New chat stuff (emoji, timestamps, etc)

This commit is contained in:
Vortrex
2022-07-17 04:23:32 -05:00
parent 8ca7a8bdfd
commit 25543b5f07
9 changed files with 123 additions and 65 deletions

View File

@@ -298,7 +298,7 @@ function toggleAccountGUICommand(command, params, client) {
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI`);
} else {
hideAllPlayerGUI(client);
messagePlayerNormal(client, getLocaleString(client, "WelcomeBack", getServerConfig().name, getPlayerName(client), "{ALTCOLOUR}/login{MAINCOLOUR}"));
messagePlayerNormal(client, getLocaleString(client, "WelcomeBack", getServerName(), getPlayerName(client), "{ALTCOLOUR}/login{MAINCOLOUR}"));
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled)`);
}
} else {
@@ -307,7 +307,7 @@ function toggleAccountGUICommand(command, params, client) {
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
} else {
hideAllPlayerGUI(client);
messagePlayerNormal(client, getLocaleString(client, "WelcomeNewPlayer", getServerConfig().name, getPlayerName(client), "{ALTCOLOUR}/register{MAINCOLOUR}"));
messagePlayerNormal(client, getLocaleString(client, "WelcomeNewPlayer", getServerName(), getPlayerName(client), "{ALTCOLOUR}/register{MAINCOLOUR}"));
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled)`);
}
}
@@ -422,6 +422,23 @@ function toggleAccountProfanityFilterCommand(command, params, client) {
// ===========================================================================
function toggleAccountReplaceEmojiCommand(command, params, client) {
let flagValue = getAccountSettingsFlagValue("ChatEmoji");
if (hasBitFlag(getPlayerData(client).accountData.settings, flagValue)) {
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
messagePlayerSuccess(client, getLocaleString(client, "ChatEmojiSet", `{softRed}${toUpperCase(getLocaleString(client, "Off"))}{MAINCOLOUR}`));
sendPlayerChatEmojiState(client, false);
} else {
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
messagePlayerSuccess(client, getLocaleString(client, "ChatEmojiSet", `{softGreen}${toUpperCase(getLocaleString(client, "On"))}{MAINCOLOUR}`));
sendPlayerChatEmojiState(client, true);
}
return true;
}
// ===========================================================================
function toggleAccountHideBloodCommand(command, params, client) {
let flagValue = getAccountSettingsFlagValue("NoBlood");
@@ -1210,7 +1227,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
messagePlayerAlert(client, getLocaleString(client, "RegistrationFailedCreateError"));
}
messagePlayerAlert(client, `${getServerConfig().name} staff have been notified of the problem and will fix it shortly.`);
messagePlayerAlert(client, `${getServerName()} staff have been notified of the problem and will fix it shortly.`);
return false;
}
@@ -1469,7 +1486,7 @@ function initClient(client) {
showPlayerLoginGUI(client);
} else {
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled).`);
messagePlayerNormal(client, getLocaleString(client, "WelcomeBack", getServerConfig().name, getPlayerName(client), "/login"), getColourByName("softGreen"));
messagePlayerNormal(client, getLocaleString(client, "WelcomeBack", getServerName(), getPlayerName(client), "/login"), getColourByName("softGreen"));
//if(checkForGeoIPModule()) {
// let iso = module.geoip.getCountryISO(getPlayerIP(client));
@@ -1487,7 +1504,7 @@ function initClient(client) {
showPlayerRegistrationGUI(client);
} else {
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled).`);
messagePlayerNormal(client, getLocaleString(client, "WelcomeNewPlayer", getServerConfig().name, getPlayerName(client), "/register"), getColourByName("softGreen"));
messagePlayerNormal(client, getLocaleString(client, "WelcomeNewPlayer", getServerName(), getPlayerName(client), "/register"), getColourByName("softGreen"));
}
playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
}
@@ -1725,9 +1742,9 @@ function generateEmailVerificationCode() {
function sendEmailVerificationEmail(client, emailVerificationCode) {
let emailBodyText = getEmailConfig().bodyContent.confirmEmail;
emailBodyText = emailBodyText.replace("{VERIFICATIONCODE}", emailVerificationCode);
emailBodyText = emailBodyText.replace("{SERVERNAME}", getServerConfig().name);
emailBodyText = emailBodyText.replace("{SERVERNAME}", getServerName());
sendEmail(getPlayerData(client).accountData.emailAddress, getPlayerData(client).accountData.name, `Confirm email on ${getServerConfig().name}`, emailBodyText);
sendEmail(getPlayerData(client).accountData.emailAddress, getPlayerData(client).accountData.name, `Confirm email on ${getServerName()}`, emailBodyText);
}
// ===========================================================================
@@ -1735,9 +1752,9 @@ function sendEmailVerificationEmail(client, emailVerificationCode) {
function sendPasswordResetEmail(client, verificationCode) {
let emailBodyText = getEmailConfig().bodyContent.confirmPasswordReset;
emailBodyText = emailBodyText.replace("{VERIFICATIONCODE}", verificationCode);
emailBodyText = emailBodyText.replace("{SERVERNAME}", getServerConfig().name);
emailBodyText = emailBodyText.replace("{SERVERNAME}", getServerName());
sendEmail(getPlayerData(client).accountData.emailAddress, getPlayerData(client).accountData.name, `Reset your password on ${getServerConfig().name}`, emailBodyText);
sendEmail(getPlayerData(client).accountData.emailAddress, getPlayerData(client).accountData.name, `Reset your password on ${getServerName()}`, emailBodyText);
}
// ===========================================================================
@@ -1747,9 +1764,9 @@ function verifyAccountEmail(accountData, verificationCode) {
let emailBodyText = getEmailConfig().bodyContent.confirmEmail;
emailBodyText = emailBodyText.replace("{VERIFICATIONCODE}", emailVerificationCode);
emailBodyText = emailBodyText.replace("{SERVERNAME}", getServerConfig().name);
emailBodyText = emailBodyText.replace("{SERVERNAME}", getServerName());
sendEmail(getPlayerData(client).accountData.emailAddress, getPlayerData(client).accountData.name, `Confirm email on ${getServerConfig().name}`, emailBodyText);
sendEmail(getPlayerData(client).accountData.emailAddress, getPlayerData(client).accountData.name, `Confirm email on ${getServerName()}`, emailBodyText);
getPlayerData(client).accountData.emailAddress = emailAddress;
getPlayerData(client).accountData.emailVerificationCode = module.hashing.sha512(emailVerificationCode);
@@ -1766,10 +1783,10 @@ function sendAccountLoginFailedNotification(emailAddress, name, ip, game = getGa
emailBodyText = emailBodyText.replace("{GAMENAME}", getGameName(game));
emailBodyText = emailBodyText.replace("{IPADDRESS}", ip);
emailBodyText = emailBodyText.replace("{LOCATION}", `${cityName}, ${subDivisionName}, ${countryName}`);
emailBodyText = emailBodyText.replace("{SERVERNAME}", getServerConfig().name);
emailBodyText = emailBodyText.replace("{SERVERNAME}", getServerName());
emailBodyText = emailBodyText.replace("{TIMESTAMP}", new Date().toLocaleString('en-US'));
sendEmail(emailAddress, name, `Login failed on ${getServerConfig().name}`, emailBodyText);
sendEmail(emailAddress, name, `Login failed on ${getServerName()}`, emailBodyText);
return true;
}
@@ -1784,10 +1801,10 @@ function sendAccountLoginSuccessNotification(emailAddress, name, ip, game = getG
emailBodyText = emailBodyText.replace("{GAMENAME}", getGameName(game));
emailBodyText = emailBodyText.replace("{IPADDRESS}", ip);
emailBodyText = emailBodyText.replace("{LOCATION}", `${cityName}, ${subDivisionName}, ${countryName}`);
emailBodyText = emailBodyText.replace("{SERVERNAME}", getServerConfig().name);
emailBodyText = emailBodyText.replace("{SERVERNAME}", getServerName());
emailBodyText = emailBodyText.replace("{TIMESTAMP}", new Date().toLocaleString('en-US'));
sendEmail(emailAddress, name, `Login successful on ${getServerConfig().name}`, emailBodyText);
sendEmail(emailAddress, name, `Login successful on ${getServerName()}`, emailBodyText);
return true;
}
@@ -1837,9 +1854,9 @@ function sendAccountTwoFactorAuthCode(emailAddress, name, twoFactorAuthCode) {
let emailBodyText = getEmailConfig().bodyContent.twoFactorAuthentication;
emailBodyText = emailBodyText.replace("{2FACODE}", twoFactorAuthCode);
emailBodyText = emailBodyText.replace("{GAMENAME}", getGameName(getGame()));
emailBodyText = emailBodyText.replace("{SERVERNAME}", getServerConfig().name);
emailBodyText = emailBodyText.replace("{SERVERNAME}", getServerName());
sendEmail(emailAddress, name, `Login code for ${getServerConfig().name}`, emailBodyText);
sendEmail(emailAddress, name, `Login code for ${getServerName()}`, emailBodyText);
return true;
}

View File

@@ -119,9 +119,10 @@ let serverBitFlagKeys = {
"NoRandomTips",
"NoActionTips",
"ChatBoxTimestamps",
"ChatProfanityFilter",
"ProfanityFilter",
"ChatAutoHide",
"NoPlayerContent",
"ChatEmoji",
//"NoBlood",
],

View File

@@ -13,7 +13,8 @@ const AGRP_BIZ_TYPE_NONE = 0; // None (invalid)
const AGRP_BIZ_TYPE_NORMAL = 1; // Normal business (sells items)
const AGRP_BIZ_TYPE_BANK = 2; // Bank
const AGRP_BIZ_TYPE_PUBLIC = 3; // Public business (Government, public service, etc)
const AGRP_BIZ_TYPE_PAINTBALL = 4; // Paintball arena. Player joins paintball/airsoft when they enter
const AGRP_BIZ_TYPE_PAINTBALL = 4; // Paintball arena. Player joins paintball/airsoft when they enter
const AGRP_BIZ_TYPE_DEALERSHIP = 5; // Vehicle Dealership (also for airplane, boat, etc)
// ===========================================================================
@@ -846,7 +847,7 @@ function setBusinessEntranceFeeCommand(command, params, client) {
getBusinessData(businessId).entranceFee = entranceFee;
getBusinessData(businessId).needsSaved = true;
messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}entrance fee to [#AAAAAAA]$${entranceFee}`);
messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} entrance fee to [#AAAAAAA]$${entranceFee}`);
}
// ===========================================================================
@@ -873,7 +874,7 @@ function setBusinessPaintBallCommand(command, params, client) {
return false;
}
getBusinessData(businessId).entranceType = AGRP_BIZ_ENTRANCE_TYPE_PAINTBALL;
getBusinessData(businessId).type = AGRP_BIZ_TYPE_PAINTBALL;
getBusinessData(businessId).needsSaved = true;
messagePlayerSuccess(client, getLocaleString(client, "BusinessIsNowPaintBall"));
}
@@ -1305,6 +1306,7 @@ function setBusinessEntranceLabelToDealershipCommand(command, params, client) {
}
getBusinessData(businessId).labelHelpType == AGRP_PROPLABEL_INFO_ENTERVEHICLE;
getBusinessData(businessId).type = AGRP_BIZ_TYPE_VEHDEALERSHIP;
updateBusinessPickupLabelData(businessId);
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set the business type of {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} to dealership`);
}

View File

@@ -527,7 +527,8 @@ function sendPlayerRemoveFromVehicle(client) {
function sendChatBoxMessageToPlayer(client, messageText, colour) {
//messageClient(messageText, client, colour);
sendNetworkEventToPlayer("m", client, messageText, colour);
let date = new Date();
sendNetworkEventToPlayer("m", client, messageText, colour, date.getHours(), date.getMinutes(), date.getSeconds());
}
// ===========================================================================
@@ -1244,4 +1245,16 @@ function sendPlayerChatBoxTimeStampsState(client, state) {
sendNetworkEventToPlayer("agrp.chatTimeStamps", client, state);
}
// ==========================================================================
function sendPlayerChatEmojiState(client, state) {
sendNetworkEventToPlayer("agrp.chatEmoji", client, state);
}
// ==========================================================================
function sendPlayerProfanityFilterState(client, state) {
sendNetworkEventToPlayer("agrp.profanityFilter", client, state);
}
// ==========================================================================