diff options
Diffstat (limited to 'src/server/game/Spells/SpellEffects.cpp')
-rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 590 |
1 files changed, 295 insertions, 295 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index fa4b8ea9a4a..9e4284c6738 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -230,17 +230,17 @@ SpellEffectHandlerFn SpellEffectHandlers[TOTAL_SPELL_EFFECTS] = &Spell::EffectRemoveAura, //164 SPELL_EFFECT_REMOVE_AURA }; -void Spell::EffectNULL(SpellEffIndex /*effIndex*/) +void Spell::EffectNULL() { TC_LOG_DEBUG("spells", "WORLD: Spell Effect DUMMY"); } -void Spell::EffectUnused(SpellEffIndex /*effIndex*/) +void Spell::EffectUnused() { // NOT USED BY ANY SPELL OR USELESS OR IMPLEMENTED IN DIFFERENT WAY IN TRINITY } -void Spell::EffectResurrectNew(SpellEffIndex effIndex) +void Spell::EffectResurrectNew() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -262,13 +262,13 @@ void Spell::EffectResurrectNew(SpellEffIndex effIndex) return; uint32 health = damage; - uint32 mana = m_spellInfo->Effects[effIndex].MiscValue; - ExecuteLogEffectResurrect(effIndex, player); + uint32 mana = effectInfo->MiscValue; + ExecuteLogEffectResurrect(effectInfo->EffectIndex, player); player->SetResurrectRequestData(m_caster, health, mana, 0); SendResurrectRequest(player); } -void Spell::EffectInstaKill(SpellEffIndex /*effIndex*/) +void Spell::EffectInstaKill() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -292,7 +292,7 @@ void Spell::EffectInstaKill(SpellEffIndex /*effIndex*/) Unit::DealDamage(GetUnitCasterForEffectHandlers(), unitTarget, unitTarget->GetHealth(), nullptr, NODAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); } -void Spell::EffectEnvironmentalDMG(SpellEffIndex /*effIndex*/) +void Spell::EffectEnvironmentalDMG() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -316,7 +316,7 @@ void Spell::EffectEnvironmentalDMG(SpellEffIndex /*effIndex*/) } } -void Spell::EffectSchoolDMG(SpellEffIndex effIndex) +void Spell::EffectSchoolDMG() { if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET) return; @@ -338,7 +338,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) if (ihit->MissCondition != SPELL_MISS_NONE) continue; - if (ihit->EffectMask & (1 << effIndex)) + if (ihit->EffectMask & (1 << effectInfo->EffectIndex)) ++count; } @@ -359,7 +359,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) { uint8 level = unitCaster->GetLevel(); uint32 block_value = unitCaster->GetShieldBlockValue(uint32(float(level) * 24.5f), uint32(float(level) * 34.5f)); - damage += int32(unitCaster->ApplyEffectModifiers(m_spellInfo, effIndex, float(block_value))); + damage += int32(unitCaster->ApplyEffectModifiers(m_spellInfo, effectInfo->EffectIndex, float(block_value))); } // Victory Rush else if (m_spellInfo->SpellFamilyFlags[1] & 0x100) @@ -495,7 +495,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) { // converts each extra point of energy into ($f1+$AP/410) additional damage float ap = unitCaster->GetTotalAttackPowerValue(BASE_ATTACK); - float multiple = ap / 410 + m_spellInfo->Effects[effIndex].DamageMultiplier; + float multiple = ap / 410 + effectInfo->DamageMultiplier; int32 energy = -(unitCaster->ModifyPower(POWER_ENERGY, -30)); damage += int32(energy * multiple); damage += int32(CalculatePct(unitCaster->ToPlayer()->GetComboPoints() * ap, 7)); @@ -686,7 +686,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) if (unitCaster && damage > 0 && apply_direct_bonus) { - damage = unitCaster->SpellDamageBonusDone(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE, effIndex, { }); + damage = unitCaster->SpellDamageBonusDone(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE, *effectInfo, { }); damage = unitTarget->SpellDamageBonusTaken(unitCaster, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE); } @@ -694,7 +694,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) } } -void Spell::EffectDummy(SpellEffIndex effIndex) +void Spell::EffectDummy() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -705,7 +705,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) // pet auras if (m_caster->GetTypeId() == TYPEID_PLAYER) { - if (PetAura const* petSpell = sSpellMgr->GetPetAura(m_spellInfo->Id, effIndex)) + if (PetAura const* petSpell = sSpellMgr->GetPetAura(m_spellInfo->Id, effectInfo->EffectIndex)) { m_caster->ToPlayer()->AddPetAura(petSpell); return; @@ -713,20 +713,20 @@ void Spell::EffectDummy(SpellEffIndex effIndex) } // normal DB scripted effect - TC_LOG_DEBUG("spells", "Spell ScriptStart spellid %u in EffectDummy(%u)", m_spellInfo->Id, effIndex); - m_caster->GetMap()->ScriptsStart(sSpellScripts, uint32(m_spellInfo->Id | (effIndex << 24)), m_caster, unitTarget); + TC_LOG_DEBUG("spells", "Spell ScriptStart spellid %u in EffectDummy(%u)", m_spellInfo->Id, uint32(effectInfo->EffectIndex)); + m_caster->GetMap()->ScriptsStart(sSpellScripts, uint32(m_spellInfo->Id | (effectInfo->EffectIndex << 24)), m_caster, unitTarget); } -void Spell::EffectTriggerSpell(SpellEffIndex effIndex) +void Spell::EffectTriggerSpell() { if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET && effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH) return; - uint32 triggered_spell_id = m_spellInfo->Effects[effIndex].TriggerSpell; + uint32 triggered_spell_id = effectInfo->TriggerSpell; /// @todo move those to spell scripts - if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_TRIGGER_SPELL + if (effectInfo->Effect == SPELL_EFFECT_TRIGGER_SPELL && effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH_TARGET) { Unit* unitCaster = GetUnitCasterForEffectHandlers(); @@ -784,7 +784,7 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex) if (triggered_spell_id == 0) { - TC_LOG_WARN("spells.effect.nospell", "Spell::EffectTriggerSpell: Spell %u [EffectIndex: %u] does not have triggered spell.", m_spellInfo->Id, effIndex); + TC_LOG_WARN("spells.effect.nospell", "Spell::EffectTriggerSpell: Spell %u [EffectIndex: %u] does not have triggered spell.", m_spellInfo->Id, uint32(effectInfo->EffectIndex)); return; } @@ -805,7 +805,7 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex) } else //if (effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH) { - if (spellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) && (m_spellInfo->Effects[effIndex].GetProvidedTargetMask() & TARGET_FLAG_UNIT_MASK)) + if (spellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) && (effectInfo->GetProvidedTargetMask() & TARGET_FLAG_UNIT_MASK)) return; if (spellInfo->GetExplicitTargetMask() & TARGET_FLAG_DEST_LOCATION) @@ -824,7 +824,7 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex) CastSpellExtraArgs args(m_originalCasterGUID); // set basepoints for trigger with value effect - if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE) + if (effectInfo->Effect == SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE) for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i) args.AddSpellMod(SpellValueMod(SPELLVALUE_BASE_POINT0 + i), damage); @@ -832,16 +832,16 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex) m_caster->CastSpell(targets, spellInfo->Id, args); } -void Spell::EffectTriggerMissileSpell(SpellEffIndex effIndex) +void Spell::EffectTriggerMissileSpell() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET && effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; - uint32 triggered_spell_id = m_spellInfo->Effects[effIndex].TriggerSpell; + uint32 triggered_spell_id = effectInfo->TriggerSpell; if (triggered_spell_id == 0) { - TC_LOG_WARN("spells.effect.nospell", "Spell::EffectTriggerMissileSpell: Spell %u [EffectIndex: %u] does not have triggered spell.", m_spellInfo->Id, effIndex); + TC_LOG_WARN("spells.effect.nospell", "Spell::EffectTriggerMissileSpell: Spell %u [EffectIndex: %u] does not have triggered spell.", m_spellInfo->Id, uint32(effectInfo->EffectIndex)); return; } @@ -862,7 +862,7 @@ void Spell::EffectTriggerMissileSpell(SpellEffIndex effIndex) } else //if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT) { - if (spellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) && (m_spellInfo->Effects[effIndex].GetProvidedTargetMask() & TARGET_FLAG_UNIT_MASK)) + if (spellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) && (effectInfo->GetProvidedTargetMask() & TARGET_FLAG_UNIT_MASK)) return; if (spellInfo->GetExplicitTargetMask() & TARGET_FLAG_DEST_LOCATION) @@ -876,7 +876,7 @@ void Spell::EffectTriggerMissileSpell(SpellEffIndex effIndex) CastSpellExtraArgs args(m_originalCasterGUID); // set basepoints for trigger with value effect - if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_TRIGGER_MISSILE_SPELL_WITH_VALUE) + if (effectInfo->Effect == SPELL_EFFECT_TRIGGER_MISSILE_SPELL_WITH_VALUE) for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i) args.AddSpellMod(SpellValueMod(SPELLVALUE_BASE_POINT0 + i), damage); @@ -884,7 +884,7 @@ void Spell::EffectTriggerMissileSpell(SpellEffIndex effIndex) m_caster->CastSpell(targets, spellInfo->Id, args); } -void Spell::EffectForceCast(SpellEffIndex effIndex) +void Spell::EffectForceCast() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -892,10 +892,10 @@ void Spell::EffectForceCast(SpellEffIndex effIndex) if (!unitTarget) return; - uint32 triggered_spell_id = m_spellInfo->Effects[effIndex].TriggerSpell; + uint32 triggered_spell_id = effectInfo->TriggerSpell; if (triggered_spell_id == 0) { - TC_LOG_WARN("spells.effect.nospell", "Spell::EffectForceCast: Spell %u [EffectIndex: %u] does not have triggered spell.", m_spellInfo->Id, effIndex); + TC_LOG_WARN("spells.effect.nospell", "Spell::EffectForceCast: Spell %u [EffectIndex: %u] does not have triggered spell.", m_spellInfo->Id, uint32(effectInfo->EffectIndex)); return; } @@ -908,7 +908,7 @@ void Spell::EffectForceCast(SpellEffIndex effIndex) return; } - if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_FORCE_CAST && damage) + if (effectInfo->Effect == SPELL_EFFECT_FORCE_CAST && damage) { switch (m_spellInfo->Id) { @@ -935,22 +935,22 @@ void Spell::EffectForceCast(SpellEffIndex effIndex) } CastSpellExtraArgs args(TRIGGERED_FULL_MASK); - if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_FORCE_CAST_WITH_VALUE) + if (effectInfo->Effect == SPELL_EFFECT_FORCE_CAST_WITH_VALUE) for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i) args.AddSpellMod(SpellValueMod(SPELLVALUE_BASE_POINT0 + i), damage); unitTarget->CastSpell(m_caster, spellInfo->Id, args); } -void Spell::EffectTriggerRitualOfSummoning(SpellEffIndex effIndex) +void Spell::EffectTriggerRitualOfSummoning() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; - uint32 triggered_spell_id = m_spellInfo->Effects[effIndex].TriggerSpell; + uint32 triggered_spell_id = effectInfo->TriggerSpell; if (triggered_spell_id == 0) { - TC_LOG_WARN("spells.effect.nospell", "Spell::EffectTriggerRitualOfSummoning: Spell %u [EffectIndex: %u] does not have triggered spell.", m_spellInfo->Id, effIndex); + TC_LOG_WARN("spells.effect.nospell", "Spell::EffectTriggerRitualOfSummoning: Spell %u [EffectIndex: %u] does not have triggered spell.", m_spellInfo->Id, uint32(effectInfo->EffectIndex)); return; } @@ -967,7 +967,7 @@ void Spell::EffectTriggerRitualOfSummoning(SpellEffIndex effIndex) m_caster->CastSpell(nullptr, spellInfo->Id, false); } -void Spell::CalculateJumpSpeeds(SpellInfo const* spellInfo, uint8 i, float dist, float& speedXY, float& speedZ) +void Spell::CalculateJumpSpeeds(SpellEffectInfo const& spellEffectInfo, float dist, float& speedXY, float& speedZ) { Unit* unitCaster = GetUnitCasterForEffectHandlers(); ASSERT(unitCaster); @@ -975,7 +975,7 @@ void Spell::CalculateJumpSpeeds(SpellInfo const* spellInfo, uint8 i, float dist, if (Creature* creature = unitCaster->ToCreature()) runSpeed *= creature->GetCreatureTemplate()->speed_run; - float multiplier = m_spellInfo->Effects[i].ValueMultiplier; + float multiplier = spellEffectInfo.ValueMultiplier; if (multiplier <= 0.0f) multiplier = 1.0f; @@ -983,8 +983,8 @@ void Spell::CalculateJumpSpeeds(SpellInfo const* spellInfo, uint8 i, float dist, float duration = dist / speedXY; float durationSqr = duration * duration; - float minHeight = spellInfo->Effects[i].MiscValue ? spellInfo->Effects[i].MiscValue / 10.0f : 0.5f; // Lower bound is blizzlike - float maxHeight = spellInfo->Effects[i].MiscValueB ? spellInfo->Effects[i].MiscValueB / 10.0f : 1000.0f; // Upper bound is unknown + float minHeight = spellEffectInfo.MiscValue ? spellEffectInfo.MiscValue / 10.0f : 0.5f; // Lower bound is blizzlike + float maxHeight = spellEffectInfo.MiscValueB ? spellEffectInfo.MiscValueB / 10.0f : 1000.0f; // Upper bound is unknown float height; if (durationSqr < minHeight * 8 / Movement::gravity) height = minHeight; @@ -996,7 +996,7 @@ void Spell::CalculateJumpSpeeds(SpellInfo const* spellInfo, uint8 i, float dist, speedZ = std::sqrt(2 * Movement::gravity * height); } -void Spell::EffectJump(SpellEffIndex effIndex) +void Spell::EffectJump() { if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET) return; @@ -1012,11 +1012,11 @@ void Spell::EffectJump(SpellEffIndex effIndex) return; float speedXY, speedZ; - CalculateJumpSpeeds(m_spellInfo, effIndex, unitCaster->GetExactDist2d(unitTarget), speedXY, speedZ); + CalculateJumpSpeeds(*effectInfo, unitCaster->GetExactDist2d(unitTarget), speedXY, speedZ); unitCaster->GetMotionMaster()->MoveJump(*unitTarget, speedXY, speedZ, EVENT_JUMP, false); } -void Spell::EffectJumpDest(SpellEffIndex effIndex) +void Spell::EffectJumpDest() { if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH) return; @@ -1032,11 +1032,11 @@ void Spell::EffectJumpDest(SpellEffIndex effIndex) return; float speedXY, speedZ; - CalculateJumpSpeeds(m_spellInfo, effIndex, unitCaster->GetExactDist2d(destTarget), speedXY, speedZ); + CalculateJumpSpeeds(*effectInfo, unitCaster->GetExactDist2d(destTarget), speedXY, speedZ); unitCaster->GetMotionMaster()->MoveJump(*destTarget, speedXY, speedZ, EVENT_JUMP, !m_targets.GetObjectTargetGUID().IsEmpty()); } -void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/) +void Spell::EffectTeleportUnits() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -1070,7 +1070,7 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/) } } -void Spell::EffectApplyAura(SpellEffIndex effIndex) +void Spell::EffectApplyAura() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -1081,12 +1081,12 @@ void Spell::EffectApplyAura(SpellEffIndex effIndex) // register target/effect on aura AuraApplication* aurApp = _spellAura->GetApplicationOfTarget(unitTarget->GetGUID()); if (!aurApp) - aurApp = unitTarget->_CreateAuraApplication(_spellAura, 1 << effIndex); + aurApp = unitTarget->_CreateAuraApplication(_spellAura, 1 << effectInfo->EffectIndex); else - aurApp->UpdateApplyEffectMask(aurApp->GetEffectsToApply() | 1 << effIndex); + aurApp->UpdateApplyEffectMask(aurApp->GetEffectsToApply() | 1 << effectInfo->EffectIndex); } -void Spell::EffectUnlearnSpecialization(SpellEffIndex effIndex) +void Spell::EffectUnlearnSpecialization() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -1095,22 +1095,22 @@ void Spell::EffectUnlearnSpecialization(SpellEffIndex effIndex) return; Player* player = unitTarget->ToPlayer(); - uint32 spellToUnlearn = m_spellInfo->Effects[effIndex].TriggerSpell; + uint32 spellToUnlearn = effectInfo->TriggerSpell; player->RemoveSpell(spellToUnlearn); TC_LOG_DEBUG("spells", "Spell: Player %s has unlearned spell %u from Npc %s", player->GetGUID().ToString().c_str(), spellToUnlearn, m_caster->GetGUID().ToString().c_str()); } -void Spell::EffectPowerDrain(SpellEffIndex effIndex) +void Spell::EffectPowerDrain() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; - if (m_spellInfo->Effects[effIndex].MiscValue < 0 || m_spellInfo->Effects[effIndex].MiscValue >= int8(MAX_POWERS)) + if (effectInfo->MiscValue < 0 || effectInfo->MiscValue >= int8(MAX_POWERS)) return; - Powers powerType = Powers(m_spellInfo->Effects[effIndex].MiscValue); + Powers powerType = Powers(effectInfo->MiscValue); if (!unitTarget || !unitTarget->IsAlive() || unitTarget->GetPowerType() != powerType || damage < 0) return; @@ -1118,7 +1118,7 @@ void Spell::EffectPowerDrain(SpellEffIndex effIndex) // add spell damage bonus if (unitCaster) { - damage = unitCaster->SpellDamageBonusDone(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE, effIndex, { }); + damage = unitCaster->SpellDamageBonusDone(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE, *effectInfo, { }); damage = unitTarget->SpellDamageBonusTaken(unitCaster, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); } @@ -1133,15 +1133,15 @@ void Spell::EffectPowerDrain(SpellEffIndex effIndex) float gainMultiplier = 0.f; if (unitCaster && unitCaster != unitTarget) { - gainMultiplier = m_spellInfo->Effects[effIndex].CalcValueMultiplier(unitCaster, this); + gainMultiplier = effectInfo->CalcValueMultiplier(unitCaster, this); int32 const gain = int32(newDamage * gainMultiplier); unitCaster->EnergizeBySpell(unitCaster, m_spellInfo, gain, powerType); } - ExecuteLogEffectTakeTargetPower(effIndex, unitTarget, powerType, newDamage, gainMultiplier); + ExecuteLogEffectTakeTargetPower(effectInfo->EffectIndex, unitTarget, powerType, newDamage, gainMultiplier); } -void Spell::EffectSendEvent(SpellEffIndex effIndex) +void Spell::EffectSendEvent() { // we do not handle a flag dropping or clicking on flag in battleground by sendevent system if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET @@ -1166,7 +1166,7 @@ void Spell::EffectSendEvent(SpellEffIndex effIndex) // this check was requested by scripters, but it has some downsides: // now it's impossible to script (using sEventScripts) a cast which misses all targets // or to have an ability to script the moment spell hits dest (in a case when there are object targets present) - if (m_spellInfo->Effects[effIndex].GetProvidedTargetMask() & (TARGET_FLAG_UNIT_MASK | TARGET_FLAG_GAMEOBJECT_MASK)) + if (effectInfo->GetProvidedTargetMask() & (TARGET_FLAG_UNIT_MASK | TARGET_FLAG_GAMEOBJECT_MASK)) return; // some spells have no target entries in dbc and they use focus target if (focusObject) @@ -1174,25 +1174,25 @@ void Spell::EffectSendEvent(SpellEffIndex effIndex) /// @todo there should be a possibility to pass dest target to event script } - TC_LOG_DEBUG("spells", "Spell ScriptStart %u for spellid %u in EffectSendEvent ", m_spellInfo->Effects[effIndex].MiscValue, m_spellInfo->Id); + TC_LOG_DEBUG("spells", "Spell ScriptStart %u for spellid %u in EffectSendEvent ", effectInfo->MiscValue, m_spellInfo->Id); if (ZoneScript* zoneScript = m_caster->GetZoneScript()) - zoneScript->ProcessEvent(target, m_spellInfo->Effects[effIndex].MiscValue); + zoneScript->ProcessEvent(target, effectInfo->MiscValue); else if (InstanceScript* instanceScript = m_caster->GetInstanceScript()) // needed in case Player is the caster - instanceScript->ProcessEvent(target, m_spellInfo->Effects[effIndex].MiscValue); + instanceScript->ProcessEvent(target, effectInfo->MiscValue); - m_caster->GetMap()->ScriptsStart(sEventScripts, m_spellInfo->Effects[effIndex].MiscValue, m_caster, target); + m_caster->GetMap()->ScriptsStart(sEventScripts, effectInfo->MiscValue, m_caster, target); } -void Spell::EffectPowerBurn(SpellEffIndex effIndex) +void Spell::EffectPowerBurn() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; - if (m_spellInfo->Effects[effIndex].MiscValue < 0 || m_spellInfo->Effects[effIndex].MiscValue >= int8(MAX_POWERS)) + if (effectInfo->MiscValue < 0 || effectInfo->MiscValue >= int8(MAX_POWERS)) return; - Powers powerType = Powers(m_spellInfo->Effects[effIndex].MiscValue); + Powers powerType = Powers(effectInfo->MiscValue); if (!unitTarget || !unitTarget->IsAlive() || unitTarget->GetPowerType() != powerType || damage < 0) return; @@ -1215,17 +1215,17 @@ void Spell::EffectPowerBurn(SpellEffIndex effIndex) int32 newDamage = -(unitTarget->ModifyPower(powerType, -power)); // NO - Not a typo - EffectPowerBurn uses effect value multiplier - not effect damage multiplier - float dmgMultiplier = m_spellInfo->Effects[effIndex].CalcValueMultiplier(unitCaster, this); + float dmgMultiplier = effectInfo->CalcValueMultiplier(unitCaster, this); // add log data before multiplication (need power amount, not damage) - ExecuteLogEffectTakeTargetPower(effIndex, unitTarget, powerType, newDamage, 0.0f); + ExecuteLogEffectTakeTargetPower(effectInfo->EffectIndex, unitTarget, powerType, newDamage, 0.0f); newDamage = int32(newDamage * dmgMultiplier); m_damage += newDamage; } -void Spell::EffectHeal(SpellEffIndex effIndex) +void Spell::EffectHeal() { if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET) return; @@ -1296,9 +1296,9 @@ void Spell::EffectHeal(SpellEffIndex effIndex) } // Death Pact - return pct of max health to caster else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && m_spellInfo->SpellFamilyFlags[0] & 0x00080000) - addhealth = unitCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, int32(unitCaster->CountPctFromMaxHealth(damage)), HEAL, effIndex, { }); + addhealth = unitCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, int32(unitCaster->CountPctFromMaxHealth(damage)), HEAL, *effectInfo, { }); else - addhealth = unitCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL, effIndex, { }); + addhealth = unitCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL, *effectInfo, { }); addhealth = unitTarget->SpellHealingBonusTaken(unitCaster, m_spellInfo, addhealth, HEAL); @@ -1309,7 +1309,7 @@ void Spell::EffectHeal(SpellEffIndex effIndex) m_healing += addhealth; } -void Spell::EffectHealPct(SpellEffIndex effIndex) +void Spell::EffectHealPct() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -1320,14 +1320,14 @@ void Spell::EffectHealPct(SpellEffIndex effIndex) uint32 heal = unitTarget->CountPctFromMaxHealth(damage); if (Unit* unitCaster = GetUnitCasterForEffectHandlers()) { - heal = unitCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, heal, HEAL, effIndex, { }); + heal = unitCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, heal, HEAL, *effectInfo, { }); heal = unitTarget->SpellHealingBonusTaken(unitCaster, m_spellInfo, heal, HEAL); } m_healing += heal; } -void Spell::EffectHealMechanical(SpellEffIndex effIndex) +void Spell::EffectHealMechanical() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -1338,14 +1338,14 @@ void Spell::EffectHealMechanical(SpellEffIndex effIndex) uint32 heal = damage; if (Unit* unitCaster = GetUnitCasterForEffectHandlers()) { - heal = unitCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, heal, HEAL, effIndex, { }); + heal = unitCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, heal, HEAL, *effectInfo, { }); heal = unitTarget->SpellHealingBonusTaken(unitCaster, m_spellInfo, heal, HEAL); } m_healing += heal; } -void Spell::EffectHealthLeech(SpellEffIndex effIndex) +void Spell::EffectHealthLeech() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -1356,13 +1356,13 @@ void Spell::EffectHealthLeech(SpellEffIndex effIndex) Unit* unitCaster = GetUnitCasterForEffectHandlers(); if (unitCaster) { - damage = unitCaster->SpellDamageBonusDone(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE, effIndex, { }); + damage = unitCaster->SpellDamageBonusDone(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE, *effectInfo, { }); damage = unitTarget->SpellDamageBonusTaken(unitCaster, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); } TC_LOG_DEBUG("spells", "HealthLeech :%i", damage); - float healMultiplier = m_spellInfo->Effects[effIndex].CalcValueMultiplier(unitCaster, this); + float healMultiplier = effectInfo->CalcValueMultiplier(unitCaster, this); m_damage += damage; @@ -1376,7 +1376,7 @@ void Spell::EffectHealthLeech(SpellEffIndex effIndex) if (unitCaster && unitCaster->IsAlive()) { - healthGain = unitCaster->SpellHealingBonusDone(unitCaster, m_spellInfo, healthGain, HEAL, effIndex, { }); + healthGain = unitCaster->SpellHealingBonusDone(unitCaster, m_spellInfo, healthGain, HEAL, *effectInfo, { }); healthGain = unitCaster->SpellHealingBonusTaken(unitCaster, m_spellInfo, healthGain, HEAL); HealInfo healInfo(unitCaster, unitCaster, healthGain, m_spellInfo, m_spellSchoolMask); @@ -1384,14 +1384,14 @@ void Spell::EffectHealthLeech(SpellEffIndex effIndex) } } -void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype) +void Spell::DoCreateItem(uint32 itemId) { if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; Player* player = unitTarget->ToPlayer(); - uint32 newitemid = itemtype; + uint32 newitemid = itemId; ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(newitemid); if (!pProto) { @@ -1431,7 +1431,7 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype) // the chance of getting a perfect result float perfectCreateChance = 0.0f; // the resulting perfect item if successful - uint32 perfectItemType = itemtype; + uint32 perfectItemType = itemId; // get perfection capability and chance if (CanCreatePerfectItem(player, m_spellInfo->Id, perfectCreateChance, perfectItemType)) if (roll_chance_f(perfectCreateChance)) // if the roll succeeds... @@ -1509,16 +1509,16 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype) */ } -void Spell::EffectCreateItem(SpellEffIndex effIndex) +void Spell::EffectCreateItem() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; - DoCreateItem(effIndex, m_spellInfo->Effects[effIndex].ItemType); - ExecuteLogEffectCreateItem(effIndex, m_spellInfo->Effects[effIndex].ItemType); + DoCreateItem(effectInfo->ItemType); + ExecuteLogEffectCreateItem(effectInfo->EffectIndex, effectInfo->ItemType); } -void Spell::EffectCreateItem2(SpellEffIndex effIndex) +void Spell::EffectCreateItem2() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -1536,16 +1536,16 @@ void Spell::EffectCreateItem2(SpellEffIndex effIndex) } else // If there's no random loot entries for this spell, pick the item associated with this spell { - uint32 item_id = m_spellInfo->Effects[effIndex].ItemType; + uint32 item_id = effectInfo->ItemType; if (item_id) - DoCreateItem(effIndex, item_id); + DoCreateItem(item_id); } - /// @todo ExecuteLogEffectCreateItem(i, m_spellInfo->Effects[i].ItemType); + /// @todo ExecuteLogEffectCreateItem(effectInfo->EffectIndex, effectInfo->ItemType); } -void Spell::EffectCreateRandomItem(SpellEffIndex /*effIndex*/) +void Spell::EffectCreateRandomItem() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -1556,10 +1556,10 @@ void Spell::EffectCreateRandomItem(SpellEffIndex /*effIndex*/) // create some random items player->AutoStoreLoot(m_spellInfo->Id, LootTemplates_Spell); - /// @todo ExecuteLogEffectCreateItem(i, m_spellInfo->Effects[i].ItemType); + /// @todo ExecuteLogEffectCreateItem(effectInfo->EffectIndex, effectInfo->ItemType); } -void Spell::EffectPersistentAA(SpellEffIndex effIndex) +void Spell::EffectPersistentAA() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; @@ -1569,13 +1569,13 @@ void Spell::EffectPersistentAA(SpellEffIndex effIndex) return; // only handle at last effect - for (uint8 i = effIndex + 1; i < MAX_SPELL_EFFECTS; ++i) - if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA) + for (size_t i = effectInfo->EffectIndex + 1; i < m_spellInfo->GetEffects().size(); ++i) + if (m_spellInfo->GetEffect(SpellEffIndex(i)).Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA) return; ASSERT(!_dynObjAura); - float radius = m_spellInfo->Effects[effIndex].CalcRadius(unitCaster); + float radius = effectInfo->CalcRadius(unitCaster); // Caster not in world, might be spell triggered from aura removal if (!unitCaster->IsInWorld()) @@ -1602,10 +1602,10 @@ void Spell::EffectPersistentAA(SpellEffIndex effIndex) return; ASSERT(_dynObjAura->GetDynobjOwner()); - _dynObjAura->_ApplyEffectForTargets(effIndex); + _dynObjAura->_ApplyEffectForTargets(effectInfo->EffectIndex); } -void Spell::EffectEnergize(SpellEffIndex effIndex) +void Spell::EffectEnergize() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -1617,10 +1617,10 @@ void Spell::EffectEnergize(SpellEffIndex effIndex) if (!unitTarget->IsAlive()) return; - if (m_spellInfo->Effects[effIndex].MiscValue < 0 || m_spellInfo->Effects[effIndex].MiscValue >= int8(MAX_POWERS)) + if (effectInfo->MiscValue < 0 || effectInfo->MiscValue >= int8(MAX_POWERS)) return; - Powers power = Powers(m_spellInfo->Effects[effIndex].MiscValue); + Powers power = Powers(effectInfo->MiscValue); if (unitTarget->GetTypeId() == TYPEID_PLAYER && unitTarget->GetPowerType() != power && m_spellInfo->SpellFamilyName != SPELLFAMILY_POTION && !m_spellInfo->HasAttribute(SPELL_ATTR7_CAN_RESTORE_SECONDARY_POWER)) return; @@ -1677,7 +1677,7 @@ void Spell::EffectEnergize(SpellEffIndex effIndex) unitCaster->EnergizeBySpell(unitTarget, m_spellInfo, damage, power); } -void Spell::EffectEnergizePct(SpellEffIndex effIndex) +void Spell::EffectEnergizePct() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -1689,10 +1689,10 @@ void Spell::EffectEnergizePct(SpellEffIndex effIndex) if (!unitTarget->IsAlive()) return; - if (m_spellInfo->Effects[effIndex].MiscValue < 0 || m_spellInfo->Effects[effIndex].MiscValue >= int8(MAX_POWERS)) + if (effectInfo->MiscValue < 0 || effectInfo->MiscValue >= int8(MAX_POWERS)) return; - Powers power = Powers(m_spellInfo->Effects[effIndex].MiscValue); + Powers power = Powers(effectInfo->MiscValue); if (unitTarget->GetTypeId() == TYPEID_PLAYER && unitTarget->GetPowerType() != power && !m_spellInfo->HasAttribute(SPELL_ATTR7_CAN_RESTORE_SECONDARY_POWER)) return; @@ -1772,7 +1772,7 @@ void Spell::SendLoot(ObjectGuid guid, LootType loottype) player->SendLoot(guid, loottype); } -void Spell::EffectOpenLock(SpellEffIndex effIndex) +void Spell::EffectOpenLock() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -1847,7 +1847,7 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex) int32 reqSkillValue = 0; int32 skillValue; - SpellCastResult res = CanOpenLock(m_spellInfo->GetEffect(effIndex), lockId, skillId, reqSkillValue, skillValue); + SpellCastResult res = CanOpenLock(*effectInfo, lockId, skillId, reqSkillValue, skillValue); if (res != SPELL_CAST_OK) { SendCastResult(res); @@ -1882,10 +1882,10 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex) } } } - ExecuteLogEffectOpenLock(effIndex, gameObjTarget ? (Object*)gameObjTarget : (Object*)itemTarget); + ExecuteLogEffectOpenLock(effectInfo->EffectIndex, gameObjTarget ? (Object*)gameObjTarget : (Object*)itemTarget); } -void Spell::EffectSummonChangeItem(SpellEffIndex effIndex) +void Spell::EffectSummonChangeItem() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; @@ -1903,7 +1903,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex) if (m_CastItem->GetOwnerGUID() != player->GetGUID()) return; - uint32 newitemid = m_spellInfo->Effects[effIndex].ItemType; + uint32 newitemid = effectInfo->ItemType; if (!newitemid) return; @@ -1996,7 +1996,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex) delete pNewItem; } -void Spell::EffectProficiency(SpellEffIndex /*effIndex*/) +void Spell::EffectProficiency() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; @@ -2018,19 +2018,19 @@ void Spell::EffectProficiency(SpellEffIndex /*effIndex*/) } } -void Spell::EffectSummonType(SpellEffIndex effIndex) +void Spell::EffectSummonType() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; - uint32 entry = m_spellInfo->Effects[effIndex].MiscValue; + uint32 entry = effectInfo->MiscValue; if (!entry) return; - SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(m_spellInfo->Effects[effIndex].MiscValueB); + SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(effectInfo->MiscValueB); if (!properties) { - TC_LOG_ERROR("spells", "EffectSummonType: Unhandled summon type %u.", m_spellInfo->Effects[effIndex].MiscValueB); + TC_LOG_ERROR("spells", "EffectSummonType: Unhandled summon type %u.", effectInfo->MiscValueB); return; } @@ -2086,7 +2086,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) { if (properties->Flags & 512) { - SummonGuardian(effIndex, entry, properties, numSummons); + SummonGuardian(*effectInfo, entry, properties, numSummons); break; } @@ -2096,7 +2096,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) case SUMMON_TYPE_GUARDIAN: case SUMMON_TYPE_GUARDIAN2: case SUMMON_TYPE_MINION: - SummonGuardian(effIndex, entry, properties, numSummons); + SummonGuardian(*effectInfo, entry, properties, numSummons); break; // Summons a vehicle, but doesn't force anyone to enter it (see SUMMON_CATEGORY_VEHICLE) case SUMMON_TYPE_VEHICLE: @@ -2145,7 +2145,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) } default: { - float radius = m_spellInfo->Effects[effIndex].CalcRadius(); + float radius = effectInfo->CalcRadius(); TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN; @@ -2168,7 +2168,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) summon->SetFaction(caster->GetFaction()); } - ExecuteLogEffectSummonObject(effIndex, summon); + ExecuteLogEffectSummonObject(effectInfo->EffectIndex, summon); } return; } @@ -2176,7 +2176,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) break; } case SUMMON_CATEGORY_PET: - SummonGuardian(effIndex, entry, properties, numSummons); + SummonGuardian(*effectInfo, entry, properties, numSummons); break; case SUMMON_CATEGORY_PUPPET: { @@ -2199,7 +2199,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) // The spell that this effect will trigger. It has SPELL_AURA_CONTROL_VEHICLE uint32 spellId = VEHICLE_SPELL_RIDE_HARDCODED; - int32 basePoints = m_spellInfo->Effects[effIndex].CalcValue(); + int32 basePoints = effectInfo->CalcValue(); if (basePoints > MAX_VEHICLE_SEATS) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(basePoints); @@ -2227,11 +2227,11 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) if (summon) { summon->SetCreatorGUID(caster->GetGUID()); - ExecuteLogEffectSummonObject(effIndex, summon); + ExecuteLogEffectSummonObject(effectInfo->EffectIndex, summon); } } -void Spell::EffectLearnSpell(SpellEffIndex effIndex) +void Spell::EffectLearnSpell() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -2242,19 +2242,19 @@ void Spell::EffectLearnSpell(SpellEffIndex effIndex) if (unitTarget->GetTypeId() != TYPEID_PLAYER) { if (unitTarget->ToPet()) - EffectLearnPetSpell(effIndex); + EffectLearnPetSpell(); return; } Player* player = unitTarget->ToPlayer(); - uint32 spellToLearn = (m_spellInfo->Id == 483 || m_spellInfo->Id == 55884) ? damage : m_spellInfo->Effects[effIndex].TriggerSpell; + uint32 spellToLearn = (m_spellInfo->Id == 483 || m_spellInfo->Id == 55884) ? damage : effectInfo->TriggerSpell; player->LearnSpell(spellToLearn, false); TC_LOG_DEBUG("spells", "Spell: Player %s has learned spell %u from Npc %s", player->GetGUID().ToString().c_str(), spellToLearn, m_caster->GetGUID().ToString().c_str()); } -void Spell::EffectDispel(SpellEffIndex effIndex) +void Spell::EffectDispel() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -2263,7 +2263,7 @@ void Spell::EffectDispel(SpellEffIndex effIndex) return; // Create dispel mask by dispel type - uint32 dispel_type = m_spellInfo->Effects[effIndex].MiscValue; + uint32 dispel_type = effectInfo->MiscValue; uint32 dispelMask = SpellInfo::GetDispelMask(DispelType(dispel_type)); DispelChargesList dispelList; @@ -2358,7 +2358,7 @@ void Spell::EffectDispel(SpellEffIndex effIndex) } } -void Spell::EffectDualWield(SpellEffIndex /*effIndex*/) +void Spell::EffectDualWield() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -2366,13 +2366,13 @@ void Spell::EffectDualWield(SpellEffIndex /*effIndex*/) unitTarget->SetCanDualWield(true); } -void Spell::EffectPull(SpellEffIndex effIndex) +void Spell::EffectPull() { /// @todo create a proper pull towards distract spell center for distract - EffectNULL(effIndex); + EffectNULL(); } -void Spell::EffectDistract(SpellEffIndex /*effIndex*/) +void Spell::EffectDistract() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -2388,7 +2388,7 @@ void Spell::EffectDistract(SpellEffIndex /*effIndex*/) unitTarget->GetMotionMaster()->MoveDistract(damage * IN_MILLISECONDS, unitTarget->GetAbsoluteAngle(destTarget)); } -void Spell::EffectPickPocket(SpellEffIndex /*effIndex*/) +void Spell::EffectPickPocket() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -2405,7 +2405,7 @@ void Spell::EffectPickPocket(SpellEffIndex /*effIndex*/) m_caster->ToPlayer()->SendLoot(unitTarget->GetGUID(), LOOT_PICKPOCKETING); } -void Spell::EffectAddFarsight(SpellEffIndex effIndex) +void Spell::EffectAddFarsight() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; @@ -2414,7 +2414,7 @@ void Spell::EffectAddFarsight(SpellEffIndex effIndex) if (!player) return; - float radius = m_spellInfo->Effects[effIndex].CalcRadius(); + float radius = effectInfo->CalcRadius(); int32 duration = m_spellInfo->GetDuration(); // Caster not in world, might be spell triggered from aura removal if (!player->IsInWorld()) @@ -2431,7 +2431,7 @@ void Spell::EffectAddFarsight(SpellEffIndex effIndex) dynObj->SetCasterViewpoint(); } -void Spell::EffectUntrainTalents(SpellEffIndex /*effIndex*/) +void Spell::EffectUntrainTalents() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -2443,7 +2443,7 @@ void Spell::EffectUntrainTalents(SpellEffIndex /*effIndex*/) unitTarget->ToPlayer()->SendTalentWipeConfirm(guid); } -void Spell::EffectTeleUnitsFaceCaster(SpellEffIndex /*effIndex*/) +void Spell::EffectTeleUnitsFaceCaster() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -2458,7 +2458,7 @@ void Spell::EffectTeleUnitsFaceCaster(SpellEffIndex /*effIndex*/) unitTarget->NearTeleportTo(destTarget->GetPositionX(), destTarget->GetPositionY(), destTarget->GetPositionZ(), destTarget->GetAbsoluteAngle(m_caster), unitTarget == m_caster); } -void Spell::EffectLearnSkill(SpellEffIndex effIndex) +void Spell::EffectLearnSkill() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -2469,7 +2469,7 @@ void Spell::EffectLearnSkill(SpellEffIndex effIndex) if (damage < 0) return; - uint32 skillid = m_spellInfo->Effects[effIndex].MiscValue; + uint32 skillid = effectInfo->MiscValue; SkillRaceClassInfoEntry const* rcEntry = GetSkillRaceClassInfo(skillid, unitTarget->GetRace(), unitTarget->GetClass()); if (!rcEntry) return; @@ -2479,10 +2479,10 @@ void Spell::EffectLearnSkill(SpellEffIndex effIndex) return; uint16 skillval = unitTarget->ToPlayer()->GetPureSkillValue(skillid); - unitTarget->ToPlayer()->SetSkill(skillid, m_spellInfo->Effects[effIndex].CalcValue(), std::max<uint16>(skillval, 1), tier->Value[damage - 1]); + unitTarget->ToPlayer()->SetSkill(skillid, effectInfo->CalcValue(), std::max<uint16>(skillval, 1), tier->Value[damage - 1]); } -void Spell::EffectAddHonor(SpellEffIndex /*effIndex*/) +void Spell::EffectAddHonor() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -2513,19 +2513,19 @@ void Spell::EffectAddHonor(SpellEffIndex /*effIndex*/) } } -void Spell::EffectTradeSkill(SpellEffIndex /*effIndex*/) +void Spell::EffectTradeSkill() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; if (m_caster->GetTypeId() != TYPEID_PLAYER) return; - // uint32 skillid = m_spellInfo->Effects[i].MiscValue; + // uint32 skillid = effectInfo->MiscValue; // uint16 skillmax = unitTarget->ToPlayer()->(skillid); // m_caster->ToPlayer()->SetSkill(skillid, skillval?skillval:1, skillmax+75); } -void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex) +void Spell::EffectEnchantItemPerm() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -2545,7 +2545,7 @@ void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex) player->DestroyItemCount(itemTarget, count, true); unitTarget = player; // and add a scroll - DoCreateItem(effIndex, m_spellInfo->Effects[effIndex].ItemType); + DoCreateItem(effectInfo->ItemType); itemTarget = nullptr; m_targets.SetItemTarget(nullptr); } @@ -2555,7 +2555,7 @@ void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex) if (!(m_CastItem && m_CastItem->GetTemplate()->HasFlag(ITEM_FLAG_NO_REAGENT_COST))) player->UpdateCraftSkill(m_spellInfo->Id); - uint32 enchant_id = m_spellInfo->Effects[effIndex].MiscValue; + uint32 enchant_id = effectInfo->MiscValue; if (!enchant_id) return; @@ -2589,7 +2589,7 @@ void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex) } } -void Spell::EffectEnchantItemPrismatic(SpellEffIndex effIndex) +void Spell::EffectEnchantItemPrismatic() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -2601,7 +2601,7 @@ void Spell::EffectEnchantItemPrismatic(SpellEffIndex effIndex) if (!player) return; - uint32 enchantId = m_spellInfo->Effects[effIndex].MiscValue; + uint32 enchantId = effectInfo->MiscValue; if (!enchantId) return; @@ -2653,7 +2653,7 @@ void Spell::EffectEnchantItemPrismatic(SpellEffIndex effIndex) itemTarget->ClearSoulboundTradeable(item_owner); } -void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex) +void Spell::EffectEnchantItemTmp() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -2715,18 +2715,18 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex) return; } - uint32 enchant_id = m_spellInfo->Effects[effIndex].MiscValue; + uint32 enchant_id = effectInfo->MiscValue; if (!enchant_id) { - TC_LOG_ERROR("spells", "Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) has enchanting id 0.", m_spellInfo->Id, effIndex); + TC_LOG_ERROR("spells", "Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) has enchanting id 0.", m_spellInfo->Id, uint32(effectInfo->EffectIndex)); return; } SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) { - TC_LOG_ERROR("spells", "Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) has a non-existing enchanting id %u ", m_spellInfo->Id, effIndex, enchant_id); + TC_LOG_ERROR("spells", "Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) has a non-existing enchanting id %u ", m_spellInfo->Id, uint32(effectInfo->EffectIndex), enchant_id); return; } @@ -2781,7 +2781,7 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex) item_owner->ApplyEnchantment(itemTarget, TEMP_ENCHANTMENT_SLOT, true); } -void Spell::EffectTameCreature(SpellEffIndex /*effIndex*/) +void Spell::EffectTameCreature() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -2838,7 +2838,7 @@ void Spell::EffectTameCreature(SpellEffIndex /*effIndex*/) } } -void Spell::EffectSummonPet(SpellEffIndex effIndex) +void Spell::EffectSummonPet() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; @@ -2851,13 +2851,13 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex) owner = unitCaster->GetCharmerOrOwnerPlayerOrPlayerItself(); } - uint32 petentry = m_spellInfo->Effects[effIndex].MiscValue; + uint32 petentry = effectInfo->MiscValue; if (!owner) { SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(67); if (properties) - SummonGuardian(effIndex, petentry, properties, 1); + SummonGuardian(*effectInfo, petentry, properties, 1); return; } @@ -2923,10 +2923,10 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex) if (!new_name.empty()) pet->SetName(new_name); - ExecuteLogEffectSummonObject(effIndex, pet); + ExecuteLogEffectSummonObject(effectInfo->EffectIndex, pet); } -void Spell::EffectLearnPetSpell(SpellEffIndex effIndex) +void Spell::EffectLearnPetSpell() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -2936,14 +2936,14 @@ void Spell::EffectLearnPetSpell(SpellEffIndex effIndex) if (unitTarget->ToPlayer()) { - EffectLearnSpell(effIndex); + EffectLearnSpell(); return; } Pet* pet = unitTarget->ToPet(); if (!pet) return; - SpellInfo const* learn_spellproto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[effIndex].TriggerSpell); + SpellInfo const* learn_spellproto = sSpellMgr->GetSpellInfo(effectInfo->TriggerSpell); if (!learn_spellproto) return; @@ -2952,7 +2952,7 @@ void Spell::EffectLearnPetSpell(SpellEffIndex effIndex) pet->GetOwner()->PetSpellInitialize(); } -void Spell::EffectTaunt(SpellEffIndex /*effIndex*/) +void Spell::EffectTaunt() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -2992,7 +2992,7 @@ void Spell::EffectTaunt(SpellEffIndex /*effIndex*/) mgr.MatchUnitThreatToHighestThreat(unitCaster); } -void Spell::EffectWeaponDmg(SpellEffIndex effIndex) +void Spell::EffectWeaponDmg() { if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET) return; @@ -3007,9 +3007,9 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) // multiple weapon dmg effect workaround // execute only the last weapon damage // and handle all effects at once - for (uint8 j = effIndex + 1; j < MAX_SPELL_EFFECTS; ++j) + for (size_t j = effectInfo->EffectIndex + 1; j < m_spellInfo->GetEffects().size(); ++j) { - switch (m_spellInfo->Effects[j].Effect) + switch (m_spellInfo->GetEffect(SpellEffIndex(j)).Effect) { case SPELL_EFFECT_WEAPON_DAMAGE: case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL: @@ -3284,7 +3284,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) m_damage += unitTarget->MeleeDamageBonusTaken(unitCaster, weaponDamage, m_attackType, m_spellInfo); } -void Spell::EffectThreat(SpellEffIndex /*effIndex*/) +void Spell::EffectThreat() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -3302,7 +3302,7 @@ void Spell::EffectThreat(SpellEffIndex /*effIndex*/) unitTarget->GetThreatManager().AddThreat(unitCaster, float(damage), m_spellInfo, true); } -void Spell::EffectHealMaxHealth(SpellEffIndex /*effIndex*/) +void Spell::EffectHealMaxHealth() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -3325,7 +3325,7 @@ void Spell::EffectHealMaxHealth(SpellEffIndex /*effIndex*/) m_healing += addhealth; } -void Spell::EffectInterruptCast(SpellEffIndex effIndex) +void Spell::EffectInterruptCast() { if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET) return; @@ -3351,7 +3351,7 @@ void Spell::EffectInterruptCast(SpellEffIndex effIndex) if (Unit* unitCaster = GetUnitCasterForEffectHandlers()) { int32 duration = m_spellInfo->GetDuration(); - unitTarget->GetSpellHistory()->LockSpellSchool(curSpellInfo->GetSchoolMask(), unitTarget->ModSpellDuration(m_spellInfo, unitTarget, duration, false, 1 << effIndex)); + unitTarget->GetSpellHistory()->LockSpellSchool(curSpellInfo->GetSchoolMask(), unitTarget->ModSpellDuration(m_spellInfo, unitTarget, duration, false, 1 << effectInfo->EffectIndex)); if (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC) Unit::ProcSkillsAndAuras(unitCaster, unitTarget, PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG, PROC_SPELL_TYPE_MASK_ALL, PROC_SPELL_PHASE_HIT, PROC_HIT_INTERRUPT, nullptr, nullptr, nullptr); @@ -3359,19 +3359,19 @@ void Spell::EffectInterruptCast(SpellEffIndex effIndex) Unit::ProcSkillsAndAuras(unitCaster, unitTarget, PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS, PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS, PROC_SPELL_TYPE_MASK_ALL, PROC_SPELL_PHASE_HIT, PROC_HIT_INTERRUPT, nullptr, nullptr, nullptr); } - ExecuteLogEffectInterruptCast(effIndex, unitTarget, curSpellInfo->Id); + ExecuteLogEffectInterruptCast(effectInfo->EffectIndex, unitTarget, curSpellInfo->Id); unitTarget->InterruptSpell(CurrentSpellTypes(i), false); } } } } -void Spell::EffectSummonObjectWild(SpellEffIndex effIndex) +void Spell::EffectSummonObjectWild() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; - uint32 gameobject_id = m_spellInfo->Effects[effIndex].MiscValue; + uint32 gameobject_id = effectInfo->MiscValue; GameObject* pGameObj = new GameObject(); @@ -3399,7 +3399,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex) pGameObj->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0); pGameObj->SetSpellId(m_spellInfo->Id); - ExecuteLogEffectSummonObject(effIndex, pGameObj); + ExecuteLogEffectSummonObject(effectInfo->EffectIndex, pGameObj); // Wild object not have owner and check clickable by players map->AddToMap(pGameObj); @@ -3414,11 +3414,11 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex) linkedTrap->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0); linkedTrap->SetSpellId(m_spellInfo->Id); - ExecuteLogEffectSummonObject(effIndex, linkedTrap); + ExecuteLogEffectSummonObject(effectInfo->EffectIndex, linkedTrap); } } -void Spell::EffectScriptEffect(SpellEffIndex effIndex) +void Spell::EffectScriptEffect() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -3497,7 +3497,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) case 45151: { //Workaround for Range ... should be global for every ScriptEffect - float radius = m_spellInfo->Effects[effIndex].CalcRadius(); + float radius = effectInfo->CalcRadius(); if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER && unitTarget->GetDistance(m_caster) >= radius && !unitTarget->HasAura(46394) && unitTarget != m_caster) unitTarget->CastSpell(unitTarget, 46394, true); @@ -3510,7 +3510,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) return; float x, y, z; - float radius = m_spellInfo->Effects[effIndex].CalcRadius(); + float radius = effectInfo->CalcRadius(); for (uint8 i = 0; i < 15; ++i) { m_caster->GetRandomPoint(*destTarget, radius, x, y, z); @@ -3567,11 +3567,11 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) } // normal DB scripted effect - TC_LOG_DEBUG("spells", "Spell ScriptStart spellid %u in EffectScriptEffect(%u)", m_spellInfo->Id, effIndex); - m_caster->GetMap()->ScriptsStart(sSpellScripts, uint32(m_spellInfo->Id | (effIndex << 24)), m_caster, unitTarget); + TC_LOG_DEBUG("spells", "Spell ScriptStart spellid %u in EffectScriptEffect(%u)", m_spellInfo->Id, uint32(effectInfo->EffectIndex)); + m_caster->GetMap()->ScriptsStart(sSpellScripts, uint32(m_spellInfo->Id | (effectInfo->EffectIndex << 24)), m_caster, unitTarget); } -void Spell::EffectSanctuary(SpellEffIndex /*effIndex*/) +void Spell::EffectSanctuary() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -3595,7 +3595,7 @@ void Spell::EffectSanctuary(SpellEffIndex /*effIndex*/) unitTarget->m_lastSanctuaryTime = GameTime::GetGameTimeMS(); } -void Spell::EffectAddComboPoints(SpellEffIndex /*effIndex*/) +void Spell::EffectAddComboPoints() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -3609,7 +3609,7 @@ void Spell::EffectAddComboPoints(SpellEffIndex /*effIndex*/) AddComboPointGain(unitTarget, damage); } -void Spell::EffectDuel(SpellEffIndex effIndex) +void Spell::EffectDuel() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -3642,7 +3642,7 @@ void Spell::EffectDuel(SpellEffIndex effIndex) //CREATE DUEL FLAG OBJECT GameObject* pGameObj = new GameObject; - uint32 gameobject_id = m_spellInfo->Effects[effIndex].MiscValue; + uint32 gameobject_id = effectInfo->MiscValue; Position const pos = { @@ -3666,7 +3666,7 @@ void Spell::EffectDuel(SpellEffIndex effIndex) pGameObj->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0); pGameObj->SetSpellId(m_spellInfo->Id); - ExecuteLogEffectSummonObject(effIndex, pGameObj); + ExecuteLogEffectSummonObject(effectInfo->EffectIndex, pGameObj); caster->AddGameObject(pGameObj); map->AddToMap(pGameObj); @@ -3690,7 +3690,7 @@ void Spell::EffectDuel(SpellEffIndex effIndex) sScriptMgr->OnPlayerDuelRequest(target, caster); } -void Spell::EffectStuck(SpellEffIndex /*effIndex*/) +void Spell::EffectStuck() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; @@ -3736,7 +3736,7 @@ void Spell::EffectStuck(SpellEffIndex /*effIndex*/) player->CastSpell(player, 8690, TriggerCastFlags(TRIGGERED_FULL_MASK&~TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD)); } -void Spell::EffectSummonPlayer(SpellEffIndex /*effIndex*/) +void Spell::EffectSummonPlayer() { // workaround - this effect should not use target map if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) @@ -3752,7 +3752,7 @@ void Spell::EffectSummonPlayer(SpellEffIndex /*effIndex*/) unitTarget->ToPlayer()->SendSummonRequestFrom(unitCaster); } -void Spell::EffectActivateObject(SpellEffIndex effIndex) +void Spell::EffectActivateObject() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -3760,7 +3760,7 @@ void Spell::EffectActivateObject(SpellEffIndex effIndex) if (!gameObjTarget) return; - GameObjectActions action = GameObjectActions(m_spellInfo->Effects[effIndex].MiscValue); + GameObjectActions action = GameObjectActions(effectInfo->MiscValue); switch (action) { @@ -3823,16 +3823,16 @@ void Spell::EffectActivateObject(SpellEffIndex effIndex) break; } case GameObjectActions::None: - TC_LOG_FATAL("spell", "Spell %d has action type NONE in effect %d", m_spellInfo->Id, int32(effIndex)); + TC_LOG_FATAL("spell", "Spell %d has action type NONE in effect %d", m_spellInfo->Id, int32(effectInfo->EffectIndex)); break; default: - TC_LOG_ERROR("spell", "Spell %d has unhandled action %d in effect %d", m_spellInfo->Id, int32(action), int32(effIndex)); + TC_LOG_ERROR("spell", "Spell %d has unhandled action %d in effect %d", m_spellInfo->Id, int32(action), int32(effectInfo->EffectIndex)); break; } } -void Spell::EffectApplyGlyph(SpellEffIndex effIndex) +void Spell::EffectApplyGlyph() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; @@ -3862,7 +3862,7 @@ void Spell::EffectApplyGlyph(SpellEffIndex effIndex) } // apply new one - if (uint32 glyph = m_spellInfo->Effects[effIndex].MiscValue) + if (uint32 glyph = effectInfo->MiscValue) { if (GlyphPropertiesEntry const* gp = sGlyphPropertiesStore.LookupEntry(glyph)) { @@ -3892,7 +3892,7 @@ void Spell::EffectApplyGlyph(SpellEffIndex effIndex) } } -void Spell::EffectEnchantHeldItem(SpellEffIndex effIndex) +void Spell::EffectEnchantHeldItem() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -3911,9 +3911,9 @@ void Spell::EffectEnchantHeldItem(SpellEffIndex effIndex) if (!item->IsEquipped()) return; - if (m_spellInfo->Effects[effIndex].MiscValue) + if (effectInfo->MiscValue) { - uint32 enchant_id = m_spellInfo->Effects[effIndex].MiscValue; + uint32 enchant_id = effectInfo->MiscValue; int32 duration = m_spellInfo->GetDuration(); // Try duration index first .. if (!duration) duration = damage;//+1; // Base points after .. @@ -3940,7 +3940,7 @@ void Spell::EffectEnchantHeldItem(SpellEffIndex effIndex) } } -void Spell::EffectDisEnchant(SpellEffIndex /*effIndex*/) +void Spell::EffectDisEnchant() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -3957,7 +3957,7 @@ void Spell::EffectDisEnchant(SpellEffIndex /*effIndex*/) // item will be removed at disenchanting end } -void Spell::EffectInebriate(SpellEffIndex /*effIndex*/) +void Spell::EffectInebriate() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -3980,7 +3980,7 @@ void Spell::EffectInebriate(SpellEffIndex /*effIndex*/) player->SetDrunkValue(currentDrunk, m_CastItem ? m_CastItem->GetEntry() : 0); } -void Spell::EffectFeedPet(SpellEffIndex effIndex) +void Spell::EffectFeedPet() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -4004,7 +4004,7 @@ void Spell::EffectFeedPet(SpellEffIndex effIndex) if (benefit <= 0) return; - ExecuteLogEffectDestroyItem(effIndex, foodItem->GetEntry()); + ExecuteLogEffectDestroyItem(effectInfo->EffectIndex, foodItem->GetEntry()); uint32 count = 1; player->DestroyItemCount(foodItem, count, true); @@ -4012,10 +4012,10 @@ void Spell::EffectFeedPet(SpellEffIndex effIndex) CastSpellExtraArgs args(TRIGGERED_FULL_MASK); args.AddSpellMod(SPELLVALUE_BASE_POINT0, benefit); - m_caster->CastSpell(pet, m_spellInfo->Effects[effIndex].TriggerSpell, args); + m_caster->CastSpell(pet, effectInfo->TriggerSpell, args); } -void Spell::EffectDismissPet(SpellEffIndex effIndex) +void Spell::EffectDismissPet() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -4025,11 +4025,11 @@ void Spell::EffectDismissPet(SpellEffIndex effIndex) Pet* pet = unitTarget->ToPet(); - ExecuteLogEffectUnsummonObject(effIndex, pet); + ExecuteLogEffectUnsummonObject(effectInfo->EffectIndex, pet); pet->Remove(PET_SAVE_NOT_IN_SLOT); } -void Spell::EffectSummonObject(SpellEffIndex effIndex) +void Spell::EffectSummonObject() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; @@ -4038,8 +4038,8 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex) if (!unitCaster) return; - uint32 go_id = m_spellInfo->Effects[effIndex].MiscValue; - uint8 slot = m_spellInfo->Effects[effIndex].Effect - SPELL_EFFECT_SUMMON_OBJECT_SLOT1; + uint32 go_id = effectInfo->MiscValue; + uint8 slot = effectInfo->Effect - SPELL_EFFECT_SUMMON_OBJECT_SLOT1; if (ObjectGuid guid = unitCaster->m_ObjectSlot[slot]) { @@ -4077,14 +4077,14 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex) go->SetSpellId(m_spellInfo->Id); unitCaster->AddGameObject(go); - ExecuteLogEffectSummonObject(effIndex, go); + ExecuteLogEffectSummonObject(effectInfo->EffectIndex, go); map->AddToMap(go); unitCaster->m_ObjectSlot[slot] = go->GetGUID(); } -void Spell::EffectResurrect(SpellEffIndex effIndex) +void Spell::EffectResurrect() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -4108,13 +4108,13 @@ void Spell::EffectResurrect(SpellEffIndex effIndex) uint32 health = player->CountPctFromMaxHealth(damage); uint32 mana = CalculatePct(player->GetMaxPower(POWER_MANA), damage); - ExecuteLogEffectResurrect(effIndex, player); + ExecuteLogEffectResurrect(effectInfo->EffectIndex, player); player->SetResurrectRequestData(m_caster, health, mana, 0); SendResurrectRequest(player); } -void Spell::EffectAddExtraAttacks(SpellEffIndex effIndex) +void Spell::EffectAddExtraAttacks() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -4127,10 +4127,10 @@ void Spell::EffectAddExtraAttacks(SpellEffIndex effIndex) unitTarget->m_extraAttacks = damage; - ExecuteLogEffectExtraAttacks(effIndex, unitTarget, damage); + ExecuteLogEffectExtraAttacks(effectInfo->EffectIndex, unitTarget, damage); } -void Spell::EffectParry(SpellEffIndex /*effIndex*/) +void Spell::EffectParry() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; @@ -4139,7 +4139,7 @@ void Spell::EffectParry(SpellEffIndex /*effIndex*/) m_caster->ToPlayer()->SetCanParry(true); } -void Spell::EffectBlock(SpellEffIndex /*effIndex*/) +void Spell::EffectBlock() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; @@ -4148,7 +4148,7 @@ void Spell::EffectBlock(SpellEffIndex /*effIndex*/) m_caster->ToPlayer()->SetCanBlock(true); } -void Spell::EffectLeap(SpellEffIndex /*effIndex*/) +void Spell::EffectLeap() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -4163,7 +4163,7 @@ void Spell::EffectLeap(SpellEffIndex /*effIndex*/) unitTarget->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), unitTarget == m_caster); } -void Spell::EffectReputation(SpellEffIndex effIndex) +void Spell::EffectReputation() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -4175,7 +4175,7 @@ void Spell::EffectReputation(SpellEffIndex effIndex) int32 repChange = damage; - uint32 factionId = m_spellInfo->Effects[effIndex].MiscValue; + uint32 factionId = effectInfo->MiscValue; FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId); if (!factionEntry) @@ -4186,7 +4186,7 @@ void Spell::EffectReputation(SpellEffIndex effIndex) player->GetReputationMgr().ModifyReputation(factionEntry, repChange); } -void Spell::EffectQuestComplete(SpellEffIndex effIndex) +void Spell::EffectQuestComplete() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -4195,7 +4195,7 @@ void Spell::EffectQuestComplete(SpellEffIndex effIndex) return; Player* player = unitTarget->ToPlayer(); - uint32 questId = m_spellInfo->Effects[effIndex].MiscValue; + uint32 questId = effectInfo->MiscValue; if (questId) { Quest const* quest = sObjectMgr->GetQuestTemplate(questId); @@ -4210,7 +4210,7 @@ void Spell::EffectQuestComplete(SpellEffIndex effIndex) } } -void Spell::EffectForceDeselect(SpellEffIndex /*effIndex*/) +void Spell::EffectForceDeselect() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; @@ -4243,7 +4243,7 @@ void Spell::EffectForceDeselect(SpellEffIndex /*effIndex*/) (*itr)->AttackStop(); } -void Spell::EffectSelfResurrect(SpellEffIndex effIndex) +void Spell::EffectSelfResurrect() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; @@ -4259,7 +4259,7 @@ void Spell::EffectSelfResurrect(SpellEffIndex effIndex) if (damage < 0) { health = uint32(-damage); - mana = m_spellInfo->Effects[effIndex].MiscValue; + mana = effectInfo->MiscValue; } // percent case else @@ -4279,7 +4279,7 @@ void Spell::EffectSelfResurrect(SpellEffIndex effIndex) player->SpawnCorpseBones(); } -void Spell::EffectSkinning(SpellEffIndex /*effIndex*/) +void Spell::EffectSkinning() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -4307,7 +4307,7 @@ void Spell::EffectSkinning(SpellEffIndex /*effIndex*/) player->UpdateGatherSkill(skill, skillValue, reqValue, creature->isElite() ? 2 : 1); } -void Spell::EffectCharge(SpellEffIndex /*effIndex*/) +void Spell::EffectCharge() { if (!unitTarget) return; @@ -4342,7 +4342,7 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/) } } -void Spell::EffectChargeDest(SpellEffIndex /*effIndex*/) +void Spell::EffectChargeDest() { if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH) return; @@ -4366,7 +4366,7 @@ void Spell::EffectChargeDest(SpellEffIndex /*effIndex*/) } } -void Spell::EffectKnockBack(SpellEffIndex effIndex) +void Spell::EffectKnockBack() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -4388,13 +4388,13 @@ void Spell::EffectKnockBack(SpellEffIndex effIndex) unitTarget->InterruptNonMeleeSpells(true); float ratio = 0.1f; - float speedxy = float(m_spellInfo->Effects[effIndex].MiscValue) * ratio; + float speedxy = float(effectInfo->MiscValue) * ratio; float speedz = float(damage) * ratio; if (speedxy < 0.01f && speedz < 0.01f) return; float x, y; - if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_KNOCK_BACK_DEST) + if (effectInfo->Effect == SPELL_EFFECT_KNOCK_BACK_DEST) { if (m_targets.HasDst()) destTarget->GetPosition(x, y); @@ -4407,7 +4407,7 @@ void Spell::EffectKnockBack(SpellEffIndex effIndex) unitTarget->KnockbackFrom(x, y, speedxy, speedz); } -void Spell::EffectLeapBack(SpellEffIndex effIndex) +void Spell::EffectLeapBack() { if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET) return; @@ -4415,7 +4415,7 @@ void Spell::EffectLeapBack(SpellEffIndex effIndex) if (!unitTarget) return; - float speedxy = m_spellInfo->Effects[effIndex].MiscValue / 10.f; + float speedxy = effectInfo->MiscValue / 10.f; float speedz = damage/ 10.f; //1891: Disengage unitTarget->JumpTo(speedxy, speedz, m_spellInfo->SpellIconID != 1891); @@ -4425,7 +4425,7 @@ void Spell::EffectLeapBack(SpellEffIndex effIndex) m_caster->ToPlayer()->SetFallInformation(0, m_caster->GetPositionZ()); } -void Spell::EffectQuestClear(SpellEffIndex effIndex) +void Spell::EffectQuestClear() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -4434,7 +4434,7 @@ void Spell::EffectQuestClear(SpellEffIndex effIndex) return; Player* player = unitTarget->ToPlayer(); - uint32 quest_id = m_spellInfo->Effects[effIndex].MiscValue; + uint32 quest_id = effectInfo->MiscValue; Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id); @@ -4470,7 +4470,7 @@ void Spell::EffectQuestClear(SpellEffIndex effIndex) sScriptMgr->OnQuestStatusChange(player, quest_id); } -void Spell::EffectSendTaxi(SpellEffIndex effIndex) +void Spell::EffectSendTaxi() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -4478,10 +4478,10 @@ void Spell::EffectSendTaxi(SpellEffIndex effIndex) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - unitTarget->ToPlayer()->ActivateTaxiPathTo(m_spellInfo->Effects[effIndex].MiscValue, m_spellInfo->Id); + unitTarget->ToPlayer()->ActivateTaxiPathTo(effectInfo->MiscValue, m_spellInfo->Id); } -void Spell::EffectPullTowards(SpellEffIndex effIndex) +void Spell::EffectPullTowards() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -4499,7 +4499,7 @@ void Spell::EffectPullTowards(SpellEffIndex effIndex) return; float distZ = pos.GetPositionZ() - unitTarget->GetPositionZ(); - float speedXY = m_spellInfo->Effects[effIndex].MiscValue ? m_spellInfo->Effects[effIndex].MiscValue / 10.0f : 30.0f; + float speedXY = effectInfo->MiscValue ? effectInfo->MiscValue / 10.0f : 30.0f; float speedZ = (2 * speedXY * speedXY * distZ + Movement::gravity * distXY * distXY) / (2 * speedXY * distXY); if (!std::isfinite(speedZ)) @@ -4511,7 +4511,7 @@ void Spell::EffectPullTowards(SpellEffIndex effIndex) unitTarget->JumpTo(speedXY, speedZ, true, pos); } -void Spell::EffectPullTowardsDest(SpellEffIndex effIndex) +void Spell::EffectPullTowardsDest() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -4535,7 +4535,7 @@ void Spell::EffectPullTowardsDest(SpellEffIndex effIndex) float distZ = pos->GetPositionZ() - unitTarget->GetPositionZ(); - float speedXY = m_spellInfo->Effects[effIndex].MiscValue ? m_spellInfo->Effects[effIndex].MiscValue / 10.0f : 30.0f; + float speedXY = effectInfo->MiscValue ? effectInfo->MiscValue / 10.0f : 30.0f; float speedZ = (2 * speedXY * speedXY * distZ + Movement::gravity * distXY * distXY) / (2 * speedXY * distXY); if (!std::isfinite(speedZ)) @@ -4547,7 +4547,7 @@ void Spell::EffectPullTowardsDest(SpellEffIndex effIndex) unitTarget->JumpTo(speedXY, speedZ, true, *pos); } -void Spell::EffectDispelMechanic(SpellEffIndex effIndex) +void Spell::EffectDispelMechanic() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -4555,7 +4555,7 @@ void Spell::EffectDispelMechanic(SpellEffIndex effIndex) if (!unitTarget) return; - uint32 mechanic = m_spellInfo->Effects[effIndex].MiscValue; + uint32 mechanic = effectInfo->MiscValue; DispelList dispel_list; Unit::AuraMap const& auras = unitTarget->GetOwnedAuras(); for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) @@ -4572,7 +4572,7 @@ void Spell::EffectDispelMechanic(SpellEffIndex effIndex) unitTarget->RemoveAura(itr->first, itr->second, 0, AURA_REMOVE_BY_ENEMY_SPELL); } -void Spell::EffectResurrectPet(SpellEffIndex /*effIndex*/) +void Spell::EffectResurrectPet() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; @@ -4634,7 +4634,7 @@ void Spell::EffectResurrectPet(SpellEffIndex /*effIndex*/) pet->SavePetToDB(PET_SAVE_AS_CURRENT); } -void Spell::EffectDestroyAllTotems(SpellEffIndex /*effIndex*/) +void Spell::EffectDestroyAllTotems() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; @@ -4671,7 +4671,7 @@ void Spell::EffectDestroyAllTotems(SpellEffIndex /*effIndex*/) } } -void Spell::EffectDurabilityDamage(SpellEffIndex effIndex) +void Spell::EffectDurabilityDamage() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -4679,13 +4679,13 @@ void Spell::EffectDurabilityDamage(SpellEffIndex effIndex) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - int32 slot = m_spellInfo->Effects[effIndex].MiscValue; + int32 slot = effectInfo->MiscValue; // -1 means all player equipped items and -2 all items if (slot < 0) { unitTarget->ToPlayer()->DurabilityPointsLossAll(damage, (slot < -1)); - ExecuteLogEffectDurabilityDamage(effIndex, unitTarget, -1, -1); + ExecuteLogEffectDurabilityDamage(effectInfo->EffectIndex, unitTarget, -1, -1); return; } @@ -4696,11 +4696,11 @@ void Spell::EffectDurabilityDamage(SpellEffIndex effIndex) if (Item* item = unitTarget->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) { unitTarget->ToPlayer()->DurabilityPointsLoss(item, damage); - ExecuteLogEffectDurabilityDamage(effIndex, unitTarget, item->GetEntry(), slot); + ExecuteLogEffectDurabilityDamage(effectInfo->EffectIndex, unitTarget, item->GetEntry(), slot); } } -void Spell::EffectDurabilityDamagePCT(SpellEffIndex effIndex) +void Spell::EffectDurabilityDamagePCT() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -4708,7 +4708,7 @@ void Spell::EffectDurabilityDamagePCT(SpellEffIndex effIndex) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - int32 slot = m_spellInfo->Effects[effIndex].MiscValue; + int32 slot = effectInfo->MiscValue; // FIXME: some spells effects have value -1/-2 // Possibly its mean -1 all player equipped items and -2 all items @@ -4729,7 +4729,7 @@ void Spell::EffectDurabilityDamagePCT(SpellEffIndex effIndex) unitTarget->ToPlayer()->DurabilityLoss(item, float(damage) / 100.0f); } -void Spell::EffectModifyThreatPercent(SpellEffIndex /*effIndex*/) +void Spell::EffectModifyThreatPercent() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -4741,7 +4741,7 @@ void Spell::EffectModifyThreatPercent(SpellEffIndex /*effIndex*/) unitTarget->GetThreatManager().ModifyThreatByPercent(unitCaster, damage); } -void Spell::EffectTransmitted(SpellEffIndex effIndex) +void Spell::EffectTransmitted() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; @@ -4750,7 +4750,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) if (!unitCaster) return; - uint32 name_id = m_spellInfo->Effects[effIndex].MiscValue; + uint32 name_id = effectInfo->MiscValue; GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(name_id); if (!goinfo) { @@ -4763,9 +4763,9 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) if (m_targets.HasDst()) destTarget->GetPosition(fx, fy, fz); //FIXME: this can be better check for most objects but still hack - else if (m_spellInfo->Effects[effIndex].HasRadius() && m_spellInfo->Speed == 0) + else if (effectInfo->HasRadius() && m_spellInfo->Speed == 0) { - float dis = m_spellInfo->Effects[effIndex].CalcRadius(unitCaster); + float dis = effectInfo->CalcRadius(unitCaster); unitCaster->GetClosePoint(fx, fy, fz, DEFAULT_PLAYER_BOUNDING_RADIUS, dis); } else @@ -4840,7 +4840,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) //pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, unitCaster->GetLevel()); pGameObj->SetSpellId(m_spellInfo->Id); - ExecuteLogEffectSummonObject(effIndex, pGameObj); + ExecuteLogEffectSummonObject(effectInfo->EffectIndex, pGameObj); TC_LOG_DEBUG("spells", "AddObject at SpellEfects.cpp EffectTransmitted"); //unitCaster->AddGameObject(pGameObj); @@ -4855,11 +4855,11 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) linkedTrap->SetSpellId(m_spellInfo->Id); linkedTrap->SetOwnerGUID(unitCaster->GetGUID()); - ExecuteLogEffectSummonObject(effIndex, linkedTrap); + ExecuteLogEffectSummonObject(effectInfo->EffectIndex, linkedTrap); } } -void Spell::EffectProspecting(SpellEffIndex /*effIndex*/) +void Spell::EffectProspecting() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -4884,7 +4884,7 @@ void Spell::EffectProspecting(SpellEffIndex /*effIndex*/) player->SendLoot(itemTarget->GetGUID(), LOOT_PROSPECTING); } -void Spell::EffectMilling(SpellEffIndex /*effIndex*/) +void Spell::EffectMilling() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -4909,7 +4909,7 @@ void Spell::EffectMilling(SpellEffIndex /*effIndex*/) player->SendLoot(itemTarget->GetGUID(), LOOT_MILLING); } -void Spell::EffectSkill(SpellEffIndex /*effIndex*/) +void Spell::EffectSkill() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; @@ -4921,7 +4921,7 @@ void Spell::EffectSkill(SpellEffIndex /*effIndex*/) If we would handle the resurrection here, the spiritguide would instantly disappear as the player revives, and so we wouldn't see the spirit heal visual effect on the npc. This is why we use a half sec delay between the visual effect and the resurrection itself */ -void Spell::EffectSpiritHeal(SpellEffIndex /*effIndex*/) +void Spell::EffectSpiritHeal() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -4940,7 +4940,7 @@ void Spell::EffectSpiritHeal(SpellEffIndex /*effIndex*/) } // remove insignia spell effect -void Spell::EffectSkinPlayerCorpse(SpellEffIndex /*effIndex*/) +void Spell::EffectSkinPlayerCorpse() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -4961,7 +4961,7 @@ void Spell::EffectSkinPlayerCorpse(SpellEffIndex /*effIndex*/) target->RemovedInsignia(player); } -void Spell::EffectStealBeneficialBuff(SpellEffIndex effIndex) +void Spell::EffectStealBeneficialBuff() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -4974,7 +4974,7 @@ void Spell::EffectStealBeneficialBuff(SpellEffIndex effIndex) DispelChargesList stealList; // Create dispel mask by dispel type - uint32 dispelMask = SpellInfo::GetDispelMask(DispelType(m_spellInfo->Effects[effIndex].MiscValue)); + uint32 dispelMask = SpellInfo::GetDispelMask(DispelType(effectInfo->MiscValue)); Unit::AuraMap const& auras = unitTarget->GetOwnedAuras(); for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) { @@ -5067,7 +5067,7 @@ void Spell::EffectStealBeneficialBuff(SpellEffIndex effIndex) m_caster->SendMessageToSet(&dataSuccess, true); } -void Spell::EffectKillCreditPersonal(SpellEffIndex effIndex) +void Spell::EffectKillCreditPersonal() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -5075,10 +5075,10 @@ void Spell::EffectKillCreditPersonal(SpellEffIndex effIndex) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - unitTarget->ToPlayer()->KilledMonsterCredit(m_spellInfo->Effects[effIndex].MiscValue); + unitTarget->ToPlayer()->KilledMonsterCredit(effectInfo->MiscValue); } -void Spell::EffectKillCredit(SpellEffIndex effIndex) +void Spell::EffectKillCredit() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -5086,7 +5086,7 @@ void Spell::EffectKillCredit(SpellEffIndex effIndex) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - int32 creatureEntry = m_spellInfo->Effects[effIndex].MiscValue; + int32 creatureEntry = effectInfo->MiscValue; if (!creatureEntry) { if (m_spellInfo->Id == 42793) // Burn Body @@ -5097,7 +5097,7 @@ void Spell::EffectKillCredit(SpellEffIndex effIndex) unitTarget->ToPlayer()->RewardPlayerAndGroupAtEvent(creatureEntry, unitTarget); } -void Spell::EffectQuestFail(SpellEffIndex effIndex) +void Spell::EffectQuestFail() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -5105,10 +5105,10 @@ void Spell::EffectQuestFail(SpellEffIndex effIndex) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - unitTarget->ToPlayer()->FailQuest(m_spellInfo->Effects[effIndex].MiscValue); + unitTarget->ToPlayer()->FailQuest(effectInfo->MiscValue); } -void Spell::EffectQuestStart(SpellEffIndex effIndex) +void Spell::EffectQuestStart() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -5120,7 +5120,7 @@ void Spell::EffectQuestStart(SpellEffIndex effIndex) if (!player) return; - if (Quest const* quest = sObjectMgr->GetQuestTemplate(m_spellInfo->Effects[effIndex].MiscValue)) + if (Quest const* quest = sObjectMgr->GetQuestTemplate(effectInfo->MiscValue)) { if (!player->CanTakeQuest(quest, false)) return; @@ -5132,7 +5132,7 @@ void Spell::EffectQuestStart(SpellEffIndex effIndex) } } -void Spell::EffectActivateRune(SpellEffIndex effIndex) +void Spell::EffectActivateRune() { if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH) return; @@ -5154,7 +5154,7 @@ void Spell::EffectActivateRune(SpellEffIndex effIndex) for (uint32 j = 0; j < MAX_RUNES && count > 0; ++j) { - if (player->GetRuneCooldown(j) && player->GetCurrentRune(j) == RuneType(m_spellInfo->Effects[effIndex].MiscValue)) + if (player->GetRuneCooldown(j) && player->GetCurrentRune(j) == RuneType(effectInfo->MiscValue)) { player->SetRuneCooldown(j, 0); --count; @@ -5165,7 +5165,7 @@ void Spell::EffectActivateRune(SpellEffIndex effIndex) if (m_spellInfo->Id == 47568) { // Need to do this just once - if (effIndex != 0) + if (effectInfo->EffectIndex != EFFECT_0) return; for (uint32 i = 0; i < MAX_RUNES; ++i) @@ -5176,7 +5176,7 @@ void Spell::EffectActivateRune(SpellEffIndex effIndex) } } -void Spell::EffectCreateTamedPet(SpellEffIndex effIndex) +void Spell::EffectCreateTamedPet() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -5184,7 +5184,7 @@ void Spell::EffectCreateTamedPet(SpellEffIndex effIndex) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER || unitTarget->GetPetGUID() || unitTarget->GetClass() != CLASS_HUNTER) return; - uint32 creatureEntry = m_spellInfo->Effects[effIndex].MiscValue; + uint32 creatureEntry = effectInfo->MiscValue; Pet* pet = unitTarget->CreateTamedPetFrom(creatureEntry, m_spellInfo->Id); if (!pet) return; @@ -5204,28 +5204,28 @@ void Spell::EffectCreateTamedPet(SpellEffIndex effIndex) } } -void Spell::EffectDiscoverTaxi(SpellEffIndex effIndex) +void Spell::EffectDiscoverTaxi() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - uint32 nodeid = m_spellInfo->Effects[effIndex].MiscValue; + uint32 nodeid = effectInfo->MiscValue; if (sTaxiNodesStore.LookupEntry(nodeid)) unitTarget->ToPlayer()->GetSession()->SendDiscoverNewTaxiNode(nodeid); } -void Spell::EffectTitanGrip(SpellEffIndex effIndex) +void Spell::EffectTitanGrip() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; if (m_caster->GetTypeId() == TYPEID_PLAYER) - m_caster->ToPlayer()->SetCanTitanGrip(true, m_spellInfo->Effects[effIndex].MiscValue); + m_caster->ToPlayer()->SetCanTitanGrip(true, effectInfo->MiscValue); } -void Spell::EffectRedirectThreat(SpellEffIndex /*effIndex*/) +void Spell::EffectRedirectThreat() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -5238,7 +5238,7 @@ void Spell::EffectRedirectThreat(SpellEffIndex /*effIndex*/) unitCaster->GetThreatManager().RegisterRedirectThreat(m_spellInfo->Id, unitTarget->GetGUID(), uint32(damage)); } -void Spell::EffectGameObjectDamage(SpellEffIndex /*effIndex*/) +void Spell::EffectGameObjectDamage() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -5253,7 +5253,7 @@ void Spell::EffectGameObjectDamage(SpellEffIndex /*effIndex*/) gameObjTarget->ModifyHealth(-damage, m_caster, GetSpellInfo()->Id); } -void Spell::EffectGameObjectRepair(SpellEffIndex /*effIndex*/) +void Spell::EffectGameObjectRepair() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -5264,7 +5264,7 @@ void Spell::EffectGameObjectRepair(SpellEffIndex /*effIndex*/) gameObjTarget->ModifyHealth(damage, m_caster); } -void Spell::EffectGameObjectSetDestructionState(SpellEffIndex effIndex) +void Spell::EffectGameObjectSetDestructionState() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -5272,10 +5272,10 @@ void Spell::EffectGameObjectSetDestructionState(SpellEffIndex effIndex) if (!gameObjTarget) return; - gameObjTarget->SetDestructibleState(GameObjectDestructibleState(m_spellInfo->Effects[effIndex].MiscValue), m_caster, true); + gameObjTarget->SetDestructibleState(GameObjectDestructibleState(effectInfo->MiscValue), m_caster, true); } -void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* properties, uint32 numGuardians) +void Spell::SummonGuardian(SpellEffectInfo const& spellEffectInfo, uint32 entry, SummonPropertiesEntry const* properties, uint32 numGuardians) { Unit* unitCaster = GetUnitCasterForEffectHandlers(); if (!unitCaster) @@ -5335,11 +5335,11 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* summon->SetDisplayId(1126); // modelid1 } - ExecuteLogEffectSummonObject(i, summon); + ExecuteLogEffectSummonObject(effectInfo->EffectIndex, summon); } } -void Spell::EffectRenamePet(SpellEffIndex /*effIndex*/) +void Spell::EffectRenamePet() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -5351,7 +5351,7 @@ void Spell::EffectRenamePet(SpellEffIndex /*effIndex*/) unitTarget->SetByteFlag(UNIT_FIELD_BYTES_2, UNIT_BYTES_2_OFFSET_PET_FLAGS, UNIT_CAN_BE_RENAMED); } -void Spell::EffectPlayMusic(SpellEffIndex effIndex) +void Spell::EffectPlayMusic() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -5359,7 +5359,7 @@ void Spell::EffectPlayMusic(SpellEffIndex effIndex) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - uint32 soundid = m_spellInfo->Effects[effIndex].MiscValue; + uint32 soundid = effectInfo->MiscValue; if (!sSoundEntriesStore.LookupEntry(soundid)) { @@ -5370,7 +5370,7 @@ void Spell::EffectPlayMusic(SpellEffIndex effIndex) unitTarget->ToPlayer()->SendDirectMessage(WorldPackets::Misc::PlayMusic(soundid).Write()); } -void Spell::EffectSpecCount(SpellEffIndex /*effIndex*/) +void Spell::EffectSpecCount() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -5381,7 +5381,7 @@ void Spell::EffectSpecCount(SpellEffIndex /*effIndex*/) unitTarget->ToPlayer()->UpdateSpecCount(damage); } -void Spell::EffectActivateSpec(SpellEffIndex /*effIndex*/) +void Spell::EffectActivateSpec() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -5392,7 +5392,7 @@ void Spell::EffectActivateSpec(SpellEffIndex /*effIndex*/) unitTarget->ToPlayer()->ActivateSpec(damage-1); // damage is 1 or 2, spec is 0 or 1 } -void Spell::EffectPlaySound(SpellEffIndex effIndex) +void Spell::EffectPlaySound() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -5414,7 +5414,7 @@ void Spell::EffectPlaySound(SpellEffIndex effIndex) break; } - uint32 soundId = m_spellInfo->Effects[effIndex].MiscValue; + uint32 soundId = effectInfo->MiscValue; if (!sSoundEntriesStore.LookupEntry(soundId)) { @@ -5425,7 +5425,7 @@ void Spell::EffectPlaySound(SpellEffIndex effIndex) player->PlayDirectSound(soundId, player); } -void Spell::EffectRemoveAura(SpellEffIndex effIndex) +void Spell::EffectRemoveAura() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -5433,10 +5433,10 @@ void Spell::EffectRemoveAura(SpellEffIndex effIndex) if (!unitTarget) return; // there may be need of specifying casterguid of removed auras - unitTarget->RemoveAurasDueToSpell(m_spellInfo->Effects[effIndex].TriggerSpell); + unitTarget->RemoveAurasDueToSpell(effectInfo->TriggerSpell); } -void Spell::EffectCastButtons(SpellEffIndex effIndex) +void Spell::EffectCastButtons() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; @@ -5445,8 +5445,8 @@ void Spell::EffectCastButtons(SpellEffIndex effIndex) if (!player) return; - uint32 button_id = m_spellInfo->Effects[effIndex].MiscValue + 132; - uint32 n_buttons = m_spellInfo->Effects[effIndex].MiscValueB; + uint32 button_id = effectInfo->MiscValue + 132; + uint32 n_buttons = effectInfo->MiscValueB; for (; n_buttons; --n_buttons, ++button_id) { @@ -5479,7 +5479,7 @@ void Spell::EffectCastButtons(SpellEffIndex effIndex) } } -void Spell::EffectRechargeManaGem(SpellEffIndex /*effIndex*/) +void Spell::EffectRechargeManaGem() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -5509,7 +5509,7 @@ void Spell::EffectRechargeManaGem(SpellEffIndex /*effIndex*/) } } -void Spell::EffectBind(SpellEffIndex effIndex) +void Spell::EffectBind() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -5522,8 +5522,8 @@ void Spell::EffectBind(SpellEffIndex effIndex) WorldLocation homeLoc; uint32 areaId = player->GetAreaId(); - if (m_spellInfo->Effects[effIndex].MiscValue) - areaId = m_spellInfo->Effects[effIndex].MiscValue; + if (effectInfo->MiscValue) + areaId = effectInfo->MiscValue; if (m_targets.HasDst()) homeLoc.WorldRelocate(*destTarget); @@ -5541,7 +5541,7 @@ void Spell::EffectBind(SpellEffIndex effIndex) player->SendDirectMessage(packet.Write()); } -void Spell::EffectSummonRaFFriend(SpellEffIndex effIndex) +void Spell::EffectSummonRaFFriend() { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; @@ -5549,5 +5549,5 @@ void Spell::EffectSummonRaFFriend(SpellEffIndex effIndex) if (m_caster->GetTypeId() != TYPEID_PLAYER || !unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - m_caster->CastSpell(unitTarget, m_spellInfo->Effects[effIndex].TriggerSpell, true); + m_caster->CastSpell(unitTarget, effectInfo->TriggerSpell, true); } |