aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/World
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/scripts/World')
-rw-r--r--src/server/scripts/World/duel_reset.cpp31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/server/scripts/World/duel_reset.cpp b/src/server/scripts/World/duel_reset.cpp
index 947d705cc80..7246abc8377 100644
--- a/src/server/scripts/World/duel_reset.cpp
+++ b/src/server/scripts/World/duel_reset.cpp
@@ -94,25 +94,32 @@ class DuelResetScript : public PlayerScript
player->GetSpellHistory()->ResetCooldowns([player, onStartDuel](SpellHistory::CooldownStorageType::iterator itr) -> bool
{
SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(itr->first, DIFFICULTY_NONE);
- uint32 remainingCooldown = player->GetSpellHistory()->GetRemainingCooldown(spellInfo);
- int32 totalCooldown = spellInfo->RecoveryTime;
- int32 categoryCooldown = spellInfo->CategoryRecoveryTime;
+ Milliseconds remainingCooldown = player->GetSpellHistory()->GetRemainingCooldown(spellInfo);
+ Milliseconds totalCooldown = Milliseconds(spellInfo->RecoveryTime);
+ Milliseconds categoryCooldown = Milliseconds(spellInfo->CategoryRecoveryTime);
- player->ApplySpellMod(spellInfo, SpellModOp::Cooldown, totalCooldown, nullptr);
+ auto applySpellMod = [&](Milliseconds& value)
+ {
+ int32 intValue = value.count();
+ player->ApplySpellMod(spellInfo, SpellModOp::Cooldown, intValue, nullptr);
+ value = Milliseconds(intValue);
+ };
+
+ applySpellMod(totalCooldown);
if (int32 cooldownMod = player->GetTotalAuraModifier(SPELL_AURA_MOD_COOLDOWN))
- totalCooldown += cooldownMod * IN_MILLISECONDS;
+ totalCooldown += Milliseconds(cooldownMod);
if (!spellInfo->HasAttribute(SPELL_ATTR6_IGNORE_CATEGORY_COOLDOWN_MODS))
- player->ApplySpellMod(spellInfo, SpellModOp::Cooldown, categoryCooldown, nullptr);
+ applySpellMod(categoryCooldown);
- return remainingCooldown > 0
+ return remainingCooldown > 0ms
&& !itr->second.OnHold
- && Milliseconds(totalCooldown) < Minutes(10)
- && Milliseconds(categoryCooldown) < Minutes(10)
- && Milliseconds(remainingCooldown) < Minutes(10)
- && (onStartDuel ? Milliseconds(totalCooldown - remainingCooldown) > Seconds(30) : true)
- && (onStartDuel ? Milliseconds(categoryCooldown - remainingCooldown) > Seconds(30) : true);
+ && Milliseconds(totalCooldown) < 10min
+ && Milliseconds(categoryCooldown) < 10min
+ && Milliseconds(remainingCooldown) < 10min
+ && (onStartDuel ? totalCooldown - remainingCooldown > 30s : true)
+ && (onStartDuel ? categoryCooldown - remainingCooldown > 30s : true);
}, true);
// pet cooldowns