mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Getter added & Extra Code Cleanup
This commit is contained in:
@@ -14,6 +14,24 @@
|
|||||||
*/
|
*/
|
||||||
namespace LuaCreature
|
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.
|
* Sets whether the [Creature] can regenerate health or not.
|
||||||
*
|
*
|
||||||
@@ -37,7 +55,7 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* @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;
|
||||||
@@ -50,7 +68,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);
|
||||||
|
|
||||||
@@ -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.
|
* @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);
|
||||||
|
|
||||||
@@ -90,10 +108,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));
|
||||||
@@ -106,7 +124,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;
|
||||||
@@ -118,9 +136,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));
|
||||||
@@ -136,7 +154,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());
|
||||||
@@ -152,7 +170,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));
|
||||||
@@ -169,7 +187,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;
|
||||||
@@ -181,7 +199,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;
|
||||||
@@ -193,7 +211,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;
|
||||||
@@ -205,7 +223,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());
|
||||||
@@ -221,7 +239,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;
|
||||||
@@ -233,7 +251,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;
|
||||||
@@ -245,7 +263,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;
|
||||||
@@ -258,7 +276,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;
|
||||||
@@ -271,7 +289,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());
|
||||||
@@ -288,17 +306,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);
|
||||||
@@ -315,7 +333,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);
|
||||||
|
|
||||||
@@ -330,7 +348,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);
|
||||||
|
|
||||||
@@ -349,7 +367,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);
|
||||||
|
|
||||||
@@ -367,7 +385,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;
|
||||||
@@ -380,7 +398,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;
|
||||||
@@ -391,7 +409,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;
|
||||||
@@ -405,9 +423,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));
|
||||||
@@ -423,7 +441,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);
|
||||||
|
|
||||||
@@ -440,7 +458,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;
|
||||||
@@ -452,7 +470,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());
|
||||||
@@ -468,7 +486,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;
|
||||||
@@ -480,7 +498,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);
|
||||||
@@ -497,7 +515,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;
|
||||||
@@ -509,9 +527,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));
|
||||||
@@ -533,9 +551,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;
|
||||||
@@ -547,7 +565,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());
|
||||||
@@ -562,7 +580,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;
|
||||||
@@ -577,7 +595,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;
|
||||||
@@ -592,7 +610,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;
|
||||||
@@ -606,7 +624,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;
|
||||||
@@ -618,12 +636,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);
|
||||||
@@ -643,7 +661,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;
|
||||||
@@ -658,7 +676,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)
|
||||||
@@ -683,7 +701,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);
|
||||||
@@ -701,9 +719,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
|
||||||
};
|
};
|
||||||
@@ -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
|
* @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);
|
||||||
@@ -743,13 +761,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())
|
||||||
@@ -757,17 +775,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;
|
||||||
@@ -794,37 +812,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;
|
||||||
@@ -835,14 +853,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);
|
||||||
@@ -850,9 +868,9 @@ namespace LuaCreature
|
|||||||
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;
|
||||||
@@ -869,7 +887,7 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* @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());
|
||||||
@@ -889,7 +907,7 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* @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;
|
||||||
@@ -903,7 +921,7 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* @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);
|
||||||
@@ -919,7 +937,7 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* @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;
|
||||||
@@ -927,7 +945,7 @@ namespace LuaCreature
|
|||||||
#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;
|
||||||
@@ -939,7 +957,7 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* @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());
|
||||||
@@ -955,7 +973,7 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* @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);
|
||||||
|
|
||||||
@@ -963,12 +981,13 @@ namespace LuaCreature
|
|||||||
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);
|
||||||
|
|
||||||
@@ -981,7 +1000,7 @@ namespace LuaCreature
|
|||||||
}
|
}
|
||||||
|
|
||||||
#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);
|
||||||
|
|
||||||
@@ -995,7 +1014,7 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* @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);
|
||||||
|
|
||||||
@@ -1012,7 +1031,7 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* @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);
|
||||||
|
|
||||||
@@ -1027,7 +1046,7 @@ namespace LuaCreature
|
|||||||
* @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);
|
||||||
@@ -1050,7 +1069,7 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* @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);
|
||||||
|
|
||||||
@@ -1074,7 +1093,7 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* @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);
|
||||||
|
|
||||||
@@ -1088,7 +1107,7 @@ namespace LuaCreature
|
|||||||
* 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)
|
||||||
@@ -1107,7 +1126,7 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* @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);
|
||||||
|
|
||||||
@@ -1124,7 +1143,7 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* @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);
|
||||||
|
|
||||||
@@ -1137,7 +1156,7 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* @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);
|
||||||
|
|
||||||
@@ -1150,7 +1169,7 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* @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);
|
||||||
|
|
||||||
@@ -1163,7 +1182,7 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* @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);
|
||||||
|
|
||||||
@@ -1176,7 +1195,7 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* @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);
|
||||||
|
|
||||||
@@ -1206,7 +1225,7 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* @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);
|
||||||
|
|
||||||
@@ -1223,7 +1242,7 @@ namespace LuaCreature
|
|||||||
/**
|
/**
|
||||||
* 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;
|
||||||
@@ -1232,7 +1251,7 @@ namespace LuaCreature
|
|||||||
/**
|
/**
|
||||||
* 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;
|
||||||
@@ -1241,7 +1260,7 @@ namespace LuaCreature
|
|||||||
/**
|
/**
|
||||||
* 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);
|
||||||
@@ -1254,7 +1273,7 @@ namespace LuaCreature
|
|||||||
/**
|
/**
|
||||||
* 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;
|
||||||
@@ -1265,7 +1284,7 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* @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);
|
||||||
|
|
||||||
@@ -1276,7 +1295,7 @@ namespace LuaCreature
|
|||||||
/**
|
/**
|
||||||
* 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;
|
||||||
@@ -1287,9 +1306,9 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* @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;
|
||||||
@@ -1298,7 +1317,7 @@ namespace LuaCreature
|
|||||||
/**
|
/**
|
||||||
* 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;
|
||||||
@@ -1309,7 +1328,7 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* 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());
|
||||||
@@ -1325,7 +1344,7 @@ namespace LuaCreature
|
|||||||
* @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);
|
||||||
@@ -1342,7 +1361,7 @@ namespace LuaCreature
|
|||||||
/**
|
/**
|
||||||
* 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;
|
||||||
@@ -1353,7 +1372,7 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* @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);
|
||||||
|
|
||||||
@@ -1366,7 +1385,7 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* @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);
|
||||||
|
|
||||||
@@ -1429,16 +1448,16 @@ namespace LuaCreature
|
|||||||
*
|
*
|
||||||
* @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
|
||||||
|
|||||||
@@ -811,6 +811,7 @@ ElunaRegister<Creature> CreatureMethods[] =
|
|||||||
{ "SetEquipmentSlots", &LuaCreature::SetEquipmentSlots },
|
{ "SetEquipmentSlots", &LuaCreature::SetEquipmentSlots },
|
||||||
|
|
||||||
// Boolean
|
// Boolean
|
||||||
|
{ "IsRegeneratingHealth", &LuaCreature::IsRegeneratingHealth },
|
||||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||||
{ "IsDungeonBoss", &LuaCreature::IsDungeonBoss },
|
{ "IsDungeonBoss", &LuaCreature::IsDungeonBoss },
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user