mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 07:18:37 +00:00
[Quest API] Add NPC List Filter Methods to Perl/Lua (#4493)
* [Quest API] Add GetNPCsByNPCIDs to Perl/Lua * Push * Update entity.cpp * Separate methods.
This commit is contained in:
@@ -5937,3 +5937,39 @@ void EntityList::DamageArea(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<NPC*> EntityList::GetNPCsByIDs(std::vector<uint32> npc_ids)
|
||||
{
|
||||
std::vector<NPC*> v;
|
||||
|
||||
for (const auto& e : GetNPCList()) {
|
||||
const auto& n = std::find(npc_ids.begin(), npc_ids.end(), e.second->GetNPCTypeID());
|
||||
if (e.second) {
|
||||
if (n != npc_ids.end()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
v.emplace_back(e.second);
|
||||
}
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
std::vector<NPC*> EntityList::GetExcludedNPCsByIDs(std::vector<uint32> npc_ids)
|
||||
{
|
||||
std::vector<NPC*> v;
|
||||
|
||||
for (const auto& e : GetNPCList()) {
|
||||
const auto& n = std::find(npc_ids.begin(), npc_ids.end(), e.second->GetNPCTypeID());
|
||||
if (e.second) {
|
||||
if (n == npc_ids.end()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
v.emplace_back(e.second);
|
||||
}
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user