The /summon command can now spawn up to 100 NPCs at a time.

Note that /unsummon can only remove one at a time.
This commit is contained in:
dongresource 2020-10-13 21:50:14 +02:00
parent 599bbedd8c
commit 63414ea9a2

View File

@ -535,11 +535,12 @@ void NPCManager::npcSummonHandler(CNSocket* sock, CNPacketData* data) {
Player* plr = PlayerManager::getPlayer(sock);
// permission & sanity check
if (plr == nullptr || plr->accountLevel > 30 || req->iNPCType >= 3314)
if (plr == nullptr || plr->accountLevel > 30 || req->iNPCType >= 3314 || req->iNPCCnt > 100)
return;
int team = NPCData[req->iNPCType]["m_iTeam"];
for (int i = 0; i < req->iNPCCnt; i++) {
assert(nextId < INT32_MAX);
int id = nextId++;
@ -550,6 +551,7 @@ void NPCManager::npcSummonHandler(CNSocket* sock, CNPacketData* data) {
NPCs[id] = new BaseNPC(plr->x, plr->y, plr->z, plr->instanceID, req->iNPCType, id);
updateNPCPosition(id, plr->x, plr->y, plr->z);
}
}
void NPCManager::npcWarpHandler(CNSocket* sock, CNPacketData* data) {