Fix cmangos (classic) build

This commit is contained in:
Rochet2
2016-11-27 20:53:42 +02:00
parent 4aba0d6da2
commit 67ea403f10
9 changed files with 78 additions and 8 deletions

View File

@@ -121,10 +121,10 @@ namespace LuaCreature
{ {
Player* player = Eluna::CHECKOBJ<Player>(L, 2); Player* player = Eluna::CHECKOBJ<Player>(L, 2);
#ifdef MANGOS #ifdef TRINITY
Eluna::Push(L, creature->IsTappedBy(player));
#else
Eluna::Push(L, creature->isTappedBy(player)); Eluna::Push(L, creature->isTappedBy(player));
#else
Eluna::Push(L, creature->IsTappedBy(player));
#endif #endif
return 1; return 1;
} }
@@ -1102,7 +1102,11 @@ namespace LuaCreature
data.Initialize(SMSG_MOVE_UNSET_HOVER, 8 + 4); data.Initialize(SMSG_MOVE_UNSET_HOVER, 8 + 4);
data << creature->GetPackGUID(); data << creature->GetPackGUID();
data << uint32(0); data << uint32(0);
#ifdef CMANGOS
creature->SendMessageToSet(data, true);
#else
creature->SendMessageToSet(&data, true); creature->SendMessageToSet(&data, true);
#endif
#endif #endif
return 0; return 0;
} }

View File

@@ -49,7 +49,11 @@
#include "SpellHistory.h" #include "SpellHistory.h"
#else #else
#include "Config/Config.h" #include "Config/Config.h"
#ifdef CMANGOS
#include "AI/AggressorAI.h"
#else
#include "AggressorAI.h" #include "AggressorAI.h"
#endif
#include "BattleGroundMgr.h" #include "BattleGroundMgr.h"
#include "SQLStorages.h" #include "SQLStorages.h"
#include "revision.h" #include "revision.h"

View File

@@ -291,7 +291,11 @@ namespace LuaGroup
bool ignorePlayersInBg = Eluna::CHECKVAL<bool>(L, 3); bool ignorePlayersInBg = Eluna::CHECKVAL<bool>(L, 3);
uint64 ignore = Eluna::CHECKVAL<uint64>(L, 4); uint64 ignore = Eluna::CHECKVAL<uint64>(L, 4);
#ifdef CMANGOS
group->BroadcastPacket(*data, ignorePlayersInBg, -1, ObjectGuid(ignore));
#else
group->BroadcastPacket(data, ignorePlayersInBg, -1, ObjectGuid(ignore)); group->BroadcastPacket(data, ignorePlayersInBg, -1, ObjectGuid(ignore));
#endif
return 0; return 0;
} }

View File

@@ -195,7 +195,11 @@ 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;
} }
@@ -211,7 +215,11 @@ 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;
} }

View File

@@ -66,7 +66,11 @@ bool Eluna::OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets)
data << ObjectGuid(guid); data << ObjectGuid(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;
} }

View File

@@ -123,13 +123,9 @@ class TC_GAME_API Eluna
{ {
public: public:
typedef std::list<LuaScript> ScriptList; typedef std::list<LuaScript> ScriptList;
#ifdef TRINITY
typedef std::recursive_mutex LockType; typedef std::recursive_mutex LockType;
typedef std::lock_guard<LockType> Guard; typedef std::lock_guard<LockType> Guard;
#else
typedef ACE_Recursive_Thread_Mutex LockType;
typedef ACE_Guard<LockType> Guard;
#endif
private: private:
static bool reload; static bool reload;

View File

@@ -2155,7 +2155,11 @@ namespace LuaPlayer
data << uint64(summoner->GetGUIDLow()); data << uint64(summoner->GetGUIDLow());
data << uint32(summoner->GetZoneId()); data << uint32(summoner->GetZoneId());
data << uint32(MAX_PLAYER_SUMMON_DELAY * IN_MILLISECONDS); data << uint32(MAX_PLAYER_SUMMON_DELAY * IN_MILLISECONDS);
#ifdef CMANGOS
player->GetSession()->SendPacket(data);
#else
player->GetSession()->SendPacket(&data); player->GetSession()->SendPacket(&data);
#endif
#endif #endif
return 0; return 0;
} }
@@ -2231,7 +2235,11 @@ namespace LuaPlayer
#endif #endif
data << uint32(ahEntry->houseId); data << uint32(ahEntry->houseId);
data << uint8(1); data << uint8(1);
#ifdef CMANGOS
player->GetSession()->SendPacket(data);
#else
player->GetSession()->SendPacket(&data); player->GetSession()->SendPacket(&data);
#endif
return 0; return 0;
} }
@@ -3492,10 +3500,17 @@ namespace LuaPlayer
{ {
WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(L, 2); WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(L, 2);
bool selfOnly = Eluna::CHECKVAL<bool>(L, 3, true); bool selfOnly = Eluna::CHECKVAL<bool>(L, 3, true);
#ifdef CMANGOS
if (selfOnly)
player->GetSession()->SendPacket(*data);
else
player->SendMessageToSet(*data, true);
#else
if (selfOnly) if (selfOnly)
player->GetSession()->SendPacket(data); player->GetSession()->SendPacket(data);
else else
player->SendMessageToSet(data, true); player->SendMessageToSet(data, true);
#endif
return 0; return 0;
} }
@@ -3529,7 +3544,11 @@ namespace LuaPlayer
data << uint32(fullmsg.length() + 1); data << uint32(fullmsg.length() + 1);
data << fullmsg; data << fullmsg;
data << uint8(0); data << uint8(0);
#ifdef CMANGOS
receiver->GetSession()->SendPacket(data);
#else
receiver->GetSession()->SendPacket(&data); receiver->GetSession()->SendPacket(&data);
#endif
return 0; return 0;
} }
@@ -3736,7 +3755,11 @@ namespace LuaPlayer
packet << icon; packet << icon;
packet << data; packet << data;
packet << iconText; packet << iconText;
#ifdef CMANGOS
player->GetSession()->SendPacket(packet);
#else
player->GetSession()->SendPacket(&packet); player->GetSession()->SendPacket(&packet);
#endif
return 0; return 0;
} }
@@ -3842,7 +3865,11 @@ namespace LuaPlayer
#if defined(CLASSIC) || defined(TBC) #if defined(CLASSIC) || defined(TBC)
WorldPacket data(SMSG_GROUP_INVITE, 10); // guess size WorldPacket data(SMSG_GROUP_INVITE, 10); // guess size
data << player->GetName(); data << player->GetName();
#ifdef CMANGOS
invited->GetSession()->SendPacket(data);
#else
invited->GetSession()->SendPacket(&data); invited->GetSession()->SendPacket(&data);
#endif
#else #else
WorldPacket data(SMSG_GROUP_INVITE, 10); // guess size WorldPacket data(SMSG_GROUP_INVITE, 10); // guess size
data << uint8(1); // invited/already in group flag data << uint8(1); // invited/already in group flag

View File

@@ -1998,7 +1998,11 @@ namespace LuaUnit
#else #else
ChatHandler::BuildChatPacket(data, ChatMsg(type), msg.c_str(), Language(lang), 0, unit->GET_GUID(), unit->GetName(), target->GET_GUID(), target->GetName()); ChatHandler::BuildChatPacket(data, ChatMsg(type), msg.c_str(), Language(lang), 0, unit->GET_GUID(), unit->GetName(), target->GET_GUID(), target->GetName());
#endif #endif
#ifdef CMANGOS
target->GetSession()->SendPacket(data);
#else
target->GetSession()->SendPacket(&data); target->GetSession()->SendPacket(&data);
#endif
return 0; return 0;
} }
@@ -2286,7 +2290,11 @@ namespace LuaUnit
if (!spellEntry) if (!spellEntry)
return 0; return 0;
#ifdef CMANGOS
unit->CastSpell(target, spell, TRIGGERED_OLD_TRIGGERED);
#else
unit->CastSpell(target, spell, triggered); unit->CastSpell(target, spell, triggered);
#endif
return 0; return 0;
} }
@@ -2337,7 +2345,11 @@ namespace LuaUnit
float _z = Eluna::CHECKVAL<float>(L, 4); float _z = Eluna::CHECKVAL<float>(L, 4);
uint32 spell = Eluna::CHECKVAL<uint32>(L, 5); uint32 spell = Eluna::CHECKVAL<uint32>(L, 5);
bool triggered = Eluna::CHECKVAL<bool>(L, 6, true); bool triggered = Eluna::CHECKVAL<bool>(L, 6, true);
#ifdef CMANGOS
unit->CastSpell(_x, _y, _z, spell, TRIGGERED_OLD_TRIGGERED);
#else
unit->CastSpell(_x, _y, _z, spell, triggered); unit->CastSpell(_x, _y, _z, spell, triggered);
#endif
return 0; return 0;
} }

View File

@@ -656,7 +656,11 @@ namespace LuaWorldObject
int SendPacket(Eluna* /*E*/, lua_State* L, WorldObject* obj) int SendPacket(Eluna* /*E*/, 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;
} }
@@ -868,10 +872,17 @@ 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;
} }