Move some data to shared script

This commit is contained in:
Vortrex
2021-03-16 02:26:02 -05:00
parent 9796b11d38
commit f9856388d0

View File

@@ -24,192 +24,6 @@ let disconnectReasons = [
// ===========================================================================
let policeStations = [
[],
[ // GTA III
[1143.875, -675.1875, 14.97], // Portland
[340.25, -1123.375, 25.98], // Staunton Island
[-1253.0, -138.1875, 58.75], // Shoreside Vale
],
[ // GTA Vice City
[399.77, -468.90, 11.73], // Washington Beach
[508.96, 512.07, 12.10], // Vice Point
[-657.43, 762.31, 11.59], // Downtown
[-885.08, -470.44, 13.11], // Little Havana
],
];
// ===========================================================================
let fireStations = [
[],
[ // GTA III
[1103.70, -52.45, 7.49], // Portland
[-78.48, -436.80, 16.17], // Staunton Island
[-1202.10, -14.67, 53.20], // Shoreside Vale
],
[ // GTA Vice City
[-695.15, 912.58, 11.08], // Downtown
],
];
// ===========================================================================
let hospitals = [
[],
[ // GTA III
],
[ // GTA Vice City
[-822.57, 1152.82, 12.41], // Downtown (Shuman Health Care Center)
[-885.08, -470.44, 13.11], // Little Havana (West Haven Community Health Care Center)
[-133.19, -980.76, 10.46], // Ocean Beach (Ocean View Hospital)
],
]
// ===========================================================================
let payAndSprays = [
[],
[ // GTA III
[925.4, -360.3, 10.83], // Portland
[-1142.4, 35.01, 58.61], // Shoreside Vale
],
[ // GTA Vice City
[-869.95, -119.06, 10.63], // Little Haiti
[-910.82, -1265.96, 11.79], // Viceport
],
];
// ===========================================================================
let ammuNations = [
[],
[ // GTA III
[1068.3, -400.9, 15.24], // Portland
[348.2, -717.9, 26.43], // Staunton Island
],
[ // GTA Vice City
[-676.32, 1204.98, 11.10], // Downtown
],
];
// ===========================================================================
let hiddenPackages = [
[
[1105.25, -1020, 25.0625],
[877.562, -788, 27.5625],
[1254, -611.188, 22.75],
[1045.75, -967.062, 16],
[942.062, -793.375, 14.875],
[934, -718.875, 14.75],
[898.062, -414.688, 26.5],
[846.875, -442.5, 23.1875],
[927.062, -404.375, 29.0625],
[864.25, -171.5, 3.5],
[1538.25, -174.375, 19.1875],
[1213.06, -127.062, 15.0625],
[753.562, 137, 3.5],
[1162, -101.75, 12],
[1155.56, -191.5, 14.375],
[1285.5, -247.5, 42.375],
[1007.19, -219.562, 6.6875],
[1138.19, -250, 24.25],
[1023.56, -423.688, 14.875],
[1237.5, -854.062, 20.5625],
[1478.25, -1150.69, 12],
[1018.88, -56.75, 21],
[1465.69, -166.5, 55.5],
[1120.19, -926.188, 16],
[1206.5, -821.5, 15],
[940.188, -199.875, 5],
[979.25, -1143.06, 13.0625],
[1195.5, -908.75, 14.875],
[1470.38, -811.375, 22.375],
[1320.5, -365.5, 15.1875],
[932.562, -477.25, -10.75],
[1305.88, -380.875, 39.5],
[938.188, -1258.25, 3.5],
[36.75, -530.188, 26],
[414.375, -279.25, 23.5625],
[203.5, -1252.56, 59.25],
[77.6875, -352.25, 16.0625],
[120.875, 243.688, 11.375],
[49.375, 36.25, 16.6875],
[68.0625, -773.25, 22.75],
[-4, -1129.06, 26],
[-134.688, -1386.88, 26.1875],
[-23.5, -1472.38, 19.6875],
[112.062, -1227.56, 26],
[218.25, -1237.75, 20.375],
[308, -1533.38, 23.5625],
[468.562, -1457.19, 44.25],
[355.062, -1085.69, 25.875],
[312.375, -483.75, 29],
[322.25, -447.062, 23.375],
[586.688, -795, 1.5625],
[504.25, -1027.75, 1.6875],
[174.062, -1259.5, 32.0625],
[248.75, -958.25, 26],
[54.75, -566.5, 26.0625],
[-77, -1490.06, 26],
[556, -231.375, 22.75],
[-38.1875, -1434.25, 31.75],
[194.75, -0.5, 19.75],
[223.062, -272.188, 16.0625],
[-18.0625, -222.25, 29.75],
[-69.25, -469.188, 16.0625],
[-270.688, -631.562, 72.25],
[-59.1875, -579.75, 15.875],
[392.75, -1135.56, 15.875],
[145, -1584, 30.6875],
[428.062, -340.375, 16.1875],
[351.062, -980.5, 33.0625],
[-221.75, -1487.56, 5.75],
[-1193.06, -75.75, 47.375],
[-1090.5, 131.688, 58.6875],
[-1015.5, -13, 49.0625],
[-821.75, -184.875, 33.75],
[-849.062, -209.375, 41.75],
[-736.375, 304.688, 54.0625],
[-678.062, 308.562, 59.75],
[-609.188, 286.688, 65.0625],
[-329.562, 320.062, 60.6875],
[-1221.06, 562.75, 68.5625],
[-1131.88, 605.375, 68.5625],
[-1098.38, 471.25, 35.5],
[-1208.06, 325.188, 3.375],
[-1216.19, 347.875, 30.375],
[-1211.88, -166.875, 58.6875],
[-1195.19, -7.6875, 59.75],
[-206.875, 328.75, 3.375],
[-753.188, 142, 10.0625],
[-697.875, -182.062, 9.1875],
[-748.375, -807, -13.5625],
[-489.875, -44.875, 3.75],
[-632.875, 67.5625, 18.75],
[-546.75, 10.6875, 3.875],
[-1032.56, -573.375, 10.875],
[-542, -1046.56, 3.375],
[-1556.38, -905.75, 14.5],
[-1327, -624.688, 11.0625],
[-737.375, -745.375, 9.6875],
[-1278.69, -776, 11.0625],
[-1494.69, -1097.25, 3.375],
[-837.75, -469.188, 10.75],
],
[],
[]
];
// ===========================================================================
let weekDays = [
"Sunday",
"Monday",
@@ -253,34 +67,6 @@ let cardinalDirections = [
// ===========================================================================
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 getParams(params, delimiter, index) {
return params.split(delimiter)[index];
}
// ===========================================================================
function getCardinalDirectionName(cardinalDirectionId) {
let cardinalDirections = ["North", "Northeast", "East", "Southeast", "South", "Southwest", "West", "Northwest", "Unknown" ];
return cardinalDirections[cardinalDirectionId];
@@ -379,47 +165,6 @@ function makeReadableTime(hour, minute) {
// ===========================================================================
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 degToRad(deg) {
return deg * Math.PI / 180;
}
// ===========================================================================
function radToDeg(rad) {
return rad * 180 / Math.PI;
}
// ===========================================================================
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 getClosestVehicle(position) {
let vehicles = getServerData().vehicles;
let closest = 0;
@@ -471,18 +216,6 @@ function getWeaponName(weapon) {
// ===========================================================================
function vec3ToVec2(pos) {
return toVector2(pos[0], pos[1]);
}
// ===========================================================================
function vec3ToVec3(pos, z) {
return toVector3(pos[0], pos[1], z);
}
// ===========================================================================
function isParamsInvalid(params) {
if(params == null) {
return true;
@@ -561,30 +294,6 @@ function getClientFromPlayer(player) {
// ===========================================================================
function packData(...args) {
for(let i in args) {
switch(args[i].constructor.name) {
case "Vec3":
let x = args[i].x.toFixed(2);
let y = args[i].y.toFixed(2);
let z = args[i].z.toFixed(2);
x = x * 100;
y = z * 100;
z = z * 100;
let result = combine(x, y, z);
break;
}
}
}
// ===========================================================================
function combine(a, b, c) {
return toInteger((a << 20) | (b << 10) | c);
}
// ===========================================================================
function killDeathRatio(kills, deaths) {
if(deaths == 0 || kills == 0) {
return 0.0;