aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp26
-rw-r--r--src/server/game/Achievements/AchievementMgr.cpp2
-rw-r--r--src/server/game/Entities/Creature/Trainer.cpp21
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp6
-rw-r--r--src/server/game/Entities/Object/Object.cpp6
-rw-r--r--src/server/game/Entities/Player/Player.cpp58
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp79
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp26
-rw-r--r--src/server/game/Scripting/ScriptMgr.cpp70
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.cpp85
-rw-r--r--src/server/game/Spells/SpellEffects.cpp28
-rw-r--r--src/server/game/Spells/SpellInfo.cpp4
-rw-r--r--src/server/game/Spells/SpellInfo.h3
-rw-r--r--src/server/game/Spells/SpellMgr.cpp482
-rw-r--r--src/server/scripts/Spells/spell_pet.cpp12
-rw-r--r--src/server/scripts/Spells/spell_priest.cpp2
16 files changed, 464 insertions, 446 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index bcd764b0be8..64b511c16d4 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -1586,13 +1586,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
if (!IsSpellValid(e, e.action.cast.spell))
return false;
- for (SpellEffectInfo const& Effect : sSpellMgr->AssertSpellInfo(e.action.cast.spell)->Effects)
+ for (SpellEffectInfo const& spellEffectInfo : sSpellMgr->AssertSpellInfo(e.action.cast.spell)->GetEffects())
{
- if (Effect.IsEffect(SPELL_EFFECT_KILL_CREDIT) || Effect.IsEffect(SPELL_EFFECT_KILL_CREDIT2))
+ if (spellEffectInfo.IsEffect(SPELL_EFFECT_KILL_CREDIT) || spellEffectInfo.IsEffect(SPELL_EFFECT_KILL_CREDIT2))
{
- if (Effect.TargetA.GetTarget() == TARGET_UNIT_CASTER)
+ if (spellEffectInfo.TargetA.GetTarget() == TARGET_UNIT_CASTER)
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u Effect: SPELL_EFFECT_KILL_CREDIT: (SpellId: %u targetA: %u - targetB: %u) has invalid target for this Action",
- e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.cast.spell, Effect.TargetA.GetTarget(), Effect.TargetB.GetTarget());
+ e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.cast.spell, spellEffectInfo.TargetA.GetTarget(), spellEffectInfo.TargetB.GetTarget());
}
}
break;
@@ -2245,19 +2245,19 @@ void SmartAIMgr::LoadHelperStores()
if (!spellInfo)
continue;
- for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
{
- if (spellInfo->Effects[j].IsEffect(SPELL_EFFECT_SUMMON))
- SummonCreatureSpellStore.insert(std::make_pair(uint32(spellInfo->Effects[j].MiscValue), std::make_pair(i, SpellEffIndex(j))));
+ if (spellEffectInfo.IsEffect(SPELL_EFFECT_SUMMON))
+ SummonCreatureSpellStore.insert(std::make_pair(uint32(spellEffectInfo.MiscValue), std::make_pair(i, spellEffectInfo.EffectIndex)));
- else if (spellInfo->Effects[j].IsEffect(SPELL_EFFECT_SUMMON_OBJECT_WILD))
- SummonGameObjectSpellStore.insert(std::make_pair(uint32(spellInfo->Effects[j].MiscValue), std::make_pair(i, SpellEffIndex(j))));
+ else if (spellEffectInfo.IsEffect(SPELL_EFFECT_SUMMON_OBJECT_WILD))
+ SummonGameObjectSpellStore.insert(std::make_pair(uint32(spellEffectInfo.MiscValue), std::make_pair(i, spellEffectInfo.EffectIndex)));
- else if (spellInfo->Effects[j].IsEffect(SPELL_EFFECT_KILL_CREDIT) || spellInfo->Effects[j].IsEffect(SPELL_EFFECT_KILL_CREDIT2))
- KillCreditSpellStore.insert(std::make_pair(uint32(spellInfo->Effects[j].MiscValue), std::make_pair(i, SpellEffIndex(j))));
+ else if (spellEffectInfo.IsEffect(SPELL_EFFECT_KILL_CREDIT) || spellEffectInfo.IsEffect(SPELL_EFFECT_KILL_CREDIT2))
+ KillCreditSpellStore.insert(std::make_pair(uint32(spellEffectInfo.MiscValue), std::make_pair(i, spellEffectInfo.EffectIndex)));
- else if (spellInfo->Effects[j].IsEffect(SPELL_EFFECT_CREATE_ITEM))
- CreateItemSpellStore.insert(std::make_pair(uint32(spellInfo->Effects[j].ItemType), std::make_pair(i, SpellEffIndex(j))));
+ else if (spellEffectInfo.IsEffect(SPELL_EFFECT_CREATE_ITEM))
+ CreateItemSpellStore.insert(std::make_pair(uint32(spellEffectInfo.ItemType), std::make_pair(i, spellEffectInfo.EffectIndex)));
}
}
diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp
index 73765828a50..3d8020ea770 100644
--- a/src/server/game/Achievements/AchievementMgr.cpp
+++ b/src/server/game/Achievements/AchievementMgr.cpp
@@ -152,7 +152,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
criteria->ID, criteria->Type, (dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"), dataType, aura.effect_idx);
return false;
}
- if (!spellEntry->Effects[aura.effect_idx].ApplyAuraName)
+ if (!spellEntry->GetEffect(SpellEffIndex(aura.effect_idx)).ApplyAuraName)
{
TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) contains a non-aura spell effect (ID: %u Effect: %u), ignored.",
criteria->ID, criteria->Type, (dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"), dataType, aura.spell_id, aura.effect_idx);
diff --git a/src/server/game/Entities/Creature/Trainer.cpp b/src/server/game/Entities/Creature/Trainer.cpp
index 062f9919fcf..29679993176 100644
--- a/src/server/game/Entities/Creature/Trainer.cpp
+++ b/src/server/game/Entities/Creature/Trainer.cpp
@@ -51,12 +51,12 @@ namespace Trainer
SpellInfo const* trainerSpellInfo = sSpellMgr->AssertSpellInfo(trainerSpell.SpellId);
bool primaryProfessionFirstRank = false;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : trainerSpellInfo->GetEffects())
{
- if (trainerSpellInfo->Effects[i].Effect != SPELL_EFFECT_LEARN_SPELL)
+ if (!spellEffectInfo.IsEffect(SPELL_EFFECT_LEARN_SPELL))
continue;
- SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(trainerSpellInfo->Effects[i].TriggerSpell);
+ SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(spellEffectInfo.TriggerSpell);
if (learnedSpellInfo && learnedSpellInfo->IsPrimaryProfessionFirstRank())
primaryProfessionFirstRank = true;
}
@@ -138,12 +138,12 @@ namespace Trainer
SpellInfo const* trainerSpellInfo = sSpellMgr->AssertSpellInfo(trainerSpell->SpellId);
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : trainerSpellInfo->GetEffects())
{
- if (trainerSpellInfo->Effects[i].Effect != SPELL_EFFECT_LEARN_SPELL)
+ if (!spellEffectInfo.IsEffect(SPELL_EFFECT_LEARN_SPELL))
continue;
- SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(trainerSpellInfo->Effects[i].TriggerSpell);
+ SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(spellEffectInfo.TriggerSpell);
if (learnedSpellInfo && learnedSpellInfo->IsPrimaryProfessionFirstRank() && !player->GetFreePrimaryProfessionPoints())
return false;
}
@@ -175,17 +175,16 @@ namespace Trainer
// check ranks
bool hasLearnSpellEffect = false;
bool knowsAllLearnedSpells = true;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : sSpellMgr->AssertSpellInfo(trainerSpell->SpellId)->GetEffects())
{
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(trainerSpell->SpellId);
- if (!spellInfo || spellInfo->Effects[i].Effect != SPELL_EFFECT_LEARN_SPELL)
+ if (!spellEffectInfo.IsEffect(SPELL_EFFECT_LEARN_SPELL))
continue;
hasLearnSpellEffect = true;
- if (!player->HasSpell(spellInfo->Effects[i].TriggerSpell))
+ if (!player->HasSpell(spellEffectInfo.TriggerSpell))
knowsAllLearnedSpells = false;
- if (uint32 previousRankSpellId = sSpellMgr->GetPrevSpellInChain(spellInfo->Effects[i].TriggerSpell))
+ if (uint32 previousRankSpellId = sSpellMgr->GetPrevSpellInChain(spellEffectInfo.TriggerSpell))
if (!player->HasSpell(previousRankSpellId))
return SpellState::Unavailable;
}
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 0e864cdc479..4a290700fc4 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -2757,9 +2757,9 @@ SpellInfo const* GameObject::GetSpellForLock(Player const* player) const
for (auto&& playerSpell : player->GetSpellMap())
if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(playerSpell.first))
- for (auto&& effect : spell->Effects)
- if (effect.Effect == SPELL_EFFECT_OPEN_LOCK && ((uint32) effect.MiscValue) == lock->Index[i])
- if (effect.CalcValue(player) >= int32(lock->Skill[i]))
+ for (SpellEffectInfo const& spellEffectInfo : spell->GetEffects())
+ if (spellEffectInfo.IsEffect(SPELL_EFFECT_OPEN_LOCK) && ((uint32) spellEffectInfo.MiscValue) == lock->Index[i])
+ if (spellEffectInfo.CalcValue(player) >= int32(lock->Skill[i]))
return spell;
}
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index 4e5dbebc8ac..0a43a53d9d0 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -2355,7 +2355,7 @@ int32 WorldObject::ModSpellDuration(SpellInfo const* spellInfo, WorldObject cons
sSpellMgr->IsSpellMemberOfSpellGroup(spellInfo->Id, SPELL_GROUP_ELIXIR_BATTLE) ||
sSpellMgr->IsSpellMemberOfSpellGroup(spellInfo->Id, SPELL_GROUP_ELIXIR_GUARDIAN)))
{
- if (unitTarget->HasAura(53042) && unitTarget->HasSpell(spellInfo->Effects[0].TriggerSpell))
+ if (unitTarget->HasAura(53042) && unitTarget->HasSpell(spellInfo->GetEffect(EFFECT_0).TriggerSpell))
duration *= 2;
}
}
@@ -2511,9 +2511,9 @@ SpellMissInfo WorldObject::MagicSpellHitResult(Unit* victim, SpellInfo const* sp
if (!spellInfo->IsPositive() && !spellInfo->HasAttribute(SPELL_ATTR4_IGNORE_RESISTANCES))
{
bool hasAura = false;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
{
- if (spellInfo->Effects[i].IsAura())
+ if (spellEffectInfo.IsAura())
{
hasAura = true;
break;
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index e7fd4ab5b53..f8d90a45e39 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -3457,9 +3457,9 @@ bool Player::AddSpell(uint32 spellId, bool active, bool learning, bool dependent
LearnDefaultSkill(pSkill->ID, 0);
if (pSkill->ID == SKILL_MOUNTS && !Has310Flyer(false))
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
- spellInfo->Effects[i].CalcValue() == 310)
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
+ if (spellEffectInfo.ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
+ spellEffectInfo.CalcValue() == 310)
SetHas310Flyer(true);
}
}
@@ -3531,9 +3531,9 @@ bool Player::HandlePassiveSpellLearn(SpellInfo const* spellInfo)
// passive spells which apply aura and have an item requirement are to be added manually, instead of casted
if (spellInfo->EquippedItemClass >= 0)
{
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
{
- if (spellInfo->Effects[i].IsAura())
+ if (spellEffectInfo.IsAura())
{
if (!HasAura(spellInfo->Id) && HasItemFitToSpellRequirements(spellInfo))
AddAura(spellInfo->Id, this);
@@ -3706,10 +3706,10 @@ void Player::RemoveSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
if (_spell_idx->second->SkillLine == SKILL_MOUNTS)
{
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
{
- if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
- spellInfo->Effects[i].CalcValue() == 310)
+ if (spellEffectInfo.ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
+ spellEffectInfo.CalcValue() == 310)
{
Has310Flyer(true, spell_id); // with true as first argument its also used to set/remove the flag
break;
@@ -3813,13 +3813,15 @@ bool Player::Has310Flyer(bool checkAllSpells, uint32 excludeSpellId)
break; // We can break because mount spells belong only to one skillline (at least 310 flyers do)
spellInfo = sSpellMgr->AssertSpellInfo(itr->first);
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
- spellInfo->Effects[i].CalcValue() == 310)
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
+ {
+ if (spellEffectInfo.ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
+ spellEffectInfo.CalcValue() == 310)
{
SetHas310Flyer(true);
return true;
}
+ }
}
}
}
@@ -3934,9 +3936,9 @@ bool Player::ResetTalents(bool no_cost)
continue;
RemoveSpell(talentInfo->SpellRank[rank], true);
// search for spells that the talent teaches and unlearn them
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (_spellEntry->Effects[i].TriggerSpell > 0 && _spellEntry->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL)
- RemoveSpell(_spellEntry->Effects[i].TriggerSpell, true);
+ for (SpellEffectInfo const& spellEffectInfo : _spellEntry->GetEffects())
+ if (spellEffectInfo.IsEffect(SPELL_EFFECT_LEARN_SPELL) && spellEffectInfo.TriggerSpell > 0)
+ RemoveSpell(spellEffectInfo.TriggerSpell, true);
// if this talent rank can be found in the PlayerTalentMap, mark the talent as removed so it gets deleted
PlayerTalentMap::iterator plrTalent = m_talents[m_activeSpec]->find(talentInfo->SpellRank[rank]);
if (plrTalent != m_talents[m_activeSpec]->end())
@@ -8065,11 +8067,9 @@ void Player::CastItemCombatSpell(DamageInfo const& damageInfo, Item* item, ItemT
int32 const effectPct = std::max(0, 100 - (lvlDifference * lvlPenaltyFactor));
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- {
- if (spellInfo->Effects[i].IsEffect())
- args.AddSpellMod(static_cast<SpellValueMod>(SPELLVALUE_BASE_POINT0 + i), CalculatePct(spellInfo->Effects[i].CalcValue(this), effectPct));
- }
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
+ if (spellEffectInfo.IsEffect())
+ args.AddSpellMod(static_cast<SpellValueMod>(SPELLVALUE_BASE_POINT0 + spellEffectInfo.EffectIndex), CalculatePct(spellEffectInfo.CalcValue(this), effectPct));
}
CastSpell(target, spellInfo->Id, args);
}
@@ -23100,9 +23100,9 @@ void Player::LearnQuestRewardedSpells(Quest const* quest)
// check learned spells state
bool found = false;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
{
- if (spellInfo->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL && !HasSpell(spellInfo->Effects[i].TriggerSpell))
+ if (spellEffectInfo.IsEffect(SPELL_EFFECT_LEARN_SPELL) && !HasSpell(spellEffectInfo.TriggerSpell))
{
found = true;
break;
@@ -23113,7 +23113,7 @@ void Player::LearnQuestRewardedSpells(Quest const* quest)
if (!found)
return;
- uint32 learned_0 = spellInfo->Effects[0].TriggerSpell;
+ uint32 learned_0 = spellInfo->GetEffect(EFFECT_0).TriggerSpell;
if (!HasSpell(learned_0))
{
SpellInfo const* learnedInfo = sSpellMgr->GetSpellInfo(learned_0);
@@ -23121,7 +23121,7 @@ void Player::LearnQuestRewardedSpells(Quest const* quest)
return;
// profession specialization can be re-learned from npc
- if (learnedInfo->Effects[0].Effect == SPELL_EFFECT_TRADE_SKILL && learnedInfo->Effects[1].Effect == 0 && !learnedInfo->SpellLevel)
+ if (learnedInfo->GetEffect(EFFECT_0).Effect == SPELL_EFFECT_TRADE_SKILL && learnedInfo->GetEffect(EFFECT_1).Effect == 0 && !learnedInfo->SpellLevel)
return;
}
@@ -23720,11 +23720,9 @@ bool Player::HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item cons
// special check to filter things like Shield Wall, the aura is not permanent and must stay even without required item
if (!spellInfo->IsPassive())
- {
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (spellInfo->Effects[i].IsAura())
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
+ if (spellEffectInfo.IsAura())
return true;
- }
}
// tabard not have dependent spells
@@ -26127,9 +26125,9 @@ void Player::ActivateSpec(uint8 spec)
continue;
RemoveSpell(talentInfo->SpellRank[rank], true); // removes the talent, and all dependant, learned, and chained spells..
if (SpellInfo const* _spellEntry = sSpellMgr->GetSpellInfo(talentInfo->SpellRank[rank]))
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) // search through the SpellInfo for valid trigger spells
- if (_spellEntry->Effects[i].TriggerSpell > 0 && _spellEntry->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL)
- RemoveSpell(_spellEntry->Effects[i].TriggerSpell, true); // and remove any spells that the talent teaches
+ for (SpellEffectInfo const& spellEffectInfo : _spellEntry->GetEffects()) // search through the SpellInfo for valid trigger spells
+ if (spellEffectInfo.IsEffect(SPELL_EFFECT_LEARN_SPELL) && spellEffectInfo.TriggerSpell > 0)
+ RemoveSpell(spellEffectInfo.TriggerSpell, true); // and remove any spells that the talent teaches
// if this talent rank can be found in the PlayerTalentMap, mark the talent as removed so it gets deleted
//PlayerTalentMap::iterator plrTalent = m_talents[m_activeSpec]->find(talentInfo->RankID[rank]);
//if (plrTalent != m_talents[m_activeSpec]->end())
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 10f1a7183ae..c785087220e 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -1872,7 +1872,7 @@ void Unit::HandleEmoteCommand(Emote emoteId)
int32 manaReduction = currentAbsorb;
// lower absorb amount by talents
- if (float manaMultiplier = absorbAurEff->GetSpellInfo()->Effects[absorbAurEff->GetEffIndex()].CalcValueMultiplier(absorbAurEff->GetCaster()))
+ if (float manaMultiplier = absorbAurEff->GetSpellEffectInfo().CalcValueMultiplier(absorbAurEff->GetCaster()))
manaReduction = int32(float(manaReduction) * manaMultiplier);
int32 manaTaken = -damageInfo.GetVictim()->ModifyPower(POWER_MANA, -manaReduction);
@@ -3232,16 +3232,17 @@ Aura* Unit::_TryStackingOrRefreshingExistingAura(AuraCreateInfo& createInfo)
return nullptr;
// update basepoints with new values - effect amount will be recalculated in ModStackAmount
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : createInfo.GetSpellInfo()->GetEffects())
{
- if (!foundAura->HasEffect(i))
+ AuraEffect const* auraEff = foundAura->GetEffect(spellEffectInfo.EffectIndex);
+ if (!auraEff)
continue;
- int32 bp = foundAura->GetSpellInfo()->Effects[i].BasePoints;
+ int32 bp = spellEffectInfo.BasePoints;
if (createInfo.BaseAmount)
- bp = *(createInfo.BaseAmount + i);
+ bp = *(createInfo.BaseAmount + spellEffectInfo.EffectIndex);
- int32* oldBP = const_cast<int32*>(&(foundAura->GetEffect(i)->m_baseAmount));
+ int32* oldBP = const_cast<int32*>(&(auraEff->m_baseAmount));
*oldBP = bp;
}
@@ -4078,9 +4079,9 @@ void Unit::RemoveMovementImpairingAuras(bool withRoot)
}
// turn off snare auras by setting amount to 0
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (((1 << i) & iter->second->GetEffectMask()) && aura->GetSpellInfo()->Effects[i].Mechanic == MECHANIC_SNARE)
- aura->GetEffect(i)->ChangeAmount(0);
+ for (SpellEffectInfo const& spellEffectInfo : aura->GetSpellInfo()->GetEffects())
+ if (iter->second->HasEffect(spellEffectInfo.EffectIndex) && spellEffectInfo.Mechanic == MECHANIC_SNARE)
+ aura->GetEffect(spellEffectInfo.EffectIndex)->ChangeAmount(0);
++iter;
}
@@ -4579,7 +4580,7 @@ bool Unit::HasAuraTypeWithValue(AuraType auraType, int32 value) const
bool Unit::HasAuraTypeWithTriggerSpell(AuraType auratype, uint32 triggerSpell) const
{
for (AuraEffect const* aura : GetAuraEffectsByType(auratype))
- if (aura->GetSpellInfo()->Effects[aura->GetEffIndex()].TriggerSpell == triggerSpell)
+ if (aura->GetSpellEffectInfo().TriggerSpell == triggerSpell)
return true;
return false;
}
@@ -4604,9 +4605,9 @@ bool Unit::HasAuraWithMechanic(uint32 mechanicMask) const
if (spellInfo->Mechanic && (mechanicMask & (1 << spellInfo->Mechanic)))
return true;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (iter->second->HasEffect(i) && spellInfo->Effects[i].Effect && spellInfo->Effects[i].Mechanic)
- if (mechanicMask & (1 << spellInfo->Effects[i].Mechanic))
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
+ if (iter->second->HasEffect(spellEffectInfo.EffectIndex) && spellEffectInfo.IsEffect() && spellEffectInfo.Mechanic)
+ if (mechanicMask & (1 << spellEffectInfo.Mechanic))
return true;
}
@@ -5985,12 +5986,12 @@ void Unit::SetMinion(Minion *minion, bool apply)
// All summoned by totem minions must disappear when it is removed.
if (SpellInfo const* spInfo = sSpellMgr->GetSpellInfo(minion->ToTotem()->GetSpell()))
{
- for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : spInfo->GetEffects())
{
- if (spInfo->Effects[i].Effect != SPELL_EFFECT_SUMMON)
+ if (!spellEffectInfo.IsEffect(SPELL_EFFECT_SUMMON))
continue;
- RemoveAllMinionsByEntry(spInfo->Effects[i].MiscValue);
+ RemoveAllMinionsByEntry(spellEffectInfo.MiscValue);
}
}
}
@@ -6505,7 +6506,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
case 49636:
case 49638:
if (SpellInfo const* proto = sSpellMgr->GetSpellInfo(itr->first))
- AddPct(ApCoeffMod, proto->Effects[EFFECT_0].CalcValue());
+ AddPct(ApCoeffMod, proto->GetEffect(EFFECT_0).CalcValue());
break;
}
}
@@ -7359,7 +7360,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
case 49636:
case 49638:
if (SpellInfo const* proto = sSpellMgr->GetSpellInfo(itr->first))
- AddPct(ApCoeffMod, proto->Effects[EFFECT_0].CalcValue());
+ AddPct(ApCoeffMod, proto->GetEffect(EFFECT_0).CalcValue());
break;
}
}
@@ -7422,9 +7423,9 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
}
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& otherSpellEffect : spellProto->GetEffects())
{
- switch (spellProto->Effects[i].ApplyAuraName)
+ switch (otherSpellEffect.ApplyAuraName)
{
// Bonus healing does not apply to these spells
case SPELL_AURA_PERIODIC_LEECH:
@@ -7434,7 +7435,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
default:
break;
}
- if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH)
+ if (otherSpellEffect.IsEffect(SPELL_EFFECT_HEALTH_LEECH))
DoneTotal = 0;
}
@@ -7595,7 +7596,7 @@ int32 Unit::SpellBaseHealingBonusDone(SpellSchoolMask schoolMask) const
for (AuraEffectList::const_iterator i = mHealingDoneOfStatPercent.begin(); i != mHealingDoneOfStatPercent.end(); ++i)
{
// stat used dependent from misc value (stat index)
- Stats usedStat = Stats((*i)->GetSpellInfo()->Effects[(*i)->GetEffIndex()].MiscValue);
+ Stats usedStat = Stats((*i)->GetSpellEffectInfo().MiscValue);
advertisedBenefit += int32(CalculatePct(GetStat(usedStat), (*i)->GetAmount()));
}
@@ -10586,9 +10587,9 @@ uint32 Unit::GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectTyp
bool DirectDamage = false;
bool AreaEffect = false;
- for (uint32 i = 0; i < MAX_SPELL_EFFECTS; i++)
+ for (SpellEffectInfo const& spellEffectInfo : spellProto->GetEffects())
{
- switch (spellProto->Effects[i].Effect)
+ switch (spellEffectInfo.Effect)
{
case SPELL_EFFECT_SCHOOL_DAMAGE:
case SPELL_EFFECT_POWER_DRAIN:
@@ -10599,7 +10600,7 @@ uint32 Unit::GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectTyp
DirectDamage = true;
break;
case SPELL_EFFECT_APPLY_AURA:
- switch (spellProto->Effects[i].ApplyAuraName)
+ switch (spellEffectInfo.ApplyAuraName)
{
case SPELL_AURA_PERIODIC_DAMAGE:
case SPELL_AURA_PERIODIC_HEAL:
@@ -10617,7 +10618,7 @@ uint32 Unit::GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectTyp
break;
}
- if (spellProto->Effects[i].IsTargetingArea())
+ if (spellEffectInfo.IsTargetingArea())
AreaEffect = true;
}
@@ -10644,10 +10645,10 @@ uint32 Unit::GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectTyp
CastingTime /= 2;
// 50% for damage and healing spells for leech spells from damage bonus and 0% from healing
- for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
+ for (SpellEffectInfo const& spellEffectInfo : spellProto->GetEffects())
{
- if (spellProto->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH ||
- (spellProto->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH))
+ if (spellEffectInfo.IsEffect(SPELL_EFFECT_HEALTH_LEECH) ||
+ (spellEffectInfo.IsEffect(SPELL_EFFECT_APPLY_AURA) && spellEffectInfo.ApplyAuraName == SPELL_AURA_PERIODIC_LEECH))
{
CastingTime /= 2;
break;
@@ -12452,9 +12453,9 @@ void Unit::HandleSpellClick(Unit* clicker, int8 seatId /*= -1*/)
{
uint8 i = 0;
bool valid = false;
- while (i < MAX_SPELL_EFFECTS)
+ for (SpellEffectInfo const& spellEffectInfo : spellEntry->GetEffects())
{
- if (spellEntry->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE)
+ if (spellEffectInfo.ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE)
{
valid = true;
break;
@@ -12478,8 +12479,8 @@ void Unit::HandleSpellClick(Unit* clicker, int8 seatId /*= -1*/)
else // This can happen during Player::_LoadAuras
{
int32 bp[MAX_SPELL_EFFECTS] = { };
- for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
- bp[j] = spellEntry->Effects[j].BasePoints;
+ for (SpellEffectInfo const& spellEffectInfo : spellEntry->GetEffects())
+ bp[spellEffectInfo.EffectIndex] = spellEffectInfo.BasePoints;
bp[i] = seatId;
@@ -13421,13 +13422,19 @@ void Unit::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target)
// this also applies for transform auras
if (SpellInfo const* transform = sSpellMgr->GetSpellInfo(GetTransformSpell()))
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (transform->Effects[i].IsAura(SPELL_AURA_TRANSFORM))
- if (CreatureTemplate const* transformInfo = sObjectMgr->GetCreatureTemplate(transform->Effects[i].MiscValue))
+ {
+ for (SpellEffectInfo const& spellEffectInfo : transform->GetEffects())
+ {
+ if (spellEffectInfo.IsAura(SPELL_AURA_TRANSFORM))
+ {
+ if (CreatureTemplate const* transformInfo = sObjectMgr->GetCreatureTemplate(spellEffectInfo.MiscValue))
{
cinfo = transformInfo;
break;
}
+ }
+ }
+ }
if (cinfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER)
if (target->IsGameMaster())
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index e31a650b1bb..8a3eb210e22 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -5330,12 +5330,12 @@ void ObjectMgr::LoadQuests()
if (!spellInfo)
continue;
- for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
{
- if (spellInfo->Effects[j].Effect != SPELL_EFFECT_QUEST_COMPLETE)
+ if (spellEffectInfo.Effect != SPELL_EFFECT_QUEST_COMPLETE)
continue;
- uint32 quest_id = spellInfo->Effects[j].MiscValue;
+ uint32 quest_id = spellEffectInfo.MiscValue;
Quest const* quest = GetQuestTemplate(quest_id);
@@ -5733,10 +5733,16 @@ void ObjectMgr::LoadSpellScripts()
continue;
}
- uint8 i = (uint8)((uint32(itr->first) >> 24) & 0x000000FF);
+ SpellEffIndex i = SpellEffIndex((uint32(itr->first) >> 24) & 0x000000FF);
+ if (uint32(i) > MAX_SPELL_EFFECTS)
+ {
+ TC_LOG_ERROR("sql.sql", "Table `spell_scripts` has too high effect index %u for spell (Id: %u) as script id", uint32(i), spellId);
+ continue;
+ }
+
//check for correct spellEffect
- if (!spellInfo->Effects[i].Effect || (spellInfo->Effects[i].Effect != SPELL_EFFECT_SCRIPT_EFFECT && spellInfo->Effects[i].Effect != SPELL_EFFECT_DUMMY))
- TC_LOG_ERROR("sql.sql", "Table `spell_scripts` - spell %u effect %u is not SPELL_EFFECT_SCRIPT_EFFECT or SPELL_EFFECT_DUMMY", spellId, i);
+ if (!spellInfo->GetEffect(i).Effect || (spellInfo->GetEffect(i).Effect != SPELL_EFFECT_SCRIPT_EFFECT && spellInfo->GetEffect(i).Effect != SPELL_EFFECT_DUMMY))
+ TC_LOG_ERROR("sql.sql", "Table `spell_scripts` - spell %u effect %u is not SPELL_EFFECT_SCRIPT_EFFECT or SPELL_EFFECT_DUMMY", spellId, uint32(i));
}
}
@@ -5753,10 +5759,10 @@ void ObjectMgr::LoadEventScripts()
// Load all possible script entries from spells
for (uint32 i = 1; i < sSpellMgr->GetSpellInfoStoreSize(); ++i)
if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(i))
- for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
- if (spell->Effects[j].Effect == SPELL_EFFECT_SEND_EVENT)
- if (spell->Effects[j].MiscValue)
- evt_scripts.insert(spell->Effects[j].MiscValue);
+ for (SpellEffectInfo const& spellEffectInfo : spell->GetEffects())
+ if (spellEffectInfo.IsEffect(SPELL_EFFECT_SEND_EVENT))
+ if (spellEffectInfo.MiscValue)
+ evt_scripts.insert(spellEffectInfo.MiscValue);
for (size_t path_idx = 0; path_idx < sTaxiPathNodesByPath.size(); ++path_idx)
{
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
index 8019735974d..2026df3f378 100644
--- a/src/server/game/Scripting/ScriptMgr.cpp
+++ b/src/server/game/Scripting/ScriptMgr.cpp
@@ -1147,70 +1147,70 @@ void ScriptMgr::FillSpellSummary()
if (!pTempSpell)
continue;
- for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
+ for (SpellEffectInfo const& spellEffectInfo : pTempSpell->GetEffects())
{
// Spell targets self.
- if (pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_CASTER)
+ if (spellEffectInfo.TargetA.GetTarget() == TARGET_UNIT_CASTER)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SELF-1);
// Spell targets a single enemy.
- if (pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_TARGET_ENEMY ||
- pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_DEST_TARGET_ENEMY)
+ if (spellEffectInfo.TargetA.GetTarget() == TARGET_UNIT_TARGET_ENEMY ||
+ spellEffectInfo.TargetA.GetTarget() == TARGET_DEST_TARGET_ENEMY)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SINGLE_ENEMY-1);
// Spell targets AoE at enemy.
- if (pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_SRC_AREA_ENEMY ||
- pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_DEST_AREA_ENEMY ||
- pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_SRC_CASTER ||
- pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_DEST_DYNOBJ_ENEMY)
+ if (spellEffectInfo.TargetA.GetTarget() == TARGET_UNIT_SRC_AREA_ENEMY ||
+ spellEffectInfo.TargetA.GetTarget() == TARGET_UNIT_DEST_AREA_ENEMY ||
+ spellEffectInfo.TargetA.GetTarget() == TARGET_SRC_CASTER ||
+ spellEffectInfo.TargetA.GetTarget() == TARGET_DEST_DYNOBJ_ENEMY)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_AOE_ENEMY-1);
// Spell targets an enemy.
- if (pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_TARGET_ENEMY ||
- pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_DEST_TARGET_ENEMY ||
- pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_SRC_AREA_ENEMY ||
- pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_DEST_AREA_ENEMY ||
- pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_SRC_CASTER ||
- pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_DEST_DYNOBJ_ENEMY)
+ if (spellEffectInfo.TargetA.GetTarget() == TARGET_UNIT_TARGET_ENEMY ||
+ spellEffectInfo.TargetA.GetTarget() == TARGET_DEST_TARGET_ENEMY ||
+ spellEffectInfo.TargetA.GetTarget() == TARGET_UNIT_SRC_AREA_ENEMY ||
+ spellEffectInfo.TargetA.GetTarget() == TARGET_UNIT_DEST_AREA_ENEMY ||
+ spellEffectInfo.TargetA.GetTarget() == TARGET_SRC_CASTER ||
+ spellEffectInfo.TargetA.GetTarget() == TARGET_DEST_DYNOBJ_ENEMY)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_ANY_ENEMY-1);
// Spell targets a single friend (or self).
- if (pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_CASTER ||
- pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_TARGET_ALLY ||
- pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_TARGET_PARTY)
+ if (spellEffectInfo.TargetA.GetTarget() == TARGET_UNIT_CASTER ||
+ spellEffectInfo.TargetA.GetTarget() == TARGET_UNIT_TARGET_ALLY ||
+ spellEffectInfo.TargetA.GetTarget() == TARGET_UNIT_TARGET_PARTY)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SINGLE_FRIEND-1);
// Spell targets AoE friends.
- if (pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_CASTER_AREA_PARTY ||
- pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_LASTTARGET_AREA_PARTY ||
- pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_SRC_CASTER)
+ if (spellEffectInfo.TargetA.GetTarget() == TARGET_UNIT_CASTER_AREA_PARTY ||
+ spellEffectInfo.TargetA.GetTarget() == TARGET_UNIT_LASTTARGET_AREA_PARTY ||
+ spellEffectInfo.TargetA.GetTarget() == TARGET_SRC_CASTER)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_AOE_FRIEND-1);
// Spell targets any friend (or self).
- if (pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_CASTER ||
- pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_TARGET_ALLY ||
- pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_TARGET_PARTY ||
- pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_CASTER_AREA_PARTY ||
- pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_UNIT_LASTTARGET_AREA_PARTY ||
- pTempSpell->Effects[j].TargetA.GetTarget() == TARGET_SRC_CASTER)
+ if (spellEffectInfo.TargetA.GetTarget() == TARGET_UNIT_CASTER ||
+ spellEffectInfo.TargetA.GetTarget() == TARGET_UNIT_TARGET_ALLY ||
+ spellEffectInfo.TargetA.GetTarget() == TARGET_UNIT_TARGET_PARTY ||
+ spellEffectInfo.TargetA.GetTarget() == TARGET_UNIT_CASTER_AREA_PARTY ||
+ spellEffectInfo.TargetA.GetTarget() == TARGET_UNIT_LASTTARGET_AREA_PARTY ||
+ spellEffectInfo.TargetA.GetTarget() == TARGET_SRC_CASTER)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_ANY_FRIEND-1);
// Make sure that this spell includes a damage effect.
- if (pTempSpell->Effects[j].Effect == SPELL_EFFECT_SCHOOL_DAMAGE ||
- pTempSpell->Effects[j].Effect == SPELL_EFFECT_INSTAKILL ||
- pTempSpell->Effects[j].Effect == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE ||
- pTempSpell->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH)
+ if (spellEffectInfo.Effect == SPELL_EFFECT_SCHOOL_DAMAGE ||
+ spellEffectInfo.Effect == SPELL_EFFECT_INSTAKILL ||
+ spellEffectInfo.Effect == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE ||
+ spellEffectInfo.Effect == SPELL_EFFECT_HEALTH_LEECH)
SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_DAMAGE-1);
// Make sure that this spell includes a healing effect (or an apply aura with a periodic heal).
- if (pTempSpell->Effects[j].Effect == SPELL_EFFECT_HEAL ||
- pTempSpell->Effects[j].Effect == SPELL_EFFECT_HEAL_MAX_HEALTH ||
- pTempSpell->Effects[j].Effect == SPELL_EFFECT_HEAL_MECHANICAL ||
- (pTempSpell->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && pTempSpell->Effects[j].ApplyAuraName == 8))
+ if (spellEffectInfo.Effect == SPELL_EFFECT_HEAL ||
+ spellEffectInfo.Effect == SPELL_EFFECT_HEAL_MAX_HEALTH ||
+ spellEffectInfo.Effect == SPELL_EFFECT_HEAL_MECHANICAL ||
+ (spellEffectInfo.Effect == SPELL_EFFECT_APPLY_AURA && spellEffectInfo.ApplyAuraName == 8))
SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_HEALING-1);
// Make sure that this spell applies an aura.
- if (pTempSpell->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA)
+ if (spellEffectInfo.Effect == SPELL_EFFECT_APPLY_AURA)
SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_AURA-1);
}
}
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index c783ce63189..9225876eb9d 100644
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -134,9 +134,9 @@ void AuraApplication::_InitFlags(Unit* caster, uint8 effMask)
if (IsSelfcast() || !caster || !caster->IsFriendlyTo(GetTarget()))
{
bool negativeFound = false;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (uint8 i = 0; i < GetBase()->GetSpellInfo()->GetEffects().size(); ++i)
{
- if (((1<<i) & effMask) && !GetBase()->GetSpellInfo()->IsPositiveEffect(i))
+ if (((1 << i) & effMask) && !GetBase()->GetSpellInfo()->IsPositiveEffect(i))
{
negativeFound = true;
break;
@@ -149,9 +149,9 @@ void AuraApplication::_InitFlags(Unit* caster, uint8 effMask)
else
{
bool positiveFound = false;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (uint8 i = 0; i < GetBase()->GetSpellInfo()->GetEffects().size(); ++i)
{
- if (((1<<i) & effMask) && GetBase()->GetSpellInfo()->IsPositiveEffect(i))
+ if (((1 << i) & effMask) && GetBase()->GetSpellInfo()->IsPositiveEffect(i))
{
positiveFound = true;
break;
@@ -279,17 +279,17 @@ uint8 Aura::BuildEffectMaskForOwner(SpellInfo const* spellProto, uint8 available
{
case TYPEID_UNIT:
case TYPEID_PLAYER:
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : spellProto->GetEffects())
{
- if (spellProto->Effects[i].IsUnitOwnedAuraEffect())
- effMask |= 1 << i;
+ if (spellEffectInfo.IsUnitOwnedAuraEffect())
+ effMask |= 1 << spellEffectInfo.EffectIndex;
}
break;
case TYPEID_DYNAMICOBJECT:
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : spellProto->GetEffects())
{
- if (spellProto->Effects[i].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA)
- effMask |= 1 << i;
+ if (spellEffectInfo.IsEffect(SPELL_EFFECT_PERSISTENT_AREA_AURA))
+ effMask |= 1 << spellEffectInfo.EffectIndex;
}
break;
default:
@@ -509,9 +509,9 @@ void Aura::SaveCasterInfo(Unit* caster)
* The only two spells in 3.3.5 with those conditions are 17484 and 50344
* which shouldn't be allowed to crit, so we're fine
*/
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : GetSpellInfo()->GetEffects())
{
- switch (GetSpellInfo()->Effects[i].ApplyAuraName)
+ switch (spellEffectInfo.ApplyAuraName)
{
case SPELL_AURA_PERIODIC_HEAL:
_casterInfo.BonusDonePct = caster->SpellHealingPctDone(GetUnitOwner(), GetSpellInfo());
@@ -1054,8 +1054,8 @@ bool Aura::ModStackAmount(int32 num, AuraRemoveMode removeMode /*= AURA_REMOVE_B
bool Aura::HasMoreThanOneEffectForType(AuraType auraType) const
{
uint32 count = 0;
- for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (HasEffect(i) && AuraType(GetSpellInfo()->Effects[i].ApplyAuraName) == auraType)
+ for (SpellEffectInfo const& spellEffectInfo : GetSpellInfo()->GetEffects())
+ if (HasEffect(spellEffectInfo.EffectIndex) && spellEffectInfo.ApplyAuraName == auraType)
++count;
return count > 1;
@@ -1063,8 +1063,8 @@ bool Aura::HasMoreThanOneEffectForType(AuraType auraType) const
bool Aura::IsArea() const
{
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (HasEffect(i) && GetSpellInfo()->Effects[i].IsAreaAuraEffect())
+ for (SpellEffectInfo const& spellEffectInfo : GetSpellInfo()->GetEffects())
+ if (HasEffect(spellEffectInfo.EffectIndex) && spellEffectInfo.IsAreaAuraEffect())
return true;
return false;
@@ -1100,12 +1100,12 @@ bool Aura::CanBeSaved() const
if (GetCasterGUID() != GetOwner()->GetGUID())
{
// owner == caster for area auras, check for possible bad data in DB
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : GetSpellInfo()->GetEffects())
{
- if (!GetSpellInfo()->Effects[i].IsEffect())
+ if (!spellEffectInfo.IsEffect())
continue;
- if (GetSpellInfo()->Effects[i].IsTargetingArea() || GetSpellInfo()->Effects[i].IsAreaAuraEffect())
+ if (spellEffectInfo.IsTargetingArea() || spellEffectInfo.IsAreaAuraEffect())
return false;
}
@@ -1867,12 +1867,17 @@ bool Aura::CanStackWith(Aura const* existingAura) const
if (IsPassive() && sameCaster && (m_spellInfo->IsDifferentRankOf(existingSpellInfo) || (m_spellInfo->Id == existingSpellInfo->Id && m_castItemGuid.IsEmpty())))
return false;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : existingSpellInfo->GetEffects())
{
// prevent remove triggering aura by triggered aura
- if (existingSpellInfo->Effects[i].TriggerSpell == GetId()
- // prevent remove triggered aura by triggering aura refresh
- || m_spellInfo->Effects[i].TriggerSpell == existingAura->GetId())
+ if (spellEffectInfo.TriggerSpell == GetId())
+ return true;
+ }
+
+ for (SpellEffectInfo const& spellEffectInfo : GetSpellInfo()->GetEffects())
+ {
+ // prevent remove triggered aura by triggering aura refresh
+ if (spellEffectInfo.TriggerSpell == existingAura->GetId())
return true;
}
@@ -2640,13 +2645,13 @@ void UnitAura::FillTargetMap(std::unordered_map<Unit*, uint8>& targets, Unit* ca
targets.emplace(target, targetPair.second);
}
- for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
+ for (SpellEffectInfo const& spellEffectInfo : GetSpellInfo()->GetEffects())
{
- if (!HasEffect(effIndex))
+ if (!HasEffect(spellEffectInfo.EffectIndex))
continue;
// area auras only
- if (GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_APPLY_AURA)
+ if (spellEffectInfo.Effect == SPELL_EFFECT_APPLY_AURA)
continue;
// skip area update if owner is not in world!
@@ -2657,12 +2662,12 @@ void UnitAura::FillTargetMap(std::unordered_map<Unit*, uint8>& targets, Unit* ca
continue;
std::vector<Unit*> units;
- ConditionContainer* condList = m_spellInfo->Effects[effIndex].ImplicitTargetConditions;
+ ConditionContainer* condList = spellEffectInfo.ImplicitTargetConditions;
- float radius = GetSpellInfo()->Effects[effIndex].CalcRadius(ref);
+ float radius = spellEffectInfo.CalcRadius(ref);
SpellTargetCheckTypes selectionType = TARGET_CHECK_DEFAULT;
- switch (GetSpellInfo()->Effects[effIndex].Effect)
+ switch (spellEffectInfo.Effect)
{
case SPELL_EFFECT_APPLY_AREA_AURA_PARTY:
selectionType = TARGET_CHECK_PARTY;
@@ -2700,17 +2705,17 @@ void UnitAura::FillTargetMap(std::unordered_map<Unit*, uint8>& targets, Unit* ca
}
for (Unit* unit : units)
- targets[unit] |= 1 << effIndex;
+ targets[unit] |= 1 << spellEffectInfo.EffectIndex;
}
}
void UnitAura::AddStaticApplication(Unit* target, uint8 effMask)
{
// only valid for non-area auras
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : GetSpellInfo()->GetEffects())
{
- if ((effMask & (1 << i)) && GetSpellInfo()->Effects[i].Effect != SPELL_EFFECT_APPLY_AURA)
- effMask &= ~(1 << i);
+ if ((effMask & (1 << spellEffectInfo.EffectIndex)) && !spellEffectInfo.IsEffect(SPELL_EFFECT_APPLY_AURA))
+ effMask &= ~(1 << spellEffectInfo.EffectIndex);
}
if (!effMask)
@@ -2743,25 +2748,25 @@ void DynObjAura::FillTargetMap(std::unordered_map<Unit*, uint8>& targets, Unit*
Unit* dynObjOwnerCaster = GetDynobjOwner()->GetCaster();
float radius = GetDynobjOwner()->GetRadius();
- for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
+ for (SpellEffectInfo const& spellEffectInfo : GetSpellInfo()->GetEffects())
{
- if (!HasEffect(effIndex))
+ if (!HasEffect(spellEffectInfo.EffectIndex))
continue;
// we can't use effect type like area auras to determine check type, check targets
- SpellTargetCheckTypes selectionType = m_spellInfo->Effects[effIndex].TargetA.GetCheckType();
- if (m_spellInfo->Effects[effIndex].TargetB.GetReferenceType() == TARGET_REFERENCE_TYPE_DEST)
- selectionType = m_spellInfo->Effects[effIndex].TargetB.GetCheckType();
+ SpellTargetCheckTypes selectionType = spellEffectInfo.TargetA.GetCheckType();
+ if (spellEffectInfo.TargetB.GetReferenceType() == TARGET_REFERENCE_TYPE_DEST)
+ selectionType = spellEffectInfo.TargetB.GetCheckType();
std::vector<Unit*> units;
- ConditionContainer* condList = m_spellInfo->Effects[effIndex].ImplicitTargetConditions;
+ ConditionContainer* condList = spellEffectInfo.ImplicitTargetConditions;
Trinity::WorldObjectSpellAreaTargetCheck check(radius, GetDynobjOwner(), dynObjOwnerCaster, dynObjOwnerCaster, m_spellInfo, selectionType, condList);
Trinity::UnitListSearcher<Trinity::WorldObjectSpellAreaTargetCheck> searcher(GetDynobjOwner(), units, check);
Cell::VisitAllObjects(GetDynobjOwner(), searcher, radius);
for (Unit* unit : units)
- targets[unit] |= 1 << effIndex;
+ targets[unit] |= 1 << spellEffectInfo.EffectIndex;
}
}
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 769489d51d2..5712f1f92c1 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -476,7 +476,7 @@ void Spell::EffectSchoolDMG()
((*i)->GetSpellInfo()->SpellIconID == 95))
{
// Mind Trauma
- int32 const chance = (*i)->GetSpellInfo()->Effects[EFFECT_1].CalcValue(unitCaster);
+ int32 const chance = (*i)->GetSpellInfo()->GetEffect(EFFECT_1).CalcValue(unitCaster);
if (roll_chance_i(chance))
unitCaster->CastSpell(unitTarget, 48301, true);
break;
@@ -540,7 +540,7 @@ void Spell::EffectSchoolDMG()
{
if ((*iter)->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_ROGUE && (*iter)->GetSpellInfo()->SpellIconID == 1960)
{
- uint32 chance = (*iter)->GetSpellInfo()->Effects[EFFECT_2].CalcValue(unitCaster);
+ uint32 chance = (*iter)->GetSpellInfo()->GetEffect(EFFECT_2).CalcValue(unitCaster);
if (chance && roll_chance_i(chance))
needConsume = false;
@@ -609,7 +609,7 @@ void Spell::EffectSchoolDMG()
/// @todo should this be put on taken but not done?
if (found)
- damage += m_spellInfo->Effects[EFFECT_1].CalcValue();
+ damage += m_spellInfo->GetEffect(EFFECT_1).CalcValue();
if (Player* caster = unitCaster->ToPlayer())
{
@@ -661,7 +661,7 @@ void Spell::EffectSchoolDMG()
{
uint8 level = unitCaster->GetLevel();
uint32 block_value = unitCaster->GetShieldBlockValue(uint32(float(level) * 29.5f), uint32(float(level) * 39.5f));
- damage += CalculatePct(block_value, m_spellInfo->Effects[EFFECT_1].CalcValue());
+ damage += CalculatePct(block_value, m_spellInfo->GetEffect(EFFECT_1).CalcValue());
break;
}
break;
@@ -1570,7 +1570,7 @@ void Spell::EffectPersistentAA()
// only handle at last effect
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)
+ if (m_spellInfo->GetEffect(SpellEffIndex(i)).IsEffect(SPELL_EFFECT_PERSISTENT_AREA_AURA))
return;
ASSERT(!_dynObjAura);
@@ -2349,7 +2349,7 @@ void Spell::EffectDispel()
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->GetCategory() == SPELLCATEGORY_DEVOUR_MAGIC)
{
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
- args.AddSpellMod(SPELLVALUE_BASE_POINT0, m_spellInfo->Effects[EFFECT_1].CalcValue());
+ args.AddSpellMod(SPELLVALUE_BASE_POINT0, m_spellInfo->GetEffect(EFFECT_1).CalcValue());
m_caster->CastSpell(m_caster, 19658, args);
// Glyph of Felhunter
if (Unit* owner = m_caster->GetOwner())
@@ -3145,7 +3145,7 @@ void Spell::EffectWeaponDmg()
// Blood Strike
if (m_spellInfo->SpellFamilyFlags[0] & 0x400000)
{
- float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(unitCaster->GetGUID()) / 2.0f;
+ float bonusPct = m_spellInfo->GetEffect(EFFECT_2).CalcValue() * unitTarget->GetDiseasesByCaster(unitCaster->GetGUID()) / 2.0f;
// Death Knight T8 Melee 4P Bonus
if (AuraEffect const* aurEff = unitCaster->GetAuraEffect(64736, EFFECT_0))
AddPct(bonusPct, aurEff->GetAmount());
@@ -3162,7 +3162,7 @@ void Spell::EffectWeaponDmg()
{
// Glyph of Death Strike
if (AuraEffect const* aurEff = unitCaster->GetAuraEffect(59336, EFFECT_0))
- if (uint32 runic = std::min<uint32>(unitCaster->GetPower(POWER_RUNIC_POWER), aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()))
+ if (uint32 runic = std::min<uint32>(unitCaster->GetPower(POWER_RUNIC_POWER), aurEff->GetSpellInfo()->GetEffect(EFFECT_1).CalcValue()))
AddPct(totalDamagePercentMod, runic);
break;
}
@@ -3176,7 +3176,7 @@ void Spell::EffectWeaponDmg()
if (roll_chance_i(aurEff->GetAmount()))
consumeDiseases = false;
- float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(unitCaster->GetGUID(), consumeDiseases) / 2.0f;
+ float bonusPct = m_spellInfo->GetEffect(EFFECT_2).CalcValue() * unitTarget->GetDiseasesByCaster(unitCaster->GetGUID(), consumeDiseases) / 2.0f;
// Death Knight T8 Melee 4P Bonus
if (AuraEffect const* aurEff = unitCaster->GetAuraEffect(64736, EFFECT_0))
AddPct(bonusPct, aurEff->GetAmount());
@@ -3192,7 +3192,7 @@ void Spell::EffectWeaponDmg()
// Heart Strike
if (m_spellInfo->SpellFamilyFlags[0] & 0x1000000)
{
- float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(unitCaster->GetGUID());
+ float bonusPct = m_spellInfo->GetEffect(EFFECT_2).CalcValue() * unitTarget->GetDiseasesByCaster(unitCaster->GetGUID());
// Death Knight T8 Melee 4P Bonus
if (AuraEffect const* aurEff = unitCaster->GetAuraEffect(64736, EFFECT_0))
AddPct(bonusPct, aurEff->GetAmount());
@@ -3250,11 +3250,11 @@ void Spell::EffectWeaponDmg()
int32 weaponDamage = unitCaster->CalculateDamage(m_attackType, normalized, addPctMods);
// Sequence is important
- for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
+ for (SpellEffectInfo const& spellEffectInfo : m_spellInfo->GetEffects())
{
// We assume that a spell have at most one fixed_bonus
// and at most one weaponDamagePercentMod
- switch (m_spellInfo->Effects[j].Effect)
+ switch (spellEffectInfo.Effect)
{
case SPELL_EFFECT_WEAPON_DAMAGE:
case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL:
@@ -3555,7 +3555,7 @@ void Spell::EffectScriptEffect()
{
/// @todo a hack, range = 11, should after some time cast, otherwise too far
unitCaster->CastSpell(parent, 62496, true);
- unitTarget->CastSpell(parent, m_spellInfo->Effects[EFFECT_0].CalcValue());
+ unitTarget->CastSpell(parent, m_spellInfo->GetEffect(EFFECT_0).CalcValue());
}
}
}
@@ -5335,7 +5335,7 @@ void Spell::SummonGuardian(SpellEffectInfo const& spellEffectInfo, uint32 entry,
summon->SetDisplayId(1126); // modelid1
}
- ExecuteLogEffectSummonObject(effectInfo->EffectIndex, summon);
+ ExecuteLogEffectSummonObject(spellEffectInfo.EffectIndex, summon);
}
}
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index ea2478971e0..abf92924757 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -2558,7 +2558,7 @@ int32 SpellInfo::GetDiminishingReturnsLimitDuration(bool triggered) const
void SpellInfo::_LoadImmunityInfo()
{
- for (SpellEffectInfo& effect : Effects)
+ for (SpellEffectInfo& effect : _GetEffects())
{
uint32 schoolImmunityMask = 0;
uint32 applyHarmfulAuraImmunityMask = 0;
@@ -3892,7 +3892,7 @@ void SpellInfo::_InitializeSpellPositivity()
void SpellInfo::_UnloadImplicitTargetConditionLists()
{
// find the same instances of ConditionList and delete them.
- for (SpellEffectInfo const& effect : Effects)
+ for (SpellEffectInfo const& effect : GetEffects())
{
ConditionContainer* cur = effect.ImplicitTargetConditions;
if (!cur)
diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h
index 6915020659d..3d662c445e2 100644
--- a/src/server/game/Spells/SpellInfo.h
+++ b/src/server/game/Spells/SpellInfo.h
@@ -547,6 +547,9 @@ class TC_GAME_API SpellInfo
void _LoadSpellDiminishInfo();
void _LoadImmunityInfo();
+ std::array<SpellEffectInfo, MAX_SPELL_EFFECTS>& _GetEffects() { return Effects; }
+ SpellEffectInfo& _GetEffect(SpellEffIndex index) { ASSERT(index < Effects.size()); return Effects[index]; }
+
// unloading helpers
void _UnloadImplicitTargetConditionLists();
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index 5b91fc61929..1a7868cdddd 100644
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -77,15 +77,15 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg
bool needCheckReagents = false;
// check effects
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
{
- switch (spellInfo->Effects[i].Effect)
+ switch (spellEffectInfo.Effect)
{
// craft spell for crafting non-existed item (break client recipes list show)
case SPELL_EFFECT_CREATE_ITEM:
case SPELL_EFFECT_CREATE_ITEM_2:
{
- if (spellInfo->Effects[i].ItemType == 0)
+ if (spellEffectInfo.ItemType == 0)
{
// skip auto-loot crafting spells, it does not need explicit item info (but has special fake items sometimes).
if (!spellInfo->IsLootCrafting())
@@ -102,14 +102,14 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg
}
// also possible IsLootCrafting case but fake items must exist anyway
- else if (!sObjectMgr->GetItemTemplate(spellInfo->Effects[i].ItemType))
+ else if (!sObjectMgr->GetItemTemplate(spellEffectInfo.ItemType))
{
if (msg)
{
if (player)
- ChatHandler(player->GetSession()).PSendSysMessage("Craft spell %u has created a non-existing item in DB (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType);
+ ChatHandler(player->GetSession()).PSendSysMessage("Craft spell %u has created a non-existing item in DB (Entry: %u) and then...", spellInfo->Id, spellEffectInfo.ItemType);
else
- TC_LOG_ERROR("sql.sql", "Craft spell %u has created a non-existing item in DB (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType);
+ TC_LOG_ERROR("sql.sql", "Craft spell %u has created a non-existing item in DB (Entry: %u) and then...", spellInfo->Id, spellEffectInfo.ItemType);
}
return false;
}
@@ -119,15 +119,15 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg
}
case SPELL_EFFECT_LEARN_SPELL:
{
- SpellInfo const* spellInfo2 = sSpellMgr->GetSpellInfo(spellInfo->Effects[i].TriggerSpell);
+ SpellInfo const* spellInfo2 = sSpellMgr->GetSpellInfo(spellEffectInfo.TriggerSpell);
if (!IsSpellValid(spellInfo2, player, msg))
{
if (msg)
{
if (player)
- ChatHandler(player->GetSession()).PSendSysMessage("Spell %u learn to broken spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell);
+ ChatHandler(player->GetSession()).PSendSysMessage("Spell %u learn to broken spell %u, and then...", spellInfo->Id, spellEffectInfo.TriggerSpell);
else
- TC_LOG_ERROR("sql.sql", "Spell %u learn to invalid spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell);
+ TC_LOG_ERROR("sql.sql", "Spell %u learn to invalid spell %u, and then...", spellInfo->Id, spellEffectInfo.TriggerSpell);
}
return false;
}
@@ -1046,14 +1046,14 @@ void SpellMgr::LoadSpellLearnSkills()
if (!entry)
continue;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : entry->GetEffects())
{
SpellLearnSkillNode dbc_node;
- switch (entry->Effects[i].Effect)
+ switch (spellEffectInfo.Effect)
{
case SPELL_EFFECT_SKILL:
- dbc_node.skill = entry->Effects[i].MiscValue;
- dbc_node.step = entry->Effects[i].CalcValue();
+ dbc_node.skill = spellEffectInfo.MiscValue;
+ dbc_node.step = spellEffectInfo.CalcValue();
if (dbc_node.skill != SKILL_RIDING)
dbc_node.value = 1;
else
@@ -1137,12 +1137,12 @@ void SpellMgr::LoadSpellLearnSpells()
if (!entry)
continue;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : entry->GetEffects())
{
- if (entry->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL)
+ if (spellEffectInfo.IsEffect(SPELL_EFFECT_LEARN_SPELL))
{
SpellLearnSpellNode dbc_node;
- dbc_node.spell = entry->Effects[i].TriggerSpell;
+ dbc_node.spell = spellEffectInfo.TriggerSpell;
dbc_node.active = true; // all dbc based learned spells is active (show in spell book or hide by client itself)
// ignore learning not existed spells (broken/outdated/or generic learnig spell 483
@@ -1152,7 +1152,7 @@ void SpellMgr::LoadSpellLearnSpells()
// talent or passive spells or skill-step spells auto-cast and not need dependent learning,
// pet teaching spells must not be dependent learning (cast)
// other required explicit dependent learning
- dbc_node.autoLearned = entry->Effects[i].TargetA.GetTarget() == TARGET_UNIT_PET || GetTalentSpellCost(spell) > 0 || entry->IsPassive() || entry->HasEffect(SPELL_EFFECT_SKILL_STEP);
+ dbc_node.autoLearned = spellEffectInfo.TargetA.GetTarget() == TARGET_UNIT_PET || GetTalentSpellCost(spell) > 0 || entry->IsPassive() || entry->HasEffect(SPELL_EFFECT_SKILL_STEP);
SpellLearnSpellMapBounds db_node_bounds = GetSpellLearnSpellMapBounds(spell);
@@ -1230,7 +1230,7 @@ void SpellMgr::LoadSpellTargetPositions()
continue;
}
- if (spellInfo->Effects[effIndex].TargetA.GetTarget() == TARGET_DEST_DB || spellInfo->Effects[effIndex].TargetB.GetTarget() == TARGET_DEST_DB)
+ if (spellInfo->GetEffect(effIndex).TargetA.GetTarget() == TARGET_DEST_DB || spellInfo->GetEffect(effIndex).TargetB.GetTarget() == TARGET_DEST_DB)
{
std::pair<uint32, SpellEffIndex> key = std::make_pair(Spell_ID, effIndex);
mSpellTargetPositions[key] = st;
@@ -1433,12 +1433,12 @@ void SpellMgr::LoadSpellGroupStackRules()
for (uint32 spellId : spellIds)
{
SpellInfo const* spellInfo = AssertSpellInfo(spellId);
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
{
- if (!spellInfo->Effects[i].IsAura())
+ if (!spellEffectInfo.IsAura())
continue;
- uint32 auraName = spellInfo->Effects[i].ApplyAuraName;
+ uint32 auraName = spellEffectInfo.ApplyAuraName;
for (std::vector<uint32> const& subGroup : SubGroups)
{
if (std::find(subGroup.begin(), subGroup.end(), auraName) != subGroup.end())
@@ -1626,18 +1626,18 @@ void SpellMgr::LoadSpellProcs()
TC_LOG_ERROR("sql.sql", "The `spell_proc` table entry for spellId %u has wrong `HitMask` set: %u", spellInfo->Id, procEntry.HitMask);
if (procEntry.HitMask && !(procEntry.ProcFlags & TAKEN_HIT_PROC_FLAG_MASK || (procEntry.ProcFlags & DONE_HIT_PROC_FLAG_MASK && (!procEntry.SpellPhaseMask || procEntry.SpellPhaseMask & (PROC_SPELL_PHASE_HIT | PROC_SPELL_PHASE_FINISH)))))
TC_LOG_ERROR("sql.sql", "The `spell_proc` table entry for spellId %u has `HitMask` value defined, but it will not be used for defined `ProcFlags` and `SpellPhaseMask` values.", spellInfo->Id);
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if ((procEntry.DisableEffectsMask & (1u << i)) && !spellInfo->Effects[i].IsAura())
- TC_LOG_ERROR("sql.sql", "The `spell_proc` table entry for spellId %u has DisableEffectsMask with effect %u, but effect %u is not an aura effect", spellInfo->Id, static_cast<uint32>(i), static_cast<uint32>(i));
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
+ if ((procEntry.DisableEffectsMask & (1u << spellEffectInfo.EffectIndex)) && !spellEffectInfo.IsAura())
+ TC_LOG_ERROR("sql.sql", "The `spell_proc` table entry for spellId %u has DisableEffectsMask with effect %u, but effect %u is not an aura effect", spellInfo->Id, static_cast<uint32>(spellEffectInfo.EffectIndex), static_cast<uint32>(spellEffectInfo.EffectIndex));
if (procEntry.AttributesMask & PROC_ATTR_REQ_SPELLMOD)
{
bool found = false;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
{
- if (!spellInfo->Effects[i].IsAura())
+ if (!spellEffectInfo.IsAura())
continue;
- if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_ADD_PCT_MODIFIER || spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_ADD_FLAT_MODIFIER)
+ if (spellEffectInfo.ApplyAuraName == SPELL_AURA_ADD_PCT_MODIFIER || spellEffectInfo.ApplyAuraName == SPELL_AURA_ADD_FLAT_MODIFIER)
{
found = true;
break;
@@ -1762,19 +1762,19 @@ void SpellMgr::LoadSpellProcs()
bool addTriggerFlag = false;
uint32 procSpellTypeMask = PROC_SPELL_TYPE_NONE;
uint32 nonProcMask = 0;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
{
- if (!spellInfo->Effects[i].IsEffect())
+ if (!spellEffectInfo.IsEffect())
continue;
- uint32 auraName = spellInfo->Effects[i].ApplyAuraName;
+ uint32 auraName = spellEffectInfo.ApplyAuraName;
if (!auraName)
continue;
if (!isTriggerAura[auraName])
{
// explicitly disable non proccing auras to avoid losing charges on self proc
- nonProcMask |= 1 << i;
+ nonProcMask |= 1 << spellEffectInfo.EffectIndex;
continue;
}
@@ -1800,9 +1800,9 @@ void SpellMgr::LoadSpellProcs()
if (!procSpellTypeMask)
{
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
{
- if (spellInfo->Effects[i].IsAura())
+ if (spellEffectInfo.IsAura())
{
TC_LOG_ERROR("sql.sql", "Spell Id %u has DBC ProcFlags %u, but it's of non-proc aura type, it probably needs an entry in `spell_proc` table to be handled correctly.", spellInfo->Id, spellInfo->ProcFlags);
break;
@@ -1816,9 +1816,9 @@ void SpellMgr::LoadSpellProcs()
procEntry.SchoolMask = 0;
procEntry.ProcFlags = spellInfo->ProcFlags;
procEntry.SpellFamilyName = 0;
- for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (spellInfo->Effects[i].IsEffect() && isTriggerAura[spellInfo->Effects[i].ApplyAuraName])
- procEntry.SpellFamilyMask |= spellInfo->Effects[i].SpellClassMask;
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
+ if (spellEffectInfo.IsEffect() && isTriggerAura[spellEffectInfo.ApplyAuraName])
+ procEntry.SpellFamilyMask |= spellEffectInfo.SpellClassMask;
if (procEntry.SpellFamilyMask)
procEntry.SpellFamilyName = spellInfo->SpellFamilyName;
@@ -1827,12 +1827,12 @@ void SpellMgr::LoadSpellProcs()
procEntry.SpellPhaseMask = PROC_SPELL_PHASE_HIT;
procEntry.HitMask = PROC_HIT_NONE; // uses default proc @see SpellMgr::CanSpellTriggerProcOnEvent
- for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
{
- if (!spellInfo->Effects[i].IsAura())
+ if (!spellEffectInfo.IsAura())
continue;
- switch (spellInfo->Effects[i].ApplyAuraName)
+ switch (spellEffectInfo.ApplyAuraName)
{
// Reflect auras should only proc off reflects
case SPELL_AURA_REFLECT_SPELLS:
@@ -1849,7 +1849,7 @@ void SpellMgr::LoadSpellProcs()
break;
// proc auras with another aura reducing hit chance (eg 63767) only proc on missed attack
case SPELL_AURA_MOD_HIT_CHANCE:
- if (spellInfo->Effects[i].CalcValue() <= -100)
+ if (spellEffectInfo.CalcValue() <= -100)
procEntry.HitMask = PROC_HIT_MISS;
break;
default:
@@ -1996,11 +1996,11 @@ void SpellMgr::LoadSpellPetAuras()
Field* fields = result->Fetch();
uint32 spell = fields[0].GetUInt32();
- uint8 eff = fields[1].GetUInt8();
+ SpellEffIndex eff = SpellEffIndex(fields[1].GetUInt8());
uint32 pet = fields[2].GetUInt32();
uint32 aura = fields[3].GetUInt32();
- SpellPetAuraMap::iterator itr = mSpellPetAuraMap.find((spell<<8) + eff);
+ SpellPetAuraMap::iterator itr = mSpellPetAuraMap.find((spell << 8) + eff);
if (itr != mSpellPetAuraMap.end())
itr->second.AddAura(pet, aura);
else
@@ -2011,9 +2011,9 @@ void SpellMgr::LoadSpellPetAuras()
TC_LOG_ERROR("sql.sql", "The spell %u listed in `spell_pet_auras` does not exist.", spell);
continue;
}
- if (spellInfo->Effects[eff].Effect != SPELL_EFFECT_DUMMY &&
- (spellInfo->Effects[eff].Effect != SPELL_EFFECT_APPLY_AURA ||
- spellInfo->Effects[eff].ApplyAuraName != SPELL_AURA_DUMMY))
+ if (spellInfo->GetEffect(eff).Effect != SPELL_EFFECT_DUMMY &&
+ (spellInfo->GetEffect(eff).Effect != SPELL_EFFECT_APPLY_AURA ||
+ spellInfo->GetEffect(eff).ApplyAuraName != SPELL_AURA_DUMMY))
{
TC_LOG_ERROR("spells", "The spell %u listed in `spell_pet_auras` does not have any dummy aura or dummy effect.", spell);
continue;
@@ -2026,7 +2026,7 @@ void SpellMgr::LoadSpellPetAuras()
continue;
}
- PetAura pa(pet, aura, spellInfo->Effects[eff].TargetA.GetTarget() == TARGET_UNIT_PET, spellInfo->Effects[eff].CalcValue());
+ PetAura pa(pet, aura, spellInfo->GetEffect(eff).TargetA.GetTarget() == TARGET_UNIT_PET, spellInfo->GetEffect(eff).CalcValue());
mSpellPetAuraMap[(spell<<8) + eff] = pa;
}
@@ -2058,11 +2058,11 @@ void SpellMgr::LoadEnchantCustomAttr()
if (!spellInfo->HasAttribute(SPELL_ATTR2_PRESERVE_ENCHANT_IN_ARENA) || !spellInfo->HasAttribute(SPELL_ATTR0_NOT_SHAPESHIFT))
continue;
- for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
{
- if (spellInfo->Effects[j].Effect == SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY)
+ if (spellEffectInfo.Effect == SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY)
{
- uint32 enchId = spellInfo->Effects[j].MiscValue;
+ uint32 enchId = spellEffectInfo.MiscValue;
SpellItemEnchantmentEntry const* ench = sSpellItemEnchantmentStore.LookupEntry(enchId);
if (!ench)
continue;
@@ -2149,10 +2149,10 @@ void SpellMgr::LoadSpellLinked()
}
if (effect >= 0)
- for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
{
- if (spellInfo->Effects[j].CalcValue() == abs(effect))
- TC_LOG_ERROR("sql.sql", "The spell %u Effect: %u listed in `spell_linked_spell` has same bp%u like effect (possible hack).", abs(trigger), abs(effect), j);
+ if (spellEffectInfo.CalcValue() == abs(effect))
+ TC_LOG_ERROR("sql.sql", "The spell %u Effect: %u listed in `spell_linked_spell` has same bp%u like effect (possible hack).", abs(trigger), abs(effect), uint32(spellEffectInfo.EffectIndex));
}
spellInfo = GetSpellInfo(abs(effect));
@@ -2325,11 +2325,11 @@ void SpellMgr::LoadPetDefaultSpells()
if (!spellEntry)
continue;
- for (uint8 k = 0; k < MAX_SPELL_EFFECTS; ++k)
+ for (SpellEffectInfo const& spellEffectInfo : spellEntry->GetEffects())
{
- if (spellEntry->Effects[k].Effect == SPELL_EFFECT_SUMMON || spellEntry->Effects[k].Effect == SPELL_EFFECT_SUMMON_PET)
+ if (spellEffectInfo.IsEffect(SPELL_EFFECT_SUMMON) || spellEffectInfo.IsEffect(SPELL_EFFECT_SUMMON_PET))
{
- uint32 creature_id = spellEntry->Effects[k].MiscValue;
+ uint32 creature_id = spellEffectInfo.MiscValue;
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creature_id);
if (!cInfo)
continue;
@@ -2572,13 +2572,13 @@ void SpellMgr::LoadSpellInfoStore()
if (!mSpellInfoMap[spellIndex])
continue;
- for (auto const& effect : mSpellInfoMap[spellIndex]->Effects)
+ for (SpellEffectInfo const& spellEffectInfo : mSpellInfoMap[spellIndex]->GetEffects())
{
//ASSERT(effect.EffectIndex < MAX_SPELL_EFFECTS, "MAX_SPELL_EFFECTS must be at least %u", effect.EffectIndex + 1);
- ASSERT(effect.Effect < TOTAL_SPELL_EFFECTS, "TOTAL_SPELL_EFFECTS must be at least %u", effect.Effect + 1);
- ASSERT(effect.ApplyAuraName < TOTAL_AURAS, "TOTAL_AURAS must be at least %u", effect.ApplyAuraName + 1);
- ASSERT(effect.TargetA.GetTarget() < TOTAL_SPELL_TARGETS, "TOTAL_SPELL_TARGETS must be at least %u", effect.TargetA.GetTarget() + 1);
- ASSERT(effect.TargetB.GetTarget() < TOTAL_SPELL_TARGETS, "TOTAL_SPELL_TARGETS must be at least %u", effect.TargetB.GetTarget() + 1);
+ ASSERT(spellEffectInfo.Effect < TOTAL_SPELL_EFFECTS, "TOTAL_SPELL_EFFECTS must be at least %u", spellEffectInfo.Effect + 1);
+ ASSERT(spellEffectInfo.ApplyAuraName < TOTAL_AURAS, "TOTAL_AURAS must be at least %u", spellEffectInfo.ApplyAuraName + 1);
+ ASSERT(spellEffectInfo.TargetA.GetTarget() < TOTAL_SPELL_TARGETS, "TOTAL_SPELL_TARGETS must be at least %u", spellEffectInfo.TargetA.GetTarget() + 1);
+ ASSERT(spellEffectInfo.TargetB.GetTarget() < TOTAL_SPELL_TARGETS, "TOTAL_SPELL_TARGETS must be at least %u", spellEffectInfo.TargetB.GetTarget() + 1);
}
}
@@ -2628,14 +2628,14 @@ void SpellMgr::LoadSpellInfoCustomAttributes()
if ((attributes & SPELL_ATTR0_CU_NEGATIVE) != 0)
{
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
{
- if (spellInfo->Effects[i].IsEffect())
+ if (spellEffectInfo.IsEffect())
continue;
- if ((attributes & (SPELL_ATTR0_CU_NEGATIVE_EFF0 << i)) != 0)
+ if ((attributes & (SPELL_ATTR0_CU_NEGATIVE_EFF0 << spellEffectInfo.EffectIndex)) != 0)
{
- TC_LOG_ERROR("sql.sql", "Table `spell_custom_attr` has attribute SPELL_ATTR0_CU_NEGATIVE_EFF%u for spell %u with no EFFECT_%u", uint32(i), spellId, uint32(i));
+ TC_LOG_ERROR("sql.sql", "Table `spell_custom_attr` has attribute SPELL_ATTR0_CU_NEGATIVE_EFF%u for spell %u with no EFFECT_%u", uint32(spellEffectInfo.EffectIndex), spellId, uint32(spellEffectInfo.EffectIndex));
continue;
}
}
@@ -2653,13 +2653,13 @@ void SpellMgr::LoadSpellInfoCustomAttributes()
if (!spellInfo)
continue;
- for (SpellEffectInfo const& effect : spellInfo->GetEffects())
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
{
// all bleed effects and spells ignore armor
- if (spellInfo->GetEffectMechanicMask(effect.EffectIndex) & (1 << MECHANIC_BLEED))
+ if (spellInfo->GetEffectMechanicMask(spellEffectInfo.EffectIndex) & (1 << MECHANIC_BLEED))
spellInfo->AttributesCu |= SPELL_ATTR0_CU_IGNORE_ARMOR;
- switch (effect.ApplyAuraName)
+ switch (spellEffectInfo.ApplyAuraName)
{
case SPELL_AURA_MOD_POSSESS:
case SPELL_AURA_MOD_CONFUSE:
@@ -2673,7 +2673,7 @@ void SpellMgr::LoadSpellInfoCustomAttributes()
break;
}
- switch (effect.Effect)
+ switch (spellEffectInfo.Effect)
{
case SPELL_EFFECT_SCHOOL_DAMAGE:
case SPELL_EFFECT_HEALTH_LEECH:
@@ -2691,7 +2691,7 @@ void SpellMgr::LoadSpellInfoCustomAttributes()
break;
}
- switch (effect.Effect)
+ switch (spellEffectInfo.Effect)
{
case SPELL_EFFECT_SCHOOL_DAMAGE:
case SPELL_EFFECT_WEAPON_DAMAGE:
@@ -2729,7 +2729,7 @@ void SpellMgr::LoadSpellInfoCustomAttributes()
// only enchanting profession enchantments procs can stack
if (IsPartOfSkillLine(SKILL_ENCHANTING, spellInfo->Id))
{
- uint32 enchantId = effect.MiscValue;
+ uint32 enchantId = spellEffectInfo.MiscValue;
SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId);
if (!enchant)
break;
@@ -2763,11 +2763,11 @@ void SpellMgr::LoadSpellInfoCustomAttributes()
if (!spellInfo->HasAttribute(SPELL_ATTR3_IGNORE_HIT_RESULT))
{
bool setFlag = false;
- for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
{
- if (spellInfo->Effects[j].IsEffect())
+ if (spellEffectInfo.IsEffect())
{
- switch (spellInfo->Effects[j].Effect)
+ switch (spellEffectInfo.Effect)
{
case SPELL_EFFECT_SCHOOL_DAMAGE:
case SPELL_EFFECT_WEAPON_DAMAGE:
@@ -2786,19 +2786,19 @@ void SpellMgr::LoadSpellInfoCustomAttributes()
case SPELL_EFFECT_APPLY_AREA_AURA_PET:
case SPELL_EFFECT_APPLY_AREA_AURA_OWNER:
{
- if (spellInfo->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE ||
- spellInfo->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE_PERCENT ||
- spellInfo->Effects[j].ApplyAuraName == SPELL_AURA_DUMMY ||
- spellInfo->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH ||
- spellInfo->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_HEALTH_FUNNEL ||
- spellInfo->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_DUMMY)
+ if (spellEffectInfo.ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE ||
+ spellEffectInfo.ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE_PERCENT ||
+ spellEffectInfo.ApplyAuraName == SPELL_AURA_DUMMY ||
+ spellEffectInfo.ApplyAuraName == SPELL_AURA_PERIODIC_LEECH ||
+ spellEffectInfo.ApplyAuraName == SPELL_AURA_PERIODIC_HEALTH_FUNNEL ||
+ spellEffectInfo.ApplyAuraName == SPELL_AURA_PERIODIC_DUMMY)
break;
[[fallthrough]];
}
default:
{
// No value and not interrupt cast or crowd control without SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY flag
- if (!spellInfo->Effects[j].CalcValue() && !((spellInfo->Effects[j].Effect == SPELL_EFFECT_INTERRUPT_CAST || spellInfo->HasAttribute(SPELL_ATTR0_CU_AURA_CC)) && !spellInfo->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY)))
+ if (!spellEffectInfo.CalcValue() && !((spellEffectInfo.Effect == SPELL_EFFECT_INTERRUPT_CAST || spellInfo->HasAttribute(SPELL_ATTR0_CU_AURA_CC)) && !spellInfo->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY)))
break;
// Sindragosa Frost Breath
@@ -2885,16 +2885,16 @@ void SpellMgr::LoadSpellInfoCustomAttributes()
bool allNonBinary = true;
bool overrideAttr = false;
- for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
{
- if (spellInfo->Effects[j].IsAura() && spellInfo->Effects[j].TriggerSpell)
+ if (spellEffectInfo.IsAura() && spellEffectInfo.TriggerSpell)
{
- switch (spellInfo->Effects[j].ApplyAuraName)
+ switch (spellEffectInfo.ApplyAuraName)
{
case SPELL_AURA_PERIODIC_TRIGGER_SPELL:
case SPELL_AURA_PERIODIC_TRIGGER_SPELL_FROM_CLIENT:
case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE:
- if (SpellInfo const* triggerSpell = sSpellMgr->GetSpellInfo(spellInfo->Effects[j].TriggerSpell))
+ if (SpellInfo const* triggerSpell = sSpellMgr->GetSpellInfo(spellEffectInfo.TriggerSpell))
{
overrideAttr = true;
if (triggerSpell->HasAttribute(SPELL_ATTR0_CU_BINARY_SPELL))
@@ -2923,14 +2923,14 @@ void SpellMgr::LoadSpellInfoCustomAttributes()
else if (spellInfo->HasAttribute(SPELL_ATTR4_INHERIT_CRIT_FROM_AURA))
{
bool found = false;
- for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
{
- switch (spellInfo->Effects[j].ApplyAuraName)
+ switch (spellEffectInfo.ApplyAuraName)
{
case SPELL_AURA_PERIODIC_TRIGGER_SPELL:
case SPELL_AURA_PERIODIC_TRIGGER_SPELL_FROM_CLIENT:
case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE:
- if (SpellInfo* triggerSpell = const_cast<SpellInfo*>(sSpellMgr->GetSpellInfo(spellInfo->Effects[j].TriggerSpell)))
+ if (SpellInfo* triggerSpell = const_cast<SpellInfo*>(sSpellMgr->GetSpellInfo(spellEffectInfo.TriggerSpell)))
if (triggerSpell->HasAttribute(SPELL_ATTR0_CU_CAN_CRIT))
found = true;
break;
@@ -2992,7 +2992,7 @@ void SpellMgr::LoadSpellInfoCorrections()
65755
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].Amplitude = 1 * IN_MILLISECONDS;
+ spellInfo->_GetEffect(EFFECT_0).Amplitude = 1 * IN_MILLISECONDS;
});
ApplySpellFix({
@@ -3003,27 +3003,27 @@ void SpellMgr::LoadSpellInfoCorrections()
}, [](SpellInfo* spellInfo)
{
// first effect has correct amplitude
- spellInfo->Effects[EFFECT_1].Amplitude = spellInfo->Effects[EFFECT_0].Amplitude;
+ spellInfo->_GetEffect(EFFECT_1).Amplitude = spellInfo->GetEffect(EFFECT_0).Amplitude;
});
// Vomit
ApplySpellFix({ 43327 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_1].Amplitude = 1 * IN_MILLISECONDS;
+ spellInfo->_GetEffect(EFFECT_1).Amplitude = 1 * IN_MILLISECONDS;
});
// Strider Presence
ApplySpellFix({ 4312 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].Amplitude = 1 * IN_MILLISECONDS;
- spellInfo->Effects[EFFECT_1].Amplitude = 1 * IN_MILLISECONDS;
+ spellInfo->_GetEffect(EFFECT_0).Amplitude = 1 * IN_MILLISECONDS;
+ spellInfo->_GetEffect(EFFECT_1).Amplitude = 1 * IN_MILLISECONDS;
});
// Food
ApplySpellFix({ 64345 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].Amplitude = 1 * IN_MILLISECONDS;
- spellInfo->Effects[EFFECT_2].Amplitude = 1 * IN_MILLISECONDS;
+ spellInfo->_GetEffect(EFFECT_0).Amplitude = 1 * IN_MILLISECONDS;
+ spellInfo->_GetEffect(EFFECT_2).Amplitude = 1 * IN_MILLISECONDS;
});
}
@@ -3032,43 +3032,43 @@ void SpellMgr::LoadSpellInfoCorrections()
// Brood Affliction: Bronze
ApplySpellFix({ 23170 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TriggerSpell = 23171;
+ spellInfo->_GetEffect(EFFECT_0).TriggerSpell = 23171;
});
// Feed Captured Animal
ApplySpellFix({ 29917 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TriggerSpell = 29916;
+ spellInfo->_GetEffect(EFFECT_0).TriggerSpell = 29916;
});
// Remote Toy
ApplySpellFix({ 37027 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TriggerSpell = 37029;
+ spellInfo->_GetEffect(EFFECT_0).TriggerSpell = 37029;
});
// Eye of Grillok
ApplySpellFix({ 38495 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TriggerSpell = 38530;
+ spellInfo->_GetEffect(EFFECT_0).TriggerSpell = 38530;
});
// Tear of Azzinoth Summon Channel - it's not really supposed to do anything, and this only prevents the console spam
ApplySpellFix({ 39857 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TriggerSpell = 39856;
+ spellInfo->_GetEffect(EFFECT_0).TriggerSpell = 39856;
});
// Personalized Weather
ApplySpellFix({ 46736 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_1].TriggerSpell = 46737;
+ spellInfo->_GetEffect(EFFECT_1).TriggerSpell = 46737;
});
// Lich Pet
ApplySpellFix({ 70050 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TriggerSpell = 70049;
+ spellInfo->_GetEffect(EFFECT_0).TriggerSpell = 70049;
});
}
@@ -3103,7 +3103,7 @@ void SpellMgr::LoadSpellInfoCorrections()
63137 // Force Cast (HACK: Target shouldn't be changed; summon position should be untied from spell destination)
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[0].TargetA = SpellImplicitTargetInfo(TARGET_DEST_DB);
+ spellInfo->_GetEffect(EFFECT_0).TargetA = SpellImplicitTargetInfo(TARGET_DEST_DB);
});
// Immolate
@@ -3122,7 +3122,7 @@ void SpellMgr::LoadSpellInfoCorrections()
}, [](SpellInfo* spellInfo)
{
// copy SP scaling data from direct damage to DoT
- spellInfo->Effects[EFFECT_0].BonusMultiplier = spellInfo->Effects[EFFECT_1].BonusMultiplier;
+ spellInfo->_GetEffect(EFFECT_0).BonusMultiplier = spellInfo->GetEffect(EFFECT_1).BonusMultiplier;
});
// Detect Undead
@@ -3136,13 +3136,13 @@ void SpellMgr::LoadSpellInfoCorrections()
// Drink! (Brewfest)
ApplySpellFix({ 42436 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_TARGET_ANY);
+ spellInfo->_GetEffect(EFFECT_0).TargetA = SpellImplicitTargetInfo(TARGET_UNIT_TARGET_ANY);
});
// Summon Skeletons
ApplySpellFix({ 52611, 52612 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].MiscValueB = 64;
+ spellInfo->_GetEffect(EFFECT_0).MiscValueB = 64;
});
// Battlegear of Eternal Justice
@@ -3162,7 +3162,7 @@ void SpellMgr::LoadSpellInfoCorrections()
42835 // Spout, remove damage effect, only anim is needed
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].Effect = SPELL_EFFECT_NONE;
+ spellInfo->_GetEffect(EFFECT_0).Effect = SPELL_EFFECT_NONE;
});
ApplySpellFix({
@@ -3176,8 +3176,8 @@ void SpellMgr::LoadSpellInfoCorrections()
3137 // Abolish Poison Effect
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
- spellInfo->Effects[EFFECT_0].TargetB = SpellImplicitTargetInfo();
+ spellInfo->_GetEffect(EFFECT_0).TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
+ spellInfo->_GetEffect(EFFECT_0).TargetB = SpellImplicitTargetInfo();
});
ApplySpellFix({
@@ -3201,7 +3201,7 @@ void SpellMgr::LoadSpellInfoCorrections()
// Howl of Azgalor
ApplySpellFix({ 31344 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_100_YARDS); // 100yards instead of 50000?!
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_100_YARDS); // 100yards instead of 50000?!
});
ApplySpellFix({
@@ -3215,7 +3215,7 @@ void SpellMgr::LoadSpellInfoCorrections()
// They Must Burn Bomb Aura (self)
ApplySpellFix({ 36350 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TriggerSpell = 36325; // They Must Burn Bomb Drop (DND)
+ spellInfo->_GetEffect(EFFECT_0).TriggerSpell = 36325; // They Must Burn Bomb Drop (DND)
});
ApplySpellFix({
@@ -3225,7 +3225,7 @@ void SpellMgr::LoadSpellInfoCorrections()
56251 // Energize Cores
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_SRC_AREA_ENTRY);
+ spellInfo->_GetEffect(EFFECT_0).TargetA = SpellImplicitTargetInfo(TARGET_UNIT_SRC_AREA_ENTRY);
});
ApplySpellFix({
@@ -3233,7 +3233,7 @@ void SpellMgr::LoadSpellInfoCorrections()
59372 // Energize Cores
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_SRC_AREA_ENEMY);
+ spellInfo->_GetEffect(EFFECT_0).TargetA = SpellImplicitTargetInfo(TARGET_UNIT_SRC_AREA_ENEMY);
});
// Mana Shield (rank 2)
@@ -3285,7 +3285,7 @@ void SpellMgr::LoadSpellInfoCorrections()
52915 // Turn the Tables
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
+ spellInfo->_GetEffect(EFFECT_0).TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
});
// Magic Absorption
@@ -3318,8 +3318,8 @@ void SpellMgr::LoadSpellInfoCorrections()
ApplySpellFix({ 59725 }, [](SpellInfo* spellInfo)
{
// Target entry seems to be wrong for this spell :/
- spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER_AREA_PARTY);
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_20_YARDS);
+ spellInfo->_GetEffect(EFFECT_0).TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER_AREA_PARTY);
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_20_YARDS);
});
ApplySpellFix({
@@ -3459,8 +3459,8 @@ void SpellMgr::LoadSpellInfoCorrections()
// First two effects apply auras, which shouldn't be there
// due to NO_TARGET applying aura on current caster (core bug)
// Just wipe effect data, to mimic blizz-behavior
- spellInfo->Effects[EFFECT_0].Effect = SPELL_EFFECT_NONE;
- spellInfo->Effects[EFFECT_1].Effect = SPELL_EFFECT_NONE;
+ spellInfo->_GetEffect(EFFECT_0).Effect = SPELL_EFFECT_NONE;
+ spellInfo->_GetEffect(EFFECT_1).Effect = SPELL_EFFECT_NONE;
});
// Lock and Load (Rank 1)
@@ -3468,30 +3468,30 @@ void SpellMgr::LoadSpellInfoCorrections()
{
// @workaround: Delete dummy effect from rank 1
// effect apply aura has NO_TARGET but core still applies it to caster (same as above)
- spellInfo->Effects[EFFECT_2].Effect = SPELL_EFFECT_NONE;
+ spellInfo->_GetEffect(EFFECT_2).Effect = SPELL_EFFECT_NONE;
});
// Roar of Sacrifice
ApplySpellFix({ 53480 }, [](SpellInfo* spellInfo)
{
// missing spell effect 2 data, taken from 4.3.4
- spellInfo->Effects[EFFECT_1].Effect = SPELL_EFFECT_APPLY_AURA;
- spellInfo->Effects[EFFECT_1].ApplyAuraName = SPELL_AURA_DUMMY;
- spellInfo->Effects[EFFECT_1].MiscValue = 127;
- spellInfo->Effects[EFFECT_1].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_TARGET_ALLY);
+ spellInfo->_GetEffect(EFFECT_1).Effect = SPELL_EFFECT_APPLY_AURA;
+ spellInfo->_GetEffect(EFFECT_1).ApplyAuraName = SPELL_AURA_DUMMY;
+ spellInfo->_GetEffect(EFFECT_1).MiscValue = 127;
+ spellInfo->_GetEffect(EFFECT_1).TargetA = SpellImplicitTargetInfo(TARGET_UNIT_TARGET_ALLY);
});
// Murmur's Touch
ApplySpellFix({ 33711, 38794 }, [](SpellInfo* spellInfo)
{
spellInfo->MaxAffectedTargets = 1;
- spellInfo->Effects[EFFECT_0].TriggerSpell = 33760;
+ spellInfo->_GetEffect(EFFECT_0).TriggerSpell = 33760;
});
// Fingers of Frost
ApplySpellFix({ 44544 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].SpellClassMask = flag96(685904631, 1151048, 0);
+ spellInfo->_GetEffect(EFFECT_0).SpellClassMask = flag96(685904631, 1151048, 0);
});
// Magic Suppression - DK
@@ -3516,7 +3516,7 @@ void SpellMgr::LoadSpellInfoCorrections()
ApplySpellFix({ 47201, 47202, 47203, 47204, 47205 }, [](SpellInfo* spellInfo)
{
// add corruption to affected spells
- spellInfo->Effects[EFFECT_1].SpellClassMask[0] |= 2;
+ spellInfo->_GetEffect(EFFECT_1).SpellClassMask[0] |= 2;
});
// Renewed Hope
@@ -3526,19 +3526,19 @@ void SpellMgr::LoadSpellInfoCorrections()
}, [](SpellInfo* spellInfo)
{
// should also affect Flash Heal
- spellInfo->Effects[EFFECT_0].SpellClassMask[0] |= 0x800;
+ spellInfo->_GetEffect(EFFECT_0).SpellClassMask[0] |= 0x800;
});
// Crafty's Ultra-Advanced Proto-Typical Shortening Blaster
ApplySpellFix({ 51912 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].Amplitude = 3000;
+ spellInfo->_GetEffect(EFFECT_0).Amplitude = 3000;
});
// Desecration Arm - 36 instead of 37 - typo? :/
ApplySpellFix({ 29809 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_7_YARDS);
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_7_YARDS);
});
// In sniff caster hits multiple targets
@@ -3548,7 +3548,7 @@ void SpellMgr::LoadSpellInfoCorrections()
73836 // [DND] Test Roar
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50_YARDS); // 50yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50_YARDS); // 50yd
});
// In sniff caster hits multiple targets
@@ -3557,7 +3557,7 @@ void SpellMgr::LoadSpellInfoCorrections()
73886 // [DND] Test Stop Dance
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_150_YARDS); // 150yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_150_YARDS); // 150yd
});
// Master Shapeshifter: missing stance data for forms other than bear - bear version has correct data
@@ -3583,10 +3583,10 @@ void SpellMgr::LoadSpellInfoCorrections()
51470 // (Rank 2)
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_1].Effect = SPELL_EFFECT_APPLY_AURA;
- spellInfo->Effects[EFFECT_1].ApplyAuraName = SPELL_AURA_ADD_FLAT_MODIFIER;
- spellInfo->Effects[EFFECT_1].MiscValue = SPELLMOD_EFFECT2;
- spellInfo->Effects[EFFECT_1].SpellClassMask = flag96(0x00000000, 0x00004000, 0x00000000);
+ spellInfo->_GetEffect(EFFECT_1).Effect = SPELL_EFFECT_APPLY_AURA;
+ spellInfo->_GetEffect(EFFECT_1).ApplyAuraName = SPELL_AURA_ADD_FLAT_MODIFIER;
+ spellInfo->_GetEffect(EFFECT_1).MiscValue = SPELLMOD_EFFECT2;
+ spellInfo->_GetEffect(EFFECT_1).SpellClassMask = flag96(0x00000000, 0x00004000, 0x00000000);
});
// Improved Shadowform (Rank 1)
@@ -3599,19 +3599,19 @@ void SpellMgr::LoadSpellInfoCorrections()
// Hymn of Hope
ApplySpellFix({ 64904 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_1].ApplyAuraName = SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT;
+ spellInfo->_GetEffect(EFFECT_1).ApplyAuraName = SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT;
});
// Improved Stings (Rank 2)
ApplySpellFix({ 19465 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_2].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
+ spellInfo->_GetEffect(EFFECT_2).TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
});
// Nether Portal - Perseverence
ApplySpellFix({ 30421 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_2].BasePoints += 30000;
+ spellInfo->_GetEffect(EFFECT_2).BasePoints += 30000;
});
// Natural shapeshifter
@@ -3631,14 +3631,14 @@ void SpellMgr::LoadSpellInfoCorrections()
{
spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS;
spellInfo->SpellFamilyFlags[2] = 0x10;
- spellInfo->Effects[EFFECT_1].ApplyAuraName = SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN;
+ spellInfo->_GetEffect(EFFECT_1).ApplyAuraName = SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN;
});
// Parasitic Shadowfiend Passive
ApplySpellFix({ 41913 }, [](SpellInfo* spellInfo)
{
// proc debuff, and summon infinite fiends
- spellInfo->Effects[EFFECT_0].ApplyAuraName = SPELL_AURA_DUMMY;
+ spellInfo->_GetEffect(EFFECT_0).ApplyAuraName = SPELL_AURA_DUMMY;
});
ApplySpellFix({
@@ -3674,16 +3674,16 @@ void SpellMgr::LoadSpellInfoCorrections()
{
// target allys instead of enemies, target A is src_caster, spells with effect like that have ally target
// this is the only known exception, probably just wrong data
- spellInfo->Effects[EFFECT_0].TargetB = SpellImplicitTargetInfo(TARGET_UNIT_SRC_AREA_ALLY);
- spellInfo->Effects[EFFECT_1].TargetB = SpellImplicitTargetInfo(TARGET_UNIT_SRC_AREA_ALLY);
+ spellInfo->_GetEffect(EFFECT_0).TargetB = SpellImplicitTargetInfo(TARGET_UNIT_SRC_AREA_ALLY);
+ spellInfo->_GetEffect(EFFECT_1).TargetB = SpellImplicitTargetInfo(TARGET_UNIT_SRC_AREA_ALLY);
});
// Wind Shear
ApplySpellFix({ 57994 }, [](SpellInfo* spellInfo)
{
// improper data for EFFECT_1 in 3.3.5 DBC, but is correct in 4.x
- spellInfo->Effects[EFFECT_1].Effect = SPELL_EFFECT_MODIFY_THREAT_PERCENT;
- spellInfo->Effects[EFFECT_1].BasePoints = -6; // -5%
+ spellInfo->_GetEffect(EFFECT_1).Effect = SPELL_EFFECT_MODIFY_THREAT_PERCENT;
+ spellInfo->_GetEffect(EFFECT_1).BasePoints = -6; // -5%
});
ApplySpellFix({
@@ -3740,10 +3740,10 @@ void SpellMgr::LoadSpellInfoCorrections()
58655 // rank 8
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
- spellInfo->Effects[EFFECT_1].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
- spellInfo->Effects[EFFECT_0].TargetB = SpellImplicitTargetInfo();
- spellInfo->Effects[EFFECT_1].TargetB = SpellImplicitTargetInfo();
+ spellInfo->_GetEffect(EFFECT_0).TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
+ spellInfo->_GetEffect(EFFECT_1).TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
+ spellInfo->_GetEffect(EFFECT_0).TargetB = SpellImplicitTargetInfo();
+ spellInfo->_GetEffect(EFFECT_1).TargetB = SpellImplicitTargetInfo();
});
// Marked for Death
@@ -3755,7 +3755,7 @@ void SpellMgr::LoadSpellInfoCorrections()
53246 // (Rank 5)
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].SpellClassMask = flag96(0x00067801, 0x10820001, 0x00000801);
+ spellInfo->_GetEffect(EFFECT_0).SpellClassMask = flag96(0x00067801, 0x10820001, 0x00000801);
});
ApplySpellFix({
@@ -3763,15 +3763,15 @@ void SpellMgr::LoadSpellInfoCorrections()
70840 // Devious Minds (needs target selection script)
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
- spellInfo->Effects[EFFECT_0].TargetB = SpellImplicitTargetInfo(TARGET_UNIT_PET);
+ spellInfo->_GetEffect(EFFECT_0).TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
+ spellInfo->_GetEffect(EFFECT_0).TargetB = SpellImplicitTargetInfo(TARGET_UNIT_PET);
});
// Culling The Herd (needs target selection script)
ApplySpellFix({ 70893 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
- spellInfo->Effects[EFFECT_0].TargetB = SpellImplicitTargetInfo(TARGET_UNIT_MASTER);
+ spellInfo->_GetEffect(EFFECT_0).TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
+ spellInfo->_GetEffect(EFFECT_0).TargetB = SpellImplicitTargetInfo(TARGET_UNIT_MASTER);
});
// Sigil of the Frozen Conscience
@@ -3781,14 +3781,14 @@ void SpellMgr::LoadSpellInfoCorrections()
// this is done because another spell also uses the same SpellFamilyFlags as Icy Touch
// SpellFamilyFlags[0] & 0x00000040 in SPELLFAMILY_DEATHKNIGHT is currently unused (3.3.5a)
// this needs research on modifier applying rules, does not seem to be in Attributes fields
- spellInfo->Effects[EFFECT_0].SpellClassMask = flag96(0x00000040, 0x00000000, 0x00000000);
+ spellInfo->_GetEffect(EFFECT_0).SpellClassMask = flag96(0x00000040, 0x00000000, 0x00000000);
});
// Idol of the Flourishing Life
ApplySpellFix({ 64949 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].SpellClassMask = flag96(0x00000000, 0x02000000, 0x00000000);
- spellInfo->Effects[EFFECT_0].ApplyAuraName = SPELL_AURA_ADD_FLAT_MODIFIER;
+ spellInfo->_GetEffect(EFFECT_0).SpellClassMask = flag96(0x00000000, 0x02000000, 0x00000000);
+ spellInfo->_GetEffect(EFFECT_0).ApplyAuraName = SPELL_AURA_ADD_FLAT_MODIFIER;
});
ApplySpellFix({
@@ -3797,8 +3797,8 @@ void SpellMgr::LoadSpellInfoCorrections()
64956 // Libram of the Resolute
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].SpellClassMask = flag96(0x80000000, 0x00000000, 0x00000000);
- spellInfo->Effects[EFFECT_0].ApplyAuraName = SPELL_AURA_ADD_FLAT_MODIFIER;
+ spellInfo->_GetEffect(EFFECT_0).SpellClassMask = flag96(0x80000000, 0x00000000, 0x00000000);
+ spellInfo->_GetEffect(EFFECT_0).ApplyAuraName = SPELL_AURA_ADD_FLAT_MODIFIER;
});
ApplySpellFix({
@@ -3807,15 +3807,15 @@ void SpellMgr::LoadSpellInfoCorrections()
32403 // Blessed Book of Nagrand
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].SpellClassMask = flag96(0x40000000, 0x00000000, 0x00000000);
- spellInfo->Effects[EFFECT_0].ApplyAuraName = SPELL_AURA_ADD_FLAT_MODIFIER;
+ spellInfo->_GetEffect(EFFECT_0).SpellClassMask = flag96(0x40000000, 0x00000000, 0x00000000);
+ spellInfo->_GetEffect(EFFECT_0).ApplyAuraName = SPELL_AURA_ADD_FLAT_MODIFIER;
});
// Ride Carpet
ApplySpellFix({ 45602 }, [](SpellInfo* spellInfo)
{
// force seat 0, vehicle doesn't have the required seat flags for "no seat specified (-1)"
- spellInfo->Effects[EFFECT_0].BasePoints = 0;
+ spellInfo->_GetEffect(EFFECT_0).BasePoints = 0;
});
ApplySpellFix({
@@ -3824,7 +3824,7 @@ void SpellMgr::LoadSpellInfoCorrections()
}, [](SpellInfo* spellInfo)
{
// 100% chance of procc'ing, not -10% (chance calculated in PrepareTriggersExecutedOnHit)
- spellInfo->Effects[EFFECT_0].BasePoints = 100;
+ spellInfo->_GetEffect(EFFECT_0).BasePoints = 100;
});
// Entangling Roots -- Nature's Grasp Proc
@@ -3852,7 +3852,7 @@ void SpellMgr::LoadSpellInfoCorrections()
// Death Knight T10 Tank 2P Bonus
ApplySpellFix({ 70650 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].ApplyAuraName = SPELL_AURA_ADD_PCT_MODIFIER;
+ spellInfo->_GetEffect(EFFECT_0).ApplyAuraName = SPELL_AURA_ADD_PCT_MODIFIER;
});
ApplySpellFix({
@@ -3876,13 +3876,13 @@ void SpellMgr::LoadSpellInfoCorrections()
}, [](SpellInfo* spellInfo)
{
/// @todo: remove this when basepoints of all Ride Vehicle auras are calculated correctly
- spellInfo->Effects[EFFECT_0].BasePoints = 1;
+ spellInfo->_GetEffect(EFFECT_0).BasePoints = 1;
});
// Summon Scourged Captive
ApplySpellFix({ 51597 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].DieSides = 0;
+ spellInfo->_GetEffect(EFFECT_0).DieSides = 0;
});
// Black Magic
@@ -3906,7 +3906,7 @@ void SpellMgr::LoadSpellInfoCorrections()
}, [](SpellInfo* spellInfo)
{
//! HACK: This spell break quest complete for alliance and on retail not used
- spellInfo->Effects[EFFECT_0].Effect = SPELL_EFFECT_NONE;
+ spellInfo->_GetEffect(EFFECT_0).Effect = SPELL_EFFECT_NONE;
});
ApplySpellFix({
@@ -3941,7 +3941,7 @@ void SpellMgr::LoadSpellInfoCorrections()
46836 // Flame Patch
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo();
+ spellInfo->_GetEffect(EFFECT_0).TargetA = SpellImplicitTargetInfo();
});
// Test Ribbon Pole Channel
@@ -3955,7 +3955,7 @@ void SpellMgr::LoadSpellInfoCorrections()
43092 // Stop the Ascension!: Halfdan's Soul Destruction
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_NEARBY_ENTRY);
+ spellInfo->_GetEffect(EFFECT_0).TargetA = SpellImplicitTargetInfo(TARGET_UNIT_NEARBY_ENTRY);
});
// Polymorph (Six Demon Bag)
@@ -4007,7 +4007,7 @@ void SpellMgr::LoadSpellInfoCorrections()
// Summon Corpse Scarabs
ApplySpellFix({ 28864, 29105 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_10_YARDS);
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_10_YARDS);
});
ApplySpellFix({
@@ -4084,7 +4084,7 @@ void SpellMgr::LoadSpellInfoCorrections()
{
// in 3.3.5 there is only one radius in dbc which is 0 yards in this
// use max radius from 4.3.4
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_25_YARDS);
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_25_YARDS);
});
// ENDOF VIOLET HOLD
@@ -4094,7 +4094,7 @@ void SpellMgr::LoadSpellInfoCorrections()
// Pursued (Flame Leviathan)
ApplySpellFix({ 62374 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd
});
// Focused Eyebeam Summon Trigger (Kologarn)
@@ -4151,13 +4151,13 @@ void SpellMgr::LoadSpellInfoCorrections()
{
// DBC data is wrong for EFFECT_0, it's a different dynobject target than EFFECT_1
// Both effects should be shared by the same DynObject
- spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_DEST_CASTER_LEFT);
+ spellInfo->_GetEffect(EFFECT_0).TargetA = SpellImplicitTargetInfo(TARGET_DEST_CASTER_LEFT);
});
// Spinning Up (Mimiron)
ApplySpellFix({ 63414 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TargetB = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
+ spellInfo->_GetEffect(EFFECT_0).TargetB = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
spellInfo->ChannelInterruptFlags = 0;
});
@@ -4194,7 +4194,7 @@ void SpellMgr::LoadSpellInfoCorrections()
// Cosmic Smash (Algalon the Observer)
ApplySpellFix({ 62293 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TargetB = SpellImplicitTargetInfo(TARGET_DEST_CASTER);
+ spellInfo->_GetEffect(EFFECT_0).TargetB = SpellImplicitTargetInfo(TARGET_DEST_CASTER);
});
// Cosmic Smash (Algalon the Observer)
@@ -4215,7 +4215,7 @@ void SpellMgr::LoadSpellInfoCorrections()
65042 // Prison of Yogg-Saron Teleport
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[0].TargetA = SpellImplicitTargetInfo(TARGET_DEST_DB);
+ spellInfo->_GetEffect(EFFECT_0).TargetA = SpellImplicitTargetInfo(TARGET_DEST_DB);
});
// ENDOF ULDUAR SPELLS
@@ -4239,19 +4239,19 @@ void SpellMgr::LoadSpellInfoCorrections()
72452 // Defiling Horror
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = spellInfo->Effects[EFFECT_1].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_60_YARDS); // 60yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = spellInfo->_GetEffect(EFFECT_1).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_60_YARDS); // 60yd
});
// Achievement Check
ApplySpellFix({ 72830 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd
});
// Start Halls of Reflection Quest AE
ApplySpellFix({ 72900 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // 200yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // 200yd
});
// ENDOF HALLS OF REFLECTION SPELLS
@@ -4271,13 +4271,13 @@ void SpellMgr::LoadSpellInfoCorrections()
70861 // Sindragosa's Lair Teleport
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_DEST_DB);
+ spellInfo->_GetEffect(EFFECT_0).TargetA = SpellImplicitTargetInfo(TARGET_DEST_DB);
});
// Bone Slice (Lord Marrowgar)
ApplySpellFix({ 69055, 70814 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_5_YARDS); // 5yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_5_YARDS); // 5yd
});
ApplySpellFix({
@@ -4290,7 +4290,7 @@ void SpellMgr::LoadSpellInfoCorrections()
71123 // Decimate (Stinky & Precious)
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_100_YARDS); // 100yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_100_YARDS); // 100yd
});
// Coldflame (Lord Marrowgar)
@@ -4314,7 +4314,7 @@ void SpellMgr::LoadSpellInfoCorrections()
// Award Reputation - Boss Kill
ApplySpellFix({ 73843, 73844, 73845, 73846 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd
});
ApplySpellFix({
@@ -4323,20 +4323,20 @@ void SpellMgr::LoadSpellInfoCorrections()
72769 // Scent of Blood (Deathbringer Saurfang)
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = spellInfo->Effects[EFFECT_1].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS);
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = spellInfo->_GetEffect(EFFECT_1).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS);
});
// Scent of Blood (Deathbringer Saurfang)
ApplySpellFix({ 72771 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_1].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS);
+ spellInfo->_GetEffect(EFFECT_1).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS);
});
// Resistant Skin (Deathbringer Saurfang adds)
ApplySpellFix({ 72723 }, [](SpellInfo* spellInfo)
{
// this spell initially granted Shadow damage immunity, however it was removed but the data was left in client
- spellInfo->Effects[EFFECT_2].Effect = SPELL_EFFECT_NONE;
+ spellInfo->_GetEffect(EFFECT_2).Effect = SPELL_EFFECT_NONE;
});
// Coldflame Jets (Traps after Saurfang)
@@ -4350,7 +4350,7 @@ void SpellMgr::LoadSpellInfoCorrections()
71415 // Orange Ooze Summon (Professor Putricide)
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_TARGET_ANY);
+ spellInfo->_GetEffect(EFFECT_0).TargetA = SpellImplicitTargetInfo(TARGET_UNIT_TARGET_ANY);
});
// Ooze flood
@@ -4369,26 +4369,26 @@ void SpellMgr::LoadSpellInfoCorrections()
// Volatile Ooze Beam Protection (Professor Putricide)
ApplySpellFix({ 70530 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].Effect = SPELL_EFFECT_APPLY_AURA; // for an unknown reason this was SPELL_EFFECT_APPLY_AREA_AURA_RAID
+ spellInfo->_GetEffect(EFFECT_0).Effect = SPELL_EFFECT_APPLY_AURA; // for an unknown reason this was SPELL_EFFECT_APPLY_AREA_AURA_RAID
});
// Mutated Strength (Professor Putricide)
ApplySpellFix({ 71604, 72673, 72674, 72675 }, [](SpellInfo* spellInfo)
{
// THIS IS HERE BECAUSE COOLDOWN ON CREATURE PROCS WERE NOT IMPLEMENTED WHEN THE SCRIPT WAS WRITTEN
- spellInfo->Effects[EFFECT_1].Effect = SPELL_EFFECT_NONE;
+ spellInfo->_GetEffect(EFFECT_1).Effect = SPELL_EFFECT_NONE;
});
// Mutated Plague (Professor Putricide)
ApplySpellFix({ 72454, 72464, 72506, 72507 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd
});
// Unbound Plague (Professor Putricide) (needs target selection script)
ApplySpellFix({ 70911, 72854, 72855, 72856 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TargetB = SpellImplicitTargetInfo(TARGET_UNIT_TARGET_ENEMY);
+ spellInfo->_GetEffect(EFFECT_0).TargetB = SpellImplicitTargetInfo(TARGET_UNIT_TARGET_ENEMY);
});
ApplySpellFix({
@@ -4397,7 +4397,7 @@ void SpellMgr::LoadSpellInfoCorrections()
72289 // Frost Infusion Quest Credit (Sindragosa)
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // another missing radius
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // another missing radius
});
// Empowered Flare (Blood Prince Council)
@@ -4433,14 +4433,14 @@ void SpellMgr::LoadSpellInfoCorrections()
// Frostbolt Volley (only heroic)
ApplySpellFix({ 72015, 72016 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_2].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_40_YARDS);
+ spellInfo->_GetEffect(EFFECT_2).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_40_YARDS);
});
// Summon Suppressor (needs target selection script)
ApplySpellFix({ 70936 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_TARGET_ANY);
- spellInfo->Effects[EFFECT_0].TargetB = SpellImplicitTargetInfo();
+ spellInfo->_GetEffect(EFFECT_0).TargetA = SpellImplicitTargetInfo(TARGET_UNIT_TARGET_ANY);
+ spellInfo->_GetEffect(EFFECT_0).TargetB = SpellImplicitTargetInfo();
spellInfo->RangeEntry = sSpellRangeStore.LookupEntry(157); // 90yd
});
@@ -4449,13 +4449,13 @@ void SpellMgr::LoadSpellInfoCorrections()
71357 // Order Whelp
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // 200yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // 200yd
});
// Sindragosa's Fury
ApplySpellFix({ 70598 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_DEST_DEST);
+ spellInfo->_GetEffect(EFFECT_0).TargetA = SpellImplicitTargetInfo(TARGET_DEST_DEST);
});
// Frost Bomb
@@ -4492,13 +4492,13 @@ void SpellMgr::LoadSpellInfoCorrections()
// Defile
ApplySpellFix({ 72754, 73708, 73709, 73710 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = spellInfo->Effects[EFFECT_1].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // 200yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = spellInfo->_GetEffect(EFFECT_1).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // 200yd
});
// Val'kyr Target Search
ApplySpellFix({ 69030 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = spellInfo->Effects[EFFECT_1].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // 200yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = spellInfo->_GetEffect(EFFECT_1).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // 200yd
spellInfo->Attributes |= SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY;
});
@@ -4511,9 +4511,9 @@ void SpellMgr::LoadSpellInfoCorrections()
// Harvest Souls
ApplySpellFix({ 73654, 74295, 74296, 74297 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd
- spellInfo->Effects[EFFECT_1].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd
- spellInfo->Effects[EFFECT_2].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd
+ spellInfo->_GetEffect(EFFECT_1).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd
+ spellInfo->_GetEffect(EFFECT_2).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd
});
// Harvest Soul
@@ -4537,51 +4537,51 @@ void SpellMgr::LoadSpellInfoCorrections()
// Shadow Trap
ApplySpellFix({ 73529 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_1].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_10_YARDS); // 10yd
+ spellInfo->_GetEffect(EFFECT_1).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_10_YARDS); // 10yd
});
// Shadow Trap (searcher)
ApplySpellFix({ 74282 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_5_YARDS); // 5yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_5_YARDS); // 5yd
});
// Restore Soul
ApplySpellFix({ 72595, 73650 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // 200yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // 200yd
});
// Destroy Soul
ApplySpellFix({ 74086 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // 200yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // 200yd
});
// Summon Spirit Bomb
ApplySpellFix({ 74302, 74342 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // 200yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // 200yd
spellInfo->MaxAffectedTargets = 1;
});
// Summon Spirit Bomb
ApplySpellFix({ 74341, 74343 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // 200yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // 200yd
spellInfo->MaxAffectedTargets = 3;
});
// Summon Spirit Bomb
ApplySpellFix({ 73579 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_25_YARDS); // 25yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_25_YARDS); // 25yd
});
// Fury of Frostmourne
ApplySpellFix({ 72350 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = spellInfo->Effects[EFFECT_1].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = spellInfo->_GetEffect(EFFECT_1).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd
});
ApplySpellFix(
@@ -4594,28 +4594,28 @@ void SpellMgr::LoadSpellInfoCorrections()
73582 // Trigger Vile Spirit (Inside, Heroic)
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd
});
// Raise Dead
ApplySpellFix({ 72376 }, [](SpellInfo* spellInfo)
{
spellInfo->MaxAffectedTargets = 3;
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd
});
// Jump
ApplySpellFix({ 71809 }, [](SpellInfo* spellInfo)
{
spellInfo->RangeEntry = sSpellRangeStore.LookupEntry(5); // 40yd
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_10_YARDS); // 10yd
- spellInfo->Effects[EFFECT_0].MiscValue = 190;
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_10_YARDS); // 10yd
+ spellInfo->_GetEffect(EFFECT_0).MiscValue = 190;
});
// Broken Frostmourne
ApplySpellFix({ 72405 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_1].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_20_YARDS); // 20yd
+ spellInfo->_GetEffect(EFFECT_1).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_20_YARDS); // 20yd
spellInfo->AttributesEx |= SPELL_ATTR1_NO_THREAT;
});
// ENDOF ICECROWN CITADEL SPELLS
@@ -4626,13 +4626,13 @@ void SpellMgr::LoadSpellInfoCorrections()
// Soul Consumption
ApplySpellFix({ 74799 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_1].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_12_YARDS);
+ spellInfo->_GetEffect(EFFECT_1).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_12_YARDS);
});
// Twilight Cutter
ApplySpellFix({ 74769, 77844, 77845, 77846 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_100_YARDS); // 100yd
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_100_YARDS); // 100yd
});
// Twilight Mending
@@ -4645,20 +4645,20 @@ void SpellMgr::LoadSpellInfoCorrections()
// Combustion and Consumption Heroic versions lacks radius data
ApplySpellFix({ 75875 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].Mechanic = MECHANIC_NONE;
- spellInfo->Effects[EFFECT_1].Mechanic = MECHANIC_SNARE;
- spellInfo->Effects[EFFECT_1].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_6_YARDS);
+ spellInfo->_GetEffect(EFFECT_0).Mechanic = MECHANIC_NONE;
+ spellInfo->_GetEffect(EFFECT_1).Mechanic = MECHANIC_SNARE;
+ spellInfo->_GetEffect(EFFECT_1).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_6_YARDS);
});
ApplySpellFix({ 75884 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_6_YARDS);
- spellInfo->Effects[EFFECT_1].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_6_YARDS);
+ spellInfo->_GetEffect(EFFECT_0).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_6_YARDS);
+ spellInfo->_GetEffect(EFFECT_1).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_6_YARDS);
});
ApplySpellFix({ 75883, 75876 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_1].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_6_YARDS);
+ spellInfo->_GetEffect(EFFECT_1).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_6_YARDS);
});
// ENDOF RUBY SANCTUM SPELLS
@@ -4700,7 +4700,7 @@ void SpellMgr::LoadSpellInfoCorrections()
49345 // Call Emerald Drake
}, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_1].Effect = SPELL_EFFECT_NONE;
+ spellInfo->_GetEffect(EFFECT_1).Effect = SPELL_EFFECT_NONE;
});
// ENDOF OCULUS SPELLS
@@ -4713,7 +4713,7 @@ void SpellMgr::LoadSpellInfoCorrections()
// Chains of Ice
ApplySpellFix({ 45524 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_2].TargetA = SpellImplicitTargetInfo();
+ spellInfo->_GetEffect(EFFECT_2).TargetA = SpellImplicitTargetInfo();
});
// Minor Fortitude
@@ -4745,8 +4745,8 @@ void SpellMgr::LoadSpellInfoCorrections()
// Bad DBC data? Copying 25820 here due to spell description
// either is a periodic with chance on tick, or a proc
- spellInfo->Effects[EFFECT_0].ApplyAuraName = SPELL_AURA_PROC_TRIGGER_SPELL;
- spellInfo->Effects[EFFECT_0].Amplitude = 0;
+ spellInfo->_GetEffect(EFFECT_0).ApplyAuraName = SPELL_AURA_PROC_TRIGGER_SPELL;
+ spellInfo->_GetEffect(EFFECT_0).Amplitude = 0;
spellInfo->ProcChance = 10;
});
@@ -4911,7 +4911,7 @@ void SpellMgr::LoadSpellInfoCorrections()
// Feral Charge - Cat
ApplySpellFix({ 49376 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_1].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_3_YARDS); // 3yd
+ spellInfo->_GetEffect(EFFECT_1).RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_3_YARDS); // 3yd
});
// Baron Rivendare (Stratholme) - Unholy Aura
@@ -4930,13 +4930,13 @@ void SpellMgr::LoadSpellInfoCorrections()
// Death's Embrace
ApplySpellFix({ 47198, 47199, 47200 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_1].SpellClassMask[0] |= 0x00004000; // Drain soul
+ spellInfo->_GetEffect(EFFECT_1).SpellClassMask[0] |= 0x00004000; // Drain soul
});
// Soul Sickness (Forge of Souls)
ApplySpellFix({ 69131 }, [](SpellInfo* spellInfo)
{
- spellInfo->Effects[EFFECT_1].ApplyAuraName = SPELL_AURA_MOD_DECREASE_SPEED;
+ spellInfo->_GetEffect(EFFECT_1).ApplyAuraName = SPELL_AURA_MOD_DECREASE_SPEED;
});
// Headless Horseman Climax - Return Head (Hallow End)
@@ -4960,12 +4960,12 @@ void SpellMgr::LoadSpellInfoCorrections()
continue;
// Fix range for trajectory triggered spell
- for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
+ for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
{
- if (spellInfo->Effects[j].IsEffect() && (spellInfo->Effects[j].TargetA.GetTarget() == TARGET_DEST_TRAJ || spellInfo->Effects[j].TargetB.GetTarget() == TARGET_DEST_TRAJ))
+ if (spellEffectInfo.IsEffect() && (spellEffectInfo.TargetA.GetTarget() == TARGET_DEST_TRAJ || spellEffectInfo.TargetB.GetTarget() == TARGET_DEST_TRAJ))
{
// Get triggered spell if any
- if (SpellInfo* spellInfoTrigger = const_cast<SpellInfo*>(GetSpellInfo(spellInfo->Effects[j].TriggerSpell)))
+ if (SpellInfo* spellInfoTrigger = const_cast<SpellInfo*>(GetSpellInfo(spellEffectInfo.TriggerSpell)))
{
float maxRangeMain = spellInfo->RangeEntry ? spellInfo->RangeEntry->RangeMax[0] : 0.0f;
float maxRangeTrigger = spellInfoTrigger->RangeEntry ? spellInfoTrigger->RangeEntry->RangeMax[0] : 0.0f;
@@ -4977,9 +4977,9 @@ void SpellMgr::LoadSpellInfoCorrections()
}
}
- for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
+ for (SpellEffectInfo& spellEffectInfo : spellInfo->_GetEffects())
{
- switch (spellInfo->Effects[j].Effect)
+ switch (spellEffectInfo.Effect)
{
case SPELL_EFFECT_CHARGE:
case SPELL_EFFECT_CHARGE_DEST:
@@ -4991,8 +4991,8 @@ void SpellMgr::LoadSpellInfoCorrections()
break;
case SPELL_EFFECT_APPLY_AURA:
// special aura updates each 30 seconds
- if (spellInfo->Effects[j].ApplyAuraName == SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR)
- spellInfo->Effects[j].Amplitude = 30 * IN_MILLISECONDS;
+ if (spellEffectInfo.ApplyAuraName == SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR)
+ spellEffectInfo.Amplitude = 30 * IN_MILLISECONDS;
break;
default:
break;
@@ -5000,14 +5000,14 @@ void SpellMgr::LoadSpellInfoCorrections()
// Passive talent auras cannot target pets
if (spellInfo->IsPassive() && GetTalentSpellCost(i))
- if (spellInfo->Effects[j].TargetA.GetTarget() == TARGET_UNIT_PET)
- spellInfo->Effects[j].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
+ if (spellEffectInfo.TargetA.GetTarget() == TARGET_UNIT_PET)
+ spellEffectInfo.TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
// Area auras may not target area (they're self cast)
- if (spellInfo->Effects[j].IsAreaAuraEffect() && spellInfo->Effects[j].IsTargetingArea())
+ if (spellEffectInfo.IsAreaAuraEffect() && spellEffectInfo.IsTargetingArea())
{
- spellInfo->Effects[j].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
- spellInfo->Effects[j].TargetB = SpellImplicitTargetInfo(0);
+ spellEffectInfo.TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
+ spellEffectInfo.TargetB = SpellImplicitTargetInfo(0);
}
}
@@ -5027,7 +5027,7 @@ void SpellMgr::LoadSpellInfoCorrections()
case SPELLFAMILY_PALADIN:
// Seals of the Pure should affect Seal of Righteousness
if (spellInfo->SpellIconID == 25 && spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE))
- spellInfo->Effects[EFFECT_0].SpellClassMask[1] |= 0x20000000;
+ spellInfo->_GetEffect(EFFECT_0).SpellClassMask[1] |= 0x20000000;
break;
case SPELLFAMILY_DEATHKNIGHT:
// Icy Touch - extend FamilyFlags (unused value) for Sigil of the Frozen Conscience to use
diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp
index 6e0c5eb1b27..068ee909857 100644
--- a/src/server/scripts/Spells/spell_pet.cpp
+++ b/src/server/scripts/Spells/spell_pet.cpp
@@ -917,7 +917,7 @@ public:
if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
{
SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
- AddPct(mod, spellInfo->Effects[EFFECT_0].CalcValue());
+ AddPct(mod, spellInfo->GetEffect(EFFECT_0).CalcValue());
}
ownerBonus = owner->GetStat(STAT_STAMINA)*mod;
@@ -960,7 +960,7 @@ public:
if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
{
SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
- mod += CalculatePct(1.0f, spellInfo->Effects[EFFECT_1].CalcValue());
+ mod += CalculatePct(1.0f, spellInfo->GetEffect(EFFECT_1).CalcValue());
}
bonusAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.22f * mod;
@@ -990,7 +990,7 @@ public:
if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
{
SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
- mod += CalculatePct(1.0f, spellInfo->Effects[EFFECT_1].CalcValue());
+ mod += CalculatePct(1.0f, spellInfo->GetEffect(EFFECT_1).CalcValue());
}
bonusDamage = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.1287f * mod;
@@ -1470,7 +1470,7 @@ public:
amount = -90;
// Night of the dead
else if (Aura* aur = owner->GetAuraOfRankedSpell(SPELL_NIGHT_OF_THE_DEAD))
- amount = aur->GetSpellInfo()->Effects[EFFECT_2].CalcValue();
+ amount = aur->GetSpellInfo()->GetEffect(EFFECT_2).CalcValue();
}
}
}
@@ -1515,7 +1515,7 @@ public:
// Ravenous Dead. Check just if owner has Ravenous Dead since it's effect is not an aura
if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0))
- mod += aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()/100; // Ravenous Dead edits the original scale
+ mod += aurEff->GetSpellInfo()->GetEffect(EFFECT_1).CalcValue()/100; // Ravenous Dead edits the original scale
// Glyph of the Ghoul
if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_DEATH_KNIGHT_GLYPH_OF_GHOUL, 0))
@@ -1560,7 +1560,7 @@ public:
aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0);
if (aurEff)
{
- mod += CalculatePct(mod, aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale
+ mod += CalculatePct(mod, aurEff->GetSpellInfo()->GetEffect(EFFECT_1).CalcValue()); // Ravenous Dead edits the original scale
}
// Glyph of the Ghoul
aurEff = owner->GetAuraEffect(58686, 0);
diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp
index 803ecee8c5c..e6e743c5d8f 100644
--- a/src/server/scripts/Spells/spell_priest.cpp
+++ b/src/server/scripts/Spells/spell_priest.cpp
@@ -432,7 +432,7 @@ class spell_pri_guardian_spirit : public AuraScript
bool Load() override
{
- healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue();
+ healPct = GetEffectInfo(EFFECT_1).CalcValue();
return true;
}