diff --git a/CreatureMethods.h b/CreatureMethods.h index d3bf10a..443f028 100644 --- a/CreatureMethods.h +++ b/CreatureMethods.h @@ -121,10 +121,10 @@ namespace LuaCreature { Player* player = Eluna::CHECKOBJ(L, 2); -#ifdef MANGOS - Eluna::Push(L, creature->IsTappedBy(player)); -#else +#ifdef TRINITY Eluna::Push(L, creature->isTappedBy(player)); +#else + Eluna::Push(L, creature->IsTappedBy(player)); #endif return 1; } @@ -1102,7 +1102,11 @@ namespace LuaCreature data.Initialize(SMSG_MOVE_UNSET_HOVER, 8 + 4); data << creature->GetPackGUID(); data << uint32(0); +#ifdef CMANGOS + creature->SendMessageToSet(data, true); +#else creature->SendMessageToSet(&data, true); +#endif #endif return 0; } diff --git a/ElunaIncludes.h b/ElunaIncludes.h index e97eac7..99dabd1 100644 --- a/ElunaIncludes.h +++ b/ElunaIncludes.h @@ -49,7 +49,11 @@ #include "SpellHistory.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" diff --git a/GroupMethods.h b/GroupMethods.h index 2f99e50..b436690 100644 --- a/GroupMethods.h +++ b/GroupMethods.h @@ -291,7 +291,11 @@ namespace LuaGroup bool ignorePlayersInBg = Eluna::CHECKVAL(L, 3); uint64 ignore = Eluna::CHECKVAL(L, 4); +#ifdef CMANGOS + group->BroadcastPacket(*data, ignorePlayersInBg, -1, ObjectGuid(ignore)); +#else group->BroadcastPacket(data, ignorePlayersInBg, -1, ObjectGuid(ignore)); +#endif return 0; } diff --git a/GuildMethods.h b/GuildMethods.h index 665ae0a..aa26228 100644 --- a/GuildMethods.h +++ b/GuildMethods.h @@ -195,7 +195,11 @@ namespace LuaGuild { WorldPacket* data = Eluna::CHECKOBJ(L, 2); +#ifdef CMANGOS + guild->BroadcastPacket(*data); +#else guild->BroadcastPacket(data); +#endif return 0; } @@ -211,7 +215,11 @@ namespace LuaGuild WorldPacket* data = Eluna::CHECKOBJ(L, 2); uint8 ranked = Eluna::CHECKVAL(L, 3); +#ifdef CMANGOS + guild->BroadcastPacketToRank(*data, ranked); +#else guild->BroadcastPacketToRank(data, ranked); +#endif return 0; } diff --git a/ItemHooks.cpp b/ItemHooks.cpp index baf00e8..e172195 100644 --- a/ItemHooks.cpp +++ b/ItemHooks.cpp @@ -66,7 +66,11 @@ bool Eluna::OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets) data << ObjectGuid(guid); data << ObjectGuid(uint64(0)); data << uint8(0); +#ifdef CMANGOS + pPlayer->GetSession()->SendPacket(data); +#else pPlayer->GetSession()->SendPacket(&data); +#endif return false; } diff --git a/LuaEngine.h b/LuaEngine.h index 269acf9..93bc88a 100644 --- a/LuaEngine.h +++ b/LuaEngine.h @@ -123,13 +123,9 @@ class TC_GAME_API Eluna { public: typedef std::list ScriptList; -#ifdef TRINITY + typedef std::recursive_mutex LockType; typedef std::lock_guard Guard; -#else - typedef ACE_Recursive_Thread_Mutex LockType; - typedef ACE_Guard Guard; -#endif private: static bool reload; diff --git a/PlayerMethods.h b/PlayerMethods.h index 39fff49..622ceb1 100644 --- a/PlayerMethods.h +++ b/PlayerMethods.h @@ -2155,7 +2155,11 @@ namespace LuaPlayer data << uint64(summoner->GetGUIDLow()); data << uint32(summoner->GetZoneId()); data << uint32(MAX_PLAYER_SUMMON_DELAY * IN_MILLISECONDS); +#ifdef CMANGOS + player->GetSession()->SendPacket(data); +#else player->GetSession()->SendPacket(&data); +#endif #endif return 0; } @@ -2231,7 +2235,11 @@ namespace LuaPlayer #endif data << uint32(ahEntry->houseId); data << uint8(1); +#ifdef CMANGOS + player->GetSession()->SendPacket(data); +#else player->GetSession()->SendPacket(&data); +#endif return 0; } @@ -3492,10 +3500,17 @@ namespace LuaPlayer { WorldPacket* data = Eluna::CHECKOBJ(L, 2); bool selfOnly = Eluna::CHECKVAL(L, 3, true); +#ifdef CMANGOS + if (selfOnly) + player->GetSession()->SendPacket(*data); + else + player->SendMessageToSet(*data, true); +#else if (selfOnly) player->GetSession()->SendPacket(data); else player->SendMessageToSet(data, true); +#endif return 0; } @@ -3529,7 +3544,11 @@ namespace LuaPlayer data << uint32(fullmsg.length() + 1); data << fullmsg; data << uint8(0); +#ifdef CMANGOS + receiver->GetSession()->SendPacket(data); +#else receiver->GetSession()->SendPacket(&data); +#endif return 0; } @@ -3736,7 +3755,11 @@ namespace LuaPlayer packet << icon; packet << data; packet << iconText; +#ifdef CMANGOS + player->GetSession()->SendPacket(packet); +#else player->GetSession()->SendPacket(&packet); +#endif return 0; } @@ -3842,7 +3865,11 @@ namespace LuaPlayer #if defined(CLASSIC) || defined(TBC) WorldPacket data(SMSG_GROUP_INVITE, 10); // guess size data << player->GetName(); +#ifdef CMANGOS + invited->GetSession()->SendPacket(data); +#else invited->GetSession()->SendPacket(&data); +#endif #else WorldPacket data(SMSG_GROUP_INVITE, 10); // guess size data << uint8(1); // invited/already in group flag diff --git a/UnitMethods.h b/UnitMethods.h index ef7585e..5b9feab 100644 --- a/UnitMethods.h +++ b/UnitMethods.h @@ -1998,7 +1998,11 @@ namespace LuaUnit #else ChatHandler::BuildChatPacket(data, ChatMsg(type), msg.c_str(), Language(lang), 0, unit->GET_GUID(), unit->GetName(), target->GET_GUID(), target->GetName()); #endif +#ifdef CMANGOS + target->GetSession()->SendPacket(data); +#else target->GetSession()->SendPacket(&data); +#endif return 0; } @@ -2286,7 +2290,11 @@ namespace LuaUnit if (!spellEntry) return 0; +#ifdef CMANGOS + unit->CastSpell(target, spell, TRIGGERED_OLD_TRIGGERED); +#else unit->CastSpell(target, spell, triggered); +#endif return 0; } @@ -2337,7 +2345,11 @@ namespace LuaUnit float _z = Eluna::CHECKVAL(L, 4); uint32 spell = Eluna::CHECKVAL(L, 5); bool triggered = Eluna::CHECKVAL(L, 6, true); +#ifdef CMANGOS + unit->CastSpell(_x, _y, _z, spell, TRIGGERED_OLD_TRIGGERED); +#else unit->CastSpell(_x, _y, _z, spell, triggered); +#endif return 0; } diff --git a/WorldObjectMethods.h b/WorldObjectMethods.h index dd9d9eb..78ee720 100644 --- a/WorldObjectMethods.h +++ b/WorldObjectMethods.h @@ -656,7 +656,11 @@ namespace LuaWorldObject int SendPacket(Eluna* /*E*/, lua_State* L, WorldObject* obj) { WorldPacket* data = Eluna::CHECKOBJ(L, 2); +#ifdef CMANGOS + obj->SendMessageToSet(*data, true); +#else obj->SendMessageToSet(data, true); +#endif return 0; } @@ -868,10 +872,17 @@ namespace LuaWorldObject WorldPacket data(SMSG_PLAY_MUSIC, 4); data << uint32(musicid); +#ifdef CMANGOS + if (player) + player->SendDirectMessage(data); + else + obj->SendMessageToSet(data, true); +#else if (player) player->SendDirectMessage(&data); else obj->SendMessageToSet(&data, true); +#endif return 0; }