[0109] More spell cast time calculation research, defined SpellAttributesEx9 and SpellAttributesEx10

Signed-off-by: Yaki Khadafi <ElSolDolLo@gmail.com>
This commit is contained in:
Yaki Khadafi 2012-08-17 02:12:34 +03:00 committed by Antz
parent 1f0148a9ec
commit d16be01744
5 changed files with 101 additions and 7 deletions

View file

@ -128,7 +128,27 @@ uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell)
castTime = int32(spellScalingEntry->castTimeMax);
}
else if (SpellCastTimesEntry const* spellCastTimeEntry = sSpellCastTimesStore.LookupEntry(spellInfo->CastingTimeIndex))
castTime = spellCastTimeEntry->CastTime;
{
if (spell)
{
uint32 level = spell->GetCaster()->getLevel();
if (SpellLevelsEntry const* levelsEntry = spellInfo->GetSpellLevels())
{
if (levelsEntry->maxLevel)
level = std::min(level, levelsEntry->maxLevel);
if (levelsEntry->baseLevel)
level = std::max(level, levelsEntry->baseLevel) - levelsEntry->baseLevel;
}
// currently only profession spells have CastTimePerLevel data filled, always negative
castTime = spellCastTimeEntry->CastTime + spellCastTimeEntry->CastTimePerLevel * level;
}
else
castTime = spellCastTimeEntry->CastTime;
if (castTime < spellCastTimeEntry->MinCastTime)
castTime = spellCastTimeEntry->MinCastTime;
}
else
// not all spells have cast time index and this is all is pasiive abilities
return 0;