From 152a49166369d4fd81f41945cae596bc5b0b440c Mon Sep 17 00:00:00 2001 From: kabigon <114336867+kabigon143@users.noreply.github.com> Date: Sat, 4 May 2024 21:23:51 +0200 Subject: [PATCH] feat: add GetRank method for creatures (#173) --- src/LuaEngine/CreatureMethods.h | 11 +++++++++++ src/LuaEngine/LuaFunctions.cpp | 1 + 2 files changed, 12 insertions(+) diff --git a/src/LuaEngine/CreatureMethods.h b/src/LuaEngine/CreatureMethods.h index cb85860..f616399 100644 --- a/src/LuaEngine/CreatureMethods.h +++ b/src/LuaEngine/CreatureMethods.h @@ -957,6 +957,17 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList(); return 1; } + /** + * Returns the [Creature]'s rank. + * + * @return [Rank] rank + */ + int GetRank(lua_State* L, Creature* creature) + { + Eluna::Push(L, creature->GetCreatureTemplate()->rank); + return 1; + } + #if defined(CLASSIC) || defined(TBC) || defined(WOTLK) /** * Returns the [Creature]'s shield block value. diff --git a/src/LuaEngine/LuaFunctions.cpp b/src/LuaEngine/LuaFunctions.cpp index ae7b23e..69305a0 100644 --- a/src/LuaEngine/LuaFunctions.cpp +++ b/src/LuaEngine/LuaFunctions.cpp @@ -831,6 +831,7 @@ ElunaRegister CreatureMethods[] = { "GetUnitFlags", &LuaCreature::GetUnitFlags }, { "GetUnitFlagsTwo", &LuaCreature::GetUnitFlagsTwo }, { "GetExtraFlags", &LuaCreature::GetExtraFlags }, + { "GetRank", &LuaCreature::GetRank }, #if defined(CLASSIC) || defined(TBC) || defined(WOTLK) { "GetShieldBlockValue", &LuaCreature::GetShieldBlockValue }, #endif