From 3448758c031f827a4bd321f64f47317e52cde658 Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Sun, 26 Feb 2023 21:35:10 -0500 Subject: [PATCH] [Quest API] Add HasSpecialAbilities() to Perl/Lua (#2994) * [Quest API] Add HasSpecialAbilities() to Perl/Lua # Perl - Add `$mob->HasSpecialAbilities()`. # Lua - Add `mob:HasSpecialAbilities()` # Notes - Allows operators to check if a mob has special abilities * Move to NPC. * Update lua_mob.cpp --- zone/lua_npc.cpp | 5 +++++ zone/lua_npc.h | 1 + zone/perl_npc.cpp | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/zone/lua_npc.cpp b/zone/lua_npc.cpp index 51e36ad66..cce4aa022 100644 --- a/zone/lua_npc.cpp +++ b/zone/lua_npc.cpp @@ -767,6 +767,11 @@ void Lua_NPC::ScaleNPC(uint8 npc_level, bool override_special_abilities) self->ScaleNPC(npc_level, true, override_special_abilities); } +bool Lua_NPC::HasSpecialAbilities() { + Lua_Safe_Call_Bool(); + return self->HasSpecialAbilities(); +} + luabind::scope lua_register_npc() { return luabind::class_("NPC") .def(luabind::constructor<>()) diff --git a/zone/lua_npc.h b/zone/lua_npc.h index 1763a33b3..f4d509f0c 100644 --- a/zone/lua_npc.h +++ b/zone/lua_npc.h @@ -174,6 +174,7 @@ public: void SetLDoNTrapDetected(bool is_detected); void ScaleNPC(uint8 npc_level); void ScaleNPC(uint8 npc_level, bool override_special_abilities); + bool HasSpecialAbilities(); }; #endif diff --git a/zone/perl_npc.cpp b/zone/perl_npc.cpp index 8d11b41e6..acb06b276 100644 --- a/zone/perl_npc.cpp +++ b/zone/perl_npc.cpp @@ -765,6 +765,11 @@ void Perl_NPC_ScaleNPC(NPC* self, uint8 npc_level, bool override_special_abiliti return self->ScaleNPC(npc_level, override_special_abilities); } +bool Perl_NPC_HasSpecialAbilities(NPC* self) // @categories Script Utility +{ + return self->HasSpecialAbilities(); +} + void perl_register_npc() { perl::interpreter perl(PERL_GET_THX); @@ -852,6 +857,7 @@ void perl_register_npc() package.add("GetSwarmTarget", &Perl_NPC_GetSwarmTarget); package.add("GetWaypointMax", &Perl_NPC_GetWaypointMax); package.add("HasAISpellEffect", &Perl_NPC_HasAISpellEffect); + package.add("HasSpecialAbilities", &Perl_NPC_HasSpecialAbilities); package.add("HasItem", &Perl_NPC_HasItem); package.add("IsAnimal", &Perl_NPC_IsAnimal); package.add("IsGuarding", &Perl_NPC_IsGuarding);