Add index members to a bunch of classes

This commit is contained in:
Vortrex
2021-01-02 21:56:55 -06:00
parent 8499bfaf4f
commit 5f8843a8ad

View File

@@ -96,6 +96,7 @@ function initClassTable() {
this.client = client; this.client = client;
this.currentSubAccount = -1; this.currentSubAccount = -1;
this.loggedIn = false; this.loggedIn = false;
this.index = -1;
this.busRoute = null; this.busRoute = null;
this.busRouteStop = null; this.busRouteStop = null;
@@ -217,38 +218,68 @@ function initClassTable() {
}, },
subAccountData: class { subAccountData: class {
constructor(subAccountAssoc) { constructor(subAccountAssoc) {
if(!subAccountAssoc) { this.databaseId = 0;
return; this.server = 0;
} this.firstName = "John";
this.lastName = "Doe";
this.account = 0;
this.skin = 0;
this.cash = 0;
this.placeOfOrigin = "";
this.dateOfBirth = "";
this.spawnPosition = toVector3(0.0, 0.0, 0.0);
this.spawnHeading = 0.0;
this.lastLogin = 0;
this.databaseId = subAccountAssoc["sacct_id"]; this.clan = 0;
this.server = subAccountAssoc["sacct_server"]; this.clanFlags = 0;
this.firstName = subAccountAssoc["sacct_name_first"]; this.clanRank = 0;
this.lastName = subAccountAssoc["sacct_name_last"]; this.clanTitle = 0;
this.account = subAccountAssoc["sacct_acct"];
this.skin = subAccountAssoc["sacct_skin"];
this.cash = subAccountAssoc["sacct_cash"];
this.placeOfOrigin = subAccountAssoc["sacct_origin"];
this.dateOfBirth = subAccountAssoc["sacct_when_born"];
this.spawnPosition = toVector3(subAccountAssoc["sacct_pos_x"], subAccountAssoc["sacct_pos_y"], subAccountAssoc["sacct_pos_z"]);
this.spawnHeading = toFloat(subAccountAssoc["sacct_angle"]);
this.lastLogin = toInteger(subAccountAssoc["sacct_last_login"]);
this.clan = toInteger(subAccountAssoc["sacct_clan"]);
this.clanFlags = toInteger(subAccountAssoc["sacct_clan_flags"]);
this.clanRank = toInteger(subAccountAssoc["sacct_clan_rank"]);
this.clanTitle = toInteger(subAccountAssoc["sacct_clan_title"]);
this.isWorking = false; this.isWorking = false;
this.jobUniform = this.skin; this.jobUniform = this.skin;
this.lastJobVehicle = null; this.lastJobVehicle = null;
this.job = subAccountAssoc["sacct_job"]; this.job = 0;
this.weapons = []; this.weapons = [];
this.inJail = false; this.inJail = false;
this.interior = 0; this.interior = 0;
this.dimension = 0; this.dimension = 0;
if(subAccountAssoc) {
this.databaseId = subAccountAssoc["sacct_id"];
this.server = subAccountAssoc["sacct_server"];
this.firstName = subAccountAssoc["sacct_name_first"];
this.lastName = subAccountAssoc["sacct_name_last"];
this.account = subAccountAssoc["sacct_acct"];
this.skin = subAccountAssoc["sacct_skin"];
this.cash = subAccountAssoc["sacct_cash"];
this.placeOfOrigin = subAccountAssoc["sacct_origin"];
this.dateOfBirth = subAccountAssoc["sacct_when_born"];
this.spawnPosition = toVector3(subAccountAssoc["sacct_pos_x"], subAccountAssoc["sacct_pos_y"], subAccountAssoc["sacct_pos_z"]);
this.spawnHeading = toFloat(subAccountAssoc["sacct_angle"]);
this.lastLogin = toInteger(subAccountAssoc["sacct_last_login"]);
this.clan = toInteger(subAccountAssoc["sacct_clan"]);
this.clanFlags = toInteger(subAccountAssoc["sacct_clan_flags"]);
this.clanRank = toInteger(subAccountAssoc["sacct_clan_rank"]);
this.clanTitle = toInteger(subAccountAssoc["sacct_clan_title"]);
this.isWorking = false;
this.jobUniform = this.skin;
this.lastJobVehicle = null;
this.job = subAccountAssoc["sacct_job"];
this.weapons = [];
this.inJail = false;
this.interior = subAccountAssoc["sacct_int"];
this.dimension = subAccountAssoc["sacct_vw"];
return;
}
} }
}, },
businessData: class { businessData: class {
@@ -260,6 +291,7 @@ function initClassTable() {
this.buyPrice = 0; this.buyPrice = 0;
this.locked = false; this.locked = false;
this.hasInterior = false; this.hasInterior = false;
this.index = -1;
this.entrancePosition = false; this.entrancePosition = false;
this.entranceRotation = 0.0; this.entranceRotation = 0.0;
@@ -311,20 +343,30 @@ function initClassTable() {
} }
}, },
businessLocationData: class { businessLocationData: class {
constructor(businessLocationAssoc) { constructor(dbAssoc) {
if(!businessLocationAssoc) { this.databaseId = 0;
return; this.name = "";
this.type = 0;
this.business = 0;
this.enabled = false;
this.index = -1;
this.position = toVector3(0.0, 0.0, 0.0);
this.interior = 0;
this.dimension = 0;
if(dbAssoc) {
this.databaseId = toInteger(dbAssoc("biz_loc_id"));
this.name = toString(dbAssoc("biz_loc_name"));
this.type = toInteger(dbAssoc("biz_loc_type"));
this.business = toInteger(dbAssoc("biz_loc_biz"));
this.enabled = intToBool(toInteger(dbAssoc("biz_loc_enabled")));
this.index = -1;
this.position = toVector3(toFloat(dbAssoc("biz_loc_pos_x")), toFloat(dbAssoc("biz_loc_pos_y")), toFloat(dbAssoc("biz_loc_pos_z")));
this.interior = toInteger(dbAssoc["biz_loc_int"]);
this.dimension = toInteger(dbAssoc["biz_loc_vw"]);
} }
this.databaseId = toInteger(businessLocationAssoc("biz_loc_id"));
this.name = toString(businessLocationAssoc("biz_loc_name"));
this.type = toInteger(businessLocationAssoc("biz_loc_type"));
this.business = toInteger(businessLocationAssoc("biz_loc_biz"));
this.enabled = intToBool(toInteger(businessLocationAssoc("biz_loc_enabled")));
this.position = toVector3(toFloat(businessLocationAssoc("biz_loc_pos_x")), toFloat(businessLocationAssoc("biz_loc_pos_y")), toFloat(businessLocationAssoc("biz_loc_pos_z")));
this.interior = toInteger(businessLocationAssoc["biz_loc_int"]);
this.dimension = toInteger(businessLocationAssoc["biz_loc_vw"]);
} }
}, },
houseData: class { houseData: class {
@@ -336,6 +378,7 @@ function initClassTable() {
this.buyPrice = 0; this.buyPrice = 0;
this.locked = false; this.locked = false;
this.hasInterior = false; this.hasInterior = false;
this.index = -1;
this.entrancePosition = false; this.entrancePosition = false;
this.entranceRotation = 0.0; this.entranceRotation = 0.0;
@@ -393,6 +436,7 @@ function initClassTable() {
this.server = getServerId(); this.server = getServerId();
this.model = (vehicle != false) ? vehicle.modelIndex : 0; this.model = (vehicle != false) ? vehicle.modelIndex : 0;
this.vehicle = vehicle; this.vehicle = vehicle;
this.index = -1;
// Ownership // Ownership
this.ownerType = AG_VEHOWNER_NONE; this.ownerType = AG_VEHOWNER_NONE;
@@ -511,7 +555,7 @@ function initClassTable() {
} }
}, },
jobData: class { jobData: class {
constructor(jobAssoc) { constructor(dbAssoc) {
this.databaseId = 0; this.databaseId = 0;
this.type = AG_JOB_NONE; this.type = AG_JOB_NONE;
this.name = "Unnamed"; this.name = "Unnamed";
@@ -521,7 +565,7 @@ function initClassTable() {
this.colour = toColour(0, 0, 0, 255); this.colour = toColour(0, 0, 0, 255);
this.whiteListEnabled = false; this.whiteListEnabled = false;
this.blackListEnabled = false; this.blackListEnabled = false;
this.id = -1; this.index = -1;
this.equipment = []; this.equipment = [];
this.uniforms = []; this.uniforms = [];
@@ -529,16 +573,16 @@ function initClassTable() {
this.whiteList = []; this.whiteList = [];
this.blackList = []; this.blackList = [];
if(jobAssoc) { if(dbAssoc) {
this.databaseId = jobAssoc["job_id"]; this.databaseId = dbAssoc["job_id"];
this.type = jobAssoc["job_type"]; this.type = dbAssoc["job_type"];
this.name = jobAssoc["job_name"]; this.name = dbAssoc["job_name"];
this.enabled = jobAssoc["job_enabled"]; this.enabled = dbAssoc["job_enabled"];
this.blipModel = jobAssoc["job_blip"]; this.blipModel = dbAssoc["job_blip"];
this.pickupModel = jobAssoc["job_pickup"]; this.pickupModel = dbAssoc["job_pickup"];
this.colour = toColour(jobAssoc["job_colour_r"], jobAssoc["job_colour_g"], jobAssoc["job_colour_b"], 255); this.colour = toColour(dbAssoc["job_colour_r"], dbAssoc["job_colour_g"], dbAssoc["job_colour_b"], 255);
this.whiteListEnabled = jobAssoc["job_whitelist"]; this.whiteListEnabled = dbAssoc["job_whitelist"];
this.blackListEnabled = jobAssoc["job_blacklist"]; this.blackListEnabled = dbAssoc["job_blacklist"];
this.equipment = []; this.equipment = [];
this.uniforms = []; this.uniforms = [];
@@ -549,60 +593,63 @@ function initClassTable() {
} }
}, },
jobEquipmentData: class { jobEquipmentData: class {
constructor(jobEquipmentAssoc) { constructor(dbAssoc) {
this.databaseId = 0; this.databaseId = 0;
this.job = 0; this.job = 0;
this.name = "Unnamed"; this.name = "Unnamed";
this.requiredRank = 0; this.requiredRank = 0;
this.enabled = false; this.enabled = false;
this.index = -1;
if(jobEquipmentAssoc) { if(dbAssoc) {
this.databaseId = jobEquipmentAssoc["job_equip_id"]; this.databaseId = dbAssoc["job_equip_id"];
this.job = jobEquipmentAssoc["job_equip_job"]; this.job = dbAssoc["job_equip_job"];
this.name = jobEquipmentAssoc["job_equip_name"]; this.name = dbAssoc["job_equip_name"];
this.requiredRank = jobEquipmentAssoc["job_equip_minrank"]; this.requiredRank = dbAssoc["job_equip_minrank"];
this.enabled = jobEquipmentAssoc["job_equip_enabled"]; this.enabled = dbAssoc["job_equip_enabled"];
} }
} }
}, },
jobEquipmentWeaponData: class { jobEquipmentWeaponData: class {
constructor(jobEquipmentWeaponAssoc) { constructor(dbAssoc) {
this.databaseId = 0; this.databaseId = 0;
this.equipmentId = 0; this.equipmentId = 0;
this.weaponId = 0; this.weaponId = 0;
this.ammo = 0; this.ammo = 0;
this.enabled = false; this.enabled = false;
this.index = -1;
if(jobEquipmentWeaponAssoc) { if(dbAssoc) {
this.databaseId = jobEquipmentWeaponAssoc["job_equip_wep_id"]; this.databaseId = dbAssoc["job_equip_wep_id"];
this.equipmentId = jobEquipmentWeaponAssoc["job_equip_wep_equip"]; this.equipmentId = dbAssoc["job_equip_wep_equip"];
this.weaponId = jobEquipmentWeaponAssoc["job_equip_wep_wep"]; this.weaponId = dbAssoc["job_equip_wep_wep"];
this.ammo = jobEquipmentWeaponAssoc["job_equip_wep_ammo"]; this.ammo = dbAssoc["job_equip_wep_ammo"];
this.enabled = jobEquipmentWeaponAssoc["job_equip_wep_enabled"]; this.enabled = dbAssoc["job_equip_wep_enabled"];
} }
} }
}, },
jobUniformData: class { jobUniformData: class {
constructor(jobUniformAssoc) { constructor(dbAssoc) {
this.databaseId = 0; this.databaseId = 0;
this.job = 0; this.job = 0;
this.name = "Unnamed"; this.name = "Unnamed";
this.requiredRank = 0 this.requiredRank = 0
this.skin = -1; this.skin = -1;
this.enabled = false; this.enabled = false;
this.index = -1;
if(jobUniformAssoc) { if(dbAssoc) {
this.databaseId = jobUniformAssoc["job_uniform_id"]; this.databaseId = dbAssoc["job_uniform_id"];
this.job = jobUniformAssoc["job_uniform_job"]; this.job = dbAssoc["job_uniform_job"];
this.name = jobUniformAssoc["job_uniform_name"]; this.name = dbAssoc["job_uniform_name"];
this.requiredRank = jobUniformAssoc["job_uniform_minrank"]; this.requiredRank = dbAssoc["job_uniform_minrank"];
this.skin = jobUniformAssoc["job_uniform_skin"]; this.skin = dbAssoc["job_uniform_skin"];
this.enabled = jobUniformAssoc["job_uniform_skin"]; this.enabled = dbAssoc["job_uniform_skin"];
} }
} }
}, },
jobLocationData: class { jobLocationData: class {
constructor(jobLocationAssoc) { constructor(dbAssoc) {
this.databaseId = 0; this.databaseId = 0;
this.job = 0; this.job = 0;
this.position = toVector3(0.0, 0.0, 0.0); this.position = toVector3(0.0, 0.0, 0.0);
@@ -611,46 +658,49 @@ function initClassTable() {
this.enabled = false; this.enabled = false;
this.interior = 0; this.interior = 0;
this.dimension = 0; this.dimension = 0;
this.index = -1;
if(jobLocationAssoc) { if(dbAssoc) {
this.databaseId = jobLocationAssoc["job_loc_id"]; this.databaseId = dbAssoc["job_loc_id"];
this.job = jobLocationAssoc["job_loc_job"]; this.job = dbAssoc["job_loc_job"];
this.position = toVector3(jobLocationAssoc["job_loc_pos_x"], jobLocationAssoc["job_loc_pos_y"], jobLocationAssoc["job_loc_pos_z"]); this.position = toVector3(dbAssoc["job_loc_pos_x"], dbAssoc["job_loc_pos_y"], dbAssoc["job_loc_pos_z"]);
this.blip = false; this.blip = false;
this.pickup = false; this.pickup = false;
this.enabled = jobLocationAssoc["job_loc_enabled"]; this.enabled = dbAssoc["job_loc_enabled"];
this.interior = jobLocationAssoc["job_loc_int"]; this.interior = dbAssoc["job_loc_int"];
this.dimension = jobLocationAssoc["job_loc_vw"]; this.dimension = dbAssoc["job_loc_vw"];
} }
} }
}, },
jobWhiteListData: class { jobWhiteListData: class {
constructor(jobWhiteListAssoc) { constructor(dbAssoc) {
this.databaseId = 0; this.databaseId = 0;
this.job = 0; this.job = 0;
this.subAccount = 0 this.subAccount = 0
this.enabled = false; this.enabled = false;
this.index = -1;
if(jobWhiteListAssoc) { if(dbAssoc) {
this.databaseId = jobWhiteListAssoc["job_wl_id"]; this.databaseId = dbAssoc["job_wl_id"];
this.job = jobWhiteListAssoc["job_wl_job"]; this.job = dbAssoc["job_wl_job"];
this.subAccount = jobWhiteListAssoc["job_wl_sacct"] this.subAccount = dbAssoc["job_wl_sacct"]
this.enabled = jobWhiteListAssoc["job_wl_enabled"]; this.enabled = dbAssoc["job_wl_enabled"];
} }
} }
}, },
jobBlackListData: class { jobBlackListData: class {
constructor(jobBlackListAssoc) { constructor(dbAssoc) {
this.databaseId = 0; this.databaseId = 0;
this.job = 0; this.job = 0;
this.subAccount = 0 this.subAccount = 0
this.enabled = false; this.enabled = false;
this.index = -1;
if(jobBlackListAssoc) { if(dbAssoc) {
this.databaseId = jobBlackListAssoc["job_bl_id"]; this.databaseId = dbAssoc["job_bl_id"];
this.job = jobBlackListAssoc["job_bl_job"]; this.job = dbAssoc["job_bl_job"];
this.subAccount = jobBlackListAssoc["job_bl_sacct"] this.subAccount = dbAssoc["job_bl_sacct"]
this.enabled = jobBlackListAssoc["job_bl_enabled"]; this.enabled = dbAssoc["job_bl_enabled"];
} }
} }
}, },
@@ -663,39 +713,49 @@ function initClassTable() {
this.whenAdded = 0; this.whenAdded = 0;
this.enabled = true; this.enabled = true;
this.keyState = false; this.keyState = false;
this.index = -1;
if(keyBindAssoc) { if(dbAssoc) {
this.databaseId = keyBindAssoc["acct_hotkey_id"]; this.databaseId = dbAssoc["acct_hotkey_id"];
this.key = toInteger(keyBindAssoc["acct_hotkey_key"]); this.key = toInteger(dbAssoc["acct_hotkey_key"]);
this.account = toInteger(keyBindAssoc["acct_hotkey_acct"]); this.account = toInteger(dbAssoc["acct_hotkey_acct"]);
this.commandString = keyBindAssoc["acct_hotkey_cmdstr"]; this.commandString = dbAssoc["acct_hotkey_cmdstr"];
this.whenAdded = keyBindAssoc["acct_hotkey_when_added"]; this.whenAdded = dbAssoc["acct_hotkey_when_added"];
this.enabled = intToBool(keyBindAssoc["acct_hotkey_enabled"]); this.enabled = intToBool(dbAssoc["acct_hotkey_enabled"]);
this.keyState = intToBool(keyBindAssoc["acct_hotkey_down"]); this.keyState = intToBool(dbAssoc["acct_hotkey_down"]);
} }
} }
}, },
blackListedGameScriptData: class { blackListedGameScriptData: class {
constructor(dbAssoc) { constructor(dbAssoc) {
if(!dbAssoc) { this.databaseId = 0;
return; this.enabled = false
this.server = 0;
this.scriptName = "";
this.index = -1;
if(dbAssoc) {
this.databaseId = dbAssoc["ac_script_bl_id"];
this.enabled = intToBool(dbAssoc["ac_script_bl_enabled"]);
this.server = dbAssoc["ac_script_bl_server"];
this.scriptName = dbAssoc["ac_script_bl_name"];
} }
this.databaseId = dbAssoc["ac_script_bl_id"];
this.enabled = intToBool(dbAssoc["ac_script_bl_enabled"]);
this.server = dbAssoc["ac_script_bl_server"];
this.scriptName = dbAssoc["ac_script_bl_name"];
} }
}, },
whiteListedGameScriptData: class { whiteListedGameScriptData: class {
constructor(dbAssoc) { constructor(dbAssoc) {
if(!dbAssoc) { this.databaseId = 0;
return; this.enabled = false
} this.server = 0;
this.scriptName = "";
this.index = -1;
this.databaseId = dbAssoc["ac_script_wl_id"]; if(dbAssoc) {
this.enabled = intToBool(dbAssoc["ac_script_wl_enabled"]); this.databaseId = dbAssoc["ac_script_wl_id"];
this.server = dbAssoc["ac_script_wl_server"]; this.enabled = intToBool(dbAssoc["ac_script_wl_enabled"]);
this.scriptName = dbAssoc["ac_script_wl_name"]; this.server = dbAssoc["ac_script_wl_server"];
this.scriptName = dbAssoc["ac_script_wl_name"];
}
} }
}, },
removedWorldObjectData: class { removedWorldObjectData: class {
@@ -706,9 +766,9 @@ function initClassTable() {
} }
}, },
interiorTemplateData: class { interiorTemplateData: class {
constructor(exitPosition, interior) { constructor(exitPosition, exitInterior) {
this.exitPosition = exitPosition; this.exitPosition = exitPosition;
this.interior = interior; this.exitInterior = exitInterior;
} }
}, },
} }