mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-17 03:20:06 +00:00
[WIP] Rename Entity.type -> Entity.kind
This commit is contained in:
parent
0af8f7e91d
commit
1858938280
@ -142,7 +142,7 @@ bool doDebuff(CNSocket *sock, sSkillResult_Buff *respdata, int i, int32_t target
|
|||||||
}
|
}
|
||||||
|
|
||||||
BaseNPC* npc = NPCManager::NPCs[targetID];
|
BaseNPC* npc = NPCManager::NPCs[targetID];
|
||||||
if (npc->type != EntityType::MOB) {
|
if (npc->kind != EntityType::MOB) {
|
||||||
std::cout << "[WARN] doDebuff: NPC is not a mob" << std::endl;
|
std::cout << "[WARN] doDebuff: NPC is not a mob" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -213,7 +213,7 @@ bool doDamageNDebuff(CNSocket *sock, sSkillResult_Damage_N_Debuff *respdata, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
BaseNPC* npc = NPCManager::NPCs[targetID];
|
BaseNPC* npc = NPCManager::NPCs[targetID];
|
||||||
if (npc->type != EntityType::MOB) {
|
if (npc->kind != EntityType::MOB) {
|
||||||
std::cout << "[WARN] doDamageNDebuff: NPC is not a mob" << std::endl;
|
std::cout << "[WARN] doDamageNDebuff: NPC is not a mob" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -281,7 +281,7 @@ bool doDamage(CNSocket *sock, sSkillResult_Damage *respdata, int i, int32_t targ
|
|||||||
}
|
}
|
||||||
|
|
||||||
BaseNPC* npc = NPCManager::NPCs[targetID];
|
BaseNPC* npc = NPCManager::NPCs[targetID];
|
||||||
if (npc->type != EntityType::MOB) {
|
if (npc->kind != EntityType::MOB) {
|
||||||
std::cout << "[WARN] doDamage: NPC is not a mob" << std::endl;
|
std::cout << "[WARN] doDamage: NPC is not a mob" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -337,7 +337,7 @@ bool doLeech(CNSocket *sock, sSkillResult_Heal_HP *healdata, int i, int32_t targ
|
|||||||
}
|
}
|
||||||
|
|
||||||
BaseNPC* npc = NPCManager::NPCs[targetID];
|
BaseNPC* npc = NPCManager::NPCs[targetID];
|
||||||
if (npc->type != EntityType::MOB) {
|
if (npc->kind != EntityType::MOB) {
|
||||||
std::cout << "[WARN] doLeech: NPC is not a mob" << std::endl;
|
std::cout << "[WARN] doLeech: NPC is not a mob" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -468,7 +468,7 @@ bool doHeal(Mob* mob, sSkillResult_Heal_HP* respdata, int i, int32_t targetID, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
BaseNPC* npc = NPCManager::NPCs[targetID];
|
BaseNPC* npc = NPCManager::NPCs[targetID];
|
||||||
if (npc->type != EntityType::MOB) {
|
if (npc->kind != EntityType::MOB) {
|
||||||
std::cout << "[WARN] doHeal: NPC is not a mob" << std::endl;
|
std::cout << "[WARN] doHeal: NPC is not a mob" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -275,7 +275,7 @@ void Chunking::createInstance(uint64_t instanceID) {
|
|||||||
BaseNPC* baseNPC = (BaseNPC*)ref.getEntity();
|
BaseNPC* baseNPC = (BaseNPC*)ref.getEntity();
|
||||||
|
|
||||||
// make a copy of each NPC in the template chunks and put them in the new instance
|
// make a copy of each NPC in the template chunks and put them in the new instance
|
||||||
if (baseNPC->type == EntityType::MOB) {
|
if (baseNPC->kind == EntityType::MOB) {
|
||||||
if (((Mob*)baseNPC)->groupLeader != 0 && ((Mob*)baseNPC)->groupLeader != npcID)
|
if (((Mob*)baseNPC)->groupLeader != 0 && ((Mob*)baseNPC)->groupLeader != npcID)
|
||||||
continue; // follower; don't copy individually
|
continue; // follower; don't copy individually
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ static void pcAttackNpcs(CNSocket *sock, CNPacketData *data) {
|
|||||||
|
|
||||||
|
|
||||||
BaseNPC* npc = NPCManager::NPCs[targets[i]];
|
BaseNPC* npc = NPCManager::NPCs[targets[i]];
|
||||||
if (npc->type != EntityType::MOB) {
|
if (npc->kind != EntityType::MOB) {
|
||||||
std::cout << "[WARN] pcAttackNpcs: NPC is not a mob" << std::endl;
|
std::cout << "[WARN] pcAttackNpcs: NPC is not a mob" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -486,7 +486,7 @@ static void pcAttackChars(CNSocket *sock, CNPacketData *data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BaseNPC* npc = NPCManager::NPCs[pktdata[i * 2]];
|
BaseNPC* npc = NPCManager::NPCs[pktdata[i * 2]];
|
||||||
if (npc->type != EntityType::MOB) {
|
if (npc->kind != EntityType::MOB) {
|
||||||
std::cout << "[WARN] pcAttackChars: NPC is not a mob" << std::endl;
|
std::cout << "[WARN] pcAttackChars: NPC is not a mob" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -696,7 +696,7 @@ static void projectileHit(CNSocket* sock, CNPacketData* data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BaseNPC* npc = NPCManager::NPCs[pktdata[i]];
|
BaseNPC* npc = NPCManager::NPCs[pktdata[i]];
|
||||||
if (npc->type != EntityType::MOB) {
|
if (npc->kind != EntityType::MOB) {
|
||||||
std::cout << "[WARN] projectileHit: NPC is not a mob" << std::endl;
|
std::cout << "[WARN] projectileHit: NPC is not a mob" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -283,10 +283,10 @@ static void unsummonWCommand(std::string full, std::vector<std::string>& args, C
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NPCManager::NPCs.find(npc->appearanceData.iNPC_ID) != NPCManager::NPCs.end() && NPCManager::NPCs[npc->appearanceData.iNPC_ID]->type == EntityType::MOB) {
|
if (NPCManager::NPCs.find(npc->appearanceData.iNPC_ID) != NPCManager::NPCs.end() && NPCManager::NPCs[npc->appearanceData.iNPC_ID]->kind == EntityType::MOB) {
|
||||||
int leadId = ((Mob*)npc)->groupLeader;
|
int leadId = ((Mob*)npc)->groupLeader;
|
||||||
if (leadId != 0) {
|
if (leadId != 0) {
|
||||||
if (NPCManager::NPCs.find(leadId) == NPCManager::NPCs.end() || NPCManager::NPCs[leadId]->type != EntityType::MOB) {
|
if (NPCManager::NPCs.find(leadId) == NPCManager::NPCs.end() || NPCManager::NPCs[leadId]->kind != EntityType::MOB) {
|
||||||
std::cout << "[WARN] unsummonW: leader not found!" << std::endl;
|
std::cout << "[WARN] unsummonW: leader not found!" << std::endl;
|
||||||
}
|
}
|
||||||
Mob* leadNpc = (Mob*)NPCManager::NPCs[leadId];
|
Mob* leadNpc = (Mob*)NPCManager::NPCs[leadId];
|
||||||
@ -294,7 +294,7 @@ static void unsummonWCommand(std::string full, std::vector<std::string>& args, C
|
|||||||
if (leadNpc->groupMember[i] == 0)
|
if (leadNpc->groupMember[i] == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (NPCManager::NPCs.find(leadNpc->groupMember[i]) == NPCManager::NPCs.end() || NPCManager::NPCs[leadNpc->groupMember[i]]->type != EntityType::MOB) {
|
if (NPCManager::NPCs.find(leadNpc->groupMember[i]) == NPCManager::NPCs.end() || NPCManager::NPCs[leadNpc->groupMember[i]]->kind != EntityType::MOB) {
|
||||||
std::cout << "[WARN] unsommonW: leader can't find a group member!" << std::endl;
|
std::cout << "[WARN] unsommonW: leader can't find a group member!" << std::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -324,7 +324,7 @@ static void toggleAiCommand(std::string full, std::vector<std::string>& args, CN
|
|||||||
|
|
||||||
// return all mobs to their spawn points
|
// return all mobs to their spawn points
|
||||||
for (auto& pair : NPCManager::NPCs) {
|
for (auto& pair : NPCManager::NPCs) {
|
||||||
if (pair.second->type != EntityType::MOB)
|
if (pair.second->kind != EntityType::MOB)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Mob* mob = (Mob*)pair.second;
|
Mob* mob = (Mob*)pair.second;
|
||||||
@ -609,7 +609,7 @@ static void summonGroupCommand(std::string full, std::vector<std::string>& args,
|
|||||||
}
|
}
|
||||||
|
|
||||||
BaseNPC *npc = NPCManager::summonNPC(x, y, z, plr->instanceID, type, wCommand);
|
BaseNPC *npc = NPCManager::summonNPC(x, y, z, plr->instanceID, type, wCommand);
|
||||||
if (team == 2 && i > 0 && npc->type == EntityType::MOB) {
|
if (team == 2 && i > 0 && npc->kind == EntityType::MOB) {
|
||||||
leadNpc->groupMember[i-1] = npc->appearanceData.iNPC_ID;
|
leadNpc->groupMember[i-1] = npc->appearanceData.iNPC_ID;
|
||||||
Mob* mob = (Mob*)NPCManager::NPCs[npc->appearanceData.iNPC_ID];
|
Mob* mob = (Mob*)NPCManager::NPCs[npc->appearanceData.iNPC_ID];
|
||||||
mob->groupLeader = leadNpc->appearanceData.iNPC_ID;
|
mob->groupLeader = leadNpc->appearanceData.iNPC_ID;
|
||||||
@ -624,7 +624,7 @@ static void summonGroupCommand(std::string full, std::vector<std::string>& args,
|
|||||||
if (PLAYERID(plr->instanceID) != 0) {
|
if (PLAYERID(plr->instanceID) != 0) {
|
||||||
npc = NPCManager::summonNPC(plr->x, plr->y, plr->z, plr->instanceID, type, wCommand, true);
|
npc = NPCManager::summonNPC(plr->x, plr->y, plr->z, plr->instanceID, type, wCommand, true);
|
||||||
|
|
||||||
if (team == 2 && i > 0 && npc->type == EntityType::MOB) {
|
if (team == 2 && i > 0 && npc->kind == EntityType::MOB) {
|
||||||
leadNpc->groupMember[i-1] = npc->appearanceData.iNPC_ID;
|
leadNpc->groupMember[i-1] = npc->appearanceData.iNPC_ID;
|
||||||
Mob* mob = (Mob*)NPCManager::NPCs[npc->appearanceData.iNPC_ID];
|
Mob* mob = (Mob*)NPCManager::NPCs[npc->appearanceData.iNPC_ID];
|
||||||
mob->groupLeader = leadNpc->appearanceData.iNPC_ID;
|
mob->groupLeader = leadNpc->appearanceData.iNPC_ID;
|
||||||
@ -639,7 +639,7 @@ static void summonGroupCommand(std::string full, std::vector<std::string>& args,
|
|||||||
Chat::sendServerMessage(sock, "/summonGroup(W): placed mob with type: " + std::to_string(type) +
|
Chat::sendServerMessage(sock, "/summonGroup(W): placed mob with type: " + std::to_string(type) +
|
||||||
", id: " + std::to_string(npc->appearanceData.iNPC_ID));
|
", id: " + std::to_string(npc->appearanceData.iNPC_ID));
|
||||||
|
|
||||||
if (i == 0 && team == 2 && npc->type == EntityType::MOB) {
|
if (i == 0 && team == 2 && npc->kind == EntityType::MOB) {
|
||||||
type = type2;
|
type = type2;
|
||||||
leadNpc = (Mob*)NPCManager::NPCs[npc->appearanceData.iNPC_ID];
|
leadNpc = (Mob*)NPCManager::NPCs[npc->appearanceData.iNPC_ID];
|
||||||
leadNpc->groupLeader = leadNpc->appearanceData.iNPC_ID;
|
leadNpc->groupLeader = leadNpc->appearanceData.iNPC_ID;
|
||||||
@ -675,7 +675,7 @@ static void whoisCommand(std::string full, std::vector<std::string>& args, CNSoc
|
|||||||
Chat::sendServerMessage(sock, "[WHOIS] Type: " + std::to_string(npc->appearanceData.iNPCType));
|
Chat::sendServerMessage(sock, "[WHOIS] Type: " + std::to_string(npc->appearanceData.iNPCType));
|
||||||
Chat::sendServerMessage(sock, "[WHOIS] HP: " + std::to_string(npc->appearanceData.iHP));
|
Chat::sendServerMessage(sock, "[WHOIS] HP: " + std::to_string(npc->appearanceData.iHP));
|
||||||
Chat::sendServerMessage(sock, "[WHOIS] CBF: " + std::to_string(npc->appearanceData.iConditionBitFlag));
|
Chat::sendServerMessage(sock, "[WHOIS] CBF: " + std::to_string(npc->appearanceData.iConditionBitFlag));
|
||||||
Chat::sendServerMessage(sock, "[WHOIS] EntityType: " + std::to_string((int)npc->type));
|
Chat::sendServerMessage(sock, "[WHOIS] EntityType: " + std::to_string((int)npc->kind));
|
||||||
Chat::sendServerMessage(sock, "[WHOIS] X: " + std::to_string(npc->x));
|
Chat::sendServerMessage(sock, "[WHOIS] X: " + std::to_string(npc->x));
|
||||||
Chat::sendServerMessage(sock, "[WHOIS] Y: " + std::to_string(npc->y));
|
Chat::sendServerMessage(sock, "[WHOIS] Y: " + std::to_string(npc->y));
|
||||||
Chat::sendServerMessage(sock, "[WHOIS] Z: " + std::to_string(npc->z));
|
Chat::sendServerMessage(sock, "[WHOIS] Z: " + std::to_string(npc->z));
|
||||||
|
@ -124,7 +124,7 @@ static void eggStep(CNServer* serv, time_t currTime) {
|
|||||||
|
|
||||||
// check dead eggs and eggs in inactive chunks
|
// check dead eggs and eggs in inactive chunks
|
||||||
for (auto npc : NPCManager::NPCs) {
|
for (auto npc : NPCManager::NPCs) {
|
||||||
if (npc.second->type != EntityType::EGG)
|
if (npc.second->kind != EntityType::EGG)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto egg = (Egg*)npc.second;
|
auto egg = (Egg*)npc.second;
|
||||||
@ -163,7 +163,7 @@ static void eggPickup(CNSocket* sock, CNPacketData* data) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto egg = (Egg*)eggRef.getEntity();
|
auto egg = (Egg*)eggRef.getEntity();
|
||||||
if (egg->type != EntityType::EGG) {
|
if (egg->kind != EntityType::EGG) {
|
||||||
std::cout << "[WARN] Player tried to open something other than an?!" << std::endl;
|
std::cout << "[WARN] Player tried to open something other than an?!" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ EntityRef::EntityRef(int32_t i) {
|
|||||||
id = i;
|
id = i;
|
||||||
|
|
||||||
assert(NPCManager::NPCs.find(id) != NPCManager::NPCs.end());
|
assert(NPCManager::NPCs.find(id) != NPCManager::NPCs.end());
|
||||||
type = NPCManager::NPCs[id]->type;
|
type = NPCManager::NPCs[id]->kind;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EntityRef::isValid() const {
|
bool EntityRef::isValid() const {
|
||||||
|
@ -17,7 +17,7 @@ enum class EntityType : uint8_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Entity {
|
struct Entity {
|
||||||
EntityType type = EntityType::INVALID;
|
EntityType kind = EntityType::INVALID;
|
||||||
int x = 0, y = 0, z = 0;
|
int x = 0, y = 0, z = 0;
|
||||||
uint64_t instanceID = 0;
|
uint64_t instanceID = 0;
|
||||||
ChunkPos chunkPos = {};
|
ChunkPos chunkPos = {};
|
||||||
@ -129,7 +129,7 @@ struct Egg : public BaseNPC {
|
|||||||
Egg(int x, int y, int z, uint64_t iID, int t, int32_t id, bool summon)
|
Egg(int x, int y, int z, uint64_t iID, int t, int32_t id, bool summon)
|
||||||
: BaseNPC(x, y, z, 0, iID, t, id) {
|
: BaseNPC(x, y, z, 0, iID, t, id) {
|
||||||
summoned = summon;
|
summoned = summon;
|
||||||
type = EntityType::EGG;
|
kind = EntityType::EGG;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool isAlive() override { return !dead; }
|
virtual bool isAlive() override { return !dead; }
|
||||||
@ -142,7 +142,7 @@ struct Egg : public BaseNPC {
|
|||||||
struct Bus : public BaseNPC {
|
struct Bus : public BaseNPC {
|
||||||
Bus(int x, int y, int z, int angle, uint64_t iID, int t, int id) :
|
Bus(int x, int y, int z, int angle, uint64_t iID, int t, int id) :
|
||||||
BaseNPC(x, y, z, angle, iID, t, id) {
|
BaseNPC(x, y, z, angle, iID, t, id) {
|
||||||
type = EntityType::BUS;
|
kind = EntityType::BUS;
|
||||||
loopingPath = true;
|
loopingPath = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,13 +58,13 @@ void MobAI::clearDebuff(Mob *mob) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MobAI::followToCombat(Mob *mob) {
|
void MobAI::followToCombat(Mob *mob) {
|
||||||
if (NPCManager::NPCs.find(mob->groupLeader) != NPCManager::NPCs.end() && NPCManager::NPCs[mob->groupLeader]->type == EntityType::MOB) {
|
if (NPCManager::NPCs.find(mob->groupLeader) != NPCManager::NPCs.end() && NPCManager::NPCs[mob->groupLeader]->kind == EntityType::MOB) {
|
||||||
Mob* leadMob = (Mob*)NPCManager::NPCs[mob->groupLeader];
|
Mob* leadMob = (Mob*)NPCManager::NPCs[mob->groupLeader];
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
if (leadMob->groupMember[i] == 0)
|
if (leadMob->groupMember[i] == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (NPCManager::NPCs.find(leadMob->groupMember[i]) == NPCManager::NPCs.end() || NPCManager::NPCs[leadMob->groupMember[i]]->type != EntityType::MOB) {
|
if (NPCManager::NPCs.find(leadMob->groupMember[i]) == NPCManager::NPCs.end() || NPCManager::NPCs[leadMob->groupMember[i]]->kind != EntityType::MOB) {
|
||||||
std::cout << "[WARN] roamingStep: leader can't find a group member!" << std::endl;
|
std::cout << "[WARN] roamingStep: leader can't find a group member!" << std::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ void MobAI::followToCombat(Mob *mob) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MobAI::groupRetreat(Mob *mob) {
|
void MobAI::groupRetreat(Mob *mob) {
|
||||||
if (NPCManager::NPCs.find(mob->groupLeader) == NPCManager::NPCs.end() || NPCManager::NPCs[mob->groupLeader]->type != EntityType::MOB)
|
if (NPCManager::NPCs.find(mob->groupLeader) == NPCManager::NPCs.end() || NPCManager::NPCs[mob->groupLeader]->kind != EntityType::MOB)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Mob* leadMob = (Mob*)NPCManager::NPCs[mob->groupLeader];
|
Mob* leadMob = (Mob*)NPCManager::NPCs[mob->groupLeader];
|
||||||
@ -92,7 +92,7 @@ void MobAI::groupRetreat(Mob *mob) {
|
|||||||
if (leadMob->groupMember[i] == 0)
|
if (leadMob->groupMember[i] == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (NPCManager::NPCs.find(leadMob->groupMember[i]) == NPCManager::NPCs.end() || NPCManager::NPCs[leadMob->groupMember[i]]->type != EntityType::MOB) {
|
if (NPCManager::NPCs.find(leadMob->groupMember[i]) == NPCManager::NPCs.end() || NPCManager::NPCs[leadMob->groupMember[i]]->kind != EntityType::MOB) {
|
||||||
std::cout << "[WARN] roamingStep: leader can't find a group member!" << std::endl;
|
std::cout << "[WARN] roamingStep: leader can't find a group member!" << std::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -479,7 +479,7 @@ static void deadStep(Mob *mob, time_t currTime) {
|
|||||||
|
|
||||||
// if mob is a group leader/follower, spawn where the group is.
|
// if mob is a group leader/follower, spawn where the group is.
|
||||||
if (mob->groupLeader != 0) {
|
if (mob->groupLeader != 0) {
|
||||||
if (NPCManager::NPCs.find(mob->groupLeader) != NPCManager::NPCs.end() && NPCManager::NPCs[mob->groupLeader]->type == EntityType::MOB) {
|
if (NPCManager::NPCs.find(mob->groupLeader) != NPCManager::NPCs.end() && NPCManager::NPCs[mob->groupLeader]->kind == EntityType::MOB) {
|
||||||
Mob* leaderMob = (Mob*)NPCManager::NPCs[mob->groupLeader];
|
Mob* leaderMob = (Mob*)NPCManager::NPCs[mob->groupLeader];
|
||||||
mob->x = leaderMob->x + mob->offsetX;
|
mob->x = leaderMob->x + mob->offsetX;
|
||||||
mob->y = leaderMob->y + mob->offsetY;
|
mob->y = leaderMob->y + mob->offsetY;
|
||||||
@ -721,7 +721,7 @@ static void roamingStep(Mob *mob, time_t currTime) {
|
|||||||
if (mob->groupMember[i] == 0)
|
if (mob->groupMember[i] == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (NPCManager::NPCs.find(mob->groupMember[i]) == NPCManager::NPCs.end() || NPCManager::NPCs[mob->groupMember[i]]->type != EntityType::MOB) {
|
if (NPCManager::NPCs.find(mob->groupMember[i]) == NPCManager::NPCs.end() || NPCManager::NPCs[mob->groupMember[i]]->kind != EntityType::MOB) {
|
||||||
std::cout << "[WARN] roamingStep: leader can't find a group member!" << std::endl;
|
std::cout << "[WARN] roamingStep: leader can't find a group member!" << std::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -782,7 +782,7 @@ static void retreatStep(Mob *mob, time_t currTime) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MobAI::step(CombatNPC *npc, time_t currTime) {
|
void MobAI::step(CombatNPC *npc, time_t currTime) {
|
||||||
assert(npc->type == EntityType::MOB);
|
assert(npc->kind == EntityType::MOB);
|
||||||
auto mob = (Mob*)npc;
|
auto mob = (Mob*)npc;
|
||||||
|
|
||||||
if (mob->playersInView < 0)
|
if (mob->playersInView < 0)
|
||||||
|
@ -77,7 +77,7 @@ struct Mob : public CombatNPC {
|
|||||||
// NOTE: there appear to be discrepancies in the dump
|
// NOTE: there appear to be discrepancies in the dump
|
||||||
appearanceData.iHP = maxHealth;
|
appearanceData.iHP = maxHealth;
|
||||||
|
|
||||||
type = EntityType::MOB;
|
kind = EntityType::MOB;
|
||||||
_stepAI = MobAI::step;
|
_stepAI = MobAI::step;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ void NPCManager::queueNPCRemoval(int32_t id) {
|
|||||||
|
|
||||||
static void step(CNServer *serv, time_t currTime) {
|
static void step(CNServer *serv, time_t currTime) {
|
||||||
for (auto& pair : NPCs) {
|
for (auto& pair : NPCs) {
|
||||||
if (pair.second->type != EntityType::COMBAT_NPC && pair.second->type != EntityType::MOB)
|
if (pair.second->kind != EntityType::COMBAT_NPC && pair.second->kind != EntityType::MOB)
|
||||||
continue;
|
continue;
|
||||||
auto npc = (CombatNPC*)pair.second;
|
auto npc = (CombatNPC*)pair.second;
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ struct Player : public Entity {
|
|||||||
time_t lastShot = 0;
|
time_t lastShot = 0;
|
||||||
std::vector<sItemBase> buyback = {};
|
std::vector<sItemBase> buyback = {};
|
||||||
|
|
||||||
Player() { type = EntityType::PLAYER; }
|
Player() { kind = EntityType::PLAYER; }
|
||||||
|
|
||||||
virtual void enterIntoViewOf(CNSocket *sock) override;
|
virtual void enterIntoViewOf(CNSocket *sock) override;
|
||||||
virtual void disappearFromViewOf(CNSocket *sock) override;
|
virtual void disappearFromViewOf(CNSocket *sock) override;
|
||||||
|
@ -1226,7 +1226,7 @@ void TableData::flush() {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
int x, y, z;
|
int x, y, z;
|
||||||
if (npc->type == EntityType::MOB) {
|
if (npc->kind == EntityType::MOB) {
|
||||||
Mob *m = (Mob*)npc;
|
Mob *m = (Mob*)npc;
|
||||||
x = m->spawnX;
|
x = m->spawnX;
|
||||||
y = m->spawnY;
|
y = m->spawnY;
|
||||||
@ -1259,7 +1259,7 @@ void TableData::flush() {
|
|||||||
|
|
||||||
int x, y, z;
|
int x, y, z;
|
||||||
std::vector<Mob*> followers;
|
std::vector<Mob*> followers;
|
||||||
if (npc->type == EntityType::MOB) {
|
if (npc->kind == EntityType::MOB) {
|
||||||
Mob* m = (Mob*)npc;
|
Mob* m = (Mob*)npc;
|
||||||
x = m->spawnX;
|
x = m->spawnX;
|
||||||
y = m->spawnY;
|
y = m->spawnY;
|
||||||
@ -1271,7 +1271,7 @@ void TableData::flush() {
|
|||||||
|
|
||||||
// add follower data to vector; go until OOB or until follower ID is 0
|
// add follower data to vector; go until OOB or until follower ID is 0
|
||||||
for (int i = 0; i < 4 && m->groupMember[i] > 0; i++) {
|
for (int i = 0; i < 4 && m->groupMember[i] > 0; i++) {
|
||||||
if (NPCManager::NPCs.find(m->groupMember[i]) == NPCManager::NPCs.end() || NPCManager::NPCs[m->groupMember[i]]->type != EntityType::MOB) {
|
if (NPCManager::NPCs.find(m->groupMember[i]) == NPCManager::NPCs.end() || NPCManager::NPCs[m->groupMember[i]]->kind != EntityType::MOB) {
|
||||||
std::cout << "[WARN] Follower with ID " << m->groupMember[i] << " not found; skipping\n";
|
std::cout << "[WARN] Follower with ID " << m->groupMember[i] << " not found; skipping\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -257,13 +257,13 @@ static void stepNPCPathing() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// skip if not simulating mobs
|
// skip if not simulating mobs
|
||||||
if (npc->type == EntityType::MOB && !MobAI::simulateMobs) {
|
if (npc->kind == EntityType::MOB && !MobAI::simulateMobs) {
|
||||||
it++;
|
it++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// do not roam if not roaming
|
// do not roam if not roaming
|
||||||
if (npc->type == EntityType::MOB && ((Mob*)npc)->state != MobState::ROAMING) {
|
if (npc->kind == EntityType::MOB && ((Mob*)npc)->state != MobState::ROAMING) {
|
||||||
it++;
|
it++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -279,7 +279,7 @@ static void stepNPCPathing() {
|
|||||||
NPCManager::updateNPCPosition(npc->appearanceData.iNPC_ID, point.x, point.y, point.z, npc->instanceID, npc->appearanceData.iAngle);
|
NPCManager::updateNPCPosition(npc->appearanceData.iNPC_ID, point.x, point.y, point.z, npc->instanceID, npc->appearanceData.iAngle);
|
||||||
|
|
||||||
// TODO: move walking logic into Entity stack
|
// TODO: move walking logic into Entity stack
|
||||||
switch (npc->type) {
|
switch (npc->kind) {
|
||||||
case EntityType::BUS:
|
case EntityType::BUS:
|
||||||
INITSTRUCT(sP_FE2CL_TRANSPORTATION_MOVE, busMove);
|
INITSTRUCT(sP_FE2CL_TRANSPORTATION_MOVE, busMove);
|
||||||
|
|
||||||
@ -385,7 +385,7 @@ NPCPath* Transport::findApplicablePath(int32_t id, int32_t type, int taskID) {
|
|||||||
|
|
||||||
void Transport::constructPathNPC(int32_t id, NPCPath* path) {
|
void Transport::constructPathNPC(int32_t id, NPCPath* path) {
|
||||||
BaseNPC* npc = NPCManager::NPCs[id];
|
BaseNPC* npc = NPCManager::NPCs[id];
|
||||||
if (npc->type == EntityType::MOB)
|
if (npc->kind == EntityType::MOB)
|
||||||
((Mob*)(npc))->staticPath = true;
|
((Mob*)(npc))->staticPath = true;
|
||||||
npc->loopingPath = path->isLoop;
|
npc->loopingPath = path->isLoop;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user