aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Battlegrounds/ArenaScore.h8
-rw-r--r--src/server/game/Battlegrounds/Battleground.cpp23
-rw-r--r--src/server/game/Battlegrounds/Battleground.h1
-rw-r--r--src/server/game/Battlegrounds/BattlegroundScore.h2
4 files changed, 21 insertions, 13 deletions
diff --git a/src/server/game/Battlegrounds/ArenaScore.h b/src/server/game/Battlegrounds/ArenaScore.h
index 3b976a0a0da..fdeb13adc3d 100644
--- a/src/server/game/Battlegrounds/ArenaScore.h
+++ b/src/server/game/Battlegrounds/ArenaScore.h
@@ -40,6 +40,12 @@ struct ArenaScore : public BattlegroundScore
data << uint8(TeamId);
data << uint32(DamageDone);
data << uint32(HealingDone);
+
+ BuildObjectivesBlock(data);
+ }
+
+ void BuildObjectivesBlock(WorldPacket& data) final
+ {
data << uint32(0); // Objectives Count
}
@@ -51,7 +57,7 @@ struct ArenaScore : public BattlegroundScore
return stream.str();
}
- uint8 TeamId; // TEAM_ALLIANCE or TEAM_HORDE
+ uint8 TeamId; // bgTeamId
};
#endif // TRINITY_ARENA_SCORE_H
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index d840c351d11..4e077979b3e 100644
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -755,7 +755,7 @@ void Battleground::EndBattleground(uint32 winner)
}
else
{
- SetWinner(3);
+ SetWinner(3); // weird
}
SetStatus(STATUS_WAIT_LEAVE);
@@ -784,11 +784,13 @@ void Battleground::EndBattleground(uint32 winner)
SetArenaMatchmakerRating(winner, winnerMatchmakerRating + winnerMatchmakerChange);
SetArenaMatchmakerRating(GetOtherTeam(winner), loserMatchmakerRating + loserMatchmakerChange);
- uint8 winnerId = GetWinner();
- uint8 loserId = winnerId == WINNER_ALLIANCE ? uint8(WINNER_HORDE) : winnerId;
+ // bg team that the client expects is different to TeamId
+ // alliance 1, horde 0
+ uint8 winnerTeam = winner == ALLIANCE ? WINNER_ALLIANCE : WINNER_HORDE;
+ uint8 loserTeam = winner == ALLIANCE ? WINNER_HORDE : WINNER_ALLIANCE;
- _arenaTeamScores[winnerId].Assign(winnerChange, winnerMatchmakerRating + winnerMatchmakerChange, winnerArenaTeam->GetName());
- _arenaTeamScores[loserId].Assign(loserChange, loserMatchmakerRating + loserMatchmakerChange, loserArenaTeam->GetName());
+ _arenaTeamScores[winnerTeam].Assign(winnerChange, winnerMatchmakerRating, winnerArenaTeam->GetName());
+ _arenaTeamScores[loserTeam].Assign(loserChange, loserMatchmakerRating, loserArenaTeam->GetName());
TC_LOG_DEBUG("bg.arena", "Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[TEAM_ALLIANCE], m_ArenaTeamIds[TEAM_HORDE], winnerArenaTeam->GetId(), winnerChange, loserChange);
if (sWorld->getBoolConfig(CONFIG_ARENA_LOG_EXTENDED_INFO))
@@ -803,8 +805,8 @@ void Battleground::EndBattleground(uint32 winner)
// Deduct 16 points from each teams arena-rating if there are no winners after 45+2 minutes
else
{
- _arenaTeamScores[WINNER_ALLIANCE].Assign(ARENA_TIMELIMIT_POINTS_LOSS, winnerMatchmakerRating + winnerMatchmakerChange, winnerArenaTeam->GetName());
- _arenaTeamScores[WINNER_HORDE].Assign(ARENA_TIMELIMIT_POINTS_LOSS, loserMatchmakerRating + loserMatchmakerChange, loserArenaTeam->GetName());
+ _arenaTeamScores[WINNER_ALLIANCE].Assign(ARENA_TIMELIMIT_POINTS_LOSS, winnerMatchmakerRating, winnerArenaTeam->GetName());
+ _arenaTeamScores[WINNER_HORDE].Assign(ARENA_TIMELIMIT_POINTS_LOSS, loserMatchmakerRating, loserArenaTeam->GetName());
winnerArenaTeam->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS);
loserArenaTeam->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS);
@@ -1099,7 +1101,7 @@ void Battleground::Reset()
delete itr->second;
PlayerScores.clear();
- for (int8 i = WINNER_ALLIANCE; i >= WINNER_HORDE; --i)
+ for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
_arenaTeamScores[i].Reset();
ResetBGSubclass();
@@ -1361,11 +1363,10 @@ void Battleground::BuildPvPLogDataPacket(WorldPacket& data)
if (type) // arena
{
- // it seems this must be according to BG_WINNER_A/H and _NOT_ TEAM_A/H
- for (int8 i = WINNER_ALLIANCE; i >= WINNER_HORDE; --i)
+ for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
_arenaTeamScores[i].BuildRatingInfoBlock(data);
- for (int8 i = WINNER_ALLIANCE; i >= WINNER_HORDE; --i)
+ for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
_arenaTeamScores[i].BuildTeamInfoBlock(data);
}
diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h
index e353cd1dc62..2904ec1dc7e 100644
--- a/src/server/game/Battlegrounds/Battleground.h
+++ b/src/server/game/Battlegrounds/Battleground.h
@@ -633,6 +633,7 @@ class Battleground
uint32 ratingLost = std::abs(std::min(RatingChange, 0));
uint32 ratingWon = std::max(RatingChange, 0);
+ // should be old rating, new rating, and client will calculate rating change itself
data << uint32(ratingLost);
data << uint32(ratingWon);
data << uint32(MatchmakerRating);
diff --git a/src/server/game/Battlegrounds/BattlegroundScore.h b/src/server/game/Battlegrounds/BattlegroundScore.h
index 7fedc4dbc4d..ae65721b516 100644
--- a/src/server/game/Battlegrounds/BattlegroundScore.h
+++ b/src/server/game/Battlegrounds/BattlegroundScore.h
@@ -101,7 +101,7 @@ struct BattlegroundScore
BuildObjectivesBlock(data);
}
- virtual void BuildObjectivesBlock(WorldPacket& /*data*/) { }
+ virtual void BuildObjectivesBlock(WorldPacket& /*data*/) = 0;
// For Logging purpose
virtual std::string ToString() const { return ""; }