[9411] More SpellEffectIndex using in apropriate cases

This commit is contained in:
VladimirMangos 2010-02-19 04:27:24 +03:00
parent 6469c21c41
commit 84080aaf60
26 changed files with 199 additions and 196 deletions

View file

@ -154,7 +154,7 @@ bool IsPassiveSpell(uint32 spellId)
return (spellInfo->Attributes & SPELL_ATTR_PASSIVE) != 0;
}
bool IsNoStackAuraDueToAura(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2)
bool IsNoStackAuraDueToAura(uint32 spellId_1, SpellEffectIndex effIndex_1, uint32 spellId_2, SpellEffectIndex effIndex_2)
{
SpellEntry const *spellInfo_1 = sSpellStore.LookupEntry(spellId_1);
SpellEntry const *spellInfo_2 = sSpellStore.LookupEntry(spellId_2);
@ -170,7 +170,7 @@ bool IsNoStackAuraDueToAura(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_
return true;
}
int32 CompareAuraRanks(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2)
int32 CompareAuraRanks(uint32 spellId_1, SpellEffectIndex effIndex_1, uint32 spellId_2, SpellEffectIndex effIndex_2)
{
SpellEntry const*spellInfo_1 = sSpellStore.LookupEntry(spellId_1);
SpellEntry const*spellInfo_2 = sSpellStore.LookupEntry(spellId_2);
@ -464,7 +464,7 @@ bool IsExplicitNegativeTarget(uint32 targetA)
return false;
}
bool IsPositiveEffect(uint32 spellId, uint32 effIndex)
bool IsPositiveEffect(uint32 spellId, SpellEffectIndex effIndex)
{
SpellEntry const *spellproto = sSpellStore.LookupEntry(spellId);
if (!spellproto) return false;
@ -542,19 +542,20 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex)
case SPELL_AURA_ADD_TARGET_TRIGGER:
return true;
case SPELL_AURA_PERIODIC_TRIGGER_SPELL:
if(spellId != spellproto->EffectTriggerSpell[effIndex])
if (spellId != spellproto->EffectTriggerSpell[effIndex])
{
uint32 spellTriggeredId = spellproto->EffectTriggerSpell[effIndex];
SpellEntry const *spellTriggeredProto = sSpellStore.LookupEntry(spellTriggeredId);
if(spellTriggeredProto)
if (spellTriggeredProto)
{
// non-positive targets of main spell return early
for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
{
// if non-positive trigger cast targeted to positive target this main cast is non-positive
// this will place this spell auras as debuffs
if(IsPositiveTarget(spellTriggeredProto->EffectImplicitTargetA[effIndex],spellTriggeredProto->EffectImplicitTargetB[effIndex]) && !IsPositiveEffect(spellTriggeredId,i))
if (IsPositiveTarget(spellTriggeredProto->EffectImplicitTargetA[effIndex],spellTriggeredProto->EffectImplicitTargetB[effIndex]) &&
!IsPositiveEffect(spellTriggeredId,SpellEffectIndex(i)))
return false;
}
}
@ -681,12 +682,13 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex)
bool IsPositiveSpell(uint32 spellId)
{
SpellEntry const *spellproto = sSpellStore.LookupEntry(spellId);
if (!spellproto) return false;
if (!spellproto)
return false;
// spells with atleast one negative effect are considered negative
// some self-applied spells have negative effects but in self casting case negative check ignored.
for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
if (!IsPositiveEffect(spellId, i))
if (!IsPositiveEffect(spellId, SpellEffectIndex(i)))
return false;
return true;
}
@ -1872,11 +1874,10 @@ SpellEntry const* SpellMgr::SelectAuraRankForPlayerLevel(SpellEntry const* spell
bool needRankSelection = false;
for(int i=0;i<3;++i)
{
if( IsPositiveEffect(spellInfo->Id, i) && (
if (IsPositiveEffect(spellInfo->Id, SpellEffectIndex(i)) && (
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA ||
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PARTY ||
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_RAID
) )
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_RAID))
{
needRankSelection = true;
break;
@ -2098,8 +2099,8 @@ void SpellMgr::LoadSpellLearnSkills()
if ( dbc_node.skill != SKILL_RIDING )
dbc_node.value = 1;
else
dbc_node.value = entry->CalculateSimpleValue(i)*75;
dbc_node.maxvalue = entry->CalculateSimpleValue(i)*75;
dbc_node.value = entry->CalculateSimpleValue(SpellEffectIndex(i))*75;
dbc_node.maxvalue = entry->CalculateSimpleValue(SpellEffectIndex(i))*75;
mSpellLearnSkills[spell] = dbc_node;
++dbc_count;
@ -2388,10 +2389,16 @@ void SpellMgr::LoadSpellPetAuras()
bar.step();
uint32 spell = fields[0].GetUInt32();
uint8 eff = fields[1].GetUInt8();
SpellEffectIndex eff = SpellEffectIndex(fields[1].GetUInt32());
uint32 pet = fields[2].GetUInt32();
uint32 aura = fields[3].GetUInt32();
if (eff >= MAX_EFFECT_INDEX)
{
sLog.outErrorDb("Spell %u listed in `spell_pet_auras` with wrong spell effect index (%u)", spell, eff);
continue;
}
SpellPetAuraMap::iterator itr = mSpellPetAuraMap.find((spell<<8) + eff);
if(itr != mSpellPetAuraMap.end())
{