aboutsummaryrefslogtreecommitdiff
path: root/src/server/game
diff options
context:
space:
mode:
authorGigaDev90 <gabriele.gelardi@gmail.com>2015-10-25 16:23:51 +0100
committerShinDarth <borzifrancesco@gmail.com>2015-10-28 20:14:21 +0100
commitb774aedd93a229fd3cbcd17a09ac195a9c0c47c6 (patch)
treec6b15b723b727a237f6b091d4a24e3fa7fe942d3 /src/server/game
parentf5781ec3af1e0958f505d5d4b3e452cb10f1a70c (diff)
Scripts/DuelReset:
- fixed druid mana restoration - fixed bug when a player accepts duel with a spel on onHold true (like when stealth of rogue/druid is active)
Diffstat (limited to 'src/server/game')
-rw-r--r--src/server/game/Spells/SpellHistory.cpp27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/server/game/Spells/SpellHistory.cpp b/src/server/game/Spells/SpellHistory.cpp
index ca0e8cc6238..c76c4545643 100644
--- a/src/server/game/Spells/SpellHistory.cpp
+++ b/src/server/game/Spells/SpellHistory.cpp
@@ -652,23 +652,16 @@ void SpellHistory::RestoreCooldownStateAfterDuel()
SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(itr->first);
if (spellInfo->RecoveryTime > 10 * MINUTE * IN_MILLISECONDS ||
- spellInfo->CategoryRecoveryTime > 10 * MINUTE * IN_MILLISECONDS)
+ spellInfo->CategoryRecoveryTime > 10 * MINUTE * IN_MILLISECONDS)
_spellCooldownsBeforeDuel[itr->first] = _spellCooldowns[itr->first];
}
-
- _spellCooldowns = _spellCooldownsBeforeDuel;
-
- // update the client: clear all cooldowns
- std::vector<int32> resetCooldowns;
- resetCooldowns.reserve(_spellCooldowns.size());
-
- for (auto itr = _spellCooldowns.begin(); itr != _spellCooldowns.end(); ++itr)
- resetCooldowns.push_back(itr->first);
-
- if (resetCooldowns.empty())
- return;
-
- SendClearCooldowns(resetCooldowns);
+ //check for spell with onHold active before and during the duel
+ for (auto itr = _spellCooldownsBeforeDuel.begin(); itr != _spellCooldownsBeforeDuel.end(); ++itr)
+ {
+ if (!itr->second.OnHold)
+ if (!_spellCooldowns[itr->first].OnHold)
+ _spellCooldowns[itr->first] = _spellCooldownsBeforeDuel[itr->first];
+ }
// update the client: restore old cooldowns
PacketCooldowns cooldowns;
@@ -679,14 +672,14 @@ void SpellHistory::RestoreCooldownStateAfterDuel()
uint32 cooldownDuration = itr->second.CooldownEnd > now ? std::chrono::duration_cast<std::chrono::milliseconds>(itr->second.CooldownEnd - now).count() : 0;
// cooldownDuration must be between 0 and 10 minutes in order to avoid any visual bugs
- if (cooldownDuration == 0 || cooldownDuration > 10 * MINUTE * IN_MILLISECONDS)
+ if (cooldownDuration <= 0 || cooldownDuration > 10 * MINUTE * IN_MILLISECONDS || itr->second.OnHold)
continue;
cooldowns[itr->first] = cooldownDuration;
}
WorldPacket data;
- BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, cooldowns);
+ BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_INCLUDE_EVENT_COOLDOWNS, cooldowns);
player->SendDirectMessage(&data);
}
}