diff options
| author | Spp <spp@jorge.gr> | 2011-09-29 10:21:33 +0200 |
|---|---|---|
| committer | Spp <spp@jorge.gr> | 2011-09-29 10:21:33 +0200 |
| commit | 8b820baa7324d41df264f48e344d62584bff70f8 (patch) | |
| tree | 4971b3df4ca7345646b5630e9c0e061ca22eb097 /src/server/game/Server | |
| parent | 9e517c963b8769d152b408a1e82e5fda907b5417 (diff) | |
Core/Battleground: Use a general solution for MSG_BATTLEGROUND_PLAYER_POSITIONS
Diffstat (limited to 'src/server/game/Server')
| -rwxr-xr-x | src/server/game/Server/Protocol/Handlers/BattleGroundHandler.cpp | 77 |
1 files changed, 31 insertions, 46 deletions
diff --git a/src/server/game/Server/Protocol/Handlers/BattleGroundHandler.cpp b/src/server/game/Server/Protocol/Handlers/BattleGroundHandler.cpp index 1810016d22e..efdcb5f4e1e 100755 --- a/src/server/game/Server/Protocol/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/BattleGroundHandler.cpp @@ -25,7 +25,6 @@ #include "ArenaTeam.h" #include "BattlegroundMgr.h" -#include "BattlegroundWS.h" #include "Battleground.h" #include "Chat.h" #include "Language.h" @@ -252,56 +251,42 @@ void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket & /*recv_ if (!bg) // can't be received if player not in battleground return; - switch(bg->GetTypeID(true)) - { - case BATTLEGROUND_WS: - { - uint32 count = 0; + uint32 count = 0; + Player* aplr = NULL; + Player* hplr = NULL; - Player* aplr = ObjectAccessor::FindPlayer(((BattlegroundWS*)bg)->GetAllianceFlagPickerGUID()); - if (aplr) - ++count; - - Player* hplr = ObjectAccessor::FindPlayer(((BattlegroundWS*)bg)->GetHordeFlagPickerGUID()); - if (hplr) - ++count; + if (uint64 guid = bg->GetFlagPickerGUID(BG_TEAM_ALLIANCE)) + { + aplr = ObjectAccessor::FindPlayer(guid); + if (aplr) + ++count; + } - WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, 4 + 4 + 16 * count); - data << 0; - data << count; - if (aplr) - { - data << uint64(aplr->GetGUID()); - data << float(aplr->GetPositionX()); - data << float(aplr->GetPositionY()); - } + if (uint64 guid = bg->GetFlagPickerGUID(BG_TEAM_HORDE)) + { + hplr = ObjectAccessor::FindPlayer(guid); + if (hplr) + ++count; + } - if (hplr) - { - data << uint64(hplr->GetGUID()); - data << float(hplr->GetPositionX()); - data << float(hplr->GetPositionY()); - } + WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, 4 + 4 + 16 * count); + data << 0; + data << count; + if (aplr) + { + data << uint64(aplr->GetGUID()); + data << float(aplr->GetPositionX()); + data << float(aplr->GetPositionY()); + } - SendPacket(&data); - break; - } - case BATTLEGROUND_EY: - //TODO : fix me! - break; - case BATTLEGROUND_AB: - case BATTLEGROUND_AV: - { - WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4+4)); - data << uint32(0); - data << uint32(0); - SendPacket(&data); - break; - } - default: - //maybe it is sent also in arena - do nothing - break; + if (hplr) + { + data << uint64(hplr->GetGUID()); + data << float(hplr->GetPositionX()); + data << float(hplr->GetPositionY()); } + + SendPacket(&data); } void WorldSession::HandlePVPLogDataOpcode(WorldPacket & /*recv_data*/) |
