[Quest API] Add Buff Support to Perl/Lua (#4182)

* [Quest API] Add Buff Support to Perl/Lua

- Add `$mob->GetCasterID()`.
- Add `$mob->GetCasterLevel()`.
- Add `$mob->GetCasterName()`.
- Add `$mob->GetCastOnX()`.
- Add `$mob->GetCastOnY()`.
- Add `$mob->GetCastOnZ()`.
- Add `$mob->GetCounters()`.
- Add `$mob->GetDOTRune()`.
- Add `$mob->GetExtraDIChance()`.
- Add `$mob->GetInstrumentModi()`.
- Add `$mob->GetMagicRune()`.
- Add `$mob->GetMeleeRune()`.
- Add `$mob->GetNumberOfHits()`.
- Add `$mob->GetRootBreakChanc()`.
- Add `$mob->GetSpellID()`.
- Add `$mob->GetTicsRemaining()`.
- Add `$mob->GetVirusSpreadTim()`.
- Add `$mob->IsCasterClient()`.
- Add `$mob->IsPersistentBuff()`.
- Add `$mob->SendsClientUpdate()`.

- Add `mob:GetCasterID()`.
- Add `mob:GetCasterLevel()`.
- Add `mob:GetCasterName()`.
- Add `mob:GetCastOnX()`.
- Add `mob:GetCastOnY()`.
- Add `mob:GetCastOnZ()`.
- Add `mob:GetCounters()`.
- Add `mob:GetDOTRune()`.
- Add `mob:GetExtraDIChance()`.
- Add `mob:GetInstrumentModi()`.
- Add `mob:GetMagicRune()`.
- Add `mob:GetMeleeRune()`.
- Add `mob:GetNumberOfHits()`.
- Add `mob:GetRootBreakChanc()`.
- Add `mob:GetSpellID()`.
- Add `mob:GetTicsRemaining()`.
- Add `mob:GetVirusSpreadTim()`.
- Add `mob:IsCasterClient()`.
- Add `mob:IsPersistentBuff()`.
- Add `mob:SendsClientUpdate()`.

- Adds support for `Buffs_Struct` to Perl/Lua.
- Allows operators to read a mob's buff data directly to determine caster, melee rune, etc.

* Fix GetCasterID() to proper data type.

* Remove Lua_Buffs, return table instead.

* Cleanup
This commit is contained in:
Alex King
2024-03-13 23:38:15 -04:00
committed by GitHub
parent b29c26becb
commit 161c13f457
9 changed files with 398 additions and 21 deletions
+22 -5
View File
@@ -3,18 +3,19 @@
#include "lua.hpp"
#include <luabind/luabind.hpp>
#include "client.h"
#include "npc.h"
#include "bot.h"
#include "client.h"
#include "dialogue_window.h"
#include "lua_bot.h"
#include "lua_buff.h"
#include "lua_client.h"
#include "lua_hate_list.h"
#include "lua_item.h"
#include "lua_iteminst.h"
#include "lua_mob.h"
#include "lua_npc.h"
#include "lua_hate_list.h"
#include "lua_client.h"
#include "lua_stat_bonuses.h"
#include "dialogue_window.h"
#include "npc.h"
struct SpecialAbilities { };
@@ -3303,6 +3304,21 @@ std::string Lua_Mob::GetDeityName()
return EQ::deity::GetDeityName(static_cast<EQ::deity::DeityType>(self->GetDeity()));
}
luabind::object Lua_Mob::GetBuffs(lua_State* L) {
auto t = luabind::newtable(L);
if (d_) {
auto self = reinterpret_cast<NativeType*>(d_);
auto l = self->GetBuffs();
int i = 1;
for (int slot_id = 0; slot_id < self->GetMaxBuffSlots(); slot_id++) {
t[i] = l[slot_id];
i++;
}
}
return t;
}
luabind::scope lua_register_mob() {
return luabind::class_<Lua_Mob, Lua_Entity>("Mob")
.def(luabind::constructor<>())
@@ -3505,6 +3521,7 @@ luabind::scope lua_register_mob() {
.def("GetBucketExpires", (std::string(Lua_Mob::*)(std::string))&Lua_Mob::GetBucketExpires)
.def("GetBucketKey", (std::string(Lua_Mob::*)(void))&Lua_Mob::GetBucketKey)
.def("GetBucketRemaining", (std::string(Lua_Mob::*)(std::string))&Lua_Mob::GetBucketRemaining)
.def("GetBuffs", &Lua_Mob::GetBuffs)
.def("GetBuffSlotFromType", &Lua_Mob::GetBuffSlotFromType)
.def("GetBuffSpellIDs", &Lua_Mob::GetBuffSpellIDs)
.def("GetBuffStatValueBySlot", (void(Lua_Mob::*)(uint8, const char*))& Lua_Mob::GetBuffStatValueBySlot)