Server settings
This commit is contained in:
@@ -106,7 +106,7 @@ function toggleAccountGUICommand(command, params, client) {
|
|||||||
|
|
||||||
if(!isPlayerLoggedIn(client)) {
|
if(!isPlayerLoggedIn(client)) {
|
||||||
if(getPlayerData().accountData.databaseId != 0) {
|
if(getPlayerData().accountData.databaseId != 0) {
|
||||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerLoginGUI(client);
|
showPlayerLoginGUI(client);
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI`);
|
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI`);
|
||||||
} else {
|
} else {
|
||||||
@@ -115,7 +115,7 @@ function toggleAccountGUICommand(command, params, client) {
|
|||||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled)`);
|
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled)`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerRegistrationGUI(client);
|
showPlayerRegistrationGUI(client);
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
|
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
|
||||||
} else {
|
} else {
|
||||||
@@ -566,8 +566,24 @@ function loginSuccess(client) {
|
|||||||
client.administrator = true;
|
client.administrator = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("Testing"))) {
|
||||||
|
if(!hasBitFlag(getPlayerData(client).accountData.flags.moderation, getModerationFlagValue("IsTester"))) {
|
||||||
|
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
|
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the error GUI (not a tester).`);
|
||||||
|
showPlayerErrorGUI(client, getLocaleString(client, "NotATester"), getLocaleString(client, "AccessDenied"));
|
||||||
|
} else {
|
||||||
|
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled).`);
|
||||||
|
messagePlayerError(client, getLocaleString(client, "NotATester"));
|
||||||
|
}
|
||||||
|
setTimeout(function() {
|
||||||
|
client.disconnect();
|
||||||
|
}, 3500);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(getPlayerData(client).subAccounts.length == 0) {
|
if(getPlayerData(client).subAccounts.length == 0) {
|
||||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerPromptGUI(client, `You have no characters. Would you like to make one?`, "No characters");
|
showPlayerPromptGUI(client, `You have no characters. Would you like to make one?`, "No characters");
|
||||||
getPlayerData(client).promptType = VRR_PROMPT_CREATEFIRSTCHAR;
|
getPlayerData(client).promptType = VRR_PROMPT_CREATEFIRSTCHAR;
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters prompt GUI`);
|
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters prompt GUI`);
|
||||||
@@ -760,7 +776,7 @@ function checkLogin(client, password) {
|
|||||||
|
|
||||||
if(isPlayerLoggedIn(client)) {
|
if(isPlayerLoggedIn(client)) {
|
||||||
logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is already logged in`);
|
logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is already logged in`);
|
||||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerLoginSuccessGUI(client);
|
showPlayerLoginSuccessGUI(client);
|
||||||
} else {
|
} else {
|
||||||
messagePlayerError(client, "You are already logged in!");
|
messagePlayerError(client, "You are already logged in!");
|
||||||
@@ -771,7 +787,7 @@ function checkLogin(client, password) {
|
|||||||
|
|
||||||
if(!isPlayerRegistered(client)) {
|
if(!isPlayerRegistered(client)) {
|
||||||
logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is not registered`);
|
logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is not registered`);
|
||||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerRegistrationGUI(client);
|
showPlayerRegistrationGUI(client);
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
|
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
|
||||||
} else {
|
} else {
|
||||||
@@ -783,7 +799,7 @@ function checkLogin(client, password) {
|
|||||||
|
|
||||||
if(areParamsEmpty(password)) {
|
if(areParamsEmpty(password)) {
|
||||||
logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (empty password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
|
logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (empty password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
|
||||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerLoginFailedGUI(client, `Invalid password! ${getPlayerData(client).loginAttemptsRemaining} tries remaining.`);
|
showPlayerLoginFailedGUI(client, `Invalid password! ${getPlayerData(client).loginAttemptsRemaining} tries remaining.`);
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
||||||
} else {
|
} else {
|
||||||
@@ -799,7 +815,7 @@ function checkLogin(client, password) {
|
|||||||
|
|
||||||
if(!isAccountPasswordCorrect(getPlayerData(client).accountData, hashAccountPassword(getPlayerName(client), password))) {
|
if(!isAccountPasswordCorrect(getPlayerData(client).accountData, hashAccountPassword(getPlayerName(client), password))) {
|
||||||
logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (wrong password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
|
logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (wrong password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
|
||||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerLoginFailedGUI(client, `Invalid password! ${getPlayerData(client).loginAttemptsRemaining} tries remaining.`);
|
showPlayerLoginFailedGUI(client, `Invalid password! ${getPlayerData(client).loginAttemptsRemaining} tries remaining.`);
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
||||||
} else {
|
} else {
|
||||||
@@ -819,7 +835,7 @@ function checkLogin(client, password) {
|
|||||||
// return true;
|
// return true;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerLoginSuccessGUI(client);
|
showPlayerLoginSuccessGUI(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -836,7 +852,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
|||||||
logToConsole(LOG_DEBUG, `[VRR.Account]: Checking registration for ${getPlayerName(client)}`);
|
logToConsole(LOG_DEBUG, `[VRR.Account]: Checking registration for ${getPlayerName(client)}`);
|
||||||
|
|
||||||
if(isPlayerRegistered(client)) {
|
if(isPlayerRegistered(client)) {
|
||||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerLoginGUI(client);
|
showPlayerLoginGUI(client);
|
||||||
} else {
|
} else {
|
||||||
messagePlayerError(client, getLocaleString(client, "AlreadyRegistered"));
|
messagePlayerError(client, getLocaleString(client, "AlreadyRegistered"));
|
||||||
@@ -846,7 +862,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(isPlayerLoggedIn(client)) {
|
if(isPlayerLoggedIn(client)) {
|
||||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerLoginSuccessGUI(client);
|
showPlayerLoginSuccessGUI(client);
|
||||||
} else {
|
} else {
|
||||||
messagePlayerError(client, getLocaleString(client, "AlreadyLoggedIn"));
|
messagePlayerError(client, getLocaleString(client, "AlreadyLoggedIn"));
|
||||||
@@ -856,7 +872,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(areParamsEmpty(password)) {
|
if(areParamsEmpty(password)) {
|
||||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedNoPassword"));
|
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedNoPassword"));
|
||||||
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (password is blank)`);
|
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (password is blank)`);
|
||||||
} else {
|
} else {
|
||||||
@@ -866,7 +882,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
if(areParamsEmpty(confirmPassword)) {
|
if(areParamsEmpty(confirmPassword)) {
|
||||||
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedNoPasswordConfirm"));
|
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedNoPasswordConfirm"));
|
||||||
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (password confirm is blank)`);
|
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (password confirm is blank)`);
|
||||||
@@ -874,7 +890,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
if(areParamsEmpty(emailAddress)) {
|
if(areParamsEmpty(emailAddress)) {
|
||||||
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedNoEmail"));
|
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedNoEmail"));
|
||||||
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (email address is blank)`);
|
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (email address is blank)`);
|
||||||
@@ -882,7 +898,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
if(password != confirmPassword) {
|
if(password != confirmPassword) {
|
||||||
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedPasswordMismatch"));
|
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedPasswordMismatch"));
|
||||||
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (password and confirm don't match)`);
|
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (password and confirm don't match)`);
|
||||||
@@ -891,7 +907,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!doesPasswordMeetRequirements(password)) {
|
if(!doesPasswordMeetRequirements(password)) {
|
||||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
// Work on this later. Function should return true by default anyway for now.
|
// Work on this later. Function should return true by default anyway for now.
|
||||||
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedNoPasswordWeak"));
|
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedNoPasswordWeak"));
|
||||||
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (password doesn't meet requirements)`);
|
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (password doesn't meet requirements)`);
|
||||||
@@ -901,7 +917,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
if(!isValidEmailAddress(emailAddress)) {
|
if(!isValidEmailAddress(emailAddress)) {
|
||||||
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedInvalidEmail"));
|
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedInvalidEmail"));
|
||||||
return false
|
return false
|
||||||
@@ -910,7 +926,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
|||||||
|
|
||||||
let accountData = createAccount(getPlayerName(client), password, emailAddress);
|
let accountData = createAccount(getPlayerName(client), password, emailAddress);
|
||||||
if(!accountData) {
|
if(!accountData) {
|
||||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedCreateError"));
|
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedCreateError"));
|
||||||
} else {
|
} else {
|
||||||
messagePlayerAlert(client, getLocaleString(client, "RegistrationFailedCreateError"));
|
messagePlayerAlert(client, getLocaleString(client, "RegistrationFailedCreateError"));
|
||||||
@@ -929,7 +945,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
|||||||
}
|
}
|
||||||
messagePlayerAlert(client, getLocaleString(client, "RegistrationCreateCharReminder"));
|
messagePlayerAlert(client, getLocaleString(client, "RegistrationCreateCharReminder"));
|
||||||
|
|
||||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerRegistrationSuccessGUI(client);
|
showPlayerRegistrationSuccessGUI(client);
|
||||||
showPlayerPromptGUI(client, getLocaleString(client, "NoCharactersMessage"), getLocaleString(client, "NoCharactersWindowTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
|
showPlayerPromptGUI(client, getLocaleString(client, "NoCharactersMessage"), getLocaleString(client, "NoCharactersWindowTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
|
||||||
getPlayerData(client).promptType = VRR_PROMPT_CREATEFIRSTCHAR;
|
getPlayerData(client).promptType = VRR_PROMPT_CREATEFIRSTCHAR;
|
||||||
@@ -1084,6 +1100,12 @@ function initClient(client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(client.getData("vrr.isInitialized") != null || client.getData("vrr.isInitialized") == true) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
client.setData("vrr.isInitialized", true, false);
|
||||||
|
|
||||||
sendPlayerGUIColours(client);
|
sendPlayerGUIColours(client);
|
||||||
sendPlayerGUIInit(client);
|
sendPlayerGUIInit(client);
|
||||||
updatePlayerSnowState(client);
|
updatePlayerSnowState(client);
|
||||||
@@ -1109,7 +1131,7 @@ function initClient(client) {
|
|||||||
messagePlayerAlert(client, getLocaleString(client, "AutoLoggedInIP"));
|
messagePlayerAlert(client, getLocaleString(client, "AutoLoggedInIP"));
|
||||||
loginSuccess(client);
|
loginSuccess(client);
|
||||||
} else {
|
} else {
|
||||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI.`);
|
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI.`);
|
||||||
showPlayerLoginGUI(client);
|
showPlayerLoginGUI(client);
|
||||||
} else {
|
} else {
|
||||||
@@ -1119,7 +1141,7 @@ function initClient(client) {
|
|||||||
playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
|
playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI.`);
|
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI.`);
|
||||||
showPlayerRegistrationGUI(client);
|
showPlayerRegistrationGUI(client);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -163,7 +163,6 @@ function saveServerConfigToDatabase() {
|
|||||||
if(dbConnection) {
|
if(dbConnection) {
|
||||||
let data = [
|
let data = [
|
||||||
["svr_settings", toInteger(getServerConfig().settings)],
|
["svr_settings", toInteger(getServerConfig().settings)],
|
||||||
["svr_gui", boolToInt(hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("GUI")))],
|
|
||||||
["svr_start_time_hour", getServerConfig().hour],
|
["svr_start_time_hour", getServerConfig().hour],
|
||||||
["svr_start_time_min", getServerConfig().minute],
|
["svr_start_time_min", getServerConfig().minute],
|
||||||
["svr_start_weather", getServerConfig().weather],
|
["svr_start_weather", getServerConfig().weather],
|
||||||
@@ -492,10 +491,14 @@ function toggleServerLogoCommand(command, params, client) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function toggleServerBusinessBlipsCommand(command, params, client) {
|
function toggleServerBusinessBlipsCommand(command, params, client) {
|
||||||
getServerConfig().createBusinessBlips = !getServerConfig().createBusinessBlips;
|
if(doesServerHaveBusinessBlipsEnabled()) {
|
||||||
|
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("BusinessBlips"));
|
||||||
|
} else {
|
||||||
|
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("BusinessBlips"));
|
||||||
|
}
|
||||||
getServerConfig().needsSaved = true;
|
getServerConfig().needsSaved = true;
|
||||||
|
|
||||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(getServerConfig().createBusinessBlips)}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessBlips))} {MAINCOLOUR}all business blips`);
|
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveBusinessBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessBlips))} {MAINCOLOUR}all business blips`);
|
||||||
resetAllBusinessBlips();
|
resetAllBusinessBlips();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -512,10 +515,14 @@ function toggleServerLogoCommand(command, params, client) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function toggleServerBusinessPickupsCommand(command, params, client) {
|
function toggleServerBusinessPickupsCommand(command, params, client) {
|
||||||
getServerConfig().createBusinessPickups = !getServerConfig().createBusinessPickups;
|
if(doesServerHaveBusinessPickupsEnabled()) {
|
||||||
|
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("BusinessPickups"));
|
||||||
|
} else {
|
||||||
|
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("BusinessPickups"));
|
||||||
|
}
|
||||||
getServerConfig().needsSaved = true;
|
getServerConfig().needsSaved = true;
|
||||||
|
|
||||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(getServerConfig().createBusinessPickups)}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessPickups))} {MAINCOLOUR}all business pickups`);
|
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveBusinessPickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessPickups))} {MAINCOLOUR}all business pickups`);
|
||||||
resetAllBusinessPickups();
|
resetAllBusinessPickups();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -532,10 +539,14 @@ function toggleServerLogoCommand(command, params, client) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function toggleServerHouseBlipsCommand(command, params, client) {
|
function toggleServerHouseBlipsCommand(command, params, client) {
|
||||||
getServerConfig().createHouseBlips = !getServerConfig().createHouseBlips;
|
if(doesServerHaveHouseBlipsEnabled()) {
|
||||||
|
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("HousePickups"));
|
||||||
|
} else {
|
||||||
|
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("HouseBlips"));
|
||||||
|
}
|
||||||
getServerConfig().needsSaved = true;
|
getServerConfig().needsSaved = true;
|
||||||
|
|
||||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(getServerConfig().createHouseBlips)}${toUpperCase(getOnOffFromBool(getServerConfig().createHouseBlips))} {MAINCOLOUR}all house blips`);
|
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveHouseBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createHouseBlips))} {MAINCOLOUR}all house blips`);
|
||||||
resetAllHouseBlips();
|
resetAllHouseBlips();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -552,10 +563,14 @@ function toggleServerLogoCommand(command, params, client) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function toggleServerHousePickupsCommand(command, params, client) {
|
function toggleServerHousePickupsCommand(command, params, client) {
|
||||||
getServerConfig().createHousePickups = !getServerConfig().createHousePickups;
|
if(doesServerHaveHousePickupsEnabled()) {
|
||||||
|
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("HousePickups"));
|
||||||
|
} else {
|
||||||
|
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("HousePickups"));
|
||||||
|
}
|
||||||
getServerConfig().needsSaved = true;
|
getServerConfig().needsSaved = true;
|
||||||
|
|
||||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(getServerConfig().createHousePickups)}${toUpperCase(getOnOffFromBool(getServerConfig().createHousePickups))} {MAINCOLOUR}all house pickups`);
|
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveHousePickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createHousePickups))} {MAINCOLOUR}all house pickups`);
|
||||||
resetAllHousePickups();
|
resetAllHousePickups();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -572,10 +587,15 @@ function toggleServerLogoCommand(command, params, client) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function toggleServerGUICommand(command, params, client) {
|
function toggleServerGUICommand(command, params, client) {
|
||||||
getServerConfig().useGUI = !getServerConfig().useGUI;
|
if(doesServerHaveGUIEnabled()) {
|
||||||
|
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("GUI"));
|
||||||
|
} else {
|
||||||
|
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("GUI"));
|
||||||
|
}
|
||||||
|
|
||||||
getServerConfig().needsSaved = true;
|
getServerConfig().needsSaved = true;
|
||||||
|
|
||||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned GUI ${toLowerCase(getOnOffFromBool(getServerConfig().useGUI))} for this server`);
|
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned GUI ${toLowerCase(getOnOffFromBool(doesServerHaveGUIEnabled()))} for this server`);
|
||||||
updateServerRules();
|
updateServerRules();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -592,10 +612,15 @@ function toggleServerGUICommand(command, params, client) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function toggleServerUseRealWorldTimeCommand(command, params, client) {
|
function toggleServerUseRealWorldTimeCommand(command, params, client) {
|
||||||
getServerConfig().useRealTime = !getServerConfig().useRealTime;
|
if(doesServerHaveRealTimeEnabled()) {
|
||||||
|
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("RealTime"));
|
||||||
|
} else {
|
||||||
|
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("RealTime"));
|
||||||
|
}
|
||||||
|
|
||||||
getServerConfig().needsSaved = true;
|
getServerConfig().needsSaved = true;
|
||||||
|
|
||||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned real-world time ${toLowerCase(getOnOffFromBool(getServerConfig().useRealTime))} for this server (GMT ${addPositiveNegativeSymbol(getServerConfig().realTimeZone)})`);
|
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned real-world time ${toLowerCase(getOnOffFromBool(doesServerHaveRealTimeEnabled()))} for this server (GMT ${addPositiveNegativeSymbol(getServerConfig().realTimeZone)})`);
|
||||||
updateServerGameTime();
|
updateServerGameTime();
|
||||||
updateServerRules();
|
updateServerRules();
|
||||||
return true;
|
return true;
|
||||||
@@ -725,4 +750,58 @@ function loadAccentConfig() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function doesServerHaveGUIEnabled() {
|
||||||
|
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("GUI"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function doesServerHaveTesterOnlyEnabled() {
|
||||||
|
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("Testing"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function doesServerHaveRealTimeEnabled() {
|
||||||
|
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("RealTime"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function doesServerHaveBusinessPickupsEnabled() {
|
||||||
|
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("BusinessPickups"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function doesServerHaveHousePickupsEnabled() {
|
||||||
|
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("HousePickups"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function doesServerHaveJobPickupsEnabled() {
|
||||||
|
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("JobPickups"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function doesServerHaveBusinesBlipsEnabled() {
|
||||||
|
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("BusinessBlips"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function doesServerHaveHouseBlipsEnabled() {
|
||||||
|
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("HouseBlips"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function doesServerHaveJobBlipsEnabled() {
|
||||||
|
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("JobBlips"));
|
||||||
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -99,7 +99,7 @@ function playerPromptAnswerYes(client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function canPlayerUseGUI(client) {
|
function canPlayerUseGUI(client) {
|
||||||
return (getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client));
|
return (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -429,6 +429,4 @@ function kickAllClients() {
|
|||||||
getClients().forEach((client) => {
|
getClients().forEach((client) => {
|
||||||
client.disconnect();
|
client.disconnect();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
Reference in New Issue
Block a user