From df3c7b4be6daae739c3463f2686e7b2807f4b9fd Mon Sep 17 00:00:00 2001 From: BuildingOutLoud Date: Fri, 16 Apr 2021 12:52:08 -0600 Subject: [PATCH] Add GetExtraFlags --- CreatureMethods.h | 18 ++++++++++++++++++ LuaFunctions.cpp | 3 +++ 2 files changed, 21 insertions(+) diff --git a/CreatureMethods.h b/CreatureMethods.h index b3db467..4a43cbf 100644 --- a/CreatureMethods.h +++ b/CreatureMethods.h @@ -864,6 +864,24 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); return 1; } + /** + * Returns the [Creature]'s Extra flags. + * + * These are used to control whether the NPC is a civilian, uses pathfinding, + * if it's a guard, etc. + * + * @return [ExtraFlags] extraFlags + */ + int GetExtraFlags(lua_State* L, Creature* creature) + { +#if defined(TRINITY) || defined(AZEROTHCORE) + Eluna::Push(L, creature->GetCreatureTemplate()->flags_extra); +#else + Eluna::Push(L, creature->GetCreatureInfo()->ExtraFlags); +#endif + return 1; + } + #if defined(CLASSIC) || defined(TBC) || defined(WOTLK) /** * Returns the [Creature]'s shield block value. diff --git a/LuaFunctions.cpp b/LuaFunctions.cpp index d5448c9..f006937 100644 --- a/LuaFunctions.cpp +++ b/LuaFunctions.cpp @@ -782,6 +782,9 @@ ElunaRegister CreatureMethods[] = { "GetLootRecipient", &LuaCreature::GetLootRecipient }, { "GetLootRecipientGroup", &LuaCreature::GetLootRecipientGroup }, { "GetNPCFlags", &LuaCreature::GetNPCFlags }, +#if defined(TRINITY) || defined(AZEROTHCORE) + { "GetExtraFlags", &LuaCreature::GetNPCFlags }, +#endif #if defined(CLASSIC) || defined(TBC) || defined(WOTLK) { "GetShieldBlockValue", &LuaCreature::GetShieldBlockValue }, #endif