[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

@ -274,7 +274,7 @@ std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi)
return ss;
}
SpellModifier::SpellModifier( SpellModOp _op, SpellModType _type, int32 _value, SpellEntry const* spellEntry, uint8 eff, int16 _charges /*= 0*/ ) : op(_op), type(_type), charges(_charges), value(_value), spellId(spellEntry->Id), lastAffected(NULL)
SpellModifier::SpellModifier( SpellModOp _op, SpellModType _type, int32 _value, SpellEntry const* spellEntry, SpellEffectIndex eff, int16 _charges /*= 0*/ ) : op(_op), type(_type), charges(_charges), value(_value), spellId(spellEntry->Id), lastAffected(NULL)
{
uint32 const* ptr = spellEntry->GetEffectSpellClassMask(eff);
mask = uint64(ptr[0]) | (uint64(ptr[1]) << 32);
@ -3280,7 +3280,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank, bo
// remove pet auras
for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
if(PetAura const* petSpell = sSpellMgr.GetPetAura(spell_id, i))
if(PetAura const* petSpell = sSpellMgr.GetPetAura(spell_id, SpellEffectIndex(i)))
RemovePetAura(petSpell);
// free talent points
@ -4256,9 +4256,9 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
{
int32 delta = (int32(getLevel()) - startLevel + 1)*MINUTE;
for(int i =0; i < MAX_EFFECT_INDEX; ++i)
for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
{
if(Aura* Aur = GetAura(SPELL_ID_PASSIVE_RESURRECTION_SICKNESS,i))
if(Aura* Aur = GetAura(SPELL_ID_PASSIVE_RESURRECTION_SICKNESS,SpellEffectIndex(i)))
{
Aur->SetAuraDuration(delta*IN_MILISECONDS);
Aur->SendAuraUpdate(false);
@ -7080,7 +7080,7 @@ void Player::ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply
bool found = false;
for (int k=0; k < MAX_EFFECT_INDEX; ++k)
{
spellEffectPair spair = spellEffectPair(spellInfo->Id, k);
spellEffectPair spair = spellEffectPair(spellInfo->Id, SpellEffectIndex(k));
for (AuraMap::const_iterator iter = m_Auras.lower_bound(spair); iter != m_Auras.upper_bound(spair); ++iter)
{
if(!item || iter->second->GetCastItemGUID() == item->GetGUID())
@ -15266,7 +15266,7 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff)
Field *fields = result->Fetch();
uint64 caster_guid = fields[0].GetUInt64();
uint32 spellid = fields[1].GetUInt32();
uint32 effindex = fields[2].GetUInt32();
SpellEffectIndex effindex = SpellEffectIndex(fields[2].GetUInt32());
uint32 stackcount = fields[3].GetUInt32();
int32 damage = fields[4].GetInt32();
int32 maxduration = fields[5].GetInt32();
@ -15274,13 +15274,13 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff)
int32 remaincharges = fields[7].GetInt32();
SpellEntry const* spellproto = sSpellStore.LookupEntry(spellid);
if(!spellproto)
if (!spellproto)
{
sLog.outError("Unknown aura (spellid %u, effindex %u), ignore.",spellid,effindex);
continue;
}
if(effindex >= 3)
if (effindex >= MAX_EFFECT_INDEX)
{
sLog.outError("Invalid effect index (spellid %u, effindex %u), ignore.",spellid,effindex);
continue;
@ -15296,19 +15296,19 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff)
}
// prevent wrong values of remaincharges
if(spellproto->procCharges)
if (spellproto->procCharges)
{
if(remaincharges <= 0 || remaincharges > (int32)spellproto->procCharges)
if (remaincharges <= 0 || remaincharges > (int32)spellproto->procCharges)
remaincharges = spellproto->procCharges;
}
else
remaincharges = 0;
for(uint32 i=0; i < stackcount; ++i)
for(uint32 i = 0; i < stackcount; ++i)
{
Aura* aura = CreateAura(spellproto, effindex, NULL, this, NULL);
if(!damage)
if (!damage)
damage = aura->GetModifier()->m_amount;
// reset stolen single target auras
@ -19242,7 +19242,7 @@ void Player::SendAurasForTarget(Unit *target)
{
for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
{
if(Aura *aura = target->GetAura(itr->second, j))
if(Aura *aura = target->GetAura(itr->second, SpellEffectIndex(j)))
{
data << uint8(aura->GetAuraSlot());
data << uint32(aura->GetId());
@ -21535,7 +21535,7 @@ void Player::SendDuelCountdown(uint32 counter)
GetSession()->SendPacket(&data);
}
bool Player::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const
bool Player::IsImmunedToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const
{
switch(spellInfo->Effect[index])
{