[0103] Use SpellScaling.dbc to calculate cast time

Signed-off-by: Yaki Khadafi <ElSolDolLo@gmail.com>
This commit is contained in:
Yaki Khadafi 2012-08-16 18:10:33 +03:00 committed by Antz
parent bfe7e6a96f
commit a7bf0fe70b
3 changed files with 19 additions and 7 deletions

View file

@ -1060,6 +1060,7 @@ struct GtRegenMPPerSptEntry
struct GtSpellScalingEntry
{
//uint32 id;
float value;
};

View file

@ -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())

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "0102"
#define REVISION_NR "0103"
#endif // __REVISION_NR_H__