diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index c7efc69d6..1617f9460 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1060,6 +1060,7 @@ struct GtRegenMPPerSptEntry struct GtSpellScalingEntry { + //uint32 id; float value; }; diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 38c8e017c..4bab522df 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -114,14 +114,25 @@ uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell) return 0; } - SpellCastTimesEntry const* spellCastTimeEntry = sSpellCastTimesStore.LookupEntry(spellInfo->CastingTimeIndex); - - // not all spells have cast time index and this is all is pasiive abilities - if (!spellCastTimeEntry) + int32 castTime = 0; + SpellScalingEntry const* spellScalingEntry = spellInfo->GetSpellScaling(); + if (spell && spellScalingEntry && (spell->GetCaster()->GetTypeId() == TYPEID_PLAYER || spell->GetCaster()->GetObjectGuid().IsPet())) + { + uint32 level = spell->GetCaster()->getLevel(); + if (level == 1) + castTime = int32(spellScalingEntry->castTimeMin); + else if (level < spellScalingEntry->castScalingMaxLevel) + castTime = int32(spellScalingEntry->castTimeMin + float(level - 1) * + (spellScalingEntry->castTimeMax - spellScalingEntry->castTimeMin) / (spellScalingEntry->castScalingMaxLevel - 1)); + else + castTime = int32(spellScalingEntry->castTimeMax); + } + else if (SpellCastTimesEntry const* spellCastTimeEntry = sSpellCastTimesStore.LookupEntry(spellInfo->CastingTimeIndex)) + castTime = spellCastTimeEntry->CastTime; + else + // not all spells have cast time index and this is all is pasiive abilities return 0; - int32 castTime = spellCastTimeEntry->CastTime; - if (spell) { if (Player* modOwner = spell->GetCaster()->GetSpellModOwner()) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index ba49ba625..f980f5500 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "0102" + #define REVISION_NR "0103" #endif // __REVISION_NR_H__