diff --git a/src/LuaEngine/ElunaCreatureAI.h b/src/LuaEngine/ElunaCreatureAI.h index b03cbae..e6a13dd 100644 --- a/src/LuaEngine/ElunaCreatureAI.h +++ b/src/LuaEngine/ElunaCreatureAI.h @@ -9,12 +9,7 @@ #include "LuaEngine.h" -#if defined TRINITY || AZEROTHCORE struct ScriptedAI; -#else -class AggressorAI; -typedef AggressorAI ScriptedAI; -#endif struct ElunaCreatureAI : ScriptedAI { @@ -22,9 +17,6 @@ struct ElunaCreatureAI : ScriptedAI bool justSpawned; // used to delay movementinform hook (WP hook) std::vector< std::pair > movepoints; -#if defined MANGOS || defined CMANGOS -#define me m_creature -#endif ElunaCreatureAI(Creature* creature) : ScriptedAI(creature), justSpawned(true) { @@ -32,22 +24,14 @@ struct ElunaCreatureAI : ScriptedAI ~ElunaCreatureAI() { } //Called at World update tick -#ifndef TRINITY - void UpdateAI(const uint32 diff) override -#else void UpdateAI(uint32 diff) override -#endif { -#ifdef TRINITY - //Spawns are handled by Creature.cpp - in function Creature::Update() -#else if (justSpawned) { justSpawned = false; JustRespawned(); } -#endif if (!movepoints.empty()) { @@ -61,17 +45,11 @@ struct ElunaCreatureAI : ScriptedAI if (!sEluna->UpdateAI(me, diff)) { -#if defined TRINITY || AZEROTHCORE if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)) ScriptedAI::UpdateAI(diff); -#else - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)) - ScriptedAI::UpdateAI(diff); -#endif } } -#if defined TRINITY || AZEROTHCORE // 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 @@ -79,34 +57,13 @@ struct ElunaCreatureAI : ScriptedAI if (!sEluna->EnterCombat(me, target)) ScriptedAI::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 - { - if (!sEluna->EnterCombat(me, target)) - ScriptedAI::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 - void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType damageType, SpellInfo const* spellInfo) override -#else - void DamageTaken(Unit* attacker, uint32& damage) override -#endif { if (!sEluna->DamageTaken(me, attacker, damage)) { -#if defined AZEROTHCORE ScriptedAI::DamageTaken(attacker, damage, damagetype, damageSchoolMask); -#elif defined TRINITY - ScriptedAI::DamageTaken(attacker, damage, damageType, spellInfo); -#else - ScriptedAI::DamageTaken(attacker, damage); -#endif } } @@ -160,21 +117,12 @@ struct ElunaCreatureAI : ScriptedAI ScriptedAI::EnterEvadeMode(); } -#ifdef TRINITY - // Called when creature appears in the world (spawn, respawn, grid load etc...) - void JustAppeared() override - { - if (!sEluna->JustRespawned(me)) - ScriptedAI::JustAppeared(); - } -#else // Called when creature is spawned or respawned (for reseting variables) void JustRespawned() override { if (!sEluna->JustRespawned(me)) ScriptedAI::JustRespawned(); } -#endif // Called at reaching home after evade void JustReachedHome() override @@ -197,14 +145,6 @@ struct ElunaCreatureAI : ScriptedAI ScriptedAI::CorpseRemoved(respawnDelay); } -#if !defined TRINITY && !AZEROTHCORE - // Enables use of MoveInLineOfSight - bool IsVisible(Unit* who) const override - { - return true; - } -#endif - void MoveInLineOfSight(Unit* who) override { if (!sEluna->MoveInLineOfSight(me, who)) @@ -212,44 +152,25 @@ struct ElunaCreatureAI : ScriptedAI } // Called when hit by a spell -#if defined TRINITY - void SpellHit(WorldObject* caster, SpellInfo const* spell) override -#else void SpellHit(Unit* caster, SpellInfo const* spell) override -#endif { if (!sEluna->SpellHit(me, caster, spell)) ScriptedAI::SpellHit(caster, spell); } // Called when spell hits a target -#if defined TRINITY - void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override -#else void SpellHitTarget(Unit* target, SpellInfo const* spell) override -#endif { if (!sEluna->SpellHitTarget(me, target, spell)) ScriptedAI::SpellHitTarget(target, spell); } -#if defined TRINITY || AZEROTHCORE - -#if defined TRINITY || AZEROTHCORE // Called when the creature is summoned successfully by other creature void IsSummonedBy(WorldObject* summoner) override { if (!summoner->ToUnit() || !sEluna->OnSummoned(me, summoner->ToUnit())) ScriptedAI::IsSummonedBy(summoner); } -#else - // Called when the creature is summoned successfully by other creature - void IsSummonedBy(Unit* summoner) override - { - if (!sEluna->OnSummoned(me, summoner)) - ScriptedAI::IsSummonedBy(summoner); - } -#endif void SummonedCreatureDies(Creature* summon, Unit* killer) override { @@ -270,11 +191,6 @@ struct ElunaCreatureAI : ScriptedAI if (!sEluna->OwnerAttacked(me, target)) ScriptedAI::OwnerAttacked(target); } -#endif - -#if defined MANGOS || defined CMANGOS -#undef me -#endif }; #endif diff --git a/src/LuaEngine/ElunaEventMgr.h b/src/LuaEngine/ElunaEventMgr.h index 013c8ea..1ab2cbe 100644 --- a/src/LuaEngine/ElunaEventMgr.h +++ b/src/LuaEngine/ElunaEventMgr.h @@ -9,18 +9,10 @@ #include "ElunaUtility.h" #include "Common.h" -#ifdef TRINITY -#include "Random.h" -#else #include "Util.h" -#endif #include -#if defined(TRINITY) || AZEROTHCORE #include "Define.h" -#else -#include "Platform/Define.h" -#endif class Eluna; class EventMgr; diff --git a/src/LuaEngine/ElunaIncludes.h b/src/LuaEngine/ElunaIncludes.h index 26f8c0c..7692680 100644 --- a/src/LuaEngine/ElunaIncludes.h +++ b/src/LuaEngine/ElunaIncludes.h @@ -37,18 +37,7 @@ #include "TemporarySummon.h" #include "WorldPacket.h" #include "WorldSession.h" - -#if defined TRINITY -#include "SpellHistory.h" -#endif - -#if defined AZEROTHCORE #include "MapMgr.h" -#else -#include "MapManager.h" -#endif - -#if defined TRINITY || defined AZEROTHCORE #include "Config.h" #include "GameEventMgr.h" #include "GitRevision.h" @@ -60,54 +49,17 @@ #include "MotionMaster.h" #include "DatabaseEnv.h" #include "Bag.h" -#else -#include "Config/Config.h" -#ifdef CMANGOS -#include "AI/AggressorAI.h" -#else -#include "AggressorAI.h" -#endif -#include "BattleGroundMgr.h" -#include "SQLStorages.h" -#include "revision.h" -#endif - -#if (!defined(TBC) && !defined(CLASSIC)) #include "Vehicle.h" -#endif - -#ifndef CLASSIC #include "ArenaTeam.h" -#endif -#ifndef 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 -#define CORE_NAME "MaNGOS" -#define CORE_VERSION REVISION_NR -#endif - -#ifdef CMANGOS -#define CORE_NAME "cMaNGOS" -#define CORE_VERSION REVISION_DATE " " REVISION_TIME -#endif - -#ifdef TRINITY -#define CORE_NAME "TrinityCore" -#define REGEN_TIME_FULL -#endif - -#ifdef AZEROTHCORE #define CORE_NAME "AzerothCore" -#endif -#if defined TRINITY || defined AZEROTHCORE #define CORE_VERSION (GitRevision::GetFullVersion()) #define eWorld (sWorld) #define eMapMgr (sMapMgr) @@ -118,42 +70,5 @@ typedef Opcodes OpcodesList; #define eAuctionMgr (sAuctionMgr) #define eGameEventMgr (sGameEventMgr) #define eObjectAccessor() ObjectAccessor:: -#endif - -#ifdef CATA -#define NUM_MSG_TYPES NUM_OPCODE_HANDLERS -#endif - -#if !defined TRINITY && !AZEROTHCORE -#define eWorld (&sWorld) -#define eMapMgr (&sMapMgr) -#define eConfigMgr (&sConfig) -#define eGuildMgr (&sGuildMgr) -#define eObjectMgr (&sObjectMgr) -#define eAccountMgr (&sAccountMgr) -#define eAuctionMgr (&sAuctionMgr) -#define eGameEventMgr (&sGameEventMgr) -#define eObjectAccessor() sObjectAccessor. -#define SERVER_MSG_STRING SERVER_MSG_CUSTOM -#define TOTAL_LOCALES MAX_LOCALE -#define TARGETICONCOUNT TARGET_ICON_COUNT -#define MAX_TALENT_SPECS MAX_TALENT_SPEC_COUNT -#define TEAM_NEUTRAL TEAM_INDEX_NEUTRAL - -#if defined(TBC) || defined(WOTLK) || defined(CATA) -#define PLAYER_FIELD_LIFETIME_HONORABLE_KILLS PLAYER_FIELD_LIFETIME_HONORBALE_KILLS -#endif - -#ifdef TBC -#define SPELL_AURA_MOD_KILL_XP_PCT SPELL_AURA_MOD_XP_PCT -#endif - -#if defined(CATA) || defined(MISTS) || (defined(WOTLK) && !defined(MANGOS)) -#define UNIT_BYTE2_FLAG_SANCTUARY UNIT_BYTE2_FLAG_SUPPORTABLE -#endif - -typedef TemporarySummon TempSummon; -typedef SpellEntry SpellInfo; -#endif // TRINITY #endif // _ELUNA_INCLUDES_H diff --git a/src/LuaEngine/ElunaInstanceAI.cpp b/src/LuaEngine/ElunaInstanceAI.cpp index 3f58012..731261a 100644 --- a/src/LuaEngine/ElunaInstanceAI.cpp +++ b/src/LuaEngine/ElunaInstanceAI.cpp @@ -9,7 +9,6 @@ #include "lmarshal.h" -#ifndef TRINITY void ElunaInstanceAI::Initialize() { LOCK_ELUNA; @@ -23,7 +22,6 @@ void ElunaInstanceAI::Initialize() sEluna->OnInitialize(this); } -#endif void ElunaInstanceAI::Load(const char* data) { @@ -84,9 +82,7 @@ void ElunaInstanceAI::Load(const char* data) lua_pop(L, 1); // Stack: (empty) -#ifndef TRINITY Initialize(); -#endif } } else @@ -96,9 +92,7 @@ void ElunaInstanceAI::Load(const char* data) lua_pop(L, 1); // Stack: (empty) -#ifndef TRINITY Initialize(); -#endif } delete[] decodedData; @@ -107,9 +101,7 @@ void ElunaInstanceAI::Load(const char* data) { ELUNA_LOG_ERROR("Error while decoding instance data: Data is not valid base-64"); -#ifndef TRINITY Initialize(); -#endif } } diff --git a/src/LuaEngine/ElunaInstanceAI.h b/src/LuaEngine/ElunaInstanceAI.h index 4da8323..b141a8e 100644 --- a/src/LuaEngine/ElunaInstanceAI.h +++ b/src/LuaEngine/ElunaInstanceAI.h @@ -8,15 +8,7 @@ #define _ELUNA_INSTANCE_DATA_H #include "LuaEngine.h" -#if defined(TRINITY) || AZEROTHCORE #include "InstanceScript.h" -#else -#include "InstanceData.h" -#endif - -#ifdef TRINITY -#include "Map.h" -#endif /* * This class is a small wrapper around `InstanceData`, @@ -64,35 +56,23 @@ private: std::string lastSaveData; public: -#ifdef TRINITY - ElunaInstanceAI(Map* map) : InstanceData(map->ToInstanceMap()) - { - } -#else ElunaInstanceAI(Map* map) : InstanceData(map) { } -#endif -#ifndef TRINITY void Initialize() override; -#endif /* * These are responsible for serializing/deserializing the instance's * data table to/from the core. */ void Load(const char* data) override; -#if defined TRINITY || AZEROTHCORE // 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; -#else - const char* Save() const override; -#endif /* @@ -139,11 +119,7 @@ public: sEluna->OnPlayerEnterInstance(this, player); } -#if defined TRINITY || AZEROTHCORE void OnGameObjectCreate(GameObject* gameobject) override -#else - void OnObjectCreate(GameObject* gameobject) override -#endif { sEluna->OnGameObjectCreate(this, gameobject); } diff --git a/src/LuaEngine/ElunaUtility.cpp b/src/LuaEngine/ElunaUtility.cpp index 9f436d6..4bc7cb8 100644 --- a/src/LuaEngine/ElunaUtility.cpp +++ b/src/LuaEngine/ElunaUtility.cpp @@ -10,9 +10,6 @@ #include "Unit.h" #include "GameObject.h" #include "DBCStores.h" -#ifdef MANGOS -#include "Timer.h" -#endif uint32 ElunaUtil::GetCurrTime() { @@ -72,26 +69,17 @@ bool ElunaUtil::WorldObjectInRangeCheck::operator()(WorldObject* u) target = go->GetOwner(); if (target) { -#ifdef CMANGOS - if (i_dead && (i_dead == 1) != target->isAlive()) - return false; -#else if (i_dead && (i_dead == 1) != target->IsAlive()) return false; -#endif + if (i_hostile) { if (!i_obj_unit) { if (i_obj_fact) { -#if defined TRINITY || AZEROTHCORE if ((i_obj_fact->IsHostileTo(*target->GetFactionTemplateEntry())) != (i_hostile == 1)) return false; -#else - if ((i_obj_fact->IsHostileTo(*target->getFactionTemplateEntry())) != (i_hostile == 1)) - return false; -#endif } else if (i_hostile == 1) return false; diff --git a/src/LuaEngine/ElunaUtility.h b/src/LuaEngine/ElunaUtility.h index ba6a5f8..024aba6 100644 --- a/src/LuaEngine/ElunaUtility.h +++ b/src/LuaEngine/ElunaUtility.h @@ -14,18 +14,9 @@ #include "Common.h" #include "SharedDefines.h" #include "ObjectGuid.h" -#ifdef TRINITY -#include "QueryResult.h" -#include "Log.h" -#ifdef CATA -#include "Object.h" -#endif -#else #include "Database/QueryResult.h" #include "Log.h" -#endif -#if defined(TRINITY) || defined(AZEROTHCORE) typedef QueryResult ElunaQuery; #define GET_GUID GetGUID #define HIGHGUID_PLAYER HighGuid::Player @@ -41,29 +32,11 @@ typedef QueryResult ElunaQuery; #define HIGHGUID_MO_TRANSPORT HighGuid::Mo_Transport #define HIGHGUID_INSTANCE HighGuid::Instance #define HIGHGUID_GROUP HighGuid::Group -#endif -#ifdef TRINITY -#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__); -#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__); -#else -typedef QueryNamedResult ElunaQuery; -#define ASSERT MANGOS_ASSERT -#define ELUNA_LOG_INFO(...) sLog.outString(__VA_ARGS__); -#define ELUNA_LOG_ERROR(...) sLog.outErrorEluna(__VA_ARGS__); -#define ELUNA_LOG_DEBUG(...) sLog.outDebug(__VA_ARGS__); -#define GET_GUID GetObjectGuid -#define GetGameObjectTemplate GetGameObjectInfo -#define GetItemTemplate GetItemPrototype -#define GetTemplate GetProto -#endif -#if defined(TRINITY) || defined(AZEROTHCORE) || defined(MANGOS) #ifndef MAKE_NEW_GUID #define MAKE_NEW_GUID(l, e, h) ObjectGuid(h, e, l) #endif @@ -76,7 +49,6 @@ typedef QueryNamedResult ElunaQuery; #ifndef GUID_HIPART #define GUID_HIPART(guid) ObjectGuid(guid).GetHigh() #endif -#endif class Unit; class WorldObject; diff --git a/src/LuaEngine/HttpManager.cpp b/src/LuaEngine/HttpManager.cpp index 80d6b29..1efdc9d 100644 --- a/src/LuaEngine/HttpManager.cpp +++ b/src/LuaEngine/HttpManager.cpp @@ -5,9 +5,8 @@ extern "C" #include "lauxlib.h" }; -#if defined TRINITY || defined AZEROTHCORE #define CPPHTTPLIB_OPENSSL_SUPPORT -#endif + #include "libs/httplib.h" #include "HttpManager.h" #include "LuaEngine.h" diff --git a/src/LuaEngine/LuaEngine.cpp b/src/LuaEngine/LuaEngine.cpp index db1c720..40cb155 100644 --- a/src/LuaEngine/LuaEngine.cpp +++ b/src/LuaEngine/LuaEngine.cpp @@ -16,35 +16,15 @@ #include "ElunaCreatureAI.h" #include "ElunaInstanceAI.h" -#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) -#if PLATFORM == PLATFORM_WINDOWS -#define ELUNA_WINDOWS -#endif -#else -#error Eluna could not determine platform -#endif // Some dummy includes containing BOOST_VERSION: // ObjectAccessor.h Config.h Log.h -#if !defined MANGOS #define USING_BOOST -#endif -#ifdef USING_BOOST #include -#else -#include -#include -#include -#endif extern "C" { @@ -72,11 +52,9 @@ void Eluna::Initialize() LOCK_ELUNA; ASSERT(!IsInitialized()); -#if defined TRINITY || AZEROTHCORE // For instance data the data column needs to be able to hold more than 255 characters (tinytext) // so we change it to TEXT automatically on startup CharacterDatabase.DirectExecute("ALTER TABLE `instance` CHANGE COLUMN `data` `data` TEXT NOT NULL"); -#endif LoadScriptPaths(); @@ -109,11 +87,7 @@ void Eluna::LoadScriptPaths() lua_scripts.clear(); lua_extensions.clear(); -#if defined(AZEROTHCORE) lua_folderpath = eConfigMgr->GetOption("Eluna.ScriptPath", "lua_scripts"); -#else - lua_folderpath = eConfigMgr->GetStringDefault("Eluna.ScriptPath", "lua_scripts"); -#endif #ifndef ELUNA_WINDOWS if (lua_folderpath[0] == '~') @@ -226,11 +200,7 @@ void Eluna::CloseLua() void Eluna::OpenLua() { -#if defined(AZEROTHCORE) enabled = eConfigMgr->GetOption("Eluna.Enabled", true); -#else - enabled = eConfigMgr->GetBoolDefault("Eluna.Enabled", true); -#endif if (!IsEnabled()) { @@ -363,7 +333,6 @@ void Eluna::GetScripts(std::string path) { ELUNA_LOG_DEBUG("[Eluna]: GetScripts from path `{}`", path); -#ifdef USING_BOOST boost::filesystem::path someDir(path); boost::filesystem::directory_iterator end_iter; @@ -405,53 +374,6 @@ void Eluna::GetScripts(std::string path) } } } -#else - ACE_Dirent dir; - if (dir.open(path.c_str()) == -1) // Error opening directory, return - return; - - lua_requirepath += - path + "/?.lua;" + - path + "/?.ext;" + - path + "/?.dll;" + - path + "/?.so;"; - - ACE_DIRENT *directory = 0; - while ((directory = dir.read())) - { - // Skip the ".." and "." files. - if (ACE::isdotdir(directory->d_name)) - continue; - - std::string fullpath = path + "/" + directory->d_name; - - // Check if file is hidden -#ifdef ELUNA_WINDOWS - DWORD dwAttrib = GetFileAttributes(fullpath.c_str()); - if (dwAttrib != INVALID_FILE_ATTRIBUTES && (dwAttrib & FILE_ATTRIBUTE_HIDDEN)) - continue; -#else - std::string name = directory->d_name; - if (name[0] == '.') - continue; -#endif - - ACE_stat stat_buf; - if (ACE_OS::lstat(fullpath.c_str(), &stat_buf) == -1) - continue; - - // load subfolder - if ((stat_buf.st_mode & S_IFMT) == (S_IFDIR)) - { - GetScripts(fullpath); - continue; - } - - // was file, try add - std::string filename = directory->d_name; - AddScriptPath(filename, fullpath); - } -#endif } static bool ScriptPathComparator(const LuaScript& first, const LuaScript& second) @@ -540,11 +462,7 @@ void Eluna::RunScripts() void Eluna::InvalidateObjects() { ++callstackid; -#ifdef TRINITY - ASSERT(callstackid, "Callstackid overflow"); -#else ASSERT(callstackid && "Callstackid overflow"); -#endif } void Eluna::Report(lua_State* _L) @@ -600,12 +518,7 @@ bool Eluna::ExecuteCall(int params, int res) ASSERT(false); // stack probably corrupt } -#if defined(AZEROTHCORE) bool usetrace = eConfigMgr->GetOption("Eluna.TraceBack", false); -#else - bool usetrace = eConfigMgr->GetBoolDefault("Eluna.TraceBack", false); -#endif - if (usetrace) { lua_pushcfunction(L, &StackTrace); diff --git a/src/LuaEngine/LuaEngine.h b/src/LuaEngine/LuaEngine.h index af0a5d5..b6869f1 100644 --- a/src/LuaEngine/LuaEngine.h +++ b/src/LuaEngine/LuaEngine.h @@ -14,9 +14,7 @@ #include "Group.h" #include "Item.h" #include "Chat.h" -#ifndef TRINITY #include "Player.h" -#endif #include "Weather.h" #include "World.h" #include "Hooks.h" @@ -32,46 +30,23 @@ 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 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 Item; class Pet; @@ -79,26 +54,12 @@ class Player; class Quest; class Spell; class SpellCastTargets; -#if defined(TRINITY) || AZEROTHCORE class 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 -class VehicleInfo; -typedef VehicleInfo Vehicle; -#endif -#endif -#endif struct lua_State; class EventMgr; @@ -121,13 +82,7 @@ struct LuaScript #define ELUNA_STATE_PTR "Eluna State Ptr" #define LOCK_ELUNA Eluna::Guard __guard(Eluna::GetLock()) -#if defined(TRINITY) -#define ELUNA_GAME_API TC_GAME_API -#elif defined(AZEROTHCORE) #define ELUNA_GAME_API AC_GAME_API -#else -#define ELUNA_GAME_API -#endif class ELUNA_GAME_API Eluna { @@ -429,12 +384,8 @@ public: 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 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); void UpdateAI(GameObject* pGameObject, uint32 diff); @@ -492,16 +443,12 @@ public: void OnBattlegroundDesertion(Player* player, const BattlegroundDesertionType type); void OnCreatureKilledByPet(Player* player, Creature* killed); -#ifndef CLASSIC -#ifndef 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 */ bool OnAreaTrigger(Player* pPlayer, AreaTriggerEntry const* pTrigger); @@ -560,11 +507,7 @@ public: /* 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(); @@ -574,11 +517,7 @@ public: /* 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/src/LuaEngine/LuaFunctions.cpp b/src/LuaEngine/LuaFunctions.cpp index a4c75b0..9868b75 100644 --- a/src/LuaEngine/LuaFunctions.cpp +++ b/src/LuaEngine/LuaFunctions.cpp @@ -212,10 +212,8 @@ ElunaRegister WorldObjectMethods[] = // Getters { "GetName", &LuaWorldObject::GetName }, { "GetMap", &LuaWorldObject::GetMap }, -#if (!defined(TBC) && !defined(CLASSIC)) { "GetPhaseMask", &LuaWorldObject::GetPhaseMask }, { "SetPhaseMask", &LuaWorldObject::SetPhaseMask }, -#endif { "GetInstanceId", &LuaWorldObject::GetInstanceId }, { "GetAreaId", &LuaWorldObject::GetAreaId }, { "GetZoneId", &LuaWorldObject::GetZoneId }, @@ -301,9 +299,7 @@ ElunaRegister UnitMethods[] = { "GetCharmerGUID", &LuaUnit::GetCharmerGUID }, { "GetCharmGUID", &LuaUnit::GetCharmGUID }, { "GetPetGUID", &LuaUnit::GetPetGUID }, -#if (!defined(TBC) && !defined(CLASSIC)) { "GetCritterGUID", &LuaUnit::GetCritterGUID }, -#endif { "GetControllerGUID", &LuaUnit::GetControllerGUID }, { "GetControllerGUIDS", &LuaUnit::GetControllerGUIDS }, { "GetStandState", &LuaUnit::GetStandState }, @@ -312,10 +308,8 @@ ElunaRegister UnitMethods[] = { "GetSpeedRate", &LuaUnit::GetSpeedRate }, { "GetStat", &LuaUnit::GetStat }, { "GetBaseSpellPower", &LuaUnit::GetBaseSpellPower }, -#if (!defined(TBC) && !defined(CLASSIC)) { "GetVehicleKit", &LuaUnit::GetVehicleKit }, // {"GetVehicle", &LuaUnit::GetVehicle}, // :GetVehicle() - UNDOCUMENTED - Gets the Vehicle kit of the vehicle the unit is on -#endif { "GetMovementType", &LuaUnit::GetMovementType }, { "GetAttackers", &LuaUnit::GetAttackers }, @@ -338,10 +332,8 @@ ElunaRegister UnitMethods[] = {"SetConfused", &LuaUnit::SetConfused}, {"SetFeared", &LuaUnit::SetFeared}, { "SetPvP", &LuaUnit::SetPvP }, -#if (!defined(TBC) && !defined(CLASSIC)) { "SetFFA", &LuaUnit::SetFFA }, { "SetSanctuary", &LuaUnit::SetSanctuary }, -#endif // {"SetCanFly", &LuaUnit::SetCanFly}, // :SetCanFly(apply) - UNDOCUMENTED // {"SetVisible", &LuaUnit::SetVisible}, // :SetVisible(x) - UNDOCUMENTED { "SetOwnerGUID", &LuaUnit::SetOwnerGUID }, @@ -350,9 +342,7 @@ ElunaRegister UnitMethods[] = { "SetCreatorGUID", &LuaUnit::SetCreatorGUID }, { "SetMinionGUID", &LuaUnit::SetPetGUID }, { "SetPetGUID", &LuaUnit::SetPetGUID }, -#if (!defined(TBC) && !defined(CLASSIC)) { "SetCritterGUID", &LuaUnit::SetCritterGUID }, -#endif { "SetWaterWalk", &LuaUnit::SetWaterWalk }, { "SetStandState", &LuaUnit::SetStandState }, { "SetInCombatWith", &LuaUnit::SetInCombatWith }, @@ -401,18 +391,14 @@ ElunaRegister UnitMethods[] = { "HasAura", &LuaUnit::HasAura }, { "IsCasting", &LuaUnit::IsCasting }, { "IsStandState", &LuaUnit::IsStandState }, -#ifndef CLASSIC { "IsOnVehicle", &LuaUnit::IsOnVehicle }, -#endif // Other { "HandleStatModifier", &LuaUnit::HandleStatModifier }, { "AddAura", &LuaUnit::AddAura }, { "RemoveAura", &LuaUnit::RemoveAura }, { "RemoveAllAuras", &LuaUnit::RemoveAllAuras }, -#if !defined(CLASSIC) { "RemoveArenaAuras", &LuaUnit::RemoveArenaAuras }, -#endif { "ClearInCombat", &LuaUnit::ClearInCombat }, { "DeMorph", &LuaUnit::DeMorph }, { "SendUnitWhisper", &LuaUnit::SendUnitWhisper }, @@ -451,9 +437,7 @@ ElunaRegister UnitMethods[] = { "MoveConfused", &LuaUnit::MoveConfused }, { "MoveFleeing", &LuaUnit::MoveFleeing }, { "MoveTo", &LuaUnit::MoveTo }, -#if (!defined(TBC) && !defined(CLASSIC)) { "MoveJump", &LuaUnit::MoveJump }, -#endif { "MoveStop", &LuaUnit::MoveStop }, { "MoveExpire", &LuaUnit::MoveExpire }, { "MoveClear", &LuaUnit::MoveClear }, @@ -479,10 +463,8 @@ ElunaRegister PlayerMethods[] = { "GetAccountId", &LuaPlayer::GetAccountId }, { "GetAccountName", &LuaPlayer::GetAccountName }, { "GetCompletedQuestsCount", &LuaPlayer::GetCompletedQuestsCount }, -#if defined (TBC) || defined (WOTLK) { "GetArenaPoints", &LuaPlayer::GetArenaPoints }, { "GetHonorPoints", &LuaPlayer::GetHonorPoints }, -#endif { "GetLifetimeKills", &LuaPlayer::GetLifetimeKills }, { "GetPlayerIP", &LuaPlayer::GetPlayerIP }, { "GetLevelPlayedTime", &LuaPlayer::GetLevelPlayedTime }, @@ -497,11 +479,9 @@ ElunaRegister PlayerMethods[] = { "GetQuestLevel", &LuaPlayer::GetQuestLevel }, { "GetChatTag", &LuaPlayer::GetChatTag }, { "GetRestBonus", &LuaPlayer::GetRestBonus }, -#ifdef WOTLK { "GetPhaseMaskForSpawn", &LuaPlayer::GetPhaseMaskForSpawn }, { "GetAchievementPoints", &LuaPlayer::GetAchievementPoints }, { "GetCompletedAchievementsCount", &LuaPlayer::GetCompletedAchievementsCount }, -#endif { "GetReqKillOrCastCurrentCount", &LuaPlayer::GetReqKillOrCastCurrentCount }, { "GetQuestStatus", &LuaPlayer::GetQuestStatus }, { "GetInGameTime", &LuaPlayer::GetInGameTime }, @@ -509,10 +489,8 @@ ElunaRegister PlayerMethods[] = { "GetComboTarget", &LuaPlayer::GetComboTarget }, { "GetGuildName", &LuaPlayer::GetGuildName }, { "GetFreeTalentPoints", &LuaPlayer::GetFreeTalentPoints }, -#if (!defined(TBC) && !defined(CLASSIC)) { "GetActiveSpec", &LuaPlayer::GetActiveSpec }, { "GetSpecsCount", &LuaPlayer::GetSpecsCount }, -#endif { "GetSpellCooldownDelay", &LuaPlayer::GetSpellCooldownDelay }, { "GetGuildRank", &LuaPlayer::GetGuildRank }, { "GetDifficulty", &LuaPlayer::GetDifficulty }, @@ -536,9 +514,7 @@ ElunaRegister PlayerMethods[] = { "GetNextRandomRaidMember", &LuaPlayer::GetNextRandomRaidMember }, { "GetOriginalGroup", &LuaPlayer::GetOriginalGroup }, { "GetOriginalSubGroup", &LuaPlayer::GetOriginalSubGroup }, -#if defined(TRINITY) || AZEROTHCORE { "GetChampioningFaction", &LuaPlayer::GetChampioningFaction }, -#endif { "GetLatency", &LuaPlayer::GetLatency }, // {"GetRecruiterId", &LuaPlayer::GetRecruiterId}, // :GetRecruiterId() - UNDOCUMENTED - Returns player's recruiter's ID { "GetDbLocaleIndex", &LuaPlayer::GetDbLocaleIndex }, @@ -546,14 +522,7 @@ ElunaRegister PlayerMethods[] = { "GetCorpse", &LuaPlayer::GetCorpse }, { "GetGossipTextId", &LuaPlayer::GetGossipTextId }, { "GetQuestRewardStatus", &LuaPlayer::GetQuestRewardStatus }, -#if defined(CLASSIC) || defined(TBC) || defined(WOTLK) { "GetShieldBlockValue", &LuaPlayer::GetShieldBlockValue }, -#endif -#ifdef CLASSIC - { "GetHonorStoredKills", &LuaPlayer::GetHonorStoredKills }, - { "GetRankPoints", &LuaPlayer::GetRankPoints }, - { "GetHonorLastWeekStandingPos", &LuaPlayer::GetHonorLastWeekStandingPos }, -#endif { "GetPlayerSettingValue", &LuaPlayer::GetPlayerSettingValue }, { "GetTrader", &LuaPlayer::GetTrader }, @@ -563,20 +532,11 @@ ElunaRegister PlayerMethods[] = { "AdvanceAllSkills", &LuaPlayer::AdvanceAllSkills }, { "AddLifetimeKills", &LuaPlayer::AddLifetimeKills }, { "SetCoinage", &LuaPlayer::SetCoinage }, -#ifndef CLASSIC { "SetKnownTitle", &LuaPlayer::SetKnownTitle }, { "UnsetKnownTitle", &LuaPlayer::UnsetKnownTitle }, -#endif { "SetBindPoint", &LuaPlayer::SetBindPoint }, -#if defined(TBC) || defined(WOTLK) { "SetArenaPoints", &LuaPlayer::SetArenaPoints }, { "SetHonorPoints", &LuaPlayer::SetHonorPoints }, -#endif -#ifdef CLASSIC - { "SetHonorStoredKills", &LuaPlayer::SetHonorStoredKills }, - { "SetRankPoints", &LuaPlayer::SetRankPoints }, - { "SetHonorLastWeekStandingPos", &LuaPlayer::SetHonorLastWeekStandingPos }, -#endif { "SetSpellPower", &LuaPlayer::SetSpellPower }, { "SetLifetimeKills", &LuaPlayer::SetLifetimeKills }, { "SetGameMaster", &LuaPlayer::SetGameMaster }, @@ -598,9 +558,6 @@ ElunaRegister PlayerMethods[] = { "SetPlayerLock", &LuaPlayer::SetPlayerLock }, { "SetGender", &LuaPlayer::SetGender }, { "SetSheath", &LuaPlayer::SetSheath }, -#if !defined TRINITY && !AZEROTHCORE - { "SetFFA", &LuaPlayer::SetFFA }, -#endif // Boolean { "HasTankSpec", &LuaPlayer::HasTankSpec }, @@ -613,15 +570,11 @@ ElunaRegister PlayerMethods[] = { "IsImmuneToDamage", &LuaPlayer::IsImmuneToDamage }, { "IsAlliance", &LuaPlayer::IsAlliance }, { "IsHorde", &LuaPlayer::IsHorde }, -#ifndef CLASSIC { "HasTitle", &LuaPlayer::HasTitle }, -#endif { "HasItem", &LuaPlayer::HasItem }, { "Teleport", &LuaPlayer::Teleport }, { "AddItem", &LuaPlayer::AddItem }, -#ifndef CLASSIC { "IsInArenaTeam", &LuaPlayer::IsInArenaTeam }, -#endif { "CanRewardQuest", &LuaPlayer::CanRewardQuest }, { "CanCompleteRepeatableQuest", &LuaPlayer::CanCompleteRepeatableQuest }, { "CanCompleteQuest", &LuaPlayer::CanCompleteQuest }, @@ -642,13 +595,9 @@ ElunaRegister PlayerMethods[] = { "HasAtLoginFlag", &LuaPlayer::HasAtLoginFlag }, // {"InRandomLfgDungeon", &LuaPlayer::InRandomLfgDungeon}, // :InRandomLfgDungeon() - UNDOCUMENTED - Returns true if the player is in a random LFG dungeon // {"HasPendingBind", &LuaPlayer::HasPendingBind}, // :HasPendingBind() - UNDOCUMENTED - Returns true if the player has a pending instance bind -#if (!defined(TBC) && !defined(CLASSIC)) { "HasAchieved", &LuaPlayer::HasAchieved }, { "GetAchievementCriteriaProgress", &LuaPlayer::GetAchievementCriteriaProgress }, -#if defined(TRINITY) || defined(AZEROTHCORE) { "SetAchievement", &LuaPlayer::SetAchievement }, -#endif -#endif { "CanUninviteFromGroup", &LuaPlayer::CanUninviteFromGroup }, { "IsRested", &LuaPlayer::IsRested }, // {"CanFlyInZone", &LuaPlayer::CanFlyInZone}, // :CanFlyInZone(mapid, zone) - UNDOCUMENTED - Returns true if the player can fly in the area @@ -659,9 +608,7 @@ ElunaRegister PlayerMethods[] = { "HasQuestForGO", &LuaPlayer::HasQuestForGO }, { "CanShareQuest", &LuaPlayer::CanShareQuest }, // {"HasReceivedQuestReward", &LuaPlayer::HasReceivedQuestReward}, // :HasReceivedQuestReward(entry) - UNDOCUMENTED - Returns true if the player has recieved the quest's reward -#if (!defined(TBC) && !defined(CLASSIC)) { "HasTalent", &LuaPlayer::HasTalent }, -#endif { "IsInSameGroupWith", &LuaPlayer::IsInSameGroupWith }, { "IsInSameRaidWith", &LuaPlayer::IsInSameRaidWith }, { "IsGroupVisibleFor", &LuaPlayer::IsGroupVisibleFor }, @@ -669,26 +616,18 @@ ElunaRegister PlayerMethods[] = { "IsHonorOrXPTarget", &LuaPlayer::IsHonorOrXPTarget }, { "CanParry", &LuaPlayer::CanParry }, { "CanBlock", &LuaPlayer::CanBlock }, -#if (!defined(TBC) && !defined(CLASSIC)) { "CanTitanGrip", &LuaPlayer::CanTitanGrip }, -#endif { "InBattleground", &LuaPlayer::InBattleground }, -#ifndef CLASSIC { "InArena", &LuaPlayer::InArena }, -#endif // {"IsOutdoorPvPActive", &LuaPlayer::IsOutdoorPvPActive}, // :IsOutdoorPvPActive() - UNDOCUMENTED - Returns true if the player is outdoor pvp active // {"IsARecruiter", &LuaPlayer::IsARecruiter}, // :IsARecruiter() - UNDOCUMENTED - Returns true if the player is a recruiter { "CanUseItem", &LuaPlayer::CanUseItem }, { "HasSpell", &LuaPlayer::HasSpell }, { "HasSpellCooldown", &LuaPlayer::HasSpellCooldown }, { "IsInWater", &LuaPlayer::IsInWater }, -#ifndef CLASSIC { "CanFly", &LuaPlayer::CanFly }, -#endif { "IsMoving", &LuaPlayer::IsMoving }, -#ifndef CLASSIC { "IsFlying", &LuaPlayer::IsFlying }, -#endif // Gossip { "GossipMenuAddItem", &LuaPlayer::GossipMenuAddItem }, @@ -709,9 +648,7 @@ ElunaRegister PlayerMethods[] = { "RunCommand", &LuaPlayer::RunCommand }, { "SetGlyph", &LuaPlayer::SetGlyph }, { "GetGlyph", &LuaPlayer::GetGlyph }, -#if !defined(CLASSIC) { "RemoveArenaSpellCooldowns", &LuaPlayer::RemoveArenaSpellCooldowns }, -#endif { "RemoveItem", &LuaPlayer::RemoveItem }, { "RemoveLifetimeKills", &LuaPlayer::RemoveLifetimeKills }, { "ResurrectPlayer", &LuaPlayer::ResurrectPlayer }, @@ -739,9 +676,7 @@ ElunaRegister PlayerMethods[] = // {"KilledPlayerCredit", &LuaPlayer::KilledPlayerCredit}, // :KilledPlayerCredit() - UNDOCUMENTED - Satisfies a player kill for the player // {"KillGOCredit", &LuaPlayer::KillGOCredit}, // :KillGOCredit(GOEntry[, GUID]) - UNDOCUMENTED - Credits the player for destroying a GO, guid is optional { "TalkedToCreature", &LuaPlayer::TalkedToCreature }, -#if (!defined(TBC) && !defined(CLASSIC)) { "ResetPetTalents", &LuaPlayer::ResetPetTalents }, -#endif { "AddComboPoints", &LuaPlayer::AddComboPoints }, // {"GainSpellComboPoints", &LuaPlayer::GainSpellComboPoints}, // :GainSpellComboPoints(amount) - UNDOCUMENTED - Player gains spell combo points { "ClearComboPoints", &LuaPlayer::ClearComboPoints }, @@ -758,18 +693,14 @@ ElunaRegister PlayerMethods[] = { "DurabilityPointLossForEquipSlot", &LuaPlayer::DurabilityPointLossForEquipSlot }, { "DurabilityRepairAll", &LuaPlayer::DurabilityRepairAll }, { "DurabilityRepair", &LuaPlayer::DurabilityRepair }, -#if defined(TBC) || defined(WOTLK) { "ModifyHonorPoints", &LuaPlayer::ModifyHonorPoints }, { "ModifyArenaPoints", &LuaPlayer::ModifyArenaPoints }, -#endif { "LeaveBattleground", &LuaPlayer::LeaveBattleground }, // {"BindToInstance", &LuaPlayer::BindToInstance}, // :BindToInstance() - UNDOCUMENTED - Binds the player to the current instance { "UnbindInstance", &LuaPlayer::UnbindInstance }, { "UnbindAllInstances", &LuaPlayer::UnbindAllInstances }, { "RemoveFromBattlegroundRaid", &LuaPlayer::RemoveFromBattlegroundRaid }, -#if (!defined(TBC) && !defined(CLASSIC)) { "ResetAchievements", &LuaPlayer::ResetAchievements }, -#endif { "KickPlayer", &LuaPlayer::KickPlayer }, { "LogoutPlayer", &LuaPlayer::LogoutPlayer }, { "SendTrainerList", &LuaPlayer::SendTrainerList }, @@ -795,14 +726,7 @@ ElunaRegister PlayerMethods[] = { "GroupInvite", &LuaPlayer::GroupInvite }, { "GroupCreate", &LuaPlayer::GroupCreate }, { "SendCinematicStart", &LuaPlayer::SendCinematicStart }, -#if !defined(CLASSIC) && !defined(TBC) { "SendMovieStart", &LuaPlayer::SendMovieStart }, -#endif -#ifdef CLASSIC - { "UpdateHonor", &LuaPlayer::UpdateHonor }, - { "ResetHonor", &LuaPlayer::ResetHonor }, - { "ClearHonorInfo", &LuaPlayer::ClearHonorInfo }, -#endif { "UpdatePlayerSetting", &LuaPlayer::UpdatePlayerSetting }, { NULL, NULL } @@ -820,18 +744,13 @@ ElunaRegister CreatureMethods[] = { "GetScriptId", &LuaCreature::GetScriptId }, { "GetAIName", &LuaCreature::GetAIName }, { "GetScriptName", &LuaCreature::GetScriptName }, -#ifndef AZEROTHCORE - { "GetAttackDistance", &LuaCreature::GetAttackDistance }, -#endif { "GetAggroRange", &LuaCreature::GetAggroRange }, { "GetDefaultMovementType", &LuaCreature::GetDefaultMovementType }, { "GetRespawnDelay", &LuaCreature::GetRespawnDelay }, { "GetWanderRadius", &LuaCreature::GetWanderRadius }, { "GetCurrentWaypointId", &LuaCreature::GetCurrentWaypointId }, -#if defined(TRINITY) || AZEROTHCORE { "GetWaypointPath", &LuaCreature::GetWaypointPath }, { "GetLootMode", &LuaCreature::GetLootMode }, -#endif { "GetLootRecipient", &LuaCreature::GetLootRecipient }, { "GetLootRecipientGroup", &LuaCreature::GetLootRecipientGroup }, { "GetNPCFlags", &LuaCreature::GetNPCFlags }, @@ -839,16 +758,12 @@ ElunaRegister CreatureMethods[] = { "GetUnitFlagsTwo", &LuaCreature::GetUnitFlagsTwo }, { "GetExtraFlags", &LuaCreature::GetExtraFlags }, { "GetRank", &LuaCreature::GetRank }, -#if defined(CLASSIC) || defined(TBC) || defined(WOTLK) { "GetShieldBlockValue", &LuaCreature::GetShieldBlockValue }, -#endif { "GetDBTableGUIDLow", &LuaCreature::GetDBTableGUIDLow }, { "GetCreatureFamily", &LuaCreature::GetCreatureFamily }, // Setters -#if defined(TRINITY) || defined(AZEROTHCORE) { "SetRegeneratingHealth", &LuaCreature::SetRegeneratingHealth }, -#endif { "SetHover", &LuaCreature::SetHover }, { "SetDisableGravity", &LuaCreature::SetDisableGravity }, { "SetAggroEnabled", &LuaCreature::SetAggroEnabled }, @@ -859,15 +774,11 @@ ElunaRegister CreatureMethods[] = { "SetWanderRadius", &LuaCreature::SetWanderRadius }, { "SetInCombatWithZone", &LuaCreature::SetInCombatWithZone }, { "SetDisableReputationGain", &LuaCreature::SetDisableReputationGain }, -#if defined(TRINITY) || AZEROTHCORE { "SetLootMode", &LuaCreature::SetLootMode }, -#endif { "SetNPCFlags", &LuaCreature::SetNPCFlags }, { "SetUnitFlags", &LuaCreature::SetUnitFlags }, { "SetUnitFlagsTwo", &LuaCreature::SetUnitFlagsTwo }, -#if defined(TRINITY) || AZEROTHCORE { "SetReactState", &LuaCreature::SetReactState }, -#endif { "SetDeathState", &LuaCreature::SetDeathState }, { "SetWalk", &LuaCreature::SetWalk }, { "SetHomePosition", &LuaCreature::SetHomePosition }, @@ -875,15 +786,11 @@ ElunaRegister CreatureMethods[] = // Boolean { "IsRegeneratingHealth", &LuaCreature::IsRegeneratingHealth }, -#if defined(TRINITY) || defined(AZEROTHCORE) { "IsDungeonBoss", &LuaCreature::IsDungeonBoss }, -#endif { "IsWorldBoss", &LuaCreature::IsWorldBoss }, { "IsRacialLeader", &LuaCreature::IsRacialLeader }, { "IsCivilian", &LuaCreature::IsCivilian }, -#if defined(TRINITY) || AZEROTHCORE { "IsTrigger", &LuaCreature::IsTrigger }, -#endif { "IsGuard", &LuaCreature::IsGuard }, { "IsElite", &LuaCreature::IsElite }, { "IsInEvadeMode", &LuaCreature::IsInEvadeMode }, @@ -891,9 +798,7 @@ ElunaRegister CreatureMethods[] = { "CanWalk", &LuaCreature::CanWalk }, { "CanSwim", &LuaCreature::CanSwim }, { "CanAggro", &LuaCreature::CanAggro }, -#if defined(TRINITY) || AZEROTHCORE { "CanStartAttack", &LuaCreature::CanStartAttack }, -#endif { "HasSearchedAssistance", &LuaCreature::HasSearchedAssistance }, { "IsTappedBy", &LuaCreature::IsTappedBy }, { "HasLootRecipient", &LuaCreature::HasLootRecipient }, @@ -901,10 +806,8 @@ ElunaRegister CreatureMethods[] = { "IsTargetableForAttack", &LuaCreature::IsTargetableForAttack }, { "CanCompleteQuest", &LuaCreature::CanCompleteQuest }, { "IsReputationGainDisabled", &LuaCreature::IsReputationGainDisabled }, -#if defined(TRINITY) || AZEROTHCORE { "IsDamageEnoughForLootingAndReward", &LuaCreature::IsDamageEnoughForLootingAndReward }, { "HasLootMode", &LuaCreature::HasLootMode }, -#endif { "HasSpell", &LuaCreature::HasSpell }, { "HasQuest", &LuaCreature::HasQuest }, { "HasSpellCooldown", &LuaCreature::HasSpellCooldown }, @@ -918,11 +821,9 @@ ElunaRegister CreatureMethods[] = { "DespawnOrUnsummon", &LuaCreature::DespawnOrUnsummon }, { "Respawn", &LuaCreature::Respawn }, { "AttackStart", &LuaCreature::AttackStart }, -#if defined(TRINITY) || AZEROTHCORE { "AddLootMode", &LuaCreature::AddLootMode }, { "ResetLootMode", &LuaCreature::ResetLootMode }, { "RemoveLootMode", &LuaCreature::RemoveLootMode }, -#endif { "SaveToDB", &LuaCreature::SaveToDB }, { "SelectVictim", &LuaCreature::SelectVictim }, { "MoveWaypoint", &LuaCreature::MoveWaypoint }, @@ -990,13 +891,9 @@ ElunaRegister ItemMethods[] = { "GetAllowableRace", &LuaItem::GetAllowableRace }, { "GetItemLevel", &LuaItem::GetItemLevel }, { "GetRequiredLevel", &LuaItem::GetRequiredLevel }, -#ifdef WOTLK { "GetStatsCount", &LuaItem::GetStatsCount }, -#endif { "GetRandomProperty", &LuaItem::GetRandomProperty }, -#ifndef CLASSIC { "GetRandomSuffix", &LuaItem::GetRandomSuffix }, -#endif { "GetItemSet", &LuaItem::GetItemSet }, { "GetBagSize", &LuaItem::GetBagSize }, { "GetItemTemplate", &LuaItem::GetItemTemplate }, @@ -1008,16 +905,12 @@ ElunaRegister ItemMethods[] = // Boolean { "IsSoulBound", &LuaItem::IsSoulBound }, -#if (!defined(TBC) && !defined(CLASSIC)) { "IsBoundAccountWide", &LuaItem::IsBoundAccountWide }, -#endif { "IsBoundByEnchant", &LuaItem::IsBoundByEnchant }, { "IsNotBoundToPlayer", &LuaItem::IsNotBoundToPlayer }, { "IsLocked", &LuaItem::IsLocked }, { "IsBag", &LuaItem::IsBag }, -#ifndef CLASSIC { "IsCurrencyToken", &LuaItem::IsCurrencyToken }, -#endif { "IsNotEmptyBag", &LuaItem::IsNotEmptyBag }, { "IsBroken", &LuaItem::IsBroken }, { "CanBeTraded", &LuaItem::CanBeTraded }, @@ -1026,10 +919,8 @@ ElunaRegister ItemMethods[] = { "IsEquipped", &LuaItem::IsEquipped }, { "HasQuest", &LuaItem::HasQuest }, { "IsPotion", &LuaItem::IsPotion }, -#if defined(CLASSIC) || defined(TBC) || defined(WOTLK) { "IsWeaponVellum", &LuaItem::IsWeaponVellum }, { "IsArmorVellum", &LuaItem::IsArmorVellum }, -#endif { "IsConjuredConsumable", &LuaItem::IsConjuredConsumable }, //{"IsRefundExpired", &LuaItem::IsRefundExpired}, // :IsRefundExpired() - UNDOCUMENTED - Returns true if the item's refund time has expired { "SetEnchantment", &LuaItem::SetEnchantment }, @@ -1126,9 +1017,7 @@ ElunaRegister QuestMethods[] = // Boolean { "HasFlag", &LuaQuest::HasFlag }, -#ifndef CLASSIC { "IsDaily", &LuaQuest::IsDaily }, -#endif { "IsRepeatable", &LuaQuest::IsRepeatable }, { NULL, NULL } @@ -1187,13 +1076,9 @@ ElunaRegister GuildMethods[] = { "GetMemberCount", &LuaGuild::GetMemberCount }, // Setters -#ifndef CLASSIC { "SetBankTabText", &LuaGuild::SetBankTabText }, -#endif { "SetMemberRank", &LuaGuild::SetMemberRank }, -#if defined(CLASSIC) || defined(TBC) || defined(WOTLK) { "SetLeader", &LuaGuild::SetLeader }, -#endif // Other { "SendPacket", &LuaGuild::SendPacket }, @@ -1205,8 +1090,6 @@ ElunaRegister GuildMethods[] = { NULL, NULL } }; -#ifndef CLASSIC -#ifndef TBC ElunaRegister VehicleMethods[] = { // Getters @@ -1223,8 +1106,6 @@ ElunaRegister VehicleMethods[] = { NULL, NULL } }; -#endif -#endif ElunaRegister QueryMethods[] = { @@ -1306,15 +1187,11 @@ ElunaRegister MapMethods[] = { "SetWeather", &LuaMap::SetWeather }, // Boolean -#ifndef CLASSIC { "IsArena", &LuaMap::IsArena }, -#endif { "IsBattleground", &LuaMap::IsBattleground }, { "IsDungeon", &LuaMap::IsDungeon }, { "IsEmpty", &LuaMap::IsEmpty }, -#ifndef CLASSIC { "IsHeroic", &LuaMap::IsHeroic }, -#endif { "IsRaid", &LuaMap::IsRaid }, // Other @@ -1349,9 +1226,6 @@ ElunaRegister BattleGroundMethods[] = { "GetAlivePlayersCountByTeam", &LuaBattleGround::GetAlivePlayersCountByTeam }, { "GetMap", &LuaBattleGround::GetMap }, { "GetBonusHonorFromKillCount", &LuaBattleGround::GetBonusHonorFromKillCount }, -#ifndef AZEROTHCORE - { "GetBracketId", &LuaBattleGround::GetBracketId }, -#endif { "GetEndTime", &LuaBattleGround::GetEndTime }, { "GetFreeSlotsForTeam", &LuaBattleGround::GetFreeSlotsForTeam }, { "GetInstanceId", &LuaBattleGround::GetInstanceId }, @@ -1416,7 +1290,6 @@ ElunaRegister RollMethods[] = { NULL, NULL } }; -#if (!defined(TBC) && !defined(CLASSIC)) // fix compile error about accessing vehicle destructor template<> int ElunaTemplate::CollectGarbage(lua_State* L) { @@ -1427,7 +1300,6 @@ template<> int ElunaTemplate::CollectGarbage(lua_State* L) delete obj; return 0; } -#endif // Template by Mud from http://stackoverflow.com/questions/4484437/lua-integer-type/4485511#4485511 template<> int ElunaTemplate::Add(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL(L, 1) + Eluna::CHECKVAL(L, 2)); return 1; } @@ -1521,12 +1393,8 @@ void RegisterFunctions(Eluna* E) ElunaTemplate::Register(E, "ItemTemplate"); ElunaTemplate::SetMethods(E, ItemTemplateMethods); -#ifndef CLASSIC -#ifndef TBC ElunaTemplate::Register(E, "Vehicle"); ElunaTemplate::SetMethods(E, VehicleMethods); -#endif -#endif ElunaTemplate::Register(E, "Group"); ElunaTemplate::SetMethods(E, GroupMethods); diff --git a/src/LuaEngine/hooks/BattleGroundHooks.cpp b/src/LuaEngine/hooks/BattleGroundHooks.cpp index 497256d..713a6de 100644 --- a/src/LuaEngine/hooks/BattleGroundHooks.cpp +++ b/src/LuaEngine/hooks/BattleGroundHooks.cpp @@ -29,11 +29,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); Push(bg); diff --git a/src/LuaEngine/hooks/CreatureHooks.cpp b/src/LuaEngine/hooks/CreatureHooks.cpp index e2bd6d1..2450525 100644 --- a/src/LuaEngine/hooks/CreatureHooks.cpp +++ b/src/LuaEngine/hooks/CreatureHooks.cpp @@ -301,8 +301,6 @@ bool Eluna::SpellHitTarget(Creature* me, WorldObject* target, SpellInfo const* s return CallAllFunctionsBool(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key); } -#if defined TRINITY || AZEROTHCORE - bool Eluna::SummonedCreatureDies(Creature* me, Creature* summon, Unit* killer) { START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_SUMMONED_CREATURE_DIED, me, false); @@ -329,5 +327,3 @@ bool Eluna::OwnerAttacked(Creature* me, Unit* target) Push(target); return CallAllFunctionsBool(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key); } - -#endif // TRINITY diff --git a/src/LuaEngine/hooks/GameObjectHooks.cpp b/src/LuaEngine/hooks/GameObjectHooks.cpp index e463220..fc64c81 100644 --- a/src/LuaEngine/hooks/GameObjectHooks.cpp +++ b/src/LuaEngine/hooks/GameObjectHooks.cpp @@ -76,8 +76,6 @@ void Eluna::GetDialogStatus(const Player* pPlayer, const GameObject* pGameObject CallAllFunctions(GameObjectEventBindings, key); } -#ifndef CLASSIC -#ifndef TBC void Eluna::OnDestroyed(GameObject* pGameObject, WorldObject* attacker) { START_HOOK(GAMEOBJECT_EVENT_ON_DESTROYED, pGameObject->GetEntry()); @@ -93,8 +91,6 @@ void Eluna::OnDamaged(GameObject* pGameObject, WorldObject* attacker) Push(attacker); CallAllFunctions(GameObjectEventBindings, key); } -#endif -#endif void Eluna::OnLootStateChanged(GameObject* pGameObject, uint32 state) { diff --git a/src/LuaEngine/hooks/ItemHooks.cpp b/src/LuaEngine/hooks/ItemHooks.cpp index ddd0223..1deb795 100644 --- a/src/LuaEngine/hooks/ItemHooks.cpp +++ b/src/LuaEngine/hooks/ItemHooks.cpp @@ -74,11 +74,7 @@ bool Eluna::OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets) data << guid; data << ObjectGuid(uint64(0)); data << uint8(0); -#ifdef CMANGOS - pPlayer->GetSession()->SendPacket(data); -#else pPlayer->GetSession()->SendPacket(&data); -#endif return false; } @@ -87,7 +83,7 @@ bool Eluna::OnItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targ START_HOOK_WITH_RETVAL(ITEM_EVENT_ON_USE, pItem->GetEntry(), true); Push(pPlayer); Push(pItem); -#if defined TRINITY || AZEROTHCORE + if (GameObject* target = targets.GetGOTarget()) Push(target); else if (Item* target = targets.GetItemTarget()) @@ -100,18 +96,6 @@ bool Eluna::OnItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targ Push(target); else Push(); -#else - if (GameObject* target = targets.getGOTarget()) - Push(target); - else if (Item* target = targets.getItemTarget()) - Push(target); - else if (Corpse* target = pPlayer->GetMap()->GetCorpse(targets.getCorpseTargetGuid())) - Push(target); - else if (Unit* target = targets.getUnitTarget()) - Push(target); - else - Push(); -#endif return CallAllFunctionsBool(ItemEventBindings, key, true); } diff --git a/src/LuaEngine/hooks/ServerHooks.cpp b/src/LuaEngine/hooks/ServerHooks.cpp index db2c537..4f69c09 100644 --- a/src/LuaEngine/hooks/ServerHooks.cpp +++ b/src/LuaEngine/hooks/ServerHooks.cpp @@ -116,14 +116,8 @@ bool Eluna::OnAreaTrigger(Player* pPlayer, AreaTriggerEntry const* pTrigger) { START_HOOK_WITH_RETVAL(TRIGGER_EVENT_ON_TRIGGER, false); Push(pPlayer); -#ifdef TRINITY - Push(pTrigger->ID); -#elif AZEROTHCORE Push(pTrigger->entry); -#else - Push(pTrigger->id); - -#endif + return CallAllFunctionsBool(ServerEventBindings, key); } @@ -140,22 +134,10 @@ 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 - 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; @@ -174,23 +156,10 @@ 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 - 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; @@ -209,23 +178,10 @@ 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 - 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; @@ -244,23 +200,10 @@ 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 - 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; @@ -284,17 +227,11 @@ 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); Push(reload); -#ifdef AZEROTHCORE Push(isBefore); -#endif CallAllFunctions(ServerEventBindings, key); } diff --git a/src/LuaEngine/hooks/VehicleHooks.cpp b/src/LuaEngine/hooks/VehicleHooks.cpp index 44eaf23..6e1cd99 100644 --- a/src/LuaEngine/hooks/VehicleHooks.cpp +++ b/src/LuaEngine/hooks/VehicleHooks.cpp @@ -10,9 +10,6 @@ #include "BindingMap.h" #include "ElunaTemplate.h" -#ifndef CLASSIC -#ifndef TBC - using namespace Hooks; #define START_HOOK(EVENT) \ @@ -61,6 +58,3 @@ void Eluna::OnRemovePassenger(Vehicle* vehicle, Unit* passenger) Push(passenger); CallAllFunctions(VehicleEventBindings, key); } - -#endif // CLASSIC -#endif // TBC diff --git a/src/LuaEngine/methods/AuraMethods.h b/src/LuaEngine/methods/AuraMethods.h index 081da95..91345a5 100644 --- a/src/LuaEngine/methods/AuraMethods.h +++ b/src/LuaEngine/methods/AuraMethods.h @@ -39,11 +39,7 @@ namespace LuaAura */ int GetCasterGUID(lua_State* L, Aura* aura) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, aura->GetCasterGUID()); -#else - Eluna::Push(L, aura->GetCasterGuid()); -#endif return 1; } @@ -65,11 +61,7 @@ namespace LuaAura */ int GetDuration(lua_State* L, Aura* aura) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, aura->GetDuration()); -#else - Eluna::Push(L, aura->GetAuraDuration()); -#endif return 1; } @@ -94,11 +86,7 @@ namespace LuaAura */ int GetMaxDuration(lua_State* L, Aura* aura) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, aura->GetMaxDuration()); -#else - Eluna::Push(L, aura->GetAuraMaxDuration()); -#endif return 1; } @@ -122,11 +110,7 @@ namespace LuaAura */ int GetOwner(lua_State* L, Aura* aura) { -#if defined TRINITY || defined AZEROTHCORE Eluna::Push(L, aura->GetOwner()); -#else - Eluna::Push(L, aura->GetTarget()); -#endif return 1; } @@ -138,16 +122,7 @@ namespace LuaAura int SetDuration(lua_State* L, Aura* aura) { int32 duration = Eluna::CHECKVAL(L, 2); -#if defined TRINITY || defined AZEROTHCORE aura->SetDuration(duration); -#else - aura->GetHolder()->SetAuraDuration(duration); -#if (defined(TBC) || defined(CLASSIC)) - aura->GetHolder()->UpdateAuraDuration(); -#else - aura->GetHolder()->SendAuraUpdate(false); -#endif -#endif return 0; } @@ -162,16 +137,7 @@ namespace LuaAura int SetMaxDuration(lua_State* L, Aura* aura) { int32 duration = Eluna::CHECKVAL(L, 2); -#if defined TRINITY || defined AZEROTHCORE aura->SetMaxDuration(duration); -#else - aura->GetHolder()->SetAuraMaxDuration(duration); -#if (defined(TBC) || defined(CLASSIC)) - aura->GetHolder()->UpdateAuraDuration(); -#else - aura->GetHolder()->SendAuraUpdate(false); -#endif -#endif return 0; } @@ -186,11 +152,7 @@ namespace LuaAura int SetStackAmount(lua_State* L, Aura* aura) { uint8 amount = Eluna::CHECKVAL(L, 2); -#if defined TRINITY || defined AZEROTHCORE aura->SetStackAmount(amount); -#else - aura->GetHolder()->SetStackAmount(amount); -#endif return 0; } @@ -199,11 +161,7 @@ namespace LuaAura */ int Remove(lua_State* L, Aura* aura) { -#if defined TRINITY || defined AZEROTHCORE aura->Remove(); -#else - aura->GetTarget()->RemoveSpellAuraHolder(aura->GetHolder(), AURA_REMOVE_BY_CANCEL); -#endif Eluna::CHECKOBJ(L, 1)->Invalidate(); return 0; } diff --git a/src/LuaEngine/methods/BattleGroundMethods.h b/src/LuaEngine/methods/BattleGroundMethods.h index 98b4a8d..935e6c2 100644 --- a/src/LuaEngine/methods/BattleGroundMethods.h +++ b/src/LuaEngine/methods/BattleGroundMethods.h @@ -35,11 +35,7 @@ namespace LuaBattleGround { uint32 team = Eluna::CHECKVAL(L, 2); -#ifndef AZEROTHCORE - Eluna::Push(L, bg->GetAlivePlayersCountByTeam((Team)team)); -#else Eluna::Push(L, bg->GetAlivePlayersCountByTeam((TeamId)team)); -#endif return 1; } @@ -68,19 +64,6 @@ namespace LuaBattleGround return 1; } -#ifndef AZEROTHCORE - /** - * Returns the bracket ID of the specific [BattleGround]. - * - * @return [BattleGroundBracketId] bracketId - */ - int GetBracketId(lua_State* L, BattleGround* bg) - { - Eluna::Push(L, bg->GetBracketId()); - return 1; - } -#endif - /** * Returns the end time of the [BattleGround]. * @@ -88,11 +71,7 @@ namespace LuaBattleGround */ int GetEndTime(lua_State* L, BattleGround* bg) { -#ifdef CATA - Eluna::Push(L, bg->GetRemainingTime()); -#else Eluna::Push(L, bg->GetEndTime()); -#endif return 1; } @@ -106,11 +85,7 @@ namespace LuaBattleGround { uint32 team = Eluna::CHECKVAL(L, 2); -#ifndef AZEROTHCORE - Eluna::Push(L, bg->GetFreeSlotsForTeam((Team)team)); -#else Eluna::Push(L, bg->GetFreeSlotsForTeam((TeamId)team)); -#endif return 1; } @@ -143,11 +118,7 @@ namespace LuaBattleGround */ int GetTypeId(lua_State* L, BattleGround* bg) { -#ifndef AZEROTHCORE - Eluna::Push(L, bg->GetTypeID()); -#else Eluna::Push(L, bg->GetBgTypeID()); -#endif return 1; } @@ -180,11 +151,7 @@ namespace LuaBattleGround */ int GetMaxPlayers(lua_State* L, BattleGround* bg) { -#ifndef AZEROTHCORE - Eluna::Push(L, bg->GetMaxPlayers()); -#else Eluna::Push(L, bg->GetMaxPlayersPerTeam() * 2); -#endif return 1; } @@ -195,11 +162,7 @@ namespace LuaBattleGround */ int GetMinPlayers(lua_State* L, BattleGround* bg) { -#ifndef AZEROTHCORE - Eluna::Push(L, bg->GetMinPlayers()); -#else Eluna::Push(L, bg->GetMaxPlayersPerTeam() * 2); -#endif return 1; } diff --git a/src/LuaEngine/methods/CorpseMethods.h b/src/LuaEngine/methods/CorpseMethods.h index aba7d20..b78c499 100644 --- a/src/LuaEngine/methods/CorpseMethods.h +++ b/src/LuaEngine/methods/CorpseMethods.h @@ -21,11 +21,7 @@ namespace LuaCorpse */ int GetOwnerGUID(lua_State* L, Corpse* corpse) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, corpse->GetOwnerGUID()); -#else - Eluna::Push(L, corpse->GetOwnerGuid()); -#endif return 1; } diff --git a/src/LuaEngine/methods/CreatureMethods.h b/src/LuaEngine/methods/CreatureMethods.h index f616399..5614647 100644 --- a/src/LuaEngine/methods/CreatureMethods.h +++ b/src/LuaEngine/methods/CreatureMethods.h @@ -22,17 +22,10 @@ namespace LuaCreature */ int IsRegeneratingHealth(lua_State* L, Creature* creature) { -#if defined(AZEROTHCORE) Eluna::Push(L, creature->isRegeneratingHealth()); -#elif defined(TRINITY) - Eluna::Push(L, creature->CanRegenerateHealth()); -#else - Eluna::Push(L, creature->IsRegeneratingHealth()); -#endif return 1; } -#if defined(TRINITY) || defined(AZEROTHCORE) /** * Sets whether the [Creature] can regenerate health or not. * @@ -42,14 +35,9 @@ namespace LuaCreature { bool enable = Eluna::CHECKVAL(L, 2, true); -#if defined(AZEROTHCORE) creature->SetRegeneratingHealth(enable); -#else - creature->SetRegenerateHealth(enable); -#endif return 0; } -#endif /** * Returns `true` if the [Creature] is set to not give reputation when killed, @@ -74,11 +62,7 @@ namespace LuaCreature { uint32 quest_id = Eluna::CHECKVAL(L, 2); -#if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->hasInvolvedQuest(quest_id)); -#else - Eluna::Push(L, creature->HasInvolvedQuest(quest_id)); -#endif return 1; } @@ -93,11 +77,7 @@ namespace LuaCreature { bool mustBeDead = Eluna::CHECKVAL(L, 2, false); -#ifdef MANGOS - Eluna::Push(L, creature->IsTargetableForAttack(mustBeDead)); -#else Eluna::Push(L, creature->isTargetableForAttack(mustBeDead)); -#endif return 1; } @@ -142,11 +122,7 @@ namespace LuaCreature { Player* player = Eluna::CHECKOBJ(L, 2); -#if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->isTappedBy(player)); -#else - Eluna::Push(L, creature->IsTappedBy(player)); -#endif return 1; } @@ -158,11 +134,7 @@ namespace LuaCreature */ int HasLootRecipient(lua_State* L, Creature* creature) { -#if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->hasLootRecipient()); -#else - Eluna::Push(L, creature->HasLootRecipient()); -#endif return 1; } @@ -174,12 +146,7 @@ namespace LuaCreature */ int CanAggro(lua_State* L, Creature* creature) { -#if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, !creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)); -#else - // Eluna::Push(L, creature->CanInitiateAttack()); - Eluna::Push(L, !creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)); -#endif return 1; } @@ -227,11 +194,7 @@ namespace LuaCreature */ int IsElite(lua_State* L, Creature* creature) { -#if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->isElite()); -#else - Eluna::Push(L, creature->IsElite()); -#endif return 1; } @@ -277,13 +240,11 @@ namespace LuaCreature * * @return bool isDungeonBoss */ -#if defined(TRINITY) || defined(AZEROTHCORE) int IsDungeonBoss(lua_State* L, Creature* creature) { Eluna::Push(L, creature->IsDungeonBoss()); return 1; } -#endif /** * Returns `true` if the [Creature]'s rank is Boss, @@ -293,11 +254,7 @@ namespace LuaCreature */ int IsWorldBoss(lua_State* L, Creature* creature) { -#if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->isWorldBoss()); -#else - Eluna::Push(L, creature->IsWorldBoss()); -#endif return 1; } @@ -312,19 +269,10 @@ namespace LuaCreature { uint32 spell = Eluna::CHECKVAL(L, 2); -#if defined(TRINITY) - if (const SpellInfo* info = sSpellMgr->GetSpellInfo(spell)) - Eluna::Push(L, info->GetCategory() && creature->GetSpellHistory()->HasCooldown(spell)); - else - Eluna::Push(L, false); -#elif defined(AZEROTHCORE) if (const SpellInfo* info = sSpellMgr->GetSpellInfo(spell)) Eluna::Push(L, info->GetCategory() && creature->HasSpellCooldown(spell)); else Eluna::Push(L, false); -#else - Eluna::Push(L, creature->HasCategoryCooldown(spell)); -#endif return 1; } @@ -354,11 +302,7 @@ namespace LuaCreature { uint32 questId = Eluna::CHECKVAL(L, 2); -#if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->hasQuest(questId)); -#else - Eluna::Push(L, creature->HasQuest(questId)); -#endif return 1; } @@ -373,11 +317,7 @@ namespace LuaCreature { uint32 spellId = Eluna::CHECKVAL(L, 2); -#if defined(TRINITY) - Eluna::Push(L, creature->GetSpellHistory()->HasCooldown(spellId)); -#else Eluna::Push(L, creature->HasSpellCooldown(spellId)); -#endif return 1; } @@ -393,7 +333,6 @@ namespace LuaCreature return 1; } -#if defined(TRINITY) || defined(AZEROTHCORE) /** * Returns `true` if the [Creature] is an invisible trigger, * and returns `false` otherwise. @@ -428,12 +367,8 @@ namespace LuaCreature int CanStartAttack(lua_State* L, Creature* creature) // TODO: Implement core side { Unit* target = Eluna::CHECKOBJ(L, 2); -#ifndef AZEROTHCORE - bool force = Eluna::CHECKVAL(L, 3, true); - Eluna::Push(L, creature->CanStartAttack(target, force)); -#else + Eluna::Push(L, creature->CanStartAttack(target)); -#endif return 1; } @@ -450,7 +385,6 @@ namespace LuaCreature Eluna::Push(L, creature->HasLootMode(lootMode)); return 1; } -#endif /** * Returns the time it takes for this [Creature] to respawn once killed. @@ -474,15 +408,10 @@ namespace LuaCreature */ int GetWanderRadius(lua_State* L, Creature* creature) { -#if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->GetWanderDistance()); -#else - Eluna::Push(L, creature->GetRespawnRadius()); -#endif return 1; } -#if defined(TRINITY) || defined(AZEROTHCORE) /** * Returns the current waypoint path ID of the [Creature]. * @@ -493,7 +422,6 @@ namespace LuaCreature Eluna::Push(L, creature->GetWaypointPath()); return 1; } -#endif /** * Returns the current waypoint ID of the [Creature]. @@ -502,13 +430,7 @@ namespace LuaCreature */ int GetCurrentWaypointId(lua_State* L, Creature* creature) { -#if defined(TRINITY) - Eluna::Push(L, creature->GetCurrentWaypointInfo().first); -#elif defined(AZEROTHCORE) Eluna::Push(L, creature->GetCurrentWaypointID()); -#else - Eluna::Push(L, creature->GetMotionMaster()->getLastReachedWaypoint()); -#endif return 1; } @@ -533,35 +455,10 @@ namespace LuaCreature { Unit* target = Eluna::CHECKOBJ(L, 2); -#if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->GetAggroRange(target)); -#else - float AttackDist = creature->GetAttackDistance(target); - float ThreatRadius = sWorld.getConfig(CONFIG_FLOAT_THREAT_RADIUS); - Eluna::Push(L, ThreatRadius > AttackDist ? ThreatRadius : AttackDist); -#endif return 1; } -#ifndef AZEROTHCORE - /** - * Returns the effective aggro range of the [Creature] for `target`. - * - * If this is smaller than the minimum aggro range set in the config file, - * that is used as the aggro range instead. - * - * @param [Unit] target - * @return float attackDistance - */ - int GetAttackDistance(lua_State* L, Creature* creature) - { - Unit* target = Eluna::CHECKOBJ(L, 2); - - Eluna::Push(L, creature->GetAttackDistance(target)); - return 1; - } -#endif - /** * Returns the [Group] that can loot this [Creature]. * @@ -569,11 +466,7 @@ namespace LuaCreature */ int GetLootRecipientGroup(lua_State* L, Creature* creature) { -#if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->GetLootRecipientGroup()); -#else - Eluna::Push(L, creature->GetGroupLootRecipient()); -#endif return 1; } @@ -642,19 +535,11 @@ namespace LuaCreature { uint32 spell = Eluna::CHECKVAL(L, 2); -#if defined(TRINITY) - if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell)) - Eluna::Push(L, creature->GetSpellHistory()->GetRemainingCooldown(spellInfo)); - else - Eluna::Push(L, 0); -#elif defined(AZEROTHCORE) if (sSpellMgr->GetSpellInfo(spell)) Eluna::Push(L, creature->GetSpellCooldown(spell)); else Eluna::Push(L, 0); -#else - Eluna::Push(L, creature->GetCreatureSpellCooldownDelay(spell)); -#endif + return 1; } @@ -681,11 +566,7 @@ namespace LuaCreature int GetHomePosition(lua_State* L, Creature* creature) { float x, y, z, o; -#if defined(TRINITY) || defined(AZEROTHCORE) creature->GetHomePosition(x, y, z, o); -#else - creature->GetRespawnCoord(x, y, z, &o); -#endif Eluna::Push(L, x); Eluna::Push(L, y); @@ -710,12 +591,7 @@ namespace LuaCreature float z = Eluna::CHECKVAL(L, 4); float o = Eluna::CHECKVAL(L, 5); -#if defined(TRINITY) || defined(AZEROTHCORE) creature->SetHomePosition(x, y, z, o); -#else - creature->SetRespawnCoord(x, y, z, o); -#endif - return 0; } @@ -762,33 +638,19 @@ namespace LuaCreature float dist = Eluna::CHECKVAL(L, 5, 0.0f); int32 aura = Eluna::CHECKVAL(L, 6, 0); -#if defined(CMANGOS) - ThreatList const& threatlist = creature->getThreatManager().getThreatList(); -#elif defined(MANGOS) - ThreatList const& threatlist = creature->GetThreatManager().getThreatList(); -#elif defined(TRINITY) - auto const& threatlist = creature->GetThreatManager().GetSortedThreatList(); -#elif defined(AZEROTHCORE) auto const& threatlist = creature->GetThreatMgr().GetThreatList(); -#endif -#ifndef TRINITY + if (threatlist.empty()) return 1; if (position >= threatlist.size()) return 1; -#endif + std::list targetList; -#if defined(TRINITY) - for (ThreatReference const* itr : threatlist) -#else + for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr) -#endif - { -#if defined(TRINITY) - Unit* target = itr->GetVictim(); -#else + { Unit* target = (*itr)->getTarget(); -#endif + if (!target) continue; if (playerOnly && target->GetTypeId() != TYPEID_PLAYER) @@ -857,25 +719,18 @@ namespace LuaCreature */ int GetAITargets(lua_State* L, Creature* creature) { -#if defined(TRINITY) - auto const& threatlist = creature->GetThreatManager().GetThreatenedByMeList(); -#elif defined(AZEROTHCORE) -auto const& threatlist = creature->GetThreatMgr().GetThreatList(); -#else - ThreatList const& threatlist = creature->GetThreatManager().getThreatList(); -#endif + auto const& threatlist = creature->GetThreatMgr().GetThreatList(); + lua_createtable(L, threatlist.size(), 0); int tbl = lua_gettop(L); uint32 i = 0; for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr) { -#if defined(TRINITY) - Unit* target = itr->second->GetOwner(); -#else Unit* target = (*itr)->getTarget(); -#endif + if (!target) continue; + Eluna::Push(L, target); lua_rawseti(L, tbl, ++i); } @@ -891,13 +746,7 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList(); */ int GetAITargetsCount(lua_State* L, Creature* creature) { -#if defined(TRINITY) - Eluna::Push(L, creature->GetThreatManager().GetThreatenedByMeList().size()); -#elif defined(AZEROTHCORE) Eluna::Push(L, creature->GetThreatMgr().GetThreatListSize()); -#else - Eluna::Push(L, creature->GetThreatManager().getThreatList().size()); -#endif return 1; } @@ -949,11 +798,7 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList(); */ int GetExtraFlags(lua_State* L, Creature* creature) { -#if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->GetCreatureTemplate()->flags_extra); -#else - Eluna::Push(L, creature->GetCreatureInfo()->ExtraFlags); -#endif return 1; } @@ -968,7 +813,6 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList(); return 1; } -#if defined(CLASSIC) || defined(TBC) || defined(WOTLK) /** * Returns the [Creature]'s shield block value. * @@ -979,15 +823,12 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList(); Eluna::Push(L, creature->GetShieldBlockValue()); return 1; } -#endif -#if defined(TRINITY) || defined(AZEROTHCORE) int GetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features { Eluna::Push(L, creature->GetLootMode()); return 1; } -#endif /** * Returns the guid of the [Creature] that is used as the ID in the database @@ -996,12 +837,7 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList(); */ int GetDBTableGUIDLow(lua_State* L, Creature* creature) { -#if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->GetSpawnId()); -#else - // on mangos based this is same as lowguid - Eluna::Push(L, creature->GetGUIDLow()); -#endif return 1; } @@ -1042,7 +878,6 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList(); return 0; } -#if defined(TRINITY) || defined(AZEROTHCORE) /** * Sets the [Creature]'s ReactState to `state`. * @@ -1055,7 +890,6 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList(); creature->SetReactState((ReactStates)state); return 0; } -#endif /** * Makes the [Creature] able to fly if enabled. @@ -1066,15 +900,10 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList(); { bool disable = Eluna::CHECKVAL(L, 2); -#if defined(TRINITY) || defined(AZEROTHCORE) creature->SetDisableGravity(disable); -#else - creature->SetLevitate(disable); -#endif return 0; } -#if defined(TRINITY) || defined(AZEROTHCORE) int SetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features { uint16 lootMode = Eluna::CHECKVAL(L, 2); @@ -1082,7 +911,6 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList(); creature->SetLootMode(lootMode); return 0; } -#endif /** * Sets the [Creature]'s death state to `deathState`. @@ -1093,11 +921,7 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList(); { int32 state = Eluna::CHECKVAL(L, 2); -#if defined(TRINITY) || defined(AZEROTHCORE) creature->setDeathState((DeathState)state); -#else - creature->SetDeathState((DeathState)state); -#endif return 0; } @@ -1127,15 +951,10 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList(); uint32 off_hand = Eluna::CHECKVAL(L, 3); uint32 ranged = Eluna::CHECKVAL(L, 4); -#if defined(TRINITY) || defined(AZEROTHCORE) creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, main_hand); creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, off_hand); creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, ranged); -#else - creature->SetVirtualItem(VIRTUAL_ITEM_SLOT_0, main_hand); - creature->SetVirtualItem(VIRTUAL_ITEM_SLOT_1, off_hand); - creature->SetVirtualItem(VIRTUAL_ITEM_SLOT_2, ranged); -#endif + return 0; } @@ -1148,17 +967,10 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList(); { bool allow = Eluna::CHECKVAL(L, 2, true); -#if defined(TRINITY) || defined(AZEROTHCORE) if (allow) creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); else creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); -#else - if (allow) - creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE); - else - creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE); -#endif return 0; } @@ -1184,15 +996,9 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList(); */ int SetInCombatWithZone(lua_State* /*L*/, Creature* creature) { -#if defined(AZEROTHCORE) if (creature->IsAIEnabled) creature->AI()->DoZoneInCombat(); -#elif defined(TRINITY) - if (creature->IsAIEnabled()) - creature->AI()->DoZoneInCombat(); -#else - creature->SetInCombatWithZone(); -#endif + return 0; } @@ -1205,11 +1011,8 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList(); { float dist = Eluna::CHECKVAL(L, 2); -#if defined(TRINITY) || defined(AZEROTHCORE) creature->SetWanderDistance(dist); -#else - creature->SetRespawnRadius(dist); -#endif + return 0; } @@ -1274,24 +1077,8 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList(); { bool enable = Eluna::CHECKVAL(L, 2, true); -#if defined(TRINITY) || defined(AZEROTHCORE) creature->SetHover(enable); -#else - // Copy paste from Aura::HandleAuraHover - // TODO: implement core side properly - WorldPacket data; - if (enable) - data.Initialize(SMSG_MOVE_SET_HOVER, 8 + 4); - else - data.Initialize(SMSG_MOVE_UNSET_HOVER, 8 + 4); - data << creature->GetPackGUID(); - data << uint32(0); -#if defined(CMANGOS) - creature->SendMessageToSet(data, true); -#else - creature->SendMessageToSet(&data, true); -#endif -#endif + return 0; } @@ -1303,14 +1090,8 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList(); int DespawnOrUnsummon(lua_State* L, Creature* creature) { uint32 msTimeToDespawn = Eluna::CHECKVAL(L, 2, 0); - -#if defined(TRINITY) - creature->DespawnOrUnsummon(Milliseconds(msTimeToDespawn)); -#elif defined(AZEROTHCORE) creature->DespawnOrUnsummon(msTimeToDespawn); -#else - creature->ForcedDespawn(msTimeToDespawn); -#endif + return 0; } @@ -1337,11 +1118,8 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList(); */ int MoveWaypoint(lua_State* /*L*/, Creature* creature) { -#if defined(TRINITY) || defined(AZEROTHCORE) creature->GetMotionMaster()->MovePath(creature->GetWaypointPath(), true); -#else - creature->GetMotionMaster()->MoveWaypoint(); -#endif + return 0; } @@ -1405,11 +1183,7 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList(); */ int SelectVictim(lua_State* L, Creature* creature) { -#if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, creature->SelectVictim()); -#else - Eluna::Push(L, creature->SelectHostileTarget()); -#endif return 1; } @@ -1424,15 +1198,10 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList(); uint32 entry = Eluna::CHECKVAL(L, 2); uint32 dataGuidLow = Eluna::CHECKVAL(L, 3, 0); -#if defined(TRINITY) || defined(AZEROTHCORE) creature->UpdateEntry(entry, dataGuidLow ? eObjectMgr->GetCreatureData(dataGuidLow) : NULL); -#else - creature->UpdateEntry(entry, ALLIANCE, dataGuidLow ? eObjectMgr->GetCreatureData(dataGuidLow) : NULL); -#endif return 0; } -#if defined(TRINITY) || defined(AZEROTHCORE) /** * Resets [Creature]'s loot mode to default */ @@ -1467,7 +1236,6 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList(); creature->AddLootMode(lootMode); return 0; } -#endif /** * Returns the [Creature]'s creature family ID (enumerated in CreatureFamily.dbc). @@ -1527,15 +1295,10 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList(); { uint32 entry = creature->GetEntry(); -#if defined(TRINITY) || defined(AZEROTHCORE) CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(entry); if (cInfo) Eluna::Push(L, cInfo->family); -#else - CreatureInfo const* cInfo = ObjectMgr::GetCreatureTemplate(entry); - if (cInfo) - Eluna::Push(L, cInfo->Family); -#endif + return 1; } }; diff --git a/src/LuaEngine/methods/ElunaQueryMethods.h b/src/LuaEngine/methods/ElunaQueryMethods.h index 3780184..b2efe4f 100644 --- a/src/LuaEngine/methods/ElunaQueryMethods.h +++ b/src/LuaEngine/methods/ElunaQueryMethods.h @@ -7,11 +7,7 @@ #ifndef QUERYMETHODS_H #define QUERYMETHODS_H -#if defined TRINITY || defined AZEROTHCORE #define RESULT (*result) -#else -#define RESULT result -#endif /*** * The result of a database query. @@ -45,11 +41,7 @@ namespace LuaQuery uint32 col = Eluna::CHECKVAL(L, 2); CheckFields(L, result); -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, RESULT->Fetch()[col].IsNull()); -#else - Eluna::Push(L, RESULT->Fetch()[col].IsNULL()); -#endif return 1; } @@ -286,13 +278,8 @@ namespace LuaQuery lua_createtable(L, 0, col); int tbl = lua_gettop(L); -#if !defined TRINITY && !AZEROTHCORE - const QueryFieldNames& names = RESULT->GetFieldNames(); -#endif - for (uint32 i = 0; i < col; ++i) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, RESULT->GetFieldName(i)); std::string _str = row[i].Get(); @@ -304,50 +291,12 @@ namespace LuaQuery // MYSQL_TYPE_LONGLONG Interpreted as string for lua switch (row[i].GetType()) { -#if defined TRINITY || AZEROTHCORE case DatabaseFieldTypes::Int8: case DatabaseFieldTypes::Int16: case DatabaseFieldTypes::Int32: case DatabaseFieldTypes::Int64: case DatabaseFieldTypes::Float: case DatabaseFieldTypes::Double: -#else - case MYSQL_TYPE_TINY: - case MYSQL_TYPE_YEAR: - case MYSQL_TYPE_SHORT: - case MYSQL_TYPE_INT24: - case MYSQL_TYPE_LONG: - case MYSQL_TYPE_LONGLONG: - case MYSQL_TYPE_BIT: - case MYSQL_TYPE_FLOAT: - case MYSQL_TYPE_DOUBLE: - case MYSQL_TYPE_DECIMAL: - case MYSQL_TYPE_NEWDECIMAL: -#endif - Eluna::Push(L, strtod(str, NULL)); - break; - default: - Eluna::Push(L, str); - break; - } - } -#else - Eluna::Push(L, names[i]); - - const char* str = row[i].GetString(); - if (row[i].IsNULL() || !str) - Eluna::Push(L); - else - { - // MYSQL_TYPE_LONGLONG Interpreted as string for lua - switch (row[i].GetType()) - { - case MYSQL_TYPE_TINY: - case MYSQL_TYPE_SHORT: - case MYSQL_TYPE_INT24: - case MYSQL_TYPE_LONG: - case MYSQL_TYPE_FLOAT: - case MYSQL_TYPE_DOUBLE: Eluna::Push(L, strtod(str, NULL)); break; default: @@ -355,8 +304,6 @@ namespace LuaQuery break; } } -#endif - lua_rawset(L, tbl); } diff --git a/src/LuaEngine/methods/GameObjectMethods.h b/src/LuaEngine/methods/GameObjectMethods.h index ccb0ce1..9a4ecaf 100644 --- a/src/LuaEngine/methods/GameObjectMethods.h +++ b/src/LuaEngine/methods/GameObjectMethods.h @@ -22,11 +22,7 @@ namespace LuaGameObject { uint32 questId = Eluna::CHECKVAL(L, 2); -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, go->hasQuest(questId)); -#else - Eluna::Push(L, go->HasQuest(questId)); -#endif return 1; } @@ -145,11 +141,7 @@ namespace LuaGameObject */ int GetLootRecipientGroup(lua_State* L, GameObject* go) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, go->GetLootRecipientGroup()); -#else - Eluna::Push(L, go->GetGroupLootRecipient()); -#endif return 1; } @@ -160,12 +152,7 @@ namespace LuaGameObject */ int GetDBTableGUIDLow(lua_State* L, GameObject* go) { -#if defined(TRINITY) || defined(AZEROTHCORE) Eluna::Push(L, go->GetSpawnId()); -#else - // on mangos based this is same as lowguid - Eluna::Push(L, go->GetGUIDLow()); -#endif return 1; } @@ -192,13 +179,7 @@ namespace LuaGameObject else if (state == 1) go->SetGoState(GO_STATE_READY); else if (state == 2) - { -#ifdef TRINITY - go->SetGoState(GO_STATE_DESTROYED); -#else go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); -#endif - } return 0; } @@ -249,20 +230,15 @@ namespace LuaGameObject int i = 1; int argAmount = lua_gettop(L); -#if defined TRINITY || defined AZEROTHCORE CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction(); -#endif + uint8 addedItems = 0; while (i + 2 <= argAmount) { uint32 entry = Eluna::CHECKVAL(L, ++i); uint32 amount = Eluna::CHECKVAL(L, ++i); -#if defined TRINITY || AZEROTHCORE ItemTemplate const* item_proto = eObjectMgr->GetItemTemplate(entry); -#else - ItemTemplate const* item_proto = ObjectMgr::GetItemPrototype(entry); -#endif if (!item_proto) { luaL_error(L, "Item entry %d does not exist", entry); @@ -275,25 +251,15 @@ namespace LuaGameObject } if (Item* item = Item::CreateItem(entry, amount)) { -#if defined TRINITY || AZEROTHCORE item->SaveToDB(trans); -#else - item->SaveToDB(); -#endif LootStoreItem storeItem(item->GetEntry(), 0, 100, 0, LOOT_MODE_DEFAULT, 0, item->GetCount(), item->GetCount()); go->loot.AddItem(storeItem); -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, item->GetGUID().GetCounter()); -#else - Eluna::Push(L, item->GetGUIDLow()); -#endif ++addedItems; } } -#if defined TRINITY || AZEROTHCORE CharacterDatabase.CommitTransaction(trans); -#endif return addedItems; } @@ -320,11 +286,7 @@ namespace LuaGameObject bool deldb = Eluna::CHECKVAL(L, 2, false); // cs_gobject.cpp copy paste -#if defined TRINITY || AZEROTHCORE ObjectGuid ownerGuid = go->GetOwnerGUID(); -#else - ObjectGuid ownerGuid = go->GetOwnerGuid(); -#endif if (ownerGuid) { Unit* owner = eObjectAccessor()GetUnit(*go, ownerGuid); @@ -335,13 +297,7 @@ namespace LuaGameObject } if (deldb) - { -#ifdef TRINITY - GameObject::DeleteFromDB(go->GetSpawnId()); -#else go->DeleteFromDB(); -#endif - } go->SetRespawnTime(0); go->Delete(); diff --git a/src/LuaEngine/methods/GlobalMethods.h b/src/LuaEngine/methods/GlobalMethods.h index 33d7d5b..d1f29f3 100644 --- a/src/LuaEngine/methods/GlobalMethods.h +++ b/src/LuaEngine/methods/GlobalMethods.h @@ -9,8 +9,6 @@ #include "BindingMap.h" -#ifdef AZEROTHCORE - #include "BanMgr.h" #include "GameTime.h" #include "SharedDefines.h" @@ -24,8 +22,6 @@ enum BanMode BAN_IP = 3 }; -#endif - /*** * These functions can be used anywhere at any time, including at start-up. */ @@ -67,13 +63,7 @@ namespace LuaGlobalFunctions int GetRealmID(lua_State* L) { -#ifdef MANGOS - Eluna::Push(L, realmID); -#elif defined(AZEROTHCORE) Eluna::Push(L, sConfigMgr->GetOption("RealmID", 1)); -#else - Eluna::Push(L, sConfigMgr->GetIntDefault("RealmID", 1)); -#endif return 1; } @@ -101,15 +91,7 @@ namespace LuaGlobalFunctions */ int GetCoreExpansion(lua_State* L) { -#ifdef CLASSIC - Eluna::Push(L, 0); -#elif defined(TBC) - Eluna::Push(L, 1); -#elif defined(WOTLK) Eluna::Push(L, 2); -#elif defined(CATA) - Eluna::Push(L, 3); -#endif return 1; } @@ -196,13 +178,7 @@ namespace LuaGlobalFunctions */ int GetGameTime(lua_State* L) { -#ifdef TRINITY - Eluna::Push(L, GameTime::GetGameTime()); -#elif AZEROTHCORE Eluna::Push(L, GameTime::GetGameTime().count()); -#else - Eluna::Push(L, eWorld->GetGameTime()); -#endif return 1; } @@ -231,24 +207,8 @@ namespace LuaGlobalFunctions int tbl = lua_gettop(L); uint32 i = 0; -#if defined(MANGOS) - eObjectAccessor()DoForAllPlayers([&](Player* player){ - if(player->IsInWorld()) - { - if ((team == TEAM_NEUTRAL || player->GetTeamId() == team) && (!onlyGM || player->isGameMaster())) - { - Eluna::Push(L, player); - lua_rawseti(L, tbl, ++i); - } - } - }); -#else { -#if defined TRINITY || AZEROTHCORE std::shared_lock lock(*HashMapHolder::GetLock()); -#else - HashMapHolder::ReadGuard g(HashMapHolder::GetLock()); -#endif const HashMapHolder::MapType& m = eObjectAccessor()GetPlayers(); for (HashMapHolder::MapType::const_iterator it = m.begin(); it != m.end(); ++it) { @@ -256,11 +216,8 @@ namespace LuaGlobalFunctions { if (!player->IsInWorld()) continue; -#if defined TRINITY || AZEROTHCORE + if ((team == TEAM_NEUTRAL || player->GetTeamId() == team) && (!onlyGM || player->IsGameMaster())) -#else - if ((team == TEAM_NEUTRAL || player->GetTeamId() == team) && (!onlyGM || player->isGameMaster())) -#endif { Eluna::Push(L, player); lua_rawseti(L, tbl, ++i); @@ -268,7 +225,7 @@ namespace LuaGlobalFunctions } } } -#endif + lua_settop(L, tbl); // push table to top of stack return 1; } @@ -470,9 +427,7 @@ namespace LuaGlobalFunctions std::ostringstream oss; oss << "|c" << std::hex << ItemQualityColors[temp->Quality] << std::dec << "|Hitem:" << entry << ":0:" << -#ifndef CLASSIC "0:0:0:0:" << -#endif "0:0:0:0|h[" << name << "]|h|r"; Eluna::Push(L, oss.str()); @@ -538,19 +493,12 @@ namespace LuaGlobalFunctions if (locale >= TOTAL_LOCALES) return luaL_argerror(L, 2, "valid LocaleConstant expected"); -#if defined TRINITY || AZEROTHCORE AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaOrZoneId); -#else - AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaOrZoneId); -#endif + if (!areaEntry) return luaL_argerror(L, 1, "valid Area or Zone ID expected"); -#if defined(TRINITY) - Eluna::Push(L, areaEntry->AreaName[locale]); -#else Eluna::Push(L, areaEntry->area_name[locale]); -#endif return 1; } @@ -1284,16 +1232,14 @@ namespace LuaGlobalFunctions int RunCommand(lua_State* L) { const char* command = Eluna::CHECKVAL(L, 1); -#if defined TRINITY || AZEROTHCORE + eWorld->QueueCliCommand(new CliCommandHolder(nullptr, command, [](void*, std::string_view view) { std::string str = { view.begin(), view.end() }; str.erase(std::find_if(str.rbegin(), str.rend(), [](unsigned char ch) { return !std::isspace(ch); }).base(), str.end()); // Remove trailing spaces and line breaks ELUNA_LOG_INFO("{}", str); }, nullptr)); -#elif defined MANGOS - eWorld->QueueCliCommand(new CliCommandHolder(0, SEC_CONSOLE, nullptr, command, nullptr, nullptr)); -#endif + return 0; } @@ -1365,19 +1311,11 @@ namespace LuaGlobalFunctions { const char* query = Eluna::CHECKVAL(L, 1); -#if defined TRINITY || AZEROTHCORE ElunaQuery result = WorldDatabase.Query(query); if (result) Eluna::Push(L, new ElunaQuery(result)); else Eluna::Push(L); -#else - ElunaQuery* result = WorldDatabase.QueryNamed(query); - if (result) - Eluna::Push(L, result); - else - Eluna::Push(L); -#endif return 1; } @@ -1441,19 +1379,11 @@ namespace LuaGlobalFunctions { const char* query = Eluna::CHECKVAL(L, 1); -#if defined TRINITY || AZEROTHCORE QueryResult result = CharacterDatabase.Query(query); if (result) Eluna::Push(L, new QueryResult(result)); else Eluna::Push(L); -#else - QueryNamedResult* result = CharacterDatabase.QueryNamed(query); - if (result) - Eluna::Push(L, result); - else - Eluna::Push(L); -#endif return 1; } @@ -1510,19 +1440,11 @@ namespace LuaGlobalFunctions { const char* query = Eluna::CHECKVAL(L, 1); -#if defined TRINITY || AZEROTHCORE QueryResult result = LoginDatabase.Query(query); if (result) Eluna::Push(L, new QueryResult(result)); else Eluna::Push(L); -#else - QueryNamedResult* result = LoginDatabase.QueryNamed(query); - if (result) - Eluna::Push(L, result); - else - Eluna::Push(L); -#endif return 1; } @@ -1670,209 +1592,21 @@ namespace LuaGlobalFunctions uint32 entry = Eluna::CHECKVAL(L, 2); uint32 mapID = Eluna::CHECKVAL(L, 3); uint32 instanceID = Eluna::CHECKVAL(L, 4); + float x = Eluna::CHECKVAL(L, 5); float y = Eluna::CHECKVAL(L, 6); float z = Eluna::CHECKVAL(L, 7); float o = Eluna::CHECKVAL(L, 8); bool save = Eluna::CHECKVAL(L, 9, false); uint32 durorresptime = Eluna::CHECKVAL(L, 10, 0); -#if (!defined(TBC) && !defined(CLASSIC)) uint32 phase = Eluna::CHECKVAL(L, 11, PHASEMASK_NORMAL); + if (!phase) { Eluna::Push(L); return 1; } -#endif -#if !defined TRINITY && !AZEROTHCORE - Map* map = eMapMgr->FindMap(mapID, instanceID); - if (!map) - { - Eluna::Push(L); - return 1; - } - - if (spawntype == 1) // spawn creature - { - if (save) - { - CreatureInfo const* cinfo = ObjectMgr::GetCreatureTemplate(entry); - if (!cinfo) - { - Eluna::Push(L); - return 1; - } - -#if (defined(TBC) || defined(CLASSIC)) - CreatureCreatePos pos(map, x, y, z, o); -#else - CreatureCreatePos pos(map, x, y, z, o, phase); -#endif - Creature* pCreature = new Creature; - // used guids from specially reserved range (can be 0 if no free values) - uint32 lowguid = eObjectMgr->GenerateStaticCreatureLowGuid(); - if (!lowguid) - { - Eluna::Push(L); - return 1; - } - - if (!pCreature->Create(lowguid, pos, cinfo)) - { - delete pCreature; - Eluna::Push(L); - return 1; - } - -#ifdef TBC - pCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode())); -#elif defined(CLASSIC) - pCreature->SaveToDB(map->GetId()); -#else - pCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), phase); -#endif - - uint32 db_guid = pCreature->GetGUIDLow(); - - // To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells(); - pCreature->LoadFromDB(db_guid, map); - - map->Add(pCreature); - eObjectMgr->AddCreatureToGrid(db_guid, eObjectMgr->GetCreatureData(db_guid)); - if (durorresptime) - pCreature->ForcedDespawn(durorresptime); - - Eluna::Push(L, pCreature); - } - else - { - CreatureInfo const* cinfo = ObjectMgr::GetCreatureTemplate(entry); - if (!cinfo) - { - Eluna::Push(L); - return 1; - } - - TemporarySummon* pCreature = new TemporarySummon(ObjectGuid(uint64(0))); -#if (defined(TBC) || defined(CLASSIC)) - CreatureCreatePos pos(map, x, y, z, o); -#else - CreatureCreatePos pos(map, x, y, z, o, phase); -#endif - - if (!pCreature->Create(map->GenerateLocalLowGuid(cinfo->GetHighGuid()), pos, cinfo, TEAM_NONE)) - { - delete pCreature; - { - Eluna::Push(L); - return 1; - } - } - - pCreature->SetRespawnCoord(pos); - - // Active state set before added to map - pCreature->SetActiveObjectState(false); - - // Also initializes the AI and MMGen - pCreature->Summon(durorresptime ? TEMPSPAWN_TIMED_OR_DEAD_DESPAWN : TEMPSPAWN_MANUAL_DESPAWN, durorresptime); - - // Creature Linking, Initial load is handled like respawn - if (pCreature->IsLinkingEventTrigger()) - map->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_RESPAWN, pCreature); - - Eluna::Push(L, pCreature); - } - - return 1; - } - - if (spawntype == 2) // Spawn object - { - if (save) - { - const GameObjectInfo* gInfo = ObjectMgr::GetGameObjectInfo(entry); - if (!gInfo) - { - Eluna::Push(L); - return 1; - } - - // used guids from specially reserved range (can be 0 if no free values) - uint32 db_lowGUID = eObjectMgr->GenerateStaticGameObjectLowGuid(); - if (!db_lowGUID) - { - Eluna::Push(L); - return 1; - } - - GameObject* pGameObj = new GameObject; -#if (defined(TBC) || defined(CLASSIC)) - if (!pGameObj->Create(db_lowGUID, gInfo->id, map, x, y, z, o)) -#else - if (!pGameObj->Create(db_lowGUID, gInfo->id, map, phase, x, y, z, o)) -#endif - { - delete pGameObj; - Eluna::Push(L); - return 1; - } - - if (durorresptime) - pGameObj->SetRespawnTime(durorresptime); - - // fill the gameobject data and save to the db -#ifdef TBC - pGameObj->SaveToDB(map->GetId(), (1 << map->GetSpawnMode())); -#elif defined(CLASSIC) - pGameObj->SaveToDB(map->GetId()); -#else - pGameObj->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), phase); -#endif - - // this will generate a new guid if the object is in an instance - if (!pGameObj->LoadFromDB(db_lowGUID, map)) - { - delete pGameObj; - Eluna::Push(L); - return 1; - } - - // DEBUG_LOG(GetMangosString(LANG_GAMEOBJECT_CURRENT), gInfo->name, db_lowGUID, x, y, z, o); - - map->Add(pGameObj); - pGameObj->AIM_Initialize(); - - eObjectMgr->AddGameobjectToGrid(db_lowGUID, eObjectMgr->GetGOData(db_lowGUID)); - - Eluna::Push(L, pGameObj); - } - else - { - GameObject* pGameObj = new GameObject; - -#if (defined(TBC) || defined(CLASSIC)) - if (!pGameObj->Create(map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), entry, map, x, y, z, o)) -#else - if (!pGameObj->Create(map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), entry, map, phase, x, y, z, o)) -#endif - { - delete pGameObj; - Eluna::Push(L); - return 1; - } - - pGameObj->SetRespawnTime(durorresptime / IN_MILLISECONDS); - - map->Add(pGameObj); - pGameObj->AIM_Initialize(); - - Eluna::Push(L, pGameObj); - } - return 1; - } -#else Map* map = eMapMgr->FindMap(mapID, instanceID); if (!map) { @@ -1887,11 +1621,7 @@ namespace LuaGlobalFunctions if (save) { Creature* creature = new Creature(); -#ifndef AZEROTHCORE - if (!creature->Create(map->GenerateLowGuid(), map, phase, entry, pos)) -#else if (!creature->Create(map->GenerateLowGuid(), map, phase, entry, 0, x, y, z, o)) -#endif { delete creature; Eluna::Push(L); @@ -1907,11 +1637,8 @@ namespace LuaGlobalFunctions creature->CleanupsBeforeDelete(); delete creature; creature = new Creature(); -#ifndef AZEROTHCORE - if (!creature->LoadFromDB(db_guid, map, true, true)) -#else + if (!creature->LoadFromDB(db_guid, map, true)) -#endif { delete creature; Eluna::Push(L); @@ -1957,14 +1684,9 @@ namespace LuaGlobalFunctions } GameObject* object = new GameObject; -#ifndef AZEROTHCORE - uint32 guidLow = map->GenerateLowGuid(); - QuaternionData rot = QuaternionData::fromEulerAnglesZYX(o, 0.f, 0.f); - if (!object->Create(guidLow, objectInfo->entry, map, phase, Position(x, y, z, o), rot, 0, GO_STATE_READY)) -#else uint32 guidLow = map->GenerateLowGuid(); + if (!object->Create(guidLow, entry, map, phase, x, y, z, o, G3D::Quat(0.0f, 0.0f, 0.0f, 0.0f), 100, GO_STATE_READY)) -#endif { delete object; Eluna::Push(L); @@ -1986,11 +1708,7 @@ namespace LuaGlobalFunctions object = new GameObject(); // this will generate a new lowguid if the object is in an instance -#ifndef AZEROTHCORE - if (!object->LoadFromDB(guidLow, map, true)) -#else if (!object->LoadFromDB(guidLow, map)) -#endif { delete object; Eluna::Push(L); @@ -2004,7 +1722,6 @@ namespace LuaGlobalFunctions Eluna::Push(L, object); return 1; } -#endif Eluna::Push(L); return 1; } @@ -2044,25 +1761,10 @@ namespace LuaGlobalFunctions uint32 incrtime = Eluna::CHECKVAL(L, 4); uint32 extendedcost = Eluna::CHECKVAL(L, 5); -#if defined TRINITY || AZEROTHCORE -#ifdef CATA - if (!eObjectMgr->IsVendorItemValid(entry, item, maxcount, incrtime, extendedcost, 1)) - return 0; - eObjectMgr->AddVendorItem(entry, item, maxcount, incrtime, extendedcost, 1); -#else if (!eObjectMgr->IsVendorItemValid(entry, item, maxcount, incrtime, extendedcost)) return 0; eObjectMgr->AddVendorItem(entry, item, maxcount, incrtime, extendedcost); -#endif -#else - if (!eObjectMgr->IsVendorItemValid(false, "npc_vendor", entry, item, maxcount, incrtime, extendedcost, 0)) - return 0; -#ifndef CLASSIC - eObjectMgr->AddVendorItem(entry, item, maxcount, incrtime, extendedcost); -#else - eObjectMgr->AddVendorItem(entry, item, maxcount, incrtime); -#endif -#endif//TRINITY + return 0; } @@ -2079,11 +1781,7 @@ namespace LuaGlobalFunctions if (!eObjectMgr->GetCreatureTemplate(entry)) return luaL_argerror(L, 1, "valid CreatureEntry expected"); -#if defined(CATA) || defined(MISTS) - eObjectMgr->RemoveVendorItem(entry, item, 1); -#else eObjectMgr->RemoveVendorItem(entry, item); -#endif return 0; } @@ -2102,15 +1800,7 @@ namespace LuaGlobalFunctions auto const& itemlist = items->m_items; for (auto itr = itemlist.rbegin(); itr != itemlist.rend(); ++itr) -#if defined(CATA) || defined(MISTS) - eObjectMgr->RemoveVendorItem(entry, (*itr)->item, 1); -#else -#ifdef TRINITY - eObjectMgr->RemoveVendorItem(entry, itr->item); -#else eObjectMgr->RemoveVendorItem(entry, (*itr)->item); -#endif -#endif return 0; } @@ -2122,11 +1812,7 @@ namespace LuaGlobalFunctions int Kick(lua_State* L) { Player* player = Eluna::CHECKOBJ(L, 1); -#ifdef TRINITY - player->GetSession()->KickPlayer("GlobalMethods::Kick Kick the player"); -#else player->GetSession()->KickPlayer(); -#endif return 0; } @@ -2162,13 +1848,8 @@ namespace LuaGlobalFunctions switch (banMode) { case BAN_ACCOUNT: -#if defined TRINITY || AZEROTHCORE if (!Utf8ToUpperOnlyLatin(nameOrIP)) return luaL_argerror(L, 2, "invalid account name"); -#else - if (!AccountMgr::normalizeString(nameOrIP)) - return luaL_argerror(L, 2, "invalid account name"); -#endif break; case BAN_CHARACTER: if (!normalizePlayerName(nameOrIP)) @@ -2207,15 +1888,9 @@ namespace LuaGlobalFunctions case BanReturn::BAN_NOTFOUND: Eluna::Push(L, 2); break; -#ifdef AZEROTHCORE case BanReturn::BAN_LONGER_EXISTS: Eluna::Push(L, 3); break; -#elif TRINITY - case BanReturn::BAN_EXISTS: - Eluna::Push(L, 3); - break; -#endif } return 1; } @@ -2274,32 +1949,19 @@ namespace LuaGlobalFunctions MailSender sender(MAIL_NORMAL, senderGUIDLow, (MailStationery)stationary); MailDraft draft(subject, text); -#if defined TRINITY || AZEROTHCORE if (cod) draft.AddCOD(cod); if (money) draft.AddMoney(money); -#else - if (cod) - draft.SetCOD(cod); - if (money) - draft.SetMoney(money); -#endif -#if defined TRINITY || defined AZEROTHCORE CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction(); -#endif uint8 addedItems = 0; while (addedItems <= MAX_MAIL_ITEMS && i + 2 <= argAmount) { uint32 entry = Eluna::CHECKVAL(L, ++i); uint32 amount = Eluna::CHECKVAL(L, ++i); -#if defined TRINITY || AZEROTHCORE ItemTemplate const* item_proto = eObjectMgr->GetItemTemplate(entry); -#else - ItemTemplate const* item_proto = ObjectMgr::GetItemPrototype(entry); -#endif if (!item_proto) { luaL_error(L, "Item entry %d does not exist", entry); @@ -2312,28 +1974,16 @@ namespace LuaGlobalFunctions } if (Item* item = Item::CreateItem(entry, amount)) { -#if defined TRINITY || AZEROTHCORE item->SaveToDB(trans); -#else - item->SaveToDB(); -#endif draft.AddItem(item); -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, item->GetGUID().GetCounter()); -#else - Eluna::Push(L, item->GetGUIDLow()); -#endif ++addedItems; } } Player* receiverPlayer = eObjectAccessor()FindPlayer(MAKE_NEW_GUID(receiverGUIDLow, 0, HIGHGUID_PLAYER)); -#if defined TRINITY || AZEROTHCORE draft.SendMailTo(trans, MailReceiver(receiverPlayer, receiverGUIDLow), sender, MAIL_CHECK_MASK_NONE, delay); CharacterDatabase.CommitTransaction(trans); -#else - draft.SendMailTo(MailReceiver(receiverPlayer, MAKE_NEW_GUID(receiverGUIDLow, 0, HIGHGUID_PLAYER)), sender); -#endif return addedItems; } @@ -2489,16 +2139,6 @@ namespace LuaGlobalFunctions // Stack: {nodes}, mountA, mountH, price, pathid, {nodes}, node, key, value } TaxiPathNodeEntry entry; -#ifdef TRINITY - // mandatory - entry.ContinentID = Eluna::CHECKVAL(L, start); - entry.Loc.X = Eluna::CHECKVAL(L, start + 1); - entry.Loc.Y = Eluna::CHECKVAL(L, start + 2); - entry.Loc.Z = Eluna::CHECKVAL(L, start + 3); - // optional - entry.Flags = Eluna::CHECKVAL(L, start + 4, 0); - entry.Delay = Eluna::CHECKVAL(L, start + 5, 0); -#else // mandatory entry.mapid = Eluna::CHECKVAL(L, start); entry.x = Eluna::CHECKVAL(L, start + 1); @@ -2507,7 +2147,6 @@ namespace LuaGlobalFunctions // optional entry.actionFlag = Eluna::CHECKVAL(L, start + 4, 0); entry.delay = Eluna::CHECKVAL(L, start + 5, 0); -#endif nodes.push_back(entry); @@ -2529,28 +2168,17 @@ namespace LuaGlobalFunctions pathId = sTaxiPathNodesByPath.size(); if (sTaxiPathNodesByPath.size() <= pathId) sTaxiPathNodesByPath.resize(pathId + 1); + sTaxiPathNodesByPath[pathId].clear(); sTaxiPathNodesByPath[pathId].resize(nodes.size()); static uint32 nodeId = 500; uint32 startNode = nodeId; uint32 index = 0; + for (std::list::iterator it = nodes.begin(); it != nodes.end(); ++it) { TaxiPathNodeEntry& entry = *it; TaxiNodesEntry* nodeEntry = new TaxiNodesEntry(); -#ifdef TRINITY - entry.PathID = pathId; - entry.NodeIndex = nodeId; - nodeEntry->ID = index; - nodeEntry->ContinentID = entry.ContinentID; - nodeEntry->Pos.X = entry.Loc.X; - nodeEntry->Pos.Y = entry.Loc.Y; - nodeEntry->Pos.Z = entry.Loc.Z; - nodeEntry->MountCreatureID[0] = mountH; - nodeEntry->MountCreatureID[1] = mountA; - sTaxiNodesStore.SetEntry(nodeId++, nodeEntry); - sTaxiPathNodesByPath[pathId][index++] = new TaxiPathNodeEntry(entry); -#else entry.path = pathId; entry.index = nodeId; nodeEntry->ID = index; @@ -2561,33 +2189,19 @@ namespace LuaGlobalFunctions nodeEntry->MountCreatureID[0] = mountH; nodeEntry->MountCreatureID[1] = mountA; sTaxiNodesStore.SetEntry(nodeId++, nodeEntry); -#ifndef AZEROTHCORE - sTaxiPathNodesByPath[pathId].set(index++, new TaxiPathNodeEntry(entry)); -#else sTaxiPathNodesByPath[pathId][index++] = new TaxiPathNodeEntry(entry); -#endif -#endif } if (startNode >= nodeId) return 1; -#ifndef AZEROTHCORE - sTaxiPathSetBySource[startNode][nodeId - 1] = TaxiPathBySourceAndDestination(pathId, price); -#endif + TaxiPathEntry* pathEntry = new TaxiPathEntry(); -#ifdef TRINITY - pathEntry->FromTaxiNode = startNode; - pathEntry->ToTaxiNode = nodeId - 1; - pathEntry->Cost = price; -#else pathEntry->from = startNode; pathEntry->to = nodeId - 1; pathEntry->price = price; -#endif pathEntry->ID = pathId; sTaxiPathStore.SetEntry(pathId, pathEntry); -#ifdef AZEROTHCORE sTaxiPathSetBySource[startNode][nodeId - 1] = pathEntry; -#endif + Eluna::Push(L, pathId); return 1; } @@ -3479,7 +3093,6 @@ namespace LuaGlobalFunctions return 0; } - #ifdef AZEROTHCORE /** * Gets the faction which is the current owner of Halaa in Nagrand * 0 = Alliance @@ -3530,6 +3143,5 @@ namespace LuaGlobalFunctions return 0; } - #endif } #endif diff --git a/src/LuaEngine/methods/GroupMethods.h b/src/LuaEngine/methods/GroupMethods.h index 763c18a..ee7d39c 100644 --- a/src/LuaEngine/methods/GroupMethods.h +++ b/src/LuaEngine/methods/GroupMethods.h @@ -149,13 +149,9 @@ namespace LuaGroup if (player->GetGroupInvite()) player->UninviteFromGroup(); -#if defined TRINITY || AZEROTHCORE bool success = group->AddMember(player); if (success) group->BroadcastGroupUpdate(); -#else - bool success = group->AddMember(player->GetObjectGuid(), player->GetName()); -#endif Eluna::Push(L, success); return 1; @@ -186,11 +182,7 @@ namespace LuaGroup for (GroupReference* itr = group->GetFirstMember(); itr; itr = itr->next()) { -#if defined TRINITY || AZEROTHCORE Player* member = itr->GetSource(); -#else - Player* member = itr->getSource(); -#endif if (!member || !member->GetSession()) continue; @@ -210,11 +202,7 @@ namespace LuaGroup */ int GetLeaderGUID(lua_State* L, Group* group) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, group->GetLeaderGUID()); -#else - Eluna::Push(L, group->GetLeaderGuid()); -#endif return 1; } @@ -225,11 +213,7 @@ namespace LuaGroup */ int GetGUID(lua_State* L, Group* group) { -#ifdef CLASSIC - Eluna::Push(L, group->GetId()); -#else Eluna::Push(L, group->GET_GUID()); -#endif return 1; } @@ -242,11 +226,8 @@ namespace LuaGroup int GetMemberGUID(lua_State* L, Group* group) { const char* name = Eluna::CHECKVAL(L, 2); -#if defined TRINITY || AZEROTHCORE + Eluna::Push(L, group->GetMemberGUID(name)); -#else - Eluna::Push(L, group->GetMemberGuid(name)); -#endif return 1; } @@ -322,11 +303,7 @@ namespace LuaGroup bool ignorePlayersInBg = Eluna::CHECKVAL(L, 3); ObjectGuid ignore = Eluna::CHECKVAL(L, 4); -#ifdef CMANGOS - group->BroadcastPacket(*data, ignorePlayersInBg, -1, ignore); -#else group->BroadcastPacket(data, ignorePlayersInBg, -1, ignore); -#endif return 0; } @@ -352,11 +329,7 @@ namespace LuaGroup ObjectGuid guid = Eluna::CHECKVAL(L, 2); uint32 method = Eluna::CHECKVAL(L, 3, 0); -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, group->RemoveMember(guid, (RemoveMethod)method)); -#else - Eluna::Push(L, group->RemoveMember(guid, method)); -#endif return 1; } @@ -420,11 +393,7 @@ namespace LuaGroup if (icon >= TARGETICONCOUNT) return luaL_argerror(L, 2, "valid target icon expected"); -#if (defined(CLASSIC) || defined(TBC)) - group->SetTargetIcon(icon, target); -#else group->SetTargetIcon(icon, setter, target); -#endif return 0; } diff --git a/src/LuaEngine/methods/GuildMethods.h b/src/LuaEngine/methods/GuildMethods.h index ba9863f..4915012 100644 --- a/src/LuaEngine/methods/GuildMethods.h +++ b/src/LuaEngine/methods/GuildMethods.h @@ -25,22 +25,8 @@ namespace LuaGuild int tbl = lua_gettop(L); uint32 i = 0; -#if defined(MANGOS) - eObjectAccessor()DoForAllPlayers([&](Player* player) { - if (player->IsInWorld() && player->GetGuildId() == guild->GetId()) - { - Eluna::Push(L, player); - lua_rawseti(L, tbl, ++i); - } - }); -#else - { -#if defined TRINITY || AZEROTHCORE std::shared_lock lock(*HashMapHolder::GetLock()); -#else - HashMapHolder::ReadGuard g(HashMapHolder::GetLock()); -#endif const HashMapHolder::MapType& m = eObjectAccessor()GetPlayers(); for (HashMapHolder::MapType::const_iterator it = m.begin(); it != m.end(); ++it) { @@ -54,7 +40,7 @@ namespace LuaGuild } } } -#endif + lua_settop(L, tbl); // push table to top of stack return 1; } @@ -66,11 +52,7 @@ namespace LuaGuild */ int GetMemberCount(lua_State* L, Guild* guild) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, guild->GetMemberCount()); -#else - Eluna::Push(L, guild->GetMemberSize()); -#endif return 1; } @@ -81,11 +63,7 @@ namespace LuaGuild */ int GetLeader(lua_State* L, Guild* guild) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, eObjectAccessor()FindPlayer(guild->GetLeaderGUID())); -#else - Eluna::Push(L, eObjectAccessor()FindPlayer(guild->GetLeaderGuid())); -#endif return 1; } @@ -96,11 +74,7 @@ namespace LuaGuild */ int GetLeaderGUID(lua_State* L, Guild* guild) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, guild->GetLeaderGUID()); -#else - Eluna::Push(L, guild->GetLeaderGuid()); -#endif return 1; } @@ -144,15 +118,10 @@ namespace LuaGuild */ int GetInfo(lua_State* L, Guild* guild) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, guild->GetInfo()); -#else - Eluna::Push(L, guild->GetGINFO()); -#endif return 1; } -#if defined(CLASSIC) || defined(TBC) || defined(WOTLK) /** * Sets the leader of this [Guild] * @@ -162,16 +131,10 @@ namespace LuaGuild { Player* player = Eluna::CHECKOBJ(L, 2); -#if defined TRINITY || AZEROTHCORE guild->HandleSetLeader(player->GetSession(), player->GetName()); -#else - guild->SetLeader(player->GET_GUID()); -#endif return 0; } -#endif -#ifndef CLASSIC /** * Sets the information of the bank tab specified * @@ -182,14 +145,9 @@ namespace LuaGuild { uint8 tabId = Eluna::CHECKVAL(L, 2); const char* text = Eluna::CHECKVAL(L, 3); -#if defined TRINITY || AZEROTHCORE guild->SetBankTabText(tabId, text); -#else - guild->SetGuildBankTabText(tabId, text); -#endif return 0; } -#endif // SendPacketToGuild(packet) /** @@ -201,11 +159,7 @@ namespace LuaGuild { WorldPacket* data = Eluna::CHECKOBJ(L, 2); -#ifdef CMANGOS - guild->BroadcastPacket(*data); -#else guild->BroadcastPacket(data); -#endif return 0; } @@ -221,11 +175,7 @@ namespace LuaGuild WorldPacket* data = Eluna::CHECKOBJ(L, 2); uint8 ranked = Eluna::CHECKVAL(L, 3); -#ifdef CMANGOS - guild->BroadcastPacketToRank(*data, ranked); -#else guild->BroadcastPacketToRank(data, ranked); -#endif return 0; } @@ -251,12 +201,7 @@ namespace LuaGuild Player* player = Eluna::CHECKOBJ(L, 2); uint8 rankId = Eluna::CHECKVAL(L, 3, GUILD_RANK_NONE); -#ifdef TRINITY - CharacterDatabaseTransaction trans(nullptr); - guild->AddMember(trans, player->GET_GUID(), rankId); -#else guild->AddMember(player->GET_GUID(), rankId); -#endif return 0; } @@ -271,14 +216,7 @@ namespace LuaGuild Player* player = Eluna::CHECKOBJ(L, 2); bool isDisbanding = Eluna::CHECKVAL(L, 3, false); -#if defined TRINITY - CharacterDatabaseTransaction trans(nullptr); - guild->DeleteMember(trans, player->GET_GUID(), isDisbanding); -#elif defined AZEROTHCORE guild->DeleteMember(player->GET_GUID(), isDisbanding); -#else - guild->DelMember(player->GET_GUID(), isDisbanding); -#endif return 0; } @@ -293,12 +231,7 @@ namespace LuaGuild Player* player = Eluna::CHECKOBJ(L, 2); uint8 newRank = Eluna::CHECKVAL(L, 3); -#ifdef TRINITY - CharacterDatabaseTransaction trans(nullptr); - guild->ChangeMemberRank(trans, player->GET_GUID(), newRank); -#else guild->ChangeMemberRank(player->GET_GUID(), newRank); -#endif return 0; } }; diff --git a/src/LuaEngine/methods/ItemMethods.h b/src/LuaEngine/methods/ItemMethods.h index 9c85551..30a6687 100644 --- a/src/LuaEngine/methods/ItemMethods.h +++ b/src/LuaEngine/methods/ItemMethods.h @@ -23,7 +23,6 @@ namespace LuaItem return 1; } -#if (!defined(TBC) && !defined(CLASSIC)) /** * Returns 'true' if the [Item] is account bound, 'false' otherwise * @@ -34,7 +33,6 @@ namespace LuaItem Eluna::Push(L, item->IsBoundAccountWide()); return 1; } -#endif /** * Returns 'true' if the [Item] is bound to a [Player] by an enchant, 'false' otehrwise @@ -83,7 +81,6 @@ namespace LuaItem return 1; } -#ifndef CLASSIC /** * Returns 'true' if the [Item] is a currency token, 'false' otherwise * @@ -94,7 +91,6 @@ namespace LuaItem Eluna::Push(L, item->IsCurrencyToken()); return 1; } -#endif /** * Returns 'true' if the [Item] is a not an empty bag, 'false' otherwise @@ -125,12 +121,8 @@ namespace LuaItem */ int CanBeTraded(lua_State* L, Item* item) { -#if (defined(TBC) || defined(CLASSIC)) - Eluna::Push(L, item->CanBeTraded()); -#else bool mail = Eluna::CHECKVAL(L, 2, false); Eluna::Push(L, item->CanBeTraded(mail)); -#endif return 1; } @@ -176,11 +168,7 @@ namespace LuaItem int HasQuest(lua_State* L, Item* item) { uint32 quest = Eluna::CHECKVAL(L, 2); -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, item->hasQuest(quest)); -#else - Eluna::Push(L, item->HasQuest(quest)); -#endif return 1; } @@ -195,7 +183,6 @@ namespace LuaItem return 1; } -#if defined CLASSIC || defined(TBC) || defined(WOTLK) /** * Returns 'true' if the [Item] is a weapon vellum, 'false' otherwise * @@ -217,7 +204,6 @@ namespace LuaItem Eluna::Push(L, item->IsArmorVellum()); return 1; } -#endif /** * Returns 'true' if the [Item] is a conjured consumable, 'false' otherwise @@ -270,49 +256,24 @@ namespace LuaItem ObjectMgr::GetLocaleString(il->Name, static_cast(locale), name); } -#ifndef CLASSIC if (int32 itemRandPropId = item->GetItemRandomPropertyId()) { -#if defined(CATA) || defined (MISTS) - char* suffix = NULL; -#else -#if TRINITY || AZEROTHCORE std::array const* suffix = NULL; -#else - char* const* suffix = NULL; -#endif -#endif if (itemRandPropId < 0) { const ItemRandomSuffixEntry* itemRandEntry = sItemRandomSuffixStore.LookupEntry(-item->GetItemRandomPropertyId()); if (itemRandEntry) - { -#if TRINITY || AZEROTHCORE suffix = &itemRandEntry->Name; -#else - suffix = itemRandEntry->nameSuffix; -#endif - } } else { const ItemRandomPropertiesEntry* itemRandEntry = sItemRandomPropertiesStore.LookupEntry(item->GetItemRandomPropertyId()); if (itemRandEntry) - { -#if TRINITY || AZEROTHCORE suffix = &itemRandEntry->Name; -#else - suffix = itemRandEntry->nameSuffix; -#endif - } } if (suffix) { -#if TRINITY || AZEROTHCORE const char* suffixName = (*suffix)[(name != temp->Name1) ? locale : uint8(DEFAULT_LOCALE)]; -#else - const char* suffixName = suffix[(name != temp->Name1) ? locale : uint8(DEFAULT_LOCALE)]; -#endif if (strcmp(suffixName, "") != 0) { name += ' '; @@ -320,19 +281,16 @@ namespace LuaItem } } } -#endif Player* owner = item->GetOwner(); std::ostringstream oss; oss << "|c" << std::hex << ItemQualityColors[temp->Quality] << std::dec << "|Hitem:" << temp->ItemId << ":" << item->GetEnchantmentId(PERM_ENCHANTMENT_SLOT) << ":" << -#ifndef CLASSIC item->GetEnchantmentId(SOCK_ENCHANTMENT_SLOT) << ":" << item->GetEnchantmentId(SOCK_ENCHANTMENT_SLOT_2) << ":" << item->GetEnchantmentId(SOCK_ENCHANTMENT_SLOT_3) << ":" << item->GetEnchantmentId(BONUS_ENCHANTMENT_SLOT) << ":" << -#endif item->GetItemRandomPropertyId() << ":" << item->GetItemSuffixFactor() << ":" << (uint32)(owner ? owner->GetLevel() : 0) << "|h[" << name << "]|h|r"; @@ -342,11 +300,7 @@ namespace LuaItem int GetOwnerGUID(lua_State* L, Item* item) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, item->GetOwnerGUID()); -#else - Eluna::Push(L, item->GetOwnerGuid()); -#endif return 1; } @@ -597,13 +551,11 @@ namespace LuaItem return 1; } -#ifdef WOTLK int GetStatsCount(lua_State* L, Item* item) { Eluna::Push(L, item->GetTemplate()->StatsCount); return 1; } -#endif /** * Returns the random property ID of this [Item] @@ -616,13 +568,11 @@ namespace LuaItem return 1; } -#ifndef CLASSIC int GetRandomSuffix(lua_State* L, Item* item) { Eluna::Push(L, item->GetTemplate()->RandomSuffix); return 1; } -#endif /** * Returns the item set ID of this [Item] @@ -668,11 +618,7 @@ namespace LuaItem int SetOwner(lua_State* L, Item* item) { Player* player = Eluna::CHECKOBJ(L, 2); -#if defined TRINITY || AZEROTHCORE item->SetOwnerGUID(player->GET_GUID()); -#else - item->SetOwnerGuid(player->GET_GUID()); -#endif return 0; } @@ -774,12 +720,8 @@ namespace LuaItem */ int SaveToDB(lua_State* /*L*/, Item* item) { -#if defined TRINITY || defined AZEROTHCORE CharacterDatabaseTransaction trans = CharacterDatabaseTransaction(nullptr); item->SaveToDB(trans); -#else - item->SaveToDB(); -#endif return 0; } }; diff --git a/src/LuaEngine/methods/MapMethods.h b/src/LuaEngine/methods/MapMethods.h index aa85ecc..c2781cc 100644 --- a/src/LuaEngine/methods/MapMethods.h +++ b/src/LuaEngine/methods/MapMethods.h @@ -17,7 +17,6 @@ namespace LuaMap { -#ifndef CLASSIC /** * Returns `true` if the [Map] is an arena [BattleGround], `false` otherwise. * @@ -28,7 +27,6 @@ namespace LuaMap Eluna::Push(L, map->IsBattleArena()); return 1; } -#endif /** * Returns `true` if the [Map] is a non-arena [BattleGround], `false` otherwise. @@ -37,11 +35,7 @@ namespace LuaMap */ int IsBattleground(lua_State* L, Map* map) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, map->IsBattleground()); -#else - Eluna::Push(L, map->IsBattleGround()); -#endif return 1; } @@ -67,7 +61,6 @@ namespace LuaMap return 1; } -#ifndef CLASSIC /** * Returns `true` if the [Map] is a heroic, `false` otherwise. * @@ -78,7 +71,6 @@ namespace LuaMap Eluna::Push(L, map->IsHeroic()); return 1; } -#endif /** * Returns `true` if the [Map] is a raid, `false` otherwise. @@ -115,12 +107,8 @@ namespace LuaMap { float x = Eluna::CHECKVAL(L, 2); float y = Eluna::CHECKVAL(L, 3); -#if (defined(TBC) || defined(CLASSIC)) - float z = map->GetHeight(x, y, MAX_HEIGHT); -#else uint32 phasemask = Eluna::CHECKVAL(L, 4, 1); float z = map->GetHeight(phasemask, x, y, MAX_HEIGHT); -#endif if (z != INVALID_HEIGHT) Eluna::Push(L, z); return 1; @@ -135,11 +123,7 @@ namespace LuaMap */ int GetDifficulty(lua_State* L, Map* map) { -#ifndef CLASSIC Eluna::Push(L, map->GetDifficulty()); -#else - Eluna::Push(L, (Difficulty)0); -#endif return 1; } @@ -190,13 +174,9 @@ namespace LuaMap float x = Eluna::CHECKVAL(L, 2); float y = Eluna::CHECKVAL(L, 3); float z = Eluna::CHECKVAL(L, 4); -#if defined TRINITY || defined AZEROTHCORE float phasemask = Eluna::CHECKVAL(L, 5, PHASEMASK_NORMAL); Eluna::Push(L, map->GetAreaId(phasemask, x, y, z)); -#else - Eluna::Push(L, map->GetTerrain()->GetAreaId(x, y, z)); -#endif return 1; } @@ -210,7 +190,6 @@ namespace LuaMap { ObjectGuid guid = Eluna::CHECKVAL(L, 2); -#if defined TRINITY || AZEROTHCORE switch (guid.GetHigh()) { case HIGHGUID_PLAYER: @@ -237,9 +216,6 @@ namespace LuaMap default: break; } -#else - Eluna::Push(L, map->GetWorldObject(guid)); -#endif return 1; } @@ -267,19 +243,11 @@ namespace LuaMap uint32 weatherType = Eluna::CHECKVAL(L, 3); float grade = Eluna::CHECKVAL(L, 4); -#if defined TRINITY - if (Weather * weather = map->GetOrGenerateZoneDefaultWeather(zoneId)) - weather->SetWeather((WeatherType)weatherType, grade); -#elif defined AZEROTHCORE Weather* weather = WeatherMgr::FindWeather(zoneId); if (!weather) weather = WeatherMgr::AddWeather(zoneId); if (weather) weather->SetWeather((WeatherType)weatherType, grade); -#else - if (Weather::IsValidWeatherType(weatherType)) - map->SetWeather(zoneId, (WeatherType)weatherType, grade, false); -#endif return 0; } @@ -293,13 +261,9 @@ namespace LuaMap */ int GetInstanceData(lua_State* L, Map* map) { -#if defined TRINITY || AZEROTHCORE ElunaInstanceAI* iAI = NULL; if (InstanceMap* inst = map->ToInstanceMap()) iAI = dynamic_cast(inst->GetInstanceScript()); -#else - ElunaInstanceAI* iAI = dynamic_cast(map->GetInstanceData()); -#endif if (iAI) Eluna::GetEluna(L)->PushInstanceData(L, iAI, false); @@ -314,13 +278,9 @@ namespace LuaMap */ int SaveInstanceData(lua_State* /*L*/, Map* map) { -#if defined TRINITY || AZEROTHCORE ElunaInstanceAI* iAI = NULL; if (InstanceMap* inst = map->ToInstanceMap()) iAI = dynamic_cast(inst->GetInstanceScript()); -#else - ElunaInstanceAI* iAI = dynamic_cast(map->GetInstanceData()); -#endif if (iAI) iAI->SaveToDB(); @@ -352,11 +312,7 @@ namespace LuaMap Map::PlayerList const& players = map->GetPlayers(); for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { -#if defined TRINITY || AZEROTHCORE Player* player = itr->GetSource(); -#else - Player* player = itr->getSource(); -#endif if (!player) continue; if (player->GetSession() && (team >= TEAM_NEUTRAL || player->GetTeamId() == team)) diff --git a/src/LuaEngine/methods/ObjectMethods.h b/src/LuaEngine/methods/ObjectMethods.h index d96fbdf..28ef17a 100644 --- a/src/LuaEngine/methods/ObjectMethods.h +++ b/src/LuaEngine/methods/ObjectMethods.h @@ -58,9 +58,7 @@ namespace LuaObject */ int IsPlayer(lua_State* L, Object* obj) { -#ifdef AZEROTHCORE //AC-only Eluna::Push(L, obj->IsPlayer()); -#endif return 1; } @@ -146,11 +144,7 @@ namespace LuaObject */ int GetScale(lua_State* L, Object* obj) { -#ifndef AZEROTHCORE - Eluna::Push(L, obj->GetObjectScale()); -#else Eluna::Push(L, obj->GetFloatValue(OBJECT_FIELD_SCALE_X)); -#endif return 1; } @@ -199,11 +193,7 @@ namespace LuaObject */ int GetGUIDLow(lua_State* L, Object* obj) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, obj->GetGUID().GetCounter()); -#else - Eluna::Push(L, obj->GetGUIDLow()); -#endif return 1; } diff --git a/src/LuaEngine/methods/PlayerMethods.h b/src/LuaEngine/methods/PlayerMethods.h index b1f8051..b0d3c29 100644 --- a/src/LuaEngine/methods/PlayerMethods.h +++ b/src/LuaEngine/methods/PlayerMethods.h @@ -16,7 +16,6 @@ */ namespace LuaPlayer { -#if (!defined(TBC) && !defined(CLASSIC)) /** * Returns `true` if the [Player] can Titan Grip, `false` otherwise. * @@ -38,11 +37,7 @@ namespace LuaPlayer int HasTalent(lua_State* L, Player* player) { uint32 spellId = Eluna::CHECKVAL(L, 2); -#ifdef MANGOS - uint8 maxSpecs = MAX_TALENT_SPEC_COUNT; -#else uint8 maxSpecs = MAX_TALENT_SPECS; -#endif uint8 spec = Eluna::CHECKVAL(L, 3); if (spec >= maxSpecs) return 1; @@ -59,11 +54,7 @@ namespace LuaPlayer int HasAchieved(lua_State* L, Player* player) { uint32 achievementId = Eluna::CHECKVAL(L, 2); -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, player->HasAchieved(achievementId)); -#else - Eluna::Push(L, player->GetAchievementMgr().HasAchievement(achievementId)); -#endif return 1; } @@ -88,7 +79,6 @@ namespace LuaPlayer } return 1; } -#endif /** * Returns `true` if the [Player] has an active [Quest] by specific ID, `false` otherwise. @@ -160,7 +150,6 @@ namespace LuaPlayer return 1; } -#ifndef CLASSIC /** * Returns `true` if the [Player] has a title by specific ID, `false` otherwise. * @@ -175,7 +164,6 @@ namespace LuaPlayer Eluna::Push(L, player->HasTitle(titleInfo)); return 1; } -#endif /** * Returns `true` if the [Player] has the given amount of item entry specified, `false` otherwise. @@ -244,11 +232,7 @@ namespace LuaPlayer { uint32 spellId = Eluna::CHECKVAL(L, 2); -#ifdef TRINITY - Eluna::Push(L, player->GetSpellHistory()->HasCooldown(spellId)); -#else Eluna::Push(L, player->HasSpellCooldown(spellId)); -#endif return 1; } @@ -273,11 +257,7 @@ namespace LuaPlayer */ int CanSpeak(lua_State* L, Player* player) { -#ifdef TRINITY - Eluna::Push(L, player->GetSession()->CanSpeak()); -#else Eluna::Push(L, player->CanSpeak()); -#endif return 1; } @@ -292,7 +272,6 @@ namespace LuaPlayer return 1; } -#ifndef CLASSIC /** * Returns `true` if the [Player] can fly, `false` otherwise. * @@ -303,45 +282,6 @@ namespace LuaPlayer Eluna::Push(L, player->CanFly()); return 1; } -#endif - -#ifdef CLASSIC - /** - * Returns [Player] kills - * - * @param bool honorable = true : if victims are honorable - * @return uint32 kills - */ - int GetHonorStoredKills(lua_State* L, Player* player) - { - bool honorable = Eluna::CHECKVAL(L, 2, true); - - Eluna::Push(L, player->GetHonorStoredKills(honorable)); - return 1; - } - - /** - * Returns rank points - * - * @return float rankPoints - */ - int GetRankPoints(lua_State* L, Player* player) - { - Eluna::Push(L, player->GetRankPoints()); - return 1; - } - - /** - * Returns last week's standing position - * - * @return int32 standingPos - */ - int GetHonorLastWeekStandingPos(lua_State* L, Player* player) - { - Eluna::Push(L, player->GetHonorLastWeekStandingPos()); - return 1; - } -#endif /** * Returns `true` if the [Player] is currently in water, `false` otherwise. @@ -365,36 +305,6 @@ namespace LuaPlayer return 1; } -#ifdef CLASSIC - /** - * Updates the [Player]s weekly honor status - */ - int UpdateHonor(lua_State* L, Player* player) - { - player->UpdateHonor(); - return 0; - } - - /** - * Resets the [Player]s weekly honor status - */ - int ResetHonor(lua_State* L, Player* player) - { - player->ResetHonor(); - return 0; - } - - /** - * Clears all of [Player]s weekly honor status - */ - int ClearHonorInfo(lua_State* L, Player* player) - { - player->ClearHonorInfo(); - return 0; - } -#endif - -#ifndef CLASSIC /** * Returns `true` if the [Player] is currently flying, `false` otherwise. * @@ -405,7 +315,6 @@ namespace LuaPlayer Eluna::Push(L, player->IsFlying()); return 1; } -#endif /** * Returns `true` if the [Player] has a Tank Specialization, `false` otherwise. @@ -482,15 +391,10 @@ namespace LuaPlayer */ int IsGM(lua_State* L, Player* player) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, player->IsGameMaster()); -#else - Eluna::Push(L, player->isGameMaster()); -#endif return 1; } -#ifndef CLASSIC /** * Returns `true` if the [Player] is in an arena team specified by type, `false` otherwise. * @@ -506,7 +410,6 @@ namespace LuaPlayer Eluna::Push(L, false); return 1; } -#endif /** * Returns `true` if the [Player] is immune to everything. @@ -580,11 +483,7 @@ namespace LuaPlayer */ int IsHorde(lua_State* L, Player* player) { -#ifdef AZEROTHCORE Eluna::Push(L, (player->GetTeamId() == TEAM_HORDE)); -#else - Eluna::Push(L, (player->GetTeam() == HORDE)); -#endif return 1; } @@ -595,11 +494,7 @@ namespace LuaPlayer */ int IsAlliance(lua_State* L, Player* player) { -#ifdef AZEROTHCORE Eluna::Push(L, (player->GetTeamId() == TEAM_ALLIANCE)); -#else - Eluna::Push(L, (player->GetTeam() == ALLIANCE)); -#endif return 1; } @@ -710,11 +605,7 @@ namespace LuaPlayer */ int IsTaxiCheater(lua_State* L, Player* player) { -#ifdef MANGOS - Eluna::Push(L, player->IsTaxiCheater()); -#else Eluna::Push(L, player->isTaxiCheater()); -#endif return 1; } @@ -753,15 +644,10 @@ namespace LuaPlayer */ int InBattlegroundQueue(lua_State* L, Player* player) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, player->InBattlegroundQueue()); -#else - Eluna::Push(L, player->InBattleGroundQueue()); -#endif return 1; } -#ifndef CLASSIC /** * Returns `true` if the [Player] is currently in an arena, `false` otherwise. * @@ -772,7 +658,6 @@ namespace LuaPlayer Eluna::Push(L, player->InArena()); return 1; } -#endif /** * Returns `true` if the [Player] is currently in a [BattleGround], `false` otherwise. @@ -781,11 +666,7 @@ namespace LuaPlayer */ int InBattleground(lua_State* L, Player* player) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, player->InBattleground()); -#else - Eluna::Push(L, player->InBattleGround()); -#endif return 1; } @@ -870,7 +751,6 @@ namespace LuaPlayer return 1; }*/ -#if (!defined(TBC) && !defined(CLASSIC)) /** * Returns the amount of available specs the [Player] currently has * @@ -892,9 +772,7 @@ namespace LuaPlayer Eluna::Push(L, player->GetActiveSpec()); return 1; } -#endif -#ifdef WOTLK /** * Returns the normal phase of the player instead of the actual phase possibly containing GM phase * @@ -950,9 +828,7 @@ namespace LuaPlayer Eluna::Push(L, count); return 1; } -#endif -#if defined(TBC) || defined (WOTLK) /** * Returns the [Player]s current amount of Arena Points * @@ -974,8 +850,7 @@ namespace LuaPlayer Eluna::Push(L, player->GetHonorPoints()); return 1; } -#endif -#if defined(CLASSIC) || defined(TBC) || defined (WOTLK) + /** * Returns the [Player]s current shield block value * @@ -986,7 +861,6 @@ namespace LuaPlayer Eluna::Push(L, player->GetShieldBlockValue()); return 1; } -#endif /** * Returns the [Player]s cooldown delay by specified [Spell] ID @@ -998,14 +872,7 @@ namespace LuaPlayer { uint32 spellId = Eluna::CHECKVAL(L, 2); -#ifdef TRINITY - if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId)) - Eluna::Push(L, player->GetSpellHistory()->GetRemainingCooldown(spellInfo)); - else - Eluna::Push(L, 0); -#else Eluna::Push(L, uint32(player->GetSpellCooldownDelay(spellId))); -#endif return 1; } @@ -1020,7 +887,6 @@ namespace LuaPlayer return 1; } -#if defined TRINITY || AZEROTHCORE /** * Returns the faction ID the [Player] is currently flagged as champion for * @@ -1031,7 +897,6 @@ namespace LuaPlayer Eluna::Push(L, player->GetChampioningFaction()); return 1; } -#endif /** * Returns [Player]s original sub group @@ -1123,11 +988,7 @@ namespace LuaPlayer */ int GetBattlegroundTypeId(lua_State* L, Player* player) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, player->GetBattlegroundTypeId()); -#else - Eluna::Push(L, player->GetBattleGroundTypeId()); -#endif return 1; } @@ -1138,11 +999,7 @@ namespace LuaPlayer */ int GetBattlegroundId(lua_State* L, Player* player) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, player->GetBattlegroundId()); -#else - Eluna::Push(L, player->GetBattleGroundId()); -#endif return 1; } @@ -1299,14 +1156,8 @@ namespace LuaPlayer */ int GetDifficulty(lua_State* L, Player* player) { -#ifdef TBC - Eluna::Push(L, player->GetDifficulty()); -#elif defined(CLASSIC) - Eluna::Push(L, (Difficulty)0); -#else bool isRaid = Eluna::CHECKVAL(L, 2, true); Eluna::Push(L, player->GetDifficulty(isRaid)); -#endif return 1; } @@ -1366,11 +1217,7 @@ namespace LuaPlayer */ int GetComboTarget(lua_State* L, Player* player) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, player->GetComboTarget()); -#else - Eluna::Push(L, player->GetMap()->GetUnit(player->GetComboTargetGuid())); -#endif return 1; } @@ -1450,11 +1297,7 @@ namespace LuaPlayer { Quest* quest = Eluna::CHECKOBJ(L, 2); -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, player->GetQuestLevel(quest)); -#else - Eluna::Push(L, player->GetQuestLevelForPlayer(quest)); -#endif return 1; } @@ -1617,11 +1460,7 @@ namespace LuaPlayer */ int GetSelection(lua_State* L, Player* player) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, player->GetSelectedUnit()); -#else - Eluna::Push(L, player->GetMap()->GetUnit(player->GetSelectionGuid())); -#endif return 1; } @@ -1769,11 +1608,7 @@ namespace LuaPlayer int GetAccountName(lua_State* L, Player* player) { std::string accName; -#ifndef AZEROTHCORE - if (eAccountMgr->GetName(player->GetSession()->GetAccountId(), accName)) -#else if (AccountMgr::GetName(player->GetSession()->GetAccountId(), accName)) -#endif Eluna::Push(L, accName); return 1; } @@ -1920,11 +1755,7 @@ namespace LuaPlayer { uint8 race = Eluna::CHECKVAL(L, 2); -#if defined TRINITY || AZEROTHCORE player->SetFactionForRace(race); -#else - player->setFactionForRace(race); -#endif return 0; } @@ -1943,11 +1774,7 @@ namespace LuaPlayer uint16 currVal = Eluna::CHECKVAL(L, 4); uint16 maxVal = Eluna::CHECKVAL(L, 5); -#ifdef TRINITY - player->SetSkill(id, step, currVal, maxVal); -#else player->SetSkill(id, currVal, maxVal, step); -#endif return 0; } @@ -1977,9 +1804,7 @@ namespace LuaPlayer uint32 points = Eluna::CHECKVAL(L, 2); player->SetFreeTalentPoints(points); -#if (!defined(TBC) && !defined(CLASSIC)) player->SendTalentsInfoData(false); -#endif return 0; } @@ -2138,7 +1963,6 @@ namespace LuaPlayer return 0; } -#if defined(TBC) || defined(WOTLK) /** * Sets the [Player]s Arena Points to the amount specified * @@ -2162,50 +1986,6 @@ namespace LuaPlayer player->SetHonorPoints(honorP); return 0; } -#endif - -#ifdef CLASSIC - /** - * Sets kills - * - * @param uint32 kills - * @param bool honorable = true : if victims were honorable - */ - int SetHonorStoredKills(lua_State* L, Player* player) - { - uint32 kills = Eluna::CHECKVAL(L, 2); - bool honorable = Eluna::CHECKVAL(L, 3, true); - - player->SetHonorStoredKills(kills, honorable); - return 0; - } - - /** - * Sets rank points - * - * @param float rankPoints - */ - int SetRankPoints(lua_State* L, Player* player) - { - float rankPoints = Eluna::CHECKVAL(L, 2); - - player->SetRankPoints(rankPoints); - return 0; - } - - /** - * Sets last week's honor standing position - * - * @param int32 standingPos - */ - int SetHonorLastWeekStandingPos(lua_State* L, Player* player) - { - int32 standingPos = Eluna::CHECKVAL(L, 2); - - player->SetHonorLastWeekStandingPos(standingPos); - return 0; - } -#endif /** * Sets the [Player]s amount of Lifetime Honorable Kills to the value specified @@ -2249,15 +2029,10 @@ namespace LuaPlayer uint32 areaId = Eluna::CHECKVAL(L, 6); WorldLocation loc(mapId, x, y, z); -#if defined TRINITY || AZEROTHCORE player->SetHomebind(loc, areaId); -#else - player->SetHomebindToLocation(loc, areaId); -#endif return 0; } -#ifndef CLASSIC /** * Adds the specified title to the [Player]s list of known titles * @@ -2272,8 +2047,6 @@ namespace LuaPlayer return 0; } - -#if defined(TRINITY) || defined(AZEROTHCORE) /** * Adds the specified achievement to the [Player]s * @@ -2287,24 +2060,6 @@ namespace LuaPlayer player->CompletedAchievement(t); return 0; } -#endif - -#endif - -#if !defined TRINITY && !AZEROTHCORE - /** - * Toggle the [Player]s FFA flag - * - * @param bool applyFFA = true - */ - int SetFFA(lua_State* L, Player* player) - { - bool apply = Eluna::CHECKVAL(L, 2, true); - - player->SetFFAPvP(apply); - return 0; - } -#endif /*int SetMovement(lua_State* L, Player* player) { @@ -2314,21 +2069,15 @@ namespace LuaPlayer return 0; }*/ -#if (!defined(TBC) && !defined(CLASSIC)) /** * Resets the [Player]s pets talent points */ int ResetPetTalents(lua_State* /*L*/, Player* player) { -#ifndef TRINITY Pet* pet = player->GetPet(); Pet::resetTalentsForAllPetsOf(player, pet); if (pet) player->SendTalentsInfoData(true); -#else - player->ResetPetTalents(); - player->SendTalentsInfoData(true); -#endif return 0; } @@ -2337,14 +2086,9 @@ namespace LuaPlayer */ int ResetAchievements(lua_State* /*L*/, Player* player) { -#if defined TRINITY || AZEROTHCORE player->ResetAchievements(); -#else - player->GetAchievementMgr().Reset(); -#endif return 0; } -#endif /** * Shows the mailbox window to the player from specified guid. @@ -2355,17 +2099,10 @@ namespace LuaPlayer { ObjectGuid guid = Eluna::CHECKVAL(L, 2, player->GET_GUID()); -#if (defined(CLASSIC) || defined(TBC)) - WorldPacket data(CMSG_GET_MAIL_LIST, 8); - data << guid; - player->GetSession()->HandleGetMailList(data); -#else player->GetSession()->SendShowMailBox(guid); -#endif return 0; } -#if defined(TBC) || defined(WOTLK) /** * Adds or detracts from the [Player]s current Arena Points * @@ -2391,18 +2128,13 @@ namespace LuaPlayer player->ModifyHonorPoints(amount); return 0; } -#endif /** * Saves the [Player] to the database */ int SaveToDB(lua_State* /*L*/, Player* player) { -#ifndef AZEROTHCORE - player->SaveToDB(); -#else player->SaveToDB(false, false); -#endif return 0; } @@ -2415,9 +2147,6 @@ namespace LuaPlayer { Unit* summoner = Eluna::CHECKOBJ(L, 2); -#ifdef TRINITY - player->SendSummonRequestFrom(summoner); -#else float x, y, z; summoner->GetPosition(x,y,z); player->SetSummonPoint(summoner->GetMapId(), x, y, z); @@ -2426,12 +2155,7 @@ namespace LuaPlayer data << summoner->GET_GUID(); data << uint32(summoner->GetZoneId()); data << uint32(MAX_PLAYER_SUMMON_DELAY * IN_MILLISECONDS); -#ifdef CMANGOS - player->GetSession()->SendPacket(data); -#else player->GetSession()->SendPacket(&data); -#endif -#endif return 0; } @@ -2479,29 +2203,15 @@ namespace LuaPlayer { Unit* unit = Eluna::CHECKOBJ(L, 2); -#if defined AZEROTHCORE - AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntryFromFactionTemplate(unit->GetFaction()); -#elif defined TRINITY - AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntry(unit->GetFaction()); -#else - AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntry(unit); -#endif + AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntryFromFactionTemplate(unit->GetFaction()); if (!ahEntry) return 0; WorldPacket data(MSG_AUCTION_HELLO, 12); data << unit->GET_GUID(); -#ifdef TRINITY - data << uint32(ahEntry->ID); -#else data << uint32(ahEntry->houseId); -#endif data << uint8(1); -#ifdef CMANGOS - player->GetSession()->SendPacket(data); -#else player->GetSession()->SendPacket(&data); -#endif return 0; } @@ -2576,11 +2286,7 @@ namespace LuaPlayer { Creature* obj = Eluna::CHECKOBJ(L, 2); -#ifdef TRINITY - player->GetSession()->SendTrainerList(obj); -#else player->GetSession()->SendTrainerList(obj->GET_GUID()); -#endif return 0; } @@ -2593,12 +2299,8 @@ namespace LuaPlayer { Player* plr = Eluna::CHECKOBJ(L, 2); -#if defined TRINITY || AZEROTHCORE if (Guild* guild = player->GetGuild()) guild->HandleInviteMember(player->GetSession(), plr->GetName()); -#else - player->GetSession()->SendGuildInvite(plr); -#endif return 0; } @@ -2635,11 +2337,7 @@ namespace LuaPlayer */ int RemoveFromBattlegroundRaid(lua_State* /*L*/, Player* player) { -#if defined TRINITY || AZEROTHCORE player->RemoveFromBattlegroundOrBattlefieldRaid(); -#else - player->RemoveFromBattleGroundRaid(); -#endif return 0; } @@ -2654,18 +2352,10 @@ namespace LuaPlayer int UnbindInstance(lua_State* L, Player* player) { uint32 map = Eluna::CHECKVAL(L, 2); -#ifndef CLASSIC uint32 difficulty = Eluna::CHECKVAL(L, 3, 0); if (difficulty < MAX_DIFFICULTY) -#ifndef AZEROTHCORE - player->UnbindInstance(map, (Difficulty)difficulty); -#else sInstanceSaveMgr->PlayerUnbindInstance(player->GetGUID(), map, Difficulty(difficulty), true, player); -#endif//AZEROTHCORE -#else//CLASSIC - player->UnbindInstance(map); -#endif return 0; } @@ -2674,16 +2364,6 @@ namespace LuaPlayer */ int UnbindAllInstances(lua_State* /*L*/, Player* player) { -#ifdef CLASSIC - Player::BoundInstancesMap& binds = player->GetBoundInstances(); - for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();) - { - if (itr->first != player->GetMapId()) - player->UnbindInstance(itr); - else - ++itr; - } -#elif defined AZEROTHCORE for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) { const BoundInstancesMap& binds = sInstanceSaveMgr->PlayerGetBoundInstances(player->GetGUID(), Difficulty(i)); @@ -2700,19 +2380,7 @@ namespace LuaPlayer } } } -#else - for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) - { - Player::BoundInstancesMap& binds = player->GetBoundInstances(Difficulty(i)); - for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();) - { - if (itr->first != player->GetMapId()) - player->UnbindInstance(itr, Difficulty(i)); - else - ++itr; - } - } -#endif + return 0; } @@ -2724,12 +2392,7 @@ namespace LuaPlayer int LeaveBattleground(lua_State* L, Player* player) { (void)L; // ensure that the variable is referenced in order to pass compiler checks -#ifndef AZEROTHCORE - bool teleToEntryPoint = Eluna::CHECKVAL(L, 2, true); - player->LeaveBattleground(teleToEntryPoint); -#else player->LeaveBattleground(); -#endif return 0; } @@ -2746,13 +2409,7 @@ namespace LuaPlayer bool takeCost = Eluna::CHECKVAL(L, 3, true); float discountMod = Eluna::CHECKVAL(L, 4, 1.0f); -#ifdef CLASSIC - player->DurabilityRepair(position, takeCost, discountMod); -#elif defined(TRINITY) - player->DurabilityRepair(position, takeCost, discountMod); -#else player->DurabilityRepair(position, takeCost, discountMod, false); -#endif return 0; } @@ -2769,11 +2426,7 @@ namespace LuaPlayer float discountMod = Eluna::CHECKVAL(L, 3, 1.0f); bool guildBank = Eluna::CHECKVAL(L, 4, false); -#ifdef CLASSIC - player->DurabilityRepairAll(takeCost, discountMod); -#else player->DurabilityRepairAll(takeCost, discountMod, guildBank); -#endif return 0; } @@ -2881,15 +2534,7 @@ namespace LuaPlayer */ int ResetTalentsCost(lua_State* L, Player* player) { -#ifdef CATA - Eluna::Push(L, player->GetNextResetTalentsCost()); -#else -#ifdef TRINITY - Eluna::Push(L, player->ResetTalentsCost()); -#else Eluna::Push(L, player->resetTalentsCost()); -#endif -#endif return 1; } @@ -2902,18 +2547,8 @@ namespace LuaPlayer { bool no_cost = Eluna::CHECKVAL(L, 2, true); -#ifdef CATA - player->ResetTalents(no_cost); -#else -#ifdef TRINITY - player->ResetTalents(no_cost); -#else player->resetTalents(no_cost); -#endif -#endif -#if (!defined(TBC) && !defined(CLASSIC)) player->SendTalentsInfoData(false); -#endif return 0; } @@ -2926,13 +2561,7 @@ namespace LuaPlayer { uint32 entry = Eluna::CHECKVAL(L, 2); -#ifdef TRINITY - player->RemoveSpell(entry); -#elif defined (AZEROTHCORE) player->removeSpell(entry, SPEC_MASK_ALL, false); -#else - player->removeSpell(entry); -#endif return 0; } @@ -3062,13 +2691,8 @@ namespace LuaPlayer // Add quest items for quests that require items for (uint8 x = 0; x < QUEST_ITEM_OBJECTIVES_COUNT; ++x) { -#if defined TRINITY || AZEROTHCORE uint32 id = quest->RequiredItemId[x]; uint32 count = quest->RequiredItemCount[x]; -#else - uint32 id = quest->ReqItemId[x]; - uint32 count = quest->ReqItemCount[x]; -#endif if (!id || !count) continue; @@ -3087,7 +2711,6 @@ namespace LuaPlayer // All creature/GO slain/cast (not required, but otherwise it will display "Creature slain 0/10") for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) { -#if defined TRINITY || AZEROTHCORE int32 creature = quest->RequiredNpcOrGo[i]; uint32 creatureCount = quest->RequiredNpcOrGoCount[i]; @@ -3100,27 +2723,6 @@ namespace LuaPlayer else if (creature < 0) for (uint16 z = 0; z < creatureCount; ++z) player->KillCreditGO(creature); -#else - int32 creature = quest->ReqCreatureOrGOId[i]; - uint32 creaturecount = quest->ReqCreatureOrGOCount[i]; - - if (uint32 spell_id = quest->ReqSpell[i]) - { - for (uint16 z = 0; z < creaturecount; ++z) - player->CastedCreatureOrGO(creature, ObjectGuid(), spell_id); - } - else if (creature > 0) - { - if (CreatureInfo const* cInfo = ObjectMgr::GetCreatureTemplate(creature)) - for (uint16 z = 0; z < creaturecount; ++z) - player->KilledMonster(cInfo, ObjectGuid()); - } - else if (creature < 0) - { - for (uint16 z = 0; z < creaturecount; ++z) - player->CastedCreatureOrGO(-creature, ObjectGuid(), 0); - } -#endif } @@ -3134,7 +2736,6 @@ namespace LuaPlayer player->GetReputationMgr().SetReputation(factionEntry, repValue); } -#if defined TRINITY || AZEROTHCORE // If the quest requires a SECOND reputation to complete if (uint32 repFaction = quest->GetRepObjectiveFaction2()) { @@ -3144,26 +2745,12 @@ namespace LuaPlayer if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(repFaction)) player->GetReputationMgr().SetReputation(factionEntry, repValue2); } -#endif // If the quest requires money int32 ReqOrRewMoney = quest->GetRewOrReqMoney(); if (ReqOrRewMoney < 0) player->ModifyMoney(-ReqOrRewMoney); -#ifdef TRINITY - if (sWorld->getBoolConfig(CONFIG_QUEST_ENABLE_QUEST_TRACKER)) // check if Quest Tracker is enabled - { - // prepare Quest Tracker datas - CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_QUEST_TRACK_GM_COMPLETE); - stmt->setUInt32(0, quest->GetQuestId()); - stmt->setUInt32(1, player->GetGUID().GetCounter()); - - // add to Quest Tracker - CharacterDatabase.Execute(stmt); - } -#endif - player->CompleteQuest(entry); return 0; } @@ -3178,52 +2765,19 @@ namespace LuaPlayer uint32 entry = Eluna::CHECKVAL(L, 2); Quest const* quest = eObjectMgr->GetQuestTemplate(entry); - if (!quest) return 0; -#if defined TRINITY || AZEROTHCORE // check item starting quest (it can work incorrectly if added without item in inventory) -#ifndef AZEROTHCORE - 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(); - }); - - if (itr != std::end(itc)) - return 0; -#else ItemTemplateContainer const* itc = sObjectMgr->GetItemTemplateStore(); ItemTemplateContainer::const_iterator result = find_if(itc->begin(), itc->end(), Finder(entry, &ItemTemplate::StartQuest)); if (result != itc->end()) return 0; -#endif + // ok, normal (creature/GO starting) quest if (player->CanAddQuest(quest, true)) player->AddQuestAndCheckCompletion(quest, NULL); -#else - // check item starting quest (it can work incorrectly if added without item in inventory) - for (uint32 id = 0; id < sItemStorage.GetMaxEntry(); ++id) - { - ItemPrototype const* pProto = sItemStorage.LookupEntry(id); - if (!pProto) - continue; - - if (pProto->StartQuest == entry) - return 0; - } - - // ok, normal (creature/GO starting) quest - if (player->CanAddQuest(quest, true)) - { - player->AddQuest(quest, NULL); - - if (player->CanCompleteQuest(entry)) - player->CompleteQuest(entry); - } -#endif return 0; } @@ -3253,26 +2807,16 @@ namespace LuaPlayer // we ignore unequippable quest items in this case, its' still be equipped player->TakeQuestSourceItem(logQuest, false); -#if defined TRINITY || AZEROTHCORE if (quest->HasFlag(QUEST_FLAGS_FLAGS_PVP)) { player->pvpInfo.IsHostile = player->pvpInfo.IsInHostileArea || player->HasPvPForcingQuest(); player->UpdatePvPState(); } -#endif } } -#if defined TRINITY || AZEROTHCORE player->RemoveActiveQuest(entry, false); player->RemoveRewardedQuest(entry); -#else - // set quest status to not started (will updated in DB at next save) - player->SetQuestStatus(entry, QUEST_STATUS_NONE); - - // reset rewarded for restart repeatable quest - player->getQuestStatusMap()[entry].m_rewarded = false; -#endif return 0; } @@ -3288,13 +2832,8 @@ namespace LuaPlayer { std::string text = Eluna::CHECKVAL(L, 2); uint32 lang = Eluna::CHECKVAL(L, 3); -#if defined(TRINITY) || defined(AZEROTHCORE) Player* receiver = Eluna::CHECKOBJ(L, 4); player->Whisper(text, (Language)lang, receiver); -#else - ObjectGuid guid = Eluna::CHECKVAL(L, 4); - player->Whisper(text, lang, guid); -#endif return 0; } @@ -3321,11 +2860,7 @@ namespace LuaPlayer { std::string text = Eluna::CHECKVAL(L, 2); uint32 lang = Eluna::CHECKVAL(L, 3); -#if defined(TRINITY) || defined(AZEROTHCORE) player->Yell(text, (Language)lang); -#else - player->Yell(text, lang); -#endif return 0; } @@ -3339,11 +2874,7 @@ namespace LuaPlayer { std::string text = Eluna::CHECKVAL(L, 2); uint32 lang = Eluna::CHECKVAL(L, 3); -#if defined(TRINITY) || defined(AZEROTHCORE) player->Say(text, (Language)lang); -#else - player->Say(text, lang); -#endif return 0; } @@ -3444,9 +2975,7 @@ namespace LuaPlayer return 1; } player->ItemAddedQuestCheck(entry, 1); -#if (!defined(TBC) && !defined(CLASSIC)) player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, entry, 1); -#endif } else { @@ -3506,7 +3035,6 @@ namespace LuaPlayer return 1; } -#ifndef CLASSIC /** * Removes a title by ID from the [Player]s list of known titles * @@ -3520,18 +3048,13 @@ namespace LuaPlayer player->SetTitle(t, true); return 0; } -#endif /** * Advances all of the [Player]s weapon skills to the maximum amount available */ int AdvanceSkillsToMax(lua_State* /*L*/, Player* player) { -#ifdef TRINITY - player->UpdateWeaponsSkillsToMaxSkillsForLevel(); -#else player->UpdateSkillsToMaxSkillsForLevel(); -#endif return 0; } @@ -3551,19 +3074,11 @@ namespace LuaPlayer { if (SkillLineEntry const* entry = sSkillLineStore.LookupEntry(i)) { -#ifdef TRINITY - if (entry->CategoryID == SKILL_CATEGORY_LANGUAGES || entry->CategoryID == SKILL_CATEGORY_GENERIC) - continue; - - if (player->HasSkill(entry->ID)) - player->UpdateSkill(entry->ID, step); -#else if (entry->categoryId == SKILL_CATEGORY_LANGUAGES || entry->categoryId == SKILL_CATEGORY_GENERIC) continue; if (player->HasSkill(entry->id)) player->UpdateSkill(entry->id, step); -#endif } } @@ -3604,24 +3119,13 @@ namespace LuaPlayer float y = Eluna::CHECKVAL(L, 4); float z = Eluna::CHECKVAL(L, 5); float o = Eluna::CHECKVAL(L, 6); -#if defined AZEROTHCORE + if (player->IsInFlight()) { player->GetMotionMaster()->MovementExpired(); player->m_taxi.ClearTaxiDestinations(); } -#elif defined TRINITY - if (player->IsInFlight()) - player->FinishTaxiFlight(); - else - player->SaveRecallPosition(); -#else - if (player->IsTaxiFlying()) - { - player->GetMotionMaster()->MovementExpired(); - player->m_taxi.ClearTaxiDestinations(); - } -#endif + Eluna::Push(L, player->TeleportTo(mapId, x, y, z, o)); return 1; } @@ -3646,7 +3150,6 @@ namespace LuaPlayer uint32 itemId = Eluna::CHECKVAL(L, 2); uint32 itemCount = Eluna::CHECKVAL(L, 3, 1); -#if defined TRINITY || AZEROTHCORE uint32 noSpaceForCount = 0; ItemPosCountVec dest; InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, itemCount, &noSpaceForCount); @@ -3655,17 +3158,12 @@ namespace LuaPlayer if (itemCount == 0 || dest.empty()) return 1; -#ifndef AZEROTHCORE - Item* item = player->StoreNewItem(dest, itemId, true, GenerateItemRandomPropertyId(itemId)); -#else + Item* item = player->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); -#endif if (item) player->SendNewItem(item, itemCount, true, false); Eluna::Push(L, item); -#else - Eluna::Push(L, player->StoreNewItemInInventorySlot(itemId, itemCount)); -#endif + return 1; } @@ -3722,11 +3220,7 @@ namespace LuaPlayer { uint32 spellId = Eluna::CHECKVAL(L, 2); bool update = Eluna::CHECKVAL(L, 3, true); -#ifdef TRINITY - player->GetSpellHistory()->ResetCooldown(spellId, update); -#else player->RemoveSpellCooldown(spellId, update); -#endif return 0; } @@ -3742,19 +3236,7 @@ namespace LuaPlayer bool update = Eluna::CHECKVAL(L, 3, true); (void)update; // ensure that the variable is referenced in order to pass compiler checks -#ifdef TRINITY - player->GetSpellHistory()->ResetCooldowns([category](SpellHistory::CooldownStorageType::iterator itr) -> bool - { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); - return spellInfo && spellInfo->GetCategory() == category; - }, update); -#else -#ifndef AZEROTHCORE - player->RemoveSpellCategoryCooldown(category, update); -#else player->RemoveCategoryCooldown(category); -#endif -#endif return 0; } @@ -3763,11 +3245,7 @@ namespace LuaPlayer */ int ResetAllCooldowns(lua_State* /*L*/, Player* player) { -#ifdef TRINITY - player->GetSpellHistory()->ResetAllCooldowns(); -#else player->RemoveAllSpellCooldown(); -#endif return 0; } @@ -3820,17 +3298,10 @@ namespace LuaPlayer { WorldPacket* data = Eluna::CHECKOBJ(L, 2); bool selfOnly = Eluna::CHECKVAL(L, 3, true); -#ifdef CMANGOS - if (selfOnly) - player->GetSession()->SendPacket(*data); - else - player->SendMessageToSet(*data, true); -#else if (selfOnly) player->GetSession()->SendPacket(data); else player->SendMessageToSet(data, true); -#endif return 0; } @@ -3856,18 +3327,12 @@ namespace LuaPlayer data << uint8(channel); data << int32(LANG_ADDON); data << player->GET_GUID(); -#ifndef CLASSIC data << uint32(0); data << receiver->GET_GUID(); -#endif data << uint32(fullmsg.length() + 1); data << fullmsg; data << uint8(0); -#ifdef CMANGOS - receiver->GetSession()->SendPacket(data); -#else receiver->GetSession()->SendPacket(&data); -#endif return 0; } @@ -3876,11 +3341,7 @@ namespace LuaPlayer */ int KickPlayer(lua_State* /*L*/, Player* player) { -#ifdef TRINITY - player->GetSession()->KickPlayer("PlayerMethods::KickPlayer Kick the player"); -#else player->GetSession()->KickPlayer(); -#endif return 0; } @@ -3905,14 +3366,7 @@ namespace LuaPlayer int LearnSpell(lua_State* L, Player* player) { uint32 id = Eluna::CHECKVAL(L, 2); - -#ifdef TRINITY - player->LearnSpell(id, false); -#elif AZEROTHCORE player->learnSpell(id); -#else - player->learnSpell(id, false); -#endif return 0; } @@ -3928,15 +3382,8 @@ namespace LuaPlayer uint32 rank = Eluna::CHECKVAL(L, 3); player->LearnTalent(id, rank); -#if (!defined(TBC) && !defined(CLASSIC)) player->SendTalentsInfoData(false); -#endif -#if !defined TRINITY && !AZEROTHCORE - // if player has a pet, update owner talent auras - if (player->GetPet()) - player->GetPet()->CastOwnerTalentAuras(); -#endif return 0; } /** @@ -3988,7 +3435,6 @@ namespace LuaPlayer return 1; } -#if !defined(CLASSIC) /** * Remove cooldowns on spells that have less than 10 minutes of cooldown from the [Player], similarly to when you enter an arena. */ @@ -3997,7 +3443,6 @@ namespace LuaPlayer player->RemoveArenaSpellCooldowns(); return 0; } -#endif /** * Resurrects the [Player]. @@ -4041,7 +3486,6 @@ namespace LuaPlayer bool _code = Eluna::CHECKVAL(L, 6, false); const char* _promptMsg = Eluna::CHECKVAL(L, 7, ""); uint32 _money = Eluna::CHECKVAL(L, 8, 0); -#if defined TRINITY || AZEROTHCORE if (player->PlayerTalkClass->GetGossipMenu().GetMenuItemCount() < GOSSIP_MAX_MENU_ITEMS) { player->PlayerTalkClass->GetGossipMenu().AddMenuItem(-1, _icon, msg, _sender, _intid, _promptMsg, _money, @@ -4051,13 +3495,6 @@ namespace LuaPlayer { return luaL_error(L, "GossipMenuItem not added. Reached Max amount of possible GossipMenuItems in this GossipMenu"); } -#else -#ifndef CLASSIC - player->PlayerTalkClass->GetGossipMenu().AddMenuItem(_icon, msg, _sender, _intid, _promptMsg, _money, _code); -#else - player->PlayerTalkClass->GetGossipMenu().AddMenuItem(_icon, msg, _sender, _intid, _promptMsg, _code); -#endif -#endif//TRINITY return 0; } @@ -4068,11 +3505,7 @@ namespace LuaPlayer */ int GossipComplete(lua_State* /*L*/, Player* player) { -#if defined TRINITY || AZEROTHCORE player->PlayerTalkClass->SendCloseGossip(); -#else - player->PlayerTalkClass->CloseGossip(); -#endif return 0; } @@ -4156,11 +3589,7 @@ namespace LuaPlayer packet << icon; packet << data; packet << iconText; -#ifdef CMANGOS - player->GetSession()->SendPacket(packet); -#else player->GetSession()->SendPacket(&packet); -#endif return 0; } @@ -4263,27 +3692,13 @@ namespace LuaPlayer if (success) { -#if defined(CLASSIC) || defined(TBC) - WorldPacket data(SMSG_GROUP_INVITE, 10); // guess size - data << player->GetName(); -#ifdef CMANGOS - invited->GetSession()->SendPacket(data); -#else - invited->GetSession()->SendPacket(&data); -#endif -#else WorldPacket data(SMSG_GROUP_INVITE, 10); // guess size data << uint8(1); // invited/already in group flag data << player->GetName(); // max len 48 data << uint32(0); // unk data << uint8(0); // count data << uint32(0); // unk -#ifdef CMANGOS - invited->GetSession()->SendPacket(data); -#else invited->GetSession()->SendPacket(&data); -#endif -#endif } Eluna::Push(L, success); @@ -4320,24 +3735,13 @@ namespace LuaPlayer if (!group->IsCreated()) { group->RemoveInvite(player); -#if defined TRINITY || AZEROTHCORE group->Create(player); sGroupMgr->AddGroup(group); -#else - if (!group->Create(group->GetLeaderGuid(), group->GetLeaderName())) - return 0; - sObjectMgr.AddGroup(group); -#endif } -#if defined TRINITY || AZEROTHCORE if (!group->AddMember(invited)) return 0; group->BroadcastGroupUpdate(); -#else - if (!group->AddMember(invited->GetObjectGuid(), invited->GetName())) - return 0; -#endif Eluna::Push(L, group); return 1; } @@ -4355,7 +3759,6 @@ namespace LuaPlayer return 0; } -#if !defined(CLASSIC) && !defined(TBC) /** * Starts a movie for the [Player] * @@ -4368,7 +3771,6 @@ namespace LuaPlayer player->SendMovieStart(MovieId); return 0; } -#endif /** * Sets a setting value for the [Player] @@ -4512,4 +3914,4 @@ namespace LuaPlayer return 0; }*/ }; -#endif +#endif \ No newline at end of file diff --git a/src/LuaEngine/methods/QuestMethods.h b/src/LuaEngine/methods/QuestMethods.h index 7ca026b..5b46d36 100644 --- a/src/LuaEngine/methods/QuestMethods.h +++ b/src/LuaEngine/methods/QuestMethods.h @@ -52,15 +52,10 @@ namespace LuaQuest int HasFlag(lua_State* L, Quest* quest) { uint32 flag = Eluna::CHECKVAL(L, 2); -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, quest->HasFlag(flag)); -#else - Eluna::Push(L, quest->HasQuestFlag((QuestFlags)flag)); -#endif return 1; } -#ifndef CLASSIC /** * Returns 'true' if the [Quest] is a daily quest, false otherwise. * @@ -71,7 +66,6 @@ namespace LuaQuest Eluna::Push(L, quest->IsDaily()); return 1; } -#endif /** * Returns 'true' if the [Quest] is repeatable, false otherwise. @@ -157,11 +151,7 @@ namespace LuaQuest */ int GetFlags(lua_State* L, Quest* quest) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, quest->GetFlags()); -#else - Eluna::Push(L, quest->GetQuestFlags()); -#endif return 1; } diff --git a/src/LuaEngine/methods/SpellMethods.h b/src/LuaEngine/methods/SpellMethods.h index 3c5d025..c5283b1 100644 --- a/src/LuaEngine/methods/SpellMethods.h +++ b/src/LuaEngine/methods/SpellMethods.h @@ -100,11 +100,7 @@ namespace LuaSpell */ int GetDuration(lua_State* L, Spell* spell) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, spell->GetSpellInfo()->GetDuration()); -#else - Eluna::Push(L, GetSpellDuration(spell->m_spellInfo)); -#endif return 1; } @@ -117,17 +113,11 @@ namespace LuaSpell */ int GetTargetDest(lua_State* L, Spell* spell) { -#if defined TRINITY || AZEROTHCORE if (!spell->m_targets.HasDst()) return 3; float x, y, z; spell->m_targets.GetDstPos()->GetPosition(x, y, z); -#else - if (!(spell->m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)) - return 3; - float x, y, z; - spell->m_targets.getDestination(x, y, z); -#endif + Eluna::Push(L, x); Eluna::Push(L, y); Eluna::Push(L, z); @@ -148,7 +138,6 @@ namespace LuaSpell */ int GetTarget(lua_State* L, Spell* spell) { -#if defined TRINITY || AZEROTHCORE if (GameObject* target = spell->m_targets.GetGOTarget()) Eluna::Push(L, target); else if (Item* target = spell->m_targets.GetItemTarget()) @@ -159,16 +148,6 @@ namespace LuaSpell Eluna::Push(L, target); else if (WorldObject* target = spell->m_targets.GetObjectTarget()) Eluna::Push(L, target); -#else - if (GameObject* target = spell->m_targets.getGOTarget()) - Eluna::Push(L, target); - else if (Item* target = spell->m_targets.getItemTarget()) - Eluna::Push(L, target); - else if (Corpse* target = spell->GetCaster()->GetMap()->GetCorpse(spell->m_targets.getCorpseTargetGuid())) - Eluna::Push(L, target); - else if (Unit* target = spell->m_targets.getUnitTarget()) - Eluna::Push(L, target); -#endif return 1; } diff --git a/src/LuaEngine/methods/UnitMethods.h b/src/LuaEngine/methods/UnitMethods.h index b8e5f80..529dc51 100644 --- a/src/LuaEngine/methods/UnitMethods.h +++ b/src/LuaEngine/methods/UnitMethods.h @@ -403,7 +403,6 @@ namespace LuaUnit return 1; } -#ifndef CLASSIC /** * Returns true if the [Unit] is on a [Vehicle]. * @@ -414,7 +413,6 @@ namespace LuaUnit Eluna::Push(L, unit->GetVehicle()); return 1; } -#endif /** * Returns true if the [Unit] is in combat. @@ -1166,7 +1164,6 @@ namespace LuaUnit return 1; } -#if (!defined(TBC) && !defined(CLASSIC)) /** * Returns [Unit]'s [Vehicle] methods * @@ -1196,7 +1193,6 @@ namespace LuaUnit Eluna::Push(L, unit->GetCritterGUID()); return 1; } -#endif /** * Returns the [Unit]'s speed of given [UnitMoveType]. @@ -1752,7 +1748,6 @@ namespace LuaUnit return 0; } -#if (!defined(TBC) && !defined(CLASSIC)) /** * Sets the [Unit]'s FFA flag on or off. * @@ -1804,7 +1799,6 @@ namespace LuaUnit unit->SetCritterGUID(guid); return 0; } -#endif /*int SetStunned(lua_State* L, Unit* unit) { @@ -2157,7 +2151,6 @@ namespace LuaUnit return 0; } -#if (!defined(TBC) && !defined(CLASSIC)) /** * Makes the [Unit] jump to the coordinates * @@ -2180,7 +2173,6 @@ namespace LuaUnit unit->GetMotionMaster()->MoveJump(pos, zSpeed, maxHeight, id); return 0; } -#endif /** * The [Unit] will whisper the message to a [Player] @@ -2426,7 +2418,6 @@ namespace LuaUnit return 0; } -#if !defined(CLASSIC) /** * Removes all positive visible [Aura]'s from the [Unit]. */ @@ -2435,7 +2426,6 @@ namespace LuaUnit unit->RemoveArenaAuras(); return 0; } -#endif /** * Adds the given unit state for the [Unit]. diff --git a/src/LuaEngine/methods/VehicleMethods.h b/src/LuaEngine/methods/VehicleMethods.h index 3bbfea5..54a2183 100644 --- a/src/LuaEngine/methods/VehicleMethods.h +++ b/src/LuaEngine/methods/VehicleMethods.h @@ -6,8 +6,6 @@ #ifndef VEHICLEMETHODS_H #define VEHICLEMETHODS_H -#ifndef CLASSIC -#ifndef TBC /*** * Inherits all methods from: none @@ -23,11 +21,7 @@ namespace LuaVehicle int IsOnBoard(lua_State* L, Vehicle* vehicle) { Unit* passenger = Eluna::CHECKOBJ(L, 2); -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, passenger->IsOnVehicle(vehicle->GetBase())); -#else - Eluna::Push(L, vehicle->HasOnBoard(passenger)); -#endif return 1; } @@ -38,11 +32,7 @@ namespace LuaVehicle */ int GetOwner(lua_State* L, Vehicle* vehicle) { -#if defined TRINITY || AZEROTHCORE Eluna::Push(L, vehicle->GetBase()); -#else - Eluna::Push(L, vehicle->GetOwner()); -#endif return 1; } @@ -53,13 +43,7 @@ namespace LuaVehicle */ int GetEntry(lua_State* L, Vehicle* vehicle) { -#ifdef TRINITY - Eluna::Push(L, vehicle->GetVehicleInfo()->ID); -#elif AZEROTHCORE Eluna::Push(L, vehicle->GetVehicleInfo()->m_ID); -#else - Eluna::Push(L, vehicle->GetVehicleEntry()->m_ID); -#endif return 1; } @@ -86,12 +70,8 @@ namespace LuaVehicle { Unit* passenger = Eluna::CHECKOBJ(L, 2); int8 seatId = Eluna::CHECKVAL(L, 3); -#if defined TRINITY || AZEROTHCORE + vehicle->AddPassenger(passenger, seatId); -#else - if (vehicle->CanBoard(passenger)) - vehicle->Board(passenger, seatId); -#endif return 0; } @@ -103,15 +83,9 @@ namespace LuaVehicle int RemovePassenger(lua_State* L, Vehicle* vehicle) { Unit* passenger = Eluna::CHECKOBJ(L, 2); -#if defined TRINITY || AZEROTHCORE vehicle->RemovePassenger(passenger); -#else - vehicle->UnBoard(passenger, false); -#endif return 0; } } -#endif // CLASSIC -#endif // TBC #endif // VEHICLEMETHODS_H diff --git a/src/LuaEngine/methods/WorldObjectMethods.h b/src/LuaEngine/methods/WorldObjectMethods.h index babf66d..6cacb16 100644 --- a/src/LuaEngine/methods/WorldObjectMethods.h +++ b/src/LuaEngine/methods/WorldObjectMethods.h @@ -34,7 +34,6 @@ namespace LuaWorldObject return 1; } -#if (!defined(TBC) && !defined(CLASSIC)) /** * Returns the current phase of the [WorldObject] * @@ -59,7 +58,6 @@ namespace LuaWorldObject obj->SetPhaseMask(phaseMask, update); return 0; } -#endif /** * Returns the current instance ID of the [WorldObject] @@ -183,17 +181,9 @@ namespace LuaWorldObject Unit* target = NULL; ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_PLAYER, 0, hostile, dead); -#ifdef TRINITY - Trinity::UnitLastSearcher searcher(obj, target, checker); - Cell::VisitAllObjects(obj, searcher, range); -#elif AZEROTHCORE Acore::UnitLastSearcher searcher(obj, target, checker); Cell::VisitAllObjects(obj, searcher, range); -#else - MaNGOS::UnitLastSearcher searcher(target, checker); - Cell::VisitWorldObjects(obj, searcher, range); -#endif Eluna::Push(L, target); return 1; @@ -216,16 +206,9 @@ namespace LuaWorldObject GameObject* target = NULL; ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_GAMEOBJECT, entry, hostile); -#ifdef TRINITY - Trinity::GameObjectLastSearcher searcher(obj, target, checker); - Cell::VisitAllObjects(obj, searcher, range); -#elif AZEROTHCORE + Acore::GameObjectLastSearcher searcher(obj, target, checker); Cell::VisitAllObjects(obj, searcher, range); -#else - MaNGOS::GameObjectLastSearcher searcher(target, checker); - Cell::VisitGridObjects(obj, searcher, range); -#endif Eluna::Push(L, target); return 1; @@ -250,17 +233,9 @@ namespace LuaWorldObject Creature* target = NULL; ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_UNIT, entry, hostile, dead); -#ifdef TRINITY - Trinity::CreatureLastSearcher searcher(obj, target, checker); - Cell::VisitAllObjects(obj, searcher, range); -#elif AZEROTHCORE + Acore::CreatureLastSearcher searcher(obj, target, checker); Cell::VisitAllObjects(obj, searcher, range); -#else - MaNGOS::CreatureLastSearcher searcher(target, checker); - Cell::VisitGridObjects(obj, searcher, range); - -#endif Eluna::Push(L, target); return 1; @@ -283,16 +258,9 @@ namespace LuaWorldObject std::list list; ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_PLAYER, 0, hostile, dead); -#ifdef TRINITY - Trinity::PlayerListSearcher searcher(obj, list, checker); - Cell::VisitAllObjects(obj, searcher, range); -#elif AZEROTHCORE + Acore::PlayerListSearcher searcher(obj, list, checker); Cell::VisitAllObjects(obj, searcher, range); -#else - MaNGOS::PlayerListSearcher searcher(list, checker); - Cell::VisitWorldObjects(obj, searcher, range); -#endif lua_createtable(L, list.size(), 0); int tbl = lua_gettop(L); @@ -327,16 +295,9 @@ namespace LuaWorldObject std::list list; ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_UNIT, entry, hostile, dead); -#ifdef TRINITY - Trinity::CreatureListSearcher searcher(obj, list, checker); - Cell::VisitAllObjects(obj, searcher, range); -#elif defined AZEROTHCORE + Acore::CreatureListSearcher searcher(obj, list, checker); Cell::VisitAllObjects(obj, searcher, range); -#else - MaNGOS::CreatureListSearcher searcher(list, checker); - Cell::VisitGridObjects(obj, searcher, range); -#endif lua_createtable(L, list.size(), 0); int tbl = lua_gettop(L); @@ -369,16 +330,9 @@ namespace LuaWorldObject std::list list; ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_GAMEOBJECT, entry, hostile); -#ifdef TRINITY - Trinity::GameObjectListSearcher searcher(obj, list, checker); - Cell::VisitAllObjects(obj, searcher, range); -#elif AZEROTHCORE + Acore::GameObjectListSearcher searcher(obj, list, checker); Cell::VisitAllObjects(obj, searcher, range); -#else - MaNGOS::GameObjectListSearcher searcher(list, checker); - Cell::VisitGridObjects(obj, searcher, range); -#endif lua_createtable(L, list.size(), 0); int tbl = lua_gettop(L); @@ -419,16 +373,9 @@ namespace LuaWorldObject ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, type, entry, hostile, dead); WorldObject* target = NULL; -#ifdef TRINITY - Trinity::WorldObjectLastSearcher searcher(obj, target, checker); - Cell::VisitAllObjects(obj, searcher, range); -#elif AZEROTHCORE + Acore::WorldObjectLastSearcher searcher(obj, target, checker); Cell::VisitAllObjects(obj, searcher, range); -#else - MaNGOS::WorldObjectLastSearcher searcher(target, checker); - Cell::VisitAllObjects(obj, searcher, range); -#endif Eluna::Push(L, target); return 1; @@ -459,16 +406,9 @@ namespace LuaWorldObject ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, type, entry, hostile, dead); std::list list; -#ifdef TRINITY - Trinity::WorldObjectListSearcher searcher(obj, list, checker); - Cell::VisitAllObjects(obj, searcher, range); -#elif AZEROTHCORE + Acore::WorldObjectListSearcher searcher(obj, list, checker); Cell::VisitAllObjects(obj, searcher, range); -#else - MaNGOS::WorldObjectListSearcher searcher(list, checker); - Cell::VisitAllObjects(obj, searcher, range); -#endif lua_createtable(L, list.size(), 0); int tbl = lua_gettop(L); @@ -658,7 +598,6 @@ namespace LuaWorldObject int GetAngle(lua_State* L, WorldObject* obj) { WorldObject* target = Eluna::CHECKOBJ(L, 2, false); -#if defined TRINITY && !AZEROTHCORE if (target) Eluna::Push(L, obj->GetAbsoluteAngle(target)); else @@ -667,16 +606,7 @@ namespace LuaWorldObject float y = Eluna::CHECKVAL(L, 3); Eluna::Push(L, obj->GetAbsoluteAngle(x, y)); } -#else - if (target) - Eluna::Push(L, obj->GetAngle(target)); - else - { - float x = Eluna::CHECKVAL(L, 2); - float y = Eluna::CHECKVAL(L, 3); - Eluna::Push(L, obj->GetAngle(x, y)); - } -#endif + return 1; } @@ -688,11 +618,7 @@ namespace LuaWorldObject int SendPacket(lua_State* L, WorldObject* obj) { WorldPacket* data = Eluna::CHECKOBJ(L, 2); -#ifdef CMANGOS - obj->SendMessageToSet(*data, true); -#else obj->SendMessageToSet(data, true); -#endif return 0; } @@ -715,14 +641,8 @@ namespace LuaWorldObject float z = Eluna::CHECKVAL(L, 5); float o = Eluna::CHECKVAL(L, 6); uint32 respawnDelay = Eluna::CHECKVAL(L, 7, 30); -#ifdef TRINITY - QuaternionData rot = QuaternionData::fromEulerAnglesZYX(o, 0.f, 0.f); - Eluna::Push(L, obj->SummonGameObject(entry, Position(x, y, z, o), rot, Seconds(respawnDelay))); -#elif AZEROTHCORE + Eluna::Push(L, obj->SummonGameObject(entry, x, y, z, o, 0, 0, 0, 0, respawnDelay)); -#else - Eluna::Push(L, obj->SummonGameObject(entry, x, y, z, o, respawnDelay)); -#endif return 1; } @@ -762,7 +682,6 @@ namespace LuaWorldObject uint32 spawnType = Eluna::CHECKVAL(L, 7, 8); uint32 despawnTimer = Eluna::CHECKVAL(L, 8, 0); -#if defined TRINITY || AZEROTHCORE TempSummonType type; switch (spawnType) { @@ -793,49 +712,8 @@ namespace LuaWorldObject default: return luaL_argerror(L, 7, "valid SpawnType expected"); } -#else - TempSpawnType type; - switch (spawnType) - { - case 1: - type = TEMPSPAWN_TIMED_OR_DEAD_DESPAWN; - break; - case 2: - type = TEMPSPAWN_TIMED_OR_CORPSE_DESPAWN; - break; - case 3: - type = TEMPSPAWN_TIMED_DESPAWN; - break; - case 4: - type = TEMPSPAWN_TIMED_OOC_DESPAWN; - break; - case 5: - type = TEMPSPAWN_CORPSE_DESPAWN; - break; - case 6: - type = TEMPSPAWN_CORPSE_TIMED_DESPAWN; - break; - case 7: - type = TEMPSPAWN_DEAD_DESPAWN; - break; - case 8: - type = TEMPSPAWN_MANUAL_DESPAWN; - break; - case 9: - type = TEMPSPAWN_TIMED_OOC_OR_CORPSE_DESPAWN; - break; - case 10: - type = TEMPSPAWN_TIMED_OOC_OR_DEAD_DESPAWN; - break; - default: - return luaL_argerror(L, 7, "valid SpawnType expected"); - } -#endif -#ifdef TRINITY - Eluna::Push(L, obj->SummonCreature(entry, x, y, z, o, type, Seconds(despawnTimer))); -#else + Eluna::Push(L, obj->SummonCreature(entry, x, y, z, o, type, despawnTimer)); -#endif return 1; } @@ -1119,11 +997,7 @@ namespace LuaWorldObject WorldObject* target = Eluna::CHECKOBJ(L, 2); float arc = Eluna::CHECKVAL(L, 3, static_cast(M_PI)); -#ifdef MANGOS - Eluna::Push(L, obj->IsInFront(target, arc)); -#else Eluna::Push(L, obj->isInFront(target, arc)); -#endif return 1; } @@ -1139,11 +1013,7 @@ namespace LuaWorldObject WorldObject* target = Eluna::CHECKOBJ(L, 2); float arc = Eluna::CHECKVAL(L, 3, static_cast(M_PI)); -#ifdef MANGOS - Eluna::Push(L, obj->IsInBack(target, arc)); -#else Eluna::Push(L, obj->isInBack(target, arc)); -#endif return 1; } @@ -1165,17 +1035,10 @@ namespace LuaWorldObject WorldPacket data(SMSG_PLAY_MUSIC, 4); data << uint32(musicid); -#ifdef CMANGOS - if (player) - player->SendDirectMessage(data); - else - obj->SendMessageToSet(data, true); -#else if (player) player->SendDirectMessage(&data); else obj->SendMessageToSet(&data, true); -#endif return 0; }