Merge pull request #1048 from KinglyKrab/master

Add GetNPCBySpawnID() to Perl/Lua.
This commit is contained in:
Chris Miles authored and GitHub committed 2020-05-09 14:53:47 -05:00
commit e453f3e6ed
5 files changed
+53

No files matched your search

+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;