Mass convert indentation + add ped speech cmd

This commit is contained in:
Vortrex
2022-03-16 17:02:33 -05:00
parent 297ab6f8f8
commit efc72dffe1
68 changed files with 8401 additions and 8312 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -8,121 +8,121 @@
// ===========================================================================
let bindableKeys = {
8: "backspace",
9: "tab",
13: "return",
27: "escape",
32: "space",
33: "exclamation",
34: "doublequote",
35: "hashtag",
36: "dollar",
37: "percent",
38: "ampersand",
39: "quote",
40: "leftparenthesis",
41: "rightparenthesis",
42: "asterisk",
43: "plus",
44: "comma",
45: "minus",
46: "period",
47: "slash",
48: "0",
49: "1",
50: "2",
51: "3",
52: "4",
53: "5",
54: "6",
55: "7",
56: "8",
57: "9",
58: "colon",
59: "semicolon",
60: "less",
61: "equals",
62: "greater",
63: "questionmark",
64: "at",
91: "leftbracket",
92: "backslash",
93: "rightbracket",
95: "underscore",
97: "a",
98: "b",
99: "c",
100: "d",
101: "e",
102: "f",
103: "g",
104: "h",
105: "i",
106: "j",
107: "k",
108: "l",
109: "m",
110: "n",
111: "o",
112: "p",
113: "q",
114: "r",
115: "s",
116: "t",
117: "u",
118: "v",
119: "w",
120: "x",
121: "y",
122: "z",
127: "delete",
1073741881: "capslock",
1073741882: "f12",
1073741883: "f2",
1073741884: "f3",
1073741885: "f4",
1073741886: "f5",
1073741887: "f6",
1073741888: "f7",
1073741889: "f8",
1073741890: "f9",
1073741891: "f10",
1073741892: "f11",
1073741893: "f12",
1073741894: "printscreen",
1073741895: "scrolllock",
1073741896: "pause",
1073741897: "insert",
1073741898: "home",
1073741899: "pageup",
1073741901: "end",
1073741902: "pagedown",
1073741903: "right",
1073741904: "left",
1073741905: "down",
1073741906: "up",
1073741908: "numdivide",
1073741909: "nummultiply",
1073741910: "numminus",
1073741911: "numplus",
1073741912: "numenter",
1073741913: "num1",
1073741914: "num2",
1073741915: "num3",
1073741916: "num4",
1073741917: "num5",
1073741918: "num6",
1073741919: "num7",
1073741920: "num8",
1073741921: "num9",
1073741922: "num0",
1073741923: "numperiod",
1073742048: "leftctrl",
1073742049: "leftshift",
1073742050: "leftalt",
1073742052: "rightctrl",
1073742053: "rightshift",
1073742054: "rightalt",
8: "backspace",
9: "tab",
13: "return",
27: "escape",
32: "space",
33: "exclamation",
34: "doublequote",
35: "hashtag",
36: "dollar",
37: "percent",
38: "ampersand",
39: "quote",
40: "leftparenthesis",
41: "rightparenthesis",
42: "asterisk",
43: "plus",
44: "comma",
45: "minus",
46: "period",
47: "slash",
48: "0",
49: "1",
50: "2",
51: "3",
52: "4",
53: "5",
54: "6",
55: "7",
56: "8",
57: "9",
58: "colon",
59: "semicolon",
60: "less",
61: "equals",
62: "greater",
63: "questionmark",
64: "at",
91: "leftbracket",
92: "backslash",
93: "rightbracket",
95: "underscore",
97: "a",
98: "b",
99: "c",
100: "d",
101: "e",
102: "f",
103: "g",
104: "h",
105: "i",
106: "j",
107: "k",
108: "l",
109: "m",
110: "n",
111: "o",
112: "p",
113: "q",
114: "r",
115: "s",
116: "t",
117: "u",
118: "v",
119: "w",
120: "x",
121: "y",
122: "z",
127: "delete",
1073741881: "capslock",
1073741882: "f12",
1073741883: "f2",
1073741884: "f3",
1073741885: "f4",
1073741886: "f5",
1073741887: "f6",
1073741888: "f7",
1073741889: "f8",
1073741890: "f9",
1073741891: "f10",
1073741892: "f11",
1073741893: "f12",
1073741894: "printscreen",
1073741895: "scrolllock",
1073741896: "pause",
1073741897: "insert",
1073741898: "home",
1073741899: "pageup",
1073741901: "end",
1073741902: "pagedown",
1073741903: "right",
1073741904: "left",
1073741905: "down",
1073741906: "up",
1073741908: "numdivide",
1073741909: "nummultiply",
1073741910: "numminus",
1073741911: "numplus",
1073741912: "numenter",
1073741913: "num1",
1073741914: "num2",
1073741915: "num3",
1073741916: "num4",
1073741917: "num5",
1073741918: "num6",
1073741919: "num7",
1073741920: "num8",
1073741921: "num9",
1073741922: "num0",
1073741923: "numperiod",
1073742048: "leftctrl",
1073742049: "leftshift",
1073742050: "leftalt",
1073742052: "rightctrl",
1073742053: "rightshift",
1073742054: "rightalt",
};
// ===========================================================================
@@ -1138,24 +1138,24 @@ function makeLargeNumberReadable(num) {
// ===========================================================================
function getKeyIdFromParams(params) {
let tempParams = toLowerCase(toString(params));
let tempParams = toLowerCase(toString(params));
//let sdlName = sdl.getKeyFromName(tempParams);
//if(sdlName != null) {
// return sdlName;
//}
//let sdlName = sdl.getKeyFromName(tempParams);
//if(sdlName != null) {
// return sdlName;
//}
for(let i in bindableKeys) {
if(toLowerCase(bindableKeys[i]) == toLowerCase(tempParams)) {
return i;
}
}
for(let i in bindableKeys) {
if(toLowerCase(bindableKeys[i]) == toLowerCase(tempParams)) {
return i;
}
}
}
// ===========================================================================
function getKeyNameFromId(params) {
return bindableKeys[toInteger(params)];
return bindableKeys[toInteger(params)];
}
// ===========================================================================
@@ -1350,7 +1350,7 @@ function getEntityData(entity, dataName) {
return entity.getData(dataName);
}
}
return null;
return null;
}
// ===========================================================================
@@ -1371,7 +1371,7 @@ function removeEntityData(entity, dataName) {
if(entity != null) {
return entity.removeData(dataName);
}
return null;
return null;
}
// ===========================================================================
@@ -1389,15 +1389,15 @@ function getDistance(vec1, vec2) {
if(isNull(vec1) || isNull(vec2)) {
return false;
}
return vec1.distance(vec2);
return vec1.distance(vec2);
}
// ===========================================================================
function logToConsole(tempLogLevel, text) {
if(typeof server != "undefined") {
text = removeColoursInMessage(text);
}
if(typeof server != "undefined") {
text = removeColoursInMessage(text);
}
if((logLevel & tempLogLevel) || logLevel == LOG_ALL) {
if(tempLogLevel == LOG_ERROR) {
@@ -1417,10 +1417,10 @@ function logToConsole(tempLogLevel, text) {
// ===========================================================================
function Enum(constantsList) {
let tempTable = {};
let tempTable = {};
for(let i in constantsList) {
tempTable[constantsList[i]] = i;
}
tempTable[constantsList[i]] = i;
}
return tempTable;
}
@@ -1499,13 +1499,13 @@ function arePickupsSupported() {
// ===========================================================================
function areBlipsSupported() {
return supportedFeatures.blips[getGame()];
return supportedFeatures.blips[getGame()];
}
// ===========================================================================
function areMarkersSupported() {
return supportedFeatures.markers[getGame()];
return supportedFeatures.markers[getGame()];
}
// ===========================================================================
@@ -1800,7 +1800,7 @@ function getPosInFrontOfPos(pos, angle, distance) {
y = (pos.y+((Math.sin(angle+(Math.PI/2)))*distance));
} else {
while(angle < 0.0)
angle += 360.0;
angle += 360.0;
while(angle > 360.0)
angle -= 360.0;
@@ -2056,23 +2056,23 @@ function removeHexColoursFromString(str) {
// ===========================================================================
async function waitUntil(condition) {
return new Promise((resolve) => {
let interval = setInterval(() => {
if (!condition()) {
return
}
return new Promise((resolve) => {
let interval = setInterval(() => {
if (!condition()) {
return
}
clearInterval(interval);
resolve();
}, 1);
});
clearInterval(interval);
resolve();
}, 1);
});
}
// ===========================================================================
function getGameLocationFromParams(params) {
if(isNaN(params)) {
let locations = getGameConfig().locations[getGame()];
let locations = getGameConfig().locations[getGame()];
for(let i in locations) {
if(toLowerCase(locations[i][0]).indexOf(toLowerCase(params)) != -1) {
return i;
@@ -2204,16 +2204,16 @@ function getCardinalDirection(pos1, pos2) {
function getTimeDifferenceDisplay(timeStamp2, timeStamp1) {
timeStamp1 = timeStamp1 * 1000;
timeStamp2 = timeStamp2 * 1000;
if(isNaN(timeStamp1) || isNaN(timeStamp2)) {
return "Unknown";
}
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);
let days = Math.floor(millisecondDiff / 1000 / 60 / (60 * 24));
let diffDate = new Date(millisecondDiff);
return `${days} days, ${diffDate.getHours()} hours, ${diffDate.getMinutes()} minutes`;
return `${days} days, ${diffDate.getHours()} hours, ${diffDate.getMinutes()} minutes`;
}
// ===========================================================================
@@ -2399,12 +2399,24 @@ function isConsole(client) {
// ===========================================================================
/**
* Gets the console client (only valid on server)
*
* @return {Boolean} Whether or not the two clients are the same
*
*/
function isSamePlayer(client1, client2) {
return (client1 == client2);
}
// ===========================================================================
/**
* Gets the console client (only valid on server)
*
* @return {Client} Console client
*
*/
function getConsoleClient() {
let clients = getClients();
for(let i in clients) {
@@ -2416,24 +2428,51 @@ function getConsoleClient() {
// ===========================================================================
/**
* Gets the entire colours table
*
* @return {Object} Colours table
*
*/
function getServerColours() {
return serverColours;
}
// ===========================================================================
/**
* Gets an RGB value for a colour type name
*
* @param {String} typeName - Colour type name (red, blue, etc)
* @return {Number} Colour value (same as from toColour)
*
*/
function getColourByType(typeName) {
return getServerColours().byType[typeName];
}
// ===========================================================================
/**
* Gets an RGB value for a colour name
*
* @param {String} colourName - Colour name (error, businessBlue, etc)
* @return {Number} Colour value (same as from toColour)
*
*/
function getColourByName(colourName) {
return getServerColours().byName[colourName];
}
// ===========================================================================
/**
* Gets a hex value for a colour type
*
* @param {String} colourName - Colour name (red, blue, etc)
* @return {String} Hex value as string without brackets (has only the hashtag)
*
*/
function getHexColourByName(colourName) {
//let rgbaColour = getServerColours().byName[colourName];
//let rgbaArray = rgbaArrayFromToColour(rgbaColour);
@@ -2444,7 +2483,14 @@ function getHexColourByName(colourName) {
// ===========================================================================
function getHexColourByType(colourName) {
/**
* Gets a hex value for a colour type
*
* @param {String} typeName - Colour type name (error, businessBlue, etc)
* @return {String} Hex value as string without brackets (has only the hashtag)
*
*/
function getHexColourByType(typeName) {
//let rgbaColour = getServerColours().byType[colourName];
//let rgbaArray = rgbaArrayFromToColour(rgbaColour);
//return rgbToHex(rgbaArray[0], rgbaArray[1], rgbaArray[2]);
@@ -2585,29 +2631,43 @@ function getInlineChatColourByType(colourName) {
*
*/
function rgbaArrayFromToColour(colour) {
//return [
// (colour >> 24) & 0xFF, // red
// (colour >> 16) & 0xFF,
// (colour >> 8) & 0xFF,
// colour & 0xFF // alpha
//];
return [
(colour >> 16) & 0xFF, // red
(colour >> 8) & 0xFF,
colour & 0xFF,
(colour >> 24) & 0xFF// alpha
];
//return [
// (colour >> 24) & 0xFF, // red
// (colour >> 16) & 0xFF,
// (colour >> 8) & 0xFF,
// colour & 0xFF // alpha
//];
return [
(colour >> 16) & 0xFF, // red
(colour >> 8) & 0xFF,
colour & 0xFF,
(colour >> 24) & 0xFF// alpha
];
}
// ===========================================================================
/**
* Gets a hex formatting colour by type for use inline in chatbox messages (example: [#FFFFFF]).
*
* @param {Number} colourValue - Colour value (from toColour)
* @return {String} HEX-formatted colour string without brackets (just the hashtag)
*
*/
function hexFromToColour(colour) {
let rgba = rgbaArrayFromToColour(colour);
return rgbToHex(rgba[0], rgba[1], rgba[2]);
return rgbToHex(rgba[0], rgba[1], rgba[2]);
}
// ===========================================================================
/**
* Replaces colour types with HEX values in a message string
*
* @param {String} colouredString - String with colours
* @return {String} String with replaced colours for inline chatbox usage
*
*/
function replaceColoursInMessage(messageText) {
if(messageText == null) {
return "";
@@ -2642,6 +2702,13 @@ function replaceColoursInMessage(messageText) {
// ===========================================================================
/**
* Removes colour types from a message
*
* @param {String} colouredString - String with colours
* @return {String} String without colours
*
*/
function removeColoursInMessage(messageText) {
if(messageText == null) {
return "";
@@ -2676,6 +2743,13 @@ function removeColoursInMessage(messageText) {
// ===========================================================================
/**
* Replaces emoji texts with actual emoji
*
* @param {String} colouredString - String with emoji names
* @return {String} String with actual emoji images
*
*/
function replaceEmojiInString(messageString) {
for(let i in emojiReplaceString) {
while(messageString.indexOf(emojiReplaceString[i][0]) != -1) {