NPC class, data load and save

This commit is contained in:
Vortrex
2022-03-24 15:25:23 -05:00
parent a2882a88df
commit bbf0921003
2 changed files with 43 additions and 74 deletions

View File

@@ -1468,8 +1468,10 @@ class NPCData {
this.middleName = "Q";
this.skin = 0;
this.cash = 0;
this.spawnPosition = toVector3(0.0, 0.0, 0.0);
this.spawnHeading = 0.0;
this.position = toVector3(0.0, 0.0, 0.0);
this.rotation = toVector3(0.0, 0.0, 0.0);
this.scale = toVector3(1.0, 1.0, 1.0);
this.heading = 0.0;
this.clan = 0;
this.isWorking = false;
this.jobUniform = this.skin;
@@ -1478,7 +1480,6 @@ class NPCData {
this.weapons = [];
this.interior = 0;
this.dimension = 0;
this.pedScale = toVector3(1.0, 1.0, 1.0);
this.walkStyle = 0;
this.fightStyle = 0;
this.health = 100;
@@ -1514,17 +1515,16 @@ class NPCData {
this.middleName = dbAssoc["npc_name_middle"] || "";
this.skin = toInteger(dbAssoc["npc_skin"]);
this.cash = toInteger(dbAssoc["npc_cash"]);
this.spawnPosition = toVector3(toFloat(dbAssoc["npc_pos_x"]), toFloat(dbAssoc["npc_pos_y"]), toFloat(dbAssoc["npc_pos_z"]));
this.spawnHeading = toFloat(dbAssoc["npc_angle"]);
this.position = toVector3(toFloat(dbAssoc["npc_pos_x"]), toFloat(dbAssoc["npc_pos_y"]), toFloat(dbAssoc["npc_pos_z"]));
this.rotation = toVector3(toFloat(dbAssoc["npc_rot_x"]), toFloat(dbAssoc["npc_rot_y"]), toFloat(dbAssoc["npc_rot_z"]));
this.scale = toVector3(toFloat(dbAssoc["npc_scale_x"]), toFloat(dbAssoc["npc_scale_y"]), toFloat(dbAssoc["npc_scale_z"]));
this.heading = toFloat(dbAssoc["npc_rot_z"]);
this.lastLogin = toInteger(dbAssoc["npc_when_lastlogin"]);
this.clan = toInteger(dbAssoc["npc_clan"]);
this.clanFlags = toInteger(dbAssoc["npc_clan_flags"]);
this.clanRank = toInteger(dbAssoc["npc_clan_rank"]);
this.clanTitle = toInteger(dbAssoc["npc_clan_title"]);
this.rank = toInteger(dbAssoc["npc_rank"]);
this.title = toInteger(dbAssoc["npc_title"]);
this.job = toInteger(dbAssoc["npc_job"]);
this.interior = toInteger(dbAssoc["npc_int"]);
this.dimension = toInteger(dbAssoc["npc_vw"]);
this.pedScale = toVector3(toFloat(dbAssoc["npc_scale_x"]), toFloat(dbAssoc["npc_scale_y"]), toFloat(dbAssoc["npc_scale_z"]));
this.walkStyle = toInteger(dbAssoc["npc_walkstyle"]);
this.fightStyle = toInteger(dbAssoc["npc_fightstyle"]);
this.health = toInteger(dbAssoc["npc_health"]);