mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 13:37:00 +00:00
[0103] Use SpellScaling.dbc to calculate cast time
Signed-off-by: Yaki Khadafi <ElSolDolLo@gmail.com>
This commit is contained in:
parent
bfe7e6a96f
commit
a7bf0fe70b
3 changed files with 19 additions and 7 deletions
|
|
@ -1060,6 +1060,7 @@ struct GtRegenMPPerSptEntry
|
||||||
|
|
||||||
struct GtSpellScalingEntry
|
struct GtSpellScalingEntry
|
||||||
{
|
{
|
||||||
|
//uint32 id;
|
||||||
float value;
|
float value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,14 +114,25 @@ uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpellCastTimesEntry const* spellCastTimeEntry = sSpellCastTimesStore.LookupEntry(spellInfo->CastingTimeIndex);
|
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
|
// not all spells have cast time index and this is all is pasiive abilities
|
||||||
if (!spellCastTimeEntry)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int32 castTime = spellCastTimeEntry->CastTime;
|
|
||||||
|
|
||||||
if (spell)
|
if (spell)
|
||||||
{
|
{
|
||||||
if (Player* modOwner = spell->GetCaster()->GetSpellModOwner())
|
if (Player* modOwner = spell->GetCaster()->GetSpellModOwner())
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "0102"
|
#define REVISION_NR "0103"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue