aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Battlegrounds/BattlegroundMgr.cpp
diff options
context:
space:
mode:
authorVincent-Michael <Vincent_Michael@gmx.de>2014-06-28 21:07:41 +0200
committerVincent-Michael <Vincent_Michael@gmx.de>2014-06-28 21:07:41 +0200
commit3b1c659b60410f6d44d366274815aaa0f7ade84f (patch)
treef23964fe79ce7ddf46d63631ddaacd0e0ff3cf1a /src/server/game/Battlegrounds/BattlegroundMgr.cpp
parentf3de6f028403b6b6eb59b8cb59cb15419ea47932 (diff)
parent68958205d40cbadd2e5ad7d88f68accceedfb041 (diff)
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts: src/server/game/Battlegrounds/ArenaTeam.h src/server/game/Battlegrounds/BattlegroundMgr.cpp src/server/game/Battlegrounds/BattlegroundMgr.h src/server/game/Globals/ObjectMgr.cpp src/server/game/Globals/ObjectMgr.h
Diffstat (limited to 'src/server/game/Battlegrounds/BattlegroundMgr.cpp')
-rw-r--r--src/server/game/Battlegrounds/BattlegroundMgr.cpp248
1 files changed, 0 insertions, 248 deletions
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
index 3f39f8e3715..d5154260ed2 100644
--- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
@@ -355,254 +355,6 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket* data, Battlegro
}
}
-void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
-{
- ByteBuffer buff;
- uint8 isRated = (bg->isRated() ? 1 : 0); // type (normal=0/rated=1) -- ATM arena or bg, RBG NYI
- uint8 isArena = (bg->isArena() ? 1 : 0); // Arena names
-
- data->Initialize(SMSG_PVP_LOG_DATA, (1+1+4+40*bg->GetPlayerScoresSize()));
- data->WriteBit(isArena);
- data->WriteBit(isRated);
-
- if (isArena)
- {
- for (int8 i = 0; i < BG_TEAMS_COUNT; ++i)
- {
- if (ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(bg->GetArenaTeamIdByIndex(i)))
- data->WriteBits(at->GetName().length(), 8);
- else
- data->WriteBits(0, 8);
- }
- }
-
- size_t count_pos = data->bitwpos();
- data->WriteBits(0, 21);
- uint32 count = 0;
- Battleground::BattlegroundPlayerMap const& bgPlayers = bg->GetPlayers();
-
- for (Battleground::BattlegroundScoreMap::const_iterator itr = bg->GetPlayerScoresBegin(); itr != bg->GetPlayerScoresEnd(); ++itr)
- {
- if (!bg->IsPlayerInBattleground(itr->first))
- {
- TC_LOG_ERROR("bg.battleground", "Player " UI64FMTD " has scoreboard entry for battleground %u but is not in battleground!", itr->first, bg->GetTypeID(true));
- continue;
- }
-
- uint32 team;
- int32 primaryTree;
- if (Player* player = ObjectAccessor::FindPlayer(itr->first))
- {
- team = player->GetBGTeam();
- primaryTree = player->GetPrimaryTalentTree(player->GetActiveSpec());
- }
- else
- {
- Battleground::BattlegroundPlayerMap::const_iterator itr2 = bgPlayers.find(itr->first);
- if (itr2 == bgPlayers.end())
- {
- TC_LOG_ERROR("bg.battleground", "Player " UI64FMTD " has scoreboard entry for battleground %u but do not have battleground data!", itr->first, bg->GetTypeID(true));
- continue;
- }
-
- team = itr2->second.Team;
- primaryTree = itr2->second.PrimaryTree;
- }
-
- ObjectGuid playerGUID = itr->first;
- BattlegroundScore* score = itr->second;
-
- data->WriteBit(0); // Unk 1
- data->WriteBit(0); // Unk 2
- data->WriteBit(playerGUID[2]);
- data->WriteBit(!isArena);
- data->WriteBit(0); // Unk 4
- data->WriteBit(0); // Unk 5
- data->WriteBit(0); // Unk 6
- data->WriteBit(playerGUID[3]);
- data->WriteBit(playerGUID[0]);
- data->WriteBit(playerGUID[5]);
- data->WriteBit(playerGUID[1]);
- data->WriteBit(playerGUID[6]);
- data->WriteBit(team == HORDE ? 0 : 1);
- data->WriteBit(playerGUID[7]);
-
- buff << uint32(score->HealingDone); // healing done
- buff << uint32(score->DamageDone); // damage done
-
- if (!isArena)
- {
- buff << uint32(score->BonusHonor / 100);
- buff << uint32(score->Deaths);
- buff << uint32(score->HonorableKills);
- }
-
- buff.WriteByteSeq(playerGUID[4]);
- buff << uint32(score->KillingBlows);
- // if (unk 5) << uint32() unk
- buff.WriteByteSeq(playerGUID[5]);
- // if (unk 6) << uint32() unk
- // if (unk 2) << uint32() unk
- buff.WriteByteSeq(playerGUID[1]);
- buff.WriteByteSeq(playerGUID[6]);
-
- buff << int32(primaryTree);
-
- switch (bg->GetTypeID(true)) // Custom values
- {
- case BATTLEGROUND_RB:
- switch (bg->GetMapId())
- {
- case 489:
- data->WriteBits(0x00000002, 24);
- buff << uint32(((BattlegroundWGScore*)score)->FlagCaptures); // flag captures
- buff << uint32(((BattlegroundWGScore*)score)->FlagReturns); // flag returns
- break;
- case 566:
- data->WriteBits(0x00000001, 24);
- buff << uint32(((BattlegroundEYScore*)score)->FlagCaptures); // flag captures
- break;
- case 529:
- data->WriteBits(0x00000002, 24);
- buff << uint32(((BattlegroundABScore*)score)->BasesAssaulted); // bases assaulted
- buff << uint32(((BattlegroundABScore*)score)->BasesDefended); // bases defended
- break;
- case 30:
- data->WriteBits(0x00000005, 24);
- buff << uint32(((BattlegroundAVScore*)score)->GraveyardsAssaulted); // GraveyardsAssaulted
- buff << uint32(((BattlegroundAVScore*)score)->GraveyardsDefended); // GraveyardsDefended
- buff << uint32(((BattlegroundAVScore*)score)->TowersAssaulted); // TowersAssaulted
- buff << uint32(((BattlegroundAVScore*)score)->TowersDefended); // TowersDefended
- buff << uint32(((BattlegroundAVScore*)score)->MinesCaptured); // MinesCaptured
- break;
- case 607:
- data->WriteBits(0x00000002, 24);
- buff << uint32(((BattlegroundSAScore*)score)->demolishers_destroyed);
- buff << uint32(((BattlegroundSAScore*)score)->gates_destroyed);
- break;
- case 628: // IC
- data->WriteBits(0x00000002, 24);
- buff << uint32(((BattlegroundICScore*)score)->BasesAssaulted); // bases assaulted
- buff << uint32(((BattlegroundICScore*)score)->BasesDefended); // bases defended
- break;
- case 726:
- data->WriteBits(0x00000002, 24);
- buff << uint32(((BattlegroundTPScore*)score)->FlagCaptures); // flag captures
- buff << uint32(((BattlegroundTPScore*)score)->FlagReturns); // flag returns
- break;
- case 761:
- data->WriteBits(0x00000002, 24);
- buff << uint32(((BattlegroundBFGScore*)score)->BasesAssaulted); // bases assaulted
- buff << uint32(((BattlegroundBFGScore*)score)->BasesDefended); // bases defended
- break;
- default:
- data->WriteBits(0, 24);
- break;
- }
- break;
- case BATTLEGROUND_AV:
- data->WriteBits(0x00000005, 24);
- buff << uint32(((BattlegroundAVScore*)score)->GraveyardsAssaulted); // GraveyardsAssaulted
- buff << uint32(((BattlegroundAVScore*)score)->GraveyardsDefended); // GraveyardsDefended
- buff << uint32(((BattlegroundAVScore*)score)->TowersAssaulted); // TowersAssaulted
- buff << uint32(((BattlegroundAVScore*)score)->TowersDefended); // TowersDefended
- buff << uint32(((BattlegroundAVScore*)score)->MinesCaptured); // MinesCaptured
- break;
- case BATTLEGROUND_WS:
- data->WriteBits(0x00000002, 24);
- buff << uint32(((BattlegroundWGScore*)score)->FlagCaptures); // flag captures
- buff << uint32(((BattlegroundWGScore*)score)->FlagReturns); // flag returns
- break;
- case BATTLEGROUND_AB:
- data->WriteBits(0x00000002, 24);
- buff << uint32(((BattlegroundABScore*)score)->BasesAssaulted); // bases assaulted
- buff << uint32(((BattlegroundABScore*)score)->BasesDefended); // bases defended
- break;
- case BATTLEGROUND_EY:
- data->WriteBits(0x00000001, 24);
- buff << uint32(((BattlegroundEYScore*)score)->FlagCaptures); // flag captures
- break;
- case BATTLEGROUND_SA:
- data->WriteBits(0x00000002, 24);
- buff << uint32(((BattlegroundSAScore*)score)->demolishers_destroyed);
- buff << uint32(((BattlegroundSAScore*)score)->gates_destroyed);
- break;
- case BATTLEGROUND_IC:
- data->WriteBits(0x00000002, 24);
- buff << uint32(((BattlegroundICScore*)score)->BasesAssaulted); // bases assaulted
- buff << uint32(((BattlegroundICScore*)score)->BasesDefended); // bases defended
- break;
- case BATTLEGROUND_TP:
- data->WriteBits(0x00000002, 24);
- buff << uint32(((BattlegroundTPScore*)score)->FlagCaptures); // flag captures
- buff << uint32(((BattlegroundTPScore*)score)->FlagReturns); // flag returns
- break;
- case BATTLEGROUND_BFG:
- data->WriteBits(0x00000002, 24);
- buff << uint32(((BattlegroundBFGScore*)score)->BasesAssaulted); // bases assaulted
- buff << uint32(((BattlegroundBFGScore*)score)->BasesDefended); // bases defended
- break;
- case BATTLEGROUND_NA:
- case BATTLEGROUND_BE:
- case BATTLEGROUND_AA:
- case BATTLEGROUND_RL:
- case BATTLEGROUND_DS:
- case BATTLEGROUND_RV:
- data->WriteBits(0, 24);
- break;
- default:
- data->WriteBits(0, 24);
- break;
- }
-
- data->WriteBit(playerGUID[4]);
-
- buff.WriteByteSeq(playerGUID[0]);
- buff.WriteByteSeq(playerGUID[3]);
- // if (unk 4) << uint32() unk
- buff.WriteByteSeq(playerGUID[7]);
- buff.WriteByteSeq(playerGUID[2]);
- ++count;
- }
-
- data->PutBits(count_pos, count, 21);
- data->WriteBit(bg->GetStatus() == STATUS_WAIT_LEAVE); // If Ended
-
- if (isRated) // arena
- {
- // it seems this must be according to BG_WINNER_A/H and _NOT_ BG_TEAM_A/H
- for (int8 i = 0; i < BG_TEAMS_COUNT; ++i)
- {
- int32 rating_change = bg->GetArenaTeamRatingChangeByIndex(i);
-
- uint32 pointsLost = rating_change < 0 ? -rating_change : 0;
- uint32 pointsGained = rating_change > 0 ? rating_change : 0;
- uint32 MatchmakerRating = bg->GetArenaMatchmakerRatingByIndex(i);
-
- *data << uint32(MatchmakerRating); // Matchmaking Value
- *data << uint32(pointsLost); // Rating Lost
- *data << uint32(pointsGained); // Rating gained
-
- TC_LOG_DEBUG("bg.battleground", "rating change: %d", rating_change);
- }
- }
-
- data->FlushBits();
- data->append(buff);
-
- if (isArena)
- for (int8 i = 0; i < BG_TEAMS_COUNT; ++i)
- if (ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(bg->GetArenaTeamIdByIndex(i)))
- data->WriteString(at->GetName());
-
- *data << uint8(bg->GetPlayersCountByTeam(HORDE));
-
- if (bg->GetStatus() == STATUS_WAIT_LEAVE)
- *data << uint8(bg->GetWinner());
-
- *data << uint8(bg->GetPlayersCountByTeam(ALLIANCE));
-}
-
void BattlegroundMgr::BuildStatusFailedPacket(WorldPacket* data, Battleground* bg, Player* player, uint8 QueueSlot, GroupJoinBattlegroundResult result)
{
ObjectGuid guidBytes1 = player->GetGUID(); // player who caused the error