Work under spell mods

* Add support > 64 bit spellFamily mask
    * Remove not used fields in SpellModifier
    * Remove not used (and not correct work vs charges) GetTotalFlatMods, GetTotalPctMods
    * Use DBC based data for spell_affect
    * More better work SPELL_AURA_ADD_TARGET_TRIGGER aura

Signed-off-by: DiSlord <dislord@nomail.com>
This commit is contained in:
DiSlord 2008-12-08 23:22:39 +03:00
parent 916bd178a2
commit 9b842b6fdc
13 changed files with 145 additions and 127 deletions

View file

@ -16361,42 +16361,6 @@ void Player::CharmSpellInitialize()
GetSession()->SendPacket(&data);
}
int32 Player::GetTotalFlatMods(uint32 spellId, SpellModOp op)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
if (!spellInfo) return 0;
int32 total = 0;
for (SpellModList::iterator itr = m_spellMods[op].begin(); itr != m_spellMods[op].end(); ++itr)
{
SpellModifier *mod = *itr;
if(!IsAffectedBySpellmod(spellInfo,mod))
continue;
if (mod->type == SPELLMOD_FLAT)
total += mod->value;
}
return total;
}
int32 Player::GetTotalPctMods(uint32 spellId, SpellModOp op)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
if (!spellInfo) return 0;
int32 total = 0;
for (SpellModList::iterator itr = m_spellMods[op].begin(); itr != m_spellMods[op].end(); ++itr)
{
SpellModifier *mod = *itr;
if(!IsAffectedBySpellmod(spellInfo,mod))
continue;
if (mod->type == SPELLMOD_PCT)
total += mod->value;
}
return total;
}
bool Player::IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mod, Spell const* spell)
{
if (!mod || !spellInfo)
@ -16414,22 +16378,25 @@ bool Player::IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mo
return false;
}
return spellmgr.IsAffectedBySpell(spellInfo,mod->spellId,mod->effectId,mod->mask);
return spellmgr.IsAffectedByMod(spellInfo, mod);
}
void Player::AddSpellMod(SpellModifier* mod, bool apply)
{
uint16 Opcode= (mod->type == SPELLMOD_FLAT) ? SMSG_SET_FLAT_SPELL_MODIFIER : SMSG_SET_PCT_SPELL_MODIFIER;
for(int eff=0;eff<64;++eff)
for(int eff=0;eff<96;++eff)
{
uint64 _mask = uint64(1) << eff;
if ( mod->mask & _mask)
uint64 _mask = 0;
uint64 _mask2= 0;
if (eff<64) _mask = uint64(1) << (eff- 0);
else _mask2= uint64(1) << (eff-64);
if ( mod->mask & _mask || mod->mask2 & _mask2)
{
int32 val = 0;
for (SpellModList::iterator itr = m_spellMods[mod->op].begin(); itr != m_spellMods[mod->op].end(); ++itr)
{
if ((*itr)->type == mod->type && (*itr)->mask & _mask)
if ((*itr)->type == mod->type && ((*itr)->mask & _mask || (*itr)->mask2 & _mask2))
val += (*itr)->value;
}
val += apply ? mod->value : -(mod->value);