|
|
|
@@ -37,7 +37,7 @@ namespace LuaCreature
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint32 quest_id = Eluna::CHECKVAL<uint32>(L, 2);
|
|
|
|
uint32 quest_id = Eluna::CHECKVAL<uint32>(L, 2);
|
|
|
|
|
|
|
|
|
|
|
|
#if defined TRINITY || AZEROTHCORE
|
|
|
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
|
|
|
Eluna::Push(L, creature->hasInvolvedQuest(quest_id));
|
|
|
|
Eluna::Push(L, creature->hasInvolvedQuest(quest_id));
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
Eluna::Push(L, creature->HasInvolvedQuest(quest_id));
|
|
|
|
Eluna::Push(L, creature->HasInvolvedQuest(quest_id));
|
|
|
|
@@ -105,7 +105,7 @@ namespace LuaCreature
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
|
|
|
|
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
|
|
|
|
|
|
|
|
|
|
|
|
#if defined TRINITY || AZEROTHCORE
|
|
|
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
|
|
|
Eluna::Push(L, creature->isTappedBy(player));
|
|
|
|
Eluna::Push(L, creature->isTappedBy(player));
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
Eluna::Push(L, creature->IsTappedBy(player));
|
|
|
|
Eluna::Push(L, creature->IsTappedBy(player));
|
|
|
|
@@ -121,7 +121,7 @@ namespace LuaCreature
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
int HasLootRecipient(lua_State* L, Creature* creature)
|
|
|
|
int HasLootRecipient(lua_State* L, Creature* creature)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#if defined TRINITY || AZEROTHCORE
|
|
|
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
|
|
|
Eluna::Push(L, creature->hasLootRecipient());
|
|
|
|
Eluna::Push(L, creature->hasLootRecipient());
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
Eluna::Push(L, creature->HasLootRecipient());
|
|
|
|
Eluna::Push(L, creature->HasLootRecipient());
|
|
|
|
@@ -137,7 +137,7 @@ namespace LuaCreature
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
int CanAggro(lua_State* L, Creature* creature)
|
|
|
|
int CanAggro(lua_State* L, Creature* creature)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#if defined TRINITY || 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));
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
// Eluna::Push(L, creature->CanInitiateAttack());
|
|
|
|
// Eluna::Push(L, creature->CanInitiateAttack());
|
|
|
|
@@ -190,7 +190,7 @@ namespace LuaCreature
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
int IsElite(lua_State* L, Creature* creature)
|
|
|
|
int IsElite(lua_State* L, Creature* creature)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#if defined TRINITY || AZEROTHCORE
|
|
|
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
|
|
|
Eluna::Push(L, creature->isElite());
|
|
|
|
Eluna::Push(L, creature->isElite());
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
Eluna::Push(L, creature->IsElite());
|
|
|
|
Eluna::Push(L, creature->IsElite());
|
|
|
|
@@ -242,7 +242,7 @@ namespace LuaCreature
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
int IsWorldBoss(lua_State* L, Creature* creature)
|
|
|
|
int IsWorldBoss(lua_State* L, Creature* creature)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#if defined TRINITY || AZEROTHCORE
|
|
|
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
|
|
|
Eluna::Push(L, creature->isWorldBoss());
|
|
|
|
Eluna::Push(L, creature->isWorldBoss());
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
Eluna::Push(L, creature->IsWorldBoss());
|
|
|
|
Eluna::Push(L, creature->IsWorldBoss());
|
|
|
|
@@ -261,12 +261,12 @@ namespace LuaCreature
|
|
|
|
{
|
|
|
|
{
|
|
|
|
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 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
|
|
|
|
@@ -303,7 +303,7 @@ namespace LuaCreature
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
|
|
|
|
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
|
|
|
|
|
|
|
|
|
|
|
|
#if defined TRINITY || AZEROTHCORE
|
|
|
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
|
|
|
Eluna::Push(L, creature->hasQuest(questId));
|
|
|
|
Eluna::Push(L, creature->hasQuest(questId));
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
Eluna::Push(L, creature->HasQuest(questId));
|
|
|
|
Eluna::Push(L, creature->HasQuest(questId));
|
|
|
|
@@ -322,7 +322,7 @@ namespace LuaCreature
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
|
|
|
|
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef TRINITY
|
|
|
|
#if defined(TRINITY)
|
|
|
|
Eluna::Push(L, creature->GetSpellHistory()->HasCooldown(spellId));
|
|
|
|
Eluna::Push(L, creature->GetSpellHistory()->HasCooldown(spellId));
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
Eluna::Push(L, creature->HasSpellCooldown(spellId));
|
|
|
|
Eluna::Push(L, creature->HasSpellCooldown(spellId));
|
|
|
|
@@ -342,7 +342,7 @@ namespace LuaCreature
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(TRINITY) || AZEROTHCORE
|
|
|
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Returns `true` if the [Creature] is an invisible trigger,
|
|
|
|
* Returns `true` if the [Creature] is an invisible trigger,
|
|
|
|
* and returns `false` otherwise.
|
|
|
|
* and returns `false` otherwise.
|
|
|
|
@@ -423,7 +423,7 @@ namespace LuaCreature
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
int GetWanderRadius(lua_State* L, Creature* creature)
|
|
|
|
int GetWanderRadius(lua_State* L, Creature* creature)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#if defined TRINITY || AZEROTHCORE
|
|
|
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
|
|
|
Eluna::Push(L, creature->GetWanderDistance());
|
|
|
|
Eluna::Push(L, creature->GetWanderDistance());
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
Eluna::Push(L, creature->GetRespawnRadius());
|
|
|
|
Eluna::Push(L, creature->GetRespawnRadius());
|
|
|
|
@@ -431,7 +431,7 @@ namespace LuaCreature
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(TRINITY) || AZEROTHCORE
|
|
|
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Returns the current waypoint path ID of the [Creature].
|
|
|
|
* Returns the current waypoint path ID of the [Creature].
|
|
|
|
*
|
|
|
|
*
|
|
|
|
@@ -451,9 +451,9 @@ namespace LuaCreature
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
int GetCurrentWaypointId(lua_State* L, Creature* creature)
|
|
|
|
int GetCurrentWaypointId(lua_State* L, Creature* creature)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#ifdef TRINITY
|
|
|
|
#if defined(TRINITY)
|
|
|
|
Eluna::Push(L, creature->GetCurrentWaypointInfo().first);
|
|
|
|
Eluna::Push(L, creature->GetCurrentWaypointInfo().first);
|
|
|
|
#elif AZEROTHCORE
|
|
|
|
#elif defined(AZEROTHCORE)
|
|
|
|
Eluna::Push(L, creature->GetCurrentWaypointID());
|
|
|
|
Eluna::Push(L, creature->GetCurrentWaypointID());
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
Eluna::Push(L, creature->GetMotionMaster()->getLastReachedWaypoint());
|
|
|
|
Eluna::Push(L, creature->GetMotionMaster()->getLastReachedWaypoint());
|
|
|
|
@@ -482,7 +482,7 @@ namespace LuaCreature
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
|
|
|
|
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
|
|
|
|
|
|
|
|
|
|
|
|
#if defined TRINITY || AZEROTHCORE
|
|
|
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
|
|
|
Eluna::Push(L, creature->GetAggroRange(target));
|
|
|
|
Eluna::Push(L, creature->GetAggroRange(target));
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
float AttackDist = creature->GetAttackDistance(target);
|
|
|
|
float AttackDist = creature->GetAttackDistance(target);
|
|
|
|
@@ -518,7 +518,7 @@ namespace LuaCreature
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
int GetLootRecipientGroup(lua_State* L, Creature* creature)
|
|
|
|
int GetLootRecipientGroup(lua_State* L, Creature* creature)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#if defined TRINITY || AZEROTHCORE
|
|
|
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
|
|
|
Eluna::Push(L, creature->GetLootRecipientGroup());
|
|
|
|
Eluna::Push(L, creature->GetLootRecipientGroup());
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
Eluna::Push(L, creature->GetGroupLootRecipient());
|
|
|
|
Eluna::Push(L, creature->GetGroupLootRecipient());
|
|
|
|
@@ -591,12 +591,12 @@ namespace LuaCreature
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint32 spell = Eluna::CHECKVAL<uint32>(L, 2);
|
|
|
|
uint32 spell = Eluna::CHECKVAL<uint32>(L, 2);
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef 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);
|
|
|
|
#elif AZEROTHCORE
|
|
|
|
#elif defined(AZEROTHCORE)
|
|
|
|
if (sSpellMgr->GetSpellInfo(spell))
|
|
|
|
if (sSpellMgr->GetSpellInfo(spell))
|
|
|
|
Eluna::Push(L, creature->GetSpellCooldown(spell));
|
|
|
|
Eluna::Push(L, creature->GetSpellCooldown(spell));
|
|
|
|
else
|
|
|
|
else
|
|
|
|
@@ -630,7 +630,7 @@ namespace LuaCreature
|
|
|
|
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 || AZEROTHCORE
|
|
|
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
|
|
|
creature->GetHomePosition(x, y, z, o);
|
|
|
|
creature->GetHomePosition(x, y, z, o);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
creature->GetRespawnCoord(x, y, z, &o);
|
|
|
|
creature->GetRespawnCoord(x, y, z, &o);
|
|
|
|
@@ -659,7 +659,7 @@ namespace LuaCreature
|
|
|
|
float z = Eluna::CHECKVAL<float>(L, 4);
|
|
|
|
float z = Eluna::CHECKVAL<float>(L, 4);
|
|
|
|
float o = Eluna::CHECKVAL<float>(L, 5);
|
|
|
|
float o = Eluna::CHECKVAL<float>(L, 5);
|
|
|
|
|
|
|
|
|
|
|
|
#if defined TRINITY || AZEROTHCORE
|
|
|
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
|
|
|
creature->SetHomePosition(x, y, z, o);
|
|
|
|
creature->SetHomePosition(x, y, z, o);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
creature->SetRespawnCoord(x, y, z, o);
|
|
|
|
creature->SetRespawnCoord(x, y, z, o);
|
|
|
|
@@ -711,13 +711,13 @@ namespace LuaCreature
|
|
|
|
float dist = Eluna::CHECKVAL<float>(L, 5, 0.0f);
|
|
|
|
float dist = Eluna::CHECKVAL<float>(L, 5, 0.0f);
|
|
|
|
int32 aura = Eluna::CHECKVAL<int32>(L, 6, 0);
|
|
|
|
int32 aura = Eluna::CHECKVAL<int32>(L, 6, 0);
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef CMANGOS
|
|
|
|
#if defined(CMANGOS)
|
|
|
|
ThreatList const& threatlist = creature->getThreatManager().getThreatList();
|
|
|
|
ThreatList const& threatlist = creature->getThreatManager().getThreatList();
|
|
|
|
#elif MANGOS
|
|
|
|
#elif defined(MANGOS)
|
|
|
|
ThreatList const& threatlist = creature->GetThreatManager().getThreatList();
|
|
|
|
ThreatList const& threatlist = creature->GetThreatManager().getThreatList();
|
|
|
|
#elif TRINITY
|
|
|
|
#elif defined(TRINITY)
|
|
|
|
auto const& threatlist = creature->GetThreatManager().GetSortedThreatList();
|
|
|
|
auto const& threatlist = creature->GetThreatManager().GetSortedThreatList();
|
|
|
|
#elif AZEROTHCORE
|
|
|
|
#elif defined(AZEROTHCORE)
|
|
|
|
auto const& threatlist = creature->getThreatManager().getThreatList();
|
|
|
|
auto const& threatlist = creature->getThreatManager().getThreatList();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#ifndef TRINITY
|
|
|
|
#ifndef TRINITY
|
|
|
|
@@ -727,13 +727,13 @@ namespace LuaCreature
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
std::list<Unit*> targetList;
|
|
|
|
std::list<Unit*> targetList;
|
|
|
|
#ifdef 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
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#ifdef TRINITY
|
|
|
|
#if defined(TRINITY)
|
|
|
|
Unit* target = itr->GetVictim();
|
|
|
|
Unit* target = itr->GetVictim();
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
Unit* target = (*itr)->getTarget();
|
|
|
|
Unit* target = (*itr)->getTarget();
|
|
|
|
@@ -806,9 +806,9 @@ namespace LuaCreature
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
int GetAITargets(lua_State* L, Creature* creature)
|
|
|
|
int GetAITargets(lua_State* L, Creature* creature)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#ifdef 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();
|
|
|
|
@@ -818,7 +818,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
|
|
|
uint32 i = 0;
|
|
|
|
uint32 i = 0;
|
|
|
|
for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
|
|
|
for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#ifdef TRINITY
|
|
|
|
#if defined(TRINITY)
|
|
|
|
Unit* target = itr->second->GetOwner();
|
|
|
|
Unit* target = itr->second->GetOwner();
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
Unit* target = (*itr)->getTarget();
|
|
|
|
Unit* target = (*itr)->getTarget();
|
|
|
|
@@ -840,9 +840,9 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
int GetAITargetsCount(lua_State* L, Creature* creature)
|
|
|
|
int GetAITargetsCount(lua_State* L, Creature* creature)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#ifdef TRINITY
|
|
|
|
#if defined(TRINITY)
|
|
|
|
Eluna::Push(L, creature->GetThreatManager().GetThreatenedByMeList().size());
|
|
|
|
Eluna::Push(L, creature->GetThreatManager().GetThreatenedByMeList().size());
|
|
|
|
#elif AZEROTHCORE
|
|
|
|
#elif defined(AZEROTHCORE)
|
|
|
|
Eluna::Push(L, creature->getThreatManager().getThreatList().size());
|
|
|
|
Eluna::Push(L, creature->getThreatManager().getThreatList().size());
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
Eluna::Push(L, creature->GetThreatManager().getThreatList().size());
|
|
|
|
Eluna::Push(L, creature->GetThreatManager().getThreatList().size());
|
|
|
|
@@ -877,7 +877,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(TRINITY) || 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());
|
|
|
|
@@ -892,7 +892,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
int GetDBTableGUIDLow(lua_State* L, Creature* creature)
|
|
|
|
int GetDBTableGUIDLow(lua_State* L, Creature* creature)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#ifdef TRINITY
|
|
|
|
#if defined(TRINITY)
|
|
|
|
Eluna::Push(L, creature->GetSpawnId());
|
|
|
|
Eluna::Push(L, creature->GetSpawnId());
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
// on mangos based this is same as lowguid
|
|
|
|
// on mangos based this is same as lowguid
|
|
|
|
@@ -924,7 +924,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool disable = Eluna::CHECKVAL<bool>(L, 2);
|
|
|
|
bool disable = Eluna::CHECKVAL<bool>(L, 2);
|
|
|
|
|
|
|
|
|
|
|
|
#if defined TRINITY || AZEROTHCORE
|
|
|
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
|
|
|
creature->SetDisableGravity(disable);
|
|
|
|
creature->SetDisableGravity(disable);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
creature->SetLevitate(disable);
|
|
|
|
creature->SetLevitate(disable);
|
|
|
|
@@ -932,7 +932,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if defined TRINITY || 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);
|
|
|
|
@@ -951,7 +951,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int32 state = Eluna::CHECKVAL<int32>(L, 2);
|
|
|
|
int32 state = Eluna::CHECKVAL<int32>(L, 2);
|
|
|
|
|
|
|
|
|
|
|
|
#if defined TRINITY || AZEROTHCORE
|
|
|
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
|
|
|
creature->setDeathState((DeathState)state);
|
|
|
|
creature->setDeathState((DeathState)state);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
creature->SetDeathState((DeathState)state);
|
|
|
|
creature->SetDeathState((DeathState)state);
|
|
|
|
@@ -985,7 +985,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
|
|
|
uint32 off_hand = Eluna::CHECKVAL<uint32>(L, 3);
|
|
|
|
uint32 off_hand = Eluna::CHECKVAL<uint32>(L, 3);
|
|
|
|
uint32 ranged = Eluna::CHECKVAL<uint32>(L, 4);
|
|
|
|
uint32 ranged = Eluna::CHECKVAL<uint32>(L, 4);
|
|
|
|
|
|
|
|
|
|
|
|
#if defined TRINITY || AZEROTHCORE
|
|
|
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
|
|
|
creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, main_hand);
|
|
|
|
creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, main_hand);
|
|
|
|
creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, off_hand);
|
|
|
|
creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, off_hand);
|
|
|
|
creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, ranged);
|
|
|
|
creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, ranged);
|
|
|
|
@@ -1006,7 +1006,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool allow = Eluna::CHECKVAL<bool>(L, 2, true);
|
|
|
|
bool allow = Eluna::CHECKVAL<bool>(L, 2, true);
|
|
|
|
|
|
|
|
|
|
|
|
#if defined TRINITY || AZEROTHCORE
|
|
|
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
|
|
|
if (allow)
|
|
|
|
if (allow)
|
|
|
|
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
|
|
|
|
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
@@ -1042,10 +1042,10 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
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)
|
|
|
|
creature->AI()->DoZoneInCombat();
|
|
|
|
creature->AI()->DoZoneInCombat();
|
|
|
|
#elif defined TRINITY
|
|
|
|
#elif defined(TRINITY)
|
|
|
|
if (creature->IsAIEnabled())
|
|
|
|
if (creature->IsAIEnabled())
|
|
|
|
creature->AI()->DoZoneInCombat();
|
|
|
|
creature->AI()->DoZoneInCombat();
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
@@ -1063,7 +1063,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
|
|
|
{
|
|
|
|
{
|
|
|
|
float dist = Eluna::CHECKVAL<float>(L, 2);
|
|
|
|
float dist = Eluna::CHECKVAL<float>(L, 2);
|
|
|
|
|
|
|
|
|
|
|
|
#if defined TRINITY || AZEROTHCORE
|
|
|
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
|
|
|
creature->SetWanderDistance(dist);
|
|
|
|
creature->SetWanderDistance(dist);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
creature->SetRespawnRadius(dist);
|
|
|
|
creature->SetRespawnRadius(dist);
|
|
|
|
@@ -1132,7 +1132,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
|
|
|
|
bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
|
|
|
|
|
|
|
|
|
|
|
|
#if defined TRINITY || AZEROTHCORE
|
|
|
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
|
|
|
creature->SetHover(enable);
|
|
|
|
creature->SetHover(enable);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
// Copy paste from Aura::HandleAuraHover
|
|
|
|
// Copy paste from Aura::HandleAuraHover
|
|
|
|
@@ -1144,7 +1144,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
|
|
|
data.Initialize(SMSG_MOVE_UNSET_HOVER, 8 + 4);
|
|
|
|
data.Initialize(SMSG_MOVE_UNSET_HOVER, 8 + 4);
|
|
|
|
data << creature->GetPackGUID();
|
|
|
|
data << creature->GetPackGUID();
|
|
|
|
data << uint32(0);
|
|
|
|
data << uint32(0);
|
|
|
|
#ifdef CMANGOS
|
|
|
|
#if defined(CMANGOS)
|
|
|
|
creature->SendMessageToSet(data, true);
|
|
|
|
creature->SendMessageToSet(data, true);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
creature->SendMessageToSet(&data, true);
|
|
|
|
creature->SendMessageToSet(&data, true);
|
|
|
|
@@ -1162,9 +1162,9 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint32 msTimeToDespawn = Eluna::CHECKVAL<uint32>(L, 2, 0);
|
|
|
|
uint32 msTimeToDespawn = Eluna::CHECKVAL<uint32>(L, 2, 0);
|
|
|
|
|
|
|
|
|
|
|
|
#if defined TRINITY
|
|
|
|
#if defined(TRINITY)
|
|
|
|
creature->DespawnOrUnsummon(Milliseconds(msTimeToDespawn));
|
|
|
|
creature->DespawnOrUnsummon(Milliseconds(msTimeToDespawn));
|
|
|
|
#elif defined AZEROTHCORE
|
|
|
|
#elif defined(AZEROTHCORE)
|
|
|
|
creature->DespawnOrUnsummon(msTimeToDespawn);
|
|
|
|
creature->DespawnOrUnsummon(msTimeToDespawn);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
creature->ForcedDespawn(msTimeToDespawn);
|
|
|
|
creature->ForcedDespawn(msTimeToDespawn);
|
|
|
|
@@ -1195,7 +1195,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
int MoveWaypoint(lua_State* /*L*/, Creature* creature)
|
|
|
|
int MoveWaypoint(lua_State* /*L*/, Creature* creature)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#if defined TRINITY || AZEROTHCORE
|
|
|
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
|
|
|
creature->GetMotionMaster()->MovePath(creature->GetWaypointPath(), true);
|
|
|
|
creature->GetMotionMaster()->MovePath(creature->GetWaypointPath(), true);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
creature->GetMotionMaster()->MoveWaypoint();
|
|
|
|
creature->GetMotionMaster()->MoveWaypoint();
|
|
|
|
@@ -1263,7 +1263,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
int SelectVictim(lua_State* L, Creature* creature)
|
|
|
|
int SelectVictim(lua_State* L, Creature* creature)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#if defined TRINITY || AZEROTHCORE
|
|
|
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
|
|
|
Eluna::Push(L, creature->SelectVictim());
|
|
|
|
Eluna::Push(L, creature->SelectVictim());
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
Eluna::Push(L, creature->SelectHostileTarget());
|
|
|
|
Eluna::Push(L, creature->SelectHostileTarget());
|
|
|
|
@@ -1282,7 +1282,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
|
#if defined TRINITY || AZEROTHCORE
|
|
|
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
|
|
|
creature->UpdateEntry(entry, dataGuidLow ? eObjectMgr->GetCreatureData(dataGuidLow) : NULL);
|
|
|
|
creature->UpdateEntry(entry, dataGuidLow ? eObjectMgr->GetCreatureData(dataGuidLow) : NULL);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
creature->UpdateEntry(entry, ALLIANCE, dataGuidLow ? eObjectMgr->GetCreatureData(dataGuidLow) : NULL);
|
|
|
|
creature->UpdateEntry(entry, ALLIANCE, dataGuidLow ? eObjectMgr->GetCreatureData(dataGuidLow) : NULL);
|
|
|
|
@@ -1290,7 +1290,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if defined TRINITY || AZEROTHCORE
|
|
|
|
#if defined(TRINITY) || defined(AZEROTHCORE)
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Resets [Creature]'s loot mode to default
|
|
|
|
* Resets [Creature]'s loot mode to default
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@@ -1385,7 +1385,7 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint32 entry = creature->GetEntry();
|
|
|
|
uint32 entry = creature->GetEntry();
|
|
|
|
|
|
|
|
|
|
|
|
#if defined TRINITY || 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);
|
|
|
|
|