aboutsummaryrefslogtreecommitdiff
path: root/src/game/BattleGroundSA.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/BattleGroundSA.cpp')
-rw-r--r--src/game/BattleGroundSA.cpp67
1 files changed, 40 insertions, 27 deletions
diff --git a/src/game/BattleGroundSA.cpp b/src/game/BattleGroundSA.cpp
index f1ba5157f8e..782de247398 100644
--- a/src/game/BattleGroundSA.cpp
+++ b/src/game/BattleGroundSA.cpp
@@ -634,36 +634,33 @@ void BattleGroundSA::CaptureGraveyard(BG_SA_Graveyards i)
void BattleGroundSA::EventPlayerUsedGO(Player* Source, GameObject* object)
{
-
- if(object->GetEntry() == BG_SA_ObjEntries[BG_SA_TITAN_RELIC])
+ if(object->GetEntry() == BG_SA_ObjEntries[BG_SA_TITAN_RELIC])
{
- if(Source->GetTeamId() == attackers)
- {
-
- if(status == BG_SA_ROUND_ONE)
- {
- RoundScores[0].winner = attackers;
- RoundScores[0].time = TotalTime;
- attackers = (attackers == TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE;
- status = BG_SA_SECOND_WARMUP;
- TotalTime = 0;
- ToggleTimer();
- ResetObjs();
- }
- else if(status == BG_SA_ROUND_TWO)
- {
- RoundScores[1].winner = attackers;
- RoundScores[1].time = TotalTime;
- ToggleTimer();
- if(RoundScores[0].time < RoundScores[1].time)
- EndBattleGround(RoundScores[0].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
- else
- EndBattleGround(RoundScores[1].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
-
+ if(Source->GetTeamId() == attackers)
+ {
+ if(status == BG_SA_ROUND_ONE)
+ {
+ RoundScores[0].winner = attackers;
+ RoundScores[0].time = TotalTime;
+ attackers = (attackers == TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE;
+ status = BG_SA_SECOND_WARMUP;
+ TotalTime = 0;
+ ToggleTimer();
+ ResetObjs();
+ }
+ else if(status == BG_SA_ROUND_TWO)
+ {
+ RoundScores[1].winner = attackers;
+ RoundScores[1].time = TotalTime;ToggleTimer();
+ if(RoundScores[0].time == RoundScores[1].time)
+ EndBattleGround(NULL);
+ else if(RoundScores[0].time < RoundScores[1].time)
+ EndBattleGround(RoundScores[0].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
+ else
+ EndBattleGround(RoundScores[1].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
+ }
}
- }
}
-
}
void BattleGroundSA::ToggleTimer()
@@ -673,3 +670,19 @@ void BattleGroundSA::ToggleTimer()
UpdateWorldState(BG_SA_ENABLE_TIMER, (TimerEnabled) ? 1 : 0);
}
+
+void BattleGroundSA::EndBattleGround(uint32 winner)
+{
+ //win reward
+ if (winner == ALLIANCE)
+ RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), ALLIANCE);
+ else if (winner == HORDE)
+ RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), HORDE);
+
+ //complete map_end rewards (even if no team wins)
+ RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), ALLIANCE);
+ RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), HORDE);
+
+ BattleGround::EndBattleGround(winner);
+}
+