Skip to content

Commit

Permalink
Rename defines to correct names and minor clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Niam5 committed Feb 3, 2025
1 parent c99f83f commit cfd9cdf
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 50 deletions.
4 changes: 2 additions & 2 deletions LuaEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -989,13 +989,13 @@ int Eluna::Register(uint8 regtype, uint32 entry, ObjectGuid guid, uint32 instanc
void Eluna::UpdateEluna(uint32 diff)
{
if (reload && sElunaLoader->GetCacheState() == SCRIPT_CACHE_READY)
#if defined ELUNA_TRINITY && ELUNA_EXPANSION == WOTLK
#if defined ELUNA_TRINITY && ELUNA_EXPANSION != EXP_RETAIL
if(!GetQueryProcessor().HasPendingCallbacks())
#endif
_ReloadEluna();

eventMgr->globalProcessor->Update(diff);
#if defined ELUNA_TRINITY && ELUNA_EXPANSION == WOTLK
#if defined ELUNA_TRINITY && ELUNA_EXPANSION != EXP_RETAIL
GetQueryProcessor().ProcessReadyCallbacks();
#endif
}
Expand Down
4 changes: 2 additions & 2 deletions hooks/ItemHooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ bool Eluna::OnItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targ

bool Eluna::OnExpire(Player* pPlayer, ItemTemplate const* pProto)
{
#if defined ELUNA_TRINITY && ELUNA_EXPANSION >= CATA
#if defined ELUNA_TRINITY && ELUNA_EXPANSION >= EXP_CATA
START_HOOK_WITH_RETVAL(ITEM_EVENT_ON_EXPIRE, pProto->BasicData->ID, false);
#else
START_HOOK_WITH_RETVAL(ITEM_EVENT_ON_EXPIRE, pProto->ItemId, false);
#endif
HookPush(pPlayer);
#if defined ELUNA_TRINITY && ELUNA_EXPANSION >= CATA
#if defined ELUNA_TRINITY && ELUNA_EXPANSION >= EXP_CATA
HookPush(pProto->BasicData->ID);
#else
HookPush(pProto->ItemId);
Expand Down
2 changes: 1 addition & 1 deletion methods/TrinityCore/BattleGroundMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ namespace LuaBattleGround
*/
int GetEndTime(Eluna* E, BattleGround* bg)
{
#if ELUNA_EXPANSION >= CATA
#if ELUNA_EXPANSION >= EXP_CATA
E->Push(bg->GetRemainingTime());
#else
E->Push(bg->GetEndTime());
Expand Down
36 changes: 16 additions & 20 deletions methods/TrinityCore/GlobalMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ namespace LuaGlobalFunctions
/**
* Returns emulator's supported expansion.
*
* Expansion is 0 for pre-TBC, 1 for TBC, 2 for WotLK, 3 for Cataclysm, 9 for Dragonflight.
* Expansion is 0 for pre-TBC, 1 for TBC, 2 for WotLK, 3 for Cataclysm, 9 for Retail.
*
* @return int32 expansion
*/
Expand Down Expand Up @@ -1830,7 +1830,7 @@ namespace LuaGlobalFunctions
uint32 incrtime = E->CHECKVAL<uint32>(4);
uint32 extendedcost = E->CHECKVAL<uint32>(5);

#if ELUNA_EXPANSION >= CATA
#if ELUNA_EXPANSION >= EXP_CATA
VendorItem vItem;
vItem.item = item;
vItem.maxcount = maxcount;
Expand Down Expand Up @@ -1863,7 +1863,7 @@ namespace LuaGlobalFunctions
if (!eObjectMgr->GetCreatureTemplate(entry))
return luaL_argerror(E->L, 1, "valid CreatureEntry expected");

#if ELUNA_EXPANSION >= CATA
#if ELUNA_EXPANSION >= EXP_CATA
eObjectMgr->RemoveVendorItem(entry, item, 1);
#else
eObjectMgr->RemoveVendorItem(entry, item);
Expand All @@ -1887,7 +1887,7 @@ namespace LuaGlobalFunctions

auto const itemlist = items->m_items;
for (auto itr = itemlist.begin(); itr != itemlist.end(); ++itr)
#if ELUNA_EXPANSION >= CATA
#if ELUNA_EXPANSION >= EXP_CATA
eObjectMgr->RemoveVendorItem(entry, itr->item, 1);
#else
eObjectMgr->RemoveVendorItem(entry, itr->item);
Expand Down Expand Up @@ -2295,7 +2295,6 @@ namespace LuaGlobalFunctions
return 1;
}
#endif

/**
* Returns `true` if Eluna is in compatibility mode, `false` if in multistate.
*
Expand Down Expand Up @@ -3161,33 +3160,33 @@ namespace LuaGlobalFunctions
{ "GetGuildByName", &LuaGlobalFunctions::GetGuildByName },
{ "GetGuildByLeaderGUID", &LuaGlobalFunctions::GetGuildByLeaderGUID },
{ "GetPlayerCount", &LuaGlobalFunctions::GetPlayerCount },
{ "GetGUIDLow", &LuaGlobalFunctions::GetGUIDLow },
{ "GetGUIDType", &LuaGlobalFunctions::GetGUIDType },
{ "GetGUIDEntry", &LuaGlobalFunctions::GetGUIDEntry },
#if ELUNA_EXPANSION < EXP_RETAIL
{ "GetPlayerGUID", &LuaGlobalFunctions::GetPlayerGUID },
{ "GetItemGUID", &LuaGlobalFunctions::GetItemGUID },
{ "GetObjectGUID", &LuaGlobalFunctions::GetObjectGUID },
{ "GetUnitGUID", &LuaGlobalFunctions::GetUnitGUID },
{ "GetGUIDLow", &LuaGlobalFunctions::GetGUIDLow },
{ "GetGUIDType", &LuaGlobalFunctions::GetGUIDType },
{ "GetGUIDEntry", &LuaGlobalFunctions::GetGUIDEntry },
{ "GetAreaName", &LuaGlobalFunctions::GetAreaName },
{ "GetItemLink", &LuaGlobalFunctions::GetItemLink },
#else
{ "GetPlayerGUID", METHOD_REG_NONE },
{ "GetItemGUID", METHOD_REG_NONE },
{ "GetObjectGUID", METHOD_REG_NONE },
{ "GetUnitGUID", METHOD_REG_NONE },
{ "GetGUIDLow", METHOD_REG_NONE },
{ "GetGUIDType", METHOD_REG_NONE },
{ "GetGUIDEntry", METHOD_REG_NONE },
{ "GetAreaName", METHOD_REG_NONE },
{ "GetItemLink", METHOD_REG_NONE },
#endif
{ "bit_not", &LuaGlobalFunctions::bit_not },
{ "bit_xor", &LuaGlobalFunctions::bit_xor },
{ "bit_rshift", &LuaGlobalFunctions::bit_rshift },
{ "bit_lshift", &LuaGlobalFunctions::bit_lshift },
{ "bit_or", &LuaGlobalFunctions::bit_or },
{ "bit_and", &LuaGlobalFunctions::bit_and },
#if ELUNA_EXPANSION < EXP_RETAIL
{ "GetItemLink", &LuaGlobalFunctions::GetItemLink },
#else
{ "GetItemLink", METHOD_REG_NONE },
#endif
{ "GetMapById", &LuaGlobalFunctions::GetMapById, METHOD_REG_WORLD }, // World state method only in multistate
{ "GetCurrTime", &LuaGlobalFunctions::GetCurrTime },
{ "GetTimeDiff", &LuaGlobalFunctions::GetTimeDiff },
Expand Down Expand Up @@ -3223,23 +3222,20 @@ namespace LuaGlobalFunctions
#if ELUNA_EXPANSION < EXP_RETAIL
{ "PerformIngameSpawn", &LuaGlobalFunctions::PerformIngameSpawn },
{ "CreatePacket", &LuaGlobalFunctions::CreatePacket },
{ "SendMail", &LuaGlobalFunctions::SendMail },
{ "AddTaxiPath", &LuaGlobalFunctions::AddTaxiPath },
#else
{ "PerformIngameSpawn", METHOD_REG_NONE },
{ "CreatePacket", METHOD_REG_NONE },
{ "SendMail", METHOD_REG_NONE },
{ "AddTaxiPath", METHOD_REG_NONE },
#endif
{ "AddVendorItem", &LuaGlobalFunctions::AddVendorItem },
{ "VendorRemoveItem", &LuaGlobalFunctions::VendorRemoveItem },
{ "VendorRemoveAllItems", &LuaGlobalFunctions::VendorRemoveAllItems },
{ "Kick", &LuaGlobalFunctions::Kick },
{ "Ban", &LuaGlobalFunctions::Ban },
{ "SaveAllPlayers", &LuaGlobalFunctions::SaveAllPlayers },
#if ELUNA_EXPANSION < EXP_RETAIL
{ "SendMail", &LuaGlobalFunctions::SendMail },
{ "AddTaxiPath", &LuaGlobalFunctions::AddTaxiPath },
#else
{ "SendMail", METHOD_REG_NONE },
{ "AddTaxiPath", METHOD_REG_NONE },
#endif
{ "CreateInt64", &LuaGlobalFunctions::CreateLongLong },
{ "CreateUint64", &LuaGlobalFunctions::CreateULongLong },
{ "StartGameEvent", &LuaGlobalFunctions::StartGameEvent },
Expand Down
4 changes: 2 additions & 2 deletions methods/TrinityCore/GuildMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ namespace LuaGuild
return 1;
}

#if ELUNA_EXPANSION < CATA
#if ELUNA_EXPANSION < EXP_CATA
/**
* Sets the leader of this [Guild]
*
Expand Down Expand Up @@ -293,7 +293,7 @@ namespace LuaGuild
#if ELUNA_EXPANSION < CATA
{ "SetLeader", &LuaGuild::SetLeader, METHOD_REG_WORLD }, // World state method only in multistate
#else
{ "SetLeader", METHOD_REG_NONE }, // World state method only in multistate
{ "SetLeader", METHOD_REG_NONE },
#endif

// Other
Expand Down
22 changes: 11 additions & 11 deletions methods/TrinityCore/ItemMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ namespace LuaItem
*/
int GetClass(Eluna* E, Item* item)
{
#if ELUNA_EXPANSION >= CATA
#if ELUNA_EXPANSION >= EXP_CATA
E->Push(item->GetTemplate()->GetClass());
#else
E->Push(item->GetTemplate()->Class);
Expand All @@ -441,7 +441,7 @@ namespace LuaItem
*/
int GetSubClass(Eluna* E, Item* item)
{
#if ELUNA_EXPANSION >= CATA
#if ELUNA_EXPANSION >= EXP_CATA
E->Push(item->GetTemplate()->GetSubClass());
#else
E->Push(item->GetTemplate()->SubClass);
Expand Down Expand Up @@ -471,7 +471,7 @@ namespace LuaItem
*/
int GetName(Eluna* E, Item* item)
{
#if ELUNA_EXPANSION >= CATA
#if ELUNA_EXPANSION >= EXP_CATA
E->Push(item->GetTemplate()->GetDefaultLocaleName());
#else
E->Push(item->GetTemplate()->Name1);
Expand Down Expand Up @@ -499,7 +499,7 @@ namespace LuaItem
*/
int GetQuality(Eluna* E, Item* item)
{
#if ELUNA_EXPANSION >= CATA
#if ELUNA_EXPANSION >= EXP_CATA
E->Push(item->GetTemplate()->GetQuality());
#else
E->Push(item->GetTemplate()->Quality);
Expand Down Expand Up @@ -549,7 +549,7 @@ namespace LuaItem
*/
int GetBuyCount(Eluna* E, Item* item)
{
#if ELUNA_EXPANSION >= CATA
#if ELUNA_EXPANSION >= EXP_CATA
E->Push(item->GetTemplate()->GetBuyCount());
#else
E->Push(item->GetTemplate()->BuyCount);
Expand All @@ -564,7 +564,7 @@ namespace LuaItem
*/
int GetBuyPrice(Eluna* E, Item* item)
{
#if ELUNA_EXPANSION >= CATA
#if ELUNA_EXPANSION >= EXP_CATA
E->Push(item->GetTemplate()->GetBuyPrice());
#else
E->Push(item->GetTemplate()->BuyPrice);
Expand All @@ -579,7 +579,7 @@ namespace LuaItem
*/
int GetSellPrice(Eluna* E, Item* item)
{
#if ELUNA_EXPANSION >= CATA
#if ELUNA_EXPANSION >= EXP_CATA
E->Push(item->GetTemplate()->GetSellPrice());
#else
E->Push(item->GetTemplate()->SellPrice);
Expand All @@ -594,7 +594,7 @@ namespace LuaItem
*/
int GetInventoryType(Eluna* E, Item* item)
{
#if ELUNA_EXPANSION >= CATA
#if ELUNA_EXPANSION >= EXP_CATA
E->Push(item->GetTemplate()->GetInventoryType());
#else
E->Push(item->GetTemplate()->InventoryType);
Expand All @@ -609,7 +609,7 @@ namespace LuaItem
*/
int GetAllowableClass(Eluna* E, Item* item)
{
#if ELUNA_EXPANSION >= CATA
#if ELUNA_EXPANSION >= EXP_CATA
E->Push(item->GetTemplate()->GetAllowableClass());
#else
E->Push(item->GetTemplate()->AllowableClass);
Expand Down Expand Up @@ -637,7 +637,7 @@ namespace LuaItem
*/
int GetItemLevel(Eluna* E, Item* item)
{
#if ELUNA_EXPANSION >= CATA
#if ELUNA_EXPANSION >= EXP_CATA
E->Push(item->GetTemplate()->GetBaseItemLevel());
#else
E->Push(item->GetTemplate()->ItemLevel);
Expand Down Expand Up @@ -704,7 +704,7 @@ namespace LuaItem
*/
int GetItemSet(Eluna* E, Item* item)
{
#if ELUNA_EXPANSION >= CATA
#if ELUNA_EXPANSION >= EXP_CATA
E->Push(item->GetTemplate()->GetItemSet());
#else
E->Push(item->GetTemplate()->ItemSet);
Expand Down
15 changes: 9 additions & 6 deletions methods/TrinityCore/PlayerMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -1992,7 +1992,7 @@ namespace LuaPlayer
return 0;
}

#if ELUNA_EXPANSION < CATA
#if ELUNA_EXPANSION < EXP_CATA
/**
* Sets the [Player]s Arena Points to the amount specified
*
Expand Down Expand Up @@ -2123,7 +2123,7 @@ namespace LuaPlayer
*
* @param int32 movementType
*/
#if ELUNA_EXPANSION < CATA
#if ELUNA_EXPANSION < EXP_CATA
int SetMovement(Eluna* E, Player* player)
{
int32 pType = E->CHECKVAL<int32>(2);
Expand Down Expand Up @@ -2182,7 +2182,7 @@ namespace LuaPlayer
return 0;
}

#if ELUNA_EXPANSION < CATA
#if ELUNA_EXPANSION < EXP_CATA
/**
* Adds or detracts from the [Player]s current Arena Points
*
Expand Down Expand Up @@ -2363,7 +2363,7 @@ namespace LuaPlayer
{
Creature* obj = E->CHECKOBJ<Creature>(2);

#if ELUNA_EXPANSION >= CATA
#if ELUNA_EXPANSION >= EXP_CATA
player->GetSession()->SendTrainerList(obj, NULL);
#else
player->GetSession()->SendTrainerList(obj);
Expand Down Expand Up @@ -2614,7 +2614,7 @@ namespace LuaPlayer
*/
int ResetTalentsCost(Eluna* E, Player* player)
{
#if ELUNA_EXPANSION >= CATA
#if ELUNA_EXPANSION >= EXP_CATA
E->Push(player->GetNextResetTalentsCost());
#else
E->Push(player->ResetTalentsCost());
Expand Down Expand Up @@ -3719,7 +3719,7 @@ namespace LuaPlayer
if (!quest)
return 0;

#if ELUNA_EXPANSION >= CATA
#if ELUNA_EXPANSION >= EXP_CATA
player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, player->GET_GUID(), activateAccept, true);
#else
player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, player->GET_GUID(), activateAccept);
Expand Down Expand Up @@ -4362,10 +4362,13 @@ namespace LuaPlayer
{ "GetHonorStoredKills", METHOD_REG_NONE }, // classic only
{ "GetRankPoints", METHOD_REG_NONE }, // classic only
{ "GetHonorLastWeekStandingPos", METHOD_REG_NONE }, // classic only

{ "SetHonorStoredKills", METHOD_REG_NONE }, // classic only
{ "SetRankPoints", METHOD_REG_NONE }, // classic only
{ "SetHonorLastWeekStandingPos", METHOD_REG_NONE }, // classic only

{ "CanFlyInZone", METHOD_REG_NONE }, // not implemented

{ "UpdateHonor", METHOD_REG_NONE }, // classic only
{ "ResetHonor", METHOD_REG_NONE }, // classic only
{ "ClearHonorInfo", METHOD_REG_NONE }, // classic only
Expand Down
2 changes: 1 addition & 1 deletion methods/TrinityCore/QuestMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ namespace LuaQuest
*/
int GetType(Eluna* E, Quest* quest)
{
#if ELUNA_EXPANSION >= CATA
#if ELUNA_EXPANSION >= EXP_CATA
E->Push(quest->GetQuestType());
#else
E->Push(quest->GetType());
Expand Down
4 changes: 2 additions & 2 deletions methods/TrinityCore/VehicleMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace LuaVehicle
return 1;
}

#if ELUNA_EXPANSION < CATA
#if ELUNA_EXPANSION < EXP_CATA
/**
* Adds [Unit] passenger to a specified seat in the [Vehicle]
*
Expand Down Expand Up @@ -102,7 +102,7 @@ namespace LuaVehicle
{ "IsOnBoard", &LuaVehicle::IsOnBoard },

// Other
#if ELUNA_EXPANSION < CATA
#if ELUNA_EXPANSION < EXP_CATA
{ "AddPassenger", &LuaVehicle::AddPassenger },
#else
{ "AddPassenger", METHOD_REG_NONE },
Expand Down
6 changes: 3 additions & 3 deletions methods/TrinityCore/WorldObjectMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace LuaWorldObject
*/
int GetPhaseMask(Eluna* E, WorldObject* obj)
{
#if ELUNA_EXPANSION >= CATA
#if ELUNA_EXPANSION >= EXP_CATA
EventMap event;
E->Push(event.GetPhaseMask());
#else
Expand All @@ -62,7 +62,7 @@ namespace LuaWorldObject
{
uint32 phaseMask = E->CHECKVAL<uint32>(2);

#if ELUNA_EXPANSION >= CATA
#if ELUNA_EXPANSION >= EXP_CATA
EventMap event;
event.SetPhase(phaseMask);
#else
Expand Down Expand Up @@ -1050,7 +1050,7 @@ namespace LuaWorldObject
#if ELUNA_EXPANSION == EXP_RETAIL
if (!sSoundKitStore.LookupEntry(musicid))
#else
if (!sSoundEntriesStore.LookupEntry(musicid))
if (!sSoundEntriesStore.LookupEntry(musicid))
#endif
musicid = 0;
WorldPackets::Misc::PlayMusic playMusic(musicid);
Expand Down

0 comments on commit cfd9cdf

Please sign in to comment.