aboutsummaryrefslogtreecommitdiff
path: root/src/game/BattleGroundSA.cpp
diff options
context:
space:
mode:
authorp0wer <none@none>2010-03-02 19:44:54 -0600
committerp0wer <none@none>2010-03-02 19:44:54 -0600
commit2942a19592d2820e6bd284a909a532bc0015a3d0 (patch)
treedc57f7cc8bdc4705ee0764029142708644feb112 /src/game/BattleGroundSA.cpp
parentd3e09cb65f1c3e61263040708c8ac1a8e4ee4f42 (diff)
Some SA fixes by gyullo.
Also added formating fix for BattleGroundSA::EventPlayerUsedGO. --HG-- branch : trunk
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);
+}
+