diff options
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraDefines.h | 8 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 8 | ||||
-rw-r--r-- | src/server/game/Spells/Spell.cpp | 17 | ||||
-rw-r--r-- | src/server/game/Spells/SpellHistory.cpp | 22 |
4 files changed, 36 insertions, 19 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuraDefines.h b/src/server/game/Spells/Auras/SpellAuraDefines.h index 5130ebd7876..d781a8822b8 100644 --- a/src/server/game/Spells/Auras/SpellAuraDefines.h +++ b/src/server/game/Spells/Auras/SpellAuraDefines.h @@ -404,7 +404,7 @@ enum AuraType SPELL_AURA_MOD_AUTOATTACK_DAMAGE = 344, // NYI SPELL_AURA_BYPASS_ARMOR_FOR_CASTER = 345, SPELL_AURA_ENABLE_ALT_POWER = 346, // NYI - SPELL_AURA_MOD_SPELL_COOLDOWN_BY_HASTE = 347, // NYI + SPELL_AURA_MOD_SPELL_COOLDOWN_BY_HASTE = 347, SPELL_AURA_DEPOSIT_BONUS_MONEY_IN_GUILD_BANK_ON_LOOT = 348, SPELL_AURA_MOD_CURRENCY_GAIN = 349, SPELL_AURA_MOD_GATHERING_ITEMS_GAINED_PERCENT = 350, // NYI @@ -437,7 +437,7 @@ enum AuraType SPELL_AURA_CAST_WHILE_WALKING_2 = 377, // NYI SPELL_AURA_378 = 378, SPELL_AURA_379 = 379, - SPELL_AURA_380 = 380, + SPELL_AURA_MOD_GLOBAL_COOLDOWN_BY_HASTE = 380, // Allows melee abilities to benefit from haste GCD reduction SPELL_AURA_381 = 381, SPELL_AURA_MOD_PET_STAT_PCT = 382, // NYI SPELL_AURA_IGNORE_SPELL_COOLDOWN = 383, // NYI @@ -473,8 +473,8 @@ enum AuraType SPELL_AURA_413 = 413, SPELL_AURA_414 = 414, SPELL_AURA_415 = 415, - SPELL_AURA_MOD_COOLDOWN_BY_HASTE_EFFECTS = 416, // NYI - SPELL_AURA_MOD_GLOBAL_COOLDOWN_BY_HASTE_EFFECTS = 417, // NYI + SPELL_AURA_MOD_COOLDOWN_BY_HASTE_REGEN = 416, + SPELL_AURA_MOD_GLOBAL_COOLDOWN_BY_HASTE_REGEN = 417, SPELL_AURA_MOD_MAX_POWER = 418, // NYI SPELL_AURA_MOD_BASE_MANA_PCT = 419, SPELL_AURA_MOD_BATTLE_PET_XP_PCT = 420, // NYI diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index a35d5e37b47..911db589f2d 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -406,7 +406,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]= &AuraEffect::HandleNULL, //344 SPELL_AURA_MOD_AUTOATTACK_DAMAGE &AuraEffect::HandleNoImmediateEffect, //345 SPELL_AURA_BYPASS_ARMOR_FOR_CASTER &AuraEffect::HandleEnableAltPower, //346 SPELL_AURA_ENABLE_ALT_POWER - &AuraEffect::HandleNULL, //347 SPELL_AURA_MOD_SPELL_COOLDOWN_BY_HASTE + &AuraEffect::HandleNoImmediateEffect, //347 SPELL_AURA_MOD_SPELL_COOLDOWN_BY_HASTE implemented in SpellHistory::StartCooldown &AuraEffect::HandleNoImmediateEffect, //348 SPELL_AURA_DEPOSIT_BONUS_MONEY_IN_GUILD_BANK_ON_LOOT implemented in WorldSession::HandleLootMoneyOpcode &AuraEffect::HandleNoImmediateEffect, //349 SPELL_AURA_MOD_CURRENCY_GAIN implemented in Player::ModifyCurrency &AuraEffect::HandleNULL, //350 SPELL_AURA_MOD_GATHERING_ITEMS_GAINED_PERCENT @@ -439,7 +439,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]= &AuraEffect::HandleNULL, //377 SPELL_AURA_CAST_WHILE_WALKING_2 &AuraEffect::HandleNULL, //378 &AuraEffect::HandleNULL, //379 - &AuraEffect::HandleNULL, //380 + &AuraEffect::HandleNoImmediateEffect, //380 SPELL_AURA_MOD_GLOBAL_COOLDOWN_BY_HASTE implemented in Spell::TriggerGlobalCooldown &AuraEffect::HandleNULL, //381 &AuraEffect::HandleNULL, //382 SPELL_AURA_MOD_PET_STAT_PCT &AuraEffect::HandleNULL, //383 SPELL_AURA_IGNORE_SPELL_COOLDOWN @@ -475,8 +475,8 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]= &AuraEffect::HandleNULL, //413 &AuraEffect::HandleNULL, //414 &AuraEffect::HandleNULL, //415 - &AuraEffect::HandleNULL, //416 SPELL_AURA_MOD_COOLDOWN_BY_HASTE_EFFECTS - &AuraEffect::HandleNULL, //417 SPELL_AURA_MOD_GLOBAL_COOLDOWN_BY_HASTE_EFFECTS + &AuraEffect::HandleNoImmediateEffect, //416 SPELL_AURA_MOD_COOLDOWN_BY_HASTE_REGEN implemented in SpellHistory::StartCooldown + &AuraEffect::HandleNoImmediateEffect, //417 SPELL_AURA_MOD_GLOBAL_COOLDOWN_BY_HASTE_REGEN implemented in Spell::TriggerGlobalCooldown &AuraEffect::HandleNULL, //418 SPELL_AURA_MOD_MAX_POWER &AuraEffect::HandleAuraModIncreaseBaseManaPercent, //419 SPELL_AURA_MOD_BASE_MANA_PCT &AuraEffect::HandleNULL, //420 SPELL_AURA_MOD_BATTLE_PET_XP_PCT diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index dac9b82549c..aa02dfa3f63 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -7450,7 +7450,7 @@ bool Spell::HasGlobalCooldown() const void Spell::TriggerGlobalCooldown() { int32 gcd = m_spellInfo->StartRecoveryTime; - if (!gcd) + if (!gcd || !m_spellInfo->StartRecoveryCategory) return; // Only players or controlled units have global cooldown @@ -7470,12 +7470,17 @@ void Spell::TriggerGlobalCooldown() if (m_caster->GetTypeId() == TYPEID_PLAYER) m_caster->ToPlayer()->ApplySpellMod(m_spellInfo->Id, SPELLMOD_GLOBAL_COOLDOWN, gcd, this); + bool isMeleeOrRangedSpell = m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE || + m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED || + m_spellInfo->HasAttribute(SPELL_ATTR0_REQ_AMMO) || + m_spellInfo->HasAttribute(SPELL_ATTR0_ABILITY); + // Apply haste rating - gcd = int32(float(gcd) * m_caster->GetFloatValue(UNIT_MOD_CAST_SPEED)); - if (gcd < MIN_GCD) - gcd = MIN_GCD; - else if (gcd > MAX_GCD) - gcd = MAX_GCD; + if (gcd > MIN_GCD && ((m_spellInfo->StartRecoveryCategory == 133 && !isMeleeOrRangedSpell) || m_caster->HasAuraTypeWithAffectMask(SPELL_AURA_MOD_GLOBAL_COOLDOWN_BY_HASTE, m_spellInfo))) + gcd = std::min<int32>(std::max<int32>(int32(float(gcd) * m_caster->GetFloatValue(UNIT_MOD_CAST_HASTE)), MIN_GCD), MAX_GCD); + + if (gcd > MIN_GCD && m_caster->HasAuraTypeWithAffectMask(SPELL_AURA_MOD_GLOBAL_COOLDOWN_BY_HASTE_REGEN, m_spellInfo)) + gcd = std::min<int32>(std::max<int32>(int32(float(gcd) * m_caster->GetFloatValue(UNIT_FIELD_MOD_HASTE_REGEN)), MIN_GCD), MAX_GCD); } m_caster->GetSpellHistory()->AddGlobalCooldown(m_spellInfo, gcd); diff --git a/src/server/game/Spells/SpellHistory.cpp b/src/server/game/Spells/SpellHistory.cpp index 82822a3b873..fe56eb3c01b 100644 --- a/src/server/game/Spells/SpellHistory.cpp +++ b/src/server/game/Spells/SpellHistory.cpp @@ -330,7 +330,7 @@ void SpellHistory::WritePacket(WorldPackets::Spells::SendSpellCharges* sendSpell WorldPackets::Spells::SpellChargeEntry chargeEntry; chargeEntry.Category = p.first; chargeEntry.NextRecoveryTime = uint32(cooldownDuration.count()); - chargeEntry.ConsumedCharges = p.second.size(); + chargeEntry.ConsumedCharges = uint8(p.second.size()); sendSpellCharges->Entries.push_back(chargeEntry); } } @@ -377,7 +377,7 @@ void SpellHistory::WritePacket(WorldPackets::Pet::PetSpells* petSpells) const WorldPackets::Pet::PetSpellHistory petChargeEntry; petChargeEntry.CategoryID = p.first; petChargeEntry.RecoveryTime = uint32(cooldownDuration.count()); - petChargeEntry.ConsumedCharges = p.second.size(); + petChargeEntry.ConsumedCharges = int8(p.second.size()); petSpells->SpellHistory.push_back(petChargeEntry); } @@ -422,6 +422,18 @@ void SpellHistory::StartCooldown(SpellInfo const* spellInfo, uint32 itemId, Spel modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, categoryCooldown, spell); } + if (_owner->HasAuraTypeWithAffectMask(SPELL_AURA_MOD_SPELL_COOLDOWN_BY_HASTE, spellInfo)) + { + cooldown = int32(cooldown * _owner->GetFloatValue(UNIT_MOD_CAST_HASTE)); + categoryCooldown = int32(categoryCooldown * _owner->GetFloatValue(UNIT_MOD_CAST_HASTE)); + } + + if (_owner->HasAuraTypeWithAffectMask(SPELL_AURA_MOD_COOLDOWN_BY_HASTE_REGEN, spellInfo)) + { + cooldown = int32(cooldown * _owner->GetFloatValue(UNIT_FIELD_MOD_HASTE_REGEN)); + categoryCooldown = int32(categoryCooldown * _owner->GetFloatValue(UNIT_FIELD_MOD_HASTE_REGEN)); + } + if (int32 cooldownMod = _owner->GetTotalAuraModifier(SPELL_AURA_MOD_COOLDOWN)) { // Apply SPELL_AURA_MOD_COOLDOWN only to own spells @@ -735,7 +747,7 @@ void SpellHistory::RestoreCharge(SpellCategoryEntry const* chargeCategoryEntry) setSpellCharges.Category = chargeCategoryEntry->ID; if (!itr->second.empty()) setSpellCharges.NextRecoveryTime = uint32(std::chrono::duration_cast<std::chrono::milliseconds>(itr->second.front().RechargeEnd - Clock::now()).count()); - setSpellCharges.ConsumedCharges = itr->second.size(); + setSpellCharges.ConsumedCharges = uint8(itr->second.size()); setSpellCharges.IsPet = player != _owner; player->SendDirectMessage(setSpellCharges.Write()); @@ -807,7 +819,7 @@ int32 SpellHistory::GetChargeRecoveryTime(SpellCategoryEntry const* chargeCatego int32 recoveryTime = chargeCategoryEntry->ChargeRecoveryTime; recoveryTime += _owner->GetTotalAuraModifierByMiscValue(SPELL_AURA_CHARGE_RECOVERY_MOD, chargeCategoryEntry->ID); - float recoveryTimeF = recoveryTime; + float recoveryTimeF = float(recoveryTime); recoveryTimeF *= _owner->GetTotalAuraMultiplierByMiscValue(SPELL_AURA_CHARGE_RECOVERY_MULTIPLIER, chargeCategoryEntry->ID); if (_owner->HasAuraType(SPELL_AURA_CHARGE_RECOVERY_AFFECTED_BY_HASTE)) @@ -928,7 +940,7 @@ void SpellHistory::RestoreCooldownStateAfterDuel() for (auto const& c : _spellCooldowns) { Clock::time_point now = Clock::now(); - uint32 cooldownDuration = c.second.CooldownEnd > now ? std::chrono::duration_cast<std::chrono::milliseconds>(c.second.CooldownEnd - now).count() : 0; + uint32 cooldownDuration = uint32(c.second.CooldownEnd > now ? std::chrono::duration_cast<std::chrono::milliseconds>(c.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 || c.second.OnHold) |