aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2021-11-20 00:28:48 +0100
committerShauren <shauren.trinity@gmail.com>2021-11-20 00:28:48 +0100
commit8cc6520b89583d4bf6549b28fa5b7390fc2b0b9d (patch)
tree708be5e5c81e611a9d0c4afb0b59c86eeefd4b7e /src/server/scripts
parentd4d47b52e3f68f9042f582a2a4c29b92bbb1e260 (diff)
Core/Spells: SpellHistory updates
* Add duration override argument to StartCooldown (for cooldowns sent to client) * Research new SMSG_SPELL_COOLDOWN flags * Send interrupt school lockouts with newly defined SPELL_COOLDOWN_FLAG_LOSS_OF_CONTROL_UI * Fixed packet structure of SMSG_MODIFY_COOLDOWN * std::chorno-ification
Diffstat (limited to 'src/server/scripts')
-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