Organize a lot of utils

This commit is contained in:
Vortrex
2022-01-09 17:19:53 -06:00
parent 2684ffae7d
commit 5dfe47a3e8
16 changed files with 905 additions and 1069 deletions

View File

@@ -67,4 +67,76 @@ function sendNetworkEventToServer(eventName, ...args) {
triggerNetworkEvent.apply(null, eventName, args); triggerNetworkEvent.apply(null, eventName, args);
} }
// ===========================================================================
function getElementId(element) {
return element.id;
}
// ===========================================================================
function getClientFromIndex(index) {
let clients = getClients();
for(let i in clients) {
if(clients[i].index == index) {
return clients[i];
}
}
}
// ===========================================================================
function getVehiclesInRange(position, distance) {
return getElementsByType(ELEMENT_VEHICLE).filter(x => x.player && x.position.distance(position) <= distance);
}
// ===========================================================================
function getClientsInRange(position, distance) {
return getPlayersInRange(position, distance);
}
// ===========================================================================
function getCiviliansInRange(position, distance) {
return getElementsByType(ELEMENT_PED).filter(x => !x.isType(ELEMENT_PLAYER) && getElementPosition(x).position.distance(position) <= distance);
}
// ===========================================================================
function getPlayersInRange(position, distance) {
return getClients().filter(x => getPlayerPosition(x).distance(position) <= distance);
}
// ===========================================================================
function getElementsByTypeInRange(elementType, position, distance) {
return getElementsByType(elementType).filter(x => getElementPosition(x).position.distance(position) <= distance);
}
// ===========================================================================
function getClosestCivilian(position) {
return getElementsByType(ELEMENT_PED).reduce((i, j) => ((i.position.distance(position) <= j.position.distance(position)) ? i : j));
}
// ===========================================================================
function is2dPositionOnScreen(pos2d) {
return pos2d.x >= 0 && pos2d.y >= 0 && pos2d.x <= game.width && pos2d.y <= game.height;
}
// ===========================================================================
function getVehiclesInRange(position, range) {
let vehicles = getElementsByType(ELEMENT_VEHICLE);
let inRangeVehicles = [];
for(let i in vehicles) {
if(getDistance(position, vehicles[i].position) <= range) {
inRangeVehicles.push(vehicles[i]);
}
}
return inRangeVehicles;
}
// =========================================================================== // ===========================================================================

View File

@@ -70,4 +70,22 @@ function listAccentsCommand(command, params, client) {
} }
} }
// ===========================================================================
function getAccentFromParams(params) {
if(isNaN(params)) {
for(let i in getGlobalConfig().accents) {
if(toLowerCase(getGlobalConfig().accents[i]).indexOf(toLowerCase(params)) != -1) {
return i;
}
}
} else {
if(typeof getGlobalConfig().accents[params] != "undefined") {
return toInteger(params);
}
}
return false;
}
// =========================================================================== // ===========================================================================

View File

@@ -75,7 +75,7 @@ function showAnimationListCommand(command, params, client) {
let chunkedList = splitArrayIntoChunks(animList, 10); let chunkedList = splitArrayIntoChunks(animList, 10);
messagePlayerInfo(client, makeChatSectionHeader(getLocaleString(client, "HeaderAnimationsList"))); messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderAnimationsList")));
for(let i in chunkedList) { for(let i in chunkedList) {
messagePlayerNormal(client, chunkedList[i].join(", ")); messagePlayerNormal(client, chunkedList[i].join(", "));
@@ -138,4 +138,22 @@ function makePlayerStopAnimation(client) {
getPlayerData(client).animationForced = false; getPlayerData(client).animationForced = false;
} }
// ===========================================================================
function getAnimationFromParams(params) {
if(isNaN(params)) {
for(let i in getGameData().animations[getServerGame()]) {
if(toLowerCase(getGameData().animations[getServerGame()][i][0]).indexOf(toLowerCase(params)) != -1) {
return i;
}
}
} else {
if(typeof getGameData().animations[getServerGame()][params] != "undefined") {
return toInteger(params);
}
}
return false;
}
// =========================================================================== // ===========================================================================

View File

@@ -248,4 +248,44 @@ function isPlayerExemptFromAntiCheat(client) {
return false; return false;
} }
// ===========================================================================
function canPlayerUsePoliceJob(client) {
if(getPlayerData(client).accountData.flags.moderation & getServerBitFlags().moderationFlags.policeBanned) {
return false;
}
return true;
}
// ===========================================================================
function canClientUseFireJob(client) {
if(getPlayerData(client).accountData.flags.moderation & getServerBitFlags().moderationFlags.fireBanned) {
return false;
}
return true;
}
// ===========================================================================
function canClientUseAmmunations(client) {
if(getPlayerData(client).accountData.flags.moderation & getServerBitFlags().moderationFlags.AmmuBanned) {
return false;
}
return true;
}
// ===========================================================================
function canClientUseGuns(client) {
if(getPlayerData(client).accountData.flags.moderation & getServerBitFlags().moderationFlags.GunBanned) {
return false;
}
return true;
}
// =========================================================================== // ===========================================================================

View File

@@ -517,7 +517,7 @@ function lockUnlockBusinessCommand(command, params, client) {
setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.locked", getBusinessData(businessId).locked, true); setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.locked", getBusinessData(businessId).locked, true);
getBusinessData(businessId).needsSaved = true; getBusinessData(businessId).needsSaved = true;
messagePlayerSuccess(client, `${getLockedUnlockedEmojiFromBool((getBusinessData(businessId).locked))} Business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}${getLockedUnlockedTextFromBool((getBusinessData(businessId).locked))}!`); messagePlayerSuccess(client, `${getLockedUnlockedEmojiFromBool((getBusinessData(businessId).locked))} Business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}${getLockedUnlockedFromBool((getBusinessData(businessId).locked))}!`);
} }
// =========================================================================== // ===========================================================================
@@ -2126,3 +2126,20 @@ function deleteBusinessPickups(business) {
// =========================================================================== // ===========================================================================
function getBusinessFromParams(params) {
if(isNaN(params)) {
for(let i in getServerData().businesses) {
if(toLowerCase(getServerData().businesses[i].name).indexOf(toLowerCase(params)) != -1) {
return i;
}
}
} else {
if(typeof getServerData().businesses[params] != "undefined") {
return toInteger(params);
}
}
return false;
}
// ===========================================================================

View File

@@ -1215,4 +1215,42 @@ function showClanFlagListCommand(command, params, client) {
messagePlayerInfo(client, chunkedList[i].join(", ")); messagePlayerInfo(client, chunkedList[i].join(", "));
} }
} }
*/ */
function getClanFromParams(params) {
if(isNaN(params)) {
for(let i in getServerData().clans) {
if(toLowerCase(getServerData().clans[i].name).indexOf(toLowerCase(params)) != -1) {
return i;
}
}
} else {
if(typeof getServerData().clans[params] != "undefined") {
return toInteger(params);
}
}
return false;
}
// ===========================================================================
function getClanRankFromParams(clanId, params) {
if(isNaN(params)) {
for(let i in getClanData(clanId).ranks) {
if((toLowerCase(getClanData(clanId).ranks[i].name).indexOf(toLowerCase(params)) != -1)) {
return i;
}
}
} else {
for(let i in getClanData(clanId).ranks) {
if(getClanData(clanId).ranks[i].level == toInteger(params)) {
return i;
}
}
}
return false;
}
// ===========================================================================

View File

@@ -765,4 +765,46 @@ function getCommandAliasesNames(command) {
return commandAliases; return commandAliases;
} }
// ===========================================================================
function areParamsEmpty(params) {
if(!params || params == "" || params.length == 0 || typeof params == "undefined") {
return true;
}
return false;
}
// ===========================================================================
function getParamsCount(params, delimiter = " ") {
return params.split(delimiter).length;
}
// ===========================================================================
function areThereEnoughParams(params, requiredAmount, delimiter = " ") {
return (params.split(delimiter).length >= requiredAmount);
}
// ===========================================================================
function getParam(params, delimiter, index) {
return params.split(delimiter)[index];
}
// ===========================================================================
function getCommandFromParams(params) {
for(let i in serverCommands) {
for(let j in serverCommands[i]) {
if(toLowerCase(serverCommands[i][j].command).indexOf(toLowerCase(params)) != -1) {
return serverCommands[i][j];
}
}
}
return false;
}
// =========================================================================== // ===========================================================================

View File

@@ -125,7 +125,7 @@ function lockUnlockHouseCommand(command, params, client) {
setEntityData(getHouseData(houseId).entrancePickup, "vrr.label.locked", getHouseData(houseId).locked, true); setEntityData(getHouseData(houseId).entrancePickup, "vrr.label.locked", getHouseData(houseId).locked, true);
getHouseData(houseId).needsSaved = true; getHouseData(houseId).needsSaved = true;
messagePlayerSuccess(client, `House {houseGreen}${getHouseData(houseId).description} {MAINCOLOUR}${getLockedUnlockedTextFromBool((getHouseData(houseId).locked))}!`); messagePlayerSuccess(client, `House {houseGreen}${getHouseData(houseId).description} {MAINCOLOUR}${getLockedUnlockedFromBool((getHouseData(houseId).locked))}!`);
} }
// =========================================================================== // ===========================================================================
@@ -1380,4 +1380,21 @@ function canPlayerManageHouse(client, houseId) {
return false; return false;
} }
// ===========================================================================
function getHouseFromParams(params) {
if(isNaN(params)) {
for(let i in getServerData().houses) {
if(toLowerCase(getServerData().houses[i].description).indexOf(toLowerCase(params)) != -1) {
return i;
}
}
} else {
if(typeof getServerData().houses[params] != "undefined") {
return toInteger(params);
}
}
return false;
}
// =========================================================================== // ===========================================================================

View File

@@ -2020,4 +2020,23 @@ function createGroundPlant(itemId) {
groundPlantCache.push(itemId); groundPlantCache.push(itemId);
groundItemCache.push(itemId); groundItemCache.push(itemId);
} }
// ===========================================================================
function getItemTypeFromParams(params) {
if(isNaN(params)) {
for(let i in getServerData().itemTypes) {
if(toLowerCase(getServerData().itemTypes[i].name).indexOf(toLowerCase(params)) != -1) {
return i;
}
}
} else {
if(typeof getServerData().itemTypes[params] != "undefined") {
return toInteger(params);
}
}
return false;
}
// ===========================================================================

View File

@@ -2083,4 +2083,44 @@ function setAllJobIndexes() {
} }
} }
} }
} }
// ===========================================================================
function getJobFromParams(params) {
if(isNaN(params)) {
for(let i in getServerData().jobs) {
if(toLowerCase(getServerData().jobs[i].name).indexOf(toLowerCase(params)) != -1) {
return i;
}
}
} else {
if(typeof getServerData().jobs[params] != "undefined") {
return params;
}
}
return false;
}
// ===========================================================================
function getClosestJobLocation(position) {
let closestJobLocation = false;
for(let i in getServerData().jobs) {
for(let j in getServerData().jobs[i].locations) {
if(!closestJobLocation || getServerData().jobs[i].locations[j].position.distance(position) < closestJobLocation.position.distance(position)) {
closestJobLocation = getServerData().jobs[i].locations[j];
}
}
}
return closestJobLocation;
}
// ===========================================================================
function getJobPointsInRange(position, distance) {
return getServerData().jobs[getServerGame()].filter(x => x.position.distance(position) <= distance);
}
// ===========================================================================

View File

@@ -68,4 +68,19 @@ function getLocaleStrings() {
return getServerData().localeStrings; return getServerData().localeStrings;
} }
// ===========================================================================
function getLocaleNameFromParams(params) {
let locales = getLocales();
if(isNaN(params)) {
for(let i in locales) {
if(toLowerCase(i).indexOf(toLowerCase(params)) != -1) {
return locales[i];
}
}
}
return false;
}
// =========================================================================== // ===========================================================================

View File

@@ -211,4 +211,32 @@ function messagePlayerTimedRandomTip(client, message) {
} }
} }
// ===========================================================================
function makeChatBoxSectionHeader(name) {
let resultString = `== ${name} `;
let endFiller = fillStringWithCharacter("=", getGlobalConfig().chatSectionHeaderLength-resultString.length);
return `${resultString} ${endFiller}`;
}
// ===========================================================================
function clearChatBox(client) {
//game.messages.clear();
for(let i = 0; i <= 20; i++) {
messageClient(" ", client, COLOUR_WHITE);
}
}
// ===========================================================================
function replaceEmojiIntoString(message) {
for(let i in emojiReplaceString) {
while(message.indexOf(emojiReplaceString[i][0]) != -1) {
message = message.replace(emojiReplaceString[i][0], emojiReplaceString[i][1]);
}
}
return message;
}
// =========================================================================== // ===========================================================================

View File

@@ -898,4 +898,69 @@ function addNetworkEventHandler(eventName, handlerFunction) {
addNetworkHandler(eventName, handlerFunction); addNetworkHandler(eventName, handlerFunction);
} }
// ===========================================================================
function getElementId(element) {
return element.id;
}
// ===========================================================================
function getClientFromIndex(index) {
let clients = getClients();
for(let i in clients) {
if(clients[i].index == index) {
return clients[i];
}
}
}
// ===========================================================================
function getClientsInRange(position, distance) {
return getPlayersInRange(position, distance);
}
// ===========================================================================
function getCiviliansInRange(position, distance) {
return getElementsByTypeInRange(ELEMENT_PED, position, distance).filter(x => !x.isType(ELEMENT_PLAYER));
}
// ===========================================================================
function getPlayersInRange(position, distance) {
return getClients().filter(x => getDistance(position, getPlayerPosition(x)) <= distance);
}
// ===========================================================================
function getElementsByTypeInRange(elementType, position, distance) {
return getElementsByType(elementType).filter(x => getDistance(position, getElementPosition(x)) <= distance);
}
// ===========================================================================
function getClosestCivilian(position) {
return getClosestElementByType(ELEMENT_PED, position).filter(ped => !ped.isType(ELEMENT_PLAYER));
}
// ===========================================================================
function getVehiclesInRange(position, range) {
return getElementsByTypeInRange(ELEMENT_VEHICLE, position, range);
}
// ===========================================================================
function getClosestVehicle(position) {
return getClosestElementByType(ELEMENT_VEHICLE, position);
}
// ===========================================================================
function getClosestElementByType(elementType, position) {
return getElementsByType(elementType).reduce((i, j) => (getDistance(position, getElementPosition(i)) <= getDistance(position, getElementPosition(j))) ? i : j);
}
// =========================================================================== // ===========================================================================

File diff suppressed because it is too large Load Diff

View File

@@ -1496,4 +1496,10 @@ function getClosestTaxi(position) {
.reduce((i, j) => ((i.position.distance(position) <= j.position.distance(position)) ? i : j)); .reduce((i, j) => ((i.position.distance(position) <= j.position.distance(position)) ? i : j));
} }
// ===========================================================================
function getVehicleTrunkPosition(vehicle) {
return getPosBehindPos(getVehiclePosition(vehicle), getVehicleHeading(vehicle), getGlobalConfig().vehicleTrunkRearDistance);
}
// =========================================================================== // ===========================================================================

View File

@@ -127,6 +127,49 @@ let bindableKeys = {
// =========================================================================== // ===========================================================================
let weekDays = [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
];
// ===========================================================================
let months = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
];
// ===========================================================================
let cardinalDirections = [
"North",
"Northeast",
"East",
"Southeast",
"South",
"Southwest",
"West",
"Northwest",
"Unknown"
];
// ===========================================================================
function makeLargeNumberReadable(num) { function makeLargeNumberReadable(num) {
return new Number(num).toLocaleString("en-US"); return new Number(num).toLocaleString("en-US");
} }
@@ -877,4 +920,425 @@ function boolToInt(boolVal) {
return (boolVal) ? 1 : 0; return (boolVal) ? 1 : 0;
} }
// ===========================================================================
function fixAngle(angle) {
angle = radToDeg(angle);
if(angle < 0)
{
angle = Math.abs(angle);
angle = ((180-angle+1)+180);
}
return degToRad(angle);
}
// ===========================================================================
function addPositiveNegativeSymbol(value) {
return (value >= 0) ? `+${value}` : `${value}`;
}
// ===========================================================================
function arrayBufferToString(arrayBuffer) {
return String.fromCharCode.apply(null, new Uint8Array(arrayBuffer));
}
// ===========================================================================
function vec3ToVec2(pos) {
return toVector2(pos[0], pos[1]);
}
// ===========================================================================
function vec2ToVec3(pos, z) {
return toVector3(pos[0], pos[1], z);
}
// ===========================================================================
function degToRad(deg) {
return deg * Math.PI / 180;
}
// ===========================================================================
function radToDeg(rad) {
return rad * 180 / Math.PI;
}
// ===========================================================================
function getHeadingFromPosToPos(pos1, pos2) {
let x = pos2.x-pos1.x;
let y = pos2.y-pos1.y;
let rad = Math.atan2(y, x);
let deg = radToDeg(rad);
deg -= 90;
deg = deg % 360;
return degToRad(deg);
}
// ===========================================================================
function getAngleInCircleFromCenter(center, total, current) {
let gap = 360 / total;
let deg = Math.floor(gap*current);
if(deg <= 0) {
deg = 1;
} else {
if(deg >= 360) {
deg = 359;
}
}
return degToRad(deg);
}
// ===========================================================================
function getArrayOfElementId(elements) {
let tempArray = [];
for(let i in elements) {
tempArray.push(elements[i].id);
}
return tempArray;
}
// ===========================================================================
function getCurrentUnixTimestamp() {
return new Date().getTime()/1000;
}
// ===========================================================================
function msToTime(duration) {
let milliseconds = Math.floor(toInteger((duration % 1000) / 100));
let seconds = Math.floor(toInteger((duration / 1000) % 60));
let minutes = Math.floor(toInteger((duration / (1000 * 60)) % 60));
let hours = Math.floor(toInteger((duration / (1000 * 60 * 60)) % 24));
let days = Math.floor(toInteger((duration / (1000 * 60 * 60 * 24)) % 365));
//hours = (hours < 10) ? "0" + hours : hours;
//minutes = (minutes < 10) ? "0" + minutes : minutes;
//seconds = (seconds < 10) ? "0" + seconds : seconds;
if (days !== 0) {
return `${days} days, ${hours} hours, ${minutes} minutes`;
} else {
return `${hours} hours, ${minutes} minutes`;
}
}
// ===========================================================================
function generateRandomString(length, characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
var result = '';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
// ===========================================================================
function doesWordStartWithVowel(word) {
switch(word.substr(0,1).toLowerCase()) {
case "a":
case "e":
case "i":
case "o":
case "u":
return true;
default:
return false;
}
return false;
}
// ===========================================================================
function getProperDeterminerForName(word) {
switch(word.substr(0,1).toLowerCase()) {
case "a":
case "e":
case "i":
case "o":
return "an";
default:
return "a";
}
}
// ===========================================================================
function getPluralForm(name) {
return name;
}
// ===========================================================================
function removeHexColoursFromString(str) {
let matchRegex = /#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})\b/gi;
let matchedHexes = str.match(matchRegex);
for(let i in matchHex) {
str.replace(matchedHexes, `{${i}}`);
}
return [str, matchedHexes];
}
// ===========================================================================
async function waitUntil(condition) {
return new Promise((resolve) => {
let interval = setInterval(() => {
if (!condition()) {
return
}
clearInterval(interval);
resolve();
}, 1);
});
}
// ===========================================================================
function getGameLocationFromParams(params) {
if(isNaN(params)) {
for(let i in getGameData().locations[getServerGame()]) {
if(toLowerCase(getGameData().locations[getServerGame()][i][0]).indexOf(toLowerCase(params)) != -1) {
return i;
}
}
} else {
if(typeof getGameData().locations[getServerGame()][params] != "undefined") {
return toInteger(params);
}
}
return false;
}
// ===========================================================================
function getYesNoFromBool(boolVal) {
return (boolVal) ? "Yes" : "No";
}
// ===========================================================================
function getOnOffFromBool(boolVal) {
return (boolVal) ? "On" : "Off";
}
// ===========================================================================
function getEnabledDisabledFromBool(boolVal) {
return (boolVal) ? "Enabled" : "Disabled";
}
// ===========================================================================
function getLockedUnlockedFromBool(boolVal) {
return (boolVal) ? "Locked" : "Unlocked";
}
// ===========================================================================
function getOpenedClosedFromBool(boolVal) {
return (boolVal) ? "Opened" : "Closed";
}
// ===========================================================================
function breakText(text, maxLength) {
let lines = [];
let j = Math.floor(text.length / maxLength);
for(let i = 0; i < j; i++) {
lines.push(text.substr(i*maxLength,maxLength));
}
let line = text.substr(j*maxLength, text.length % maxLength);
if(line.length > 0) {
lines.push(line);
}
return lines;
}
// ===========================================================================
function getSpeedFromVelocity(vel) {
return Math.sqrt(vel.x*vel.x + vel.y*vel.y + vel.z*vel.z);
}
// ===========================================================================
function getCardinalDirection(pos1, pos2) {
let a = pos1.x - pos2.x;
let b = pos1.y - pos2.y;
let c = pos1.z - pos2.z;
let x = Math.abs(a);
let y = Math.abs(b);
let z = Math.abs(c);
let no = 0;
let ne = 1;
let ea = 2;
let se = 3;
let so = 4;
let sw = 5;
let we = 6;
let nw = 7;
let na = 8;
if(b < 0 && a < 0){
if(x < (y/2)){
return no;
} else if(y < (x/2)){
return ea;
} else {
return ne;
}
} else if(b < 0 && a >= 0){
if(x < (y/2)){
return no;
} else if(y < (x/2)){
return we;
} else {
return nw;
}
} else if(b >= 0 && a >= 0){
if(x < (y/2)){
return so;
} else if(y < (x/2)){
return we;
} else {
return sw;
}
} else if(b >= 0 && a < 0){
if(x < (y/2)){
return so;
} else if(y < (x/2)){
return ea;
} else {
return se;
}
} else {
return na;
}
return na;
}
// ===========================================================================
function getTimeDifferenceDisplay(timeStamp2, timeStamp1) {
timeStamp1 = timeStamp1 * 1000;
timeStamp2 = timeStamp2 * 1000;
if(isNaN(timeStamp1) || isNaN(timeStamp2)) {
return "Unknown";
}
let millisecondDiff = timeStamp2 - timeStamp1;
let days = Math.floor(millisecondDiff / 1000 / 60 / (60 * 24));
let diffDate = new Date(millisecondDiff);
return `${days} days, ${diffDate.getHours()} hours, ${diffDate.getMinutes()} minutes`;
}
// ===========================================================================
function doesWordStartWithVowel(word) {
switch(toLowerCase(word.substr(0,1))) {
case "a":
case "e":
case "i":
case "o":
case "u":
return true;
default:
return false;
}
return false;
}
// ===========================================================================
function replaceEmojiIntoString(message) {
for(let i in emojiReplaceString) {
message = message.replace(emojiReplaceString[i][0], emojiReplaceString[i][1]);
}
return message;
}
// ===========================================================================
function makeReadableTime(hour, minute) {
let hourStr = toString(hour);
let minuteStr = toString(minute);
let meridianStr = "AM";
if(hour < 10) {
hourStr = "0" + toString(hour);
meridianStr = "AM";
}
if(hour > 11) {
let actualHour = hour-12;
if(actualHour < 10) {
hourStr = "0" + toString(hour-12);
} else {
hourStr = toString(hour-12);
}
meridianStr = "PM";
}
if(minute < 10) {
minuteStr = "0" + toString(minute);
}
return hourStr + ":" + minuteStr + " " + meridianStr;
}
// ===========================================================================
function getCardinalDirectionName(cardinalDirectionId) {
let cardinalDirections = ["North", "Northeast", "East", "Southeast", "South", "Southwest", "West", "Northwest", "Unknown" ];
return cardinalDirections[cardinalDirectionId];
}
// ===========================================================================
function getWeekDayName(weekdayId) {
let weekdayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ];
return weekdayNames[weekdayId];
}
// ===========================================================================
function getMonthName(monthId) {
let monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
return monthNames[monthId];
}
// ===========================================================================
function getLockedUnlockedEmojiFromBool(boolVal) {
return (boolVal) ? "🔒" : "🔓";
}
// =========================================================================== // ===========================================================================