Some SA fixes by gyullo.

Also added formating fix for BattleGroundSA::EventPlayerUsedGO.

--HG--
branch : trunk
This commit is contained in:
p0wer
2010-03-02 19:44:54 -06:00
parent d3e09cb65f
commit 2942a19592
4 changed files with 53 additions and 28 deletions
+40 -27
View File
@@ -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();
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);
}
}
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);
}
}
}
}
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);
}