diff --git a/scripts/server/accent.js b/scripts/server/accent.js index a7501c2b..db508d0e 100644 --- a/scripts/server/accent.js +++ b/scripts/server/accent.js @@ -27,11 +27,46 @@ function doesPlayerHaveAccent(client) { function getPlayerAccentInlineOutput(client) { let outputText = ""; - //if(doesPlayerHaveAccent(client)) { - // outputText = `[${getPlayerAccentText(client)}]`; - //} + if(doesPlayerHaveAccent(client)) { + outputText = `[${getPlayerAccentText(client)}] `; + } return outputText; } +// =========================================================================== + +function setAccentCommand(command, params, client) { + if(areParamsEmpty(params)) { + messagePlayerSyntax(client, getCommandSyntaxText(command)); + return false; + } + + let accentId = getAccentFromParams(params); + + if(!accentId) { + messagePlayerError(client, "Accent not found!"); + return false; + } + + let accentString = getGlobalConfig().accents[accentId]; + + getPlayerCurrentSubAccount(client).accent = accentString; + messagePlayerSuccess(client, `You set your accent to ${getInlineChatColourByName("lightGrey")}${accentString}`); +} + +// =========================================================================== + +function listAccentsCommand(command, params, client) { + let stationList = getGlobalConfig().accents; + + let chunkedList = splitArrayIntoChunks(stationList, 8); + + messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Accents ${getInlineChatColourByType("clanOrange")}==================================`); + + for(let i in chunkedList) { + messagePlayerInfo(client, chunkedList[i].join(", ")); + } +} + // =========================================================================== \ No newline at end of file