Skip to content

Commit

Permalink
CMaNGOS method header cleanup
Browse files Browse the repository at this point in the history
-Remove all other core defines in headers
-Add CMaNGOS Cata compatibility
  • Loading branch information
Niam5 committed Jul 31, 2023
1 parent e53e406 commit 9ffa66a
Show file tree
Hide file tree
Showing 21 changed files with 201 additions and 2,687 deletions.
36 changes: 1 addition & 35 deletions CMangos/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 @@ -54,11 +50,7 @@ namespace LuaAura
*/
int GetCasterLevel(lua_State* L, Aura* aura)
{
#if defined(TRINITY) || CMANGOS
Eluna::Push(L, aura->GetCaster()->GetLevel());
#else
Eluna::Push(L, aura->GetCaster()->getLevel());
#endif
return 1;
}

Expand All @@ -69,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 @@ -98,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 @@ -126,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 @@ -142,15 +122,11 @@ 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 @@ -166,15 +142,11 @@ 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 @@ -190,9 +162,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);
#elif defined CMANGOS
#ifndef CATA
aura->GetHolder()->SetStackAmount(amount, aura->GetTarget());
#else
aura->GetHolder()->SetStackAmount(amount);
Expand All @@ -205,11 +175,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
28 changes: 1 addition & 27 deletions CMangos/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 @@ -88,11 +84,7 @@ namespace LuaBattleGround
*/
int GetEndTime(lua_State* L, BattleGround* bg)
{
#ifdef CATA
Eluna::Push(L, bg->GetRemainingTime());
#else
Eluna::Push(L, bg->GetEndTime());
#endif
return 1;
}

Expand All @@ -106,11 +98,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 All @@ -121,7 +109,7 @@ namespace LuaBattleGround
*/
int GetInstanceId(lua_State* L, BattleGround* bg)
{
#ifdef CMANGOS
#ifndef CATA
Eluna::Push(L, bg->GetInstanceId());
#else
Eluna::Push(L, bg->GetInstanceID());
Expand All @@ -147,13 +135,7 @@ namespace LuaBattleGround
*/
int GetTypeId(lua_State* L, BattleGround* bg)
{
#ifdef CMANGOS
Eluna::Push(L, bg->GetTypeId());
#elif !AZEROTHCORE
Eluna::Push(L, bg->GetTypeID());
#else
Eluna::Push(L, bg->GetBgTypeID());
#endif
return 1;
}

Expand Down Expand Up @@ -186,11 +168,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 @@ -201,11 +179,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 CMangos/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
Loading

0 comments on commit 9ffa66a

Please sign in to comment.