From 32a885d1773a25bd4cdf2b26ecf7f9bd7c3313ab Mon Sep 17 00:00:00 2001 From: nytmyr <53322305+nytmyr@users.noreply.github.com> Date: Mon, 20 Jan 2025 11:44:21 -0600 Subject: [PATCH] Add IsPetOwnerOfClientBot(), add Lua and Perl methods --- zone/attack.cpp | 2 +- zone/lua_mob.cpp | 9 ++++++++- zone/lua_mob.h | 3 ++- zone/mob.h | 1 + zone/perl_mob.cpp | 6 ++++++ 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index 41016be13..5dd9e521d 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -2641,7 +2641,7 @@ bool NPC::Death(Mob* killer_mob, int64 damage, uint16 spell, EQ::skills::SkillTy } } - if (give_exp && give_exp->IsTempPet() && (give_exp->IsPetOwnerClient() || give_exp->IsPetOwnerBot())) { + if (give_exp && give_exp->IsTempPet() && give_exp->IsPetOwnerOfClientBot()) { if (give_exp->IsNPC() && give_exp->CastToNPC()->GetSwarmOwner()) { Mob* temp_owner = entity_list.GetMobID(give_exp->CastToNPC()->GetSwarmOwner()); if (temp_owner) { diff --git a/zone/lua_mob.cpp b/zone/lua_mob.cpp index 0e644f4f2..27ab7bbd8 100644 --- a/zone/lua_mob.cpp +++ b/zone/lua_mob.cpp @@ -3268,6 +3268,12 @@ bool Lua_Mob::IsPetOwnerNPC() return self->IsPetOwnerNPC(); } +bool Lua_Mob::IsPetOwnerOfClientBot() +{ + Lua_Safe_Call_Bool(); + return self->IsPetOwnerOfClientBot(); +} + bool Lua_Mob::IsDestructibleObject() { Lua_Safe_Call_Bool(); @@ -3902,8 +3908,9 @@ luabind::scope lua_register_mob() { .def("IsPausedTimer", &Lua_Mob::IsPausedTimer) .def("IsPet", (bool(Lua_Mob::*)(void))&Lua_Mob::IsPet) .def("IsPetOwnerBot", &Lua_Mob::IsPetOwnerBot) - .def("IsPetOwnerClient", &Lua_Mob::IsPetOwnerClient) + .def("IsPetOwnerClient", &Lua_Mob::IsPetOwnerClient) .def("IsPetOwnerNPC", &Lua_Mob::IsPetOwnerNPC) + .def("IsPetOwnerOfClientBot", &Lua_Mob::IsPetOwnerOfClientBot) .def("IsPureMeleeClass", &Lua_Mob::IsPureMeleeClass) .def("IsRoamer", (bool(Lua_Mob::*)(void))&Lua_Mob::IsRoamer) .def("IsRooted", (bool(Lua_Mob::*)(void))&Lua_Mob::IsRooted) diff --git a/zone/lua_mob.h b/zone/lua_mob.h index dfe646cc0..0f3d4f6c4 100644 --- a/zone/lua_mob.h +++ b/zone/lua_mob.h @@ -574,8 +574,9 @@ public: bool IsFamiliar(); bool IsTargetLockPet(); bool IsPetOwnerBot(); - bool IsPetOwnerClient(); + bool IsPetOwnerClient(); bool IsPetOwnerNPC(); + bool IsPetOwnerOfClientBot(); bool IsDestructibleObject(); bool IsBoat(); bool IsControllableBoat(); diff --git a/zone/mob.h b/zone/mob.h index 5737b5ff8..b092e3f54 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -1179,6 +1179,7 @@ public: inline void SetPetOwnerClient(bool b) { pet_owner_client = b; } inline bool IsPetOwnerNPC() const { return pet_owner_npc; } inline void SetPetOwnerNPC(bool b) { pet_owner_npc = b; } + inline bool IsPetOwnerOfClientBot() const { return pet_owner_bot || pet_owner_client; } inline bool IsTempPet() const { return _IsTempPet; } inline void SetTempPet(bool value) { _IsTempPet = value; } inline bool IsHorse() { return is_horse; } diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index a4042dc4b..af564d3b7 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.cpp @@ -3400,6 +3400,11 @@ bool Perl_Mob_IsPetOwnerNPC(Mob* self) return self->IsPetOwnerNPC(); } +bool Perl_Mob_IsPetOwnerOfClientBot(Mob* self) +{ + return self->IsPetOwnerOfClientBot(); +} + bool Perl_Mob_IsDestructibleObject(Mob* self) { return self->IsDestructibleObject(); @@ -3999,6 +4004,7 @@ void perl_register_mob() package.add("IsPetOwnerBot", &Perl_Mob_IsPetOwnerBot); package.add("IsPetOwnerClient", &Perl_Mob_IsPetOwnerClient); package.add("IsPetOwnerNPC", &Perl_Mob_IsPetOwnerNPC); + package.add("IsPetOwnerOfClientBot", &Perl_Mob_IsPetOwnerOfClientBot); package.add("IsPlayerCorpse", &Perl_Mob_IsPlayerCorpse); package.add("IsPureMeleeClass", &Perl_Mob_IsPureMeleeClass); package.add("IsRoamer", &Perl_Mob_IsRoamer);