Skip to content

Commit

Permalink
drop all non-AC/WOTLK related code within #if-blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
sudlud committed Jul 5, 2024
1 parent 2378298 commit 6ab56bc
Show file tree
Hide file tree
Showing 31 changed files with 63 additions and 2,424 deletions.
42 changes: 0 additions & 42 deletions src/LuaEngine/AuraMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ namespace LuaAura
*/
int GetCasterGUID(lua_State* L, Aura* aura)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, aura->GetCasterGUID());
#else
Eluna::Push(L, aura->GetCasterGuid());
#endif
return 1;
}

Expand All @@ -65,11 +61,7 @@ namespace LuaAura
*/
int GetDuration(lua_State* L, Aura* aura)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, aura->GetDuration());
#else
Eluna::Push(L, aura->GetAuraDuration());
#endif
return 1;
}

Expand All @@ -94,11 +86,7 @@ namespace LuaAura
*/
int GetMaxDuration(lua_State* L, Aura* aura)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, aura->GetMaxDuration());
#else
Eluna::Push(L, aura->GetAuraMaxDuration());
#endif
return 1;
}

Expand All @@ -122,11 +110,7 @@ namespace LuaAura
*/
int GetOwner(lua_State* L, Aura* aura)
{
#if defined TRINITY || defined AZEROTHCORE
Eluna::Push(L, aura->GetOwner());
#else
Eluna::Push(L, aura->GetTarget());
#endif
return 1;
}

Expand All @@ -138,16 +122,7 @@ namespace LuaAura
int SetDuration(lua_State* L, Aura* aura)
{
int32 duration = Eluna::CHECKVAL<int32>(L, 2);
#if defined TRINITY || defined AZEROTHCORE
aura->SetDuration(duration);
#else
aura->GetHolder()->SetAuraDuration(duration);
#if (defined(TBC) || defined(CLASSIC))
aura->GetHolder()->UpdateAuraDuration();
#else
aura->GetHolder()->SendAuraUpdate(false);
#endif
#endif
return 0;
}

Expand All @@ -162,16 +137,7 @@ namespace LuaAura
int SetMaxDuration(lua_State* L, Aura* aura)
{
int32 duration = Eluna::CHECKVAL<int32>(L, 2);
#if defined TRINITY || defined AZEROTHCORE
aura->SetMaxDuration(duration);
#else
aura->GetHolder()->SetAuraMaxDuration(duration);
#if (defined(TBC) || defined(CLASSIC))
aura->GetHolder()->UpdateAuraDuration();
#else
aura->GetHolder()->SendAuraUpdate(false);
#endif
#endif
return 0;
}

Expand All @@ -186,11 +152,7 @@ namespace LuaAura
int SetStackAmount(lua_State* L, Aura* aura)
{
uint8 amount = Eluna::CHECKVAL<uint8>(L, 2);
#if defined TRINITY || defined AZEROTHCORE
aura->SetStackAmount(amount);
#else
aura->GetHolder()->SetStackAmount(amount);
#endif
return 0;
}

Expand All @@ -199,11 +161,7 @@ namespace LuaAura
*/
int Remove(lua_State* L, Aura* aura)
{
#if defined TRINITY || defined AZEROTHCORE
aura->Remove();
#else
aura->GetTarget()->RemoveSpellAuraHolder(aura->GetHolder(), AURA_REMOVE_BY_CANCEL);
#endif
Eluna::CHECKOBJ<ElunaObject>(L, 1)->Invalidate();
return 0;
}
Expand Down
4 changes: 0 additions & 4 deletions src/LuaEngine/BattleGroundHooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ void Eluna::OnBGStart(BattleGround* bg, BattleGroundTypeId bgId, uint32 instance
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)
#endif
{
START_HOOK(BG_EVENT_ON_END);
Push(bg);
Expand Down
37 changes: 0 additions & 37 deletions src/LuaEngine/BattleGroundMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ namespace LuaBattleGround
{
uint32 team = Eluna::CHECKVAL<uint32>(L, 2);

#ifndef AZEROTHCORE
Eluna::Push(L, bg->GetAlivePlayersCountByTeam((Team)team));
#else
Eluna::Push(L, bg->GetAlivePlayersCountByTeam((TeamId)team));
#endif
return 1;
}

Expand Down Expand Up @@ -68,31 +64,14 @@ namespace LuaBattleGround
return 1;
}

#ifndef AZEROTHCORE
/**
* Returns the bracket ID of the specific [BattleGround].
*
* @return [BattleGroundBracketId] bracketId
*/
int GetBracketId(lua_State* L, BattleGround* bg)
{
Eluna::Push(L, bg->GetBracketId());
return 1;
}
#endif

/**
* Returns the end time of the [BattleGround].
*
* @return uint32 endTime
*/
int GetEndTime(lua_State* L, BattleGround* bg)
{
#ifdef CATA
Eluna::Push(L, bg->GetRemainingTime());
#else
Eluna::Push(L, bg->GetEndTime());
#endif
return 1;
}

Expand All @@ -106,11 +85,7 @@ namespace LuaBattleGround
{
uint32 team = Eluna::CHECKVAL<uint32>(L, 2);

#ifndef AZEROTHCORE
Eluna::Push(L, bg->GetFreeSlotsForTeam((Team)team));
#else
Eluna::Push(L, bg->GetFreeSlotsForTeam((TeamId)team));
#endif
return 1;
}

Expand Down Expand Up @@ -143,11 +118,7 @@ namespace LuaBattleGround
*/
int GetTypeId(lua_State* L, BattleGround* bg)
{
#ifndef AZEROTHCORE
Eluna::Push(L, bg->GetTypeID());
#else
Eluna::Push(L, bg->GetBgTypeID());
#endif
return 1;
}

Expand Down Expand Up @@ -180,11 +151,7 @@ namespace LuaBattleGround
*/
int GetMaxPlayers(lua_State* L, BattleGround* bg)
{
#ifndef AZEROTHCORE
Eluna::Push(L, bg->GetMaxPlayers());
#else
Eluna::Push(L, bg->GetMaxPlayersPerTeam() * 2);
#endif
return 1;
}

Expand All @@ -195,11 +162,7 @@ namespace LuaBattleGround
*/
int GetMinPlayers(lua_State* L, BattleGround* bg)
{
#ifndef AZEROTHCORE
Eluna::Push(L, bg->GetMinPlayers());
#else
Eluna::Push(L, bg->GetMaxPlayersPerTeam() * 2);
#endif
return 1;
}

Expand Down
4 changes: 0 additions & 4 deletions src/LuaEngine/CorpseMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ namespace LuaCorpse
*/
int GetOwnerGUID(lua_State* L, Corpse* corpse)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, corpse->GetOwnerGUID());
#else
Eluna::Push(L, corpse->GetOwnerGuid());
#endif
return 1;
}

Expand Down
4 changes: 0 additions & 4 deletions src/LuaEngine/CreatureHooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,6 @@ bool Eluna::SpellHitTarget(Creature* me, WorldObject* target, SpellInfo const* s
return CallAllFunctionsBool(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key);
}

#if defined TRINITY || AZEROTHCORE

bool Eluna::SummonedCreatureDies(Creature* me, Creature* summon, Unit* killer)
{
START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_SUMMONED_CREATURE_DIED, me, false);
Expand All @@ -329,5 +327,3 @@ bool Eluna::OwnerAttacked(Creature* me, Unit* target)
Push(target);
return CallAllFunctionsBool(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key);
}

#endif // TRINITY
Loading

0 comments on commit 6ab56bc

Please sign in to comment.