mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 21:40:05 +00:00
Read the NPC ID limit from the XDT
This commit is contained in:
parent
9057f31bff
commit
e0808ffcbd
@ -209,8 +209,10 @@ void summonWCommand(std::string full, std::vector<std::string>& args, CNSocket*
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int limit = NPCManager::NPCData.back()["m_iNpcNumber"];
|
||||||
|
|
||||||
// permission & sanity check
|
// permission & sanity check
|
||||||
if (type >= 3314)
|
if (type > limit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BaseNPC *npc = NPCManager::summonNPC(plr->x, plr->y, plr->z, plr->instanceID, type, true);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int limit = NPCManager::NPCData.back()["m_iNpcNumber"];
|
||||||
|
|
||||||
// permission & sanity check
|
// 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");
|
ChatManager::sendServerMessage(sock, "Invalid parameters; double check types and count");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -498,8 +498,10 @@ void NPCManager::npcSummonHandler(CNSocket* sock, CNPacketData* data) {
|
|||||||
sP_CL2FE_REQ_NPC_SUMMON* req = (sP_CL2FE_REQ_NPC_SUMMON*)data->buf;
|
sP_CL2FE_REQ_NPC_SUMMON* req = (sP_CL2FE_REQ_NPC_SUMMON*)data->buf;
|
||||||
Player* plr = PlayerManager::getPlayer(sock);
|
Player* plr = PlayerManager::getPlayer(sock);
|
||||||
|
|
||||||
|
int limit = NPCData.back()["m_iNpcNumber"];
|
||||||
|
|
||||||
// permission & sanity check
|
// permission & sanity check
|
||||||
if (plr->accountLevel > 30 || req->iNPCType >= 3314 || req->iNPCCnt > 100)
|
if (plr->accountLevel > 30 || req->iNPCType >= limit || req->iNPCCnt > 100)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int i = 0; i < req->iNPCCnt; i++) {
|
for (int i = 0; i < req->iNPCCnt; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user