mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 21:40:05 +00:00
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:
parent
599bbedd8c
commit
63414ea9a2
@ -535,11 +535,12 @@ void NPCManager::npcSummonHandler(CNSocket* sock, CNPacketData* data) {
|
|||||||
Player* plr = PlayerManager::getPlayer(sock);
|
Player* plr = PlayerManager::getPlayer(sock);
|
||||||
|
|
||||||
// permission & sanity check
|
// 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;
|
return;
|
||||||
|
|
||||||
int team = NPCData[req->iNPCType]["m_iTeam"];
|
int team = NPCData[req->iNPCType]["m_iTeam"];
|
||||||
|
|
||||||
|
for (int i = 0; i < req->iNPCCnt; i++) {
|
||||||
assert(nextId < INT32_MAX);
|
assert(nextId < INT32_MAX);
|
||||||
int id = nextId++;
|
int id = nextId++;
|
||||||
|
|
||||||
@ -551,6 +552,7 @@ void NPCManager::npcSummonHandler(CNSocket* sock, CNPacketData* data) {
|
|||||||
|
|
||||||
updateNPCPosition(id, plr->x, plr->y, plr->z);
|
updateNPCPosition(id, plr->x, plr->y, plr->z);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void NPCManager::npcWarpHandler(CNSocket* sock, CNPacketData* data) {
|
void NPCManager::npcWarpHandler(CNSocket* sock, CNPacketData* data) {
|
||||||
if (data->size != sizeof(sP_CL2FE_REQ_PC_WARP_USE_NPC))
|
if (data->size != sizeof(sP_CL2FE_REQ_PC_WARP_USE_NPC))
|
||||||
|
Loading…
Reference in New Issue
Block a user