mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-05 06:50:04 +00:00
Always grab mob HP from XDT
This commit is contained in:
parent
57c28d7539
commit
5431d21d27
@ -463,7 +463,7 @@ void ChunkManager::createInstance(uint64_t instanceID) {
|
||||
continue; // follower; don't copy individually
|
||||
|
||||
Mob* newMob = new Mob(baseNPC->appearanceData.iX, baseNPC->appearanceData.iY, baseNPC->appearanceData.iZ, baseNPC->appearanceData.iAngle,
|
||||
instanceID, baseNPC->appearanceData.iNPCType, ((Mob*)baseNPC)->maxHealth, NPCManager::NPCData[baseNPC->appearanceData.iNPCType], NPCManager::nextId++);
|
||||
instanceID, baseNPC->appearanceData.iNPCType, NPCManager::NPCData[baseNPC->appearanceData.iNPCType], NPCManager::nextId++);
|
||||
NPCManager::NPCs[newMob->appearanceData.iNPC_ID] = newMob;
|
||||
MobManager::Mobs[newMob->appearanceData.iNPC_ID] = newMob;
|
||||
|
||||
@ -477,7 +477,7 @@ void ChunkManager::createInstance(uint64_t instanceID) {
|
||||
BaseNPC* baseFollower = NPCManager::NPCs[mobData->groupMember[i]]; // follower from template
|
||||
// new follower instance
|
||||
Mob* newMobFollower = new Mob(baseFollower->appearanceData.iX, baseFollower->appearanceData.iY, baseFollower->appearanceData.iZ, baseFollower->appearanceData.iAngle,
|
||||
instanceID, baseFollower->appearanceData.iNPCType, ((Mob*)baseFollower)->maxHealth, NPCManager::NPCData[baseFollower->appearanceData.iNPCType], followerID);
|
||||
instanceID, baseFollower->appearanceData.iNPCType, NPCManager::NPCData[baseFollower->appearanceData.iNPCType], followerID);
|
||||
// add follower to NPC maps
|
||||
NPCManager::NPCs[followerID] = newMobFollower;
|
||||
MobManager::Mobs[followerID] = newMobFollower;
|
||||
|
@ -61,9 +61,9 @@ struct Mob : public BaseNPC {
|
||||
// temporary; until we're sure what's what
|
||||
nlohmann::json data;
|
||||
|
||||
Mob(int x, int y, int z, int angle, uint64_t iID, int type, int hp, nlohmann::json d, int32_t id)
|
||||
Mob(int x, int y, int z, int angle, uint64_t iID, int type, nlohmann::json d, int32_t id)
|
||||
: BaseNPC(x, y, z, angle, iID, type, id),
|
||||
maxHealth(hp),
|
||||
maxHealth(d["m_iHP"]),
|
||||
sightRange(d["m_iSightRange"]) {
|
||||
state = MobState::ROAMING;
|
||||
|
||||
@ -91,9 +91,8 @@ struct Mob : public BaseNPC {
|
||||
|
||||
// constructor for /summon
|
||||
Mob(int x, int y, int z, uint64_t iID, int type, nlohmann::json d, int32_t id)
|
||||
: Mob(x, y, z, 0, iID, type, 0, d, id) {
|
||||
: Mob(x, y, z, 0, iID, type, d, id) {
|
||||
summoned = true; // will be despawned and deallocated when killed
|
||||
appearanceData.iHP = maxHealth = d["m_iHP"];
|
||||
}
|
||||
|
||||
~Mob() {}
|
||||
|
@ -233,7 +233,7 @@ void TableData::init() {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// load temporary mob dump
|
||||
// load mobs
|
||||
try {
|
||||
std::ifstream inFile(settings::MOBJSON);
|
||||
nlohmann::json npcData, groupData;
|
||||
@ -249,7 +249,7 @@ void TableData::init() {
|
||||
auto td = NPCManager::NPCData[(int)npc["iNPCType"]];
|
||||
uint64_t instanceID = npc.find("iMapNum") == npc.end() ? INSTANCE_OVERWORLD : (int)npc["iMapNum"];
|
||||
|
||||
Mob *tmp = new Mob(npc["iX"], npc["iY"], npc["iZ"], npc["iAngle"], instanceID, npc["iNPCType"], npc["iHP"], td, nextId);
|
||||
Mob *tmp = new Mob(npc["iX"], npc["iY"], npc["iZ"], npc["iAngle"], instanceID, npc["iNPCType"], td, nextId);
|
||||
|
||||
NPCManager::NPCs[nextId] = tmp;
|
||||
MobManager::Mobs[nextId] = (Mob*)NPCManager::NPCs[nextId];
|
||||
@ -265,7 +265,7 @@ void TableData::init() {
|
||||
auto td = NPCManager::NPCData[(int)leader["iNPCType"]];
|
||||
uint64_t instanceID = leader.find("iMapNum") == leader.end() ? INSTANCE_OVERWORLD : (int)leader["iMapNum"];
|
||||
|
||||
Mob* tmp = new Mob(leader["iX"], leader["iY"], leader["iZ"], leader["iAngle"], instanceID, leader["iNPCType"], leader["iHP"], td, nextId);
|
||||
Mob* tmp = new Mob(leader["iX"], leader["iY"], leader["iZ"], leader["iAngle"], instanceID, leader["iNPCType"], td, nextId);
|
||||
|
||||
NPCManager::NPCs[nextId] = tmp;
|
||||
MobManager::Mobs[nextId] = (Mob*)NPCManager::NPCs[nextId];
|
||||
@ -281,7 +281,7 @@ void TableData::init() {
|
||||
for (nlohmann::json::iterator _fol = followers.begin(); _fol != followers.end(); _fol++) {
|
||||
auto follower = _fol.value();
|
||||
auto tdFol = NPCManager::NPCData[(int)follower["iNPCType"]];
|
||||
Mob* tmpFol = new Mob((int)leader["iX"] + (int)follower["iOffsetX"], (int)leader["iY"] + (int)follower["iOffsetY"], leader["iZ"], leader["iAngle"], instanceID, follower["iNPCType"], follower["iHP"], tdFol, nextId);
|
||||
Mob* tmpFol = new Mob((int)leader["iX"] + (int)follower["iOffsetX"], (int)leader["iY"] + (int)follower["iOffsetY"], leader["iZ"], leader["iAngle"], instanceID, follower["iNPCType"], tdFol, nextId);
|
||||
|
||||
NPCManager::NPCs[nextId] = tmpFol;
|
||||
MobManager::Mobs[nextId] = (Mob*)NPCManager::NPCs[nextId];
|
||||
@ -702,7 +702,7 @@ void TableData::loadGruntwork(int32_t *nextId) {
|
||||
auto td = NPCManager::NPCData[(int)leader["iNPCType"]];
|
||||
uint64_t instanceID = leader.find("iMapNum") == leader.end() ? INSTANCE_OVERWORLD : (int)leader["iMapNum"];
|
||||
|
||||
Mob* tmp = new Mob(leader["iX"], leader["iY"], leader["iZ"], leader["iAngle"], instanceID, leader["iNPCType"], leader["iHP"], td, *nextId);
|
||||
Mob* tmp = new Mob(leader["iX"], leader["iY"], leader["iZ"], leader["iAngle"], instanceID, leader["iNPCType"], td, *nextId);
|
||||
|
||||
// re-enable respawning
|
||||
((Mob*)tmp)->summoned = false;
|
||||
@ -721,7 +721,7 @@ void TableData::loadGruntwork(int32_t *nextId) {
|
||||
for (nlohmann::json::iterator _fol = followers.begin(); _fol != followers.end(); _fol++) {
|
||||
auto follower = _fol.value();
|
||||
auto tdFol = NPCManager::NPCData[(int)follower["iNPCType"]];
|
||||
Mob* tmpFol = new Mob((int)leader["iX"] + (int)follower["iOffsetX"], (int)leader["iY"] + (int)follower["iOffsetY"], leader["iZ"], leader["iAngle"], instanceID, follower["iNPCType"], follower["iHP"], tdFol, *nextId);
|
||||
Mob* tmpFol = new Mob((int)leader["iX"] + (int)follower["iOffsetX"], (int)leader["iY"] + (int)follower["iOffsetY"], leader["iZ"], leader["iAngle"], instanceID, follower["iNPCType"], tdFol, *nextId);
|
||||
|
||||
// re-enable respawning
|
||||
((Mob*)tmp)->summoned = false;
|
||||
|
2
tdata
2
tdata
@ -1 +1 @@
|
||||
Subproject commit 9a3991958689087a5846cac71edd16c82edbf09d
|
||||
Subproject commit daba8a8a622ab9f2f63a72a66c243a49ea926088
|
Loading…
Reference in New Issue
Block a user