diff options
| author | click <none@none> | 2010-12-02 22:50:30 +0100 |
|---|---|---|
| committer | click <none@none> | 2010-12-02 22:50:30 +0100 |
| commit | 28c2e270db3fb866369da1e01e6a7030a9e64eee (patch) | |
| tree | afa0814cd5e304cc4507a68c42d6bea506f1e9ac /src/server/game/Battlegrounds/Battleground.cpp | |
| parent | 2338eae0ff984c2b0e3e18f3dbb0301a47674613 (diff) | |
Core/Battlegrounds: Implement power resets on arena-fight preparations (first 60 seconds before arena-fight kicks off) (Thanks to Kaelima)
Restores all player powers every 5 seconds untill arena starts (fixes possible exploit with entering arena battle with full rage or runic power)
(The 5 second timer is not 100% confirmed, as official pages only states that the power is reset after prep-time - needs feedback)
Closes issue 4805
--HG--
branch : trunk
Diffstat (limited to 'src/server/game/Battlegrounds/Battleground.cpp')
| -rwxr-xr-x | src/server/game/Battlegrounds/Battleground.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 43b416928fa..306552a2a95 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -141,6 +141,7 @@ Battleground::Battleground() m_IsArena = false; m_Winner = 2; m_StartTime = 0; + m_ResetStatTimer = 0; m_Events = 0; m_IsRated = false; m_BuffChange = false; @@ -379,6 +380,14 @@ void Battleground::Update(uint32 diff) { ModifyStartDelayTime(diff); + if (m_ResetStatTimer <= 5000) + { + m_ResetStatTimer = 0; + for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) + if (Player *plr = sObjectMgr.GetPlayer(itr->first)) + plr->ResetAllPowers(); + } + if (!(m_Events & BG_STARTING_EVENT_1)) { m_Events |= BG_STARTING_EVENT_1; @@ -434,6 +443,7 @@ void Battleground::Update(uint32 diff) plr->GetSession()->SendPacket(&status); plr->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION); + plr->ResetAllPowers(); // remove auras with duration lower than 30s Unit::AuraApplicationMap & auraMap = plr->GetAppliedAuras(); for (Unit::AuraApplicationMap::iterator iter = auraMap.begin(); iter != auraMap.end();) @@ -455,12 +465,14 @@ void Battleground::Update(uint32 diff) } else { - PlaySoundToAll(SOUND_BG_START); for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) if (Player* plr = sObjectMgr.GetPlayer(itr->first)) + { plr->RemoveAurasDueToSpell(SPELL_PREPARATION); + plr->ResetAllPowers(); + } //Announce BG starting if (sWorld.getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE)) { @@ -493,8 +505,9 @@ void Battleground::Update(uint32 diff) } } - //update start time + // Update start time and reset stats timer m_StartTime += diff; + m_ResetStatTimer += diff; } void Battleground::SetTeamStartLoc(uint32 TeamID, float X, float Y, float Z, float O) @@ -843,8 +856,7 @@ void Battleground::EndBattleground(uint32 winner) } - plr->SetFullHealth(); - plr->SetPower(POWER_MANA, plr->GetMaxPower(POWER_MANA)); + plr->ResetAllPowers(); plr->CombatStopWithPets(true); BlockMovement(plr); @@ -1132,9 +1144,7 @@ void Battleground::AddPlayer(Player *plr) if (GetStatus() == STATUS_WAIT_JOIN) // not started yet { plr->CastSpell(plr, SPELL_ARENA_PREPARATION, true); - - plr->SetFullHealth(); - plr->SetPower(POWER_MANA, plr->GetMaxPower(POWER_MANA)); + plr->ResetAllPowers(); } WorldPacket teammate; teammate.Initialize(SMSG_ARENA_OPPONENT_UPDATE, 8); |
