Read the NPC ID limit from the XDT

This commit is contained in:
2020-12-21 01:57:56 +01:00
committed by Gent S
parent 9057f31bff
commit e0808ffcbd
2 changed files with 9 additions and 3 deletions

View File

@@ -209,8 +209,10 @@ void summonWCommand(std::string full, std::vector<std::string>& args, CNSocket*
return;
}
int limit = NPCManager::NPCData.back()["m_iNpcNumber"];
// permission & sanity check
if (type >= 3314)
if (type > limit)
return;
BaseNPC *npc = NPCManager::summonNPC(plr->x, plr->y, plr->z, plr->instanceID, type, true);
@@ -540,8 +542,10 @@ void summonGroupCommand(std::string full, std::vector<std::string>& args, CNSock
return;
}
int limit = NPCManager::NPCData.back()["m_iNpcNumber"];
// permission & sanity check
if (type >= 3314 || type2 >= 3314 || count > 5) {
if (type > limit || type2 > limit || count > 5) {
ChatManager::sendServerMessage(sock, "Invalid parameters; double check types and count");
return;
}