Chore: Remove unused #if statement (TrinityCore, Mangos, AzerothCore, TBC, Classic, Mists, Cata) (#217)

This commit is contained in:
iThorgrim
2025-01-21 17:37:39 +01:00
committed by GitHub
parent 16173cb751
commit 2e89531b05
35 changed files with 60 additions and 2504 deletions

View File

@@ -39,11 +39,7 @@ namespace LuaAura
*/
int GetCasterGUID(lua_State* L, Aura* aura)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, aura->GetCasterGUID());
#else
Eluna::Push(L, aura->GetCasterGuid());
#endif
return 1;
}
@@ -65,11 +61,7 @@ namespace LuaAura
*/
int GetDuration(lua_State* L, Aura* aura)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, aura->GetDuration());
#else
Eluna::Push(L, aura->GetAuraDuration());
#endif
return 1;
}
@@ -94,11 +86,7 @@ namespace LuaAura
*/
int GetMaxDuration(lua_State* L, Aura* aura)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, aura->GetMaxDuration());
#else
Eluna::Push(L, aura->GetAuraMaxDuration());
#endif
return 1;
}
@@ -122,11 +110,7 @@ namespace LuaAura
*/
int GetOwner(lua_State* L, Aura* aura)
{
#if defined TRINITY || defined AZEROTHCORE
Eluna::Push(L, aura->GetOwner());
#else
Eluna::Push(L, aura->GetTarget());
#endif
return 1;
}
@@ -138,16 +122,7 @@ namespace LuaAura
int SetDuration(lua_State* L, Aura* aura)
{
int32 duration = Eluna::CHECKVAL<int32>(L, 2);
#if defined TRINITY || defined AZEROTHCORE
aura->SetDuration(duration);
#else
aura->GetHolder()->SetAuraDuration(duration);
#if (defined(TBC) || defined(CLASSIC))
aura->GetHolder()->UpdateAuraDuration();
#else
aura->GetHolder()->SendAuraUpdate(false);
#endif
#endif
return 0;
}
@@ -162,16 +137,7 @@ namespace LuaAura
int SetMaxDuration(lua_State* L, Aura* aura)
{
int32 duration = Eluna::CHECKVAL<int32>(L, 2);
#if defined TRINITY || defined AZEROTHCORE
aura->SetMaxDuration(duration);
#else
aura->GetHolder()->SetAuraMaxDuration(duration);
#if (defined(TBC) || defined(CLASSIC))
aura->GetHolder()->UpdateAuraDuration();
#else
aura->GetHolder()->SendAuraUpdate(false);
#endif
#endif
return 0;
}
@@ -186,11 +152,7 @@ namespace LuaAura
int SetStackAmount(lua_State* L, Aura* aura)
{
uint8 amount = Eluna::CHECKVAL<uint8>(L, 2);
#if defined TRINITY || defined AZEROTHCORE
aura->SetStackAmount(amount);
#else
aura->GetHolder()->SetStackAmount(amount);
#endif
return 0;
}
@@ -199,11 +161,7 @@ namespace LuaAura
*/
int Remove(lua_State* L, Aura* aura)
{
#if defined TRINITY || defined AZEROTHCORE
aura->Remove();
#else
aura->GetTarget()->RemoveSpellAuraHolder(aura->GetHolder(), AURA_REMOVE_BY_CANCEL);
#endif
Eluna::CHECKOBJ<ElunaObject>(L, 1)->Invalidate();
return 0;
}

View File

@@ -35,11 +35,7 @@ namespace LuaBattleGround
{
uint32 team = Eluna::CHECKVAL<uint32>(L, 2);
#ifndef AZEROTHCORE
Eluna::Push(L, bg->GetAlivePlayersCountByTeam((Team)team));
#else
Eluna::Push(L, bg->GetAlivePlayersCountByTeam((TeamId)team));
#endif
return 1;
}
@@ -68,19 +64,6 @@ namespace LuaBattleGround
return 1;
}
#ifndef AZEROTHCORE
/**
* Returns the bracket ID of the specific [BattleGround].
*
* @return [BattleGroundBracketId] bracketId
*/
int GetBracketId(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetBracketId());
return 1;
}
#endif
/**
* Returns the end time of the [BattleGround].
*
@@ -88,11 +71,7 @@ namespace LuaBattleGround
*/
int GetEndTime(lua_State* L, BattleGround* bg)
{
#ifdef CATA
Eluna::Push(L, bg->GetRemainingTime());
#else
Eluna::Push(L, bg->GetEndTime());
#endif
return 1;
}
@@ -106,11 +85,7 @@ namespace LuaBattleGround
{
uint32 team = Eluna::CHECKVAL<uint32>(L, 2);
#ifndef AZEROTHCORE
Eluna::Push(L, bg->GetFreeSlotsForTeam((Team)team));
#else
Eluna::Push(L, bg->GetFreeSlotsForTeam((TeamId)team));
#endif
return 1;
}
@@ -143,11 +118,7 @@ namespace LuaBattleGround
*/
int GetTypeId(lua_State* L, BattleGround* bg)
{
#ifndef AZEROTHCORE
Eluna::Push(L, bg->GetTypeID());
#else
Eluna::Push(L, bg->GetBgTypeID());
#endif
return 1;
}
@@ -180,11 +151,7 @@ namespace LuaBattleGround
*/
int GetMaxPlayers(lua_State* L, BattleGround* bg)
{
#ifndef AZEROTHCORE
Eluna::Push(L, bg->GetMaxPlayers());
#else
Eluna::Push(L, bg->GetMaxPlayersPerTeam() * 2);
#endif
return 1;
}
@@ -195,11 +162,7 @@ namespace LuaBattleGround
*/
int GetMinPlayers(lua_State* L, BattleGround* bg)
{
#ifndef AZEROTHCORE
Eluna::Push(L, bg->GetMinPlayers());
#else
Eluna::Push(L, bg->GetMaxPlayersPerTeam() * 2);
#endif
return 1;
}

View File

@@ -21,11 +21,7 @@ namespace LuaCorpse
*/
int GetOwnerGUID(lua_State* L, Corpse* corpse)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, corpse->GetOwnerGUID());
#else
Eluna::Push(L, corpse->GetOwnerGuid());
#endif
return 1;
}

View File

@@ -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;
}
};

View File

@@ -7,11 +7,7 @@
#ifndef QUERYMETHODS_H
#define QUERYMETHODS_H
#if defined TRINITY || defined AZEROTHCORE
#define RESULT (*result)
#else
#define RESULT result
#endif
/***
* The result of a database query.
@@ -45,11 +41,7 @@ namespace LuaQuery
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, RESULT->Fetch()[col].IsNull());
#else
Eluna::Push(L, RESULT->Fetch()[col].IsNULL());
#endif
return 1;
}
@@ -286,13 +278,8 @@ namespace LuaQuery
lua_createtable(L, 0, col);
int tbl = lua_gettop(L);
#if !defined TRINITY && !AZEROTHCORE
const QueryFieldNames& names = RESULT->GetFieldNames();
#endif
for (uint32 i = 0; i < col; ++i)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, RESULT->GetFieldName(i));
std::string _str = row[i].Get<std::string>();
@@ -304,50 +291,12 @@ namespace LuaQuery
// MYSQL_TYPE_LONGLONG Interpreted as string for lua
switch (row[i].GetType())
{
#if defined TRINITY || AZEROTHCORE
case DatabaseFieldTypes::Int8:
case DatabaseFieldTypes::Int16:
case DatabaseFieldTypes::Int32:
case DatabaseFieldTypes::Int64:
case DatabaseFieldTypes::Float:
case DatabaseFieldTypes::Double:
#else
case MYSQL_TYPE_TINY:
case MYSQL_TYPE_YEAR:
case MYSQL_TYPE_SHORT:
case MYSQL_TYPE_INT24:
case MYSQL_TYPE_LONG:
case MYSQL_TYPE_LONGLONG:
case MYSQL_TYPE_BIT:
case MYSQL_TYPE_FLOAT:
case MYSQL_TYPE_DOUBLE:
case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_NEWDECIMAL:
#endif
Eluna::Push(L, strtod(str, NULL));
break;
default:
Eluna::Push(L, str);
break;
}
}
#else
Eluna::Push(L, names[i]);
const char* str = row[i].GetString();
if (row[i].IsNULL() || !str)
Eluna::Push(L);
else
{
// MYSQL_TYPE_LONGLONG Interpreted as string for lua
switch (row[i].GetType())
{
case MYSQL_TYPE_TINY:
case MYSQL_TYPE_SHORT:
case MYSQL_TYPE_INT24:
case MYSQL_TYPE_LONG:
case MYSQL_TYPE_FLOAT:
case MYSQL_TYPE_DOUBLE:
Eluna::Push(L, strtod(str, NULL));
break;
default:
@@ -355,8 +304,6 @@ namespace LuaQuery
break;
}
}
#endif
lua_rawset(L, tbl);
}

View File

@@ -22,11 +22,7 @@ namespace LuaGameObject
{
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, go->hasQuest(questId));
#else
Eluna::Push(L, go->HasQuest(questId));
#endif
return 1;
}
@@ -145,11 +141,7 @@ namespace LuaGameObject
*/
int GetLootRecipientGroup(lua_State* L, GameObject* go)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, go->GetLootRecipientGroup());
#else
Eluna::Push(L, go->GetGroupLootRecipient());
#endif
return 1;
}
@@ -160,12 +152,7 @@ namespace LuaGameObject
*/
int GetDBTableGUIDLow(lua_State* L, GameObject* go)
{
#if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, go->GetSpawnId());
#else
// on mangos based this is same as lowguid
Eluna::Push(L, go->GetGUIDLow());
#endif
return 1;
}
@@ -192,13 +179,7 @@ namespace LuaGameObject
else if (state == 1)
go->SetGoState(GO_STATE_READY);
else if (state == 2)
{
#ifdef TRINITY
go->SetGoState(GO_STATE_DESTROYED);
#else
go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
#endif
}
return 0;
}
@@ -249,20 +230,15 @@ namespace LuaGameObject
int i = 1;
int argAmount = lua_gettop(L);
#if defined TRINITY || defined AZEROTHCORE
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
#endif
uint8 addedItems = 0;
while (i + 2 <= argAmount)
{
uint32 entry = Eluna::CHECKVAL<uint32>(L, ++i);
uint32 amount = Eluna::CHECKVAL<uint32>(L, ++i);
#if defined TRINITY || AZEROTHCORE
ItemTemplate const* item_proto = eObjectMgr->GetItemTemplate(entry);
#else
ItemTemplate const* item_proto = ObjectMgr::GetItemPrototype(entry);
#endif
if (!item_proto)
{
luaL_error(L, "Item entry %d does not exist", entry);
@@ -275,25 +251,15 @@ namespace LuaGameObject
}
if (Item* item = Item::CreateItem(entry, amount))
{
#if defined TRINITY || AZEROTHCORE
item->SaveToDB(trans);
#else
item->SaveToDB();
#endif
LootStoreItem storeItem(item->GetEntry(), 0, 100, 0, LOOT_MODE_DEFAULT, 0, item->GetCount(), item->GetCount());
go->loot.AddItem(storeItem);
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, item->GetGUID().GetCounter());
#else
Eluna::Push(L, item->GetGUIDLow());
#endif
++addedItems;
}
}
#if defined TRINITY || AZEROTHCORE
CharacterDatabase.CommitTransaction(trans);
#endif
return addedItems;
}
@@ -320,11 +286,7 @@ namespace LuaGameObject
bool deldb = Eluna::CHECKVAL<bool>(L, 2, false);
// cs_gobject.cpp copy paste
#if defined TRINITY || AZEROTHCORE
ObjectGuid ownerGuid = go->GetOwnerGUID();
#else
ObjectGuid ownerGuid = go->GetOwnerGuid();
#endif
if (ownerGuid)
{
Unit* owner = eObjectAccessor()GetUnit(*go, ownerGuid);
@@ -335,13 +297,7 @@ namespace LuaGameObject
}
if (deldb)
{
#ifdef TRINITY
GameObject::DeleteFromDB(go->GetSpawnId());
#else
go->DeleteFromDB();
#endif
}
go->SetRespawnTime(0);
go->Delete();

View File

@@ -9,8 +9,6 @@
#include "BindingMap.h"
#ifdef AZEROTHCORE
#include "BanMgr.h"
#include "GameTime.h"
#include "SharedDefines.h"
@@ -24,8 +22,6 @@ enum BanMode
BAN_IP = 3
};
#endif
/***
* These functions can be used anywhere at any time, including at start-up.
*/
@@ -67,13 +63,7 @@ namespace LuaGlobalFunctions
int GetRealmID(lua_State* L)
{
#ifdef MANGOS
Eluna::Push(L, realmID);
#elif defined(AZEROTHCORE)
Eluna::Push(L, sConfigMgr->GetOption<uint32>("RealmID", 1));
#else
Eluna::Push(L, sConfigMgr->GetIntDefault("RealmID", 1));
#endif
return 1;
}
@@ -101,15 +91,7 @@ namespace LuaGlobalFunctions
*/
int GetCoreExpansion(lua_State* L)
{
#ifdef CLASSIC
Eluna::Push(L, 0);
#elif defined(TBC)
Eluna::Push(L, 1);
#elif defined(WOTLK)
Eluna::Push(L, 2);
#elif defined(CATA)
Eluna::Push(L, 3);
#endif
return 1;
}
@@ -196,13 +178,7 @@ namespace LuaGlobalFunctions
*/
int GetGameTime(lua_State* L)
{
#ifdef TRINITY
Eluna::Push(L, GameTime::GetGameTime());
#elif AZEROTHCORE
Eluna::Push(L, GameTime::GetGameTime().count());
#else
Eluna::Push(L, eWorld->GetGameTime());
#endif
return 1;
}
@@ -231,24 +207,8 @@ namespace LuaGlobalFunctions
int tbl = lua_gettop(L);
uint32 i = 0;
#if defined(MANGOS)
eObjectAccessor()DoForAllPlayers([&](Player* player){
if(player->IsInWorld())
{
if ((team == TEAM_NEUTRAL || player->GetTeamId() == team) && (!onlyGM || player->isGameMaster()))
{
Eluna::Push(L, player);
lua_rawseti(L, tbl, ++i);
}
}
});
#else
{
#if defined TRINITY || AZEROTHCORE
std::shared_lock<std::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
#else
HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock());
#endif
const HashMapHolder<Player>::MapType& m = eObjectAccessor()GetPlayers();
for (HashMapHolder<Player>::MapType::const_iterator it = m.begin(); it != m.end(); ++it)
{
@@ -256,11 +216,8 @@ namespace LuaGlobalFunctions
{
if (!player->IsInWorld())
continue;
#if defined TRINITY || AZEROTHCORE
if ((team == TEAM_NEUTRAL || player->GetTeamId() == team) && (!onlyGM || player->IsGameMaster()))
#else
if ((team == TEAM_NEUTRAL || player->GetTeamId() == team) && (!onlyGM || player->isGameMaster()))
#endif
{
Eluna::Push(L, player);
lua_rawseti(L, tbl, ++i);
@@ -268,7 +225,7 @@ namespace LuaGlobalFunctions
}
}
}
#endif
lua_settop(L, tbl); // push table to top of stack
return 1;
}
@@ -470,9 +427,7 @@ namespace LuaGlobalFunctions
std::ostringstream oss;
oss << "|c" << std::hex << ItemQualityColors[temp->Quality] << std::dec <<
"|Hitem:" << entry << ":0:" <<
#ifndef CLASSIC
"0:0:0:0:" <<
#endif
"0:0:0:0|h[" << name << "]|h|r";
Eluna::Push(L, oss.str());
@@ -538,19 +493,12 @@ namespace LuaGlobalFunctions
if (locale >= TOTAL_LOCALES)
return luaL_argerror(L, 2, "valid LocaleConstant expected");
#if defined TRINITY || AZEROTHCORE
AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaOrZoneId);
#else
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaOrZoneId);
#endif
if (!areaEntry)
return luaL_argerror(L, 1, "valid Area or Zone ID expected");
#if defined(TRINITY)
Eluna::Push(L, areaEntry->AreaName[locale]);
#else
Eluna::Push(L, areaEntry->area_name[locale]);
#endif
return 1;
}
@@ -1284,16 +1232,14 @@ namespace LuaGlobalFunctions
int RunCommand(lua_State* L)
{
const char* command = Eluna::CHECKVAL<const char*>(L, 1);
#if defined TRINITY || AZEROTHCORE
eWorld->QueueCliCommand(new CliCommandHolder(nullptr, command, [](void*, std::string_view view)
{
std::string str = { view.begin(), view.end() };
str.erase(std::find_if(str.rbegin(), str.rend(), [](unsigned char ch) { return !std::isspace(ch); }).base(), str.end()); // Remove trailing spaces and line breaks
ELUNA_LOG_INFO("{}", str);
}, nullptr));
#elif defined MANGOS
eWorld->QueueCliCommand(new CliCommandHolder(0, SEC_CONSOLE, nullptr, command, nullptr, nullptr));
#endif
return 0;
}
@@ -1365,19 +1311,11 @@ namespace LuaGlobalFunctions
{
const char* query = Eluna::CHECKVAL<const char*>(L, 1);
#if defined TRINITY || AZEROTHCORE
ElunaQuery result = WorldDatabase.Query(query);
if (result)
Eluna::Push(L, new ElunaQuery(result));
else
Eluna::Push(L);
#else
ElunaQuery* result = WorldDatabase.QueryNamed(query);
if (result)
Eluna::Push(L, result);
else
Eluna::Push(L);
#endif
return 1;
}
@@ -1441,19 +1379,11 @@ namespace LuaGlobalFunctions
{
const char* query = Eluna::CHECKVAL<const char*>(L, 1);
#if defined TRINITY || AZEROTHCORE
QueryResult result = CharacterDatabase.Query(query);
if (result)
Eluna::Push(L, new QueryResult(result));
else
Eluna::Push(L);
#else
QueryNamedResult* result = CharacterDatabase.QueryNamed(query);
if (result)
Eluna::Push(L, result);
else
Eluna::Push(L);
#endif
return 1;
}
@@ -1510,19 +1440,11 @@ namespace LuaGlobalFunctions
{
const char* query = Eluna::CHECKVAL<const char*>(L, 1);
#if defined TRINITY || AZEROTHCORE
QueryResult result = LoginDatabase.Query(query);
if (result)
Eluna::Push(L, new QueryResult(result));
else
Eluna::Push(L);
#else
QueryNamedResult* result = LoginDatabase.QueryNamed(query);
if (result)
Eluna::Push(L, result);
else
Eluna::Push(L);
#endif
return 1;
}
@@ -1670,209 +1592,21 @@ namespace LuaGlobalFunctions
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
uint32 mapID = Eluna::CHECKVAL<uint32>(L, 3);
uint32 instanceID = Eluna::CHECKVAL<uint32>(L, 4);
float x = Eluna::CHECKVAL<float>(L, 5);
float y = Eluna::CHECKVAL<float>(L, 6);
float z = Eluna::CHECKVAL<float>(L, 7);
float o = Eluna::CHECKVAL<float>(L, 8);
bool save = Eluna::CHECKVAL<bool>(L, 9, false);
uint32 durorresptime = Eluna::CHECKVAL<uint32>(L, 10, 0);
#if (!defined(TBC) && !defined(CLASSIC))
uint32 phase = Eluna::CHECKVAL<uint32>(L, 11, PHASEMASK_NORMAL);
if (!phase)
{
Eluna::Push(L);
return 1;
}
#endif
#if !defined TRINITY && !AZEROTHCORE
Map* map = eMapMgr->FindMap(mapID, instanceID);
if (!map)
{
Eluna::Push(L);
return 1;
}
if (spawntype == 1) // spawn creature
{
if (save)
{
CreatureInfo const* cinfo = ObjectMgr::GetCreatureTemplate(entry);
if (!cinfo)
{
Eluna::Push(L);
return 1;
}
#if (defined(TBC) || defined(CLASSIC))
CreatureCreatePos pos(map, x, y, z, o);
#else
CreatureCreatePos pos(map, x, y, z, o, phase);
#endif
Creature* pCreature = new Creature;
// used guids from specially reserved range (can be 0 if no free values)
uint32 lowguid = eObjectMgr->GenerateStaticCreatureLowGuid();
if (!lowguid)
{
Eluna::Push(L);
return 1;
}
if (!pCreature->Create(lowguid, pos, cinfo))
{
delete pCreature;
Eluna::Push(L);
return 1;
}
#ifdef TBC
pCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()));
#elif defined(CLASSIC)
pCreature->SaveToDB(map->GetId());
#else
pCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), phase);
#endif
uint32 db_guid = pCreature->GetGUIDLow();
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
pCreature->LoadFromDB(db_guid, map);
map->Add(pCreature);
eObjectMgr->AddCreatureToGrid(db_guid, eObjectMgr->GetCreatureData(db_guid));
if (durorresptime)
pCreature->ForcedDespawn(durorresptime);
Eluna::Push(L, pCreature);
}
else
{
CreatureInfo const* cinfo = ObjectMgr::GetCreatureTemplate(entry);
if (!cinfo)
{
Eluna::Push(L);
return 1;
}
TemporarySummon* pCreature = new TemporarySummon(ObjectGuid(uint64(0)));
#if (defined(TBC) || defined(CLASSIC))
CreatureCreatePos pos(map, x, y, z, o);
#else
CreatureCreatePos pos(map, x, y, z, o, phase);
#endif
if (!pCreature->Create(map->GenerateLocalLowGuid(cinfo->GetHighGuid()), pos, cinfo, TEAM_NONE))
{
delete pCreature;
{
Eluna::Push(L);
return 1;
}
}
pCreature->SetRespawnCoord(pos);
// Active state set before added to map
pCreature->SetActiveObjectState(false);
// Also initializes the AI and MMGen
pCreature->Summon(durorresptime ? TEMPSPAWN_TIMED_OR_DEAD_DESPAWN : TEMPSPAWN_MANUAL_DESPAWN, durorresptime);
// Creature Linking, Initial load is handled like respawn
if (pCreature->IsLinkingEventTrigger())
map->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_RESPAWN, pCreature);
Eluna::Push(L, pCreature);
}
return 1;
}
if (spawntype == 2) // Spawn object
{
if (save)
{
const GameObjectInfo* gInfo = ObjectMgr::GetGameObjectInfo(entry);
if (!gInfo)
{
Eluna::Push(L);
return 1;
}
// used guids from specially reserved range (can be 0 if no free values)
uint32 db_lowGUID = eObjectMgr->GenerateStaticGameObjectLowGuid();
if (!db_lowGUID)
{
Eluna::Push(L);
return 1;
}
GameObject* pGameObj = new GameObject;
#if (defined(TBC) || defined(CLASSIC))
if (!pGameObj->Create(db_lowGUID, gInfo->id, map, x, y, z, o))
#else
if (!pGameObj->Create(db_lowGUID, gInfo->id, map, phase, x, y, z, o))
#endif
{
delete pGameObj;
Eluna::Push(L);
return 1;
}
if (durorresptime)
pGameObj->SetRespawnTime(durorresptime);
// fill the gameobject data and save to the db
#ifdef TBC
pGameObj->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()));
#elif defined(CLASSIC)
pGameObj->SaveToDB(map->GetId());
#else
pGameObj->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), phase);
#endif
// this will generate a new guid if the object is in an instance
if (!pGameObj->LoadFromDB(db_lowGUID, map))
{
delete pGameObj;
Eluna::Push(L);
return 1;
}
// DEBUG_LOG(GetMangosString(LANG_GAMEOBJECT_CURRENT), gInfo->name, db_lowGUID, x, y, z, o);
map->Add(pGameObj);
pGameObj->AIM_Initialize();
eObjectMgr->AddGameobjectToGrid(db_lowGUID, eObjectMgr->GetGOData(db_lowGUID));
Eluna::Push(L, pGameObj);
}
else
{
GameObject* pGameObj = new GameObject;
#if (defined(TBC) || defined(CLASSIC))
if (!pGameObj->Create(map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), entry, map, x, y, z, o))
#else
if (!pGameObj->Create(map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), entry, map, phase, x, y, z, o))
#endif
{
delete pGameObj;
Eluna::Push(L);
return 1;
}
pGameObj->SetRespawnTime(durorresptime / IN_MILLISECONDS);
map->Add(pGameObj);
pGameObj->AIM_Initialize();
Eluna::Push(L, pGameObj);
}
return 1;
}
#else
Map* map = eMapMgr->FindMap(mapID, instanceID);
if (!map)
{
@@ -1887,11 +1621,7 @@ namespace LuaGlobalFunctions
if (save)
{
Creature* creature = new Creature();
#ifndef AZEROTHCORE
if (!creature->Create(map->GenerateLowGuid<HighGuid::Unit>(), map, phase, entry, pos))
#else
if (!creature->Create(map->GenerateLowGuid<HighGuid::Unit>(), map, phase, entry, 0, x, y, z, o))
#endif
{
delete creature;
Eluna::Push(L);
@@ -1907,11 +1637,8 @@ namespace LuaGlobalFunctions
creature->CleanupsBeforeDelete();
delete creature;
creature = new Creature();
#ifndef AZEROTHCORE
if (!creature->LoadFromDB(db_guid, map, true, true))
#else
if (!creature->LoadFromDB(db_guid, map, true))
#endif
{
delete creature;
Eluna::Push(L);
@@ -1957,14 +1684,9 @@ namespace LuaGlobalFunctions
}
GameObject* object = new GameObject;
#ifndef AZEROTHCORE
uint32 guidLow = map->GenerateLowGuid<HighGuid::GameObject>();
QuaternionData rot = QuaternionData::fromEulerAnglesZYX(o, 0.f, 0.f);
if (!object->Create(guidLow, objectInfo->entry, map, phase, Position(x, y, z, o), rot, 0, GO_STATE_READY))
#else
uint32 guidLow = map->GenerateLowGuid<HighGuid::GameObject>();
if (!object->Create(guidLow, entry, map, phase, x, y, z, o, G3D::Quat(0.0f, 0.0f, 0.0f, 0.0f), 100, GO_STATE_READY))
#endif
{
delete object;
Eluna::Push(L);
@@ -1986,11 +1708,7 @@ namespace LuaGlobalFunctions
object = new GameObject();
// this will generate a new lowguid if the object is in an instance
#ifndef AZEROTHCORE
if (!object->LoadFromDB(guidLow, map, true))
#else
if (!object->LoadFromDB(guidLow, map))
#endif
{
delete object;
Eluna::Push(L);
@@ -2004,7 +1722,6 @@ namespace LuaGlobalFunctions
Eluna::Push(L, object);
return 1;
}
#endif
Eluna::Push(L);
return 1;
}
@@ -2044,25 +1761,10 @@ namespace LuaGlobalFunctions
uint32 incrtime = Eluna::CHECKVAL<uint32>(L, 4);
uint32 extendedcost = Eluna::CHECKVAL<uint32>(L, 5);
#if defined TRINITY || AZEROTHCORE
#ifdef CATA
if (!eObjectMgr->IsVendorItemValid(entry, item, maxcount, incrtime, extendedcost, 1))
return 0;
eObjectMgr->AddVendorItem(entry, item, maxcount, incrtime, extendedcost, 1);
#else
if (!eObjectMgr->IsVendorItemValid(entry, item, maxcount, incrtime, extendedcost))
return 0;
eObjectMgr->AddVendorItem(entry, item, maxcount, incrtime, extendedcost);
#endif
#else
if (!eObjectMgr->IsVendorItemValid(false, "npc_vendor", entry, item, maxcount, incrtime, extendedcost, 0))
return 0;
#ifndef CLASSIC
eObjectMgr->AddVendorItem(entry, item, maxcount, incrtime, extendedcost);
#else
eObjectMgr->AddVendorItem(entry, item, maxcount, incrtime);
#endif
#endif//TRINITY
return 0;
}
@@ -2079,11 +1781,7 @@ namespace LuaGlobalFunctions
if (!eObjectMgr->GetCreatureTemplate(entry))
return luaL_argerror(L, 1, "valid CreatureEntry expected");
#if defined(CATA) || defined(MISTS)
eObjectMgr->RemoveVendorItem(entry, item, 1);
#else
eObjectMgr->RemoveVendorItem(entry, item);
#endif
return 0;
}
@@ -2102,15 +1800,7 @@ namespace LuaGlobalFunctions
auto const& itemlist = items->m_items;
for (auto itr = itemlist.rbegin(); itr != itemlist.rend(); ++itr)
#if defined(CATA) || defined(MISTS)
eObjectMgr->RemoveVendorItem(entry, (*itr)->item, 1);
#else
#ifdef TRINITY
eObjectMgr->RemoveVendorItem(entry, itr->item);
#else
eObjectMgr->RemoveVendorItem(entry, (*itr)->item);
#endif
#endif
return 0;
}
@@ -2122,11 +1812,7 @@ namespace LuaGlobalFunctions
int Kick(lua_State* L)
{
Player* player = Eluna::CHECKOBJ<Player>(L, 1);
#ifdef TRINITY
player->GetSession()->KickPlayer("GlobalMethods::Kick Kick the player");
#else
player->GetSession()->KickPlayer();
#endif
return 0;
}
@@ -2162,13 +1848,8 @@ namespace LuaGlobalFunctions
switch (banMode)
{
case BAN_ACCOUNT:
#if defined TRINITY || AZEROTHCORE
if (!Utf8ToUpperOnlyLatin(nameOrIP))
return luaL_argerror(L, 2, "invalid account name");
#else
if (!AccountMgr::normalizeString(nameOrIP))
return luaL_argerror(L, 2, "invalid account name");
#endif
break;
case BAN_CHARACTER:
if (!normalizePlayerName(nameOrIP))
@@ -2207,15 +1888,9 @@ namespace LuaGlobalFunctions
case BanReturn::BAN_NOTFOUND:
Eluna::Push(L, 2);
break;
#ifdef AZEROTHCORE
case BanReturn::BAN_LONGER_EXISTS:
Eluna::Push(L, 3);
break;
#elif TRINITY
case BanReturn::BAN_EXISTS:
Eluna::Push(L, 3);
break;
#endif
}
return 1;
}
@@ -2274,32 +1949,19 @@ namespace LuaGlobalFunctions
MailSender sender(MAIL_NORMAL, senderGUIDLow, (MailStationery)stationary);
MailDraft draft(subject, text);
#if defined TRINITY || AZEROTHCORE
if (cod)
draft.AddCOD(cod);
if (money)
draft.AddMoney(money);
#else
if (cod)
draft.SetCOD(cod);
if (money)
draft.SetMoney(money);
#endif
#if defined TRINITY || defined AZEROTHCORE
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
#endif
uint8 addedItems = 0;
while (addedItems <= MAX_MAIL_ITEMS && i + 2 <= argAmount)
{
uint32 entry = Eluna::CHECKVAL<uint32>(L, ++i);
uint32 amount = Eluna::CHECKVAL<uint32>(L, ++i);
#if defined TRINITY || AZEROTHCORE
ItemTemplate const* item_proto = eObjectMgr->GetItemTemplate(entry);
#else
ItemTemplate const* item_proto = ObjectMgr::GetItemPrototype(entry);
#endif
if (!item_proto)
{
luaL_error(L, "Item entry %d does not exist", entry);
@@ -2312,28 +1974,16 @@ namespace LuaGlobalFunctions
}
if (Item* item = Item::CreateItem(entry, amount))
{
#if defined TRINITY || AZEROTHCORE
item->SaveToDB(trans);
#else
item->SaveToDB();
#endif
draft.AddItem(item);
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, item->GetGUID().GetCounter());
#else
Eluna::Push(L, item->GetGUIDLow());
#endif
++addedItems;
}
}
Player* receiverPlayer = eObjectAccessor()FindPlayer(MAKE_NEW_GUID(receiverGUIDLow, 0, HIGHGUID_PLAYER));
#if defined TRINITY || AZEROTHCORE
draft.SendMailTo(trans, MailReceiver(receiverPlayer, receiverGUIDLow), sender, MAIL_CHECK_MASK_NONE, delay);
CharacterDatabase.CommitTransaction(trans);
#else
draft.SendMailTo(MailReceiver(receiverPlayer, MAKE_NEW_GUID(receiverGUIDLow, 0, HIGHGUID_PLAYER)), sender);
#endif
return addedItems;
}
@@ -2489,16 +2139,6 @@ namespace LuaGlobalFunctions
// Stack: {nodes}, mountA, mountH, price, pathid, {nodes}, node, key, value
}
TaxiPathNodeEntry entry;
#ifdef TRINITY
// mandatory
entry.ContinentID = Eluna::CHECKVAL<uint32>(L, start);
entry.Loc.X = Eluna::CHECKVAL<float>(L, start + 1);
entry.Loc.Y = Eluna::CHECKVAL<float>(L, start + 2);
entry.Loc.Z = Eluna::CHECKVAL<float>(L, start + 3);
// optional
entry.Flags = Eluna::CHECKVAL<uint32>(L, start + 4, 0);
entry.Delay = Eluna::CHECKVAL<uint32>(L, start + 5, 0);
#else
// mandatory
entry.mapid = Eluna::CHECKVAL<uint32>(L, start);
entry.x = Eluna::CHECKVAL<float>(L, start + 1);
@@ -2507,7 +2147,6 @@ namespace LuaGlobalFunctions
// optional
entry.actionFlag = Eluna::CHECKVAL<uint32>(L, start + 4, 0);
entry.delay = Eluna::CHECKVAL<uint32>(L, start + 5, 0);
#endif
nodes.push_back(entry);
@@ -2529,28 +2168,17 @@ namespace LuaGlobalFunctions
pathId = sTaxiPathNodesByPath.size();
if (sTaxiPathNodesByPath.size() <= pathId)
sTaxiPathNodesByPath.resize(pathId + 1);
sTaxiPathNodesByPath[pathId].clear();
sTaxiPathNodesByPath[pathId].resize(nodes.size());
static uint32 nodeId = 500;
uint32 startNode = nodeId;
uint32 index = 0;
for (std::list<TaxiPathNodeEntry>::iterator it = nodes.begin(); it != nodes.end(); ++it)
{
TaxiPathNodeEntry& entry = *it;
TaxiNodesEntry* nodeEntry = new TaxiNodesEntry();
#ifdef TRINITY
entry.PathID = pathId;
entry.NodeIndex = nodeId;
nodeEntry->ID = index;
nodeEntry->ContinentID = entry.ContinentID;
nodeEntry->Pos.X = entry.Loc.X;
nodeEntry->Pos.Y = entry.Loc.Y;
nodeEntry->Pos.Z = entry.Loc.Z;
nodeEntry->MountCreatureID[0] = mountH;
nodeEntry->MountCreatureID[1] = mountA;
sTaxiNodesStore.SetEntry(nodeId++, nodeEntry);
sTaxiPathNodesByPath[pathId][index++] = new TaxiPathNodeEntry(entry);
#else
entry.path = pathId;
entry.index = nodeId;
nodeEntry->ID = index;
@@ -2561,33 +2189,19 @@ namespace LuaGlobalFunctions
nodeEntry->MountCreatureID[0] = mountH;
nodeEntry->MountCreatureID[1] = mountA;
sTaxiNodesStore.SetEntry(nodeId++, nodeEntry);
#ifndef AZEROTHCORE
sTaxiPathNodesByPath[pathId].set(index++, new TaxiPathNodeEntry(entry));
#else
sTaxiPathNodesByPath[pathId][index++] = new TaxiPathNodeEntry(entry);
#endif
#endif
}
if (startNode >= nodeId)
return 1;
#ifndef AZEROTHCORE
sTaxiPathSetBySource[startNode][nodeId - 1] = TaxiPathBySourceAndDestination(pathId, price);
#endif
TaxiPathEntry* pathEntry = new TaxiPathEntry();
#ifdef TRINITY
pathEntry->FromTaxiNode = startNode;
pathEntry->ToTaxiNode = nodeId - 1;
pathEntry->Cost = price;
#else
pathEntry->from = startNode;
pathEntry->to = nodeId - 1;
pathEntry->price = price;
#endif
pathEntry->ID = pathId;
sTaxiPathStore.SetEntry(pathId, pathEntry);
#ifdef AZEROTHCORE
sTaxiPathSetBySource[startNode][nodeId - 1] = pathEntry;
#endif
Eluna::Push(L, pathId);
return 1;
}
@@ -3479,7 +3093,6 @@ namespace LuaGlobalFunctions
return 0;
}
#ifdef AZEROTHCORE
/**
* Gets the faction which is the current owner of Halaa in Nagrand
* 0 = Alliance
@@ -3530,6 +3143,5 @@ namespace LuaGlobalFunctions
return 0;
}
#endif
}
#endif

View File

@@ -149,13 +149,9 @@ namespace LuaGroup
if (player->GetGroupInvite())
player->UninviteFromGroup();
#if defined TRINITY || AZEROTHCORE
bool success = group->AddMember(player);
if (success)
group->BroadcastGroupUpdate();
#else
bool success = group->AddMember(player->GetObjectGuid(), player->GetName());
#endif
Eluna::Push(L, success);
return 1;
@@ -186,11 +182,7 @@ namespace LuaGroup
for (GroupReference* itr = group->GetFirstMember(); itr; itr = itr->next())
{
#if defined TRINITY || AZEROTHCORE
Player* member = itr->GetSource();
#else
Player* member = itr->getSource();
#endif
if (!member || !member->GetSession())
continue;
@@ -210,11 +202,7 @@ namespace LuaGroup
*/
int GetLeaderGUID(lua_State* L, Group* group)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, group->GetLeaderGUID());
#else
Eluna::Push(L, group->GetLeaderGuid());
#endif
return 1;
}
@@ -225,11 +213,7 @@ namespace LuaGroup
*/
int GetGUID(lua_State* L, Group* group)
{
#ifdef CLASSIC
Eluna::Push(L, group->GetId());
#else
Eluna::Push(L, group->GET_GUID());
#endif
return 1;
}
@@ -242,11 +226,8 @@ namespace LuaGroup
int GetMemberGUID(lua_State* L, Group* group)
{
const char* name = Eluna::CHECKVAL<const char*>(L, 2);
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, group->GetMemberGUID(name));
#else
Eluna::Push(L, group->GetMemberGuid(name));
#endif
return 1;
}
@@ -322,11 +303,7 @@ namespace LuaGroup
bool ignorePlayersInBg = Eluna::CHECKVAL<bool>(L, 3);
ObjectGuid ignore = Eluna::CHECKVAL<ObjectGuid>(L, 4);
#ifdef CMANGOS
group->BroadcastPacket(*data, ignorePlayersInBg, -1, ignore);
#else
group->BroadcastPacket(data, ignorePlayersInBg, -1, ignore);
#endif
return 0;
}
@@ -352,11 +329,7 @@ namespace LuaGroup
ObjectGuid guid = Eluna::CHECKVAL<ObjectGuid>(L, 2);
uint32 method = Eluna::CHECKVAL<uint32>(L, 3, 0);
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, group->RemoveMember(guid, (RemoveMethod)method));
#else
Eluna::Push(L, group->RemoveMember(guid, method));
#endif
return 1;
}
@@ -420,11 +393,7 @@ namespace LuaGroup
if (icon >= TARGETICONCOUNT)
return luaL_argerror(L, 2, "valid target icon expected");
#if (defined(CLASSIC) || defined(TBC))
group->SetTargetIcon(icon, target);
#else
group->SetTargetIcon(icon, setter, target);
#endif
return 0;
}

View File

@@ -25,22 +25,8 @@ namespace LuaGuild
int tbl = lua_gettop(L);
uint32 i = 0;
#if defined(MANGOS)
eObjectAccessor()DoForAllPlayers([&](Player* player)
{
if (player->IsInWorld() && player->GetGuildId() == guild->GetId())
{
Eluna::Push(L, player);
lua_rawseti(L, tbl, ++i);
}
});
#else
{
#if defined TRINITY || AZEROTHCORE
std::shared_lock<std::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
#else
HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock());
#endif
const HashMapHolder<Player>::MapType& m = eObjectAccessor()GetPlayers();
for (HashMapHolder<Player>::MapType::const_iterator it = m.begin(); it != m.end(); ++it)
{
@@ -54,7 +40,7 @@ namespace LuaGuild
}
}
}
#endif
lua_settop(L, tbl); // push table to top of stack
return 1;
}
@@ -66,11 +52,7 @@ namespace LuaGuild
*/
int GetMemberCount(lua_State* L, Guild* guild)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, guild->GetMemberCount());
#else
Eluna::Push(L, guild->GetMemberSize());
#endif
return 1;
}
@@ -81,11 +63,7 @@ namespace LuaGuild
*/
int GetLeader(lua_State* L, Guild* guild)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, eObjectAccessor()FindPlayer(guild->GetLeaderGUID()));
#else
Eluna::Push(L, eObjectAccessor()FindPlayer(guild->GetLeaderGuid()));
#endif
return 1;
}
@@ -96,11 +74,7 @@ namespace LuaGuild
*/
int GetLeaderGUID(lua_State* L, Guild* guild)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, guild->GetLeaderGUID());
#else
Eluna::Push(L, guild->GetLeaderGuid());
#endif
return 1;
}
@@ -144,15 +118,10 @@ namespace LuaGuild
*/
int GetInfo(lua_State* L, Guild* guild)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, guild->GetInfo());
#else
Eluna::Push(L, guild->GetGINFO());
#endif
return 1;
}
#if defined(CLASSIC) || defined(TBC) || defined(WOTLK)
/**
* Sets the leader of this [Guild]
*
@@ -162,16 +131,10 @@ namespace LuaGuild
{
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
#if defined TRINITY || AZEROTHCORE
guild->HandleSetLeader(player->GetSession(), player->GetName());
#else
guild->SetLeader(player->GET_GUID());
#endif
return 0;
}
#endif
#ifndef CLASSIC
/**
* Sets the information of the bank tab specified
*
@@ -182,14 +145,9 @@ namespace LuaGuild
{
uint8 tabId = Eluna::CHECKVAL<uint8>(L, 2);
const char* text = Eluna::CHECKVAL<const char*>(L, 3);
#if defined TRINITY || AZEROTHCORE
guild->SetBankTabText(tabId, text);
#else
guild->SetGuildBankTabText(tabId, text);
#endif
return 0;
}
#endif
// SendPacketToGuild(packet)
/**
@@ -201,11 +159,7 @@ namespace LuaGuild
{
WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(L, 2);
#ifdef CMANGOS
guild->BroadcastPacket(*data);
#else
guild->BroadcastPacket(data);
#endif
return 0;
}
@@ -221,11 +175,7 @@ namespace LuaGuild
WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(L, 2);
uint8 ranked = Eluna::CHECKVAL<uint8>(L, 3);
#ifdef CMANGOS
guild->BroadcastPacketToRank(*data, ranked);
#else
guild->BroadcastPacketToRank(data, ranked);
#endif
return 0;
}
@@ -251,12 +201,7 @@ namespace LuaGuild
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
uint8 rankId = Eluna::CHECKVAL<uint8>(L, 3, GUILD_RANK_NONE);
#ifdef TRINITY
CharacterDatabaseTransaction trans(nullptr);
guild->AddMember(trans, player->GET_GUID(), rankId);
#else
guild->AddMember(player->GET_GUID(), rankId);
#endif
return 0;
}
@@ -271,14 +216,7 @@ namespace LuaGuild
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
bool isDisbanding = Eluna::CHECKVAL<bool>(L, 3, false);
#if defined TRINITY
CharacterDatabaseTransaction trans(nullptr);
guild->DeleteMember(trans, player->GET_GUID(), isDisbanding);
#elif defined AZEROTHCORE
guild->DeleteMember(player->GET_GUID(), isDisbanding);
#else
guild->DelMember(player->GET_GUID(), isDisbanding);
#endif
return 0;
}
@@ -293,12 +231,7 @@ namespace LuaGuild
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
uint8 newRank = Eluna::CHECKVAL<uint8>(L, 3);
#ifdef TRINITY
CharacterDatabaseTransaction trans(nullptr);
guild->ChangeMemberRank(trans, player->GET_GUID(), newRank);
#else
guild->ChangeMemberRank(player->GET_GUID(), newRank);
#endif
return 0;
}
};

View File

@@ -23,7 +23,6 @@ namespace LuaItem
return 1;
}
#if (!defined(TBC) && !defined(CLASSIC))
/**
* Returns 'true' if the [Item] is account bound, 'false' otherwise
*
@@ -34,7 +33,6 @@ namespace LuaItem
Eluna::Push(L, item->IsBoundAccountWide());
return 1;
}
#endif
/**
* Returns 'true' if the [Item] is bound to a [Player] by an enchant, 'false' otehrwise
@@ -83,7 +81,6 @@ namespace LuaItem
return 1;
}
#ifndef CLASSIC
/**
* Returns 'true' if the [Item] is a currency token, 'false' otherwise
*
@@ -94,7 +91,6 @@ namespace LuaItem
Eluna::Push(L, item->IsCurrencyToken());
return 1;
}
#endif
/**
* Returns 'true' if the [Item] is a not an empty bag, 'false' otherwise
@@ -125,12 +121,8 @@ namespace LuaItem
*/
int CanBeTraded(lua_State* L, Item* item)
{
#if (defined(TBC) || defined(CLASSIC))
Eluna::Push(L, item->CanBeTraded());
#else
bool mail = Eluna::CHECKVAL<bool>(L, 2, false);
Eluna::Push(L, item->CanBeTraded(mail));
#endif
return 1;
}
@@ -176,11 +168,7 @@ namespace LuaItem
int HasQuest(lua_State* L, Item* item)
{
uint32 quest = Eluna::CHECKVAL<uint32>(L, 2);
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, item->hasQuest(quest));
#else
Eluna::Push(L, item->HasQuest(quest));
#endif
return 1;
}
@@ -195,7 +183,6 @@ namespace LuaItem
return 1;
}
#if defined CLASSIC || defined(TBC) || defined(WOTLK)
/**
* Returns 'true' if the [Item] is a weapon vellum, 'false' otherwise
*
@@ -217,7 +204,6 @@ namespace LuaItem
Eluna::Push(L, item->IsArmorVellum());
return 1;
}
#endif
/**
* Returns 'true' if the [Item] is a conjured consumable, 'false' otherwise
@@ -270,49 +256,24 @@ namespace LuaItem
ObjectMgr::GetLocaleString(il->Name, static_cast<LocaleConstant>(locale), name);
}
#ifndef CLASSIC
if (int32 itemRandPropId = item->GetItemRandomPropertyId())
{
#if defined(CATA) || defined (MISTS)
char* suffix = NULL;
#else
#if TRINITY || AZEROTHCORE
std::array<char const*, 16> const* suffix = NULL;
#else
char* const* suffix = NULL;
#endif
#endif
if (itemRandPropId < 0)
{
const ItemRandomSuffixEntry* itemRandEntry = sItemRandomSuffixStore.LookupEntry(-item->GetItemRandomPropertyId());
if (itemRandEntry)
{
#if TRINITY || AZEROTHCORE
suffix = &itemRandEntry->Name;
#else
suffix = itemRandEntry->nameSuffix;
#endif
}
}
else
{
const ItemRandomPropertiesEntry* itemRandEntry = sItemRandomPropertiesStore.LookupEntry(item->GetItemRandomPropertyId());
if (itemRandEntry)
{
#if TRINITY || AZEROTHCORE
suffix = &itemRandEntry->Name;
#else
suffix = itemRandEntry->nameSuffix;
#endif
}
}
if (suffix)
{
#if TRINITY || AZEROTHCORE
const char* suffixName = (*suffix)[(name != temp->Name1) ? locale : uint8(DEFAULT_LOCALE)];
#else
const char* suffixName = suffix[(name != temp->Name1) ? locale : uint8(DEFAULT_LOCALE)];
#endif
if (strcmp(suffixName, "") != 0)
{
name += ' ';
@@ -320,19 +281,16 @@ namespace LuaItem
}
}
}
#endif
Player* owner = item->GetOwner();
std::ostringstream oss;
oss << "|c" << std::hex << ItemQualityColors[temp->Quality] << std::dec <<
"|Hitem:" << temp->ItemId << ":" <<
item->GetEnchantmentId(PERM_ENCHANTMENT_SLOT) << ":" <<
#ifndef CLASSIC
item->GetEnchantmentId(SOCK_ENCHANTMENT_SLOT) << ":" <<
item->GetEnchantmentId(SOCK_ENCHANTMENT_SLOT_2) << ":" <<
item->GetEnchantmentId(SOCK_ENCHANTMENT_SLOT_3) << ":" <<
item->GetEnchantmentId(BONUS_ENCHANTMENT_SLOT) << ":" <<
#endif
item->GetItemRandomPropertyId() << ":" << item->GetItemSuffixFactor() << ":" <<
(uint32)(owner ? owner->GetLevel() : 0) << "|h[" << name << "]|h|r";
@@ -342,11 +300,7 @@ namespace LuaItem
int GetOwnerGUID(lua_State* L, Item* item)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, item->GetOwnerGUID());
#else
Eluna::Push(L, item->GetOwnerGuid());
#endif
return 1;
}
@@ -597,13 +551,11 @@ namespace LuaItem
return 1;
}
#ifdef WOTLK
int GetStatsCount(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->StatsCount);
return 1;
}
#endif
/**
* Returns the random property ID of this [Item]
@@ -616,13 +568,11 @@ namespace LuaItem
return 1;
}
#ifndef CLASSIC
int GetRandomSuffix(lua_State* L, Item* item)
{
Eluna::Push(L, item->GetTemplate()->RandomSuffix);
return 1;
}
#endif
/**
* Returns the item set ID of this [Item]
@@ -668,11 +618,7 @@ namespace LuaItem
int SetOwner(lua_State* L, Item* item)
{
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
#if defined TRINITY || AZEROTHCORE
item->SetOwnerGUID(player->GET_GUID());
#else
item->SetOwnerGuid(player->GET_GUID());
#endif
return 0;
}
@@ -774,12 +720,8 @@ namespace LuaItem
*/
int SaveToDB(lua_State* /*L*/, Item* item)
{
#if defined TRINITY || defined AZEROTHCORE
CharacterDatabaseTransaction trans = CharacterDatabaseTransaction(nullptr);
item->SaveToDB(trans);
#else
item->SaveToDB();
#endif
return 0;
}
};

View File

@@ -17,7 +17,6 @@
namespace LuaMap
{
#ifndef CLASSIC
/**
* Returns `true` if the [Map] is an arena [BattleGround], `false` otherwise.
*
@@ -28,7 +27,6 @@ namespace LuaMap
Eluna::Push(L, map->IsBattleArena());
return 1;
}
#endif
/**
* Returns `true` if the [Map] is a non-arena [BattleGround], `false` otherwise.
@@ -37,11 +35,7 @@ namespace LuaMap
*/
int IsBattleground(lua_State* L, Map* map)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, map->IsBattleground());
#else
Eluna::Push(L, map->IsBattleGround());
#endif
return 1;
}
@@ -67,7 +61,6 @@ namespace LuaMap
return 1;
}
#ifndef CLASSIC
/**
* Returns `true` if the [Map] is a heroic, `false` otherwise.
*
@@ -78,7 +71,6 @@ namespace LuaMap
Eluna::Push(L, map->IsHeroic());
return 1;
}
#endif
/**
* Returns `true` if the [Map] is a raid, `false` otherwise.
@@ -115,12 +107,8 @@ namespace LuaMap
{
float x = Eluna::CHECKVAL<float>(L, 2);
float y = Eluna::CHECKVAL<float>(L, 3);
#if (defined(TBC) || defined(CLASSIC))
float z = map->GetHeight(x, y, MAX_HEIGHT);
#else
uint32 phasemask = Eluna::CHECKVAL<uint32>(L, 4, 1);
float z = map->GetHeight(phasemask, x, y, MAX_HEIGHT);
#endif
if (z != INVALID_HEIGHT)
Eluna::Push(L, z);
return 1;
@@ -135,11 +123,7 @@ namespace LuaMap
*/
int GetDifficulty(lua_State* L, Map* map)
{
#ifndef CLASSIC
Eluna::Push(L, map->GetDifficulty());
#else
Eluna::Push(L, (Difficulty)0);
#endif
return 1;
}
@@ -190,13 +174,9 @@ namespace LuaMap
float x = Eluna::CHECKVAL<float>(L, 2);
float y = Eluna::CHECKVAL<float>(L, 3);
float z = Eluna::CHECKVAL<float>(L, 4);
#if defined TRINITY || defined AZEROTHCORE
float phasemask = Eluna::CHECKVAL<uint32>(L, 5, PHASEMASK_NORMAL);
Eluna::Push(L, map->GetAreaId(phasemask, x, y, z));
#else
Eluna::Push(L, map->GetTerrain()->GetAreaId(x, y, z));
#endif
return 1;
}
@@ -210,7 +190,6 @@ namespace LuaMap
{
ObjectGuid guid = Eluna::CHECKVAL<ObjectGuid>(L, 2);
#if defined TRINITY || AZEROTHCORE
switch (guid.GetHigh())
{
case HIGHGUID_PLAYER:
@@ -237,9 +216,6 @@ namespace LuaMap
default:
break;
}
#else
Eluna::Push(L, map->GetWorldObject(guid));
#endif
return 1;
}
@@ -267,19 +243,11 @@ namespace LuaMap
uint32 weatherType = Eluna::CHECKVAL<uint32>(L, 3);
float grade = Eluna::CHECKVAL<float>(L, 4);
#if defined TRINITY
if (Weather * weather = map->GetOrGenerateZoneDefaultWeather(zoneId))
weather->SetWeather((WeatherType)weatherType, grade);
#elif defined AZEROTHCORE
Weather* weather = WeatherMgr::FindWeather(zoneId);
if (!weather)
weather = WeatherMgr::AddWeather(zoneId);
if (weather)
weather->SetWeather((WeatherType)weatherType, grade);
#else
if (Weather::IsValidWeatherType(weatherType))
map->SetWeather(zoneId, (WeatherType)weatherType, grade, false);
#endif
return 0;
}
@@ -293,13 +261,9 @@ namespace LuaMap
*/
int GetInstanceData(lua_State* L, Map* map)
{
#if defined TRINITY || AZEROTHCORE
ElunaInstanceAI* iAI = NULL;
if (InstanceMap* inst = map->ToInstanceMap())
iAI = dynamic_cast<ElunaInstanceAI*>(inst->GetInstanceScript());
#else
ElunaInstanceAI* iAI = dynamic_cast<ElunaInstanceAI*>(map->GetInstanceData());
#endif
if (iAI)
Eluna::GetEluna(L)->PushInstanceData(L, iAI, false);
@@ -314,13 +278,9 @@ namespace LuaMap
*/
int SaveInstanceData(lua_State* /*L*/, Map* map)
{
#if defined TRINITY || AZEROTHCORE
ElunaInstanceAI* iAI = NULL;
if (InstanceMap* inst = map->ToInstanceMap())
iAI = dynamic_cast<ElunaInstanceAI*>(inst->GetInstanceScript());
#else
ElunaInstanceAI* iAI = dynamic_cast<ElunaInstanceAI*>(map->GetInstanceData());
#endif
if (iAI)
iAI->SaveToDB();
@@ -352,11 +312,7 @@ namespace LuaMap
Map::PlayerList const& players = map->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
#if defined TRINITY || AZEROTHCORE
Player* player = itr->GetSource();
#else
Player* player = itr->getSource();
#endif
if (!player)
continue;
if (player->GetSession() && (team >= TEAM_NEUTRAL || player->GetTeamId() == team))

View File

@@ -58,9 +58,7 @@ namespace LuaObject
*/
int IsPlayer(lua_State* L, Object* obj)
{
#ifdef AZEROTHCORE //AC-only
Eluna::Push(L, obj->IsPlayer());
#endif
return 1;
}
@@ -146,11 +144,7 @@ namespace LuaObject
*/
int GetScale(lua_State* L, Object* obj)
{
#ifndef AZEROTHCORE
Eluna::Push(L, obj->GetObjectScale());
#else
Eluna::Push(L, obj->GetFloatValue(OBJECT_FIELD_SCALE_X));
#endif
return 1;
}
@@ -199,11 +193,7 @@ namespace LuaObject
*/
int GetGUIDLow(lua_State* L, Object* obj)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, obj->GetGUID().GetCounter());
#else
Eluna::Push(L, obj->GetGUIDLow());
#endif
return 1;
}

File diff suppressed because it is too large Load Diff

View File

@@ -52,15 +52,10 @@ namespace LuaQuest
int HasFlag(lua_State* L, Quest* quest)
{
uint32 flag = Eluna::CHECKVAL<uint32>(L, 2);
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, quest->HasFlag(flag));
#else
Eluna::Push(L, quest->HasQuestFlag((QuestFlags)flag));
#endif
return 1;
}
#ifndef CLASSIC
/**
* Returns 'true' if the [Quest] is a daily quest, false otherwise.
*
@@ -71,7 +66,6 @@ namespace LuaQuest
Eluna::Push(L, quest->IsDaily());
return 1;
}
#endif
/**
* Returns 'true' if the [Quest] is repeatable, false otherwise.
@@ -157,11 +151,7 @@ namespace LuaQuest
*/
int GetFlags(lua_State* L, Quest* quest)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, quest->GetFlags());
#else
Eluna::Push(L, quest->GetQuestFlags());
#endif
return 1;
}

View File

@@ -100,11 +100,7 @@ namespace LuaSpell
*/
int GetDuration(lua_State* L, Spell* spell)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, spell->GetSpellInfo()->GetDuration());
#else
Eluna::Push(L, GetSpellDuration(spell->m_spellInfo));
#endif
return 1;
}
@@ -117,17 +113,11 @@ namespace LuaSpell
*/
int GetTargetDest(lua_State* L, Spell* spell)
{
#if defined TRINITY || AZEROTHCORE
if (!spell->m_targets.HasDst())
return 3;
float x, y, z;
spell->m_targets.GetDstPos()->GetPosition(x, y, z);
#else
if (!(spell->m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION))
return 3;
float x, y, z;
spell->m_targets.getDestination(x, y, z);
#endif
Eluna::Push(L, x);
Eluna::Push(L, y);
Eluna::Push(L, z);
@@ -148,7 +138,6 @@ namespace LuaSpell
*/
int GetTarget(lua_State* L, Spell* spell)
{
#if defined TRINITY || AZEROTHCORE
if (GameObject* target = spell->m_targets.GetGOTarget())
Eluna::Push(L, target);
else if (Item* target = spell->m_targets.GetItemTarget())
@@ -159,16 +148,6 @@ namespace LuaSpell
Eluna::Push(L, target);
else if (WorldObject* target = spell->m_targets.GetObjectTarget())
Eluna::Push(L, target);
#else
if (GameObject* target = spell->m_targets.getGOTarget())
Eluna::Push(L, target);
else if (Item* target = spell->m_targets.getItemTarget())
Eluna::Push(L, target);
else if (Corpse* target = spell->GetCaster()->GetMap()->GetCorpse(spell->m_targets.getCorpseTargetGuid()))
Eluna::Push(L, target);
else if (Unit* target = spell->m_targets.getUnitTarget())
Eluna::Push(L, target);
#endif
return 1;
}

View File

@@ -403,7 +403,6 @@ namespace LuaUnit
return 1;
}
#ifndef CLASSIC
/**
* Returns true if the [Unit] is on a [Vehicle].
*
@@ -414,7 +413,6 @@ namespace LuaUnit
Eluna::Push(L, unit->GetVehicle());
return 1;
}
#endif
/**
* Returns true if the [Unit] is in combat.
@@ -1166,7 +1164,6 @@ namespace LuaUnit
return 1;
}
#if (!defined(TBC) && !defined(CLASSIC))
/**
* Returns [Unit]'s [Vehicle] methods
*
@@ -1196,7 +1193,6 @@ namespace LuaUnit
Eluna::Push(L, unit->GetCritterGUID());
return 1;
}
#endif
/**
* Returns the [Unit]'s speed of given [UnitMoveType].
@@ -1752,7 +1748,6 @@ namespace LuaUnit
return 0;
}
#if (!defined(TBC) && !defined(CLASSIC))
/**
* Sets the [Unit]'s FFA flag on or off.
*
@@ -1804,7 +1799,6 @@ namespace LuaUnit
unit->SetCritterGUID(guid);
return 0;
}
#endif
/*int SetStunned(lua_State* L, Unit* unit)
{
@@ -2157,7 +2151,6 @@ namespace LuaUnit
return 0;
}
#if (!defined(TBC) && !defined(CLASSIC))
/**
* Makes the [Unit] jump to the coordinates
*
@@ -2180,7 +2173,6 @@ namespace LuaUnit
unit->GetMotionMaster()->MoveJump(pos, zSpeed, maxHeight, id);
return 0;
}
#endif
/**
* The [Unit] will whisper the message to a [Player]
@@ -2426,7 +2418,6 @@ namespace LuaUnit
return 0;
}
#if !defined(CLASSIC)
/**
* Removes all positive visible [Aura]'s from the [Unit].
*/
@@ -2435,7 +2426,6 @@ namespace LuaUnit
unit->RemoveArenaAuras();
return 0;
}
#endif
/**
* Adds the given unit state for the [Unit].

View File

@@ -6,8 +6,6 @@
#ifndef VEHICLEMETHODS_H
#define VEHICLEMETHODS_H
#ifndef CLASSIC
#ifndef TBC
/***
* Inherits all methods from: none
@@ -23,11 +21,7 @@ namespace LuaVehicle
int IsOnBoard(lua_State* L, Vehicle* vehicle)
{
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, passenger->IsOnVehicle(vehicle->GetBase()));
#else
Eluna::Push(L, vehicle->HasOnBoard(passenger));
#endif
return 1;
}
@@ -38,11 +32,7 @@ namespace LuaVehicle
*/
int GetOwner(lua_State* L, Vehicle* vehicle)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, vehicle->GetBase());
#else
Eluna::Push(L, vehicle->GetOwner());
#endif
return 1;
}
@@ -53,13 +43,7 @@ namespace LuaVehicle
*/
int GetEntry(lua_State* L, Vehicle* vehicle)
{
#ifdef TRINITY
Eluna::Push(L, vehicle->GetVehicleInfo()->ID);
#elif AZEROTHCORE
Eluna::Push(L, vehicle->GetVehicleInfo()->m_ID);
#else
Eluna::Push(L, vehicle->GetVehicleEntry()->m_ID);
#endif
return 1;
}
@@ -86,12 +70,8 @@ namespace LuaVehicle
{
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
int8 seatId = Eluna::CHECKVAL<int8>(L, 3);
#if defined TRINITY || AZEROTHCORE
vehicle->AddPassenger(passenger, seatId);
#else
if (vehicle->CanBoard(passenger))
vehicle->Board(passenger, seatId);
#endif
return 0;
}
@@ -103,15 +83,9 @@ namespace LuaVehicle
int RemovePassenger(lua_State* L, Vehicle* vehicle)
{
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
#if defined TRINITY || AZEROTHCORE
vehicle->RemovePassenger(passenger);
#else
vehicle->UnBoard(passenger, false);
#endif
return 0;
}
}
#endif // CLASSIC
#endif // TBC
#endif // VEHICLEMETHODS_H

View File

@@ -34,7 +34,6 @@ namespace LuaWorldObject
return 1;
}
#if (!defined(TBC) && !defined(CLASSIC))
/**
* Returns the current phase of the [WorldObject]
*
@@ -59,7 +58,6 @@ namespace LuaWorldObject
obj->SetPhaseMask(phaseMask, update);
return 0;
}
#endif
/**
* Returns the current instance ID of the [WorldObject]
@@ -183,17 +181,9 @@ namespace LuaWorldObject
Unit* target = NULL;
ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_PLAYER, 0, hostile, dead);
#ifdef TRINITY
Trinity::UnitLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
Cell::VisitAllObjects(obj, searcher, range);
#elif AZEROTHCORE
Acore::UnitLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
Cell::VisitAllObjects(obj, searcher, range);
#else
MaNGOS::UnitLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(target, checker);
Cell::VisitWorldObjects(obj, searcher, range);
#endif
Eluna::Push(L, target);
return 1;
@@ -216,16 +206,9 @@ namespace LuaWorldObject
GameObject* target = NULL;
ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_GAMEOBJECT, entry, hostile);
#ifdef TRINITY
Trinity::GameObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
Cell::VisitAllObjects(obj, searcher, range);
#elif AZEROTHCORE
Acore::GameObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
Cell::VisitAllObjects(obj, searcher, range);
#else
MaNGOS::GameObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(target, checker);
Cell::VisitGridObjects(obj, searcher, range);
#endif
Eluna::Push(L, target);
return 1;
@@ -250,17 +233,9 @@ namespace LuaWorldObject
Creature* target = NULL;
ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_UNIT, entry, hostile, dead);
#ifdef TRINITY
Trinity::CreatureLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
Cell::VisitAllObjects(obj, searcher, range);
#elif AZEROTHCORE
Acore::CreatureLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
Cell::VisitAllObjects(obj, searcher, range);
#else
MaNGOS::CreatureLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(target, checker);
Cell::VisitGridObjects(obj, searcher, range);
#endif
Eluna::Push(L, target);
return 1;
@@ -283,16 +258,9 @@ namespace LuaWorldObject
std::list<Player*> list;
ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_PLAYER, 0, hostile, dead);
#ifdef TRINITY
Trinity::PlayerListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
Cell::VisitAllObjects(obj, searcher, range);
#elif AZEROTHCORE
Acore::PlayerListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
Cell::VisitAllObjects(obj, searcher, range);
#else
MaNGOS::PlayerListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(list, checker);
Cell::VisitWorldObjects(obj, searcher, range);
#endif
lua_createtable(L, list.size(), 0);
int tbl = lua_gettop(L);
@@ -327,16 +295,9 @@ namespace LuaWorldObject
std::list<Creature*> list;
ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_UNIT, entry, hostile, dead);
#ifdef TRINITY
Trinity::CreatureListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
Cell::VisitAllObjects(obj, searcher, range);
#elif defined AZEROTHCORE
Acore::CreatureListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
Cell::VisitAllObjects(obj, searcher, range);
#else
MaNGOS::CreatureListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(list, checker);
Cell::VisitGridObjects(obj, searcher, range);
#endif
lua_createtable(L, list.size(), 0);
int tbl = lua_gettop(L);
@@ -369,16 +330,9 @@ namespace LuaWorldObject
std::list<GameObject*> list;
ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_GAMEOBJECT, entry, hostile);
#ifdef TRINITY
Trinity::GameObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
Cell::VisitAllObjects(obj, searcher, range);
#elif AZEROTHCORE
Acore::GameObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
Cell::VisitAllObjects(obj, searcher, range);
#else
MaNGOS::GameObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(list, checker);
Cell::VisitGridObjects(obj, searcher, range);
#endif
lua_createtable(L, list.size(), 0);
int tbl = lua_gettop(L);
@@ -419,16 +373,9 @@ namespace LuaWorldObject
ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, type, entry, hostile, dead);
WorldObject* target = NULL;
#ifdef TRINITY
Trinity::WorldObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
Cell::VisitAllObjects(obj, searcher, range);
#elif AZEROTHCORE
Acore::WorldObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
Cell::VisitAllObjects(obj, searcher, range);
#else
MaNGOS::WorldObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(target, checker);
Cell::VisitAllObjects(obj, searcher, range);
#endif
Eluna::Push(L, target);
return 1;
@@ -459,16 +406,9 @@ namespace LuaWorldObject
ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, type, entry, hostile, dead);
std::list<WorldObject*> list;
#ifdef TRINITY
Trinity::WorldObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
Cell::VisitAllObjects(obj, searcher, range);
#elif AZEROTHCORE
Acore::WorldObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
Cell::VisitAllObjects(obj, searcher, range);
#else
MaNGOS::WorldObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(list, checker);
Cell::VisitAllObjects(obj, searcher, range);
#endif
lua_createtable(L, list.size(), 0);
int tbl = lua_gettop(L);
@@ -658,7 +598,6 @@ namespace LuaWorldObject
int GetAngle(lua_State* L, WorldObject* obj)
{
WorldObject* target = Eluna::CHECKOBJ<WorldObject>(L, 2, false);
#if defined TRINITY && !AZEROTHCORE
if (target)
Eluna::Push(L, obj->GetAbsoluteAngle(target));
else
@@ -667,16 +606,7 @@ namespace LuaWorldObject
float y = Eluna::CHECKVAL<float>(L, 3);
Eluna::Push(L, obj->GetAbsoluteAngle(x, y));
}
#else
if (target)
Eluna::Push(L, obj->GetAngle(target));
else
{
float x = Eluna::CHECKVAL<float>(L, 2);
float y = Eluna::CHECKVAL<float>(L, 3);
Eluna::Push(L, obj->GetAngle(x, y));
}
#endif
return 1;
}
@@ -688,11 +618,7 @@ namespace LuaWorldObject
int SendPacket(lua_State* L, WorldObject* obj)
{
WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(L, 2);
#ifdef CMANGOS
obj->SendMessageToSet(*data, true);
#else
obj->SendMessageToSet(data, true);
#endif
return 0;
}
@@ -715,14 +641,8 @@ namespace LuaWorldObject
float z = Eluna::CHECKVAL<float>(L, 5);
float o = Eluna::CHECKVAL<float>(L, 6);
uint32 respawnDelay = Eluna::CHECKVAL<uint32>(L, 7, 30);
#ifdef TRINITY
QuaternionData rot = QuaternionData::fromEulerAnglesZYX(o, 0.f, 0.f);
Eluna::Push(L, obj->SummonGameObject(entry, Position(x, y, z, o), rot, Seconds(respawnDelay)));
#elif AZEROTHCORE
Eluna::Push(L, obj->SummonGameObject(entry, x, y, z, o, 0, 0, 0, 0, respawnDelay));
#else
Eluna::Push(L, obj->SummonGameObject(entry, x, y, z, o, respawnDelay));
#endif
return 1;
}
@@ -762,7 +682,6 @@ namespace LuaWorldObject
uint32 spawnType = Eluna::CHECKVAL<uint32>(L, 7, 8);
uint32 despawnTimer = Eluna::CHECKVAL<uint32>(L, 8, 0);
#if defined TRINITY || AZEROTHCORE
TempSummonType type;
switch (spawnType)
{
@@ -793,49 +712,8 @@ namespace LuaWorldObject
default:
return luaL_argerror(L, 7, "valid SpawnType expected");
}
#else
TempSpawnType type;
switch (spawnType)
{
case 1:
type = TEMPSPAWN_TIMED_OR_DEAD_DESPAWN;
break;
case 2:
type = TEMPSPAWN_TIMED_OR_CORPSE_DESPAWN;
break;
case 3:
type = TEMPSPAWN_TIMED_DESPAWN;
break;
case 4:
type = TEMPSPAWN_TIMED_OOC_DESPAWN;
break;
case 5:
type = TEMPSPAWN_CORPSE_DESPAWN;
break;
case 6:
type = TEMPSPAWN_CORPSE_TIMED_DESPAWN;
break;
case 7:
type = TEMPSPAWN_DEAD_DESPAWN;
break;
case 8:
type = TEMPSPAWN_MANUAL_DESPAWN;
break;
case 9:
type = TEMPSPAWN_TIMED_OOC_OR_CORPSE_DESPAWN;
break;
case 10:
type = TEMPSPAWN_TIMED_OOC_OR_DEAD_DESPAWN;
break;
default:
return luaL_argerror(L, 7, "valid SpawnType expected");
}
#endif
#ifdef TRINITY
Eluna::Push(L, obj->SummonCreature(entry, x, y, z, o, type, Seconds(despawnTimer)));
#else
Eluna::Push(L, obj->SummonCreature(entry, x, y, z, o, type, despawnTimer));
#endif
return 1;
}
@@ -1119,11 +997,7 @@ namespace LuaWorldObject
WorldObject* target = Eluna::CHECKOBJ<WorldObject>(L, 2);
float arc = Eluna::CHECKVAL<float>(L, 3, static_cast<float>(M_PI));
#ifdef MANGOS
Eluna::Push(L, obj->IsInFront(target, arc));
#else
Eluna::Push(L, obj->isInFront(target, arc));
#endif
return 1;
}
@@ -1139,11 +1013,7 @@ namespace LuaWorldObject
WorldObject* target = Eluna::CHECKOBJ<WorldObject>(L, 2);
float arc = Eluna::CHECKVAL<float>(L, 3, static_cast<float>(M_PI));
#ifdef MANGOS
Eluna::Push(L, obj->IsInBack(target, arc));
#else
Eluna::Push(L, obj->isInBack(target, arc));
#endif
return 1;
}
@@ -1165,17 +1035,10 @@ namespace LuaWorldObject
WorldPacket data(SMSG_PLAY_MUSIC, 4);
data << uint32(musicid);
#ifdef CMANGOS
if (player)
player->SendDirectMessage(data);
else
obj->SendMessageToSet(data, true);
#else
if (player)
player->SendDirectMessage(&data);
else
obj->SendMessageToSet(&data, true);
#endif
return 0;
}