diff --git a/ElunaCompat.cpp b/ElunaCompat.cpp index 9dfdc79b6e..c7c5a62862 100644 --- a/ElunaCompat.cpp +++ b/ElunaCompat.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 - 2022 Eluna Lua Engine + * Copyright (C) 2010 - 2024 Eluna Lua Engine * This program is free software licensed under GPL version 3 * Please see the included DOCS/LICENSE.md for more information */ @@ -62,7 +62,7 @@ int lua_absindex(lua_State* L, int i) { return i; } -#ifndef LUAJIT_VERSION +#if !defined LUAJIT_VERSION void* luaL_testudata(lua_State* L, int index, const char* tname) { void* ud = lua_touserdata(L, index); if (ud) diff --git a/ElunaCompat.h b/ElunaCompat.h index d4fc4fd4b0..db6ef2a223 100644 --- a/ElunaCompat.h +++ b/ElunaCompat.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 - 2022 Eluna Lua Engine + * Copyright (C) 2010 - 2024 Eluna Lua Engine * This program is free software licensed under GPL version 3 * Please see the included DOCS/LICENSE.md for more information */ @@ -27,7 +27,7 @@ extern "C" #define lua_load(L, buf_read, dec_buf, str, NULL) \ lua_load(L, buf_read, dec_buf, str) -#ifndef LUAJIT_VERSION +#if !defined LUAJIT_VERSION void* luaL_testudata(lua_State* L, int index, const char* tname); void luaL_setmetatable(lua_State* L, const char* tname); #define luaL_setfuncs(L, l, n) luaL_register(L, NULL, l) diff --git a/ElunaConfig.cpp b/ElunaConfig.cpp index 273fa58111..e5657bdc0a 100644 --- a/ElunaConfig.cpp +++ b/ElunaConfig.cpp @@ -45,20 +45,20 @@ void ElunaConfig::Initialize() void ElunaConfig::SetConfig(ElunaConfigBoolValues index, char const* fieldname, bool defvalue) { -#ifdef TRINITY +#if defined TRINITY SetConfig(index, sConfigMgr->GetBoolDefault(fieldname, defvalue)); -#elif defined CMANGOS || defined VMANGOS || defined MANGOS +#else SetConfig(index, sConfig.GetBoolDefault(fieldname, defvalue)); #endif } void ElunaConfig::SetConfig(ElunaConfigStringValues index, char const* fieldname, std::string defvalue) { -#ifdef TRINITY +#if defined TRINITY SetConfig(index, sConfigMgr->GetStringDefault(fieldname, defvalue)); -#elif CMANGOS +#elif defined CMANGOS SetConfig(index, sConfig.GetStringDefault(fieldname, defvalue)); -#elif defined VMANGOS || defined MANGOS +#else SetConfig(index, sConfig.GetStringDefault(fieldname, defvalue.c_str())); #endif } diff --git a/ElunaCreatureAI.h b/ElunaCreatureAI.h index ec851c58d4..a1623b5c2b 100644 --- a/ElunaCreatureAI.h +++ b/ElunaCreatureAI.h @@ -8,52 +8,46 @@ #define _ELUNA_CREATURE_AI_H #include "LuaEngine.h" -#ifdef CMANGOS +#if defined CMANGOS #include "AI/BaseAI/CreatureAI.h" #endif -#if defined TRINITY || AZEROTHCORE +#if defined TRINITY struct ScriptedAI; +typedef ScriptedAI NativeScriptedAI; #elif defined CMANGOS class CreatureAI; +typedef CreatureAI NativeScriptedAI; #elif defined VMANGOS class BasicAI; -typedef BasicAI ScriptedAI; +typedef BasicAI NativeScriptedAI; #else class AggressorAI; -typedef AggressorAI ScriptedAI; +typedef AggressorAI NativeScriptedAI; #endif -#ifndef CMANGOS -struct ElunaCreatureAI : ScriptedAI -#else -struct ElunaCreatureAI : CreatureAI -#endif +struct ElunaCreatureAI : NativeScriptedAI { // used to delay the spawn hook triggering on AI creation bool justSpawned; // used to delay movementinform hook (WP hook) std::vector< std::pair > movepoints; -#if defined MANGOS || defined CMANGOS || defined VMANGOS +#if !defined TRINITY #define me m_creature #endif -#ifndef CMANGOS - ElunaCreatureAI(Creature* creature) : ScriptedAI(creature), justSpawned(true) -#else - ElunaCreatureAI(Creature* creature) : CreatureAI(creature), justSpawned(true) -#endif + ElunaCreatureAI(Creature* creature) : NativeScriptedAI(creature), justSpawned(true) { } ~ElunaCreatureAI() { } //Called at World update tick -#ifndef TRINITY +#if !defined TRINITY void UpdateAI(const uint32 diff) override #else void UpdateAI(uint32 diff) override #endif { -#ifndef TRINITY +#if !defined TRINITY if (justSpawned) { justSpawned = false; @@ -61,66 +55,47 @@ struct ElunaCreatureAI : CreatureAI JustRespawned(); } #endif - if (!movepoints.empty()) { for (auto& point : movepoints) { -#ifndef CMANGOS - if (!me->GetEluna()->MovementInform(me, point.first, point.second)) - ScriptedAI::MovementInform(point.first, point.second); -#else if (!me->GetEluna()->MovementInform(me, point.first, point.second)) - CreatureAI::MovementInform(point.first, point.second); -#endif + NativeScriptedAI::MovementInform(point.first, point.second); } movepoints.clear(); } if (!me->GetEluna()->UpdateAI(me, diff)) { -#if defined TRINITY || AZEROTHCORE || VMANGOS - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)) - ScriptedAI::UpdateAI(diff); -#elif defined CMANGOS - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)) - CreatureAI::UpdateAI(diff); -#else +#if defined MANGOS if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)) - ScriptedAI::UpdateAI(diff); +#else + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)) #endif + NativeScriptedAI::UpdateAI(diff); } } -#ifdef TRINITY +#if defined TRINITY // Called for reaction when initially engaged - this will always happen _after_ JustEnteredCombat // Called at creature aggro either by MoveInLOS or Attack Start void JustEngagedWith(Unit* target) override { if (!me->GetEluna()->EnterCombat(me, target)) - ScriptedAI::JustEngagedWith(target); + NativeScriptedAI::JustEngagedWith(target); } #else //Called for reaction at enter to combat if not in combat yet (enemy can be NULL) //Called at creature aggro either by MoveInLOS or Attack Start void EnterCombat(Unit* target) override { -#ifndef CMANGOS - if (!me->GetEluna()->EnterCombat(me, target)) - ScriptedAI::EnterCombat(target); -#else if (!me->GetEluna()->EnterCombat(me, target)) - CreatureAI::EnterCombat(target); -#endif + NativeScriptedAI::EnterCombat(target); } #endif // Called at any Damage from any attacker (before damage apply) -#if defined AZEROTHCORE - void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask) override -#elif ((defined (TRINITY) || CMANGOS) && !defined CATA) - void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType damageType, SpellInfo const* spellInfo) override -#elif defined CATA && defined CMANGOS +#if defined TRINITY || defined CMANGOS void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType damageType, SpellInfo const* spellInfo) override #else void DamageTaken(Unit* attacker, uint32& damage) override @@ -128,14 +103,10 @@ struct ElunaCreatureAI : CreatureAI { if (!me->GetEluna()->DamageTaken(me, attacker, damage)) { -#if defined AZEROTHCORE - ScriptedAI::DamageTaken(attacker, damage, damagetype, damageSchoolMask); -#elif defined TRINITY && !defined CATA - ScriptedAI::DamageTaken(attacker, damage, damageType, spellInfo); -#elif defined CMANGOS - CreatureAI::DamageTaken(attacker, damage, damageType, spellInfo); +#if defined TRINITY || defined CMANGOS + NativeScriptedAI::DamageTaken(attacker, damage, damageType, spellInfo); #else - ScriptedAI::DamageTaken(attacker, damage); + NativeScriptedAI::DamageTaken(attacker, damage); #endif } } @@ -143,49 +114,29 @@ struct ElunaCreatureAI : CreatureAI //Called at creature death void JustDied(Unit* killer) override { -#ifndef CMANGOS if (!me->GetEluna()->JustDied(me, killer)) - ScriptedAI::JustDied(killer); -#else - if (!me->GetEluna()->JustDied(me, killer)) - CreatureAI::JustDied(killer); -#endif + NativeScriptedAI::JustDied(killer); } //Called at creature killing another unit void KilledUnit(Unit* victim) override { -#ifndef CMANGOS - if (!me->GetEluna()->KilledUnit(me, victim)) - ScriptedAI::KilledUnit(victim); -#else if (!me->GetEluna()->KilledUnit(me, victim)) - CreatureAI::KilledUnit(victim); -#endif + NativeScriptedAI::KilledUnit(victim); } // Called when the creature summon successfully other creature void JustSummoned(Creature* summon) override { -#ifndef CMANGOS - if (!me->GetEluna()->JustSummoned(me, summon)) - ScriptedAI::JustSummoned(summon); -#else if (!me->GetEluna()->JustSummoned(me, summon)) - CreatureAI::JustSummoned(summon); -#endif + NativeScriptedAI::JustSummoned(summon); } // Called when a summoned creature is despawned void SummonedCreatureDespawn(Creature* summon) override { -#ifndef CMANGOS if (!me->GetEluna()->SummonedCreatureDespawn(me, summon)) - ScriptedAI::SummonedCreatureDespawn(summon); -#else - if (!me->GetEluna()->SummonedCreatureDespawn(me, summon)) - CreatureAI::SummonedCreatureDespawn(summon); -#endif + NativeScriptedAI::SummonedCreatureDespawn(summon); } //Called at waypoint reached or PointMovement end @@ -199,94 +150,59 @@ struct ElunaCreatureAI : CreatureAI // Called before EnterCombat even before the creature is in combat. void AttackStart(Unit* target) override { -#ifndef CMANGOS - if (!me->GetEluna()->AttackStart(me, target)) - ScriptedAI::AttackStart(target); -#else if (!me->GetEluna()->AttackStart(me, target)) - CreatureAI::AttackStart(target); -#endif + NativeScriptedAI::AttackStart(target); } -#ifdef TRINITY +#if defined TRINITY // Called for reaction at stopping attack at no attackers or targets void EnterEvadeMode(EvadeReason /*why*/) override - { - if (!me->GetEluna()->EnterEvadeMode(me)) - ScriptedAI::EnterEvadeMode(); - } #else - // Called for reaction at stopping attack at no attackers or targets void EnterEvadeMode() override +#endif { -#ifndef CMANGOS if (!me->GetEluna()->EnterEvadeMode(me)) - ScriptedAI::EnterEvadeMode(); -#else - if (!me->GetEluna()->EnterEvadeMode(me)) - CreatureAI::EnterEvadeMode(); -#endif + NativeScriptedAI::EnterEvadeMode(); } -#endif -#ifdef TRINITY +#if defined TRINITY // Called when creature appears in the world (spawn, respawn, grid load etc...) void JustAppeared() override { if (!me->GetEluna()->JustRespawned(me)) - ScriptedAI::JustAppeared(); + NativeScriptedAI::JustAppeared(); } #else // Called when creature is spawned or respawned (for reseting variables) void JustRespawned() override { -#ifndef CMANGOS if (!me->GetEluna()->JustRespawned(me)) - ScriptedAI::JustRespawned(); -#else - if (!me->GetEluna()->JustRespawned(me)) - CreatureAI::JustRespawned(); -#endif + NativeScriptedAI::JustRespawned(); } #endif // Called at reaching home after evade void JustReachedHome() override { -#ifndef CMANGOS - if (!me->GetEluna()->JustReachedHome(me)) - ScriptedAI::JustReachedHome(); -#else if (!me->GetEluna()->JustReachedHome(me)) - CreatureAI::JustReachedHome(); -#endif + NativeScriptedAI::JustReachedHome(); } // Called at text emote receive from player void ReceiveEmote(Player* player, uint32 emoteId) override { -#ifndef CMANGOS if (!me->GetEluna()->ReceiveEmote(me, player, emoteId)) - ScriptedAI::ReceiveEmote(player, emoteId); -#else - if (!me->GetEluna()->ReceiveEmote(me, player, emoteId)) - CreatureAI::ReceiveEmote(player, emoteId); -#endif + NativeScriptedAI::ReceiveEmote(player, emoteId); } // called when the corpse of this creature gets removed void CorpseRemoved(uint32& respawnDelay) override { -#ifndef CMANGOS if (!me->GetEluna()->CorpseRemoved(me, respawnDelay)) - ScriptedAI::CorpseRemoved(respawnDelay); -#else - if (!me->GetEluna()->CorpseRemoved(me, respawnDelay)) - CreatureAI::CorpseRemoved(respawnDelay); -#endif + NativeScriptedAI::CorpseRemoved(respawnDelay); } -#if !defined TRINITY && !AZEROTHCORE && !VMANGOS +#if !defined TRINITY && !defined VMANGOS // Enables use of MoveInLineOfSight bool IsVisible(Unit* who) const override { @@ -296,13 +212,8 @@ struct ElunaCreatureAI : CreatureAI void MoveInLineOfSight(Unit* who) override { -#ifndef CMANGOS if (!me->GetEluna()->MoveInLineOfSight(me, who)) - ScriptedAI::MoveInLineOfSight(who); -#else - if (!me->GetEluna()->MoveInLineOfSight(me, who)) - CreatureAI::MoveInLineOfSight(who); -#endif + NativeScriptedAI::MoveInLineOfSight(who); } // Called when hit by a spell @@ -314,13 +225,8 @@ struct ElunaCreatureAI : CreatureAI void SpellHit(Unit* caster, SpellInfo const* spell) override #endif { -#ifndef CMANGOS - if (!me->GetEluna()->SpellHit(me, caster, spell)) - ScriptedAI::SpellHit(caster, spell); -#else if (!me->GetEluna()->SpellHit(me, caster, spell)) - CreatureAI::SpellHit(caster, spell); -#endif + NativeScriptedAI::SpellHit(caster, spell); } // Called when spell hits a target @@ -330,13 +236,8 @@ struct ElunaCreatureAI : CreatureAI void SpellHitTarget(Unit* target, SpellInfo const* spell) override #endif { -#ifndef CMANGOS - if (!me->GetEluna()->SpellHitTarget(me, target, spell)) - ScriptedAI::SpellHitTarget(target, spell); -#else if (!me->GetEluna()->SpellHitTarget(me, target, spell)) - CreatureAI::SpellHitTarget(target, spell); -#endif + NativeScriptedAI::SpellHitTarget(target, spell); } #if defined TRINITY @@ -344,27 +245,27 @@ struct ElunaCreatureAI : CreatureAI void IsSummonedBy(WorldObject* summoner) override { if (!summoner->ToUnit() || !me->GetEluna()->OnSummoned(me, summoner->ToUnit())) - ScriptedAI::IsSummonedBy(summoner); + NativeScriptedAI::IsSummonedBy(summoner); } void SummonedCreatureDies(Creature* summon, Unit* killer) override { if (!me->GetEluna()->SummonedCreatureDies(me, summon, killer)) - ScriptedAI::SummonedCreatureDies(summon, killer); + NativeScriptedAI::SummonedCreatureDies(summon, killer); } // Called when owner takes damage void OwnerAttackedBy(Unit* attacker) override { if (!me->GetEluna()->OwnerAttackedBy(me, attacker)) - ScriptedAI::OwnerAttackedBy(attacker); + NativeScriptedAI::OwnerAttackedBy(attacker); } // Called when owner attacks something void OwnerAttacked(Unit* target) override { if (!me->GetEluna()->OwnerAttacked(me, target)) - ScriptedAI::OwnerAttacked(target); + NativeScriptedAI::OwnerAttacked(target); } #endif diff --git a/ElunaEventMgr.cpp b/ElunaEventMgr.cpp index 5a91c264ac..7ee65316c2 100644 --- a/ElunaEventMgr.cpp +++ b/ElunaEventMgr.cpp @@ -6,7 +6,7 @@ #include "ElunaEventMgr.h" #include "LuaEngine.h" -#ifndef CMANGOS +#if !defined CMANGOS #include "Object.h" #else #include "Entities/Object.h" diff --git a/ElunaEventMgr.h b/ElunaEventMgr.h index 0d86521bc0..72a8f1d1cd 100644 --- a/ElunaEventMgr.h +++ b/ElunaEventMgr.h @@ -9,7 +9,7 @@ #include "ElunaUtility.h" #include "Common.h" -#ifdef TRINITY +#if defined TRINITY #include "Random.h" #elif defined CMANGOS #include "Util/Util.h" @@ -18,7 +18,7 @@ #endif #include -#if defined(TRINITY) || AZEROTHCORE +#if defined TRINITY #include "Define.h" #else #include "Platform/Define.h" diff --git a/ElunaIncludes.h b/ElunaIncludes.h index b8eb057262..00535c0045 100644 --- a/ElunaIncludes.h +++ b/ElunaIncludes.h @@ -8,17 +8,14 @@ #define _ELUNA_INCLUDES_H // Required -#ifndef CMANGOS +#if !defined CMANGOS #include "AccountMgr.h" #include "AuctionHouseMgr.h" #include "Cell.h" #include "CellImpl.h" -#include "Chat.h" #include "Channel.h" +#include "Chat.h" #include "DBCStores.h" -#if defined CATA && defined TRINITY -#include "DB2Stores.h" -#endif #include "GameEventMgr.h" #include "GossipDef.h" #include "GridNotifiers.h" @@ -28,75 +25,67 @@ #include "GuildMgr.h" #include "Language.h" #include "Mail.h" +#include "MapManager.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Opcodes.h" -#include "Player.h" #include "Pet.h" +#include "Player.h" #include "ReputationMgr.h" #include "ScriptMgr.h" #include "Spell.h" #include "SpellAuras.h" #include "SpellMgr.h" #include "TemporarySummon.h" -#include "WorldSession.h" #include "WorldPacket.h" +#include "WorldSession.h" #else #include "Accounts/AccountMgr.h" #include "AuctionHouse/AuctionHouseMgr.h" -#include "Grids/Cell.h" -#include "Grids/CellImpl.h" -#include "Chat/Chat.h" #include "Chat/Channel.h" -#include "Server/DBCStores.h" -#include "GameEvents/GameEventMgr.h" +#include "Chat/Chat.h" +#include "DBScripts/ScriptMgr.h" #include "Entities/GossipDef.h" +#include "Entities/Pet.h" +#include "Entities/Player.h" +#include "Entities/TemporarySpawn.h" +#include "GameEvents/GameEventMgr.h" +#include "Globals/ObjectAccessor.h" +#include "Globals/ObjectMgr.h" +#include "Grids/Cell.h" +#include "Grids/CellImpl.h" #include "Grids/GridNotifiers.h" #include "Grids/GridNotifiersImpl.h" #include "Groups/Group.h" #include "Guilds/Guild.h" #include "Guilds/GuildMgr.h" -#include "Tools/Language.h" #include "Mails/Mail.h" #include "Maps/MapManager.h" -#include "Globals/ObjectAccessor.h" -#include "Globals/ObjectMgr.h" -#include "Server/Opcodes.h" -#include "Entities/Player.h" -#include "Entities/Pet.h" #include "Reputation/ReputationMgr.h" -#include "DBScripts/ScriptMgr.h" +#include "Server/DBCStores.h" +#include "Server/Opcodes.h" +#include "Server/WorldPacket.h" +#include "Server/WorldSession.h" #include "Spells/Spell.h" #include "Spells/SpellAuras.h" #include "Spells/SpellMgr.h" -#include "Entities/TemporarySpawn.h" -#include "Server/WorldSession.h" -#include "Server/WorldPacket.h" +#include "Tools/Language.h" #endif #if defined TRINITY -#include "SpellHistory.h" -#include "MiscPackets.h" -#endif - -#if defined AZEROTHCORE -#include "MapMgr.h" -#elif !defined CMANGOS -#include "MapManager.h" -#endif - -#if defined TRINITY || defined AZEROTHCORE +#include "Bag.h" +#include "Battleground.h" #include "Config.h" +#include "DatabaseEnv.h" #include "GameEventMgr.h" #include "GitRevision.h" #include "GroupMgr.h" +#include "MiscPackets.h" +#include "MotionMaster.h" #include "ScriptedCreature.h" +#include "SpellHistory.h" #include "SpellInfo.h" #include "WeatherMgr.h" -#include "Battleground.h" -#include "MotionMaster.h" -#include "DatabaseEnv.h" -#include "Bag.h" #else #include "Config/Config.h" #if defined CMANGOS && defined CATA @@ -113,80 +102,67 @@ #include "SQLStorages.h" #endif #include "BattleGroundMgr.h" -#ifndef CMANGOS +#if !defined CMANGOS #include "SQLStorages.h" #else #include "Server/SQLStorages.h" #endif -#ifdef MANGOS +#if defined MANGOS #include "GitRevision.h" #else #include "revision.h" #endif #endif -#if (!defined(TBC) && !defined(CLASSIC)) -#ifndef CMANGOS +#if !defined TBC && !defined CLASSIC +#if !defined CMANGOS #include "Vehicle.h" #else #include "Entities/Vehicle.h" #endif #endif -#ifndef CLASSIC -#ifndef CMANGOS +#if !defined CLASSIC +typedef Opcodes OpcodesList; +#if !defined CMANGOS #include "ArenaTeam.h" #else #include "Arena/ArenaTeam.h" #endif #endif -#if (defined(TRINITY) && defined(CATA)) -typedef OpcodeServer OpcodesList; - -#elif !defined CLASSIC -typedef Opcodes OpcodesList; -#endif - /* * Note: if you add or change a CORE_NAME or CORE_VERSION #define, * please update LuaGlobalFunctions::GetCoreName or LuaGlobalFunctions::GetCoreVersion documentation example string. */ -#ifdef MANGOS +#if defined MANGOS #define CORE_NAME "MaNGOS" #define CORE_VERSION REVISION_NR -#ifdef CATA +#if defined CATA #define NUM_MSG_TYPES NUM_OPCODE_HANDLERS #endif #endif -#ifdef CMANGOS +#if defined CMANGOS #define CORE_NAME "cMaNGOS" #define CORE_VERSION REVISION_DATE " " REVISION_ID -#ifdef CATA +#if defined CATA #define NUM_MSG_TYPES MAX_OPCODE_TABLE_SIZE #endif #endif -#ifdef VMANGOS +#if defined VMANGOS #define CORE_NAME "vMaNGOS" #define CORE_VERSION REVISION_HASH #define DEFAULT_LOCALE LOCALE_enUS #endif -#ifdef TRINITY +#if defined TRINITY #define CORE_NAME "TrinityCore" #define REGEN_TIME_FULL -#ifdef CATA -#define NUM_MSG_TYPES NUM_OPCODE_HANDLERS -#endif -#endif - -#ifdef AZEROTHCORE -#define CORE_NAME "AzerothCore" #endif -#if defined TRINITY || defined AZEROTHCORE +#if defined TRINITY #define CORE_VERSION (GitRevision::GetFullVersion()) #define eWorld (sWorld) #define eMapMgr (sMapMgr) @@ -196,9 +172,7 @@ typedef Opcodes OpcodesList; #define eAuctionMgr (sAuctionMgr) #define eGameEventMgr (sGameEventMgr) #define eObjectAccessor() ObjectAccessor:: -#endif - -#if !defined TRINITY && !AZEROTHCORE +#else #define eWorld (&sWorld) #define eMapMgr (&sMapMgr) #define eConfigMgr (&sConfig) @@ -212,24 +186,24 @@ typedef Opcodes OpcodesList; #define TOTAL_LOCALES MAX_LOCALE #define TARGETICONCOUNT TARGET_ICON_COUNT #define MAX_TALENT_SPECS MAX_TALENT_SPEC_COUNT -#ifndef VMANGOS +#if !defined VMANGOS #define TEAM_NEUTRAL TEAM_INDEX_NEUTRAL #endif -#if ((defined(CATA) && !defined(MANGOS)) || defined VMANGOS) +#if (defined CATA && !defined MANGOS) || defined VMANGOS #define PLAYER_FIELD_LIFETIME_HONORABLE_KILLS PLAYER_FIELD_LIFETIME_HONORBALE_KILLS #endif -#ifdef TBC +#if defined TBC #define SPELL_AURA_MOD_KILL_XP_PCT SPELL_AURA_MOD_XP_PCT #endif -#if defined(CATA) || defined(MISTS) || (defined(WOTLK) && !defined(MANGOS)) +#if defined CATA || defined MISTS || (defined WOTLK && !defined MANGOS) #define UNIT_BYTE2_FLAG_SANCTUARY UNIT_BYTE2_FLAG_SUPPORTABLE #endif -#ifndef CMANGOS +#if !defined CMANGOS typedef TemporarySummon TempSummon; #else typedef TemporarySpawn TempSummon; diff --git a/ElunaInstanceAI.cpp b/ElunaInstanceAI.cpp index 2f8d9c049d..388c36bfa2 100644 --- a/ElunaInstanceAI.cpp +++ b/ElunaInstanceAI.cpp @@ -9,7 +9,7 @@ #include "lmarshal.h" -#ifndef TRINITY +#if !defined TRINITY void ElunaInstanceAI::Initialize() { ASSERT(!instance->GetEluna()->HasInstanceData(instance)); @@ -80,7 +80,7 @@ void ElunaInstanceAI::Load(const char* data) lua_pop(L, 1); // Stack: (empty) -#ifndef TRINITY +#if !defined TRINITY Initialize(); #endif } @@ -92,7 +92,7 @@ void ElunaInstanceAI::Load(const char* data) lua_pop(L, 1); // Stack: (empty) -#ifndef TRINITY +#if !defined TRINITY Initialize(); #endif } @@ -103,7 +103,7 @@ void ElunaInstanceAI::Load(const char* data) { ELUNA_LOG_ERROR("Error while decoding instance data: Data is not valid base-64"); -#ifndef TRINITY +#if !defined TRINITY Initialize(); #endif } diff --git a/ElunaInstanceAI.h b/ElunaInstanceAI.h index a9fa3faf5f..b69c208c1f 100644 --- a/ElunaInstanceAI.h +++ b/ElunaInstanceAI.h @@ -8,18 +8,15 @@ #define _ELUNA_INSTANCE_DATA_H #include "LuaEngine.h" -#if defined(TRINITY) || AZEROTHCORE +#if defined TRINITY #include "InstanceScript.h" +#include "Map.h" #elif defined CMANGOS #include "Maps/InstanceData.h" #else #include "InstanceData.h" #endif -#ifdef TRINITY -#include "Map.h" -#endif - /* * This class is a small wrapper around `InstanceData`, * allowing instances to be scripted with Eluna. @@ -66,7 +63,7 @@ class ElunaInstanceAI : public InstanceData std::string lastSaveData; public: -#ifdef TRINITY +#if defined TRINITY ElunaInstanceAI(Map* map) : InstanceData(map->ToInstanceMap()) { } @@ -76,7 +73,7 @@ class ElunaInstanceAI : public InstanceData } #endif -#ifndef TRINITY +#if !defined TRINITY void Initialize() override; #endif @@ -85,7 +82,7 @@ class ElunaInstanceAI : public InstanceData * data table to/from the core. */ void Load(const char* data) override; -#if defined TRINITY || AZEROTHCORE +#if defined TRINITY // Simply calls Save, since the functions are a bit different in name and data types on different cores std::string GetSaveData() override { @@ -113,14 +110,14 @@ class ElunaInstanceAI : public InstanceData /* * These methods allow non-Lua scripts (e.g. DB, C++) to get/set instance data. */ -#ifndef VMANGOS +#if !defined VMANGOS uint32 GetData(uint32 key) const override; #else uint32 GetData(uint32 key) const; #endif void SetData(uint32 key, uint32 value) override; -#ifndef VMANGOS +#if !defined VMANGOS uint64 GetData64(uint32 key) const override; #else uint64 GetData64(uint32 key) const; @@ -151,7 +148,7 @@ class ElunaInstanceAI : public InstanceData instance->GetEluna()->OnPlayerEnterInstance(this, player); } -#if defined TRINITY || AZEROTHCORE +#if defined TRINITY void OnGameObjectCreate(GameObject* gameobject) override #else void OnObjectCreate(GameObject* gameobject) override diff --git a/ElunaLoader.cpp b/ElunaLoader.cpp index eab05f5443..a01b5b0c63 100644 --- a/ElunaLoader.cpp +++ b/ElunaLoader.cpp @@ -13,7 +13,7 @@ #include #include -#ifdef USING_BOOST +#if defined USING_BOOST #include namespace fs = boost::filesystem; #else @@ -21,11 +21,11 @@ namespace fs = boost::filesystem; namespace fs = std::filesystem; #endif -#ifdef ELUNA_WINDOWS +#if defined ELUNA_WINDOWS #include #endif -#ifdef TRINITY +#if defined TRINITY #include "MapManager.h" #endif @@ -35,7 +35,7 @@ extern "C" { #include } -#ifdef TRINITY +#if defined TRINITY void ElunaUpdateListener::handleFileAction(efsw::WatchID /*watchid*/, std::string const& dir, std::string const& filename, efsw::Action /*action*/, std::string /*oldFilename*/) { auto const path = fs::absolute(filename, dir); @@ -54,7 +54,7 @@ void ElunaUpdateListener::handleFileAction(efsw::WatchID /*watchid*/, std::strin ElunaLoader::ElunaLoader() : m_cacheState(SCRIPT_CACHE_NONE) { -#ifdef TRINITY +#if defined TRINITY lua_scriptWatcher = -1; #endif } @@ -71,7 +71,7 @@ ElunaLoader::~ElunaLoader() if (m_reloadThread.joinable()) m_reloadThread.join(); -#ifdef TRINITY +#if defined TRINITY if (lua_scriptWatcher >= 0) { lua_fileWatcher.removeWatch(lua_scriptWatcher); @@ -116,7 +116,7 @@ void ElunaLoader::LoadScripts() const std::string& lua_path_extra = sElunaConfig->GetConfig(CONFIG_ELUNA_REQUIRE_PATH_EXTRA); const std::string& lua_cpath_extra = sElunaConfig->GetConfig(CONFIG_ELUNA_REQUIRE_CPATH_EXTRA); -#ifndef ELUNA_WINDOWS +#if !defined ELUNA_WINDOWS if (lua_folderpath[0] == '~') if (const char* home = getenv("HOME")) lua_folderpath.replace(0, 1, home); @@ -194,7 +194,7 @@ void ElunaLoader::ReadFiles(lua_State* L, std::string path) { std::string fullpath = dir_iter->path().generic_string(); // Check if file is hidden -#ifdef ELUNA_WINDOWS +#if defined ELUNA_WINDOWS DWORD dwAttrib = GetFileAttributes(fullpath.c_str()); if (dwAttrib != INVALID_FILE_ATTRIBUTES && (dwAttrib & FILE_ATTRIBUTE_HIDDEN)) continue; @@ -312,7 +312,7 @@ void ElunaLoader::ProcessScript(lua_State* L, std::string filename, const std::s ELUNA_LOG_DEBUG("[Eluna]: ProcessScript processed `%s` successfully", fullpath.c_str()); } -#ifdef TRINITY +#if defined TRINITY void ElunaLoader::InitializeFileWatcher() { std::string lua_folderpath = sElunaConfig->GetConfig(CONFIG_ELUNA_SCRIPT_PATH); @@ -358,14 +358,14 @@ void ElunaLoader::ReloadElunaForMap(int mapId) if (mapId != RELOAD_CACHE_ONLY) { if (mapId == RELOAD_GLOBAL_STATE || mapId == RELOAD_ALL_STATES) -#ifdef TRINITY +#if defined TRINITY if (Eluna* e = sWorld->GetEluna()) #else if (Eluna* e = sWorld.GetEluna()) #endif e->ReloadEluna(); -#ifdef TRINITY +#if defined TRINITY sMapMgr->DoForAllMaps([&](Map* map) #else sMapMgr.DoForAllMaps([&](Map* map) diff --git a/ElunaLoader.h b/ElunaLoader.h index 5c0f9cfc15..298f29b84f 100644 --- a/ElunaLoader.h +++ b/ElunaLoader.h @@ -1,5 +1,5 @@ /* -* Copyright (C) 2010 - 2022 Eluna Lua Engine +* Copyright (C) 2010 - 2024 Eluna Lua Engine * Copyright (C) 2022 - 2022 Hour of Twilight * This program is free software licensed under GPL version 3 * Please see the included DOCS/LICENSE.md for more information @@ -8,7 +8,9 @@ #ifndef _ELUNALOADER_H #define _ELUNALOADER_H -#ifdef TRINITY +#include "LuaEngine.h" + +#if defined TRINITY #include #endif @@ -56,7 +58,7 @@ class ElunaLoader const std::string& GetRequirePath() const { return m_requirePath; } const std::string& GetRequireCPath() const { return m_requirecPath; } -#ifdef TRINITY +#if defined TRINITY // efsw file watcher void InitializeFileWatcher(); efsw::FileWatcher lua_fileWatcher; @@ -80,7 +82,7 @@ class ElunaLoader std::thread m_reloadThread; }; -#ifdef TRINITY +#if defined TRINITY /// File watcher responsible for watching lua scripts class ElunaUpdateListener : public efsw::FileWatchListener { diff --git a/ElunaTemplate.h b/ElunaTemplate.h index 1660548851..cd0c1cb98a 100644 --- a/ElunaTemplate.h +++ b/ElunaTemplate.h @@ -16,13 +16,13 @@ extern "C" #include "LuaEngine.h" #include "ElunaUtility.h" #include "ElunaCompat.h" -#ifndef CMANGOS +#if !defined CMANGOS #include "SharedDefines.h" #else #include "Globals/SharedDefines.h" #endif -#ifdef TRINITY +#if defined TRINITY #include "UniqueTrackablePtr.h" #endif @@ -115,7 +115,7 @@ class ElunaObject virtual void* GetObjIfValid() const = 0; // Returns pointer to the wrapped object's type name const char* GetTypeName() const { return type_name; } -#ifndef TRACKABLE_PTR_NAMESPACE +#if !defined TRACKABLE_PTR_NAMESPACE // Invalidates the pointer if it should be invalidated virtual void Invalidate() = 0; #endif @@ -125,7 +125,7 @@ class ElunaObject const char* type_name; }; -#ifdef TRACKABLE_PTR_NAMESPACE +#if defined TRACKABLE_PTR_NAMESPACE template struct ElunaConstrainedObjectRef { @@ -156,7 +156,7 @@ template class ElunaObjectImpl : public ElunaObject { public: -#ifdef TRACKABLE_PTR_NAMESPACE +#if defined TRACKABLE_PTR_NAMESPACE ElunaObjectImpl(Eluna* E, T const* obj, char const* tname) : ElunaObject(E, tname), _obj(GetWeakPtrFor(obj)) { } @@ -186,7 +186,7 @@ class ElunaObjectImpl : public ElunaObject #endif private: -#ifdef TRACKABLE_PTR_NAMESPACE +#if defined TRACKABLE_PTR_NAMESPACE ElunaConstrainedObjectRef _obj; #else void* _obj; @@ -204,7 +204,7 @@ class ElunaObjectValueImpl : public ElunaObject void* GetObjIfValid() const override { return const_cast(&_obj); } -#ifndef TRACKABLE_PTR_NAMESPACE +#if !defined TRACKABLE_PTR_NAMESPACE void Invalidate() override { } #endif diff --git a/ElunaUtility.cpp b/ElunaUtility.cpp index 142c0c34f3..1d0bc3a5e2 100644 --- a/ElunaUtility.cpp +++ b/ElunaUtility.cpp @@ -5,7 +5,7 @@ */ #include "ElunaUtility.h" -#ifndef CMANGOS +#if !defined CMANGOS #include "World.h" #include "Object.h" #include "Unit.h" @@ -67,7 +67,7 @@ ElunaUtil::WorldObjectInRangeCheck::WorldObjectInRangeCheck(bool nearest, WorldO if (GameObject const* go = i_obj->ToGameObject()) i_obj_unit = go->GetOwner(); if (!i_obj_unit) -#ifndef VMANGOS +#if !defined VMANGOS i_obj_fact = sFactionTemplateStore.LookupEntry(14); #else i_obj_fact = sObjectMgr.GetFactionTemplateEntry(14); @@ -101,12 +101,9 @@ bool ElunaUtil::WorldObjectInRangeCheck::operator()(WorldObject* u) { if (i_obj_fact) { -#if ((defined TRINITY || AZEROTHCORE || CMANGOS || VMANGOS) && !defined CATA) +#if (defined TRINITY || CMANGOS || VMANGOS) && !defined CATA if ((i_obj_fact->IsHostileTo(*target->GetFactionTemplateEntry())) != (i_hostile == 1)) return false; -#elif defined CATA && defined TRINITY - if ((i_obj_fact->IsHostileTo(target->GetFactionTemplateEntry())) != (i_hostile == 1)) - return false; #elif defined CATA && defined CMANGOS if ((i_obj_fact->IsHostileTo(*target->GetFactionTemplateEntry())) != (i_hostile == 1)) return false; diff --git a/ElunaUtility.h b/ElunaUtility.h index 3dbd5ba632..5f3d33d729 100644 --- a/ElunaUtility.h +++ b/ElunaUtility.h @@ -7,25 +7,20 @@ #ifndef _ELUNA_UTIL_H #define _ELUNA_UTIL_H -#include -#include -#include -#include #include "Common.h" -#ifndef CMANGOS + +#if !defined CMANGOS #include "SharedDefines.h" #include "ObjectGuid.h" #else #include "Globals/SharedDefines.h" #include "Entities/ObjectGuid.h" #endif -#ifdef TRINITY + +#if defined TRINITY #include "QueryResult.h" #include "Log.h" -#ifdef CATA -#include "Object.h" -#endif -#elif VMANGOS +#elif defined VMANGOS #include "Database/QueryResult.h" #include "Log.h" #else @@ -33,19 +28,20 @@ #include "Log/Log.h" #endif -#if !defined(MANGOS) && !defined(VMANGOS) +#include +#include +#include +#include + +#if !defined MANGOS && !defined VMANGOS #define USING_BOOST #endif -#if defined(TRINITY_PLATFORM) && defined(TRINITY_PLATFORM_WINDOWS) +#if defined TRINITY_PLATFORM && defined TRINITY_PLATFORM_WINDOWS #if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS #define ELUNA_WINDOWS #endif -#elif defined(AC_PLATFORM) && defined(AC_PLATFORM_WINDOWS) -#if AC_PLATFORM == AC_PLATFORM_WINDOWS -#define ELUNA_WINDOWS -#endif -#elif defined(PLATFORM) && defined(PLATFORM_WINDOWS) +#elif defined PLATFORM && defined PLATFORM_WINDOWS #if PLATFORM == PLATFORM_WINDOWS #define ELUNA_WINDOWS #endif @@ -53,7 +49,7 @@ #error Eluna could not determine platform #endif -#if defined(TRINITY) || defined(AZEROTHCORE) +#if defined TRINITY typedef QueryResult ElunaQuery; #define GET_GUID GetGUID #define HIGHGUID_PLAYER HighGuid::Player @@ -71,8 +67,7 @@ typedef QueryResult ElunaQuery; #define HIGHGUID_GROUP HighGuid::Group #endif -#ifdef TRINITY -#ifdef WOTLK +#if defined TRINITY #include "fmt/printf.h" #define ELUNA_LOG_TC_FMT(TC_LOG_MACRO, ...) \ try { \ @@ -84,16 +79,7 @@ typedef QueryResult ElunaQuery; #define ELUNA_LOG_INFO(...) ELUNA_LOG_TC_FMT(TC_LOG_INFO, __VA_ARGS__); #define ELUNA_LOG_ERROR(...) ELUNA_LOG_TC_FMT(TC_LOG_ERROR, __VA_ARGS__); #define ELUNA_LOG_DEBUG(...) ELUNA_LOG_TC_FMT(TC_LOG_DEBUG, __VA_ARGS__); -#else -#define ELUNA_LOG_INFO(...) TC_LOG_INFO("eluna", __VA_ARGS__); -#define ELUNA_LOG_ERROR(...) TC_LOG_ERROR("eluna", __VA_ARGS__); -#define ELUNA_LOG_DEBUG(...) TC_LOG_DEBUG("eluna", __VA_ARGS__); -#endif -#elif defined(AZEROTHCORE) -#define ELUNA_LOG_INFO(...) LOG_INFO("eluna", __VA_ARGS__); -#define ELUNA_LOG_ERROR(...) LOG_ERROR("eluna", __VA_ARGS__); -#define ELUNA_LOG_DEBUG(...) LOG_DEBUG("eluna", __VA_ARGS__); -#elif VMANGOS +#elif defined VMANGOS typedef std::shared_ptr ElunaQuery; #define ASSERT MANGOS_ASSERT #define ELUNA_LOG_INFO(...) sLog.Out(LOG_ELUNA, LOG_LVL_BASIC,__VA_ARGS__); @@ -115,20 +101,18 @@ typedef std::shared_ptr ElunaQuery; #define GetTemplate GetProto #endif -#if defined(TRINITY) || defined(AZEROTHCORE) || defined(MANGOS) || defined(CMANGOS) || defined(VMANGOS) -#ifndef MAKE_NEW_GUID +#if !defined MAKE_NEW_GUID #define MAKE_NEW_GUID(l, e, h) ObjectGuid(h, e, l) #endif -#ifndef GUID_ENPART +#if !defined GUID_ENPART #define GUID_ENPART(guid) ObjectGuid(guid).GetEntry() #endif -#ifndef GUID_LOPART +#if !defined GUID_LOPART #define GUID_LOPART(guid) ObjectGuid(guid).GetCounter() #endif -#ifndef GUID_HIPART +#if !defined GUID_HIPART #define GUID_HIPART(guid) ObjectGuid(guid).GetHigh() #endif -#endif typedef std::vector BytecodeBuffer; diff --git a/LuaEngine.cpp b/LuaEngine.cpp index 131d2abf61..12e3052e21 100644 --- a/LuaEngine.cpp +++ b/LuaEngine.cpp @@ -309,7 +309,7 @@ void Eluna::RunScripts() OnLuaStateOpen(); } -#ifndef TRACKABLE_PTR_NAMESPACE +#if !defined TRACKABLE_PTR_NAMESPACE void Eluna::InvalidateObjects() { ++callstackid; @@ -971,7 +971,7 @@ int Eluna::Register(uint8 regtype, uint32 entry, ObjectGuid guid, uint32 instanc luaL_unref(L, LUA_REGISTRYINDEX, functionRef); std::ostringstream oss; oss << "regtype " << static_cast(regtype) << ", event " << event_id << ", entry " << entry << ", guid " << -#ifdef TRINITY +#if defined TRINITY guid.ToHexString() #else guid.GetRawValue() @@ -984,13 +984,13 @@ int Eluna::Register(uint8 regtype, uint32 entry, ObjectGuid guid, uint32 instanc void Eluna::UpdateEluna(uint32 diff) { if (reload && sElunaLoader->GetCacheState() == SCRIPT_CACHE_READY) -#ifdef TRINITY +#if defined TRINITY if(!GetQueryProcessor().HasPendingCallbacks()) #endif _ReloadEluna(); eventMgr->globalProcessor->Update(diff); -#ifdef TRINITY +#if defined TRINITY GetQueryProcessor().ProcessReadyCallbacks(); #endif } @@ -1005,7 +1005,7 @@ void Eluna::CleanUpStack(int number_of_arguments) lua_pop(L, number_of_arguments + 1); // Add 1 because the caller doesn't know about `event_id`. // Stack: (empty) -#ifndef TRACKABLE_PTR_NAMESPACE +#if !defined TRACKABLE_PTR_NAMESPACE if (event_level == 0) InvalidateObjects(); #endif diff --git a/LuaEngine.h b/LuaEngine.h index fdca2ba9c1..76cebfce4f 100644 --- a/LuaEngine.h +++ b/LuaEngine.h @@ -8,36 +8,36 @@ #define _LUA_ENGINE_H #include "Common.h" -#ifndef CMANGOS -#include "SharedDefines.h" -#include "DBCEnums.h" +#include "ElunaUtility.h" +#include "Hooks.h" +#if !defined CMANGOS +#include "DBCEnums.h" #include "Group.h" #include "Item.h" +#include "Map.h" +#include "SharedDefines.h" +#include "Weather.h" +#include "World.h" #else +#include "Entities/Item.h" #include "Globals/SharedDefines.h" -#include "Server/DBCEnums.h" #include "Groups/Group.h" -#include "Entities/Item.h" +#include "Maps/Map.h" +#include "Server/DBCEnums.h" +#include "Weather/Weather.h" +#include "World/World.h" #endif -#ifndef TRINITY -#ifndef CMANGOS + +#if !defined TRINITY +#if !defined CMANGOS #include "Player.h" #else #include "Entities/Player.h" #endif #endif -#ifndef CMANGOS -#include "Map.h" -#include "Weather.h" -#include "World.h" -#else -#include "Maps/Map.h" -#include "Weather/Weather.h" -#include "World/World.h" -#endif -#include "Hooks.h" -#include "ElunaUtility.h" + + #include #include @@ -46,76 +46,62 @@ extern "C" #include "lua.h" }; -#if defined(TRINITY) || AZEROTHCORE -struct ItemTemplate; -typedef BattlegroundTypeId BattleGroundTypeId; -#else -struct ItemPrototype; -typedef ItemPrototype ItemTemplate; -typedef SpellEffectIndex SpellEffIndex; -struct SpellEntry; -typedef SpellEntry SpellInfo; -#ifdef CLASSIC -typedef int Difficulty; -#endif -#endif -#ifndef AZEROTHCORE -struct AreaTriggerEntry; -#else -typedef AreaTrigger AreaTriggerEntry; -#endif class AuctionHouseObject; -struct AuctionEntry; -#if defined(TRINITY) || AZEROTHCORE -class Battleground; -typedef Battleground BattleGround; -#endif class Channel; class Corpse; class Creature; class CreatureAI; +class ElunaInstanceAI; class GameObject; -#if defined(TRINITY) || AZEROTHCORE -class GameObjectAI; -#endif -class Guild; class Group; -#if defined(TRINITY) || AZEROTHCORE -class InstanceScript; -typedef InstanceScript InstanceData; -#else -class InstanceData; -#endif -class ElunaInstanceAI; +class Guild; class Item; class Pet; class Player; class Quest; class Spell; class SpellCastTargets; -#if defined(TRINITY) || AZEROTHCORE +class Unit; +class Weather; +class WorldPacket; +struct AreaTriggerEntry; +struct AuctionEntry; + +#if defined TRINITY +class Battleground; +class GameObjectAI; +class InstanceScript; class TempSummon; -#elif defined CMANGOS +class Vehicle; +struct ItemTemplate; +typedef Battleground BattleGround; +typedef BattlegroundTypeId BattleGroundTypeId; +typedef InstanceScript InstanceData; +#else // MANGOS && CMANGOS && VMANGOS +class InstanceData; +struct ItemPrototype; +struct SpellEntry; +typedef ItemPrototype ItemTemplate; +typedef SpellEffectIndex SpellEffIndex; +typedef SpellEntry SpellInfo; + +#if defined CMANGOS class TemporarySpawn; typedef TemporarySpawn TempSummon; #else class TemporarySummon; typedef TemporarySummon TempSummon; #endif -// class Transport; -class Unit; -class Weather; -class WorldPacket; -#ifndef CLASSIC -#ifndef TBC -#if defined(TRINITY) || AZEROTHCORE -class Vehicle; -#else + +#if defined CLASSIC +typedef int Difficulty; +#endif + +#if !defined CLASSIC && !defined TBC class VehicleInfo; typedef VehicleInfo Vehicle; #endif #endif -#endif struct lua_State; class EventMgr; @@ -147,11 +133,9 @@ enum MethodRegisterState #define ELUNA_STATE_PTR "Eluna State Ptr" -#if defined(TRINITY) +#if defined TRINITY #define ELUNA_GAME_API TC_GAME_API #define TRACKABLE_PTR_NAMESPACE ::Trinity:: -#elif defined(AZEROTHCORE) -#define ELUNA_GAME_API AC_GAME_API #else #define ELUNA_GAME_API #endif @@ -170,7 +154,7 @@ class ELUNA_GAME_API Eluna // Indicates that the lua state should be reloaded bool reload = false; -#ifndef TRACKABLE_PTR_NAMESPACE +#if !defined TRACKABLE_PTR_NAMESPACE // A counter for lua event stacks that occur (see event_level). // This is used to determine whether an object belongs to the current call stack or not. // 0 is reserved for always belonging to the call stack @@ -203,7 +187,7 @@ class ELUNA_GAME_API Eluna void CloseLua(); void DestroyBindStores(); void CreateBindStores(); -#ifndef TRACKABLE_PTR_NAMESPACE +#if !defined TRACKABLE_PTR_NAMESPACE void InvalidateObjects(); #endif @@ -258,7 +242,7 @@ class ELUNA_GAME_API Eluna lua_State* L; EventMgr* eventMgr; -#ifdef TRINITY +#if defined TRINITY QueryCallbackProcessor queryProcessor; QueryCallbackProcessor& GetQueryProcessor() { return queryProcessor; } #endif @@ -350,7 +334,7 @@ class ELUNA_GAME_API Eluna void RunScripts(); bool HasLuaState() const { return L != NULL; } -#ifndef TRACKABLE_PTR_NAMESPACE +#if !defined TRACKABLE_PTR_NAMESPACE uint64 GetCallstackId() const { return callstackid; } #endif int Register(uint8 reg, uint32 entry, ObjectGuid guid, uint32 instanceId, uint32 event_id, int functionRef, uint32 shots); @@ -477,11 +461,9 @@ 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); -#ifndef CLASSIC -#ifndef TBC +#if !defined CLASSIC && !defined TBC void OnDestroyed(GameObject* pGameObject, WorldObject* attacker); void OnDamaged(GameObject* pGameObject, WorldObject* attacker); -#endif #endif void OnLootStateChanged(GameObject* pGameObject, uint32 state); void OnGameObjectStateChanged(GameObject* pGameObject, uint32 state); @@ -507,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); -#ifdef CATA +#if defined CATA void OnMoneyChanged(Player* pPlayer, int64& amount); #endif void OnGiveXP(Player* pPlayer, uint32& amount, Unit* pVictim); @@ -535,15 +517,13 @@ 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); -#ifndef CLASSIC -#ifndef TBC +#if !defined CLASSIC && !defined TBC /* Vehicle */ void OnInstall(Vehicle* vehicle); void OnUninstall(Vehicle* vehicle); void OnInstallAccessory(Vehicle* vehicle, Creature* accessory); void OnAddPassenger(Vehicle* vehicle, Unit* passenger, int8 seatId); void OnRemovePassenger(Vehicle* vehicle, Unit* passenger); -#endif #endif /* AreaTrigger */ @@ -566,11 +546,11 @@ class ELUNA_GAME_API Eluna void OnCreate(Guild* guild, Player* leader, const std::string& name); void OnDisband(Guild* guild); void OnMemberWitdrawMoney(Guild* guild, Player* player, uint32& amount, bool isRepair); -#ifdef CATA +#if defined CATA void OnMemberWitdrawMoney(Guild* guild, Player* player, uint64& amount, bool isRepair); #endif void OnMemberDepositMoney(Guild* guild, Player* player, uint32& amount); -#ifdef CATA +#if defined CATA void OnMemberDepositMoney(Guild* guild, Player* player, uint64& amount); #endif void OnItemMove(Guild* guild, Player* player, Item* pItem, bool isSrcBank, uint8 srcContainer, uint8 srcSlotId, bool isDestBank, uint8 destContainer, uint8 destSlotId); @@ -583,11 +563,7 @@ class ELUNA_GAME_API Eluna void OnRemoveMember(Group* group, ObjectGuid guid, uint8 method); void OnChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid); void OnDisband(Group* group); -#if defined (TRINITY) && defined (CATA) - void OnCreate(Group* group, ObjectGuid leaderGuid, GroupFlags groupType); -#else void OnCreate(Group* group, ObjectGuid leaderGuid, GroupType groupType); -#endif bool OnMemberAccept(Group* group, Player* player); /* Map */ @@ -614,11 +590,7 @@ class ELUNA_GAME_API Eluna /* World */ void OnOpenStateChange(bool open); -#ifndef AZEROTHCORE void OnConfigLoad(bool reload); -#else - void OnConfigLoad(bool reload, bool isBefore); -#endif void OnShutdownInitiate(ShutdownExitCode code, ShutdownMask mask); void OnShutdownCancel(); void OnStartup(); @@ -628,11 +600,7 @@ class ELUNA_GAME_API Eluna /* Battle Ground */ 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); -#endif void OnBGCreate(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId); void OnBGDestroy(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId); diff --git a/LuaFunctions.cpp b/LuaFunctions.cpp index a23aa6a88f..634863879c 100644 --- a/LuaFunctions.cpp +++ b/LuaFunctions.cpp @@ -37,7 +37,7 @@ extern "C" #include "VehicleMethods.h" #include "BattleGroundMethods.h" -#ifdef TRACKABLE_PTR_NAMESPACE +#if defined TRACKABLE_PTR_NAMESPACE ElunaConstrainedObjectRef GetWeakPtrFor(Aura const* obj) { return { obj->GetWeakPtr(), obj->GetOwner()->GetMap() }; } ElunaConstrainedObjectRef GetWeakPtrFor(Battleground const* obj) { return { obj->GetWeakPtr(), obj->GetBgMap() }; } ElunaConstrainedObjectRef GetWeakPtrFor(Group const* obj) { return { obj->GetWeakPtr(), nullptr }; } @@ -117,7 +117,7 @@ template<> int ElunaTemplate::Equal(lua_State* L) { Eluna* E = Eluna template<> int ElunaTemplate::ToString(lua_State* L) { Eluna* E = Eluna::GetEluna(L); -#if defined(TRINITY) +#if defined TRINITY E->Push(E->CHECKVAL(1).ToString()); #else E->Push(E->CHECKVAL(1).GetString()); @@ -167,11 +167,9 @@ void RegisterFunctions(Eluna* E) ElunaTemplate::SetMethods(E, LuaObject::ObjectMethods); ElunaTemplate::SetMethods(E, LuaItem::ItemMethods); -#ifndef CLASSIC -#ifndef TBC +#if !defined CLASSIC && !defined TBC ElunaTemplate::Register(E, "Vehicle"); ElunaTemplate::SetMethods(E, LuaVehicle::VehicleMethods); -#endif #endif ElunaTemplate::Register(E, "Group"); diff --git a/hooks/BattleGroundHooks.cpp b/hooks/BattleGroundHooks.cpp index 455cbfadc2..292ba431aa 100644 --- a/hooks/BattleGroundHooks.cpp +++ b/hooks/BattleGroundHooks.cpp @@ -26,11 +26,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); HookPush(bg); diff --git a/hooks/CreatureHooks.cpp b/hooks/CreatureHooks.cpp index fc48206d8f..a48ab89e27 100644 --- a/hooks/CreatureHooks.cpp +++ b/hooks/CreatureHooks.cpp @@ -295,7 +295,7 @@ bool Eluna::SpellHitTarget(Creature* me, WorldObject* target, SpellInfo const* s return CallAllFunctionsBool(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key); } -#if defined TRINITY || AZEROTHCORE +#if defined TRINITY bool Eluna::SummonedCreatureDies(Creature* me, Creature* summon, Unit* killer) { diff --git a/hooks/GameObjectHooks.cpp b/hooks/GameObjectHooks.cpp index 1d2dbc0cfb..a19cea8e9c 100644 --- a/hooks/GameObjectHooks.cpp +++ b/hooks/GameObjectHooks.cpp @@ -69,8 +69,7 @@ void Eluna::GetDialogStatus(const Player* pPlayer, const GameObject* pGameObject CallAllFunctions(GameObjectEventBindings, key); } -#ifndef CLASSIC -#ifndef TBC +#if !defined(CLASSIC) && !defined(TBC) void Eluna::OnDestroyed(GameObject* pGameObject, WorldObject* attacker) { START_HOOK(GAMEOBJECT_EVENT_ON_DESTROYED, pGameObject->GetEntry()); @@ -87,7 +86,6 @@ void Eluna::OnDamaged(GameObject* pGameObject, WorldObject* attacker) CallAllFunctions(GameObjectEventBindings, key); } #endif -#endif void Eluna::OnLootStateChanged(GameObject* pGameObject, uint32 state) { diff --git a/hooks/GossipHooks.cpp b/hooks/GossipHooks.cpp index e74609375f..361a77c22f 100644 --- a/hooks/GossipHooks.cpp +++ b/hooks/GossipHooks.cpp @@ -26,7 +26,7 @@ using namespace Hooks; bool Eluna::OnGossipHello(Player* pPlayer, GameObject* pGameObject) { START_HOOK_WITH_RETVAL(GameObjectGossipBindings, GOSSIP_EVENT_ON_HELLO, pGameObject->GetEntry(), false); -#if defined CMANGOS && !defined(CATA) +#if defined CMANGOS && !defined CATA pPlayer->GetPlayerMenu()->ClearMenus(); #else pPlayer->PlayerTalkClass->ClearMenus(); @@ -39,7 +39,7 @@ bool Eluna::OnGossipHello(Player* pPlayer, GameObject* pGameObject) bool Eluna::OnGossipSelect(Player* pPlayer, GameObject* pGameObject, uint32 sender, uint32 action) { START_HOOK_WITH_RETVAL(GameObjectGossipBindings, GOSSIP_EVENT_ON_SELECT, pGameObject->GetEntry(), false); -#if defined CMANGOS && !defined(CATA) +#if defined CMANGOS && !defined CATA pPlayer->GetPlayerMenu()->ClearMenus(); #else pPlayer->PlayerTalkClass->ClearMenus(); @@ -54,7 +54,7 @@ bool Eluna::OnGossipSelect(Player* pPlayer, GameObject* pGameObject, uint32 send bool Eluna::OnGossipSelectCode(Player* pPlayer, GameObject* pGameObject, uint32 sender, uint32 action, const char* code) { START_HOOK_WITH_RETVAL(GameObjectGossipBindings, GOSSIP_EVENT_ON_SELECT, pGameObject->GetEntry(), false); -#if defined CMANGOS && !defined(CATA) +#if defined CMANGOS && !defined CATA pPlayer->GetPlayerMenu()->ClearMenus(); #else pPlayer->PlayerTalkClass->ClearMenus(); @@ -70,7 +70,7 @@ bool Eluna::OnGossipSelectCode(Player* pPlayer, GameObject* pGameObject, uint32 void Eluna::HandleGossipSelectOption(Player* pPlayer, uint32 menuId, uint32 sender, uint32 action, const std::string& code) { START_HOOK(PlayerGossipBindings, GOSSIP_EVENT_ON_SELECT, menuId); -#if defined CMANGOS && !defined(CATA) +#if defined CMANGOS && !defined CATA pPlayer->GetPlayerMenu()->ClearMenus(); #else pPlayer->PlayerTalkClass->ClearMenus(); @@ -91,7 +91,7 @@ void Eluna::HandleGossipSelectOption(Player* pPlayer, uint32 menuId, uint32 send bool Eluna::OnItemGossip(Player* pPlayer, Item* pItem, SpellCastTargets const& /*targets*/) { START_HOOK_WITH_RETVAL(ItemGossipBindings, GOSSIP_EVENT_ON_HELLO, pItem->GetEntry(), true); -#if defined CMANGOS && !defined(CATA) +#if defined CMANGOS && !defined CATA pPlayer->GetPlayerMenu()->ClearMenus(); #else pPlayer->PlayerTalkClass->ClearMenus(); @@ -104,7 +104,7 @@ bool Eluna::OnItemGossip(Player* pPlayer, Item* pItem, SpellCastTargets const& / void Eluna::HandleGossipSelectOption(Player* pPlayer, Item* pItem, uint32 sender, uint32 action, const std::string& code) { START_HOOK(ItemGossipBindings, GOSSIP_EVENT_ON_SELECT, pItem->GetEntry()); -#if defined CMANGOS && !defined(CATA) +#if defined CMANGOS && !defined CATA pPlayer->GetPlayerMenu()->ClearMenus(); #else pPlayer->PlayerTalkClass->ClearMenus(); @@ -125,7 +125,7 @@ void Eluna::HandleGossipSelectOption(Player* pPlayer, Item* pItem, uint32 sender bool Eluna::OnGossipHello(Player* pPlayer, Creature* pCreature) { START_HOOK_WITH_RETVAL(CreatureGossipBindings, GOSSIP_EVENT_ON_HELLO, pCreature->GetEntry(), false); -#if defined CMANGOS && !defined(CATA) +#if defined CMANGOS && !defined CATA pPlayer->GetPlayerMenu()->ClearMenus(); #else pPlayer->PlayerTalkClass->ClearMenus(); @@ -138,7 +138,7 @@ bool Eluna::OnGossipHello(Player* pPlayer, Creature* pCreature) bool Eluna::OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action) { START_HOOK_WITH_RETVAL(CreatureGossipBindings, GOSSIP_EVENT_ON_SELECT, pCreature->GetEntry(), false); -#if defined CMANGOS && !defined(CATA) +#if defined CMANGOS && !defined CATA auto original_menu = *pPlayer->GetPlayerMenu(); pPlayer->GetPlayerMenu()->ClearMenus(); #else @@ -151,7 +151,7 @@ bool Eluna::OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 sender, HookPush(action); auto preventDefault = CallAllFunctionsBool(CreatureGossipBindings, key, true); if (!preventDefault) { -#if defined CMANGOS && !defined(CATA) +#if defined CMANGOS && !defined CATA *pPlayer->GetPlayerMenu() = original_menu; #else *pPlayer->PlayerTalkClass = original_menu; @@ -163,7 +163,7 @@ bool Eluna::OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 sender, bool Eluna::OnGossipSelectCode(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action, const char* code) { START_HOOK_WITH_RETVAL(CreatureGossipBindings, GOSSIP_EVENT_ON_SELECT, pCreature->GetEntry(), false); -#if defined CMANGOS && !defined(CATA) +#if defined CMANGOS && !defined CATA auto original_menu = *pPlayer->GetPlayerMenu(); pPlayer->GetPlayerMenu()->ClearMenus(); #else @@ -177,7 +177,7 @@ bool Eluna::OnGossipSelectCode(Player* pPlayer, Creature* pCreature, uint32 send HookPush(code); auto preventDefault = CallAllFunctionsBool(CreatureGossipBindings, key, true); if (!preventDefault) { -#if defined CMANGOS &&!defined(CATA) +#if defined CMANGOS && !defined CATA *pPlayer->GetPlayerMenu() = original_menu; #else *pPlayer->PlayerTalkClass = original_menu; diff --git a/hooks/GuildHooks.cpp b/hooks/GuildHooks.cpp index 97915bdcb9..cf46ad46c9 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); } -#ifdef CATA +#if defined 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); } -#ifdef CATA +#if defined CATA void Eluna::OnMemberDepositMoney(Guild* guild, Player* player, uint64& amount) { START_HOOK(GUILD_EVENT_ON_MONEY_DEPOSIT); diff --git a/hooks/ItemHooks.cpp b/hooks/ItemHooks.cpp index 3b78c5823b..94ffc0df6e 100644 --- a/hooks/ItemHooks.cpp +++ b/hooks/ItemHooks.cpp @@ -68,7 +68,7 @@ bool Eluna::OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets) data << guid; data << ObjectGuid(uint64(0)); data << uint8(0); -#ifdef CMANGOS +#if defined CMANGOS pPlayer->GetSession()->SendPacket(data); #else pPlayer->GetSession()->SendPacket(&data); @@ -81,7 +81,7 @@ bool Eluna::OnItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targ START_HOOK_WITH_RETVAL(ITEM_EVENT_ON_USE, pItem->GetEntry(), true); HookPush(pPlayer); HookPush(pItem); -#if defined TRINITY || AZEROTHCORE +#if defined TRINITY if (GameObject* target = targets.GetGOTarget()) HookPush(target); else if (Item* target = targets.GetItemTarget()) diff --git a/hooks/PacketHooks.cpp b/hooks/PacketHooks.cpp index 86a211cb11..59f323e854 100644 --- a/hooks/PacketHooks.cpp +++ b/hooks/PacketHooks.cpp @@ -101,7 +101,7 @@ void Eluna::OnPacketReceiveAny(Player* player, WorldPacket& packet, bool& result if (lua_isuserdata(L, r + 1)) if (WorldPacket* data = CHECKOBJ(r + 1, false)) { -#if defined(TRINITY) || defined(VMANGOS) +#if defined TRINITY || defined VMANGOS packet = std::move(*data); #else packet = *data; @@ -131,7 +131,7 @@ void Eluna::OnPacketReceiveOne(Player* player, WorldPacket& packet, bool& result if (lua_isuserdata(L, r + 1)) if (WorldPacket* data = CHECKOBJ(r + 1, false)) { -#if defined(TRINITY) || defined(VMANGOS) +#if defined TRINITY || defined VMANGOS packet = std::move(*data); #else packet = *data; diff --git a/hooks/PlayerHooks.cpp b/hooks/PlayerHooks.cpp index 26841c8e5e..4abb25c72b 100644 --- a/hooks/PlayerHooks.cpp +++ b/hooks/PlayerHooks.cpp @@ -280,7 +280,7 @@ void Eluna::OnMoneyChanged(Player* pPlayer, int32& amount) CleanUpStack(2); } -#ifdef CATA +#if defined CATA void Eluna::OnMoneyChanged(Player* pPlayer, int64& amount) { START_HOOK(PLAYER_EVENT_ON_MONEY_CHANGE); diff --git a/hooks/ServerHooks.cpp b/hooks/ServerHooks.cpp index e3d88db0f6..133161fe14 100644 --- a/hooks/ServerHooks.cpp +++ b/hooks/ServerHooks.cpp @@ -75,7 +75,7 @@ void Eluna::OnTimedEvent(int funcRef, uint32 delay, uint32 calls, WorldObject* o ExecuteCall(4, 0); ASSERT(!event_level); -#ifndef TRACKABLE_PTR_NAMESPACE +#if !defined TRACKABLE_PTR_NAMESPACE InvalidateObjects(); #endif } @@ -111,14 +111,12 @@ bool Eluna::OnAreaTrigger(Player* pPlayer, AreaTriggerEntry const* pTrigger) { START_HOOK_WITH_RETVAL(TRIGGER_EVENT_ON_TRIGGER, false); HookPush(pPlayer); -#ifdef TRINITY +#if defined TRINITY HookPush(pTrigger->ID); -#elif AZEROTHCORE - HookPush(pTrigger->entry); #else HookPush(pTrigger->id); - #endif + return CallAllFunctionsBool(ServerEventBindings, key); } @@ -135,18 +133,11 @@ void Eluna::OnChange(Weather* /*weather*/, uint32 zone, WeatherState state, floa // Auction House void Eluna::OnAdd(AuctionHouseObject* /*ah*/, AuctionEntry* entry) { -#ifdef AZEROTHCORE - Player* owner = eObjectAccessor()FindPlayer(entry->owner); -#else Player* owner = eObjectAccessor()FindPlayer(MAKE_NEW_GUID(entry->owner, 0, HIGHGUID_PLAYER)); -#endif -#ifdef TRINITY +#if defined TRINITY Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow); uint32 expiretime = entry->expire_time; -#elif AZEROTHCORE - Item* item = eAuctionMgr->GetAItem(entry->item_guid); - uint32 expiretime = entry->expire_time; #else Item* item = eAuctionMgr->GetAItem(entry->itemGuidLow); uint32 expiretime = entry->expireTime; @@ -169,18 +160,11 @@ void Eluna::OnAdd(AuctionHouseObject* /*ah*/, AuctionEntry* entry) void Eluna::OnRemove(AuctionHouseObject* /*ah*/, AuctionEntry* entry) { -#ifdef AZEROTHCORE - Player* owner = eObjectAccessor()FindPlayer(entry->owner); -#else Player* owner = eObjectAccessor()FindPlayer(MAKE_NEW_GUID(entry->owner, 0, HIGHGUID_PLAYER)); -#endif -#ifdef TRINITY +#if defined TRINITY Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow); uint32 expiretime = entry->expire_time; -#elif AZEROTHCORE - Item* item = eAuctionMgr->GetAItem(entry->item_guid); - uint32 expiretime = entry->expire_time; #else Item* item = eAuctionMgr->GetAItem(entry->itemGuidLow); uint32 expiretime = entry->expireTime; @@ -204,24 +188,16 @@ void Eluna::OnRemove(AuctionHouseObject* /*ah*/, AuctionEntry* entry) void Eluna::OnSuccessful(AuctionHouseObject* /*ah*/, AuctionEntry* entry) { -#ifdef AZEROTHCORE - Player* owner = eObjectAccessor()FindPlayer(entry->owner); -#else Player* owner = eObjectAccessor()FindPlayer(MAKE_NEW_GUID(entry->owner, 0, HIGHGUID_PLAYER)); -#endif -#ifdef TRINITY +#if defined TRINITY Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow); uint32 expiretime = entry->expire_time; -#elif AZEROTHCORE - Item* item = eAuctionMgr->GetAItem(entry->item_guid); - uint32 expiretime = entry->expire_time; #else Item* item = eAuctionMgr->GetAItem(entry->itemGuidLow); uint32 expiretime = entry->expireTime; #endif - if (!owner || !item) return; @@ -239,24 +215,16 @@ void Eluna::OnSuccessful(AuctionHouseObject* /*ah*/, AuctionEntry* entry) void Eluna::OnExpire(AuctionHouseObject* /*ah*/, AuctionEntry* entry) { -#ifdef AZEROTHCORE - Player* owner = eObjectAccessor()FindPlayer(entry->owner); -#else Player* owner = eObjectAccessor()FindPlayer(MAKE_NEW_GUID(entry->owner, 0, HIGHGUID_PLAYER)); -#endif -#ifdef TRINITY +#if defined TRINITY Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow); uint32 expiretime = entry->expire_time; -#elif AZEROTHCORE - Item* item = eAuctionMgr->GetAItem(entry->item_guid); - uint32 expiretime = entry->expire_time; #else Item* item = eAuctionMgr->GetAItem(entry->itemGuidLow); uint32 expiretime = entry->expireTime; #endif - if (!owner || !item) return; @@ -279,17 +247,10 @@ void Eluna::OnOpenStateChange(bool open) CallAllFunctions(ServerEventBindings, key); } -#ifndef AZEROTHCORE void Eluna::OnConfigLoad(bool reload) -#else -void Eluna::OnConfigLoad(bool reload, bool isBefore) -#endif { START_HOOK(WORLD_EVENT_ON_CONFIG_LOAD); HookPush(reload); -#ifdef AZEROTHCORE - HookPush(isBefore); -#endif CallAllFunctions(ServerEventBindings, key); } diff --git a/hooks/VehicleHooks.cpp b/hooks/VehicleHooks.cpp index 2d05665655..f19ede836b 100644 --- a/hooks/VehicleHooks.cpp +++ b/hooks/VehicleHooks.cpp @@ -10,8 +10,7 @@ #include "BindingMap.h" #include "ElunaTemplate.h" -#ifndef CLASSIC -#ifndef TBC +#if !defined(CLASSIC) && !defined(TBC) using namespace Hooks; @@ -59,5 +58,4 @@ void Eluna::OnRemovePassenger(Vehicle* vehicle, Unit* passenger) CallAllFunctions(VehicleEventBindings, key); } -#endif // CLASSIC -#endif // TBC +#endif // !CLASSIC && !TBC diff --git a/methods/TrinityCore/BattleGroundMethods.h b/methods/TrinityCore/BattleGroundMethods.h index f386f47148..830a33b17a 100644 --- a/methods/TrinityCore/BattleGroundMethods.h +++ b/methods/TrinityCore/BattleGroundMethods.h @@ -82,11 +82,7 @@ namespace LuaBattleGround */ int GetEndTime(Eluna* E, BattleGround* bg) { -#ifdef CATA - E->Push(bg->GetRemainingTime()); -#else E->Push(bg->GetEndTime()); -#endif return 1; } diff --git a/methods/TrinityCore/CreatureMethods.h b/methods/TrinityCore/CreatureMethods.h index 4162d7cf9e..e25c1328f3 100644 --- a/methods/TrinityCore/CreatureMethods.h +++ b/methods/TrinityCore/CreatureMethods.h @@ -22,11 +22,7 @@ namespace LuaCreature */ int IsRegeneratingHealth(Eluna* E, Creature* creature) { -#ifdef CATA - E->Push(creature->isRegeneratingHealth()); -#else E->Push(creature->CanRegenerateHealth()); -#endif return 1; } @@ -904,7 +900,6 @@ namespace LuaCreature return 1; } -#ifndef CATA /** * Returns the [Creature]'s shield block value. * @@ -915,7 +910,6 @@ namespace LuaCreature E->Push(creature->GetShieldBlockValue()); return 1; } -#endif /** * Returns the loot mode for the [Creature]. @@ -1440,9 +1434,7 @@ namespace LuaCreature { "GetNPCFlags", &LuaCreature::GetNPCFlags }, { "GetExtraFlags", &LuaCreature::GetExtraFlags }, { "GetRank", &LuaCreature::GetRank }, -#ifndef CATA { "GetShieldBlockValue", &LuaCreature::GetShieldBlockValue }, -#endif { "GetDBTableGUIDLow", &LuaCreature::GetDBTableGUIDLow }, { "GetCreatureFamily", &LuaCreature::GetCreatureFamily }, { "GetThreat", &LuaCreature::GetThreat }, @@ -1519,10 +1511,6 @@ namespace LuaCreature { "ClearFixate", &LuaCreature::ClearFixate }, { "RemoveFromWorld", &LuaCreature::RemoveFromWorld }, -#ifdef CATA //Not implemented in TCPP - { "GetShieldBlockValue", nullptr }, -#endif - { NULL, NULL, METHOD_REG_NONE } }; }; diff --git a/methods/TrinityCore/GameObjectMethods.h b/methods/TrinityCore/GameObjectMethods.h index 3e53ee767c..1838abf8e9 100644 --- a/methods/TrinityCore/GameObjectMethods.h +++ b/methods/TrinityCore/GameObjectMethods.h @@ -184,13 +184,7 @@ namespace LuaGameObject else if (state == 1) go->SetGoState(GO_STATE_READY); else if (state == 2) - { -#ifndef CATA go->SetGoState(GO_STATE_DESTROYED); -#else - go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); -#endif - } return 0; } diff --git a/methods/TrinityCore/GlobalMethods.h b/methods/TrinityCore/GlobalMethods.h index ae89a50629..528a5145d2 100644 --- a/methods/TrinityCore/GlobalMethods.h +++ b/methods/TrinityCore/GlobalMethods.h @@ -78,11 +78,7 @@ namespace LuaGlobalFunctions */ int GetCoreExpansion(Eluna* E) { -#ifdef WOTLK E->Push(2); -#elif CATA - E->Push(3); -#endif return 1; } @@ -457,20 +453,12 @@ namespace LuaGlobalFunctions if (!temp) return luaL_argerror(E->L, 1, "valid ItemEntry expected"); -#ifdef CATA - std::string name = temp->ExtendedData->Display->Str[locale]; -#else std::string name = temp->Name1; -#endif if (ItemLocale const* il = eObjectMgr->GetItemLocale(entry)) ObjectMgr::GetLocaleString(il->Name, static_cast(locale), name); std::ostringstream oss; -#ifdef CATA - oss << "|c" << std::hex << ItemQualityColors[temp->ExtendedData->Quality] << std::dec << -#else oss << "|c" << std::hex << ItemQualityColors[temp->Quality] << std::dec << -#endif "|Hitem:" << entry << ":0:" << "0:0:0:0:" << "0:0:0:0|h[" << name << "]|h|r"; @@ -1304,11 +1292,7 @@ namespace LuaGlobalFunctions { const char* command = E->CHECKVAL(1); // ignores output of the command -#ifdef CATA - eWorld->QueueCliCommand(new CliCommandHolder(nullptr, command, nullptr, [](void*, bool) {})); -#else eWorld->QueueCliCommand(new CliCommandHolder(nullptr, command, [](void*, std::string_view) {}, [](void*, bool) {})); -#endif return 0; } @@ -1748,22 +1732,14 @@ namespace LuaGlobalFunctions if (save) { Creature* creature = new Creature(); -#ifdef CATA - if (!creature->Create(map->GenerateLowGuid(), map, entry, pos)) -#else if (!creature->Create(map->GenerateLowGuid(), map, phase, entry, pos)) -#endif { delete creature; E->Push(); return 1; } -#ifdef CATA - creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode())); -#else creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), phase); -#endif uint32 db_guid = creature->GetSpawnId(); @@ -1785,13 +1761,7 @@ namespace LuaGlobalFunctions } else { -#ifdef CATA - SummonCreatureExtraArgs extraArgs; - extraArgs.SummonDuration = durorresptime; - TempSummon* creature = map->SummonCreature(entry, pos, extraArgs); -#else TempSummon* creature = map->SummonCreature(entry, pos, NULL, durorresptime); -#endif if (!creature) { E->Push(); @@ -1827,11 +1797,8 @@ namespace LuaGlobalFunctions GameObject* object = new GameObject; uint32 guidLow = map->GenerateLowGuid(); QuaternionData rot = QuaternionData::fromEulerAnglesZYX(o, 0.f, 0.f); -#ifdef CATA - if (!object->Create(guidLow, objectInfo->entry, map, Position(x, y, z, o), rot, 0, GO_STATE_READY)) -#else + if (!object->Create(guidLow, objectInfo->entry, map, phase, Position(x, y, z, o), rot, 0, GO_STATE_READY)) -#endif { delete object; E->Push(); @@ -1844,11 +1811,7 @@ namespace LuaGlobalFunctions if (save) { // fill the gameobject data and save to the db -#ifdef CATA - object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode())); -#else object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), phase); -#endif guidLow = object->GetSpawnId(); // delete the old object and do a clean load from DB with a fresh new GameObject instance. @@ -1910,22 +1873,11 @@ namespace LuaGlobalFunctions uint32 incrtime = E->CHECKVAL(4); uint32 extendedcost = E->CHECKVAL(5); -#ifdef CATA - VendorItem vItem; - vItem.item = item; - vItem.maxcount = maxcount; - vItem.incrtime = incrtime; - vItem.ExtendedCost = extendedcost; - - if (!eObjectMgr->IsVendorItemValid(entry, vItem)) - return 0; - eObjectMgr->AddVendorItem(entry, vItem); -#else if (!eObjectMgr->IsVendorItemValid(entry, item, maxcount, incrtime, extendedcost)) return 0; eObjectMgr->AddVendorItem(entry, item, maxcount, incrtime, extendedcost); -#endif + return 0; } @@ -1942,11 +1894,7 @@ namespace LuaGlobalFunctions if (!eObjectMgr->GetCreatureTemplate(entry)) return luaL_argerror(E->L, 1, "valid CreatureEntry expected"); -#ifdef CATA - eObjectMgr->RemoveVendorItem(entry, item, 1); -#else eObjectMgr->RemoveVendorItem(entry, item); -#endif return 0; } @@ -1966,12 +1914,8 @@ namespace LuaGlobalFunctions auto const itemlist = items->m_items; for (auto itr = itemlist.begin(); itr != itemlist.end(); ++itr) -#ifdef CATA - eObjectMgr->RemoveVendorItem(entry, itr->item, 1); -#else eObjectMgr->RemoveVendorItem(entry, itr->item); -#endif return 0; } @@ -1984,11 +1928,7 @@ namespace LuaGlobalFunctions { Player* player = E->CHECKOBJ(1); -#ifndef CATA player->GetSession()->KickPlayer("GlobalMethods::Kick Kick the player"); -#else - player->GetSession()->KickPlayer(); -#endif return 0; } @@ -2136,11 +2076,8 @@ namespace LuaGlobalFunctions luaL_error(E->L, "Item entry %d does not exist", entry); continue; } -#ifdef CATA - if (amount < 1 || (item_proto->ExtendedData->MaxCount > 0 && amount > uint32(item_proto->ExtendedData->MaxCount))) -#else + if (amount < 1 || (item_proto->MaxCount > 0 && amount > uint32(item_proto->MaxCount))) -#endif { luaL_error(E->L, "Item entry %d has invalid amount %d", entry, amount); continue; diff --git a/methods/TrinityCore/GroupMethods.h b/methods/TrinityCore/GroupMethods.h index 25c87af4bc..1bd46773a0 100644 --- a/methods/TrinityCore/GroupMethods.h +++ b/methods/TrinityCore/GroupMethods.h @@ -256,7 +256,6 @@ namespace LuaGroup return 1; } -#ifndef CATA /** * Returns the [Group] members' flags * @@ -278,7 +277,6 @@ namespace LuaGroup E->Push(group->GetMemberFlags(guid)); return 1; } -#endif /** * Sets the leader of this [Group] @@ -424,7 +422,6 @@ namespace LuaGroup return 0; } -#ifndef CATA /** * Sets or removes a flag for a [Group] member * @@ -452,7 +449,6 @@ namespace LuaGroup group->SetGroupMemberFlag(target, apply, flag); return 0; } -#endif ElunaRegister GroupMethods[] = { @@ -463,17 +459,13 @@ namespace LuaGroup { "GetMemberGroup", &LuaGroup::GetMemberGroup }, { "GetMemberGUID", &LuaGroup::GetMemberGUID }, { "GetMembersCount", &LuaGroup::GetMembersCount }, -#ifndef CATA { "GetMemberFlags", &LuaGroup::GetMemberFlags }, -#endif // Setters { "SetLeader", &LuaGroup::SetLeader, METHOD_REG_WORLD }, // World state method only in multistate { "SetMembersGroup", &LuaGroup::SetMembersGroup, METHOD_REG_WORLD }, // World state method only in multistate { "SetTargetIcon", &LuaGroup::SetTargetIcon, METHOD_REG_WORLD }, // World state method only in multistate -#ifndef CATA { "SetMemberFlag", &LuaGroup::SetMemberFlag, METHOD_REG_WORLD }, // World state method only in multistate -#endif // Boolean { "IsLeader", &LuaGroup::IsLeader }, @@ -495,11 +487,6 @@ namespace LuaGroup { "ConvertToLFG", &LuaGroup::ConvertToLFG, METHOD_REG_WORLD }, // World state method only in multistate { "ConvertToRaid", &LuaGroup::ConvertToRaid, METHOD_REG_WORLD }, // World state method only in multistate -#ifdef CATA //Not implemented in TCPP - { "GetMemberFlags", nullptr, METHOD_REG_NONE }, - { "SetMemberFlag", nullptr, METHOD_REG_NONE }, -#endif - { NULL, NULL, METHOD_REG_NONE } }; }; diff --git a/methods/TrinityCore/GuildMethods.h b/methods/TrinityCore/GuildMethods.h index fcd941593f..4cc6acc63b 100644 --- a/methods/TrinityCore/GuildMethods.h +++ b/methods/TrinityCore/GuildMethods.h @@ -124,7 +124,6 @@ namespace LuaGuild return 1; } -#ifndef CATA /** * Sets the leader of this [Guild] * @@ -139,7 +138,6 @@ namespace LuaGuild guild->HandleSetLeader(player->GetSession(), player->GetName()); return 0; } -#endif /** * Sets the information of the bank tab specified @@ -274,9 +272,7 @@ namespace LuaGuild // Setters { "SetBankTabText", &LuaGuild::SetBankTabText, METHOD_REG_WORLD }, // World state method only in multistate { "SetMemberRank", &LuaGuild::SetMemberRank, METHOD_REG_WORLD }, // World state method only in multistate -#ifndef CATA { "SetLeader", &LuaGuild::SetLeader, METHOD_REG_WORLD }, // World state method only in multistate -#endif // Other { "SendPacket", &LuaGuild::SendPacket }, @@ -285,10 +281,6 @@ namespace LuaGuild { "AddMember", &LuaGuild::AddMember, METHOD_REG_WORLD }, // World state method only in multistate { "DeleteMember", &LuaGuild::DeleteMember, METHOD_REG_WORLD }, // World state method only in multistate -#ifdef CATA //Not implemented in TCPP - { "SetLeader", nullptr, METHOD_REG_NONE }, -#endif - { NULL, NULL, METHOD_REG_NONE } }; }; diff --git a/methods/TrinityCore/ItemMethods.h b/methods/TrinityCore/ItemMethods.h index 60ababc544..fdd8f0a162 100644 --- a/methods/TrinityCore/ItemMethods.h +++ b/methods/TrinityCore/ItemMethods.h @@ -185,7 +185,6 @@ namespace LuaItem return 1; } -#if defined(WOTLK) /** * Returns 'true' if the [Item] is a weapon vellum, 'false' otherwise * @@ -207,7 +206,6 @@ namespace LuaItem E->Push(item->IsArmorVellum()); return 1; } -#endif /** * Returns 'true' if the [Item] is a conjured consumable, 'false' otherwise @@ -220,7 +218,6 @@ namespace LuaItem return 1; } -#ifndef CATA /** * Returns 'true' if the refund period has expired for this [Item], 'false' otherwise * @@ -231,7 +228,6 @@ namespace LuaItem E->Push(item->IsRefundExpired()); return 1; } -#endif /** * Returns the chat link of the [Item] @@ -261,22 +257,14 @@ namespace LuaItem return luaL_argerror(E->L, 2, "valid LocaleConstant expected"); const ItemTemplate* temp = item->GetTemplate(); -#ifdef CATA - std::string name = temp->ExtendedData->Display1->Str[locale]; - if (ItemLocale const* il = eObjectMgr->GetItemLocale(temp->BasicData->ID)) -#else + std::string name = temp->Name1; if (ItemLocale const* il = eObjectMgr->GetItemLocale(temp->ItemId)) -#endif ObjectMgr::GetLocaleString(il->Name, static_cast(locale), name); if (int32 itemRandPropId = item->GetItemRandomPropertyId()) { -#ifndef CATA std::array const* suffix = NULL; -#else - char* const* suffix = NULL; -#endif if (itemRandPropId < 0) { const ItemRandomSuffixEntry* itemRandEntry = sItemRandomSuffixStore.LookupEntry(-item->GetItemRandomPropertyId()); @@ -292,22 +280,13 @@ namespace LuaItem if (suffix) { name += ' '; -#ifndef CATA name += (*suffix)[(name != temp->Name1) ? locale : uint8(DEFAULT_LOCALE)]; -#else - name += (*suffix)[(name != temp->ExtendedData->Display->Str[locale]) ? locale : uint8(DEFAULT_LOCALE)]; -#endif } } std::ostringstream oss; -#ifdef CATA - oss << "|c" << std::hex << ItemQualityColors[temp->ExtendedData->Quality] << std::dec << - "|Hitem:" << temp->BasicData->ID << ":" << -#else oss << "|c" << std::hex << ItemQualityColors[temp->Quality] << std::dec << "|Hitem:" << temp->ItemId << ":" << -#endif item->GetEnchantmentId(PERM_ENCHANTMENT_SLOT) << ":" << item->GetEnchantmentId(SOCK_ENCHANTMENT_SLOT) << ":" << item->GetEnchantmentId(SOCK_ENCHANTMENT_SLOT_2) << ":" << @@ -415,11 +394,7 @@ namespace LuaItem if (index >= MAX_ITEM_PROTO_SPELLS) return luaL_argerror(E->L, 2, "valid SpellIndex expected"); -#ifdef CATA - E->Push(item->GetTemplate()->ExtendedData->SpellID[index]); -#else E->Push(item->GetTemplate()->Spells[index].SpellId); -#endif return 1; } @@ -435,11 +410,7 @@ namespace LuaItem if (index >= MAX_ITEM_PROTO_SPELLS) return luaL_argerror(E->L, 2, "valid SpellIndex expected"); -#ifdef CATA - E->Push(item->GetTemplate()->ExtendedData->SpellTrigger[index]); -#else E->Push(item->GetTemplate()->Spells[index].SpellTrigger); -#endif return 1; } @@ -450,11 +421,7 @@ namespace LuaItem */ int GetClass(Eluna* E, Item* item) { -#ifdef CATA - E->Push(item->GetTemplate()->GetClass()); -#else E->Push(item->GetTemplate()->Class); -#endif return 1; } @@ -465,11 +432,7 @@ namespace LuaItem */ int GetSubClass(Eluna* E, Item* item) { -#ifdef CATA - E->Push(item->GetTemplate()->GetSubClass()); -#else E->Push(item->GetTemplate()->SubClass); -#endif return 1; } @@ -491,11 +454,7 @@ namespace LuaItem */ int GetName(Eluna* E, Item* item) { -#ifdef CATA - E->Push(item->GetTemplate()->GetDefaultLocaleName()); -#else E->Push(item->GetTemplate()->Name1); -#endif return 1; } @@ -506,11 +465,7 @@ namespace LuaItem */ int GetDisplayId(Eluna* E, Item* item) { -#ifdef CATA - E->Push(item->GetTemplate()->GetDisplayID()); -#else E->Push(item->GetTemplate()->DisplayInfoID); -#endif return 1; } @@ -521,11 +476,7 @@ namespace LuaItem */ int GetQuality(Eluna* E, Item* item) { -#ifdef CATA - E->Push(item->GetTemplate()->GetQuality()); -#else E->Push(item->GetTemplate()->Quality); -#endif return 1; } @@ -569,11 +520,7 @@ namespace LuaItem */ int GetBuyCount(Eluna* E, Item* item) { -#ifdef CATA - E->Push(item->GetTemplate()->GetBuyCount()); -#else E->Push(item->GetTemplate()->BuyCount); -#endif return 1; } @@ -584,11 +531,7 @@ namespace LuaItem */ int GetBuyPrice(Eluna* E, Item* item) { -#ifdef CATA - E->Push(item->GetTemplate()->GetBuyPrice()); -#else E->Push(item->GetTemplate()->BuyPrice); -#endif return 1; } @@ -599,11 +542,7 @@ namespace LuaItem */ int GetSellPrice(Eluna* E, Item* item) { -#ifdef CATA - E->Push(item->GetTemplate()->GetSellPrice()); -#else E->Push(item->GetTemplate()->SellPrice); -#endif return 1; } @@ -614,11 +553,7 @@ namespace LuaItem */ int GetInventoryType(Eluna* E, Item* item) { -#ifdef CATA - E->Push(item->GetTemplate()->GetInventoryType()); -#else E->Push(item->GetTemplate()->InventoryType); -#endif return 1; } @@ -629,11 +564,7 @@ namespace LuaItem */ int GetAllowableClass(Eluna* E, Item* item) { -#ifdef CATA - E->Push(item->GetTemplate()->GetAllowableClass()); -#else E->Push(item->GetTemplate()->AllowableClass); -#endif return 1; } @@ -644,11 +575,7 @@ namespace LuaItem */ int GetAllowableRace(Eluna* E, Item* item) { -#ifdef CATA - E->Push(item->GetTemplate()->GetAllowableRace()); -#else E->Push(item->GetTemplate()->AllowableRace); -#endif return 1; } @@ -659,11 +586,7 @@ namespace LuaItem */ int GetItemLevel(Eluna* E, Item* item) { -#ifdef CATA - E->Push(item->GetTemplate()->GetBaseItemLevel()); -#else E->Push(item->GetTemplate()->ItemLevel); -#endif return 1; } @@ -674,15 +597,10 @@ namespace LuaItem */ int GetRequiredLevel(Eluna* E, Item* item) { -#ifdef CATA - E->Push(item->GetTemplate()->GetRequiredLevel()); -#else E->Push(item->GetTemplate()->RequiredLevel); -#endif return 1; } -#ifdef WOTLK /** * Returns the amount of stat values on this [Item] * @@ -693,7 +611,6 @@ namespace LuaItem E->Push(item->GetTemplate()->StatsCount); return 1; } -#endif /** * Returns the random property ID of this [Item] @@ -702,11 +619,7 @@ namespace LuaItem */ int GetRandomProperty(Eluna* E, Item* item) { -#ifdef CATA - E->Push(item->GetTemplate()->GetRandomProperty()); -#else E->Push(item->GetTemplate()->RandomProperty); -#endif return 1; } @@ -717,11 +630,7 @@ namespace LuaItem */ int GetRandomSuffix(Eluna* E, Item* item) { -#ifdef CATA - E->Push(item->GetTemplate()->GetRandomSuffix()); -#else E->Push(item->GetTemplate()->RandomSuffix); -#endif return 1; } @@ -732,11 +641,7 @@ namespace LuaItem */ int GetItemSet(Eluna* E, Item* item) { -#ifdef CATA - E->Push(item->GetTemplate()->GetItemSet()); -#else E->Push(item->GetTemplate()->ItemSet); -#endif return 1; } @@ -900,9 +805,7 @@ namespace LuaItem { "GetAllowableRace", &LuaItem::GetAllowableRace }, { "GetItemLevel", &LuaItem::GetItemLevel }, { "GetRequiredLevel", &LuaItem::GetRequiredLevel }, -#ifndef CATA { "GetStatsCount", &LuaItem::GetStatsCount }, -#endif { "GetRandomProperty", &LuaItem::GetRandomProperty }, { "GetRandomSuffix", &LuaItem::GetRandomSuffix }, { "GetItemSet", &LuaItem::GetItemSet }, @@ -929,11 +832,9 @@ namespace LuaItem { "IsEquipped", &LuaItem::IsEquipped }, { "HasQuest", &LuaItem::HasQuest }, { "IsPotion", &LuaItem::IsPotion }, -#ifndef CATA { "IsWeaponVellum", &LuaItem::IsWeaponVellum }, { "IsArmorVellum", &LuaItem::IsArmorVellum }, { "IsRefundExpired", &LuaItem::IsRefundExpired }, -#endif { "IsConjuredConsumable", &LuaItem::IsConjuredConsumable }, { "SetEnchantment", &LuaItem::SetEnchantment }, { "ClearEnchantment", &LuaItem::ClearEnchantment }, @@ -941,13 +842,6 @@ namespace LuaItem // Other { "SaveToDB", &LuaItem::SaveToDB }, -#ifdef CATA //Not implemented in TCPP - { "GetStatsCount", nullptr, METHOD_REG_NONE }, - { "IsWeaponVellum", nullptr, METHOD_REG_NONE }, - { "IsArmorVellum", nullptr, METHOD_REG_NONE }, - { "IsRefundExpired", nullptr, METHOD_REG_NONE }, -#endif - { NULL, NULL, METHOD_REG_NONE } }; }; diff --git a/methods/TrinityCore/MapMethods.h b/methods/TrinityCore/MapMethods.h index 7032e844d6..50601014f4 100644 --- a/methods/TrinityCore/MapMethods.h +++ b/methods/TrinityCore/MapMethods.h @@ -108,14 +108,9 @@ namespace LuaMap { float x = E->CHECKVAL(2); float y = E->CHECKVAL(3); -#ifdef CATA - PhaseShift phase; - float z = map->GetHeight(phase, x, y, MAX_HEIGHT); -#else uint32 phasemask = E->CHECKVAL(4, 1); float z = map->GetHeight(phasemask, x, y, MAX_HEIGHT); -#endif if (z != INVALID_HEIGHT) E->Push(z); return 1; @@ -181,14 +176,9 @@ namespace LuaMap float x = E->CHECKVAL(2); float y = E->CHECKVAL(3); float z = E->CHECKVAL(4); -#ifdef CATA - PhaseShift phase; - E->Push(map->GetAreaId(phase, x, y, z)); -#else float phasemask = E->CHECKVAL(5, PHASEMASK_NORMAL); E->Push(map->GetAreaId(phasemask, x, y, z)); -#endif return 1; } diff --git a/methods/TrinityCore/PlayerMethods.h b/methods/TrinityCore/PlayerMethods.h index 7efd583bc2..120314e65b 100644 --- a/methods/TrinityCore/PlayerMethods.h +++ b/methods/TrinityCore/PlayerMethods.h @@ -239,11 +239,7 @@ namespace LuaPlayer */ int CanSpeak(Eluna* E, Player* player) { -#ifndef CATA E->Push(player->GetSession()->CanSpeak()); -#else - E->Push(player->CanSpeak()); -#endif return 1; } @@ -378,7 +374,6 @@ namespace LuaPlayer return 1; } -#ifndef CATA /** * Returns 'true' if the [Player] satisfies all requirements to complete the repeatable quest entry. * @@ -416,7 +411,6 @@ namespace LuaPlayer return 1; } -#endif /** * Returns 'true' if the [Player] is a part of the Horde faction, 'false' otherwise. @@ -668,12 +662,7 @@ namespace LuaPlayer int IsNeverVisible(Eluna* E, Player* player) { - // Possibly add a bool var here -#ifdef CATA - E->Push(player->IsNeverVisible()); -#else E->Push(player->IsNeverVisible(true)); -#endif return 1; } @@ -720,7 +709,6 @@ namespace LuaPlayer return 1; } -#ifndef CATA /** * Returns the normal phase of the player instead of the actual phase possibly containing GM phase * @@ -764,7 +752,6 @@ namespace LuaPlayer E->Push(player->GetShieldBlockValue()); return 1; } -#endif /** * Returns the [Player]s cooldown delay by specified [Spell] ID @@ -1066,11 +1053,7 @@ namespace LuaPlayer */ int GetGuildRank(Eluna* E, Player* player) // TODO: Move to Guild Methods { -#ifdef CATA - E->Push(player->GetGuildRank()); -#else E->Push(player->GetRank()); -#endif return 1; } @@ -1553,7 +1536,6 @@ namespace LuaPlayer return 1; } -#ifndef CATA /** * Returns the amount of mails in the [Player]s mailbox * @@ -1586,7 +1568,6 @@ namespace LuaPlayer E->Push(player->GetXPForNextLevel()); return 1; } -#endif /** * Locks the player controls and disallows all movement and casting. @@ -1695,11 +1676,7 @@ namespace LuaPlayer if (!player->GetGuildId()) return 0; -#ifdef CATA - player->SetGuildRank(rank); -#else player->SetRank(rank); -#endif return 0; } @@ -1872,7 +1849,6 @@ namespace LuaPlayer return 0; } -#ifndef CATA /** * Sets the [Player]s Arena Points to the amount specified * @@ -1896,7 +1872,6 @@ namespace LuaPlayer player->SetHonorPoints(honorP); return 0; } -#endif /** * Sets the [Player]s amount of Lifetime Honorable Kills to the value specified @@ -1986,20 +1961,12 @@ namespace LuaPlayer bool apply = E->CHECKVAL(2, true); if(apply) -#ifdef CATA - player->SetByteFlag(UNIT_FIELD_BYTES_2, UNIT_BYTES_2_OFFSET_PVP_FLAG, UNIT_BYTE2_FLAG_FFA_PVP); - else - player->RemoveByteFlag(UNIT_FIELD_BYTES_2, UNIT_BYTES_2_OFFSET_PVP_FLAG, UNIT_BYTE2_FLAG_FFA_PVP); -#else player->SetPvpFlag(UNIT_BYTE2_FLAG_FFA_PVP); else player->RemovePvpFlag(UNIT_BYTE2_FLAG_FFA_PVP); -#endif return 0; } - -#ifndef CATA int SetMovement(Eluna* E, Player* player) { int32 pType = E->CHECKVAL(2); @@ -2007,7 +1974,6 @@ namespace LuaPlayer player->SetMovement((PlayerMovementType)pType); return 0; } -#endif /** * Resets the [Player]s pets talent points @@ -2041,7 +2007,6 @@ namespace LuaPlayer return 0; } -#ifndef CATA /** * Adds or detracts from the [Player]s current Arena Points * @@ -2067,7 +2032,6 @@ namespace LuaPlayer player->ModifyHonorPoints(amount); return 0; } -#endif /** * Saves the [Player] to the database @@ -2099,17 +2063,10 @@ namespace LuaPlayer int Mute(Eluna* E, Player* player) { uint32 muteseconds = E->CHECKVAL(2); - /*const char* reason = luaL_checkstring(E, 2);*/ // Mangos does not have a reason field in database. time_t muteTime = time(NULL) + muteseconds; player->GetSession()->m_muteTime = muteTime; -#ifdef WOTLK LoginDatabase.PExecute("UPDATE account SET mutetime = {} WHERE id = {}", muteTime, player->GetSession()->GetAccountId()); -#else - std::ostringstream oss; - oss << "UPDATE account SET mutetime = " << muteTime << " WHERE id = " << player->GetSession()->GetAccountId(); - LoginDatabase.PExecute("%s", oss.str().c_str()); -#endif return 0; } @@ -2215,11 +2172,7 @@ namespace LuaPlayer { Creature* obj = E->CHECKOBJ(2); -#ifdef CATA - player->GetSession()->SendTrainerList(obj, NULL); -#else player->GetSession()->SendTrainerList(obj); -#endif return 0; } @@ -2464,11 +2417,7 @@ namespace LuaPlayer */ int ResetTalentsCost(Eluna* E, Player* player) { -#ifdef CATA - E->Push(player->GetNextResetTalentsCost()); -#else E->Push(player->ResetTalentsCost()); -#endif return 1; } @@ -2715,23 +2664,15 @@ namespace LuaPlayer return 0; // check item starting quest (it can work incorrectly if added without item in inventory) -#ifndef CATA ItemTemplateContainer const& itc = sObjectMgr->GetItemTemplateStore(); auto itr = std::find_if(std::begin(itc), std::end(itc), [quest](ItemTemplateContainer::value_type const& value) - { - return value.second.StartQuest == quest->GetQuestId(); - }); + { + return value.second.StartQuest == quest->GetQuestId(); + }); if (itr != std::end(itc)) return 0; -#elif CATA - ItemTemplateContainer const* itc = sObjectMgr->GetItemTemplateStore(); - ItemTemplateContainer::const_iterator result = std::find_if(itc->begin(), itc->end(), [quest](ItemTemplateContainer::value_type const& value) - { - return value.second.ExtendedData->StartQuest == quest->GetQuestId(); - }); -#endif // ok, normal (creature/GO starting) quest if (player->CanAddQuest(quest, true)) player->AddQuestAndCheckCompletion(quest, NULL); @@ -3009,7 +2950,6 @@ namespace LuaPlayer return 0; } -#ifndef CATA /** * Advances all of the [Player]s weapon skills to the maximum amount available */ @@ -3018,7 +2958,6 @@ namespace LuaPlayer player->UpdateWeaponsSkillsToMaxSkillsForLevel(); return 0; } -#endif /** * Advances all of the [Player]s skills to the amount specified @@ -3082,21 +3021,11 @@ namespace LuaPlayer float z = E->CHECKVAL(5); float o = E->CHECKVAL(6); -#ifdef CATA - if (player->IsInFlight()) - { - player->GetMotionMaster()->MovementExpired(); - player->m_taxi.ClearTaxiDestinations(); - } - else - player->SaveRecallPosition(); -#else if (player->IsInFlight()) player->FinishTaxiFlight(); else player->SaveRecallPosition(); -#endif E->Push(player->TeleportTo(mapId, x, y, z, o)); return 1; } @@ -3309,11 +3238,7 @@ namespace LuaPlayer */ int KickPlayer(Eluna* /*E*/, Player* player) { -#ifndef CATA player->GetSession()->KickPlayer("PlayerMethods::KickPlayer Kick the player"); -#else - player->GetSession()->KickPlayer(); -#endif return 0; } @@ -3550,12 +3475,7 @@ namespace LuaPlayer if (!quest) return 0; -#ifdef CATA - player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, player->GET_GUID(), activateAccept, true); -#else player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, player->GET_GUID(), activateAccept); - -#endif return 0; } @@ -3801,10 +3721,8 @@ namespace LuaPlayer { "GetGuild", &LuaPlayer::GetGuild }, { "GetAccountId", &LuaPlayer::GetAccountId }, { "GetAccountName", &LuaPlayer::GetAccountName }, -#ifndef CATA { "GetArenaPoints", &LuaPlayer::GetArenaPoints }, { "GetHonorPoints", &LuaPlayer::GetHonorPoints }, -#endif { "GetLifetimeKills", &LuaPlayer::GetLifetimeKills }, { "GetPlayerIP", &LuaPlayer::GetPlayerIP }, { "GetLevelPlayedTime", &LuaPlayer::GetLevelPlayedTime }, @@ -3818,9 +3736,7 @@ namespace LuaPlayer { "GetQuestLevel", &LuaPlayer::GetQuestLevel }, { "GetChatTag", &LuaPlayer::GetChatTag }, { "GetRestBonus", &LuaPlayer::GetRestBonus }, -#ifndef CATA { "GetPhaseMaskForSpawn", &LuaPlayer::GetPhaseMaskForSpawn }, -#endif { "GetReqKillOrCastCurrentCount", &LuaPlayer::GetReqKillOrCastCurrentCount }, { "GetQuestStatus", &LuaPlayer::GetQuestStatus }, { "GetInGameTime", &LuaPlayer::GetInGameTime }, @@ -3860,17 +3776,13 @@ namespace LuaPlayer { "GetCorpse", &LuaPlayer::GetCorpse }, { "GetGossipTextId", &LuaPlayer::GetGossipTextId }, { "GetQuestRewardStatus", &LuaPlayer::GetQuestRewardStatus }, -#ifndef CATA { "GetShieldBlockValue", &LuaPlayer::GetShieldBlockValue }, { "GetMailCount", &LuaPlayer::GetMailCount }, { "GetXP", &LuaPlayer::GetXP }, { "GetXPForNextLevel", &LuaPlayer::GetXPForNextLevel }, -#endif // Setters -#ifndef CATA { "AdvanceSkillsToMax", &LuaPlayer::AdvanceSkillsToMax }, -#endif { "AdvanceSkill", &LuaPlayer::AdvanceSkill }, { "AdvanceAllSkills", &LuaPlayer::AdvanceAllSkills }, { "AddLifetimeKills", &LuaPlayer::AddLifetimeKills }, @@ -3878,10 +3790,8 @@ namespace LuaPlayer { "SetKnownTitle", &LuaPlayer::SetKnownTitle }, { "UnsetKnownTitle", &LuaPlayer::UnsetKnownTitle }, { "SetBindPoint", &LuaPlayer::SetBindPoint }, -#ifndef CATA { "SetArenaPoints", &LuaPlayer::SetArenaPoints }, { "SetHonorPoints", &LuaPlayer::SetHonorPoints }, -#endif { "SetLifetimeKills", &LuaPlayer::SetLifetimeKills }, { "SetGameMaster", &LuaPlayer::SetGameMaster }, { "SetGMChat", &LuaPlayer::SetGMChat }, @@ -3894,9 +3804,7 @@ namespace LuaPlayer { "SetReputation", &LuaPlayer::SetReputation }, { "SetFreeTalentPoints", &LuaPlayer::SetFreeTalentPoints }, { "SetGuildRank", &LuaPlayer::SetGuildRank }, -#ifndef CATA { "SetMovement", &LuaPlayer::SetMovement }, -#endif { "SetSkill", &LuaPlayer::SetSkill }, { "SetFactionForRace", &LuaPlayer::SetFactionForRace }, { "SetDrunkValue", &LuaPlayer::SetDrunkValue }, @@ -3967,10 +3875,8 @@ namespace LuaPlayer { "CanFly", &LuaPlayer::CanFly }, { "IsMoving", &LuaPlayer::IsMoving }, { "IsFlying", &LuaPlayer::IsFlying }, -#ifndef CATA { "CanCompleteRepeatableQuest", &LuaPlayer::CanCompleteRepeatableQuest }, { "CanRewardQuest", &LuaPlayer::CanRewardQuest }, -#endif // Gossip { "GossipMenuAddItem", &LuaPlayer::GossipMenuAddItem }, @@ -4031,10 +3937,8 @@ namespace LuaPlayer { "DurabilityPointLossForEquipSlot", &LuaPlayer::DurabilityPointLossForEquipSlot }, { "DurabilityRepairAll", &LuaPlayer::DurabilityRepairAll }, { "DurabilityRepair", &LuaPlayer::DurabilityRepair }, -#ifndef CATA { "ModifyHonorPoints", &LuaPlayer::ModifyHonorPoints }, { "ModifyArenaPoints", &LuaPlayer::ModifyArenaPoints }, -#endif { "LeaveBattleground", &LuaPlayer::LeaveBattleground }, { "BindToInstance", &LuaPlayer::BindToInstance }, { "UnbindInstance", &LuaPlayer::UnbindInstance }, @@ -4084,24 +3988,6 @@ namespace LuaPlayer { "ClearHonorInfo", nullptr, METHOD_REG_NONE }, // classic only { "GainSpellComboPoints", nullptr, METHOD_REG_NONE }, // not implemented -#ifdef CATA //Not implmented in TCPP - { "GetArenaPoints", nullptr, METHOD_REG_NONE }, - { "GetHonorPoints", nullptr, METHOD_REG_NONE }, - { "GetPhaseMaskForSpawn", nullptr, METHOD_REG_NONE }, - { "GetShieldBlockValue", nullptr, METHOD_REG_NONE }, - { "GetMailCount", nullptr, METHOD_REG_NONE }, - { "GetXP", nullptr, METHOD_REG_NONE }, - { "GetXPForNextLevel", nullptr, METHOD_REG_NONE }, - { "AdvanceSkillsToMax", nullptr, METHOD_REG_NONE }, - { "SetArenaPoints", nullptr, METHOD_REG_NONE }, - { "SetHonorPoints", nullptr, METHOD_REG_NONE }, - { "SetMovement", nullptr, METHOD_REG_NONE }, - { "CanCompleteRepeatableQuest", nullptr, METHOD_REG_NONE }, - { "CanRewardQuest", nullptr, METHOD_REG_NONE }, - { "ModifyHonorPoints", nullptr, METHOD_REG_NONE }, - { "ModifyArenaPoints", nullptr, METHOD_REG_NONE }, -#endif - { NULL, NULL, METHOD_REG_NONE } }; }; diff --git a/methods/TrinityCore/QuestMethods.h b/methods/TrinityCore/QuestMethods.h index 0e2c24011e..38a05a2991 100644 --- a/methods/TrinityCore/QuestMethods.h +++ b/methods/TrinityCore/QuestMethods.h @@ -165,11 +165,7 @@ namespace LuaQuest */ int GetType(Eluna* E, Quest* quest) { -#ifdef CATA - E->Push(quest->GetQuestType()); -#else E->Push(quest->GetType()); -#endif return 1; } diff --git a/methods/TrinityCore/UnitMethods.h b/methods/TrinityCore/UnitMethods.h index 0165b8eb03..14a54edc0b 100644 --- a/methods/TrinityCore/UnitMethods.h +++ b/methods/TrinityCore/UnitMethods.h @@ -1550,11 +1550,7 @@ namespace LuaUnit int SetNativeDisplayId(Eluna* E, Unit* unit) { uint32 model = E->CHECKVAL(2); -#ifndef CATA unit->SetNativeDisplayId(model); -#else - unit->SetDisplayId(model, true); -#endif return 0; } diff --git a/methods/TrinityCore/VehicleMethods.h b/methods/TrinityCore/VehicleMethods.h index 1fdeb6d29b..cf27fedf9a 100644 --- a/methods/TrinityCore/VehicleMethods.h +++ b/methods/TrinityCore/VehicleMethods.h @@ -72,11 +72,7 @@ namespace LuaVehicle Unit* passenger = E->CHECKOBJ(2); int8 seatId = E->CHECKVAL(3); -#ifndef CATA vehicle->AddPassenger(passenger, seatId); -#else - vehicle->AddVehiclePassenger(passenger, seatId); -#endif return 0; } diff --git a/methods/TrinityCore/WorldObjectMethods.h b/methods/TrinityCore/WorldObjectMethods.h index 497064c742..d7274a73a5 100644 --- a/methods/TrinityCore/WorldObjectMethods.h +++ b/methods/TrinityCore/WorldObjectMethods.h @@ -43,12 +43,7 @@ namespace LuaWorldObject */ int GetPhaseMask(Eluna* E, WorldObject* obj) { -#ifdef CATA - EventMap event; - E->Push(event.GetPhaseMask()); -#else E->Push(obj->GetPhaseMask()); -#endif return 1; } @@ -61,13 +56,9 @@ namespace LuaWorldObject int SetPhaseMask(Eluna* E, WorldObject* obj) { uint32 phaseMask = E->CHECKVAL(2); -#ifdef CATA - EventMap event; - event.SetPhase(phaseMask); -#else bool update = E->CHECKVAL(3, true); + obj->SetPhaseMask(phaseMask, update); -#endif return 0; } @@ -602,7 +593,7 @@ namespace LuaWorldObject int GetAngle(Eluna* E, WorldObject* obj) { WorldObject* target = E->CHECKOBJ(2, false); -#ifndef CATA + if (target) E->Push(obj->GetAbsoluteAngle(target)); else @@ -611,16 +602,6 @@ namespace LuaWorldObject float y = E->CHECKVAL(3); E->Push(obj->GetAbsoluteAngle(x, y)); } -#else - if (target) - E->Push(obj->GetAngle(target)); - else - { - float x = E->CHECKVAL(2); - float y = E->CHECKVAL(3); - E->Push(obj->GetAngle(x, y)); - } -#endif return 1; } @@ -658,14 +639,9 @@ namespace LuaWorldObject float o = E->CHECKVAL(6); uint32 respawnDelay = E->CHECKVAL(7, 30); -#ifndef CATA QuaternionData rot = QuaternionData::fromEulerAnglesZYX(o, 0.f, 0.f); E->Push(obj->SummonGameObject(entry, Position(x, y, z, o), rot, Seconds(respawnDelay))); -#else - QuaternionData rot = QuaternionData::fromEulerAnglesZYX(o, 0.f, 0.f); - E->Push(obj->SummonGameObject(entry, x, y, z, o, rot, respawnDelay)); -#endif return 1; } @@ -736,11 +712,7 @@ namespace LuaWorldObject return luaL_argerror(E->L, 7, "valid SpawnType expected"); } -#ifndef CATA E->Push(obj->SummonCreature(entry, x, y, z, o, type, Milliseconds(despawnTimer))); -#else - E->Push(obj->SummonCreature(entry, x, y, z, o, type, despawnTimer)); -#endif return 1; }