From a19a6afea98e9ed9a20b6f371a2905ad93b7d766 Mon Sep 17 00:00:00 2001 From: Niam5 Date: Wed, 28 Aug 2024 10:05:07 -0700 Subject: [PATCH] Change expansion defines to have prefix and add MaNGOS defines MaNGOS uses the CLASSIC, TBC, etc defines as a way to control their multiversion core code so redefining them in Eluna was causing issues. --- ElunaCreatureAI.h | 6 ++- ElunaIncludes.h | 35 ++++++++++++----- ElunaLoader.cpp | 2 +- ElunaUtility.cpp | 8 +++- ElunaUtility.h | 10 ++--- LuaEngine.h | 14 +++---- LuaFunctions.cpp | 2 +- hooks/GameObjectHooks.cpp | 2 +- hooks/GuildHooks.cpp | 4 +- hooks/PlayerHooks.cpp | 2 +- hooks/VehicleHooks.cpp | 2 +- methods/CMangos/GlobalMethods.h | 56 ++++++++++++---------------- methods/CMangos/ItemMethods.h | 30 +++++++-------- methods/CMangos/UnitMethods.h | 34 ++++++++--------- methods/CMangos/VehicleMethods.h | 2 +- methods/CMangos/WorldObjectMethods.h | 8 ++-- methods/Mangos/GlobalMethods.h | 10 +---- methods/Mangos/GuildMethods.h | 2 +- methods/Mangos/PlayerMethods.h | 2 +- methods/VMangos/PlayerMethods.h | 11 ------ methods/VMangos/VehicleMethods.h | 2 +- 21 files changed, 120 insertions(+), 124 deletions(-) diff --git a/ElunaCreatureAI.h b/ElunaCreatureAI.h index a8a58e7eae..05cf599d33 100644 --- a/ElunaCreatureAI.h +++ b/ElunaCreatureAI.h @@ -15,7 +15,7 @@ #if defined ELUNA_TRINITY struct ScriptedAI; typedef ScriptedAI NativeScriptedAI; -#elif defined ELUNA_CMANGOS +#elif defined ELUNA_CMANGOS || ELUNA_MANGOS class CreatureAI; typedef CreatureAI NativeScriptedAI; #elif defined ELUNA_VMANGOS @@ -64,7 +64,11 @@ struct ElunaCreatureAI : NativeScriptedAI if (!me->GetEluna()->UpdateAI(me, diff)) { +#if !defined ELUNA_MANGOS if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)) +#else + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)) +#endif NativeScriptedAI::UpdateAI(diff); } } diff --git a/ElunaIncludes.h b/ElunaIncludes.h index 43aa7d82e1..ec76d3973c 100644 --- a/ElunaIncludes.h +++ b/ElunaIncludes.h @@ -55,11 +55,13 @@ #elif defined ELUNA_VMANGOS #include "BasicAI.h" #include "SQLStorages.h" +#elif defined ELUNA_MANGOS +#include "SQLStorages.h" #endif // ELUNA_TRINITY -#if ELUNA_EXPANSION > CLASSIC +#if ELUNA_EXPANSION > EXP_CLASSIC #include "ArenaTeam.h" #endif -#if ELUNA_EXPANSION >= WOTLK +#if ELUNA_EXPANSION >= EXP_WOTLK #include "Vehicle.h" #endif #else @@ -94,13 +96,13 @@ #include "Spells/SpellMgr.h" #include "Tools/Language.h" #include "Server/SQLStorages.h" -#if ELUNA_EXPANSION > CLASSIC +#if ELUNA_EXPANSION > EXP_CLASSIC #include "Arena/ArenaTeam.h" #endif -#if ELUNA_EXPANSION >= WOTLK +#if ELUNA_EXPANSION >= EXP_WOTLK #include "Entities/Vehicle.h" #endif -#if ELUNA_EXPANSION >= CATA +#if ELUNA_EXPANSION >= EXP_CATA #include "AI/BaseAI/AggressorAI.h" #else #include "AI/BaseAI/UnitAI.h" @@ -110,10 +112,15 @@ #if !defined ELUNA_TRINITY #include "Config/Config.h" #include "BattleGroundMgr.h" +#if !defined ELUNA_MANGOS #include "revision.h" +#else +#include "GitRevision.h" +#include "revision_data.h" +#endif #endif -#if ELUNA_EXPANSION > CLASSIC +#if ELUNA_EXPANSION > EXP_CLASSIC typedef Opcodes OpcodesList; #endif @@ -124,7 +131,7 @@ typedef Opcodes OpcodesList; #if defined ELUNA_CMANGOS #define CORE_NAME "cMaNGOS" #define CORE_VERSION REVISION_DATE " " REVISION_ID -#if ELUNA_EXPANSION == CATA +#if ELUNA_EXPANSION == EXP_CATA #define NUM_MSG_TYPES MAX_OPCODE_TABLE_SIZE #endif #endif @@ -135,6 +142,14 @@ typedef Opcodes OpcodesList; #define DEFAULT_LOCALE LOCALE_enUS #endif +#if defined ELUNA_MANGOS +#define CORE_NAME "MaNGOS" +#define CORE_VERSION PROJECT_REVISION_NR +#if ELUNA_EXPANSION >= EXP_CATA +#define NUM_MSG_TYPES NUM_OPCODE_HANDLERS +#endif +#endif + #if defined ELUNA_TRINITY #define CORE_NAME "TrinityCore" #define REGEN_TIME_FULL @@ -169,15 +184,15 @@ typedef Opcodes OpcodesList; #endif -#if ELUNA_EXPANSION >= CATA || defined ELUNA_VMANGOS +#if ELUNA_EXPANSION >= EXP_CATA || defined ELUNA_VMANGOS #define PLAYER_FIELD_LIFETIME_HONORABLE_KILLS PLAYER_FIELD_LIFETIME_HONORBALE_KILLS #endif -#if ELUNA_EXPANSION == TBC +#if ELUNA_EXPANSION == EXP_TBC #define SPELL_AURA_MOD_KILL_XP_PCT SPELL_AURA_MOD_XP_PCT #endif -#if ELUNA_EXPANSION >= WOTLK +#if ELUNA_EXPANSION >= EXP_WOTLK #define UNIT_BYTE2_FLAG_SANCTUARY UNIT_BYTE2_FLAG_SUPPORTABLE #endif diff --git a/ElunaLoader.cpp b/ElunaLoader.cpp index 2eda6b0435..c1369caa50 100644 --- a/ElunaLoader.cpp +++ b/ElunaLoader.cpp @@ -25,7 +25,7 @@ namespace fs = std::filesystem; #include #endif -#if defined ELUNA_TRINITY +#if defined ELUNA_TRINITY || ELUNA_MANGOS #include "MapManager.h" #elif defined ELUNA_CMANGOS #include "Maps/MapManager.h" diff --git a/ElunaUtility.cpp b/ElunaUtility.cpp index 01524fc6fe..5556b8d19c 100644 --- a/ElunaUtility.cpp +++ b/ElunaUtility.cpp @@ -22,7 +22,7 @@ uint32 ElunaUtil::GetCurrTime() { -#if defined ELUNA_TRINITY +#if defined ELUNA_TRINITY || ELUNA_MANGOS return getMSTime(); #else return WorldTimer::getMSTime(); @@ -31,7 +31,7 @@ uint32 ElunaUtil::GetCurrTime() uint32 ElunaUtil::GetTimeDiff(uint32 oldMSTime) { -#if defined ELUNA_TRINITY +#if defined ELUNA_TRINITY || ELUNA_MANGOS return GetMSTimeDiffToNow(oldMSTime); #else return WorldTimer::getMSTimeDiff(oldMSTime, WorldTimer::getMSTime()); @@ -98,7 +98,11 @@ bool ElunaUtil::WorldObjectInRangeCheck::operator()(WorldObject* u) { if (i_obj_fact) { +#if !defined ELUNA_MANGOS if ((i_obj_fact->IsHostileTo(*target->GetFactionTemplateEntry())) != (i_hostile == 1)) +#else + if ((i_obj_fact->IsHostileTo(*target->getFactionTemplateEntry())) != (i_hostile == 1)) +#endif return false; } else if (i_hostile == 1) diff --git a/ElunaUtility.h b/ElunaUtility.h index 0eb3b18b0a..72897e7af9 100644 --- a/ElunaUtility.h +++ b/ElunaUtility.h @@ -9,10 +9,10 @@ #include "Common.h" -#define CLASSIC 0 -#define TBC 1 -#define WOTLK 2 -#define CATA 3 +#define EXP_CLASSIC 0 +#define EXP_TBC 1 +#define EXP_WOTLK 2 +#define EXP_CATA 3 #if !defined ELUNA_CMANGOS #include "SharedDefines.h" @@ -35,7 +35,7 @@ #include #include -#if !defined ELUNA_VMANGOS +#if defined ELUNA_TRINITY || ELUNA_CMANGOS #define USING_BOOST #endif diff --git a/LuaEngine.h b/LuaEngine.h index d902f42f85..000e048490 100644 --- a/LuaEngine.h +++ b/LuaEngine.h @@ -85,16 +85,16 @@ class TemporarySpawn; typedef TemporarySpawn TempSummon; #endif -#if defined ELUNA_VMANGOS +#if defined ELUNA_VMANGOS || ELUNA_MANGOS class TemporarySummon; typedef TemporarySummon TempSummon; #endif -#if ELUNA_EXPANSION == CLASSIC +#if ELUNA_EXPANSION == EXP_CLASSIC typedef int Difficulty; #endif -#if ELUNA_EXPANSION >= WOTLK +#if ELUNA_EXPANSION >= EXP_WOTLK class VehicleInfo; typedef VehicleInfo Vehicle; #endif @@ -461,7 +461,7 @@ class ELUNA_GAME_API Eluna bool OnQuestAccept(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest); bool OnQuestReward(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest, uint32 opt); void GetDialogStatus(const Player* pPlayer, const GameObject* pGameObject); -#if ELUNA_EXPANSION >= WOTLK +#if ELUNA_EXPANSION >= EXP_WOTLK void OnDestroyed(GameObject* pGameObject, WorldObject* attacker); void OnDamaged(GameObject* pGameObject, WorldObject* attacker); #endif @@ -489,7 +489,7 @@ class ELUNA_GAME_API Eluna void OnFreeTalentPointsChanged(Player* pPlayer, uint32 newPoints); void OnTalentsReset(Player* pPlayer, bool noCost); void OnMoneyChanged(Player* pPlayer, int32& amount); -#if ELUNA_EXPANSION >= CATA +#if ELUNA_EXPANSION >= EXP_CATA void OnMoneyChanged(Player* pPlayer, int64& amount); #endif void OnGiveXP(Player* pPlayer, uint32& amount, Unit* pVictim); @@ -517,7 +517,7 @@ class ELUNA_GAME_API Eluna void HandleGossipSelectOption(Player* pPlayer, uint32 menuId, uint32 sender, uint32 action, const std::string& code); void OnAchievementComplete(Player* pPlayer, uint32 achievementId); -#if ELUNA_EXPANSION >= WOTLK +#if ELUNA_EXPANSION >= EXP_WOTLK /* Vehicle */ void OnInstall(Vehicle* vehicle); void OnUninstall(Vehicle* vehicle); @@ -547,7 +547,7 @@ class ELUNA_GAME_API Eluna void OnDisband(Guild* guild); void OnMemberWitdrawMoney(Guild* guild, Player* player, uint32& amount, bool isRepair); void OnMemberDepositMoney(Guild* guild, Player* player, uint32& amount); -#if ELUNA_EXPANSION >= CATA +#if ELUNA_EXPANSION >= EXP_CATA void OnMemberWitdrawMoney(Guild* guild, Player* player, uint64& amount, bool isRepair); void OnMemberDepositMoney(Guild* guild, Player* player, uint64& amount); #endif diff --git a/LuaFunctions.cpp b/LuaFunctions.cpp index 168bba6ddc..6bccd5ce95 100644 --- a/LuaFunctions.cpp +++ b/LuaFunctions.cpp @@ -185,7 +185,7 @@ void RegisterFunctions(Eluna* E) ElunaTemplate::SetMethods(E, LuaObject::ObjectMethods); ElunaTemplate::SetMethods(E, LuaItem::ItemMethods); -#if ELUNA_EXPANSION >= WOTLK +#if ELUNA_EXPANSION >= EXP_WOTLK ElunaTemplate::Register(E, "Vehicle"); ElunaTemplate::SetMethods(E, LuaVehicle::VehicleMethods); #endif diff --git a/hooks/GameObjectHooks.cpp b/hooks/GameObjectHooks.cpp index 831ec48d9f..654811334f 100644 --- a/hooks/GameObjectHooks.cpp +++ b/hooks/GameObjectHooks.cpp @@ -69,7 +69,7 @@ void Eluna::GetDialogStatus(const Player* pPlayer, const GameObject* pGameObject CallAllFunctions(GameObjectEventBindings, key); } -#if ELUNA_EXPANSION >= WOTLK +#if ELUNA_EXPANSION >= EXP_WOTLK void Eluna::OnDestroyed(GameObject* pGameObject, WorldObject* attacker) { START_HOOK(GAMEOBJECT_EVENT_ON_DESTROYED, pGameObject->GetEntry()); diff --git a/hooks/GuildHooks.cpp b/hooks/GuildHooks.cpp index 4daadb78e0..6018507948 100644 --- a/hooks/GuildHooks.cpp +++ b/hooks/GuildHooks.cpp @@ -94,7 +94,7 @@ void Eluna::OnMemberWitdrawMoney(Guild* guild, Player* player, uint32& amount, b CleanUpStack(4); } -#if ELUNA_EXPANSION >= CATA +#if ELUNA_EXPANSION >= EXP_CATA void Eluna::OnMemberWitdrawMoney(Guild* guild, Player* player, uint64& amount, bool isRepair) { START_HOOK(GUILD_EVENT_ON_MONEY_WITHDRAW); @@ -149,7 +149,7 @@ void Eluna::OnMemberDepositMoney(Guild* guild, Player* player, uint32& amount) CleanUpStack(3); } -#if ELUNA_EXPANSION >= CATA +#if ELUNA_EXPANSION >= EXP_CATA void Eluna::OnMemberDepositMoney(Guild* guild, Player* player, uint64& amount) { START_HOOK(GUILD_EVENT_ON_MONEY_DEPOSIT); diff --git a/hooks/PlayerHooks.cpp b/hooks/PlayerHooks.cpp index 60584b973d..2b988d9a23 100644 --- a/hooks/PlayerHooks.cpp +++ b/hooks/PlayerHooks.cpp @@ -280,7 +280,7 @@ void Eluna::OnMoneyChanged(Player* pPlayer, int32& amount) CleanUpStack(2); } -#if ELUNA_EXPANSION >= CATA +#if ELUNA_EXPANSION >= EXP_CATA void Eluna::OnMoneyChanged(Player* pPlayer, int64& amount) { START_HOOK(PLAYER_EVENT_ON_MONEY_CHANGE); diff --git a/hooks/VehicleHooks.cpp b/hooks/VehicleHooks.cpp index f24f4f1c4e..932f6baea3 100644 --- a/hooks/VehicleHooks.cpp +++ b/hooks/VehicleHooks.cpp @@ -10,7 +10,7 @@ #include "BindingMap.h" #include "ElunaTemplate.h" -#if ELUNA_EXPANSION >= WOTLK +#if ELUNA_EXPANSION >= EXP_WOTLK using namespace Hooks; diff --git a/methods/CMangos/GlobalMethods.h b/methods/CMangos/GlobalMethods.h index b1bd5203b2..0bcc5867fe 100644 --- a/methods/CMangos/GlobalMethods.h +++ b/methods/CMangos/GlobalMethods.h @@ -78,15 +78,7 @@ namespace LuaGlobalFunctions */ int GetCoreExpansion(Eluna* E) { -#if ELUNA_EXPANSION == CLASSIC - E->Push(0); -#elif ELUNA_EXPANSION == TBC - E->Push(1); -#elif ELUNA_EXPANSION == WOTLK - E->Push(2); -#elif ELUNA_EXPANSION == CATA - E->Push(3); -#endif + E->Push(ELUNA_EXPANSION); return 1; } @@ -460,7 +452,7 @@ namespace LuaGlobalFunctions std::ostringstream oss; oss << "|c" << std::hex << ItemQualityColors[temp->Quality] << std::dec << "|Hitem:" << entry << ":0:" << -#if ELUNA_EXPANSION > CLASSIC +#if ELUNA_EXPANSION > EXP_CLASSIC "0:0:0:0:" << #endif "0:0:0:0|h[" << name << "]|h|r"; @@ -1678,7 +1670,7 @@ namespace LuaGlobalFunctions float o = E->CHECKVAL(8); bool save = E->CHECKVAL(9, false); uint32 durorresptime = E->CHECKVAL(10, 0); -#if ELUNA_EXPANSION >= WOTLK +#if ELUNA_EXPANSION >= EXP_WOTLK uint32 phase = E->CHECKVAL(11, PHASEMASK_NORMAL); if (!phase) { @@ -1705,7 +1697,7 @@ namespace LuaGlobalFunctions return 1; } -#if ELUNA_EXPANSION <= TBC +#if ELUNA_EXPANSION <= EXP_TBC CreatureCreatePos pos(map, x, y, z, o); #else CreatureCreatePos pos(map, x, y, z, o, phase); @@ -1718,7 +1710,7 @@ namespace LuaGlobalFunctions E->Push(); return 1; } -#if ELUNA_EXPANSION < CATA +#if ELUNA_EXPANSION < EXP_CATA if (!pCreature->Create(lowguid, lowguid, pos, cinfo)) #else if (!pCreature->Create(lowguid, pos, cinfo)) @@ -1729,9 +1721,9 @@ namespace LuaGlobalFunctions return 1; } -#if ELUNA_EXPANSION == TBC +#if ELUNA_EXPANSION == EXP_TBC pCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode())); -#elif ELUNA_EXPANSION == CLASSIC +#elif ELUNA_EXPANSION == EXP_CLASSIC pCreature->SaveToDB(map->GetId()); #else pCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), phase); @@ -1740,7 +1732,7 @@ namespace LuaGlobalFunctions uint32 db_guid = pCreature->GetGUIDLow(); // To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells(); -#if ELUNA_EXPANSION < CATA +#if ELUNA_EXPANSION < EXP_CATA pCreature->LoadFromDB(db_guid, map, db_guid, 0); #else pCreature->LoadFromDB(db_guid, map); @@ -1764,12 +1756,12 @@ namespace LuaGlobalFunctions TemporarySpawn* pCreature = new TemporarySpawn(ObjectGuid(uint64(0))); -#if ELUNA_EXPANSION <= TBC +#if ELUNA_EXPANSION <= EXP_TBC CreatureCreatePos pos(map, x, y, z, o); #else CreatureCreatePos pos(map, x, y, z, o, phase); #endif -#if ELUNA_EXPANSION == CATA +#if ELUNA_EXPANSION == EXP_CATA if (!pCreature->Create(map->GenerateLocalLowGuid(cinfo->GetHighGuid()), pos, cinfo)) #else if (!pCreature->Create(map->GenerateLocalLowGuid(cinfo->GetHighGuid()), map->GenerateLocalLowGuid(cinfo->GetHighGuid()), pos, cinfo)) @@ -1820,9 +1812,9 @@ namespace LuaGlobalFunctions } GameObject* pGameObj = new GameObject; -#if ELUNA_EXPANSION <= TBC +#if ELUNA_EXPANSION <= EXP_TBC if (!pGameObj->Create(db_lowGUID, db_lowGUID, gInfo->id, map, x, y, z, o)) -#elif ELUNA_EXPANSION == CATA +#elif ELUNA_EXPANSION == EXP_CATA if (!pGameObj->Create(db_lowGUID, gInfo->id, map, phase, x, y, z, o)) #else if (!pGameObj->Create(db_lowGUID, db_lowGUID, gInfo->id, map, phase, x, y, z, o)) @@ -1837,16 +1829,16 @@ namespace LuaGlobalFunctions pGameObj->SetRespawnTime(durorresptime); // fill the gameobject data and save to the db -#if ELUNA_EXPANSION == TBC +#if ELUNA_EXPANSION == EXP_TBC pGameObj->SaveToDB(map->GetId(), (1 << map->GetSpawnMode())); -#elif ELUNA_EXPANSION == CLASSIC +#elif ELUNA_EXPANSION == EXP_CLASSIC pGameObj->SaveToDB(map->GetId()); #else pGameObj->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), phase); #endif // this will generate a new guid if the object is in an instance -#if ELUNA_EXPANSION < CATA +#if ELUNA_EXPANSION < EXP_CATA if (!pGameObj->LoadFromDB(db_lowGUID, map, db_lowGUID, 0)) #else if (!pGameObj->LoadFromDB(db_lowGUID, map)) @@ -1869,9 +1861,9 @@ namespace LuaGlobalFunctions else { GameObject* pGameObj = new GameObject; -#if ELUNA_EXPANSION <= TBC +#if ELUNA_EXPANSION <= EXP_TBC if (!pGameObj->Create(map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), entry, map, x, y, z, o)) -#elif ELUNA_EXPANSION == WOTLK +#elif ELUNA_EXPANSION == EXP_WOTLK if (!pGameObj->Create(map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), entry, map, phase, x, y, z, o)) #else if (!pGameObj->Create(map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), entry, map, phase, x, y, z, o)) @@ -1910,7 +1902,7 @@ namespace LuaGlobalFunctions if (opcode >= NUM_MSG_TYPES) return luaL_argerror(E->L, 1, "valid opcode expected"); -#if ELUNA_EXPANSION == CLASSIC +#if ELUNA_EXPANSION == EXP_CLASSIC E->Push(new WorldPacket((Opcodes)opcode, size)); #else E->Push(new WorldPacket((OpcodesList)opcode, size)); @@ -1935,15 +1927,15 @@ namespace LuaGlobalFunctions uint32 incrtime = E->CHECKVAL(4); uint32 extendedcost = E->CHECKVAL(5); -#if ELUNA_EXPANSION < CATA +#if ELUNA_EXPANSION < EXP_CATA if (!eObjectMgr->IsVendorItemValid(false, "npc_vendor", entry, item, maxcount, incrtime, extendedcost, 0)) #else if (!eObjectMgr->IsVendorItemValid(false, "npc_vendor", entry, item, VENDOR_ITEM_TYPE_ITEM, maxcount, incrtime, extendedcost, 0)) #endif return 0; -#if ELUNA_EXPANSION == CATA +#if ELUNA_EXPANSION == EXP_CATA eObjectMgr->AddVendorItem(entry, item, VENDOR_ITEM_TYPE_ITEM, maxcount, incrtime, extendedcost); -#elif ELUNA_EXPANSION > CLASSIC +#elif ELUNA_EXPANSION > EXP_CLASSIC eObjectMgr->AddVendorItem(entry, item, maxcount, incrtime, extendedcost); #else eObjectMgr->AddVendorItem(entry, item, maxcount, incrtime); @@ -1964,7 +1956,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); @@ -1987,7 +1979,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); @@ -2370,7 +2362,7 @@ namespace LuaGlobalFunctions sTaxiNodesStore.InsertEntry(nodeEntry, nodeId++); -#if ELUNA_EXPANSION == CATA +#if ELUNA_EXPANSION == EXP_CATA sTaxiPathNodesByPath[pathId][index++] = new TaxiPathNodeEntry(entry); #else sTaxiPathNodesByPath[pathId].set(index++, new TaxiPathNodeEntry(entry)); diff --git a/methods/CMangos/ItemMethods.h b/methods/CMangos/ItemMethods.h index 20e3d25cc7..29edd3f56b 100644 --- a/methods/CMangos/ItemMethods.h +++ b/methods/CMangos/ItemMethods.h @@ -23,7 +23,7 @@ namespace LuaItem return 1; } -#if ELUNA_EXPANSION >= WOTLK +#if ELUNA_EXPANSION >= EXP_WOTLK /** * Returns 'true' if the [Item] is account bound, 'false' otherwise * @@ -83,7 +83,7 @@ namespace LuaItem return 1; } -#if ELUNA_EXPANSION >= TBC +#if ELUNA_EXPANSION >= EXP_TBC /** * Returns 'true' if the [Item] is a currency token, 'false' otherwise * @@ -125,7 +125,7 @@ namespace LuaItem */ int CanBeTraded(Eluna* E, Item* item) { -#if ELUNA_EXPANSION <= TBC +#if ELUNA_EXPANSION <= EXP_TBC E->Push(item->CanBeTraded()); #else bool mail = E->CHECKVAL(2, false); @@ -192,7 +192,7 @@ namespace LuaItem return 1; } -#if ELUNA_EXPANSION == WOTLK +#if ELUNA_EXPANSION == EXP_WOTLK /** * Returns 'true' if the [Item] is a weapon vellum, 'false' otherwise * @@ -259,10 +259,10 @@ namespace LuaItem if (ItemLocale const* il = eObjectMgr->GetItemLocale(temp->ItemId)) ObjectMgr::GetLocaleString(il->Name, static_cast(locale), name); -#if ELUNA_EXPANSION >= TBC +#if ELUNA_EXPANSION >= EXP_TBC if (int32 itemRandPropId = item->GetItemRandomPropertyId()) { -#if ELUNA_EXPANSION == CATA +#if ELUNA_EXPANSION == EXP_CATA char* suffix = NULL; #else char* const* suffix = NULL; @@ -291,7 +291,7 @@ namespace LuaItem oss << "|c" << std::hex << ItemQualityColors[temp->Quality] << std::dec << "|Hitem:" << temp->ItemId << ":" << item->GetEnchantmentId(PERM_ENCHANTMENT_SLOT) << ":" << -#if ELUNA_EXPANSION >= TBC +#if ELUNA_EXPANSION >= EXP_TBC item->GetEnchantmentId(SOCK_ENCHANTMENT_SLOT) << ":" << item->GetEnchantmentId(SOCK_ENCHANTMENT_SLOT_2) << ":" << item->GetEnchantmentId(SOCK_ENCHANTMENT_SLOT_3) << ":" << @@ -491,7 +491,7 @@ namespace LuaItem return 1; } -#if ELUNA_EXPANSION > TBC +#if ELUNA_EXPANSION > EXP_TBC /** * Returns the flags2 of the [Item] * @@ -603,7 +603,7 @@ namespace LuaItem return 1; } -#if ELUNA_EXPANSION == WOTLK +#if ELUNA_EXPANSION == EXP_WOTLK int GetStatsCount(Eluna* E, Item* item) { E->Push(item->GetTemplate()->StatsCount); @@ -622,7 +622,7 @@ namespace LuaItem return 1; } -#if ELUNA_EXPANSION >= TBC +#if ELUNA_EXPANSION >= EXP_TBC int GetRandomSuffix(Eluna* E, Item* item) { E->Push(item->GetTemplate()->RandomSuffix); @@ -790,7 +790,7 @@ namespace LuaItem { "GetDisplayId", &LuaItem::GetDisplayId }, { "GetQuality", &LuaItem::GetQuality }, { "GetFlags", &LuaItem::GetFlags }, -#if ELUNA_EXPANSION > TBC +#if ELUNA_EXPANSION > EXP_TBC { "GetFlags2", &LuaItem::GetFlags2 }, #else { "GetFlags2", METHOD_REG_NONE }, @@ -807,12 +807,12 @@ namespace LuaItem { "GetRandomProperty", &LuaItem::GetRandomProperty }, { "GetItemSet", &LuaItem::GetItemSet }, { "GetBagSize", &LuaItem::GetBagSize }, -#if ELUNA_EXPANSION >= TBC +#if ELUNA_EXPANSION >= EXP_TBC { "GetRandomSuffix", &LuaItem::GetRandomSuffix }, #else { "GetRandomSuffix", METHOD_REG_NONE }, #endif -#if ELUNA_EXPANSION == WOTLK +#if ELUNA_EXPANSION == EXP_WOTLK { "GetStatsCount", &LuaItem::GetStatsCount }, #else { "GetStatsCount", METHOD_REG_NONE }, @@ -840,12 +840,12 @@ namespace LuaItem { "IsConjuredConsumable", &LuaItem::IsConjuredConsumable }, { "SetEnchantment", &LuaItem::SetEnchantment }, { "ClearEnchantment", &LuaItem::ClearEnchantment }, -#if ELUNA_EXPANSION >= TBC +#if ELUNA_EXPANSION >= EXP_TBC { "IsCurrencyToken", &LuaItem::IsCurrencyToken }, #else { "IsCurrencyToken", METHOD_REG_NONE }, #endif -#if ELUNA_EXPANSION == WOTLK +#if ELUNA_EXPANSION == EXP_WOTLK { "IsBoundAccountWide", &LuaItem::IsBoundAccountWide }, { "IsWeaponVellum", &LuaItem::IsWeaponVellum }, { "IsArmorVellum", &LuaItem::IsArmorVellum }, diff --git a/methods/CMangos/UnitMethods.h b/methods/CMangos/UnitMethods.h index 877264e044..cc885de581 100644 --- a/methods/CMangos/UnitMethods.h +++ b/methods/CMangos/UnitMethods.h @@ -58,7 +58,7 @@ namespace LuaUnit int32 immunity = E->CHECKVAL(2); bool apply = E->CHECKVAL(3, true); -#if ELUNA_EXPANSION < CATA +#if ELUNA_EXPANSION < EXP_CATA unit->ApplySpellImmune(nullptr, 5, immunity, apply); #else unit->ApplySpellImmune(0, 5, immunity, apply); @@ -383,7 +383,7 @@ namespace LuaUnit return 1; } -#if ELUNA_EXPANSION >= TBC +#if ELUNA_EXPANSION >= EXP_TBC /** * Returns true if the [Unit] is on a [Vehicle]. * @@ -1126,7 +1126,7 @@ namespace LuaUnit return 1; } -#if ELUNA_EXPANSION >= WOTLK +#if ELUNA_EXPANSION >= EXP_WOTLK /** * Returns [Unit]'s [Vehicle] methods * @@ -1605,7 +1605,7 @@ namespace LuaUnit return 0; } -#if ELUNA_EXPANSION >= WOTLK +#if ELUNA_EXPANSION >= EXP_WOTLK /** * Sets the [Unit]'s FFA flag on or off. * @@ -1922,7 +1922,7 @@ namespace LuaUnit float y = E->CHECKVAL(4); float z = E->CHECKVAL(5); bool genPath = E->CHECKVAL(6, true); -#if ELUNA_EXPANSION < CATA +#if ELUNA_EXPANSION < EXP_CATA unit->GetMotionMaster()->MovePoint(id, x, y, z, FORCED_MOVEMENT_NONE, genPath); #else unit->GetMotionMaster()->MovePoint(id, x, y, z, genPath); @@ -1930,7 +1930,7 @@ namespace LuaUnit return 0; } -#if ELUNA_EXPANSION >= WOTLK +#if ELUNA_EXPANSION >= EXP_WOTLK /** * Makes the [Unit] jump to the coordinates * @@ -2181,7 +2181,7 @@ namespace LuaUnit for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i) { -#if ELUNA_EXPANSION == CATA +#if ELUNA_EXPANSION == EXP_CATA SpellEffectEntry const* spellEffect = spellEntry->GetSpellEffect(SpellEffectIndex(i)); if (!spellEffect) continue; @@ -2189,7 +2189,7 @@ namespace LuaUnit #else uint8 eff = spellEntry->Effect[i]; #endif -#if ELUNA_EXPANSION < CATA +#if ELUNA_EXPANSION < EXP_CATA if (eff >= MAX_SPELL_EFFECTS) #else if (eff >= TOTAL_SPELL_EFFECTS) @@ -2199,7 +2199,7 @@ namespace LuaUnit eff == SPELL_EFFECT_APPLY_AURA || eff == SPELL_EFFECT_PERSISTENT_AREA_AURA) { -#if ELUNA_EXPANSION < CATA +#if ELUNA_EXPANSION < EXP_CATA Aura* aur = CreateAura(spellEntry, SpellEffIndex(i), NULL, NULL, holder, target); #else Aura* aur = CreateAura(spellEntry, SpellEffIndex(i), NULL, holder, target); @@ -2234,7 +2234,7 @@ namespace LuaUnit return 0; } -#if ELUNA_EXPANSION >= TBC +#if ELUNA_EXPANSION >= EXP_TBC /** * Removes all positive visible [Aura]'s from the [Unit]. */ @@ -2326,7 +2326,7 @@ namespace LuaUnit // flat melee damage without resistence/etc reduction if (school == MAX_SPELL_SCHOOL) { -#if ELUNA_EXPANSION < CATA +#if ELUNA_EXPANSION < EXP_CATA Unit::DealDamage(unit, target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, durabilityloss); unit->SendAttackStateUpdate(HITINFO_NORMALSWING2, target, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_NORMAL, 0); #else @@ -2339,7 +2339,7 @@ namespace LuaUnit SpellSchoolMask schoolmask = SpellSchoolMask(1 << school); if (schoolmask & SPELL_SCHOOL_MASK_NORMAL) -#if ELUNA_EXPANSION < CATA +#if ELUNA_EXPANSION < EXP_CATA damage = unit->CalcArmorReducedDamage(unit, target, damage); #else damage = unit->CalcArmorReducedDamage(target, damage); @@ -2349,7 +2349,7 @@ namespace LuaUnit if (!spell) { uint32 absorb = 0; -#if ELUNA_EXPANSION < CATA +#if ELUNA_EXPANSION < EXP_CATA int32 resist = 0; #else uint32 resist = 0; @@ -2361,7 +2361,7 @@ namespace LuaUnit else damage -= absorb + resist; -#if ELUNA_EXPANSION < CATA +#if ELUNA_EXPANSION < EXP_CATA unit->DealDamageMods(unit, target, damage, &absorb, DIRECT_DAMAGE); unit->DealDamage(unit, target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false); #else @@ -2409,7 +2409,7 @@ namespace LuaUnit Unit* target = E->CHECKOBJ(2); bool durLoss = E->CHECKVAL(3, true); -#if ELUNA_EXPANSION < CATA +#if ELUNA_EXPANSION < EXP_CATA unit->DealDamage(unit, target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, durLoss); #else unit->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, durLoss); @@ -2570,10 +2570,10 @@ namespace LuaUnit { "DealHeal", &LuaUnit::DealHeal }, // Expansion specific methods -#if ELUNA_EXPANSION >= TBC +#if ELUNA_EXPANSION >= EXP_TBC { "IsOnVehicle", &LuaUnit::IsOnVehicle }, { "RemoveArenaAuras", &LuaUnit::RemoveArenaAuras }, -#elif ELUNA_EXPANSION >= WOTLK +#elif ELUNA_EXPANSION >= EXP_WOTLK { "GetCritterGUID", &LuaUnit::GetCritterGUID }, { "GetVehicleKit", &LuaUnit::GetVehicleKit }, { "SetFFA", &LuaUnit::SetFFA }, diff --git a/methods/CMangos/VehicleMethods.h b/methods/CMangos/VehicleMethods.h index 7e3e67a4a2..e458601ca9 100644 --- a/methods/CMangos/VehicleMethods.h +++ b/methods/CMangos/VehicleMethods.h @@ -6,7 +6,7 @@ #ifndef VEHICLEMETHODS_H #define VEHICLEMETHODS_H -#if ELUNA_EXPANSION >= WOTLK +#if ELUNA_EXPANSION >= EXP_WOTLK /*** * Inherits all methods from: none diff --git a/methods/CMangos/WorldObjectMethods.h b/methods/CMangos/WorldObjectMethods.h index 79a1a7ef67..aae9402a52 100644 --- a/methods/CMangos/WorldObjectMethods.h +++ b/methods/CMangos/WorldObjectMethods.h @@ -34,7 +34,7 @@ namespace LuaWorldObject return 1; } -#if ELUNA_EXPANSION > TBC +#if ELUNA_EXPANSION > EXP_TBC /** * Returns the current phase of the [WorldObject] * @@ -1060,7 +1060,7 @@ namespace LuaWorldObject return 0; if (player) -#if ELUNA_EXPANSION == CATA +#if ELUNA_EXPANSION == EXP_CATA obj->PlayDirectSound(soundId, player); #else obj->PlayDirectSound(soundId, PlayPacketParameters(PLAY_TARGET, (Player const*)player)); @@ -1090,7 +1090,7 @@ namespace LuaWorldObject return 0; if (player) -#if ELUNA_EXPANSION == CATA +#if ELUNA_EXPANSION == EXP_CATA obj->PlayDistanceSound(soundId, player); #else obj->PlayDistanceSound(soundId, PlayPacketParameters(PLAY_TARGET, (Player const*)player)); @@ -1154,7 +1154,7 @@ namespace LuaWorldObject { "GetExactDistance2d", &LuaWorldObject::GetExactDistance2d }, { "GetRelativePoint", &LuaWorldObject::GetRelativePoint }, { "GetAngle", &LuaWorldObject::GetAngle }, -#if ELUNA_EXPANSION == WOTLK +#if ELUNA_EXPANSION == EXP_WOTLK { "GetPhaseMask", &LuaWorldObject::GetPhaseMask }, { "SetPhaseMask", &LuaWorldObject::SetPhaseMask }, #else diff --git a/methods/Mangos/GlobalMethods.h b/methods/Mangos/GlobalMethods.h index 61b5e52501..0817c2ed71 100644 --- a/methods/Mangos/GlobalMethods.h +++ b/methods/Mangos/GlobalMethods.h @@ -78,15 +78,7 @@ namespace LuaGlobalFunctions */ int GetCoreExpansion(Eluna* E) { -#ifdef CLASSIC - E->Push(0); -#elif defined(TBC) - E->Push(1); -#elif defined(WOTLK) - E->Push(2); -#elif defined(CATA) - E->Push(3); -#endif + E->Push(ELUNA_EXPANSION); return 1; } diff --git a/methods/Mangos/GuildMethods.h b/methods/Mangos/GuildMethods.h index 84cd1f60a9..44e44b8925 100644 --- a/methods/Mangos/GuildMethods.h +++ b/methods/Mangos/GuildMethods.h @@ -251,7 +251,7 @@ namespace LuaGuild #ifndef CLASSIC { "SetBankTabText", &LuaGuild::SetBankTabText, METHOD_REG_WORLD }, // World state method only in multistate #else - { "SetBankTabText", nullptr, METHOD_REG_NONE}, + { "SetBankTabText", METHOD_REG_NONE}, #endif // Other diff --git a/methods/Mangos/PlayerMethods.h b/methods/Mangos/PlayerMethods.h index 09a12f9499..871c851fa3 100644 --- a/methods/Mangos/PlayerMethods.h +++ b/methods/Mangos/PlayerMethods.h @@ -3829,7 +3829,7 @@ namespace LuaPlayer { "IsInArenaTeam", METHOD_REG_NONE }, { "InArena", METHOD_REG_NONE }, { "CanFly", METHOD_REG_NONE }, - { "IsFlying",nullptr, METHOD_REG_NONE }, + { "IsFlying", METHOD_REG_NONE }, #endif #if (!defined(TBC) && !defined(CLASSIC)) { "HasAchieved", &LuaPlayer::HasAchieved }, diff --git a/methods/VMangos/PlayerMethods.h b/methods/VMangos/PlayerMethods.h index 041a525a41..2eaf39b87d 100644 --- a/methods/VMangos/PlayerMethods.h +++ b/methods/VMangos/PlayerMethods.h @@ -3010,17 +3010,6 @@ namespace LuaPlayer return 0; } -#if !defined(CLASSIC) - /** - * Remove cooldowns on spells that have less than 10 minutes of cooldown from the [Player], similarly to when you enter an arena. - */ - int RemoveArenaSpellCooldowns(Eluna* /*E*/, Player* player) - { - player->RemoveArenaSpellCooldowns(); - return 0; - } -#endif - /** * Resurrects the [Player]. * diff --git a/methods/VMangos/VehicleMethods.h b/methods/VMangos/VehicleMethods.h index dec025ddf1..9af4d36a14 100644 --- a/methods/VMangos/VehicleMethods.h +++ b/methods/VMangos/VehicleMethods.h @@ -6,7 +6,7 @@ #ifndef VEHICLEMETHODS_H #define VEHICLEMETHODS_H -#if ELUNA_EXPANSION >= WOTLK +#if ELUNA_EXPANSION >= EXP_WOTLK /*** * Inherits all methods from: none