[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:
Alex King
2024-10-03 20:28:57 -04:00
committed by GitHub
parent 3359839a9b
commit a17f467b98
5 changed files with 143 additions and 1 deletions
+40
View File
@@ -739,6 +739,44 @@ void Perl_EntityList_MassGroupBuff(EntityList* self, Mob* caster, Mob* center, u
self->MassGroupBuff(caster, center, spell_id, affect_caster);
}
perl::array Perl_EntityList_GetNPCsByExcludedIDs(EntityList* self, perl::array npc_ids)
{
std::vector<uint32> ids;
for (int i = 0; i < npc_ids.size(); i++) {
ids.emplace_back(npc_ids[i]);
}
const auto& l = self->GetExcludedNPCsByIDs(ids);
perl::array npcs;
for (const auto& e : l) {
npcs.push_back(e);
}
return npcs;
}
perl::array Perl_EntityList_GetNPCsByIDs(EntityList* self, perl::array npc_ids)
{
std::vector<uint32> ids;
for (int i = 0; i < npc_ids.size(); i++) {
ids.emplace_back(npc_ids[i]);
}
const auto& l = self->GetNPCsByIDs(ids);
perl::array npcs;
for (const auto& e : l) {
npcs.push_back(e);
}
return npcs;
}
void perl_register_entitylist()
{
perl::interpreter perl(PERL_GET_THX);
@@ -804,6 +842,8 @@ void perl_register_entitylist()
package.add("GetNPCByNPCTypeID", &Perl_EntityList_GetNPCByNPCTypeID);
package.add("GetNPCBySpawnID", &Perl_EntityList_GetNPCBySpawnID);
package.add("GetNPCList", &Perl_EntityList_GetNPCList);
package.add("GetNPCsByExcludedIDs", &Perl_EntityList_GetNPCsByExcludedIDs);
package.add("GetNPCsByIDs", &Perl_EntityList_GetNPCsByIDs);
package.add("GetObjectByDBID", &Perl_EntityList_GetObjectByDBID);
package.add("GetObjectByID", &Perl_EntityList_GetObjectByID);
package.add("GetObjectList", &Perl_EntityList_GetObjectList);