Core/Battleground: addition to c28345e279

This commit is contained in:
joschiwald
2014-06-29 16:53:28 +02:00
parent c674f229cb
commit 876e9dde01
4 changed files with 21 additions and 13 deletions

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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 ""; }