mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-05 06:50:04 +00:00
Populated the future with scraped mobs.
This system is temporary; meant to ease testing.
This commit is contained in:
parent
60be814e16
commit
3e5101892b
@ -30,6 +30,6 @@ gm=true
|
|||||||
|
|
||||||
# spawn coordinates (Z is height)
|
# spawn coordinates (Z is height)
|
||||||
# the supplied defaults are at City Hall
|
# the supplied defaults are at City Hall
|
||||||
spawnx=179213
|
spawnx=632032
|
||||||
spawny=268451
|
spawny=187177
|
||||||
spawnz=-4210
|
spawnz=-5500
|
||||||
|
19
src/NPC.hpp
19
src/NPC.hpp
@ -1,5 +1,4 @@
|
|||||||
#ifndef _NPCCLASS_HPP
|
#pragma once
|
||||||
#define _NPCCLASS_HPP
|
|
||||||
|
|
||||||
#include "CNStructs.hpp"
|
#include "CNStructs.hpp"
|
||||||
|
|
||||||
@ -21,6 +20,18 @@ public:
|
|||||||
// hopefully no collisions happen :eyes:
|
// hopefully no collisions happen :eyes:
|
||||||
appearanceData.iNPC_ID = (int32_t)rand();
|
appearanceData.iNPC_ID = (int32_t)rand();
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
BaseNPC(int x, int y, int z, int type, int hp, int cond, int angle, int barker) {
|
||||||
|
appearanceData.iX = x;
|
||||||
|
appearanceData.iY = y;
|
||||||
|
appearanceData.iZ = z;
|
||||||
|
appearanceData.iNPCType = type;
|
||||||
|
appearanceData.iHP = hp;
|
||||||
|
appearanceData.iAngle = angle;
|
||||||
|
appearanceData.iConditionBitFlag = cond;
|
||||||
|
appearanceData.iBarkerType = barker;
|
||||||
|
|
||||||
|
// hopefully no collisions happen :eyes:
|
||||||
|
appearanceData.iNPC_ID = (int32_t)rand();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
@ -31,11 +31,30 @@ void NPCManager::init() {
|
|||||||
RespawnPoints.push_back({npc.value()["x"], npc.value()["y"], ((int)npc.value()["z"]) + RESURRECT_HEIGHT});
|
RespawnPoints.push_back({npc.value()["x"], npc.value()["y"], ((int)npc.value()["z"]) + RESURRECT_HEIGHT});
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "[INFO] populated " << NPCs.size() << " NPCs" << std::endl;
|
|
||||||
} catch (const std::exception& err) {
|
} catch (const std::exception& err) {
|
||||||
std::cerr << "[WARN] Malformed NPCs.json file! Reason:" << err.what() << std::endl;
|
std::cerr << "[WARN] Malformed NPCs.json file! Reason:" << err.what() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// load temporary mob dump
|
||||||
|
try {
|
||||||
|
std::ifstream inFile("mobs.json"); // not in settings, since it's temp
|
||||||
|
nlohmann::json npcData;
|
||||||
|
|
||||||
|
// read file into json
|
||||||
|
inFile >> npcData;
|
||||||
|
|
||||||
|
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"]);
|
||||||
|
|
||||||
|
NPCs[tmp.appearanceData.iNPC_ID] = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "[INFO] populated " << NPCs.size() << " NPCs" << std::endl;
|
||||||
|
} catch (const std::exception& err) {
|
||||||
|
std::cerr << "[WARN] Malformed mobs.json file! Reason:" << err.what() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
std::ifstream infile(settings::WARPJSON);
|
std::ifstream infile(settings::WARPJSON);
|
||||||
nlohmann::json warpData;
|
nlohmann::json warpData;
|
||||||
@ -142,7 +161,7 @@ void NPCManager::npcSummonHandler(CNSocket *sock, CNPacketData *data) {
|
|||||||
Player *plr = PlayerManager::getPlayer(sock);
|
Player *plr = PlayerManager::getPlayer(sock);
|
||||||
|
|
||||||
// permission & sanity check
|
// permission & sanity check
|
||||||
if (!plr->IsGM || req->iNPCType >= NPCs.size())
|
if (!plr->IsGM || req->iNPCType >= 3314)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
resp.NPCAppearanceData.iNPC_ID = rand(); // cpunch-style
|
resp.NPCAppearanceData.iNPC_ID = rand(); // cpunch-style
|
||||||
|
@ -202,6 +202,7 @@ void PlayerManager::enterPlayer(CNSocket* sock, CNPacketData* data) {
|
|||||||
response.PCLoadData2CL.iX = plr.x;
|
response.PCLoadData2CL.iX = plr.x;
|
||||||
response.PCLoadData2CL.iY = plr.y;
|
response.PCLoadData2CL.iY = plr.y;
|
||||||
response.PCLoadData2CL.iZ = plr.z;
|
response.PCLoadData2CL.iZ = plr.z;
|
||||||
|
response.PCLoadData2CL.iAngle = 130;
|
||||||
response.PCLoadData2CL.iActiveNanoSlotNum = -1;
|
response.PCLoadData2CL.iActiveNanoSlotNum = -1;
|
||||||
response.PCLoadData2CL.iFatigue = 50;
|
response.PCLoadData2CL.iFatigue = 50;
|
||||||
response.PCLoadData2CL.PCStyle = plr.PCStyle;
|
response.PCLoadData2CL.PCStyle = plr.PCStyle;
|
||||||
|
Loading…
Reference in New Issue
Block a user