Add GetNPCBySpawnID() to Perl/Lua.

This commit is contained in:
Alex
2020-05-07 23:05:07 -04:00
parent 954247956e
commit 0b03f27660
5 changed files with 53 additions and 0 deletions
+16
View File
@@ -1097,6 +1097,22 @@ NPC *EntityList::GetNPCByNPCTypeID(uint32 npc_id)
return nullptr;
}
NPC *EntityList::GetNPCBySpawnID(uint32 spawn_id)
{
if (spawn_id == 0 || npc_list.empty()) {
return nullptr;
}
auto it = npc_list.begin();
while (it != npc_list.end()) {
if (it->second->GetSpawnGroupId() == spawn_id) {
return it->second;
}
++it;
}
return nullptr;
}
Mob *EntityList::GetMob(uint16 get_id)
{
Entity *ent = nullptr;