Created
June 15, 2010 12:32
-
-
Save Tasssadar/439050 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp | |
index d44df94..8dbb3c7 100644 | |
--- a/src/game/Spell.cpp | |
+++ b/src/game/Spell.cpp | |
@@ -3578,6 +3578,9 @@ void Spell::SendChannelStart(uint32 duration) | |
} | |
} | |
+ //Apply haste rating | |
+ duration = ApplyHasteToChannelSpell(duration, m_spellInfo, this); | |
+ | |
WorldPacket data( MSG_CHANNEL_START, (8+4+4) ); | |
data << m_caster->GetPackGUID(); | |
data << uint32(m_spellInfo->Id); | |
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp | |
index 18b4af6..7aadb61 100644 | |
--- a/src/game/SpellAuras.cpp | |
+++ b/src/game/SpellAuras.cpp | |
@@ -445,16 +445,20 @@ m_isRemovedOnShapeLost(true), m_in_use(0), m_deleted(false) | |
m_maxduration = 1; | |
} | |
- m_duration = m_maxduration; | |
- | |
sLog.outDebug("Aura: construct Spellid : %u, Aura : %u Duration : %d Target : %d Damage : %d", m_spellProto->Id, m_spellProto->EffectApplyAuraName[eff], m_maxduration, m_spellProto->EffectImplicitTargetA[eff],damage); | |
SetModifier(AuraType(m_spellProto->EffectApplyAuraName[eff]), damage, m_spellProto->EffectAmplitude[eff], m_spellProto->EffectMiscValue[eff]); | |
+ //Apply haste to channeled spells | |
+ if(GetSpellProto()->AttributesEx & (SPELL_ATTR_EX_CHANNELED_1 | SPELL_ATTR_EX_CHANNELED_2) && m_modifier.periodictime) | |
+ ApplyHasteToPeriodic(); | |
// Apply periodic time mod | |
- if(modOwner && m_modifier.periodictime) | |
+ else if(modOwner && m_modifier.periodictime) | |
modOwner->ApplySpellMod(GetId(), SPELLMOD_ACTIVATION_TIME, m_modifier.periodictime); | |
+ //Must be after haste | |
+ m_duration = m_maxduration; | |
+ | |
// Start periodic on next tick or at aura apply | |
if (!(m_spellProto->AttributesEx5 & SPELL_ATTR_EX5_START_PERIODIC_AT_APPLY)) | |
m_periodicTimer += m_modifier.periodictime; | |
@@ -1444,6 +1448,37 @@ bool Aura::isWeaponBuffCoexistableWith(Aura* ref) | |
return ref->GetCastItemGUID() != GetCastItemGUID(); | |
} | |
+void Aura::ApplyHasteToPeriodic() | |
+{ | |
+ if(!GetCaster() || !GetTarget()) | |
+ return; | |
+ if(GetCaster()->GetTypeId() != TYPEID_PLAYER) | |
+ return; | |
+ | |
+ int32 periodic = m_modifier.periodictime; | |
+ int32 duration = GetCaster()->CalculateSpellDuration(m_spellProto, m_effIndex, GetTarget()); | |
+ int32 hastedduration = duration; | |
+ if(duration == 0 || periodic == 0) | |
+ return; | |
+ | |
+ int32 ticks = duration / periodic; | |
+ | |
+ Player* modOwner = GetCaster()->GetSpellModOwner(); | |
+ | |
+ if(modOwner) | |
+ modOwner->ApplySpellMod(GetId(), SPELLMOD_ACTIVATION_TIME, periodic); | |
+ | |
+ if( !(GetSpellProto()->Attributes & (SPELL_ATTR_UNK4|SPELL_ATTR_TRADESPELL)) ) | |
+ hastedduration = int32(duration * GetCaster()->GetFloatValue(UNIT_MOD_CAST_SPEED)); | |
+ | |
+ if(hastedduration != duration) | |
+ { | |
+ periodic = int32(periodic * GetCaster()->GetFloatValue(UNIT_MOD_CAST_SPEED)); | |
+ m_maxduration = periodic * ticks; | |
+ } | |
+ m_modifier.periodictime = periodic; | |
+} | |
+ | |
/*********************************************************/ | |
/*** BASIC AURA FUNCTION ***/ | |
/*********************************************************/ | |
diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h | |
index fa7d86d..3ec2b37 100644 | |
--- a/src/game/SpellAuras.h | |
+++ b/src/game/SpellAuras.h | |
@@ -403,6 +403,7 @@ class MANGOS_DLL_SPEC Aura | |
uint32 m_in_use; // > 0 while in Aura::ApplyModifier call/Aura::Update/etc | |
private: | |
+ void ApplyHasteToPeriodic(); | |
void CleanupTriggeredSpells(); | |
bool IsNeedVisibleSlot(Unit const* caster) const; // helper for check req. visibility slot | |
void ReapplyAffectedPassiveAuras(Unit* target, bool owner_mode); | |
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp | |
index 9fcf50f..291f9f9 100644 | |
--- a/src/game/SpellMgr.cpp | |
+++ b/src/game/SpellMgr.cpp | |
@@ -147,6 +147,20 @@ WeaponAttackType GetWeaponAttackType(SpellEntry const *spellInfo) | |
} | |
} | |
+int32 ApplyHasteToChannelSpell(int32 dur, SpellEntry const* spellInfo, Spell const* spell) | |
+{ | |
+ if (!spell) | |
+ return dur; | |
+ | |
+ if(Player* modOwner = spell->GetCaster()->GetSpellModOwner()) | |
+ modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CASTING_TIME, dur, spell); | |
+ | |
+ if( !(spellInfo->Attributes & (SPELL_ATTR_UNK4|SPELL_ATTR_TRADESPELL)) ) | |
+ dur = int32(dur * spell->GetCaster()->GetFloatValue(UNIT_MOD_CAST_SPEED)); | |
+ | |
+ return dur; | |
+} | |
+ | |
bool IsPassiveSpell(uint32 spellId) | |
{ | |
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); | |
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h | |
index c50a35c..22bebcd 100644 | |
--- a/src/game/SpellMgr.h | |
+++ b/src/game/SpellMgr.h | |
@@ -126,6 +126,7 @@ inline uint32 GetSpellRecoveryTime(SpellEntry const *spellInfo) { return spellIn | |
int32 GetSpellDuration(SpellEntry const *spellInfo); | |
int32 GetSpellMaxDuration(SpellEntry const *spellInfo); | |
uint16 GetSpellAuraMaxTicks(SpellEntry const* spellInfo); | |
+int32 ApplyHasteToChannelSpell(int32 dur, SpellEntry const* spellInfo, Spell const* spell); | |
WeaponAttackType GetWeaponAttackType(SpellEntry const *spellInfo); | |
inline bool IsSpellHaveEffect(SpellEntry const *spellInfo, SpellEffects effect) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment