diff --git a/ElunaCompat.cpp b/ElunaCompat.cpp index 91e42e8f84..c7c5a62862 100644 --- a/ElunaCompat.cpp +++ b/ElunaCompat.cpp @@ -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 5942da3235..db6ef2a223 100644 --- a/ElunaCompat.h +++ b/ElunaCompat.h @@ -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 20e21782bb..a1623b5c2b 100644 --- a/ElunaCreatureAI.h +++ b/ElunaCreatureAI.h @@ -8,7 +8,7 @@ #define _ELUNA_CREATURE_AI_H #include "LuaEngine.h" -#ifdef CMANGOS +#if defined CMANGOS #include "AI/BaseAI/CreatureAI.h" #endif @@ -32,7 +32,7 @@ struct ElunaCreatureAI : NativeScriptedAI bool justSpawned; // used to delay movementinform hook (WP hook) std::vector< std::pair > movepoints; -#ifndef TRINITY +#if !defined TRINITY #define me m_creature #endif ElunaCreatureAI(Creature* creature) : NativeScriptedAI(creature), justSpawned(true) @@ -41,13 +41,13 @@ struct ElunaCreatureAI : NativeScriptedAI ~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; @@ -67,7 +67,7 @@ struct ElunaCreatureAI : NativeScriptedAI if (!me->GetEluna()->UpdateAI(me, diff)) { -#ifdef MANGOS +#if defined MANGOS if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)) #else if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)) @@ -76,7 +76,7 @@ struct ElunaCreatureAI : NativeScriptedAI } } -#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 @@ -154,7 +154,7 @@ struct ElunaCreatureAI : NativeScriptedAI NativeScriptedAI::AttackStart(target); } -#ifdef TRINITY +#if defined TRINITY // Called for reaction at stopping attack at no attackers or targets void EnterEvadeMode(EvadeReason /*why*/) override #else @@ -165,7 +165,7 @@ struct ElunaCreatureAI : NativeScriptedAI NativeScriptedAI::EnterEvadeMode(); } -#ifdef TRINITY +#if defined TRINITY // Called when creature appears in the world (spawn, respawn, grid load etc...) void JustAppeared() override { @@ -202,7 +202,7 @@ struct ElunaCreatureAI : NativeScriptedAI NativeScriptedAI::CorpseRemoved(respawnDelay); } -#if !defined(TRINITY) && !defined(VMANGOS) +#if !defined TRINITY && !defined VMANGOS // Enables use of MoveInLineOfSight bool IsVisible(Unit* who) const override { @@ -217,9 +217,9 @@ struct ElunaCreatureAI : NativeScriptedAI } // Called when hit by a spell -#ifdef TRINITY +#if defined TRINITY void SpellHit(WorldObject* caster, SpellInfo const* spell) override -#elif VMANGOS +#elif defined VMANGOS void SpellHit(Unit* caster, SpellInfo const* spell) #else void SpellHit(Unit* caster, SpellInfo const* spell) override @@ -230,7 +230,7 @@ struct ElunaCreatureAI : NativeScriptedAI } // Called when spell hits a target -#ifdef TRINITY +#if defined TRINITY void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override #else void SpellHitTarget(Unit* target, SpellInfo const* spell) override @@ -240,7 +240,7 @@ struct ElunaCreatureAI : NativeScriptedAI NativeScriptedAI::SpellHitTarget(target, spell); } -#ifdef TRINITY +#if defined TRINITY // Called when the creature is summoned successfully by other creature void IsSummonedBy(WorldObject* summoner) override { 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 58999b74b7..72a8f1d1cd 100644 --- a/ElunaEventMgr.h +++ b/ElunaEventMgr.h @@ -9,16 +9,16 @@ #include "ElunaUtility.h" #include "Common.h" -#ifdef TRINITY +#if defined TRINITY #include "Random.h" -#elif CMANGOS +#elif defined CMANGOS #include "Util/Util.h" #else #include "Util.h" #endif #include -#ifdef TRINITY +#if defined TRINITY #include "Define.h" #else #include "Platform/Define.h" diff --git a/ElunaIncludes.h b/ElunaIncludes.h index f854ae16bc..00535c0045 100644 --- a/ElunaIncludes.h +++ b/ElunaIncludes.h @@ -8,7 +8,7 @@ #define _ELUNA_INCLUDES_H // Required -#ifndef CMANGOS +#if !defined CMANGOS #include "AccountMgr.h" #include "AuctionHouseMgr.h" #include "Cell.h" @@ -72,7 +72,7 @@ #include "Tools/Language.h" #endif -#ifdef TRINITY +#if defined TRINITY #include "Bag.h" #include "Battleground.h" #include "Config.h" @@ -102,70 +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 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 #endif -#ifdef TRINITY +#if defined TRINITY #define CORE_VERSION (GitRevision::GetFullVersion()) #define eWorld (sWorld) #define eMapMgr (sMapMgr) @@ -189,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 ba8826f34e..b69c208c1f 100644 --- a/ElunaInstanceAI.h +++ b/ElunaInstanceAI.h @@ -8,10 +8,10 @@ #define _ELUNA_INSTANCE_DATA_H #include "LuaEngine.h" -#ifdef TRINITY +#if defined TRINITY #include "InstanceScript.h" #include "Map.h" -#elif CMANGOS +#elif defined CMANGOS #include "Maps/InstanceData.h" #else #include "InstanceData.h" @@ -63,7 +63,7 @@ class ElunaInstanceAI : public InstanceData std::string lastSaveData; public: -#ifdef TRINITY +#if defined TRINITY ElunaInstanceAI(Map* map) : InstanceData(map->ToInstanceMap()) { } @@ -73,7 +73,7 @@ class ElunaInstanceAI : public InstanceData } #endif -#ifndef TRINITY +#if !defined TRINITY void Initialize() override; #endif @@ -82,14 +82,14 @@ class ElunaInstanceAI : public InstanceData * data table to/from the core. */ void Load(const char* data) override; -#ifdef TRINITY +#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 { return Save(); } const char* Save() const; -#elif VMANGOS +#elif defined VMANGOS const char* Save() const; #else const char* Save() const override; @@ -110,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; @@ -148,7 +148,7 @@ class ElunaInstanceAI : public InstanceData instance->GetEluna()->OnPlayerEnterInstance(this, player); } -#ifdef TRINITY +#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 759f62bd13..298f29b84f 100644 --- a/ElunaLoader.h +++ b/ElunaLoader.h @@ -10,7 +10,7 @@ #include "LuaEngine.h" -#ifdef TRINITY +#if defined TRINITY #include #endif @@ -58,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; @@ -82,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 6448b77f0a..8b44c29668 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,7 +101,7 @@ bool ElunaUtil::WorldObjectInRangeCheck::operator()(WorldObject* u) { if (i_obj_fact) { -#if ((defined TRINITY || 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 diff --git a/ElunaUtility.h b/ElunaUtility.h index ce74461561..5f3d33d729 100644 --- a/ElunaUtility.h +++ b/ElunaUtility.h @@ -9,7 +9,7 @@ #include "Common.h" -#ifndef CMANGOS +#if !defined CMANGOS #include "SharedDefines.h" #include "ObjectGuid.h" #else @@ -17,10 +17,10 @@ #include "Entities/ObjectGuid.h" #endif -#ifdef TRINITY +#if defined TRINITY #include "QueryResult.h" #include "Log.h" -#elif VMANGOS +#elif defined VMANGOS #include "Database/QueryResult.h" #include "Log.h" #else @@ -33,15 +33,15 @@ #include #include -#if !defined(MANGOS) && !defined(VMANGOS) +#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(PLATFORM) && defined(PLATFORM_WINDOWS) +#elif defined PLATFORM && defined PLATFORM_WINDOWS #if PLATFORM == PLATFORM_WINDOWS #define ELUNA_WINDOWS #endif @@ -49,7 +49,7 @@ #error Eluna could not determine platform #endif -#ifdef TRINITY +#if defined TRINITY typedef QueryResult ElunaQuery; #define GET_GUID GetGUID #define HIGHGUID_PLAYER HighGuid::Player @@ -67,7 +67,7 @@ typedef QueryResult ElunaQuery; #define HIGHGUID_GROUP HighGuid::Group #endif -#ifdef TRINITY +#if defined TRINITY #include "fmt/printf.h" #define ELUNA_LOG_TC_FMT(TC_LOG_MACRO, ...) \ try { \ @@ -79,7 +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__); -#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__); @@ -101,16 +101,16 @@ typedef std::shared_ptr ElunaQuery; #define GetTemplate GetProto #endif -#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 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 6cfc98c438..76cebfce4f 100644 --- a/LuaEngine.h +++ b/LuaEngine.h @@ -11,7 +11,7 @@ #include "ElunaUtility.h" #include "Hooks.h" -#ifndef CMANGOS +#if !defined CMANGOS #include "DBCEnums.h" #include "Group.h" #include "Item.h" @@ -29,8 +29,8 @@ #include "World/World.h" #endif -#ifndef TRINITY -#ifndef CMANGOS +#if !defined TRINITY +#if !defined CMANGOS #include "Player.h" #else #include "Entities/Player.h" @@ -67,7 +67,7 @@ class WorldPacket; struct AreaTriggerEntry; struct AuctionEntry; -#ifdef TRINITY +#if defined TRINITY class Battleground; class GameObjectAI; class InstanceScript; @@ -85,7 +85,7 @@ typedef ItemPrototype ItemTemplate; typedef SpellEffectIndex SpellEffIndex; typedef SpellEntry SpellInfo; -#ifdef CMANGOS +#if defined CMANGOS class TemporarySpawn; typedef TemporarySpawn TempSummon; #else @@ -93,11 +93,11 @@ class TemporarySummon; typedef TemporarySummon TempSummon; #endif -#ifdef CLASSIC +#if defined CLASSIC typedef int Difficulty; #endif -#if !defined(CLASSIC) && !defined(TBC) +#if !defined CLASSIC && !defined TBC class VehicleInfo; typedef VehicleInfo Vehicle; #endif @@ -133,7 +133,7 @@ enum MethodRegisterState #define ELUNA_STATE_PTR "Eluna State Ptr" -#ifdef TRINITY +#if defined TRINITY #define ELUNA_GAME_API TC_GAME_API #define TRACKABLE_PTR_NAMESPACE ::Trinity:: #else @@ -154,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 @@ -187,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 @@ -242,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 @@ -334,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); @@ -461,7 +461,7 @@ class ELUNA_GAME_API Eluna bool OnQuestAccept(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest); bool OnQuestReward(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest, uint32 opt); void GetDialogStatus(const Player* pPlayer, const GameObject* pGameObject); -#if !defined(CLASSIC) && !defined(TBC) +#if !defined CLASSIC && !defined TBC void OnDestroyed(GameObject* pGameObject, WorldObject* attacker); void OnDamaged(GameObject* pGameObject, WorldObject* attacker); #endif @@ -489,7 +489,7 @@ class ELUNA_GAME_API Eluna void OnFreeTalentPointsChanged(Player* pPlayer, uint32 newPoints); void OnTalentsReset(Player* pPlayer, bool noCost); void OnMoneyChanged(Player* pPlayer, int32& amount); -#ifdef CATA +#if defined CATA void OnMoneyChanged(Player* pPlayer, int64& amount); #endif void OnGiveXP(Player* pPlayer, uint32& amount, Unit* pVictim); @@ -517,7 +517,7 @@ class ELUNA_GAME_API Eluna void HandleGossipSelectOption(Player* pPlayer, uint32 menuId, uint32 sender, uint32 action, const std::string& code); void OnAchievementComplete(Player* pPlayer, uint32 achievementId); -#if !defined(CLASSIC) && !defined(TBC) +#if !defined CLASSIC && !defined TBC /* Vehicle */ void OnInstall(Vehicle* vehicle); void OnUninstall(Vehicle* vehicle); @@ -546,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); diff --git a/LuaFunctions.cpp b/LuaFunctions.cpp index 152f547e47..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); -#ifdef TRINITY +#if defined TRINITY E->Push(E->CHECKVAL(1).ToString()); #else E->Push(E->CHECKVAL(1).GetString()); @@ -167,7 +167,7 @@ void RegisterFunctions(Eluna* E) ElunaTemplate::SetMethods(E, LuaObject::ObjectMethods); ElunaTemplate::SetMethods(E, LuaItem::ItemMethods); -#if !defined(CLASSIC) && !defined(TBC) +#if !defined CLASSIC && !defined TBC ElunaTemplate::Register(E, "Vehicle"); ElunaTemplate::SetMethods(E, LuaVehicle::VehicleMethods); #endif diff --git a/hooks/CreatureHooks.cpp b/hooks/CreatureHooks.cpp index cf478aa833..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); } -#ifdef TRINITY +#if defined TRINITY bool Eluna::SummonedCreatureDies(Creature* me, Creature* summon, Unit* killer) { diff --git a/hooks/GossipHooks.cpp b/hooks/GossipHooks.cpp index 28f867b5d4..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 a49a219969..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); -#ifdef TRINITY +#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 9c79203f2c..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,7 +111,7 @@ 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); #else HookPush(pTrigger->id); @@ -135,7 +135,7 @@ void Eluna::OnAdd(AuctionHouseObject* /*ah*/, AuctionEntry* entry) { Player* owner = eObjectAccessor()FindPlayer(MAKE_NEW_GUID(entry->owner, 0, HIGHGUID_PLAYER)); -#ifdef TRINITY +#if defined TRINITY Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow); uint32 expiretime = entry->expire_time; #else @@ -162,7 +162,7 @@ void Eluna::OnRemove(AuctionHouseObject* /*ah*/, AuctionEntry* entry) { Player* owner = eObjectAccessor()FindPlayer(MAKE_NEW_GUID(entry->owner, 0, HIGHGUID_PLAYER)); -#ifdef TRINITY +#if defined TRINITY Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow); uint32 expiretime = entry->expire_time; #else @@ -190,7 +190,7 @@ void Eluna::OnSuccessful(AuctionHouseObject* /*ah*/, AuctionEntry* entry) { Player* owner = eObjectAccessor()FindPlayer(MAKE_NEW_GUID(entry->owner, 0, HIGHGUID_PLAYER)); -#ifdef TRINITY +#if defined TRINITY Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow); uint32 expiretime = entry->expire_time; #else @@ -217,7 +217,7 @@ void Eluna::OnExpire(AuctionHouseObject* /*ah*/, AuctionEntry* entry) { Player* owner = eObjectAccessor()FindPlayer(MAKE_NEW_GUID(entry->owner, 0, HIGHGUID_PLAYER)); -#ifdef TRINITY +#if defined TRINITY Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow); uint32 expiretime = entry->expire_time; #else diff --git a/methods/TrinityCore/BattleGroundMethods.h b/methods/TrinityCore/BattleGroundMethods.h index f386f47148..d6d39eb35f 100644 --- a/methods/TrinityCore/BattleGroundMethods.h +++ b/methods/TrinityCore/BattleGroundMethods.h @@ -82,7 +82,7 @@ namespace LuaBattleGround */ int GetEndTime(Eluna* E, BattleGround* bg) { -#ifdef CATA +#if defined CATA E->Push(bg->GetRemainingTime()); #else E->Push(bg->GetEndTime()); diff --git a/methods/TrinityCore/CreatureMethods.h b/methods/TrinityCore/CreatureMethods.h index 4162d7cf9e..fd20af3d5e 100644 --- a/methods/TrinityCore/CreatureMethods.h +++ b/methods/TrinityCore/CreatureMethods.h @@ -22,7 +22,7 @@ namespace LuaCreature */ int IsRegeneratingHealth(Eluna* E, Creature* creature) { -#ifdef CATA +#if defined CATA E->Push(creature->isRegeneratingHealth()); #else E->Push(creature->CanRegenerateHealth()); @@ -904,7 +904,7 @@ namespace LuaCreature return 1; } -#ifndef CATA +#if !defined CATA /** * Returns the [Creature]'s shield block value. * @@ -1440,7 +1440,7 @@ namespace LuaCreature { "GetNPCFlags", &LuaCreature::GetNPCFlags }, { "GetExtraFlags", &LuaCreature::GetExtraFlags }, { "GetRank", &LuaCreature::GetRank }, -#ifndef CATA +#if !defined CATA { "GetShieldBlockValue", &LuaCreature::GetShieldBlockValue }, #endif { "GetDBTableGUIDLow", &LuaCreature::GetDBTableGUIDLow }, @@ -1519,7 +1519,7 @@ namespace LuaCreature { "ClearFixate", &LuaCreature::ClearFixate }, { "RemoveFromWorld", &LuaCreature::RemoveFromWorld }, -#ifdef CATA //Not implemented in TCPP +#if defined CATA //Not implemented in TCPP { "GetShieldBlockValue", nullptr }, #endif diff --git a/methods/TrinityCore/GameObjectMethods.h b/methods/TrinityCore/GameObjectMethods.h index 3e53ee767c..230b36d507 100644 --- a/methods/TrinityCore/GameObjectMethods.h +++ b/methods/TrinityCore/GameObjectMethods.h @@ -185,7 +185,7 @@ namespace LuaGameObject go->SetGoState(GO_STATE_READY); else if (state == 2) { -#ifndef CATA +#if !defined CATA go->SetGoState(GO_STATE_DESTROYED); #else go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); diff --git a/methods/TrinityCore/GlobalMethods.h b/methods/TrinityCore/GlobalMethods.h index ae89a50629..db5cce03ba 100644 --- a/methods/TrinityCore/GlobalMethods.h +++ b/methods/TrinityCore/GlobalMethods.h @@ -457,7 +457,7 @@ namespace LuaGlobalFunctions if (!temp) return luaL_argerror(E->L, 1, "valid ItemEntry expected"); -#ifdef CATA +#if defined CATA std::string name = temp->ExtendedData->Display->Str[locale]; #else std::string name = temp->Name1; @@ -466,7 +466,7 @@ namespace LuaGlobalFunctions ObjectMgr::GetLocaleString(il->Name, static_cast(locale), name); std::ostringstream oss; -#ifdef CATA +#if defined CATA oss << "|c" << std::hex << ItemQualityColors[temp->ExtendedData->Quality] << std::dec << #else oss << "|c" << std::hex << ItemQualityColors[temp->Quality] << std::dec << @@ -1304,7 +1304,7 @@ namespace LuaGlobalFunctions { const char* command = E->CHECKVAL(1); // ignores output of the command -#ifdef CATA +#if defined CATA eWorld->QueueCliCommand(new CliCommandHolder(nullptr, command, nullptr, [](void*, bool) {})); #else eWorld->QueueCliCommand(new CliCommandHolder(nullptr, command, [](void*, std::string_view) {}, [](void*, bool) {})); @@ -1748,7 +1748,7 @@ namespace LuaGlobalFunctions if (save) { Creature* creature = new Creature(); -#ifdef CATA +#if defined CATA if (!creature->Create(map->GenerateLowGuid(), map, entry, pos)) #else if (!creature->Create(map->GenerateLowGuid(), map, phase, entry, pos)) @@ -1759,7 +1759,7 @@ namespace LuaGlobalFunctions return 1; } -#ifdef CATA +#if defined CATA creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode())); #else creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), phase); @@ -1785,7 +1785,7 @@ namespace LuaGlobalFunctions } else { -#ifdef CATA +#if defined CATA SummonCreatureExtraArgs extraArgs; extraArgs.SummonDuration = durorresptime; TempSummon* creature = map->SummonCreature(entry, pos, extraArgs); @@ -1827,7 +1827,7 @@ namespace LuaGlobalFunctions GameObject* object = new GameObject; uint32 guidLow = map->GenerateLowGuid(); QuaternionData rot = QuaternionData::fromEulerAnglesZYX(o, 0.f, 0.f); -#ifdef CATA +#if defined 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)) @@ -1844,7 +1844,7 @@ namespace LuaGlobalFunctions if (save) { // fill the gameobject data and save to the db -#ifdef CATA +#if defined CATA object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode())); #else object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), phase); @@ -1910,7 +1910,7 @@ namespace LuaGlobalFunctions uint32 incrtime = E->CHECKVAL(4); uint32 extendedcost = E->CHECKVAL(5); -#ifdef CATA +#if defined CATA VendorItem vItem; vItem.item = item; vItem.maxcount = maxcount; @@ -1942,7 +1942,7 @@ namespace LuaGlobalFunctions if (!eObjectMgr->GetCreatureTemplate(entry)) return luaL_argerror(E->L, 1, "valid CreatureEntry expected"); -#ifdef CATA +#if defined CATA eObjectMgr->RemoveVendorItem(entry, item, 1); #else eObjectMgr->RemoveVendorItem(entry, item); @@ -1966,7 +1966,7 @@ namespace LuaGlobalFunctions auto const itemlist = items->m_items; for (auto itr = itemlist.begin(); itr != itemlist.end(); ++itr) -#ifdef CATA +#if defined CATA eObjectMgr->RemoveVendorItem(entry, itr->item, 1); #else eObjectMgr->RemoveVendorItem(entry, itr->item); @@ -1984,7 +1984,7 @@ namespace LuaGlobalFunctions { Player* player = E->CHECKOBJ(1); -#ifndef CATA +#if !defined CATA player->GetSession()->KickPlayer("GlobalMethods::Kick Kick the player"); #else player->GetSession()->KickPlayer(); @@ -2136,7 +2136,7 @@ namespace LuaGlobalFunctions luaL_error(E->L, "Item entry %d does not exist", entry); continue; } -#ifdef CATA +#if defined 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))) diff --git a/methods/TrinityCore/GroupMethods.h b/methods/TrinityCore/GroupMethods.h index 25c87af4bc..1aa85b9606 100644 --- a/methods/TrinityCore/GroupMethods.h +++ b/methods/TrinityCore/GroupMethods.h @@ -256,7 +256,7 @@ namespace LuaGroup return 1; } -#ifndef CATA +#if !defined CATA /** * Returns the [Group] members' flags * @@ -424,7 +424,7 @@ namespace LuaGroup return 0; } -#ifndef CATA +#if !defined CATA /** * Sets or removes a flag for a [Group] member * @@ -463,7 +463,7 @@ namespace LuaGroup { "GetMemberGroup", &LuaGroup::GetMemberGroup }, { "GetMemberGUID", &LuaGroup::GetMemberGUID }, { "GetMembersCount", &LuaGroup::GetMembersCount }, -#ifndef CATA +#if !defined CATA { "GetMemberFlags", &LuaGroup::GetMemberFlags }, #endif @@ -471,7 +471,7 @@ namespace LuaGroup { "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 +#if !defined CATA { "SetMemberFlag", &LuaGroup::SetMemberFlag, METHOD_REG_WORLD }, // World state method only in multistate #endif @@ -495,7 +495,7 @@ 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 +#if defined CATA //Not implemented in TCPP { "GetMemberFlags", nullptr, METHOD_REG_NONE }, { "SetMemberFlag", nullptr, METHOD_REG_NONE }, #endif diff --git a/methods/TrinityCore/GuildMethods.h b/methods/TrinityCore/GuildMethods.h index fcd941593f..9691f85b34 100644 --- a/methods/TrinityCore/GuildMethods.h +++ b/methods/TrinityCore/GuildMethods.h @@ -124,7 +124,7 @@ namespace LuaGuild return 1; } -#ifndef CATA +#if !defined CATA /** * Sets the leader of this [Guild] * @@ -274,7 +274,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 +#if !defined CATA { "SetLeader", &LuaGuild::SetLeader, METHOD_REG_WORLD }, // World state method only in multistate #endif @@ -285,7 +285,7 @@ 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 +#if defined CATA //Not implemented in TCPP { "SetLeader", nullptr, METHOD_REG_NONE }, #endif diff --git a/methods/TrinityCore/ItemMethods.h b/methods/TrinityCore/ItemMethods.h index 60ababc544..16564eaa41 100644 --- a/methods/TrinityCore/ItemMethods.h +++ b/methods/TrinityCore/ItemMethods.h @@ -185,7 +185,7 @@ namespace LuaItem return 1; } -#if defined(WOTLK) +#if !defined CATA /** * Returns 'true' if the [Item] is a weapon vellum, 'false' otherwise * @@ -220,7 +220,7 @@ namespace LuaItem return 1; } -#ifndef CATA +#if !defined CATA /** * Returns 'true' if the refund period has expired for this [Item], 'false' otherwise * @@ -261,7 +261,7 @@ namespace LuaItem return luaL_argerror(E->L, 2, "valid LocaleConstant expected"); const ItemTemplate* temp = item->GetTemplate(); -#ifdef CATA +#if defined CATA std::string name = temp->ExtendedData->Display1->Str[locale]; if (ItemLocale const* il = eObjectMgr->GetItemLocale(temp->BasicData->ID)) #else @@ -272,10 +272,10 @@ namespace LuaItem if (int32 itemRandPropId = item->GetItemRandomPropertyId()) { -#ifndef CATA - std::array const* suffix = NULL; -#else +#if defined CATA char* const* suffix = NULL; +#else + std::array const* suffix = NULL; #endif if (itemRandPropId < 0) { @@ -292,16 +292,16 @@ namespace LuaItem if (suffix) { name += ' '; -#ifndef CATA - name += (*suffix)[(name != temp->Name1) ? locale : uint8(DEFAULT_LOCALE)]; -#else +#if defined CATA name += (*suffix)[(name != temp->ExtendedData->Display->Str[locale]) ? locale : uint8(DEFAULT_LOCALE)]; +#else + name += (*suffix)[(name != temp->Name1) ? locale : uint8(DEFAULT_LOCALE)]; #endif } } std::ostringstream oss; -#ifdef CATA +#if defined CATA oss << "|c" << std::hex << ItemQualityColors[temp->ExtendedData->Quality] << std::dec << "|Hitem:" << temp->BasicData->ID << ":" << #else @@ -415,7 +415,7 @@ namespace LuaItem if (index >= MAX_ITEM_PROTO_SPELLS) return luaL_argerror(E->L, 2, "valid SpellIndex expected"); -#ifdef CATA +#if defined CATA E->Push(item->GetTemplate()->ExtendedData->SpellID[index]); #else E->Push(item->GetTemplate()->Spells[index].SpellId); @@ -435,7 +435,7 @@ namespace LuaItem if (index >= MAX_ITEM_PROTO_SPELLS) return luaL_argerror(E->L, 2, "valid SpellIndex expected"); -#ifdef CATA +#if defined CATA E->Push(item->GetTemplate()->ExtendedData->SpellTrigger[index]); #else E->Push(item->GetTemplate()->Spells[index].SpellTrigger); @@ -450,7 +450,7 @@ namespace LuaItem */ int GetClass(Eluna* E, Item* item) { -#ifdef CATA +#if defined CATA E->Push(item->GetTemplate()->GetClass()); #else E->Push(item->GetTemplate()->Class); @@ -465,7 +465,7 @@ namespace LuaItem */ int GetSubClass(Eluna* E, Item* item) { -#ifdef CATA +#if defined CATA E->Push(item->GetTemplate()->GetSubClass()); #else E->Push(item->GetTemplate()->SubClass); @@ -491,7 +491,7 @@ namespace LuaItem */ int GetName(Eluna* E, Item* item) { -#ifdef CATA +#if defined CATA E->Push(item->GetTemplate()->GetDefaultLocaleName()); #else E->Push(item->GetTemplate()->Name1); @@ -506,7 +506,7 @@ namespace LuaItem */ int GetDisplayId(Eluna* E, Item* item) { -#ifdef CATA +#if defined CATA E->Push(item->GetTemplate()->GetDisplayID()); #else E->Push(item->GetTemplate()->DisplayInfoID); @@ -521,7 +521,7 @@ namespace LuaItem */ int GetQuality(Eluna* E, Item* item) { -#ifdef CATA +#if defined CATA E->Push(item->GetTemplate()->GetQuality()); #else E->Push(item->GetTemplate()->Quality); @@ -569,7 +569,7 @@ namespace LuaItem */ int GetBuyCount(Eluna* E, Item* item) { -#ifdef CATA +#if defined CATA E->Push(item->GetTemplate()->GetBuyCount()); #else E->Push(item->GetTemplate()->BuyCount); @@ -584,7 +584,7 @@ namespace LuaItem */ int GetBuyPrice(Eluna* E, Item* item) { -#ifdef CATA +#if defined CATA E->Push(item->GetTemplate()->GetBuyPrice()); #else E->Push(item->GetTemplate()->BuyPrice); @@ -599,7 +599,7 @@ namespace LuaItem */ int GetSellPrice(Eluna* E, Item* item) { -#ifdef CATA +#if defined CATA E->Push(item->GetTemplate()->GetSellPrice()); #else E->Push(item->GetTemplate()->SellPrice); @@ -614,7 +614,7 @@ namespace LuaItem */ int GetInventoryType(Eluna* E, Item* item) { -#ifdef CATA +#if defined CATA E->Push(item->GetTemplate()->GetInventoryType()); #else E->Push(item->GetTemplate()->InventoryType); @@ -629,7 +629,7 @@ namespace LuaItem */ int GetAllowableClass(Eluna* E, Item* item) { -#ifdef CATA +#if defined CATA E->Push(item->GetTemplate()->GetAllowableClass()); #else E->Push(item->GetTemplate()->AllowableClass); @@ -644,7 +644,7 @@ namespace LuaItem */ int GetAllowableRace(Eluna* E, Item* item) { -#ifdef CATA +#if defined CATA E->Push(item->GetTemplate()->GetAllowableRace()); #else E->Push(item->GetTemplate()->AllowableRace); @@ -659,7 +659,7 @@ namespace LuaItem */ int GetItemLevel(Eluna* E, Item* item) { -#ifdef CATA +#if defined CATA E->Push(item->GetTemplate()->GetBaseItemLevel()); #else E->Push(item->GetTemplate()->ItemLevel); @@ -674,7 +674,7 @@ namespace LuaItem */ int GetRequiredLevel(Eluna* E, Item* item) { -#ifdef CATA +#if defined CATA E->Push(item->GetTemplate()->GetRequiredLevel()); #else E->Push(item->GetTemplate()->RequiredLevel); @@ -702,7 +702,7 @@ namespace LuaItem */ int GetRandomProperty(Eluna* E, Item* item) { -#ifdef CATA +#if defined CATA E->Push(item->GetTemplate()->GetRandomProperty()); #else E->Push(item->GetTemplate()->RandomProperty); @@ -717,7 +717,7 @@ namespace LuaItem */ int GetRandomSuffix(Eluna* E, Item* item) { -#ifdef CATA +#if defined CATA E->Push(item->GetTemplate()->GetRandomSuffix()); #else E->Push(item->GetTemplate()->RandomSuffix); @@ -732,7 +732,7 @@ namespace LuaItem */ int GetItemSet(Eluna* E, Item* item) { -#ifdef CATA +#if defined CATA E->Push(item->GetTemplate()->GetItemSet()); #else E->Push(item->GetTemplate()->ItemSet); @@ -900,7 +900,7 @@ namespace LuaItem { "GetAllowableRace", &LuaItem::GetAllowableRace }, { "GetItemLevel", &LuaItem::GetItemLevel }, { "GetRequiredLevel", &LuaItem::GetRequiredLevel }, -#ifndef CATA +#if !defined CATA { "GetStatsCount", &LuaItem::GetStatsCount }, #endif { "GetRandomProperty", &LuaItem::GetRandomProperty }, @@ -929,7 +929,7 @@ namespace LuaItem { "IsEquipped", &LuaItem::IsEquipped }, { "HasQuest", &LuaItem::HasQuest }, { "IsPotion", &LuaItem::IsPotion }, -#ifndef CATA +#if !defined CATA { "IsWeaponVellum", &LuaItem::IsWeaponVellum }, { "IsArmorVellum", &LuaItem::IsArmorVellum }, { "IsRefundExpired", &LuaItem::IsRefundExpired }, @@ -941,7 +941,7 @@ namespace LuaItem // Other { "SaveToDB", &LuaItem::SaveToDB }, -#ifdef CATA //Not implemented in TCPP +#if defined CATA //Not implemented in TCPP { "GetStatsCount", nullptr, METHOD_REG_NONE }, { "IsWeaponVellum", nullptr, METHOD_REG_NONE }, { "IsArmorVellum", nullptr, METHOD_REG_NONE }, diff --git a/methods/TrinityCore/MapMethods.h b/methods/TrinityCore/MapMethods.h index 7032e844d6..cc0329926a 100644 --- a/methods/TrinityCore/MapMethods.h +++ b/methods/TrinityCore/MapMethods.h @@ -108,7 +108,7 @@ namespace LuaMap { float x = E->CHECKVAL(2); float y = E->CHECKVAL(3); -#ifdef CATA +#if defined CATA PhaseShift phase; float z = map->GetHeight(phase, x, y, MAX_HEIGHT); #else @@ -181,7 +181,7 @@ namespace LuaMap float x = E->CHECKVAL(2); float y = E->CHECKVAL(3); float z = E->CHECKVAL(4); -#ifdef CATA +#if defined CATA PhaseShift phase; E->Push(map->GetAreaId(phase, x, y, z)); #else diff --git a/methods/TrinityCore/PlayerMethods.h b/methods/TrinityCore/PlayerMethods.h index 7efd583bc2..98df35f7d7 100644 --- a/methods/TrinityCore/PlayerMethods.h +++ b/methods/TrinityCore/PlayerMethods.h @@ -239,7 +239,7 @@ namespace LuaPlayer */ int CanSpeak(Eluna* E, Player* player) { -#ifndef CATA +#if !defined CATA E->Push(player->GetSession()->CanSpeak()); #else E->Push(player->CanSpeak()); @@ -378,7 +378,7 @@ namespace LuaPlayer return 1; } -#ifndef CATA +#if !defined CATA /** * Returns 'true' if the [Player] satisfies all requirements to complete the repeatable quest entry. * @@ -669,7 +669,7 @@ namespace LuaPlayer int IsNeverVisible(Eluna* E, Player* player) { // Possibly add a bool var here -#ifdef CATA +#if defined CATA E->Push(player->IsNeverVisible()); #else E->Push(player->IsNeverVisible(true)); @@ -720,7 +720,7 @@ namespace LuaPlayer return 1; } -#ifndef CATA +#if !defined CATA /** * Returns the normal phase of the player instead of the actual phase possibly containing GM phase * @@ -1066,7 +1066,7 @@ namespace LuaPlayer */ int GetGuildRank(Eluna* E, Player* player) // TODO: Move to Guild Methods { -#ifdef CATA +#if defined CATA E->Push(player->GetGuildRank()); #else E->Push(player->GetRank()); @@ -1553,7 +1553,7 @@ namespace LuaPlayer return 1; } -#ifndef CATA +#if !defined CATA /** * Returns the amount of mails in the [Player]s mailbox * @@ -1695,7 +1695,7 @@ namespace LuaPlayer if (!player->GetGuildId()) return 0; -#ifdef CATA +#if defined CATA player->SetGuildRank(rank); #else player->SetRank(rank); @@ -1872,7 +1872,7 @@ namespace LuaPlayer return 0; } -#ifndef CATA +#if !defined CATA /** * Sets the [Player]s Arena Points to the amount specified * @@ -1986,7 +1986,7 @@ namespace LuaPlayer bool apply = E->CHECKVAL(2, true); if(apply) -#ifdef CATA +#if defined 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); @@ -1999,7 +1999,7 @@ namespace LuaPlayer } -#ifndef CATA +#if !defined CATA int SetMovement(Eluna* E, Player* player) { int32 pType = E->CHECKVAL(2); @@ -2041,7 +2041,7 @@ namespace LuaPlayer return 0; } -#ifndef CATA +#if !defined CATA /** * Adds or detracts from the [Player]s current Arena Points * @@ -2103,12 +2103,12 @@ namespace LuaPlayer 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 +#if defined CATA std::ostringstream oss; oss << "UPDATE account SET mutetime = " << muteTime << " WHERE id = " << player->GetSession()->GetAccountId(); LoginDatabase.PExecute("%s", oss.str().c_str()); +#else + LoginDatabase.PExecute("UPDATE account SET mutetime = {} WHERE id = {}", muteTime, player->GetSession()->GetAccountId()); #endif return 0; } @@ -2215,7 +2215,7 @@ namespace LuaPlayer { Creature* obj = E->CHECKOBJ(2); -#ifdef CATA +#if defined CATA player->GetSession()->SendTrainerList(obj, NULL); #else player->GetSession()->SendTrainerList(obj); @@ -2464,7 +2464,7 @@ namespace LuaPlayer */ int ResetTalentsCost(Eluna* E, Player* player) { -#ifdef CATA +#if defined CATA E->Push(player->GetNextResetTalentsCost()); #else E->Push(player->ResetTalentsCost()); @@ -2715,22 +2715,21 @@ namespace LuaPlayer return 0; // check item starting quest (it can work incorrectly if added without item in inventory) -#ifndef CATA +#if defined 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(); + }); +#else 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)) @@ -3009,7 +3008,7 @@ namespace LuaPlayer return 0; } -#ifndef CATA +#if !defined CATA /** * Advances all of the [Player]s weapon skills to the maximum amount available */ @@ -3082,7 +3081,7 @@ namespace LuaPlayer float z = E->CHECKVAL(5); float o = E->CHECKVAL(6); -#ifdef CATA +#if defined CATA if (player->IsInFlight()) { player->GetMotionMaster()->MovementExpired(); @@ -3309,10 +3308,10 @@ namespace LuaPlayer */ int KickPlayer(Eluna* /*E*/, Player* player) { -#ifndef CATA - player->GetSession()->KickPlayer("PlayerMethods::KickPlayer Kick the player"); -#else +#if defined CATA player->GetSession()->KickPlayer(); +#else + player->GetSession()->KickPlayer("PlayerMethods::KickPlayer Kick the player"); #endif return 0; } @@ -3550,7 +3549,7 @@ namespace LuaPlayer if (!quest) return 0; -#ifdef CATA +#if defined CATA player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, player->GET_GUID(), activateAccept, true); #else player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, player->GET_GUID(), activateAccept); @@ -3801,7 +3800,7 @@ namespace LuaPlayer { "GetGuild", &LuaPlayer::GetGuild }, { "GetAccountId", &LuaPlayer::GetAccountId }, { "GetAccountName", &LuaPlayer::GetAccountName }, -#ifndef CATA +#if !defined CATA { "GetArenaPoints", &LuaPlayer::GetArenaPoints }, { "GetHonorPoints", &LuaPlayer::GetHonorPoints }, #endif @@ -3818,7 +3817,7 @@ namespace LuaPlayer { "GetQuestLevel", &LuaPlayer::GetQuestLevel }, { "GetChatTag", &LuaPlayer::GetChatTag }, { "GetRestBonus", &LuaPlayer::GetRestBonus }, -#ifndef CATA +#if !defined CATA { "GetPhaseMaskForSpawn", &LuaPlayer::GetPhaseMaskForSpawn }, #endif { "GetReqKillOrCastCurrentCount", &LuaPlayer::GetReqKillOrCastCurrentCount }, @@ -3860,7 +3859,7 @@ namespace LuaPlayer { "GetCorpse", &LuaPlayer::GetCorpse }, { "GetGossipTextId", &LuaPlayer::GetGossipTextId }, { "GetQuestRewardStatus", &LuaPlayer::GetQuestRewardStatus }, -#ifndef CATA +#if !defined CATA { "GetShieldBlockValue", &LuaPlayer::GetShieldBlockValue }, { "GetMailCount", &LuaPlayer::GetMailCount }, { "GetXP", &LuaPlayer::GetXP }, @@ -3868,7 +3867,7 @@ namespace LuaPlayer #endif // Setters -#ifndef CATA +#if !defined CATA { "AdvanceSkillsToMax", &LuaPlayer::AdvanceSkillsToMax }, #endif { "AdvanceSkill", &LuaPlayer::AdvanceSkill }, @@ -3878,7 +3877,7 @@ namespace LuaPlayer { "SetKnownTitle", &LuaPlayer::SetKnownTitle }, { "UnsetKnownTitle", &LuaPlayer::UnsetKnownTitle }, { "SetBindPoint", &LuaPlayer::SetBindPoint }, -#ifndef CATA +#if !defined CATA { "SetArenaPoints", &LuaPlayer::SetArenaPoints }, { "SetHonorPoints", &LuaPlayer::SetHonorPoints }, #endif @@ -3894,7 +3893,7 @@ namespace LuaPlayer { "SetReputation", &LuaPlayer::SetReputation }, { "SetFreeTalentPoints", &LuaPlayer::SetFreeTalentPoints }, { "SetGuildRank", &LuaPlayer::SetGuildRank }, -#ifndef CATA +#if !defined CATA { "SetMovement", &LuaPlayer::SetMovement }, #endif { "SetSkill", &LuaPlayer::SetSkill }, @@ -3967,7 +3966,7 @@ namespace LuaPlayer { "CanFly", &LuaPlayer::CanFly }, { "IsMoving", &LuaPlayer::IsMoving }, { "IsFlying", &LuaPlayer::IsFlying }, -#ifndef CATA +#if !defined CATA { "CanCompleteRepeatableQuest", &LuaPlayer::CanCompleteRepeatableQuest }, { "CanRewardQuest", &LuaPlayer::CanRewardQuest }, #endif @@ -4031,7 +4030,7 @@ namespace LuaPlayer { "DurabilityPointLossForEquipSlot", &LuaPlayer::DurabilityPointLossForEquipSlot }, { "DurabilityRepairAll", &LuaPlayer::DurabilityRepairAll }, { "DurabilityRepair", &LuaPlayer::DurabilityRepair }, -#ifndef CATA +#if !defined CATA { "ModifyHonorPoints", &LuaPlayer::ModifyHonorPoints }, { "ModifyArenaPoints", &LuaPlayer::ModifyArenaPoints }, #endif @@ -4084,7 +4083,7 @@ namespace LuaPlayer { "ClearHonorInfo", nullptr, METHOD_REG_NONE }, // classic only { "GainSpellComboPoints", nullptr, METHOD_REG_NONE }, // not implemented -#ifdef CATA //Not implmented in TCPP +#if defined CATA //Not implmented in TCPP { "GetArenaPoints", nullptr, METHOD_REG_NONE }, { "GetHonorPoints", nullptr, METHOD_REG_NONE }, { "GetPhaseMaskForSpawn", nullptr, METHOD_REG_NONE }, diff --git a/methods/TrinityCore/QuestMethods.h b/methods/TrinityCore/QuestMethods.h index 0e2c24011e..933f2d7b90 100644 --- a/methods/TrinityCore/QuestMethods.h +++ b/methods/TrinityCore/QuestMethods.h @@ -165,7 +165,7 @@ namespace LuaQuest */ int GetType(Eluna* E, Quest* quest) { -#ifdef CATA +#if defined CATA E->Push(quest->GetQuestType()); #else E->Push(quest->GetType()); diff --git a/methods/TrinityCore/UnitMethods.h b/methods/TrinityCore/UnitMethods.h index 0165b8eb03..902b9dbe76 100644 --- a/methods/TrinityCore/UnitMethods.h +++ b/methods/TrinityCore/UnitMethods.h @@ -1550,10 +1550,10 @@ namespace LuaUnit int SetNativeDisplayId(Eluna* E, Unit* unit) { uint32 model = E->CHECKVAL(2); -#ifndef CATA - unit->SetNativeDisplayId(model); -#else +#if defined CATA unit->SetDisplayId(model, true); +#else + unit->SetNativeDisplayId(model); #endif return 0; } diff --git a/methods/TrinityCore/VehicleMethods.h b/methods/TrinityCore/VehicleMethods.h index 1fdeb6d29b..cd4fe93d56 100644 --- a/methods/TrinityCore/VehicleMethods.h +++ b/methods/TrinityCore/VehicleMethods.h @@ -72,10 +72,10 @@ namespace LuaVehicle Unit* passenger = E->CHECKOBJ(2); int8 seatId = E->CHECKVAL(3); -#ifndef CATA - vehicle->AddPassenger(passenger, seatId); -#else +#if defined CATA vehicle->AddVehiclePassenger(passenger, seatId); +#else + vehicle->AddPassenger(passenger, seatId); #endif return 0; } diff --git a/methods/TrinityCore/WorldObjectMethods.h b/methods/TrinityCore/WorldObjectMethods.h index 497064c742..4b7710379c 100644 --- a/methods/TrinityCore/WorldObjectMethods.h +++ b/methods/TrinityCore/WorldObjectMethods.h @@ -43,7 +43,7 @@ namespace LuaWorldObject */ int GetPhaseMask(Eluna* E, WorldObject* obj) { -#ifdef CATA +#if defined CATA EventMap event; E->Push(event.GetPhaseMask()); #else @@ -61,7 +61,7 @@ namespace LuaWorldObject int SetPhaseMask(Eluna* E, WorldObject* obj) { uint32 phaseMask = E->CHECKVAL(2); -#ifdef CATA +#if defined CATA EventMap event; event.SetPhase(phaseMask); #else @@ -602,25 +602,23 @@ namespace LuaWorldObject int GetAngle(Eluna* E, WorldObject* obj) { WorldObject* target = E->CHECKOBJ(2, false); -#ifndef CATA - if (target) - E->Push(obj->GetAbsoluteAngle(target)); - else - { - float x = E->CHECKVAL(2); - float y = E->CHECKVAL(3); - E->Push(obj->GetAbsoluteAngle(x, y)); - } -#else + if (target) +#if defined CATA E->Push(obj->GetAngle(target)); +#else + E->Push(obj->GetAbsoluteAngle(target)); +#endif else { float x = E->CHECKVAL(2); float y = E->CHECKVAL(3); +#if defined CATA E->Push(obj->GetAngle(x, y)); - } +#else + E->Push(obj->GetAbsoluteAngle(x, y)); #endif + } return 1; } @@ -658,13 +656,11 @@ 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); +#if defined CATA E->Push(obj->SummonGameObject(entry, x, y, z, o, rot, respawnDelay)); +#else + E->Push(obj->SummonGameObject(entry, Position(x, y, z, o), rot, Seconds(respawnDelay))); #endif return 1; } @@ -736,10 +732,10 @@ 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 +#if defined CATA E->Push(obj->SummonCreature(entry, x, y, z, o, type, despawnTimer)); +#else + E->Push(obj->SummonCreature(entry, x, y, z, o, type, Milliseconds(despawnTimer))); #endif return 1; }