Add get game location util
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function getTimeDisplayUntilPlayerPayDay(client) {
|
||||
return getTimeDifferenceDisplay(sdl.ticks-getPlayerData(client).payDayTickStart);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user