Add check for account gui setting and add logging

This commit is contained in:
Vortrex
2020-12-14 10:45:07 -06:00
parent d45578519d
commit 48e1b510ce

View File

@@ -112,17 +112,19 @@ function createSubAccount(accountId, firstName, lastName, skinId, dateOfBirth, p
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function showCharacterSelectToClient(client) { function showCharacterSelectToClient(client) {
if(getServerConfig().useGUI) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
getClientData(client).currentSubAccount = 0; getClientData(client).currentSubAccount = 0;
let tempSubAccount = getClientData(client).subAccounts[0]; let tempSubAccount = getClientData(client).subAccounts[0];
triggerNetworkEvent("ag.showCharacterSelect", client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.placeOfOrigin, tempSubAccount.dateOfBirth, tempSubAccount.skin); triggerNetworkEvent("ag.showCharacterSelect", client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.placeOfOrigin, tempSubAccount.dateOfBirth, tempSubAccount.skin);
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} is being shown the character select GUI`);
} else { } else {
//let emojiNumbers = ["➊", "➋", "➌", "➍", "➎", "➏", "➐", "➑", "➒"]; //let emojiNumbers = ["➊", "➋", "➌", "➍", "➎", "➏", "➐", "➑", "➒"];
//let emojiNumbers = ["①", "②", "③", "④", "⑤", "⑥", "⑦", "⑧", "⑨"]; //let emojiNumbers = ["①", "②", "③", "④", "⑤", "⑥", "⑦", "⑧", "⑨"];
messageClientNormal(client, `You have the following characters. Use /usechar <id> to select one:`, getColourByName("teal")); messageClientNormal(client, `You have the following characters. Use /usechar <id> to select one:`, getColourByName("teal"));
getClientData(client).subAccounts.forEach(function(subAccount, index) { getClientData(client).subAccounts.forEach(function(subAccount, index) {
messageClientNormal(client, `${index+1} • [#CCCCCC]${subAccount.firstName} ${subAccount.lastName}`); messageClientNormal(client, `${index+1} • [#AAAAAA]${subAccount.firstName} ${subAccount.lastName}`);
}); });
console.log(`[Asshat.Account] ${getClientDisplayForConsole(client)} is being shown the character select/list message (GUI disabled)`);
} }
} }
@@ -158,7 +160,7 @@ function checkNewCharacter(client, firstName, lastName, dateOfBirth, placeOfOrig
let subAccountData = createSubAccount(getClientData(client).accountData.databaseId, firstName, lastName, skinId, dateOfBirth, placeOfOrigin); let subAccountData = createSubAccount(getClientData(client).accountData.databaseId, firstName, lastName, skinId, dateOfBirth, placeOfOrigin);
if(!subAccountData) { if(!subAccountData) {
if(getServerConfig().useGUI) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
triggerNetworkEvent("ag.newCharacterFailed", client, "Something went wrong. Your character could not be created!"); triggerNetworkEvent("ag.newCharacterFailed", client, "Something went wrong. Your character could not be created!");
} else { } else {
messageClientAlert(client, "Something went wrong. Your character could not be created!"); messageClientAlert(client, "Something went wrong. Your character could not be created!");
@@ -209,7 +211,7 @@ addNetworkHandler("ag.nextCharacter", function(client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function selectCharacter(client, characterId = -1) { function selectCharacter(client, characterId = -1) {
if(getServerConfig().useGUI) { if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
triggerNetworkEvent("ag.characterSelectSuccess", client); triggerNetworkEvent("ag.characterSelectSuccess", client);
} }
@@ -225,8 +227,9 @@ function selectCharacter(client, characterId = -1) {
messageClientNormal(client, "Please report any bugs using /bug and suggestions using /idea", getColourByName("yellow")); messageClientNormal(client, "Please report any bugs using /bug and suggestions using /idea", getColourByName("yellow"));
triggerNetworkEvent("ag.restoreCamera", client); triggerNetworkEvent("ag.restoreCamera", client);
setEntityData(client, "ag.spawned", true, true); setEntityData(client, "ag.spawned", true, true);
setEntityData(client, "ag.position", tempSubAccount.spawnPosition, true); setTimeout(function() {
setEntityData(client, "ag.heading", tempSubAccount.spawnHeading, true); setEntityData(client.player, "ag.spawned", true, true);
}, client.ping+500);
} }
addNetworkHandler("ag.selectCharacter", selectCharacter); addNetworkHandler("ag.selectCharacter", selectCharacter);