Fix /unsummonW crash on non-mob NPCs

This commit is contained in:
Gent S 2020-11-30 10:53:34 -05:00
parent 128aad89d3
commit 4863d29590

View File

@ -284,6 +284,7 @@ void unsummonWCommand(std::string full, std::vector<std::string>& args, CNSocket
return;
}
if (MobManager::Mobs.find(npc->appearanceData.iNPC_ID) != MobManager::Mobs.end()) {
int leadId = ((Mob*)npc)->groupLeader;
if (leadId != 0) {
if (MobManager::Mobs.find(leadId) == MobManager::Mobs.end()) {
@ -306,6 +307,7 @@ void unsummonWCommand(std::string full, std::vector<std::string>& args, CNSocket
ChatManager::sendServerMessage(sock, "/unsummonW: Mob group destroyed.");
return;
}
}
ChatManager::sendServerMessage(sock, "/unsummonW: removed mob with type: " + std::to_string(npc->appearanceData.iNPCType) +
", id: " + std::to_string(npc->appearanceData.iNPC_ID));