Merge pull request #1048 from KinglyKrab/master

Add GetNPCBySpawnID() to Perl/Lua.
This commit is contained in:
Chris Miles
2020-05-09 14:53:47 -05:00
committed by GitHub
5 changed files with 53 additions and 0 deletions
+16
View File
@@ -1116,6 +1116,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;