From 68b5ffcf4b18fb1888c1d501359d037f794c4b87 Mon Sep 17 00:00:00 2001 From: Tikki Date: Fri, 28 May 2021 14:46:53 +0200 Subject: [PATCH 1/3] feat(CreatureMethods.h): Added SetReactState(x) Signed-off-by: Tikki --- CreatureMethods.h | 12 ++++++++++++ LuaFunctions.cpp | 1 + 2 files changed, 13 insertions(+) diff --git a/CreatureMethods.h b/CreatureMethods.h index e0ddb85..f47d5e1 100644 --- a/CreatureMethods.h +++ b/CreatureMethods.h @@ -983,6 +983,18 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); return 0; } + /** + * Sets the [Creature]'s ReactState to `state`. + * + * @param [ReactState] state + */ + int SetReactState(lua_State* L, Creature* creature) + { + uint32 state = Eluna::CHECKVAL(L, 2); + + creature->SetReactState((ReactStates)state); + return 0; + } /** * Makes the [Creature] able to fly if enabled. diff --git a/LuaFunctions.cpp b/LuaFunctions.cpp index ef496f6..8dfdf18 100644 --- a/LuaFunctions.cpp +++ b/LuaFunctions.cpp @@ -807,6 +807,7 @@ ElunaRegister CreatureMethods[] = { "SetLootMode", &LuaCreature::SetLootMode }, #endif { "SetNPCFlags", &LuaCreature::SetNPCFlags }, + { "SetReactState", &LuaCreature::SetReactState }, { "SetDeathState", &LuaCreature::SetDeathState }, { "SetWalk", &LuaCreature::SetWalk }, { "SetHomePosition", &LuaCreature::SetHomePosition }, From 6f1e553c83ecbad3018ad6b502e9477ecd7c9197 Mon Sep 17 00:00:00 2001 From: Tikki Date: Fri, 28 May 2021 14:50:03 +0200 Subject: [PATCH 2/3] fix(CreatureMethods.h): Added Trinity/AzerothCore guards to SetReactState Signed-off-by: Tikki --- CreatureMethods.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CreatureMethods.h b/CreatureMethods.h index f47d5e1..46b0291 100644 --- a/CreatureMethods.h +++ b/CreatureMethods.h @@ -983,6 +983,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); return 0; } +#if defined(TRINITY) || defined(AZEROTHCORE) /** * Sets the [Creature]'s ReactState to `state`. * @@ -995,6 +996,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); creature->SetReactState((ReactStates)state); return 0; } +#endif /** * Makes the [Creature] able to fly if enabled. From 2fde577aafb317179b88657baa3096aefca78b35 Mon Sep 17 00:00:00 2001 From: Tikki Date: Fri, 28 May 2021 15:23:23 +0200 Subject: [PATCH 3/3] fix(LuaFunctions.cpp): Added Trinity/Azerothcore guards to SetReactState() Signed-off-by: Tikki --- LuaFunctions.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/LuaFunctions.cpp b/LuaFunctions.cpp index 8dfdf18..1a621b5 100644 --- a/LuaFunctions.cpp +++ b/LuaFunctions.cpp @@ -807,7 +807,9 @@ ElunaRegister CreatureMethods[] = { "SetLootMode", &LuaCreature::SetLootMode }, #endif { "SetNPCFlags", &LuaCreature::SetNPCFlags }, +#if defined(TRINITY) || AZEROTHCORE { "SetReactState", &LuaCreature::SetReactState }, +#endif { "SetDeathState", &LuaCreature::SetDeathState }, { "SetWalk", &LuaCreature::SetWalk }, { "SetHomePosition", &LuaCreature::SetHomePosition },