mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user