diff options
author | Shauren <shauren.trinity@gmail.com> | 2012-10-27 12:19:29 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2012-10-27 12:19:29 +0200 |
commit | 3b4b536fd04d71aae8d79906a7c552fde7c6a9f1 (patch) | |
tree | b9176aa21321f20f8d594755f516ce87dbf3820b /src | |
parent | aa30f9c5f553f08999d267cb38458c25ad83a151 (diff) |
Core/Battlegrounds: Minor cleanup
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Battlegrounds/BattlegroundMgr.cpp | 242 |
1 files changed, 121 insertions, 121 deletions
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index d090db1268a..070f974e65a 100755 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -163,13 +163,15 @@ void BattlegroundMgr::Update(uint32 diff) } } -void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battleground *bg, Player * pPlayer, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype, uint8 /*uiFrame*/) +void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battleground *bg, Player * player, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype, uint8 /*uiFrame*/) { - if (!bg) - StatusID = STATUS_NONE; + ObjectGuid playerGuid = player->GetGUID(); + ObjectGuid bgGuid; - ObjectGuid guidBytes1 = pPlayer->GetGUID(); - ObjectGuid guidBytes2 = bg->GetGUID(); + if (bg) + bgGuid = bg->GetGUID(); + else + StatusID = STATUS_NONE; switch (StatusID) { @@ -177,82 +179,82 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battlegro { data->Initialize(SMSG_BATTLEFIELD_STATUS); - data->WriteBit(guidBytes1[0]); - data->WriteBit(guidBytes1[4]); - data->WriteBit(guidBytes1[7]); - data->WriteBit(guidBytes1[1]); - data->WriteBit(guidBytes1[6]); - data->WriteBit(guidBytes1[3]); - data->WriteBit(guidBytes1[5]); - data->WriteBit(guidBytes1[2]); + data->WriteBit(playerGuid[0]); + data->WriteBit(playerGuid[4]); + data->WriteBit(playerGuid[7]); + data->WriteBit(playerGuid[1]); + data->WriteBit(playerGuid[6]); + data->WriteBit(playerGuid[3]); + data->WriteBit(playerGuid[5]); + data->WriteBit(playerGuid[2]); data->FlushBits(); - data->WriteByteSeq(guidBytes1[5]); - data->WriteByteSeq(guidBytes1[6]); - data->WriteByteSeq(guidBytes1[7]); - data->WriteByteSeq(guidBytes1[2]); + data->WriteByteSeq(playerGuid[5]); + data->WriteByteSeq(playerGuid[6]); + data->WriteByteSeq(playerGuid[7]); + data->WriteByteSeq(playerGuid[2]); *data << uint32(1); // unk, always 1 - data->WriteByteSeq(guidBytes1[3]); - data->WriteByteSeq(guidBytes1[1]); + data->WriteByteSeq(playerGuid[3]); + data->WriteByteSeq(playerGuid[1]); *data << uint32(QueueSlot); // Queue slot *data << uint32(Time1); // Join Time - data->WriteByteSeq(guidBytes1[0]); - data->WriteByteSeq(guidBytes1[4]); + data->WriteByteSeq(playerGuid[0]); + data->WriteByteSeq(playerGuid[4]); break; } case STATUS_WAIT_QUEUE: { data->Initialize(SMSG_BATTLEFIELD_STATUS_QUEUED); - data->WriteBit(guidBytes1[3]); - data->WriteBit(guidBytes1[0]); - data->WriteBit(guidBytes2[3]); - data->WriteBit(guidBytes1[2]); + data->WriteBit(playerGuid[3]); + data->WriteBit(playerGuid[0]); + data->WriteBit(bgGuid[3]); + data->WriteBit(playerGuid[2]); data->WriteBit(1); // Eligible In Queue data->WriteBit(0); // Join Failed - data->WriteBit(guidBytes2[2]); - data->WriteBit(guidBytes1[1]); - data->WriteBit(guidBytes2[0]); - data->WriteBit(guidBytes2[6]); - data->WriteBit(guidBytes2[4]); - data->WriteBit(guidBytes1[6]); - data->WriteBit(guidBytes1[7]); - data->WriteBit(guidBytes2[7]); - data->WriteBit(guidBytes2[5]); - data->WriteBit(guidBytes1[4]); - data->WriteBit(guidBytes1[5]); + data->WriteBit(bgGuid[2]); + data->WriteBit(playerGuid[1]); + data->WriteBit(bgGuid[0]); + data->WriteBit(bgGuid[6]); + data->WriteBit(bgGuid[4]); + data->WriteBit(playerGuid[6]); + data->WriteBit(playerGuid[7]); + data->WriteBit(bgGuid[7]); + data->WriteBit(bgGuid[5]); + data->WriteBit(playerGuid[4]); + data->WriteBit(playerGuid[5]); data->WriteBit(bg->isRated()); // Is Rated data->WriteBit(0); // Waiting On Other Activity - data->WriteBit(guidBytes2[1]); + data->WriteBit(bgGuid[1]); data->FlushBits(); - data->WriteByteSeq(guidBytes1[0]); + data->WriteByteSeq(playerGuid[0]); *data << uint32(1); // unk, always 1 - data->WriteByteSeq(guidBytes2[5]); - data->WriteByteSeq(guidBytes1[3]); + data->WriteByteSeq(bgGuid[5]); + data->WriteByteSeq(playerGuid[3]); *data << uint32(Time1); // Estimated Wait Time - data->WriteByteSeq(guidBytes2[7]); - data->WriteByteSeq(guidBytes2[1]); - data->WriteByteSeq(guidBytes2[2]); + data->WriteByteSeq(bgGuid[7]); + data->WriteByteSeq(bgGuid[1]); + data->WriteByteSeq(bgGuid[2]); *data << uint8(0); // unk - data->WriteByteSeq(guidBytes2[4]); - data->WriteByteSeq(guidBytes1[2]); + data->WriteByteSeq(bgGuid[4]); + data->WriteByteSeq(playerGuid[2]); *data << uint8(0); // Player count in rated mode - data->WriteByteSeq(guidBytes2[6]); - data->WriteByteSeq(guidBytes1[7]); - data->WriteByteSeq(guidBytes2[3]); - data->WriteByteSeq(guidBytes1[6]); - data->WriteByteSeq(guidBytes2[0]); + data->WriteByteSeq(bgGuid[6]); + data->WriteByteSeq(playerGuid[7]); + data->WriteByteSeq(bgGuid[3]); + data->WriteByteSeq(playerGuid[6]); + data->WriteByteSeq(bgGuid[0]); *data << uint32(Time2); // Join Time *data << uint32(QueueSlot); // Queue slot *data << uint8(bg->GetMinLevel()); // Min Level *data << uint32(GetMSTimeDiffToNow(Time2)); // Time since joined - data->WriteByteSeq(guidBytes1[1]); - data->WriteByteSeq(guidBytes1[5]); + data->WriteByteSeq(playerGuid[1]); + data->WriteByteSeq(playerGuid[5]); *data << uint32(bg->GetClientInstanceID()); // Client Instance ID - data->WriteByteSeq(guidBytes1[4]); + data->WriteByteSeq(playerGuid[4]); break; } case STATUS_WAIT_JOIN: @@ -269,83 +271,83 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battlegro *data << uint32(bg->GetMapId()); // Map Id *data << uint8(0); // Player count in rated mode - data->WriteBit(guidBytes1[5]); - data->WriteBit(guidBytes1[2]); - data->WriteBit(guidBytes1[1]); - data->WriteBit(guidBytes2[2]); - data->WriteBit(guidBytes1[4]); - data->WriteBit(guidBytes2[6]); - data->WriteBit(guidBytes2[3]); + data->WriteBit(playerGuid[5]); + data->WriteBit(playerGuid[2]); + data->WriteBit(playerGuid[1]); + data->WriteBit(bgGuid[2]); + data->WriteBit(playerGuid[4]); + data->WriteBit(bgGuid[6]); + data->WriteBit(bgGuid[3]); data->WriteBit(bg->isRated()); // Is Rated - data->WriteBit(guidBytes1[7]); - data->WriteBit(guidBytes1[3]); - data->WriteBit(guidBytes2[7]); - data->WriteBit(guidBytes2[0]); - data->WriteBit(guidBytes2[4]); - data->WriteBit(guidBytes1[6]); - data->WriteBit(guidBytes2[1]); - data->WriteBit(guidBytes2[5]); - data->WriteBit(guidBytes1[0]); + data->WriteBit(playerGuid[7]); + data->WriteBit(playerGuid[3]); + data->WriteBit(bgGuid[7]); + data->WriteBit(bgGuid[0]); + data->WriteBit(bgGuid[4]); + data->WriteBit(playerGuid[6]); + data->WriteBit(bgGuid[1]); + data->WriteBit(bgGuid[5]); + data->WriteBit(playerGuid[0]); data->FlushBits(); - data->WriteByteSeq(guidBytes2[6]); - data->WriteByteSeq(guidBytes2[5]); - data->WriteByteSeq(guidBytes2[7]); - data->WriteByteSeq(guidBytes2[2]); - data->WriteByteSeq(guidBytes1[0]); - data->WriteByteSeq(guidBytes1[7]); - data->WriteByteSeq(guidBytes2[4]); - data->WriteByteSeq(guidBytes1[1]); - data->WriteByteSeq(guidBytes2[0]); - data->WriteByteSeq(guidBytes1[4]); - data->WriteByteSeq(guidBytes2[1]); - data->WriteByteSeq(guidBytes1[5]); - data->WriteByteSeq(guidBytes2[3]); - data->WriteByteSeq(guidBytes1[6]); - data->WriteByteSeq(guidBytes1[2]); - data->WriteByteSeq(guidBytes1[3]); + data->WriteByteSeq(bgGuid[6]); + data->WriteByteSeq(bgGuid[5]); + data->WriteByteSeq(bgGuid[7]); + data->WriteByteSeq(bgGuid[2]); + data->WriteByteSeq(playerGuid[0]); + data->WriteByteSeq(playerGuid[7]); + data->WriteByteSeq(bgGuid[4]); + data->WriteByteSeq(playerGuid[1]); + data->WriteByteSeq(bgGuid[0]); + data->WriteByteSeq(playerGuid[4]); + data->WriteByteSeq(bgGuid[1]); + data->WriteByteSeq(playerGuid[5]); + data->WriteByteSeq(bgGuid[3]); + data->WriteByteSeq(playerGuid[6]); + data->WriteByteSeq(playerGuid[2]); + data->WriteByteSeq(playerGuid[3]); break; } case STATUS_IN_PROGRESS: { data->Initialize(SMSG_BATTLEFIELD_STATUS_ACTIVE); - data->WriteBit(guidBytes1[2]); - data->WriteBit(guidBytes1[7]); - data->WriteBit(guidBytes2[7]); - data->WriteBit(guidBytes2[1]); - data->WriteBit(guidBytes1[5]); - data->WriteBit(bg->GetPlayerTeam(guidBytes1) == ALLIANCE); // Battlefield Faction ( 0 horde, 1 alliance ) - data->WriteBit(guidBytes2[0]); - data->WriteBit(guidBytes1[1]); - data->WriteBit(guidBytes2[3]); - data->WriteBit(guidBytes1[6]); - data->WriteBit(guidBytes2[5]); + data->WriteBit(playerGuid[2]); + data->WriteBit(playerGuid[7]); + data->WriteBit(bgGuid[7]); + data->WriteBit(bgGuid[1]); + data->WriteBit(playerGuid[5]); + data->WriteBit(player->GetBGTeam() == ALLIANCE); // Battlefield Faction ( 0 horde, 1 alliance ) + data->WriteBit(bgGuid[0]); + data->WriteBit(playerGuid[1]); + data->WriteBit(bgGuid[3]); + data->WriteBit(playerGuid[6]); + data->WriteBit(bgGuid[5]); data->WriteBit(0); // unk, Bit 64 - data->WriteBit(guidBytes1[4]); - data->WriteBit(guidBytes2[6]); - data->WriteBit(guidBytes2[4]); - data->WriteBit(guidBytes2[2]); - data->WriteBit(guidBytes1[3]); - data->WriteBit(guidBytes1[0]); + data->WriteBit(playerGuid[4]); + data->WriteBit(bgGuid[6]); + data->WriteBit(bgGuid[4]); + data->WriteBit(bgGuid[2]); + data->WriteBit(playerGuid[3]); + data->WriteBit(playerGuid[0]); data->FlushBits(); - data->WriteByteSeq(guidBytes2[4]); - data->WriteByteSeq(guidBytes2[5]); - data->WriteByteSeq(guidBytes1[5]); - data->WriteByteSeq(guidBytes2[1]); - data->WriteByteSeq(guidBytes2[6]); - data->WriteByteSeq(guidBytes2[3]); - data->WriteByteSeq(guidBytes2[7]); - data->WriteByteSeq(guidBytes1[6]); + data->WriteByteSeq(bgGuid[4]); + data->WriteByteSeq(bgGuid[5]); + data->WriteByteSeq(playerGuid[5]); + data->WriteByteSeq(bgGuid[1]); + data->WriteByteSeq(bgGuid[6]); + data->WriteByteSeq(bgGuid[3]); + data->WriteByteSeq(bgGuid[7]); + data->WriteByteSeq(playerGuid[6]); *data << uint32(Time1); // Join Time *data << uint8(arenatype); // Teamsize (0 if not arena) - data->WriteByteSeq(guidBytes1[4]); - data->WriteByteSeq(guidBytes1[1]); + data->WriteByteSeq(playerGuid[4]); + data->WriteByteSeq(playerGuid[1]); *data << uint32(QueueSlot); // Queue slot *data << uint8(0); // Player count in rated mode @@ -354,17 +356,17 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battlegro *data << uint8(bg->GetMinLevel()); // Min Level *data << uint32(Time2); // Elapsed Time - data->WriteByteSeq(guidBytes1[2]); + data->WriteByteSeq(playerGuid[2]); *data << uint32(getMSTimeDiff(bg->GetRemainingTime(), Time2)); // Remaining Time - data->WriteByteSeq(guidBytes1[0]); - data->WriteByteSeq(guidBytes1[3]); - data->WriteByteSeq(guidBytes1[2]); + data->WriteByteSeq(playerGuid[0]); + data->WriteByteSeq(playerGuid[3]); + data->WriteByteSeq(playerGuid[2]); *data << uint32(bg->GetClientInstanceID()); // Client Instance ID - data->WriteByteSeq(guidBytes2[0]); - data->WriteByteSeq(guidBytes1[7]); + data->WriteByteSeq(bgGuid[0]); + data->WriteByteSeq(playerGuid[7]); break; } case STATUS_WAIT_LEAVE: @@ -422,7 +424,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg) data->WriteBit(guid[5]); data->WriteBit(guid[1]); data->WriteBit(guid[6]); - data->WriteBit(player->GetTeam() == ALLIANCE); + data->WriteBit(player->GetBGTeam() == ALLIANCE); data->WriteBit(guid[7]); buff << uint32(itr2->second->HealingDone); // healing done @@ -1215,8 +1217,6 @@ void BattlegroundMgr::SendToBattleground(Player* player, uint32 instanceId, Batt float x, y, z, O; uint32 mapid = bg->GetMapId(); uint32 team = player->GetBGTeam(); - if (team == 0) - team = player->GetTeam(); bg->GetTeamStartLoc(team, x, y, z, O); sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundMgr::SendToBattleground: Sending %s to map %u, X %f, Y %f, Z %f, O %f (bgType %u)", player->GetName(), mapid, x, y, z, O, bgTypeId); |