Chore: Remove unused #if statement (TrinityCore, Mangos, AzerothCore, TBC, Classic, Mists, Cata) (#217)

This commit is contained in:
iThorgrim
2025-01-21 17:37:39 +01:00
committed by GitHub
parent 16173cb751
commit 2e89531b05
35 changed files with 60 additions and 2504 deletions

View File

@@ -9,12 +9,7 @@
#include "LuaEngine.h" #include "LuaEngine.h"
#if defined TRINITY || AZEROTHCORE
struct ScriptedAI; struct ScriptedAI;
#else
class AggressorAI;
typedef AggressorAI ScriptedAI;
#endif
struct ElunaCreatureAI : ScriptedAI struct ElunaCreatureAI : ScriptedAI
{ {
@@ -22,9 +17,6 @@ struct ElunaCreatureAI : ScriptedAI
bool justSpawned; bool justSpawned;
// used to delay movementinform hook (WP hook) // used to delay movementinform hook (WP hook)
std::vector< std::pair<uint32, uint32> > movepoints; std::vector< std::pair<uint32, uint32> > movepoints;
#if defined MANGOS || defined CMANGOS
#define me m_creature
#endif
ElunaCreatureAI(Creature* creature) : ScriptedAI(creature), justSpawned(true) ElunaCreatureAI(Creature* creature) : ScriptedAI(creature), justSpawned(true)
{ {
@@ -32,22 +24,14 @@ struct ElunaCreatureAI : ScriptedAI
~ElunaCreatureAI() { } ~ElunaCreatureAI() { }
//Called at World update tick //Called at World update tick
#ifndef TRINITY
void UpdateAI(const uint32 diff) override
#else
void UpdateAI(uint32 diff) override void UpdateAI(uint32 diff) override
#endif
{ {
#ifdef TRINITY
//Spawns are handled by Creature.cpp - in function Creature::Update()
#else
if (justSpawned) if (justSpawned)
{ {
justSpawned = false; justSpawned = false;
JustRespawned(); JustRespawned();
} }
#endif
if (!movepoints.empty()) if (!movepoints.empty())
{ {
@@ -61,17 +45,11 @@ struct ElunaCreatureAI : ScriptedAI
if (!sEluna->UpdateAI(me, diff)) if (!sEluna->UpdateAI(me, diff))
{ {
#if defined TRINITY || AZEROTHCORE
if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)) if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC))
ScriptedAI::UpdateAI(diff); 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 for reaction when initially engaged - this will always happen _after_ JustEnteredCombat
// Called at creature aggro either by MoveInLOS or Attack Start // Called at creature aggro either by MoveInLOS or Attack Start
void JustEngagedWith(Unit* target) override void JustEngagedWith(Unit* target) override
@@ -79,34 +57,13 @@ struct ElunaCreatureAI : ScriptedAI
if (!sEluna->EnterCombat(me, target)) if (!sEluna->EnterCombat(me, target))
ScriptedAI::JustEngagedWith(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) // Called at any Damage from any attacker (before damage apply)
#if defined AZEROTHCORE
void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask) override 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 (!sEluna->DamageTaken(me, attacker, damage))
{ {
#if defined AZEROTHCORE
ScriptedAI::DamageTaken(attacker, damage, damagetype, damageSchoolMask); 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(); 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) // Called when creature is spawned or respawned (for reseting variables)
void JustRespawned() override void JustRespawned() override
{ {
if (!sEluna->JustRespawned(me)) if (!sEluna->JustRespawned(me))
ScriptedAI::JustRespawned(); ScriptedAI::JustRespawned();
} }
#endif
// Called at reaching home after evade // Called at reaching home after evade
void JustReachedHome() override void JustReachedHome() override
@@ -197,14 +145,6 @@ struct ElunaCreatureAI : ScriptedAI
ScriptedAI::CorpseRemoved(respawnDelay); 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 void MoveInLineOfSight(Unit* who) override
{ {
if (!sEluna->MoveInLineOfSight(me, who)) if (!sEluna->MoveInLineOfSight(me, who))
@@ -212,44 +152,25 @@ struct ElunaCreatureAI : ScriptedAI
} }
// Called when hit by a spell // 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 void SpellHit(Unit* caster, SpellInfo const* spell) override
#endif
{ {
if (!sEluna->SpellHit(me, caster, spell)) if (!sEluna->SpellHit(me, caster, spell))
ScriptedAI::SpellHit(caster, spell); ScriptedAI::SpellHit(caster, spell);
} }
// Called when spell hits a target // 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 void SpellHitTarget(Unit* target, SpellInfo const* spell) override
#endif
{ {
if (!sEluna->SpellHitTarget(me, target, spell)) if (!sEluna->SpellHitTarget(me, target, spell))
ScriptedAI::SpellHitTarget(target, spell); ScriptedAI::SpellHitTarget(target, spell);
} }
#if defined TRINITY || AZEROTHCORE
#if defined TRINITY || AZEROTHCORE
// Called when the creature is summoned successfully by other creature // Called when the creature is summoned successfully by other creature
void IsSummonedBy(WorldObject* summoner) override void IsSummonedBy(WorldObject* summoner) override
{ {
if (!summoner->ToUnit() || !sEluna->OnSummoned(me, summoner->ToUnit())) if (!summoner->ToUnit() || !sEluna->OnSummoned(me, summoner->ToUnit()))
ScriptedAI::IsSummonedBy(summoner); 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 void SummonedCreatureDies(Creature* summon, Unit* killer) override
{ {
@@ -270,11 +191,6 @@ struct ElunaCreatureAI : ScriptedAI
if (!sEluna->OwnerAttacked(me, target)) if (!sEluna->OwnerAttacked(me, target))
ScriptedAI::OwnerAttacked(target); ScriptedAI::OwnerAttacked(target);
} }
#endif
#if defined MANGOS || defined CMANGOS
#undef me
#endif
}; };
#endif #endif

View File

@@ -9,18 +9,10 @@
#include "ElunaUtility.h" #include "ElunaUtility.h"
#include "Common.h" #include "Common.h"
#ifdef TRINITY
#include "Random.h"
#else
#include "Util.h" #include "Util.h"
#endif
#include <map> #include <map>
#if defined(TRINITY) || AZEROTHCORE
#include "Define.h" #include "Define.h"
#else
#include "Platform/Define.h"
#endif
class Eluna; class Eluna;
class EventMgr; class EventMgr;

View File

@@ -37,18 +37,7 @@
#include "TemporarySummon.h" #include "TemporarySummon.h"
#include "WorldPacket.h" #include "WorldPacket.h"
#include "WorldSession.h" #include "WorldSession.h"
#if defined TRINITY
#include "SpellHistory.h"
#endif
#if defined AZEROTHCORE
#include "MapMgr.h" #include "MapMgr.h"
#else
#include "MapManager.h"
#endif
#if defined TRINITY || defined AZEROTHCORE
#include "Config.h" #include "Config.h"
#include "GameEventMgr.h" #include "GameEventMgr.h"
#include "GitRevision.h" #include "GitRevision.h"
@@ -60,54 +49,17 @@
#include "MotionMaster.h" #include "MotionMaster.h"
#include "DatabaseEnv.h" #include "DatabaseEnv.h"
#include "Bag.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" #include "Vehicle.h"
#endif
#ifndef CLASSIC
#include "ArenaTeam.h" #include "ArenaTeam.h"
#endif
#ifndef CLASSIC
typedef Opcodes OpcodesList; typedef Opcodes OpcodesList;
#endif
/* /*
* Note: if you add or change a CORE_NAME or CORE_VERSION #define, * Note: if you add or change a CORE_NAME or CORE_VERSION #define,
* please update LuaGlobalFunctions::GetCoreName or LuaGlobalFunctions::GetCoreVersion documentation example string. * 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" #define CORE_NAME "AzerothCore"
#endif
#if defined TRINITY || defined AZEROTHCORE
#define CORE_VERSION (GitRevision::GetFullVersion()) #define CORE_VERSION (GitRevision::GetFullVersion())
#define eWorld (sWorld) #define eWorld (sWorld)
#define eMapMgr (sMapMgr) #define eMapMgr (sMapMgr)
@@ -118,42 +70,5 @@ typedef Opcodes OpcodesList;
#define eAuctionMgr (sAuctionMgr) #define eAuctionMgr (sAuctionMgr)
#define eGameEventMgr (sGameEventMgr) #define eGameEventMgr (sGameEventMgr)
#define eObjectAccessor() ObjectAccessor:: #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 #endif // _ELUNA_INCLUDES_H

View File

@@ -9,7 +9,6 @@
#include "lmarshal.h" #include "lmarshal.h"
#ifndef TRINITY
void ElunaInstanceAI::Initialize() void ElunaInstanceAI::Initialize()
{ {
LOCK_ELUNA; LOCK_ELUNA;
@@ -23,7 +22,6 @@ void ElunaInstanceAI::Initialize()
sEluna->OnInitialize(this); sEluna->OnInitialize(this);
} }
#endif
void ElunaInstanceAI::Load(const char* data) void ElunaInstanceAI::Load(const char* data)
{ {
@@ -84,9 +82,7 @@ void ElunaInstanceAI::Load(const char* data)
lua_pop(L, 1); lua_pop(L, 1);
// Stack: (empty) // Stack: (empty)
#ifndef TRINITY
Initialize(); Initialize();
#endif
} }
} }
else else
@@ -96,9 +92,7 @@ void ElunaInstanceAI::Load(const char* data)
lua_pop(L, 1); lua_pop(L, 1);
// Stack: (empty) // Stack: (empty)
#ifndef TRINITY
Initialize(); Initialize();
#endif
} }
delete[] decodedData; 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"); ELUNA_LOG_ERROR("Error while decoding instance data: Data is not valid base-64");
#ifndef TRINITY
Initialize(); Initialize();
#endif
} }
} }

View File

@@ -8,15 +8,7 @@
#define _ELUNA_INSTANCE_DATA_H #define _ELUNA_INSTANCE_DATA_H
#include "LuaEngine.h" #include "LuaEngine.h"
#if defined(TRINITY) || AZEROTHCORE
#include "InstanceScript.h" #include "InstanceScript.h"
#else
#include "InstanceData.h"
#endif
#ifdef TRINITY
#include "Map.h"
#endif
/* /*
* This class is a small wrapper around `InstanceData`, * This class is a small wrapper around `InstanceData`,
@@ -64,35 +56,23 @@ private:
std::string lastSaveData; std::string lastSaveData;
public: public:
#ifdef TRINITY
ElunaInstanceAI(Map* map) : InstanceData(map->ToInstanceMap())
{
}
#else
ElunaInstanceAI(Map* map) : InstanceData(map) ElunaInstanceAI(Map* map) : InstanceData(map)
{ {
} }
#endif
#ifndef TRINITY
void Initialize() override; void Initialize() override;
#endif
/* /*
* These are responsible for serializing/deserializing the instance's * These are responsible for serializing/deserializing the instance's
* data table to/from the core. * data table to/from the core.
*/ */
void Load(const char* data) override; 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 // Simply calls Save, since the functions are a bit different in name and data types on different cores
std::string GetSaveData() override std::string GetSaveData() override
{ {
return Save(); return Save();
} }
const char* Save() const; const char* Save() const;
#else
const char* Save() const override;
#endif
/* /*
@@ -139,11 +119,7 @@ public:
sEluna->OnPlayerEnterInstance(this, player); sEluna->OnPlayerEnterInstance(this, player);
} }
#if defined TRINITY || AZEROTHCORE
void OnGameObjectCreate(GameObject* gameobject) override void OnGameObjectCreate(GameObject* gameobject) override
#else
void OnObjectCreate(GameObject* gameobject) override
#endif
{ {
sEluna->OnGameObjectCreate(this, gameobject); sEluna->OnGameObjectCreate(this, gameobject);
} }

View File

@@ -10,9 +10,6 @@
#include "Unit.h" #include "Unit.h"
#include "GameObject.h" #include "GameObject.h"
#include "DBCStores.h" #include "DBCStores.h"
#ifdef MANGOS
#include "Timer.h"
#endif
uint32 ElunaUtil::GetCurrTime() uint32 ElunaUtil::GetCurrTime()
{ {
@@ -72,26 +69,17 @@ bool ElunaUtil::WorldObjectInRangeCheck::operator()(WorldObject* u)
target = go->GetOwner(); target = go->GetOwner();
if (target) if (target)
{ {
#ifdef CMANGOS
if (i_dead && (i_dead == 1) != target->isAlive())
return false;
#else
if (i_dead && (i_dead == 1) != target->IsAlive()) if (i_dead && (i_dead == 1) != target->IsAlive())
return false; return false;
#endif
if (i_hostile) if (i_hostile)
{ {
if (!i_obj_unit) if (!i_obj_unit)
{ {
if (i_obj_fact) if (i_obj_fact)
{ {
#if defined TRINITY || AZEROTHCORE
if ((i_obj_fact->IsHostileTo(*target->GetFactionTemplateEntry())) != (i_hostile == 1)) if ((i_obj_fact->IsHostileTo(*target->GetFactionTemplateEntry())) != (i_hostile == 1))
return false; return false;
#else
if ((i_obj_fact->IsHostileTo(*target->getFactionTemplateEntry())) != (i_hostile == 1))
return false;
#endif
} }
else if (i_hostile == 1) else if (i_hostile == 1)
return false; return false;

View File

@@ -14,18 +14,9 @@
#include "Common.h" #include "Common.h"
#include "SharedDefines.h" #include "SharedDefines.h"
#include "ObjectGuid.h" #include "ObjectGuid.h"
#ifdef TRINITY
#include "QueryResult.h"
#include "Log.h"
#ifdef CATA
#include "Object.h"
#endif
#else
#include "Database/QueryResult.h" #include "Database/QueryResult.h"
#include "Log.h" #include "Log.h"
#endif
#if defined(TRINITY) || defined(AZEROTHCORE)
typedef QueryResult ElunaQuery; typedef QueryResult ElunaQuery;
#define GET_GUID GetGUID #define GET_GUID GetGUID
#define HIGHGUID_PLAYER HighGuid::Player #define HIGHGUID_PLAYER HighGuid::Player
@@ -41,29 +32,11 @@ typedef QueryResult ElunaQuery;
#define HIGHGUID_MO_TRANSPORT HighGuid::Mo_Transport #define HIGHGUID_MO_TRANSPORT HighGuid::Mo_Transport
#define HIGHGUID_INSTANCE HighGuid::Instance #define HIGHGUID_INSTANCE HighGuid::Instance
#define HIGHGUID_GROUP HighGuid::Group #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_INFO(...) LOG_INFO("eluna", __VA_ARGS__);
#define ELUNA_LOG_ERROR(...) LOG_ERROR("eluna", __VA_ARGS__); #define ELUNA_LOG_ERROR(...) LOG_ERROR("eluna", __VA_ARGS__);
#define ELUNA_LOG_DEBUG(...) LOG_DEBUG("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 #ifndef MAKE_NEW_GUID
#define MAKE_NEW_GUID(l, e, h) ObjectGuid(h, e, l) #define MAKE_NEW_GUID(l, e, h) ObjectGuid(h, e, l)
#endif #endif
@@ -76,7 +49,6 @@ typedef QueryNamedResult ElunaQuery;
#ifndef GUID_HIPART #ifndef GUID_HIPART
#define GUID_HIPART(guid) ObjectGuid(guid).GetHigh() #define GUID_HIPART(guid) ObjectGuid(guid).GetHigh()
#endif #endif
#endif
class Unit; class Unit;
class WorldObject; class WorldObject;

View File

@@ -5,9 +5,8 @@ extern "C"
#include "lauxlib.h" #include "lauxlib.h"
}; };
#if defined TRINITY || defined AZEROTHCORE
#define CPPHTTPLIB_OPENSSL_SUPPORT #define CPPHTTPLIB_OPENSSL_SUPPORT
#endif
#include "libs/httplib.h" #include "libs/httplib.h"
#include "HttpManager.h" #include "HttpManager.h"
#include "LuaEngine.h" #include "LuaEngine.h"

View File

@@ -16,35 +16,15 @@
#include "ElunaCreatureAI.h" #include "ElunaCreatureAI.h"
#include "ElunaInstanceAI.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 #if AC_PLATFORM == AC_PLATFORM_WINDOWS
#define ELUNA_WINDOWS #define ELUNA_WINDOWS
#endif #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: // Some dummy includes containing BOOST_VERSION:
// ObjectAccessor.h Config.h Log.h // ObjectAccessor.h Config.h Log.h
#if !defined MANGOS
#define USING_BOOST #define USING_BOOST
#endif
#ifdef USING_BOOST
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#else
#include <ace/ACE.h>
#include <ace/Dirent.h>
#include <ace/OS_NS_sys_stat.h>
#endif
extern "C" extern "C"
{ {
@@ -72,11 +52,9 @@ void Eluna::Initialize()
LOCK_ELUNA; LOCK_ELUNA;
ASSERT(!IsInitialized()); ASSERT(!IsInitialized());
#if defined TRINITY || AZEROTHCORE
// For instance data the data column needs to be able to hold more than 255 characters (tinytext) // 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 // so we change it to TEXT automatically on startup
CharacterDatabase.DirectExecute("ALTER TABLE `instance` CHANGE COLUMN `data` `data` TEXT NOT NULL"); CharacterDatabase.DirectExecute("ALTER TABLE `instance` CHANGE COLUMN `data` `data` TEXT NOT NULL");
#endif
LoadScriptPaths(); LoadScriptPaths();
@@ -109,11 +87,7 @@ void Eluna::LoadScriptPaths()
lua_scripts.clear(); lua_scripts.clear();
lua_extensions.clear(); lua_extensions.clear();
#if defined(AZEROTHCORE)
lua_folderpath = eConfigMgr->GetOption<std::string>("Eluna.ScriptPath", "lua_scripts"); lua_folderpath = eConfigMgr->GetOption<std::string>("Eluna.ScriptPath", "lua_scripts");
#else
lua_folderpath = eConfigMgr->GetStringDefault("Eluna.ScriptPath", "lua_scripts");
#endif
#ifndef ELUNA_WINDOWS #ifndef ELUNA_WINDOWS
if (lua_folderpath[0] == '~') if (lua_folderpath[0] == '~')
@@ -226,11 +200,7 @@ void Eluna::CloseLua()
void Eluna::OpenLua() void Eluna::OpenLua()
{ {
#if defined(AZEROTHCORE)
enabled = eConfigMgr->GetOption<bool>("Eluna.Enabled", true); enabled = eConfigMgr->GetOption<bool>("Eluna.Enabled", true);
#else
enabled = eConfigMgr->GetBoolDefault("Eluna.Enabled", true);
#endif
if (!IsEnabled()) if (!IsEnabled())
{ {
@@ -363,7 +333,6 @@ void Eluna::GetScripts(std::string path)
{ {
ELUNA_LOG_DEBUG("[Eluna]: GetScripts from path `{}`", path); ELUNA_LOG_DEBUG("[Eluna]: GetScripts from path `{}`", path);
#ifdef USING_BOOST
boost::filesystem::path someDir(path); boost::filesystem::path someDir(path);
boost::filesystem::directory_iterator end_iter; 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) static bool ScriptPathComparator(const LuaScript& first, const LuaScript& second)
@@ -540,11 +462,7 @@ void Eluna::RunScripts()
void Eluna::InvalidateObjects() void Eluna::InvalidateObjects()
{ {
++callstackid; ++callstackid;
#ifdef TRINITY
ASSERT(callstackid, "Callstackid overflow");
#else
ASSERT(callstackid && "Callstackid overflow"); ASSERT(callstackid && "Callstackid overflow");
#endif
} }
void Eluna::Report(lua_State* _L) void Eluna::Report(lua_State* _L)
@@ -600,12 +518,7 @@ bool Eluna::ExecuteCall(int params, int res)
ASSERT(false); // stack probably corrupt ASSERT(false); // stack probably corrupt
} }
#if defined(AZEROTHCORE)
bool usetrace = eConfigMgr->GetOption<bool>("Eluna.TraceBack", false); bool usetrace = eConfigMgr->GetOption<bool>("Eluna.TraceBack", false);
#else
bool usetrace = eConfigMgr->GetBoolDefault("Eluna.TraceBack", false);
#endif
if (usetrace) if (usetrace)
{ {
lua_pushcfunction(L, &StackTrace); lua_pushcfunction(L, &StackTrace);

View File

@@ -14,9 +14,7 @@
#include "Group.h" #include "Group.h"
#include "Item.h" #include "Item.h"
#include "Chat.h" #include "Chat.h"
#ifndef TRINITY
#include "Player.h" #include "Player.h"
#endif
#include "Weather.h" #include "Weather.h"
#include "World.h" #include "World.h"
#include "Hooks.h" #include "Hooks.h"
@@ -32,46 +30,23 @@ extern "C"
#include "lua.h" #include "lua.h"
}; };
#if defined(TRINITY) || AZEROTHCORE
struct ItemTemplate; struct ItemTemplate;
typedef BattlegroundTypeId BattleGroundTypeId; 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; typedef AreaTrigger AreaTriggerEntry;
#endif
class AuctionHouseObject; class AuctionHouseObject;
struct AuctionEntry; struct AuctionEntry;
#if defined(TRINITY) || AZEROTHCORE
class Battleground; class Battleground;
typedef Battleground BattleGround; typedef Battleground BattleGround;
#endif
class Channel; class Channel;
class Corpse; class Corpse;
class Creature; class Creature;
class CreatureAI; class CreatureAI;
class GameObject; class GameObject;
#if defined(TRINITY) || AZEROTHCORE
class GameObjectAI; class GameObjectAI;
#endif
class Guild; class Guild;
class Group; class Group;
#if defined(TRINITY) || AZEROTHCORE
class InstanceScript; class InstanceScript;
typedef InstanceScript InstanceData; typedef InstanceScript InstanceData;
#else
class InstanceData;
#endif
class ElunaInstanceAI; class ElunaInstanceAI;
class Item; class Item;
class Pet; class Pet;
@@ -79,26 +54,12 @@ class Player;
class Quest; class Quest;
class Spell; class Spell;
class SpellCastTargets; class SpellCastTargets;
#if defined(TRINITY) || AZEROTHCORE
class TempSummon; class TempSummon;
#else
class TemporarySummon;
typedef TemporarySummon TempSummon;
#endif
// class Transport; // class Transport;
class Unit; class Unit;
class Weather; class Weather;
class WorldPacket; class WorldPacket;
#ifndef CLASSIC
#ifndef TBC
#if defined(TRINITY) || AZEROTHCORE
class Vehicle; class Vehicle;
#else
class VehicleInfo;
typedef VehicleInfo Vehicle;
#endif
#endif
#endif
struct lua_State; struct lua_State;
class EventMgr; class EventMgr;
@@ -121,13 +82,7 @@ struct LuaScript
#define ELUNA_STATE_PTR "Eluna State Ptr" #define ELUNA_STATE_PTR "Eluna State Ptr"
#define LOCK_ELUNA Eluna::Guard __guard(Eluna::GetLock()) #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 #define ELUNA_GAME_API AC_GAME_API
#else
#define ELUNA_GAME_API
#endif
class ELUNA_GAME_API Eluna class ELUNA_GAME_API Eluna
{ {
@@ -429,12 +384,8 @@ public:
bool OnQuestAccept(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest); bool OnQuestAccept(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest);
bool OnQuestReward(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest, uint32 opt); bool OnQuestReward(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest, uint32 opt);
void GetDialogStatus(const Player* pPlayer, const GameObject* pGameObject); void GetDialogStatus(const Player* pPlayer, const GameObject* pGameObject);
#ifndef CLASSIC
#ifndef TBC
void OnDestroyed(GameObject* pGameObject, WorldObject* attacker); void OnDestroyed(GameObject* pGameObject, WorldObject* attacker);
void OnDamaged(GameObject* pGameObject, WorldObject* attacker); void OnDamaged(GameObject* pGameObject, WorldObject* attacker);
#endif
#endif
void OnLootStateChanged(GameObject* pGameObject, uint32 state); void OnLootStateChanged(GameObject* pGameObject, uint32 state);
void OnGameObjectStateChanged(GameObject* pGameObject, uint32 state); void OnGameObjectStateChanged(GameObject* pGameObject, uint32 state);
void UpdateAI(GameObject* pGameObject, uint32 diff); void UpdateAI(GameObject* pGameObject, uint32 diff);
@@ -492,16 +443,12 @@ public:
void OnBattlegroundDesertion(Player* player, const BattlegroundDesertionType type); void OnBattlegroundDesertion(Player* player, const BattlegroundDesertionType type);
void OnCreatureKilledByPet(Player* player, Creature* killed); void OnCreatureKilledByPet(Player* player, Creature* killed);
#ifndef CLASSIC
#ifndef TBC
/* Vehicle */ /* Vehicle */
void OnInstall(Vehicle* vehicle); void OnInstall(Vehicle* vehicle);
void OnUninstall(Vehicle* vehicle); void OnUninstall(Vehicle* vehicle);
void OnInstallAccessory(Vehicle* vehicle, Creature* accessory); void OnInstallAccessory(Vehicle* vehicle, Creature* accessory);
void OnAddPassenger(Vehicle* vehicle, Unit* passenger, int8 seatId); void OnAddPassenger(Vehicle* vehicle, Unit* passenger, int8 seatId);
void OnRemovePassenger(Vehicle* vehicle, Unit* passenger); void OnRemovePassenger(Vehicle* vehicle, Unit* passenger);
#endif
#endif
/* AreaTrigger */ /* AreaTrigger */
bool OnAreaTrigger(Player* pPlayer, AreaTriggerEntry const* pTrigger); bool OnAreaTrigger(Player* pPlayer, AreaTriggerEntry const* pTrigger);
@@ -560,11 +507,7 @@ public:
/* World */ /* World */
void OnOpenStateChange(bool open); void OnOpenStateChange(bool open);
#ifndef AZEROTHCORE
void OnConfigLoad(bool reload);
#else
void OnConfigLoad(bool reload, bool isBefore); void OnConfigLoad(bool reload, bool isBefore);
#endif
void OnShutdownInitiate(ShutdownExitCode code, ShutdownMask mask); void OnShutdownInitiate(ShutdownExitCode code, ShutdownMask mask);
void OnShutdownCancel(); void OnShutdownCancel();
void OnStartup(); void OnStartup();
@@ -574,11 +517,7 @@ public:
/* Battle Ground */ /* Battle Ground */
void OnBGStart(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId); void OnBGStart(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId);
#if AZEROTHCORE
void OnBGEnd(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId, TeamId winner); 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 OnBGCreate(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId);
void OnBGDestroy(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId); void OnBGDestroy(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId);
}; };

View File

@@ -212,10 +212,8 @@ ElunaRegister<WorldObject> WorldObjectMethods[] =
// Getters // Getters
{ "GetName", &LuaWorldObject::GetName }, { "GetName", &LuaWorldObject::GetName },
{ "GetMap", &LuaWorldObject::GetMap }, { "GetMap", &LuaWorldObject::GetMap },
#if (!defined(TBC) && !defined(CLASSIC))
{ "GetPhaseMask", &LuaWorldObject::GetPhaseMask }, { "GetPhaseMask", &LuaWorldObject::GetPhaseMask },
{ "SetPhaseMask", &LuaWorldObject::SetPhaseMask }, { "SetPhaseMask", &LuaWorldObject::SetPhaseMask },
#endif
{ "GetInstanceId", &LuaWorldObject::GetInstanceId }, { "GetInstanceId", &LuaWorldObject::GetInstanceId },
{ "GetAreaId", &LuaWorldObject::GetAreaId }, { "GetAreaId", &LuaWorldObject::GetAreaId },
{ "GetZoneId", &LuaWorldObject::GetZoneId }, { "GetZoneId", &LuaWorldObject::GetZoneId },
@@ -301,9 +299,7 @@ ElunaRegister<Unit> UnitMethods[] =
{ "GetCharmerGUID", &LuaUnit::GetCharmerGUID }, { "GetCharmerGUID", &LuaUnit::GetCharmerGUID },
{ "GetCharmGUID", &LuaUnit::GetCharmGUID }, { "GetCharmGUID", &LuaUnit::GetCharmGUID },
{ "GetPetGUID", &LuaUnit::GetPetGUID }, { "GetPetGUID", &LuaUnit::GetPetGUID },
#if (!defined(TBC) && !defined(CLASSIC))
{ "GetCritterGUID", &LuaUnit::GetCritterGUID }, { "GetCritterGUID", &LuaUnit::GetCritterGUID },
#endif
{ "GetControllerGUID", &LuaUnit::GetControllerGUID }, { "GetControllerGUID", &LuaUnit::GetControllerGUID },
{ "GetControllerGUIDS", &LuaUnit::GetControllerGUIDS }, { "GetControllerGUIDS", &LuaUnit::GetControllerGUIDS },
{ "GetStandState", &LuaUnit::GetStandState }, { "GetStandState", &LuaUnit::GetStandState },
@@ -312,10 +308,8 @@ ElunaRegister<Unit> UnitMethods[] =
{ "GetSpeedRate", &LuaUnit::GetSpeedRate }, { "GetSpeedRate", &LuaUnit::GetSpeedRate },
{ "GetStat", &LuaUnit::GetStat }, { "GetStat", &LuaUnit::GetStat },
{ "GetBaseSpellPower", &LuaUnit::GetBaseSpellPower }, { "GetBaseSpellPower", &LuaUnit::GetBaseSpellPower },
#if (!defined(TBC) && !defined(CLASSIC))
{ "GetVehicleKit", &LuaUnit::GetVehicleKit }, { "GetVehicleKit", &LuaUnit::GetVehicleKit },
// {"GetVehicle", &LuaUnit::GetVehicle}, // :GetVehicle() - UNDOCUMENTED - Gets the Vehicle kit of the vehicle the unit is on // {"GetVehicle", &LuaUnit::GetVehicle}, // :GetVehicle() - UNDOCUMENTED - Gets the Vehicle kit of the vehicle the unit is on
#endif
{ "GetMovementType", &LuaUnit::GetMovementType }, { "GetMovementType", &LuaUnit::GetMovementType },
{ "GetAttackers", &LuaUnit::GetAttackers }, { "GetAttackers", &LuaUnit::GetAttackers },
@@ -338,10 +332,8 @@ ElunaRegister<Unit> UnitMethods[] =
{"SetConfused", &LuaUnit::SetConfused}, {"SetConfused", &LuaUnit::SetConfused},
{"SetFeared", &LuaUnit::SetFeared}, {"SetFeared", &LuaUnit::SetFeared},
{ "SetPvP", &LuaUnit::SetPvP }, { "SetPvP", &LuaUnit::SetPvP },
#if (!defined(TBC) && !defined(CLASSIC))
{ "SetFFA", &LuaUnit::SetFFA }, { "SetFFA", &LuaUnit::SetFFA },
{ "SetSanctuary", &LuaUnit::SetSanctuary }, { "SetSanctuary", &LuaUnit::SetSanctuary },
#endif
// {"SetCanFly", &LuaUnit::SetCanFly}, // :SetCanFly(apply) - UNDOCUMENTED // {"SetCanFly", &LuaUnit::SetCanFly}, // :SetCanFly(apply) - UNDOCUMENTED
// {"SetVisible", &LuaUnit::SetVisible}, // :SetVisible(x) - UNDOCUMENTED // {"SetVisible", &LuaUnit::SetVisible}, // :SetVisible(x) - UNDOCUMENTED
{ "SetOwnerGUID", &LuaUnit::SetOwnerGUID }, { "SetOwnerGUID", &LuaUnit::SetOwnerGUID },
@@ -350,9 +342,7 @@ ElunaRegister<Unit> UnitMethods[] =
{ "SetCreatorGUID", &LuaUnit::SetCreatorGUID }, { "SetCreatorGUID", &LuaUnit::SetCreatorGUID },
{ "SetMinionGUID", &LuaUnit::SetPetGUID }, { "SetMinionGUID", &LuaUnit::SetPetGUID },
{ "SetPetGUID", &LuaUnit::SetPetGUID }, { "SetPetGUID", &LuaUnit::SetPetGUID },
#if (!defined(TBC) && !defined(CLASSIC))
{ "SetCritterGUID", &LuaUnit::SetCritterGUID }, { "SetCritterGUID", &LuaUnit::SetCritterGUID },
#endif
{ "SetWaterWalk", &LuaUnit::SetWaterWalk }, { "SetWaterWalk", &LuaUnit::SetWaterWalk },
{ "SetStandState", &LuaUnit::SetStandState }, { "SetStandState", &LuaUnit::SetStandState },
{ "SetInCombatWith", &LuaUnit::SetInCombatWith }, { "SetInCombatWith", &LuaUnit::SetInCombatWith },
@@ -401,18 +391,14 @@ ElunaRegister<Unit> UnitMethods[] =
{ "HasAura", &LuaUnit::HasAura }, { "HasAura", &LuaUnit::HasAura },
{ "IsCasting", &LuaUnit::IsCasting }, { "IsCasting", &LuaUnit::IsCasting },
{ "IsStandState", &LuaUnit::IsStandState }, { "IsStandState", &LuaUnit::IsStandState },
#ifndef CLASSIC
{ "IsOnVehicle", &LuaUnit::IsOnVehicle }, { "IsOnVehicle", &LuaUnit::IsOnVehicle },
#endif
// Other // Other
{ "HandleStatModifier", &LuaUnit::HandleStatModifier }, { "HandleStatModifier", &LuaUnit::HandleStatModifier },
{ "AddAura", &LuaUnit::AddAura }, { "AddAura", &LuaUnit::AddAura },
{ "RemoveAura", &LuaUnit::RemoveAura }, { "RemoveAura", &LuaUnit::RemoveAura },
{ "RemoveAllAuras", &LuaUnit::RemoveAllAuras }, { "RemoveAllAuras", &LuaUnit::RemoveAllAuras },
#if !defined(CLASSIC)
{ "RemoveArenaAuras", &LuaUnit::RemoveArenaAuras }, { "RemoveArenaAuras", &LuaUnit::RemoveArenaAuras },
#endif
{ "ClearInCombat", &LuaUnit::ClearInCombat }, { "ClearInCombat", &LuaUnit::ClearInCombat },
{ "DeMorph", &LuaUnit::DeMorph }, { "DeMorph", &LuaUnit::DeMorph },
{ "SendUnitWhisper", &LuaUnit::SendUnitWhisper }, { "SendUnitWhisper", &LuaUnit::SendUnitWhisper },
@@ -451,9 +437,7 @@ ElunaRegister<Unit> UnitMethods[] =
{ "MoveConfused", &LuaUnit::MoveConfused }, { "MoveConfused", &LuaUnit::MoveConfused },
{ "MoveFleeing", &LuaUnit::MoveFleeing }, { "MoveFleeing", &LuaUnit::MoveFleeing },
{ "MoveTo", &LuaUnit::MoveTo }, { "MoveTo", &LuaUnit::MoveTo },
#if (!defined(TBC) && !defined(CLASSIC))
{ "MoveJump", &LuaUnit::MoveJump }, { "MoveJump", &LuaUnit::MoveJump },
#endif
{ "MoveStop", &LuaUnit::MoveStop }, { "MoveStop", &LuaUnit::MoveStop },
{ "MoveExpire", &LuaUnit::MoveExpire }, { "MoveExpire", &LuaUnit::MoveExpire },
{ "MoveClear", &LuaUnit::MoveClear }, { "MoveClear", &LuaUnit::MoveClear },
@@ -479,10 +463,8 @@ ElunaRegister<Player> PlayerMethods[] =
{ "GetAccountId", &LuaPlayer::GetAccountId }, { "GetAccountId", &LuaPlayer::GetAccountId },
{ "GetAccountName", &LuaPlayer::GetAccountName }, { "GetAccountName", &LuaPlayer::GetAccountName },
{ "GetCompletedQuestsCount", &LuaPlayer::GetCompletedQuestsCount }, { "GetCompletedQuestsCount", &LuaPlayer::GetCompletedQuestsCount },
#if defined (TBC) || defined (WOTLK)
{ "GetArenaPoints", &LuaPlayer::GetArenaPoints }, { "GetArenaPoints", &LuaPlayer::GetArenaPoints },
{ "GetHonorPoints", &LuaPlayer::GetHonorPoints }, { "GetHonorPoints", &LuaPlayer::GetHonorPoints },
#endif
{ "GetLifetimeKills", &LuaPlayer::GetLifetimeKills }, { "GetLifetimeKills", &LuaPlayer::GetLifetimeKills },
{ "GetPlayerIP", &LuaPlayer::GetPlayerIP }, { "GetPlayerIP", &LuaPlayer::GetPlayerIP },
{ "GetLevelPlayedTime", &LuaPlayer::GetLevelPlayedTime }, { "GetLevelPlayedTime", &LuaPlayer::GetLevelPlayedTime },
@@ -497,11 +479,9 @@ ElunaRegister<Player> PlayerMethods[] =
{ "GetQuestLevel", &LuaPlayer::GetQuestLevel }, { "GetQuestLevel", &LuaPlayer::GetQuestLevel },
{ "GetChatTag", &LuaPlayer::GetChatTag }, { "GetChatTag", &LuaPlayer::GetChatTag },
{ "GetRestBonus", &LuaPlayer::GetRestBonus }, { "GetRestBonus", &LuaPlayer::GetRestBonus },
#ifdef WOTLK
{ "GetPhaseMaskForSpawn", &LuaPlayer::GetPhaseMaskForSpawn }, { "GetPhaseMaskForSpawn", &LuaPlayer::GetPhaseMaskForSpawn },
{ "GetAchievementPoints", &LuaPlayer::GetAchievementPoints }, { "GetAchievementPoints", &LuaPlayer::GetAchievementPoints },
{ "GetCompletedAchievementsCount", &LuaPlayer::GetCompletedAchievementsCount }, { "GetCompletedAchievementsCount", &LuaPlayer::GetCompletedAchievementsCount },
#endif
{ "GetReqKillOrCastCurrentCount", &LuaPlayer::GetReqKillOrCastCurrentCount }, { "GetReqKillOrCastCurrentCount", &LuaPlayer::GetReqKillOrCastCurrentCount },
{ "GetQuestStatus", &LuaPlayer::GetQuestStatus }, { "GetQuestStatus", &LuaPlayer::GetQuestStatus },
{ "GetInGameTime", &LuaPlayer::GetInGameTime }, { "GetInGameTime", &LuaPlayer::GetInGameTime },
@@ -509,10 +489,8 @@ ElunaRegister<Player> PlayerMethods[] =
{ "GetComboTarget", &LuaPlayer::GetComboTarget }, { "GetComboTarget", &LuaPlayer::GetComboTarget },
{ "GetGuildName", &LuaPlayer::GetGuildName }, { "GetGuildName", &LuaPlayer::GetGuildName },
{ "GetFreeTalentPoints", &LuaPlayer::GetFreeTalentPoints }, { "GetFreeTalentPoints", &LuaPlayer::GetFreeTalentPoints },
#if (!defined(TBC) && !defined(CLASSIC))
{ "GetActiveSpec", &LuaPlayer::GetActiveSpec }, { "GetActiveSpec", &LuaPlayer::GetActiveSpec },
{ "GetSpecsCount", &LuaPlayer::GetSpecsCount }, { "GetSpecsCount", &LuaPlayer::GetSpecsCount },
#endif
{ "GetSpellCooldownDelay", &LuaPlayer::GetSpellCooldownDelay }, { "GetSpellCooldownDelay", &LuaPlayer::GetSpellCooldownDelay },
{ "GetGuildRank", &LuaPlayer::GetGuildRank }, { "GetGuildRank", &LuaPlayer::GetGuildRank },
{ "GetDifficulty", &LuaPlayer::GetDifficulty }, { "GetDifficulty", &LuaPlayer::GetDifficulty },
@@ -536,9 +514,7 @@ ElunaRegister<Player> PlayerMethods[] =
{ "GetNextRandomRaidMember", &LuaPlayer::GetNextRandomRaidMember }, { "GetNextRandomRaidMember", &LuaPlayer::GetNextRandomRaidMember },
{ "GetOriginalGroup", &LuaPlayer::GetOriginalGroup }, { "GetOriginalGroup", &LuaPlayer::GetOriginalGroup },
{ "GetOriginalSubGroup", &LuaPlayer::GetOriginalSubGroup }, { "GetOriginalSubGroup", &LuaPlayer::GetOriginalSubGroup },
#if defined(TRINITY) || AZEROTHCORE
{ "GetChampioningFaction", &LuaPlayer::GetChampioningFaction }, { "GetChampioningFaction", &LuaPlayer::GetChampioningFaction },
#endif
{ "GetLatency", &LuaPlayer::GetLatency }, { "GetLatency", &LuaPlayer::GetLatency },
// {"GetRecruiterId", &LuaPlayer::GetRecruiterId}, // :GetRecruiterId() - UNDOCUMENTED - Returns player's recruiter's ID // {"GetRecruiterId", &LuaPlayer::GetRecruiterId}, // :GetRecruiterId() - UNDOCUMENTED - Returns player's recruiter's ID
{ "GetDbLocaleIndex", &LuaPlayer::GetDbLocaleIndex }, { "GetDbLocaleIndex", &LuaPlayer::GetDbLocaleIndex },
@@ -546,14 +522,7 @@ ElunaRegister<Player> PlayerMethods[] =
{ "GetCorpse", &LuaPlayer::GetCorpse }, { "GetCorpse", &LuaPlayer::GetCorpse },
{ "GetGossipTextId", &LuaPlayer::GetGossipTextId }, { "GetGossipTextId", &LuaPlayer::GetGossipTextId },
{ "GetQuestRewardStatus", &LuaPlayer::GetQuestRewardStatus }, { "GetQuestRewardStatus", &LuaPlayer::GetQuestRewardStatus },
#if defined(CLASSIC) || defined(TBC) || defined(WOTLK)
{ "GetShieldBlockValue", &LuaPlayer::GetShieldBlockValue }, { "GetShieldBlockValue", &LuaPlayer::GetShieldBlockValue },
#endif
#ifdef CLASSIC
{ "GetHonorStoredKills", &LuaPlayer::GetHonorStoredKills },
{ "GetRankPoints", &LuaPlayer::GetRankPoints },
{ "GetHonorLastWeekStandingPos", &LuaPlayer::GetHonorLastWeekStandingPos },
#endif
{ "GetPlayerSettingValue", &LuaPlayer::GetPlayerSettingValue }, { "GetPlayerSettingValue", &LuaPlayer::GetPlayerSettingValue },
{ "GetTrader", &LuaPlayer::GetTrader }, { "GetTrader", &LuaPlayer::GetTrader },
@@ -563,20 +532,11 @@ ElunaRegister<Player> PlayerMethods[] =
{ "AdvanceAllSkills", &LuaPlayer::AdvanceAllSkills }, { "AdvanceAllSkills", &LuaPlayer::AdvanceAllSkills },
{ "AddLifetimeKills", &LuaPlayer::AddLifetimeKills }, { "AddLifetimeKills", &LuaPlayer::AddLifetimeKills },
{ "SetCoinage", &LuaPlayer::SetCoinage }, { "SetCoinage", &LuaPlayer::SetCoinage },
#ifndef CLASSIC
{ "SetKnownTitle", &LuaPlayer::SetKnownTitle }, { "SetKnownTitle", &LuaPlayer::SetKnownTitle },
{ "UnsetKnownTitle", &LuaPlayer::UnsetKnownTitle }, { "UnsetKnownTitle", &LuaPlayer::UnsetKnownTitle },
#endif
{ "SetBindPoint", &LuaPlayer::SetBindPoint }, { "SetBindPoint", &LuaPlayer::SetBindPoint },
#if defined(TBC) || defined(WOTLK)
{ "SetArenaPoints", &LuaPlayer::SetArenaPoints }, { "SetArenaPoints", &LuaPlayer::SetArenaPoints },
{ "SetHonorPoints", &LuaPlayer::SetHonorPoints }, { "SetHonorPoints", &LuaPlayer::SetHonorPoints },
#endif
#ifdef CLASSIC
{ "SetHonorStoredKills", &LuaPlayer::SetHonorStoredKills },
{ "SetRankPoints", &LuaPlayer::SetRankPoints },
{ "SetHonorLastWeekStandingPos", &LuaPlayer::SetHonorLastWeekStandingPos },
#endif
{ "SetSpellPower", &LuaPlayer::SetSpellPower }, { "SetSpellPower", &LuaPlayer::SetSpellPower },
{ "SetLifetimeKills", &LuaPlayer::SetLifetimeKills }, { "SetLifetimeKills", &LuaPlayer::SetLifetimeKills },
{ "SetGameMaster", &LuaPlayer::SetGameMaster }, { "SetGameMaster", &LuaPlayer::SetGameMaster },
@@ -598,9 +558,6 @@ ElunaRegister<Player> PlayerMethods[] =
{ "SetPlayerLock", &LuaPlayer::SetPlayerLock }, { "SetPlayerLock", &LuaPlayer::SetPlayerLock },
{ "SetGender", &LuaPlayer::SetGender }, { "SetGender", &LuaPlayer::SetGender },
{ "SetSheath", &LuaPlayer::SetSheath }, { "SetSheath", &LuaPlayer::SetSheath },
#if !defined TRINITY && !AZEROTHCORE
{ "SetFFA", &LuaPlayer::SetFFA },
#endif
// Boolean // Boolean
{ "HasTankSpec", &LuaPlayer::HasTankSpec }, { "HasTankSpec", &LuaPlayer::HasTankSpec },
@@ -613,15 +570,11 @@ ElunaRegister<Player> PlayerMethods[] =
{ "IsImmuneToDamage", &LuaPlayer::IsImmuneToDamage }, { "IsImmuneToDamage", &LuaPlayer::IsImmuneToDamage },
{ "IsAlliance", &LuaPlayer::IsAlliance }, { "IsAlliance", &LuaPlayer::IsAlliance },
{ "IsHorde", &LuaPlayer::IsHorde }, { "IsHorde", &LuaPlayer::IsHorde },
#ifndef CLASSIC
{ "HasTitle", &LuaPlayer::HasTitle }, { "HasTitle", &LuaPlayer::HasTitle },
#endif
{ "HasItem", &LuaPlayer::HasItem }, { "HasItem", &LuaPlayer::HasItem },
{ "Teleport", &LuaPlayer::Teleport }, { "Teleport", &LuaPlayer::Teleport },
{ "AddItem", &LuaPlayer::AddItem }, { "AddItem", &LuaPlayer::AddItem },
#ifndef CLASSIC
{ "IsInArenaTeam", &LuaPlayer::IsInArenaTeam }, { "IsInArenaTeam", &LuaPlayer::IsInArenaTeam },
#endif
{ "CanRewardQuest", &LuaPlayer::CanRewardQuest }, { "CanRewardQuest", &LuaPlayer::CanRewardQuest },
{ "CanCompleteRepeatableQuest", &LuaPlayer::CanCompleteRepeatableQuest }, { "CanCompleteRepeatableQuest", &LuaPlayer::CanCompleteRepeatableQuest },
{ "CanCompleteQuest", &LuaPlayer::CanCompleteQuest }, { "CanCompleteQuest", &LuaPlayer::CanCompleteQuest },
@@ -642,13 +595,9 @@ ElunaRegister<Player> PlayerMethods[] =
{ "HasAtLoginFlag", &LuaPlayer::HasAtLoginFlag }, { "HasAtLoginFlag", &LuaPlayer::HasAtLoginFlag },
// {"InRandomLfgDungeon", &LuaPlayer::InRandomLfgDungeon}, // :InRandomLfgDungeon() - UNDOCUMENTED - Returns true if the player is in a random LFG dungeon // {"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 // {"HasPendingBind", &LuaPlayer::HasPendingBind}, // :HasPendingBind() - UNDOCUMENTED - Returns true if the player has a pending instance bind
#if (!defined(TBC) && !defined(CLASSIC))
{ "HasAchieved", &LuaPlayer::HasAchieved }, { "HasAchieved", &LuaPlayer::HasAchieved },
{ "GetAchievementCriteriaProgress", &LuaPlayer::GetAchievementCriteriaProgress }, { "GetAchievementCriteriaProgress", &LuaPlayer::GetAchievementCriteriaProgress },
#if defined(TRINITY) || defined(AZEROTHCORE)
{ "SetAchievement", &LuaPlayer::SetAchievement }, { "SetAchievement", &LuaPlayer::SetAchievement },
#endif
#endif
{ "CanUninviteFromGroup", &LuaPlayer::CanUninviteFromGroup }, { "CanUninviteFromGroup", &LuaPlayer::CanUninviteFromGroup },
{ "IsRested", &LuaPlayer::IsRested }, { "IsRested", &LuaPlayer::IsRested },
// {"CanFlyInZone", &LuaPlayer::CanFlyInZone}, // :CanFlyInZone(mapid, zone) - UNDOCUMENTED - Returns true if the player can fly in the area // {"CanFlyInZone", &LuaPlayer::CanFlyInZone}, // :CanFlyInZone(mapid, zone) - UNDOCUMENTED - Returns true if the player can fly in the area
@@ -659,9 +608,7 @@ ElunaRegister<Player> PlayerMethods[] =
{ "HasQuestForGO", &LuaPlayer::HasQuestForGO }, { "HasQuestForGO", &LuaPlayer::HasQuestForGO },
{ "CanShareQuest", &LuaPlayer::CanShareQuest }, { "CanShareQuest", &LuaPlayer::CanShareQuest },
// {"HasReceivedQuestReward", &LuaPlayer::HasReceivedQuestReward}, // :HasReceivedQuestReward(entry) - UNDOCUMENTED - Returns true if the player has recieved the quest's reward // {"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 }, { "HasTalent", &LuaPlayer::HasTalent },
#endif
{ "IsInSameGroupWith", &LuaPlayer::IsInSameGroupWith }, { "IsInSameGroupWith", &LuaPlayer::IsInSameGroupWith },
{ "IsInSameRaidWith", &LuaPlayer::IsInSameRaidWith }, { "IsInSameRaidWith", &LuaPlayer::IsInSameRaidWith },
{ "IsGroupVisibleFor", &LuaPlayer::IsGroupVisibleFor }, { "IsGroupVisibleFor", &LuaPlayer::IsGroupVisibleFor },
@@ -669,26 +616,18 @@ ElunaRegister<Player> PlayerMethods[] =
{ "IsHonorOrXPTarget", &LuaPlayer::IsHonorOrXPTarget }, { "IsHonorOrXPTarget", &LuaPlayer::IsHonorOrXPTarget },
{ "CanParry", &LuaPlayer::CanParry }, { "CanParry", &LuaPlayer::CanParry },
{ "CanBlock", &LuaPlayer::CanBlock }, { "CanBlock", &LuaPlayer::CanBlock },
#if (!defined(TBC) && !defined(CLASSIC))
{ "CanTitanGrip", &LuaPlayer::CanTitanGrip }, { "CanTitanGrip", &LuaPlayer::CanTitanGrip },
#endif
{ "InBattleground", &LuaPlayer::InBattleground }, { "InBattleground", &LuaPlayer::InBattleground },
#ifndef CLASSIC
{ "InArena", &LuaPlayer::InArena }, { "InArena", &LuaPlayer::InArena },
#endif
// {"IsOutdoorPvPActive", &LuaPlayer::IsOutdoorPvPActive}, // :IsOutdoorPvPActive() - UNDOCUMENTED - Returns true if the player is outdoor pvp active // {"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 // {"IsARecruiter", &LuaPlayer::IsARecruiter}, // :IsARecruiter() - UNDOCUMENTED - Returns true if the player is a recruiter
{ "CanUseItem", &LuaPlayer::CanUseItem }, { "CanUseItem", &LuaPlayer::CanUseItem },
{ "HasSpell", &LuaPlayer::HasSpell }, { "HasSpell", &LuaPlayer::HasSpell },
{ "HasSpellCooldown", &LuaPlayer::HasSpellCooldown }, { "HasSpellCooldown", &LuaPlayer::HasSpellCooldown },
{ "IsInWater", &LuaPlayer::IsInWater }, { "IsInWater", &LuaPlayer::IsInWater },
#ifndef CLASSIC
{ "CanFly", &LuaPlayer::CanFly }, { "CanFly", &LuaPlayer::CanFly },
#endif
{ "IsMoving", &LuaPlayer::IsMoving }, { "IsMoving", &LuaPlayer::IsMoving },
#ifndef CLASSIC
{ "IsFlying", &LuaPlayer::IsFlying }, { "IsFlying", &LuaPlayer::IsFlying },
#endif
// Gossip // Gossip
{ "GossipMenuAddItem", &LuaPlayer::GossipMenuAddItem }, { "GossipMenuAddItem", &LuaPlayer::GossipMenuAddItem },
@@ -709,9 +648,7 @@ ElunaRegister<Player> PlayerMethods[] =
{ "RunCommand", &LuaPlayer::RunCommand }, { "RunCommand", &LuaPlayer::RunCommand },
{ "SetGlyph", &LuaPlayer::SetGlyph }, { "SetGlyph", &LuaPlayer::SetGlyph },
{ "GetGlyph", &LuaPlayer::GetGlyph }, { "GetGlyph", &LuaPlayer::GetGlyph },
#if !defined(CLASSIC)
{ "RemoveArenaSpellCooldowns", &LuaPlayer::RemoveArenaSpellCooldowns }, { "RemoveArenaSpellCooldowns", &LuaPlayer::RemoveArenaSpellCooldowns },
#endif
{ "RemoveItem", &LuaPlayer::RemoveItem }, { "RemoveItem", &LuaPlayer::RemoveItem },
{ "RemoveLifetimeKills", &LuaPlayer::RemoveLifetimeKills }, { "RemoveLifetimeKills", &LuaPlayer::RemoveLifetimeKills },
{ "ResurrectPlayer", &LuaPlayer::ResurrectPlayer }, { "ResurrectPlayer", &LuaPlayer::ResurrectPlayer },
@@ -739,9 +676,7 @@ ElunaRegister<Player> PlayerMethods[] =
// {"KilledPlayerCredit", &LuaPlayer::KilledPlayerCredit}, // :KilledPlayerCredit() - UNDOCUMENTED - Satisfies a player kill for the player // {"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 // {"KillGOCredit", &LuaPlayer::KillGOCredit}, // :KillGOCredit(GOEntry[, GUID]) - UNDOCUMENTED - Credits the player for destroying a GO, guid is optional
{ "TalkedToCreature", &LuaPlayer::TalkedToCreature }, { "TalkedToCreature", &LuaPlayer::TalkedToCreature },
#if (!defined(TBC) && !defined(CLASSIC))
{ "ResetPetTalents", &LuaPlayer::ResetPetTalents }, { "ResetPetTalents", &LuaPlayer::ResetPetTalents },
#endif
{ "AddComboPoints", &LuaPlayer::AddComboPoints }, { "AddComboPoints", &LuaPlayer::AddComboPoints },
// {"GainSpellComboPoints", &LuaPlayer::GainSpellComboPoints}, // :GainSpellComboPoints(amount) - UNDOCUMENTED - Player gains spell combo points // {"GainSpellComboPoints", &LuaPlayer::GainSpellComboPoints}, // :GainSpellComboPoints(amount) - UNDOCUMENTED - Player gains spell combo points
{ "ClearComboPoints", &LuaPlayer::ClearComboPoints }, { "ClearComboPoints", &LuaPlayer::ClearComboPoints },
@@ -758,18 +693,14 @@ ElunaRegister<Player> PlayerMethods[] =
{ "DurabilityPointLossForEquipSlot", &LuaPlayer::DurabilityPointLossForEquipSlot }, { "DurabilityPointLossForEquipSlot", &LuaPlayer::DurabilityPointLossForEquipSlot },
{ "DurabilityRepairAll", &LuaPlayer::DurabilityRepairAll }, { "DurabilityRepairAll", &LuaPlayer::DurabilityRepairAll },
{ "DurabilityRepair", &LuaPlayer::DurabilityRepair }, { "DurabilityRepair", &LuaPlayer::DurabilityRepair },
#if defined(TBC) || defined(WOTLK)
{ "ModifyHonorPoints", &LuaPlayer::ModifyHonorPoints }, { "ModifyHonorPoints", &LuaPlayer::ModifyHonorPoints },
{ "ModifyArenaPoints", &LuaPlayer::ModifyArenaPoints }, { "ModifyArenaPoints", &LuaPlayer::ModifyArenaPoints },
#endif
{ "LeaveBattleground", &LuaPlayer::LeaveBattleground }, { "LeaveBattleground", &LuaPlayer::LeaveBattleground },
// {"BindToInstance", &LuaPlayer::BindToInstance}, // :BindToInstance() - UNDOCUMENTED - Binds the player to the current instance // {"BindToInstance", &LuaPlayer::BindToInstance}, // :BindToInstance() - UNDOCUMENTED - Binds the player to the current instance
{ "UnbindInstance", &LuaPlayer::UnbindInstance }, { "UnbindInstance", &LuaPlayer::UnbindInstance },
{ "UnbindAllInstances", &LuaPlayer::UnbindAllInstances }, { "UnbindAllInstances", &LuaPlayer::UnbindAllInstances },
{ "RemoveFromBattlegroundRaid", &LuaPlayer::RemoveFromBattlegroundRaid }, { "RemoveFromBattlegroundRaid", &LuaPlayer::RemoveFromBattlegroundRaid },
#if (!defined(TBC) && !defined(CLASSIC))
{ "ResetAchievements", &LuaPlayer::ResetAchievements }, { "ResetAchievements", &LuaPlayer::ResetAchievements },
#endif
{ "KickPlayer", &LuaPlayer::KickPlayer }, { "KickPlayer", &LuaPlayer::KickPlayer },
{ "LogoutPlayer", &LuaPlayer::LogoutPlayer }, { "LogoutPlayer", &LuaPlayer::LogoutPlayer },
{ "SendTrainerList", &LuaPlayer::SendTrainerList }, { "SendTrainerList", &LuaPlayer::SendTrainerList },
@@ -795,14 +726,7 @@ ElunaRegister<Player> PlayerMethods[] =
{ "GroupInvite", &LuaPlayer::GroupInvite }, { "GroupInvite", &LuaPlayer::GroupInvite },
{ "GroupCreate", &LuaPlayer::GroupCreate }, { "GroupCreate", &LuaPlayer::GroupCreate },
{ "SendCinematicStart", &LuaPlayer::SendCinematicStart }, { "SendCinematicStart", &LuaPlayer::SendCinematicStart },
#if !defined(CLASSIC) && !defined(TBC)
{ "SendMovieStart", &LuaPlayer::SendMovieStart }, { "SendMovieStart", &LuaPlayer::SendMovieStart },
#endif
#ifdef CLASSIC
{ "UpdateHonor", &LuaPlayer::UpdateHonor },
{ "ResetHonor", &LuaPlayer::ResetHonor },
{ "ClearHonorInfo", &LuaPlayer::ClearHonorInfo },
#endif
{ "UpdatePlayerSetting", &LuaPlayer::UpdatePlayerSetting }, { "UpdatePlayerSetting", &LuaPlayer::UpdatePlayerSetting },
{ NULL, NULL } { NULL, NULL }
@@ -820,18 +744,13 @@ ElunaRegister<Creature> CreatureMethods[] =
{ "GetScriptId", &LuaCreature::GetScriptId }, { "GetScriptId", &LuaCreature::GetScriptId },
{ "GetAIName", &LuaCreature::GetAIName }, { "GetAIName", &LuaCreature::GetAIName },
{ "GetScriptName", &LuaCreature::GetScriptName }, { "GetScriptName", &LuaCreature::GetScriptName },
#ifndef AZEROTHCORE
{ "GetAttackDistance", &LuaCreature::GetAttackDistance },
#endif
{ "GetAggroRange", &LuaCreature::GetAggroRange }, { "GetAggroRange", &LuaCreature::GetAggroRange },
{ "GetDefaultMovementType", &LuaCreature::GetDefaultMovementType }, { "GetDefaultMovementType", &LuaCreature::GetDefaultMovementType },
{ "GetRespawnDelay", &LuaCreature::GetRespawnDelay }, { "GetRespawnDelay", &LuaCreature::GetRespawnDelay },
{ "GetWanderRadius", &LuaCreature::GetWanderRadius }, { "GetWanderRadius", &LuaCreature::GetWanderRadius },
{ "GetCurrentWaypointId", &LuaCreature::GetCurrentWaypointId }, { "GetCurrentWaypointId", &LuaCreature::GetCurrentWaypointId },
#if defined(TRINITY) || AZEROTHCORE
{ "GetWaypointPath", &LuaCreature::GetWaypointPath }, { "GetWaypointPath", &LuaCreature::GetWaypointPath },
{ "GetLootMode", &LuaCreature::GetLootMode }, { "GetLootMode", &LuaCreature::GetLootMode },
#endif
{ "GetLootRecipient", &LuaCreature::GetLootRecipient }, { "GetLootRecipient", &LuaCreature::GetLootRecipient },
{ "GetLootRecipientGroup", &LuaCreature::GetLootRecipientGroup }, { "GetLootRecipientGroup", &LuaCreature::GetLootRecipientGroup },
{ "GetNPCFlags", &LuaCreature::GetNPCFlags }, { "GetNPCFlags", &LuaCreature::GetNPCFlags },
@@ -839,16 +758,12 @@ ElunaRegister<Creature> CreatureMethods[] =
{ "GetUnitFlagsTwo", &LuaCreature::GetUnitFlagsTwo }, { "GetUnitFlagsTwo", &LuaCreature::GetUnitFlagsTwo },
{ "GetExtraFlags", &LuaCreature::GetExtraFlags }, { "GetExtraFlags", &LuaCreature::GetExtraFlags },
{ "GetRank", &LuaCreature::GetRank }, { "GetRank", &LuaCreature::GetRank },
#if defined(CLASSIC) || defined(TBC) || defined(WOTLK)
{ "GetShieldBlockValue", &LuaCreature::GetShieldBlockValue }, { "GetShieldBlockValue", &LuaCreature::GetShieldBlockValue },
#endif
{ "GetDBTableGUIDLow", &LuaCreature::GetDBTableGUIDLow }, { "GetDBTableGUIDLow", &LuaCreature::GetDBTableGUIDLow },
{ "GetCreatureFamily", &LuaCreature::GetCreatureFamily }, { "GetCreatureFamily", &LuaCreature::GetCreatureFamily },
// Setters // Setters
#if defined(TRINITY) || defined(AZEROTHCORE)
{ "SetRegeneratingHealth", &LuaCreature::SetRegeneratingHealth }, { "SetRegeneratingHealth", &LuaCreature::SetRegeneratingHealth },
#endif
{ "SetHover", &LuaCreature::SetHover }, { "SetHover", &LuaCreature::SetHover },
{ "SetDisableGravity", &LuaCreature::SetDisableGravity }, { "SetDisableGravity", &LuaCreature::SetDisableGravity },
{ "SetAggroEnabled", &LuaCreature::SetAggroEnabled }, { "SetAggroEnabled", &LuaCreature::SetAggroEnabled },
@@ -859,15 +774,11 @@ ElunaRegister<Creature> CreatureMethods[] =
{ "SetWanderRadius", &LuaCreature::SetWanderRadius }, { "SetWanderRadius", &LuaCreature::SetWanderRadius },
{ "SetInCombatWithZone", &LuaCreature::SetInCombatWithZone }, { "SetInCombatWithZone", &LuaCreature::SetInCombatWithZone },
{ "SetDisableReputationGain", &LuaCreature::SetDisableReputationGain }, { "SetDisableReputationGain", &LuaCreature::SetDisableReputationGain },
#if defined(TRINITY) || AZEROTHCORE
{ "SetLootMode", &LuaCreature::SetLootMode }, { "SetLootMode", &LuaCreature::SetLootMode },
#endif
{ "SetNPCFlags", &LuaCreature::SetNPCFlags }, { "SetNPCFlags", &LuaCreature::SetNPCFlags },
{ "SetUnitFlags", &LuaCreature::SetUnitFlags }, { "SetUnitFlags", &LuaCreature::SetUnitFlags },
{ "SetUnitFlagsTwo", &LuaCreature::SetUnitFlagsTwo }, { "SetUnitFlagsTwo", &LuaCreature::SetUnitFlagsTwo },
#if defined(TRINITY) || AZEROTHCORE
{ "SetReactState", &LuaCreature::SetReactState }, { "SetReactState", &LuaCreature::SetReactState },
#endif
{ "SetDeathState", &LuaCreature::SetDeathState }, { "SetDeathState", &LuaCreature::SetDeathState },
{ "SetWalk", &LuaCreature::SetWalk }, { "SetWalk", &LuaCreature::SetWalk },
{ "SetHomePosition", &LuaCreature::SetHomePosition }, { "SetHomePosition", &LuaCreature::SetHomePosition },
@@ -875,15 +786,11 @@ ElunaRegister<Creature> CreatureMethods[] =
// Boolean // Boolean
{ "IsRegeneratingHealth", &LuaCreature::IsRegeneratingHealth }, { "IsRegeneratingHealth", &LuaCreature::IsRegeneratingHealth },
#if defined(TRINITY) || defined(AZEROTHCORE)
{ "IsDungeonBoss", &LuaCreature::IsDungeonBoss }, { "IsDungeonBoss", &LuaCreature::IsDungeonBoss },
#endif
{ "IsWorldBoss", &LuaCreature::IsWorldBoss }, { "IsWorldBoss", &LuaCreature::IsWorldBoss },
{ "IsRacialLeader", &LuaCreature::IsRacialLeader }, { "IsRacialLeader", &LuaCreature::IsRacialLeader },
{ "IsCivilian", &LuaCreature::IsCivilian }, { "IsCivilian", &LuaCreature::IsCivilian },
#if defined(TRINITY) || AZEROTHCORE
{ "IsTrigger", &LuaCreature::IsTrigger }, { "IsTrigger", &LuaCreature::IsTrigger },
#endif
{ "IsGuard", &LuaCreature::IsGuard }, { "IsGuard", &LuaCreature::IsGuard },
{ "IsElite", &LuaCreature::IsElite }, { "IsElite", &LuaCreature::IsElite },
{ "IsInEvadeMode", &LuaCreature::IsInEvadeMode }, { "IsInEvadeMode", &LuaCreature::IsInEvadeMode },
@@ -891,9 +798,7 @@ ElunaRegister<Creature> CreatureMethods[] =
{ "CanWalk", &LuaCreature::CanWalk }, { "CanWalk", &LuaCreature::CanWalk },
{ "CanSwim", &LuaCreature::CanSwim }, { "CanSwim", &LuaCreature::CanSwim },
{ "CanAggro", &LuaCreature::CanAggro }, { "CanAggro", &LuaCreature::CanAggro },
#if defined(TRINITY) || AZEROTHCORE
{ "CanStartAttack", &LuaCreature::CanStartAttack }, { "CanStartAttack", &LuaCreature::CanStartAttack },
#endif
{ "HasSearchedAssistance", &LuaCreature::HasSearchedAssistance }, { "HasSearchedAssistance", &LuaCreature::HasSearchedAssistance },
{ "IsTappedBy", &LuaCreature::IsTappedBy }, { "IsTappedBy", &LuaCreature::IsTappedBy },
{ "HasLootRecipient", &LuaCreature::HasLootRecipient }, { "HasLootRecipient", &LuaCreature::HasLootRecipient },
@@ -901,10 +806,8 @@ ElunaRegister<Creature> CreatureMethods[] =
{ "IsTargetableForAttack", &LuaCreature::IsTargetableForAttack }, { "IsTargetableForAttack", &LuaCreature::IsTargetableForAttack },
{ "CanCompleteQuest", &LuaCreature::CanCompleteQuest }, { "CanCompleteQuest", &LuaCreature::CanCompleteQuest },
{ "IsReputationGainDisabled", &LuaCreature::IsReputationGainDisabled }, { "IsReputationGainDisabled", &LuaCreature::IsReputationGainDisabled },
#if defined(TRINITY) || AZEROTHCORE
{ "IsDamageEnoughForLootingAndReward", &LuaCreature::IsDamageEnoughForLootingAndReward }, { "IsDamageEnoughForLootingAndReward", &LuaCreature::IsDamageEnoughForLootingAndReward },
{ "HasLootMode", &LuaCreature::HasLootMode }, { "HasLootMode", &LuaCreature::HasLootMode },
#endif
{ "HasSpell", &LuaCreature::HasSpell }, { "HasSpell", &LuaCreature::HasSpell },
{ "HasQuest", &LuaCreature::HasQuest }, { "HasQuest", &LuaCreature::HasQuest },
{ "HasSpellCooldown", &LuaCreature::HasSpellCooldown }, { "HasSpellCooldown", &LuaCreature::HasSpellCooldown },
@@ -918,11 +821,9 @@ ElunaRegister<Creature> CreatureMethods[] =
{ "DespawnOrUnsummon", &LuaCreature::DespawnOrUnsummon }, { "DespawnOrUnsummon", &LuaCreature::DespawnOrUnsummon },
{ "Respawn", &LuaCreature::Respawn }, { "Respawn", &LuaCreature::Respawn },
{ "AttackStart", &LuaCreature::AttackStart }, { "AttackStart", &LuaCreature::AttackStart },
#if defined(TRINITY) || AZEROTHCORE
{ "AddLootMode", &LuaCreature::AddLootMode }, { "AddLootMode", &LuaCreature::AddLootMode },
{ "ResetLootMode", &LuaCreature::ResetLootMode }, { "ResetLootMode", &LuaCreature::ResetLootMode },
{ "RemoveLootMode", &LuaCreature::RemoveLootMode }, { "RemoveLootMode", &LuaCreature::RemoveLootMode },
#endif
{ "SaveToDB", &LuaCreature::SaveToDB }, { "SaveToDB", &LuaCreature::SaveToDB },
{ "SelectVictim", &LuaCreature::SelectVictim }, { "SelectVictim", &LuaCreature::SelectVictim },
{ "MoveWaypoint", &LuaCreature::MoveWaypoint }, { "MoveWaypoint", &LuaCreature::MoveWaypoint },
@@ -990,13 +891,9 @@ ElunaRegister<Item> ItemMethods[] =
{ "GetAllowableRace", &LuaItem::GetAllowableRace }, { "GetAllowableRace", &LuaItem::GetAllowableRace },
{ "GetItemLevel", &LuaItem::GetItemLevel }, { "GetItemLevel", &LuaItem::GetItemLevel },
{ "GetRequiredLevel", &LuaItem::GetRequiredLevel }, { "GetRequiredLevel", &LuaItem::GetRequiredLevel },
#ifdef WOTLK
{ "GetStatsCount", &LuaItem::GetStatsCount }, { "GetStatsCount", &LuaItem::GetStatsCount },
#endif
{ "GetRandomProperty", &LuaItem::GetRandomProperty }, { "GetRandomProperty", &LuaItem::GetRandomProperty },
#ifndef CLASSIC
{ "GetRandomSuffix", &LuaItem::GetRandomSuffix }, { "GetRandomSuffix", &LuaItem::GetRandomSuffix },
#endif
{ "GetItemSet", &LuaItem::GetItemSet }, { "GetItemSet", &LuaItem::GetItemSet },
{ "GetBagSize", &LuaItem::GetBagSize }, { "GetBagSize", &LuaItem::GetBagSize },
{ "GetItemTemplate", &LuaItem::GetItemTemplate }, { "GetItemTemplate", &LuaItem::GetItemTemplate },
@@ -1008,16 +905,12 @@ ElunaRegister<Item> ItemMethods[] =
// Boolean // Boolean
{ "IsSoulBound", &LuaItem::IsSoulBound }, { "IsSoulBound", &LuaItem::IsSoulBound },
#if (!defined(TBC) && !defined(CLASSIC))
{ "IsBoundAccountWide", &LuaItem::IsBoundAccountWide }, { "IsBoundAccountWide", &LuaItem::IsBoundAccountWide },
#endif
{ "IsBoundByEnchant", &LuaItem::IsBoundByEnchant }, { "IsBoundByEnchant", &LuaItem::IsBoundByEnchant },
{ "IsNotBoundToPlayer", &LuaItem::IsNotBoundToPlayer }, { "IsNotBoundToPlayer", &LuaItem::IsNotBoundToPlayer },
{ "IsLocked", &LuaItem::IsLocked }, { "IsLocked", &LuaItem::IsLocked },
{ "IsBag", &LuaItem::IsBag }, { "IsBag", &LuaItem::IsBag },
#ifndef CLASSIC
{ "IsCurrencyToken", &LuaItem::IsCurrencyToken }, { "IsCurrencyToken", &LuaItem::IsCurrencyToken },
#endif
{ "IsNotEmptyBag", &LuaItem::IsNotEmptyBag }, { "IsNotEmptyBag", &LuaItem::IsNotEmptyBag },
{ "IsBroken", &LuaItem::IsBroken }, { "IsBroken", &LuaItem::IsBroken },
{ "CanBeTraded", &LuaItem::CanBeTraded }, { "CanBeTraded", &LuaItem::CanBeTraded },
@@ -1026,10 +919,8 @@ ElunaRegister<Item> ItemMethods[] =
{ "IsEquipped", &LuaItem::IsEquipped }, { "IsEquipped", &LuaItem::IsEquipped },
{ "HasQuest", &LuaItem::HasQuest }, { "HasQuest", &LuaItem::HasQuest },
{ "IsPotion", &LuaItem::IsPotion }, { "IsPotion", &LuaItem::IsPotion },
#if defined(CLASSIC) || defined(TBC) || defined(WOTLK)
{ "IsWeaponVellum", &LuaItem::IsWeaponVellum }, { "IsWeaponVellum", &LuaItem::IsWeaponVellum },
{ "IsArmorVellum", &LuaItem::IsArmorVellum }, { "IsArmorVellum", &LuaItem::IsArmorVellum },
#endif
{ "IsConjuredConsumable", &LuaItem::IsConjuredConsumable }, { "IsConjuredConsumable", &LuaItem::IsConjuredConsumable },
//{"IsRefundExpired", &LuaItem::IsRefundExpired}, // :IsRefundExpired() - UNDOCUMENTED - Returns true if the item's refund time has expired //{"IsRefundExpired", &LuaItem::IsRefundExpired}, // :IsRefundExpired() - UNDOCUMENTED - Returns true if the item's refund time has expired
{ "SetEnchantment", &LuaItem::SetEnchantment }, { "SetEnchantment", &LuaItem::SetEnchantment },
@@ -1126,9 +1017,7 @@ ElunaRegister<Quest> QuestMethods[] =
// Boolean // Boolean
{ "HasFlag", &LuaQuest::HasFlag }, { "HasFlag", &LuaQuest::HasFlag },
#ifndef CLASSIC
{ "IsDaily", &LuaQuest::IsDaily }, { "IsDaily", &LuaQuest::IsDaily },
#endif
{ "IsRepeatable", &LuaQuest::IsRepeatable }, { "IsRepeatable", &LuaQuest::IsRepeatable },
{ NULL, NULL } { NULL, NULL }
@@ -1187,13 +1076,9 @@ ElunaRegister<Guild> GuildMethods[] =
{ "GetMemberCount", &LuaGuild::GetMemberCount }, { "GetMemberCount", &LuaGuild::GetMemberCount },
// Setters // Setters
#ifndef CLASSIC
{ "SetBankTabText", &LuaGuild::SetBankTabText }, { "SetBankTabText", &LuaGuild::SetBankTabText },
#endif
{ "SetMemberRank", &LuaGuild::SetMemberRank }, { "SetMemberRank", &LuaGuild::SetMemberRank },
#if defined(CLASSIC) || defined(TBC) || defined(WOTLK)
{ "SetLeader", &LuaGuild::SetLeader }, { "SetLeader", &LuaGuild::SetLeader },
#endif
// Other // Other
{ "SendPacket", &LuaGuild::SendPacket }, { "SendPacket", &LuaGuild::SendPacket },
@@ -1205,8 +1090,6 @@ ElunaRegister<Guild> GuildMethods[] =
{ NULL, NULL } { NULL, NULL }
}; };
#ifndef CLASSIC
#ifndef TBC
ElunaRegister<Vehicle> VehicleMethods[] = ElunaRegister<Vehicle> VehicleMethods[] =
{ {
// Getters // Getters
@@ -1223,8 +1106,6 @@ ElunaRegister<Vehicle> VehicleMethods[] =
{ NULL, NULL } { NULL, NULL }
}; };
#endif
#endif
ElunaRegister<ElunaQuery> QueryMethods[] = ElunaRegister<ElunaQuery> QueryMethods[] =
{ {
@@ -1306,15 +1187,11 @@ ElunaRegister<Map> MapMethods[] =
{ "SetWeather", &LuaMap::SetWeather }, { "SetWeather", &LuaMap::SetWeather },
// Boolean // Boolean
#ifndef CLASSIC
{ "IsArena", &LuaMap::IsArena }, { "IsArena", &LuaMap::IsArena },
#endif
{ "IsBattleground", &LuaMap::IsBattleground }, { "IsBattleground", &LuaMap::IsBattleground },
{ "IsDungeon", &LuaMap::IsDungeon }, { "IsDungeon", &LuaMap::IsDungeon },
{ "IsEmpty", &LuaMap::IsEmpty }, { "IsEmpty", &LuaMap::IsEmpty },
#ifndef CLASSIC
{ "IsHeroic", &LuaMap::IsHeroic }, { "IsHeroic", &LuaMap::IsHeroic },
#endif
{ "IsRaid", &LuaMap::IsRaid }, { "IsRaid", &LuaMap::IsRaid },
// Other // Other
@@ -1349,9 +1226,6 @@ ElunaRegister<BattleGround> BattleGroundMethods[] =
{ "GetAlivePlayersCountByTeam", &LuaBattleGround::GetAlivePlayersCountByTeam }, { "GetAlivePlayersCountByTeam", &LuaBattleGround::GetAlivePlayersCountByTeam },
{ "GetMap", &LuaBattleGround::GetMap }, { "GetMap", &LuaBattleGround::GetMap },
{ "GetBonusHonorFromKillCount", &LuaBattleGround::GetBonusHonorFromKillCount }, { "GetBonusHonorFromKillCount", &LuaBattleGround::GetBonusHonorFromKillCount },
#ifndef AZEROTHCORE
{ "GetBracketId", &LuaBattleGround::GetBracketId },
#endif
{ "GetEndTime", &LuaBattleGround::GetEndTime }, { "GetEndTime", &LuaBattleGround::GetEndTime },
{ "GetFreeSlotsForTeam", &LuaBattleGround::GetFreeSlotsForTeam }, { "GetFreeSlotsForTeam", &LuaBattleGround::GetFreeSlotsForTeam },
{ "GetInstanceId", &LuaBattleGround::GetInstanceId }, { "GetInstanceId", &LuaBattleGround::GetInstanceId },
@@ -1416,7 +1290,6 @@ ElunaRegister<Roll> RollMethods[] =
{ NULL, NULL } { NULL, NULL }
}; };
#if (!defined(TBC) && !defined(CLASSIC))
// fix compile error about accessing vehicle destructor // fix compile error about accessing vehicle destructor
template<> int ElunaTemplate<Vehicle>::CollectGarbage(lua_State* L) template<> int ElunaTemplate<Vehicle>::CollectGarbage(lua_State* L)
{ {
@@ -1427,7 +1300,6 @@ template<> int ElunaTemplate<Vehicle>::CollectGarbage(lua_State* L)
delete obj; delete obj;
return 0; return 0;
} }
#endif
// Template by Mud from http://stackoverflow.com/questions/4484437/lua-integer-type/4485511#4485511 // Template by Mud from http://stackoverflow.com/questions/4484437/lua-integer-type/4485511#4485511
template<> int ElunaTemplate<unsigned long long>::Add(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL<unsigned long long>(L, 1) + Eluna::CHECKVAL<unsigned long long>(L, 2)); return 1; } template<> int ElunaTemplate<unsigned long long>::Add(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL<unsigned long long>(L, 1) + Eluna::CHECKVAL<unsigned long long>(L, 2)); return 1; }
@@ -1521,12 +1393,8 @@ void RegisterFunctions(Eluna* E)
ElunaTemplate<ItemTemplate>::Register(E, "ItemTemplate"); ElunaTemplate<ItemTemplate>::Register(E, "ItemTemplate");
ElunaTemplate<ItemTemplate>::SetMethods(E, ItemTemplateMethods); ElunaTemplate<ItemTemplate>::SetMethods(E, ItemTemplateMethods);
#ifndef CLASSIC
#ifndef TBC
ElunaTemplate<Vehicle>::Register(E, "Vehicle"); ElunaTemplate<Vehicle>::Register(E, "Vehicle");
ElunaTemplate<Vehicle>::SetMethods(E, VehicleMethods); ElunaTemplate<Vehicle>::SetMethods(E, VehicleMethods);
#endif
#endif
ElunaTemplate<Group>::Register(E, "Group"); ElunaTemplate<Group>::Register(E, "Group");
ElunaTemplate<Group>::SetMethods(E, GroupMethods); ElunaTemplate<Group>::SetMethods(E, GroupMethods);

View File

@@ -29,11 +29,7 @@ void Eluna::OnBGStart(BattleGround* bg, BattleGroundTypeId bgId, uint32 instance
CallAllFunctions(BGEventBindings, key); CallAllFunctions(BGEventBindings, key);
} }
#if AZEROTHCORE
void Eluna::OnBGEnd(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId, TeamId winner) 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); START_HOOK(BG_EVENT_ON_END);
Push(bg); Push(bg);

View File

@@ -301,8 +301,6 @@ bool Eluna::SpellHitTarget(Creature* me, WorldObject* target, SpellInfo const* s
return CallAllFunctionsBool(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key); return CallAllFunctionsBool(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key);
} }
#if defined TRINITY || AZEROTHCORE
bool Eluna::SummonedCreatureDies(Creature* me, Creature* summon, Unit* killer) bool Eluna::SummonedCreatureDies(Creature* me, Creature* summon, Unit* killer)
{ {
START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_SUMMONED_CREATURE_DIED, me, false); 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); Push(target);
return CallAllFunctionsBool(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key); return CallAllFunctionsBool(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key);
} }
#endif // TRINITY

View File

@@ -76,8 +76,6 @@ void Eluna::GetDialogStatus(const Player* pPlayer, const GameObject* pGameObject
CallAllFunctions(GameObjectEventBindings, key); CallAllFunctions(GameObjectEventBindings, key);
} }
#ifndef CLASSIC
#ifndef TBC
void Eluna::OnDestroyed(GameObject* pGameObject, WorldObject* attacker) void Eluna::OnDestroyed(GameObject* pGameObject, WorldObject* attacker)
{ {
START_HOOK(GAMEOBJECT_EVENT_ON_DESTROYED, pGameObject->GetEntry()); START_HOOK(GAMEOBJECT_EVENT_ON_DESTROYED, pGameObject->GetEntry());
@@ -93,8 +91,6 @@ void Eluna::OnDamaged(GameObject* pGameObject, WorldObject* attacker)
Push(attacker); Push(attacker);
CallAllFunctions(GameObjectEventBindings, key); CallAllFunctions(GameObjectEventBindings, key);
} }
#endif
#endif
void Eluna::OnLootStateChanged(GameObject* pGameObject, uint32 state) void Eluna::OnLootStateChanged(GameObject* pGameObject, uint32 state)
{ {

View File

@@ -74,11 +74,7 @@ bool Eluna::OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets)
data << guid; data << guid;
data << ObjectGuid(uint64(0)); data << ObjectGuid(uint64(0));
data << uint8(0); data << uint8(0);
#ifdef CMANGOS
pPlayer->GetSession()->SendPacket(data);
#else
pPlayer->GetSession()->SendPacket(&data); pPlayer->GetSession()->SendPacket(&data);
#endif
return false; 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); START_HOOK_WITH_RETVAL(ITEM_EVENT_ON_USE, pItem->GetEntry(), true);
Push(pPlayer); Push(pPlayer);
Push(pItem); Push(pItem);
#if defined TRINITY || AZEROTHCORE
if (GameObject* target = targets.GetGOTarget()) if (GameObject* target = targets.GetGOTarget())
Push(target); Push(target);
else if (Item* target = targets.GetItemTarget()) else if (Item* target = targets.GetItemTarget())
@@ -100,18 +96,6 @@ bool Eluna::OnItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targ
Push(target); Push(target);
else else
Push(); 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); return CallAllFunctionsBool(ItemEventBindings, key, true);
} }

View File

@@ -116,14 +116,8 @@ bool Eluna::OnAreaTrigger(Player* pPlayer, AreaTriggerEntry const* pTrigger)
{ {
START_HOOK_WITH_RETVAL(TRIGGER_EVENT_ON_TRIGGER, false); START_HOOK_WITH_RETVAL(TRIGGER_EVENT_ON_TRIGGER, false);
Push(pPlayer); Push(pPlayer);
#ifdef TRINITY
Push(pTrigger->ID);
#elif AZEROTHCORE
Push(pTrigger->entry); Push(pTrigger->entry);
#else
Push(pTrigger->id);
#endif
return CallAllFunctionsBool(ServerEventBindings, key); return CallAllFunctionsBool(ServerEventBindings, key);
} }
@@ -140,22 +134,10 @@ void Eluna::OnChange(Weather* /*weather*/, uint32 zone, WeatherState state, floa
// Auction House // Auction House
void Eluna::OnAdd(AuctionHouseObject* /*ah*/, AuctionEntry* entry) void Eluna::OnAdd(AuctionHouseObject* /*ah*/, AuctionEntry* entry)
{ {
#ifdef AZEROTHCORE
Player* owner = eObjectAccessor()FindPlayer(entry->owner); 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); Item* item = eAuctionMgr->GetAItem(entry->item_guid);
uint32 expiretime = entry->expire_time; uint32 expiretime = entry->expire_time;
#else
Item* item = eAuctionMgr->GetAItem(entry->itemGuidLow);
uint32 expiretime = entry->expireTime;
#endif
if (!owner || !item) if (!owner || !item)
return; return;
@@ -174,23 +156,10 @@ void Eluna::OnAdd(AuctionHouseObject* /*ah*/, AuctionEntry* entry)
void Eluna::OnRemove(AuctionHouseObject* /*ah*/, AuctionEntry* entry) void Eluna::OnRemove(AuctionHouseObject* /*ah*/, AuctionEntry* entry)
{ {
#ifdef AZEROTHCORE
Player* owner = eObjectAccessor()FindPlayer(entry->owner); 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); Item* item = eAuctionMgr->GetAItem(entry->item_guid);
uint32 expiretime = entry->expire_time; uint32 expiretime = entry->expire_time;
#else
Item* item = eAuctionMgr->GetAItem(entry->itemGuidLow);
uint32 expiretime = entry->expireTime;
#endif
if (!owner || !item) if (!owner || !item)
return; return;
@@ -209,23 +178,10 @@ void Eluna::OnRemove(AuctionHouseObject* /*ah*/, AuctionEntry* entry)
void Eluna::OnSuccessful(AuctionHouseObject* /*ah*/, AuctionEntry* entry) void Eluna::OnSuccessful(AuctionHouseObject* /*ah*/, AuctionEntry* entry)
{ {
#ifdef AZEROTHCORE
Player* owner = eObjectAccessor()FindPlayer(entry->owner); 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); Item* item = eAuctionMgr->GetAItem(entry->item_guid);
uint32 expiretime = entry->expire_time; uint32 expiretime = entry->expire_time;
#else
Item* item = eAuctionMgr->GetAItem(entry->itemGuidLow);
uint32 expiretime = entry->expireTime;
#endif
if (!owner || !item) if (!owner || !item)
return; return;
@@ -244,23 +200,10 @@ void Eluna::OnSuccessful(AuctionHouseObject* /*ah*/, AuctionEntry* entry)
void Eluna::OnExpire(AuctionHouseObject* /*ah*/, AuctionEntry* entry) void Eluna::OnExpire(AuctionHouseObject* /*ah*/, AuctionEntry* entry)
{ {
#ifdef AZEROTHCORE
Player* owner = eObjectAccessor()FindPlayer(entry->owner); 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); Item* item = eAuctionMgr->GetAItem(entry->item_guid);
uint32 expiretime = entry->expire_time; uint32 expiretime = entry->expire_time;
#else
Item* item = eAuctionMgr->GetAItem(entry->itemGuidLow);
uint32 expiretime = entry->expireTime;
#endif
if (!owner || !item) if (!owner || !item)
return; return;
@@ -284,17 +227,11 @@ void Eluna::OnOpenStateChange(bool open)
CallAllFunctions(ServerEventBindings, key); CallAllFunctions(ServerEventBindings, key);
} }
#ifndef AZEROTHCORE
void Eluna::OnConfigLoad(bool reload)
#else
void Eluna::OnConfigLoad(bool reload, bool isBefore) void Eluna::OnConfigLoad(bool reload, bool isBefore)
#endif
{ {
START_HOOK(WORLD_EVENT_ON_CONFIG_LOAD); START_HOOK(WORLD_EVENT_ON_CONFIG_LOAD);
Push(reload); Push(reload);
#ifdef AZEROTHCORE
Push(isBefore); Push(isBefore);
#endif
CallAllFunctions(ServerEventBindings, key); CallAllFunctions(ServerEventBindings, key);
} }

View File

@@ -10,9 +10,6 @@
#include "BindingMap.h" #include "BindingMap.h"
#include "ElunaTemplate.h" #include "ElunaTemplate.h"
#ifndef CLASSIC
#ifndef TBC
using namespace Hooks; using namespace Hooks;
#define START_HOOK(EVENT) \ #define START_HOOK(EVENT) \
@@ -61,6 +58,3 @@ void Eluna::OnRemovePassenger(Vehicle* vehicle, Unit* passenger)
Push(passenger); Push(passenger);
CallAllFunctions(VehicleEventBindings, key); CallAllFunctions(VehicleEventBindings, key);
} }
#endif // CLASSIC
#endif // TBC

View File

@@ -39,11 +39,7 @@ namespace LuaAura
*/ */
int GetCasterGUID(lua_State* L, Aura* aura) int GetCasterGUID(lua_State* L, Aura* aura)
{ {
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, aura->GetCasterGUID()); Eluna::Push(L, aura->GetCasterGUID());
#else
Eluna::Push(L, aura->GetCasterGuid());
#endif
return 1; return 1;
} }
@@ -65,11 +61,7 @@ namespace LuaAura
*/ */
int GetDuration(lua_State* L, Aura* aura) int GetDuration(lua_State* L, Aura* aura)
{ {
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, aura->GetDuration()); Eluna::Push(L, aura->GetDuration());
#else
Eluna::Push(L, aura->GetAuraDuration());
#endif
return 1; return 1;
} }
@@ -94,11 +86,7 @@ namespace LuaAura
*/ */
int GetMaxDuration(lua_State* L, Aura* aura) int GetMaxDuration(lua_State* L, Aura* aura)
{ {
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, aura->GetMaxDuration()); Eluna::Push(L, aura->GetMaxDuration());
#else
Eluna::Push(L, aura->GetAuraMaxDuration());
#endif
return 1; return 1;
} }
@@ -122,11 +110,7 @@ namespace LuaAura
*/ */
int GetOwner(lua_State* L, Aura* aura) int GetOwner(lua_State* L, Aura* aura)
{ {
#if defined TRINITY || defined AZEROTHCORE
Eluna::Push(L, aura->GetOwner()); Eluna::Push(L, aura->GetOwner());
#else
Eluna::Push(L, aura->GetTarget());
#endif
return 1; return 1;
} }
@@ -138,16 +122,7 @@ namespace LuaAura
int SetDuration(lua_State* L, Aura* aura) int SetDuration(lua_State* L, Aura* aura)
{ {
int32 duration = Eluna::CHECKVAL<int32>(L, 2); int32 duration = Eluna::CHECKVAL<int32>(L, 2);
#if defined TRINITY || defined AZEROTHCORE
aura->SetDuration(duration); 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; return 0;
} }
@@ -162,16 +137,7 @@ namespace LuaAura
int SetMaxDuration(lua_State* L, Aura* aura) int SetMaxDuration(lua_State* L, Aura* aura)
{ {
int32 duration = Eluna::CHECKVAL<int32>(L, 2); int32 duration = Eluna::CHECKVAL<int32>(L, 2);
#if defined TRINITY || defined AZEROTHCORE
aura->SetMaxDuration(duration); 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; return 0;
} }
@@ -186,11 +152,7 @@ namespace LuaAura
int SetStackAmount(lua_State* L, Aura* aura) int SetStackAmount(lua_State* L, Aura* aura)
{ {
uint8 amount = Eluna::CHECKVAL<uint8>(L, 2); uint8 amount = Eluna::CHECKVAL<uint8>(L, 2);
#if defined TRINITY || defined AZEROTHCORE
aura->SetStackAmount(amount); aura->SetStackAmount(amount);
#else
aura->GetHolder()->SetStackAmount(amount);
#endif
return 0; return 0;
} }
@@ -199,11 +161,7 @@ namespace LuaAura
*/ */
int Remove(lua_State* L, Aura* aura) int Remove(lua_State* L, Aura* aura)
{ {
#if defined TRINITY || defined AZEROTHCORE
aura->Remove(); aura->Remove();
#else
aura->GetTarget()->RemoveSpellAuraHolder(aura->GetHolder(), AURA_REMOVE_BY_CANCEL);
#endif
Eluna::CHECKOBJ<ElunaObject>(L, 1)->Invalidate(); Eluna::CHECKOBJ<ElunaObject>(L, 1)->Invalidate();
return 0; return 0;
} }

View File

@@ -35,11 +35,7 @@ namespace LuaBattleGround
{ {
uint32 team = Eluna::CHECKVAL<uint32>(L, 2); uint32 team = Eluna::CHECKVAL<uint32>(L, 2);
#ifndef AZEROTHCORE
Eluna::Push(L, bg->GetAlivePlayersCountByTeam((Team)team));
#else
Eluna::Push(L, bg->GetAlivePlayersCountByTeam((TeamId)team)); Eluna::Push(L, bg->GetAlivePlayersCountByTeam((TeamId)team));
#endif
return 1; return 1;
} }
@@ -68,19 +64,6 @@ namespace LuaBattleGround
return 1; 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]. * Returns the end time of the [BattleGround].
* *
@@ -88,11 +71,7 @@ namespace LuaBattleGround
*/ */
int GetEndTime(lua_State* L, BattleGround* bg) int GetEndTime(lua_State* L, BattleGround* bg)
{ {
#ifdef CATA
Eluna::Push(L, bg->GetRemainingTime());
#else
Eluna::Push(L, bg->GetEndTime()); Eluna::Push(L, bg->GetEndTime());
#endif
return 1; return 1;
} }
@@ -106,11 +85,7 @@ namespace LuaBattleGround
{ {
uint32 team = Eluna::CHECKVAL<uint32>(L, 2); uint32 team = Eluna::CHECKVAL<uint32>(L, 2);
#ifndef AZEROTHCORE
Eluna::Push(L, bg->GetFreeSlotsForTeam((Team)team));
#else
Eluna::Push(L, bg->GetFreeSlotsForTeam((TeamId)team)); Eluna::Push(L, bg->GetFreeSlotsForTeam((TeamId)team));
#endif
return 1; return 1;
} }
@@ -143,11 +118,7 @@ namespace LuaBattleGround
*/ */
int GetTypeId(lua_State* L, BattleGround* bg) int GetTypeId(lua_State* L, BattleGround* bg)
{ {
#ifndef AZEROTHCORE
Eluna::Push(L, bg->GetTypeID());
#else
Eluna::Push(L, bg->GetBgTypeID()); Eluna::Push(L, bg->GetBgTypeID());
#endif
return 1; return 1;
} }
@@ -180,11 +151,7 @@ namespace LuaBattleGround
*/ */
int GetMaxPlayers(lua_State* L, BattleGround* bg) int GetMaxPlayers(lua_State* L, BattleGround* bg)
{ {
#ifndef AZEROTHCORE
Eluna::Push(L, bg->GetMaxPlayers());
#else
Eluna::Push(L, bg->GetMaxPlayersPerTeam() * 2); Eluna::Push(L, bg->GetMaxPlayersPerTeam() * 2);
#endif
return 1; return 1;
} }
@@ -195,11 +162,7 @@ namespace LuaBattleGround
*/ */
int GetMinPlayers(lua_State* L, BattleGround* bg) int GetMinPlayers(lua_State* L, BattleGround* bg)
{ {
#ifndef AZEROTHCORE
Eluna::Push(L, bg->GetMinPlayers());
#else
Eluna::Push(L, bg->GetMaxPlayersPerTeam() * 2); Eluna::Push(L, bg->GetMaxPlayersPerTeam() * 2);
#endif
return 1; return 1;
} }

View File

@@ -21,11 +21,7 @@ namespace LuaCorpse
*/ */
int GetOwnerGUID(lua_State* L, Corpse* corpse) int GetOwnerGUID(lua_State* L, Corpse* corpse)
{ {
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, corpse->GetOwnerGUID()); Eluna::Push(L, corpse->GetOwnerGUID());
#else
Eluna::Push(L, corpse->GetOwnerGuid());
#endif
return 1; return 1;
} }

View File

@@ -22,17 +22,10 @@ namespace LuaCreature
*/ */
int IsRegeneratingHealth(lua_State* L, Creature* creature) int IsRegeneratingHealth(lua_State* L, Creature* creature)
{ {
#if defined(AZEROTHCORE)
Eluna::Push(L, creature->isRegeneratingHealth()); Eluna::Push(L, creature->isRegeneratingHealth());
#elif defined(TRINITY)
Eluna::Push(L, creature->CanRegenerateHealth());
#else
Eluna::Push(L, creature->IsRegeneratingHealth());
#endif
return 1; return 1;
} }
#if defined(TRINITY) || defined(AZEROTHCORE)
/** /**
* Sets whether the [Creature] can regenerate health or not. * Sets whether the [Creature] can regenerate health or not.
* *
@@ -42,14 +35,9 @@ namespace LuaCreature
{ {
bool enable = Eluna::CHECKVAL<bool>(L, 2, true); bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
#if defined(AZEROTHCORE)
creature->SetRegeneratingHealth(enable); creature->SetRegeneratingHealth(enable);
#else
creature->SetRegenerateHealth(enable);
#endif
return 0; return 0;
} }
#endif
/** /**
* Returns `true` if the [Creature] is set to not give reputation when killed, * Returns `true` if the [Creature] is set to not give reputation when killed,
@@ -74,11 +62,7 @@ namespace LuaCreature
{ {
uint32 quest_id = Eluna::CHECKVAL<uint32>(L, 2); uint32 quest_id = Eluna::CHECKVAL<uint32>(L, 2);
#if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, creature->hasInvolvedQuest(quest_id)); Eluna::Push(L, creature->hasInvolvedQuest(quest_id));
#else
Eluna::Push(L, creature->HasInvolvedQuest(quest_id));
#endif
return 1; return 1;
} }
@@ -93,11 +77,7 @@ namespace LuaCreature
{ {
bool mustBeDead = Eluna::CHECKVAL<bool>(L, 2, false); bool mustBeDead = Eluna::CHECKVAL<bool>(L, 2, false);
#ifdef MANGOS
Eluna::Push(L, creature->IsTargetableForAttack(mustBeDead));
#else
Eluna::Push(L, creature->isTargetableForAttack(mustBeDead)); Eluna::Push(L, creature->isTargetableForAttack(mustBeDead));
#endif
return 1; return 1;
} }
@@ -142,11 +122,7 @@ namespace LuaCreature
{ {
Player* player = Eluna::CHECKOBJ<Player>(L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
#if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, creature->isTappedBy(player)); Eluna::Push(L, creature->isTappedBy(player));
#else
Eluna::Push(L, creature->IsTappedBy(player));
#endif
return 1; return 1;
} }
@@ -158,11 +134,7 @@ namespace LuaCreature
*/ */
int HasLootRecipient(lua_State* L, Creature* creature) int HasLootRecipient(lua_State* L, Creature* creature)
{ {
#if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, creature->hasLootRecipient()); Eluna::Push(L, creature->hasLootRecipient());
#else
Eluna::Push(L, creature->HasLootRecipient());
#endif
return 1; return 1;
} }
@@ -174,12 +146,7 @@ namespace LuaCreature
*/ */
int CanAggro(lua_State* L, Creature* creature) 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)); 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; return 1;
} }
@@ -227,11 +194,7 @@ namespace LuaCreature
*/ */
int IsElite(lua_State* L, Creature* creature) int IsElite(lua_State* L, Creature* creature)
{ {
#if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, creature->isElite()); Eluna::Push(L, creature->isElite());
#else
Eluna::Push(L, creature->IsElite());
#endif
return 1; return 1;
} }
@@ -277,13 +240,11 @@ namespace LuaCreature
* *
* @return bool isDungeonBoss * @return bool isDungeonBoss
*/ */
#if defined(TRINITY) || defined(AZEROTHCORE)
int IsDungeonBoss(lua_State* L, Creature* creature) int IsDungeonBoss(lua_State* L, Creature* creature)
{ {
Eluna::Push(L, creature->IsDungeonBoss()); Eluna::Push(L, creature->IsDungeonBoss());
return 1; return 1;
} }
#endif
/** /**
* Returns `true` if the [Creature]'s rank is Boss, * Returns `true` if the [Creature]'s rank is Boss,
@@ -293,11 +254,7 @@ namespace LuaCreature
*/ */
int IsWorldBoss(lua_State* L, Creature* creature) int IsWorldBoss(lua_State* L, Creature* creature)
{ {
#if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, creature->isWorldBoss()); Eluna::Push(L, creature->isWorldBoss());
#else
Eluna::Push(L, creature->IsWorldBoss());
#endif
return 1; return 1;
} }
@@ -312,19 +269,10 @@ namespace LuaCreature
{ {
uint32 spell = Eluna::CHECKVAL<uint32>(L, 2); uint32 spell = Eluna::CHECKVAL<uint32>(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)) if (const SpellInfo* info = sSpellMgr->GetSpellInfo(spell))
Eluna::Push(L, info->GetCategory() && creature->HasSpellCooldown(spell)); Eluna::Push(L, info->GetCategory() && creature->HasSpellCooldown(spell));
else else
Eluna::Push(L, false); Eluna::Push(L, false);
#else
Eluna::Push(L, creature->HasCategoryCooldown(spell));
#endif
return 1; return 1;
} }
@@ -354,11 +302,7 @@ namespace LuaCreature
{ {
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2); uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
#if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, creature->hasQuest(questId)); Eluna::Push(L, creature->hasQuest(questId));
#else
Eluna::Push(L, creature->HasQuest(questId));
#endif
return 1; return 1;
} }
@@ -373,11 +317,7 @@ namespace LuaCreature
{ {
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2); uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
#if defined(TRINITY)
Eluna::Push(L, creature->GetSpellHistory()->HasCooldown(spellId));
#else
Eluna::Push(L, creature->HasSpellCooldown(spellId)); Eluna::Push(L, creature->HasSpellCooldown(spellId));
#endif
return 1; return 1;
} }
@@ -393,7 +333,6 @@ namespace LuaCreature
return 1; return 1;
} }
#if defined(TRINITY) || defined(AZEROTHCORE)
/** /**
* Returns `true` if the [Creature] is an invisible trigger, * Returns `true` if the [Creature] is an invisible trigger,
* and returns `false` otherwise. * and returns `false` otherwise.
@@ -428,12 +367,8 @@ namespace LuaCreature
int CanStartAttack(lua_State* L, Creature* creature) // TODO: Implement core side int CanStartAttack(lua_State* L, Creature* creature) // TODO: Implement core side
{ {
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2); Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
#ifndef AZEROTHCORE
bool force = Eluna::CHECKVAL<bool>(L, 3, true);
Eluna::Push(L, creature->CanStartAttack(target, force));
#else
Eluna::Push(L, creature->CanStartAttack(target)); Eluna::Push(L, creature->CanStartAttack(target));
#endif
return 1; return 1;
} }
@@ -450,7 +385,6 @@ namespace LuaCreature
Eluna::Push(L, creature->HasLootMode(lootMode)); Eluna::Push(L, creature->HasLootMode(lootMode));
return 1; return 1;
} }
#endif
/** /**
* Returns the time it takes for this [Creature] to respawn once killed. * 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) int GetWanderRadius(lua_State* L, Creature* creature)
{ {
#if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, creature->GetWanderDistance()); Eluna::Push(L, creature->GetWanderDistance());
#else
Eluna::Push(L, creature->GetRespawnRadius());
#endif
return 1; return 1;
} }
#if defined(TRINITY) || defined(AZEROTHCORE)
/** /**
* Returns the current waypoint path ID of the [Creature]. * Returns the current waypoint path ID of the [Creature].
* *
@@ -493,7 +422,6 @@ namespace LuaCreature
Eluna::Push(L, creature->GetWaypointPath()); Eluna::Push(L, creature->GetWaypointPath());
return 1; return 1;
} }
#endif
/** /**
* Returns the current waypoint ID of the [Creature]. * Returns the current waypoint ID of the [Creature].
@@ -502,13 +430,7 @@ namespace LuaCreature
*/ */
int GetCurrentWaypointId(lua_State* L, Creature* creature) int GetCurrentWaypointId(lua_State* L, Creature* creature)
{ {
#if defined(TRINITY)
Eluna::Push(L, creature->GetCurrentWaypointInfo().first);
#elif defined(AZEROTHCORE)
Eluna::Push(L, creature->GetCurrentWaypointID()); Eluna::Push(L, creature->GetCurrentWaypointID());
#else
Eluna::Push(L, creature->GetMotionMaster()->getLastReachedWaypoint());
#endif
return 1; return 1;
} }
@@ -533,35 +455,10 @@ namespace LuaCreature
{ {
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2); Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
#if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, creature->GetAggroRange(target)); 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; 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<Unit>(L, 2);
Eluna::Push(L, creature->GetAttackDistance(target));
return 1;
}
#endif
/** /**
* Returns the [Group] that can loot this [Creature]. * Returns the [Group] that can loot this [Creature].
* *
@@ -569,11 +466,7 @@ namespace LuaCreature
*/ */
int GetLootRecipientGroup(lua_State* L, Creature* creature) int GetLootRecipientGroup(lua_State* L, Creature* creature)
{ {
#if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, creature->GetLootRecipientGroup()); Eluna::Push(L, creature->GetLootRecipientGroup());
#else
Eluna::Push(L, creature->GetGroupLootRecipient());
#endif
return 1; return 1;
} }
@@ -642,19 +535,11 @@ namespace LuaCreature
{ {
uint32 spell = Eluna::CHECKVAL<uint32>(L, 2); uint32 spell = Eluna::CHECKVAL<uint32>(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)) if (sSpellMgr->GetSpellInfo(spell))
Eluna::Push(L, creature->GetSpellCooldown(spell)); Eluna::Push(L, creature->GetSpellCooldown(spell));
else else
Eluna::Push(L, 0); Eluna::Push(L, 0);
#else
Eluna::Push(L, creature->GetCreatureSpellCooldownDelay(spell));
#endif
return 1; return 1;
} }
@@ -681,11 +566,7 @@ namespace LuaCreature
int GetHomePosition(lua_State* L, Creature* creature) int GetHomePosition(lua_State* L, Creature* creature)
{ {
float x, y, z, o; float x, y, z, o;
#if defined(TRINITY) || defined(AZEROTHCORE)
creature->GetHomePosition(x, y, z, o); creature->GetHomePosition(x, y, z, o);
#else
creature->GetRespawnCoord(x, y, z, &o);
#endif
Eluna::Push(L, x); Eluna::Push(L, x);
Eluna::Push(L, y); Eluna::Push(L, y);
@@ -710,12 +591,7 @@ namespace LuaCreature
float z = Eluna::CHECKVAL<float>(L, 4); float z = Eluna::CHECKVAL<float>(L, 4);
float o = Eluna::CHECKVAL<float>(L, 5); float o = Eluna::CHECKVAL<float>(L, 5);
#if defined(TRINITY) || defined(AZEROTHCORE)
creature->SetHomePosition(x, y, z, o); creature->SetHomePosition(x, y, z, o);
#else
creature->SetRespawnCoord(x, y, z, o);
#endif
return 0; return 0;
} }
@@ -762,33 +638,19 @@ namespace LuaCreature
float dist = Eluna::CHECKVAL<float>(L, 5, 0.0f); float dist = Eluna::CHECKVAL<float>(L, 5, 0.0f);
int32 aura = Eluna::CHECKVAL<int32>(L, 6, 0); int32 aura = Eluna::CHECKVAL<int32>(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(); auto const& threatlist = creature->GetThreatMgr().GetThreatList();
#endif
#ifndef TRINITY
if (threatlist.empty()) if (threatlist.empty())
return 1; return 1;
if (position >= threatlist.size()) if (position >= threatlist.size())
return 1; return 1;
#endif
std::list<Unit*> targetList; std::list<Unit*> targetList;
#if defined(TRINITY)
for (ThreatReference const* itr : threatlist)
#else
for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr) for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr)
#endif {
{
#if defined(TRINITY)
Unit* target = itr->GetVictim();
#else
Unit* target = (*itr)->getTarget(); Unit* target = (*itr)->getTarget();
#endif
if (!target) if (!target)
continue; continue;
if (playerOnly && target->GetTypeId() != TYPEID_PLAYER) if (playerOnly && target->GetTypeId() != TYPEID_PLAYER)
@@ -857,25 +719,18 @@ namespace LuaCreature
*/ */
int GetAITargets(lua_State* L, Creature* creature) int GetAITargets(lua_State* L, Creature* creature)
{ {
#if defined(TRINITY) auto const& threatlist = creature->GetThreatMgr().GetThreatList();
auto const& threatlist = creature->GetThreatManager().GetThreatenedByMeList();
#elif defined(AZEROTHCORE)
auto const& threatlist = creature->GetThreatMgr().GetThreatList();
#else
ThreatList const& threatlist = creature->GetThreatManager().getThreatList();
#endif
lua_createtable(L, threatlist.size(), 0); lua_createtable(L, threatlist.size(), 0);
int tbl = lua_gettop(L); int tbl = lua_gettop(L);
uint32 i = 0; uint32 i = 0;
for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr) for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{ {
#if defined(TRINITY)
Unit* target = itr->second->GetOwner();
#else
Unit* target = (*itr)->getTarget(); Unit* target = (*itr)->getTarget();
#endif
if (!target) if (!target)
continue; continue;
Eluna::Push(L, target); Eluna::Push(L, target);
lua_rawseti(L, tbl, ++i); lua_rawseti(L, tbl, ++i);
} }
@@ -891,13 +746,7 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
*/ */
int GetAITargetsCount(lua_State* L, Creature* creature) 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()); Eluna::Push(L, creature->GetThreatMgr().GetThreatListSize());
#else
Eluna::Push(L, creature->GetThreatManager().getThreatList().size());
#endif
return 1; return 1;
} }
@@ -949,11 +798,7 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
*/ */
int GetExtraFlags(lua_State* L, Creature* creature) int GetExtraFlags(lua_State* L, Creature* creature)
{ {
#if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, creature->GetCreatureTemplate()->flags_extra); Eluna::Push(L, creature->GetCreatureTemplate()->flags_extra);
#else
Eluna::Push(L, creature->GetCreatureInfo()->ExtraFlags);
#endif
return 1; return 1;
} }
@@ -968,7 +813,6 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
return 1; return 1;
} }
#if defined(CLASSIC) || defined(TBC) || defined(WOTLK)
/** /**
* Returns the [Creature]'s shield block value. * Returns the [Creature]'s shield block value.
* *
@@ -979,15 +823,12 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
Eluna::Push(L, creature->GetShieldBlockValue()); Eluna::Push(L, creature->GetShieldBlockValue());
return 1; return 1;
} }
#endif
#if defined(TRINITY) || defined(AZEROTHCORE)
int GetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features int GetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features
{ {
Eluna::Push(L, creature->GetLootMode()); Eluna::Push(L, creature->GetLootMode());
return 1; return 1;
} }
#endif
/** /**
* Returns the guid of the [Creature] that is used as the ID in the database * 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) int GetDBTableGUIDLow(lua_State* L, Creature* creature)
{ {
#if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, creature->GetSpawnId()); Eluna::Push(L, creature->GetSpawnId());
#else
// on mangos based this is same as lowguid
Eluna::Push(L, creature->GetGUIDLow());
#endif
return 1; return 1;
} }
@@ -1042,7 +878,6 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
return 0; return 0;
} }
#if defined(TRINITY) || defined(AZEROTHCORE)
/** /**
* Sets the [Creature]'s ReactState to `state`. * Sets the [Creature]'s ReactState to `state`.
* *
@@ -1055,7 +890,6 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
creature->SetReactState((ReactStates)state); creature->SetReactState((ReactStates)state);
return 0; return 0;
} }
#endif
/** /**
* Makes the [Creature] able to fly if enabled. * Makes the [Creature] able to fly if enabled.
@@ -1066,15 +900,10 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
{ {
bool disable = Eluna::CHECKVAL<bool>(L, 2); bool disable = Eluna::CHECKVAL<bool>(L, 2);
#if defined(TRINITY) || defined(AZEROTHCORE)
creature->SetDisableGravity(disable); creature->SetDisableGravity(disable);
#else
creature->SetLevitate(disable);
#endif
return 0; return 0;
} }
#if defined(TRINITY) || defined(AZEROTHCORE)
int SetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features int SetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features
{ {
uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2); uint16 lootMode = Eluna::CHECKVAL<uint16>(L, 2);
@@ -1082,7 +911,6 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
creature->SetLootMode(lootMode); creature->SetLootMode(lootMode);
return 0; return 0;
} }
#endif
/** /**
* Sets the [Creature]'s death state to `deathState`. * Sets the [Creature]'s death state to `deathState`.
@@ -1093,11 +921,7 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
{ {
int32 state = Eluna::CHECKVAL<int32>(L, 2); int32 state = Eluna::CHECKVAL<int32>(L, 2);
#if defined(TRINITY) || defined(AZEROTHCORE)
creature->setDeathState((DeathState)state); creature->setDeathState((DeathState)state);
#else
creature->SetDeathState((DeathState)state);
#endif
return 0; return 0;
} }
@@ -1127,15 +951,10 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
uint32 off_hand = Eluna::CHECKVAL<uint32>(L, 3); uint32 off_hand = Eluna::CHECKVAL<uint32>(L, 3);
uint32 ranged = Eluna::CHECKVAL<uint32>(L, 4); uint32 ranged = Eluna::CHECKVAL<uint32>(L, 4);
#if defined(TRINITY) || defined(AZEROTHCORE)
creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, main_hand); 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 + 1, off_hand);
creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, ranged); 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; return 0;
} }
@@ -1148,17 +967,10 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
{ {
bool allow = Eluna::CHECKVAL<bool>(L, 2, true); bool allow = Eluna::CHECKVAL<bool>(L, 2, true);
#if defined(TRINITY) || defined(AZEROTHCORE)
if (allow) if (allow)
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
else else
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); 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; return 0;
} }
@@ -1184,15 +996,9 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
*/ */
int SetInCombatWithZone(lua_State* /*L*/, Creature* creature) int SetInCombatWithZone(lua_State* /*L*/, Creature* creature)
{ {
#if defined(AZEROTHCORE)
if (creature->IsAIEnabled) if (creature->IsAIEnabled)
creature->AI()->DoZoneInCombat(); creature->AI()->DoZoneInCombat();
#elif defined(TRINITY)
if (creature->IsAIEnabled())
creature->AI()->DoZoneInCombat();
#else
creature->SetInCombatWithZone();
#endif
return 0; return 0;
} }
@@ -1205,11 +1011,8 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
{ {
float dist = Eluna::CHECKVAL<float>(L, 2); float dist = Eluna::CHECKVAL<float>(L, 2);
#if defined(TRINITY) || defined(AZEROTHCORE)
creature->SetWanderDistance(dist); creature->SetWanderDistance(dist);
#else
creature->SetRespawnRadius(dist);
#endif
return 0; return 0;
} }
@@ -1274,24 +1077,8 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
{ {
bool enable = Eluna::CHECKVAL<bool>(L, 2, true); bool enable = Eluna::CHECKVAL<bool>(L, 2, true);
#if defined(TRINITY) || defined(AZEROTHCORE)
creature->SetHover(enable); 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; return 0;
} }
@@ -1303,14 +1090,8 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
int DespawnOrUnsummon(lua_State* L, Creature* creature) int DespawnOrUnsummon(lua_State* L, Creature* creature)
{ {
uint32 msTimeToDespawn = Eluna::CHECKVAL<uint32>(L, 2, 0); uint32 msTimeToDespawn = Eluna::CHECKVAL<uint32>(L, 2, 0);
#if defined(TRINITY)
creature->DespawnOrUnsummon(Milliseconds(msTimeToDespawn));
#elif defined(AZEROTHCORE)
creature->DespawnOrUnsummon(msTimeToDespawn); creature->DespawnOrUnsummon(msTimeToDespawn);
#else
creature->ForcedDespawn(msTimeToDespawn);
#endif
return 0; return 0;
} }
@@ -1337,11 +1118,8 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
*/ */
int MoveWaypoint(lua_State* /*L*/, Creature* creature) int MoveWaypoint(lua_State* /*L*/, Creature* creature)
{ {
#if defined(TRINITY) || defined(AZEROTHCORE)
creature->GetMotionMaster()->MovePath(creature->GetWaypointPath(), true); creature->GetMotionMaster()->MovePath(creature->GetWaypointPath(), true);
#else
creature->GetMotionMaster()->MoveWaypoint();
#endif
return 0; return 0;
} }
@@ -1405,11 +1183,7 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
*/ */
int SelectVictim(lua_State* L, Creature* creature) int SelectVictim(lua_State* L, Creature* creature)
{ {
#if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, creature->SelectVictim()); Eluna::Push(L, creature->SelectVictim());
#else
Eluna::Push(L, creature->SelectHostileTarget());
#endif
return 1; return 1;
} }
@@ -1424,15 +1198,10 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2); uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
uint32 dataGuidLow = Eluna::CHECKVAL<uint32>(L, 3, 0); uint32 dataGuidLow = Eluna::CHECKVAL<uint32>(L, 3, 0);
#if defined(TRINITY) || defined(AZEROTHCORE)
creature->UpdateEntry(entry, dataGuidLow ? eObjectMgr->GetCreatureData(dataGuidLow) : NULL); creature->UpdateEntry(entry, dataGuidLow ? eObjectMgr->GetCreatureData(dataGuidLow) : NULL);
#else
creature->UpdateEntry(entry, ALLIANCE, dataGuidLow ? eObjectMgr->GetCreatureData(dataGuidLow) : NULL);
#endif
return 0; return 0;
} }
#if defined(TRINITY) || defined(AZEROTHCORE)
/** /**
* Resets [Creature]'s loot mode to default * Resets [Creature]'s loot mode to default
*/ */
@@ -1467,7 +1236,6 @@ auto const& threatlist = creature->GetThreatMgr().GetThreatList();
creature->AddLootMode(lootMode); creature->AddLootMode(lootMode);
return 0; return 0;
} }
#endif
/** /**
* Returns the [Creature]'s creature family ID (enumerated in CreatureFamily.dbc). * 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(); uint32 entry = creature->GetEntry();
#if defined(TRINITY) || defined(AZEROTHCORE)
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(entry); CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(entry);
if (cInfo) if (cInfo)
Eluna::Push(L, cInfo->family); Eluna::Push(L, cInfo->family);
#else
CreatureInfo const* cInfo = ObjectMgr::GetCreatureTemplate(entry);
if (cInfo)
Eluna::Push(L, cInfo->Family);
#endif
return 1; return 1;
} }
}; };

View File

@@ -7,11 +7,7 @@
#ifndef QUERYMETHODS_H #ifndef QUERYMETHODS_H
#define QUERYMETHODS_H #define QUERYMETHODS_H
#if defined TRINITY || defined AZEROTHCORE
#define RESULT (*result) #define RESULT (*result)
#else
#define RESULT result
#endif
/*** /***
* The result of a database query. * The result of a database query.
@@ -45,11 +41,7 @@ namespace LuaQuery
uint32 col = Eluna::CHECKVAL<uint32>(L, 2); uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result); CheckFields(L, result);
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, RESULT->Fetch()[col].IsNull()); Eluna::Push(L, RESULT->Fetch()[col].IsNull());
#else
Eluna::Push(L, RESULT->Fetch()[col].IsNULL());
#endif
return 1; return 1;
} }
@@ -286,13 +278,8 @@ namespace LuaQuery
lua_createtable(L, 0, col); lua_createtable(L, 0, col);
int tbl = lua_gettop(L); int tbl = lua_gettop(L);
#if !defined TRINITY && !AZEROTHCORE
const QueryFieldNames& names = RESULT->GetFieldNames();
#endif
for (uint32 i = 0; i < col; ++i) for (uint32 i = 0; i < col; ++i)
{ {
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, RESULT->GetFieldName(i)); Eluna::Push(L, RESULT->GetFieldName(i));
std::string _str = row[i].Get<std::string>(); std::string _str = row[i].Get<std::string>();
@@ -304,50 +291,12 @@ namespace LuaQuery
// MYSQL_TYPE_LONGLONG Interpreted as string for lua // MYSQL_TYPE_LONGLONG Interpreted as string for lua
switch (row[i].GetType()) switch (row[i].GetType())
{ {
#if defined TRINITY || AZEROTHCORE
case DatabaseFieldTypes::Int8: case DatabaseFieldTypes::Int8:
case DatabaseFieldTypes::Int16: case DatabaseFieldTypes::Int16:
case DatabaseFieldTypes::Int32: case DatabaseFieldTypes::Int32:
case DatabaseFieldTypes::Int64: case DatabaseFieldTypes::Int64:
case DatabaseFieldTypes::Float: case DatabaseFieldTypes::Float:
case DatabaseFieldTypes::Double: 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)); Eluna::Push(L, strtod(str, NULL));
break; break;
default: default:
@@ -355,8 +304,6 @@ namespace LuaQuery
break; break;
} }
} }
#endif
lua_rawset(L, tbl); lua_rawset(L, tbl);
} }

View File

@@ -22,11 +22,7 @@ namespace LuaGameObject
{ {
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2); uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, go->hasQuest(questId)); Eluna::Push(L, go->hasQuest(questId));
#else
Eluna::Push(L, go->HasQuest(questId));
#endif
return 1; return 1;
} }
@@ -145,11 +141,7 @@ namespace LuaGameObject
*/ */
int GetLootRecipientGroup(lua_State* L, GameObject* go) int GetLootRecipientGroup(lua_State* L, GameObject* go)
{ {
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, go->GetLootRecipientGroup()); Eluna::Push(L, go->GetLootRecipientGroup());
#else
Eluna::Push(L, go->GetGroupLootRecipient());
#endif
return 1; return 1;
} }
@@ -160,12 +152,7 @@ namespace LuaGameObject
*/ */
int GetDBTableGUIDLow(lua_State* L, GameObject* go) int GetDBTableGUIDLow(lua_State* L, GameObject* go)
{ {
#if defined(TRINITY) || defined(AZEROTHCORE)
Eluna::Push(L, go->GetSpawnId()); Eluna::Push(L, go->GetSpawnId());
#else
// on mangos based this is same as lowguid
Eluna::Push(L, go->GetGUIDLow());
#endif
return 1; return 1;
} }
@@ -192,13 +179,7 @@ namespace LuaGameObject
else if (state == 1) else if (state == 1)
go->SetGoState(GO_STATE_READY); go->SetGoState(GO_STATE_READY);
else if (state == 2) else if (state == 2)
{
#ifdef TRINITY
go->SetGoState(GO_STATE_DESTROYED);
#else
go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
#endif
}
return 0; return 0;
} }
@@ -249,20 +230,15 @@ namespace LuaGameObject
int i = 1; int i = 1;
int argAmount = lua_gettop(L); int argAmount = lua_gettop(L);
#if defined TRINITY || defined AZEROTHCORE
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction(); CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
#endif
uint8 addedItems = 0; uint8 addedItems = 0;
while (i + 2 <= argAmount) while (i + 2 <= argAmount)
{ {
uint32 entry = Eluna::CHECKVAL<uint32>(L, ++i); uint32 entry = Eluna::CHECKVAL<uint32>(L, ++i);
uint32 amount = Eluna::CHECKVAL<uint32>(L, ++i); uint32 amount = Eluna::CHECKVAL<uint32>(L, ++i);
#if defined TRINITY || AZEROTHCORE
ItemTemplate const* item_proto = eObjectMgr->GetItemTemplate(entry); ItemTemplate const* item_proto = eObjectMgr->GetItemTemplate(entry);
#else
ItemTemplate const* item_proto = ObjectMgr::GetItemPrototype(entry);
#endif
if (!item_proto) if (!item_proto)
{ {
luaL_error(L, "Item entry %d does not exist", entry); luaL_error(L, "Item entry %d does not exist", entry);
@@ -275,25 +251,15 @@ namespace LuaGameObject
} }
if (Item* item = Item::CreateItem(entry, amount)) if (Item* item = Item::CreateItem(entry, amount))
{ {
#if defined TRINITY || AZEROTHCORE
item->SaveToDB(trans); item->SaveToDB(trans);
#else
item->SaveToDB();
#endif
LootStoreItem storeItem(item->GetEntry(), 0, 100, 0, LOOT_MODE_DEFAULT, 0, item->GetCount(), item->GetCount()); LootStoreItem storeItem(item->GetEntry(), 0, 100, 0, LOOT_MODE_DEFAULT, 0, item->GetCount(), item->GetCount());
go->loot.AddItem(storeItem); go->loot.AddItem(storeItem);
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, item->GetGUID().GetCounter()); Eluna::Push(L, item->GetGUID().GetCounter());
#else
Eluna::Push(L, item->GetGUIDLow());
#endif
++addedItems; ++addedItems;
} }
} }
#if defined TRINITY || AZEROTHCORE
CharacterDatabase.CommitTransaction(trans); CharacterDatabase.CommitTransaction(trans);
#endif
return addedItems; return addedItems;
} }
@@ -320,11 +286,7 @@ namespace LuaGameObject
bool deldb = Eluna::CHECKVAL<bool>(L, 2, false); bool deldb = Eluna::CHECKVAL<bool>(L, 2, false);
// cs_gobject.cpp copy paste // cs_gobject.cpp copy paste
#if defined TRINITY || AZEROTHCORE
ObjectGuid ownerGuid = go->GetOwnerGUID(); ObjectGuid ownerGuid = go->GetOwnerGUID();
#else
ObjectGuid ownerGuid = go->GetOwnerGuid();
#endif
if (ownerGuid) if (ownerGuid)
{ {
Unit* owner = eObjectAccessor()GetUnit(*go, ownerGuid); Unit* owner = eObjectAccessor()GetUnit(*go, ownerGuid);
@@ -335,13 +297,7 @@ namespace LuaGameObject
} }
if (deldb) if (deldb)
{
#ifdef TRINITY
GameObject::DeleteFromDB(go->GetSpawnId());
#else
go->DeleteFromDB(); go->DeleteFromDB();
#endif
}
go->SetRespawnTime(0); go->SetRespawnTime(0);
go->Delete(); go->Delete();

View File

@@ -9,8 +9,6 @@
#include "BindingMap.h" #include "BindingMap.h"
#ifdef AZEROTHCORE
#include "BanMgr.h" #include "BanMgr.h"
#include "GameTime.h" #include "GameTime.h"
#include "SharedDefines.h" #include "SharedDefines.h"
@@ -24,8 +22,6 @@ enum BanMode
BAN_IP = 3 BAN_IP = 3
}; };
#endif
/*** /***
* These functions can be used anywhere at any time, including at start-up. * These functions can be used anywhere at any time, including at start-up.
*/ */
@@ -67,13 +63,7 @@ namespace LuaGlobalFunctions
int GetRealmID(lua_State* L) int GetRealmID(lua_State* L)
{ {
#ifdef MANGOS
Eluna::Push(L, realmID);
#elif defined(AZEROTHCORE)
Eluna::Push(L, sConfigMgr->GetOption<uint32>("RealmID", 1)); Eluna::Push(L, sConfigMgr->GetOption<uint32>("RealmID", 1));
#else
Eluna::Push(L, sConfigMgr->GetIntDefault("RealmID", 1));
#endif
return 1; return 1;
} }
@@ -101,15 +91,7 @@ namespace LuaGlobalFunctions
*/ */
int GetCoreExpansion(lua_State* L) 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); Eluna::Push(L, 2);
#elif defined(CATA)
Eluna::Push(L, 3);
#endif
return 1; return 1;
} }
@@ -196,13 +178,7 @@ namespace LuaGlobalFunctions
*/ */
int GetGameTime(lua_State* L) int GetGameTime(lua_State* L)
{ {
#ifdef TRINITY
Eluna::Push(L, GameTime::GetGameTime());
#elif AZEROTHCORE
Eluna::Push(L, GameTime::GetGameTime().count()); Eluna::Push(L, GameTime::GetGameTime().count());
#else
Eluna::Push(L, eWorld->GetGameTime());
#endif
return 1; return 1;
} }
@@ -231,24 +207,8 @@ namespace LuaGlobalFunctions
int tbl = lua_gettop(L); int tbl = lua_gettop(L);
uint32 i = 0; 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<std::shared_mutex> lock(*HashMapHolder<Player>::GetLock()); std::shared_lock<std::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
#else
HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock());
#endif
const HashMapHolder<Player>::MapType& m = eObjectAccessor()GetPlayers(); const HashMapHolder<Player>::MapType& m = eObjectAccessor()GetPlayers();
for (HashMapHolder<Player>::MapType::const_iterator it = m.begin(); it != m.end(); ++it) for (HashMapHolder<Player>::MapType::const_iterator it = m.begin(); it != m.end(); ++it)
{ {
@@ -256,11 +216,8 @@ namespace LuaGlobalFunctions
{ {
if (!player->IsInWorld()) if (!player->IsInWorld())
continue; continue;
#if defined TRINITY || AZEROTHCORE
if ((team == TEAM_NEUTRAL || player->GetTeamId() == team) && (!onlyGM || player->IsGameMaster())) 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); Eluna::Push(L, player);
lua_rawseti(L, tbl, ++i); lua_rawseti(L, tbl, ++i);
@@ -268,7 +225,7 @@ namespace LuaGlobalFunctions
} }
} }
} }
#endif
lua_settop(L, tbl); // push table to top of stack lua_settop(L, tbl); // push table to top of stack
return 1; return 1;
} }
@@ -470,9 +427,7 @@ namespace LuaGlobalFunctions
std::ostringstream oss; std::ostringstream oss;
oss << "|c" << std::hex << ItemQualityColors[temp->Quality] << std::dec << oss << "|c" << std::hex << ItemQualityColors[temp->Quality] << std::dec <<
"|Hitem:" << entry << ":0:" << "|Hitem:" << entry << ":0:" <<
#ifndef CLASSIC
"0:0:0:0:" << "0:0:0:0:" <<
#endif
"0:0:0:0|h[" << name << "]|h|r"; "0:0:0:0|h[" << name << "]|h|r";
Eluna::Push(L, oss.str()); Eluna::Push(L, oss.str());
@@ -538,19 +493,12 @@ namespace LuaGlobalFunctions
if (locale >= TOTAL_LOCALES) if (locale >= TOTAL_LOCALES)
return luaL_argerror(L, 2, "valid LocaleConstant expected"); return luaL_argerror(L, 2, "valid LocaleConstant expected");
#if defined TRINITY || AZEROTHCORE
AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaOrZoneId); AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaOrZoneId);
#else
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaOrZoneId);
#endif
if (!areaEntry) if (!areaEntry)
return luaL_argerror(L, 1, "valid Area or Zone ID expected"); 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]); Eluna::Push(L, areaEntry->area_name[locale]);
#endif
return 1; return 1;
} }
@@ -1284,16 +1232,14 @@ namespace LuaGlobalFunctions
int RunCommand(lua_State* L) int RunCommand(lua_State* L)
{ {
const char* command = Eluna::CHECKVAL<const char*>(L, 1); const char* command = Eluna::CHECKVAL<const char*>(L, 1);
#if defined TRINITY || AZEROTHCORE
eWorld->QueueCliCommand(new CliCommandHolder(nullptr, command, [](void*, std::string_view view) eWorld->QueueCliCommand(new CliCommandHolder(nullptr, command, [](void*, std::string_view view)
{ {
std::string str = { view.begin(), view.end() }; 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 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); ELUNA_LOG_INFO("{}", str);
}, nullptr)); }, nullptr));
#elif defined MANGOS
eWorld->QueueCliCommand(new CliCommandHolder(0, SEC_CONSOLE, nullptr, command, nullptr, nullptr));
#endif
return 0; return 0;
} }
@@ -1365,19 +1311,11 @@ namespace LuaGlobalFunctions
{ {
const char* query = Eluna::CHECKVAL<const char*>(L, 1); const char* query = Eluna::CHECKVAL<const char*>(L, 1);
#if defined TRINITY || AZEROTHCORE
ElunaQuery result = WorldDatabase.Query(query); ElunaQuery result = WorldDatabase.Query(query);
if (result) if (result)
Eluna::Push(L, new ElunaQuery(result)); Eluna::Push(L, new ElunaQuery(result));
else else
Eluna::Push(L); Eluna::Push(L);
#else
ElunaQuery* result = WorldDatabase.QueryNamed(query);
if (result)
Eluna::Push(L, result);
else
Eluna::Push(L);
#endif
return 1; return 1;
} }
@@ -1441,19 +1379,11 @@ namespace LuaGlobalFunctions
{ {
const char* query = Eluna::CHECKVAL<const char*>(L, 1); const char* query = Eluna::CHECKVAL<const char*>(L, 1);
#if defined TRINITY || AZEROTHCORE
QueryResult result = CharacterDatabase.Query(query); QueryResult result = CharacterDatabase.Query(query);
if (result) if (result)
Eluna::Push(L, new QueryResult(result)); Eluna::Push(L, new QueryResult(result));
else else
Eluna::Push(L); Eluna::Push(L);
#else
QueryNamedResult* result = CharacterDatabase.QueryNamed(query);
if (result)
Eluna::Push(L, result);
else
Eluna::Push(L);
#endif
return 1; return 1;
} }
@@ -1510,19 +1440,11 @@ namespace LuaGlobalFunctions
{ {
const char* query = Eluna::CHECKVAL<const char*>(L, 1); const char* query = Eluna::CHECKVAL<const char*>(L, 1);
#if defined TRINITY || AZEROTHCORE
QueryResult result = LoginDatabase.Query(query); QueryResult result = LoginDatabase.Query(query);
if (result) if (result)
Eluna::Push(L, new QueryResult(result)); Eluna::Push(L, new QueryResult(result));
else else
Eluna::Push(L); Eluna::Push(L);
#else
QueryNamedResult* result = LoginDatabase.QueryNamed(query);
if (result)
Eluna::Push(L, result);
else
Eluna::Push(L);
#endif
return 1; return 1;
} }
@@ -1670,209 +1592,21 @@ namespace LuaGlobalFunctions
uint32 entry = Eluna::CHECKVAL<uint32>(L, 2); uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
uint32 mapID = Eluna::CHECKVAL<uint32>(L, 3); uint32 mapID = Eluna::CHECKVAL<uint32>(L, 3);
uint32 instanceID = Eluna::CHECKVAL<uint32>(L, 4); uint32 instanceID = Eluna::CHECKVAL<uint32>(L, 4);
float x = Eluna::CHECKVAL<float>(L, 5); float x = Eluna::CHECKVAL<float>(L, 5);
float y = Eluna::CHECKVAL<float>(L, 6); float y = Eluna::CHECKVAL<float>(L, 6);
float z = Eluna::CHECKVAL<float>(L, 7); float z = Eluna::CHECKVAL<float>(L, 7);
float o = Eluna::CHECKVAL<float>(L, 8); float o = Eluna::CHECKVAL<float>(L, 8);
bool save = Eluna::CHECKVAL<bool>(L, 9, false); bool save = Eluna::CHECKVAL<bool>(L, 9, false);
uint32 durorresptime = Eluna::CHECKVAL<uint32>(L, 10, 0); uint32 durorresptime = Eluna::CHECKVAL<uint32>(L, 10, 0);
#if (!defined(TBC) && !defined(CLASSIC))
uint32 phase = Eluna::CHECKVAL<uint32>(L, 11, PHASEMASK_NORMAL); uint32 phase = Eluna::CHECKVAL<uint32>(L, 11, PHASEMASK_NORMAL);
if (!phase) if (!phase)
{ {
Eluna::Push(L); Eluna::Push(L);
return 1; 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); Map* map = eMapMgr->FindMap(mapID, instanceID);
if (!map) if (!map)
{ {
@@ -1887,11 +1621,7 @@ namespace LuaGlobalFunctions
if (save) if (save)
{ {
Creature* creature = new Creature(); Creature* creature = new Creature();
#ifndef AZEROTHCORE
if (!creature->Create(map->GenerateLowGuid<HighGuid::Unit>(), map, phase, entry, pos))
#else
if (!creature->Create(map->GenerateLowGuid<HighGuid::Unit>(), map, phase, entry, 0, x, y, z, o)) if (!creature->Create(map->GenerateLowGuid<HighGuid::Unit>(), map, phase, entry, 0, x, y, z, o))
#endif
{ {
delete creature; delete creature;
Eluna::Push(L); Eluna::Push(L);
@@ -1907,11 +1637,8 @@ namespace LuaGlobalFunctions
creature->CleanupsBeforeDelete(); creature->CleanupsBeforeDelete();
delete creature; delete creature;
creature = new Creature(); creature = new Creature();
#ifndef AZEROTHCORE
if (!creature->LoadFromDB(db_guid, map, true, true))
#else
if (!creature->LoadFromDB(db_guid, map, true)) if (!creature->LoadFromDB(db_guid, map, true))
#endif
{ {
delete creature; delete creature;
Eluna::Push(L); Eluna::Push(L);
@@ -1957,14 +1684,9 @@ namespace LuaGlobalFunctions
} }
GameObject* object = new GameObject; GameObject* object = new GameObject;
#ifndef AZEROTHCORE
uint32 guidLow = map->GenerateLowGuid<HighGuid::GameObject>();
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<HighGuid::GameObject>(); uint32 guidLow = map->GenerateLowGuid<HighGuid::GameObject>();
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)) 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; delete object;
Eluna::Push(L); Eluna::Push(L);
@@ -1986,11 +1708,7 @@ namespace LuaGlobalFunctions
object = new GameObject(); object = new GameObject();
// this will generate a new lowguid if the object is in an instance // 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)) if (!object->LoadFromDB(guidLow, map))
#endif
{ {
delete object; delete object;
Eluna::Push(L); Eluna::Push(L);
@@ -2004,7 +1722,6 @@ namespace LuaGlobalFunctions
Eluna::Push(L, object); Eluna::Push(L, object);
return 1; return 1;
} }
#endif
Eluna::Push(L); Eluna::Push(L);
return 1; return 1;
} }
@@ -2044,25 +1761,10 @@ namespace LuaGlobalFunctions
uint32 incrtime = Eluna::CHECKVAL<uint32>(L, 4); uint32 incrtime = Eluna::CHECKVAL<uint32>(L, 4);
uint32 extendedcost = Eluna::CHECKVAL<uint32>(L, 5); uint32 extendedcost = Eluna::CHECKVAL<uint32>(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)) if (!eObjectMgr->IsVendorItemValid(entry, item, maxcount, incrtime, extendedcost))
return 0; return 0;
eObjectMgr->AddVendorItem(entry, item, maxcount, incrtime, extendedcost); 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; return 0;
} }
@@ -2079,11 +1781,7 @@ namespace LuaGlobalFunctions
if (!eObjectMgr->GetCreatureTemplate(entry)) if (!eObjectMgr->GetCreatureTemplate(entry))
return luaL_argerror(L, 1, "valid CreatureEntry expected"); return luaL_argerror(L, 1, "valid CreatureEntry expected");
#if defined(CATA) || defined(MISTS)
eObjectMgr->RemoveVendorItem(entry, item, 1);
#else
eObjectMgr->RemoveVendorItem(entry, item); eObjectMgr->RemoveVendorItem(entry, item);
#endif
return 0; return 0;
} }
@@ -2102,15 +1800,7 @@ namespace LuaGlobalFunctions
auto const& itemlist = items->m_items; auto const& itemlist = items->m_items;
for (auto itr = itemlist.rbegin(); itr != itemlist.rend(); ++itr) 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); eObjectMgr->RemoveVendorItem(entry, (*itr)->item);
#endif
#endif
return 0; return 0;
} }
@@ -2122,11 +1812,7 @@ namespace LuaGlobalFunctions
int Kick(lua_State* L) int Kick(lua_State* L)
{ {
Player* player = Eluna::CHECKOBJ<Player>(L, 1); Player* player = Eluna::CHECKOBJ<Player>(L, 1);
#ifdef TRINITY
player->GetSession()->KickPlayer("GlobalMethods::Kick Kick the player");
#else
player->GetSession()->KickPlayer(); player->GetSession()->KickPlayer();
#endif
return 0; return 0;
} }
@@ -2162,13 +1848,8 @@ namespace LuaGlobalFunctions
switch (banMode) switch (banMode)
{ {
case BAN_ACCOUNT: case BAN_ACCOUNT:
#if defined TRINITY || AZEROTHCORE
if (!Utf8ToUpperOnlyLatin(nameOrIP)) if (!Utf8ToUpperOnlyLatin(nameOrIP))
return luaL_argerror(L, 2, "invalid account name"); return luaL_argerror(L, 2, "invalid account name");
#else
if (!AccountMgr::normalizeString(nameOrIP))
return luaL_argerror(L, 2, "invalid account name");
#endif
break; break;
case BAN_CHARACTER: case BAN_CHARACTER:
if (!normalizePlayerName(nameOrIP)) if (!normalizePlayerName(nameOrIP))
@@ -2207,15 +1888,9 @@ namespace LuaGlobalFunctions
case BanReturn::BAN_NOTFOUND: case BanReturn::BAN_NOTFOUND:
Eluna::Push(L, 2); Eluna::Push(L, 2);
break; break;
#ifdef AZEROTHCORE
case BanReturn::BAN_LONGER_EXISTS: case BanReturn::BAN_LONGER_EXISTS:
Eluna::Push(L, 3); Eluna::Push(L, 3);
break; break;
#elif TRINITY
case BanReturn::BAN_EXISTS:
Eluna::Push(L, 3);
break;
#endif
} }
return 1; return 1;
} }
@@ -2274,32 +1949,19 @@ namespace LuaGlobalFunctions
MailSender sender(MAIL_NORMAL, senderGUIDLow, (MailStationery)stationary); MailSender sender(MAIL_NORMAL, senderGUIDLow, (MailStationery)stationary);
MailDraft draft(subject, text); MailDraft draft(subject, text);
#if defined TRINITY || AZEROTHCORE
if (cod) if (cod)
draft.AddCOD(cod); draft.AddCOD(cod);
if (money) if (money)
draft.AddMoney(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(); CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
#endif
uint8 addedItems = 0; uint8 addedItems = 0;
while (addedItems <= MAX_MAIL_ITEMS && i + 2 <= argAmount) while (addedItems <= MAX_MAIL_ITEMS && i + 2 <= argAmount)
{ {
uint32 entry = Eluna::CHECKVAL<uint32>(L, ++i); uint32 entry = Eluna::CHECKVAL<uint32>(L, ++i);
uint32 amount = Eluna::CHECKVAL<uint32>(L, ++i); uint32 amount = Eluna::CHECKVAL<uint32>(L, ++i);
#if defined TRINITY || AZEROTHCORE
ItemTemplate const* item_proto = eObjectMgr->GetItemTemplate(entry); ItemTemplate const* item_proto = eObjectMgr->GetItemTemplate(entry);
#else
ItemTemplate const* item_proto = ObjectMgr::GetItemPrototype(entry);
#endif
if (!item_proto) if (!item_proto)
{ {
luaL_error(L, "Item entry %d does not exist", entry); luaL_error(L, "Item entry %d does not exist", entry);
@@ -2312,28 +1974,16 @@ namespace LuaGlobalFunctions
} }
if (Item* item = Item::CreateItem(entry, amount)) if (Item* item = Item::CreateItem(entry, amount))
{ {
#if defined TRINITY || AZEROTHCORE
item->SaveToDB(trans); item->SaveToDB(trans);
#else
item->SaveToDB();
#endif
draft.AddItem(item); draft.AddItem(item);
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, item->GetGUID().GetCounter()); Eluna::Push(L, item->GetGUID().GetCounter());
#else
Eluna::Push(L, item->GetGUIDLow());
#endif
++addedItems; ++addedItems;
} }
} }
Player* receiverPlayer = eObjectAccessor()FindPlayer(MAKE_NEW_GUID(receiverGUIDLow, 0, HIGHGUID_PLAYER)); 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); draft.SendMailTo(trans, MailReceiver(receiverPlayer, receiverGUIDLow), sender, MAIL_CHECK_MASK_NONE, delay);
CharacterDatabase.CommitTransaction(trans); CharacterDatabase.CommitTransaction(trans);
#else
draft.SendMailTo(MailReceiver(receiverPlayer, MAKE_NEW_GUID(receiverGUIDLow, 0, HIGHGUID_PLAYER)), sender);
#endif
return addedItems; return addedItems;
} }
@@ -2489,16 +2139,6 @@ namespace LuaGlobalFunctions
// Stack: {nodes}, mountA, mountH, price, pathid, {nodes}, node, key, value // Stack: {nodes}, mountA, mountH, price, pathid, {nodes}, node, key, value
} }
TaxiPathNodeEntry entry; TaxiPathNodeEntry entry;
#ifdef TRINITY
// mandatory
entry.ContinentID = Eluna::CHECKVAL<uint32>(L, start);
entry.Loc.X = Eluna::CHECKVAL<float>(L, start + 1);
entry.Loc.Y = Eluna::CHECKVAL<float>(L, start + 2);
entry.Loc.Z = Eluna::CHECKVAL<float>(L, start + 3);
// optional
entry.Flags = Eluna::CHECKVAL<uint32>(L, start + 4, 0);
entry.Delay = Eluna::CHECKVAL<uint32>(L, start + 5, 0);
#else
// mandatory // mandatory
entry.mapid = Eluna::CHECKVAL<uint32>(L, start); entry.mapid = Eluna::CHECKVAL<uint32>(L, start);
entry.x = Eluna::CHECKVAL<float>(L, start + 1); entry.x = Eluna::CHECKVAL<float>(L, start + 1);
@@ -2507,7 +2147,6 @@ namespace LuaGlobalFunctions
// optional // optional
entry.actionFlag = Eluna::CHECKVAL<uint32>(L, start + 4, 0); entry.actionFlag = Eluna::CHECKVAL<uint32>(L, start + 4, 0);
entry.delay = Eluna::CHECKVAL<uint32>(L, start + 5, 0); entry.delay = Eluna::CHECKVAL<uint32>(L, start + 5, 0);
#endif
nodes.push_back(entry); nodes.push_back(entry);
@@ -2529,28 +2168,17 @@ namespace LuaGlobalFunctions
pathId = sTaxiPathNodesByPath.size(); pathId = sTaxiPathNodesByPath.size();
if (sTaxiPathNodesByPath.size() <= pathId) if (sTaxiPathNodesByPath.size() <= pathId)
sTaxiPathNodesByPath.resize(pathId + 1); sTaxiPathNodesByPath.resize(pathId + 1);
sTaxiPathNodesByPath[pathId].clear(); sTaxiPathNodesByPath[pathId].clear();
sTaxiPathNodesByPath[pathId].resize(nodes.size()); sTaxiPathNodesByPath[pathId].resize(nodes.size());
static uint32 nodeId = 500; static uint32 nodeId = 500;
uint32 startNode = nodeId; uint32 startNode = nodeId;
uint32 index = 0; uint32 index = 0;
for (std::list<TaxiPathNodeEntry>::iterator it = nodes.begin(); it != nodes.end(); ++it) for (std::list<TaxiPathNodeEntry>::iterator it = nodes.begin(); it != nodes.end(); ++it)
{ {
TaxiPathNodeEntry& entry = *it; TaxiPathNodeEntry& entry = *it;
TaxiNodesEntry* nodeEntry = new TaxiNodesEntry(); 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.path = pathId;
entry.index = nodeId; entry.index = nodeId;
nodeEntry->ID = index; nodeEntry->ID = index;
@@ -2561,33 +2189,19 @@ namespace LuaGlobalFunctions
nodeEntry->MountCreatureID[0] = mountH; nodeEntry->MountCreatureID[0] = mountH;
nodeEntry->MountCreatureID[1] = mountA; nodeEntry->MountCreatureID[1] = mountA;
sTaxiNodesStore.SetEntry(nodeId++, nodeEntry); sTaxiNodesStore.SetEntry(nodeId++, nodeEntry);
#ifndef AZEROTHCORE
sTaxiPathNodesByPath[pathId].set(index++, new TaxiPathNodeEntry(entry));
#else
sTaxiPathNodesByPath[pathId][index++] = new TaxiPathNodeEntry(entry); sTaxiPathNodesByPath[pathId][index++] = new TaxiPathNodeEntry(entry);
#endif
#endif
} }
if (startNode >= nodeId) if (startNode >= nodeId)
return 1; return 1;
#ifndef AZEROTHCORE
sTaxiPathSetBySource[startNode][nodeId - 1] = TaxiPathBySourceAndDestination(pathId, price);
#endif
TaxiPathEntry* pathEntry = new TaxiPathEntry(); TaxiPathEntry* pathEntry = new TaxiPathEntry();
#ifdef TRINITY
pathEntry->FromTaxiNode = startNode;
pathEntry->ToTaxiNode = nodeId - 1;
pathEntry->Cost = price;
#else
pathEntry->from = startNode; pathEntry->from = startNode;
pathEntry->to = nodeId - 1; pathEntry->to = nodeId - 1;
pathEntry->price = price; pathEntry->price = price;
#endif
pathEntry->ID = pathId; pathEntry->ID = pathId;
sTaxiPathStore.SetEntry(pathId, pathEntry); sTaxiPathStore.SetEntry(pathId, pathEntry);
#ifdef AZEROTHCORE
sTaxiPathSetBySource[startNode][nodeId - 1] = pathEntry; sTaxiPathSetBySource[startNode][nodeId - 1] = pathEntry;
#endif
Eluna::Push(L, pathId); Eluna::Push(L, pathId);
return 1; return 1;
} }
@@ -3479,7 +3093,6 @@ namespace LuaGlobalFunctions
return 0; return 0;
} }
#ifdef AZEROTHCORE
/** /**
* Gets the faction which is the current owner of Halaa in Nagrand * Gets the faction which is the current owner of Halaa in Nagrand
* 0 = Alliance * 0 = Alliance
@@ -3530,6 +3143,5 @@ namespace LuaGlobalFunctions
return 0; return 0;
} }
#endif
} }
#endif #endif

View File

@@ -149,13 +149,9 @@ namespace LuaGroup
if (player->GetGroupInvite()) if (player->GetGroupInvite())
player->UninviteFromGroup(); player->UninviteFromGroup();
#if defined TRINITY || AZEROTHCORE
bool success = group->AddMember(player); bool success = group->AddMember(player);
if (success) if (success)
group->BroadcastGroupUpdate(); group->BroadcastGroupUpdate();
#else
bool success = group->AddMember(player->GetObjectGuid(), player->GetName());
#endif
Eluna::Push(L, success); Eluna::Push(L, success);
return 1; return 1;
@@ -186,11 +182,7 @@ namespace LuaGroup
for (GroupReference* itr = group->GetFirstMember(); itr; itr = itr->next()) for (GroupReference* itr = group->GetFirstMember(); itr; itr = itr->next())
{ {
#if defined TRINITY || AZEROTHCORE
Player* member = itr->GetSource(); Player* member = itr->GetSource();
#else
Player* member = itr->getSource();
#endif
if (!member || !member->GetSession()) if (!member || !member->GetSession())
continue; continue;
@@ -210,11 +202,7 @@ namespace LuaGroup
*/ */
int GetLeaderGUID(lua_State* L, Group* group) int GetLeaderGUID(lua_State* L, Group* group)
{ {
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, group->GetLeaderGUID()); Eluna::Push(L, group->GetLeaderGUID());
#else
Eluna::Push(L, group->GetLeaderGuid());
#endif
return 1; return 1;
} }
@@ -225,11 +213,7 @@ namespace LuaGroup
*/ */
int GetGUID(lua_State* L, Group* group) int GetGUID(lua_State* L, Group* group)
{ {
#ifdef CLASSIC
Eluna::Push(L, group->GetId());
#else
Eluna::Push(L, group->GET_GUID()); Eluna::Push(L, group->GET_GUID());
#endif
return 1; return 1;
} }
@@ -242,11 +226,8 @@ namespace LuaGroup
int GetMemberGUID(lua_State* L, Group* group) int GetMemberGUID(lua_State* L, Group* group)
{ {
const char* name = Eluna::CHECKVAL<const char*>(L, 2); const char* name = Eluna::CHECKVAL<const char*>(L, 2);
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, group->GetMemberGUID(name)); Eluna::Push(L, group->GetMemberGUID(name));
#else
Eluna::Push(L, group->GetMemberGuid(name));
#endif
return 1; return 1;
} }
@@ -322,11 +303,7 @@ namespace LuaGroup
bool ignorePlayersInBg = Eluna::CHECKVAL<bool>(L, 3); bool ignorePlayersInBg = Eluna::CHECKVAL<bool>(L, 3);
ObjectGuid ignore = Eluna::CHECKVAL<ObjectGuid>(L, 4); ObjectGuid ignore = Eluna::CHECKVAL<ObjectGuid>(L, 4);
#ifdef CMANGOS
group->BroadcastPacket(*data, ignorePlayersInBg, -1, ignore);
#else
group->BroadcastPacket(data, ignorePlayersInBg, -1, ignore); group->BroadcastPacket(data, ignorePlayersInBg, -1, ignore);
#endif
return 0; return 0;
} }
@@ -352,11 +329,7 @@ namespace LuaGroup
ObjectGuid guid = Eluna::CHECKVAL<ObjectGuid>(L, 2); ObjectGuid guid = Eluna::CHECKVAL<ObjectGuid>(L, 2);
uint32 method = Eluna::CHECKVAL<uint32>(L, 3, 0); uint32 method = Eluna::CHECKVAL<uint32>(L, 3, 0);
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, group->RemoveMember(guid, (RemoveMethod)method)); Eluna::Push(L, group->RemoveMember(guid, (RemoveMethod)method));
#else
Eluna::Push(L, group->RemoveMember(guid, method));
#endif
return 1; return 1;
} }
@@ -420,11 +393,7 @@ namespace LuaGroup
if (icon >= TARGETICONCOUNT) if (icon >= TARGETICONCOUNT)
return luaL_argerror(L, 2, "valid target icon expected"); return luaL_argerror(L, 2, "valid target icon expected");
#if (defined(CLASSIC) || defined(TBC))
group->SetTargetIcon(icon, target);
#else
group->SetTargetIcon(icon, setter, target); group->SetTargetIcon(icon, setter, target);
#endif
return 0; return 0;
} }

View File

@@ -25,22 +25,8 @@ namespace LuaGuild
int tbl = lua_gettop(L); int tbl = lua_gettop(L);
uint32 i = 0; 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<std::shared_mutex> lock(*HashMapHolder<Player>::GetLock()); std::shared_lock<std::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
#else
HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock());
#endif
const HashMapHolder<Player>::MapType& m = eObjectAccessor()GetPlayers(); const HashMapHolder<Player>::MapType& m = eObjectAccessor()GetPlayers();
for (HashMapHolder<Player>::MapType::const_iterator it = m.begin(); it != m.end(); ++it) for (HashMapHolder<Player>::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 lua_settop(L, tbl); // push table to top of stack
return 1; return 1;
} }
@@ -66,11 +52,7 @@ namespace LuaGuild
*/ */
int GetMemberCount(lua_State* L, Guild* guild) int GetMemberCount(lua_State* L, Guild* guild)
{ {
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, guild->GetMemberCount()); Eluna::Push(L, guild->GetMemberCount());
#else
Eluna::Push(L, guild->GetMemberSize());
#endif
return 1; return 1;
} }
@@ -81,11 +63,7 @@ namespace LuaGuild
*/ */
int GetLeader(lua_State* L, Guild* guild) int GetLeader(lua_State* L, Guild* guild)
{ {
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, eObjectAccessor()FindPlayer(guild->GetLeaderGUID())); Eluna::Push(L, eObjectAccessor()FindPlayer(guild->GetLeaderGUID()));
#else
Eluna::Push(L, eObjectAccessor()FindPlayer(guild->GetLeaderGuid()));
#endif
return 1; return 1;
} }
@@ -96,11 +74,7 @@ namespace LuaGuild
*/ */
int GetLeaderGUID(lua_State* L, Guild* guild) int GetLeaderGUID(lua_State* L, Guild* guild)
{ {
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, guild->GetLeaderGUID()); Eluna::Push(L, guild->GetLeaderGUID());
#else
Eluna::Push(L, guild->GetLeaderGuid());
#endif
return 1; return 1;
} }
@@ -144,15 +118,10 @@ namespace LuaGuild
*/ */
int GetInfo(lua_State* L, Guild* guild) int GetInfo(lua_State* L, Guild* guild)
{ {
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, guild->GetInfo()); Eluna::Push(L, guild->GetInfo());
#else
Eluna::Push(L, guild->GetGINFO());
#endif
return 1; return 1;
} }
#if defined(CLASSIC) || defined(TBC) || defined(WOTLK)
/** /**
* Sets the leader of this [Guild] * Sets the leader of this [Guild]
* *
@@ -162,16 +131,10 @@ namespace LuaGuild
{ {
Player* player = Eluna::CHECKOBJ<Player>(L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
#if defined TRINITY || AZEROTHCORE
guild->HandleSetLeader(player->GetSession(), player->GetName()); guild->HandleSetLeader(player->GetSession(), player->GetName());
#else
guild->SetLeader(player->GET_GUID());
#endif
return 0; return 0;
} }
#endif
#ifndef CLASSIC
/** /**
* Sets the information of the bank tab specified * Sets the information of the bank tab specified
* *
@@ -182,14 +145,9 @@ namespace LuaGuild
{ {
uint8 tabId = Eluna::CHECKVAL<uint8>(L, 2); uint8 tabId = Eluna::CHECKVAL<uint8>(L, 2);
const char* text = Eluna::CHECKVAL<const char*>(L, 3); const char* text = Eluna::CHECKVAL<const char*>(L, 3);
#if defined TRINITY || AZEROTHCORE
guild->SetBankTabText(tabId, text); guild->SetBankTabText(tabId, text);
#else
guild->SetGuildBankTabText(tabId, text);
#endif
return 0; return 0;
} }
#endif
// SendPacketToGuild(packet) // SendPacketToGuild(packet)
/** /**
@@ -201,11 +159,7 @@ namespace LuaGuild
{ {
WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(L, 2); WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(L, 2);
#ifdef CMANGOS
guild->BroadcastPacket(*data);
#else
guild->BroadcastPacket(data); guild->BroadcastPacket(data);
#endif
return 0; return 0;
} }
@@ -221,11 +175,7 @@ namespace LuaGuild
WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(L, 2); WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(L, 2);
uint8 ranked = Eluna::CHECKVAL<uint8>(L, 3); uint8 ranked = Eluna::CHECKVAL<uint8>(L, 3);
#ifdef CMANGOS
guild->BroadcastPacketToRank(*data, ranked);
#else
guild->BroadcastPacketToRank(data, ranked); guild->BroadcastPacketToRank(data, ranked);
#endif
return 0; return 0;
} }
@@ -251,12 +201,7 @@ namespace LuaGuild
Player* player = Eluna::CHECKOBJ<Player>(L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
uint8 rankId = Eluna::CHECKVAL<uint8>(L, 3, GUILD_RANK_NONE); uint8 rankId = Eluna::CHECKVAL<uint8>(L, 3, GUILD_RANK_NONE);
#ifdef TRINITY
CharacterDatabaseTransaction trans(nullptr);
guild->AddMember(trans, player->GET_GUID(), rankId);
#else
guild->AddMember(player->GET_GUID(), rankId); guild->AddMember(player->GET_GUID(), rankId);
#endif
return 0; return 0;
} }
@@ -271,14 +216,7 @@ namespace LuaGuild
Player* player = Eluna::CHECKOBJ<Player>(L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
bool isDisbanding = Eluna::CHECKVAL<bool>(L, 3, false); bool isDisbanding = Eluna::CHECKVAL<bool>(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); guild->DeleteMember(player->GET_GUID(), isDisbanding);
#else
guild->DelMember(player->GET_GUID(), isDisbanding);
#endif
return 0; return 0;
} }
@@ -293,12 +231,7 @@ namespace LuaGuild
Player* player = Eluna::CHECKOBJ<Player>(L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
uint8 newRank = Eluna::CHECKVAL<uint8>(L, 3); uint8 newRank = Eluna::CHECKVAL<uint8>(L, 3);
#ifdef TRINITY
CharacterDatabaseTransaction trans(nullptr);
guild->ChangeMemberRank(trans, player->GET_GUID(), newRank);
#else
guild->ChangeMemberRank(player->GET_GUID(), newRank); guild->ChangeMemberRank(player->GET_GUID(), newRank);
#endif
return 0; return 0;
} }
}; };

View File

@@ -23,7 +23,6 @@ namespace LuaItem
return 1; return 1;
} }
#if (!defined(TBC) && !defined(CLASSIC))
/** /**
* Returns 'true' if the [Item] is account bound, 'false' otherwise * Returns 'true' if the [Item] is account bound, 'false' otherwise
* *
@@ -34,7 +33,6 @@ namespace LuaItem
Eluna::Push(L, item->IsBoundAccountWide()); Eluna::Push(L, item->IsBoundAccountWide());
return 1; return 1;
} }
#endif
/** /**
* Returns 'true' if the [Item] is bound to a [Player] by an enchant, 'false' otehrwise * Returns 'true' if the [Item] is bound to a [Player] by an enchant, 'false' otehrwise
@@ -83,7 +81,6 @@ namespace LuaItem
return 1; return 1;
} }
#ifndef CLASSIC
/** /**
* Returns 'true' if the [Item] is a currency token, 'false' otherwise * Returns 'true' if the [Item] is a currency token, 'false' otherwise
* *
@@ -94,7 +91,6 @@ namespace LuaItem
Eluna::Push(L, item->IsCurrencyToken()); Eluna::Push(L, item->IsCurrencyToken());
return 1; return 1;
} }
#endif
/** /**
* Returns 'true' if the [Item] is a not an empty bag, 'false' otherwise * 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) int CanBeTraded(lua_State* L, Item* item)
{ {
#if (defined(TBC) || defined(CLASSIC))
Eluna::Push(L, item->CanBeTraded());
#else
bool mail = Eluna::CHECKVAL<bool>(L, 2, false); bool mail = Eluna::CHECKVAL<bool>(L, 2, false);
Eluna::Push(L, item->CanBeTraded(mail)); Eluna::Push(L, item->CanBeTraded(mail));
#endif
return 1; return 1;
} }
@@ -176,11 +168,7 @@ namespace LuaItem
int HasQuest(lua_State* L, Item* item) int HasQuest(lua_State* L, Item* item)
{ {
uint32 quest = Eluna::CHECKVAL<uint32>(L, 2); uint32 quest = Eluna::CHECKVAL<uint32>(L, 2);
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, item->hasQuest(quest)); Eluna::Push(L, item->hasQuest(quest));
#else
Eluna::Push(L, item->HasQuest(quest));
#endif
return 1; return 1;
} }
@@ -195,7 +183,6 @@ namespace LuaItem
return 1; return 1;
} }
#if defined CLASSIC || defined(TBC) || defined(WOTLK)
/** /**
* Returns 'true' if the [Item] is a weapon vellum, 'false' otherwise * Returns 'true' if the [Item] is a weapon vellum, 'false' otherwise
* *
@@ -217,7 +204,6 @@ namespace LuaItem
Eluna::Push(L, item->IsArmorVellum()); Eluna::Push(L, item->IsArmorVellum());
return 1; return 1;
} }
#endif
/** /**
* Returns 'true' if the [Item] is a conjured consumable, 'false' otherwise * Returns 'true' if the [Item] is a conjured consumable, 'false' otherwise
@@ -270,49 +256,24 @@ namespace LuaItem
ObjectMgr::GetLocaleString(il->Name, static_cast<LocaleConstant>(locale), name); ObjectMgr::GetLocaleString(il->Name, static_cast<LocaleConstant>(locale), name);
} }
#ifndef CLASSIC
if (int32 itemRandPropId = item->GetItemRandomPropertyId()) if (int32 itemRandPropId = item->GetItemRandomPropertyId())
{ {
#if defined(CATA) || defined (MISTS)
char* suffix = NULL;
#else
#if TRINITY || AZEROTHCORE
std::array<char const*, 16> const* suffix = NULL; std::array<char const*, 16> const* suffix = NULL;
#else
char* const* suffix = NULL;
#endif
#endif
if (itemRandPropId < 0) if (itemRandPropId < 0)
{ {
const ItemRandomSuffixEntry* itemRandEntry = sItemRandomSuffixStore.LookupEntry(-item->GetItemRandomPropertyId()); const ItemRandomSuffixEntry* itemRandEntry = sItemRandomSuffixStore.LookupEntry(-item->GetItemRandomPropertyId());
if (itemRandEntry) if (itemRandEntry)
{
#if TRINITY || AZEROTHCORE
suffix = &itemRandEntry->Name; suffix = &itemRandEntry->Name;
#else
suffix = itemRandEntry->nameSuffix;
#endif
}
} }
else else
{ {
const ItemRandomPropertiesEntry* itemRandEntry = sItemRandomPropertiesStore.LookupEntry(item->GetItemRandomPropertyId()); const ItemRandomPropertiesEntry* itemRandEntry = sItemRandomPropertiesStore.LookupEntry(item->GetItemRandomPropertyId());
if (itemRandEntry) if (itemRandEntry)
{
#if TRINITY || AZEROTHCORE
suffix = &itemRandEntry->Name; suffix = &itemRandEntry->Name;
#else
suffix = itemRandEntry->nameSuffix;
#endif
}
} }
if (suffix) if (suffix)
{ {
#if TRINITY || AZEROTHCORE
const char* suffixName = (*suffix)[(name != temp->Name1) ? locale : uint8(DEFAULT_LOCALE)]; 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) if (strcmp(suffixName, "") != 0)
{ {
name += ' '; name += ' ';
@@ -320,19 +281,16 @@ namespace LuaItem
} }
} }
} }
#endif
Player* owner = item->GetOwner(); Player* owner = item->GetOwner();
std::ostringstream oss; std::ostringstream oss;
oss << "|c" << std::hex << ItemQualityColors[temp->Quality] << std::dec << oss << "|c" << std::hex << ItemQualityColors[temp->Quality] << std::dec <<
"|Hitem:" << temp->ItemId << ":" << "|Hitem:" << temp->ItemId << ":" <<
item->GetEnchantmentId(PERM_ENCHANTMENT_SLOT) << ":" << item->GetEnchantmentId(PERM_ENCHANTMENT_SLOT) << ":" <<
#ifndef CLASSIC
item->GetEnchantmentId(SOCK_ENCHANTMENT_SLOT) << ":" << item->GetEnchantmentId(SOCK_ENCHANTMENT_SLOT) << ":" <<
item->GetEnchantmentId(SOCK_ENCHANTMENT_SLOT_2) << ":" << item->GetEnchantmentId(SOCK_ENCHANTMENT_SLOT_2) << ":" <<
item->GetEnchantmentId(SOCK_ENCHANTMENT_SLOT_3) << ":" << item->GetEnchantmentId(SOCK_ENCHANTMENT_SLOT_3) << ":" <<
item->GetEnchantmentId(BONUS_ENCHANTMENT_SLOT) << ":" << item->GetEnchantmentId(BONUS_ENCHANTMENT_SLOT) << ":" <<
#endif
item->GetItemRandomPropertyId() << ":" << item->GetItemSuffixFactor() << ":" << item->GetItemRandomPropertyId() << ":" << item->GetItemSuffixFactor() << ":" <<
(uint32)(owner ? owner->GetLevel() : 0) << "|h[" << name << "]|h|r"; (uint32)(owner ? owner->GetLevel() : 0) << "|h[" << name << "]|h|r";
@@ -342,11 +300,7 @@ namespace LuaItem
int GetOwnerGUID(lua_State* L, Item* item) int GetOwnerGUID(lua_State* L, Item* item)
{ {
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, item->GetOwnerGUID()); Eluna::Push(L, item->GetOwnerGUID());
#else
Eluna::Push(L, item->GetOwnerGuid());
#endif
return 1; return 1;
} }
@@ -597,13 +551,11 @@ namespace LuaItem
return 1; return 1;
} }
#ifdef WOTLK
int GetStatsCount(lua_State* L, Item* item) int GetStatsCount(lua_State* L, Item* item)
{ {
Eluna::Push(L, item->GetTemplate()->StatsCount); Eluna::Push(L, item->GetTemplate()->StatsCount);
return 1; return 1;
} }
#endif
/** /**
* Returns the random property ID of this [Item] * Returns the random property ID of this [Item]
@@ -616,13 +568,11 @@ namespace LuaItem
return 1; return 1;
} }
#ifndef CLASSIC
int GetRandomSuffix(lua_State* L, Item* item) int GetRandomSuffix(lua_State* L, Item* item)
{ {
Eluna::Push(L, item->GetTemplate()->RandomSuffix); Eluna::Push(L, item->GetTemplate()->RandomSuffix);
return 1; return 1;
} }
#endif
/** /**
* Returns the item set ID of this [Item] * Returns the item set ID of this [Item]
@@ -668,11 +618,7 @@ namespace LuaItem
int SetOwner(lua_State* L, Item* item) int SetOwner(lua_State* L, Item* item)
{ {
Player* player = Eluna::CHECKOBJ<Player>(L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
#if defined TRINITY || AZEROTHCORE
item->SetOwnerGUID(player->GET_GUID()); item->SetOwnerGUID(player->GET_GUID());
#else
item->SetOwnerGuid(player->GET_GUID());
#endif
return 0; return 0;
} }
@@ -774,12 +720,8 @@ namespace LuaItem
*/ */
int SaveToDB(lua_State* /*L*/, Item* item) int SaveToDB(lua_State* /*L*/, Item* item)
{ {
#if defined TRINITY || defined AZEROTHCORE
CharacterDatabaseTransaction trans = CharacterDatabaseTransaction(nullptr); CharacterDatabaseTransaction trans = CharacterDatabaseTransaction(nullptr);
item->SaveToDB(trans); item->SaveToDB(trans);
#else
item->SaveToDB();
#endif
return 0; return 0;
} }
}; };

View File

@@ -17,7 +17,6 @@
namespace LuaMap namespace LuaMap
{ {
#ifndef CLASSIC
/** /**
* Returns `true` if the [Map] is an arena [BattleGround], `false` otherwise. * Returns `true` if the [Map] is an arena [BattleGround], `false` otherwise.
* *
@@ -28,7 +27,6 @@ namespace LuaMap
Eluna::Push(L, map->IsBattleArena()); Eluna::Push(L, map->IsBattleArena());
return 1; return 1;
} }
#endif
/** /**
* Returns `true` if the [Map] is a non-arena [BattleGround], `false` otherwise. * 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) int IsBattleground(lua_State* L, Map* map)
{ {
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, map->IsBattleground()); Eluna::Push(L, map->IsBattleground());
#else
Eluna::Push(L, map->IsBattleGround());
#endif
return 1; return 1;
} }
@@ -67,7 +61,6 @@ namespace LuaMap
return 1; return 1;
} }
#ifndef CLASSIC
/** /**
* Returns `true` if the [Map] is a heroic, `false` otherwise. * Returns `true` if the [Map] is a heroic, `false` otherwise.
* *
@@ -78,7 +71,6 @@ namespace LuaMap
Eluna::Push(L, map->IsHeroic()); Eluna::Push(L, map->IsHeroic());
return 1; return 1;
} }
#endif
/** /**
* Returns `true` if the [Map] is a raid, `false` otherwise. * Returns `true` if the [Map] is a raid, `false` otherwise.
@@ -115,12 +107,8 @@ namespace LuaMap
{ {
float x = Eluna::CHECKVAL<float>(L, 2); float x = Eluna::CHECKVAL<float>(L, 2);
float y = Eluna::CHECKVAL<float>(L, 3); float y = Eluna::CHECKVAL<float>(L, 3);
#if (defined(TBC) || defined(CLASSIC))
float z = map->GetHeight(x, y, MAX_HEIGHT);
#else
uint32 phasemask = Eluna::CHECKVAL<uint32>(L, 4, 1); uint32 phasemask = Eluna::CHECKVAL<uint32>(L, 4, 1);
float z = map->GetHeight(phasemask, x, y, MAX_HEIGHT); float z = map->GetHeight(phasemask, x, y, MAX_HEIGHT);
#endif
if (z != INVALID_HEIGHT) if (z != INVALID_HEIGHT)
Eluna::Push(L, z); Eluna::Push(L, z);
return 1; return 1;
@@ -135,11 +123,7 @@ namespace LuaMap
*/ */
int GetDifficulty(lua_State* L, Map* map) int GetDifficulty(lua_State* L, Map* map)
{ {
#ifndef CLASSIC
Eluna::Push(L, map->GetDifficulty()); Eluna::Push(L, map->GetDifficulty());
#else
Eluna::Push(L, (Difficulty)0);
#endif
return 1; return 1;
} }
@@ -190,13 +174,9 @@ namespace LuaMap
float x = Eluna::CHECKVAL<float>(L, 2); float x = Eluna::CHECKVAL<float>(L, 2);
float y = Eluna::CHECKVAL<float>(L, 3); float y = Eluna::CHECKVAL<float>(L, 3);
float z = Eluna::CHECKVAL<float>(L, 4); float z = Eluna::CHECKVAL<float>(L, 4);
#if defined TRINITY || defined AZEROTHCORE
float phasemask = Eluna::CHECKVAL<uint32>(L, 5, PHASEMASK_NORMAL); float phasemask = Eluna::CHECKVAL<uint32>(L, 5, PHASEMASK_NORMAL);
Eluna::Push(L, map->GetAreaId(phasemask, x, y, z)); Eluna::Push(L, map->GetAreaId(phasemask, x, y, z));
#else
Eluna::Push(L, map->GetTerrain()->GetAreaId(x, y, z));
#endif
return 1; return 1;
} }
@@ -210,7 +190,6 @@ namespace LuaMap
{ {
ObjectGuid guid = Eluna::CHECKVAL<ObjectGuid>(L, 2); ObjectGuid guid = Eluna::CHECKVAL<ObjectGuid>(L, 2);
#if defined TRINITY || AZEROTHCORE
switch (guid.GetHigh()) switch (guid.GetHigh())
{ {
case HIGHGUID_PLAYER: case HIGHGUID_PLAYER:
@@ -237,9 +216,6 @@ namespace LuaMap
default: default:
break; break;
} }
#else
Eluna::Push(L, map->GetWorldObject(guid));
#endif
return 1; return 1;
} }
@@ -267,19 +243,11 @@ namespace LuaMap
uint32 weatherType = Eluna::CHECKVAL<uint32>(L, 3); uint32 weatherType = Eluna::CHECKVAL<uint32>(L, 3);
float grade = Eluna::CHECKVAL<float>(L, 4); float grade = Eluna::CHECKVAL<float>(L, 4);
#if defined TRINITY
if (Weather * weather = map->GetOrGenerateZoneDefaultWeather(zoneId))
weather->SetWeather((WeatherType)weatherType, grade);
#elif defined AZEROTHCORE
Weather* weather = WeatherMgr::FindWeather(zoneId); Weather* weather = WeatherMgr::FindWeather(zoneId);
if (!weather) if (!weather)
weather = WeatherMgr::AddWeather(zoneId); weather = WeatherMgr::AddWeather(zoneId);
if (weather) if (weather)
weather->SetWeather((WeatherType)weatherType, grade); weather->SetWeather((WeatherType)weatherType, grade);
#else
if (Weather::IsValidWeatherType(weatherType))
map->SetWeather(zoneId, (WeatherType)weatherType, grade, false);
#endif
return 0; return 0;
} }
@@ -293,13 +261,9 @@ namespace LuaMap
*/ */
int GetInstanceData(lua_State* L, Map* map) int GetInstanceData(lua_State* L, Map* map)
{ {
#if defined TRINITY || AZEROTHCORE
ElunaInstanceAI* iAI = NULL; ElunaInstanceAI* iAI = NULL;
if (InstanceMap* inst = map->ToInstanceMap()) if (InstanceMap* inst = map->ToInstanceMap())
iAI = dynamic_cast<ElunaInstanceAI*>(inst->GetInstanceScript()); iAI = dynamic_cast<ElunaInstanceAI*>(inst->GetInstanceScript());
#else
ElunaInstanceAI* iAI = dynamic_cast<ElunaInstanceAI*>(map->GetInstanceData());
#endif
if (iAI) if (iAI)
Eluna::GetEluna(L)->PushInstanceData(L, iAI, false); Eluna::GetEluna(L)->PushInstanceData(L, iAI, false);
@@ -314,13 +278,9 @@ namespace LuaMap
*/ */
int SaveInstanceData(lua_State* /*L*/, Map* map) int SaveInstanceData(lua_State* /*L*/, Map* map)
{ {
#if defined TRINITY || AZEROTHCORE
ElunaInstanceAI* iAI = NULL; ElunaInstanceAI* iAI = NULL;
if (InstanceMap* inst = map->ToInstanceMap()) if (InstanceMap* inst = map->ToInstanceMap())
iAI = dynamic_cast<ElunaInstanceAI*>(inst->GetInstanceScript()); iAI = dynamic_cast<ElunaInstanceAI*>(inst->GetInstanceScript());
#else
ElunaInstanceAI* iAI = dynamic_cast<ElunaInstanceAI*>(map->GetInstanceData());
#endif
if (iAI) if (iAI)
iAI->SaveToDB(); iAI->SaveToDB();
@@ -352,11 +312,7 @@ namespace LuaMap
Map::PlayerList const& players = map->GetPlayers(); Map::PlayerList const& players = map->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{ {
#if defined TRINITY || AZEROTHCORE
Player* player = itr->GetSource(); Player* player = itr->GetSource();
#else
Player* player = itr->getSource();
#endif
if (!player) if (!player)
continue; continue;
if (player->GetSession() && (team >= TEAM_NEUTRAL || player->GetTeamId() == team)) if (player->GetSession() && (team >= TEAM_NEUTRAL || player->GetTeamId() == team))

View File

@@ -58,9 +58,7 @@ namespace LuaObject
*/ */
int IsPlayer(lua_State* L, Object* obj) int IsPlayer(lua_State* L, Object* obj)
{ {
#ifdef AZEROTHCORE //AC-only
Eluna::Push(L, obj->IsPlayer()); Eluna::Push(L, obj->IsPlayer());
#endif
return 1; return 1;
} }
@@ -146,11 +144,7 @@ namespace LuaObject
*/ */
int GetScale(lua_State* L, Object* obj) int GetScale(lua_State* L, Object* obj)
{ {
#ifndef AZEROTHCORE
Eluna::Push(L, obj->GetObjectScale());
#else
Eluna::Push(L, obj->GetFloatValue(OBJECT_FIELD_SCALE_X)); Eluna::Push(L, obj->GetFloatValue(OBJECT_FIELD_SCALE_X));
#endif
return 1; return 1;
} }
@@ -199,11 +193,7 @@ namespace LuaObject
*/ */
int GetGUIDLow(lua_State* L, Object* obj) int GetGUIDLow(lua_State* L, Object* obj)
{ {
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, obj->GetGUID().GetCounter()); Eluna::Push(L, obj->GetGUID().GetCounter());
#else
Eluna::Push(L, obj->GetGUIDLow());
#endif
return 1; return 1;
} }

File diff suppressed because it is too large Load Diff

View File

@@ -52,15 +52,10 @@ namespace LuaQuest
int HasFlag(lua_State* L, Quest* quest) int HasFlag(lua_State* L, Quest* quest)
{ {
uint32 flag = Eluna::CHECKVAL<uint32>(L, 2); uint32 flag = Eluna::CHECKVAL<uint32>(L, 2);
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, quest->HasFlag(flag)); Eluna::Push(L, quest->HasFlag(flag));
#else
Eluna::Push(L, quest->HasQuestFlag((QuestFlags)flag));
#endif
return 1; return 1;
} }
#ifndef CLASSIC
/** /**
* Returns 'true' if the [Quest] is a daily quest, false otherwise. * Returns 'true' if the [Quest] is a daily quest, false otherwise.
* *
@@ -71,7 +66,6 @@ namespace LuaQuest
Eluna::Push(L, quest->IsDaily()); Eluna::Push(L, quest->IsDaily());
return 1; return 1;
} }
#endif
/** /**
* Returns 'true' if the [Quest] is repeatable, false otherwise. * Returns 'true' if the [Quest] is repeatable, false otherwise.
@@ -157,11 +151,7 @@ namespace LuaQuest
*/ */
int GetFlags(lua_State* L, Quest* quest) int GetFlags(lua_State* L, Quest* quest)
{ {
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, quest->GetFlags()); Eluna::Push(L, quest->GetFlags());
#else
Eluna::Push(L, quest->GetQuestFlags());
#endif
return 1; return 1;
} }

View File

@@ -100,11 +100,7 @@ namespace LuaSpell
*/ */
int GetDuration(lua_State* L, Spell* spell) int GetDuration(lua_State* L, Spell* spell)
{ {
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, spell->GetSpellInfo()->GetDuration()); Eluna::Push(L, spell->GetSpellInfo()->GetDuration());
#else
Eluna::Push(L, GetSpellDuration(spell->m_spellInfo));
#endif
return 1; return 1;
} }
@@ -117,17 +113,11 @@ namespace LuaSpell
*/ */
int GetTargetDest(lua_State* L, Spell* spell) int GetTargetDest(lua_State* L, Spell* spell)
{ {
#if defined TRINITY || AZEROTHCORE
if (!spell->m_targets.HasDst()) if (!spell->m_targets.HasDst())
return 3; return 3;
float x, y, z; float x, y, z;
spell->m_targets.GetDstPos()->GetPosition(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, x);
Eluna::Push(L, y); Eluna::Push(L, y);
Eluna::Push(L, z); Eluna::Push(L, z);
@@ -148,7 +138,6 @@ namespace LuaSpell
*/ */
int GetTarget(lua_State* L, Spell* spell) int GetTarget(lua_State* L, Spell* spell)
{ {
#if defined TRINITY || AZEROTHCORE
if (GameObject* target = spell->m_targets.GetGOTarget()) if (GameObject* target = spell->m_targets.GetGOTarget())
Eluna::Push(L, target); Eluna::Push(L, target);
else if (Item* target = spell->m_targets.GetItemTarget()) else if (Item* target = spell->m_targets.GetItemTarget())
@@ -159,16 +148,6 @@ namespace LuaSpell
Eluna::Push(L, target); Eluna::Push(L, target);
else if (WorldObject* target = spell->m_targets.GetObjectTarget()) else if (WorldObject* target = spell->m_targets.GetObjectTarget())
Eluna::Push(L, target); 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; return 1;
} }

View File

@@ -403,7 +403,6 @@ namespace LuaUnit
return 1; return 1;
} }
#ifndef CLASSIC
/** /**
* Returns true if the [Unit] is on a [Vehicle]. * Returns true if the [Unit] is on a [Vehicle].
* *
@@ -414,7 +413,6 @@ namespace LuaUnit
Eluna::Push(L, unit->GetVehicle()); Eluna::Push(L, unit->GetVehicle());
return 1; return 1;
} }
#endif
/** /**
* Returns true if the [Unit] is in combat. * Returns true if the [Unit] is in combat.
@@ -1166,7 +1164,6 @@ namespace LuaUnit
return 1; return 1;
} }
#if (!defined(TBC) && !defined(CLASSIC))
/** /**
* Returns [Unit]'s [Vehicle] methods * Returns [Unit]'s [Vehicle] methods
* *
@@ -1196,7 +1193,6 @@ namespace LuaUnit
Eluna::Push(L, unit->GetCritterGUID()); Eluna::Push(L, unit->GetCritterGUID());
return 1; return 1;
} }
#endif
/** /**
* Returns the [Unit]'s speed of given [UnitMoveType]. * Returns the [Unit]'s speed of given [UnitMoveType].
@@ -1752,7 +1748,6 @@ namespace LuaUnit
return 0; return 0;
} }
#if (!defined(TBC) && !defined(CLASSIC))
/** /**
* Sets the [Unit]'s FFA flag on or off. * Sets the [Unit]'s FFA flag on or off.
* *
@@ -1804,7 +1799,6 @@ namespace LuaUnit
unit->SetCritterGUID(guid); unit->SetCritterGUID(guid);
return 0; return 0;
} }
#endif
/*int SetStunned(lua_State* L, Unit* unit) /*int SetStunned(lua_State* L, Unit* unit)
{ {
@@ -2157,7 +2151,6 @@ namespace LuaUnit
return 0; return 0;
} }
#if (!defined(TBC) && !defined(CLASSIC))
/** /**
* Makes the [Unit] jump to the coordinates * Makes the [Unit] jump to the coordinates
* *
@@ -2180,7 +2173,6 @@ namespace LuaUnit
unit->GetMotionMaster()->MoveJump(pos, zSpeed, maxHeight, id); unit->GetMotionMaster()->MoveJump(pos, zSpeed, maxHeight, id);
return 0; return 0;
} }
#endif
/** /**
* The [Unit] will whisper the message to a [Player] * The [Unit] will whisper the message to a [Player]
@@ -2426,7 +2418,6 @@ namespace LuaUnit
return 0; return 0;
} }
#if !defined(CLASSIC)
/** /**
* Removes all positive visible [Aura]'s from the [Unit]. * Removes all positive visible [Aura]'s from the [Unit].
*/ */
@@ -2435,7 +2426,6 @@ namespace LuaUnit
unit->RemoveArenaAuras(); unit->RemoveArenaAuras();
return 0; return 0;
} }
#endif
/** /**
* Adds the given unit state for the [Unit]. * Adds the given unit state for the [Unit].

View File

@@ -6,8 +6,6 @@
#ifndef VEHICLEMETHODS_H #ifndef VEHICLEMETHODS_H
#define VEHICLEMETHODS_H #define VEHICLEMETHODS_H
#ifndef CLASSIC
#ifndef TBC
/*** /***
* Inherits all methods from: none * Inherits all methods from: none
@@ -23,11 +21,7 @@ namespace LuaVehicle
int IsOnBoard(lua_State* L, Vehicle* vehicle) int IsOnBoard(lua_State* L, Vehicle* vehicle)
{ {
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2); Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, passenger->IsOnVehicle(vehicle->GetBase())); Eluna::Push(L, passenger->IsOnVehicle(vehicle->GetBase()));
#else
Eluna::Push(L, vehicle->HasOnBoard(passenger));
#endif
return 1; return 1;
} }
@@ -38,11 +32,7 @@ namespace LuaVehicle
*/ */
int GetOwner(lua_State* L, Vehicle* vehicle) int GetOwner(lua_State* L, Vehicle* vehicle)
{ {
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, vehicle->GetBase()); Eluna::Push(L, vehicle->GetBase());
#else
Eluna::Push(L, vehicle->GetOwner());
#endif
return 1; return 1;
} }
@@ -53,13 +43,7 @@ namespace LuaVehicle
*/ */
int GetEntry(lua_State* L, Vehicle* vehicle) int GetEntry(lua_State* L, Vehicle* vehicle)
{ {
#ifdef TRINITY
Eluna::Push(L, vehicle->GetVehicleInfo()->ID);
#elif AZEROTHCORE
Eluna::Push(L, vehicle->GetVehicleInfo()->m_ID); Eluna::Push(L, vehicle->GetVehicleInfo()->m_ID);
#else
Eluna::Push(L, vehicle->GetVehicleEntry()->m_ID);
#endif
return 1; return 1;
} }
@@ -86,12 +70,8 @@ namespace LuaVehicle
{ {
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2); Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
int8 seatId = Eluna::CHECKVAL<int8>(L, 3); int8 seatId = Eluna::CHECKVAL<int8>(L, 3);
#if defined TRINITY || AZEROTHCORE
vehicle->AddPassenger(passenger, seatId); vehicle->AddPassenger(passenger, seatId);
#else
if (vehicle->CanBoard(passenger))
vehicle->Board(passenger, seatId);
#endif
return 0; return 0;
} }
@@ -103,15 +83,9 @@ namespace LuaVehicle
int RemovePassenger(lua_State* L, Vehicle* vehicle) int RemovePassenger(lua_State* L, Vehicle* vehicle)
{ {
Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2); Unit* passenger = Eluna::CHECKOBJ<Unit>(L, 2);
#if defined TRINITY || AZEROTHCORE
vehicle->RemovePassenger(passenger); vehicle->RemovePassenger(passenger);
#else
vehicle->UnBoard(passenger, false);
#endif
return 0; return 0;
} }
} }
#endif // CLASSIC
#endif // TBC
#endif // VEHICLEMETHODS_H #endif // VEHICLEMETHODS_H

View File

@@ -34,7 +34,6 @@ namespace LuaWorldObject
return 1; return 1;
} }
#if (!defined(TBC) && !defined(CLASSIC))
/** /**
* Returns the current phase of the [WorldObject] * Returns the current phase of the [WorldObject]
* *
@@ -59,7 +58,6 @@ namespace LuaWorldObject
obj->SetPhaseMask(phaseMask, update); obj->SetPhaseMask(phaseMask, update);
return 0; return 0;
} }
#endif
/** /**
* Returns the current instance ID of the [WorldObject] * Returns the current instance ID of the [WorldObject]
@@ -183,17 +181,9 @@ namespace LuaWorldObject
Unit* target = NULL; Unit* target = NULL;
ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_PLAYER, 0, hostile, dead); ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_PLAYER, 0, hostile, dead);
#ifdef TRINITY
Trinity::UnitLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
Cell::VisitAllObjects(obj, searcher, range);
#elif AZEROTHCORE
Acore::UnitLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker); Acore::UnitLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
Cell::VisitAllObjects(obj, searcher, range); Cell::VisitAllObjects(obj, searcher, range);
#else
MaNGOS::UnitLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(target, checker);
Cell::VisitWorldObjects(obj, searcher, range);
#endif
Eluna::Push(L, target); Eluna::Push(L, target);
return 1; return 1;
@@ -216,16 +206,9 @@ namespace LuaWorldObject
GameObject* target = NULL; GameObject* target = NULL;
ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_GAMEOBJECT, entry, hostile); ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_GAMEOBJECT, entry, hostile);
#ifdef TRINITY
Trinity::GameObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
Cell::VisitAllObjects(obj, searcher, range);
#elif AZEROTHCORE
Acore::GameObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker); Acore::GameObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
Cell::VisitAllObjects(obj, searcher, range); Cell::VisitAllObjects(obj, searcher, range);
#else
MaNGOS::GameObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(target, checker);
Cell::VisitGridObjects(obj, searcher, range);
#endif
Eluna::Push(L, target); Eluna::Push(L, target);
return 1; return 1;
@@ -250,17 +233,9 @@ namespace LuaWorldObject
Creature* target = NULL; Creature* target = NULL;
ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_UNIT, entry, hostile, dead); ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_UNIT, entry, hostile, dead);
#ifdef TRINITY
Trinity::CreatureLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
Cell::VisitAllObjects(obj, searcher, range);
#elif AZEROTHCORE
Acore::CreatureLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker); Acore::CreatureLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
Cell::VisitAllObjects(obj, searcher, range); Cell::VisitAllObjects(obj, searcher, range);
#else
MaNGOS::CreatureLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(target, checker);
Cell::VisitGridObjects(obj, searcher, range);
#endif
Eluna::Push(L, target); Eluna::Push(L, target);
return 1; return 1;
@@ -283,16 +258,9 @@ namespace LuaWorldObject
std::list<Player*> list; std::list<Player*> list;
ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_PLAYER, 0, hostile, dead); ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_PLAYER, 0, hostile, dead);
#ifdef TRINITY
Trinity::PlayerListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
Cell::VisitAllObjects(obj, searcher, range);
#elif AZEROTHCORE
Acore::PlayerListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker); Acore::PlayerListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
Cell::VisitAllObjects(obj, searcher, range); Cell::VisitAllObjects(obj, searcher, range);
#else
MaNGOS::PlayerListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(list, checker);
Cell::VisitWorldObjects(obj, searcher, range);
#endif
lua_createtable(L, list.size(), 0); lua_createtable(L, list.size(), 0);
int tbl = lua_gettop(L); int tbl = lua_gettop(L);
@@ -327,16 +295,9 @@ namespace LuaWorldObject
std::list<Creature*> list; std::list<Creature*> list;
ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_UNIT, entry, hostile, dead); ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_UNIT, entry, hostile, dead);
#ifdef TRINITY
Trinity::CreatureListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
Cell::VisitAllObjects(obj, searcher, range);
#elif defined AZEROTHCORE
Acore::CreatureListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker); Acore::CreatureListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
Cell::VisitAllObjects(obj, searcher, range); Cell::VisitAllObjects(obj, searcher, range);
#else
MaNGOS::CreatureListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(list, checker);
Cell::VisitGridObjects(obj, searcher, range);
#endif
lua_createtable(L, list.size(), 0); lua_createtable(L, list.size(), 0);
int tbl = lua_gettop(L); int tbl = lua_gettop(L);
@@ -369,16 +330,9 @@ namespace LuaWorldObject
std::list<GameObject*> list; std::list<GameObject*> list;
ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_GAMEOBJECT, entry, hostile); ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_GAMEOBJECT, entry, hostile);
#ifdef TRINITY
Trinity::GameObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
Cell::VisitAllObjects(obj, searcher, range);
#elif AZEROTHCORE
Acore::GameObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker); Acore::GameObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
Cell::VisitAllObjects(obj, searcher, range); Cell::VisitAllObjects(obj, searcher, range);
#else
MaNGOS::GameObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(list, checker);
Cell::VisitGridObjects(obj, searcher, range);
#endif
lua_createtable(L, list.size(), 0); lua_createtable(L, list.size(), 0);
int tbl = lua_gettop(L); int tbl = lua_gettop(L);
@@ -419,16 +373,9 @@ namespace LuaWorldObject
ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, type, entry, hostile, dead); ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, type, entry, hostile, dead);
WorldObject* target = NULL; WorldObject* target = NULL;
#ifdef TRINITY
Trinity::WorldObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
Cell::VisitAllObjects(obj, searcher, range);
#elif AZEROTHCORE
Acore::WorldObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker); Acore::WorldObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
Cell::VisitAllObjects(obj, searcher, range); Cell::VisitAllObjects(obj, searcher, range);
#else
MaNGOS::WorldObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(target, checker);
Cell::VisitAllObjects(obj, searcher, range);
#endif
Eluna::Push(L, target); Eluna::Push(L, target);
return 1; return 1;
@@ -459,16 +406,9 @@ namespace LuaWorldObject
ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, type, entry, hostile, dead); ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, type, entry, hostile, dead);
std::list<WorldObject*> list; std::list<WorldObject*> list;
#ifdef TRINITY
Trinity::WorldObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
Cell::VisitAllObjects(obj, searcher, range);
#elif AZEROTHCORE
Acore::WorldObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker); Acore::WorldObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
Cell::VisitAllObjects(obj, searcher, range); Cell::VisitAllObjects(obj, searcher, range);
#else
MaNGOS::WorldObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(list, checker);
Cell::VisitAllObjects(obj, searcher, range);
#endif
lua_createtable(L, list.size(), 0); lua_createtable(L, list.size(), 0);
int tbl = lua_gettop(L); int tbl = lua_gettop(L);
@@ -658,7 +598,6 @@ namespace LuaWorldObject
int GetAngle(lua_State* L, WorldObject* obj) int GetAngle(lua_State* L, WorldObject* obj)
{ {
WorldObject* target = Eluna::CHECKOBJ<WorldObject>(L, 2, false); WorldObject* target = Eluna::CHECKOBJ<WorldObject>(L, 2, false);
#if defined TRINITY && !AZEROTHCORE
if (target) if (target)
Eluna::Push(L, obj->GetAbsoluteAngle(target)); Eluna::Push(L, obj->GetAbsoluteAngle(target));
else else
@@ -667,16 +606,7 @@ namespace LuaWorldObject
float y = Eluna::CHECKVAL<float>(L, 3); float y = Eluna::CHECKVAL<float>(L, 3);
Eluna::Push(L, obj->GetAbsoluteAngle(x, y)); Eluna::Push(L, obj->GetAbsoluteAngle(x, y));
} }
#else
if (target)
Eluna::Push(L, obj->GetAngle(target));
else
{
float x = Eluna::CHECKVAL<float>(L, 2);
float y = Eluna::CHECKVAL<float>(L, 3);
Eluna::Push(L, obj->GetAngle(x, y));
}
#endif
return 1; return 1;
} }
@@ -688,11 +618,7 @@ namespace LuaWorldObject
int SendPacket(lua_State* L, WorldObject* obj) int SendPacket(lua_State* L, WorldObject* obj)
{ {
WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(L, 2); WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(L, 2);
#ifdef CMANGOS
obj->SendMessageToSet(*data, true);
#else
obj->SendMessageToSet(data, true); obj->SendMessageToSet(data, true);
#endif
return 0; return 0;
} }
@@ -715,14 +641,8 @@ namespace LuaWorldObject
float z = Eluna::CHECKVAL<float>(L, 5); float z = Eluna::CHECKVAL<float>(L, 5);
float o = Eluna::CHECKVAL<float>(L, 6); float o = Eluna::CHECKVAL<float>(L, 6);
uint32 respawnDelay = Eluna::CHECKVAL<uint32>(L, 7, 30); uint32 respawnDelay = Eluna::CHECKVAL<uint32>(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)); 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; return 1;
} }
@@ -762,7 +682,6 @@ namespace LuaWorldObject
uint32 spawnType = Eluna::CHECKVAL<uint32>(L, 7, 8); uint32 spawnType = Eluna::CHECKVAL<uint32>(L, 7, 8);
uint32 despawnTimer = Eluna::CHECKVAL<uint32>(L, 8, 0); uint32 despawnTimer = Eluna::CHECKVAL<uint32>(L, 8, 0);
#if defined TRINITY || AZEROTHCORE
TempSummonType type; TempSummonType type;
switch (spawnType) switch (spawnType)
{ {
@@ -793,49 +712,8 @@ namespace LuaWorldObject
default: default:
return luaL_argerror(L, 7, "valid SpawnType expected"); 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)); Eluna::Push(L, obj->SummonCreature(entry, x, y, z, o, type, despawnTimer));
#endif
return 1; return 1;
} }
@@ -1119,11 +997,7 @@ namespace LuaWorldObject
WorldObject* target = Eluna::CHECKOBJ<WorldObject>(L, 2); WorldObject* target = Eluna::CHECKOBJ<WorldObject>(L, 2);
float arc = Eluna::CHECKVAL<float>(L, 3, static_cast<float>(M_PI)); float arc = Eluna::CHECKVAL<float>(L, 3, static_cast<float>(M_PI));
#ifdef MANGOS
Eluna::Push(L, obj->IsInFront(target, arc));
#else
Eluna::Push(L, obj->isInFront(target, arc)); Eluna::Push(L, obj->isInFront(target, arc));
#endif
return 1; return 1;
} }
@@ -1139,11 +1013,7 @@ namespace LuaWorldObject
WorldObject* target = Eluna::CHECKOBJ<WorldObject>(L, 2); WorldObject* target = Eluna::CHECKOBJ<WorldObject>(L, 2);
float arc = Eluna::CHECKVAL<float>(L, 3, static_cast<float>(M_PI)); float arc = Eluna::CHECKVAL<float>(L, 3, static_cast<float>(M_PI));
#ifdef MANGOS
Eluna::Push(L, obj->IsInBack(target, arc));
#else
Eluna::Push(L, obj->isInBack(target, arc)); Eluna::Push(L, obj->isInBack(target, arc));
#endif
return 1; return 1;
} }
@@ -1165,17 +1035,10 @@ namespace LuaWorldObject
WorldPacket data(SMSG_PLAY_MUSIC, 4); WorldPacket data(SMSG_PLAY_MUSIC, 4);
data << uint32(musicid); data << uint32(musicid);
#ifdef CMANGOS
if (player)
player->SendDirectMessage(data);
else
obj->SendMessageToSet(data, true);
#else
if (player) if (player)
player->SendDirectMessage(&data); player->SendDirectMessage(&data);
else else
obj->SendMessageToSet(&data, true); obj->SendMessageToSet(&data, true);
#endif
return 0; return 0;
} }