Test emoji numbers
This commit is contained in:
@@ -7,6 +7,10 @@
|
|||||||
// TYPE: Shared (JavaScript)
|
// TYPE: Shared (JavaScript)
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
let emojiNumbers = ["➊", "➋", "➌", "➍", "➎", "➏", "➐", "➑", "➒"];
|
||||||
|
//let emojiNumbers = ["①", "②", "③", "④", "⑤", "⑥", "⑦", "⑧", "⑨"];
|
||||||
|
//let emojiNumbers = ["1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣"];
|
||||||
|
|
||||||
let bindableKeys = {
|
let bindableKeys = {
|
||||||
8: "backspace",
|
8: "backspace",
|
||||||
9: "tab",
|
9: "tab",
|
||||||
@@ -1093,13 +1097,13 @@ let serverEmoji = [
|
|||||||
[":water_buffalo:", "🐃"],
|
[":water_buffalo:", "🐃"],
|
||||||
[":neutral_face:", "😐"],
|
[":neutral_face:", "😐"],
|
||||||
[":clock1230:", "🕧"],
|
[":clock1230:", "🕧"],
|
||||||
[":P", "😛" ],
|
[":P", "😛"],
|
||||||
[":)", "🙂" ],
|
[":)", "🙂"],
|
||||||
[":D", "😃" ],
|
[":D", "😃"],
|
||||||
[":o", "😮" ],
|
[":o", "😮"],
|
||||||
[":O", "😮" ],
|
[":O", "😮"],
|
||||||
[":(", "☹️" ],
|
[":(", "☹️"],
|
||||||
[":|", "😐" ],
|
[":|", "😐"],
|
||||||
];
|
];
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1139,8 +1143,8 @@ function getKeyIdFromParams(params) {
|
|||||||
// return sdlName;
|
// return sdlName;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
for(let i in bindableKeys) {
|
for (let i in bindableKeys) {
|
||||||
if(toLowerCase(bindableKeys[i]) == toLowerCase(tempParams)) {
|
if (toLowerCase(bindableKeys[i]) == toLowerCase(tempParams)) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1325,11 +1329,11 @@ function toLowerCase(val) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isNull(val) {
|
function isNull(val) {
|
||||||
if(val == null) {
|
if (val == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(typeof val === "undefined") {
|
if (typeof val === "undefined") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1339,8 +1343,8 @@ function isNull(val) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getEntityData(entity, dataName) {
|
function getEntityData(entity, dataName) {
|
||||||
if(entity != null) {
|
if (entity != null) {
|
||||||
if(entity.getData != null) {
|
if (entity.getData != null) {
|
||||||
return entity.getData(dataName);
|
return entity.getData(dataName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1350,7 +1354,7 @@ function getEntityData(entity, dataName) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getDistance(vec1, vec2) {
|
function getDistance(vec1, vec2) {
|
||||||
if(isNull(vec1) || isNull(vec2)) {
|
if (isNull(vec1) || isNull(vec2)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return vec1.distance(vec2);
|
return vec1.distance(vec2);
|
||||||
@@ -1361,11 +1365,11 @@ function getDistance(vec1, vec2) {
|
|||||||
function logToConsole(tempLogLevel, text) {
|
function logToConsole(tempLogLevel, text) {
|
||||||
text = removeColoursInMessage(text);
|
text = removeColoursInMessage(text);
|
||||||
|
|
||||||
if(hasBitFlag(logLevel|LOG_WARN|LOG_ERROR, tempLogLevel)) {
|
if (hasBitFlag(logLevel | LOG_WARN | LOG_ERROR, tempLogLevel)) {
|
||||||
if(tempLogLevel & LOG_ERROR) {
|
if (tempLogLevel & LOG_ERROR) {
|
||||||
consoleError(text);
|
consoleError(text);
|
||||||
return true;
|
return true;
|
||||||
} else if(tempLogLevel & LOG_WARN) {
|
} else if (tempLogLevel & LOG_WARN) {
|
||||||
consoleWarn(text);
|
consoleWarn(text);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@@ -1380,7 +1384,7 @@ function logToConsole(tempLogLevel, text) {
|
|||||||
|
|
||||||
function Enum(constantsList) {
|
function Enum(constantsList) {
|
||||||
let tempTable = {};
|
let tempTable = {};
|
||||||
for(let i in constantsList) {
|
for (let i in constantsList) {
|
||||||
tempTable[constantsList[i]] = i;
|
tempTable[constantsList[i]] = i;
|
||||||
}
|
}
|
||||||
return tempTable;
|
return tempTable;
|
||||||
@@ -1401,7 +1405,7 @@ function isServerScript() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPercentage(num, per) {
|
function getPercentage(num, per) {
|
||||||
return (num/100)*per;
|
return (num / 100) * per;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1498,8 +1502,8 @@ function getAllowedSkins(gameId = getGame()) {
|
|||||||
|
|
||||||
function getAllowedSkinIndexFromSkin(skin) {
|
function getAllowedSkinIndexFromSkin(skin) {
|
||||||
let allowedSkins = getAllowedSkins();
|
let allowedSkins = getAllowedSkins();
|
||||||
for(let i in allowedSkins) {
|
for (let i in allowedSkins) {
|
||||||
if(allowedSkins[i][0] == skin) {
|
if (allowedSkins[i][0] == skin) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1511,8 +1515,8 @@ function getAllowedSkinIndexFromSkin(skin) {
|
|||||||
|
|
||||||
function getSkinIndexFromModel(model, gameId = getGame()) {
|
function getSkinIndexFromModel(model, gameId = getGame()) {
|
||||||
let skins = getGameConfig().skins[gameId];
|
let skins = getGameConfig().skins[gameId];
|
||||||
for(let i in skins) {
|
for (let i in skins) {
|
||||||
if(toLowerCase(skins[i][0]).indexOf(toLowerCase(model)) != -1) {
|
if (toLowerCase(skins[i][0]).indexOf(toLowerCase(model)) != -1) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1524,8 +1528,8 @@ function getSkinIndexFromModel(model, gameId = getGame()) {
|
|||||||
|
|
||||||
function getSkinIndexFromName(name, gameId = getGame()) {
|
function getSkinIndexFromName(name, gameId = getGame()) {
|
||||||
let skins = getGameConfig().skins[gameId];
|
let skins = getGameConfig().skins[gameId];
|
||||||
for(let i in skins) {
|
for (let i in skins) {
|
||||||
if(toLowerCase(skins[i][1]).indexOf(toLowerCase(name)) != -1) {
|
if (toLowerCase(skins[i][1]).indexOf(toLowerCase(name)) != -1) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1537,8 +1541,8 @@ function getSkinIndexFromName(name, gameId = getGame()) {
|
|||||||
|
|
||||||
function getObjectModelIndexFromModel(model, gameId = getGame()) {
|
function getObjectModelIndexFromModel(model, gameId = getGame()) {
|
||||||
let objects = getGameConfig().objects[gameId];
|
let objects = getGameConfig().objects[gameId];
|
||||||
for(let i in objects) {
|
for (let i in objects) {
|
||||||
if(toLowerCase(objects[i][0]).indexOf(toLowerCase(model)) != -1) {
|
if (toLowerCase(objects[i][0]).indexOf(toLowerCase(model)) != -1) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1558,11 +1562,11 @@ function getVehicleModelIndexFromParams(params, gameId = getGame()) {
|
|||||||
let fromName = getVehicleModelIndexFromName(params, gameId);
|
let fromName = getVehicleModelIndexFromName(params, gameId);
|
||||||
let fromModel = getVehicleModelIndexFromModel(params, gameId);
|
let fromModel = getVehicleModelIndexFromModel(params, gameId);
|
||||||
|
|
||||||
if(fromModel && !fromName) {
|
if (fromModel && !fromName) {
|
||||||
return fromModel;
|
return fromModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!fromModel && fromName) {
|
if (!fromModel && fromName) {
|
||||||
return fromName;
|
return fromName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1573,8 +1577,8 @@ function getVehicleModelIndexFromParams(params, gameId = getGame()) {
|
|||||||
|
|
||||||
function getVehicleModelIndexFromName(name, gameId = getGame()) {
|
function getVehicleModelIndexFromName(name, gameId = getGame()) {
|
||||||
let vehicles = getGameConfig().vehicles[gameId];
|
let vehicles = getGameConfig().vehicles[gameId];
|
||||||
for(let i in vehicles) {
|
for (let i in vehicles) {
|
||||||
if(toLowerCase(vehicles[i][1]).indexOf(toLowerCase(name)) != -1) {
|
if (toLowerCase(vehicles[i][1]).indexOf(toLowerCase(name)) != -1) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1586,13 +1590,13 @@ function getVehicleModelIndexFromName(name, gameId = getGame()) {
|
|||||||
|
|
||||||
function getVehicleModelIndexFromModel(model, gameId = getGame()) {
|
function getVehicleModelIndexFromModel(model, gameId = getGame()) {
|
||||||
let vehicles = getGameConfig().vehicles[gameId];
|
let vehicles = getGameConfig().vehicles[gameId];
|
||||||
for(let i in vehicles) {
|
for (let i in vehicles) {
|
||||||
if(isNaN(model)) {
|
if (isNaN(model)) {
|
||||||
if(toLowerCase(vehicles[i][0]).indexOf(toLowerCase(model)) != -1) {
|
if (toLowerCase(vehicles[i][0]).indexOf(toLowerCase(model)) != -1) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(vehicles[i][0] == toInteger(model)) {
|
if (vehicles[i][0] == toInteger(model)) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1605,8 +1609,8 @@ function getVehicleModelIndexFromModel(model, gameId = getGame()) {
|
|||||||
|
|
||||||
function getVehicleModelFromName(name, gameId = getGame()) {
|
function getVehicleModelFromName(name, gameId = getGame()) {
|
||||||
let vehicles = getGameConfig().vehicles[gameId];
|
let vehicles = getGameConfig().vehicles[gameId];
|
||||||
for(let i in vehicles) {
|
for (let i in vehicles) {
|
||||||
if(toLowerCase(vehicles[i][1]).indexOf(toLowerCase(name)) != -1) {
|
if (toLowerCase(vehicles[i][1]).indexOf(toLowerCase(name)) != -1) {
|
||||||
return vehicles[i][0];
|
return vehicles[i][0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1618,13 +1622,13 @@ function getVehicleModelFromName(name, gameId = getGame()) {
|
|||||||
|
|
||||||
function getVehicleNameFromModel(model, gameId = getGame()) {
|
function getVehicleNameFromModel(model, gameId = getGame()) {
|
||||||
let vehicles = getGameConfig().vehicles[gameId];
|
let vehicles = getGameConfig().vehicles[gameId];
|
||||||
for(let i in vehicles) {
|
for (let i in vehicles) {
|
||||||
if(isNaN(model)) {
|
if (isNaN(model)) {
|
||||||
if(toLowerCase(vehicles[i][0]).indexOf(toLowerCase(model)) != -1) {
|
if (toLowerCase(vehicles[i][0]).indexOf(toLowerCase(model)) != -1) {
|
||||||
return vehicles[i][1];
|
return vehicles[i][1];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(vehicles[i][0] == toInteger(model)) {
|
if (vehicles[i][0] == toInteger(model)) {
|
||||||
return vehicles[i][1];
|
return vehicles[i][1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1639,11 +1643,11 @@ function getSkinModelIndexFromParams(params, gameId = getGame()) {
|
|||||||
let fromName = getSkinIndexFromName(params, gameId);
|
let fromName = getSkinIndexFromName(params, gameId);
|
||||||
let fromModel = getSkinIndexFromModel(params, gameId);
|
let fromModel = getSkinIndexFromModel(params, gameId);
|
||||||
|
|
||||||
if(fromModel && !fromName) {
|
if (fromModel && !fromName) {
|
||||||
return fromModel;
|
return fromModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!fromModel && fromName) {
|
if (!fromModel && fromName) {
|
||||||
return fromName;
|
return fromName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1654,8 +1658,8 @@ function getSkinModelIndexFromParams(params, gameId = getGame()) {
|
|||||||
|
|
||||||
function getSkinNameFromModel(model, gameId = getGame()) {
|
function getSkinNameFromModel(model, gameId = getGame()) {
|
||||||
let skins = getGameConfig().skins[gameId];
|
let skins = getGameConfig().skins[gameId];
|
||||||
for(let i in skins) {
|
for (let i in skins) {
|
||||||
if(toLowerCase(skins[i][0]).indexOf(toLowerCase(model)) != -1) {
|
if (toLowerCase(skins[i][0]).indexOf(toLowerCase(model)) != -1) {
|
||||||
return skins[i][1];
|
return skins[i][1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1666,7 +1670,7 @@ function getSkinNameFromModel(model, gameId = getGame()) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getSkinNameFromIndex(index, gameId = getGame()) {
|
function getSkinNameFromIndex(index, gameId = getGame()) {
|
||||||
if(typeof getGameConfig().skins[gameId][index] != "undefined") {
|
if (typeof getGameConfig().skins[gameId][index] != "undefined") {
|
||||||
return getGameConfig().skins[gameId][index][1];
|
return getGameConfig().skins[gameId][index][1];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1677,8 +1681,8 @@ function getSkinNameFromIndex(index, gameId = getGame()) {
|
|||||||
|
|
||||||
function getSkinModelFromName(name, gameId = getGame()) {
|
function getSkinModelFromName(name, gameId = getGame()) {
|
||||||
let skins = getGameConfig().skins[gameId];
|
let skins = getGameConfig().skins[gameId];
|
||||||
for(let i in skins) {
|
for (let i in skins) {
|
||||||
if(toLowerCase(skins[i][1]).indexOf(toLowerCase(name)) != -1) {
|
if (toLowerCase(skins[i][1]).indexOf(toLowerCase(name)) != -1) {
|
||||||
return skins[i][0];
|
return skins[i][0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1690,11 +1694,11 @@ function getObjectModelIndexFromParams(params, gameId = getGame()) {
|
|||||||
let fromName = getObjectModelIndexFromName(params, gameId);
|
let fromName = getObjectModelIndexFromName(params, gameId);
|
||||||
let fromModel = getObjectModelIndexFromModel(params, gameId);
|
let fromModel = getObjectModelIndexFromModel(params, gameId);
|
||||||
|
|
||||||
if(fromModel && !fromName) {
|
if (fromModel && !fromName) {
|
||||||
return fromModel;
|
return fromModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!fromModel && fromName) {
|
if (!fromModel && fromName) {
|
||||||
return fromName;
|
return fromName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1705,8 +1709,8 @@ function getObjectModelIndexFromParams(params, gameId = getGame()) {
|
|||||||
|
|
||||||
function getObjectNameFromModel(model, gameId = getGame()) {
|
function getObjectNameFromModel(model, gameId = getGame()) {
|
||||||
let objects = getGameConfig().objects[gameId];
|
let objects = getGameConfig().objects[gameId];
|
||||||
for(let i in objects) {
|
for (let i in objects) {
|
||||||
if(toLowerCase(objects[i][0]).indexOf(toLowerCase(model)) != -1) {
|
if (toLowerCase(objects[i][0]).indexOf(toLowerCase(model)) != -1) {
|
||||||
return objects[i][1];
|
return objects[i][1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1718,8 +1722,8 @@ function getObjectNameFromModel(model, gameId = getGame()) {
|
|||||||
|
|
||||||
function getObjectModelFromName(name, gameId = getGame()) {
|
function getObjectModelFromName(name, gameId = getGame()) {
|
||||||
let objects = getGameConfig().objects[gameId];
|
let objects = getGameConfig().objects[gameId];
|
||||||
for(let i in objects) {
|
for (let i in objects) {
|
||||||
if(toLowerCase(objects[i][1]).indexOf(toLowerCase(name)) != -1) {
|
if (toLowerCase(objects[i][1]).indexOf(toLowerCase(name)) != -1) {
|
||||||
return objects[i][0];
|
return objects[i][0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1728,8 +1732,8 @@ function getObjectModelFromName(name, gameId = getGame()) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPosToRightOfPos(pos, angle, distance) {
|
function getPosToRightOfPos(pos, angle, distance) {
|
||||||
let x = (pos.x+((Math.cos((angle-1.57)+(Math.PI/2)))*distance));
|
let x = (pos.x + ((Math.cos((angle - 1.57) + (Math.PI / 2))) * distance));
|
||||||
let y = (pos.y+((Math.sin((angle-1.57)+(Math.PI/2)))*distance));
|
let y = (pos.y + ((Math.sin((angle - 1.57) + (Math.PI / 2))) * distance));
|
||||||
|
|
||||||
let rightPos = toVector3(x, y, pos.z);
|
let rightPos = toVector3(x, y, pos.z);
|
||||||
|
|
||||||
@@ -1739,8 +1743,8 @@ function getPosToRightOfPos(pos, angle, distance) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPosToLeftOfPos(pos, angle, distance) {
|
function getPosToLeftOfPos(pos, angle, distance) {
|
||||||
let x = (pos.x+((Math.cos((angle+1.57)+(Math.PI/2)))*distance));
|
let x = (pos.x + ((Math.cos((angle + 1.57) + (Math.PI / 2))) * distance));
|
||||||
let y = (pos.y+((Math.sin((angle+1.57)+(Math.PI/2)))*distance));
|
let y = (pos.y + ((Math.sin((angle + 1.57) + (Math.PI / 2))) * distance));
|
||||||
|
|
||||||
let leftPos = toVector3(x, y, pos.z);
|
let leftPos = toVector3(x, y, pos.z);
|
||||||
|
|
||||||
@@ -1754,18 +1758,18 @@ function getPosInFrontOfPos(pos, angle, distance) {
|
|||||||
let y = pos.y;
|
let y = pos.y;
|
||||||
let z = pos.z;
|
let z = pos.z;
|
||||||
|
|
||||||
if(getGame() != VRR_GAME_MAFIA_ONE) {
|
if (getGame() != VRR_GAME_MAFIA_ONE) {
|
||||||
x = (pos.x+((Math.cos(angle+(Math.PI/2)))*distance));
|
x = (pos.x + ((Math.cos(angle + (Math.PI / 2))) * distance));
|
||||||
y = (pos.y+((Math.sin(angle+(Math.PI/2)))*distance));
|
y = (pos.y + ((Math.sin(angle + (Math.PI / 2))) * distance));
|
||||||
} else {
|
} else {
|
||||||
while(angle < 0.0)
|
while (angle < 0.0)
|
||||||
angle += 360.0;
|
angle += 360.0;
|
||||||
|
|
||||||
while(angle > 360.0)
|
while (angle > 360.0)
|
||||||
angle -= 360.0;
|
angle -= 360.0;
|
||||||
|
|
||||||
x = (pos.x+((Math.cos(angle-(Math.PI/2)))*distance));
|
x = (pos.x + ((Math.cos(angle - (Math.PI / 2))) * distance));
|
||||||
z = (pos.z+((Math.sin(angle+(Math.PI/2)))*distance));
|
z = (pos.z + ((Math.sin(angle + (Math.PI / 2))) * distance));
|
||||||
}
|
}
|
||||||
|
|
||||||
return toVector3(x, y, z);
|
return toVector3(x, y, z);
|
||||||
@@ -1778,14 +1782,14 @@ function getPosBehindPos(pos, angle, distance) {
|
|||||||
let y = pos.y;
|
let y = pos.y;
|
||||||
let z = pos.z;
|
let z = pos.z;
|
||||||
|
|
||||||
if(getGame() < VRR_GAME_MAFIA_ONE) {
|
if (getGame() < VRR_GAME_MAFIA_ONE) {
|
||||||
y = (pos.y+((Math.sin(angle-(Math.PI/2)))*distance));
|
y = (pos.y + ((Math.sin(angle - (Math.PI / 2))) * distance));
|
||||||
} else {
|
} else {
|
||||||
angle = radToDeg(angle);
|
angle = radToDeg(angle);
|
||||||
z = (pos.z+((Math.sin(angle-(Math.PI/2)))*distance));
|
z = (pos.z + ((Math.sin(angle - (Math.PI / 2))) * distance));
|
||||||
}
|
}
|
||||||
|
|
||||||
x = (pos.x+((Math.cos(angle-(Math.PI/2)))*distance));
|
x = (pos.x + ((Math.cos(angle - (Math.PI / 2))) * distance));
|
||||||
|
|
||||||
return toVector3(x, y, z);
|
return toVector3(x, y, z);
|
||||||
}
|
}
|
||||||
@@ -1793,19 +1797,19 @@ function getPosBehindPos(pos, angle, distance) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPosAbovePos(pos, distance) {
|
function getPosAbovePos(pos, distance) {
|
||||||
return toVector3(pos.x, pos.y, pos.z+distance);
|
return toVector3(pos.x, pos.y, pos.z + distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPosBelowPos(pos, distance) {
|
function getPosBelowPos(pos, distance) {
|
||||||
return toVector3(pos.x, pos.y, pos.z-distance);
|
return toVector3(pos.x, pos.y, pos.z - distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function applyOffsetToPos(position, position2) {
|
function applyOffsetToPos(position, position2) {
|
||||||
return toVector3(position.x+position2.x, position.y+position2.y, position.z+position2.z);
|
return toVector3(position.x + position2.x, position.y + position2.y, position.z + position2.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1840,10 +1844,9 @@ function boolToInt(boolVal) {
|
|||||||
|
|
||||||
function fixAngle(angle) {
|
function fixAngle(angle) {
|
||||||
angle = radToDeg(angle);
|
angle = radToDeg(angle);
|
||||||
if(angle < 0)
|
if (angle < 0) {
|
||||||
{
|
|
||||||
angle = Math.abs(angle);
|
angle = Math.abs(angle);
|
||||||
angle = ((180-angle+1)+180);
|
angle = ((180 - angle + 1) + 180);
|
||||||
}
|
}
|
||||||
return degToRad(angle);
|
return degToRad(angle);
|
||||||
}
|
}
|
||||||
@@ -1887,8 +1890,8 @@ function radToDeg(rad) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getHeadingFromPosToPos(pos1, pos2) {
|
function getHeadingFromPosToPos(pos1, pos2) {
|
||||||
let x = pos2.x-pos1.x;
|
let x = pos2.x - pos1.x;
|
||||||
let y = pos2.y-pos1.y;
|
let y = pos2.y - pos1.y;
|
||||||
let rad = Math.atan2(y, x);
|
let rad = Math.atan2(y, x);
|
||||||
let deg = radToDeg(rad);
|
let deg = radToDeg(rad);
|
||||||
deg -= 90;
|
deg -= 90;
|
||||||
@@ -1900,12 +1903,12 @@ function getHeadingFromPosToPos(pos1, pos2) {
|
|||||||
|
|
||||||
function getAngleInCircleFromCenter(center, total, current) {
|
function getAngleInCircleFromCenter(center, total, current) {
|
||||||
let gap = 360 / total;
|
let gap = 360 / total;
|
||||||
let deg = Math.floor(gap*current);
|
let deg = Math.floor(gap * current);
|
||||||
|
|
||||||
if(deg <= 0) {
|
if (deg <= 0) {
|
||||||
deg = 1;
|
deg = 1;
|
||||||
} else {
|
} else {
|
||||||
if(deg >= 360) {
|
if (deg >= 360) {
|
||||||
deg = 359;
|
deg = 359;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1917,7 +1920,7 @@ function getAngleInCircleFromCenter(center, total, current) {
|
|||||||
|
|
||||||
function getArrayOfElementId(elements) {
|
function getArrayOfElementId(elements) {
|
||||||
let tempArray = [];
|
let tempArray = [];
|
||||||
for(let i in elements) {
|
for (let i in elements) {
|
||||||
tempArray.push(elements[i].id);
|
tempArray.push(elements[i].id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1927,7 +1930,7 @@ function getArrayOfElementId(elements) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getCurrentUnixTimestamp() {
|
function getCurrentUnixTimestamp() {
|
||||||
return new Date().getTime()/1000;
|
return new Date().getTime() / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1953,10 +1956,10 @@ function msToTime(duration) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function generateRandomString(length, characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
|
function generateRandomString(length, characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
|
||||||
var result = '';
|
var result = '';
|
||||||
var charactersLength = characters.length;
|
var charactersLength = characters.length;
|
||||||
for ( var i = 0; i < length; i++ ) {
|
for (var i = 0; i < length; i++) {
|
||||||
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -1964,7 +1967,7 @@ function generateRandomString(length, characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZab
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function doesWordStartWithVowel(word) {
|
function doesWordStartWithVowel(word) {
|
||||||
switch(word.substr(0,1).toLowerCase()) {
|
switch (word.substr(0, 1).toLowerCase()) {
|
||||||
case "a":
|
case "a":
|
||||||
case "e":
|
case "e":
|
||||||
case "i":
|
case "i":
|
||||||
@@ -1982,7 +1985,7 @@ function doesWordStartWithVowel(word) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getProperDeterminerForName(word) {
|
function getProperDeterminerForName(word) {
|
||||||
switch(word.substr(0,1).toLowerCase()) {
|
switch (word.substr(0, 1).toLowerCase()) {
|
||||||
case "a":
|
case "a":
|
||||||
case "e":
|
case "e":
|
||||||
case "i":
|
case "i":
|
||||||
@@ -2005,7 +2008,7 @@ function getPluralForm(name) {
|
|||||||
function removeHexColoursFromString(str) {
|
function removeHexColoursFromString(str) {
|
||||||
let matchRegex = /#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})\b/gi;
|
let matchRegex = /#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})\b/gi;
|
||||||
let matchedHexes = str.match(matchRegex);
|
let matchedHexes = str.match(matchRegex);
|
||||||
for(let i in matchHex) {
|
for (let i in matchHex) {
|
||||||
str.replace(matchedHexes, `{${i}}`);
|
str.replace(matchedHexes, `{${i}}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2030,15 +2033,15 @@ async function waitUntil(condition) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getGameLocationFromParams(params) {
|
function getGameLocationFromParams(params) {
|
||||||
if(isNaN(params)) {
|
if (isNaN(params)) {
|
||||||
let locations = getGameConfig().locations[getGame()];
|
let locations = getGameConfig().locations[getGame()];
|
||||||
for(let i in locations) {
|
for (let i in locations) {
|
||||||
if(toLowerCase(locations[i][0]).indexOf(toLowerCase(params)) != -1) {
|
if (toLowerCase(locations[i][0]).indexOf(toLowerCase(params)) != -1) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(typeof getGameConfig().locations[getGame()][params] != "undefined") {
|
if (typeof getGameConfig().locations[getGame()][params] != "undefined") {
|
||||||
return toInteger(params);
|
return toInteger(params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2081,12 +2084,12 @@ function breakText(text, maxLength) {
|
|||||||
let lines = [];
|
let lines = [];
|
||||||
let j = Math.floor(text.length / maxLength);
|
let j = Math.floor(text.length / maxLength);
|
||||||
|
|
||||||
for(let i = 0; i < j; i++) {
|
for (let i = 0; i < j; i++) {
|
||||||
lines.push(text.substr(i*maxLength,maxLength));
|
lines.push(text.substr(i * maxLength, maxLength));
|
||||||
}
|
}
|
||||||
|
|
||||||
let line = text.substr(j*maxLength, text.length % maxLength);
|
let line = text.substr(j * maxLength, text.length % maxLength);
|
||||||
if(line.length > 0) {
|
if (line.length > 0) {
|
||||||
lines.push(line);
|
lines.push(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2096,7 +2099,7 @@ function breakText(text, maxLength) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getSpeedFromVelocity(vel) {
|
function getSpeedFromVelocity(vel) {
|
||||||
return Math.sqrt(vel.x*vel.x + vel.y*vel.y + vel.z*vel.z);
|
return Math.sqrt(vel.x * vel.x + vel.y * vel.y + vel.z * vel.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -2120,34 +2123,34 @@ function getCardinalDirection(pos1, pos2) {
|
|||||||
let nw = 7;
|
let nw = 7;
|
||||||
let na = 8;
|
let na = 8;
|
||||||
|
|
||||||
if(b < 0 && a < 0){
|
if (b < 0 && a < 0) {
|
||||||
if(x < (y/2)){
|
if (x < (y / 2)) {
|
||||||
return no;
|
return no;
|
||||||
} else if(y < (x/2)){
|
} else if (y < (x / 2)) {
|
||||||
return ea;
|
return ea;
|
||||||
} else {
|
} else {
|
||||||
return ne;
|
return ne;
|
||||||
}
|
}
|
||||||
} else if(b < 0 && a >= 0){
|
} else if (b < 0 && a >= 0) {
|
||||||
if(x < (y/2)){
|
if (x < (y / 2)) {
|
||||||
return no;
|
return no;
|
||||||
} else if(y < (x/2)){
|
} else if (y < (x / 2)) {
|
||||||
return we;
|
return we;
|
||||||
} else {
|
} else {
|
||||||
return nw;
|
return nw;
|
||||||
}
|
}
|
||||||
} else if(b >= 0 && a >= 0){
|
} else if (b >= 0 && a >= 0) {
|
||||||
if(x < (y/2)){
|
if (x < (y / 2)) {
|
||||||
return so;
|
return so;
|
||||||
} else if(y < (x/2)){
|
} else if (y < (x / 2)) {
|
||||||
return we;
|
return we;
|
||||||
} else {
|
} else {
|
||||||
return sw;
|
return sw;
|
||||||
}
|
}
|
||||||
} else if(b >= 0 && a < 0){
|
} else if (b >= 0 && a < 0) {
|
||||||
if(x < (y/2)){
|
if (x < (y / 2)) {
|
||||||
return so;
|
return so;
|
||||||
} else if(y < (x/2)){
|
} else if (y < (x / 2)) {
|
||||||
return ea;
|
return ea;
|
||||||
} else {
|
} else {
|
||||||
return se;
|
return se;
|
||||||
@@ -2163,7 +2166,7 @@ function getCardinalDirection(pos1, pos2) {
|
|||||||
function getTimeDifferenceDisplay(timeStamp2, timeStamp1) {
|
function getTimeDifferenceDisplay(timeStamp2, timeStamp1) {
|
||||||
timeStamp1 = timeStamp1 * 1000;
|
timeStamp1 = timeStamp1 * 1000;
|
||||||
timeStamp2 = timeStamp2 * 1000;
|
timeStamp2 = timeStamp2 * 1000;
|
||||||
if(isNaN(timeStamp1) || isNaN(timeStamp2)) {
|
if (isNaN(timeStamp1) || isNaN(timeStamp2)) {
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2178,7 +2181,7 @@ function getTimeDifferenceDisplay(timeStamp2, timeStamp1) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function doesWordStartWithVowel(word) {
|
function doesWordStartWithVowel(word) {
|
||||||
switch(toLowerCase(word.substr(0,1))) {
|
switch (toLowerCase(word.substr(0, 1))) {
|
||||||
case "a":
|
case "a":
|
||||||
case "e":
|
case "e":
|
||||||
case "i":
|
case "i":
|
||||||
@@ -2196,7 +2199,7 @@ function doesWordStartWithVowel(word) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function replaceEmojiIntoString(message) {
|
function replaceEmojiIntoString(message) {
|
||||||
for(let i in emojiReplaceString) {
|
for (let i in emojiReplaceString) {
|
||||||
message = message.replace(emojiReplaceString[i][0], emojiReplaceString[i][1]);
|
message = message.replace(emojiReplaceString[i][0], emojiReplaceString[i][1]);
|
||||||
}
|
}
|
||||||
return message;
|
return message;
|
||||||
@@ -2209,22 +2212,22 @@ function makeReadableTime(hour, minute) {
|
|||||||
let minuteStr = toString(minute);
|
let minuteStr = toString(minute);
|
||||||
let meridianStr = "AM";
|
let meridianStr = "AM";
|
||||||
|
|
||||||
if(hour < 10) {
|
if (hour < 10) {
|
||||||
hourStr = "0" + toString(hour);
|
hourStr = "0" + toString(hour);
|
||||||
meridianStr = "AM";
|
meridianStr = "AM";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hour > 11) {
|
if (hour > 11) {
|
||||||
let actualHour = hour-12;
|
let actualHour = hour - 12;
|
||||||
if(actualHour < 10) {
|
if (actualHour < 10) {
|
||||||
hourStr = "0" + toString(hour-12);
|
hourStr = "0" + toString(hour - 12);
|
||||||
} else {
|
} else {
|
||||||
hourStr = toString(hour-12);
|
hourStr = toString(hour - 12);
|
||||||
}
|
}
|
||||||
meridianStr = "PM";
|
meridianStr = "PM";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(minute < 10) {
|
if (minute < 10) {
|
||||||
minuteStr = "0" + toString(minute);
|
minuteStr = "0" + toString(minute);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2234,14 +2237,14 @@ function makeReadableTime(hour, minute) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getCardinalDirectionName(cardinalDirectionId) {
|
function getCardinalDirectionName(cardinalDirectionId) {
|
||||||
let cardinalDirections = ["North", "Northeast", "East", "Southeast", "South", "Southwest", "West", "Northwest", "Unknown" ];
|
let cardinalDirections = ["North", "Northeast", "East", "Southeast", "South", "Southwest", "West", "Northwest", "Unknown"];
|
||||||
return cardinalDirections[cardinalDirectionId];
|
return cardinalDirections[cardinalDirectionId];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getWeekDayName(weekdayId) {
|
function getWeekDayName(weekdayId) {
|
||||||
let weekdayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ];
|
let weekdayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
||||||
return weekdayNames[weekdayId];
|
return weekdayNames[weekdayId];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2260,9 +2263,9 @@ function getLockedUnlockedEmojiFromBool(boolVal) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
String.prototype.format = function() {
|
String.prototype.format = function () {
|
||||||
let a = this;
|
let a = this;
|
||||||
for(let i in arguments) {
|
for (let i in arguments) {
|
||||||
a = a.replace("{" + String(i) + "}", arguments[i]);
|
a = a.replace("{" + String(i) + "}", arguments[i]);
|
||||||
}
|
}
|
||||||
return a;
|
return a;
|
||||||
@@ -2277,8 +2280,8 @@ function ArrayBufferToString(buffer) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getElementTypeName(typeId) {
|
function getElementTypeName(typeId) {
|
||||||
if(getGame() == VRR_GAME_MAFIA_ONE) {
|
if (getGame() == VRR_GAME_MAFIA_ONE) {
|
||||||
switch(typeId) {
|
switch (typeId) {
|
||||||
case ELEMENT_VEHICLE:
|
case ELEMENT_VEHICLE:
|
||||||
return "Vehicle";
|
return "Vehicle";
|
||||||
|
|
||||||
@@ -2292,7 +2295,7 @@ function getElementTypeName(typeId) {
|
|||||||
return "Unknown"
|
return "Unknown"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch(typeId) {
|
switch (typeId) {
|
||||||
case ELEMENT_VEHICLE:
|
case ELEMENT_VEHICLE:
|
||||||
return "Vehicle";
|
return "Vehicle";
|
||||||
|
|
||||||
@@ -2330,7 +2333,7 @@ function getElementTypeName(typeId) {
|
|||||||
|
|
||||||
function fillStringWithCharacter(character, amount) {
|
function fillStringWithCharacter(character, amount) {
|
||||||
let tempString = "";
|
let tempString = "";
|
||||||
for(let i = 0; i <= amount; i++) {
|
for (let i = 0; i <= amount; i++) {
|
||||||
tempString = tempString + toString(character);
|
tempString = tempString + toString(character);
|
||||||
}
|
}
|
||||||
return tempString;
|
return tempString;
|
||||||
@@ -2351,7 +2354,7 @@ function getCurrentTimeStampWithTimeZone(timeZone) {
|
|||||||
let tzDate = new Date(date.toLocaleString('en-US', { timeZone: timeZone }));
|
let tzDate = new Date(date.toLocaleString('en-US', { timeZone: timeZone }));
|
||||||
let offset = utcDate.getTime() - tzDate.getTime();
|
let offset = utcDate.getTime() - tzDate.getTime();
|
||||||
|
|
||||||
date.setTime( date.getTime() + offset );
|
date.setTime(date.getTime() + offset);
|
||||||
|
|
||||||
return date;
|
return date;
|
||||||
};
|
};
|
||||||
@@ -2366,7 +2369,7 @@ function getSyncerFromId(syncerId) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isConsole(client) {
|
function isConsole(client) {
|
||||||
if(client == null) {
|
if (client == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2395,8 +2398,8 @@ function isSamePlayer(client1, client2) {
|
|||||||
*/
|
*/
|
||||||
function getConsoleClient() {
|
function getConsoleClient() {
|
||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
for(let i in clients) {
|
for (let i in clients) {
|
||||||
if(isConsole(clients[i])) {
|
if (isConsole(clients[i])) {
|
||||||
return clients[i];
|
return clients[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2477,11 +2480,11 @@ function getHexColourByType(typeName) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPlayerColour(client) {
|
function getPlayerColour(client) {
|
||||||
if(getPlayerData(client) != false) {
|
if (getPlayerData(client) != false) {
|
||||||
if(!isPlayerLoggedIn(client)) {
|
if (!isPlayerLoggedIn(client)) {
|
||||||
return getColourByName("darkGrey");
|
return getColourByName("darkGrey");
|
||||||
} else {
|
} else {
|
||||||
if(isPlayerWorking(client)) {
|
if (isPlayerWorking(client)) {
|
||||||
return getJobData(getJobIndexFromDatabaseId(getPlayerCurrentSubAccount(client).job)).colour;
|
return getJobData(getJobIndexFromDatabaseId(getPlayerCurrentSubAccount(client).job)).colour;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2514,9 +2517,9 @@ function getBoolRedGreenInlineColour(boolValue) {
|
|||||||
*/
|
*/
|
||||||
function hexToRgb(h) {
|
function hexToRgb(h) {
|
||||||
return [
|
return [
|
||||||
'0x'+h[1]+h[2]|0,
|
'0x' + h[1] + h[2] | 0,
|
||||||
'0x'+h[3]+h[4]|0,
|
'0x' + h[3] + h[4] | 0,
|
||||||
'0x'+h[5]+h[6]|0
|
'0x' + h[5] + h[6] | 0
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2532,7 +2535,7 @@ function hexToRgb(h) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function rgbToHex(r, g, b) {
|
function rgbToHex(r, g, b) {
|
||||||
return "#"+((1<<24)+(r<<16)+(g<<8)+ b).toString(16).slice(1);
|
return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -2546,8 +2549,8 @@ function rgbToHex(r, g, b) {
|
|||||||
*/
|
*/
|
||||||
function getClientChatColour(client) {
|
function getClientChatColour(client) {
|
||||||
let tempJob = getPlayerCurrentSubAccount(client).job;
|
let tempJob = getPlayerCurrentSubAccount(client).job;
|
||||||
if(tempJob != -1) {
|
if (tempJob != -1) {
|
||||||
if(getPlayerData(client).isWorking) {
|
if (getPlayerData(client).isWorking) {
|
||||||
return getJobData(tempJob).jobColour;
|
return getJobData(tempJob).jobColour;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2645,7 +2648,7 @@ function hexFromToColour(colour) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function replaceColoursInMessage(messageText) {
|
function replaceColoursInMessage(messageText) {
|
||||||
if(messageText == null) {
|
if (messageText == null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2661,13 +2664,13 @@ function replaceColoursInMessage(messageText) {
|
|||||||
tempRegex = new RegExp(tempFind, 'g');
|
tempRegex = new RegExp(tempFind, 'g');
|
||||||
messageText = messageText.replace(tempRegex, "[#FFFFFF]");
|
messageText = messageText.replace(tempRegex, "[#FFFFFF]");
|
||||||
|
|
||||||
for(let i in getServerColours().hex.byName) {
|
for (let i in getServerColours().hex.byName) {
|
||||||
let find = `{${i}}`;
|
let find = `{${i}}`;
|
||||||
let re = new RegExp(find, 'g');
|
let re = new RegExp(find, 'g');
|
||||||
messageText = messageText.replace(re, `[#${getServerColours().hex.byName[i]}]`);
|
messageText = messageText.replace(re, `[#${getServerColours().hex.byName[i]}]`);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(let i in getServerColours().hex.byType) {
|
for (let i in getServerColours().hex.byType) {
|
||||||
let find = `{${i}}`;
|
let find = `{${i}}`;
|
||||||
let re = new RegExp(find, 'g');
|
let re = new RegExp(find, 'g');
|
||||||
messageText = messageText.replace(re, `[#${getServerColours().hex.byType[i]}]`);
|
messageText = messageText.replace(re, `[#${getServerColours().hex.byType[i]}]`);
|
||||||
@@ -2686,15 +2689,15 @@ function replaceColoursInMessage(messageText) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function removeColoursInMessage(messageText) {
|
function removeColoursInMessage(messageText) {
|
||||||
if(messageText == null) {
|
if (messageText == null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(typeof messageText != "string") {
|
if (typeof messageText != "string") {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(messageText == "") {
|
if (messageText == "") {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2710,13 +2713,13 @@ function removeColoursInMessage(messageText) {
|
|||||||
tempRegex = new RegExp(tempFind, 'g');
|
tempRegex = new RegExp(tempFind, 'g');
|
||||||
messageText = messageText.replace(tempRegex, "");
|
messageText = messageText.replace(tempRegex, "");
|
||||||
|
|
||||||
for(let i in getServerColours().hex.byName) {
|
for (let i in getServerColours().hex.byName) {
|
||||||
let find = `{${i}}`;
|
let find = `{${i}}`;
|
||||||
let re = new RegExp(find, 'g');
|
let re = new RegExp(find, 'g');
|
||||||
messageText = messageText.replace(re, "");
|
messageText = messageText.replace(re, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
for(let i in getServerColours().hex.byType) {
|
for (let i in getServerColours().hex.byType) {
|
||||||
let find = `{${i}}`;
|
let find = `{${i}}`;
|
||||||
let re = new RegExp(find, 'g');
|
let re = new RegExp(find, 'g');
|
||||||
messageText = messageText.replace(re, "");
|
messageText = messageText.replace(re, "");
|
||||||
@@ -2735,8 +2738,8 @@ function removeColoursInMessage(messageText) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function replaceEmojiInString(messageString) {
|
function replaceEmojiInString(messageString) {
|
||||||
for(let i in emojiReplaceString) {
|
for (let i in emojiReplaceString) {
|
||||||
while(messageString.indexOf(emojiReplaceString[i][0]) != -1) {
|
while (messageString.indexOf(emojiReplaceString[i][0]) != -1) {
|
||||||
messageString = messageString.replace(emojiReplaceString[i][0], emojiReplaceString[i][1]);
|
messageString = messageString.replace(emojiReplaceString[i][0], emojiReplaceString[i][1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2781,8 +2784,8 @@ function getPlayerLocationName(client) {
|
|||||||
|
|
||||||
function getGameAreaFromPos(position) {
|
function getGameAreaFromPos(position) {
|
||||||
let areas = getGameConfig().areas[getGame()];
|
let areas = getGameConfig().areas[getGame()];
|
||||||
for(let i in areas) {
|
for (let i in areas) {
|
||||||
if(isPointInPoly(areas[i].borders, position)) {
|
if (isPointInPoly(areas[i].borders, position)) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2791,10 +2794,10 @@ function getGameAreaFromPos(position) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isPosInPoly(poly, position) {
|
function isPosInPoly(poly, position) {
|
||||||
for(var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i)
|
for (var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i)
|
||||||
((poly[i].y <= position.y && position.y < poly[j].y) || (poly[j].y <= position.y && position.y < poly[i].y))
|
((poly[i].y <= position.y && position.y < poly[j].y) || (poly[j].y <= position.y && position.y < poly[i].y))
|
||||||
&& (position.x < (poly[j].x - poly[i].x) * (position[1] - poly[i].y) / (poly[j].y - poly[i].y) + poly[i].x)
|
&& (position.x < (poly[j].x - poly[i].x) * (position[1] - poly[i].y) / (poly[j].y - poly[i].y) + poly[i].x)
|
||||||
&& (c = !c);
|
&& (c = !c);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2805,7 +2808,7 @@ function createBitFlagTable(keyNames) {
|
|||||||
let bitTable = {};
|
let bitTable = {};
|
||||||
let incVal = 1;
|
let incVal = 1;
|
||||||
|
|
||||||
for(let i in keyNames) {
|
for (let i in keyNames) {
|
||||||
let key = keyNames[i];
|
let key = keyNames[i];
|
||||||
bitTable[key] = bitVal;
|
bitTable[key] = bitVal;
|
||||||
bitVal = 1 << incVal;
|
bitVal = 1 << incVal;
|
||||||
@@ -2817,15 +2820,15 @@ function createBitFlagTable(keyNames) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function hasBitFlag(allFlags, checkForFlag) {
|
function hasBitFlag(allFlags, checkForFlag) {
|
||||||
if(allFlags == 0) {
|
if (allFlags == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(allFlags == -1) {
|
if (allFlags == -1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((allFlags & checkForFlag) == checkForFlag) {
|
if ((allFlags & checkForFlag) == checkForFlag) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user