From 7c555add76f9151ebc1a77ecbb50a042eefffbbc Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Wed, 17 Feb 2010 19:06:09 +0100 Subject: [PATCH] [9403] Replace number with enum name where explicitly used in array/other checks Signed-off-by: NoFantasy --- src/game/Creature.cpp | 2 +- src/game/CreatureEventAI.cpp | 4 +-- src/game/GridNotifiers.h | 2 +- src/game/Level3.cpp | 4 +-- src/game/ObjectMgr.cpp | 4 +-- src/game/Player.cpp | 22 +++++++------- src/game/Spell.cpp | 22 +++++++------- src/game/SpellAuras.cpp | 42 +++++++++++++------------- src/game/SpellEffects.cpp | 38 +++++++++++------------ src/game/SpellHandler.cpp | 4 +-- src/game/SpellMgr.cpp | 30 +++++++++---------- src/game/SpellMgr.h | 22 +++++++------- src/game/Unit.cpp | 58 ++++++++++++++++++------------------ src/shared/revision_nr.h | 2 +- 14 files changed, 128 insertions(+), 128 deletions(-) diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 22ced0bc1..c989812a2 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -1731,7 +1731,7 @@ bool Creature::LoadCreaturesAddon(bool reload) Aura* AdditionalAura = CreateAura(AdditionalSpellInfo, cAura->effect_idx, NULL, this, this, 0); AddAura(AdditionalAura); - sLog.outDebug("Spell: %u with Aura %u added to creature (GUIDLow: %u Entry: %u )", cAura->spell_id, AdditionalSpellInfo->EffectApplyAuraName[0],GetGUIDLow(),GetEntry()); + sLog.outDebug("Spell: %u with Aura %u added to creature (GUIDLow: %u Entry: %u )", cAura->spell_id, AdditionalSpellInfo->EffectApplyAuraName[EFFECT_INDEX_0],GetGUIDLow(),GetEntry()); } } return true; diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index 90dcf1087..44d1f1401 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -293,7 +293,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction { //Note: checked only aura for effect 0, if need check aura for effect 1/2 then // possible way: pack in event.buffed.amount 2 uint16 (ammount+effectIdx) - Aura* aura = m_creature->GetAura(event.buffed.spellId,0); + Aura* aura = m_creature->GetAura(event.buffed.spellId, EFFECT_INDEX_0); if (!aura || aura->GetStackAmount() < event.buffed.amount) return false; @@ -309,7 +309,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction //Note: checked only aura for effect 0, if need check aura for effect 1/2 then // possible way: pack in event.buffed.amount 2 uint16 (ammount+effectIdx) - Aura* aura = pActionInvoker->GetAura(event.buffed.spellId,0); + Aura* aura = pActionInvoker->GetAura(event.buffed.spellId, EFFECT_INDEX_0); if(!aura || aura->GetStackAmount() < event.buffed.amount) return false; diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h index 059621bec..9d3255df2 100644 --- a/src/game/GridNotifiers.h +++ b/src/game/GridNotifiers.h @@ -710,7 +710,7 @@ namespace MaNGOS bool operator()(Unit* u) { if(u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && - !(u->HasAura(i_spell, 0) || u->HasAura(i_spell, 1) || u->HasAura(i_spell, 2))) + !(u->HasAura(i_spell, EFFECT_INDEX_0) || u->HasAura(i_spell, EFFECT_INDEX_1) || u->HasAura(i_spell, EFFECT_INDEX_2))) { return true; } diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 1e2c3a37f..fb703f82d 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -2909,7 +2909,7 @@ bool ChatHandler::HandleLookupSpellCommand(const char* args) if(loc < MAX_LOCALE) { bool known = target && target->HasSpell(id); - bool learn = (spellInfo->Effect[0] == SPELL_EFFECT_LEARN_SPELL); + bool learn = (spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_LEARN_SPELL); uint32 talentCost = GetTalentSpellCost(id); @@ -2919,7 +2919,7 @@ bool ChatHandler::HandleLookupSpellCommand(const char* args) // unit32 used to prevent interpreting uint8 as char at output // find rank of learned spell for learning spell, or talent rank - uint32 rank = talentCost ? talentCost : sSpellMgr.GetSpellRank(learn ? spellInfo->EffectTriggerSpell[0] : id); + uint32 rank = talentCost ? talentCost : sSpellMgr.GetSpellRank(learn ? spellInfo->EffectTriggerSpell[EFFECT_INDEX_0] : id); // send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format std::ostringstream ss; diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 1065da900..23708fdac 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -7467,7 +7467,7 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val sLog.outErrorDb("Aura condition requires to have non existing spell (Id: %d), skipped", value1); return false; } - if(value2 > 2) + if(value2 > EFFECT_INDEX_2) { sLog.outErrorDb("Aura condition requires to have non existing effect index (%u) (must be 0..2), skipped", value2); return false; @@ -7571,7 +7571,7 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val sLog.outErrorDb("Aura condition requires to have non existing spell (Id: %d), skipped", value1); return false; } - if(value2 > 2) + if(value2 > EFFECT_INDEX_2) { sLog.outErrorDb("Aura condition requires to have non existing effect index (%u) (must be 0..2), skipped", value2); return false; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 348b0a867..46c03557c 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1960,7 +1960,7 @@ void Player::RewardRage( uint32 damage, uint32 weaponSpeedHitFactor, bool attack addRage = damage/rageconversion*2.5f; // Berserker Rage effect - if(HasAura(18499,0)) + if (HasAura(18499, EFFECT_INDEX_0)) addRage *= 1.3f; } @@ -13129,7 +13129,7 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver ) for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) if(itr->second->autocast && itr->second->IsFitToRequirements(this,zone,area)) - if( !HasAura(itr->second->spellId,0) ) + if (!HasAura(itr->second->spellId, EFFECT_INDEX_0) ) CastSpell(this,itr->second->spellId,true); } @@ -13319,7 +13319,7 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) if(itr->second->autocast && itr->second->IsFitToRequirements(this,zone,area)) - if( !HasAura(itr->second->spellId,0) ) + if (!HasAura(itr->second->spellId, EFFECT_INDEX_0)) CastSpell(this,itr->second->spellId,true); } @@ -18624,7 +18624,7 @@ void Player::ReportedAfkBy(Player* reporter) return; // check if player has 'Idle' or 'Inactive' debuff - if(m_bgData.bgAfkReporter.find(reporter->GetGUIDLow()) == m_bgData.bgAfkReporter.end() && !HasAura(43680, 0) && !HasAura(43681, 0) && reporter->CanReportAfkDueToLimit()) + if(m_bgData.bgAfkReporter.find(reporter->GetGUIDLow()) == m_bgData.bgAfkReporter.end() && !HasAura(43680, EFFECT_INDEX_0) && !HasAura(43681, EFFECT_INDEX_0) && reporter->CanReportAfkDueToLimit()) { m_bgData.bgAfkReporter.insert(reporter->GetGUIDLow()); // 3 players have to complain to apply debuff @@ -19139,7 +19139,7 @@ void Player::learnQuestRewardedSpells(Quest const* quest) return; // prevent learn non first rank unknown profession and second specialization for same profession) - uint32 learned_0 = spellInfo->EffectTriggerSpell[0]; + uint32 learned_0 = spellInfo->EffectTriggerSpell[EFFECT_INDEX_0]; if( sSpellMgr.GetSpellRank(learned_0) > 1 && !HasSpell(learned_0) ) { // not have first rank learned (unlearned prof?) @@ -19152,7 +19152,7 @@ void Player::learnQuestRewardedSpells(Quest const* quest) return; // specialization - if(learnedInfo->Effect[0]==SPELL_EFFECT_TRADE_SKILL && learnedInfo->Effect[1]==0) + if (learnedInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_TRADE_SKILL && learnedInfo->Effect[EFFECT_INDEX_1] == 0) { // search other specialization for same prof for(PlayerSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr) @@ -19165,7 +19165,7 @@ void Player::learnQuestRewardedSpells(Quest const* quest) return; // compare only specializations - if(itrInfo->Effect[0]!=SPELL_EFFECT_TRADE_SKILL || itrInfo->Effect[1]!=0) + if (itrInfo->Effect[EFFECT_INDEX_0] != SPELL_EFFECT_TRADE_SKILL || itrInfo->Effect[EFFECT_INDEX_1] != 0) continue; // compare same chain spells @@ -19667,7 +19667,7 @@ uint32 Player::GetResurrectionSpellId() // Reincarnation (passive spell) // prio: 1 // Glyph of Renewed Life remove reagent requiremnnt - if (prio < 1 && HasSpell(20608) && !HasSpellCooldown(21169) && (HasItemCount(17030,1) || HasAura(58059, 0))) + if (prio < 1 && HasSpell(20608) && !HasSpellCooldown(21169) && (HasItemCount(17030,1) || HasAura(58059, EFFECT_INDEX_0))) spell_id = 21169; return spell_id; @@ -19889,7 +19889,7 @@ void Player::UpdateZoneDependentAuras( uint32 newZone ) SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(newZone); for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) if(itr->second->autocast && itr->second->IsFitToRequirements(this,newZone,0)) - if( !HasAura(itr->second->spellId,0) ) + if (!HasAura(itr->second->spellId, EFFECT_INDEX_0)) CastSpell(this,itr->second->spellId,true); } @@ -19909,7 +19909,7 @@ void Player::UpdateAreaDependentAuras( uint32 newArea ) SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(newArea); for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) if(itr->second->autocast && itr->second->IsFitToRequirements(this,m_zoneUpdateId,newArea)) - if( !HasAura(itr->second->spellId,0) ) + if (!HasAura(itr->second->spellId, EFFECT_INDEX_0)) CastSpell(this,itr->second->spellId,true); } @@ -20152,7 +20152,7 @@ bool Player::CanUseBattleGroundObject() //i'm not sure if these two are correct, because invisible players should get visible when they click on flag !HasStealthAura() && // not stealthed !HasInvisibilityAura() && // not invisible - !HasAura(SPELL_RECENTLY_DROPPED_FLAG, 0) && // can't pickup + !HasAura(SPELL_RECENTLY_DROPPED_FLAG, EFFECT_INDEX_0) &&// can't pickup isAlive() // live player ); } diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 01e9eef07..cd8b58d81 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -104,8 +104,8 @@ bool IsQuestTameSpell(uint32 spellId) if (!spellproto) return false; - return spellproto->Effect[0] == SPELL_EFFECT_THREAT - && spellproto->Effect[1] == SPELL_EFFECT_APPLY_AURA && spellproto->EffectApplyAuraName[1] == SPELL_AURA_DUMMY; + return spellproto->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_THREAT + && spellproto->Effect[EFFECT_INDEX_1] == SPELL_EFFECT_APPLY_AURA && spellproto->EffectApplyAuraName[EFFECT_INDEX_1] == SPELL_AURA_DUMMY; } SpellCastTargets::SpellCastTargets() @@ -1362,9 +1362,9 @@ void Spell::SetTargetMap(uint32 effIndex, uint32 targetMode, UnitList& targetUni // overwrite EffectChainTarget for non single target spell if (Spell* currSpell = m_caster->GetCurrentSpell(CURRENT_GENERIC_SPELL)) if (currSpell->m_spellInfo->MaxAffectedTargets > 0 || - currSpell->m_spellInfo->EffectChainTarget[0] > 0 || - currSpell->m_spellInfo->EffectChainTarget[1] > 0 || - currSpell->m_spellInfo->EffectChainTarget[2] > 0) + currSpell->m_spellInfo->EffectChainTarget[EFFECT_INDEX_0] > 0 || + currSpell->m_spellInfo->EffectChainTarget[EFFECT_INDEX_1] > 0 || + currSpell->m_spellInfo->EffectChainTarget[EFFECT_INDEX_2] > 0) EffectChainTarget = 0; // no chain targets } break; @@ -2900,7 +2900,7 @@ void Spell::update(uint32 difftime) // check if the player caster has moved before the spell finished if ((m_caster->GetTypeId() == TYPEID_PLAYER && m_timer != 0) && (m_castPositionX != m_caster->GetPositionX() || m_castPositionY != m_caster->GetPositionY() || m_castPositionZ != m_caster->GetPositionZ()) && - (m_spellInfo->Effect[0] != SPELL_EFFECT_STUCK || !((Player*)m_caster)->m_movementInfo.HasMovementFlag(MOVEFLAG_FALLINGFAR))) + (m_spellInfo->Effect[EFFECT_INDEX_0] != SPELL_EFFECT_STUCK || !((Player*)m_caster)->m_movementInfo.HasMovementFlag(MOVEFLAG_FALLINGFAR))) { // always cancel for channeled spells if( m_spellState == SPELL_STATE_CASTING ) @@ -3436,12 +3436,12 @@ void Spell::SendLogExecute() data << uint32(count1); // count1 (effect count?) for(uint32 i = 0; i < count1; ++i) { - data << uint32(m_spellInfo->Effect[0]); // spell effect + data << uint32(m_spellInfo->Effect[EFFECT_INDEX_0]);// spell effect uint32 count2 = 1; data << uint32(count2); // count2 (target count?) for(uint32 j = 0; j < count2; ++j) { - switch(m_spellInfo->Effect[0]) + switch(m_spellInfo->Effect[EFFECT_INDEX_0]) { case SPELL_EFFECT_POWER_DRAIN: if(Unit *unit = m_targets.getUnitTarget()) @@ -3482,7 +3482,7 @@ void Spell::SendLogExecute() break; case SPELL_EFFECT_CREATE_ITEM: case SPELL_EFFECT_CREATE_ITEM_2: - data << uint32(m_spellInfo->EffectItemType[0]); + data << uint32(m_spellInfo->EffectItemType[EFFECT_INDEX_0]); break; case SPELL_EFFECT_SUMMON: case SPELL_EFFECT_TRANS_DOOR: @@ -4040,7 +4040,7 @@ SpellCastResult Spell::CheckCast(bool strict) if( m_caster->GetTypeId() == TYPEID_PLAYER && ((Player*)m_caster)->isMoving() ) { // skip stuck spell to allow use it in falling case and apply spell limitations at movement - if( (!((Player*)m_caster)->m_movementInfo.HasMovementFlag(MOVEFLAG_FALLINGFAR) || m_spellInfo->Effect[0] != SPELL_EFFECT_STUCK) && + if( (!((Player*)m_caster)->m_movementInfo.HasMovementFlag(MOVEFLAG_FALLINGFAR) || m_spellInfo->Effect[EFFECT_INDEX_0] != SPELL_EFFECT_STUCK) && (IsAutoRepeat() || (m_spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED) != 0) ) return SPELL_FAILED_MOVING; } @@ -4113,7 +4113,7 @@ SpellCastResult Spell::CheckCast(bool strict) // If 0 spell effect empty - client not send target data (need use selection) // TODO: check it on next client version if (m_targets.m_targetMask == TARGET_FLAG_SELF && - m_spellInfo->EffectImplicitTargetA[1] == TARGET_CHAIN_DAMAGE) + m_spellInfo->EffectImplicitTargetA[EFFECT_INDEX_1] == TARGET_CHAIN_DAMAGE) { if (target = m_caster->GetUnit(*m_caster, ((Player *)m_caster)->GetSelection())) m_targets.setUnitTarget(target); diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index c5038c9ed..d39887453 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -610,7 +610,7 @@ void Aura::Update(uint32 diff) // GetEffIndex()==0 prevent double/triple apply manaPerSecond/manaPerSecondPerLevel to same spell with many auras // all spells with manaPerSecond/manaPerSecondPerLevel have aura in effect 0 - if(GetEffIndex()==0 && m_timeCla <= 0) + if (GetEffIndex() == EFFECT_INDEX_0 && m_timeCla <= 0) { if(Unit* caster = GetCaster()) { @@ -2388,8 +2388,8 @@ void Aura::HandleAuraDummy(bool apply, bool Real) else { if( m_target->GetTypeId() == TYPEID_PLAYER && - ( GetSpellProto()->Effect[0]==72 || GetSpellProto()->Effect[0]==6 && - ( GetSpellProto()->EffectApplyAuraName[0]==1 || GetSpellProto()->EffectApplyAuraName[0]==128 ) ) ) + (GetSpellProto()->Effect[EFFECT_INDEX_0] == 72 || GetSpellProto()->Effect[EFFECT_INDEX_0] == 6 && + (GetSpellProto()->EffectApplyAuraName[EFFECT_INDEX_0] == 1 || GetSpellProto()->EffectApplyAuraName[EFFECT_INDEX_0] == 128))) { // spells with SpellEffect=72 and aura=4: 6196, 6197, 21171, 21425 ((Player*)m_target)->SetFarSightGUID(0); @@ -2828,7 +2828,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) return; } - if(GetEffIndex()==0 && m_target->GetTypeId()==TYPEID_PLAYER) + if (GetEffIndex() == EFFECT_INDEX_0 && m_target->GetTypeId() == TYPEID_PLAYER) { SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAuraMapBounds(GetId()); if(saBounds.first != saBounds.second) @@ -2844,7 +2844,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) // some auras applied at aura apply else if(itr->second->autocast) { - if( !m_target->HasAura(itr->second->spellId, 0) ) + if (!m_target->HasAura(itr->second->spellId, EFFECT_INDEX_0)) m_target->CastSpell(m_target, itr->second->spellId, true); } } @@ -3135,7 +3135,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) if(itr->second->state == PLAYERSPELL_REMOVED) continue; SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139) - Rage_val += m_target->CalculateSpellDamage(spellInfo, 0, spellInfo->EffectBasePoints[0], m_target) * 10; + Rage_val += m_target->CalculateSpellDamage(spellInfo, 0, spellInfo->EffectBasePoints[EFFECT_INDEX_0], m_target) * 10; } } @@ -4315,7 +4315,7 @@ void Aura::HandleAuraModIncreaseFlightSpeed(bool apply, bool Real) m_target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,MECHANIC_POLYMORPH,apply); // Dragonmaw Illusion (overwrite mount model, mounted aura already applied) - if( apply && m_target->HasAura(42016,0) && m_target->GetMountID()) + if (apply && m_target->HasAura(42016, EFFECT_INDEX_0) && m_target->GetMountID()) m_target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID,16314); // Festive Holiday Mount @@ -4719,9 +4719,9 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) float mwb_max = caster->GetWeaponDamageRange(BASE_ATTACK,MAXDAMAGE); m_modifier.m_amount+=int32(((mwb_min+mwb_max)/2+ap*mws/14000)*0.2f); // If used while target is above 75% health, Rend does 35% more damage - if( m_spellProto->CalculateSimpleValue(1) !=0 && - m_target->GetHealth() > m_target->GetMaxHealth() * m_spellProto->CalculateSimpleValue(1) / 100) - m_modifier.m_amount += m_modifier.m_amount * m_spellProto->CalculateSimpleValue(2) / 100; + if (m_spellProto->CalculateSimpleValue(EFFECT_INDEX_1) !=0 && + m_target->GetHealth() > m_target->GetMaxHealth() * m_spellProto->CalculateSimpleValue(EFFECT_INDEX_1) / 100) + m_modifier.m_amount += m_modifier.m_amount * m_spellProto->CalculateSimpleValue(EFFECT_INDEX_2) / 100; return; } break; @@ -4729,7 +4729,7 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) case SPELLFAMILY_DRUID: { // Rake - if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000001000) && m_spellProto->Effect[2]==SPELL_EFFECT_ADD_COMBO_POINTS) + if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000001000) && m_spellProto->Effect[EFFECT_INDEX_2] == SPELL_EFFECT_ADD_COMBO_POINTS) { // $AP*0.18/3 bonus per tick m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 6 / 100); @@ -6129,7 +6129,7 @@ void Aura::HandleSpellSpecificBoosts(bool apply) if (dummyEntry->SpellFamilyName == SPELLFAMILY_PRIEST && dummyEntry->SpellIconID == 2218 && dummyEntry->SpellVisual[0]==0) { - chance = (*itr)->GetSpellProto()->CalculateSimpleValue(1); + chance = (*itr)->GetSpellProto()->CalculateSimpleValue(EFFECT_INDEX_1); break; } } @@ -6582,11 +6582,11 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real) SpellEntry const* vSpell = (*itr)->GetSpellProto(); // Rapture (main spell) - if(vSpell->SpellFamilyName == SPELLFAMILY_PRIEST && vSpell->SpellIconID == 2894 && vSpell->Effect[1]) + if(vSpell->SpellFamilyName == SPELLFAMILY_PRIEST && vSpell->SpellIconID == 2894 && vSpell->Effect[EFFECT_INDEX_1]) { switch((*itr)->GetEffIndex()) { - case 0: + case EFFECT_INDEX_0: { // energize caster int32 manapct1000 = 5 * ((*itr)->GetModifier()->m_amount + sSpellMgr.GetSpellRank(vSpell->Id)); @@ -6594,7 +6594,7 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real) caster->CastCustomSpell(caster, 47755, &basepoints0, NULL, NULL, true); break; } - case 1: + case EFFECT_INDEX_1: { // energize target if (!roll_chance_i((*itr)->GetModifier()->m_amount) || caster->HasAura(63853)) @@ -6674,7 +6674,7 @@ void Aura::PeriodicTick() case 38772: { uint32 percent = - GetEffIndex() < 2 && GetSpellProto()->Effect[GetEffIndex()] == SPELL_EFFECT_DUMMY ? + GetEffIndex() < EFFECT_INDEX_2 && GetSpellProto()->Effect[GetEffIndex()] == SPELL_EFFECT_DUMMY ? pCaster->CalculateSpellDamage(GetSpellProto(), GetEffIndex() + 1, GetSpellProto()->EffectBasePoints[GetEffIndex() + 1], m_target) : 100; if(m_target->GetHealth() * 100 >= m_target->GetMaxHealth() * percent ) @@ -7506,7 +7506,7 @@ void Aura::PeriodicDummyTick() if (rage == 0) return; int32 mod = (rage < 100) ? rage : 100; - int32 points = m_target->CalculateSpellDamage(spell, 1, spell->EffectBasePoints[1], m_target); + int32 points = m_target->CalculateSpellDamage(spell, 1, spell->EffectBasePoints[EFFECT_INDEX_1], m_target); int32 regen = m_target->GetMaxHealth() * (mod * points / 10) / 1000; m_target->CastCustomSpell(m_target, 22845, ®en, NULL, NULL, true, NULL, this); m_target->SetPower(POWER_RAGE, rage-mod); @@ -7620,7 +7620,7 @@ void Aura::PeriodicDummyTick() if (spell->SpellFamilyFlags & UI64LIT(0x0000400000000000)) { // Get 0 effect aura - Aura *slow = m_target->GetAura(GetId(), 0); + Aura *slow = m_target->GetAura(GetId(), EFFECT_INDEX_0); if (slow) { slow->ApplyModifier(false, true); @@ -7642,7 +7642,7 @@ void Aura::PeriodicDummyTick() { // Increases your attack power by $s1 for every $s2 armor value you have. // Calculate AP bonus (from 1 efect of this spell) - int32 apBonus = m_modifier.m_amount * m_target->GetArmor() / m_target->CalculateSpellDamage(spell, 1, spell->EffectBasePoints[1], m_target); + int32 apBonus = m_modifier.m_amount * m_target->GetArmor() / m_target->CalculateSpellDamage(spell, 1, spell->EffectBasePoints[EFFECT_INDEX_1], m_target); m_target->CastCustomSpell(m_target, 61217, &apBonus, &apBonus, NULL, true, NULL, this); return; } @@ -7818,7 +7818,7 @@ void Aura::HandlePhase(bool apply, bool Real) ((Player*)m_target)->GetSession()->SendSetPhaseShift(apply ? GetMiscValue() : PHASEMASK_NORMAL); - if(GetEffIndex()==0) + if (GetEffIndex() == EFFECT_INDEX_0) { SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAuraMapBounds(GetId()); if(saBounds.first != saBounds.second) @@ -7834,7 +7834,7 @@ void Aura::HandlePhase(bool apply, bool Real) // some auras applied at aura apply else if(itr->second->autocast) { - if( !m_target->HasAura(itr->second->spellId, 0) ) + if (!m_target->HasAura(itr->second->spellId, EFFECT_INDEX_0)) m_target->CastSpell(m_target, itr->second->spellId, true); } } diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index c317ce038..bc0f92511 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -399,7 +399,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) // Shockwave ${$m3/100*$AP} else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000800000000000)) { - int32 pct = m_caster->CalculateSpellDamage(m_spellInfo, 2, m_spellInfo->EffectBasePoints[2], unitTarget); + int32 pct = m_caster->CalculateSpellDamage(m_spellInfo, 2, m_spellInfo->EffectBasePoints[EFFECT_INDEX_2], unitTarget); if (pct > 0) damage+= int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * pct / 100); break; @@ -500,7 +500,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) if ((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_PRIEST && ((*i)->GetSpellProto()->SpellIconID == 95)) { - int chance = (*i)->GetSpellProto()->CalculateSimpleValue(1); + int chance = (*i)->GetSpellProto()->CalculateSimpleValue(EFFECT_INDEX_1); if (roll_chance_i(chance)) // Mind Trauma m_caster->CastSpell(unitTarget, 48301, true); @@ -525,7 +525,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) m_caster->SetPower(POWER_ENERGY,energy-used_energy); } // Rake - else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000001000) && m_spellInfo->Effect[2]==SPELL_EFFECT_ADD_COMBO_POINTS) + else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000001000) && m_spellInfo->Effect[EFFECT_INDEX_2] == SPELL_EFFECT_ADD_COMBO_POINTS) { // $AP*0.01 bonus damage += int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) / 100); @@ -571,7 +571,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) { if ((*iter)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_ROGUE && (*iter)->GetSpellProto()->SpellIconID == 1960) { - if (int32 chance = (*iter)->GetSpellProto()->CalculateSimpleValue(2)) + if (int32 chance = (*iter)->GetSpellProto()->CalculateSimpleValue(EFFECT_INDEX_2)) if (roll_chance_i(chance)) needConsume = false; @@ -718,7 +718,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) { // Add main hand dps * effect[2] amount float average = (m_caster->GetFloatValue(UNIT_FIELD_MINDAMAGE) + m_caster->GetFloatValue(UNIT_FIELD_MAXDAMAGE)) / 2; - int32 count = m_caster->CalculateSpellDamage(m_spellInfo, 2, m_spellInfo->EffectBasePoints[2], unitTarget); + int32 count = m_caster->CalculateSpellDamage(m_spellInfo, 2, m_spellInfo->EffectBasePoints[EFFECT_INDEX_2], unitTarget); damage += count * int32(average * IN_MILISECONDS) / m_caster->GetAttackTime(BASE_ATTACK); } // Shield of Righteousness @@ -1276,10 +1276,10 @@ void Spell::EffectDummy(uint32 i) { case 0: { - uint32 spellID = m_spellInfo->CalculateSimpleValue(0); - uint32 reqAuraID = m_spellInfo->CalculateSimpleValue(1); + uint32 spellID = m_spellInfo->CalculateSimpleValue(EFFECT_INDEX_0); + uint32 reqAuraID = m_spellInfo->CalculateSimpleValue(EFFECT_INDEX_1); - if (m_caster->HasAura(reqAuraID,0)) + if (m_caster->HasAura(reqAuraID, EFFECT_INDEX_0)) m_caster->CastSpell(m_caster, spellID, true, NULL); return; } @@ -1491,7 +1491,7 @@ void Spell::EffectDummy(uint32 i) if ((*itr)->GetSpellProto()->SpellIconID == 1989) { // saved rage top stored in next affect - uint32 lastrage = (*itr)->GetSpellProto()->CalculateSimpleValue(1)*10; + uint32 lastrage = (*itr)->GetSpellProto()->CalculateSimpleValue(EFFECT_INDEX_1)*10; if(lastrage < rage) rage -= lastrage; break; @@ -3739,7 +3739,7 @@ void Spell::EffectDispel(uint32 i) // Devour Magic if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->Category == SPELLCATEGORY_DEVOUR_MAGIC) { - int32 heal_amount = m_spellInfo->CalculateSimpleValue(1); + int32 heal_amount = m_spellInfo->CalculateSimpleValue(EFFECT_INDEX_1); m_caster->CastCustomSpell(m_caster, 19658, &heal_amount, NULL, NULL, true); } } @@ -5055,7 +5055,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) // check presence for(int j = 0; j < 4; ++j) - if(unitTarget->HasAura(spells[j],0)) + if(unitTarget->HasAura(spells[j], EFFECT_INDEX_0)) return; // select spell @@ -5295,8 +5295,8 @@ void Spell::EffectScriptEffect(uint32 effIndex) if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER || effIndex!=0) return; - uint32 spellID = m_spellInfo->CalculateSimpleValue(0); - uint32 questID = m_spellInfo->CalculateSimpleValue(1); + uint32 spellID = m_spellInfo->CalculateSimpleValue(EFFECT_INDEX_0); + uint32 questID = m_spellInfo->CalculateSimpleValue(EFFECT_INDEX_1); if (((Player*)unitTarget)->GetQuestStatus(questID) == QUEST_STATUS_COMPLETE && !((Player*)unitTarget)->GetQuestRewardStatus (questID)) unitTarget->CastSpell(unitTarget, spellID, true); @@ -5464,7 +5464,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) case 63521: { // Divine Plea, refresh on target (3 aura slots) - if (Aura* aura = unitTarget->GetAura(54428,0)) + if (Aura* aura = unitTarget->GetAura(54428, EFFECT_INDEX_0)) aura->RefreshAura(); return; } @@ -5526,14 +5526,14 @@ void Spell::EffectScriptEffect(uint32 effIndex) aura->RefreshAura(); // Serpent Sting - Instantly deals 40% of the damage done by your Serpent Sting. - if ((familyFlag & UI64LIT(0x0000000000004000)) && aura->GetEffIndex() == 0) + if ((familyFlag & UI64LIT(0x0000000000004000)) && aura->GetEffIndex() == EFFECT_INDEX_0) { // m_amount already include RAP bonus basePoint = aura->GetModifier()->m_amount * 5 * 40 / 100; spellId = 53353; // Chimera Shot - Serpent } // Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting. - if ((familyFlag & UI64LIT(0x0000008000000000)) && aura->GetEffIndex() == 0) + if ((familyFlag & UI64LIT(0x0000008000000000)) && aura->GetEffIndex() == EFFECT_INDEX_0) { uint32 target_max_mana = unitTarget->GetMaxPower(POWER_MANA); if (!target_max_mana) @@ -5629,7 +5629,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) for(Unit::AuraList::const_iterator itr = m_dummyAuras.begin(); itr != m_dummyAuras.end(); ++itr) { // search seal (offensive seals have judgement's aura dummy spell id in 2 effect - if ((*itr)->GetEffIndex() != 2 || !IsSealSpell((*itr)->GetSpellProto())) + if ((*itr)->GetEffIndex() != EFFECT_INDEX_2 || !IsSealSpell((*itr)->GetSpellProto())) continue; spellId2 = (*itr)->GetModifier()->m_amount; SpellEntry const *judge = sSpellStore.LookupEntry(spellId2); @@ -5643,7 +5643,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) Unit::AuraList const& procTriggerAuras = m_caster->GetAurasByType(SPELL_AURA_PROC_TRIGGER_SPELL); for(Unit::AuraList::const_iterator itr = procTriggerAuras.begin(); itr != procTriggerAuras.end(); ++itr) { - if ((*itr)->GetEffIndex() != 0 || !IsSealSpell((*itr)->GetSpellProto())) + if ((*itr)->GetEffIndex() != EFFECT_INDEX_0 || !IsSealSpell((*itr)->GetSpellProto())) continue; spellId2 = 54158; break; @@ -5684,7 +5684,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) // don't overwrite an existing aura for(uint8 i = 0; i < 5; ++i) - if(unitTarget->HasAura(spellid + i, 0)) + if (unitTarget->HasAura(spellid + i, EFFECT_INDEX_0)) return; unitTarget->CastSpell(unitTarget, spellid+urand(0, 4), true); break; diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index 4f0929bf1..022861d58 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -132,8 +132,8 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) if (SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellid)) { // for implicit area/coord target spells - if (IsPointEffectTarget(Targets(spellInfo->EffectImplicitTargetA[0])) || - IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetA[0]))) + if (IsPointEffectTarget(Targets(spellInfo->EffectImplicitTargetA[EFFECT_INDEX_0])) || + IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetA[EFFECT_INDEX_0]))) Spell::SendCastResult(_player,spellInfo,cast_count,SPELL_FAILED_NO_VALID_TARGETS); // for explicit target spells else diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index d5e2ee5dc..6650c300a 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -239,7 +239,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId) if (spellInfo->SpellFamilyFlags & UI64LIT(0x12040000)) return SPELL_MAGE_ARMOR; - if ((spellInfo->SpellFamilyFlags & UI64LIT(0x1000000)) && spellInfo->EffectApplyAuraName[0]==SPELL_AURA_MOD_CONFUSE) + if ((spellInfo->SpellFamilyFlags & UI64LIT(0x1000000)) && spellInfo->EffectApplyAuraName[EFFECT_INDEX_0] == SPELL_AURA_MOD_CONFUSE) return SPELL_MAGE_POLYMORPH; break; @@ -564,7 +564,7 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex) // many positive auras have negative triggered spells at damage for example and this not make it negative (it can be canceled for example) break; case SPELL_AURA_MOD_STUN: //have positive and negative spells, we can't sort its correctly at this moment. - if(effIndex==0 && spellproto->Effect[1]==0 && spellproto->Effect[2]==0) + if (effIndex == EFFECT_INDEX_0 && spellproto->Effect[EFFECT_INDEX_1] == 0 && spellproto->Effect[EFFECT_INDEX_2] == 0) return false; // but all single stun aura spells is negative // Petrification @@ -599,8 +599,8 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex) spellproto->EffectImplicitTargetA[effIndex] == TARGET_SELF2) && spellproto->SpellFamilyName == SPELLFAMILY_GENERIC) return false; - // but not this if this first effect (don't found batter check) - if(spellproto->Attributes & 0x4000000 && effIndex==0) + // but not this if this first effect (don't found better check) + if (spellproto->Attributes & 0x4000000 && effIndex == EFFECT_INDEX_0) return false; break; case SPELL_AURA_TRANSFORM: @@ -745,7 +745,7 @@ SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32 // talents that learn spells can have stance requirements that need ignore // (this requirement only for client-side stance show in talent description) if( GetTalentSpellCost(spellInfo->Id) > 0 && - (spellInfo->Effect[0]==SPELL_EFFECT_LEARN_SPELL || spellInfo->Effect[1]==SPELL_EFFECT_LEARN_SPELL || spellInfo->Effect[2]==SPELL_EFFECT_LEARN_SPELL) ) + (spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_LEARN_SPELL || spellInfo->Effect[EFFECT_INDEX_1] == SPELL_EFFECT_LEARN_SPELL || spellInfo->Effect[EFFECT_INDEX_2] == SPELL_EFFECT_LEARN_SPELL) ) return SPELL_CAST_OK; uint32 stanceMask = (form ? 1 << (form - 1) : 0); @@ -1805,10 +1805,10 @@ bool SpellMgr::IsProfessionOrRidingSpell(uint32 spellId) if(!spellInfo) return false; - if(spellInfo->Effect[1] != SPELL_EFFECT_SKILL) + if (spellInfo->Effect[EFFECT_INDEX_1] != SPELL_EFFECT_SKILL) return false; - uint32 skill = spellInfo->EffectMiscValue[1]; + uint32 skill = spellInfo->EffectMiscValue[EFFECT_INDEX_1]; return IsProfessionOrRidingSkill(skill); } @@ -1819,10 +1819,10 @@ bool SpellMgr::IsProfessionSpell(uint32 spellId) if(!spellInfo) return false; - if(spellInfo->Effect[1] != SPELL_EFFECT_SKILL) + if (spellInfo->Effect[EFFECT_INDEX_1] != SPELL_EFFECT_SKILL) return false; - uint32 skill = spellInfo->EffectMiscValue[1]; + uint32 skill = spellInfo->EffectMiscValue[EFFECT_INDEX_1]; return IsProfessionSkill(skill); } @@ -1833,10 +1833,10 @@ bool SpellMgr::IsPrimaryProfessionSpell(uint32 spellId) if(!spellInfo) return false; - if(spellInfo->Effect[1] != SPELL_EFFECT_SKILL) + if (spellInfo->Effect[EFFECT_INDEX_1] != SPELL_EFFECT_SKILL) return false; - uint32 skill = spellInfo->EffectMiscValue[1]; + uint32 skill = spellInfo->EffectMiscValue[EFFECT_INDEX_1]; return IsPrimaryProfessionSkill(skill); } @@ -2810,7 +2810,7 @@ void SpellMgr::LoadSpellAreas() continue; } - switch(spellInfo->EffectApplyAuraName[0]) + switch(spellInfo->EffectApplyAuraName[EFFECT_INDEX_0]) { case SPELL_AURA_DUMMY: case SPELL_AURA_PHASE: @@ -3207,7 +3207,7 @@ void SpellMgr::CheckUsedSpells(char const* table) continue; } - if(effectIdx >= 0) + if (effectIdx >= EFFECT_INDEX_0) { if(effectType >= 0 && spellEntry->Effect[effectIdx] != effectType) { @@ -3560,10 +3560,10 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 return false; if(auraSpell > 0) // have expected aura - return player->HasAura(auraSpell,0); + return player->HasAura(auraSpell, EFFECT_INDEX_0); else // not have expected aura - return !player->HasAura(-auraSpell,0); + return !player->HasAura(-auraSpell, EFFECT_INDEX_0); } return true; diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 741b36356..90b140977 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -160,7 +160,7 @@ inline bool IsSealSpell(SpellEntry const *spellInfo) return spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN && ( spellInfo->SpellFamilyFlags & SPELLFAMILYFLAG_PALADIN_SEALS ) && // avoid counting target triggered effect as seal for avoid remove it or seal by it. - spellInfo->EffectImplicitTargetA[0] == TARGET_SELF; + spellInfo->EffectImplicitTargetA[EFFECT_INDEX_0] == TARGET_SELF; } inline bool IsElementalShield(SpellEntry const *spellInfo) @@ -171,17 +171,17 @@ inline bool IsElementalShield(SpellEntry const *spellInfo) inline bool IsExplicitDiscoverySpell(SpellEntry const *spellInfo) { - return ((spellInfo->Effect[0] == SPELL_EFFECT_CREATE_RANDOM_ITEM - && spellInfo->Effect[1] == SPELL_EFFECT_SCRIPT_EFFECT) + return ((spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_CREATE_RANDOM_ITEM + && spellInfo->Effect[EFFECT_INDEX_1] == SPELL_EFFECT_SCRIPT_EFFECT) || spellInfo->Id == 64323); // Book of Glyph Mastery (Effect0==SPELL_EFFECT_SCRIPT_EFFECT without any other data) } inline bool IsLootCraftingSpell(SpellEntry const *spellInfo) { - return (spellInfo->Effect[0]==SPELL_EFFECT_CREATE_RANDOM_ITEM || + return (spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_CREATE_RANDOM_ITEM || // different random cards from Inscription (121==Virtuoso Inking Set category) // also Abyssal Shatter (63), any !=0 infact - (spellInfo->Effect[0]==SPELL_EFFECT_CREATE_ITEM_2 && spellInfo->TotemCategory[0] != 0)); + (spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_CREATE_ITEM_2 && spellInfo->TotemCategory[0] != 0)); } int32 CompareAuraRanks(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2); @@ -330,11 +330,11 @@ inline bool IsAreaEffectTarget( Targets target ) inline bool IsAreaOfEffectSpell(SpellEntry const *spellInfo) { - if(IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetA[0])) || IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetB[0]))) + if(IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetA[EFFECT_INDEX_0])) || IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetB[EFFECT_INDEX_0]))) return true; - if(IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetA[1])) || IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetB[1]))) + if(IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetA[EFFECT_INDEX_1])) || IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetB[EFFECT_INDEX_1]))) return true; - if(IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetA[2])) || IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetB[2]))) + if(IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetA[EFFECT_INDEX_2])) || IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetB[EFFECT_INDEX_2]))) return true; return false; } @@ -353,9 +353,9 @@ inline bool IsAreaAuraEffect(uint32 effect) inline bool IsDispelSpell(SpellEntry const *spellInfo) { - if (spellInfo->Effect[0] == SPELL_EFFECT_DISPEL || - spellInfo->Effect[1] == SPELL_EFFECT_DISPEL || - spellInfo->Effect[2] == SPELL_EFFECT_DISPEL ) + if (spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_DISPEL || + spellInfo->Effect[EFFECT_INDEX_1] == SPELL_EFFECT_DISPEL || + spellInfo->Effect[EFFECT_INDEX_2] == SPELL_EFFECT_DISPEL ) return true; return false; } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 11c235bc4..897782f0e 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1128,13 +1128,13 @@ void Unit::CastCustomSpell(Unit* Victim,SpellEntry const *spellInfo, int32 const Spell *spell = new Spell(this, spellInfo, triggered, originalCaster); if(bp0) - spell->m_currentBasePoints[0] = *bp0-int32(spellInfo->EffectBaseDice[0]); + spell->m_currentBasePoints[EFFECT_INDEX_0] = *bp0-int32(spellInfo->EffectBaseDice[EFFECT_INDEX_0]); if(bp1) - spell->m_currentBasePoints[1] = *bp1-int32(spellInfo->EffectBaseDice[1]); + spell->m_currentBasePoints[EFFECT_INDEX_1] = *bp1-int32(spellInfo->EffectBaseDice[EFFECT_INDEX_1]); if(bp2) - spell->m_currentBasePoints[2] = *bp2-int32(spellInfo->EffectBaseDice[2]); + spell->m_currentBasePoints[EFFECT_INDEX_2] = *bp2-int32(spellInfo->EffectBaseDice[EFFECT_INDEX_2]); SpellCastTargets targets; targets.setUnitTarget( Victim ); @@ -1873,7 +1873,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe if (itr_spellProto->SpellFamilyName == SPELLFAMILY_MAGE && itr_spellProto->SpellIconID == 501) { // chance stored in next dummy effect - chance = itr_spellProto->CalculateSimpleValue(1); + chance = itr_spellProto->CalculateSimpleValue(EFFECT_INDEX_1); break; } } @@ -1956,8 +1956,8 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe spellProto->Id == 60218) // Essence of Gossamer { // Max absorb stored in 1 dummy effect - if (spellProto->EffectBasePoints[1] < currentAbsorb) - currentAbsorb = spellProto->EffectBasePoints[1]; + if (spellProto->EffectBasePoints[EFFECT_INDEX_1] < currentAbsorb) + currentAbsorb = spellProto->EffectBasePoints[EFFECT_INDEX_1]; break; } break; @@ -2002,7 +2002,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe if (spellProto->SpellFamilyFlags & UI64LIT(00000001) && spellProto->Mechanic == MECHANIC_SHIELD) { // Glyph of Power Word: Shield - if (Aura *glyph = pVictim->GetAura(55672,0)) + if (Aura *glyph = pVictim->GetAura(55672, EFFECT_INDEX_0)) { int32 heal = int32(glyph->GetModifier()->m_amount * (RemainingDamage >= currentAbsorb ? currentAbsorb : RemainingDamage) / 100); @@ -2190,7 +2190,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe int32 amount = int32(full_absorb * (*itr)->GetModifier()->m_amount / 100); // apply normalized part of already accumulated amount in aura - if (Aura* spdAura = pVictim->GetAura(44413,0)) + if (Aura* spdAura = pVictim->GetAura(44413, EFFECT_INDEX_0)) amount += spdAura->GetModifier()->m_amount * spdAura->GetAuraDuration() / spdAura->GetAuraMaxDuration(); // limit 5 health percents @@ -5424,7 +5424,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (!roll_chance_i(triggerAmount)) return false; - Aura *aur = GetAura(71905, 0); + Aura *aur = GetAura(71905, EFFECT_INDEX_0); if (aur && uint32(aur->GetStackAmount() + 1) >= aur->GetSpellProto()->StackAmount) { RemoveAurasDueToSpell(71905); @@ -5491,9 +5491,9 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Hot Streak if (dummySpell->SpellIconID == 2999) { - if (effIndex!=0) + if (effIndex != EFFECT_INDEX_0) return true; - Aura *counter = GetAura(triggeredByAura->GetId(), 1); + Aura *counter = GetAura(triggeredByAura->GetId(), EFFECT_INDEX_1); if (!counter) return true; @@ -5804,7 +5804,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (!procSpell) return false; - Aura* healingAura = pVictim->GetAura(procSpell->Id,0); + Aura* healingAura = pVictim->GetAura(procSpell->Id, EFFECT_INDEX_0); if (!healingAura) return false; @@ -5819,7 +5819,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (!procSpell) return false; - Aura* leachAura = pVictim->GetAura(procSpell->Id,0); + Aura* leachAura = pVictim->GetAura(procSpell->Id, EFFECT_INDEX_0); if (!leachAura) return false; @@ -5926,7 +5926,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu { if (SpellEntry const* manaCastEntry = sSpellStore.LookupEntry(60889)) { - int32 mana_percent = manaCastEntry->CalculateSimpleValue(0) * heal_percent; + int32 mana_percent = manaCastEntry->CalculateSimpleValue(EFFECT_INDEX_0) * heal_percent; CastCustomSpell(this, manaCastEntry, &mana_percent, NULL, NULL, true, castItem, triggeredByAura); } } @@ -6012,7 +6012,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (!procSpell) return false; // Only 0 aura can proc - if (effIndex!=0) + if (effIndex != EFFECT_INDEX_0) return true; // Wrath crit if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000001)) @@ -6178,7 +6178,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu case SPELLFAMILY_PALADIN: { // Seal of Righteousness - melee proc dummy (addition ${$MWS*(0.022*$AP+0.044*$SPH)} damage) - if ((dummySpell->SpellFamilyFlags & UI64LIT(0x000000008000000)) && effIndex==0) + if ((dummySpell->SpellFamilyFlags & UI64LIT(0x000000008000000)) && effIndex == EFFECT_INDEX_0) { triggered_spell_id = 25742; float ap = GetTotalAttackPowerValue(BASE_ATTACK); @@ -6297,7 +6297,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Seal of Vengeance (damage calc on apply aura) case 31801: { - if(effIndex != 0) // effect 1,2 used by seal unleashing code + if (effIndex != EFFECT_INDEX_0) // effect 1,2 used by seal unleashing code return false; // At melee attack or Hammer of the Righteous spell damage considered as melee attack @@ -6399,7 +6399,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Seal of Corruption (damage calc on apply aura) case 53736: { - if(effIndex != 0) // effect 1,2 used by seal unleashing code + if (effIndex != EFFECT_INDEX_0) // effect 1,2 used by seal unleashing code return false; // At melee attack or Hammer of the Righteous spell damage considered as melee attack @@ -6456,7 +6456,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (!triggeredEntry) return false; - basepoints0 = int32(damage / (GetSpellDuration(triggeredEntry) / triggeredEntry->EffectAmplitude[0])); + basepoints0 = int32(damage / (GetSpellDuration(triggeredEntry) / triggeredEntry->EffectAmplitude[EFFECT_INDEX_0])); target = this; break; } @@ -6553,7 +6553,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; } - int32 extra_attack_power = CalculateSpellDamage(windfurySpellEntry, 1, windfurySpellEntry->EffectBasePoints[1], pVictim); + int32 extra_attack_power = CalculateSpellDamage(windfurySpellEntry, 1, windfurySpellEntry->EffectBasePoints[EFFECT_INDEX_1], pVictim); // Off-Hand case if ( castItem->GetSlot() == EQUIPMENT_SLOT_OFFHAND ) @@ -6848,7 +6848,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (dummySpell->Id == 49028) { // 1 dummy aura for dismiss rune blade - if (effIndex!=2) + if (effIndex != EFFECT_INDEX_2) return false; // TODO: wite script for this "fights on its own, doing the same attacks" // NOTE: Trigger here on every attack and spell cast @@ -7130,7 +7130,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB // 27526; - drain mana if possible case 43820: // Charm of the Witch Doctor (Amani Charm of the Witch Doctor trinket) // Pct value stored in dummy - basepoints[0] = pVictim->GetCreateHealth() * auraSpellInfo->EffectBasePoints[1] / 100; + basepoints[0] = pVictim->GetCreateHealth() * auraSpellInfo->EffectBasePoints[EFFECT_INDEX_1] / 100; target = pVictim; break; //case 45205: break; // Copy Offhand Weapon @@ -7321,7 +7321,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB else if (auraSpellInfo->Id == 63156 || auraSpellInfo->Id == 63158) { // Looking for dummy effect - Aura *aur = GetAura(auraSpellInfo->Id, 1); + Aura *aur = GetAura(auraSpellInfo->Id, EFFECT_INDEX_1); if (!aur) return false; @@ -7470,7 +7470,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB } // percent stored in effect 1 (class scripts) base points int32 cost = originalSpell->manaCost + originalSpell->ManaCostPercentage * GetCreateMana() / 100; - basepoints[0] = cost*auraSpellInfo->CalculateSimpleValue(1)/100; + basepoints[0] = cost*auraSpellInfo->CalculateSimpleValue(EFFECT_INDEX_1)/100; trigger_spell_id = 20272; target = this; } @@ -7699,7 +7699,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB // This spell doesn't stack, but refreshes duration. So we receive current bonuses to minus them later. int32 curBonus = 0; - if (Aura* aur = owner->GetAura(48090,0)) + if (Aura* aur = owner->GetAura(48090, EFFECT_INDEX_0)) curBonus = aur->GetModifier()->m_amount; int32 spellDamage = owner->SpellBaseDamageBonus(SPELL_SCHOOL_MASK_MAGIC) - curBonus; if(spellDamage <= 0) @@ -8829,7 +8829,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 // effect 1 m_amount int32 maxPercent = (*i)->GetModifier()->m_amount; // effect 0 m_amount - int32 stepPercent = CalculateSpellDamage((*i)->GetSpellProto(), 0, (*i)->GetSpellProto()->EffectBasePoints[0], this); + int32 stepPercent = CalculateSpellDamage((*i)->GetSpellProto(), 0, (*i)->GetSpellProto()->EffectBasePoints[EFFECT_INDEX_0], this); // count affliction effects and calc additional damage in percentage int32 modPercent = 0; AuraMap const& victimAuras = pVictim->GetAuras(); @@ -9579,7 +9579,7 @@ int32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, int32 { TakenTotalMod *= 1.2f; // base bonus at HoTs - if (Aura* glyph = GetAura(62971,0)) // Glyph of Nourish + if (Aura* glyph = GetAura(62971, EFFECT_INDEX_0))// Glyph of Nourish TakenTotalMod *= (glyph->GetModifier()->m_amount * ownHotCount + 100.0f) / 100.0f; } } @@ -9953,8 +9953,8 @@ uint32 Unit::MeleeDamageBonus(Unit *pVictim, uint32 pdamage,WeaponAttackType att case 6428: if(pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT)) { - Aura* eff0 = GetAura((*i)->GetId(), 0); - if (!eff0 || (*i)->GetEffIndex() != 1) + Aura* eff0 = GetAura((*i)->GetId(), EFFECT_INDEX_0); + if (!eff0 || (*i)->GetEffIndex() != EFFECT_INDEX_1) { sLog.outError("Spell structure of DD (%u) changed.",(*i)->GetId()); continue; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index ae490c1fa..afe00df48 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9402" + #define REVISION_NR "9403" #endif // __REVISION_NR_H__