[Quest API] Add GetBuffSpellIDs() to Perl/Lua (#3273)

# Perl
- Add `$mob->GetBuffSpellIDs()`.

# Lua
- Add `$mob->GetBuffSpellIDs()`.

# Notes
- These methods allow operators to get a list of a mob's buff IDs without having to loop through their buffs themselves.
This commit is contained in:
Alex King
2023-04-09 10:58:35 -04:00
committed by GitHub
parent df92c578d2
commit 57a15d473f
5 changed files with 46 additions and 0 deletions
+16
View File
@@ -2985,6 +2985,21 @@ void Lua_Mob::StopTimer(const char* timer_name) {
quest_manager.stoptimer(timer_name, self);
}
luabind::object Lua_Mob::GetBuffSpellIDs(lua_State* L) {
auto t = luabind::newtable(L);
if (d_) {
auto self = reinterpret_cast<NativeType*>(d_);
auto l = self->GetBuffSpellIDs();
auto i = 1;
for (const auto& v : l) {
t[i] = v;
i++;
}
}
return t;
}
luabind::scope lua_register_mob() {
return luabind::class_<Lua_Mob, Lua_Entity>("Mob")
.def(luabind::constructor<>())
@@ -3184,6 +3199,7 @@ luabind::scope lua_register_mob() {
.def("GetBucketKey", (std::string(Lua_Mob::*)(void))&Lua_Mob::GetBucketKey)
.def("GetBucketRemaining", (std::string(Lua_Mob::*)(std::string))&Lua_Mob::GetBucketRemaining)
.def("GetBuffSlotFromType", &Lua_Mob::GetBuffSlotFromType)
.def("GetBuffSpellIDs", &Lua_Mob::GetBuffSpellIDs)
.def("GetBuffStatValueBySlot", (void(Lua_Mob::*)(uint8, const char*))& Lua_Mob::GetBuffStatValueBySlot)
.def("GetBuffStatValueBySpell", (void(Lua_Mob::*)(int, const char*))&Lua_Mob::GetBuffStatValueBySpell)
.def("GetCHA", &Lua_Mob::GetCHA)