Merge pull request #59 from JadeShrineMaiden/additions

Colliding NPC IID quickfix
This commit is contained in:
CPunch 2020-09-02 22:48:09 -05:00 committed by GitHub
commit 7e9793bf90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 2 deletions

View File

@ -15,7 +15,9 @@ std::vector<WarpLocation> NPCManager::RespawnPoints;
void NPCManager::init() {
// load NPCs from NPCs.json into our NPC manager
// Temporary fix, IDs will be pulled from json later
int i = 0;
try {
std::ifstream inFile(settings::NPCJSON);
nlohmann::json npcData;
@ -25,6 +27,11 @@ void NPCManager::init() {
for (nlohmann::json::iterator npc = npcData.begin(); npc != npcData.end(); npc++) {
BaseNPC tmp(npc.value()["x"], npc.value()["y"], npc.value()["z"], npc.value()["id"]);
// Temporary fix, IDs will be pulled from json later
tmp.appearanceData.iNPC_ID = i;
i++;
NPCs[tmp.appearanceData.iNPC_ID] = tmp;
if (npc.value()["id"] == 641 || npc.value()["id"] == 642)
@ -47,7 +54,11 @@ void NPCManager::init() {
for (nlohmann::json::iterator npc = npcData.begin(); npc != npcData.end(); npc++) {
BaseNPC tmp(npc.value()["iX"], npc.value()["iY"], npc.value()["iZ"], npc.value()["iNPCType"],
npc.value()["iHP"], npc.value()["iConditionBitFlag"], npc.value()["iAngle"], npc.value()["iBarkerType"]);
// Temporary fix, IDs will be pulled from json later
tmp.appearanceData.iNPC_ID = i;
i++;
NPCs[tmp.appearanceData.iNPC_ID] = tmp;
}