Chore: Remove unused #if statement (TrinityCore, Mangos, AzerothCore, TBC, Classic, Mists, Cata) (#217)
This commit is contained in:
@@ -22,17 +22,10 @@ namespace LuaCreature
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
/**
|
||||
* Sets whether the [Creature] can regenerate health or not.
|
||||
*
|
||||
@@ -42,14 +35,9 @@ namespace LuaCreature
|
||||
{
|
||||
bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
|
||||
|
||||
#if defined(AZEROTHCORE)
|
||||
creature->SetRegeneratingHealth(enable);
|
||||
#else
|
||||
creature->SetRegenerateHealth(enable);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns `true` if the [Creature] is set to not give reputation when killed,
|
||||
@@ -74,11 +62,7 @@ namespace LuaCreature
|
||||
{
|
||||
uint32 quest_id = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->hasInvolvedQuest(quest_id));
|
||||
#else
|
||||
Eluna::Push(L, creature->HasInvolvedQuest(quest_id));
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -93,11 +77,7 @@ namespace LuaCreature
|
||||
{
|
||||
bool mustBeDead = Eluna::CHECKVAL<bool>(L, 2, false);
|
||||
|
||||
#ifdef MANGOS
|
||||
Eluna::Push(L, creature->IsTargetableForAttack(mustBeDead));
|
||||
#else
|
||||
Eluna::Push(L, creature->isTargetableForAttack(mustBeDead));
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -142,11 +122,7 @@ namespace LuaCreature
|
||||
{
|
||||
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
|
||||
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->isTappedBy(player));
|
||||
#else
|
||||
Eluna::Push(L, creature->IsTappedBy(player));
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -158,11 +134,7 @@ namespace LuaCreature
|
||||
*/
|
||||
int HasLootRecipient(lua_State* L, Creature* creature)
|
||||
{
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->hasLootRecipient());
|
||||
#else
|
||||
Eluna::Push(L, creature->HasLootRecipient());
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -174,12 +146,7 @@ namespace LuaCreature
|
||||
*/
|
||||
int CanAggro(lua_State* L, Creature* creature)
|
||||
{
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, !creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC));
|
||||
#else
|
||||
// Eluna::Push(L, creature->CanInitiateAttack());
|
||||
Eluna::Push(L, !creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE));
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -227,11 +194,7 @@ namespace LuaCreature
|
||||
*/
|
||||
int IsElite(lua_State* L, Creature* creature)
|
||||
{
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->isElite());
|
||||
#else
|
||||
Eluna::Push(L, creature->IsElite());
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -277,13 +240,11 @@ namespace LuaCreature
|
||||
*
|
||||
* @return bool isDungeonBoss
|
||||
*/
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
int IsDungeonBoss(lua_State* L, Creature* creature)
|
||||
{
|
||||
Eluna::Push(L, creature->IsDungeonBoss());
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns `true` if the [Creature]'s rank is Boss,
|
||||
@@ -293,11 +254,7 @@ namespace LuaCreature
|
||||
*/
|
||||
int IsWorldBoss(lua_State* L, Creature* creature)
|
||||
{
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->isWorldBoss());
|
||||
#else
|
||||
Eluna::Push(L, creature->IsWorldBoss());
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -312,19 +269,10 @@ namespace LuaCreature
|
||||
{
|
||||
uint32 spell = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
|
||||
#if defined(TRINITY)
|
||||
if (const SpellInfo* info = sSpellMgr->GetSpellInfo(spell))
|
||||
Eluna::Push(L, info->GetCategory() && creature->GetSpellHistory()->HasCooldown(spell));
|
||||
else
|
||||
Eluna::Push(L, false);
|
||||
#elif defined(AZEROTHCORE)
|
||||
if (const SpellInfo* info = sSpellMgr->GetSpellInfo(spell))
|
||||
Eluna::Push(L, info->GetCategory() && creature->HasSpellCooldown(spell));
|
||||
else
|
||||
Eluna::Push(L, false);
|
||||
#else
|
||||
Eluna::Push(L, creature->HasCategoryCooldown(spell));
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -354,11 +302,7 @@ namespace LuaCreature
|
||||
{
|
||||
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->hasQuest(questId));
|
||||
#else
|
||||
Eluna::Push(L, creature->HasQuest(questId));
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -373,11 +317,7 @@ namespace LuaCreature
|
||||
{
|
||||
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
|
||||
#if defined(TRINITY)
|
||||
Eluna::Push(L, creature->GetSpellHistory()->HasCooldown(spellId));
|
||||
#else
|
||||
Eluna::Push(L, creature->HasSpellCooldown(spellId));
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -393,7 +333,6 @@ namespace LuaCreature
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
/**
|
||||
* Returns `true` if the [Creature] is an invisible trigger,
|
||||
* and returns `false` otherwise.
|
||||
@@ -428,12 +367,8 @@ namespace LuaCreature
|
||||
int CanStartAttack(lua_State* L, Creature* creature) // TODO: Implement core side
|
||||
{
|
||||
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
|
||||
#ifndef AZEROTHCORE
|
||||
bool force = Eluna::CHECKVAL<bool>(L, 3, true);
|
||||
Eluna::Push(L, creature->CanStartAttack(target, force));
|
||||
#else
|
||||
|
||||
Eluna::Push(L, creature->CanStartAttack(target));
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -450,7 +385,6 @@ namespace LuaCreature
|
||||
Eluna::Push(L, creature->HasLootMode(lootMode));
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns the time it takes for this [Creature] to respawn once killed.
|
||||
@@ -474,15 +408,10 @@ namespace LuaCreature
|
||||
*/
|
||||
int GetWanderRadius(lua_State* L, Creature* creature)
|
||||
{
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->GetWanderDistance());
|
||||
#else
|
||||
Eluna::Push(L, creature->GetRespawnRadius());
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
/**
|
||||
* Returns the current waypoint path ID of the [Creature].
|
||||
*
|
||||
@@ -493,7 +422,6 @@ namespace LuaCreature
|
||||
Eluna::Push(L, creature->GetWaypointPath());
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns the current waypoint ID of the [Creature].
|
||||
@@ -502,13 +430,7 @@ namespace LuaCreature
|
||||
*/
|
||||
int GetCurrentWaypointId(lua_State* L, Creature* creature)
|
||||
{
|
||||
#if defined(TRINITY)
|
||||
Eluna::Push(L, creature->GetCurrentWaypointInfo().first);
|
||||
#elif defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->GetCurrentWaypointID());
|
||||
#else
|
||||
Eluna::Push(L, creature->GetMotionMaster()->getLastReachedWaypoint());
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -533,35 +455,10 @@ namespace LuaCreature
|
||||
{
|
||||
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
|
||||
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->GetAggroRange(target));
|
||||
#else
|
||||
float AttackDist = creature->GetAttackDistance(target);
|
||||
float ThreatRadius = sWorld.getConfig(CONFIG_FLOAT_THREAT_RADIUS);
|
||||
Eluna::Push(L, ThreatRadius > AttackDist ? ThreatRadius : AttackDist);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifndef AZEROTHCORE
|
||||
/**
|
||||
* Returns the effective aggro range of the [Creature] for `target`.
|
||||
*
|
||||
* If this is smaller than the minimum aggro range set in the config file,
|
||||
* that is used as the aggro range instead.
|
||||
*
|
||||
* @param [Unit] target
|
||||
* @return float attackDistance
|
||||
*/
|
||||
int GetAttackDistance(lua_State* L, Creature* creature)
|
||||
{
|
||||
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
|
||||
|
||||
Eluna::Push(L, creature->GetAttackDistance(target));
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns the [Group] that can loot this [Creature].
|
||||
*
|
||||
@@ -569,11 +466,7 @@ namespace LuaCreature
|
||||
*/
|
||||
int GetLootRecipientGroup(lua_State* L, Creature* creature)
|
||||
{
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->GetLootRecipientGroup());
|
||||
#else
|
||||
Eluna::Push(L, creature->GetGroupLootRecipient());
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -642,19 +535,11 @@ namespace LuaCreature
|
||||
{
|
||||
uint32 spell = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
|
||||
#if defined(TRINITY)
|
||||
if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell))
|
||||
Eluna::Push(L, creature->GetSpellHistory()->GetRemainingCooldown(spellInfo));
|
||||
else
|
||||
Eluna::Push(L, 0);
|
||||
#elif defined(AZEROTHCORE)
|
||||
if (sSpellMgr->GetSpellInfo(spell))
|
||||
Eluna::Push(L, creature->GetSpellCooldown(spell));
|
||||
else
|
||||
Eluna::Push(L, 0);
|
||||
#else
|
||||
Eluna::Push(L, creature->GetCreatureSpellCooldownDelay(spell));
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -681,11 +566,7 @@ namespace LuaCreature
|
||||
int GetHomePosition(lua_State* L, Creature* creature)
|
||||
{
|
||||
float x, y, z, o;
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
creature->GetHomePosition(x, y, z, o);
|
||||
#else
|
||||
creature->GetRespawnCoord(x, y, z, &o);
|
||||
#endif
|
||||
|
||||
Eluna::Push(L, x);
|
||||
Eluna::Push(L, y);
|
||||
@@ -710,12 +591,7 @@ namespace LuaCreature
|
||||
float z = Eluna::CHECKVAL<float>(L, 4);
|
||||
float o = Eluna::CHECKVAL<float>(L, 5);
|
||||
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
creature->SetHomePosition(x, y, z, o);
|
||||
#else
|
||||
creature->SetRespawnCoord(x, y, z, o);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -762,33 +638,19 @@ namespace LuaCreature
|
||||
float dist = Eluna::CHECKVAL<float>(L, 5, 0.0f);
|
||||
int32 aura = Eluna::CHECKVAL<int32>(L, 6, 0);
|
||||
|
||||
#if defined(CMANGOS)
|
||||
ThreatList const& threatlist = creature->getThreatManager().getThreatList();
|
||||
#elif defined(MANGOS)
|
||||
ThreatList const& threatlist = creature->GetThreatManager().getThreatList();
|
||||
#elif defined(TRINITY)
|
||||
auto const& threatlist = creature->GetThreatManager().GetSortedThreatList();
|
||||
#elif defined(AZEROTHCORE)
|
||||
auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
#endif
|
||||
#ifndef TRINITY
|
||||
|
||||
if (threatlist.empty())
|
||||
return 1;
|
||||
if (position >= threatlist.size())
|
||||
return 1;
|
||||
#endif
|
||||
|
||||
std::list<Unit*> targetList;
|
||||
#if defined(TRINITY)
|
||||
for (ThreatReference const* itr : threatlist)
|
||||
#else
|
||||
|
||||
for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
#endif
|
||||
{
|
||||
#if defined(TRINITY)
|
||||
Unit* target = itr->GetVictim();
|
||||
#else
|
||||
{
|
||||
Unit* target = (*itr)->getTarget();
|
||||
#endif
|
||||
|
||||
if (!target)
|
||||
continue;
|
||||
if (playerOnly && target->GetTypeId() != TYPEID_PLAYER)
|
||||
@@ -857,25 +719,18 @@ namespace LuaCreature
|
||||
*/
|
||||
int GetAITargets(lua_State* L, Creature* creature)
|
||||
{
|
||||
#if defined(TRINITY)
|
||||
auto const& threatlist = creature->GetThreatManager().GetThreatenedByMeList();
|
||||
#elif defined(AZEROTHCORE)
|
||||
auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
#else
|
||||
ThreatList const& threatlist = creature->GetThreatManager().getThreatList();
|
||||
#endif
|
||||
auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
|
||||
lua_createtable(L, threatlist.size(), 0);
|
||||
int tbl = lua_gettop(L);
|
||||
uint32 i = 0;
|
||||
for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
{
|
||||
#if defined(TRINITY)
|
||||
Unit* target = itr->second->GetOwner();
|
||||
#else
|
||||
Unit* target = (*itr)->getTarget();
|
||||
#endif
|
||||
|
||||
if (!target)
|
||||
continue;
|
||||
|
||||
Eluna::Push(L, target);
|
||||
lua_rawseti(L, tbl, ++i);
|
||||
}
|
||||
@@ -891,13 +746,7 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
*/
|
||||
int GetAITargetsCount(lua_State* L, Creature* creature)
|
||||
{
|
||||
#if defined(TRINITY)
|
||||
Eluna::Push(L, creature->GetThreatManager().GetThreatenedByMeList().size());
|
||||
#elif defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->GetThreatMgr().GetThreatListSize());
|
||||
#else
|
||||
Eluna::Push(L, creature->GetThreatManager().getThreatList().size());
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -949,11 +798,7 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
*/
|
||||
int GetExtraFlags(lua_State* L, Creature* creature)
|
||||
{
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->GetCreatureTemplate()->flags_extra);
|
||||
#else
|
||||
Eluna::Push(L, creature->GetCreatureInfo()->ExtraFlags);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -968,7 +813,6 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined(CLASSIC) || defined(TBC) || defined(WOTLK)
|
||||
/**
|
||||
* Returns the [Creature]'s shield block value.
|
||||
*
|
||||
@@ -979,15 +823,12 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
Eluna::Push(L, creature->GetShieldBlockValue());
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
int GetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features
|
||||
{
|
||||
Eluna::Push(L, creature->GetLootMode());
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns the guid of the [Creature] that is used as the ID in the database
|
||||
@@ -996,12 +837,7 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
*/
|
||||
int GetDBTableGUIDLow(lua_State* L, Creature* creature)
|
||||
{
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->GetSpawnId());
|
||||
#else
|
||||
// on mangos based this is same as lowguid
|
||||
Eluna::Push(L, creature->GetGUIDLow());
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1042,7 +878,6 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
/**
|
||||
* Sets the [Creature]'s ReactState to `state`.
|
||||
*
|
||||
@@ -1055,7 +890,6 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
creature->SetReactState((ReactStates)state);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Makes the [Creature] able to fly if enabled.
|
||||
@@ -1066,15 +900,10 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
{
|
||||
bool disable = Eluna::CHECKVAL<bool>(L, 2);
|
||||
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
creature->SetDisableGravity(disable);
|
||||
#else
|
||||
creature->SetLevitate(disable);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
int SetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features
|
||||
{
|
||||
uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
|
||||
@@ -1082,7 +911,6 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
creature->SetLootMode(lootMode);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Sets the [Creature]'s death state to `deathState`.
|
||||
@@ -1093,11 +921,7 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
{
|
||||
int32 state = Eluna::CHECKVAL<int32>(L, 2);
|
||||
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
creature->setDeathState((DeathState)state);
|
||||
#else
|
||||
creature->SetDeathState((DeathState)state);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1127,15 +951,10 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
uint32 off_hand = Eluna::CHECKVAL<uint32>(L, 3);
|
||||
uint32 ranged = Eluna::CHECKVAL<uint32>(L, 4);
|
||||
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
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 + 2, ranged);
|
||||
#else
|
||||
creature->SetVirtualItem(VIRTUAL_ITEM_SLOT_0, main_hand);
|
||||
creature->SetVirtualItem(VIRTUAL_ITEM_SLOT_1, off_hand);
|
||||
creature->SetVirtualItem(VIRTUAL_ITEM_SLOT_2, ranged);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1148,17 +967,10 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
{
|
||||
bool allow = Eluna::CHECKVAL<bool>(L, 2, true);
|
||||
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
if (allow)
|
||||
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
|
||||
else
|
||||
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
|
||||
#else
|
||||
if (allow)
|
||||
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE);
|
||||
else
|
||||
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1184,15 +996,9 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
*/
|
||||
int SetInCombatWithZone(lua_State* /*L*/, Creature* creature)
|
||||
{
|
||||
#if defined(AZEROTHCORE)
|
||||
if (creature->IsAIEnabled)
|
||||
creature->AI()->DoZoneInCombat();
|
||||
#elif defined(TRINITY)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->DoZoneInCombat();
|
||||
#else
|
||||
creature->SetInCombatWithZone();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1205,11 +1011,8 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
{
|
||||
float dist = Eluna::CHECKVAL<float>(L, 2);
|
||||
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
creature->SetWanderDistance(dist);
|
||||
#else
|
||||
creature->SetRespawnRadius(dist);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1274,24 +1077,8 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
{
|
||||
bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
|
||||
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
creature->SetHover(enable);
|
||||
#else
|
||||
// Copy paste from Aura::HandleAuraHover
|
||||
// TODO: implement core side properly
|
||||
WorldPacket data;
|
||||
if (enable)
|
||||
data.Initialize(SMSG_MOVE_SET_HOVER, 8 + 4);
|
||||
else
|
||||
data.Initialize(SMSG_MOVE_UNSET_HOVER, 8 + 4);
|
||||
data << creature->GetPackGUID();
|
||||
data << uint32(0);
|
||||
#if defined(CMANGOS)
|
||||
creature->SendMessageToSet(data, true);
|
||||
#else
|
||||
creature->SendMessageToSet(&data, true);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1303,14 +1090,8 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
int DespawnOrUnsummon(lua_State* L, Creature* creature)
|
||||
{
|
||||
uint32 msTimeToDespawn = Eluna::CHECKVAL<uint32>(L, 2, 0);
|
||||
|
||||
#if defined(TRINITY)
|
||||
creature->DespawnOrUnsummon(Milliseconds(msTimeToDespawn));
|
||||
#elif defined(AZEROTHCORE)
|
||||
creature->DespawnOrUnsummon(msTimeToDespawn);
|
||||
#else
|
||||
creature->ForcedDespawn(msTimeToDespawn);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1337,11 +1118,8 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
*/
|
||||
int MoveWaypoint(lua_State* /*L*/, Creature* creature)
|
||||
{
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
creature->GetMotionMaster()->MovePath(creature->GetWaypointPath(), true);
|
||||
#else
|
||||
creature->GetMotionMaster()->MoveWaypoint();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1405,11 +1183,7 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
*/
|
||||
int SelectVictim(lua_State* L, Creature* creature)
|
||||
{
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
Eluna::Push(L, creature->SelectVictim());
|
||||
#else
|
||||
Eluna::Push(L, creature->SelectHostileTarget());
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1424,15 +1198,10 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
uint32 dataGuidLow = Eluna::CHECKVAL<uint32>(L, 3, 0);
|
||||
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
creature->UpdateEntry(entry, dataGuidLow ? eObjectMgr->GetCreatureData(dataGuidLow) : NULL);
|
||||
#else
|
||||
creature->UpdateEntry(entry, ALLIANCE, dataGuidLow ? eObjectMgr->GetCreatureData(dataGuidLow) : NULL);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
/**
|
||||
* Resets [Creature]'s loot mode to default
|
||||
*/
|
||||
@@ -1467,7 +1236,6 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
creature->AddLootMode(lootMode);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns the [Creature]'s creature family ID (enumerated in CreatureFamily.dbc).
|
||||
@@ -1527,15 +1295,10 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
|
||||
{
|
||||
uint32 entry = creature->GetEntry();
|
||||
|
||||
#if defined(TRINITY) || defined(AZEROTHCORE)
|
||||
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(entry);
|
||||
if (cInfo)
|
||||
Eluna::Push(L, cInfo->family);
|
||||
#else
|
||||
CreatureInfo const* cInfo = ObjectMgr::GetCreatureTemplate(entry);
|
||||
if (cInfo)
|
||||
Eluna::Push(L, cInfo->Family);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user