Implement: Creature:SetRegeneratingHealth

This commit is contained in:
xIvan0ff
2021-05-19 00:51:50 +03:00
parent b4263aec64
commit 74afaebb49
2 changed files with 154 additions and 141 deletions

View File

@@ -14,13 +14,26 @@
*/ */
namespace LuaCreature 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<bool>(L, 2, true);
creature->SetRegeneratingHealth(enable);
return 0;
}
/** /**
* Returns `true` if the [Creature] is set to not give reputation when killed, * Returns `true` if the [Creature] is set to not give reputation when killed,
* and returns `false` otherwise. * and returns `false` otherwise.
* *
* @return bool reputationDisabled * @return bool reputationDisabled
*/ */
int IsReputationGainDisabled(lua_State* L, Creature* creature) int IsReputationGainDisabled(lua_State *L, Creature *creature)
{ {
Eluna::Push(L, creature->IsReputationGainDisabled()); Eluna::Push(L, creature->IsReputationGainDisabled());
return 1; return 1;
@@ -33,7 +46,7 @@ namespace LuaCreature
* @param uint32 questID : the ID of a [Quest] * @param uint32 questID : the ID of a [Quest]
* @return bool completesQuest * @return bool completesQuest
*/ */
int CanCompleteQuest(lua_State* L, Creature* creature) int CanCompleteQuest(lua_State *L, Creature *creature)
{ {
uint32 quest_id = Eluna::CHECKVAL<uint32>(L, 2); uint32 quest_id = Eluna::CHECKVAL<uint32>(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. * @param bool mustBeDead = false : if `true`, only returns `true` if the [Creature] is also dead. Otherwise, it must be alive.
* @return bool targetable * @return bool targetable
*/ */
int IsTargetableForAttack(lua_State* L, Creature* creature) int IsTargetableForAttack(lua_State *L, Creature *creature)
{ {
bool mustBeDead = Eluna::CHECKVAL<bool>(L, 2, false); bool mustBeDead = Eluna::CHECKVAL<bool>(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 * @param bool checkFaction = true : if `true`, the [Creature] must be the same faction as `friend` to assist
* @return bool canAssist * @return bool canAssist
*/ */
int CanAssistTo(lua_State* L, Creature* creature) int CanAssistTo(lua_State *L, Creature *creature)
{ {
Unit* u = Eluna::CHECKOBJ<Unit>(L, 2); Unit *u = Eluna::CHECKOBJ<Unit>(L, 2);
Unit* enemy = Eluna::CHECKOBJ<Unit>(L, 3); Unit *enemy = Eluna::CHECKOBJ<Unit>(L, 3);
bool checkfaction = Eluna::CHECKVAL<bool>(L, 4, true); bool checkfaction = Eluna::CHECKVAL<bool>(L, 4, true);
Eluna::Push(L, creature->CanAssistTo(u, enemy, checkfaction)); Eluna::Push(L, creature->CanAssistTo(u, enemy, checkfaction));
@@ -89,7 +102,7 @@ namespace LuaCreature
* *
* @return bool searchedForAssistance * @return bool searchedForAssistance
*/ */
int HasSearchedAssistance(lua_State* L, Creature* creature) int HasSearchedAssistance(lua_State *L, Creature *creature)
{ {
Eluna::Push(L, creature->HasSearchedAssistance()); Eluna::Push(L, creature->HasSearchedAssistance());
return 1; return 1;
@@ -101,9 +114,9 @@ namespace LuaCreature
* *
* @return bool tapped * @return bool tapped
*/ */
int IsTappedBy(lua_State* L, Creature* creature) int IsTappedBy(lua_State *L, Creature *creature)
{ {
Player* player = Eluna::CHECKOBJ<Player>(L, 2); Player *player = Eluna::CHECKOBJ<Player>(L, 2);
#if defined(TRINITY) || defined(AZEROTHCORE) #if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, creature->isTappedBy(player)); Eluna::Push(L, creature->isTappedBy(player));
@@ -119,7 +132,7 @@ namespace LuaCreature
* *
* @return bool hasLootRecipient * @return bool hasLootRecipient
*/ */
int HasLootRecipient(lua_State* L, Creature* creature) int HasLootRecipient(lua_State *L, Creature *creature)
{ {
#if defined(TRINITY) || defined(AZEROTHCORE) #if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, creature->hasLootRecipient()); Eluna::Push(L, creature->hasLootRecipient());
@@ -135,7 +148,7 @@ namespace LuaCreature
* *
* @return bool canAggro * @return bool canAggro
*/ */
int CanAggro(lua_State* L, Creature* creature) int CanAggro(lua_State *L, Creature *creature)
{ {
#if defined(TRINITY) || defined(AZEROTHCORE) #if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, !creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)); Eluna::Push(L, !creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC));
@@ -152,7 +165,7 @@ namespace LuaCreature
* *
* @return bool canSwim * @return bool canSwim
*/ */
int CanSwim(lua_State* L, Creature* creature) int CanSwim(lua_State *L, Creature *creature)
{ {
Eluna::Push(L, creature->CanSwim()); Eluna::Push(L, creature->CanSwim());
return 1; return 1;
@@ -164,7 +177,7 @@ namespace LuaCreature
* *
* @return bool canWalk * @return bool canWalk
*/ */
int CanWalk(lua_State* L, Creature* creature) int CanWalk(lua_State *L, Creature *creature)
{ {
Eluna::Push(L, creature->CanWalk()); Eluna::Push(L, creature->CanWalk());
return 1; return 1;
@@ -176,7 +189,7 @@ namespace LuaCreature
* *
* @return bool inEvadeMode * @return bool inEvadeMode
*/ */
int IsInEvadeMode(lua_State* L, Creature* creature) int IsInEvadeMode(lua_State *L, Creature *creature)
{ {
Eluna::Push(L, creature->IsInEvadeMode()); Eluna::Push(L, creature->IsInEvadeMode());
return 1; return 1;
@@ -188,7 +201,7 @@ namespace LuaCreature
* *
* @return bool isElite * @return bool isElite
*/ */
int IsElite(lua_State* L, Creature* creature) int IsElite(lua_State *L, Creature *creature)
{ {
#if defined(TRINITY) || defined(AZEROTHCORE) #if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, creature->isElite()); Eluna::Push(L, creature->isElite());
@@ -204,7 +217,7 @@ namespace LuaCreature
* *
* @return bool isGuard * @return bool isGuard
*/ */
int IsGuard(lua_State* L, Creature* creature) int IsGuard(lua_State *L, Creature *creature)
{ {
Eluna::Push(L, creature->IsGuard()); Eluna::Push(L, creature->IsGuard());
return 1; return 1;
@@ -216,7 +229,7 @@ namespace LuaCreature
* *
* @return bool isCivilian * @return bool isCivilian
*/ */
int IsCivilian(lua_State* L, Creature* creature) int IsCivilian(lua_State *L, Creature *creature)
{ {
Eluna::Push(L, creature->IsCivilian()); Eluna::Push(L, creature->IsCivilian());
return 1; return 1;
@@ -228,7 +241,7 @@ namespace LuaCreature
* *
* @return bool isLeader * @return bool isLeader
*/ */
int IsRacialLeader(lua_State* L, Creature* creature) int IsRacialLeader(lua_State *L, Creature *creature)
{ {
Eluna::Push(L, creature->IsRacialLeader()); Eluna::Push(L, creature->IsRacialLeader());
return 1; return 1;
@@ -241,7 +254,7 @@ namespace LuaCreature
* @return bool isDungeonBoss * @return bool isDungeonBoss
*/ */
#if defined(TRINITY) || defined(AZEROTHCORE) #if defined(TRINITY) || defined(AZEROTHCORE)
int IsDungeonBoss(lua_State* L, Creature* creature) int IsDungeonBoss(lua_State *L, Creature *creature)
{ {
Eluna::Push(L, creature->IsDungeonBoss()); Eluna::Push(L, creature->IsDungeonBoss());
return 1; return 1;
@@ -254,7 +267,7 @@ namespace LuaCreature
* *
* @return bool isWorldBoss * @return bool isWorldBoss
*/ */
int IsWorldBoss(lua_State* L, Creature* creature) int IsWorldBoss(lua_State *L, Creature *creature)
{ {
#if defined(TRINITY) || defined(AZEROTHCORE) #if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, creature->isWorldBoss()); Eluna::Push(L, creature->isWorldBoss());
@@ -271,17 +284,17 @@ namespace LuaCreature
* @param uint32 spellId : the ID of a [Spell] * @param uint32 spellId : the ID of a [Spell]
* @return bool hasCooldown * @return bool hasCooldown
*/ */
int HasCategoryCooldown(lua_State* L, Creature* creature) int HasCategoryCooldown(lua_State *L, Creature *creature)
{ {
uint32 spell = Eluna::CHECKVAL<uint32>(L, 2); uint32 spell = Eluna::CHECKVAL<uint32>(L, 2);
#if defined(TRINITY) #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)); Eluna::Push(L, info->GetCategory() && creature->GetSpellHistory()->HasCooldown(spell));
else else
Eluna::Push(L, false); Eluna::Push(L, false);
#elif defined(AZEROTHCORE) #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)); Eluna::Push(L, info->GetCategory() && creature->HasSpellCooldown(spell));
else else
Eluna::Push(L, false); Eluna::Push(L, false);
@@ -298,7 +311,7 @@ namespace LuaCreature
* @param uint32 spellId : the ID of a [Spell] * @param uint32 spellId : the ID of a [Spell]
* @return bool hasSpell * @return bool hasSpell
*/ */
int HasSpell(lua_State* L, Creature* creature) int HasSpell(lua_State *L, Creature *creature)
{ {
uint32 id = Eluna::CHECKVAL<uint32>(L, 2); uint32 id = Eluna::CHECKVAL<uint32>(L, 2);
@@ -313,7 +326,7 @@ namespace LuaCreature
* @param uint32 questId : the ID of a [Quest] * @param uint32 questId : the ID of a [Quest]
* @return bool hasQuest * @return bool hasQuest
*/ */
int HasQuest(lua_State* L, Creature* creature) int HasQuest(lua_State *L, Creature *creature)
{ {
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2); uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
@@ -332,7 +345,7 @@ namespace LuaCreature
* @param uint32 spellId : the ID of a [Spell] * @param uint32 spellId : the ID of a [Spell]
* @return bool hasCooldown * @return bool hasCooldown
*/ */
int HasSpellCooldown(lua_State* L, Creature* creature) int HasSpellCooldown(lua_State *L, Creature *creature)
{ {
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2); uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
@@ -350,7 +363,7 @@ namespace LuaCreature
* *
* @return bool canFly * @return bool canFly
*/ */
int CanFly(lua_State* L, Creature* creature) int CanFly(lua_State *L, Creature *creature)
{ {
Eluna::Push(L, creature->CanFly()); Eluna::Push(L, creature->CanFly());
return 1; return 1;
@@ -363,7 +376,7 @@ namespace LuaCreature
* *
* @return bool canFly * @return bool canFly
*/ */
int IsTrigger(lua_State* L, Creature* creature) int IsTrigger(lua_State *L, Creature *creature)
{ {
Eluna::Push(L, creature->IsTrigger()); Eluna::Push(L, creature->IsTrigger());
return 1; return 1;
@@ -374,7 +387,7 @@ namespace LuaCreature
* *
* @return bool isDamagedEnough * @return bool isDamagedEnough
*/ */
int IsDamageEnoughForLootingAndReward(lua_State* L, Creature* creature) int IsDamageEnoughForLootingAndReward(lua_State *L, Creature *creature)
{ {
Eluna::Push(L, creature->IsDamageEnoughForLootingAndReward()); Eluna::Push(L, creature->IsDamageEnoughForLootingAndReward());
return 1; return 1;
@@ -388,9 +401,9 @@ namespace LuaCreature
* @param [Unit] target * @param [Unit] target
* @param bool force = true : force [Creature] to attack * @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<Unit>(L, 2); Unit *target = Eluna::CHECKOBJ<Unit>(L, 2);
#ifndef AZEROTHCORE #ifndef AZEROTHCORE
bool force = Eluna::CHECKVAL<bool>(L, 3, true); bool force = Eluna::CHECKVAL<bool>(L, 3, true);
Eluna::Push(L, creature->CanStartAttack(target, force)); Eluna::Push(L, creature->CanStartAttack(target, force));
@@ -406,7 +419,7 @@ namespace LuaCreature
* @param uint16 lootMode * @param uint16 lootMode
* @return bool hasLootMode * @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<uint16>(L, 2); uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
@@ -423,7 +436,7 @@ namespace LuaCreature
* *
* @return uint32 respawnDelay : the respawn delay, in seconds * @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()); Eluna::Push(L, creature->GetRespawnDelay());
return 1; return 1;
@@ -435,7 +448,7 @@ namespace LuaCreature
* *
* @return float wanderRadius * @return float wanderRadius
*/ */
int GetWanderRadius(lua_State* L, Creature* creature) int GetWanderRadius(lua_State *L, Creature *creature)
{ {
#if defined(TRINITY) || defined(AZEROTHCORE) #if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, creature->GetWanderDistance()); Eluna::Push(L, creature->GetWanderDistance());
@@ -451,7 +464,7 @@ namespace LuaCreature
* *
* @return uint32 pathId * @return uint32 pathId
*/ */
int GetWaypointPath(lua_State* L, Creature* creature) int GetWaypointPath(lua_State *L, Creature *creature)
{ {
Eluna::Push(L, creature->GetWaypointPath()); Eluna::Push(L, creature->GetWaypointPath());
return 1; return 1;
@@ -463,7 +476,7 @@ namespace LuaCreature
* *
* @return uint32 wpId * @return uint32 wpId
*/ */
int GetCurrentWaypointId(lua_State* L, Creature* creature) int GetCurrentWaypointId(lua_State *L, Creature *creature)
{ {
#if defined(TRINITY) #if defined(TRINITY)
Eluna::Push(L, creature->GetCurrentWaypointInfo().first); Eluna::Push(L, creature->GetCurrentWaypointInfo().first);
@@ -480,7 +493,7 @@ namespace LuaCreature
* *
* @return [MovementGeneratorType] defaultMovementType * @return [MovementGeneratorType] defaultMovementType
*/ */
int GetDefaultMovementType(lua_State* L, Creature* creature) int GetDefaultMovementType(lua_State *L, Creature *creature)
{ {
Eluna::Push(L, creature->GetDefaultMovementType()); Eluna::Push(L, creature->GetDefaultMovementType());
return 1; return 1;
@@ -492,9 +505,9 @@ namespace LuaCreature
* @param [Unit] target * @param [Unit] target
* @return float aggroRange * @return float aggroRange
*/ */
int GetAggroRange(lua_State* L, Creature* creature) int GetAggroRange(lua_State *L, Creature *creature)
{ {
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2); Unit *target = Eluna::CHECKOBJ<Unit>(L, 2);
#if defined(TRINITY) || defined(AZEROTHCORE) #if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, creature->GetAggroRange(target)); Eluna::Push(L, creature->GetAggroRange(target));
@@ -516,9 +529,9 @@ namespace LuaCreature
* @param [Unit] target * @param [Unit] target
* @return float attackDistance * @return float attackDistance
*/ */
int GetAttackDistance(lua_State* L, Creature* creature) int GetAttackDistance(lua_State *L, Creature *creature)
{ {
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2); Unit *target = Eluna::CHECKOBJ<Unit>(L, 2);
Eluna::Push(L, creature->GetAttackDistance(target)); Eluna::Push(L, creature->GetAttackDistance(target));
return 1; return 1;
@@ -530,7 +543,7 @@ namespace LuaCreature
* *
* @return [Group] lootRecipientGroup : the group or `nil` * @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) #if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, creature->GetLootRecipientGroup()); Eluna::Push(L, creature->GetLootRecipientGroup());
@@ -545,7 +558,7 @@ namespace LuaCreature
* *
* @return [Player] lootRecipient : the player or `nil` * @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()); Eluna::Push(L, creature->GetLootRecipient());
return 1; return 1;
@@ -560,7 +573,7 @@ namespace LuaCreature
* *
* @return string scriptName * @return string scriptName
*/ */
int GetScriptName(lua_State* L, Creature* creature) int GetScriptName(lua_State *L, Creature *creature)
{ {
Eluna::Push(L, creature->GetScriptName()); Eluna::Push(L, creature->GetScriptName());
return 1; return 1;
@@ -575,7 +588,7 @@ namespace LuaCreature
* *
* @return string AIName * @return string AIName
*/ */
int GetAIName(lua_State* L, Creature* creature) int GetAIName(lua_State *L, Creature *creature)
{ {
Eluna::Push(L, creature->GetAIName()); Eluna::Push(L, creature->GetAIName());
return 1; return 1;
@@ -589,7 +602,7 @@ namespace LuaCreature
* *
* @return uint32 scriptID * @return uint32 scriptID
*/ */
int GetScriptId(lua_State* L, Creature* creature) int GetScriptId(lua_State *L, Creature *creature)
{ {
Eluna::Push(L, creature->GetScriptId()); Eluna::Push(L, creature->GetScriptId());
return 1; return 1;
@@ -601,12 +614,12 @@ namespace LuaCreature
* @param uint32 spellID * @param uint32 spellID
* @return uint32 cooldown : the cooldown, in milliseconds * @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<uint32>(L, 2); uint32 spell = Eluna::CHECKVAL<uint32>(L, 2);
#if defined(TRINITY) #if defined(TRINITY)
if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell)) if (SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell))
Eluna::Push(L, creature->GetSpellHistory()->GetRemainingCooldown(spellInfo)); Eluna::Push(L, creature->GetSpellHistory()->GetRemainingCooldown(spellInfo));
else else
Eluna::Push(L, 0); Eluna::Push(L, 0);
@@ -626,7 +639,7 @@ namespace LuaCreature
* *
* @return uint32 corpseDelay : the delay, in seconds * @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()); Eluna::Push(L, creature->GetCorpseDelay());
return 1; return 1;
@@ -641,7 +654,7 @@ namespace LuaCreature
* @return float z * @return float z
* @return float o * @return float o
*/ */
int GetHomePosition(lua_State* L, Creature* creature) int GetHomePosition(lua_State *L, Creature *creature)
{ {
float x, y, z, o; float x, y, z, o;
#if defined(TRINITY) || defined(AZEROTHCORE) #if defined(TRINITY) || defined(AZEROTHCORE)
@@ -666,7 +679,7 @@ namespace LuaCreature
* @param float z * @param float z
* @param float o * @param float o
*/ */
int SetHomePosition(lua_State* L, Creature* creature) int SetHomePosition(lua_State *L, Creature *creature)
{ {
float x = Eluna::CHECKVAL<float>(L, 2); float x = Eluna::CHECKVAL<float>(L, 2);
float y = Eluna::CHECKVAL<float>(L, 3); float y = Eluna::CHECKVAL<float>(L, 3);
@@ -684,9 +697,9 @@ namespace LuaCreature
enum SelectAggroTarget enum SelectAggroTarget
{ {
SELECT_TARGET_RANDOM = 0, // Just selects a random target SELECT_TARGET_RANDOM = 0, // Just selects a random target
SELECT_TARGET_TOPAGGRO, // Selects targes from top aggro to bottom SELECT_TARGET_TOPAGGRO, // Selects targes from top aggro to bottom
SELECT_TARGET_BOTTOMAGGRO, // Selects targets from bottom aggro to top SELECT_TARGET_BOTTOMAGGRO, // Selects targets from bottom aggro to top
SELECT_TARGET_NEAREST, SELECT_TARGET_NEAREST,
SELECT_TARGET_FARTHEST 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 * @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` * @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<uint32>(L, 2); uint32 targetType = Eluna::CHECKVAL<uint32>(L, 2);
bool playerOnly = Eluna::CHECKVAL<bool>(L, 3, false); bool playerOnly = Eluna::CHECKVAL<bool>(L, 3, false);
@@ -726,13 +739,13 @@ namespace LuaCreature
int32 aura = Eluna::CHECKVAL<int32>(L, 6, 0); int32 aura = Eluna::CHECKVAL<int32>(L, 6, 0);
#if defined(CMANGOS) #if defined(CMANGOS)
ThreatList const& threatlist = creature->getThreatManager().getThreatList(); ThreatList const &threatlist = creature->getThreatManager().getThreatList();
#elif defined(MANGOS) #elif defined(MANGOS)
ThreatList const& threatlist = creature->GetThreatManager().getThreatList(); ThreatList const &threatlist = creature->GetThreatManager().getThreatList();
#elif defined(TRINITY) #elif defined(TRINITY)
auto const& threatlist = creature->GetThreatManager().GetSortedThreatList(); auto const &threatlist = creature->GetThreatManager().GetSortedThreatList();
#elif defined(AZEROTHCORE) #elif defined(AZEROTHCORE)
auto const& threatlist = creature->getThreatManager().getThreatList(); auto const &threatlist = creature->getThreatManager().getThreatList();
#endif #endif
#ifndef TRINITY #ifndef TRINITY
if (threatlist.empty()) if (threatlist.empty())
@@ -740,17 +753,17 @@ namespace LuaCreature
if (position >= threatlist.size()) if (position >= threatlist.size())
return 1; return 1;
#endif #endif
std::list<Unit*> targetList; std::list<Unit *> targetList;
#if defined(TRINITY) #if defined(TRINITY)
for (ThreatReference const* itr : threatlist) for (ThreatReference const *itr : threatlist)
#else #else
for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr) for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr)
#endif #endif
{ {
#if defined(TRINITY) #if defined(TRINITY)
Unit* target = itr->GetVictim(); Unit *target = itr->GetVictim();
#else #else
Unit* target = (*itr)->getTarget(); Unit *target = (*itr)->getTarget();
#endif #endif
if (!target) if (!target)
continue; continue;
@@ -777,37 +790,37 @@ namespace LuaCreature
switch (targetType) switch (targetType)
{ {
case SELECT_TARGET_NEAREST: case SELECT_TARGET_NEAREST:
case SELECT_TARGET_TOPAGGRO: case SELECT_TARGET_TOPAGGRO:
{ {
std::list<Unit*>::const_iterator itr = targetList.begin(); std::list<Unit *>::const_iterator itr = targetList.begin();
if (position) if (position)
std::advance(itr, position); std::advance(itr, position);
Eluna::Push(L, *itr); Eluna::Push(L, *itr);
} }
break; break;
case SELECT_TARGET_FARTHEST: case SELECT_TARGET_FARTHEST:
case SELECT_TARGET_BOTTOMAGGRO: case SELECT_TARGET_BOTTOMAGGRO:
{ {
std::list<Unit*>::reverse_iterator ritr = targetList.rbegin(); std::list<Unit *>::reverse_iterator ritr = targetList.rbegin();
if (position) if (position)
std::advance(ritr, position); std::advance(ritr, position);
Eluna::Push(L, *ritr); Eluna::Push(L, *ritr);
} }
break; break;
case SELECT_TARGET_RANDOM: case SELECT_TARGET_RANDOM:
{ {
std::list<Unit*>::const_iterator itr = targetList.begin(); std::list<Unit *>::const_iterator itr = targetList.begin();
if (position) if (position)
std::advance(itr, urand(0, position)); std::advance(itr, urand(0, position));
else else
std::advance(itr, urand(0, targetList.size() - 1)); std::advance(itr, urand(0, targetList.size() - 1));
Eluna::Push(L, *itr); Eluna::Push(L, *itr);
} }
break; break;
default: default:
luaL_argerror(L, 2, "SelectAggroTarget expected"); luaL_argerror(L, 2, "SelectAggroTarget expected");
break; break;
} }
return 1; return 1;
@@ -818,14 +831,14 @@ namespace LuaCreature
* *
* @return table targets * @return table targets
*/ */
int GetAITargets(lua_State* L, Creature* creature) int GetAITargets(lua_State *L, Creature *creature)
{ {
#if defined(TRINITY) #if defined(TRINITY)
auto const& threatlist = creature->GetThreatManager().GetThreatenedByMeList(); auto const &threatlist = creature->GetThreatManager().GetThreatenedByMeList();
#elif defined(AZEROTHCORE) #elif defined(AZEROTHCORE)
auto const& threatlist = creature->getThreatManager().getThreatList(); auto const &threatlist = creature->getThreatManager().getThreatList();
#else #else
ThreatList const& threatlist = creature->GetThreatManager().getThreatList(); ThreatList const &threatlist = creature->GetThreatManager().getThreatList();
#endif #endif
lua_createtable(L, threatlist.size(), 0); lua_createtable(L, threatlist.size(), 0);
int tbl = lua_gettop(L); int tbl = lua_gettop(L);
@@ -833,9 +846,9 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr) for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{ {
#if defined(TRINITY) #if defined(TRINITY)
Unit* target = itr->second->GetOwner(); Unit *target = itr->second->GetOwner();
#else #else
Unit* target = (*itr)->getTarget(); Unit *target = (*itr)->getTarget();
#endif #endif
if (!target) if (!target)
continue; continue;
@@ -852,7 +865,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
* *
* @return int targetsCount * @return int targetsCount
*/ */
int GetAITargetsCount(lua_State* L, Creature* creature) int GetAITargetsCount(lua_State *L, Creature *creature)
{ {
#if defined(TRINITY) #if defined(TRINITY)
Eluna::Push(L, creature->GetThreatManager().GetThreatenedByMeList().size()); Eluna::Push(L, creature->GetThreatManager().GetThreatenedByMeList().size());
@@ -872,7 +885,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
* *
* @return [NPCFlags] npcFlags * @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)); Eluna::Push(L, creature->GetUInt32Value(UNIT_NPC_FLAGS));
return 1; return 1;
@@ -886,7 +899,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
* *
* @return [ExtraFlags] extraFlags * @return [ExtraFlags] extraFlags
*/ */
int GetExtraFlags(lua_State* L, Creature* creature) int GetExtraFlags(lua_State *L, Creature *creature)
{ {
#if defined(TRINITY) || defined(AZEROTHCORE) #if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, creature->GetCreatureTemplate()->flags_extra); Eluna::Push(L, creature->GetCreatureTemplate()->flags_extra);
@@ -902,7 +915,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
* *
* @return uint32 shieldBlockValue * @return uint32 shieldBlockValue
*/ */
int GetShieldBlockValue(lua_State* L, Creature* creature) int GetShieldBlockValue(lua_State *L, Creature *creature)
{ {
Eluna::Push(L, creature->GetShieldBlockValue()); Eluna::Push(L, creature->GetShieldBlockValue());
return 1; return 1;
@@ -910,7 +923,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
#endif #endif
#if defined(TRINITY) || defined(AZEROTHCORE) #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()); Eluna::Push(L, creature->GetLootMode());
return 1; return 1;
@@ -922,7 +935,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
* *
* @return uint32 dbguid * @return uint32 dbguid
*/ */
int GetDBTableGUIDLow(lua_State* L, Creature* creature) int GetDBTableGUIDLow(lua_State *L, Creature *creature)
{ {
#if defined(TRINITY) || defined(AZEROTHCORE) #if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, creature->GetSpawnId()); Eluna::Push(L, creature->GetSpawnId());
@@ -938,7 +951,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
* *
* @param [NPCFlags] flags * @param [NPCFlags] flags
*/ */
int SetNPCFlags(lua_State* L, Creature* creature) int SetNPCFlags(lua_State *L, Creature *creature)
{ {
uint32 flags = Eluna::CHECKVAL<uint32>(L, 2); uint32 flags = Eluna::CHECKVAL<uint32>(L, 2);
@@ -946,13 +959,12 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
return 0; return 0;
} }
/** /**
* Makes the [Creature] able to fly if enabled. * Makes the [Creature] able to fly if enabled.
* *
* @param bool disable * @param bool disable
*/ */
int SetDisableGravity(lua_State* L, Creature* creature) int SetDisableGravity(lua_State *L, Creature *creature)
{ {
bool disable = Eluna::CHECKVAL<bool>(L, 2); bool disable = Eluna::CHECKVAL<bool>(L, 2);
@@ -965,7 +977,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
} }
#if defined(TRINITY) || defined(AZEROTHCORE) #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<uint16>(L, 2); uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
@@ -979,7 +991,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
* *
* @param [DeathState] deathState * @param [DeathState] deathState
*/ */
int SetDeathState(lua_State* L, Creature* creature) int SetDeathState(lua_State *L, Creature *creature)
{ {
int32 state = Eluna::CHECKVAL<int32>(L, 2); int32 state = Eluna::CHECKVAL<int32>(L, 2);
@@ -996,7 +1008,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
* *
* @param bool enable = true : `true` to enable walking, `false` for running * @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<bool>(L, 2, true); bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
@@ -1011,7 +1023,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
* @param uint32 off_hand : off hand [Item]'s entry * @param uint32 off_hand : off hand [Item]'s entry
* @param uint32 ranged : ranged [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<uint32>(L, 2); uint32 main_hand = Eluna::CHECKVAL<uint32>(L, 2);
uint32 off_hand = Eluna::CHECKVAL<uint32>(L, 3); uint32 off_hand = Eluna::CHECKVAL<uint32>(L, 3);
@@ -1034,7 +1046,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
* *
* @param bool allow = true : `true` to allow aggro, `false` to disable aggro * @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<bool>(L, 2, true); bool allow = Eluna::CHECKVAL<bool>(L, 2, true);
@@ -1058,7 +1070,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
* *
* @param bool disable = true : `true` to disable reputation, `false` to enable * @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<bool>(L, 2, true); bool disable = Eluna::CHECKVAL<bool>(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 * This is used by raid bosses to prevent Players from using out-of-combat
* actions once the encounter has begun. * actions once the encounter has begun.
*/ */
int SetInCombatWithZone(lua_State* /*L*/, Creature* creature) int SetInCombatWithZone(lua_State * /*L*/, Creature *creature)
{ {
#if defined(AZEROTHCORE) #if defined(AZEROTHCORE)
if (creature->IsAIEnabled) if (creature->IsAIEnabled)
@@ -1091,7 +1103,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
* *
* @param float distance * @param float distance
*/ */
int SetWanderRadius(lua_State* L, Creature* creature) int SetWanderRadius(lua_State *L, Creature *creature)
{ {
float dist = Eluna::CHECKVAL<float>(L, 2); float dist = Eluna::CHECKVAL<float>(L, 2);
@@ -1108,7 +1120,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
* *
* @param uint32 delay : the delay, in seconds * @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<uint32>(L, 2); uint32 delay = Eluna::CHECKVAL<uint32>(L, 2);
@@ -1121,7 +1133,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
* *
* @param [MovementGeneratorType] type * @param [MovementGeneratorType] type
*/ */
int SetDefaultMovementType(lua_State* L, Creature* creature) int SetDefaultMovementType(lua_State *L, Creature *creature)
{ {
int32 type = Eluna::CHECKVAL<int32>(L, 2); int32 type = Eluna::CHECKVAL<int32>(L, 2);
@@ -1134,7 +1146,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
* *
* @param bool enable = true : `true` to disable searching, `false` to allow * @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<bool>(L, 2, true); bool val = Eluna::CHECKVAL<bool>(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 * @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<bool>(L, 2, true); bool val = Eluna::CHECKVAL<bool>(L, 2, true);
@@ -1160,7 +1172,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
* *
* @param bool enable = true : `true` to enable hovering, `false` to disable * @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<bool>(L, 2, true); bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
@@ -1190,7 +1202,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
* *
* @param uint32 delay = 0 : dely to despawn in milliseconds * @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<uint32>(L, 2, 0); uint32 msTimeToDespawn = Eluna::CHECKVAL<uint32>(L, 2, 0);
@@ -1207,7 +1219,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
/** /**
* Respawn this [Creature]. * Respawn this [Creature].
*/ */
int Respawn(lua_State* /*L*/, Creature* creature) int Respawn(lua_State * /*L*/, Creature *creature)
{ {
creature->Respawn(); creature->Respawn();
return 0; return 0;
@@ -1216,7 +1228,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
/** /**
* Remove this [Creature]'s corpse. * Remove this [Creature]'s corpse.
*/ */
int RemoveCorpse(lua_State* /*L*/, Creature* creature) int RemoveCorpse(lua_State * /*L*/, Creature *creature)
{ {
creature->RemoveCorpse(); creature->RemoveCorpse();
return 0; return 0;
@@ -1225,7 +1237,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
/** /**
* Make the [Creature] start following its waypoint path. * 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) #if defined(TRINITY) || defined(AZEROTHCORE)
creature->GetMotionMaster()->MovePath(creature->GetWaypointPath(), true); 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. * 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(); creature->CallAssistance();
return 0; return 0;
@@ -1249,7 +1261,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
* *
* @param float radius * @param float radius
*/ */
int CallForHelp(lua_State* L, Creature* creature) int CallForHelp(lua_State *L, Creature *creature)
{ {
float radius = Eluna::CHECKVAL<float>(L, 2); float radius = Eluna::CHECKVAL<float>(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]. * 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(); creature->DoFleeToGetAssistance();
return 0; return 0;
@@ -1271,9 +1283,9 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
* *
* @param [Unit] target * @param [Unit] target
*/ */
int AttackStart(lua_State* L, Creature* creature) int AttackStart(lua_State *L, Creature *creature)
{ {
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2); Unit *target = Eluna::CHECKOBJ<Unit>(L, 2);
creature->AI()->AttackStart(target); creature->AI()->AttackStart(target);
return 0; return 0;
@@ -1282,7 +1294,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
/** /**
* Save the [Creature] in the database. * Save the [Creature] in the database.
*/ */
int SaveToDB(lua_State* /*L*/, Creature* creature) int SaveToDB(lua_State * /*L*/, Creature *creature)
{ {
creature->SaveToDB(); creature->SaveToDB();
return 0; return 0;
@@ -1293,7 +1305,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
* *
* This should be called every update cycle for the Creature's AI. * 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) #if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, creature->SelectVictim()); 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 entry : the Creature ID to transform into
* @param uint32 dataGUIDLow = 0 : use this Creature's model and equipment instead of the defaults * @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<uint32>(L, 2); uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
uint32 dataGuidLow = Eluna::CHECKVAL<uint32>(L, 3, 0); uint32 dataGuidLow = Eluna::CHECKVAL<uint32>(L, 3, 0);
@@ -1326,7 +1338,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
/** /**
* Resets [Creature]'s loot mode to default * 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(); creature->ResetLootMode();
return 0; return 0;
@@ -1337,7 +1349,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
* *
* @param uint16 lootMode * @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<uint16>(L, 2); uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
@@ -1350,7 +1362,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
* *
* @param uint16 lootMode * @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<uint16>(L, 2); uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
@@ -1413,16 +1425,16 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
* *
* @return [CreatureFamily] creatureFamily * @return [CreatureFamily] creatureFamily
*/ */
int GetCreatureFamily(lua_State* L, Creature* creature) int GetCreatureFamily(lua_State *L, Creature *creature)
{ {
uint32 entry = creature->GetEntry(); uint32 entry = creature->GetEntry();
#if defined(TRINITY) || defined(AZEROTHCORE) #if defined(TRINITY) || defined(AZEROTHCORE)
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(entry); CreatureTemplate const *cInfo = sObjectMgr->GetCreatureTemplate(entry);
if (cInfo) if (cInfo)
Eluna::Push(L, cInfo->family); Eluna::Push(L, cInfo->family);
#else #else
CreatureInfo const* cInfo = ObjectMgr::GetCreatureTemplate(entry); CreatureInfo const *cInfo = ObjectMgr::GetCreatureTemplate(entry);
if (cInfo) if (cInfo)
Eluna::Push(L, cInfo->Family); Eluna::Push(L, cInfo->Family);
#endif #endif

View File

@@ -790,6 +790,7 @@ ElunaRegister<Creature> CreatureMethods[] =
{ "GetCreatureFamily", &LuaCreature::GetCreatureFamily }, { "GetCreatureFamily", &LuaCreature::GetCreatureFamily },
// Setters // Setters
{ "SetRegeneratingHealth", &LuaCreature::SetRegeneratingHealth },
{ "SetHover", &LuaCreature::SetHover }, { "SetHover", &LuaCreature::SetHover },
{ "SetDisableGravity", &LuaCreature::SetDisableGravity }, { "SetDisableGravity", &LuaCreature::SetDisableGravity },
{ "SetAggroEnabled", &LuaCreature::SetAggroEnabled }, { "SetAggroEnabled", &LuaCreature::SetAggroEnabled },