Update BattleGround System for 322a

--HG--
branch : trunk
This commit is contained in:
n0n4m3
2009-12-17 10:43:12 +01:00
parent 2edfea7bb9
commit 5697ea9c94
17 changed files with 569 additions and 60 deletions
+28 -2
View File
@@ -67,9 +67,32 @@ BattleGroundWS::~BattleGroundWS()
void BattleGroundWS::Update(uint32 diff)
{
BattleGround::Update(diff);
if (GetStatus() == STATUS_IN_PROGRESS)
{
if( GetStartTime() >= 25*MINUTE*1000 ) // Òàéìåð òèêàòü íà÷èíàåò ïîñëå 25 ìèíóò
{
if( GetTeamScore(ALLIANCE) == 0 )
{
if ( GetTeamScore(HORDE) == 0 ) // No one scored - result is tie
EndBattleGround(NULL);
else // Horde has more points and thus wins
EndBattleGround(HORDE);
}
else if( GetTeamScore(HORDE) == 0 )
EndBattleGround(ALLIANCE); // Alliance has >0, Horde has 0, alliance wins
else if( GetTeamScore(HORDE) == GetTeamScore(ALLIANCE) ) // Team score equal, winner is team that scored the first flag
EndBattleGround(m_FirstFlagCaptureTeam);
else if( GetTeamScore(HORDE) > GetTeamScore(ALLIANCE) ) // Last but not least, check who has the higher score
EndBattleGround(HORDE);
else
EndBattleGround(ALLIANCE);
}
if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
{
m_FlagsTimer[BG_TEAM_ALLIANCE] -= diff;
@@ -225,7 +248,7 @@ void BattleGroundWS::RespawnFlagAfterDrop(uint32 team)
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);
GameObject *obj = HashMapHolder<GameObject>::Find(GetDroppedFlagGUID(team));
GameObject *obj = GetBgMap()->GetGameObject(GetDroppedFlagGUID(team));
if (obj)
obj->Delete();
else
@@ -294,6 +317,9 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
UpdateTeamScore(Source->GetTeam());
// only flag capture should be updated
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
if(!m_FirstFlagCaptureTeam)
SetFirstFlagCapture(Source->GetTeam());
if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
winner = ALLIANCE;