mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
AZEROTHCORE compatibility (#271)
* Done Compatible AZEROTHCORE. * Fix TC build * Try fix whitespace (trailing and tabs2spaces) * Remove undefs and TC_LOG defines * Revert indentation change * Indentation and style change * Add more possible SQL types to query * change bg hooks OnBGEnd parameter type.
This commit is contained in:
@@ -39,10 +39,10 @@ namespace LuaAura
|
|||||||
*/
|
*/
|
||||||
int GetCasterGUID(lua_State* L, Aura* aura)
|
int GetCasterGUID(lua_State* L, Aura* aura)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, aura->GetCasterGuid());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, aura->GetCasterGUID());
|
Eluna::Push(L, aura->GetCasterGUID());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, aura->GetCasterGuid());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -65,10 +65,10 @@ namespace LuaAura
|
|||||||
*/
|
*/
|
||||||
int GetDuration(lua_State* L, Aura* aura)
|
int GetDuration(lua_State* L, Aura* aura)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, aura->GetAuraDuration());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, aura->GetDuration());
|
Eluna::Push(L, aura->GetDuration());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, aura->GetAuraDuration());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -94,10 +94,10 @@ namespace LuaAura
|
|||||||
*/
|
*/
|
||||||
int GetMaxDuration(lua_State* L, Aura* aura)
|
int GetMaxDuration(lua_State* L, Aura* aura)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, aura->GetAuraMaxDuration());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, aura->GetMaxDuration());
|
Eluna::Push(L, aura->GetMaxDuration());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, aura->GetAuraMaxDuration());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -122,10 +122,10 @@ namespace LuaAura
|
|||||||
*/
|
*/
|
||||||
int GetOwner(lua_State* L, Aura* aura)
|
int GetOwner(lua_State* L, Aura* aura)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || defined AZEROTHCORE
|
||||||
Eluna::Push(L, aura->GetTarget());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, aura->GetOwner());
|
Eluna::Push(L, aura->GetOwner());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, aura->GetTarget());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -138,15 +138,15 @@ namespace LuaAura
|
|||||||
int SetDuration(lua_State* L, Aura* aura)
|
int SetDuration(lua_State* L, Aura* aura)
|
||||||
{
|
{
|
||||||
int32 duration = Eluna::CHECKVAL<int32>(L, 2);
|
int32 duration = Eluna::CHECKVAL<int32>(L, 2);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || defined AZEROTHCORE
|
||||||
|
aura->SetDuration(duration);
|
||||||
|
#else
|
||||||
aura->GetHolder()->SetAuraDuration(duration);
|
aura->GetHolder()->SetAuraDuration(duration);
|
||||||
#if (defined(TBC) || defined(CLASSIC))
|
#if (defined(TBC) || defined(CLASSIC))
|
||||||
aura->GetHolder()->UpdateAuraDuration();
|
aura->GetHolder()->UpdateAuraDuration();
|
||||||
#else
|
#else
|
||||||
aura->GetHolder()->SendAuraUpdate(false);
|
aura->GetHolder()->SendAuraUpdate(false);
|
||||||
#endif
|
#endif
|
||||||
#else
|
|
||||||
aura->SetDuration(duration);
|
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -162,15 +162,15 @@ namespace LuaAura
|
|||||||
int SetMaxDuration(lua_State* L, Aura* aura)
|
int SetMaxDuration(lua_State* L, Aura* aura)
|
||||||
{
|
{
|
||||||
int32 duration = Eluna::CHECKVAL<int32>(L, 2);
|
int32 duration = Eluna::CHECKVAL<int32>(L, 2);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || defined AZEROTHCORE
|
||||||
|
aura->SetMaxDuration(duration);
|
||||||
|
#else
|
||||||
aura->GetHolder()->SetAuraMaxDuration(duration);
|
aura->GetHolder()->SetAuraMaxDuration(duration);
|
||||||
#if (defined(TBC) || defined(CLASSIC))
|
#if (defined(TBC) || defined(CLASSIC))
|
||||||
aura->GetHolder()->UpdateAuraDuration();
|
aura->GetHolder()->UpdateAuraDuration();
|
||||||
#else
|
#else
|
||||||
aura->GetHolder()->SendAuraUpdate(false);
|
aura->GetHolder()->SendAuraUpdate(false);
|
||||||
#endif
|
#endif
|
||||||
#else
|
|
||||||
aura->SetMaxDuration(duration);
|
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -186,10 +186,10 @@ namespace LuaAura
|
|||||||
int SetStackAmount(lua_State* L, Aura* aura)
|
int SetStackAmount(lua_State* L, Aura* aura)
|
||||||
{
|
{
|
||||||
uint8 amount = Eluna::CHECKVAL<uint8>(L, 2);
|
uint8 amount = Eluna::CHECKVAL<uint8>(L, 2);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || defined AZEROTHCORE
|
||||||
aura->GetHolder()->SetStackAmount(amount);
|
|
||||||
#else
|
|
||||||
aura->SetStackAmount(amount);
|
aura->SetStackAmount(amount);
|
||||||
|
#else
|
||||||
|
aura->GetHolder()->SetStackAmount(amount);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -199,10 +199,10 @@ namespace LuaAura
|
|||||||
*/
|
*/
|
||||||
int Remove(lua_State* L, Aura* aura)
|
int Remove(lua_State* L, Aura* aura)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || defined AZEROTHCORE
|
||||||
aura->GetTarget()->RemoveSpellAuraHolder(aura->GetHolder(), AURA_REMOVE_BY_CANCEL);
|
|
||||||
#else
|
|
||||||
aura->Remove();
|
aura->Remove();
|
||||||
|
#else
|
||||||
|
aura->GetTarget()->RemoveSpellAuraHolder(aura->GetHolder(), AURA_REMOVE_BY_CANCEL);
|
||||||
#endif
|
#endif
|
||||||
Eluna::CHECKOBJ<ElunaObject>(L, 1)->Invalidate();
|
Eluna::CHECKOBJ<ElunaObject>(L, 1)->Invalidate();
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -29,7 +29,11 @@ void Eluna::OnBGStart(BattleGround* bg, BattleGroundTypeId bgId, uint32 instance
|
|||||||
CallAllFunctions(BGEventBindings, key);
|
CallAllFunctions(BGEventBindings, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if AZEROTHCORE
|
||||||
|
void Eluna::OnBGEnd(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId, TeamId winner)
|
||||||
|
#else
|
||||||
void Eluna::OnBGEnd(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId, Team winner)
|
void Eluna::OnBGEnd(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId, Team winner)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
START_HOOK(BG_EVENT_ON_END);
|
START_HOOK(BG_EVENT_ON_END);
|
||||||
Push(bg);
|
Push(bg);
|
||||||
|
|||||||
@@ -35,7 +35,11 @@ namespace LuaBattleGround
|
|||||||
{
|
{
|
||||||
uint32 team = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 team = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
|
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
Eluna::Push(L, bg->GetAlivePlayersCountByTeam((Team)team));
|
Eluna::Push(L, bg->GetAlivePlayersCountByTeam((Team)team));
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, bg->GetAlivePlayersCountByTeam((TeamId)team));
|
||||||
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,6 +68,7 @@ namespace LuaBattleGround
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
/**
|
/**
|
||||||
* Returns the bracket ID of the specific [BattleGround].
|
* Returns the bracket ID of the specific [BattleGround].
|
||||||
*
|
*
|
||||||
@@ -74,6 +79,7 @@ namespace LuaBattleGround
|
|||||||
Eluna::Push(L, bg->GetBracketId());
|
Eluna::Push(L, bg->GetBracketId());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the end time of the [BattleGround].
|
* Returns the end time of the [BattleGround].
|
||||||
@@ -100,7 +106,11 @@ namespace LuaBattleGround
|
|||||||
{
|
{
|
||||||
uint32 team = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 team = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
|
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
Eluna::Push(L, bg->GetFreeSlotsForTeam((Team)team));
|
Eluna::Push(L, bg->GetFreeSlotsForTeam((Team)team));
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, bg->GetFreeSlotsForTeam((TeamId)team));
|
||||||
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +143,11 @@ namespace LuaBattleGround
|
|||||||
*/
|
*/
|
||||||
int GetTypeId(lua_State* L, BattleGround* bg)
|
int GetTypeId(lua_State* L, BattleGround* bg)
|
||||||
{
|
{
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
Eluna::Push(L, bg->GetTypeID());
|
Eluna::Push(L, bg->GetTypeID());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, bg->GetBgTypeID());
|
||||||
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,7 +180,11 @@ namespace LuaBattleGround
|
|||||||
*/
|
*/
|
||||||
int GetMaxPlayers(lua_State* L, BattleGround* bg)
|
int GetMaxPlayers(lua_State* L, BattleGround* bg)
|
||||||
{
|
{
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
Eluna::Push(L, bg->GetMaxPlayers());
|
Eluna::Push(L, bg->GetMaxPlayers());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, bg->GetMaxPlayersPerTeam() * 2);
|
||||||
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,7 +195,11 @@ namespace LuaBattleGround
|
|||||||
*/
|
*/
|
||||||
int GetMinPlayers(lua_State* L, BattleGround* bg)
|
int GetMinPlayers(lua_State* L, BattleGround* bg)
|
||||||
{
|
{
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
Eluna::Push(L, bg->GetMinPlayers());
|
Eluna::Push(L, bg->GetMinPlayers());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, bg->GetMaxPlayersPerTeam() * 2);
|
||||||
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,10 @@ namespace LuaCorpse
|
|||||||
*/
|
*/
|
||||||
int GetOwnerGUID(lua_State* L, Corpse* corpse)
|
int GetOwnerGUID(lua_State* L, Corpse* corpse)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, corpse->GetOwnerGuid());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, corpse->GetOwnerGUID());
|
Eluna::Push(L, corpse->GetOwnerGUID());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, corpse->GetOwnerGuid());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ bool Eluna::SpellHitTarget(Creature* me, Unit* target, SpellInfo const* spell)
|
|||||||
return CallAllFunctionsBool(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key);
|
return CallAllFunctionsBool(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
|
|
||||||
bool Eluna::SummonedCreatureDies(Creature* me, Creature* summon, Unit* killer)
|
bool Eluna::SummonedCreatureDies(Creature* me, Creature* summon, Unit* killer)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,10 +37,10 @@ namespace LuaCreature
|
|||||||
{
|
{
|
||||||
uint32 quest_id = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 quest_id = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, creature->HasInvolvedQuest(quest_id));
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, creature->hasInvolvedQuest(quest_id));
|
Eluna::Push(L, creature->hasInvolvedQuest(quest_id));
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, creature->HasInvolvedQuest(quest_id));
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -105,7 +105,7 @@ namespace LuaCreature
|
|||||||
{
|
{
|
||||||
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
|
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, creature->isTappedBy(player));
|
Eluna::Push(L, creature->isTappedBy(player));
|
||||||
#else
|
#else
|
||||||
Eluna::Push(L, creature->IsTappedBy(player));
|
Eluna::Push(L, creature->IsTappedBy(player));
|
||||||
@@ -121,10 +121,10 @@ namespace LuaCreature
|
|||||||
*/
|
*/
|
||||||
int HasLootRecipient(lua_State* L, Creature* creature)
|
int HasLootRecipient(lua_State* L, Creature* creature)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, creature->HasLootRecipient());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, creature->hasLootRecipient());
|
Eluna::Push(L, creature->hasLootRecipient());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, creature->HasLootRecipient());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -137,7 +137,7 @@ namespace LuaCreature
|
|||||||
*/
|
*/
|
||||||
int CanAggro(lua_State* L, Creature* creature)
|
int CanAggro(lua_State* L, Creature* creature)
|
||||||
{
|
{
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, !creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC));
|
Eluna::Push(L, !creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC));
|
||||||
#else
|
#else
|
||||||
// Eluna::Push(L, creature->CanInitiateAttack());
|
// Eluna::Push(L, creature->CanInitiateAttack());
|
||||||
@@ -190,10 +190,10 @@ namespace LuaCreature
|
|||||||
*/
|
*/
|
||||||
int IsElite(lua_State* L, Creature* creature)
|
int IsElite(lua_State* L, Creature* creature)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, creature->IsElite());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, creature->isElite());
|
Eluna::Push(L, creature->isElite());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, creature->IsElite());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -242,10 +242,10 @@ namespace LuaCreature
|
|||||||
*/
|
*/
|
||||||
int IsWorldBoss(lua_State* L, Creature* creature)
|
int IsWorldBoss(lua_State* L, Creature* creature)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, creature->IsWorldBoss());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, creature->isWorldBoss());
|
Eluna::Push(L, creature->isWorldBoss());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, creature->IsWorldBoss());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -261,11 +261,16 @@ namespace LuaCreature
|
|||||||
{
|
{
|
||||||
uint32 spell = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 spell = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY
|
||||||
if (const SpellInfo* info = sSpellMgr->GetSpellInfo(spell))
|
if (const SpellInfo* info = sSpellMgr->GetSpellInfo(spell))
|
||||||
Eluna::Push(L, info->GetCategory() && creature->GetSpellHistory()->HasCooldown(spell));
|
Eluna::Push(L, info->GetCategory() && creature->GetSpellHistory()->HasCooldown(spell));
|
||||||
else
|
else
|
||||||
Eluna::Push(L, false);
|
Eluna::Push(L, false);
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
if (const SpellInfo* info = sSpellMgr->GetSpellInfo(spell))
|
||||||
|
Eluna::Push(L, info->GetCategory() && creature->HasSpellCooldown(spell));
|
||||||
|
else
|
||||||
|
Eluna::Push(L, false);
|
||||||
#else
|
#else
|
||||||
Eluna::Push(L, creature->HasCategoryCooldown(spell));
|
Eluna::Push(L, creature->HasCategoryCooldown(spell));
|
||||||
#endif
|
#endif
|
||||||
@@ -298,10 +303,10 @@ namespace LuaCreature
|
|||||||
{
|
{
|
||||||
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, creature->HasQuest(questId));
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, creature->hasQuest(questId));
|
Eluna::Push(L, creature->hasQuest(questId));
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, creature->HasQuest(questId));
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -337,7 +342,7 @@ namespace LuaCreature
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined(TRINITY) || AZEROTHCORE
|
||||||
/**
|
/**
|
||||||
* Returns `true` if the [Creature] is an invisible trigger,
|
* Returns `true` if the [Creature] is an invisible trigger,
|
||||||
* and returns `false` otherwise.
|
* and returns `false` otherwise.
|
||||||
@@ -372,9 +377,12 @@ namespace LuaCreature
|
|||||||
int CanStartAttack(lua_State* L, Creature* creature) // TODO: Implement core side
|
int CanStartAttack(lua_State* L, Creature* creature) // TODO: Implement core side
|
||||||
{
|
{
|
||||||
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
|
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
bool force = Eluna::CHECKVAL<bool>(L, 3, true);
|
bool force = Eluna::CHECKVAL<bool>(L, 3, true);
|
||||||
|
|
||||||
Eluna::Push(L, creature->CanStartAttack(target, force));
|
Eluna::Push(L, creature->CanStartAttack(target, force));
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, creature->CanStartAttack(target));
|
||||||
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,7 +427,7 @@ namespace LuaCreature
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined(TRINITY) || AZEROTHCORE
|
||||||
/**
|
/**
|
||||||
* Returns the current waypoint path ID of the [Creature].
|
* Returns the current waypoint path ID of the [Creature].
|
||||||
*
|
*
|
||||||
@@ -441,6 +449,8 @@ namespace LuaCreature
|
|||||||
{
|
{
|
||||||
#ifdef TRINITY
|
#ifdef TRINITY
|
||||||
Eluna::Push(L, creature->GetCurrentWaypointInfo().first);
|
Eluna::Push(L, creature->GetCurrentWaypointInfo().first);
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
Eluna::Push(L, creature->GetCurrentWaypointID());
|
||||||
#else
|
#else
|
||||||
Eluna::Push(L, creature->GetMotionMaster()->getLastReachedWaypoint());
|
Eluna::Push(L, creature->GetMotionMaster()->getLastReachedWaypoint());
|
||||||
#endif
|
#endif
|
||||||
@@ -468,16 +478,17 @@ namespace LuaCreature
|
|||||||
{
|
{
|
||||||
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
|
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
|
Eluna::Push(L, creature->GetAggroRange(target));
|
||||||
|
#else
|
||||||
float AttackDist = creature->GetAttackDistance(target);
|
float AttackDist = creature->GetAttackDistance(target);
|
||||||
float ThreatRadius = sWorld.getConfig(CONFIG_FLOAT_THREAT_RADIUS);
|
float ThreatRadius = sWorld.getConfig(CONFIG_FLOAT_THREAT_RADIUS);
|
||||||
Eluna::Push(L, ThreatRadius > AttackDist ? ThreatRadius : AttackDist);
|
Eluna::Push(L, ThreatRadius > AttackDist ? ThreatRadius : AttackDist);
|
||||||
#else
|
|
||||||
Eluna::Push(L, creature->GetAggroRange(target));
|
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
/**
|
/**
|
||||||
* Returns the effective aggro range of the [Creature] for `target`.
|
* Returns the effective aggro range of the [Creature] for `target`.
|
||||||
*
|
*
|
||||||
@@ -494,6 +505,7 @@ namespace LuaCreature
|
|||||||
Eluna::Push(L, creature->GetAttackDistance(target));
|
Eluna::Push(L, creature->GetAttackDistance(target));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the [Group] that can loot this [Creature].
|
* Returns the [Group] that can loot this [Creature].
|
||||||
@@ -502,10 +514,10 @@ namespace LuaCreature
|
|||||||
*/
|
*/
|
||||||
int GetLootRecipientGroup(lua_State* L, Creature* creature)
|
int GetLootRecipientGroup(lua_State* L, Creature* creature)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, creature->GetGroupLootRecipient());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, creature->GetLootRecipientGroup());
|
Eluna::Push(L, creature->GetLootRecipientGroup());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, creature->GetGroupLootRecipient());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -580,6 +592,11 @@ namespace LuaCreature
|
|||||||
Eluna::Push(L, creature->GetSpellHistory()->GetRemainingCooldown(spellInfo));
|
Eluna::Push(L, creature->GetSpellHistory()->GetRemainingCooldown(spellInfo));
|
||||||
else
|
else
|
||||||
Eluna::Push(L, 0);
|
Eluna::Push(L, 0);
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell))
|
||||||
|
Eluna::Push(L, creature->GetSpellCooldown(spell));
|
||||||
|
else
|
||||||
|
Eluna::Push(L, 0);
|
||||||
#else
|
#else
|
||||||
Eluna::Push(L, creature->GetCreatureSpellCooldownDelay(spell));
|
Eluna::Push(L, creature->GetCreatureSpellCooldownDelay(spell));
|
||||||
#endif
|
#endif
|
||||||
@@ -609,10 +626,10 @@ namespace LuaCreature
|
|||||||
int GetHomePosition(lua_State* L, Creature* creature)
|
int GetHomePosition(lua_State* L, Creature* creature)
|
||||||
{
|
{
|
||||||
float x, y, z, o;
|
float x, y, z, o;
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
creature->GetRespawnCoord(x, y, z, &o);
|
|
||||||
#else
|
|
||||||
creature->GetHomePosition(x, y, z, o);
|
creature->GetHomePosition(x, y, z, o);
|
||||||
|
#else
|
||||||
|
creature->GetRespawnCoord(x, y, z, &o);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Eluna::Push(L, x);
|
Eluna::Push(L, x);
|
||||||
@@ -638,10 +655,10 @@ namespace LuaCreature
|
|||||||
float z = Eluna::CHECKVAL<float>(L, 4);
|
float z = Eluna::CHECKVAL<float>(L, 4);
|
||||||
float o = Eluna::CHECKVAL<float>(L, 5);
|
float o = Eluna::CHECKVAL<float>(L, 5);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
creature->SetRespawnCoord(x, y, z, o);
|
|
||||||
#else
|
|
||||||
creature->SetHomePosition(x, y, z, o);
|
creature->SetHomePosition(x, y, z, o);
|
||||||
|
#else
|
||||||
|
creature->SetRespawnCoord(x, y, z, o);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -699,6 +716,10 @@ namespace LuaCreature
|
|||||||
#ifdef TRINITY
|
#ifdef TRINITY
|
||||||
auto const& threatlist = creature->GetThreatManager().GetThreatenedByMeList();
|
auto const& threatlist = creature->GetThreatManager().GetThreatenedByMeList();
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef AZEROTHCORE
|
||||||
|
auto const& threatlist = creature->getThreatManager().getThreatList();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (threatlist.empty())
|
if (threatlist.empty())
|
||||||
return 1;
|
return 1;
|
||||||
if (position >= threatlist.size())
|
if (position >= threatlist.size())
|
||||||
@@ -782,6 +803,8 @@ namespace LuaCreature
|
|||||||
{
|
{
|
||||||
#ifdef TRINITY
|
#ifdef TRINITY
|
||||||
auto const& threatlist = creature->GetThreatManager().GetThreatenedByMeList();
|
auto const& threatlist = creature->GetThreatManager().GetThreatenedByMeList();
|
||||||
|
#elif defined AZEROTHCORE
|
||||||
|
auto const& threatlist = creature->getThreatManager().getThreatList();
|
||||||
#else
|
#else
|
||||||
ThreatList const& threatlist = creature->GetThreatManager().getThreatList();
|
ThreatList const& threatlist = creature->GetThreatManager().getThreatList();
|
||||||
#endif
|
#endif
|
||||||
@@ -814,6 +837,8 @@ namespace LuaCreature
|
|||||||
{
|
{
|
||||||
#ifdef TRINITY
|
#ifdef TRINITY
|
||||||
Eluna::Push(L, creature->GetThreatManager().GetThreatenedByMeList().size());
|
Eluna::Push(L, creature->GetThreatManager().GetThreatenedByMeList().size());
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
Eluna::Push(L, creature->getThreatManager().getThreatList().size());
|
||||||
#else
|
#else
|
||||||
Eluna::Push(L, creature->GetThreatManager().getThreatList().size());
|
Eluna::Push(L, creature->GetThreatManager().getThreatList().size());
|
||||||
#endif
|
#endif
|
||||||
@@ -847,7 +872,7 @@ namespace LuaCreature
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined(TRINITY) || AZEROTHCORE
|
||||||
int GetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features
|
int GetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features
|
||||||
{
|
{
|
||||||
Eluna::Push(L, creature->GetLootMode());
|
Eluna::Push(L, creature->GetLootMode());
|
||||||
@@ -894,7 +919,7 @@ namespace LuaCreature
|
|||||||
{
|
{
|
||||||
bool disable = Eluna::CHECKVAL<bool>(L, 2);
|
bool disable = Eluna::CHECKVAL<bool>(L, 2);
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
creature->SetDisableGravity(disable);
|
creature->SetDisableGravity(disable);
|
||||||
#else
|
#else
|
||||||
creature->SetLevitate(disable);
|
creature->SetLevitate(disable);
|
||||||
@@ -902,7 +927,7 @@ namespace LuaCreature
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
int SetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features
|
int SetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features
|
||||||
{
|
{
|
||||||
uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
|
uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
|
||||||
@@ -921,10 +946,10 @@ namespace LuaCreature
|
|||||||
{
|
{
|
||||||
int32 state = Eluna::CHECKVAL<int32>(L, 2);
|
int32 state = Eluna::CHECKVAL<int32>(L, 2);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
creature->SetDeathState((DeathState)state);
|
|
||||||
#else
|
|
||||||
creature->setDeathState((DeathState)state);
|
creature->setDeathState((DeathState)state);
|
||||||
|
#else
|
||||||
|
creature->SetDeathState((DeathState)state);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -955,7 +980,7 @@ namespace LuaCreature
|
|||||||
uint32 off_hand = Eluna::CHECKVAL<uint32>(L, 3);
|
uint32 off_hand = Eluna::CHECKVAL<uint32>(L, 3);
|
||||||
uint32 ranged = Eluna::CHECKVAL<uint32>(L, 4);
|
uint32 ranged = Eluna::CHECKVAL<uint32>(L, 4);
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, main_hand);
|
creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, main_hand);
|
||||||
creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, off_hand);
|
creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, off_hand);
|
||||||
creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, ranged);
|
creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, ranged);
|
||||||
@@ -976,7 +1001,7 @@ namespace LuaCreature
|
|||||||
{
|
{
|
||||||
bool allow = Eluna::CHECKVAL<bool>(L, 2, true);
|
bool allow = Eluna::CHECKVAL<bool>(L, 2, true);
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
if (allow)
|
if (allow)
|
||||||
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
|
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
|
||||||
else
|
else
|
||||||
@@ -1012,7 +1037,7 @@ namespace LuaCreature
|
|||||||
*/
|
*/
|
||||||
int SetInCombatWithZone(lua_State* /*L*/, Creature* creature)
|
int SetInCombatWithZone(lua_State* /*L*/, Creature* creature)
|
||||||
{
|
{
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
if (creature->IsAIEnabled)
|
if (creature->IsAIEnabled)
|
||||||
creature->AI()->DoZoneInCombat();
|
creature->AI()->DoZoneInCombat();
|
||||||
#else
|
#else
|
||||||
@@ -1095,7 +1120,7 @@ namespace LuaCreature
|
|||||||
{
|
{
|
||||||
bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
|
bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
creature->SetHover(enable);
|
creature->SetHover(enable);
|
||||||
#else
|
#else
|
||||||
// Copy paste from Aura::HandleAuraHover
|
// Copy paste from Aura::HandleAuraHover
|
||||||
@@ -1125,10 +1150,10 @@ namespace LuaCreature
|
|||||||
{
|
{
|
||||||
uint32 msTimeToDespawn = Eluna::CHECKVAL<uint32>(L, 2, 0);
|
uint32 msTimeToDespawn = Eluna::CHECKVAL<uint32>(L, 2, 0);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
creature->ForcedDespawn(msTimeToDespawn);
|
|
||||||
#else
|
|
||||||
creature->DespawnOrUnsummon(msTimeToDespawn);
|
creature->DespawnOrUnsummon(msTimeToDespawn);
|
||||||
|
#else
|
||||||
|
creature->ForcedDespawn(msTimeToDespawn);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1156,10 +1181,10 @@ namespace LuaCreature
|
|||||||
*/
|
*/
|
||||||
int MoveWaypoint(lua_State* /*L*/, Creature* creature)
|
int MoveWaypoint(lua_State* /*L*/, Creature* creature)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
creature->GetMotionMaster()->MoveWaypoint();
|
|
||||||
#else
|
|
||||||
creature->GetMotionMaster()->MovePath(creature->GetWaypointPath(), true);
|
creature->GetMotionMaster()->MovePath(creature->GetWaypointPath(), true);
|
||||||
|
#else
|
||||||
|
creature->GetMotionMaster()->MoveWaypoint();
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1224,10 +1249,10 @@ namespace LuaCreature
|
|||||||
*/
|
*/
|
||||||
int SelectVictim(lua_State* L, Creature* creature)
|
int SelectVictim(lua_State* L, Creature* creature)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, creature->SelectHostileTarget());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, creature->SelectVictim());
|
Eluna::Push(L, creature->SelectVictim());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, creature->SelectHostileTarget());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1243,15 +1268,15 @@ namespace LuaCreature
|
|||||||
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
uint32 dataGuidLow = Eluna::CHECKVAL<uint32>(L, 3, 0);
|
uint32 dataGuidLow = Eluna::CHECKVAL<uint32>(L, 3, 0);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
creature->UpdateEntry(entry, ALLIANCE, dataGuidLow ? eObjectMgr->GetCreatureData(dataGuidLow) : NULL);
|
|
||||||
#else
|
|
||||||
creature->UpdateEntry(entry, dataGuidLow ? eObjectMgr->GetCreatureData(dataGuidLow) : NULL);
|
creature->UpdateEntry(entry, dataGuidLow ? eObjectMgr->GetCreatureData(dataGuidLow) : NULL);
|
||||||
|
#else
|
||||||
|
creature->UpdateEntry(entry, ALLIANCE, dataGuidLow ? eObjectMgr->GetCreatureData(dataGuidLow) : NULL);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
/**
|
/**
|
||||||
* Resets [Creature]'s loot mode to default
|
* Resets [Creature]'s loot mode to default
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -9,11 +9,11 @@
|
|||||||
|
|
||||||
#include "LuaEngine.h"
|
#include "LuaEngine.h"
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
|
struct ScriptedAI;
|
||||||
|
#else
|
||||||
class AggressorAI;
|
class AggressorAI;
|
||||||
typedef AggressorAI ScriptedAI;
|
typedef AggressorAI ScriptedAI;
|
||||||
#else
|
|
||||||
struct ScriptedAI;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct ElunaCreatureAI : ScriptedAI
|
struct ElunaCreatureAI : ScriptedAI
|
||||||
@@ -22,7 +22,7 @@ struct ElunaCreatureAI : ScriptedAI
|
|||||||
bool justSpawned;
|
bool justSpawned;
|
||||||
// used to delay movementinform hook (WP hook)
|
// used to delay movementinform hook (WP hook)
|
||||||
std::vector< std::pair<uint32, uint32> > movepoints;
|
std::vector< std::pair<uint32, uint32> > movepoints;
|
||||||
#ifndef TRINITY
|
#if defined MANGOS || defined CMANGOS
|
||||||
#define me m_creature
|
#define me m_creature
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ struct ElunaCreatureAI : ScriptedAI
|
|||||||
|
|
||||||
if (!sEluna->UpdateAI(me, diff))
|
if (!sEluna->UpdateAI(me, diff))
|
||||||
{
|
{
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC))
|
if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC))
|
||||||
ScriptedAI::UpdateAI(diff);
|
ScriptedAI::UpdateAI(diff);
|
||||||
#else
|
#else
|
||||||
@@ -89,10 +89,20 @@ struct ElunaCreatureAI : ScriptedAI
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Called at any Damage from any attacker (before damage apply)
|
// Called at any Damage from any attacker (before damage apply)
|
||||||
|
#if AZEROTHCORE
|
||||||
|
void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask) override
|
||||||
|
#else
|
||||||
void DamageTaken(Unit* attacker, uint32& damage) override
|
void DamageTaken(Unit* attacker, uint32& damage) override
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (!sEluna->DamageTaken(me, attacker, damage))
|
if (!sEluna->DamageTaken(me, attacker, damage))
|
||||||
|
{
|
||||||
|
#if AZEROTHCORE
|
||||||
|
ScriptedAI::DamageTaken(attacker, damage, damagetype, damageSchoolMask);
|
||||||
|
#else
|
||||||
ScriptedAI::DamageTaken(attacker, damage);
|
ScriptedAI::DamageTaken(attacker, damage);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Called at creature death
|
//Called at creature death
|
||||||
@@ -191,7 +201,7 @@ struct ElunaCreatureAI : ScriptedAI
|
|||||||
ScriptedAI::CorpseRemoved(respawnDelay);
|
ScriptedAI::CorpseRemoved(respawnDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if !defined TRINITY && !AZEROTHCORE
|
||||||
// Enables use of MoveInLineOfSight
|
// Enables use of MoveInLineOfSight
|
||||||
bool IsVisible(Unit* who) const override
|
bool IsVisible(Unit* who) const override
|
||||||
{
|
{
|
||||||
@@ -219,7 +229,7 @@ struct ElunaCreatureAI : ScriptedAI
|
|||||||
ScriptedAI::SpellHitTarget(target, spell);
|
ScriptedAI::SpellHitTarget(target, spell);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
|
|
||||||
// Called when the creature is summoned successfully by other creature
|
// Called when the creature is summoned successfully by other creature
|
||||||
void IsSummonedBy(Unit* summoner) override
|
void IsSummonedBy(Unit* summoner) override
|
||||||
@@ -249,7 +259,7 @@ struct ElunaCreatureAI : ScriptedAI
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined MANGOS || defined CMANGOS
|
||||||
#undef me
|
#undef me
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined(TRINITY) || AZEROTHCORE
|
||||||
#include "Define.h"
|
#include "Define.h"
|
||||||
#else
|
#else
|
||||||
#include "Platform/Define.h"
|
#include "Platform/Define.h"
|
||||||
|
|||||||
@@ -39,7 +39,14 @@
|
|||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY
|
||||||
|
#include "GitRevision.h"
|
||||||
|
#include "SpellHistory.h"
|
||||||
|
#include <boost/thread/locks.hpp>
|
||||||
|
#include <boost/thread/shared_mutex.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined TRINITY || defined AZEROTHCORE
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "GameEventMgr.h"
|
#include "GameEventMgr.h"
|
||||||
#include "GroupMgr.h"
|
#include "GroupMgr.h"
|
||||||
@@ -47,13 +54,9 @@
|
|||||||
#include "SpellInfo.h"
|
#include "SpellInfo.h"
|
||||||
#include "WeatherMgr.h"
|
#include "WeatherMgr.h"
|
||||||
#include "Battleground.h"
|
#include "Battleground.h"
|
||||||
#include "GitRevision.h"
|
|
||||||
#include "SpellHistory.h"
|
|
||||||
#include "MotionMaster.h"
|
#include "MotionMaster.h"
|
||||||
#include "DatabaseEnv.h"
|
#include "DatabaseEnv.h"
|
||||||
#include "Bag.h"
|
#include "Bag.h"
|
||||||
#include <boost/thread/locks.hpp>
|
|
||||||
#include <boost/thread/shared_mutex.hpp>
|
|
||||||
#else
|
#else
|
||||||
#include "Config/Config.h"
|
#include "Config/Config.h"
|
||||||
#ifdef CMANGOS
|
#ifdef CMANGOS
|
||||||
@@ -111,7 +114,21 @@ typedef Opcodes OpcodesList;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TRINITY
|
#ifdef AZEROTHCORE
|
||||||
|
#define CORE_NAME "AzerothCore"
|
||||||
|
#define CORE_VERSION ""
|
||||||
|
#define eWorld (sWorld)
|
||||||
|
#define eMapMgr (sMapMgr)
|
||||||
|
#define eConfigMgr (sConfigMgr)
|
||||||
|
#define eGuildMgr (sGuildMgr)
|
||||||
|
#define eObjectMgr (sObjectMgr)
|
||||||
|
#define eAccountMgr (sAccountMgr)
|
||||||
|
#define eAuctionMgr (sAuctionMgr)
|
||||||
|
#define eGameEventMgr (sGameEventMgr)
|
||||||
|
#define eObjectAccessor() ObjectAccessor::
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined TRINITY && !AZEROTHCORE
|
||||||
#define eWorld (&sWorld)
|
#define eWorld (&sWorld)
|
||||||
#define eMapMgr (&sMapMgr)
|
#define eMapMgr (&sMapMgr)
|
||||||
#define eConfigMgr (&sConfig)
|
#define eConfigMgr (&sConfig)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#define _ELUNA_INSTANCE_DATA_H
|
#define _ELUNA_INSTANCE_DATA_H
|
||||||
|
|
||||||
#include "LuaEngine.h"
|
#include "LuaEngine.h"
|
||||||
#ifdef TRINITY
|
#if defined(TRINITY) || AZEROTHCORE
|
||||||
#include "InstanceScript.h"
|
#include "InstanceScript.h"
|
||||||
#else
|
#else
|
||||||
#include "InstanceData.h"
|
#include "InstanceData.h"
|
||||||
@@ -72,7 +72,7 @@ public:
|
|||||||
* data table to/from the core.
|
* data table to/from the core.
|
||||||
*/
|
*/
|
||||||
void Load(const char* data) override;
|
void Load(const char* data) override;
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
// Simply calls Save, since the functions are a bit different in name and data types on different cores
|
// Simply calls Save, since the functions are a bit different in name and data types on different cores
|
||||||
std::string GetSaveData() override
|
std::string GetSaveData() override
|
||||||
{
|
{
|
||||||
@@ -128,7 +128,7 @@ public:
|
|||||||
sEluna->OnPlayerEnterInstance(this, player);
|
sEluna->OnPlayerEnterInstance(this, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
void OnGameObjectCreate(GameObject* gameobject) override
|
void OnGameObjectCreate(GameObject* gameobject) override
|
||||||
#else
|
#else
|
||||||
void OnObjectCreate(GameObject* gameobject) override
|
void OnObjectCreate(GameObject* gameobject) override
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
#ifndef QUERYMETHODS_H
|
#ifndef QUERYMETHODS_H
|
||||||
#define QUERYMETHODS_H
|
#define QUERYMETHODS_H
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || defined AZEROTHCORE
|
||||||
#define RESULT result
|
|
||||||
#else
|
|
||||||
#define RESULT (*result)
|
#define RESULT (*result)
|
||||||
|
#else
|
||||||
|
#define RESULT result
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***
|
/***
|
||||||
@@ -45,10 +45,10 @@ namespace LuaQuery
|
|||||||
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
CheckFields(L, result);
|
CheckFields(L, result);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, RESULT->Fetch()[col].IsNULL());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, RESULT->Fetch()[col].IsNull());
|
Eluna::Push(L, RESULT->Fetch()[col].IsNull());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, RESULT->Fetch()[col].IsNULL());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -291,13 +291,13 @@ namespace LuaQuery
|
|||||||
lua_createtable(L, 0, col);
|
lua_createtable(L, 0, col);
|
||||||
int tbl = lua_gettop(L);
|
int tbl = lua_gettop(L);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if !defined TRINITY && !AZEROTHCORE
|
||||||
const QueryFieldNames& names = RESULT->GetFieldNames();
|
const QueryFieldNames& names = RESULT->GetFieldNames();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (uint32 i = 0; i < col; ++i)
|
for (uint32 i = 0; i < col; ++i)
|
||||||
{
|
{
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, RESULT->GetFieldName(i));
|
Eluna::Push(L, RESULT->GetFieldName(i));
|
||||||
|
|
||||||
const char* str = row[i].GetCString();
|
const char* str = row[i].GetCString();
|
||||||
@@ -308,12 +308,26 @@ namespace LuaQuery
|
|||||||
// MYSQL_TYPE_LONGLONG Interpreted as string for lua
|
// MYSQL_TYPE_LONGLONG Interpreted as string for lua
|
||||||
switch (row[i].GetType())
|
switch (row[i].GetType())
|
||||||
{
|
{
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
case DatabaseFieldTypes::Int8:
|
case DatabaseFieldTypes::Int8:
|
||||||
case DatabaseFieldTypes::Int16:
|
case DatabaseFieldTypes::Int16:
|
||||||
case DatabaseFieldTypes::Int32:
|
case DatabaseFieldTypes::Int32:
|
||||||
case DatabaseFieldTypes::Int64:
|
case DatabaseFieldTypes::Int64:
|
||||||
case DatabaseFieldTypes::Float:
|
case DatabaseFieldTypes::Float:
|
||||||
case DatabaseFieldTypes::Double:
|
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));
|
Eluna::Push(L, strtod(str, NULL));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
uint32 ElunaUtil::GetCurrTime()
|
uint32 ElunaUtil::GetCurrTime()
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if !defined TRINITY && !AZEROTHCORE
|
||||||
return WorldTimer::getMSTime();
|
return WorldTimer::getMSTime();
|
||||||
#else
|
#else
|
||||||
return getMSTime();
|
return getMSTime();
|
||||||
@@ -22,7 +22,7 @@ uint32 ElunaUtil::GetCurrTime()
|
|||||||
|
|
||||||
uint32 ElunaUtil::GetTimeDiff(uint32 oldMSTime)
|
uint32 ElunaUtil::GetTimeDiff(uint32 oldMSTime)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if !defined TRINITY && !AZEROTHCORE
|
||||||
return WorldTimer::getMSTimeDiff(oldMSTime, GetCurrTime());
|
return WorldTimer::getMSTimeDiff(oldMSTime, GetCurrTime());
|
||||||
#else
|
#else
|
||||||
return GetMSTimeDiffToNow(oldMSTime);
|
return GetMSTimeDiffToNow(oldMSTime);
|
||||||
@@ -90,7 +90,7 @@ bool ElunaUtil::WorldObjectInRangeCheck::operator()(WorldObject* u)
|
|||||||
{
|
{
|
||||||
if (i_obj_fact)
|
if (i_obj_fact)
|
||||||
{
|
{
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
if ((i_obj_fact->IsHostileTo(*target->GetFactionTemplateEntry())) != (i_hostile == 1))
|
if ((i_obj_fact->IsHostileTo(*target->GetFactionTemplateEntry())) != (i_hostile == 1))
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -44,6 +44,12 @@ typedef QueryResult ElunaQuery;
|
|||||||
#define HIGHGUID_MO_TRANSPORT HighGuid::Mo_Transport
|
#define HIGHGUID_MO_TRANSPORT HighGuid::Mo_Transport
|
||||||
#define HIGHGUID_INSTANCE HighGuid::Instance
|
#define HIGHGUID_INSTANCE HighGuid::Instance
|
||||||
#define HIGHGUID_GROUP HighGuid::Group
|
#define HIGHGUID_GROUP HighGuid::Group
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
typedef QueryResult ElunaQuery;
|
||||||
|
#define ELUNA_LOG_INFO(...) sLog->outString(__VA_ARGS__);
|
||||||
|
#define ELUNA_LOG_ERROR(...) sLog->outError(__VA_ARGS__);
|
||||||
|
#define ELUNA_LOG_DEBUG(...) sLog->outDebug(LOG_FILTER_NONE,__VA_ARGS__);
|
||||||
|
#define GET_GUID GetGUID
|
||||||
#else
|
#else
|
||||||
typedef QueryNamedResult ElunaQuery;
|
typedef QueryNamedResult ElunaQuery;
|
||||||
#define ASSERT MANGOS_ASSERT
|
#define ASSERT MANGOS_ASSERT
|
||||||
@@ -56,6 +62,7 @@ typedef QueryNamedResult ElunaQuery;
|
|||||||
#define GetTemplate GetProto
|
#define GetTemplate GetProto
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef TRINITY
|
||||||
#ifndef MAKE_NEW_GUID
|
#ifndef MAKE_NEW_GUID
|
||||||
#define MAKE_NEW_GUID(l, e, h) ObjectGuid(h, e, l)
|
#define MAKE_NEW_GUID(l, e, h) ObjectGuid(h, e, l)
|
||||||
#endif
|
#endif
|
||||||
@@ -68,6 +75,7 @@ typedef QueryNamedResult ElunaQuery;
|
|||||||
#ifndef GUID_HIPART
|
#ifndef GUID_HIPART
|
||||||
#define GUID_HIPART(guid) ObjectGuid(guid).GetHigh()
|
#define GUID_HIPART(guid) ObjectGuid(guid).GetHigh()
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
class Unit;
|
class Unit;
|
||||||
class WorldObject;
|
class WorldObject;
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ namespace LuaGameObject
|
|||||||
{
|
{
|
||||||
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, go->HasQuest(questId));
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, go->hasQuest(questId));
|
Eluna::Push(L, go->hasQuest(questId));
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, go->HasQuest(questId));
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -145,7 +145,7 @@ namespace LuaGameObject
|
|||||||
*/
|
*/
|
||||||
int GetLootRecipientGroup(lua_State* L, GameObject* go)
|
int GetLootRecipientGroup(lua_State* L, GameObject* go)
|
||||||
{
|
{
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, go->GetLootRecipientGroup());
|
Eluna::Push(L, go->GetLootRecipientGroup());
|
||||||
#else
|
#else
|
||||||
Eluna::Push(L, go->GetGroupLootRecipient());
|
Eluna::Push(L, go->GetGroupLootRecipient());
|
||||||
@@ -162,6 +162,8 @@ namespace LuaGameObject
|
|||||||
{
|
{
|
||||||
#ifdef TRINITY
|
#ifdef TRINITY
|
||||||
Eluna::Push(L, go->GetSpawnId());
|
Eluna::Push(L, go->GetSpawnId());
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
Eluna::Push(L, go->GetDBTableGUIDLow());
|
||||||
#else
|
#else
|
||||||
// on mangos based this is same as lowguid
|
// on mangos based this is same as lowguid
|
||||||
Eluna::Push(L, go->GetGUIDLow());
|
Eluna::Push(L, go->GetGUIDLow());
|
||||||
@@ -251,7 +253,7 @@ namespace LuaGameObject
|
|||||||
bool deldb = Eluna::CHECKVAL<bool>(L, 2, false);
|
bool deldb = Eluna::CHECKVAL<bool>(L, 2, false);
|
||||||
|
|
||||||
// cs_gobject.cpp copy paste
|
// cs_gobject.cpp copy paste
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
ObjectGuid ownerGuid = go->GetOwnerGUID();
|
ObjectGuid ownerGuid = go->GetOwnerGUID();
|
||||||
#else
|
#else
|
||||||
ObjectGuid ownerGuid = go->GetOwnerGuid();
|
ObjectGuid ownerGuid = go->GetOwnerGuid();
|
||||||
|
|||||||
@@ -171,6 +171,8 @@ namespace LuaGlobalFunctions
|
|||||||
{
|
{
|
||||||
#ifdef TRINITY
|
#ifdef TRINITY
|
||||||
boost::shared_lock<boost::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
|
boost::shared_lock<boost::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
TRINITY_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
|
||||||
#else
|
#else
|
||||||
HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock());
|
HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock());
|
||||||
#endif
|
#endif
|
||||||
@@ -181,10 +183,10 @@ namespace LuaGlobalFunctions
|
|||||||
{
|
{
|
||||||
if (!player->IsInWorld())
|
if (!player->IsInWorld())
|
||||||
continue;
|
continue;
|
||||||
#ifndef TRINITY
|
#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()))
|
if ((team == TEAM_NEUTRAL || player->GetTeamId() == team) && (!onlyGM || player->IsGameMaster()))
|
||||||
|
#else
|
||||||
|
if ((team == TEAM_NEUTRAL || player->GetTeamId() == team) && (!onlyGM || player->isGameMaster()))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
Eluna::Push(L, player);
|
Eluna::Push(L, player);
|
||||||
@@ -456,7 +458,7 @@ namespace LuaGlobalFunctions
|
|||||||
if (locale >= TOTAL_LOCALES)
|
if (locale >= TOTAL_LOCALES)
|
||||||
return luaL_argerror(L, 2, "valid LocaleConstant expected");
|
return luaL_argerror(L, 2, "valid LocaleConstant expected");
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaOrZoneId);
|
AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaOrZoneId);
|
||||||
#else
|
#else
|
||||||
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaOrZoneId);
|
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaOrZoneId);
|
||||||
@@ -1208,7 +1210,7 @@ namespace LuaGlobalFunctions
|
|||||||
{
|
{
|
||||||
const char* query = Eluna::CHECKVAL<const char*>(L, 1);
|
const char* query = Eluna::CHECKVAL<const char*>(L, 1);
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
ElunaQuery result = WorldDatabase.Query(query);
|
ElunaQuery result = WorldDatabase.Query(query);
|
||||||
if (result)
|
if (result)
|
||||||
Eluna::Push(L, new ElunaQuery(result));
|
Eluna::Push(L, new ElunaQuery(result));
|
||||||
@@ -1259,7 +1261,7 @@ namespace LuaGlobalFunctions
|
|||||||
{
|
{
|
||||||
const char* query = Eluna::CHECKVAL<const char*>(L, 1);
|
const char* query = Eluna::CHECKVAL<const char*>(L, 1);
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
QueryResult result = CharacterDatabase.Query(query);
|
QueryResult result = CharacterDatabase.Query(query);
|
||||||
if (result)
|
if (result)
|
||||||
Eluna::Push(L, new QueryResult(result));
|
Eluna::Push(L, new QueryResult(result));
|
||||||
@@ -1310,7 +1312,7 @@ namespace LuaGlobalFunctions
|
|||||||
{
|
{
|
||||||
const char* query = Eluna::CHECKVAL<const char*>(L, 1);
|
const char* query = Eluna::CHECKVAL<const char*>(L, 1);
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
QueryResult result = LoginDatabase.Query(query);
|
QueryResult result = LoginDatabase.Query(query);
|
||||||
if (result)
|
if (result)
|
||||||
Eluna::Push(L, new QueryResult(result));
|
Eluna::Push(L, new QueryResult(result));
|
||||||
@@ -1468,7 +1470,7 @@ namespace LuaGlobalFunctions
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if !defined TRINITY && !AZEROTHCORE
|
||||||
Map* map = eMapMgr->FindMap(mapID, instanceID);
|
Map* map = eMapMgr->FindMap(mapID, instanceID);
|
||||||
if (!map)
|
if (!map)
|
||||||
{
|
{
|
||||||
@@ -1668,7 +1670,11 @@ namespace LuaGlobalFunctions
|
|||||||
if (save)
|
if (save)
|
||||||
{
|
{
|
||||||
Creature* creature = new Creature();
|
Creature* creature = new Creature();
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
if (!creature->Create(map->GenerateLowGuid<HighGuid::Unit>(), map, phase, entry, pos))
|
if (!creature->Create(map->GenerateLowGuid<HighGuid::Unit>(), map, phase, entry, pos))
|
||||||
|
#else
|
||||||
|
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, phase, entry, 0, x, y, z, o))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
delete creature;
|
delete creature;
|
||||||
Eluna::Push(L);
|
Eluna::Push(L);
|
||||||
@@ -1677,14 +1683,21 @@ namespace LuaGlobalFunctions
|
|||||||
|
|
||||||
creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), phase);
|
creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), phase);
|
||||||
|
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
uint32 db_guid = creature->GetSpawnId();
|
uint32 db_guid = creature->GetSpawnId();
|
||||||
|
#else
|
||||||
|
uint32 db_guid = creature->GetDBTableGUIDLow();
|
||||||
|
#endif
|
||||||
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells()
|
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells()
|
||||||
// current "creature" variable is deleted and created fresh new, otherwise old values might trigger asserts or cause undefined behavior
|
// current "creature" variable is deleted and created fresh new, otherwise old values might trigger asserts or cause undefined behavior
|
||||||
creature->CleanupsBeforeDelete();
|
creature->CleanupsBeforeDelete();
|
||||||
delete creature;
|
delete creature;
|
||||||
creature = new Creature();
|
creature = new Creature();
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
if (!creature->LoadFromDB(db_guid, map, true, true))
|
if (!creature->LoadFromDB(db_guid, map, true, true))
|
||||||
|
#else
|
||||||
|
if (!creature->LoadFromDB(db_guid, map))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
delete creature;
|
delete creature;
|
||||||
Eluna::Push(L);
|
Eluna::Push(L);
|
||||||
@@ -1730,10 +1743,14 @@ namespace LuaGlobalFunctions
|
|||||||
}
|
}
|
||||||
|
|
||||||
GameObject* object = new GameObject;
|
GameObject* object = new GameObject;
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
uint32 guidLow = map->GenerateLowGuid<HighGuid::GameObject>();
|
uint32 guidLow = map->GenerateLowGuid<HighGuid::GameObject>();
|
||||||
|
|
||||||
QuaternionData rot = QuaternionData::fromEulerAnglesZYX(o, 0.f, 0.f);
|
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))
|
if (!object->Create(guidLow, objectInfo->entry, map, phase, Position(x, y, z, o), rot, 0, GO_STATE_READY))
|
||||||
|
#else
|
||||||
|
uint32 guidLow = sObjectMgr->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;
|
delete object;
|
||||||
Eluna::Push(L);
|
Eluna::Push(L);
|
||||||
@@ -1747,7 +1764,11 @@ namespace LuaGlobalFunctions
|
|||||||
{
|
{
|
||||||
// fill the gameobject data and save to the db
|
// fill the gameobject data and save to the db
|
||||||
object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), phase);
|
object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), phase);
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
guidLow = object->GetSpawnId();
|
guidLow = object->GetSpawnId();
|
||||||
|
#else
|
||||||
|
guidLow = object->GetDBTableGUIDLow();
|
||||||
|
#endif
|
||||||
|
|
||||||
// delete the old object and do a clean load from DB with a fresh new GameObject instance.
|
// delete the old object and do a clean load from DB with a fresh new GameObject instance.
|
||||||
// this is required to avoid weird behavior and memory leaks
|
// this is required to avoid weird behavior and memory leaks
|
||||||
@@ -1755,14 +1776,21 @@ namespace LuaGlobalFunctions
|
|||||||
|
|
||||||
object = new GameObject();
|
object = new GameObject();
|
||||||
// this will generate a new lowguid if the object is in an instance
|
// this will generate a new lowguid if the object is in an instance
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
if (!object->LoadFromDB(guidLow, map, true))
|
if (!object->LoadFromDB(guidLow, map, true))
|
||||||
|
#else
|
||||||
|
if (!object->LoadFromDB(guidLow, map))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
delete object;
|
delete object;
|
||||||
Eluna::Push(L);
|
Eluna::Push(L);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
eObjectMgr->AddGameobjectToGrid(guidLow, eObjectMgr->GetGameObjectData(guidLow));
|
eObjectMgr->AddGameobjectToGrid(guidLow, eObjectMgr->GetGameObjectData(guidLow));
|
||||||
|
#else
|
||||||
|
eObjectMgr->AddGameobjectToGrid(guidLow, eObjectMgr->GetGOData(guidLow));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
map->AddToMap(object);
|
map->AddToMap(object);
|
||||||
@@ -1809,15 +1837,7 @@ namespace LuaGlobalFunctions
|
|||||||
uint32 incrtime = Eluna::CHECKVAL<uint32>(L, 4);
|
uint32 incrtime = Eluna::CHECKVAL<uint32>(L, 4);
|
||||||
uint32 extendedcost = Eluna::CHECKVAL<uint32>(L, 5);
|
uint32 extendedcost = Eluna::CHECKVAL<uint32>(L, 5);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
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
|
|
||||||
#else
|
|
||||||
#ifdef CATA
|
#ifdef CATA
|
||||||
if (!eObjectMgr->IsVendorItemValid(entry, item, maxcount, incrtime, extendedcost, 1))
|
if (!eObjectMgr->IsVendorItemValid(entry, item, maxcount, incrtime, extendedcost, 1))
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1827,7 +1847,15 @@ namespace LuaGlobalFunctions
|
|||||||
return 0;
|
return 0;
|
||||||
eObjectMgr->AddVendorItem(entry, item, maxcount, incrtime, extendedcost);
|
eObjectMgr->AddVendorItem(entry, item, maxcount, incrtime, extendedcost);
|
||||||
#endif
|
#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
|
||||||
|
#endif//TRINITY
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1938,7 +1966,11 @@ namespace LuaGlobalFunctions
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
eWorld->BanAccount((BanMode)banMode, nameOrIP, duration, reason, whoBanned);
|
eWorld->BanAccount((BanMode)banMode, nameOrIP, duration, reason, whoBanned);
|
||||||
|
#else
|
||||||
|
eWorld->BanAccount((BanMode)banMode, nameOrIP, std::to_string(duration) + "s", reason, whoBanned);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1995,7 +2027,7 @@ namespace LuaGlobalFunctions
|
|||||||
MailSender sender(MAIL_NORMAL, senderGUIDLow, (MailStationery)stationary);
|
MailSender sender(MAIL_NORMAL, senderGUIDLow, (MailStationery)stationary);
|
||||||
MailDraft draft(subject, text);
|
MailDraft draft(subject, text);
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
if (cod)
|
if (cod)
|
||||||
draft.AddCOD(cod);
|
draft.AddCOD(cod);
|
||||||
if (money)
|
if (money)
|
||||||
@@ -2007,7 +2039,7 @@ namespace LuaGlobalFunctions
|
|||||||
draft.SetMoney(money);
|
draft.SetMoney(money);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||||
#endif
|
#endif
|
||||||
uint8 addedItems = 0;
|
uint8 addedItems = 0;
|
||||||
@@ -2016,10 +2048,10 @@ namespace LuaGlobalFunctions
|
|||||||
uint32 entry = Eluna::CHECKVAL<uint32>(L, ++i);
|
uint32 entry = Eluna::CHECKVAL<uint32>(L, ++i);
|
||||||
uint32 amount = Eluna::CHECKVAL<uint32>(L, ++i);
|
uint32 amount = Eluna::CHECKVAL<uint32>(L, ++i);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
ItemTemplate const* item_proto = ObjectMgr::GetItemPrototype(entry);
|
|
||||||
#else
|
|
||||||
ItemTemplate const* item_proto = eObjectMgr->GetItemTemplate(entry);
|
ItemTemplate const* item_proto = eObjectMgr->GetItemTemplate(entry);
|
||||||
|
#else
|
||||||
|
ItemTemplate const* item_proto = ObjectMgr::GetItemPrototype(entry);
|
||||||
#endif
|
#endif
|
||||||
if (!item_proto)
|
if (!item_proto)
|
||||||
{
|
{
|
||||||
@@ -2033,21 +2065,21 @@ namespace LuaGlobalFunctions
|
|||||||
}
|
}
|
||||||
if (Item* item = Item::CreateItem(entry, amount))
|
if (Item* item = Item::CreateItem(entry, amount))
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
item->SaveToDB();
|
|
||||||
#else
|
|
||||||
item->SaveToDB(trans);
|
item->SaveToDB(trans);
|
||||||
|
#else
|
||||||
|
item->SaveToDB();
|
||||||
#endif
|
#endif
|
||||||
draft.AddItem(item);
|
draft.AddItem(item);
|
||||||
++addedItems;
|
++addedItems;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
draft.SendMailTo(MailReceiver(MAKE_NEW_GUID(receiverGUIDLow, 0, HIGHGUID_PLAYER)), sender);
|
|
||||||
#else
|
|
||||||
draft.SendMailTo(trans, MailReceiver(receiverGUIDLow), sender, MAIL_CHECK_MASK_NONE, delay);
|
draft.SendMailTo(trans, MailReceiver(receiverGUIDLow), sender, MAIL_CHECK_MASK_NONE, delay);
|
||||||
CharacterDatabase.CommitTransaction(trans);
|
CharacterDatabase.CommitTransaction(trans);
|
||||||
|
#else
|
||||||
|
draft.SendMailTo(MailReceiver(MAKE_NEW_GUID(receiverGUIDLow, 0, HIGHGUID_PLAYER)), sender);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2276,7 +2308,11 @@ namespace LuaGlobalFunctions
|
|||||||
nodeEntry->MountCreatureID[0] = mountH;
|
nodeEntry->MountCreatureID[0] = mountH;
|
||||||
nodeEntry->MountCreatureID[1] = mountA;
|
nodeEntry->MountCreatureID[1] = mountA;
|
||||||
sTaxiNodesStore.SetEntry(nodeId++, nodeEntry);
|
sTaxiNodesStore.SetEntry(nodeId++, nodeEntry);
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
sTaxiPathNodesByPath[pathId].set(index++, new TaxiPathNodeEntry(entry));
|
sTaxiPathNodesByPath[pathId].set(index++, new TaxiPathNodeEntry(entry));
|
||||||
|
#else
|
||||||
|
sTaxiPathNodesByPath[pathId][index++] = new TaxiPathNodeEntry(entry);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (startNode >= nodeId)
|
if (startNode >= nodeId)
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ namespace LuaGroup
|
|||||||
if (Group* invitedgroup = player->GetGroupInvite())
|
if (Group* invitedgroup = player->GetGroupInvite())
|
||||||
player->UninviteFromGroup();
|
player->UninviteFromGroup();
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
bool success = group->AddMember(player);
|
bool success = group->AddMember(player);
|
||||||
if (success)
|
if (success)
|
||||||
group->BroadcastGroupUpdate();
|
group->BroadcastGroupUpdate();
|
||||||
@@ -175,10 +175,10 @@ namespace LuaGroup
|
|||||||
|
|
||||||
for (GroupReference* itr = group->GetFirstMember(); itr; itr = itr->next())
|
for (GroupReference* itr = group->GetFirstMember(); itr; itr = itr->next())
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Player* member = itr->getSource();
|
|
||||||
#else
|
|
||||||
Player* member = itr->GetSource();
|
Player* member = itr->GetSource();
|
||||||
|
#else
|
||||||
|
Player* member = itr->getSource();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!member || !member->GetSession())
|
if (!member || !member->GetSession())
|
||||||
@@ -199,10 +199,10 @@ namespace LuaGroup
|
|||||||
*/
|
*/
|
||||||
int GetLeaderGUID(lua_State* L, Group* group)
|
int GetLeaderGUID(lua_State* L, Group* group)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, group->GetLeaderGuid());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, group->GetLeaderGUID());
|
Eluna::Push(L, group->GetLeaderGUID());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, group->GetLeaderGuid());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -231,10 +231,10 @@ namespace LuaGroup
|
|||||||
int GetMemberGUID(lua_State* L, Group* group)
|
int GetMemberGUID(lua_State* L, Group* group)
|
||||||
{
|
{
|
||||||
const char* name = Eluna::CHECKVAL<const char*>(L, 2);
|
const char* name = Eluna::CHECKVAL<const char*>(L, 2);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, group->GetMemberGuid(name));
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, group->GetMemberGUID(name));
|
Eluna::Push(L, group->GetMemberGUID(name));
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, group->GetMemberGuid(name));
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -319,10 +319,10 @@ namespace LuaGroup
|
|||||||
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
|
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
|
||||||
uint32 method = Eluna::CHECKVAL<uint32>(L, 3, 0);
|
uint32 method = Eluna::CHECKVAL<uint32>(L, 3, 0);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, group->RemoveMember(ObjectGuid(guid), method));
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, group->RemoveMember(ObjectGuid(guid), (RemoveMethod)method));
|
Eluna::Push(L, group->RemoveMember(ObjectGuid(guid), (RemoveMethod)method));
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, group->RemoveMember(ObjectGuid(guid), method));
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -401,4 +401,5 @@ namespace LuaGroup
|
|||||||
return 0;
|
return 0;
|
||||||
}*/
|
}*/
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ namespace LuaGuild
|
|||||||
{
|
{
|
||||||
#ifdef TRINITY
|
#ifdef TRINITY
|
||||||
boost::shared_lock<boost::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
|
boost::shared_lock<boost::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
TRINITY_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
|
||||||
#else
|
#else
|
||||||
HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock());
|
HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock());
|
||||||
#endif
|
#endif
|
||||||
@@ -66,7 +68,7 @@ namespace LuaGuild
|
|||||||
*/
|
*/
|
||||||
int GetMemberCount(lua_State* L, Guild* guild)
|
int GetMemberCount(lua_State* L, Guild* guild)
|
||||||
{
|
{
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, guild->GetMemberCount());
|
Eluna::Push(L, guild->GetMemberCount());
|
||||||
#else
|
#else
|
||||||
Eluna::Push(L, guild->GetMemberSize());
|
Eluna::Push(L, guild->GetMemberSize());
|
||||||
@@ -81,10 +83,10 @@ namespace LuaGuild
|
|||||||
*/
|
*/
|
||||||
int GetLeader(lua_State* L, Guild* guild)
|
int GetLeader(lua_State* L, Guild* guild)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, eObjectAccessor()FindPlayer(guild->GetLeaderGuid()));
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, eObjectAccessor()FindPlayer(guild->GetLeaderGUID()));
|
Eluna::Push(L, eObjectAccessor()FindPlayer(guild->GetLeaderGUID()));
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, eObjectAccessor()FindPlayer(guild->GetLeaderGuid()));
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -96,10 +98,10 @@ namespace LuaGuild
|
|||||||
*/
|
*/
|
||||||
int GetLeaderGUID(lua_State* L, Guild* guild)
|
int GetLeaderGUID(lua_State* L, Guild* guild)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, guild->GetLeaderGuid());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, guild->GetLeaderGUID());
|
Eluna::Push(L, guild->GetLeaderGUID());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, guild->GetLeaderGuid());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -144,10 +146,10 @@ namespace LuaGuild
|
|||||||
*/
|
*/
|
||||||
int GetInfo(lua_State* L, Guild* guild)
|
int GetInfo(lua_State* L, Guild* guild)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, guild->GetGINFO());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, guild->GetInfo());
|
Eluna::Push(L, guild->GetInfo());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, guild->GetGINFO());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -162,10 +164,10 @@ namespace LuaGuild
|
|||||||
{
|
{
|
||||||
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
|
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
guild->SetLeader(player->GET_GUID());
|
|
||||||
#else
|
|
||||||
guild->HandleSetLeader(player->GetSession(), player->GetName());
|
guild->HandleSetLeader(player->GetSession(), player->GetName());
|
||||||
|
#else
|
||||||
|
guild->SetLeader(player->GET_GUID());
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -182,10 +184,10 @@ namespace LuaGuild
|
|||||||
{
|
{
|
||||||
uint8 tabId = Eluna::CHECKVAL<uint8>(L, 2);
|
uint8 tabId = Eluna::CHECKVAL<uint8>(L, 2);
|
||||||
const char* text = Eluna::CHECKVAL<const char*>(L, 3);
|
const char* text = Eluna::CHECKVAL<const char*>(L, 3);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
guild->SetGuildBankTabText(tabId, text);
|
|
||||||
#else
|
|
||||||
guild->SetBankTabText(tabId, text);
|
guild->SetBankTabText(tabId, text);
|
||||||
|
#else
|
||||||
|
guild->SetGuildBankTabText(tabId, text);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -271,7 +273,7 @@ namespace LuaGuild
|
|||||||
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
|
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
|
||||||
bool isDisbanding = Eluna::CHECKVAL<bool>(L, 3, false);
|
bool isDisbanding = Eluna::CHECKVAL<bool>(L, 3, false);
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
SQLTransaction trans(nullptr);
|
SQLTransaction trans(nullptr);
|
||||||
guild->DeleteMember(trans, player->GET_GUID(), isDisbanding);
|
guild->DeleteMember(trans, player->GET_GUID(), isDisbanding);
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -79,18 +79,7 @@ bool Eluna::OnItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targ
|
|||||||
START_HOOK_WITH_RETVAL(ITEM_EVENT_ON_USE, pItem->GetEntry(), true);
|
START_HOOK_WITH_RETVAL(ITEM_EVENT_ON_USE, pItem->GetEntry(), true);
|
||||||
Push(pPlayer);
|
Push(pPlayer);
|
||||||
Push(pItem);
|
Push(pItem);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
if (GameObject* target = targets.getGOTarget())
|
|
||||||
Push(target);
|
|
||||||
else if (Item* target = targets.getItemTarget())
|
|
||||||
Push(target);
|
|
||||||
else if (Corpse* target = pPlayer->GetMap()->GetCorpse(targets.getCorpseTargetGuid()))
|
|
||||||
Push(target);
|
|
||||||
else if (Unit* target = targets.getUnitTarget())
|
|
||||||
Push(target);
|
|
||||||
else
|
|
||||||
Push();
|
|
||||||
#else
|
|
||||||
if (GameObject* target = targets.GetGOTarget())
|
if (GameObject* target = targets.GetGOTarget())
|
||||||
Push(target);
|
Push(target);
|
||||||
else if (Item* target = targets.GetItemTarget())
|
else if (Item* target = targets.GetItemTarget())
|
||||||
@@ -103,6 +92,17 @@ bool Eluna::OnItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targ
|
|||||||
Push(target);
|
Push(target);
|
||||||
else
|
else
|
||||||
Push();
|
Push();
|
||||||
|
#else
|
||||||
|
if (GameObject* target = targets.getGOTarget())
|
||||||
|
Push(target);
|
||||||
|
else if (Item* target = targets.getItemTarget())
|
||||||
|
Push(target);
|
||||||
|
else if (Corpse* target = pPlayer->GetMap()->GetCorpse(targets.getCorpseTargetGuid()))
|
||||||
|
Push(target);
|
||||||
|
else if (Unit* target = targets.getUnitTarget())
|
||||||
|
Push(target);
|
||||||
|
else
|
||||||
|
Push();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return CallAllFunctionsBool(ItemEventBindings, key, true);
|
return CallAllFunctionsBool(ItemEventBindings, key, true);
|
||||||
|
|||||||
@@ -176,10 +176,10 @@ namespace LuaItem
|
|||||||
int HasQuest(lua_State* L, Item* item)
|
int HasQuest(lua_State* L, Item* item)
|
||||||
{
|
{
|
||||||
uint32 quest = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 quest = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, item->HasQuest(quest));
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, item->hasQuest(quest));
|
Eluna::Push(L, item->hasQuest(quest));
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, item->HasQuest(quest));
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -315,10 +315,10 @@ namespace LuaItem
|
|||||||
|
|
||||||
int GetOwnerGUID(lua_State* L, Item* item)
|
int GetOwnerGUID(lua_State* L, Item* item)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, item->GetOwnerGuid());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, item->GetOwnerGUID());
|
Eluna::Push(L, item->GetOwnerGUID());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, item->GetOwnerGuid());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -630,10 +630,10 @@ namespace LuaItem
|
|||||||
int SetOwner(lua_State* L, Item* item)
|
int SetOwner(lua_State* L, Item* item)
|
||||||
{
|
{
|
||||||
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
|
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
item->SetOwnerGuid(player->GET_GUID());
|
|
||||||
#else
|
|
||||||
item->SetOwnerGUID(player->GET_GUID());
|
item->SetOwnerGUID(player->GET_GUID());
|
||||||
|
#else
|
||||||
|
item->SetOwnerGuid(player->GET_GUID());
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -736,11 +736,11 @@ namespace LuaItem
|
|||||||
*/
|
*/
|
||||||
int SaveToDB(lua_State* /*L*/, Item* item)
|
int SaveToDB(lua_State* /*L*/, Item* item)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
item->SaveToDB();
|
|
||||||
#else
|
|
||||||
SQLTransaction trans = SQLTransaction(NULL);
|
SQLTransaction trans = SQLTransaction(NULL);
|
||||||
item->SaveToDB(trans);
|
item->SaveToDB(trans);
|
||||||
|
#else
|
||||||
|
item->SaveToDB();
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
// Some dummy includes containing BOOST_VERSION:
|
// Some dummy includes containing BOOST_VERSION:
|
||||||
// ObjectAccessor.h Config.h Log.h
|
// ObjectAccessor.h Config.h Log.h
|
||||||
#ifndef MANGOS
|
#if !defined MANGOS && !defined AZEROTHCORE
|
||||||
#define USING_BOOST
|
#define USING_BOOST
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ void Eluna::Initialize()
|
|||||||
LOCK_ELUNA;
|
LOCK_ELUNA;
|
||||||
ASSERT(!IsInitialized());
|
ASSERT(!IsInitialized());
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
// For instance data the data column needs to be able to hold more than 255 characters (tinytext)
|
// For instance data the data column needs to be able to hold more than 255 characters (tinytext)
|
||||||
// so we change it to TEXT automatically on startup
|
// so we change it to TEXT automatically on startup
|
||||||
CharacterDatabase.DirectExecute("ALTER TABLE `instance` CHANGE COLUMN `data` `data` TEXT NOT NULL");
|
CharacterDatabase.DirectExecute("ALTER TABLE `instance` CHANGE COLUMN `data` `data` TEXT NOT NULL");
|
||||||
@@ -519,7 +519,11 @@ void Eluna::RunScripts()
|
|||||||
void Eluna::InvalidateObjects()
|
void Eluna::InvalidateObjects()
|
||||||
{
|
{
|
||||||
++callstackid;
|
++callstackid;
|
||||||
|
#ifdef AZEROTHCORE
|
||||||
|
ASSERT(callstackid && "Callstackid overflow");
|
||||||
|
#else
|
||||||
ASSERT(callstackid, "Callstackid overflow");
|
ASSERT(callstackid, "Callstackid overflow");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Eluna::Report(lua_State* _L)
|
void Eluna::Report(lua_State* _L)
|
||||||
|
|||||||
27
LuaEngine.h
27
LuaEngine.h
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
#include "Item.h"
|
#include "Item.h"
|
||||||
#ifndef TRINITY
|
#if defined(TRINITY) || AZEROTHCORE
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#endif
|
#endif
|
||||||
#include "Weather.h"
|
#include "Weather.h"
|
||||||
@@ -28,7 +28,7 @@ extern "C"
|
|||||||
#include "lua.h"
|
#include "lua.h"
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined(TRINITY) || AZEROTHCORE
|
||||||
struct ItemTemplate;
|
struct ItemTemplate;
|
||||||
typedef BattlegroundTypeId BattleGroundTypeId;
|
typedef BattlegroundTypeId BattleGroundTypeId;
|
||||||
#else
|
#else
|
||||||
@@ -41,11 +41,14 @@ typedef SpellEntry SpellInfo;
|
|||||||
typedef int Difficulty;
|
typedef int Difficulty;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
struct AreaTriggerEntry;
|
struct AreaTriggerEntry;
|
||||||
|
#else
|
||||||
|
typedef AreaTrigger AreaTriggerEntry;
|
||||||
|
#endif
|
||||||
class AuctionHouseObject;
|
class AuctionHouseObject;
|
||||||
struct AuctionEntry;
|
struct AuctionEntry;
|
||||||
#ifdef TRINITY
|
#if defined(TRINITY) || AZEROTHCORE
|
||||||
class Battleground;
|
class Battleground;
|
||||||
typedef Battleground BattleGround;
|
typedef Battleground BattleGround;
|
||||||
#endif
|
#endif
|
||||||
@@ -54,12 +57,12 @@ class Corpse;
|
|||||||
class Creature;
|
class Creature;
|
||||||
class CreatureAI;
|
class CreatureAI;
|
||||||
class GameObject;
|
class GameObject;
|
||||||
#ifdef TRINITY
|
#if defined(TRINITY) || AZEROTHCORE
|
||||||
class GameObjectAI;
|
class GameObjectAI;
|
||||||
#endif
|
#endif
|
||||||
class Guild;
|
class Guild;
|
||||||
class Group;
|
class Group;
|
||||||
#ifdef TRINITY
|
#if defined(TRINITY) || AZEROTHCORE
|
||||||
class InstanceScript;
|
class InstanceScript;
|
||||||
typedef InstanceScript InstanceData;
|
typedef InstanceScript InstanceData;
|
||||||
#else
|
#else
|
||||||
@@ -72,7 +75,7 @@ class Player;
|
|||||||
class Quest;
|
class Quest;
|
||||||
class Spell;
|
class Spell;
|
||||||
class SpellCastTargets;
|
class SpellCastTargets;
|
||||||
#ifdef TRINITY
|
#if defined(TRINITY) || AZEROTHCORE
|
||||||
class TempSummon;
|
class TempSummon;
|
||||||
#else
|
#else
|
||||||
class TemporarySummon;
|
class TemporarySummon;
|
||||||
@@ -84,7 +87,7 @@ class Weather;
|
|||||||
class WorldPacket;
|
class WorldPacket;
|
||||||
#ifndef CLASSIC
|
#ifndef CLASSIC
|
||||||
#ifndef TBC
|
#ifndef TBC
|
||||||
#ifdef TRINITY
|
#if defined(TRINITY) || AZEROTHCORE
|
||||||
class Vehicle;
|
class Vehicle;
|
||||||
#else
|
#else
|
||||||
class VehicleInfo;
|
class VehicleInfo;
|
||||||
@@ -526,7 +529,11 @@ public:
|
|||||||
|
|
||||||
/* World */
|
/* World */
|
||||||
void OnOpenStateChange(bool open);
|
void OnOpenStateChange(bool open);
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
void OnConfigLoad(bool reload);
|
void OnConfigLoad(bool reload);
|
||||||
|
#else
|
||||||
|
void OnConfigLoad(bool reload, bool isBefore);
|
||||||
|
#endif
|
||||||
void OnShutdownInitiate(ShutdownExitCode code, ShutdownMask mask);
|
void OnShutdownInitiate(ShutdownExitCode code, ShutdownMask mask);
|
||||||
void OnShutdownCancel();
|
void OnShutdownCancel();
|
||||||
void OnStartup();
|
void OnStartup();
|
||||||
@@ -536,7 +543,11 @@ public:
|
|||||||
|
|
||||||
/* Battle Ground */
|
/* Battle Ground */
|
||||||
void OnBGStart(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId);
|
void OnBGStart(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId);
|
||||||
|
#if AZEROTHCORE
|
||||||
|
void OnBGEnd(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId, TeamId winner);
|
||||||
|
#else
|
||||||
void OnBGEnd(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId, Team winner);
|
void OnBGEnd(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId, Team winner);
|
||||||
|
#endif
|
||||||
void OnBGCreate(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId);
|
void OnBGCreate(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId);
|
||||||
void OnBGDestroy(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId);
|
void OnBGDestroy(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -502,7 +502,7 @@ ElunaRegister<Player> PlayerMethods[] =
|
|||||||
{ "GetNextRandomRaidMember", &LuaPlayer::GetNextRandomRaidMember },
|
{ "GetNextRandomRaidMember", &LuaPlayer::GetNextRandomRaidMember },
|
||||||
{ "GetOriginalGroup", &LuaPlayer::GetOriginalGroup },
|
{ "GetOriginalGroup", &LuaPlayer::GetOriginalGroup },
|
||||||
{ "GetOriginalSubGroup", &LuaPlayer::GetOriginalSubGroup },
|
{ "GetOriginalSubGroup", &LuaPlayer::GetOriginalSubGroup },
|
||||||
#ifdef TRINITY
|
#if defined(TRINITY) || AZEROTHCORE
|
||||||
{ "GetChampioningFaction", &LuaPlayer::GetChampioningFaction },
|
{ "GetChampioningFaction", &LuaPlayer::GetChampioningFaction },
|
||||||
#endif
|
#endif
|
||||||
{ "GetLatency", &LuaPlayer::GetLatency },
|
{ "GetLatency", &LuaPlayer::GetLatency },
|
||||||
@@ -561,7 +561,7 @@ ElunaRegister<Player> PlayerMethods[] =
|
|||||||
{ "SetPlayerLock", &LuaPlayer::SetPlayerLock },
|
{ "SetPlayerLock", &LuaPlayer::SetPlayerLock },
|
||||||
{ "SetGender", &LuaPlayer::SetGender },
|
{ "SetGender", &LuaPlayer::SetGender },
|
||||||
{ "SetSheath", &LuaPlayer::SetSheath },
|
{ "SetSheath", &LuaPlayer::SetSheath },
|
||||||
#ifndef TRINITY
|
#if !defined TRINITY && !AZEROTHCORE
|
||||||
{ "SetFFA", &LuaPlayer::SetFFA },
|
{ "SetFFA", &LuaPlayer::SetFFA },
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -765,13 +765,15 @@ ElunaRegister<Creature> CreatureMethods[] =
|
|||||||
{ "GetScriptId", &LuaCreature::GetScriptId },
|
{ "GetScriptId", &LuaCreature::GetScriptId },
|
||||||
{ "GetAIName", &LuaCreature::GetAIName },
|
{ "GetAIName", &LuaCreature::GetAIName },
|
||||||
{ "GetScriptName", &LuaCreature::GetScriptName },
|
{ "GetScriptName", &LuaCreature::GetScriptName },
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
{ "GetAttackDistance", &LuaCreature::GetAttackDistance },
|
{ "GetAttackDistance", &LuaCreature::GetAttackDistance },
|
||||||
|
#endif
|
||||||
{ "GetAggroRange", &LuaCreature::GetAggroRange },
|
{ "GetAggroRange", &LuaCreature::GetAggroRange },
|
||||||
{ "GetDefaultMovementType", &LuaCreature::GetDefaultMovementType },
|
{ "GetDefaultMovementType", &LuaCreature::GetDefaultMovementType },
|
||||||
{ "GetRespawnDelay", &LuaCreature::GetRespawnDelay },
|
{ "GetRespawnDelay", &LuaCreature::GetRespawnDelay },
|
||||||
{ "GetWanderRadius", &LuaCreature::GetWanderRadius },
|
{ "GetWanderRadius", &LuaCreature::GetWanderRadius },
|
||||||
{ "GetCurrentWaypointId", &LuaCreature::GetCurrentWaypointId },
|
{ "GetCurrentWaypointId", &LuaCreature::GetCurrentWaypointId },
|
||||||
#ifdef TRINITY
|
#if defined(TRINITY) || AZEROTHCORE
|
||||||
{ "GetWaypointPath", &LuaCreature::GetWaypointPath },
|
{ "GetWaypointPath", &LuaCreature::GetWaypointPath },
|
||||||
{ "GetLootMode", &LuaCreature::GetLootMode },
|
{ "GetLootMode", &LuaCreature::GetLootMode },
|
||||||
#endif
|
#endif
|
||||||
@@ -794,7 +796,7 @@ ElunaRegister<Creature> CreatureMethods[] =
|
|||||||
{ "SetWanderRadius", &LuaCreature::SetWanderRadius },
|
{ "SetWanderRadius", &LuaCreature::SetWanderRadius },
|
||||||
{ "SetInCombatWithZone", &LuaCreature::SetInCombatWithZone },
|
{ "SetInCombatWithZone", &LuaCreature::SetInCombatWithZone },
|
||||||
{ "SetDisableReputationGain", &LuaCreature::SetDisableReputationGain },
|
{ "SetDisableReputationGain", &LuaCreature::SetDisableReputationGain },
|
||||||
#ifdef TRINITY
|
#if defined(TRINITY) || AZEROTHCORE
|
||||||
{ "SetLootMode", &LuaCreature::SetLootMode },
|
{ "SetLootMode", &LuaCreature::SetLootMode },
|
||||||
#endif
|
#endif
|
||||||
{ "SetNPCFlags", &LuaCreature::SetNPCFlags },
|
{ "SetNPCFlags", &LuaCreature::SetNPCFlags },
|
||||||
@@ -807,7 +809,7 @@ ElunaRegister<Creature> CreatureMethods[] =
|
|||||||
{ "IsWorldBoss", &LuaCreature::IsWorldBoss },
|
{ "IsWorldBoss", &LuaCreature::IsWorldBoss },
|
||||||
{ "IsRacialLeader", &LuaCreature::IsRacialLeader },
|
{ "IsRacialLeader", &LuaCreature::IsRacialLeader },
|
||||||
{ "IsCivilian", &LuaCreature::IsCivilian },
|
{ "IsCivilian", &LuaCreature::IsCivilian },
|
||||||
#ifdef TRINITY
|
#if defined(TRINITY) || AZEROTHCORE
|
||||||
{ "IsTrigger", &LuaCreature::IsTrigger },
|
{ "IsTrigger", &LuaCreature::IsTrigger },
|
||||||
#endif
|
#endif
|
||||||
{ "IsGuard", &LuaCreature::IsGuard },
|
{ "IsGuard", &LuaCreature::IsGuard },
|
||||||
@@ -817,7 +819,7 @@ ElunaRegister<Creature> CreatureMethods[] =
|
|||||||
{ "CanWalk", &LuaCreature::CanWalk },
|
{ "CanWalk", &LuaCreature::CanWalk },
|
||||||
{ "CanSwim", &LuaCreature::CanSwim },
|
{ "CanSwim", &LuaCreature::CanSwim },
|
||||||
{ "CanAggro", &LuaCreature::CanAggro },
|
{ "CanAggro", &LuaCreature::CanAggro },
|
||||||
#ifdef TRINITY
|
#if defined(TRINITY) || AZEROTHCORE
|
||||||
{ "CanStartAttack", &LuaCreature::CanStartAttack },
|
{ "CanStartAttack", &LuaCreature::CanStartAttack },
|
||||||
#endif
|
#endif
|
||||||
{ "HasSearchedAssistance", &LuaCreature::HasSearchedAssistance },
|
{ "HasSearchedAssistance", &LuaCreature::HasSearchedAssistance },
|
||||||
@@ -827,7 +829,7 @@ ElunaRegister<Creature> CreatureMethods[] =
|
|||||||
{ "IsTargetableForAttack", &LuaCreature::IsTargetableForAttack },
|
{ "IsTargetableForAttack", &LuaCreature::IsTargetableForAttack },
|
||||||
{ "CanCompleteQuest", &LuaCreature::CanCompleteQuest },
|
{ "CanCompleteQuest", &LuaCreature::CanCompleteQuest },
|
||||||
{ "IsReputationGainDisabled", &LuaCreature::IsReputationGainDisabled },
|
{ "IsReputationGainDisabled", &LuaCreature::IsReputationGainDisabled },
|
||||||
#ifdef TRINITY
|
#if defined(TRINITY) || AZEROTHCORE
|
||||||
{ "IsDamageEnoughForLootingAndReward", &LuaCreature::IsDamageEnoughForLootingAndReward },
|
{ "IsDamageEnoughForLootingAndReward", &LuaCreature::IsDamageEnoughForLootingAndReward },
|
||||||
{ "HasLootMode", &LuaCreature::HasLootMode },
|
{ "HasLootMode", &LuaCreature::HasLootMode },
|
||||||
#endif
|
#endif
|
||||||
@@ -844,7 +846,7 @@ ElunaRegister<Creature> CreatureMethods[] =
|
|||||||
{ "DespawnOrUnsummon", &LuaCreature::DespawnOrUnsummon },
|
{ "DespawnOrUnsummon", &LuaCreature::DespawnOrUnsummon },
|
||||||
{ "Respawn", &LuaCreature::Respawn },
|
{ "Respawn", &LuaCreature::Respawn },
|
||||||
{ "AttackStart", &LuaCreature::AttackStart },
|
{ "AttackStart", &LuaCreature::AttackStart },
|
||||||
#ifdef TRINITY
|
#if defined(TRINITY) || AZEROTHCORE
|
||||||
{ "AddLootMode", &LuaCreature::AddLootMode },
|
{ "AddLootMode", &LuaCreature::AddLootMode },
|
||||||
{ "ResetLootMode", &LuaCreature::ResetLootMode },
|
{ "ResetLootMode", &LuaCreature::ResetLootMode },
|
||||||
{ "RemoveLootMode", &LuaCreature::RemoveLootMode },
|
{ "RemoveLootMode", &LuaCreature::RemoveLootMode },
|
||||||
@@ -1249,7 +1251,9 @@ ElunaRegister<BattleGround> BattleGroundMethods[] =
|
|||||||
{ "GetAlivePlayersCountByTeam", &LuaBattleGround::GetAlivePlayersCountByTeam },
|
{ "GetAlivePlayersCountByTeam", &LuaBattleGround::GetAlivePlayersCountByTeam },
|
||||||
{ "GetMap", &LuaBattleGround::GetMap },
|
{ "GetMap", &LuaBattleGround::GetMap },
|
||||||
{ "GetBonusHonorFromKillCount", &LuaBattleGround::GetBonusHonorFromKillCount },
|
{ "GetBonusHonorFromKillCount", &LuaBattleGround::GetBonusHonorFromKillCount },
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
{ "GetBracketId", &LuaBattleGround::GetBracketId },
|
{ "GetBracketId", &LuaBattleGround::GetBracketId },
|
||||||
|
#endif
|
||||||
{ "GetEndTime", &LuaBattleGround::GetEndTime },
|
{ "GetEndTime", &LuaBattleGround::GetEndTime },
|
||||||
{ "GetFreeSlotsForTeam", &LuaBattleGround::GetFreeSlotsForTeam },
|
{ "GetFreeSlotsForTeam", &LuaBattleGround::GetFreeSlotsForTeam },
|
||||||
{ "GetInstanceId", &LuaBattleGround::GetInstanceId },
|
{ "GetInstanceId", &LuaBattleGround::GetInstanceId },
|
||||||
|
|||||||
34
MapMethods.h
34
MapMethods.h
@@ -37,10 +37,10 @@ namespace LuaMap
|
|||||||
*/
|
*/
|
||||||
int IsBattleground(lua_State* L, Map* map)
|
int IsBattleground(lua_State* L, Map* map)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, map->IsBattleGround());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, map->IsBattleground());
|
Eluna::Push(L, map->IsBattleground());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, map->IsBattleGround());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -190,10 +190,10 @@ namespace LuaMap
|
|||||||
float y = Eluna::CHECKVAL<float>(L, 3);
|
float y = Eluna::CHECKVAL<float>(L, 3);
|
||||||
float z = Eluna::CHECKVAL<float>(L, 4);
|
float z = Eluna::CHECKVAL<float>(L, 4);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, map->GetTerrain()->GetAreaId(x, y, z));
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, map->GetAreaId(x, y, z));
|
Eluna::Push(L, map->GetAreaId(x, y, z));
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, map->GetTerrain()->GetAreaId(x, y, z));
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -207,13 +207,15 @@ namespace LuaMap
|
|||||||
{
|
{
|
||||||
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
|
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, map->GetWorldObject(ObjectGuid(guid)));
|
|
||||||
#else
|
|
||||||
switch (GUID_HIPART(guid))
|
switch (GUID_HIPART(guid))
|
||||||
{
|
{
|
||||||
case HIGHGUID_PLAYER:
|
case HIGHGUID_PLAYER:
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
Eluna::Push(L, eObjectAccessor()GetPlayer(map, ObjectGuid(guid)));
|
Eluna::Push(L, eObjectAccessor()GetPlayer(map, ObjectGuid(guid)));
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, map->GetPlayer(ObjectGuid(guid)));
|
||||||
|
#endif // !AZEROTHCORE
|
||||||
break;
|
break;
|
||||||
case HIGHGUID_TRANSPORT:
|
case HIGHGUID_TRANSPORT:
|
||||||
case HIGHGUID_MO_TRANSPORT:
|
case HIGHGUID_MO_TRANSPORT:
|
||||||
@@ -236,6 +238,8 @@ namespace LuaMap
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, map->GetWorldObject(ObjectGuid(guid)));
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -263,7 +267,7 @@ namespace LuaMap
|
|||||||
uint32 weatherType = Eluna::CHECKVAL<uint32>(L, 3);
|
uint32 weatherType = Eluna::CHECKVAL<uint32>(L, 3);
|
||||||
float grade = Eluna::CHECKVAL<float>(L, 4);
|
float grade = Eluna::CHECKVAL<float>(L, 4);
|
||||||
|
|
||||||
#if defined(TRINITY)
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Weather* weather = WeatherMgr::FindWeather(zoneId);
|
Weather* weather = WeatherMgr::FindWeather(zoneId);
|
||||||
if (!weather)
|
if (!weather)
|
||||||
weather = WeatherMgr::AddWeather(zoneId);
|
weather = WeatherMgr::AddWeather(zoneId);
|
||||||
@@ -286,7 +290,7 @@ namespace LuaMap
|
|||||||
*/
|
*/
|
||||||
int GetInstanceData(lua_State* L, Map* map)
|
int GetInstanceData(lua_State* L, Map* map)
|
||||||
{
|
{
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
ElunaInstanceAI* iAI = NULL;
|
ElunaInstanceAI* iAI = NULL;
|
||||||
if (InstanceMap* inst = map->ToInstanceMap())
|
if (InstanceMap* inst = map->ToInstanceMap())
|
||||||
iAI = dynamic_cast<ElunaInstanceAI*>(inst->GetInstanceScript());
|
iAI = dynamic_cast<ElunaInstanceAI*>(inst->GetInstanceScript());
|
||||||
@@ -307,7 +311,7 @@ namespace LuaMap
|
|||||||
*/
|
*/
|
||||||
int SaveInstanceData(lua_State* /*L*/, Map* map)
|
int SaveInstanceData(lua_State* /*L*/, Map* map)
|
||||||
{
|
{
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
ElunaInstanceAI* iAI = NULL;
|
ElunaInstanceAI* iAI = NULL;
|
||||||
if (InstanceMap* inst = map->ToInstanceMap())
|
if (InstanceMap* inst = map->ToInstanceMap())
|
||||||
iAI = dynamic_cast<ElunaInstanceAI*>(inst->GetInstanceScript());
|
iAI = dynamic_cast<ElunaInstanceAI*>(inst->GetInstanceScript());
|
||||||
@@ -345,10 +349,10 @@ namespace LuaMap
|
|||||||
Map::PlayerList const& players = map->GetPlayers();
|
Map::PlayerList const& players = map->GetPlayers();
|
||||||
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Player* player = itr->getSource();
|
|
||||||
#else
|
|
||||||
Player* player = itr->GetSource();
|
Player* player = itr->GetSource();
|
||||||
|
#else
|
||||||
|
Player* player = itr->getSource();
|
||||||
#endif
|
#endif
|
||||||
if (!player)
|
if (!player)
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -133,7 +133,11 @@ namespace LuaObject
|
|||||||
*/
|
*/
|
||||||
int GetScale(lua_State* L, Object* obj)
|
int GetScale(lua_State* L, Object* obj)
|
||||||
{
|
{
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
Eluna::Push(L, obj->GetObjectScale());
|
Eluna::Push(L, obj->GetObjectScale());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, obj->GetFloatValue(OBJECT_FIELD_SCALE_X));
|
||||||
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
202
PlayerMethods.h
202
PlayerMethods.h
@@ -50,10 +50,10 @@ namespace LuaPlayer
|
|||||||
int HasAchieved(lua_State* L, Player* player)
|
int HasAchieved(lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
uint32 achievementId = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 achievementId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, player->GetAchievementMgr().HasAchievement(achievementId));
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, player->HasAchieved(achievementId));
|
Eluna::Push(L, player->HasAchieved(achievementId));
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, player->GetAchievementMgr().HasAchievement(achievementId));
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -403,10 +403,10 @@ namespace LuaPlayer
|
|||||||
*/
|
*/
|
||||||
int IsGM(lua_State* L, Player* player)
|
int IsGM(lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, player->isGameMaster());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, player->IsGameMaster());
|
Eluna::Push(L, player->IsGameMaster());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, player->isGameMaster());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -461,7 +461,11 @@ namespace LuaPlayer
|
|||||||
*/
|
*/
|
||||||
int IsHorde(lua_State* L, Player* player)
|
int IsHorde(lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
|
#ifdef AZEROTHCORE
|
||||||
|
Eluna::Push(L, (player->GetTeamId() == TEAM_HORDE));
|
||||||
|
#else
|
||||||
Eluna::Push(L, (player->GetTeam() == HORDE));
|
Eluna::Push(L, (player->GetTeam() == HORDE));
|
||||||
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -472,7 +476,11 @@ namespace LuaPlayer
|
|||||||
*/
|
*/
|
||||||
int IsAlliance(lua_State* L, Player* player)
|
int IsAlliance(lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
|
#ifdef AZEROTHCORE
|
||||||
|
Eluna::Push(L, (player->GetTeamId() == TEAM_ALLIANCE));
|
||||||
|
#else
|
||||||
Eluna::Push(L, (player->GetTeam() == ALLIANCE));
|
Eluna::Push(L, (player->GetTeam() == ALLIANCE));
|
||||||
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -626,10 +634,10 @@ namespace LuaPlayer
|
|||||||
*/
|
*/
|
||||||
int InBattlegroundQueue(lua_State* L, Player* player)
|
int InBattlegroundQueue(lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, player->InBattleGroundQueue());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, player->InBattlegroundQueue());
|
Eluna::Push(L, player->InBattlegroundQueue());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, player->InBattleGroundQueue());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -654,10 +662,10 @@ namespace LuaPlayer
|
|||||||
*/
|
*/
|
||||||
int InBattleground(lua_State* L, Player* player)
|
int InBattleground(lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, player->InBattleGround());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, player->InBattleground());
|
Eluna::Push(L, player->InBattleground());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, player->InBattleGround());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -848,7 +856,7 @@ namespace LuaPlayer
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
/**
|
/**
|
||||||
* Returns the faction ID the [Player] is currently flagged as champion for
|
* Returns the faction ID the [Player] is currently flagged as champion for
|
||||||
*
|
*
|
||||||
@@ -940,10 +948,10 @@ namespace LuaPlayer
|
|||||||
*/
|
*/
|
||||||
int GetBattlegroundTypeId(lua_State* L, Player* player)
|
int GetBattlegroundTypeId(lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, player->GetBattleGroundTypeId());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, player->GetBattlegroundTypeId());
|
Eluna::Push(L, player->GetBattlegroundTypeId());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, player->GetBattleGroundTypeId());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -955,10 +963,10 @@ namespace LuaPlayer
|
|||||||
*/
|
*/
|
||||||
int GetBattlegroundId(lua_State* L, Player* player)
|
int GetBattlegroundId(lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, player->GetBattleGroundId());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, player->GetBattlegroundId());
|
Eluna::Push(L, player->GetBattlegroundId());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, player->GetBattleGroundId());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1183,10 +1191,10 @@ namespace LuaPlayer
|
|||||||
*/
|
*/
|
||||||
int GetComboTarget(lua_State* L, Player* player)
|
int GetComboTarget(lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, player->GetMap()->GetUnit(player->GetComboTargetGuid()));
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, player->GetComboTarget());
|
Eluna::Push(L, player->GetComboTarget());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, player->GetMap()->GetUnit(player->GetComboTargetGuid()));
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1267,10 +1275,10 @@ namespace LuaPlayer
|
|||||||
{
|
{
|
||||||
Quest* quest = Eluna::CHECKOBJ<Quest>(L, 2);
|
Quest* quest = Eluna::CHECKOBJ<Quest>(L, 2);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, player->GetQuestLevelForPlayer(quest));
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, player->GetQuestLevel(quest));
|
Eluna::Push(L, player->GetQuestLevel(quest));
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, player->GetQuestLevelForPlayer(quest));
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1399,10 +1407,10 @@ namespace LuaPlayer
|
|||||||
*/
|
*/
|
||||||
int GetSelection(lua_State* L, Player* player)
|
int GetSelection(lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, player->GetMap()->GetUnit(player->GetSelectionGuid()));
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, player->GetSelectedUnit());
|
Eluna::Push(L, player->GetSelectedUnit());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, player->GetMap()->GetUnit(player->GetSelectionGuid()));
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1551,7 +1559,11 @@ namespace LuaPlayer
|
|||||||
int GetAccountName(lua_State* L, Player* player)
|
int GetAccountName(lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
std::string accName;
|
std::string accName;
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
if (eAccountMgr->GetName(player->GetSession()->GetAccountId(), accName))
|
if (eAccountMgr->GetName(player->GetSession()->GetAccountId(), accName))
|
||||||
|
#else
|
||||||
|
if (AccountMgr::GetName(player->GetSession()->GetAccountId(), accName))
|
||||||
|
#endif
|
||||||
Eluna::Push(L, accName);
|
Eluna::Push(L, accName);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -2010,10 +2022,10 @@ namespace LuaPlayer
|
|||||||
uint32 areaId = Eluna::CHECKVAL<uint32>(L, 6);
|
uint32 areaId = Eluna::CHECKVAL<uint32>(L, 6);
|
||||||
|
|
||||||
WorldLocation loc(mapId, x, y, z);
|
WorldLocation loc(mapId, x, y, z);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
player->SetHomebindToLocation(loc, areaId);
|
|
||||||
#else
|
|
||||||
player->SetHomebind(loc, areaId);
|
player->SetHomebind(loc, areaId);
|
||||||
|
#else
|
||||||
|
player->SetHomebindToLocation(loc, areaId);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2034,7 +2046,7 @@ namespace LuaPlayer
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if !defined TRINITY && !AZEROTHCORE
|
||||||
/**
|
/**
|
||||||
* Toggle the [Player]s FFA flag
|
* Toggle the [Player]s FFA flag
|
||||||
*
|
*
|
||||||
@@ -2080,10 +2092,10 @@ namespace LuaPlayer
|
|||||||
*/
|
*/
|
||||||
int ResetAchievements(lua_State* /*L*/, Player* player)
|
int ResetAchievements(lua_State* /*L*/, Player* player)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
player->GetAchievementMgr().Reset();
|
|
||||||
#else
|
|
||||||
player->ResetAchievements();
|
player->ResetAchievements();
|
||||||
|
#else
|
||||||
|
player->GetAchievementMgr().Reset();
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2141,7 +2153,11 @@ namespace LuaPlayer
|
|||||||
*/
|
*/
|
||||||
int SaveToDB(lua_State* /*L*/, Player* player)
|
int SaveToDB(lua_State* /*L*/, Player* player)
|
||||||
{
|
{
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
player->SaveToDB();
|
player->SaveToDB();
|
||||||
|
#else
|
||||||
|
player->SaveToDB(false, false);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2229,10 +2245,12 @@ namespace LuaPlayer
|
|||||||
{
|
{
|
||||||
Unit* unit = Eluna::CHECKOBJ<Unit>(L, 2);
|
Unit* unit = Eluna::CHECKOBJ<Unit>(L, 2);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#ifdef TRINITY
|
||||||
AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntry(unit);
|
|
||||||
#else
|
|
||||||
AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntry(unit->GetFaction());
|
AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntry(unit->GetFaction());
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntry(unit->getFaction());
|
||||||
|
#else
|
||||||
|
AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntry(unit);
|
||||||
#endif
|
#endif
|
||||||
if (!ahEntry)
|
if (!ahEntry)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2336,11 +2354,11 @@ namespace LuaPlayer
|
|||||||
{
|
{
|
||||||
Player* plr = Eluna::CHECKOBJ<Player>(L, 2);
|
Player* plr = Eluna::CHECKOBJ<Player>(L, 2);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
player->GetSession()->SendGuildInvite(plr);
|
|
||||||
#else
|
|
||||||
if (Guild* guild = player->GetGuild())
|
if (Guild* guild = player->GetGuild())
|
||||||
guild->HandleInviteMember(player->GetSession(), plr->GetName());
|
guild->HandleInviteMember(player->GetSession(), plr->GetName());
|
||||||
|
#else
|
||||||
|
player->GetSession()->SendGuildInvite(plr);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2363,10 +2381,10 @@ namespace LuaPlayer
|
|||||||
*/
|
*/
|
||||||
int RemoveFromBattlegroundRaid(lua_State* /*L*/, Player* player)
|
int RemoveFromBattlegroundRaid(lua_State* /*L*/, Player* player)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
player->RemoveFromBattleGroundRaid();
|
|
||||||
#else
|
|
||||||
player->RemoveFromBattlegroundOrBattlefieldRaid();
|
player->RemoveFromBattlegroundOrBattlefieldRaid();
|
||||||
|
#else
|
||||||
|
player->RemoveFromBattleGroundRaid();
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2386,8 +2404,12 @@ namespace LuaPlayer
|
|||||||
uint32 difficulty = Eluna::CHECKVAL<uint32>(L, 3, 0);
|
uint32 difficulty = Eluna::CHECKVAL<uint32>(L, 3, 0);
|
||||||
|
|
||||||
if (difficulty < MAX_DIFFICULTY)
|
if (difficulty < MAX_DIFFICULTY)
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
player->UnbindInstance(map, (Difficulty)difficulty);
|
player->UnbindInstance(map, (Difficulty)difficulty);
|
||||||
#else
|
#else
|
||||||
|
sInstanceSaveMgr->PlayerUnbindInstance(player->GetGUIDLow(), map, Difficulty(difficulty), true, player);
|
||||||
|
#endif//AZEROTHCORE
|
||||||
|
#else//CLASSIC
|
||||||
player->UnbindInstance(map);
|
player->UnbindInstance(map);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2407,6 +2429,19 @@ namespace LuaPlayer
|
|||||||
else
|
else
|
||||||
++itr;
|
++itr;
|
||||||
}
|
}
|
||||||
|
#elif defined AZEROTHCORE
|
||||||
|
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
|
||||||
|
{
|
||||||
|
const BoundInstancesMap& binds = sInstanceSaveMgr->PlayerGetBoundInstances(player->GetGUIDLow(), Difficulty(i));
|
||||||
|
for (BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end();)
|
||||||
|
{
|
||||||
|
if (itr->first != player->GetMapId())
|
||||||
|
//player->UnbindInstance(itr, Difficulty(i));
|
||||||
|
sInstanceSaveMgr->PlayerUnbindInstance(player->GetGUIDLow(), itr->first, Difficulty(i), true, player);
|
||||||
|
else
|
||||||
|
++itr;
|
||||||
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
|
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
|
||||||
{
|
{
|
||||||
@@ -2430,9 +2465,12 @@ namespace LuaPlayer
|
|||||||
*/
|
*/
|
||||||
int LeaveBattleground(lua_State* L, Player* player)
|
int LeaveBattleground(lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
bool teleToEntryPoint = Eluna::CHECKVAL<bool>(L, 2, true);
|
bool teleToEntryPoint = Eluna::CHECKVAL<bool>(L, 2, true);
|
||||||
|
|
||||||
player->LeaveBattleground(teleToEntryPoint);
|
player->LeaveBattleground(teleToEntryPoint);
|
||||||
|
#else
|
||||||
|
player->LeaveBattleground();
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2769,7 +2807,7 @@ namespace LuaPlayer
|
|||||||
// Add quest items for quests that require items
|
// Add quest items for quests that require items
|
||||||
for (uint8 x = 0; x < QUEST_ITEM_OBJECTIVES_COUNT; ++x)
|
for (uint8 x = 0; x < QUEST_ITEM_OBJECTIVES_COUNT; ++x)
|
||||||
{
|
{
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
uint32 id = quest->RequiredItemId[x];
|
uint32 id = quest->RequiredItemId[x];
|
||||||
uint32 count = quest->RequiredItemCount[x];
|
uint32 count = quest->RequiredItemCount[x];
|
||||||
#else
|
#else
|
||||||
@@ -2794,7 +2832,7 @@ namespace LuaPlayer
|
|||||||
// All creature/GO slain/cast (not required, but otherwise it will display "Creature slain 0/10")
|
// All creature/GO slain/cast (not required, but otherwise it will display "Creature slain 0/10")
|
||||||
for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
|
for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
|
||||||
{
|
{
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
int32 creature = quest->RequiredNpcOrGo[i];
|
int32 creature = quest->RequiredNpcOrGo[i];
|
||||||
uint32 creatureCount = quest->RequiredNpcOrGoCount[i];
|
uint32 creatureCount = quest->RequiredNpcOrGoCount[i];
|
||||||
|
|
||||||
@@ -2802,7 +2840,11 @@ namespace LuaPlayer
|
|||||||
{
|
{
|
||||||
if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creature))
|
if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creature))
|
||||||
for (uint16 z = 0; z < creatureCount; ++z)
|
for (uint16 z = 0; z < creatureCount; ++z)
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
player->KilledMonster(creatureInfo, ObjectGuid::Empty);
|
player->KilledMonster(creatureInfo, ObjectGuid::Empty);
|
||||||
|
#else
|
||||||
|
player->KilledMonster(creatureInfo, 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (creature < 0)
|
else if (creature < 0)
|
||||||
for (uint16 z = 0; z < creatureCount; ++z)
|
for (uint16 z = 0; z < creatureCount; ++z)
|
||||||
@@ -2841,7 +2883,7 @@ namespace LuaPlayer
|
|||||||
player->GetReputationMgr().SetReputation(factionEntry, repValue);
|
player->GetReputationMgr().SetReputation(factionEntry, repValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
// If the quest requires a SECOND reputation to complete
|
// If the quest requires a SECOND reputation to complete
|
||||||
if (uint32 repFaction = quest->GetRepObjectiveFaction2())
|
if (uint32 repFaction = quest->GetRepObjectiveFaction2())
|
||||||
{
|
{
|
||||||
@@ -2889,8 +2931,9 @@ namespace LuaPlayer
|
|||||||
if (!quest)
|
if (!quest)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
// check item starting quest (it can work incorrectly if added without item in inventory)
|
// check item starting quest (it can work incorrectly if added without item in inventory)
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
ItemTemplateContainer const& itc = sObjectMgr->GetItemTemplateStore();
|
ItemTemplateContainer const& itc = sObjectMgr->GetItemTemplateStore();
|
||||||
auto itr = std::find_if(std::begin(itc), std::end(itc), [quest](ItemTemplateContainer::value_type const& value)
|
auto itr = std::find_if(std::begin(itc), std::end(itc), [quest](ItemTemplateContainer::value_type const& value)
|
||||||
{
|
{
|
||||||
@@ -2899,7 +2942,13 @@ namespace LuaPlayer
|
|||||||
|
|
||||||
if (itr != std::end(itc))
|
if (itr != std::end(itc))
|
||||||
return 0;
|
return 0;
|
||||||
|
#else
|
||||||
|
ItemTemplateContainer const* itc = sObjectMgr->GetItemTemplateStore();
|
||||||
|
ItemTemplateContainer::const_iterator result = find_if(itc->begin(), itc->end(), Finder<uint32, ItemTemplate>(entry, &ItemTemplate::StartQuest));
|
||||||
|
|
||||||
|
if (result != itc->end())
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
// ok, normal (creature/GO starting) quest
|
// ok, normal (creature/GO starting) quest
|
||||||
if (player->CanAddQuest(quest, true))
|
if (player->CanAddQuest(quest, true))
|
||||||
player->AddQuestAndCheckCompletion(quest, NULL);
|
player->AddQuestAndCheckCompletion(quest, NULL);
|
||||||
@@ -2953,7 +3002,7 @@ namespace LuaPlayer
|
|||||||
// we ignore unequippable quest items in this case, its' still be equipped
|
// we ignore unequippable quest items in this case, its' still be equipped
|
||||||
player->TakeQuestSourceItem(logQuest, false);
|
player->TakeQuestSourceItem(logQuest, false);
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
if (quest->HasFlag(QUEST_FLAGS_FLAGS_PVP))
|
if (quest->HasFlag(QUEST_FLAGS_FLAGS_PVP))
|
||||||
{
|
{
|
||||||
player->pvpInfo.IsHostile = player->pvpInfo.IsInHostileArea || player->HasPvPForcingQuest();
|
player->pvpInfo.IsHostile = player->pvpInfo.IsInHostileArea || player->HasPvPForcingQuest();
|
||||||
@@ -2963,7 +3012,7 @@ namespace LuaPlayer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
player->RemoveActiveQuest(entry, false);
|
player->RemoveActiveQuest(entry, false);
|
||||||
player->RemoveRewardedQuest(entry);
|
player->RemoveRewardedQuest(entry);
|
||||||
#else
|
#else
|
||||||
@@ -3299,17 +3348,23 @@ namespace LuaPlayer
|
|||||||
float y = Eluna::CHECKVAL<float>(L, 4);
|
float y = Eluna::CHECKVAL<float>(L, 4);
|
||||||
float z = Eluna::CHECKVAL<float>(L, 5);
|
float z = Eluna::CHECKVAL<float>(L, 5);
|
||||||
float o = Eluna::CHECKVAL<float>(L, 6);
|
float o = Eluna::CHECKVAL<float>(L, 6);
|
||||||
#ifndef TRINITY
|
#if defined AZEROTHCORE
|
||||||
|
if (player->IsInFlight())
|
||||||
|
{
|
||||||
|
player->GetMotionMaster()->MovementExpired();
|
||||||
|
player->m_taxi.ClearTaxiDestinations();
|
||||||
|
}
|
||||||
|
#elif defined TRINITY
|
||||||
|
if (player->IsInFlight())
|
||||||
|
player->FinishTaxiFlight();
|
||||||
|
else
|
||||||
|
player->SaveRecallPosition();
|
||||||
|
#else
|
||||||
if (player->IsTaxiFlying())
|
if (player->IsTaxiFlying())
|
||||||
{
|
{
|
||||||
player->GetMotionMaster()->MovementExpired();
|
player->GetMotionMaster()->MovementExpired();
|
||||||
player->m_taxi.ClearTaxiDestinations();
|
player->m_taxi.ClearTaxiDestinations();
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (player->IsInFlight())
|
|
||||||
player->FinishTaxiFlight();
|
|
||||||
else
|
|
||||||
player->SaveRecallPosition();
|
|
||||||
#endif
|
#endif
|
||||||
Eluna::Push(L, player->TeleportTo(mapId, x, y, z, o));
|
Eluna::Push(L, player->TeleportTo(mapId, x, y, z, o));
|
||||||
return 1;
|
return 1;
|
||||||
@@ -3335,7 +3390,7 @@ namespace LuaPlayer
|
|||||||
uint32 itemId = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 itemId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
uint32 itemCount = Eluna::CHECKVAL<uint32>(L, 3, 1);
|
uint32 itemCount = Eluna::CHECKVAL<uint32>(L, 3, 1);
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
uint32 noSpaceForCount = 0;
|
uint32 noSpaceForCount = 0;
|
||||||
ItemPosCountVec dest;
|
ItemPosCountVec dest;
|
||||||
InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, itemCount, &noSpaceForCount);
|
InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, itemCount, &noSpaceForCount);
|
||||||
@@ -3344,8 +3399,11 @@ namespace LuaPlayer
|
|||||||
|
|
||||||
if (itemCount == 0 || dest.empty())
|
if (itemCount == 0 || dest.empty())
|
||||||
return 1;
|
return 1;
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
Item* item = player->StoreNewItem(dest, itemId, true, GenerateItemRandomPropertyId(itemId));
|
Item* item = player->StoreNewItem(dest, itemId, true, GenerateItemRandomPropertyId(itemId));
|
||||||
|
#else
|
||||||
|
Item* item = player->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
|
||||||
|
#endif
|
||||||
if (item)
|
if (item)
|
||||||
player->SendNewItem(item, itemCount, true, false);
|
player->SendNewItem(item, itemCount, true, false);
|
||||||
Eluna::Push(L, item);
|
Eluna::Push(L, item);
|
||||||
@@ -3434,7 +3492,11 @@ namespace LuaPlayer
|
|||||||
return spellInfo && spellInfo->GetCategory() == category;
|
return spellInfo && spellInfo->GetCategory() == category;
|
||||||
}, update);
|
}, update);
|
||||||
#else
|
#else
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
player->RemoveSpellCategoryCooldown(category, update);
|
player->RemoveSpellCategoryCooldown(category, update);
|
||||||
|
#else
|
||||||
|
player->RemoveCategoryCooldown(category);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -3585,6 +3647,8 @@ namespace LuaPlayer
|
|||||||
|
|
||||||
#ifdef TRINITY
|
#ifdef TRINITY
|
||||||
player->LearnSpell(id, false);
|
player->LearnSpell(id, false);
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
player->learnSpell(id);
|
||||||
#else
|
#else
|
||||||
player->learnSpell(id, false);
|
player->learnSpell(id, false);
|
||||||
#endif
|
#endif
|
||||||
@@ -3607,7 +3671,7 @@ namespace LuaPlayer
|
|||||||
player->SendTalentsInfoData(false);
|
player->SendTalentsInfoData(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if !defined TRINITY && !AZEROTHCORE
|
||||||
// if player has a pet, update owner talent auras
|
// if player has a pet, update owner talent auras
|
||||||
if (player->GetPet())
|
if (player->GetPet())
|
||||||
player->GetPet()->CastOwnerTalentAuras();
|
player->GetPet()->CastOwnerTalentAuras();
|
||||||
@@ -3657,15 +3721,15 @@ namespace LuaPlayer
|
|||||||
bool _code = Eluna::CHECKVAL<bool>(L, 6, false);
|
bool _code = Eluna::CHECKVAL<bool>(L, 6, false);
|
||||||
const char* _promptMsg = Eluna::CHECKVAL<const char*>(L, 7, "");
|
const char* _promptMsg = Eluna::CHECKVAL<const char*>(L, 7, "");
|
||||||
uint32 _money = Eluna::CHECKVAL<uint32>(L, 8, 0);
|
uint32 _money = Eluna::CHECKVAL<uint32>(L, 8, 0);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
|
player->PlayerTalkClass->GetGossipMenu().AddMenuItem(-1, _icon, msg, _sender, _intid, _promptMsg, _money, _code);
|
||||||
|
#else
|
||||||
#ifndef CLASSIC
|
#ifndef CLASSIC
|
||||||
player->PlayerTalkClass->GetGossipMenu().AddMenuItem(_icon, msg, _sender, _intid, _promptMsg, _money, _code);
|
player->PlayerTalkClass->GetGossipMenu().AddMenuItem(_icon, msg, _sender, _intid, _promptMsg, _money, _code);
|
||||||
#else
|
#else
|
||||||
player->PlayerTalkClass->GetGossipMenu().AddMenuItem(_icon, msg, _sender, _intid, _promptMsg, _code);
|
player->PlayerTalkClass->GetGossipMenu().AddMenuItem(_icon, msg, _sender, _intid, _promptMsg, _code);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#endif//TRINITY
|
||||||
player->PlayerTalkClass->GetGossipMenu().AddMenuItem(-1, _icon, msg, _sender, _intid, _promptMsg, _money, _code);
|
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3676,10 +3740,10 @@ namespace LuaPlayer
|
|||||||
*/
|
*/
|
||||||
int GossipComplete(lua_State* /*L*/, Player* player)
|
int GossipComplete(lua_State* /*L*/, Player* player)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
player->PlayerTalkClass->CloseGossip();
|
|
||||||
#else
|
|
||||||
player->PlayerTalkClass->SendCloseGossip();
|
player->PlayerTalkClass->SendCloseGossip();
|
||||||
|
#else
|
||||||
|
player->PlayerTalkClass->CloseGossip();
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -3928,7 +3992,7 @@ namespace LuaPlayer
|
|||||||
if (!group->IsCreated())
|
if (!group->IsCreated())
|
||||||
{
|
{
|
||||||
group->RemoveInvite(player);
|
group->RemoveInvite(player);
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
group->Create(player);
|
group->Create(player);
|
||||||
sGroupMgr->AddGroup(group);
|
sGroupMgr->AddGroup(group);
|
||||||
#else
|
#else
|
||||||
@@ -3938,7 +4002,7 @@ namespace LuaPlayer
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
if (!group->AddMember(invited))
|
if (!group->AddMember(invited))
|
||||||
return 0;
|
return 0;
|
||||||
group->BroadcastGroupUpdate();
|
group->BroadcastGroupUpdate();
|
||||||
|
|||||||
@@ -52,10 +52,10 @@ namespace LuaQuest
|
|||||||
int HasFlag(lua_State* L, Quest* quest)
|
int HasFlag(lua_State* L, Quest* quest)
|
||||||
{
|
{
|
||||||
uint32 flag = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 flag = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, quest->HasQuestFlag((QuestFlags)flag));
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, quest->HasFlag(flag));
|
Eluna::Push(L, quest->HasFlag(flag));
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, quest->HasQuestFlag((QuestFlags)flag));
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -157,10 +157,10 @@ namespace LuaQuest
|
|||||||
*/
|
*/
|
||||||
int GetFlags(lua_State* L, Quest* quest)
|
int GetFlags(lua_State* L, Quest* quest)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, quest->GetQuestFlags());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, quest->GetFlags());
|
Eluna::Push(L, quest->GetFlags());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, quest->GetQuestFlags());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,11 @@ bool Eluna::OnAreaTrigger(Player* pPlayer, AreaTriggerEntry const* pTrigger)
|
|||||||
{
|
{
|
||||||
START_HOOK_WITH_RETVAL(TRIGGER_EVENT_ON_TRIGGER, false);
|
START_HOOK_WITH_RETVAL(TRIGGER_EVENT_ON_TRIGGER, false);
|
||||||
Push(pPlayer);
|
Push(pPlayer);
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
Push(pTrigger->id);
|
Push(pTrigger->id);
|
||||||
|
#else
|
||||||
|
Push(pTrigger->entry);
|
||||||
|
#endif
|
||||||
return CallAllFunctionsBool(ServerEventBindings, key);
|
return CallAllFunctionsBool(ServerEventBindings, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,6 +141,9 @@ void Eluna::OnAdd(AuctionHouseObject* /*ah*/, AuctionEntry* entry)
|
|||||||
#ifdef TRINITY
|
#ifdef TRINITY
|
||||||
Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow);
|
Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow);
|
||||||
uint32 expiretime = entry->expire_time;
|
uint32 expiretime = entry->expire_time;
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
Item* item = eAuctionMgr->GetAItem(entry->item_guidlow);
|
||||||
|
uint32 expiretime = entry->expire_time;
|
||||||
#else
|
#else
|
||||||
Item* item = eAuctionMgr->GetAItem(entry->itemGuidLow);
|
Item* item = eAuctionMgr->GetAItem(entry->itemGuidLow);
|
||||||
uint32 expiretime = entry->expireTime;
|
uint32 expiretime = entry->expireTime;
|
||||||
@@ -164,6 +171,9 @@ void Eluna::OnRemove(AuctionHouseObject* /*ah*/, AuctionEntry* entry)
|
|||||||
#ifdef TRINITY
|
#ifdef TRINITY
|
||||||
Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow);
|
Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow);
|
||||||
uint32 expiretime = entry->expire_time;
|
uint32 expiretime = entry->expire_time;
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
Item* item = eAuctionMgr->GetAItem(entry->item_guidlow);
|
||||||
|
uint32 expiretime = entry->expire_time;
|
||||||
#else
|
#else
|
||||||
Item* item = eAuctionMgr->GetAItem(entry->itemGuidLow);
|
Item* item = eAuctionMgr->GetAItem(entry->itemGuidLow);
|
||||||
uint32 expiretime = entry->expireTime;
|
uint32 expiretime = entry->expireTime;
|
||||||
@@ -191,6 +201,9 @@ void Eluna::OnSuccessful(AuctionHouseObject* /*ah*/, AuctionEntry* entry)
|
|||||||
#ifdef TRINITY
|
#ifdef TRINITY
|
||||||
Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow);
|
Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow);
|
||||||
uint32 expiretime = entry->expire_time;
|
uint32 expiretime = entry->expire_time;
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
Item* item = eAuctionMgr->GetAItem(entry->item_guidlow);
|
||||||
|
uint32 expiretime = entry->expire_time;
|
||||||
#else
|
#else
|
||||||
Item* item = eAuctionMgr->GetAItem(entry->itemGuidLow);
|
Item* item = eAuctionMgr->GetAItem(entry->itemGuidLow);
|
||||||
uint32 expiretime = entry->expireTime;
|
uint32 expiretime = entry->expireTime;
|
||||||
@@ -218,6 +231,9 @@ void Eluna::OnExpire(AuctionHouseObject* /*ah*/, AuctionEntry* entry)
|
|||||||
#ifdef TRINITY
|
#ifdef TRINITY
|
||||||
Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow);
|
Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow);
|
||||||
uint32 expiretime = entry->expire_time;
|
uint32 expiretime = entry->expire_time;
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
Item* item = eAuctionMgr->GetAItem(entry->item_guidlow);
|
||||||
|
uint32 expiretime = entry->expire_time;
|
||||||
#else
|
#else
|
||||||
Item* item = eAuctionMgr->GetAItem(entry->itemGuidLow);
|
Item* item = eAuctionMgr->GetAItem(entry->itemGuidLow);
|
||||||
uint32 expiretime = entry->expireTime;
|
uint32 expiretime = entry->expireTime;
|
||||||
@@ -246,10 +262,17 @@ void Eluna::OnOpenStateChange(bool open)
|
|||||||
CallAllFunctions(ServerEventBindings, key);
|
CallAllFunctions(ServerEventBindings, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef AZEROTHCORE
|
||||||
void Eluna::OnConfigLoad(bool reload)
|
void Eluna::OnConfigLoad(bool reload)
|
||||||
|
#else
|
||||||
|
void Eluna::OnConfigLoad(bool reload, bool isBefore)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
START_HOOK(WORLD_EVENT_ON_CONFIG_LOAD);
|
START_HOOK(WORLD_EVENT_ON_CONFIG_LOAD);
|
||||||
Push(reload);
|
Push(reload);
|
||||||
|
#ifdef AZEROTHCORE
|
||||||
|
Push(isBefore);
|
||||||
|
#endif
|
||||||
CallAllFunctions(ServerEventBindings, key);
|
CallAllFunctions(ServerEventBindings, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,10 +76,10 @@ namespace LuaSpell
|
|||||||
*/
|
*/
|
||||||
int GetDuration(lua_State* L, Spell* spell)
|
int GetDuration(lua_State* L, Spell* spell)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, GetSpellDuration(spell->m_spellInfo));
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, spell->GetSpellInfo()->GetDuration());
|
Eluna::Push(L, spell->GetSpellInfo()->GetDuration());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, GetSpellDuration(spell->m_spellInfo));
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -93,16 +93,16 @@ namespace LuaSpell
|
|||||||
*/
|
*/
|
||||||
int GetTargetDest(lua_State* L, Spell* spell)
|
int GetTargetDest(lua_State* L, Spell* spell)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
if (!(spell->m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION))
|
|
||||||
return 3;
|
|
||||||
float x, y, z;
|
|
||||||
spell->m_targets.getDestination(x, y, z);
|
|
||||||
#else
|
|
||||||
if (!spell->m_targets.HasDst())
|
if (!spell->m_targets.HasDst())
|
||||||
return 3;
|
return 3;
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
spell->m_targets.GetDstPos()->GetPosition(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
|
#endif
|
||||||
Eluna::Push(L, x);
|
Eluna::Push(L, x);
|
||||||
Eluna::Push(L, y);
|
Eluna::Push(L, y);
|
||||||
@@ -124,16 +124,7 @@ namespace LuaSpell
|
|||||||
*/
|
*/
|
||||||
int GetTarget(lua_State* L, Spell* spell)
|
int GetTarget(lua_State* L, Spell* spell)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
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);
|
|
||||||
#else
|
|
||||||
if (GameObject* target = spell->m_targets.GetGOTarget())
|
if (GameObject* target = spell->m_targets.GetGOTarget())
|
||||||
Eluna::Push(L, target);
|
Eluna::Push(L, target);
|
||||||
else if (Item* target = spell->m_targets.GetItemTarget())
|
else if (Item* target = spell->m_targets.GetItemTarget())
|
||||||
@@ -144,6 +135,15 @@ namespace LuaSpell
|
|||||||
Eluna::Push(L, target);
|
Eluna::Push(L, target);
|
||||||
else if (WorldObject* target = spell->m_targets.GetObjectTarget())
|
else if (WorldObject* target = spell->m_targets.GetObjectTarget())
|
||||||
Eluna::Push(L, target);
|
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
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
323
UnitMethods.h
323
UnitMethods.h
@@ -68,7 +68,7 @@ namespace LuaUnit
|
|||||||
*/
|
*/
|
||||||
int IsRooted(lua_State* L, Unit* unit)
|
int IsRooted(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, unit->isInRoots() || unit->HasUnitMovementFlag(MOVEMENTFLAG_ROOT));
|
Eluna::Push(L, unit->isInRoots() || unit->HasUnitMovementFlag(MOVEMENTFLAG_ROOT));
|
||||||
#endif
|
#endif
|
||||||
#ifdef CMANGOS
|
#ifdef CMANGOS
|
||||||
@@ -102,10 +102,10 @@ namespace LuaUnit
|
|||||||
{
|
{
|
||||||
Creature* creature = Eluna::CHECKOBJ<Creature>(L, 2);
|
Creature* creature = Eluna::CHECKOBJ<Creature>(L, 2);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, unit->isInAccessablePlaceFor(creature));
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, unit->isInAccessiblePlaceFor(creature));
|
Eluna::Push(L, unit->isInAccessiblePlaceFor(creature));
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, unit->isInAccessablePlaceFor(creature));
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -117,10 +117,10 @@ namespace LuaUnit
|
|||||||
*/
|
*/
|
||||||
int IsAuctioneer(lua_State* L, Unit* unit)
|
int IsAuctioneer(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, unit->isAuctioner());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, unit->IsAuctioner());
|
Eluna::Push(L, unit->IsAuctioner());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, unit->isAuctioner());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -425,10 +425,10 @@ namespace LuaUnit
|
|||||||
*/
|
*/
|
||||||
int IsOnVehicle(lua_State* L, Unit* unit)
|
int IsOnVehicle(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, unit->IsBoarded());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, unit->GetVehicle());
|
Eluna::Push(L, unit->GetVehicle());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, unit->IsBoarded());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -542,7 +542,7 @@ namespace LuaUnit
|
|||||||
*/
|
*/
|
||||||
int IsCasting(lua_State* L, Unit* unit)
|
int IsCasting(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, unit->HasUnitState(UNIT_STATE_CASTING));
|
Eluna::Push(L, unit->HasUnitState(UNIT_STATE_CASTING));
|
||||||
#else
|
#else
|
||||||
Eluna::Push(L, unit->IsNonMeleeSpellCasted(false));
|
Eluna::Push(L, unit->IsNonMeleeSpellCasted(false));
|
||||||
@@ -559,10 +559,10 @@ namespace LuaUnit
|
|||||||
int HasUnitState(lua_State* L, Unit* unit)
|
int HasUnitState(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
uint32 state = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 state = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, unit->hasUnitState(state));
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, unit->HasUnitState(state));
|
Eluna::Push(L, unit->HasUnitState(state));
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, unit->hasUnitState(state));
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -603,10 +603,10 @@ namespace LuaUnit
|
|||||||
*/
|
*/
|
||||||
int GetOwnerGUID(lua_State* L, Unit* unit)
|
int GetOwnerGUID(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, unit->GetOwnerGuid());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, unit->GetOwnerGUID());
|
Eluna::Push(L, unit->GetOwnerGUID());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, unit->GetOwnerGuid());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -629,10 +629,10 @@ namespace LuaUnit
|
|||||||
*/
|
*/
|
||||||
int GetCreatorGUID(lua_State* L, Unit* unit)
|
int GetCreatorGUID(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, unit->GetCreatorGuid());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, unit->GetCreatorGUID());
|
Eluna::Push(L, unit->GetCreatorGUID());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, unit->GetCreatorGuid());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -644,10 +644,10 @@ namespace LuaUnit
|
|||||||
*/
|
*/
|
||||||
int GetCharmerGUID(lua_State* L, Unit* unit)
|
int GetCharmerGUID(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, unit->GetCharmerGuid());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, unit->GetCharmerGUID());
|
Eluna::Push(L, unit->GetCharmerGUID());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, unit->GetCharmerGuid());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -659,10 +659,10 @@ namespace LuaUnit
|
|||||||
*/
|
*/
|
||||||
int GetCharmGUID(lua_State* L, Unit* unit)
|
int GetCharmGUID(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, unit->GetCharmGuid());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, unit->GetCharmGUID());
|
Eluna::Push(L, unit->GetCharmGUID());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, unit->GetCharmGuid());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -674,10 +674,10 @@ namespace LuaUnit
|
|||||||
*/
|
*/
|
||||||
int GetPetGUID(lua_State* L, Unit* unit)
|
int GetPetGUID(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, unit->GetPetGuid());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, unit->GetPetGUID());
|
Eluna::Push(L, unit->GetPetGUID());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, unit->GetPetGuid());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -689,10 +689,10 @@ namespace LuaUnit
|
|||||||
*/
|
*/
|
||||||
int GetControllerGUID(lua_State* L, Unit* unit)
|
int GetControllerGUID(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, unit->GetCharmerOrOwnerGuid());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, unit->GetCharmerOrOwnerGUID());
|
Eluna::Push(L, unit->GetCharmerOrOwnerGUID());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, unit->GetCharmerOrOwnerGuid());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -704,10 +704,10 @@ namespace LuaUnit
|
|||||||
*/
|
*/
|
||||||
int GetControllerGUIDS(lua_State* L, Unit* unit)
|
int GetControllerGUIDS(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, unit->GetCharmerOrOwnerOrOwnGuid());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, unit->GetCharmerOrOwnerOrOwnGUID());
|
Eluna::Push(L, unit->GetCharmerOrOwnerOrOwnGUID());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, unit->GetCharmerOrOwnerOrOwnGuid());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -753,10 +753,10 @@ namespace LuaUnit
|
|||||||
*/
|
*/
|
||||||
int GetVictim(lua_State* L, Unit* unit)
|
int GetVictim(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, unit->getVictim());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, unit->GetVictim());
|
Eluna::Push(L, unit->GetVictim());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, unit->getVictim());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -851,6 +851,9 @@ namespace LuaUnit
|
|||||||
#ifdef TRINITY
|
#ifdef TRINITY
|
||||||
if (powerType == -1)
|
if (powerType == -1)
|
||||||
return unit->GetPowerType();
|
return unit->GetPowerType();
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
if (powerType == -1)
|
||||||
|
return unit->getPowerType();
|
||||||
#else
|
#else
|
||||||
if (powerType == -1)
|
if (powerType == -1)
|
||||||
return unit->GetPowerType();
|
return unit->GetPowerType();
|
||||||
@@ -977,6 +980,8 @@ namespace LuaUnit
|
|||||||
{
|
{
|
||||||
#ifdef TRINITY
|
#ifdef TRINITY
|
||||||
Eluna::Push(L, unit->GetPowerType());
|
Eluna::Push(L, unit->GetPowerType());
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
Eluna::Push(L, unit->getPowerType());
|
||||||
#else
|
#else
|
||||||
Eluna::Push(L, unit->GetPowerType());
|
Eluna::Push(L, unit->GetPowerType());
|
||||||
#endif
|
#endif
|
||||||
@@ -1001,10 +1006,10 @@ namespace LuaUnit
|
|||||||
*/
|
*/
|
||||||
int GetHealthPct(lua_State* L, Unit* unit)
|
int GetHealthPct(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, unit->GetHealthPercent());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, unit->GetHealthPct());
|
Eluna::Push(L, unit->GetHealthPct());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, unit->GetHealthPercent());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1169,10 +1174,10 @@ namespace LuaUnit
|
|||||||
int GetAura(lua_State* L, Unit* unit)
|
int GetAura(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
uint32 spellID = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 spellID = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, unit->GetAura(spellID, EFFECT_INDEX_0));
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, unit->GetAura(spellID));
|
Eluna::Push(L, unit->GetAura(spellID));
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, unit->GetAura(spellID, EFFECT_INDEX_0));
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1188,14 +1193,18 @@ namespace LuaUnit
|
|||||||
float range = Eluna::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
|
float range = Eluna::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
|
||||||
|
|
||||||
std::list<Unit*> list;
|
std::list<Unit*> list;
|
||||||
#ifndef TRINITY
|
#ifdef TRINITY
|
||||||
MaNGOS::AnyFriendlyUnitInObjectRangeCheck checker(unit, range);
|
|
||||||
MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck> searcher(list, checker);
|
|
||||||
Cell::VisitGridObjects(unit, searcher, range);
|
|
||||||
#else
|
|
||||||
Trinity::AnyFriendlyUnitInObjectRangeCheck checker(unit, unit, range);
|
Trinity::AnyFriendlyUnitInObjectRangeCheck checker(unit, unit, range);
|
||||||
Trinity::UnitListSearcher<Trinity::AnyFriendlyUnitInObjectRangeCheck> searcher(unit, list, checker);
|
Trinity::UnitListSearcher<Trinity::AnyFriendlyUnitInObjectRangeCheck> searcher(unit, list, checker);
|
||||||
Cell::VisitAllObjects(unit, searcher, range);
|
Cell::VisitAllObjects(unit, searcher, range);
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
Trinity::AnyFriendlyUnitInObjectRangeCheck checker(unit, unit, range);
|
||||||
|
Trinity::UnitListSearcher<Trinity::AnyFriendlyUnitInObjectRangeCheck> searcher(unit, list, checker);
|
||||||
|
unit->VisitNearbyObject(range, searcher);
|
||||||
|
#else
|
||||||
|
MaNGOS::AnyFriendlyUnitInObjectRangeCheck checker(unit, range);
|
||||||
|
MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck> searcher(list, checker);
|
||||||
|
Cell::VisitGridObjects(unit, searcher, range);
|
||||||
#endif
|
#endif
|
||||||
ElunaUtil::ObjectGUIDCheck guidCheck(unit->GET_GUID());
|
ElunaUtil::ObjectGUIDCheck guidCheck(unit->GET_GUID());
|
||||||
list.remove_if(guidCheck);
|
list.remove_if(guidCheck);
|
||||||
@@ -1225,14 +1234,18 @@ namespace LuaUnit
|
|||||||
float range = Eluna::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
|
float range = Eluna::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
|
||||||
|
|
||||||
std::list<Unit*> list;
|
std::list<Unit*> list;
|
||||||
#ifndef TRINITY
|
#ifdef TRINITY
|
||||||
MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck checker(unit, range);
|
|
||||||
MaNGOS::UnitListSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck> searcher(list, checker);
|
|
||||||
Cell::VisitGridObjects(unit, searcher, range);
|
|
||||||
#else
|
|
||||||
Trinity::AnyUnfriendlyUnitInObjectRangeCheck checker(unit, unit, range);
|
Trinity::AnyUnfriendlyUnitInObjectRangeCheck checker(unit, unit, range);
|
||||||
Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(unit, list, checker);
|
Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(unit, list, checker);
|
||||||
Cell::VisitAllObjects(unit, searcher, range);
|
Cell::VisitAllObjects(unit, searcher, range);
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
Trinity::AnyUnfriendlyUnitInObjectRangeCheck checker(unit, unit, range);
|
||||||
|
Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(unit, list, checker);
|
||||||
|
unit->VisitNearbyObject(range, searcher);
|
||||||
|
#else
|
||||||
|
MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck checker(unit, range);
|
||||||
|
MaNGOS::UnitListSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck> searcher(list, checker);
|
||||||
|
Cell::VisitGridObjects(unit, searcher, range);
|
||||||
#endif
|
#endif
|
||||||
ElunaUtil::ObjectGUIDCheck guidCheck(unit->GET_GUID());
|
ElunaUtil::ObjectGUIDCheck guidCheck(unit->GET_GUID());
|
||||||
list.remove_if(guidCheck);
|
list.remove_if(guidCheck);
|
||||||
@@ -1259,10 +1272,10 @@ namespace LuaUnit
|
|||||||
*/
|
*/
|
||||||
int GetVehicleKit(lua_State* L, Unit* unit)
|
int GetVehicleKit(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, unit->GetVehicleInfo());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, unit->GetVehicleKit());
|
Eluna::Push(L, unit->GetVehicleKit());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, unit->GetVehicleInfo());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1282,10 +1295,10 @@ namespace LuaUnit
|
|||||||
*/
|
*/
|
||||||
int GetCritterGUID(lua_State* L, Unit* unit)
|
int GetCritterGUID(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, unit->GetCritterGuid());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, unit->GetCritterGUID());
|
Eluna::Push(L, unit->GetCritterGUID());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, unit->GetCritterGuid());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1373,10 +1386,10 @@ namespace LuaUnit
|
|||||||
{
|
{
|
||||||
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
|
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
unit->SetOwnerGuid(ObjectGuid(guid));
|
|
||||||
#else
|
|
||||||
unit->SetOwnerGUID(ObjectGuid(guid));
|
unit->SetOwnerGUID(ObjectGuid(guid));
|
||||||
|
#else
|
||||||
|
unit->SetOwnerGuid(ObjectGuid(guid));
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1459,10 +1472,10 @@ namespace LuaUnit
|
|||||||
bool forced = Eluna::CHECKVAL<bool>(L, 4, false);
|
bool forced = Eluna::CHECKVAL<bool>(L, 4, false);
|
||||||
if (type >= MAX_MOVE_TYPE)
|
if (type >= MAX_MOVE_TYPE)
|
||||||
return luaL_argerror(L, 2, "valid UnitMoveType expected");
|
return luaL_argerror(L, 2, "valid UnitMoveType expected");
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
unit->SetSpeedRate((UnitMoveType)type, rate, forced);
|
|
||||||
#else
|
|
||||||
unit->SetSpeedRate((UnitMoveType)type, rate);
|
unit->SetSpeedRate((UnitMoveType)type, rate);
|
||||||
|
#else
|
||||||
|
unit->SetSpeedRate((UnitMoveType)type, rate, forced);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1651,6 +1664,8 @@ namespace LuaUnit
|
|||||||
|
|
||||||
#ifdef TRINITY
|
#ifdef TRINITY
|
||||||
unit->SetPowerType((Powers)type);
|
unit->SetPowerType((Powers)type);
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
unit->setPowerType((Powers)type);
|
||||||
#else
|
#else
|
||||||
unit->SetPowerType((Powers)type);
|
unit->SetPowerType((Powers)type);
|
||||||
#endif
|
#endif
|
||||||
@@ -1713,10 +1728,10 @@ namespace LuaUnit
|
|||||||
int SetCreatorGUID(lua_State* L, Unit* unit)
|
int SetCreatorGUID(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
|
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
unit->SetCreatorGuid(ObjectGuid(guid));
|
|
||||||
#else
|
|
||||||
unit->SetCreatorGUID(ObjectGuid(guid));
|
unit->SetCreatorGUID(ObjectGuid(guid));
|
||||||
|
#else
|
||||||
|
unit->SetCreatorGuid(ObjectGuid(guid));
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1729,10 +1744,10 @@ namespace LuaUnit
|
|||||||
int SetCharmerGUID(lua_State* L, Unit* unit)
|
int SetCharmerGUID(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
|
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
unit->SetCharmerGuid(ObjectGuid(guid));
|
|
||||||
#else
|
|
||||||
unit->SetCharmerGUID(ObjectGuid(guid));
|
unit->SetCharmerGUID(ObjectGuid(guid));
|
||||||
|
#else
|
||||||
|
unit->SetCharmerGuid(ObjectGuid(guid));
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1745,10 +1760,10 @@ namespace LuaUnit
|
|||||||
int SetPetGUID(lua_State* L, Unit* unit)
|
int SetPetGUID(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
|
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
unit->SetPetGuid(ObjectGuid(guid));
|
|
||||||
#else
|
|
||||||
unit->SetPetGUID(ObjectGuid(guid));
|
unit->SetPetGUID(ObjectGuid(guid));
|
||||||
|
#else
|
||||||
|
unit->SetPetGuid(ObjectGuid(guid));
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1761,10 +1776,10 @@ namespace LuaUnit
|
|||||||
int SetWaterWalk(lua_State* L, Unit* unit)
|
int SetWaterWalk(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
|
bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
unit->SetWaterWalk(enable);
|
|
||||||
#else
|
|
||||||
unit->SetWaterWalking(enable);
|
unit->SetWaterWalking(enable);
|
||||||
|
#else
|
||||||
|
unit->SetWaterWalk(enable);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1791,9 +1806,7 @@ namespace LuaUnit
|
|||||||
{
|
{
|
||||||
bool apply = Eluna::CHECKVAL<bool>(L, 2, true);
|
bool apply = Eluna::CHECKVAL<bool>(L, 2, true);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#ifdef TRINITY
|
||||||
unit->SetFFAPvP(apply);
|
|
||||||
#else
|
|
||||||
if (apply)
|
if (apply)
|
||||||
{
|
{
|
||||||
unit->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
unit->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
||||||
@@ -1806,6 +1819,21 @@ namespace LuaUnit
|
|||||||
for (Unit::ControlList::iterator itr = unit->m_Controlled.begin(); itr != unit->m_Controlled.end(); ++itr)
|
for (Unit::ControlList::iterator itr = unit->m_Controlled.begin(); itr != unit->m_Controlled.end(); ++itr)
|
||||||
(*itr)->RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
(*itr)->RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
||||||
}
|
}
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
if (apply)
|
||||||
|
{
|
||||||
|
unit->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
||||||
|
for (Unit::ControlSet::iterator itr = unit->m_Controlled.begin(); itr != unit->m_Controlled.end(); ++itr)
|
||||||
|
(*itr)->SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
unit->RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
||||||
|
for (Unit::ControlSet::iterator itr = unit->m_Controlled.begin(); itr != unit->m_Controlled.end(); ++itr)
|
||||||
|
(*itr)->RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
unit->SetFFAPvP(apply);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1834,10 +1862,10 @@ namespace LuaUnit
|
|||||||
int SetCritterGUID(lua_State* L, Unit* unit)
|
int SetCritterGUID(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
|
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
unit->SetCritterGuid(ObjectGuid(guid));
|
|
||||||
#else
|
|
||||||
unit->SetCritterGUID(ObjectGuid(guid));
|
unit->SetCritterGUID(ObjectGuid(guid));
|
||||||
|
#else
|
||||||
|
unit->SetCritterGuid(ObjectGuid(guid));
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1858,10 +1886,10 @@ namespace LuaUnit
|
|||||||
int SetRooted(lua_State* L, Unit* unit)
|
int SetRooted(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
bool apply = Eluna::CHECKVAL<bool>(L, 2, true);
|
bool apply = Eluna::CHECKVAL<bool>(L, 2, true);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
unit->SetRoot(apply);
|
|
||||||
#else
|
|
||||||
unit->SetControlled(apply, UNIT_STATE_ROOT);
|
unit->SetControlled(apply, UNIT_STATE_ROOT);
|
||||||
|
#else
|
||||||
|
unit->SetRoot(apply);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1874,10 +1902,10 @@ namespace LuaUnit
|
|||||||
int SetConfused(lua_State* L, Unit* unit)
|
int SetConfused(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
bool apply = Eluna::CHECKVAL<bool>(L, 2, true);
|
bool apply = Eluna::CHECKVAL<bool>(L, 2, true);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
unit->SetConfused(apply);
|
|
||||||
#else
|
|
||||||
unit->SetControlled(apply, UNIT_STATE_CONFUSED);
|
unit->SetControlled(apply, UNIT_STATE_CONFUSED);
|
||||||
|
#else
|
||||||
|
unit->SetConfused(apply);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1890,10 +1918,10 @@ namespace LuaUnit
|
|||||||
int SetFeared(lua_State* L, Unit* unit)
|
int SetFeared(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
bool apply = Eluna::CHECKVAL<bool>(L, 2, true);
|
bool apply = Eluna::CHECKVAL<bool>(L, 2, true);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
unit->SetFeared(apply);
|
|
||||||
#else
|
|
||||||
unit->SetControlled(apply, UNIT_STATE_FLEEING);
|
unit->SetControlled(apply, UNIT_STATE_FLEEING);
|
||||||
|
#else
|
||||||
|
unit->SetFeared(apply);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1919,6 +1947,8 @@ namespace LuaUnit
|
|||||||
{
|
{
|
||||||
#ifdef TRINITY
|
#ifdef TRINITY
|
||||||
unit->GetThreatManager().ClearAllThreat();
|
unit->GetThreatManager().ClearAllThreat();
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
unit->getThreatManager().clearReferences();
|
||||||
#else
|
#else
|
||||||
unit->GetThreatManager().clearReferences();
|
unit->GetThreatManager().clearReferences();
|
||||||
#endif
|
#endif
|
||||||
@@ -1945,12 +1975,12 @@ namespace LuaUnit
|
|||||||
{
|
{
|
||||||
if (unit->IsMounted())
|
if (unit->IsMounted())
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
unit->Unmount();
|
|
||||||
unit->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
|
|
||||||
#else
|
|
||||||
unit->Dismount();
|
unit->Dismount();
|
||||||
unit->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
unit->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||||
|
#else
|
||||||
|
unit->Unmount();
|
||||||
|
unit->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2024,7 +2054,7 @@ namespace LuaUnit
|
|||||||
return luaL_argerror(L, 3, "valid Language expected");
|
return luaL_argerror(L, 3, "valid Language expected");
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
ChatHandler::BuildChatPacket(data, ChatMsg(type), Language(lang), unit, target, msg);
|
ChatHandler::BuildChatPacket(data, ChatMsg(type), Language(lang), unit, target, msg);
|
||||||
#else
|
#else
|
||||||
ChatHandler::BuildChatPacket(data, ChatMsg(type), msg.c_str(), Language(lang), 0, unit->GET_GUID(), unit->GetName(), target->GET_GUID(), target->GetName());
|
ChatHandler::BuildChatPacket(data, ChatMsg(type), msg.c_str(), Language(lang), 0, unit->GET_GUID(), unit->GetName(), target->GET_GUID(), target->GetName());
|
||||||
@@ -2104,10 +2134,10 @@ namespace LuaUnit
|
|||||||
float radius = Eluna::CHECKVAL<float>(L, 2);
|
float radius = Eluna::CHECKVAL<float>(L, 2);
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
unit->GetPosition(x, y, z);
|
unit->GetPosition(x, y, z);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
unit->GetMotionMaster()->MoveRandomAroundPoint(x, y, z, radius);
|
|
||||||
#else
|
|
||||||
unit->GetMotionMaster()->MoveRandom(radius);
|
unit->GetMotionMaster()->MoveRandom(radius);
|
||||||
|
#else
|
||||||
|
unit->GetMotionMaster()->MoveRandomAroundPoint(x, y, z, radius);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2335,7 +2365,7 @@ namespace LuaUnit
|
|||||||
#ifdef MANGOS
|
#ifdef MANGOS
|
||||||
SpellEntry const* spellEntry = sSpellStore.LookupEntry(spell);
|
SpellEntry const* spellEntry = sSpellStore.LookupEntry(spell);
|
||||||
#endif
|
#endif
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(spell);
|
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(spell);
|
||||||
#endif
|
#endif
|
||||||
if (!spellEntry)
|
if (!spellEntry)
|
||||||
@@ -2419,6 +2449,9 @@ namespace LuaUnit
|
|||||||
#ifdef MANGOS
|
#ifdef MANGOS
|
||||||
unit->CastSpell(_x, _y, _z, spell, triggered);
|
unit->CastSpell(_x, _y, _z, spell, triggered);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef AZEROTHCORE
|
||||||
|
unit->CastSpell(_x, _y, _z, spell, triggered);
|
||||||
|
#endif
|
||||||
#ifdef TRINITY
|
#ifdef TRINITY
|
||||||
CastSpellExtraArgs args;
|
CastSpellExtraArgs args;
|
||||||
if (triggered)
|
if (triggered)
|
||||||
@@ -2502,11 +2535,16 @@ namespace LuaUnit
|
|||||||
#endif
|
#endif
|
||||||
#ifdef TRINITY
|
#ifdef TRINITY
|
||||||
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(spell);
|
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(spell);
|
||||||
|
#endif
|
||||||
|
#ifdef AZEROTHCORE
|
||||||
|
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(spell);
|
||||||
#endif
|
#endif
|
||||||
if (!spellEntry)
|
if (!spellEntry)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
|
Eluna::Push(L, unit->AddAura(spell, target));
|
||||||
|
#else
|
||||||
if (!IsSpellAppliesAura(spellEntry) && !IsSpellHaveEffect(spellEntry, SPELL_EFFECT_PERSISTENT_AREA_AURA))
|
if (!IsSpellAppliesAura(spellEntry) && !IsSpellHaveEffect(spellEntry, SPELL_EFFECT_PERSISTENT_AREA_AURA))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@@ -2526,8 +2564,6 @@ namespace LuaUnit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Eluna::Push(L, target->AddSpellAuraHolder(holder));
|
Eluna::Push(L, target->AddSpellAuraHolder(holder));
|
||||||
#else
|
|
||||||
Eluna::Push(L, unit->AddAura(spell, target));
|
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -2564,10 +2600,10 @@ namespace LuaUnit
|
|||||||
{
|
{
|
||||||
uint32 state = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 state = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
unit->addUnitState(state);
|
|
||||||
#else
|
|
||||||
unit->AddUnitState(state);
|
unit->AddUnitState(state);
|
||||||
|
#else
|
||||||
|
unit->addUnitState(state);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2581,10 +2617,10 @@ namespace LuaUnit
|
|||||||
{
|
{
|
||||||
uint32 state = Eluna::CHECKVAL<uint32>(L, 2);
|
uint32 state = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
unit->clearUnitState(state);
|
|
||||||
#else
|
|
||||||
unit->ClearUnitState(state);
|
unit->ClearUnitState(state);
|
||||||
|
#else
|
||||||
|
unit->clearUnitState(state);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2644,7 +2680,7 @@ namespace LuaUnit
|
|||||||
// flat melee damage without resistence/etc reduction
|
// flat melee damage without resistence/etc reduction
|
||||||
if (school == MAX_SPELL_SCHOOL)
|
if (school == MAX_SPELL_SCHOOL)
|
||||||
{
|
{
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Unit::DealDamage(unit, target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, durabilityloss);
|
Unit::DealDamage(unit, target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, durabilityloss);
|
||||||
unit->SendAttackStateUpdate(HITINFO_AFFECTS_VICTIM, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_HIT, 0);
|
unit->SendAttackStateUpdate(HITINFO_AFFECTS_VICTIM, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_HIT, 0);
|
||||||
#else
|
#else
|
||||||
@@ -2656,7 +2692,7 @@ namespace LuaUnit
|
|||||||
|
|
||||||
SpellSchoolMask schoolmask = SpellSchoolMask(1 << school);
|
SpellSchoolMask schoolmask = SpellSchoolMask(1 << school);
|
||||||
|
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
if (Unit::IsDamageReducedByArmor(schoolmask))
|
if (Unit::IsDamageReducedByArmor(schoolmask))
|
||||||
damage = Unit::CalcArmorReducedDamage(unit, target, damage, NULL, BASE_ATTACK);
|
damage = Unit::CalcArmorReducedDamage(unit, target, damage, NULL, BASE_ATTACK);
|
||||||
#else
|
#else
|
||||||
@@ -2705,6 +2741,35 @@ namespace LuaUnit
|
|||||||
unit->DealDamageMods(dmgInfo.target, dmgInfo.damage, &dmgInfo.absorb);
|
unit->DealDamageMods(dmgInfo.target, dmgInfo.damage, &dmgInfo.absorb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
unit->SendSpellNonMeleeDamageLog(&dmgInfo);
|
||||||
|
unit->DealSpellDamage(&dmgInfo, true);
|
||||||
|
return 0;
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
if (!spell)
|
||||||
|
{
|
||||||
|
uint32 absorb = 0;
|
||||||
|
uint32 resist = 0;
|
||||||
|
unit->CalcAbsorbResist(unit, target, schoolmask, SPELL_DIRECT_DAMAGE, damage, &absorb, &resist);
|
||||||
|
if (damage <= absorb + resist)
|
||||||
|
damage = 0;
|
||||||
|
else
|
||||||
|
damage -= absorb + resist;
|
||||||
|
|
||||||
|
unit->DealDamageMods(target, damage, &absorb);
|
||||||
|
Unit::DealDamage(unit, target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false);
|
||||||
|
unit->SendAttackStateUpdate(HITINFO_AFFECTS_VICTIM, target, 0, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!spell)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
|
||||||
|
if (!spellInfo)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
SpellNonMeleeDamage dmgInfo(unit, target, spell, spellInfo->GetSchoolMask());
|
||||||
|
Unit::DealDamageMods(dmgInfo.target, dmgInfo.damage, &dmgInfo.absorb);
|
||||||
unit->SendSpellNonMeleeDamageLog(&dmgInfo);
|
unit->SendSpellNonMeleeDamageLog(&dmgInfo);
|
||||||
unit->DealSpellDamage(&dmgInfo, true);
|
unit->DealSpellDamage(&dmgInfo, true);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2748,7 +2813,18 @@ namespace LuaUnit
|
|||||||
uint32 amount = Eluna::CHECKVAL<uint32>(L, 4);
|
uint32 amount = Eluna::CHECKVAL<uint32>(L, 4);
|
||||||
bool critical = Eluna::CHECKVAL<bool>(L, 5, false);
|
bool critical = Eluna::CHECKVAL<bool>(L, 5, false);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#ifdef TRINITY
|
||||||
|
if (const SpellInfo* info = sSpellMgr->GetSpellInfo(spell))
|
||||||
|
{
|
||||||
|
HealInfo healInfo(unit, target, amount, info, info->GetSchoolMask());
|
||||||
|
unit->HealBySpell(healInfo, critical);
|
||||||
|
}
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
if (const SpellInfo* info = sSpellMgr->GetSpellInfo(spell))
|
||||||
|
{
|
||||||
|
unit->HealBySpell(target, info, amount, critical);
|
||||||
|
}
|
||||||
|
#else
|
||||||
#ifdef CMANGOS
|
#ifdef CMANGOS
|
||||||
SpellEntry const* spellEntry = GetSpellStore()->LookupEntry<SpellEntry>(spell);
|
SpellEntry const* spellEntry = GetSpellStore()->LookupEntry<SpellEntry>(spell);
|
||||||
#else
|
#else
|
||||||
@@ -2756,12 +2832,6 @@ namespace LuaUnit
|
|||||||
#endif
|
#endif
|
||||||
if (spellEntry)
|
if (spellEntry)
|
||||||
unit->DealHeal(target, amount, spellEntry, critical);
|
unit->DealHeal(target, amount, spellEntry, critical);
|
||||||
#else
|
|
||||||
if (const SpellInfo* info = sSpellMgr->GetSpellInfo(spell))
|
|
||||||
{
|
|
||||||
HealInfo healInfo(unit, target, amount, info, info->GetSchoolMask());
|
|
||||||
unit->HealBySpell(healInfo, critical);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2777,10 +2847,10 @@ namespace LuaUnit
|
|||||||
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
|
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
|
||||||
bool durLoss = Eluna::CHECKVAL<bool>(L, 3, true);
|
bool durLoss = Eluna::CHECKVAL<bool>(L, 3, true);
|
||||||
|
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
unit->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, durLoss);
|
|
||||||
#else
|
|
||||||
Unit::Kill(unit, target, durLoss);
|
Unit::Kill(unit, target, durLoss);
|
||||||
|
#else
|
||||||
|
unit->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, durLoss);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2815,6 +2885,13 @@ namespace LuaUnit
|
|||||||
|
|
||||||
#ifdef TRINITY
|
#ifdef TRINITY
|
||||||
unit->GetThreatManager().AddThreat(victim, threat, spell ? sSpellMgr->GetSpellInfo(spell) : NULL, true, true);
|
unit->GetThreatManager().AddThreat(victim, threat, spell ? sSpellMgr->GetSpellInfo(spell) : NULL, true, true);
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
uint32 schoolMask = Eluna::CHECKVAL<uint32>(L, 5, 0);
|
||||||
|
if (schoolMask > SPELL_SCHOOL_MASK_ALL)
|
||||||
|
{
|
||||||
|
return luaL_argerror(L, 4, "valid SpellSchoolMask expected");
|
||||||
|
}
|
||||||
|
unit->AddThreat(victim, threat, (SpellSchoolMask)schoolMask, spell ? sSpellMgr->GetSpellInfo(spell) : NULL);
|
||||||
#else
|
#else
|
||||||
#ifdef CMANGOS
|
#ifdef CMANGOS
|
||||||
SpellEntry const* spellEntry = GetSpellStore()->LookupEntry<SpellEntry>(spell);
|
SpellEntry const* spellEntry = GetSpellStore()->LookupEntry<SpellEntry>(spell);
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ namespace LuaVehicle
|
|||||||
int IsOnBoard(lua_State* L, Vehicle* vehicle)
|
int IsOnBoard(lua_State* L, Vehicle* vehicle)
|
||||||
{
|
{
|
||||||
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
|
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, vehicle->HasOnBoard(passenger));
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, passenger->IsOnVehicle(vehicle->GetBase()));
|
Eluna::Push(L, passenger->IsOnVehicle(vehicle->GetBase()));
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, vehicle->HasOnBoard(passenger));
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -38,10 +38,10 @@ namespace LuaVehicle
|
|||||||
*/
|
*/
|
||||||
int GetOwner(lua_State* L, Vehicle* vehicle)
|
int GetOwner(lua_State* L, Vehicle* vehicle)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, vehicle->GetOwner());
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, vehicle->GetBase());
|
Eluna::Push(L, vehicle->GetBase());
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, vehicle->GetOwner());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -53,10 +53,10 @@ namespace LuaVehicle
|
|||||||
*/
|
*/
|
||||||
int GetEntry(lua_State* L, Vehicle* vehicle)
|
int GetEntry(lua_State* L, Vehicle* vehicle)
|
||||||
{
|
{
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
Eluna::Push(L, vehicle->GetVehicleEntry()->m_ID);
|
|
||||||
#else
|
|
||||||
Eluna::Push(L, vehicle->GetVehicleInfo()->m_ID);
|
Eluna::Push(L, vehicle->GetVehicleInfo()->m_ID);
|
||||||
|
#else
|
||||||
|
Eluna::Push(L, vehicle->GetVehicleEntry()->m_ID);
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -84,11 +84,11 @@ namespace LuaVehicle
|
|||||||
{
|
{
|
||||||
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
|
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
|
||||||
int8 seatId = Eluna::CHECKVAL<int8>(L, 3);
|
int8 seatId = Eluna::CHECKVAL<int8>(L, 3);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
|
vehicle->AddPassenger(passenger, seatId);
|
||||||
|
#else
|
||||||
if (vehicle->CanBoard(passenger))
|
if (vehicle->CanBoard(passenger))
|
||||||
vehicle->Board(passenger, seatId);
|
vehicle->Board(passenger, seatId);
|
||||||
#else
|
|
||||||
vehicle->AddPassenger(passenger, seatId);
|
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -101,10 +101,10 @@ namespace LuaVehicle
|
|||||||
int RemovePassenger(lua_State* L, Vehicle* vehicle)
|
int RemovePassenger(lua_State* L, Vehicle* vehicle)
|
||||||
{
|
{
|
||||||
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
|
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
|
||||||
#ifndef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
vehicle->UnBoard(passenger, false);
|
|
||||||
#else
|
|
||||||
vehicle->RemovePassenger(passenger);
|
vehicle->RemovePassenger(passenger);
|
||||||
|
#else
|
||||||
|
vehicle->UnBoard(passenger, false);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,12 +183,16 @@ namespace LuaWorldObject
|
|||||||
|
|
||||||
Unit* target = NULL;
|
Unit* target = NULL;
|
||||||
ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_PLAYER, 0, hostile, dead);
|
ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_PLAYER, 0, hostile, dead);
|
||||||
#ifndef TRINITY
|
#ifdef TRINITY
|
||||||
MaNGOS::UnitLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(target, checker);
|
|
||||||
Cell::VisitWorldObjects(obj, searcher, range);
|
|
||||||
#else
|
|
||||||
Trinity::UnitLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
|
Trinity::UnitLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
|
||||||
Cell::VisitAllObjects(obj, searcher, range);
|
Cell::VisitAllObjects(obj, searcher, range);
|
||||||
|
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
Trinity::UnitLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
|
||||||
|
obj->VisitNearbyObject(range,searcher);
|
||||||
|
#else
|
||||||
|
MaNGOS::UnitLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(target, checker);
|
||||||
|
Cell::VisitWorldObjects(obj, searcher, range);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Eluna::Push(L, target);
|
Eluna::Push(L, target);
|
||||||
@@ -212,12 +216,15 @@ namespace LuaWorldObject
|
|||||||
|
|
||||||
GameObject* target = NULL;
|
GameObject* target = NULL;
|
||||||
ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_GAMEOBJECT, entry, hostile);
|
ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_GAMEOBJECT, entry, hostile);
|
||||||
#ifndef TRINITY
|
#ifdef TRINITY
|
||||||
MaNGOS::GameObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(target, checker);
|
|
||||||
Cell::VisitGridObjects(obj, searcher, range);
|
|
||||||
#else
|
|
||||||
Trinity::GameObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
|
Trinity::GameObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
|
||||||
Cell::VisitAllObjects(obj, searcher, range);
|
Cell::VisitAllObjects(obj, searcher, range);
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
Trinity::GameObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
|
||||||
|
obj->VisitNearbyObject(range, searcher);
|
||||||
|
#else
|
||||||
|
MaNGOS::GameObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(target, checker);
|
||||||
|
Cell::VisitGridObjects(obj, searcher, range);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Eluna::Push(L, target);
|
Eluna::Push(L, target);
|
||||||
@@ -243,12 +250,16 @@ namespace LuaWorldObject
|
|||||||
|
|
||||||
Creature* target = NULL;
|
Creature* target = NULL;
|
||||||
ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_UNIT, entry, hostile, dead);
|
ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_UNIT, entry, hostile, dead);
|
||||||
#ifndef TRINITY
|
#ifdef TRINITY
|
||||||
MaNGOS::CreatureLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(target, checker);
|
|
||||||
Cell::VisitGridObjects(obj, searcher, range);
|
|
||||||
#else
|
|
||||||
Trinity::CreatureLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
|
Trinity::CreatureLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
|
||||||
Cell::VisitAllObjects(obj, searcher, range);
|
Cell::VisitAllObjects(obj, searcher, range);
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
Trinity::CreatureLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
|
||||||
|
obj->VisitNearbyObject(range, searcher);
|
||||||
|
#else
|
||||||
|
MaNGOS::CreatureLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(target, checker);
|
||||||
|
Cell::VisitGridObjects(obj, searcher, range);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Eluna::Push(L, target);
|
Eluna::Push(L, target);
|
||||||
@@ -272,12 +283,15 @@ namespace LuaWorldObject
|
|||||||
|
|
||||||
std::list<Player*> list;
|
std::list<Player*> list;
|
||||||
ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_PLAYER, 0, hostile, dead);
|
ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_PLAYER, 0, hostile, dead);
|
||||||
#ifndef TRINITY
|
#ifdef TRINITY
|
||||||
MaNGOS::PlayerListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(list, checker);
|
|
||||||
Cell::VisitWorldObjects(obj, searcher, range);
|
|
||||||
#else
|
|
||||||
Trinity::PlayerListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
Trinity::PlayerListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
||||||
Cell::VisitAllObjects(obj, searcher, range);
|
Cell::VisitAllObjects(obj, searcher, range);
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
Trinity::PlayerListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
||||||
|
obj->VisitNearbyObject(range, searcher);
|
||||||
|
#else
|
||||||
|
MaNGOS::PlayerListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(list, checker);
|
||||||
|
Cell::VisitWorldObjects(obj, searcher, range);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
lua_createtable(L, list.size(), 0);
|
lua_createtable(L, list.size(), 0);
|
||||||
@@ -313,12 +327,15 @@ namespace LuaWorldObject
|
|||||||
|
|
||||||
std::list<Creature*> list;
|
std::list<Creature*> list;
|
||||||
ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_UNIT, entry, hostile, dead);
|
ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_UNIT, entry, hostile, dead);
|
||||||
#ifndef TRINITY
|
#ifdef TRINITY
|
||||||
MaNGOS::CreatureListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(list, checker);
|
|
||||||
Cell::VisitGridObjects(obj, searcher, range);
|
|
||||||
#else
|
|
||||||
Trinity::CreatureListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
Trinity::CreatureListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
||||||
Cell::VisitAllObjects(obj, searcher, range);
|
Cell::VisitAllObjects(obj, searcher, range);
|
||||||
|
#elif defined AZEROTHCORE
|
||||||
|
Trinity::CreatureListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
||||||
|
obj->VisitNearbyObject(range, searcher);
|
||||||
|
#else
|
||||||
|
MaNGOS::CreatureListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(list, checker);
|
||||||
|
Cell::VisitGridObjects(obj, searcher, range);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
lua_createtable(L, list.size(), 0);
|
lua_createtable(L, list.size(), 0);
|
||||||
@@ -352,12 +369,15 @@ namespace LuaWorldObject
|
|||||||
|
|
||||||
std::list<GameObject*> list;
|
std::list<GameObject*> list;
|
||||||
ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_GAMEOBJECT, entry, hostile);
|
ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_GAMEOBJECT, entry, hostile);
|
||||||
#ifndef TRINITY
|
#ifdef TRINITY
|
||||||
MaNGOS::GameObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(list, checker);
|
|
||||||
Cell::VisitGridObjects(obj, searcher, range);
|
|
||||||
#else
|
|
||||||
Trinity::GameObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
Trinity::GameObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
||||||
Cell::VisitAllObjects(obj, searcher, range);
|
Cell::VisitAllObjects(obj, searcher, range);
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
Trinity::GameObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
||||||
|
obj->VisitNearbyObject(range, searcher);
|
||||||
|
#else
|
||||||
|
MaNGOS::GameObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(list, checker);
|
||||||
|
Cell::VisitGridObjects(obj, searcher, range);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
lua_createtable(L, list.size(), 0);
|
lua_createtable(L, list.size(), 0);
|
||||||
@@ -399,12 +419,15 @@ namespace LuaWorldObject
|
|||||||
ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, type, entry, hostile, dead);
|
ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, type, entry, hostile, dead);
|
||||||
|
|
||||||
WorldObject* target = NULL;
|
WorldObject* target = NULL;
|
||||||
#ifndef TRINITY
|
#ifdef TRINITY
|
||||||
MaNGOS::WorldObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(target, checker);
|
|
||||||
Cell::VisitAllObjects(obj, searcher, range);
|
|
||||||
#else
|
|
||||||
Trinity::WorldObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
|
Trinity::WorldObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
|
||||||
Cell::VisitAllObjects(obj, searcher, range);
|
Cell::VisitAllObjects(obj, searcher, range);
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
Trinity::WorldObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
|
||||||
|
obj->VisitNearbyObject(range, searcher);
|
||||||
|
#else
|
||||||
|
MaNGOS::WorldObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(target, checker);
|
||||||
|
Cell::VisitAllObjects(obj, searcher, range);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Eluna::Push(L, target);
|
Eluna::Push(L, target);
|
||||||
@@ -436,12 +459,15 @@ namespace LuaWorldObject
|
|||||||
ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, type, entry, hostile, dead);
|
ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, type, entry, hostile, dead);
|
||||||
|
|
||||||
std::list<WorldObject*> list;
|
std::list<WorldObject*> list;
|
||||||
#ifndef TRINITY
|
#ifdef TRINITY
|
||||||
MaNGOS::WorldObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(list, checker);
|
|
||||||
Cell::VisitAllObjects(obj, searcher, range);
|
|
||||||
#else
|
|
||||||
Trinity::WorldObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
Trinity::WorldObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
||||||
Cell::VisitAllObjects(obj, searcher, range);
|
Cell::VisitAllObjects(obj, searcher, range);
|
||||||
|
#elif AZEROTHCORE
|
||||||
|
Trinity::WorldObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
||||||
|
obj->VisitNearbyObject(range, searcher);
|
||||||
|
#else
|
||||||
|
MaNGOS::WorldObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(list, checker);
|
||||||
|
Cell::VisitAllObjects(obj, searcher, range);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
lua_createtable(L, list.size(), 0);
|
lua_createtable(L, list.size(), 0);
|
||||||
@@ -632,8 +658,7 @@ namespace LuaWorldObject
|
|||||||
int GetAngle(lua_State* L, WorldObject* obj)
|
int GetAngle(lua_State* L, WorldObject* obj)
|
||||||
{
|
{
|
||||||
WorldObject* target = Eluna::CHECKOBJ<WorldObject>(L, 2, false);
|
WorldObject* target = Eluna::CHECKOBJ<WorldObject>(L, 2, false);
|
||||||
|
#if defined TRINITY && !AZEROTHCORE
|
||||||
#ifdef TRINITY
|
|
||||||
if (target)
|
if (target)
|
||||||
Eluna::Push(L, obj->GetAbsoluteAngle(target));
|
Eluna::Push(L, obj->GetAbsoluteAngle(target));
|
||||||
else
|
else
|
||||||
@@ -690,11 +715,13 @@ namespace LuaWorldObject
|
|||||||
float z = Eluna::CHECKVAL<float>(L, 5);
|
float z = Eluna::CHECKVAL<float>(L, 5);
|
||||||
float o = Eluna::CHECKVAL<float>(L, 6);
|
float o = Eluna::CHECKVAL<float>(L, 6);
|
||||||
uint32 respawnDelay = Eluna::CHECKVAL<uint32>(L, 7, 30);
|
uint32 respawnDelay = Eluna::CHECKVAL<uint32>(L, 7, 30);
|
||||||
#ifndef TRINITY
|
#ifdef TRINITY
|
||||||
Eluna::Push(L, obj->SummonGameObject(entry, x, y, z, o, respawnDelay));
|
|
||||||
#else
|
|
||||||
QuaternionData rot = QuaternionData::fromEulerAnglesZYX(o, 0.f, 0.f);
|
QuaternionData rot = QuaternionData::fromEulerAnglesZYX(o, 0.f, 0.f);
|
||||||
Eluna::Push(L, obj->SummonGameObject(entry, Position(x, y, z, o), rot, respawnDelay));
|
Eluna::Push(L, obj->SummonGameObject(entry, Position(x, y, z, o), rot, 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
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -748,7 +775,7 @@ namespace LuaWorldObject
|
|||||||
type = TEMPSUMMON_TIMED_DESPAWN;
|
type = TEMPSUMMON_TIMED_DESPAWN;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
#ifdef TRINITY
|
#if defined TRINITY || AZEROTHCORE
|
||||||
type = TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT;
|
type = TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT;
|
||||||
#else
|
#else
|
||||||
type = TEMPSUMMON_TIMED_OOC_DESPAWN;
|
type = TEMPSUMMON_TIMED_OOC_DESPAWN;
|
||||||
@@ -766,7 +793,7 @@ namespace LuaWorldObject
|
|||||||
case 8:
|
case 8:
|
||||||
type = TEMPSUMMON_MANUAL_DESPAWN;
|
type = TEMPSUMMON_MANUAL_DESPAWN;
|
||||||
break;
|
break;
|
||||||
#ifndef TRINITY
|
#if !defined TRINITY && !AZEROTHCORE
|
||||||
case 9:
|
case 9:
|
||||||
type = TEMPSUMMON_TIMED_OOC_OR_CORPSE_DESPAWN;
|
type = TEMPSUMMON_TIMED_OOC_OR_CORPSE_DESPAWN;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user