From 74afaebb49ed00b634ffb15cd9a098b5e404bc3f Mon Sep 17 00:00:00 2001 From: xIvan0ff Date: Wed, 19 May 2021 00:51:50 +0300 Subject: [PATCH 1/5] Implement: Creature:SetRegeneratingHealth --- CreatureMethods.h | 294 ++++++++++++++++++++++++---------------------- LuaFunctions.cpp | 1 + 2 files changed, 154 insertions(+), 141 deletions(-) diff --git a/CreatureMethods.h b/CreatureMethods.h index 256ff58..cc6e2b4 100644 --- a/CreatureMethods.h +++ b/CreatureMethods.h @@ -14,13 +14,26 @@ */ namespace LuaCreature { + /** + * Sets whether the [Creature] can regenerate health or not. + * + * @param bool enable = true : `true` to enable health regeneration, `false` to disable it + */ + int SetRegeneratingHealth(lua_State* L, Creature* creature) + { + bool enable = Eluna::CHECKVAL(L, 2, true); + + creature->SetRegeneratingHealth(enable); + return 0; + } + /** * Returns `true` if the [Creature] is set to not give reputation when killed, * and returns `false` otherwise. * * @return bool reputationDisabled */ - int IsReputationGainDisabled(lua_State* L, Creature* creature) + int IsReputationGainDisabled(lua_State *L, Creature *creature) { Eluna::Push(L, creature->IsReputationGainDisabled()); return 1; @@ -33,7 +46,7 @@ namespace LuaCreature * @param uint32 questID : the ID of a [Quest] * @return bool completesQuest */ - int CanCompleteQuest(lua_State* L, Creature* creature) + int CanCompleteQuest(lua_State *L, Creature *creature) { uint32 quest_id = Eluna::CHECKVAL(L, 2); @@ -52,7 +65,7 @@ namespace LuaCreature * @param bool mustBeDead = false : if `true`, only returns `true` if the [Creature] is also dead. Otherwise, it must be alive. * @return bool targetable */ - int IsTargetableForAttack(lua_State* L, Creature* creature) + int IsTargetableForAttack(lua_State *L, Creature *creature) { bool mustBeDead = Eluna::CHECKVAL(L, 2, false); @@ -73,10 +86,10 @@ namespace LuaCreature * @param bool checkFaction = true : if `true`, the [Creature] must be the same faction as `friend` to assist * @return bool canAssist */ - int CanAssistTo(lua_State* L, Creature* creature) + int CanAssistTo(lua_State *L, Creature *creature) { - Unit* u = Eluna::CHECKOBJ(L, 2); - Unit* enemy = Eluna::CHECKOBJ(L, 3); + Unit *u = Eluna::CHECKOBJ(L, 2); + Unit *enemy = Eluna::CHECKOBJ(L, 3); bool checkfaction = Eluna::CHECKVAL(L, 4, true); Eluna::Push(L, creature->CanAssistTo(u, enemy, checkfaction)); @@ -89,7 +102,7 @@ namespace LuaCreature * * @return bool searchedForAssistance */ - int HasSearchedAssistance(lua_State* L, Creature* creature) + int HasSearchedAssistance(lua_State *L, Creature *creature) { Eluna::Push(L, creature->HasSearchedAssistance()); return 1; @@ -101,9 +114,9 @@ namespace LuaCreature * * @return bool tapped */ - int IsTappedBy(lua_State* L, Creature* creature) + int IsTappedBy(lua_State *L, Creature *creature) { - Player* player = Eluna::CHECKOBJ(L, 2); + Player *player = Eluna::CHECKOBJ(L, 2); #if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->isTappedBy(player)); @@ -119,7 +132,7 @@ namespace LuaCreature * * @return bool hasLootRecipient */ - int HasLootRecipient(lua_State* L, Creature* creature) + int HasLootRecipient(lua_State *L, Creature *creature) { #if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->hasLootRecipient()); @@ -135,7 +148,7 @@ namespace LuaCreature * * @return bool canAggro */ - int CanAggro(lua_State* L, Creature* creature) + int CanAggro(lua_State *L, Creature *creature) { #if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, !creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)); @@ -152,7 +165,7 @@ namespace LuaCreature * * @return bool canSwim */ - int CanSwim(lua_State* L, Creature* creature) + int CanSwim(lua_State *L, Creature *creature) { Eluna::Push(L, creature->CanSwim()); return 1; @@ -164,7 +177,7 @@ namespace LuaCreature * * @return bool canWalk */ - int CanWalk(lua_State* L, Creature* creature) + int CanWalk(lua_State *L, Creature *creature) { Eluna::Push(L, creature->CanWalk()); return 1; @@ -176,7 +189,7 @@ namespace LuaCreature * * @return bool inEvadeMode */ - int IsInEvadeMode(lua_State* L, Creature* creature) + int IsInEvadeMode(lua_State *L, Creature *creature) { Eluna::Push(L, creature->IsInEvadeMode()); return 1; @@ -188,7 +201,7 @@ namespace LuaCreature * * @return bool isElite */ - int IsElite(lua_State* L, Creature* creature) + int IsElite(lua_State *L, Creature *creature) { #if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->isElite()); @@ -204,7 +217,7 @@ namespace LuaCreature * * @return bool isGuard */ - int IsGuard(lua_State* L, Creature* creature) + int IsGuard(lua_State *L, Creature *creature) { Eluna::Push(L, creature->IsGuard()); return 1; @@ -216,7 +229,7 @@ namespace LuaCreature * * @return bool isCivilian */ - int IsCivilian(lua_State* L, Creature* creature) + int IsCivilian(lua_State *L, Creature *creature) { Eluna::Push(L, creature->IsCivilian()); return 1; @@ -228,7 +241,7 @@ namespace LuaCreature * * @return bool isLeader */ - int IsRacialLeader(lua_State* L, Creature* creature) + int IsRacialLeader(lua_State *L, Creature *creature) { Eluna::Push(L, creature->IsRacialLeader()); return 1; @@ -241,7 +254,7 @@ namespace LuaCreature * @return bool isDungeonBoss */ #if defined(TRINITY) || defined(AZEROTHCORE) - int IsDungeonBoss(lua_State* L, Creature* creature) + int IsDungeonBoss(lua_State *L, Creature *creature) { Eluna::Push(L, creature->IsDungeonBoss()); return 1; @@ -254,7 +267,7 @@ namespace LuaCreature * * @return bool isWorldBoss */ - int IsWorldBoss(lua_State* L, Creature* creature) + int IsWorldBoss(lua_State *L, Creature *creature) { #if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->isWorldBoss()); @@ -271,17 +284,17 @@ namespace LuaCreature * @param uint32 spellId : the ID of a [Spell] * @return bool hasCooldown */ - int HasCategoryCooldown(lua_State* L, Creature* creature) + int HasCategoryCooldown(lua_State *L, Creature *creature) { uint32 spell = Eluna::CHECKVAL(L, 2); #if defined(TRINITY) - if (const SpellInfo* info = sSpellMgr->GetSpellInfo(spell)) + if (const SpellInfo *info = sSpellMgr->GetSpellInfo(spell)) Eluna::Push(L, info->GetCategory() && creature->GetSpellHistory()->HasCooldown(spell)); else Eluna::Push(L, false); #elif defined(AZEROTHCORE) - if (const SpellInfo* info = sSpellMgr->GetSpellInfo(spell)) + if (const SpellInfo *info = sSpellMgr->GetSpellInfo(spell)) Eluna::Push(L, info->GetCategory() && creature->HasSpellCooldown(spell)); else Eluna::Push(L, false); @@ -298,7 +311,7 @@ namespace LuaCreature * @param uint32 spellId : the ID of a [Spell] * @return bool hasSpell */ - int HasSpell(lua_State* L, Creature* creature) + int HasSpell(lua_State *L, Creature *creature) { uint32 id = Eluna::CHECKVAL(L, 2); @@ -313,7 +326,7 @@ namespace LuaCreature * @param uint32 questId : the ID of a [Quest] * @return bool hasQuest */ - int HasQuest(lua_State* L, Creature* creature) + int HasQuest(lua_State *L, Creature *creature) { uint32 questId = Eluna::CHECKVAL(L, 2); @@ -332,7 +345,7 @@ namespace LuaCreature * @param uint32 spellId : the ID of a [Spell] * @return bool hasCooldown */ - int HasSpellCooldown(lua_State* L, Creature* creature) + int HasSpellCooldown(lua_State *L, Creature *creature) { uint32 spellId = Eluna::CHECKVAL(L, 2); @@ -350,7 +363,7 @@ namespace LuaCreature * * @return bool canFly */ - int CanFly(lua_State* L, Creature* creature) + int CanFly(lua_State *L, Creature *creature) { Eluna::Push(L, creature->CanFly()); return 1; @@ -363,7 +376,7 @@ namespace LuaCreature * * @return bool canFly */ - int IsTrigger(lua_State* L, Creature* creature) + int IsTrigger(lua_State *L, Creature *creature) { Eluna::Push(L, creature->IsTrigger()); return 1; @@ -374,7 +387,7 @@ namespace LuaCreature * * @return bool isDamagedEnough */ - int IsDamageEnoughForLootingAndReward(lua_State* L, Creature* creature) + int IsDamageEnoughForLootingAndReward(lua_State *L, Creature *creature) { Eluna::Push(L, creature->IsDamageEnoughForLootingAndReward()); return 1; @@ -388,9 +401,9 @@ namespace LuaCreature * @param [Unit] target * @param bool force = true : force [Creature] to attack */ - int CanStartAttack(lua_State* L, Creature* creature) // TODO: Implement core side + int CanStartAttack(lua_State *L, Creature *creature) // TODO: Implement core side { - Unit* target = Eluna::CHECKOBJ(L, 2); + Unit *target = Eluna::CHECKOBJ(L, 2); #ifndef AZEROTHCORE bool force = Eluna::CHECKVAL(L, 3, true); Eluna::Push(L, creature->CanStartAttack(target, force)); @@ -406,7 +419,7 @@ namespace LuaCreature * @param uint16 lootMode * @return bool hasLootMode */ - int HasLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features + int HasLootMode(lua_State *L, Creature *creature) // TODO: Implement LootMode features { uint16 lootMode = Eluna::CHECKVAL(L, 2); @@ -423,7 +436,7 @@ namespace LuaCreature * * @return uint32 respawnDelay : the respawn delay, in seconds */ - int GetRespawnDelay(lua_State* L, Creature* creature) + int GetRespawnDelay(lua_State *L, Creature *creature) { Eluna::Push(L, creature->GetRespawnDelay()); return 1; @@ -435,7 +448,7 @@ namespace LuaCreature * * @return float wanderRadius */ - int GetWanderRadius(lua_State* L, Creature* creature) + int GetWanderRadius(lua_State *L, Creature *creature) { #if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->GetWanderDistance()); @@ -451,7 +464,7 @@ namespace LuaCreature * * @return uint32 pathId */ - int GetWaypointPath(lua_State* L, Creature* creature) + int GetWaypointPath(lua_State *L, Creature *creature) { Eluna::Push(L, creature->GetWaypointPath()); return 1; @@ -463,7 +476,7 @@ namespace LuaCreature * * @return uint32 wpId */ - int GetCurrentWaypointId(lua_State* L, Creature* creature) + int GetCurrentWaypointId(lua_State *L, Creature *creature) { #if defined(TRINITY) Eluna::Push(L, creature->GetCurrentWaypointInfo().first); @@ -480,7 +493,7 @@ namespace LuaCreature * * @return [MovementGeneratorType] defaultMovementType */ - int GetDefaultMovementType(lua_State* L, Creature* creature) + int GetDefaultMovementType(lua_State *L, Creature *creature) { Eluna::Push(L, creature->GetDefaultMovementType()); return 1; @@ -492,9 +505,9 @@ namespace LuaCreature * @param [Unit] target * @return float aggroRange */ - int GetAggroRange(lua_State* L, Creature* creature) + int GetAggroRange(lua_State *L, Creature *creature) { - Unit* target = Eluna::CHECKOBJ(L, 2); + Unit *target = Eluna::CHECKOBJ(L, 2); #if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->GetAggroRange(target)); @@ -516,9 +529,9 @@ namespace LuaCreature * @param [Unit] target * @return float attackDistance */ - int GetAttackDistance(lua_State* L, Creature* creature) + int GetAttackDistance(lua_State *L, Creature *creature) { - Unit* target = Eluna::CHECKOBJ(L, 2); + Unit *target = Eluna::CHECKOBJ(L, 2); Eluna::Push(L, creature->GetAttackDistance(target)); return 1; @@ -530,7 +543,7 @@ namespace LuaCreature * * @return [Group] lootRecipientGroup : the group or `nil` */ - int GetLootRecipientGroup(lua_State* L, Creature* creature) + int GetLootRecipientGroup(lua_State *L, Creature *creature) { #if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->GetLootRecipientGroup()); @@ -545,7 +558,7 @@ namespace LuaCreature * * @return [Player] lootRecipient : the player or `nil` */ - int GetLootRecipient(lua_State* L, Creature* creature) + int GetLootRecipient(lua_State *L, Creature *creature) { Eluna::Push(L, creature->GetLootRecipient()); return 1; @@ -560,7 +573,7 @@ namespace LuaCreature * * @return string scriptName */ - int GetScriptName(lua_State* L, Creature* creature) + int GetScriptName(lua_State *L, Creature *creature) { Eluna::Push(L, creature->GetScriptName()); return 1; @@ -575,7 +588,7 @@ namespace LuaCreature * * @return string AIName */ - int GetAIName(lua_State* L, Creature* creature) + int GetAIName(lua_State *L, Creature *creature) { Eluna::Push(L, creature->GetAIName()); return 1; @@ -589,7 +602,7 @@ namespace LuaCreature * * @return uint32 scriptID */ - int GetScriptId(lua_State* L, Creature* creature) + int GetScriptId(lua_State *L, Creature *creature) { Eluna::Push(L, creature->GetScriptId()); return 1; @@ -601,12 +614,12 @@ namespace LuaCreature * @param uint32 spellID * @return uint32 cooldown : the cooldown, in milliseconds */ - int GetCreatureSpellCooldownDelay(lua_State* L, Creature* creature) + int GetCreatureSpellCooldownDelay(lua_State *L, Creature *creature) { uint32 spell = Eluna::CHECKVAL(L, 2); #if defined(TRINITY) - if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell)) + if (SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell)) Eluna::Push(L, creature->GetSpellHistory()->GetRemainingCooldown(spellInfo)); else Eluna::Push(L, 0); @@ -626,7 +639,7 @@ namespace LuaCreature * * @return uint32 corpseDelay : the delay, in seconds */ - int GetCorpseDelay(lua_State* L, Creature* creature) + int GetCorpseDelay(lua_State *L, Creature *creature) { Eluna::Push(L, creature->GetCorpseDelay()); return 1; @@ -641,7 +654,7 @@ namespace LuaCreature * @return float z * @return float o */ - int GetHomePosition(lua_State* L, Creature* creature) + int GetHomePosition(lua_State *L, Creature *creature) { float x, y, z, o; #if defined(TRINITY) || defined(AZEROTHCORE) @@ -666,7 +679,7 @@ namespace LuaCreature * @param float z * @param float o */ - int SetHomePosition(lua_State* L, Creature* creature) + int SetHomePosition(lua_State *L, Creature *creature) { float x = Eluna::CHECKVAL(L, 2); float y = Eluna::CHECKVAL(L, 3); @@ -684,9 +697,9 @@ namespace LuaCreature enum SelectAggroTarget { - SELECT_TARGET_RANDOM = 0, // Just selects a random target - SELECT_TARGET_TOPAGGRO, // Selects targes from top aggro to bottom - SELECT_TARGET_BOTTOMAGGRO, // Selects targets from bottom aggro to top + SELECT_TARGET_RANDOM = 0, // Just selects a random target + SELECT_TARGET_TOPAGGRO, // Selects targes from top aggro to bottom + SELECT_TARGET_BOTTOMAGGRO, // Selects targets from bottom aggro to top SELECT_TARGET_NEAREST, SELECT_TARGET_FARTHEST }; @@ -717,7 +730,7 @@ namespace LuaCreature * @param int32 aura = 0 : if positive, the target must have this [Aura]. If negative, the the target must not have this Aura * @return [Unit] target : the target, or `nil` */ - int GetAITarget(lua_State* L, Creature* creature) + int GetAITarget(lua_State *L, Creature *creature) { uint32 targetType = Eluna::CHECKVAL(L, 2); bool playerOnly = Eluna::CHECKVAL(L, 3, false); @@ -726,13 +739,13 @@ namespace LuaCreature int32 aura = Eluna::CHECKVAL(L, 6, 0); #if defined(CMANGOS) - ThreatList const& threatlist = creature->getThreatManager().getThreatList(); + ThreatList const &threatlist = creature->getThreatManager().getThreatList(); #elif defined(MANGOS) - ThreatList const& threatlist = creature->GetThreatManager().getThreatList(); + ThreatList const &threatlist = creature->GetThreatManager().getThreatList(); #elif defined(TRINITY) - auto const& threatlist = creature->GetThreatManager().GetSortedThreatList(); + auto const &threatlist = creature->GetThreatManager().GetSortedThreatList(); #elif defined(AZEROTHCORE) - auto const& threatlist = creature->getThreatManager().getThreatList(); + auto const &threatlist = creature->getThreatManager().getThreatList(); #endif #ifndef TRINITY if (threatlist.empty()) @@ -740,17 +753,17 @@ namespace LuaCreature if (position >= threatlist.size()) return 1; #endif - std::list targetList; + std::list targetList; #if defined(TRINITY) - for (ThreatReference const* itr : threatlist) + for (ThreatReference const *itr : threatlist) #else for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr) #endif - { + { #if defined(TRINITY) - Unit* target = itr->GetVictim(); + Unit *target = itr->GetVictim(); #else - Unit* target = (*itr)->getTarget(); + Unit *target = (*itr)->getTarget(); #endif if (!target) continue; @@ -777,37 +790,37 @@ namespace LuaCreature switch (targetType) { - case SELECT_TARGET_NEAREST: - case SELECT_TARGET_TOPAGGRO: - { - std::list::const_iterator itr = targetList.begin(); - if (position) - std::advance(itr, position); - Eluna::Push(L, *itr); - } - break; - case SELECT_TARGET_FARTHEST: - case SELECT_TARGET_BOTTOMAGGRO: - { - std::list::reverse_iterator ritr = targetList.rbegin(); - if (position) - std::advance(ritr, position); - Eluna::Push(L, *ritr); - } - break; - case SELECT_TARGET_RANDOM: - { - std::list::const_iterator itr = targetList.begin(); - if (position) - std::advance(itr, urand(0, position)); - else - std::advance(itr, urand(0, targetList.size() - 1)); - Eluna::Push(L, *itr); - } - break; - default: - luaL_argerror(L, 2, "SelectAggroTarget expected"); - break; + case SELECT_TARGET_NEAREST: + case SELECT_TARGET_TOPAGGRO: + { + std::list::const_iterator itr = targetList.begin(); + if (position) + std::advance(itr, position); + Eluna::Push(L, *itr); + } + break; + case SELECT_TARGET_FARTHEST: + case SELECT_TARGET_BOTTOMAGGRO: + { + std::list::reverse_iterator ritr = targetList.rbegin(); + if (position) + std::advance(ritr, position); + Eluna::Push(L, *ritr); + } + break; + case SELECT_TARGET_RANDOM: + { + std::list::const_iterator itr = targetList.begin(); + if (position) + std::advance(itr, urand(0, position)); + else + std::advance(itr, urand(0, targetList.size() - 1)); + Eluna::Push(L, *itr); + } + break; + default: + luaL_argerror(L, 2, "SelectAggroTarget expected"); + break; } return 1; @@ -818,14 +831,14 @@ namespace LuaCreature * * @return table targets */ - int GetAITargets(lua_State* L, Creature* creature) + int GetAITargets(lua_State *L, Creature *creature) { #if defined(TRINITY) - auto const& threatlist = creature->GetThreatManager().GetThreatenedByMeList(); + auto const &threatlist = creature->GetThreatManager().GetThreatenedByMeList(); #elif defined(AZEROTHCORE) -auto const& threatlist = creature->getThreatManager().getThreatList(); + auto const &threatlist = creature->getThreatManager().getThreatList(); #else - ThreatList const& threatlist = creature->GetThreatManager().getThreatList(); + ThreatList const &threatlist = creature->GetThreatManager().getThreatList(); #endif lua_createtable(L, threatlist.size(), 0); int tbl = lua_gettop(L); @@ -833,9 +846,9 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr) { #if defined(TRINITY) - Unit* target = itr->second->GetOwner(); + Unit *target = itr->second->GetOwner(); #else - Unit* target = (*itr)->getTarget(); + Unit *target = (*itr)->getTarget(); #endif if (!target) continue; @@ -852,7 +865,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * * @return int targetsCount */ - int GetAITargetsCount(lua_State* L, Creature* creature) + int GetAITargetsCount(lua_State *L, Creature *creature) { #if defined(TRINITY) Eluna::Push(L, creature->GetThreatManager().GetThreatenedByMeList().size()); @@ -872,7 +885,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * * @return [NPCFlags] npcFlags */ - int GetNPCFlags(lua_State* L, Creature* creature) + int GetNPCFlags(lua_State *L, Creature *creature) { Eluna::Push(L, creature->GetUInt32Value(UNIT_NPC_FLAGS)); return 1; @@ -886,7 +899,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * * @return [ExtraFlags] extraFlags */ - int GetExtraFlags(lua_State* L, Creature* creature) + int GetExtraFlags(lua_State *L, Creature *creature) { #if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->GetCreatureTemplate()->flags_extra); @@ -902,7 +915,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * * @return uint32 shieldBlockValue */ - int GetShieldBlockValue(lua_State* L, Creature* creature) + int GetShieldBlockValue(lua_State *L, Creature *creature) { Eluna::Push(L, creature->GetShieldBlockValue()); return 1; @@ -910,7 +923,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); #endif #if defined(TRINITY) || defined(AZEROTHCORE) - int GetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features + int GetLootMode(lua_State *L, Creature *creature) // TODO: Implement LootMode features { Eluna::Push(L, creature->GetLootMode()); return 1; @@ -922,7 +935,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * * @return uint32 dbguid */ - int GetDBTableGUIDLow(lua_State* L, Creature* creature) + int GetDBTableGUIDLow(lua_State *L, Creature *creature) { #if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->GetSpawnId()); @@ -938,7 +951,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * * @param [NPCFlags] flags */ - int SetNPCFlags(lua_State* L, Creature* creature) + int SetNPCFlags(lua_State *L, Creature *creature) { uint32 flags = Eluna::CHECKVAL(L, 2); @@ -946,13 +959,12 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); return 0; } - /** * Makes the [Creature] able to fly if enabled. * * @param bool disable */ - int SetDisableGravity(lua_State* L, Creature* creature) + int SetDisableGravity(lua_State *L, Creature *creature) { bool disable = Eluna::CHECKVAL(L, 2); @@ -965,7 +977,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); } #if defined(TRINITY) || defined(AZEROTHCORE) - int SetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features + int SetLootMode(lua_State *L, Creature *creature) // TODO: Implement LootMode features { uint16 lootMode = Eluna::CHECKVAL(L, 2); @@ -979,7 +991,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * * @param [DeathState] deathState */ - int SetDeathState(lua_State* L, Creature* creature) + int SetDeathState(lua_State *L, Creature *creature) { int32 state = Eluna::CHECKVAL(L, 2); @@ -996,7 +1008,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * * @param bool enable = true : `true` to enable walking, `false` for running */ - int SetWalk(lua_State* L, Creature* creature) // TODO: Move same to Player ? + int SetWalk(lua_State *L, Creature *creature) // TODO: Move same to Player ? { bool enable = Eluna::CHECKVAL(L, 2, true); @@ -1011,7 +1023,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * @param uint32 off_hand : off hand [Item]'s entry * @param uint32 ranged : ranged [Item]'s entry */ - int SetEquipmentSlots(lua_State* L, Creature* creature) + int SetEquipmentSlots(lua_State *L, Creature *creature) { uint32 main_hand = Eluna::CHECKVAL(L, 2); uint32 off_hand = Eluna::CHECKVAL(L, 3); @@ -1034,7 +1046,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * * @param bool allow = true : `true` to allow aggro, `false` to disable aggro */ - int SetAggroEnabled(lua_State* L, Creature* creature) + int SetAggroEnabled(lua_State *L, Creature *creature) { bool allow = Eluna::CHECKVAL(L, 2, true); @@ -1058,7 +1070,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * * @param bool disable = true : `true` to disable reputation, `false` to enable */ - int SetDisableReputationGain(lua_State* L, Creature* creature) + int SetDisableReputationGain(lua_State *L, Creature *creature) { bool disable = Eluna::CHECKVAL(L, 2, true); @@ -1072,7 +1084,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * This is used by raid bosses to prevent Players from using out-of-combat * actions once the encounter has begun. */ - int SetInCombatWithZone(lua_State* /*L*/, Creature* creature) + int SetInCombatWithZone(lua_State * /*L*/, Creature *creature) { #if defined(AZEROTHCORE) if (creature->IsAIEnabled) @@ -1091,7 +1103,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * * @param float distance */ - int SetWanderRadius(lua_State* L, Creature* creature) + int SetWanderRadius(lua_State *L, Creature *creature) { float dist = Eluna::CHECKVAL(L, 2); @@ -1108,7 +1120,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * * @param uint32 delay : the delay, in seconds */ - int SetRespawnDelay(lua_State* L, Creature* creature) + int SetRespawnDelay(lua_State *L, Creature *creature) { uint32 delay = Eluna::CHECKVAL(L, 2); @@ -1121,7 +1133,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * * @param [MovementGeneratorType] type */ - int SetDefaultMovementType(lua_State* L, Creature* creature) + int SetDefaultMovementType(lua_State *L, Creature *creature) { int32 type = Eluna::CHECKVAL(L, 2); @@ -1134,7 +1146,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * * @param bool enable = true : `true` to disable searching, `false` to allow */ - int SetNoSearchAssistance(lua_State* L, Creature* creature) + int SetNoSearchAssistance(lua_State *L, Creature *creature) { bool val = Eluna::CHECKVAL(L, 2, true); @@ -1147,7 +1159,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * * @param bool enable = true : `true` to disable calling for help, `false` to enable */ - int SetNoCallAssistance(lua_State* L, Creature* creature) + int SetNoCallAssistance(lua_State *L, Creature *creature) { bool val = Eluna::CHECKVAL(L, 2, true); @@ -1160,7 +1172,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * * @param bool enable = true : `true` to enable hovering, `false` to disable */ - int SetHover(lua_State* L, Creature* creature) + int SetHover(lua_State *L, Creature *creature) { bool enable = Eluna::CHECKVAL(L, 2, true); @@ -1190,7 +1202,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * * @param uint32 delay = 0 : dely to despawn in milliseconds */ - int DespawnOrUnsummon(lua_State* L, Creature* creature) + int DespawnOrUnsummon(lua_State *L, Creature *creature) { uint32 msTimeToDespawn = Eluna::CHECKVAL(L, 2, 0); @@ -1207,7 +1219,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); /** * Respawn this [Creature]. */ - int Respawn(lua_State* /*L*/, Creature* creature) + int Respawn(lua_State * /*L*/, Creature *creature) { creature->Respawn(); return 0; @@ -1216,7 +1228,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); /** * Remove this [Creature]'s corpse. */ - int RemoveCorpse(lua_State* /*L*/, Creature* creature) + int RemoveCorpse(lua_State * /*L*/, Creature *creature) { creature->RemoveCorpse(); return 0; @@ -1225,7 +1237,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); /** * Make the [Creature] start following its waypoint path. */ - int MoveWaypoint(lua_State* /*L*/, Creature* creature) + int MoveWaypoint(lua_State * /*L*/, Creature *creature) { #if defined(TRINITY) || defined(AZEROTHCORE) creature->GetMotionMaster()->MovePath(creature->GetWaypointPath(), true); @@ -1238,7 +1250,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); /** * Make the [Creature] call for assistance in combat from other nearby [Creature]s. */ - int CallAssistance(lua_State* /*L*/, Creature* creature) + int CallAssistance(lua_State * /*L*/, Creature *creature) { creature->CallAssistance(); return 0; @@ -1249,7 +1261,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * * @param float radius */ - int CallForHelp(lua_State* L, Creature* creature) + int CallForHelp(lua_State *L, Creature *creature) { float radius = Eluna::CHECKVAL(L, 2); @@ -1260,7 +1272,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); /** * Make the [Creature] flee combat to get assistance from a nearby friendly [Creature]. */ - int FleeToGetAssistance(lua_State* /*L*/, Creature* creature) + int FleeToGetAssistance(lua_State * /*L*/, Creature *creature) { creature->DoFleeToGetAssistance(); return 0; @@ -1271,9 +1283,9 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * * @param [Unit] target */ - int AttackStart(lua_State* L, Creature* creature) + int AttackStart(lua_State *L, Creature *creature) { - Unit* target = Eluna::CHECKOBJ(L, 2); + Unit *target = Eluna::CHECKOBJ(L, 2); creature->AI()->AttackStart(target); return 0; @@ -1282,7 +1294,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); /** * Save the [Creature] in the database. */ - int SaveToDB(lua_State* /*L*/, Creature* creature) + int SaveToDB(lua_State * /*L*/, Creature *creature) { creature->SaveToDB(); return 0; @@ -1293,7 +1305,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * * This should be called every update cycle for the Creature's AI. */ - int SelectVictim(lua_State* L, Creature* creature) + int SelectVictim(lua_State *L, Creature *creature) { #if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->SelectVictim()); @@ -1309,7 +1321,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * @param uint32 entry : the Creature ID to transform into * @param uint32 dataGUIDLow = 0 : use this Creature's model and equipment instead of the defaults */ - int UpdateEntry(lua_State* L, Creature* creature) + int UpdateEntry(lua_State *L, Creature *creature) { uint32 entry = Eluna::CHECKVAL(L, 2); uint32 dataGuidLow = Eluna::CHECKVAL(L, 3, 0); @@ -1326,7 +1338,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); /** * Resets [Creature]'s loot mode to default */ - int ResetLootMode(lua_State* /*L*/, Creature* creature) // TODO: Implement LootMode features + int ResetLootMode(lua_State * /*L*/, Creature *creature) // TODO: Implement LootMode features { creature->ResetLootMode(); return 0; @@ -1337,7 +1349,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * * @param uint16 lootMode */ - int RemoveLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features + int RemoveLootMode(lua_State *L, Creature *creature) // TODO: Implement LootMode features { uint16 lootMode = Eluna::CHECKVAL(L, 2); @@ -1350,7 +1362,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * * @param uint16 lootMode */ - int AddLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features + int AddLootMode(lua_State *L, Creature *creature) // TODO: Implement LootMode features { uint16 lootMode = Eluna::CHECKVAL(L, 2); @@ -1413,16 +1425,16 @@ auto const& threatlist = creature->getThreatManager().getThreatList(); * * @return [CreatureFamily] creatureFamily */ - int GetCreatureFamily(lua_State* L, Creature* creature) + int GetCreatureFamily(lua_State *L, Creature *creature) { uint32 entry = creature->GetEntry(); #if defined(TRINITY) || defined(AZEROTHCORE) - CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(entry); + CreatureTemplate const *cInfo = sObjectMgr->GetCreatureTemplate(entry); if (cInfo) Eluna::Push(L, cInfo->family); #else - CreatureInfo const* cInfo = ObjectMgr::GetCreatureTemplate(entry); + CreatureInfo const *cInfo = ObjectMgr::GetCreatureTemplate(entry); if (cInfo) Eluna::Push(L, cInfo->Family); #endif diff --git a/LuaFunctions.cpp b/LuaFunctions.cpp index ed3fbce..13d36f1 100644 --- a/LuaFunctions.cpp +++ b/LuaFunctions.cpp @@ -790,6 +790,7 @@ ElunaRegister CreatureMethods[] = { "GetCreatureFamily", &LuaCreature::GetCreatureFamily }, // Setters + { "SetRegeneratingHealth", &LuaCreature::SetRegeneratingHealth }, { "SetHover", &LuaCreature::SetHover }, { "SetDisableGravity", &LuaCreature::SetDisableGravity }, { "SetAggroEnabled", &LuaCreature::SetAggroEnabled }, From 564b6b8b1714067c6564d47de33e9ea6bc72b1c8 Mon Sep 17 00:00:00 2001 From: xIvan0ff Date: Thu, 20 May 2021 12:51:03 +0300 Subject: [PATCH 2/5] Fix for TC --- CreatureMethods.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CreatureMethods.h b/CreatureMethods.h index cc6e2b4..901f8d3 100644 --- a/CreatureMethods.h +++ b/CreatureMethods.h @@ -23,7 +23,11 @@ namespace LuaCreature { bool enable = Eluna::CHECKVAL(L, 2, true); +#if defined(AZEROTHCORE) creature->SetRegeneratingHealth(enable); +#else + creature->SetRegenerateHealth(enable); +#endif return 0; } From fa6fc881e62fc17941f8dedf6cd6801366bf8a4d Mon Sep 17 00:00:00 2001 From: xIvan0ff Date: Sun, 23 May 2021 00:17:50 +0300 Subject: [PATCH 3/5] Getter added & Extra Code Cleanup --- CreatureMethods.h | 299 ++++++++++++++++++++++++---------------------- LuaFunctions.cpp | 1 + 2 files changed, 160 insertions(+), 140 deletions(-) diff --git a/CreatureMethods.h b/CreatureMethods.h index 901f8d3..a8d796d 100644 --- a/CreatureMethods.h +++ b/CreatureMethods.h @@ -14,6 +14,24 @@ */ namespace LuaCreature { + /** + * Returns `true` if the [Creature] can regenerate health, + * and returns `false` otherwise. + * + * @return bool isRegenerating + */ + int IsRegeneratingHealth(lua_State* L, Creature* creature) + { +#if defined(AZEROTHCORE) + Eluna::Push(L, creature->isRegeneratingHealth()); +#elif defined(TRINITY) + Eluna::Push(L, creature->CanRegenerateHealth()); +#else + Eluna::Push(L, creature->IsRegeneratingHealth()); +#endif + return 1; + } + /** * Sets whether the [Creature] can regenerate health or not. * @@ -37,7 +55,7 @@ namespace LuaCreature * * @return bool reputationDisabled */ - int IsReputationGainDisabled(lua_State *L, Creature *creature) + int IsReputationGainDisabled(lua_State* L, Creature* creature) { Eluna::Push(L, creature->IsReputationGainDisabled()); return 1; @@ -50,7 +68,7 @@ namespace LuaCreature * @param uint32 questID : the ID of a [Quest] * @return bool completesQuest */ - int CanCompleteQuest(lua_State *L, Creature *creature) + int CanCompleteQuest(lua_State* L, Creature* creature) { uint32 quest_id = Eluna::CHECKVAL(L, 2); @@ -69,7 +87,7 @@ namespace LuaCreature * @param bool mustBeDead = false : if `true`, only returns `true` if the [Creature] is also dead. Otherwise, it must be alive. * @return bool targetable */ - int IsTargetableForAttack(lua_State *L, Creature *creature) + int IsTargetableForAttack(lua_State* L, Creature* creature) { bool mustBeDead = Eluna::CHECKVAL(L, 2, false); @@ -90,10 +108,10 @@ namespace LuaCreature * @param bool checkFaction = true : if `true`, the [Creature] must be the same faction as `friend` to assist * @return bool canAssist */ - int CanAssistTo(lua_State *L, Creature *creature) + int CanAssistTo(lua_State* L, Creature* creature) { - Unit *u = Eluna::CHECKOBJ(L, 2); - Unit *enemy = Eluna::CHECKOBJ(L, 3); + Unit* u = Eluna::CHECKOBJ(L, 2); + Unit* enemy = Eluna::CHECKOBJ(L, 3); bool checkfaction = Eluna::CHECKVAL(L, 4, true); Eluna::Push(L, creature->CanAssistTo(u, enemy, checkfaction)); @@ -106,7 +124,7 @@ namespace LuaCreature * * @return bool searchedForAssistance */ - int HasSearchedAssistance(lua_State *L, Creature *creature) + int HasSearchedAssistance(lua_State* L, Creature* creature) { Eluna::Push(L, creature->HasSearchedAssistance()); return 1; @@ -118,9 +136,9 @@ namespace LuaCreature * * @return bool tapped */ - int IsTappedBy(lua_State *L, Creature *creature) + int IsTappedBy(lua_State* L, Creature* creature) { - Player *player = Eluna::CHECKOBJ(L, 2); + Player* player = Eluna::CHECKOBJ(L, 2); #if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->isTappedBy(player)); @@ -136,7 +154,7 @@ namespace LuaCreature * * @return bool hasLootRecipient */ - int HasLootRecipient(lua_State *L, Creature *creature) + int HasLootRecipient(lua_State* L, Creature* creature) { #if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->hasLootRecipient()); @@ -152,7 +170,7 @@ namespace LuaCreature * * @return bool canAggro */ - int CanAggro(lua_State *L, Creature *creature) + int CanAggro(lua_State* L, Creature* creature) { #if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, !creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)); @@ -169,7 +187,7 @@ namespace LuaCreature * * @return bool canSwim */ - int CanSwim(lua_State *L, Creature *creature) + int CanSwim(lua_State* L, Creature* creature) { Eluna::Push(L, creature->CanSwim()); return 1; @@ -181,7 +199,7 @@ namespace LuaCreature * * @return bool canWalk */ - int CanWalk(lua_State *L, Creature *creature) + int CanWalk(lua_State* L, Creature* creature) { Eluna::Push(L, creature->CanWalk()); return 1; @@ -193,7 +211,7 @@ namespace LuaCreature * * @return bool inEvadeMode */ - int IsInEvadeMode(lua_State *L, Creature *creature) + int IsInEvadeMode(lua_State* L, Creature* creature) { Eluna::Push(L, creature->IsInEvadeMode()); return 1; @@ -205,7 +223,7 @@ namespace LuaCreature * * @return bool isElite */ - int IsElite(lua_State *L, Creature *creature) + int IsElite(lua_State* L, Creature* creature) { #if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->isElite()); @@ -221,7 +239,7 @@ namespace LuaCreature * * @return bool isGuard */ - int IsGuard(lua_State *L, Creature *creature) + int IsGuard(lua_State* L, Creature* creature) { Eluna::Push(L, creature->IsGuard()); return 1; @@ -233,7 +251,7 @@ namespace LuaCreature * * @return bool isCivilian */ - int IsCivilian(lua_State *L, Creature *creature) + int IsCivilian(lua_State* L, Creature* creature) { Eluna::Push(L, creature->IsCivilian()); return 1; @@ -245,7 +263,7 @@ namespace LuaCreature * * @return bool isLeader */ - int IsRacialLeader(lua_State *L, Creature *creature) + int IsRacialLeader(lua_State* L, Creature* creature) { Eluna::Push(L, creature->IsRacialLeader()); return 1; @@ -258,7 +276,7 @@ namespace LuaCreature * @return bool isDungeonBoss */ #if defined(TRINITY) || defined(AZEROTHCORE) - int IsDungeonBoss(lua_State *L, Creature *creature) + int IsDungeonBoss(lua_State* L, Creature* creature) { Eluna::Push(L, creature->IsDungeonBoss()); return 1; @@ -271,7 +289,7 @@ namespace LuaCreature * * @return bool isWorldBoss */ - int IsWorldBoss(lua_State *L, Creature *creature) + int IsWorldBoss(lua_State* L, Creature* creature) { #if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->isWorldBoss()); @@ -288,17 +306,17 @@ namespace LuaCreature * @param uint32 spellId : the ID of a [Spell] * @return bool hasCooldown */ - int HasCategoryCooldown(lua_State *L, Creature *creature) + int HasCategoryCooldown(lua_State* L, Creature* creature) { uint32 spell = Eluna::CHECKVAL(L, 2); #if defined(TRINITY) - if (const SpellInfo *info = sSpellMgr->GetSpellInfo(spell)) + if (const SpellInfo* info = sSpellMgr->GetSpellInfo(spell)) Eluna::Push(L, info->GetCategory() && creature->GetSpellHistory()->HasCooldown(spell)); else Eluna::Push(L, false); #elif defined(AZEROTHCORE) - if (const SpellInfo *info = sSpellMgr->GetSpellInfo(spell)) + if (const SpellInfo* info = sSpellMgr->GetSpellInfo(spell)) Eluna::Push(L, info->GetCategory() && creature->HasSpellCooldown(spell)); else Eluna::Push(L, false); @@ -315,7 +333,7 @@ namespace LuaCreature * @param uint32 spellId : the ID of a [Spell] * @return bool hasSpell */ - int HasSpell(lua_State *L, Creature *creature) + int HasSpell(lua_State* L, Creature* creature) { uint32 id = Eluna::CHECKVAL(L, 2); @@ -330,7 +348,7 @@ namespace LuaCreature * @param uint32 questId : the ID of a [Quest] * @return bool hasQuest */ - int HasQuest(lua_State *L, Creature *creature) + int HasQuest(lua_State* L, Creature* creature) { uint32 questId = Eluna::CHECKVAL(L, 2); @@ -349,7 +367,7 @@ namespace LuaCreature * @param uint32 spellId : the ID of a [Spell] * @return bool hasCooldown */ - int HasSpellCooldown(lua_State *L, Creature *creature) + int HasSpellCooldown(lua_State* L, Creature* creature) { uint32 spellId = Eluna::CHECKVAL(L, 2); @@ -367,7 +385,7 @@ namespace LuaCreature * * @return bool canFly */ - int CanFly(lua_State *L, Creature *creature) + int CanFly(lua_State* L, Creature* creature) { Eluna::Push(L, creature->CanFly()); return 1; @@ -380,7 +398,7 @@ namespace LuaCreature * * @return bool canFly */ - int IsTrigger(lua_State *L, Creature *creature) + int IsTrigger(lua_State* L, Creature* creature) { Eluna::Push(L, creature->IsTrigger()); return 1; @@ -391,7 +409,7 @@ namespace LuaCreature * * @return bool isDamagedEnough */ - int IsDamageEnoughForLootingAndReward(lua_State *L, Creature *creature) + int IsDamageEnoughForLootingAndReward(lua_State* L, Creature* creature) { Eluna::Push(L, creature->IsDamageEnoughForLootingAndReward()); return 1; @@ -405,9 +423,9 @@ namespace LuaCreature * @param [Unit] target * @param bool force = true : force [Creature] to attack */ - int CanStartAttack(lua_State *L, Creature *creature) // TODO: Implement core side + int CanStartAttack(lua_State* L, Creature* creature) // TODO: Implement core side { - Unit *target = Eluna::CHECKOBJ(L, 2); + Unit* target = Eluna::CHECKOBJ(L, 2); #ifndef AZEROTHCORE bool force = Eluna::CHECKVAL(L, 3, true); Eluna::Push(L, creature->CanStartAttack(target, force)); @@ -423,7 +441,7 @@ namespace LuaCreature * @param uint16 lootMode * @return bool hasLootMode */ - int HasLootMode(lua_State *L, Creature *creature) // TODO: Implement LootMode features + int HasLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features { uint16 lootMode = Eluna::CHECKVAL(L, 2); @@ -440,7 +458,7 @@ namespace LuaCreature * * @return uint32 respawnDelay : the respawn delay, in seconds */ - int GetRespawnDelay(lua_State *L, Creature *creature) + int GetRespawnDelay(lua_State* L, Creature* creature) { Eluna::Push(L, creature->GetRespawnDelay()); return 1; @@ -452,7 +470,7 @@ namespace LuaCreature * * @return float wanderRadius */ - int GetWanderRadius(lua_State *L, Creature *creature) + int GetWanderRadius(lua_State* L, Creature* creature) { #if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->GetWanderDistance()); @@ -468,7 +486,7 @@ namespace LuaCreature * * @return uint32 pathId */ - int GetWaypointPath(lua_State *L, Creature *creature) + int GetWaypointPath(lua_State* L, Creature* creature) { Eluna::Push(L, creature->GetWaypointPath()); return 1; @@ -480,7 +498,7 @@ namespace LuaCreature * * @return uint32 wpId */ - int GetCurrentWaypointId(lua_State *L, Creature *creature) + int GetCurrentWaypointId(lua_State* L, Creature* creature) { #if defined(TRINITY) Eluna::Push(L, creature->GetCurrentWaypointInfo().first); @@ -497,7 +515,7 @@ namespace LuaCreature * * @return [MovementGeneratorType] defaultMovementType */ - int GetDefaultMovementType(lua_State *L, Creature *creature) + int GetDefaultMovementType(lua_State* L, Creature* creature) { Eluna::Push(L, creature->GetDefaultMovementType()); return 1; @@ -509,9 +527,9 @@ namespace LuaCreature * @param [Unit] target * @return float aggroRange */ - int GetAggroRange(lua_State *L, Creature *creature) + int GetAggroRange(lua_State* L, Creature* creature) { - Unit *target = Eluna::CHECKOBJ(L, 2); + Unit* target = Eluna::CHECKOBJ(L, 2); #if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->GetAggroRange(target)); @@ -533,9 +551,9 @@ namespace LuaCreature * @param [Unit] target * @return float attackDistance */ - int GetAttackDistance(lua_State *L, Creature *creature) + int GetAttackDistance(lua_State* L, Creature* creature) { - Unit *target = Eluna::CHECKOBJ(L, 2); + Unit* target = Eluna::CHECKOBJ(L, 2); Eluna::Push(L, creature->GetAttackDistance(target)); return 1; @@ -547,7 +565,7 @@ namespace LuaCreature * * @return [Group] lootRecipientGroup : the group or `nil` */ - int GetLootRecipientGroup(lua_State *L, Creature *creature) + int GetLootRecipientGroup(lua_State* L, Creature* creature) { #if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->GetLootRecipientGroup()); @@ -562,7 +580,7 @@ namespace LuaCreature * * @return [Player] lootRecipient : the player or `nil` */ - int GetLootRecipient(lua_State *L, Creature *creature) + int GetLootRecipient(lua_State* L, Creature* creature) { Eluna::Push(L, creature->GetLootRecipient()); return 1; @@ -577,7 +595,7 @@ namespace LuaCreature * * @return string scriptName */ - int GetScriptName(lua_State *L, Creature *creature) + int GetScriptName(lua_State* L, Creature* creature) { Eluna::Push(L, creature->GetScriptName()); return 1; @@ -592,7 +610,7 @@ namespace LuaCreature * * @return string AIName */ - int GetAIName(lua_State *L, Creature *creature) + int GetAIName(lua_State* L, Creature* creature) { Eluna::Push(L, creature->GetAIName()); return 1; @@ -606,7 +624,7 @@ namespace LuaCreature * * @return uint32 scriptID */ - int GetScriptId(lua_State *L, Creature *creature) + int GetScriptId(lua_State* L, Creature* creature) { Eluna::Push(L, creature->GetScriptId()); return 1; @@ -618,12 +636,12 @@ namespace LuaCreature * @param uint32 spellID * @return uint32 cooldown : the cooldown, in milliseconds */ - int GetCreatureSpellCooldownDelay(lua_State *L, Creature *creature) + int GetCreatureSpellCooldownDelay(lua_State* L, Creature* creature) { uint32 spell = Eluna::CHECKVAL(L, 2); #if defined(TRINITY) - if (SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell)) + if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell)) Eluna::Push(L, creature->GetSpellHistory()->GetRemainingCooldown(spellInfo)); else Eluna::Push(L, 0); @@ -643,7 +661,7 @@ namespace LuaCreature * * @return uint32 corpseDelay : the delay, in seconds */ - int GetCorpseDelay(lua_State *L, Creature *creature) + int GetCorpseDelay(lua_State* L, Creature* creature) { Eluna::Push(L, creature->GetCorpseDelay()); return 1; @@ -658,7 +676,7 @@ namespace LuaCreature * @return float z * @return float o */ - int GetHomePosition(lua_State *L, Creature *creature) + int GetHomePosition(lua_State* L, Creature* creature) { float x, y, z, o; #if defined(TRINITY) || defined(AZEROTHCORE) @@ -683,7 +701,7 @@ namespace LuaCreature * @param float z * @param float o */ - int SetHomePosition(lua_State *L, Creature *creature) + int SetHomePosition(lua_State* L, Creature* creature) { float x = Eluna::CHECKVAL(L, 2); float y = Eluna::CHECKVAL(L, 3); @@ -701,9 +719,9 @@ namespace LuaCreature enum SelectAggroTarget { - SELECT_TARGET_RANDOM = 0, // Just selects a random target - SELECT_TARGET_TOPAGGRO, // Selects targes from top aggro to bottom - SELECT_TARGET_BOTTOMAGGRO, // Selects targets from bottom aggro to top + SELECT_TARGET_RANDOM = 0, // Just selects a random target + SELECT_TARGET_TOPAGGRO, // Selects targes from top aggro to bottom + SELECT_TARGET_BOTTOMAGGRO, // Selects targets from bottom aggro to top SELECT_TARGET_NEAREST, SELECT_TARGET_FARTHEST }; @@ -734,7 +752,7 @@ namespace LuaCreature * @param int32 aura = 0 : if positive, the target must have this [Aura]. If negative, the the target must not have this Aura * @return [Unit] target : the target, or `nil` */ - int GetAITarget(lua_State *L, Creature *creature) + int GetAITarget(lua_State* L, Creature* creature) { uint32 targetType = Eluna::CHECKVAL(L, 2); bool playerOnly = Eluna::CHECKVAL(L, 3, false); @@ -743,13 +761,13 @@ namespace LuaCreature int32 aura = Eluna::CHECKVAL(L, 6, 0); #if defined(CMANGOS) - ThreatList const &threatlist = creature->getThreatManager().getThreatList(); + ThreatList const& threatlist = creature->getThreatManager().getThreatList(); #elif defined(MANGOS) - ThreatList const &threatlist = creature->GetThreatManager().getThreatList(); + ThreatList const& threatlist = creature->GetThreatManager().getThreatList(); #elif defined(TRINITY) - auto const &threatlist = creature->GetThreatManager().GetSortedThreatList(); + auto const& threatlist = creature->GetThreatManager().GetSortedThreatList(); #elif defined(AZEROTHCORE) - auto const &threatlist = creature->getThreatManager().getThreatList(); + auto const& threatlist = creature->getThreatManager().getThreatList(); #endif #ifndef TRINITY if (threatlist.empty()) @@ -757,17 +775,17 @@ namespace LuaCreature if (position >= threatlist.size()) return 1; #endif - std::list targetList; + std::list targetList; #if defined(TRINITY) - for (ThreatReference const *itr : threatlist) + for (ThreatReference const* itr : threatlist) #else for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr) #endif - { + { #if defined(TRINITY) - Unit *target = itr->GetVictim(); + Unit* target = itr->GetVictim(); #else - Unit *target = (*itr)->getTarget(); + Unit* target = (*itr)->getTarget(); #endif if (!target) continue; @@ -794,37 +812,37 @@ namespace LuaCreature switch (targetType) { - case SELECT_TARGET_NEAREST: - case SELECT_TARGET_TOPAGGRO: - { - std::list::const_iterator itr = targetList.begin(); - if (position) - std::advance(itr, position); - Eluna::Push(L, *itr); - } - break; - case SELECT_TARGET_FARTHEST: - case SELECT_TARGET_BOTTOMAGGRO: - { - std::list::reverse_iterator ritr = targetList.rbegin(); - if (position) - std::advance(ritr, position); - Eluna::Push(L, *ritr); - } - break; - case SELECT_TARGET_RANDOM: - { - std::list::const_iterator itr = targetList.begin(); - if (position) - std::advance(itr, urand(0, position)); - else - std::advance(itr, urand(0, targetList.size() - 1)); - Eluna::Push(L, *itr); - } - break; - default: - luaL_argerror(L, 2, "SelectAggroTarget expected"); - break; + case SELECT_TARGET_NEAREST: + case SELECT_TARGET_TOPAGGRO: + { + std::list::const_iterator itr = targetList.begin(); + if (position) + std::advance(itr, position); + Eluna::Push(L, *itr); + } + break; + case SELECT_TARGET_FARTHEST: + case SELECT_TARGET_BOTTOMAGGRO: + { + std::list::reverse_iterator ritr = targetList.rbegin(); + if (position) + std::advance(ritr, position); + Eluna::Push(L, *ritr); + } + break; + case SELECT_TARGET_RANDOM: + { + std::list::const_iterator itr = targetList.begin(); + if (position) + std::advance(itr, urand(0, position)); + else + std::advance(itr, urand(0, targetList.size() - 1)); + Eluna::Push(L, *itr); + } + break; + default: + luaL_argerror(L, 2, "SelectAggroTarget expected"); + break; } return 1; @@ -835,14 +853,14 @@ namespace LuaCreature * * @return table targets */ - int GetAITargets(lua_State *L, Creature *creature) + int GetAITargets(lua_State* L, Creature* creature) { #if defined(TRINITY) - auto const &threatlist = creature->GetThreatManager().GetThreatenedByMeList(); + auto const& threatlist = creature->GetThreatManager().GetThreatenedByMeList(); #elif defined(AZEROTHCORE) - auto const &threatlist = creature->getThreatManager().getThreatList(); +auto const& threatlist = creature->getThreatManager().getThreatList(); #else - ThreatList const &threatlist = creature->GetThreatManager().getThreatList(); + ThreatList const& threatlist = creature->GetThreatManager().getThreatList(); #endif lua_createtable(L, threatlist.size(), 0); int tbl = lua_gettop(L); @@ -850,9 +868,9 @@ namespace LuaCreature for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr) { #if defined(TRINITY) - Unit *target = itr->second->GetOwner(); + Unit* target = itr->second->GetOwner(); #else - Unit *target = (*itr)->getTarget(); + Unit* target = (*itr)->getTarget(); #endif if (!target) continue; @@ -869,7 +887,7 @@ namespace LuaCreature * * @return int targetsCount */ - int GetAITargetsCount(lua_State *L, Creature *creature) + int GetAITargetsCount(lua_State* L, Creature* creature) { #if defined(TRINITY) Eluna::Push(L, creature->GetThreatManager().GetThreatenedByMeList().size()); @@ -889,7 +907,7 @@ namespace LuaCreature * * @return [NPCFlags] npcFlags */ - int GetNPCFlags(lua_State *L, Creature *creature) + int GetNPCFlags(lua_State* L, Creature* creature) { Eluna::Push(L, creature->GetUInt32Value(UNIT_NPC_FLAGS)); return 1; @@ -903,7 +921,7 @@ namespace LuaCreature * * @return [ExtraFlags] extraFlags */ - int GetExtraFlags(lua_State *L, Creature *creature) + int GetExtraFlags(lua_State* L, Creature* creature) { #if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->GetCreatureTemplate()->flags_extra); @@ -919,7 +937,7 @@ namespace LuaCreature * * @return uint32 shieldBlockValue */ - int GetShieldBlockValue(lua_State *L, Creature *creature) + int GetShieldBlockValue(lua_State* L, Creature* creature) { Eluna::Push(L, creature->GetShieldBlockValue()); return 1; @@ -927,7 +945,7 @@ namespace LuaCreature #endif #if defined(TRINITY) || defined(AZEROTHCORE) - int GetLootMode(lua_State *L, Creature *creature) // TODO: Implement LootMode features + int GetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features { Eluna::Push(L, creature->GetLootMode()); return 1; @@ -939,7 +957,7 @@ namespace LuaCreature * * @return uint32 dbguid */ - int GetDBTableGUIDLow(lua_State *L, Creature *creature) + int GetDBTableGUIDLow(lua_State* L, Creature* creature) { #if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->GetSpawnId()); @@ -955,7 +973,7 @@ namespace LuaCreature * * @param [NPCFlags] flags */ - int SetNPCFlags(lua_State *L, Creature *creature) + int SetNPCFlags(lua_State* L, Creature* creature) { uint32 flags = Eluna::CHECKVAL(L, 2); @@ -963,12 +981,13 @@ namespace LuaCreature return 0; } + /** * Makes the [Creature] able to fly if enabled. * * @param bool disable */ - int SetDisableGravity(lua_State *L, Creature *creature) + int SetDisableGravity(lua_State* L, Creature* creature) { bool disable = Eluna::CHECKVAL(L, 2); @@ -981,7 +1000,7 @@ namespace LuaCreature } #if defined(TRINITY) || defined(AZEROTHCORE) - int SetLootMode(lua_State *L, Creature *creature) // TODO: Implement LootMode features + int SetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features { uint16 lootMode = Eluna::CHECKVAL(L, 2); @@ -995,7 +1014,7 @@ namespace LuaCreature * * @param [DeathState] deathState */ - int SetDeathState(lua_State *L, Creature *creature) + int SetDeathState(lua_State* L, Creature* creature) { int32 state = Eluna::CHECKVAL(L, 2); @@ -1012,7 +1031,7 @@ namespace LuaCreature * * @param bool enable = true : `true` to enable walking, `false` for running */ - int SetWalk(lua_State *L, Creature *creature) // TODO: Move same to Player ? + int SetWalk(lua_State* L, Creature* creature) // TODO: Move same to Player ? { bool enable = Eluna::CHECKVAL(L, 2, true); @@ -1027,7 +1046,7 @@ namespace LuaCreature * @param uint32 off_hand : off hand [Item]'s entry * @param uint32 ranged : ranged [Item]'s entry */ - int SetEquipmentSlots(lua_State *L, Creature *creature) + int SetEquipmentSlots(lua_State* L, Creature* creature) { uint32 main_hand = Eluna::CHECKVAL(L, 2); uint32 off_hand = Eluna::CHECKVAL(L, 3); @@ -1050,7 +1069,7 @@ namespace LuaCreature * * @param bool allow = true : `true` to allow aggro, `false` to disable aggro */ - int SetAggroEnabled(lua_State *L, Creature *creature) + int SetAggroEnabled(lua_State* L, Creature* creature) { bool allow = Eluna::CHECKVAL(L, 2, true); @@ -1074,7 +1093,7 @@ namespace LuaCreature * * @param bool disable = true : `true` to disable reputation, `false` to enable */ - int SetDisableReputationGain(lua_State *L, Creature *creature) + int SetDisableReputationGain(lua_State* L, Creature* creature) { bool disable = Eluna::CHECKVAL(L, 2, true); @@ -1088,7 +1107,7 @@ namespace LuaCreature * This is used by raid bosses to prevent Players from using out-of-combat * actions once the encounter has begun. */ - int SetInCombatWithZone(lua_State * /*L*/, Creature *creature) + int SetInCombatWithZone(lua_State* /*L*/, Creature* creature) { #if defined(AZEROTHCORE) if (creature->IsAIEnabled) @@ -1107,7 +1126,7 @@ namespace LuaCreature * * @param float distance */ - int SetWanderRadius(lua_State *L, Creature *creature) + int SetWanderRadius(lua_State* L, Creature* creature) { float dist = Eluna::CHECKVAL(L, 2); @@ -1124,7 +1143,7 @@ namespace LuaCreature * * @param uint32 delay : the delay, in seconds */ - int SetRespawnDelay(lua_State *L, Creature *creature) + int SetRespawnDelay(lua_State* L, Creature* creature) { uint32 delay = Eluna::CHECKVAL(L, 2); @@ -1137,7 +1156,7 @@ namespace LuaCreature * * @param [MovementGeneratorType] type */ - int SetDefaultMovementType(lua_State *L, Creature *creature) + int SetDefaultMovementType(lua_State* L, Creature* creature) { int32 type = Eluna::CHECKVAL(L, 2); @@ -1150,7 +1169,7 @@ namespace LuaCreature * * @param bool enable = true : `true` to disable searching, `false` to allow */ - int SetNoSearchAssistance(lua_State *L, Creature *creature) + int SetNoSearchAssistance(lua_State* L, Creature* creature) { bool val = Eluna::CHECKVAL(L, 2, true); @@ -1163,7 +1182,7 @@ namespace LuaCreature * * @param bool enable = true : `true` to disable calling for help, `false` to enable */ - int SetNoCallAssistance(lua_State *L, Creature *creature) + int SetNoCallAssistance(lua_State* L, Creature* creature) { bool val = Eluna::CHECKVAL(L, 2, true); @@ -1176,7 +1195,7 @@ namespace LuaCreature * * @param bool enable = true : `true` to enable hovering, `false` to disable */ - int SetHover(lua_State *L, Creature *creature) + int SetHover(lua_State* L, Creature* creature) { bool enable = Eluna::CHECKVAL(L, 2, true); @@ -1206,7 +1225,7 @@ namespace LuaCreature * * @param uint32 delay = 0 : dely to despawn in milliseconds */ - int DespawnOrUnsummon(lua_State *L, Creature *creature) + int DespawnOrUnsummon(lua_State* L, Creature* creature) { uint32 msTimeToDespawn = Eluna::CHECKVAL(L, 2, 0); @@ -1223,7 +1242,7 @@ namespace LuaCreature /** * Respawn this [Creature]. */ - int Respawn(lua_State * /*L*/, Creature *creature) + int Respawn(lua_State* /*L*/, Creature* creature) { creature->Respawn(); return 0; @@ -1232,7 +1251,7 @@ namespace LuaCreature /** * Remove this [Creature]'s corpse. */ - int RemoveCorpse(lua_State * /*L*/, Creature *creature) + int RemoveCorpse(lua_State* /*L*/, Creature* creature) { creature->RemoveCorpse(); return 0; @@ -1241,7 +1260,7 @@ namespace LuaCreature /** * Make the [Creature] start following its waypoint path. */ - int MoveWaypoint(lua_State * /*L*/, Creature *creature) + int MoveWaypoint(lua_State* /*L*/, Creature* creature) { #if defined(TRINITY) || defined(AZEROTHCORE) creature->GetMotionMaster()->MovePath(creature->GetWaypointPath(), true); @@ -1254,7 +1273,7 @@ namespace LuaCreature /** * Make the [Creature] call for assistance in combat from other nearby [Creature]s. */ - int CallAssistance(lua_State * /*L*/, Creature *creature) + int CallAssistance(lua_State* /*L*/, Creature* creature) { creature->CallAssistance(); return 0; @@ -1265,7 +1284,7 @@ namespace LuaCreature * * @param float radius */ - int CallForHelp(lua_State *L, Creature *creature) + int CallForHelp(lua_State* L, Creature* creature) { float radius = Eluna::CHECKVAL(L, 2); @@ -1276,7 +1295,7 @@ namespace LuaCreature /** * Make the [Creature] flee combat to get assistance from a nearby friendly [Creature]. */ - int FleeToGetAssistance(lua_State * /*L*/, Creature *creature) + int FleeToGetAssistance(lua_State* /*L*/, Creature* creature) { creature->DoFleeToGetAssistance(); return 0; @@ -1287,9 +1306,9 @@ namespace LuaCreature * * @param [Unit] target */ - int AttackStart(lua_State *L, Creature *creature) + int AttackStart(lua_State* L, Creature* creature) { - Unit *target = Eluna::CHECKOBJ(L, 2); + Unit* target = Eluna::CHECKOBJ(L, 2); creature->AI()->AttackStart(target); return 0; @@ -1298,7 +1317,7 @@ namespace LuaCreature /** * Save the [Creature] in the database. */ - int SaveToDB(lua_State * /*L*/, Creature *creature) + int SaveToDB(lua_State* /*L*/, Creature* creature) { creature->SaveToDB(); return 0; @@ -1309,7 +1328,7 @@ namespace LuaCreature * * This should be called every update cycle for the Creature's AI. */ - int SelectVictim(lua_State *L, Creature *creature) + int SelectVictim(lua_State* L, Creature* creature) { #if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->SelectVictim()); @@ -1325,7 +1344,7 @@ namespace LuaCreature * @param uint32 entry : the Creature ID to transform into * @param uint32 dataGUIDLow = 0 : use this Creature's model and equipment instead of the defaults */ - int UpdateEntry(lua_State *L, Creature *creature) + int UpdateEntry(lua_State* L, Creature* creature) { uint32 entry = Eluna::CHECKVAL(L, 2); uint32 dataGuidLow = Eluna::CHECKVAL(L, 3, 0); @@ -1342,7 +1361,7 @@ namespace LuaCreature /** * Resets [Creature]'s loot mode to default */ - int ResetLootMode(lua_State * /*L*/, Creature *creature) // TODO: Implement LootMode features + int ResetLootMode(lua_State* /*L*/, Creature* creature) // TODO: Implement LootMode features { creature->ResetLootMode(); return 0; @@ -1353,7 +1372,7 @@ namespace LuaCreature * * @param uint16 lootMode */ - int RemoveLootMode(lua_State *L, Creature *creature) // TODO: Implement LootMode features + int RemoveLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features { uint16 lootMode = Eluna::CHECKVAL(L, 2); @@ -1366,7 +1385,7 @@ namespace LuaCreature * * @param uint16 lootMode */ - int AddLootMode(lua_State *L, Creature *creature) // TODO: Implement LootMode features + int AddLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features { uint16 lootMode = Eluna::CHECKVAL(L, 2); @@ -1429,16 +1448,16 @@ namespace LuaCreature * * @return [CreatureFamily] creatureFamily */ - int GetCreatureFamily(lua_State *L, Creature *creature) + int GetCreatureFamily(lua_State* L, Creature* creature) { uint32 entry = creature->GetEntry(); #if defined(TRINITY) || defined(AZEROTHCORE) - CreatureTemplate const *cInfo = sObjectMgr->GetCreatureTemplate(entry); + CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(entry); if (cInfo) Eluna::Push(L, cInfo->family); #else - CreatureInfo const *cInfo = ObjectMgr::GetCreatureTemplate(entry); + CreatureInfo const* cInfo = ObjectMgr::GetCreatureTemplate(entry); if (cInfo) Eluna::Push(L, cInfo->Family); #endif diff --git a/LuaFunctions.cpp b/LuaFunctions.cpp index 13d36f1..9bd1740 100644 --- a/LuaFunctions.cpp +++ b/LuaFunctions.cpp @@ -811,6 +811,7 @@ ElunaRegister CreatureMethods[] = { "SetEquipmentSlots", &LuaCreature::SetEquipmentSlots }, // Boolean + { "IsRegeneratingHealth", &LuaCreature::IsRegeneratingHealth }, #if defined(TRINITY) || defined(AZEROTHCORE) { "IsDungeonBoss", &LuaCreature::IsDungeonBoss }, #endif From c2bbe07163242f3ceed28e02a7d506e579dacd25 Mon Sep 17 00:00:00 2001 From: xIvan0ff Date: Sun, 23 May 2021 14:56:39 +0300 Subject: [PATCH 4/5] SetRegenerateHealth only for AC/TC --- CreatureMethods.h | 2 ++ LuaFunctions.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/CreatureMethods.h b/CreatureMethods.h index a8d796d..2f9016b 100644 --- a/CreatureMethods.h +++ b/CreatureMethods.h @@ -32,6 +32,7 @@ namespace LuaCreature return 1; } +#if defined(TRINITY) || defined(AZEROTHCORE) /** * Sets whether the [Creature] can regenerate health or not. * @@ -48,6 +49,7 @@ namespace LuaCreature #endif return 0; } +#endif /** * Returns `true` if the [Creature] is set to not give reputation when killed, diff --git a/LuaFunctions.cpp b/LuaFunctions.cpp index 9bd1740..ef496f6 100644 --- a/LuaFunctions.cpp +++ b/LuaFunctions.cpp @@ -790,7 +790,9 @@ ElunaRegister CreatureMethods[] = { "GetCreatureFamily", &LuaCreature::GetCreatureFamily }, // Setters +#if defined(TRINITY) || defined(AZEROTHCORE) { "SetRegeneratingHealth", &LuaCreature::SetRegeneratingHealth }, +#endif { "SetHover", &LuaCreature::SetHover }, { "SetDisableGravity", &LuaCreature::SetDisableGravity }, { "SetAggroEnabled", &LuaCreature::SetAggroEnabled }, From 59574c186e8b142841388a5fdf6ea7db5f136f57 Mon Sep 17 00:00:00 2001 From: Rochet2 Date: Sun, 23 May 2021 23:45:54 +0300 Subject: [PATCH 5/5] Update CreatureMethods.h --- CreatureMethods.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CreatureMethods.h b/CreatureMethods.h index 2f9016b..e0ddb85 100644 --- a/CreatureMethods.h +++ b/CreatureMethods.h @@ -27,7 +27,7 @@ namespace LuaCreature #elif defined(TRINITY) Eluna::Push(L, creature->CanRegenerateHealth()); #else - Eluna::Push(L, creature->IsRegeneratingHealth()); + Eluna::Push(L, creature->IsRegeneratingHealth()); #endif return 1; }