From 994b5d04ed65abe2f43e1f14187c7080a2a948d4 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Mon, 15 Mar 2021 12:32:46 -0500 Subject: [PATCH] Add get game location util --- scripts/server/utilities.js | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/scripts/server/utilities.js b/scripts/server/utilities.js index b7967d2d..454990d4 100644 --- a/scripts/server/utilities.js +++ b/scripts/server/utilities.js @@ -1554,6 +1554,23 @@ function getBusinessFromParams(params) { // --------------------------------------------------------------------------- +function getGameLocationFromParams(params) { + if(isNaN(params)) { + for(let i in getGameData().locations) { + if(toLowerCase(getGameData().locations[i][0]).indexOf(toLowerCase(params)) != -1) { + return i; + } + } + } else { + if(typeof getGameData().locations[params] != "undefined") { + return toInteger(params); + } + } + return false; +} + +// --------------------------------------------------------------------------- + function getHouseFromParams(params) { if(isNaN(params)) { for(let i in getServerData().houses) { @@ -1919,4 +1936,12 @@ function generateRandomString(length) { result += characters.charAt(Math.floor(Math.random() * charactersLength)); } return result; -} \ No newline at end of file +} + +// --------------------------------------------------------------------------- + +function getTimeDisplayUntilPlayerPayDay(client) { + return getTimeDifferenceDisplay(sdl.ticks-getPlayerData(client).payDayTickStart); +} + +// --------------------------------------------------------------------------- \ No newline at end of file