diff --git a/ND_CharacterSelection/source/ui/script.js b/ND_CharacterSelection/source/ui/script.js index 150d20d..bb78e56 100644 --- a/ND_CharacterSelection/source/ui/script.js +++ b/ND_CharacterSelection/source/ui/script.js @@ -1,14 +1,8 @@ $(function() { - let displayOn = true - - // Hide/show ui function function display(bool) { if (bool) { - displayOn = true; $("body").show(); - Money(false) } else { - displayOn = false; $("body").hide(); } } @@ -52,32 +46,12 @@ $(function() { } $("#spawnLocation").fadeOut("slow"); } - function Money(bool) { - if (bool) { - $("#money").show(); - $("body").css("background-image", "none"); - $("body").show(); - if (displayOn === false) { - $("#overlay").hide(); - } - } else { - $("#money").hide(); - $("#overlay").show(); - } - } - display(false); - characterCreatorMenu(false); - characterEditorMenu(false); - exitGameMenu(false); - confirmDeleteMenu(false); - spawnMenu(false); - Money(false); - window.addEventListener('message', function(event) { + window.addEventListener("message", function(event) { const item = event.data; if (item.type === "ui") { if (item.status) { - $('#serverName').text(item.serverName); + $("#serverName").text(item.serverName); $("body").css("background-image", "url(" + item.background + ")"); display(true); } else { @@ -85,12 +59,7 @@ $(function() { } } - $('#playerAmount').text(item.characterAmount); - - if (item.type === "character") { - characterCreatorMenu(false); - createCharacter(item.firstName, item.lastName, item.dateOfBirth, item.gender, item.twtName, item.department, item.startingCash, item.startingBank, item.id); - } + $("#playerAmount").text(item.characterAmount); if (item.type === "setSpawns") { $("#spawnMenuContainer").empty(); @@ -113,7 +82,7 @@ $(function() { if (item.type === "givePerms") { JSON.parse(item.deptRoles).forEach((dept) => { - $('.departments').append($('