aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/server/game/AI/CoreAI/CombatAI.cpp14
-rwxr-xr-xsrc/server/game/AI/CoreAI/PetAI.cpp15
-rwxr-xr-xsrc/server/game/AI/CoreAI/TotemAI.cpp5
-rwxr-xr-xsrc/server/game/AI/CoreAI/UnitAI.cpp45
-rwxr-xr-xsrc/server/game/AI/CreatureAI.h6
-rwxr-xr-xsrc/server/game/AI/EventAI/CreatureEventAI.cpp16
-rwxr-xr-xsrc/server/game/AI/EventAI/CreatureEventAI.h4
-rwxr-xr-xsrc/server/game/AI/EventAI/CreatureEventAIMgr.cpp16
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.cpp43
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.h12
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp4
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.h4
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp6
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.h6
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp2
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h2
-rwxr-xr-xsrc/server/game/Achievements/AchievementMgr.cpp4
-rwxr-xr-xsrc/server/game/Battlegrounds/Battleground.cpp2
-rw-r--r--src/server/game/Chat/ChatLink.cpp11
-rw-r--r--src/server/game/Chat/ChatLink.h4
-rwxr-xr-xsrc/server/game/Chat/Commands/Level2.cpp4
-rwxr-xr-xsrc/server/game/Chat/Commands/Level3.cpp32
-rwxr-xr-xsrc/server/game/Combat/HostileRefManager.cpp5
-rwxr-xr-xsrc/server/game/Combat/HostileRefManager.h4
-rwxr-xr-xsrc/server/game/Combat/ThreatManager.cpp6
-rwxr-xr-xsrc/server/game/Combat/ThreatManager.h6
-rwxr-xr-xsrc/server/game/Conditions/ConditionMgr.cpp56
-rwxr-xr-xsrc/server/game/Conditions/DisableMgr.cpp2
-rwxr-xr-xsrc/server/game/DataStores/DBCStores.cpp3
-rwxr-xr-xsrc/server/game/DataStores/DBCStores.h1
-rwxr-xr-xsrc/server/game/DataStores/DBCStructure.h12
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.cpp51
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.h10
-rwxr-xr-xsrc/server/game/Entities/DynamicObject/DynamicObject.h2
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.cpp22
-rwxr-xr-xsrc/server/game/Entities/Item/Item.cpp7
-rwxr-xr-xsrc/server/game/Entities/Item/Item.h6
-rwxr-xr-xsrc/server/game/Entities/Pet/Pet.cpp105
-rwxr-xr-xsrc/server/game/Entities/Pet/Pet.h3
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp222
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h19
-rwxr-xr-xsrc/server/game/Entities/Totem/Totem.cpp11
-rwxr-xr-xsrc/server/game/Entities/Totem/Totem.h2
-rwxr-xr-xsrc/server/game/Entities/Unit/StatSystem.cpp20
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp970
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.h153
-rwxr-xr-xsrc/server/game/Entities/Vehicle/Vehicle.cpp6
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.cpp98
-rwxr-xr-xsrc/server/game/Loot/LootMgr.cpp7
-rwxr-xr-xsrc/server/game/Miscellaneous/SharedDefines.h4
-rwxr-xr-xsrc/server/game/Scripting/ScriptMgr.cpp76
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/ItemHandler.cpp3
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/NPCHandler.cpp13
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/PetHandler.cpp61
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/SpellHandler.cpp28
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/TradeHandler.cpp4
-rwxr-xr-xsrc/server/game/Skills/SkillDiscovery.cpp15
-rwxr-xr-xsrc/server/game/Skills/SkillExtraItems.cpp4
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuraEffects.cpp461
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.h20
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuras.cpp350
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuras.h34
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp565
-rwxr-xr-xsrc/server/game/Spells/Spell.h43
-rwxr-xr-xsrc/server/game/Spells/SpellEffects.cpp462
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.cpp4629
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.h1229
-rwxr-xr-xsrc/server/game/Spells/SpellScript.cpp42
-rwxr-xr-xsrc/server/game/Spells/SpellScript.h30
-rw-r--r--src/server/game/Tools/CharacterDatabaseCleaner.cpp2
-rwxr-xr-xsrc/server/game/World/World.cpp15
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp4
-rw-r--r--src/server/scripts/Commands/cs_learn.cpp20
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp17
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp13
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/silvermoon_city.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp2
-rw-r--r--src/server/scripts/Examples/example_spell.cpp12
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp6
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp3
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp6
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp2
-rw-r--r--src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp4
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp2
-rw-r--r--src/server/scripts/Kalimdor/azshara.cpp2
-rw-r--r--src/server/scripts/Kalimdor/azuremyst_isle.cpp2
-rw-r--r--src/server/scripts/Kalimdor/darkshore.cpp2
-rw-r--r--src/server/scripts/Kalimdor/desolace.cpp2
-rw-r--r--src/server/scripts/Kalimdor/durotar.cpp24
-rw-r--r--src/server/scripts/Kalimdor/dustwallow_marsh.cpp16
-rw-r--r--src/server/scripts/Kalimdor/mulgore.cpp2
-rw-r--r--src/server/scripts/Kalimdor/the_barrens.cpp2
-rw-r--r--src/server/scripts/Kalimdor/ungoro_crater.cpp2
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp2
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp2
-rwxr-xr-xsrc/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp2
-rwxr-xr-xsrc/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp2
-rwxr-xr-xsrc/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp6
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp2
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp2
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp2
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp8
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp20
-rwxr-xr-xsrc/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp26
-rwxr-xr-xsrc/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp10
-rwxr-xr-xsrc/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp8
-rwxr-xr-xsrc/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp48
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp8
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp30
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp2
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp10
-rwxr-xr-xsrc/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h4
-rwxr-xr-xsrc/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp4
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp2
-rw-r--r--src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp2
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp2
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp6
-rw-r--r--src/server/scripts/Northrend/Ulduar/ulduar/boss_freya.cpp6
-rw-r--r--src/server/scripts/Northrend/Ulduar/ulduar/boss_general_vezax.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/ulduar/boss_hodir.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp6
-rw-r--r--src/server/scripts/Northrend/Ulduar/ulduar/boss_kologarn.cpp4
-rw-r--r--src/server/scripts/Northrend/Ulduar/ulduar/boss_razorscale.cpp6
-rw-r--r--src/server/scripts/Northrend/Ulduar/ulduar/boss_xt002.cpp18
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp2
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp2
-rw-r--r--src/server/scripts/Northrend/borean_tundra.cpp8
-rw-r--r--src/server/scripts/Northrend/grizzly_hills.cpp6
-rw-r--r--src/server/scripts/Northrend/sholazar_basin.cpp2
-rw-r--r--src/server/scripts/Northrend/storm_peaks.cpp2
-rw-r--r--src/server/scripts/Northrend/zuldrak.cpp8
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp2
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp2
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_illidan.cpp8
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp4
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp2
-rw-r--r--src/server/scripts/Outland/BlackTemple/illidari_council.cpp4
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp2
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp10
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp2
-rw-r--r--src/server/scripts/Outland/GruulsLair/boss_gruul.cpp2
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp2
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp4
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp18
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp2
-rw-r--r--src/server/scripts/Outland/blades_edge_mountains.cpp2
-rw-r--r--src/server/scripts/Outland/nagrand.cpp8
-rw-r--r--src/server/scripts/Outland/netherstorm.cpp4
-rw-r--r--src/server/scripts/Outland/shadowmoon_valley.cpp6
-rw-r--r--src/server/scripts/Spells/spell_dk.cpp62
-rw-r--r--src/server/scripts/Spells/spell_druid.cpp14
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp84
-rw-r--r--src/server/scripts/Spells/spell_hunter.cpp56
-rw-r--r--src/server/scripts/Spells/spell_item.cpp104
-rw-r--r--src/server/scripts/Spells/spell_mage.cpp36
-rw-r--r--src/server/scripts/Spells/spell_paladin.cpp28
-rw-r--r--src/server/scripts/Spells/spell_priest.cpp14
-rw-r--r--src/server/scripts/Spells/spell_quest.cpp60
-rw-r--r--src/server/scripts/Spells/spell_rogue.cpp28
-rw-r--r--src/server/scripts/Spells/spell_shaman.cpp18
-rw-r--r--src/server/scripts/Spells/spell_warlock.cpp20
-rw-r--r--src/server/scripts/Spells/spell_warrior.cpp4
-rw-r--r--src/server/scripts/World/boss_emerald_dragons.cpp6
-rw-r--r--src/server/scripts/World/guards.cpp8
-rw-r--r--src/server/scripts/World/item_scripts.cpp4
-rw-r--r--src/server/scripts/World/mob_generic_creature.cpp10
-rw-r--r--src/server/scripts/World/npc_professions.cpp4
-rw-r--r--src/server/scripts/World/npcs_special.cpp6
195 files changed, 4517 insertions, 6816 deletions
diff --git a/src/server/game/AI/CoreAI/CombatAI.cpp b/src/server/game/AI/CoreAI/CombatAI.cpp
index b90ee7fe7d8..d35710aa40f 100755
--- a/src/server/game/AI/CoreAI/CombatAI.cpp
+++ b/src/server/game/AI/CoreAI/CombatAI.cpp
@@ -18,6 +18,7 @@
#include "CombatAI.h"
#include "SpellMgr.h"
+#include "SpellInfo.h"
#include "Vehicle.h"
#include "ObjectAccessor.h"
@@ -62,7 +63,7 @@ int VehicleAI::Permissible(const Creature* /*creature*/)
void CombatAI::InitializeAI()
{
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
- if (me->m_spells[i] && GetSpellStore()->LookupEntry(me->m_spells[i]))
+ if (me->m_spells[i] && sSpellMgr->GetSpellInfo(me->m_spells[i]))
spells.push_back(me->m_spells[i]);
CreatureAI::InitializeAI();
@@ -177,10 +178,12 @@ ArcherAI::ArcherAI(Creature *c) : CreatureAI(c)
if (!me->m_spells[0])
sLog->outError("ArcherAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry());
- m_minRange = GetSpellMinRange(me->m_spells[0], false);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(me->m_spells[0]);
+ m_minRange = spellInfo ? spellInfo->GetMinRange(false) : 0;
+
if (!m_minRange)
m_minRange = MELEE_RANGE;
- me->m_CombatDistance = GetSpellMaxRange(me->m_spells[0], false);
+ me->m_CombatDistance = spellInfo ? spellInfo->GetMaxRange(false) : 0;
me->m_SightDistance = me->m_CombatDistance;
}
@@ -224,8 +227,9 @@ TurretAI::TurretAI(Creature *c) : CreatureAI(c)
if (!me->m_spells[0])
sLog->outError("TurretAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry());
- m_minRange = GetSpellMinRange(me->m_spells[0], false);
- me->m_CombatDistance = GetSpellMaxRange(me->m_spells[0], false);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(me->m_spells[0]);
+ m_minRange = spellInfo ? spellInfo->GetMinRange(false) : 0;
+ me->m_CombatDistance = spellInfo ? spellInfo->GetMaxRange(false) : 0;
me->m_SightDistance = me->m_CombatDistance;
}
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp
index 3f4c467d79e..b22cd3ecd95 100755
--- a/src/server/game/AI/CoreAI/PetAI.cpp
+++ b/src/server/game/AI/CoreAI/PetAI.cpp
@@ -28,6 +28,7 @@
#include "World.h"
#include "Util.h"
#include "Group.h"
+#include "SpellInfo.h"
int PetAI::Permissible(const Creature *creature)
{
@@ -133,7 +134,7 @@ void PetAI::UpdateAI(const uint32 diff)
if (!spellID)
continue;
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellID);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellID);
if (!spellInfo)
continue;
@@ -144,21 +145,21 @@ void PetAI::UpdateAI(const uint32 diff)
if (!me->getVictim())
{
// ignore attacking spells, and allow only self/around spells
- if (!IsPositiveSpell(spellInfo->Id))
+ if (!spellInfo->IsPositive())
continue;
// non combat spells allowed
// only pet spells have IsNonCombatSpell and not fit this reqs:
// Consume Shadows, Lesser Invisibility, so ignore checks for its
- if (!IsNonCombatSpell(spellInfo))
+ if (spellInfo->CanBeUsedInCombat())
{
// allow only spell without spell cost or with spell cost but not duration limit
- int32 duration = GetSpellDuration(spellInfo);
- if ((spellInfo->manaCost || spellInfo->ManaCostPercentage || spellInfo->manaPerSecond) && duration > 0)
+ int32 duration = spellInfo->GetDuration();
+ if ((spellInfo->ManaCost || spellInfo->ManaCostPercentage || spellInfo->ManaPerSecond) && duration > 0)
continue;
// allow only spell without cooldown > duration
- int32 cooldown = GetSpellRecoveryTime(spellInfo);
+ int32 cooldown = spellInfo->GetRecoveryTime();
if (cooldown >= 0 && duration >= 0 && cooldown > duration)
continue;
}
@@ -166,7 +167,7 @@ void PetAI::UpdateAI(const uint32 diff)
else
{
// just ignore non-combat spells
- if (IsNonCombatSpell(spellInfo))
+ if (!spellInfo->CanBeUsedInCombat())
continue;
}
diff --git a/src/server/game/AI/CoreAI/TotemAI.cpp b/src/server/game/AI/CoreAI/TotemAI.cpp
index a1ef4706b7e..f1106f2dc28 100755
--- a/src/server/game/AI/CoreAI/TotemAI.cpp
+++ b/src/server/game/AI/CoreAI/TotemAI.cpp
@@ -61,13 +61,12 @@ TotemAI::UpdateAI(const uint32 /*diff*/)
return;
// Search spell
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(me->ToTotem()->GetSpell());
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(me->ToTotem()->GetSpell());
if (!spellInfo)
return;
// Get spell range
- SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex);
- float max_range = GetSpellMaxRangeForHostile(srange);
+ float max_range = spellInfo->GetMaxRange(false);
// SPELLMOD_RANGE not applied in this place just because not existence range mods for attacking totems
diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp
index d3eb23ab0cd..88f88e60279 100755
--- a/src/server/game/AI/CoreAI/UnitAI.cpp
+++ b/src/server/game/AI/CoreAI/UnitAI.cpp
@@ -22,6 +22,7 @@
#include "SpellAuras.h"
#include "SpellAuraEffects.h"
#include "SpellMgr.h"
+#include "SpellInfo.h"
#include "CreatureAIImpl.h"
void UnitAI::AttackStart(Unit* victim)
@@ -69,10 +70,15 @@ bool UnitAI::DoSpellAttackIfReady(uint32 spell)
if (me->isAttackReady())
{
- if (me->IsWithinCombatRange(me->getVictim(), GetSpellMaxRange(spell, false)))
+ if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell))
{
- me->CastSpell(me->getVictim(), spell, false);
- me->resetAttackTimer();
+ if (me->IsWithinCombatRange(me->getVictim(), spellInfo->GetMaxRange(false)))
+ {
+ me->CastSpell(me->getVictim(), spell, false);
+ me->resetAttackTimer();
+ }
+ else
+ return false;
}
else
return false;
@@ -92,7 +98,8 @@ void UnitAI::SelectTargetList(std::list<Unit*> &targetList, uint32 num, SelectAg
float UnitAI::DoGetSpellMaxRange(uint32 spellId, bool positive)
{
- return GetSpellMaxRange(spellId, positive);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
+ return spellInfo ? spellInfo->GetMaxRange(positive) : 0;
}
void UnitAI::DoAddAuraToAllHostilePlayers(uint32 spellid)
@@ -136,19 +143,19 @@ void UnitAI::DoCast(uint32 spellId)
case AITARGET_VICTIM: target = me->getVictim(); break;
case AITARGET_ENEMY:
{
- const SpellEntry * spellInfo = GetSpellStore()->LookupEntry(spellId);
+ const SpellInfo * spellInfo = sSpellMgr->GetSpellInfo(spellId);
bool playerOnly = spellInfo->AttributesEx3 & SPELL_ATTR3_PLAYERS_ONLY;
//float range = GetSpellMaxRange(spellInfo, false);
- target = SelectTarget(SELECT_TARGET_RANDOM, 0, GetSpellMaxRange(spellInfo, false), playerOnly);
+ target = SelectTarget(SELECT_TARGET_RANDOM, 0, spellInfo->GetMaxRange(false), playerOnly);
break;
}
case AITARGET_ALLY: target = me; break;
case AITARGET_BUFF: target = me; break;
case AITARGET_DEBUFF:
{
- const SpellEntry * spellInfo = GetSpellStore()->LookupEntry(spellId);
+ const SpellInfo * spellInfo = sSpellMgr->GetSpellInfo(spellId);
bool playerOnly = spellInfo->AttributesEx3 & SPELL_ATTR3_PLAYERS_ONLY;
- float range = GetSpellMaxRange(spellInfo, false);
+ float range = spellInfo->GetMaxRange(false);
DefaultTargetSelector targetSelector(me, range, playerOnly, -(int32)spellId);
if (!(spellInfo->Attributes & SPELL_ATTR0_BREAKABLE_BY_DAMAGE)
@@ -169,20 +176,20 @@ void UnitAI::DoCast(uint32 spellId)
void UnitAI::FillAISpellInfo()
{
- AISpellInfo = new AISpellInfoType[GetSpellStore()->GetNumRows()];
+ AISpellInfo = new AISpellInfoType[sSpellMgr->GetSpellInfoStoreSize()];
AISpellInfoType *AIInfo = AISpellInfo;
- const SpellEntry * spellInfo;
+ const SpellInfo * spellInfo;
- for (uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i, ++AIInfo)
+ for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i, ++AIInfo)
{
- spellInfo = GetSpellStore()->LookupEntry(i);
+ spellInfo = sSpellMgr->GetSpellInfo(i);
if (!spellInfo)
continue;
if (spellInfo->Attributes & SPELL_ATTR0_CASTABLE_WHILE_DEAD)
AIInfo->condition = AICOND_DIE;
- else if (IsPassiveSpell(i) || GetSpellDuration(spellInfo) == -1)
+ else if (spellInfo->IsPassive() || spellInfo->GetDuration() == -1)
AIInfo->condition = AICOND_AGGRO;
else
AIInfo->condition = AICOND_COMBAT;
@@ -190,13 +197,13 @@ void UnitAI::FillAISpellInfo()
if (AIInfo->cooldown < spellInfo->RecoveryTime)
AIInfo->cooldown = spellInfo->RecoveryTime;
- if (!GetSpellMaxRange(spellInfo, false))
+ if (!spellInfo->GetMaxRange(false))
UPDATE_TARGET(AITARGET_SELF)
else
{
for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
- uint32 targetType = spellInfo->EffectImplicitTargetA[j];
+ uint32 targetType = spellInfo->Effects[j].TargetA;
if (targetType == TARGET_UNIT_TARGET_ENEMY
|| targetType == TARGET_DST_TARGET_ENEMY)
@@ -204,19 +211,17 @@ void UnitAI::FillAISpellInfo()
else if (targetType == TARGET_UNIT_AREA_ENEMY_DST)
UPDATE_TARGET(AITARGET_ENEMY)
- if (spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA)
+ if (spellInfo->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA)
{
if (targetType == TARGET_UNIT_TARGET_ENEMY)
UPDATE_TARGET(AITARGET_DEBUFF)
- else if (IsPositiveSpell(i))
+ else if (spellInfo->IsPositive())
UPDATE_TARGET(AITARGET_BUFF)
}
}
}
AIInfo->realCooldown = spellInfo->RecoveryTime + spellInfo->StartRecoveryTime;
- SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex);
- if (srange)
- AIInfo->maxRange = srange->maxRangeHostile * 3 / 4;
+ AIInfo->maxRange = spellInfo->GetMaxRange(false) * 3 / 4;
}
}
diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h
index 000acd90fd6..3b09960f31c 100755
--- a/src/server/game/AI/CreatureAI.h
+++ b/src/server/game/AI/CreatureAI.h
@@ -27,7 +27,7 @@ class WorldObject;
class Unit;
class Creature;
class Player;
-struct SpellEntry;
+class SpellInfo;
#define TIME_INTERVAL_LOOK 5000
#define VISIBILITY_RANGE 10000
@@ -111,10 +111,10 @@ class CreatureAI : public UnitAI
virtual void SummonedCreatureDies(Creature* /*summon*/, Unit* /*killer*/) {}
// Called when hit by a spell
- virtual void SpellHit(Unit* /*caster*/, SpellEntry const* /*spell*/) {}
+ virtual void SpellHit(Unit* /*caster*/, SpellInfo const* /*spell*/) {}
// Called when spell hits a target
- virtual void SpellHitTarget(Unit* /*target*/, SpellEntry const* /*spell*/) {}
+ virtual void SpellHitTarget(Unit* /*target*/, SpellInfo const* /*spell*/) {}
// Called when the creature is target of hostile action: swing, hostile spell landed, fear/etc)
//virtual void AttackedBy(Unit* attacker);
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp
index f49df99554f..fa2c0e3856b 100755
--- a/src/server/game/AI/EventAI/CreatureEventAI.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp
@@ -463,7 +463,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
if (canCast)
{
- const SpellEntry* tSpell = GetSpellStore()->LookupEntry(action.cast.spellId);
+ const SpellInfo* tSpell = sSpellMgr->GetSpellInfo(action.cast.spellId);
//Verify that spell exists
if (tSpell)
@@ -1047,7 +1047,7 @@ void CreatureEventAI::MoveInLineOfSight(Unit *who)
CreatureAI::MoveInLineOfSight(who);
}
-void CreatureEventAI::SpellHit(Unit* pUnit, const SpellEntry* pSpell)
+void CreatureEventAI::SpellHit(Unit* pUnit, const SpellInfo* pSpell)
{
if (m_bEmptyList)
@@ -1304,7 +1304,7 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit*
}
}
-bool CreatureEventAI::CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered)
+bool CreatureEventAI::CanCast(Unit* Target, SpellInfo const *Spell, bool Triggered)
{
//No target so we can't cast
if (!Target || !Spell)
@@ -1315,17 +1315,11 @@ bool CreatureEventAI::CanCast(Unit* Target, SpellEntry const *Spell, bool Trigge
return false;
//Check for power
- if (!Triggered && me->GetPower((Powers)Spell->powerType) < CalculatePowerCost(Spell, me, GetSpellSchoolMask(Spell)))
- return false;
-
- SpellRangeEntry const* tempRange = sSpellRangeStore.LookupEntry(Spell->rangeIndex);
-
- //Spell has invalid range store so we can't use it
- if (!tempRange)
+ if (!Triggered && me->GetPower((Powers)Spell->PowerType) < Spell->CalcPowerCost(me, Spell->GetSchoolMask()))
return false;
//Unit is out of range of this spell
- if (!me->IsInRange(Target, tempRange->minRangeHostile, tempRange->maxRangeHostile))
+ if (!me->IsInRange(Target, Spell->GetMinRange(false), Spell->GetMinRange(true)))
return false;
return true;
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.h b/src/server/game/AI/EventAI/CreatureEventAI.h
index 779e0d5ce37..7df0dc2d30d 100755
--- a/src/server/game/AI/EventAI/CreatureEventAI.h
+++ b/src/server/game/AI/EventAI/CreatureEventAI.h
@@ -606,7 +606,7 @@ class CreatureEventAI : public CreatureAI
void JustSummoned(Creature* pUnit);
void AttackStart(Unit *who);
void MoveInLineOfSight(Unit *who);
- void SpellHit(Unit* pUnit, const SpellEntry* pSpell);
+ void SpellHit(Unit* pUnit, const SpellInfo* pSpell);
void DamageTaken(Unit* done_by, uint32& damage);
void HealReceived(Unit* /*done_by*/, uint32& /*addhealth*/) {}
void UpdateAI(const uint32 diff);
@@ -620,7 +620,7 @@ class CreatureEventAI : public CreatureAI
inline Unit* GetTargetByType(uint32 Target, Unit* pActionInvoker);
void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target);
- bool CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered);
+ bool CanCast(Unit* Target, SpellInfo const *Spell, bool Triggered);
bool SpawnedEventConditionsCheck(CreatureEventAI_Event const& event);
diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
index c38b7159e5a..3f1b2d71da1 100755
--- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
@@ -24,6 +24,8 @@
#include "ObjectDefines.h"
#include "GridDefines.h"
#include "ConditionMgr.h"
+#include "SpellMgr.h"
+#include "SpellInfo.h"
// -------------------
void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
@@ -248,7 +250,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
case EVENT_T_SPELLHIT:
if (temp.spell_hit.spellId)
{
- SpellEntry const* pSpell = sSpellStore.LookupEntry(temp.spell_hit.spellId);
+ SpellInfo const* pSpell = sSpellMgr->GetSpellInfo(temp.spell_hit.spellId);
if (!pSpell)
{
sLog->outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
@@ -302,7 +304,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
break;
case EVENT_T_FRIENDLY_MISSING_BUFF:
{
- SpellEntry const* pSpell = sSpellStore.LookupEntry(temp.spell_hit.spellId);
+ SpellInfo const* pSpell = sSpellMgr->GetSpellInfo(temp.spell_hit.spellId);
if (!pSpell)
{
sLog->outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
@@ -379,7 +381,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
case EVENT_T_BUFFED:
case EVENT_T_TARGET_BUFFED:
{
- SpellEntry const* pSpell = sSpellStore.LookupEntry(temp.buffed.spellId);
+ SpellInfo const* pSpell = sSpellMgr->GetSpellInfo(temp.buffed.spellId);
if (!pSpell)
{
sLog->outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
@@ -499,7 +501,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
break;
case ACTION_T_CAST:
{
- const SpellEntry *spell = sSpellStore.LookupEntry(action.cast.spellId);
+ const SpellInfo *spell = sSpellMgr->GetSpellInfo(action.cast.spellId);
if (!spell)
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast.spellId);
/* FIXME: temp.raw.param3 not have event tipes with recovery time in it....
@@ -555,7 +557,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
case ACTION_T_CAST_EVENT:
if (!sObjectMgr->GetCreatureTemplate(action.cast_event.creatureId))
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event.creatureId);
- if (!sSpellStore.LookupEntry(action.cast_event.spellId))
+ if (!sSpellMgr->GetSpellInfo(action.cast_event.spellId))
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event.spellId);
if (action.cast_event.target >= TARGET_T_END)
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
@@ -593,11 +595,11 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
case ACTION_T_CAST_EVENT_ALL:
if (!sObjectMgr->GetCreatureTemplate(action.cast_event_all.creatureId))
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event_all.creatureId);
- if (!sSpellStore.LookupEntry(action.cast_event_all.spellId))
+ if (!sSpellMgr->GetSpellInfo(action.cast_event_all.spellId))
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event_all.spellId);
break;
case ACTION_T_REMOVEAURASFROMSPELL:
- if (!sSpellStore.LookupEntry(action.remove_aura.spellId))
+ if (!sSpellMgr->GetSpellInfo(action.remove_aura.spellId))
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.remove_aura.spellId);
if (action.remove_aura.target >= TARGET_T_END)
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
index 470b4623ea2..84dad3a9b3f 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
@@ -164,7 +164,7 @@ void ScriptedAI::DoStopAttack()
me->AttackStop();
}
-void ScriptedAI::DoCastSpell(Unit* pTarget, SpellEntry const* pSpellInfo, bool bTriggered)
+void ScriptedAI::DoCastSpell(Unit* pTarget, SpellInfo const* pSpellInfo, bool bTriggered)
{
if (!pTarget || me->IsNonMeleeSpellCasted(false))
return;
@@ -192,7 +192,7 @@ Creature* ScriptedAI::DoSpawnCreature(uint32 entry, float offsetX, float offsetY
return me->SummonCreature(entry, me->GetPositionX() + offsetX, me->GetPositionY() + offsetY, me->GetPositionZ() + offsetZ, angle, TempSummonType(type), despawntime);
}
-SpellEntry const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mechanic, SelectTargetType targets, uint32 powerCostMin, uint32 powerCostMax, float rangeMin, float rangeMax, SelectEffect effects)
+SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mechanic, SelectTargetType targets, uint32 powerCostMin, uint32 powerCostMax, float rangeMin, float rangeMax, SelectEffect effects)
{
//No target so we can't cast
if (!target)
@@ -203,18 +203,18 @@ SpellEntry const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 me
return false;
//Using the extended script system we first create a list of viable spells
- SpellEntry const* apSpell[CREATURE_MAX_SPELLS];
- memset(apSpell, 0, CREATURE_MAX_SPELLS * sizeof(SpellEntry*));
+ SpellInfo const* apSpell[CREATURE_MAX_SPELLS];
+ memset(apSpell, 0, CREATURE_MAX_SPELLS * sizeof(SpellInfo*));
uint32 spellCount = 0;
- SpellEntry const* tempSpell = NULL;
+ SpellInfo const* tempSpell = NULL;
SpellRangeEntry const* tempRange = NULL;
//Check if each spell is viable(set it to null if not)
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; i++)
{
- tempSpell = sSpellStore.LookupEntry(me->m_spells[i]);
+ tempSpell = sSpellMgr->GetSpellInfo(me->m_spells[i]);
//This spell doesn't exist
if (!tempSpell)
@@ -238,31 +238,24 @@ SpellEntry const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 me
continue;
//Make sure that the spell uses the requested amount of power
- if (powerCostMin && tempSpell->manaCost < powerCostMin)
+ if (powerCostMin && tempSpell->ManaCost < powerCostMin)
continue;
- if (powerCostMax && tempSpell->manaCost > powerCostMax)
+ if (powerCostMax && tempSpell->ManaCost > powerCostMax)
continue;
//Continue if we don't have the mana to actually cast this spell
- if (tempSpell->manaCost > me->GetPower(Powers(tempSpell->powerType)))
- continue;
-
- //Get the Range
- tempRange = GetSpellRangeStore()->LookupEntry(tempSpell->rangeIndex);
-
- //Spell has invalid range store so we can't use it
- if (!tempRange)
+ if (tempSpell->ManaCost > me->GetPower(Powers(tempSpell->PowerType)))
continue;
//Check if the spell meets our range requirements
- if (rangeMin && me->GetSpellMinRangeForTarget(target, tempRange) < rangeMin)
+ if (rangeMin && me->GetSpellMinRangeForTarget(target, tempSpell) < rangeMin)
continue;
- if (rangeMax && me->GetSpellMaxRangeForTarget(target, tempRange) > rangeMax)
+ if (rangeMax && me->GetSpellMaxRangeForTarget(target, tempSpell) > rangeMax)
continue;
//Check if our target is in range
- if (me->IsWithinDistInMap(target, float(me->GetSpellMinRangeForTarget(target, tempRange))) || !me->IsWithinDistInMap(target, float(me->GetSpellMaxRangeForTarget(target, tempRange))))
+ if (me->IsWithinDistInMap(target, float(me->GetSpellMinRangeForTarget(target, tempSpell))) || !me->IsWithinDistInMap(target, float(me->GetSpellMaxRangeForTarget(target, tempSpell))))
continue;
//All good so lets add it to the spell list
@@ -277,7 +270,7 @@ SpellEntry const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 me
return apSpell[urand(0, spellCount - 1)];
}
-bool ScriptedAI::CanCast(Unit* target, SpellEntry const* spell, bool triggered /*= false*/)
+bool ScriptedAI::CanCast(Unit* target, SpellInfo const* spell, bool triggered /*= false*/)
{
//No target so we can't cast
if (!target || !spell)
@@ -288,17 +281,11 @@ bool ScriptedAI::CanCast(Unit* target, SpellEntry const* spell, bool triggered /
return false;
//Check for power
- if (!triggered && me->GetPower(Powers(spell->powerType)) < spell->manaCost)
- return false;
-
- SpellRangeEntry const* tempRange = GetSpellRangeStore()->LookupEntry(spell->rangeIndex);
-
- //Spell has invalid range store so we can't use it
- if (!tempRange)
+ if (!triggered && me->GetPower(Powers(spell->PowerType)) < spell->ManaCost)
return false;
//Unit is out of range of this spell
- if (me->IsInRange(target, float(me->GetSpellMinRangeForTarget(target, tempRange)), float(me->GetSpellMaxRangeForTarget(target, tempRange))))
+ if (me->IsInRange(target, float(me->GetSpellMinRangeForTarget(target, spell)), float(me->GetSpellMaxRangeForTarget(target, spell))))
return false;
return true;
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
index b124f8d2fd6..e1de1fe091b 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
@@ -28,8 +28,6 @@
#define CAST_CRE(a) (dynamic_cast<Creature*>(a))
#define CAST_AI(a, b) (dynamic_cast<a*>(b))
-#define GET_SPELL(a) (const_cast<SpellEntry*>(GetSpellStore()->LookupEntry(a)))
-
class InstanceScript;
class SummonList : public std::list<uint64>
@@ -78,10 +76,10 @@ struct ScriptedAI : public CreatureAI
void SummonedCreatureDespawn(Creature* /*summon*/) {}
// Called when hit by a spell
- void SpellHit(Unit* /*caster*/, SpellEntry const* /*spell*/) {}
+ void SpellHit(Unit* /*caster*/, SpellInfo const* /*spell*/) {}
// Called when spell hits a target
- void SpellHitTarget(Unit* /*target*/, SpellEntry const* /*spell*/) {}
+ void SpellHitTarget(Unit* /*target*/, SpellInfo const* /*spell*/) {}
//Called at waypoint reached or PointMovement end
void MovementInform(uint32 /*type*/, uint32 /*id*/) {}
@@ -123,7 +121,7 @@ struct ScriptedAI : public CreatureAI
void DoStopAttack();
//Cast spell by spell info
- void DoCastSpell(Unit* target, SpellEntry const* spellInfo, bool triggered = false);
+ void DoCastSpell(Unit* target, SpellInfo const* spellInfo, bool triggered = false);
//Plays a sound to all nearby players
void DoPlaySoundToSet(WorldObject* source, uint32 soundId);
@@ -160,10 +158,10 @@ struct ScriptedAI : public CreatureAI
bool HealthAbovePct(uint32 pct) const { return me->HealthAbovePct(pct); }
//Returns spells that meet the specified criteria from the creatures spell list
- SpellEntry const* SelectSpell(Unit* target, uint32 school, uint32 mechanic, SelectTargetType targets, uint32 powerCostMin, uint32 powerCostMax, float rangeMin, float rangeMax, SelectEffect effect);
+ SpellInfo const* SelectSpell(Unit* target, uint32 school, uint32 mechanic, SelectTargetType targets, uint32 powerCostMin, uint32 powerCostMax, float rangeMin, float rangeMax, SelectEffect effect);
//Checks if you can cast the specified spell
- bool CanCast(Unit* target, SpellEntry const* spell, bool triggered = false);
+ bool CanCast(Unit* target, SpellInfo const* spell, bool triggered = false);
void SetEquipmentSlots(bool loadDefault, int32 mainHand = EQUIP_NO_CHANGE, int32 offHand = EQUIP_NO_CHANGE, int32 ranged = EQUIP_NO_CHANGE);
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 8719862a236..61e2e1e4216 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -606,12 +606,12 @@ void SmartAI::AttackStart(Unit* who)
}
}
-void SmartAI::SpellHit(Unit* pUnit, const SpellEntry* pSpell)
+void SmartAI::SpellHit(Unit* pUnit, const SpellInfo* pSpell)
{
GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT, pUnit, 0, 0, false, pSpell);
}
-void SmartAI::SpellHitTarget(Unit* target, const SpellEntry* pSpell)
+void SmartAI::SpellHitTarget(Unit* target, const SpellInfo* pSpell)
{
GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT_TARGET, target, 0, 0, false, pSpell);
}
diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h
index ff700ffa8e6..4dbea6c5575 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.h
+++ b/src/server/game/AI/SmartScripts/SmartAI.h
@@ -100,10 +100,10 @@ class SmartAI : public CreatureAI
void MoveInLineOfSight(Unit *who);
// Called when hit by a spell
- void SpellHit(Unit* pUnit, const SpellEntry* pSpell);
+ void SpellHit(Unit* pUnit, const SpellInfo* pSpell);
// Called when spell hits a target
- void SpellHitTarget(Unit* target, const SpellEntry* pSpell);
+ void SpellHitTarget(Unit* target, const SpellInfo* pSpell);
// Called at any Damage from any attacker (before damage apply)
void DamageTaken(Unit* done_by, uint32& damage);
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 6508b300b0e..22ecdc34f6b 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -74,7 +74,7 @@ void SmartScript::OnReset()
mLastInvoker = 0;
}
-void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellEntry* spell, GameObject* gob)
+void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellInfo* spell, GameObject* gob)
{
if (e == SMART_EVENT_AGGRO)
{
@@ -103,7 +103,7 @@ void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint3
}
}
-void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellEntry* spell, GameObject* gob)
+void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellInfo* spell, GameObject* gob)
{
//calc random
if (e.GetEventType() != SMART_EVENT_LINK && e.event.event_chance < 100 && e.event.event_chance)
@@ -2164,7 +2164,7 @@ ObjectList* SmartScript::GetWorldObjectsInDist(float dist)
return targets;
}
-void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellEntry* spell, GameObject* gob)
+void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellInfo* spell, GameObject* gob)
{
if (!e.active && e.GetEventType() != SMART_EVENT_LINK)
return;
diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h
index 1e3601dca3d..0ff6f9efefc 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.h
+++ b/src/server/game/AI/SmartScripts/SmartScript.h
@@ -40,13 +40,13 @@ class SmartScript
void GetScript();
void FillScript(SmartAIEventList e, WorldObject* obj, AreaTriggerEntry const* at);
- void ProcessEventsFor(SMART_EVENT e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellEntry* spell = NULL, GameObject* gob = NULL);
- void ProcessEvent(SmartScriptHolder& e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellEntry* spell = NULL, GameObject* gob = NULL);
+ void ProcessEventsFor(SMART_EVENT e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = NULL);
+ void ProcessEvent(SmartScriptHolder& e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = NULL);
bool CheckTimer(SmartScriptHolder const& e) const;
void RecalcTimer(SmartScriptHolder& e, uint32 min, uint32 max);
void UpdateTimer(SmartScriptHolder& e, uint32 const diff);
void InitTimer(SmartScriptHolder& e);
- void ProcessAction(SmartScriptHolder& e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellEntry* spell = NULL, GameObject* gob = NULL);
+ void ProcessAction(SmartScriptHolder& e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = NULL);
ObjectList* GetTargets(SmartScriptHolder const& e, Unit* invoker = NULL);
ObjectList* GetWorldObjectsInDist(float dist);
void InstallTemplate(SmartScriptHolder const& e);
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index b08aee787e8..99c804d3d2c 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -334,7 +334,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder &e)
case SMART_EVENT_SPELLHIT_TARGET:
if (e.event.spellHit.spell)
{
- SpellEntry const* pSpell = sSpellStore.LookupEntry(e.event.spellHit.spell);
+ SpellInfo const* pSpell = sSpellMgr->GetSpellInfo(e.event.spellHit.spell);
if (!pSpell)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index 690d722c048..4ab9a738707 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -1311,7 +1311,7 @@ class SmartAIMgr
bool IsSpellValid(SmartScriptHolder const& e, uint32 entry)
{
- if (!sSpellStore.LookupEntry(entry))
+ if (!sSpellMgr->GetSpellInfo(entry))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp
index a78f6d32b82..6cecdca5cc6 100755
--- a/src/server/game/Achievements/AchievementMgr.cpp
+++ b/src/server/game/Achievements/AchievementMgr.cpp
@@ -165,7 +165,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA:
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA:
{
- SpellEntry const* spellEntry = sSpellStore.LookupEntry(aura.spell_id);
+ SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(aura.spell_id);
if (!spellEntry)
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell id in value1 (%u), ignored.",
@@ -178,7 +178,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
criteria->ID, criteria->requiredType, (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->EffectApplyAuraName[aura.effect_idx])
+ if (!spellEntry->Effects[aura.effect_idx].ApplyAuraName)
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has non-aura spell effect (ID: %u Effect: %u), ignores.",
criteria->ID, criteria->requiredType, (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/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 3b96b842ff7..a3b208ee8a7 100755
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -465,7 +465,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
if (!aura->IsPermanent()
&& aura->GetDuration() <= 30*IN_MILLISECONDS
&& aurApp->IsPositive()
- && (!(aura->GetSpellProto()->Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY))
+ && (!(aura->GetSpellInfo()->Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY))
&& (!aura->HasEffectType(SPELL_AURA_MOD_INVISIBILITY)))
plr->RemoveAura(iter);
else
diff --git a/src/server/game/Chat/ChatLink.cpp b/src/server/game/Chat/ChatLink.cpp
index 218c4574639..30f8a4374f7 100644
--- a/src/server/game/Chat/ChatLink.cpp
+++ b/src/server/game/Chat/ChatLink.cpp
@@ -18,6 +18,7 @@
#include "ChatLink.h"
#include "SpellMgr.h"
#include "ObjectMgr.h"
+#include "SpellInfo.h"
// Supported shift-links (client generated and server side)
// |color|Hachievement:achievement_id:player_guid:0:0:0:0:0:0:0:0|h[name]|h|r
@@ -268,7 +269,7 @@ bool SpellChatLink::Initialize(std::istringstream& iss)
return false;
}
// Validate spell
- _spell = sSpellStore.LookupEntry(spellId);
+ _spell = sSpellMgr->GetSpellInfo(spellId);
if (!_spell)
{
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |spell command", iss.str().c_str(), spellId);
@@ -405,7 +406,7 @@ bool TradeChatLink::Initialize(std::istringstream& iss)
return false;
}
// Validate spell
- _spell = sSpellStore.LookupEntry(spellId);
+ _spell = sSpellMgr->GetSpellInfo(spellId);
if (!_spell)
{
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), spellId);
@@ -463,7 +464,7 @@ bool TalentChatLink::Initialize(std::istringstream& iss)
return false;
}
// Validate talent's spell
- _spell = sSpellStore.LookupEntry(talentInfo->RankID[0]);
+ _spell = sSpellMgr->GetSpellInfo(talentInfo->RankID[0]);
if (!_spell)
{
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), talentInfo->RankID[0]);
@@ -495,7 +496,7 @@ bool EnchantmentChatLink::Initialize(std::istringstream& iss)
return false;
}
// Validate spell
- _spell = sSpellStore.LookupEntry(spellId);
+ _spell = sSpellMgr->GetSpellInfo(spellId);
if (!_spell)
{
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |enchant command", iss.str().c_str(), spellId);
@@ -534,7 +535,7 @@ bool GlyphChatLink::Initialize(std::istringstream& iss)
return false;
}
// Validate glyph's spell
- _spell = sSpellStore.LookupEntry(_glyph->SpellId);
+ _spell = sSpellMgr->GetSpellInfo(_glyph->SpellId);
if (!_spell)
{
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |glyph command", iss.str().c_str(), _glyph->SpellId);
diff --git a/src/server/game/Chat/ChatLink.h b/src/server/game/Chat/ChatLink.h
index 6044672e225..4b27cab29d3 100644
--- a/src/server/game/Chat/ChatLink.h
+++ b/src/server/game/Chat/ChatLink.h
@@ -26,7 +26,7 @@ struct ItemLocale;
struct ItemTemplate;
struct ItemRandomSuffixEntry;
struct ItemRandomPropertiesEntry;
-struct SpellEntry;
+class SpellInfo;
struct AchievementEntry;
struct GlyphPropertiesEntry;
class Quest;
@@ -91,7 +91,7 @@ public:
virtual bool ValidateName(char* buffer, const char* context);
protected:
- SpellEntry const* _spell;
+ SpellInfo const* _spell;
};
// AchievementChatLink - link to quest
diff --git a/src/server/game/Chat/Commands/Level2.cpp b/src/server/game/Chat/Commands/Level2.cpp
index 587bba4d66f..8625a0ac23a 100755
--- a/src/server/game/Chat/Commands/Level2.cpp
+++ b/src/server/game/Chat/Commands/Level2.cpp
@@ -862,7 +862,7 @@ bool ChatHandler::HandlePetLearnCommand(const char* args)
uint32 spellId = extractSpellIdFromLink((char*)args);
- if (!spellId || !sSpellStore.LookupEntry(spellId))
+ if (!spellId || !sSpellMgr->GetSpellInfo(spellId))
return false;
// Check if pet already has it
@@ -874,7 +874,7 @@ bool ChatHandler::HandlePetLearnCommand(const char* args)
}
// Check if spell is valid
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo))
{
PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId);
diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp
index 1543bb3ea4c..2c80217befa 100755
--- a/src/server/game/Chat/Commands/Level3.cpp
+++ b/src/server/game/Chat/Commands/Level3.cpp
@@ -198,7 +198,7 @@ bool ChatHandler::HandleCooldownCommand(const char *args)
if (!spell_id)
return false;
- if (!sSpellStore.LookupEntry(spell_id))
+ if (!sSpellMgr->GetSpellInfo(spell_id))
{
PSendSysMessage(LANG_UNKNOWN_SPELL, target == m_session->GetPlayer() ? GetTrinityString(LANG_YOU) : tNameLink.c_str());
SetSentErrorMessage(true);
@@ -1000,9 +1000,9 @@ bool ChatHandler::HandleLookupSpellCommand(const char *args)
uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
// Search in Spell.dbc
- for (uint32 id = 0; id < sSpellStore.GetNumRows(); id++)
+ for (uint32 id = 0; id < sSpellMgr->GetSpellInfoStoreSize(); id++)
{
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(id);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(id);
if (spellInfo)
{
int loc = GetSessionDbcLocale();
@@ -1036,17 +1036,19 @@ bool ChatHandler::HandleLookupSpellCommand(const char *args)
}
bool known = target && target->HasSpell(id);
- bool learn = (spellInfo->Effect[0] == SPELL_EFFECT_LEARN_SPELL);
+ bool learn = (spellInfo->Effects[0].Effect == SPELL_EFFECT_LEARN_SPELL);
+
+ SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellInfo->Effects[0].TriggerSpell);
uint32 talentCost = GetTalentSpellCost(id);
bool talent = (talentCost > 0);
- bool passive = IsPassiveSpell(id);
+ bool passive = spellInfo->IsPassive();
bool active = target && target->HasAura(id);
// unit32 used to prevent interpreting uint8 as char at output
// find rank of learned spell for learning spell, or talent rank
- uint32 rank = talentCost ? talentCost : sSpellMgr->GetSpellRank(learn ? spellInfo->EffectTriggerSpell[0] : id);
+ uint32 rank = talentCost ? talentCost : learn ? learnSpellInfo->GetRank() : spellInfo->GetRank();
// send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format
std::ostringstream ss;
@@ -1915,7 +1917,7 @@ bool ChatHandler::HandleDamageCommand(const char * args)
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spellid = extractSpellIdFromLink((char*)args);
- if (!spellid || !sSpellStore.LookupEntry(spellid))
+ if (!spellid || !sSpellMgr->GetSpellInfo(spellid))
return false;
m_session->GetPlayer()->SpellNonMeleeDamageLog(target, spellid, damage);
@@ -1955,7 +1957,7 @@ bool ChatHandler::HandleAuraCommand(const char *args)
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spellID = extractSpellIdFromLink((char*)args);
- if (SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellID))
+ if (SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellID))
Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, target, target);
return true;
@@ -2407,7 +2409,7 @@ bool ChatHandler::HandleListAurasCommand (const char * /*args*/)
AuraApplication const* aurApp = itr->second;
Aura const* aura = aurApp->GetBase();
- char const* name = aura->GetSpellProto()->SpellName[GetSessionDbcLocale()];
+ char const* name = aura->GetSpellInfo()->SpellName[GetSessionDbcLocale()];
std::ostringstream ss_name;
ss_name << "|cffffffff|Hspell:" << aura->GetId() << "|h[" << name << "]|h|r";
@@ -3794,7 +3796,7 @@ bool ChatHandler::HandleCastCommand(const char *args)
if (!spell)
return false;
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
if (!spellInfo)
{
PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
@@ -3838,7 +3840,7 @@ bool ChatHandler::HandleCastBackCommand(const char *args)
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spell = extractSpellIdFromLink((char*)args);
- if (!spell || !sSpellStore.LookupEntry(spell))
+ if (!spell || !sSpellMgr->GetSpellInfo(spell))
{
PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
SetSentErrorMessage(true);
@@ -3872,7 +3874,7 @@ bool ChatHandler::HandleCastDistCommand(const char *args)
if (!spell)
return false;
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
if (!spellInfo)
{
PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
@@ -3931,7 +3933,7 @@ bool ChatHandler::HandleCastTargetCommand(const char *args)
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spell = extractSpellIdFromLink((char*)args);
- if (!spell || !sSpellStore.LookupEntry(spell))
+ if (!spell || !sSpellMgr->GetSpellInfo(spell))
{
PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
SetSentErrorMessage(true);
@@ -4005,7 +4007,7 @@ bool ChatHandler::HandleCastSelfCommand(const char *args)
if (!spell)
return false;
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
if (!spellInfo)
return false;
@@ -4502,7 +4504,7 @@ bool ChatHandler::HandleFreezeCommand(const char *args)
}
//m_session->GetPlayer()->CastSpell(player, spellID, false);
- if (SpellEntry const *spellInfo = sSpellStore.LookupEntry(9454))
+ if (SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(9454))
Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, player, player);
//save player
diff --git a/src/server/game/Combat/HostileRefManager.cpp b/src/server/game/Combat/HostileRefManager.cpp
index 91ba2d69037..f318e9b462b 100755
--- a/src/server/game/Combat/HostileRefManager.cpp
+++ b/src/server/game/Combat/HostileRefManager.cpp
@@ -21,6 +21,7 @@
#include "Unit.h"
#include "DBCStructure.h"
#include "SpellMgr.h"
+#include "SpellInfo.h"
HostileRefManager::~HostileRefManager()
{
@@ -32,7 +33,7 @@ HostileRefManager::~HostileRefManager()
// The pVictim is hated than by them as well
// use for buffs and healing threat functionality
-void HostileRefManager::threatAssist(Unit *pVictim, float fThreat, SpellEntry const *pThreatSpell, bool pSingleTarget)
+void HostileRefManager::threatAssist(Unit *pVictim, float fThreat, SpellInfo const *pThreatSpell, bool pSingleTarget)
{
HostileReference* ref;
@@ -40,7 +41,7 @@ void HostileRefManager::threatAssist(Unit *pVictim, float fThreat, SpellEntry co
ref = getFirst();
while (ref != NULL)
{
- float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, fThreat, (pThreatSpell ? GetSpellSchoolMask(pThreatSpell) : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell);
+ float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, fThreat, (pThreatSpell ? pThreatSpell->GetSchoolMask() : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell);
if (pVictim == getOwner())
ref->addThreat(threat / size); // It is faster to modify the threat durectly if possible
else
diff --git a/src/server/game/Combat/HostileRefManager.h b/src/server/game/Combat/HostileRefManager.h
index 0a8ad47642e..5ed15d609df 100755
--- a/src/server/game/Combat/HostileRefManager.h
+++ b/src/server/game/Combat/HostileRefManager.h
@@ -25,7 +25,7 @@
class Unit;
class ThreatManager;
class HostileReference;
-struct SpellEntry;
+class SpellInfo;
//=================================================
@@ -42,7 +42,7 @@ class HostileRefManager : public RefManager<Unit, ThreatManager>
// send threat to all my hateres for the pVictim
// The pVictim is hated than by them as well
// use for buffs and healing threat functionality
- void threatAssist(Unit *pVictim, float fThreat, SpellEntry const *threatSpell = 0, bool pSingleTarget = false);
+ void threatAssist(Unit *pVictim, float fThreat, SpellInfo const *threatSpell = 0, bool pSingleTarget = false);
void addTempThreat(float fThreat, bool apply);
diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp
index abf9ee05b53..1f06bb8dd9a 100755
--- a/src/server/game/Combat/ThreatManager.cpp
+++ b/src/server/game/Combat/ThreatManager.cpp
@@ -32,7 +32,7 @@
//==============================================================
// The pHatingUnit is not used yet
-float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* /*pHatingUnit*/, float fThreat, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell)
+float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* /*pHatingUnit*/, float fThreat, SpellSchoolMask schoolMask, SpellInfo const *pThreatSpell)
{
if (pThreatSpell)
{
@@ -355,7 +355,7 @@ void ThreatManager::clearReferences()
//============================================================
-void ThreatManager::addThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell)
+void ThreatManager::addThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask, SpellInfo const *pThreatSpell)
{
//function deals with adding threat and adding players and pets into ThreatList
//mobs, NPCs, guards have ThreatList and HateOfflineList
@@ -386,7 +386,7 @@ void ThreatManager::addThreat(Unit* pVictim, float fThreat, SpellSchoolMask scho
Unit *unit = pVictim->GetMisdirectionTarget();
if (unit)
if (Aura* pAura = unit->GetAura(63326)) // Glyph of Vigilance
- reducedThreadPercent += SpellMgr::CalculateSpellEffectAmount(pAura->GetSpellProto(), 0);
+ reducedThreadPercent += pAura->GetSpellInfo()->Effects[0].CalcValue();
float reducedThreat = threat * reducedThreadPercent / 100;
threat -= reducedThreat;
diff --git a/src/server/game/Combat/ThreatManager.h b/src/server/game/Combat/ThreatManager.h
index b8b3a2b7619..5e368f88320 100755
--- a/src/server/game/Combat/ThreatManager.h
+++ b/src/server/game/Combat/ThreatManager.h
@@ -32,7 +32,7 @@
class Unit;
class Creature;
class ThreatManager;
-struct SpellEntry;
+class SpellInfo;
#define THREAT_UPDATE_INTERVAL 1 * IN_MILLISECONDS // Server should send threat update to client periodically each second
@@ -42,7 +42,7 @@ struct SpellEntry;
class ThreatCalcHelper
{
public:
- static float calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL);
+ static float calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell = NULL);
};
//==============================================================
@@ -195,7 +195,7 @@ class ThreatManager
void clearReferences();
- void addThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL);
+ void addThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell = NULL);
void modifyThreatPercent(Unit *pVictim, int32 iPercent);
float getThreat(Unit *pVictim, bool pAlsoSearchOfflineList = false);
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index beeb06baca8..aca10df1ebe 100755
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -854,7 +854,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
return false;
}
- SpellEntry const* spellProto = sSpellStore.LookupEntry(cond->mSourceEntry);
+ SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cond->mSourceEntry);
if (!spellProto)
{
sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->mSourceEntry);
@@ -864,22 +864,22 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
bool targetfound = false;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- if (spellProto->EffectImplicitTargetA[i] == TARGET_UNIT_AREA_ENTRY_SRC ||
- spellProto->EffectImplicitTargetB[i] == TARGET_UNIT_AREA_ENTRY_SRC ||
- spellProto->EffectImplicitTargetA[i] == TARGET_UNIT_AREA_ENTRY_DST ||
- spellProto->EffectImplicitTargetB[i] == TARGET_UNIT_AREA_ENTRY_DST ||
- spellProto->EffectImplicitTargetA[i] == TARGET_UNIT_NEARBY_ENTRY ||
- spellProto->EffectImplicitTargetB[i] == TARGET_UNIT_NEARBY_ENTRY ||
- spellProto->EffectImplicitTargetA[i] == TARGET_GAMEOBJECT_NEARBY_ENTRY ||
- spellProto->EffectImplicitTargetB[i] == TARGET_GAMEOBJECT_NEARBY_ENTRY ||
- spellProto->EffectImplicitTargetA[i] == TARGET_GAMEOBJECT_AREA_SRC ||
- spellProto->EffectImplicitTargetB[i] == TARGET_GAMEOBJECT_AREA_SRC ||
- spellProto->EffectImplicitTargetA[i] == TARGET_GAMEOBJECT_AREA_DST ||
- spellProto->EffectImplicitTargetB[i] == TARGET_GAMEOBJECT_AREA_DST ||
- spellProto->EffectImplicitTargetA[i] == TARGET_DST_NEARBY_ENTRY ||
- spellProto->EffectImplicitTargetB[i] == TARGET_DST_NEARBY_ENTRY ||
- spellProto->EffectImplicitTargetA[i] == TARGET_UNIT_CONE_ENTRY ||
- spellProto->EffectImplicitTargetB[i] == TARGET_UNIT_CONE_ENTRY)
+ if (spellProto->Effects[i].TargetA == TARGET_UNIT_AREA_ENTRY_SRC ||
+ spellProto->Effects[i].TargetB == TARGET_UNIT_AREA_ENTRY_SRC ||
+ spellProto->Effects[i].TargetA == TARGET_UNIT_AREA_ENTRY_DST ||
+ spellProto->Effects[i].TargetB == TARGET_UNIT_AREA_ENTRY_DST ||
+ spellProto->Effects[i].TargetA == TARGET_UNIT_NEARBY_ENTRY ||
+ spellProto->Effects[i].TargetB == TARGET_UNIT_NEARBY_ENTRY ||
+ spellProto->Effects[i].TargetA == TARGET_GAMEOBJECT_NEARBY_ENTRY ||
+ spellProto->Effects[i].TargetB == TARGET_GAMEOBJECT_NEARBY_ENTRY ||
+ spellProto->Effects[i].TargetA == TARGET_GAMEOBJECT_AREA_SRC ||
+ spellProto->Effects[i].TargetB == TARGET_GAMEOBJECT_AREA_SRC ||
+ spellProto->Effects[i].TargetA == TARGET_GAMEOBJECT_AREA_DST ||
+ spellProto->Effects[i].TargetB == TARGET_GAMEOBJECT_AREA_DST ||
+ spellProto->Effects[i].TargetA == TARGET_DST_NEARBY_ENTRY ||
+ spellProto->Effects[i].TargetB == TARGET_DST_NEARBY_ENTRY ||
+ spellProto->Effects[i].TargetA == TARGET_UNIT_CONE_ENTRY ||
+ spellProto->Effects[i].TargetB == TARGET_UNIT_CONE_ENTRY)
{
targetfound = true;
//break;
@@ -899,7 +899,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
"TARGET_GAMEOBJECT_AREA_SRC(51), TARGET_GAMEOBJECT_AREA_DST(52)", cond->mSourceEntry);
return false;
}
- if ((cond->mConditionValue1 == SPELL_TARGET_TYPE_DEAD) && !IsAllowingDeadTargetSpell(spellProto))
+ if ((cond->mConditionValue1 == SPELL_TARGET_TYPE_DEAD) && !spellProto->IsAllowingDeadTarget())
{
sLog->outErrorDb("SourceEntry %u in `condition` table does have SPELL_TARGET_TYPE_DEAD specified but spell does not have SPELL_ATTR2_ALLOW_DEAD_TARGET", cond->mSourceEntry);
return false;
@@ -917,7 +917,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
}
case CONDITION_SOURCE_TYPE_SPELL:
{
- SpellEntry const* spellProto = sSpellStore.LookupEntry(cond->mSourceEntry);
+ SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cond->mSourceEntry);
if (!spellProto)
{
sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->mSourceEntry);
@@ -943,7 +943,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
bool bIsItemSpellValid = false;
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
{
- if (SpellEntry const* pSpellInfo = sSpellStore.LookupEntry(pItemProto->Spells[i].SpellId))
+ if (SpellInfo const* pSpellInfo = sSpellMgr->GetSpellInfo(pItemProto->Spells[i].SpellId))
{
if (pItemProto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE ||
pItemProto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE)
@@ -954,10 +954,10 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
for (int j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
- if (pSpellInfo->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ENEMY ||
- pSpellInfo->EffectImplicitTargetB[j] == TARGET_UNIT_TARGET_ENEMY ||
- pSpellInfo->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ANY ||
- pSpellInfo->EffectImplicitTargetB[j] == TARGET_UNIT_TARGET_ANY)
+ if (pSpellInfo->Effects[j].TargetA == TARGET_UNIT_TARGET_ENEMY ||
+ pSpellInfo->Effects[j].TargetB == TARGET_UNIT_TARGET_ENEMY ||
+ pSpellInfo->Effects[j].TargetA == TARGET_UNIT_TARGET_ANY ||
+ pSpellInfo->Effects[j].TargetB == TARGET_UNIT_TARGET_ANY)
{
bIsItemSpellValid = true;
break;
@@ -1005,7 +1005,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->mSourceGroup);
return false;
}
- SpellEntry const* spellProto = sSpellStore.LookupEntry(cond->mSourceEntry);
+ SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cond->mSourceEntry);
if (!spellProto)
{
sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->mSourceEntry);
@@ -1034,7 +1034,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
{
case CONDITION_AURA:
{
- if (!sSpellStore.LookupEntry(cond->mConditionValue1))
+ if (!sSpellMgr->GetSpellInfo(cond->mConditionValue1))
{
sLog->outErrorDb("Aura condition has non existing spell (Id: %d), skipped", cond->mConditionValue1);
return false;
@@ -1151,7 +1151,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
}
case CONDITION_NO_AURA:
{
- if (!sSpellStore.LookupEntry(cond->mConditionValue1))
+ if (!sSpellMgr->GetSpellInfo(cond->mConditionValue1))
{
sLog->outErrorDb("Aura condition has non existing spell (Id: %d), skipped", cond->mConditionValue1);
return false;
@@ -1320,7 +1320,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
}
case CONDITION_SPELL:
{
- if (!sSpellStore.LookupEntry(cond->mConditionValue1))
+ if (!sSpellMgr->GetSpellInfo(cond->mConditionValue1))
{
sLog->outErrorDb("Spell condition has non existing spell (Id: %d), skipped", cond->mConditionValue1);
return false;
diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp
index aa751c7fbe5..07f97ac67bf 100755
--- a/src/server/game/Conditions/DisableMgr.cpp
+++ b/src/server/game/Conditions/DisableMgr.cpp
@@ -78,7 +78,7 @@ void DisableMgr::LoadDisables()
{
case DISABLE_TYPE_SPELL:
{
- if (!(sSpellStore.LookupEntry(entry) || flags & SPELL_DISABLE_DEPRECATED_SPELL))
+ if (!(sSpellMgr->GetSpellInfo(entry) || flags & SPELL_DISABLE_DEPRECATED_SPELL))
{
sLog->outErrorDb("Spell entry %u from `disables` doesn't exist in dbc, skipped.", entry);
continue;
diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp
index 9e6ed638f59..8f42fa3a0f3 100755
--- a/src/server/game/DataStores/DBCStores.cpp
+++ b/src/server/game/DataStores/DBCStores.cpp
@@ -400,7 +400,7 @@ void LoadDBCStores(const std::string& dataPath)
SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId);
- if (spellInfo && IsPassiveSpell(spellInfo->Id))
+ if (spellInfo && spellInfo->Attributes & SPELL_ATTR0_PASSIVE)
{
for (uint32 i = 1; i < sCreatureFamilyStore.GetNumRows(); ++i)
{
@@ -860,7 +860,6 @@ uint32 const* GetTalentTabPages(uint8 cls)
// script support functions
DBCStorage <SoundEntriesEntry> const* GetSoundEntriesStore() { return &sSoundEntriesStore; }
- DBCStorage <SpellEntry> const* GetSpellStore() { return &sSpellStore; }
DBCStorage <SpellRangeEntry> const* GetSpellRangeStore() { return &sSpellRangeStore; }
DBCStorage <FactionEntry> const* GetFactionStore() { return &sFactionStore; }
DBCStorage <ItemEntry> const* GetItemDisplayStore() { return &sItemStore; }
diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h
index 396bd8ca98c..713bf5cf65c 100755
--- a/src/server/game/DataStores/DBCStores.h
+++ b/src/server/game/DataStores/DBCStores.h
@@ -173,7 +173,6 @@ void LoadDBCStores(const std::string& dataPath);
// script support functions
DBCStorage <SoundEntriesEntry> const* GetSoundEntriesStore();
- DBCStorage <SpellEntry> const* GetSpellStore();
DBCStorage <SpellRangeEntry> const* GetSpellRangeStore();
DBCStorage <FactionEntry> const* GetFactionStore();
DBCStorage <ItemEntry> const* GetItemDisplayStore();
diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h
index b4e6c39b4c6..fc99def193a 100755
--- a/src/server/game/DataStores/DBCStructure.h
+++ b/src/server/game/DataStores/DBCStructure.h
@@ -1491,7 +1491,7 @@ struct SpellEntry
uint32 AttributesEx4; // 8 m_attributesExD
uint32 AttributesEx5; // 9 m_attributesExE
uint32 AttributesEx6; // 10 m_attributesExF
- uint32 AttributesEx7; // 11 3.2.0 (0x20 - totems, 0x4 - paladin auras, etc...)
+ uint32 AttributesEx7; // 11 m_attributesExG
uint32 Stances; // 12 m_shapeshiftMask
// uint32 unk_320_2; // 13 3.2.0
uint32 StancesNot; // 14 m_shapeshiftExclude
@@ -1589,10 +1589,6 @@ struct SpellEntry
float EffectBonusMultiplier[MAX_SPELL_EFFECTS]; // 229-231 3.2.0
//uint32 spellDescriptionVariableID; // 232 3.2.0
//uint32 SpellDifficultyId; // 233 3.3.0
-
- private:
- // prevent creating custom entries (copy data from original in fact)
- SpellEntry(SpellEntry const&); // DON'T must have implementation
};
typedef std::set<uint32> SpellCategorySet;
@@ -1624,9 +1620,9 @@ struct SpellFocusObjectEntry
struct SpellRadiusEntry
{
uint32 ID;
- float radiusHostile;
+ float radiusMin;
//uint32 Unk //always 0
- float radiusFriend;
+ float radiusMax;
};
struct SpellRangeEntry
@@ -1635,7 +1631,7 @@ struct SpellRangeEntry
float minRangeHostile;
float minRangeFriend;
float maxRangeHostile;
- float maxRangeFriend; //friend means unattackable unit here
+ float maxRangeFriend;
uint32 type;
//char* Name[16]; // 7-23 unused
// 24 string flags, unused
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 6b53576cb19..40445dbc8fd 100755
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -1641,7 +1641,7 @@ void Creature::DespawnOrUnsummon(uint32 msTimeToDespawn /*= 0*/)
ForcedDespawn(msTimeToDespawn);
}
-bool Creature::IsImmunedToSpell(SpellEntry const* spellInfo)
+bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo)
{
if (!spellInfo)
return false;
@@ -1652,18 +1652,18 @@ bool Creature::IsImmunedToSpell(SpellEntry const* spellInfo)
return Unit::IsImmunedToSpell(spellInfo);
}
-bool Creature::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const
+bool Creature::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const
{
- if (GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->EffectMechanic[index] - 1)))
+ if (GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->Effects[index].Mechanic - 1)))
return true;
- if (GetCreatureInfo()->type == CREATURE_TYPE_MECHANICAL && spellInfo->Effect[index] == SPELL_EFFECT_HEAL)
+ if (GetCreatureInfo()->type == CREATURE_TYPE_MECHANICAL && spellInfo->Effects[index].Effect == SPELL_EFFECT_HEAL)
return true;
return Unit::IsImmunedToSpellEffect(spellInfo, index);
}
-SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
+SpellInfo const *Creature::reachWithSpellAttack(Unit *pVictim)
{
if (!pVictim)
return NULL;
@@ -1672,7 +1672,7 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
{
if (!m_spells[i])
continue;
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_spells[i]);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]);
if (!spellInfo)
{
sLog->outError("WORLD: unknown spell id %i", m_spells[i]);
@@ -1682,10 +1682,10 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
bool bcontinue = true;
for (uint32 j = 0; j < MAX_SPELL_EFFECTS; j++)
{
- if ((spellInfo->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE) ||
- (spellInfo->Effect[j] == SPELL_EFFECT_INSTAKILL) ||
- (spellInfo->Effect[j] == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) ||
- (spellInfo->Effect[j] == SPELL_EFFECT_HEALTH_LEECH)
+ if ((spellInfo->Effects[j].Effect == SPELL_EFFECT_SCHOOL_DAMAGE) ||
+ (spellInfo->Effects[j].Effect == SPELL_EFFECT_INSTAKILL) ||
+ (spellInfo->Effects[j].Effect == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) ||
+ (spellInfo->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH)
)
{
bcontinue = false;
@@ -1694,14 +1694,11 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
}
if (bcontinue) continue;
- if (spellInfo->manaCost > GetPower(POWER_MANA))
+ if (spellInfo->ManaCost > GetPower(POWER_MANA))
continue;
- SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex);
- float range = GetSpellMaxRangeForHostile(srange);
- float minrange = GetSpellMinRangeForHostile(srange);
+ float range = spellInfo->GetMaxRange(false);
+ float minrange = spellInfo->GetMinRange(false);
float dist = GetDistance(pVictim);
- //if (!isInFront(pVictim, range) && spellInfo->AttributesEx)
- // continue;
if (dist > range || dist < minrange)
continue;
if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
@@ -1713,7 +1710,7 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
return NULL;
}
-SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim)
+SpellInfo const *Creature::reachWithSpellCure(Unit *pVictim)
{
if (!pVictim)
return NULL;
@@ -1722,7 +1719,7 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim)
{
if (!m_spells[i])
continue;
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_spells[i]);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]);
if (!spellInfo)
{
sLog->outError("WORLD: unknown spell id %i", m_spells[i]);
@@ -1732,7 +1729,7 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim)
bool bcontinue = true;
for (uint32 j = 0; j < MAX_SPELL_EFFECTS; j++)
{
- if ((spellInfo->Effect[j] == SPELL_EFFECT_HEAL))
+ if ((spellInfo->Effects[j].Effect == SPELL_EFFECT_HEAL))
{
bcontinue = false;
break;
@@ -1740,11 +1737,11 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim)
}
if (bcontinue) continue;
- if (spellInfo->manaCost > GetPower(POWER_MANA))
+ if (spellInfo->ManaCost > GetPower(POWER_MANA))
continue;
- SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex);
- float range = GetSpellMaxRangeForFriend(srange);
- float minrange = GetSpellMinRangeForFriend(srange);
+
+ float range = spellInfo->GetMaxRange(true);
+ float minrange = spellInfo->GetMinRange(true);
float dist = GetDistance(pVictim);
//if (!isInFront(pVictim, range) && spellInfo->AttributesEx)
// continue;
@@ -2075,7 +2072,7 @@ bool Creature::LoadCreaturesAddon(bool reload)
{
for (std::vector<uint32>::const_iterator itr = cainfo->auras.begin(); itr != cainfo->auras.end(); ++itr)
{
- SpellEntry const *AdditionalSpellInfo = sSpellStore.LookupEntry(*itr);
+ SpellInfo const *AdditionalSpellInfo = sSpellMgr->GetSpellInfo(*itr);
if (!AdditionalSpellInfo)
{
sLog->outErrorDb("Creature (GUID: %u Entry: %u) has wrong spell %u defined in `auras` field.", GetGUIDLow(), GetEntry(), *itr);
@@ -2158,11 +2155,11 @@ void Creature::_AddCreatureCategoryCooldown(uint32 category, time_t apply_time)
void Creature::AddCreatureSpellCooldown(uint32 spellid)
{
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellInfo)
return;
- uint32 cooldown = GetSpellRecoveryTime(spellInfo);
+ uint32 cooldown = spellInfo->GetRecoveryTime();
if (Player *modOwner = GetSpellModOwner())
modOwner->ApplySpellMod(spellid, SPELLMOD_COOLDOWN, cooldown);
@@ -2175,7 +2172,7 @@ void Creature::AddCreatureSpellCooldown(uint32 spellid)
bool Creature::HasCategoryCooldown(uint32 spell_id) const
{
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id);
if (!spellInfo)
return false;
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index 3a5b2d1c5d1..9c3c0c4585e 100755
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -29,7 +29,7 @@
#include <list>
-struct SpellEntry;
+class SpellInfo;
class CreatureAI;
class Quest;
@@ -458,9 +458,9 @@ class Creature : public Unit, public GridObject<Creature>
bool isCanInteractWithBattleMaster(Player* player, bool msg) const;
bool isCanTrainingAndResetTalentsOf(Player* pPlayer) const;
bool canCreatureAttack(Unit const *pVictim, bool force = true) const;
- bool IsImmunedToSpell(SpellEntry const* spellInfo);
+ bool IsImmunedToSpell(SpellInfo const* spellInfo);
// redefine Unit::IsImmunedToSpell
- bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const;
+ bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const;
// redefine Unit::IsImmunedToSpellEffect
bool isElite() const
{
@@ -570,8 +570,8 @@ class Creature : public Unit, public GridObject<Creature>
void RemoveLootMode(uint16 lootMode) { m_LootMode &= ~lootMode; }
void ResetLootMode() { m_LootMode = LOOT_MODE_DEFAULT; }
- SpellEntry const *reachWithSpellAttack(Unit *pVictim);
- SpellEntry const *reachWithSpellCure(Unit *pVictim);
+ SpellInfo const *reachWithSpellAttack(Unit *pVictim);
+ SpellInfo const *reachWithSpellCure(Unit *pVictim);
uint32 m_spells[CREATURE_MAX_SPELLS];
CreatureSpellCooldowns m_CreatureSpellCooldowns;
diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.h b/src/server/game/Entities/DynamicObject/DynamicObject.h
index d764b5eafe0..419aaf9e83b 100755
--- a/src/server/game/Entities/DynamicObject/DynamicObject.h
+++ b/src/server/game/Entities/DynamicObject/DynamicObject.h
@@ -23,7 +23,7 @@
class Unit;
class Aura;
-struct SpellEntry;
+class SpellInfo;
enum DynamicObjectType
{
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 3a47729dea6..a48f1c774fe 100755
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -928,21 +928,11 @@ void GameObject::TriggeringLinkedGameObject(uint32 trapEntry, Unit* target)
if (!trapInfo || trapInfo->type != GAMEOBJECT_TYPE_TRAP)
return;
- SpellEntry const* trapSpell = sSpellStore.LookupEntry(trapInfo->trap.spellId);
+ SpellInfo const* trapSpell = sSpellMgr->GetSpellInfo(trapInfo->trap.spellId);
if (!trapSpell) // checked at load already
return;
- float range;
- SpellRangeEntry const* srentry = sSpellRangeStore.LookupEntry(trapSpell->rangeIndex);
- if (GetSpellMaxRangeForHostile(srentry) == GetSpellMaxRangeForFriend(srentry))
- range = GetSpellMaxRangeForHostile(srentry);
- else
- // get owner to check hostility of GameObject
- if (Unit *owner = GetOwner())
- range = (float)owner->GetSpellMaxRangeForTarget(target, srentry);
- else
- // if no owner assume that object is hostile to target
- range = GetSpellMaxRangeForHostile(srentry);
+ float range = float(target->GetSpellMaxRangeForTarget(GetOwner(), trapSpell));
// search nearest linked GO
GameObject* trapGO = NULL;
@@ -1593,7 +1583,7 @@ void GameObject::Use(Unit* user)
if (!spellId)
return;
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
if (user->GetTypeId() != TYPEID_PLAYER || !sOutdoorPvPMgr->HandleCustomSpell(user->ToPlayer(), spellId, this))
@@ -1611,14 +1601,14 @@ void GameObject::Use(Unit* user)
void GameObject::CastSpell(Unit* target, uint32 spellId)
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
return;
bool self = false;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- if (spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_CASTER)
+ if (spellInfo->Effects[i].TargetA == TARGET_UNIT_CASTER)
{
self = true;
break;
@@ -1633,7 +1623,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId)
}
//summon world trigger
- Creature* trigger = SummonTrigger(GetPositionX(), GetPositionY(), GetPositionZ(), 0, GetSpellCastTime(spellInfo) + 100);
+ Creature* trigger = SummonTrigger(GetPositionX(), GetPositionY(), GetPositionZ(), 0, spellInfo->CalcCastTime() + 100);
if (!trigger)
return;
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index 67e9f4d8607..81fb6079c18 100755
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -23,6 +23,7 @@
#include "DatabaseEnv.h"
#include "ItemEnchantmentMgr.h"
#include "SpellMgr.h"
+#include "SpellInfo.h"
#include "ScriptMgr.h"
#include "ConditionMgr.h"
@@ -93,7 +94,7 @@ void AddItemsSetItem(Player* player, Item* item)
{
if (!eff->spells[y]) // free slot
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(set->spells[x]);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(set->spells[x]);
if (!spellInfo)
{
sLog->outError("WORLD: unknown spell id %u in items set %u effects", set->spells[x], setid);
@@ -833,7 +834,7 @@ InventoryResult Item::CanBeMergedPartlyWith(ItemTemplate const* proto) const
return EQUIP_ERR_OK;
}
-bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const
+bool Item::IsFitToSpellRequirements(SpellInfo const* spellInfo) const
{
ItemTemplate const* proto = GetTemplate();
@@ -842,7 +843,7 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const
// Special case - accept vellum for armor/weapon requirements
if ((spellInfo->EquippedItemClass == ITEM_CLASS_ARMOR && proto->IsArmorVellum())
||(spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON && proto->IsWeaponVellum()))
- if (sSpellMgr->IsSkillTypeSpell(spellInfo->Id, SKILL_ENCHANTING)) // only for enchanting spells
+ if (spellInfo->IsAbilityOfSkillType(SKILL_ENCHANTING)) // only for enchanting spells
return true;
if (spellInfo->EquippedItemClass != int32(proto->Class))
diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h
index 46dce2cf744..c3c6b999fcc 100755
--- a/src/server/game/Entities/Item/Item.h
+++ b/src/server/game/Entities/Item/Item.h
@@ -25,7 +25,7 @@
#include "ItemPrototype.h"
#include "DatabaseEnv.h"
-struct SpellEntry;
+class SpellInfo;
class Bag;
class Unit;
@@ -33,7 +33,7 @@ struct ItemSetEffect
{
uint32 setid;
uint32 item_count;
- SpellEntry const *spells[8];
+ SpellInfo const *spells[8];
};
enum InventoryResult
@@ -267,7 +267,7 @@ class Item : public Object
bool HasEnchantRequiredSkill(const Player *pPlayer) const;
uint32 GetEnchantRequiredLevel() const;
- bool IsFitToSpellRequirements(SpellEntry const* spellInfo) const;
+ bool IsFitToSpellRequirements(SpellInfo const* spellInfo) const;
bool IsTargetValidForItemUse(Unit* pUnitTarget);
bool IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const;
bool GemsFitSockets() const;
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index baffe4cd0f4..fc9d7f64545 100755
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -138,9 +138,9 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
return false;
uint32 summon_spell_id = fields[15].GetUInt32();
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(summon_spell_id);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(summon_spell_id);
- bool is_temporary_summoned = spellInfo && GetSpellDuration(spellInfo) > 0;
+ bool is_temporary_summoned = spellInfo && spellInfo->GetDuration() > 0;
// check temporary summoned pets like mage water elemental
if (current && is_temporary_summoned)
@@ -632,45 +632,6 @@ HappinessState Pet::GetHappinessState()
return CONTENT;
}
-bool Pet::CanTakeMoreActiveSpells(uint32 spellid)
-{
- uint8 activecount = 1;
- uint32 chainstartstore[ACTIVE_SPELLS_MAX];
-
- if (IsPassiveSpell(spellid))
- return true;
-
- chainstartstore[0] = sSpellMgr->GetFirstSpellInChain(spellid);
-
- for (PetSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
- {
- if (itr->second.state == PETSPELL_REMOVED)
- continue;
-
- if (IsPassiveSpell(itr->first))
- continue;
-
- uint32 chainstart = sSpellMgr->GetFirstSpellInChain(itr->first);
-
- uint8 x;
-
- for (x = 0; x < activecount; x++)
- {
- if (chainstart == chainstartstore[x])
- break;
- }
-
- if (x == activecount) //spellchain not yet saved -> add active count
- {
- ++activecount;
- if (activecount > ACTIVE_SPELLS_MAX)
- return false;
- chainstartstore[x] = chainstart;
- }
- }
- return true;
-}
-
void Pet::Remove(PetSaveMode mode, bool returnreagent)
{
m_owner->RemovePet(this, mode, returnreagent);
@@ -1088,7 +1049,7 @@ void Pet::_LoadSpellCooldowns()
uint32 spell_id = fields[0].GetUInt32();
time_t db_time = time_t(fields[1].GetUInt32());
- if (!sSpellStore.LookupEntry(spell_id))
+ if (!sSpellMgr->GetSpellInfo(spell_id))
{
sLog->outError("Pet %u have unknown spell %u in `pet_spell_cooldown`, skipping.", m_charmInfo->GetPetNumber(), spell_id);
continue;
@@ -1205,15 +1166,15 @@ void Pet::_LoadAuras(uint32 timediff)
int32 remaintime = fields[12].GetInt32();
uint8 remaincharges = fields[13].GetUInt8();
- SpellEntry const* spellproto = sSpellStore.LookupEntry(spellid);
- if (!spellproto)
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
+ if (!spellInfo)
{
sLog->outError("Unknown aura (spellid %u), ignore.", spellid);
continue;
}
// negative effects should continue counting down after logout
- if (remaintime != -1 && !IsPositiveSpell(spellid))
+ if (remaintime != -1 && !spellInfo->IsPositive())
{
if (remaintime/IN_MILLISECONDS <= int32(timediff))
continue;
@@ -1222,15 +1183,15 @@ void Pet::_LoadAuras(uint32 timediff)
}
// prevent wrong values of remaincharges
- if (spellproto->procCharges)
+ if (spellInfo->ProcCharges)
{
- if (remaincharges <= 0 || remaincharges > spellproto->procCharges)
- remaincharges = spellproto->procCharges;
+ if (remaincharges <= 0 || remaincharges > spellInfo->ProcCharges)
+ remaincharges = spellInfo->ProcCharges;
}
else
remaincharges = 0;
- if (Aura* aura = Aura::TryCreate(spellproto, effmask, this, NULL, &baseDamage[0], NULL, caster_guid))
+ if (Aura* aura = Aura::TryCreate(spellInfo, effmask, this, NULL, &baseDamage[0], NULL, caster_guid))
{
if (!aura->CanBeSaved())
{
@@ -1239,7 +1200,7 @@ void Pet::_LoadAuras(uint32 timediff)
}
aura->SetLoadedState(maxduration, remaintime, remaincharges, stackcount, recalculatemask, &damage[0]);
aura->ApplyForTargets();
- sLog->outDetail("Added aura spellid %u, effectmask %u", spellproto->Id, effmask);
+ sLog->outDetail("Added aura spellid %u, effectmask %u", spellInfo->Id, effmask);
}
}
while (result->NextRow());
@@ -1289,7 +1250,7 @@ void Pet::_SaveAuras(SQLTransaction& trans)
bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpellState state /*= PETSPELL_NEW*/, PetSpellType type /*= PETSPELL_NORMAL*/)
{
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id);
if (!spellInfo)
{
// do pet spell book cleanup
@@ -1318,9 +1279,9 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
itr->second.state = PETSPELL_UNCHANGED;
if (active == ACT_ENABLED)
- ToggleAutocast(spell_id, true);
+ ToggleAutocast(spellInfo, true);
else if (active == ACT_DISABLED)
- ToggleAutocast(spell_id, false);
+ ToggleAutocast(spellInfo, false);
return false;
}
@@ -1334,7 +1295,7 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
if (active == ACT_DECIDE) // active was not used before, so we save it's autocast/passive state here
{
- if (IsAutocastableSpell(spell_id))
+ if (spellInfo->IsAutocastable())
newspell.active = ACT_DISABLED;
else
newspell.active = ACT_PASSIVE;
@@ -1361,27 +1322,32 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
}
}
}
- else if (sSpellMgr->GetSpellRank(spell_id) != 0)
+ else if (spellInfo->IsRanked())
{
for (PetSpellMap::const_iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2)
{
if (itr2->second.state == PETSPELL_REMOVED) continue;
- if (sSpellMgr->IsRankSpellDueToSpell(spellInfo, itr2->first))
+ SpellInfo const* oldRankSpellInfo = sSpellMgr->GetSpellInfo(itr2->first);
+
+ if (!oldRankSpellInfo)
+ continue;
+
+ if (spellInfo->IsDifferentRankOf(oldRankSpellInfo))
{
// replace by new high rank
- if (sSpellMgr->IsHighRankOfSpell(spell_id, itr2->first))
+ if (spellInfo->IsHighRankOf(oldRankSpellInfo))
{
newspell.active = itr2->second.active;
if (newspell.active == ACT_ENABLED)
- ToggleAutocast(itr2->first, false);
+ ToggleAutocast(oldRankSpellInfo, false);
unlearnSpell(itr2->first, false, false);
break;
}
// ignore new lesser rank
- else if (sSpellMgr->IsHighRankOfSpell(itr2->first, spell_id))
+ else
return false;
}
}
@@ -1389,13 +1355,13 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
m_spells[spell_id] = newspell;
- if (IsPassiveSpell(spell_id) && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState))))
+ if (spellInfo->IsPassive() && (!spellInfo->CasterAuraState || HasAuraState(AuraStateType(spellInfo->CasterAuraState))))
CastSpell(this, spell_id, true);
else
- m_charmInfo->AddSpellToActionBar(spell_id);
+ m_charmInfo->AddSpellToActionBar(spellInfo);
if (newspell.active == ACT_ENABLED)
- ToggleAutocast(spell_id, true);
+ ToggleAutocast(spellInfo, true);
uint32 talentCost = GetTalentSpellCost(spell_id);
if (talentCost)
@@ -1450,12 +1416,12 @@ void Pet::InitLevelupSpellsForLevel()
{
for (uint8 i = 0; i < MAX_CREATURE_SPELL_DATA_SLOT; ++i)
{
- SpellEntry const* spellEntry = sSpellStore.LookupEntry(defSpells->spellid[i]);
+ SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(defSpells->spellid[i]);
if (!spellEntry)
continue;
// will called first if level down
- if (spellEntry->spellLevel > level)
+ if (spellEntry->SpellLevel > level)
unlearnSpell(spellEntry->Id, true);
// will called if level up
else
@@ -1539,7 +1505,10 @@ void Pet::CleanupActionBar()
if (!HasSpell(ab->GetAction()))
m_charmInfo->SetActionBar(i, 0, ACT_PASSIVE);
else if (ab->GetType() == ACT_ENABLED)
- ToggleAutocast(ab->GetAction(), true);
+ {
+ if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(ab->GetAction()))
+ ToggleAutocast(spellInfo, true);
+ }
}
}
@@ -1735,11 +1704,13 @@ uint8 Pet::GetMaxTalentPointsForLevel(uint8 level)
return points;
}
-void Pet::ToggleAutocast(uint32 spellid, bool apply)
+void Pet::ToggleAutocast(SpellInfo const* spellInfo, bool apply)
{
- if (!IsAutocastableSpell(spellid))
+ if (!spellInfo->IsAutocastable())
return;
+ uint32 spellid = spellInfo->Id;
+
PetSpellMap::iterator itr = m_spells.find(spellid);
if (itr == m_spells.end())
return;
diff --git a/src/server/game/Entities/Pet/Pet.h b/src/server/game/Entities/Pet/Pet.h
index 172151ac85a..75e79fbc502 100755
--- a/src/server/game/Entities/Pet/Pet.h
+++ b/src/server/game/Entities/Pet/Pet.h
@@ -176,8 +176,7 @@ class Pet : public Guardian
void UpdateDamagePhysical(WeaponAttackType attType);
*/
- bool CanTakeMoreActiveSpells(uint32 SpellIconID);
- void ToggleAutocast(uint32 spellid, bool apply);
+ void ToggleAutocast(SpellInfo const* spellInfo, bool apply);
bool HasSpell(uint32 spell) const;
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 0534500fb33..786aa71e297 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -3298,7 +3298,7 @@ void Player::SendInitialSpells()
data << uint16(spellCooldowns);
for (SpellCooldowns::const_iterator itr=m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); ++itr)
{
- SpellEntry const *sEntry = sSpellStore.LookupEntry(itr->first);
+ SpellInfo const *sEntry = sSpellMgr->GetSpellInfo(itr->first);
if (!sEntry)
continue;
@@ -3406,7 +3406,7 @@ void Player::AddNewMailDeliverTime(time_t deliver_time)
bool Player::AddTalent(uint32 spell_id, uint8 spec, bool learning)
{
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id);
if (!spellInfo)
{
// do character spell book cleanup (all characters)
@@ -3469,7 +3469,7 @@ bool Player::AddTalent(uint32 spell_id, uint8 spec, bool learning)
bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependent, bool disabled, bool loading /*=false*/)
{
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id);
if (!spellInfo)
{
// do character spell book cleanup (all characters)
@@ -3513,7 +3513,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
{
uint32 next_active_spell_id = 0;
// fix activate state for non-stackable low rank (and find next spell for !active case)
- if (!SpellMgr::canStackSpellRanks(spellInfo) && sSpellMgr->GetSpellRank(spellInfo->Id) != 0)
+ if (!spellInfo->IsStackableWithRanks() && spellInfo->IsRanked())
{
if (uint32 next = sSpellMgr->GetNextSpellInChain(spell_id))
{
@@ -3557,7 +3557,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
if (active)
{
- if (IsPassiveSpell(spell_id) && IsNeedCastPassiveSpellAtLearn(spellInfo))
+ if (spellInfo->IsPassive() && IsNeedCastPassiveSpellAtLearn(spellInfo))
CastSpell (this, spell_id, true);
}
else if (IsInWorld())
@@ -3648,19 +3648,19 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
newspell->disabled = disabled;
// replace spells in action bars and spellbook to bigger rank if only one spell rank must be accessible
- if (newspell->active && !newspell->disabled && !SpellMgr::canStackSpellRanks(spellInfo) && sSpellMgr->GetSpellRank(spellInfo->Id) != 0)
+ if (newspell->active && !newspell->disabled && !spellInfo->IsStackableWithRanks() && spellInfo->IsRanked() != 0)
{
for (PlayerSpellMap::iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2)
{
if (itr2->second->state == PLAYERSPELL_REMOVED) continue;
- SpellEntry const *i_spellInfo = sSpellStore.LookupEntry(itr2->first);
+ SpellInfo const *i_spellInfo = sSpellMgr->GetSpellInfo(itr2->first);
if (!i_spellInfo) continue;
- if (sSpellMgr->IsRankSpellDueToSpell(spellInfo, itr2->first))
+ if (spellInfo->IsDifferentRankOf(i_spellInfo))
{
if (itr2->second->active)
{
- if (sSpellMgr->IsHighRankOfSpell(spell_id, itr2->first))
+ if (spellInfo->IsHighRankOf(i_spellInfo))
{
if (IsInWorld()) // not send spell (re-/over-)learn packets at loading
{
@@ -3676,7 +3676,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
itr2->second->state = PLAYERSPELL_CHANGED;
superceded_old = true; // new spell replace old in action bars and spell book.
}
- else if (sSpellMgr->IsHighRankOfSpell(itr2->first, spell_id))
+ else
{
if (IsInWorld()) // not send spell (re-/over-)learn packets at loading
{
@@ -3707,18 +3707,18 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
// cast talents with SPELL_EFFECT_LEARN_SPELL (other dependent spells will learned later as not auto-learned)
// note: all spells with SPELL_EFFECT_LEARN_SPELL isn't passive
- if (!loading && talentCost > 0 && IsSpellHaveEffect(spellInfo, SPELL_EFFECT_LEARN_SPELL))
+ if (!loading && talentCost > 0 && spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL))
{
// ignore stance requirement for talent learn spell (stance set for spell only for client spell description show)
CastSpell(this, spell_id, true);
}
// also cast passive spells (including all talents without SPELL_EFFECT_LEARN_SPELL) with additional checks
- else if (IsPassiveSpell(spell_id))
+ else if (spellInfo->IsPassive())
{
if (IsNeedCastPassiveSpellAtLearn(spellInfo))
CastSpell(this, spell_id, true);
}
- else if (IsSpellHaveEffect(spellInfo, SPELL_EFFECT_SKILL_STEP))
+ else if (spellInfo->HasEffect(SPELL_EFFECT_SKILL_STEP))
{
CastSpell(this, spell_id, true);
return false;
@@ -3730,7 +3730,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
// update free primary prof.points (if any, can be none in case GM .learn prof. learning)
if (uint32 freeProfs = GetFreePrimaryProfessionPoints())
{
- if (sSpellMgr->IsPrimaryProfessionFirstRankSpell(spell_id))
+ if (spellInfo->IsPrimaryProfessionFirstRank())
SetFreePrimaryProfessions(freeProfs-1);
}
@@ -3767,8 +3767,8 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
if (!Has310Flyer(false) && pSkill->id == SKILL_MOUNTS)
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
- SpellMgr::CalculateSpellEffectAmount(spellInfo, i) == 310)
+ if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
+ spellInfo->Effects[i].CalcValue() == 310)
SetHas310Flyer(true);
if (HasSkill(pSkill->id))
@@ -3854,7 +3854,7 @@ void Player::RemoveTemporarySpell(uint32 spellId)
m_spells.erase(itr);
}
-bool Player::IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const
+bool Player::IsNeedCastPassiveSpellAtLearn(SpellInfo const* spellInfo) const
{
// note: form passives activated with shapeshift spells be implemented by HandleShapeshiftBoosts instead of spell_learn_spell
// talent dependent passives activated at form apply have proper stance data
@@ -3863,7 +3863,7 @@ bool Player::IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const
(!form && (spellInfo->AttributesEx2 & SPELL_ATTR2_NOT_NEED_SHAPESHIFT)));
//Check CasterAuraStates
- return need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState)));
+ return need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraStateType(spellInfo->CasterAuraState)));
}
void Player::learnSpell(uint32 spell_id, bool dependent)
@@ -3887,12 +3887,11 @@ void Player::learnSpell(uint32 spell_id, bool dependent)
// learn all disabled higher ranks and required spells (recursive)
if (disabled)
{
- SpellChainNode const* node = sSpellMgr->GetSpellChainNode(spell_id);
- if (node)
+ if (uint32 nextSpell = sSpellMgr->GetNextSpellInChain(spell_id))
{
- PlayerSpellMap::iterator iter = m_spells.find(node->next);
+ PlayerSpellMap::iterator iter = m_spells.find(nextSpell);
if (iter != m_spells.end() && iter->second->disabled)
- learnSpell(node->next, false);
+ learnSpell(nextSpell, false);
}
SpellsRequiringSpellMapBounds spellsRequiringSpell = sSpellMgr->GetSpellsRequiringSpellBounds(spell_id);
@@ -3915,10 +3914,10 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
return;
// unlearn non talent higher ranks (recursive)
- if (SpellChainNode const* node = sSpellMgr->GetSpellChainNode(spell_id))
+ if (uint32 nextSpell = sSpellMgr->GetNextSpellInChain(spell_id))
{
- if (HasSpell(node->next) && !GetTalentSpellPos(node->next))
- removeSpell(node->next, disabled, false);
+ if (HasSpell(nextSpell) && !GetTalentSpellPos(nextSpell))
+ removeSpell(nextSpell, disabled, false);
}
//unlearn spells dependent from recently removed spells
SpellsRequiringSpellMapBounds spellsRequiringSpell = sSpellMgr->GetSpellsRequiringSpellBounds(spell_id);
@@ -3970,7 +3969,8 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
}
// update free primary prof.points (if not overflow setting, can be in case GM use before .learn prof. learning)
- if (sSpellMgr->IsPrimaryProfessionFirstRankSpell(spell_id))
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id);
+ if (spellInfo && spellInfo->IsPrimaryProfessionFirstRank())
{
uint32 freeProfs = GetFreePrimaryProfessionPoints()+1;
if (freeProfs <= sWorld->getIntConfig(CONFIG_MAX_PRIMARY_TRADE_SKILL))
@@ -4041,10 +4041,10 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
// most likely will never be used, haven't heard of cases where players unlearn a mount
if (Has310Flyer(false) && _spell_idx->second->skillId == SKILL_MOUNTS)
{
- SpellEntry const *pSpellInfo = sSpellStore.LookupEntry(spell_id);
+ SpellInfo const *pSpellInfo = sSpellMgr->GetSpellInfo(spell_id);
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (pSpellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
- SpellMgr::CalculateSpellEffectAmount(pSpellInfo, i) == 310)
+ if (pSpellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
+ pSpellInfo->Effects[i].CalcValue() == 310)
Has310Flyer(true, spell_id); // with true as first argument its also used to set/remove the flag
}
}
@@ -4059,9 +4059,9 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
// activate lesser rank in spellbook/action bar, and cast it if need
bool prev_activate = false;
- if (uint32 prev_id = sSpellMgr->GetPrevSpellInChain (spell_id))
+ if (uint32 prev_id = sSpellMgr->GetPrevSpellInChain(spell_id))
{
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id);
// if talent then lesser rank also talent and need learn
if (talentCosts)
@@ -4071,7 +4071,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
// learnSpell(prev_id, false);
}
// if ranked non-stackable spell: need activate lesser rank and update dendence state
- else if (cur_active && !SpellMgr::canStackSpellRanks(spellInfo) && sSpellMgr->GetSpellRank(spellInfo->Id) != 0)
+ else if (cur_active && !spellInfo->IsStackableWithRanks() && spellInfo->IsRanked())
{
// need manually update dependence state (learn spell ignore like attempts)
PlayerSpellMap::iterator prev_itr = m_spells.find(prev_id);
@@ -4125,7 +4125,7 @@ bool Player::Has310Flyer(bool checkAllSpells, uint32 excludeSpellId)
else
{
SetHas310Flyer(false);
- SpellEntry const *pSpellInfo;
+ SpellInfo const *pSpellInfo;
for (PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
{
if (itr->first == excludeSpellId)
@@ -4137,10 +4137,10 @@ bool Player::Has310Flyer(bool checkAllSpells, uint32 excludeSpellId)
if (_spell_idx->second->skillId != SKILL_MOUNTS)
break; // We can break because mount spells belong only to one skillline (at least 310 flyers do)
- pSpellInfo = sSpellStore.LookupEntry(itr->first);
+ pSpellInfo = sSpellMgr->GetSpellInfo(itr->first);
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (pSpellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
- SpellMgr::CalculateSpellEffectAmount(pSpellInfo, i) == 310)
+ if (pSpellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
+ pSpellInfo->Effects[i].CalcValue() == 310)
{
SetHas310Flyer(true);
return true;
@@ -4194,7 +4194,7 @@ void Player::RemoveArenaSpellCooldowns(bool removeActivePetCooldowns)
{
next = itr;
++next;
- SpellEntry const* entry = sSpellStore.LookupEntry(itr->first);
+ SpellInfo const* entry = sSpellMgr->GetSpellInfo(itr->first);
// check if spellentry is present and if the cooldown is less or equal to 10 min
if (entry &&
entry->RecoveryTime <= 10 * MINUTE * IN_MILLISECONDS &&
@@ -4246,7 +4246,7 @@ void Player::_LoadSpellCooldowns(PreparedQueryResult result)
uint32 item_id = fields[1].GetUInt32();
time_t db_time = time_t(fields[2].GetUInt32());
- if (!sSpellStore.LookupEntry(spell_id))
+ if (!sSpellMgr->GetSpellInfo(spell_id))
{
sLog->outError("Player %u has unknown spell %u in `character_spell_cooldown`, skipping.", GetGUIDLow(), spell_id);
continue;
@@ -4389,10 +4389,10 @@ bool Player::resetTalents(bool no_cost)
if (talentInfo->RankID[rank] == 0)
continue;
removeSpell(talentInfo->RankID[rank], true);
- if (const SpellEntry *_spellEntry = sSpellStore.LookupEntry(talentInfo->RankID[rank]))
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) // search through the SpellEntry for valid trigger spells
- if (_spellEntry->EffectTriggerSpell[i] > 0 && _spellEntry->Effect[i] == SPELL_EFFECT_LEARN_SPELL)
- removeSpell(_spellEntry->EffectTriggerSpell[i], true); // and remove any spells that the talent teaches
+ if (const SpellInfo *_spellEntry = sSpellMgr->GetSpellInfo(talentInfo->RankID[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
// 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())
@@ -4676,10 +4676,10 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
if (!IsSpellFitByClassAndRace(trainer_spell->learnedSpell[i]))
return TRAINER_SPELL_RED;
- if (SpellChainNode const* spell_chain = sSpellMgr->GetSpellChainNode(trainer_spell->learnedSpell[i]))
+ if (uint32 prevSpell = sSpellMgr->GetPrevSpellInChain(trainer_spell->learnedSpell[i]))
{
// check prev.rank requirement
- if (spell_chain->prev && !HasSpell(spell_chain->prev))
+ if (prevSpell && !HasSpell(prevSpell))
return TRAINER_SPELL_RED;
}
@@ -4698,7 +4698,8 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
{
if (!trainer_spell->learnedSpell[i])
continue;
- if ((sSpellMgr->IsPrimaryProfessionFirstRankSpell(trainer_spell->learnedSpell[i])) && (GetFreePrimaryProfessionPoints() == 0))
+ SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(trainer_spell->learnedSpell[i]);
+ if (learnedSpellInfo && learnedSpellInfo->IsPrimaryProfessionFirstRank() && (GetFreePrimaryProfessionPoints() == 0))
return TRAINER_SPELL_GREEN_DISABLED;
}
@@ -6074,7 +6075,7 @@ bool Player::UpdateCraftSkill(uint32 spellid)
uint32 SkillValue = GetPureSkillValue(_spell_idx->second->skillId);
// Alchemy Discoveries here
- SpellEntry const* spellEntry = sSpellStore.LookupEntry(spellid);
+ SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(spellid);
if (spellEntry && spellEntry->Mechanic == MECHANIC_DISCOVERY)
{
if (uint32 discoveredSpell = GetSkillDiscoverySpell(_spell_idx->second->skillId, spellid, this))
@@ -6628,7 +6629,7 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type)
switch (type)
{
case ACTION_BUTTON_SPELL:
- if (!sSpellStore.LookupEntry(action))
+ if (!sSpellMgr->GetSpellInfo(action))
{
sLog->outError("Spell action %u not added into button %u for player %s: spell not exist", action, button, GetName());
return false;
@@ -8011,7 +8012,7 @@ void Player::_ApplyWeaponDependentAuraMods(Item *item, WeaponAttackType attackTy
float mod = 100.0f;
AuraEffectList const& auraDamagePctList = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
for (AuraEffectList::const_iterator itr = auraDamagePctList.begin(); itr != auraDamagePctList.end(); ++itr)
- if ((apply && item->IsFitToSpellRequirements((*itr)->GetSpellProto())) || HasItemFitToSpellRequirements((*itr)->GetSpellProto(), item))
+ if ((apply && item->IsFitToSpellRequirements((*itr)->GetSpellInfo())) || HasItemFitToSpellRequirements((*itr)->GetSpellInfo(), item))
mod += (*itr)->GetAmount();
SetFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, mod/100.0f);
@@ -8020,7 +8021,7 @@ void Player::_ApplyWeaponDependentAuraMods(Item *item, WeaponAttackType attackTy
void Player::_ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, AuraEffect const* aura, bool apply)
{
// generic not weapon specific case processes in aura code
- if (aura->GetSpellProto()->EquippedItemClass == -1)
+ if (aura->GetSpellInfo()->EquippedItemClass == -1)
return;
BaseModGroup mod = BASEMOD_END;
@@ -8032,7 +8033,7 @@ void Player::_ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attac
default: return;
}
- if (!item->IsBroken()&&item->IsFitToSpellRequirements(aura->GetSpellProto()))
+ if (!item->IsBroken()&&item->IsFitToSpellRequirements(aura->GetSpellInfo()))
HandleBaseModValue(mod, FLAT_MOD, float (aura->GetAmount()), apply);
}
@@ -8047,7 +8048,7 @@ void Player::_ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType att
return;
// generic not weapon specific case processes in aura code
- if (aura->GetSpellProto()->EquippedItemClass == -1)
+ if (aura->GetSpellInfo()->EquippedItemClass == -1)
return;
UnitMods unitMod = UNIT_MOD_END;
@@ -8066,7 +8067,7 @@ void Player::_ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType att
default: return;
}
- if (item->IsFitToSpellRequirements(aura->GetSpellProto()))
+ if (item->IsFitToSpellRequirements(aura->GetSpellInfo()))
{
HandleStatModifier(unitMod, unitModType, float(aura->GetAmount()), apply);
ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS, aura->GetAmount(), apply);
@@ -8095,7 +8096,7 @@ void Player::ApplyItemEquipSpell(Item *item, bool apply, bool form_change)
continue;
// check if it is valid spell
- SpellEntry const* spellproto = sSpellStore.LookupEntry(spellData.SpellId);
+ SpellInfo const* spellproto = sSpellMgr->GetSpellInfo(spellData.SpellId);
if (!spellproto)
continue;
@@ -8103,12 +8104,12 @@ void Player::ApplyItemEquipSpell(Item *item, bool apply, bool form_change)
}
}
-void Player::ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply, bool form_change)
+void Player::ApplyEquipSpell(SpellInfo const* spellInfo, Item* item, bool apply, bool form_change)
{
if (apply)
{
// Cannot be used in this stance/form
- if (GetErrorAtShapeshiftedCast(spellInfo, GetShapeshiftForm()) != SPELL_CAST_OK)
+ if (spellInfo->CheckShapeshift(GetShapeshiftForm()) != SPELL_CAST_OK)
return;
if (form_change) // check aura active state from other form
@@ -8128,7 +8129,7 @@ void Player::ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply
if (form_change) // check aura compatibility
{
// Cannot be used in this stance/form
- if (GetErrorAtShapeshiftedCast(spellInfo, GetShapeshiftForm()) == SPELL_CAST_OK)
+ if (spellInfo->CheckShapeshift(GetShapeshiftForm()) == SPELL_CAST_OK)
return; // and remove only not compatible at form change
}
@@ -8159,7 +8160,7 @@ void Player::UpdateEquipSpellsAtFormChange()
for (uint32 y = 0; y < MAX_ITEM_SET_SPELLS; ++y)
{
- SpellEntry const* spellInfo = eff->spells[y];
+ SpellInfo const* spellInfo = eff->spells[y];
if (!spellInfo)
continue;
@@ -8222,7 +8223,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
if (spellData.SpellTrigger != ITEM_SPELLTRIGGER_CHANCE_ON_HIT)
continue;
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellData.SpellId);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId);
if (!spellInfo)
{
sLog->outError("WORLD: unknown Item spellid %i", spellData.SpellId);
@@ -8230,10 +8231,10 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
}
// not allow proc extra attack spell at extra attack
- if (m_extraAttacks && IsSpellHaveEffect(spellInfo, SPELL_EFFECT_ADD_EXTRA_ATTACKS))
+ if (m_extraAttacks && spellInfo->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS))
return;
- float chance = (float)spellInfo->procChance;
+ float chance = (float)spellInfo->ProcChance;
if (spellData.SpellPPMRate)
{
@@ -8289,7 +8290,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
continue;
}
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(pEnchant->spellid[s]);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]);
if (!spellInfo)
{
sLog->outError("Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...",
@@ -8316,10 +8317,10 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
if (roll_chance_f(chance))
{
- if (IsPositiveSpell(pEnchant->spellid[s]))
- CastSpell(this, pEnchant->spellid[s], true, item);
+ if (spellInfo->IsPositive())
+ CastSpell(this, spellInfo, true, item);
else
- CastSpell(target, pEnchant->spellid[s], true, item);
+ CastSpell(target, spellInfo, true, item);
}
}
}
@@ -8334,7 +8335,7 @@ void Player::CastItemUseSpell(Item *item, SpellCastTargets const& targets, uint8
uint32 learn_spell_id = proto->Spells[0].SpellId;
uint32 learning_spell_id = proto->Spells[1].SpellId;
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(learn_spell_id);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(learn_spell_id);
if (!spellInfo)
{
sLog->outError("Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring ", proto->ItemId, learn_spell_id);
@@ -8366,7 +8367,7 @@ void Player::CastItemUseSpell(Item *item, SpellCastTargets const& targets, uint8
if (spellData.SpellTrigger != ITEM_SPELLTRIGGER_ON_USE)
continue;
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellData.SpellId);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId);
if (!spellInfo)
{
sLog->outError("Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring", proto->ItemId, spellData.SpellId);
@@ -8394,7 +8395,7 @@ void Player::CastItemUseSpell(Item *item, SpellCastTargets const& targets, uint8
if (pEnchant->type[s] != ITEM_ENCHANTMENT_TYPE_USE_SPELL)
continue;
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(pEnchant->spellid[s]);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]);
if (!spellInfo)
{
sLog->outError("Player::CastItemUseSpell Enchant %i, cast unknown spell %i", pEnchant->ID, pEnchant->spellid[s]);
@@ -12073,7 +12074,7 @@ Item* Player::EquipItem(uint16 pos, Item *pItem, bool update)
if (getClass() == CLASS_ROGUE)
cooldownSpell = 6123;
- SpellEntry const* spellProto = sSpellStore.LookupEntry(cooldownSpell);
+ SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cooldownSpell);
if (!spellProto)
sLog->outError("Weapon switch cooldown spell %u couldn't be found in Spell.dbc", cooldownSpell);
@@ -17112,15 +17113,15 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff)
int32 remaintime = fields[12].GetInt32();
uint8 remaincharges = fields[13].GetUInt8();
- SpellEntry const* spellproto = sSpellStore.LookupEntry(spellid);
- if (!spellproto)
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
+ if (!spellInfo)
{
sLog->outError("Unknown aura (spellid %u), ignore.", spellid);
continue;
}
// negative effects should continue counting down after logout
- if (remaintime != -1 && !IsPositiveSpell(spellid))
+ if (remaintime != -1 && !spellInfo->IsPositive())
{
if (remaintime/IN_MILLISECONDS <= int32(timediff))
continue;
@@ -17129,17 +17130,17 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff)
}
// prevent wrong values of remaincharges
- if (spellproto->procCharges)
+ if (spellInfo->ProcCharges)
{
// we have no control over the order of applying auras and modifiers allow auras
- // to have more charges than value in SpellEntry
+ // to have more charges than value in SpellInfo
if (remaincharges <= 0/* || remaincharges > spellproto->procCharges*/)
- remaincharges = spellproto->procCharges;
+ remaincharges = spellInfo->ProcCharges;
}
else
remaincharges = 0;
- if (Aura* aura = Aura::TryCreate(spellproto, effmask, this, NULL, &baseDamage[0], NULL, caster_guid))
+ if (Aura* aura = Aura::TryCreate(spellInfo, effmask, this, NULL, &baseDamage[0], NULL, caster_guid))
{
if (!aura->CanBeSaved())
{
@@ -17149,7 +17150,7 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff)
aura->SetLoadedState(maxduration, remaintime, remaincharges, stackcount, recalculatemask, &damage[0]);
aura->ApplyForTargets();
- sLog->outDetail("Added aura spellid %u, effectmask %u", spellproto->Id, effmask);
+ sLog->outDetail("Added aura spellid %u, effectmask %u", spellInfo->Id, effmask);
}
}
while (result->NextRow());
@@ -19133,7 +19134,7 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent)
{
//returning of reagents only for players, so best done here
uint32 spellId = pet ? pet->GetUInt32Value(UNIT_CREATED_BY_SPELL) : m_oldpetspell;
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (spellInfo)
{
@@ -19434,7 +19435,8 @@ void Player::VehicleSpellInitialize()
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
{
uint32 spellId = veh->m_spells[i];
- if (!sSpellStore.LookupEntry(spellId))
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
+ if (!spellInfo)
{
data << uint16(0) << uint8(0) << uint8(i+8);
continue;
@@ -19448,7 +19450,7 @@ void Player::VehicleSpellInitialize()
continue;
}
- if (IsPassiveSpell(spellId))
+ if (spellInfo->IsPassive())
{
veh->CastSpell(veh, spellId, true);
data << uint16(0) << uint8(0) << uint8(i+8);
@@ -19536,7 +19538,7 @@ void Player::CharmSpellInitialize()
{
for (uint32 i = 0; i < MAX_SPELL_CHARM; ++i)
{
- CharmSpellEntry *cspell = charmInfo->GetCharmSpell(i);
+ CharmSpellInfo *cspell = charmInfo->GetCharmSpell(i);
if (cspell->GetAction())
data << uint32(cspell->packedData);
}
@@ -19554,7 +19556,7 @@ void Player::SendRemoveControlBar()
GetSession()->SendPacket(&data);
}
-bool Player::IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mod, Spell* spell)
+bool Player::IsAffectedBySpellmod(SpellInfo const *spellInfo, SpellModifier *mod, Spell* spell)
{
if (!mod || !spellInfo)
return false;
@@ -19564,10 +19566,10 @@ bool Player::IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mo
return false;
// +duration to infinite duration spells making them limited
- if (mod->op == SPELLMOD_DURATION && GetSpellDuration(spellInfo) == -1)
+ if (mod->op == SPELLMOD_DURATION && spellInfo->GetDuration() == -1)
return false;
- return sSpellMgr->IsAffectedByMod(spellInfo, mod);
+ return spellInfo->IsAffectedBySpellMod(mod);
}
void Player::AddSpellMod(SpellModifier* mod, bool apply)
@@ -19628,7 +19630,7 @@ void Player::RestoreSpellMods(Spell* spell, uint32 ownerAuraId, Aura* aura)
continue;
// Restore only specific owner aura mods
- if (ownerAuraId && (ownerAuraId != mod->ownerAura->GetSpellProto()->Id))
+ if (ownerAuraId && (ownerAuraId != mod->ownerAura->GetSpellInfo()->Id))
continue;
if (aura && mod->ownerAura != aura)
@@ -20121,7 +20123,7 @@ void Player::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs)
if (itr->second->state == PLAYERSPELL_REMOVED)
continue;
uint32 unSpellId = itr->first;
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(unSpellId);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(unSpellId);
if (!spellInfo)
{
ASSERT(spellInfo);
@@ -20135,7 +20137,7 @@ void Player::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs)
if (spellInfo->PreventionType != SPELL_PREVENTION_TYPE_SILENCE)
continue;
- if ((idSchoolMask & GetSpellSchoolMask(spellInfo)) && GetSpellCooldownDelay(unSpellId) < unTimeMs)
+ if ((idSchoolMask & spellInfo->GetSchoolMask()) && GetSpellCooldownDelay(unSpellId) < unTimeMs)
{
data << uint32(unSpellId);
data << uint32(unTimeMs); // in m.secs
@@ -20531,7 +20533,7 @@ void Player::UpdatePvP(bool state, bool override)
}
}
-void Player::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 itemId, Spell* spell, bool infinityCooldown)
+void Player::AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 itemId, Spell* spell, bool infinityCooldown)
{
// init cooldown values
uint32 cat = 0;
@@ -20584,7 +20586,7 @@ void Player::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 it
{
// shoot spells used equipped item cooldown values already assigned in GetAttackTime(RANGED_ATTACK)
// prevent 0 cooldowns set by another way
- if (rec <= 0 && catrec <= 0 && (cat == 76 || (IsAutoRepeatRangedSpell(spellInfo) && spellInfo->Id != 75)))
+ if (rec <= 0 && catrec <= 0 && (cat == 76 || (spellInfo->IsAutoRepeatRangedSpell() && spellInfo->Id != 75)))
rec = GetAttackTime(RANGED_ATTACK);
// Now we have cooldown data (if found any), time to apply mods
@@ -20635,7 +20637,7 @@ void Player::AddSpellCooldown(uint32 spellid, uint32 itemid, time_t end_time)
m_spellCooldowns[spellid] = sc;
}
-void Player::SendCooldownEvent(SpellEntry const* spellInfo, uint32 itemId /*= 0*/, Spell* spell /*= NULL*/, bool setCooldown /*= true*/)
+void Player::SendCooldownEvent(SpellInfo const* spellInfo, uint32 itemId /*= 0*/, Spell* spell /*= NULL*/, bool setCooldown /*= true*/)
{
// start cooldowns at server side, if any
if (setCooldown)
@@ -20661,7 +20663,7 @@ void Player::UpdatePotionCooldown(Spell* spell)
if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(m_lastPotionId))
for (uint8 idx = 0; idx < MAX_ITEM_SPELLS; ++idx)
if (proto->Spells[idx].SpellId && proto->Spells[idx].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE)
- if (SpellEntry const* spellInfo = sSpellStore.LookupEntry(proto->Spells[idx].SpellId))
+ if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(proto->Spells[idx].SpellId))
SendCooldownEvent(spellInfo, m_lastPotionId);
}
// from spell cases (m_lastPotionId set in Spell::SendSpellCooldown)
@@ -21549,12 +21551,12 @@ void Player::resetSpells(bool myClassOnly)
for (PlayerSpellMap::const_iterator iter = smap.begin(); iter != smap.end(); ++iter)
{
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(iter->first);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(iter->first);
if (!spellInfo)
continue;
// skip server-side/triggered spells
- if (spellInfo->spellLevel == 0)
+ if (spellInfo->SpellLevel == 0)
continue;
// skip wrong class/race skills
@@ -21614,7 +21616,7 @@ void Player::learnQuestRewardedSpells(Quest const* quest)
return;
}
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id);
if (!spellInfo)
return;
@@ -21622,7 +21624,7 @@ void Player::learnQuestRewardedSpells(Quest const* quest)
bool found = false;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- if (spellInfo->Effect[i] == SPELL_EFFECT_LEARN_SPELL && !HasSpell(spellInfo->EffectTriggerSpell[i]))
+ if (spellInfo->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL && !HasSpell(spellInfo->Effects[i].TriggerSpell))
{
found = true;
break;
@@ -21634,7 +21636,7 @@ void Player::learnQuestRewardedSpells(Quest const* quest)
return;
// prevent learn non first rank unknown profession and second specialization for same profession)
- uint32 learned_0 = spellInfo->EffectTriggerSpell[0];
+ uint32 learned_0 = spellInfo->Effects[0].TriggerSpell;
if (sSpellMgr->GetSpellRank(learned_0) > 1 && !HasSpell(learned_0))
{
// not have first rank learned (unlearned prof?)
@@ -21642,7 +21644,7 @@ void Player::learnQuestRewardedSpells(Quest const* quest)
if (!HasSpell(first_spell))
return;
- SpellEntry const *learnedInfo = sSpellStore.LookupEntry(learned_0);
+ SpellInfo const *learnedInfo = sSpellMgr->GetSpellInfo(learned_0);
if (!learnedInfo)
return;
@@ -21652,7 +21654,7 @@ void Player::learnQuestRewardedSpells(Quest const* quest)
uint32 profSpell = itr2->second;
// specialization
- if (learnedInfo->Effect[0] == SPELL_EFFECT_TRADE_SKILL && learnedInfo->Effect[1] == 0 && profSpell)
+ if (learnedInfo->Effects[0].Effect == SPELL_EFFECT_TRADE_SKILL && learnedInfo->Effects[1].Effect == 0 && profSpell)
{
// search other specialization for same prof
for (PlayerSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
@@ -21660,12 +21662,12 @@ void Player::learnQuestRewardedSpells(Quest const* quest)
if (itr->second->state == PLAYERSPELL_REMOVED || itr->first == learned_0)
continue;
- SpellEntry const *itrInfo = sSpellStore.LookupEntry(itr->first);
+ SpellInfo const *itrInfo = sSpellMgr->GetSpellInfo(itr->first);
if (!itrInfo)
return;
// compare only specializations
- if (itrInfo->Effect[0] != SPELL_EFFECT_TRADE_SKILL || itrInfo->Effect[1] != 0)
+ if (itrInfo->Effects[0].Effect != SPELL_EFFECT_TRADE_SKILL || itrInfo->Effects[1].Effect != 0)
continue;
// compare same chain spells
@@ -21708,7 +21710,7 @@ void Player::learnSkillRewardedSpells(uint32 skill_id, uint32 skill_value)
if (pAbility->classmask && !(pAbility->classmask & classMask))
continue;
- if (sSpellStore.LookupEntry(pAbility->spellId))
+ if (sSpellMgr->GetSpellInfo(pAbility->spellId))
{
// need unlearn spell
if (skill_value < pAbility->req_skill_value)
@@ -22032,7 +22034,7 @@ OutdoorPvP * Player::GetOutdoorPvP() const
return sOutdoorPvPMgr->GetOutdoorPvPToZoneId(GetZoneId());
}
-bool Player::HasItemFitToSpellRequirements(SpellEntry const* spellInfo, Item const* ignoreItem)
+bool Player::HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item const* ignoreItem)
{
if (spellInfo->EquippedItemClass < 0)
return true;
@@ -22077,7 +22079,7 @@ bool Player::HasItemFitToSpellRequirements(SpellEntry const* spellInfo, Item con
return false;
}
-bool Player::CanNoReagentCast(SpellEntry const* spellInfo) const
+bool Player::CanNoReagentCast(SpellInfo const* spellInfo) const
{
// don't take reagents for spells with SPELL_ATTR5_NO_REAGENT_WHILE_PREP
if (spellInfo->AttributesEx5 & SPELL_ATTR5_NO_REAGENT_WHILE_PREP &&
@@ -22102,7 +22104,7 @@ void Player::RemoveItemDependentAurasAndCasts(Item* pItem)
Aura * aura = itr->second;
// skip passive (passive item dependent spells work in another way) and not self applied auras
- SpellEntry const* spellInfo = aura->GetSpellProto();
+ SpellInfo const* spellInfo = aura->GetSpellInfo();
if (aura->IsPassive() || aura->GetCasterGUID() != GetGUID())
{
++itr;
@@ -22136,7 +22138,7 @@ uint32 Player::GetResurrectionSpellId()
for (AuraEffectList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr)
{
// Soulstone Resurrection // prio: 3 (max, non death persistent)
- if (prio < 2 && (*itr)->GetSpellProto()->SpellVisual[0] == 99 && (*itr)->GetSpellProto()->SpellIconID == 92)
+ if (prio < 2 && (*itr)->GetSpellInfo()->SpellVisual[0] == 99 && (*itr)->GetSpellInfo()->SpellIconID == 92)
{
switch ((*itr)->GetId())
{
@@ -22362,7 +22364,7 @@ void Player::UpdateAreaDependentAuras(uint32 newArea)
for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
{
// use m_zoneUpdateId for speed: UpdateArea called from UpdateZone or instead UpdateZone in both cases m_zoneUpdateId up-to-date
- if (sSpellMgr->GetSpellAllowedInLocationError(iter->second->GetSpellProto(), GetMapId(), m_zoneUpdateId, newArea, this) != SPELL_CAST_OK)
+ if (iter->second->GetSpellInfo()->CheckLocation(GetMapId(), m_zoneUpdateId, newArea, this) != SPELL_CAST_OK)
RemoveOwnedAura(iter);
else
++iter;
@@ -23142,7 +23144,7 @@ uint32 Player::CalculateTalentsPoints() const
bool Player::IsKnowHowFlyIn(uint32 mapid, uint32 zone) const
{
- // continent checked in SpellMgr::GetSpellAllowedInLocationError at cast and area update
+ // continent checked in SpellInfo::CheckLocation at cast and area update
uint32 v_map = GetVirtualMapForMapAndZone(mapid, zone);
return v_map != 571 || HasSpell(54197); // Cold Weather Flying
}
@@ -24252,10 +24254,10 @@ void Player::ActivateSpec(uint8 spec)
if (talentInfo->RankID[rank] == 0)
continue;
removeSpell(talentInfo->RankID[rank], true); // removes the talent, and all dependant, learned, and chained spells..
- if (const SpellEntry *_spellEntry = sSpellStore.LookupEntry(talentInfo->RankID[rank]))
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) // search through the SpellEntry for valid trigger spells
- if (_spellEntry->EffectTriggerSpell[i] > 0 && _spellEntry->Effect[i] == SPELL_EFFECT_LEARN_SPELL)
- removeSpell(_spellEntry->EffectTriggerSpell[i], true); // and remove any spells that the talent teaches
+ if (const SpellInfo *_spellEntry = sSpellMgr->GetSpellInfo(talentInfo->RankID[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
// 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/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 4f7167c7c17..e1d1dd7dacd 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -37,6 +37,9 @@
#include "Util.h" // for Tokens typedef
#include "WorldSession.h"
+// for template
+#include "SpellMgr.h"
+
#include<string>
#include<vector>
@@ -1202,8 +1205,8 @@ class Player : public Unit, public GridObject<Player>
uint8 GetBankBagSlotCount() const { return GetByteValue(PLAYER_BYTES_2, 2); }
void SetBankBagSlotCount(uint8 count) { SetByteValue(PLAYER_BYTES_2, 2, count); }
bool HasItemCount(uint32 item, uint32 count, bool inBankAlso = false) const;
- bool HasItemFitToSpellRequirements(SpellEntry const* spellInfo, Item const* ignoreItem = NULL);
- bool CanNoReagentCast(SpellEntry const* spellInfo) const;
+ bool HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item const* ignoreItem = NULL);
+ bool CanNoReagentCast(SpellInfo const* spellInfo) const;
bool HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot = NULL_SLOT) const;
bool HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 count, uint8 except_slot = NULL_SLOT) const;
InventoryResult CanTakeMoreSimilarItems(Item* pItem) const { return _CanTakeMoreSimilarItems(pItem->GetEntry(), pItem->GetCount(), pItem); }
@@ -1600,7 +1603,7 @@ class Player : public Unit, public GridObject<Player>
bool HasActiveSpell(uint32 spell) const; // show in spellbook
TrainerSpellState GetTrainerSpellState(TrainerSpell const* trainer_spell) const;
bool IsSpellFitByClassAndRace(uint32 spell_id) const;
- bool IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const;
+ bool IsNeedCastPassiveSpellAtLearn(SpellInfo const* spellInfo) const;
void SendProficiency(ItemClass itemClass, uint32 itemSubclassMask);
void SendInitialSpells();
@@ -1661,7 +1664,7 @@ class Player : public Unit, public GridObject<Player>
SpellCooldowns const& GetSpellCooldownMap() const { return m_spellCooldowns; }
void AddSpellMod(SpellModifier* mod, bool apply);
- bool IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mod, Spell* spell = NULL);
+ bool IsAffectedBySpellmod(SpellInfo const *spellInfo, SpellModifier *mod, Spell* spell = NULL);
template <class T> T ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell* spell = NULL);
void RemoveSpellMods(Spell* spell);
void RestoreSpellMods(Spell* spell, uint32 ownerAuraId = 0, Aura* aura = NULL);
@@ -1682,9 +1685,9 @@ class Player : public Unit, public GridObject<Player>
time_t t = time(NULL);
return uint32(itr != m_spellCooldowns.end() && itr->second.end > t ? itr->second.end - t : 0);
}
- void AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 itemId, Spell* spell = NULL, bool infinityCooldown = false);
+ void AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 itemId, Spell* spell = NULL, bool infinityCooldown = false);
void AddSpellCooldown(uint32 spell_id, uint32 itemid, time_t end_time);
- void SendCooldownEvent(SpellEntry const* spellInfo, uint32 itemId = 0, Spell* spell = NULL, bool setCooldown = true);
+ void SendCooldownEvent(SpellInfo const* spellInfo, uint32 itemId = 0, Spell* spell = NULL, bool setCooldown = true);
void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs);
void RemoveSpellCooldown(uint32 spell_id, bool update = false);
void RemoveSpellCategoryCooldown(uint32 cat, bool update = false);
@@ -2061,7 +2064,7 @@ class Player : public Unit, public GridObject<Player>
void InitDataForForm(bool reapplyMods = false);
void ApplyItemEquipSpell(Item *item, bool apply, bool form_change = false);
- void ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply, bool form_change = false);
+ void ApplyEquipSpell(SpellInfo const* spellInfo, Item* item, bool apply, bool form_change = false);
void UpdateEquipSpellsAtFormChange();
void CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 procVictim, uint32 procEx);
void CastItemUseSpell(Item *item, SpellCastTargets const& targets, uint8 cast_count, uint32 glyphIndex);
@@ -2768,7 +2771,7 @@ void RemoveItemsSetItem(Player*player, ItemTemplate const *proto);
// "the bodies of template functions must be made available in a header file"
template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell* spell)
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
return 0;
float totalmul = 1.0f;
diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp
index f7011a973f7..245ad83bd20 100755
--- a/src/server/game/Entities/Totem/Totem.cpp
+++ b/src/server/game/Entities/Totem/Totem.cpp
@@ -23,6 +23,7 @@
#include "Player.h"
#include "ObjectMgr.h"
#include "SpellMgr.h"
+#include "SpellInfo.h"
Totem::Totem(SummonPropertiesEntry const* properties, Unit* owner) : Minion(properties, owner)
{
@@ -71,8 +72,8 @@ void Totem::InitStats(uint32 duration)
Minion::InitStats(duration);
// Get spell cast by totem
- if (SpellEntry const* totemSpell = sSpellStore.LookupEntry(GetSpell()))
- if (GetSpellCastTime(totemSpell)) // If spell has cast time -> its an active totem
+ if (SpellInfo const* totemSpell = sSpellMgr->GetSpellInfo(GetSpell()))
+ if (totemSpell->CalcCastTime()) // If spell has cast time -> its an active totem
m_type = TOTEM_ACTIVE;
if (GetEntry() == SENTRY_TOTEM_ENTRY)
@@ -115,7 +116,7 @@ void Totem::UnSummon()
{
owner->SendAutoRepeatCancel(this);
- if (SpellEntry const* spell = sSpellStore.LookupEntry(GetUInt32Value(UNIT_CREATED_BY_SPELL)))
+ if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(GetUInt32Value(UNIT_CREATED_BY_SPELL)))
owner->SendCooldownEvent(spell, 0, NULL, false);
if (Group* group = owner->GetGroup())
@@ -132,13 +133,13 @@ void Totem::UnSummon()
AddObjectToRemoveList();
}
-bool Totem::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const
+bool Totem::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const
{
// TODO: possibly all negative auras immune?
if (GetEntry() == 5925)
return false;
- switch (spellInfo->EffectApplyAuraName[index])
+ switch (spellInfo->Effects[index].ApplyAuraName)
{
case SPELL_AURA_PERIODIC_DAMAGE:
case SPELL_AURA_PERIODIC_LEECH:
diff --git a/src/server/game/Entities/Totem/Totem.h b/src/server/game/Entities/Totem/Totem.h
index de73c783a4d..93fc2145901 100755
--- a/src/server/game/Entities/Totem/Totem.h
+++ b/src/server/game/Entities/Totem/Totem.h
@@ -53,7 +53,7 @@ class Totem : public Minion
void UpdateAttackPowerAndDamage(bool /*ranged*/) {}
void UpdateDamagePhysical(WeaponAttackType /*attType*/) {}
- bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const;
+ bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const;
protected:
TotemType m_type;
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index 537840163a0..8da3f35082b 100755
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -354,7 +354,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
for (Unit::AuraEffectList::const_iterator itr = mDummy.begin(); itr != mDummy.end(); ++itr)
{
AuraEffect* aurEff = *itr;
- if (aurEff->GetSpellProto()->SpellIconID == 1563)
+ if (aurEff->GetSpellInfo()->SpellIconID == 1563)
{
switch (aurEff->GetEffIndex())
{
@@ -725,10 +725,10 @@ void Player::UpdateExpertise(WeaponAttackType attack)
for (AuraEffectList::const_iterator itr = expAuras.begin(); itr != expAuras.end(); ++itr)
{
// item neutral spell
- if ((*itr)->GetSpellProto()->EquippedItemClass == -1)
+ if ((*itr)->GetSpellInfo()->EquippedItemClass == -1)
expertise += (*itr)->GetAmount();
// item dependent spell
- else if (weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto()))
+ else if (weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellInfo()))
expertise += (*itr)->GetAmount();
}
@@ -1016,8 +1016,8 @@ bool Guardian::UpdateStats(Stats stat)
aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0);
if (aurEff)
{
- SpellEntry const* sProto = aurEff->GetSpellProto(); // Then get the SpellProto and add the dummy effect value
- AddPctN(mod, SpellMgr::CalculateSpellEffectAmount(sProto, 1)); // Ravenous Dead edits the original scale
+ SpellInfo const* spellInfo = aurEff->GetSpellInfo(); // Then get the SpellProto and add the dummy effect value
+ AddPctN(mod, spellInfo->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale
}
// Glyph of the Ghoul
aurEff = owner->GetAuraEffect(58686, 0);
@@ -1044,8 +1044,8 @@ bool Guardian::UpdateStats(Stats stat)
if (itr != ToPet()->m_spells.end()) // If pet has Wild Hunt
{
- SpellEntry const* sProto = sSpellStore.LookupEntry(itr->first); // Then get the SpellProto and add the dummy effect value
- AddPctN(mod, SpellMgr::CalculateSpellEffectAmount(sProto, 0));
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
+ AddPctN(mod, spellInfo->Effects[EFFECT_0].CalcValue());
}
}
ownersBonus = float(owner->GetStat(stat)) * mod;
@@ -1213,8 +1213,8 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged)
if (itr != ToPet()->m_spells.end()) // If pet has Wild Hunt
{
- SpellEntry const* sProto = sSpellStore.LookupEntry(itr->first); // Then get the SpellProto and add the dummy effect value
- mod += CalculatePctN(1.0f, SpellMgr::CalculateSpellEffectAmount(sProto, 1));
+ SpellInfo const* sProto = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
+ mod += CalculatePctN(1.0f, sProto->Effects[1].CalcValue());
}
}
@@ -1328,7 +1328,7 @@ void Guardian::UpdateDamagePhysical(WeaponAttackType attType)
Unit::AuraEffectList const& mDummy = GetAuraEffectsByType(SPELL_AURA_MOD_ATTACKSPEED);
for (Unit::AuraEffectList::const_iterator itr = mDummy.begin(); itr != mDummy.end(); ++itr)
{
- switch ((*itr)->GetSpellProto()->Id)
+ switch ((*itr)->GetSpellInfo()->Id)
{
case 61682:
case 61683:
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 93740a637d3..57032c13aaf 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -54,6 +54,7 @@
#include "Vehicle.h"
#include "Transport.h"
#include "InstanceScript.h"
+#include "SpellInfo.h"
#include <math.h>
@@ -92,7 +93,7 @@ static bool isAlwaysTriggeredAura[TOTAL_AURAS];
// Prepare lists
static bool procPrepared = InitTriggerAuraData();
-DamageInfo::DamageInfo(Unit* _attacker, Unit* _victim, uint32 _damage, SpellEntry const* _spellInfo, SpellSchoolMask _schoolMask, DamageEffectType _damageType)
+DamageInfo::DamageInfo(Unit* _attacker, Unit* _victim, uint32 _damage, SpellInfo const* _spellInfo, SpellSchoolMask _schoolMask, DamageEffectType _damageType)
: m_attacker(_attacker), m_victim(_victim), m_damage(_damage), m_spellInfo(_spellInfo), m_schoolMask(_schoolMask),
m_damageType(_damageType), m_attackType(BASE_ATTACK)
{
@@ -242,18 +243,18 @@ m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE), m_HostileRefManager(this)
////////////////////////////////////////////////////////////
// Methods of class GlobalCooldownMgr
-bool GlobalCooldownMgr::HasGlobalCooldown(SpellEntry const* spellInfo) const
+bool GlobalCooldownMgr::HasGlobalCooldown(SpellInfo const* spellInfo) const
{
GlobalCooldownList::const_iterator itr = m_GlobalCooldowns.find(spellInfo->StartRecoveryCategory);
return itr != m_GlobalCooldowns.end() && itr->second.duration && getMSTimeDiff(itr->second.cast_time, getMSTime()) < itr->second.duration;
}
-void GlobalCooldownMgr::AddGlobalCooldown(SpellEntry const* spellInfo, uint32 gcd)
+void GlobalCooldownMgr::AddGlobalCooldown(SpellInfo const* spellInfo, uint32 gcd)
{
m_GlobalCooldowns[spellInfo->StartRecoveryCategory] = GlobalCooldown(gcd, getMSTime());
}
-void GlobalCooldownMgr::CancelGlobalCooldown(SpellEntry const* spellInfo)
+void GlobalCooldownMgr::CancelGlobalCooldown(SpellInfo const* spellInfo)
{
m_GlobalCooldowns[spellInfo->StartRecoveryCategory].duration = 0;
}
@@ -585,7 +586,7 @@ void Unit::UpdateInterruptMask()
{
m_interruptMask = 0;
for (AuraApplicationList::const_iterator i = m_interruptableAuras.begin(); i != m_interruptableAuras.end(); ++i)
- m_interruptMask |= (*i)->GetBase()->GetSpellProto()->AuraInterruptFlags;
+ m_interruptMask |= (*i)->GetBase()->GetSpellInfo()->AuraInterruptFlags;
if (Spell* spell = m_currentSpells[CURRENT_CHANNELED_SPELL])
if (spell->getState() == SPELL_STATE_CASTING)
@@ -598,7 +599,7 @@ bool Unit::HasAuraTypeWithFamilyFlags(AuraType auraType, uint32 familyName, uint
return false;
AuraEffectList const& auras = GetAuraEffectsByType(auraType);
for (AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
- if (SpellEntry const* iterSpellProto = (*itr)->GetSpellProto())
+ if (SpellInfo const* iterSpellProto = (*itr)->GetSpellInfo())
if (iterSpellProto->SpellFamilyName == familyName && iterSpellProto->SpellFamilyFlags[0] & familyFlags)
return true;
return false;
@@ -620,7 +621,7 @@ void Unit::DealDamageMods(Unit* victim, uint32 &damage, uint32* absorb)
*absorb += (originalDamage - damage);
}
-uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const* spellProto, bool durabilityLoss)
+uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss)
{
if (victim->IsAIEnabled)
victim->GetAI()->DamageTaken(this, damage);
@@ -655,13 +656,13 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
Unit* shareDamageTarget = (*i)->GetCaster();
if (!shareDamageTarget)
continue;
- SpellEntry const* spell = (*i)->GetSpellProto();
+ SpellInfo const* spell = (*i)->GetSpellInfo();
uint32 share = CalculatePctN(damage, (*i)->GetAmount());
// TODO: check packets if damage is done by victim, or by attacker of victim
DealDamageMods(shareDamageTarget, share, NULL);
- DealDamage(shareDamageTarget, share, NULL, NODAMAGE, GetSpellSchoolMask(spell), spell, false);
+ DealDamage(shareDamageTarget, share, NULL, NODAMAGE, spell->GetSchoolMask(), spell, false);
}
}
@@ -873,7 +874,7 @@ void Unit::CastStop(uint32 except_spellid)
void Unit::CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
@@ -884,7 +885,7 @@ void Unit::CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item* castIte
CastSpell(Victim, spellInfo, triggered, castItem, triggeredByAura, originalCaster);
}
-void Unit::CastSpell(Unit* Victim, SpellEntry const* spellInfo, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
+void Unit::CastSpell(Unit* Victim, SpellInfo const* spellInfo, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
{
if (!spellInfo)
{
@@ -932,7 +933,7 @@ void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit*
void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* Victim, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
sLog->outError("CastSpell: unknown spell id %i by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
@@ -962,7 +963,7 @@ void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit*
// used for scripting
void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster, Unit* OriginalVictim)
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
@@ -992,7 +993,7 @@ void Unit::CastSpell(GameObject *go, uint32 spellId, bool triggered, Item* castI
if (!go)
return;
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
@@ -1017,7 +1018,7 @@ void Unit::CastSpell(GameObject *go, uint32 spellId, bool triggered, Item* castI
// Obsolete func need remove, here only for comotability vs another patches
uint32 Unit::SpellNonMeleeDamageLog(Unit* victim, uint32 spellID, uint32 damage)
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellID);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID);
SpellNonMeleeDamage damageInfo(this, victim, spellInfo->Id, spellInfo->SchoolMask);
damage = SpellDamageBonus(victim, spellInfo, damage, SPELL_DIRECT_DAMAGE);
CalculateSpellDamageTaken(&damageInfo, damage, spellInfo);
@@ -1027,7 +1028,7 @@ uint32 Unit::SpellNonMeleeDamageLog(Unit* victim, uint32 spellID, uint32 damage)
return damageInfo.damage;
}
-void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellEntry const* spellInfo, WeaponAttackType attackType, bool crit)
+void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const* spellInfo, WeaponAttackType attackType, bool crit)
{
if (damage < 0)
return;
@@ -1076,7 +1077,7 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 dama
critPctDamageMod += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE);
// Increase crit damage from SPELL_AURA_MOD_CRIT_DAMAGE_BONUS
- critPctDamageMod += (GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, GetSpellSchoolMask(spellInfo)) - 1.0f) * 100;
+ critPctDamageMod += (GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, spellInfo->GetSchoolMask()) - 1.0f) * 100;
// Increase crit damage from SPELL_AURA_MOD_CRIT_PERCENT_VERSUS
critPctDamageMod += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, crTypeMask);
@@ -1146,7 +1147,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss)
if (!victim->isAlive() || victim->HasUnitState(UNIT_STAT_IN_FLIGHT) || (victim->HasUnitState(UNIT_STAT_ONVEHICLE) && victim->GetVehicleBase() != this) || (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsInEvadeMode()))
return;
- SpellEntry const* spellProto = sSpellStore.LookupEntry(damageInfo->SpellID);
+ SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(damageInfo->SpellID);
if (spellProto == NULL)
{
sLog->outDebug(LOG_FILTER_UNITS, "Unit::DealSpellDamage have wrong damageInfo->SpellID: %u", damageInfo->SpellID);
@@ -1441,7 +1442,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
AuraEffectList vDamageShieldsCopy(victim->GetAuraEffectsByType(SPELL_AURA_DAMAGE_SHIELD));
for (AuraEffectList::const_iterator dmgShieldItr = vDamageShieldsCopy.begin(); dmgShieldItr != vDamageShieldsCopy.end(); ++dmgShieldItr)
{
- SpellEntry const* i_spellProto = (*dmgShieldItr)->GetSpellProto();
+ SpellInfo const* i_spellProto = (*dmgShieldItr)->GetSpellInfo();
// Damage shield can be resisted...
if (SpellMissInfo missInfo = victim->SpellHitResult(this, i_spellProto , false))
{
@@ -1475,7 +1476,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
data << uint32(i_spellProto->SchoolMask);
victim->SendMessageToSet(&data, true);
- victim->DealDamage(this, damage, 0, SPELL_DIRECT_DAMAGE, GetSpellSchoolMask(i_spellProto), i_spellProto, true);
+ victim->DealDamage(this, damage, 0, SPELL_DIRECT_DAMAGE, i_spellProto->GetSchoolMask(), i_spellProto, true);
}
}
}
@@ -1488,7 +1489,7 @@ void Unit::HandleEmoteCommand(uint32 anim_id)
SendMessageToSet(&data, true);
}
-bool Unit::IsDamageReducedByArmor(SpellSchoolMask schoolMask, SpellEntry const* spellInfo, uint8 effIndex)
+bool Unit::IsDamageReducedByArmor(SpellSchoolMask schoolMask, SpellInfo const* spellInfo, uint8 effIndex)
{
// only physical spells damage gets reduced by armor
if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0)
@@ -1496,18 +1497,18 @@ bool Unit::IsDamageReducedByArmor(SpellSchoolMask schoolMask, SpellEntry const*
if (spellInfo)
{
// there are spells with no specific attribute but they have "ignores armor" in tooltip
- if (sSpellMgr->GetSpellCustomAttr(spellInfo->Id) & SPELL_ATTR0_CU_IGNORE_ARMOR)
+ if (spellInfo->AttributesCu & SPELL_ATTR0_CU_IGNORE_ARMOR)
return false;
// bleeding effects are not reduced by armor
- if (effIndex != MAX_SPELL_EFFECTS && spellInfo->EffectApplyAuraName[effIndex] == SPELL_AURA_PERIODIC_DAMAGE)
- if (GetSpellMechanicMask(spellInfo, effIndex) & (1<<MECHANIC_BLEED))
+ if (effIndex != MAX_SPELL_EFFECTS && spellInfo->Effects[effIndex].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE)
+ if (spellInfo->GetEffectMechanicMask(effIndex) & (1<<MECHANIC_BLEED))
return false;
}
return true;
}
-uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellEntry const* spellInfo, WeaponAttackType /*attackType*/)
+uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo const* spellInfo, WeaponAttackType /*attackType*/)
{
uint32 newdamage = 0;
float armor = float(victim->GetArmor());
@@ -1540,7 +1541,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellEntr
for (AuraEffectList::const_iterator itr = ResIgnoreAuras.begin(); itr != ResIgnoreAuras.end(); ++itr)
{
// item neutral spell
- if ((*itr)->GetSpellProto()->EquippedItemClass == -1)
+ if ((*itr)->GetSpellInfo()->EquippedItemClass == -1)
{
armor = floor(AddPctN(armor, -(*itr)->GetAmount()));
continue;
@@ -1551,7 +1552,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellEntr
{
Item* weapon = ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true);
- if (weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto()))
+ if (weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellInfo()))
{
armor = floor(AddPctN(armor, -(*itr)->GetAmount()));
break;
@@ -1596,7 +1597,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellEntr
return (newdamage > 1) ? newdamage : 1;
}
-void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist, SpellEntry const* spellInfo)
+void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist, SpellInfo const* spellInfo)
{
if (!victim || !victim->isAlive() || !damage)
return;
@@ -1774,7 +1775,7 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
int32 manaReduction = currentAbsorb;
// lower absorb amount by talents
- if (float manaMultiplier = SpellMgr::CalculateSpellEffectValueMultiplier(absorbAurEff->GetSpellProto(), absorbAurEff->GetEffIndex(), absorbAurEff->GetCaster()))
+ if (float manaMultiplier = absorbAurEff->GetSpellInfo()->Effects[absorbAurEff->GetEffIndex()].CalcValueMultiplier(absorbAurEff->GetCaster()))
manaReduction = int32(float(manaReduction) * manaMultiplier);
int32 manaTaken = -victim->ModifyPower(POWER_MANA, -manaReduction);
@@ -1827,10 +1828,10 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
uint32 splitted_absorb = 0;
DealDamageMods(caster, splitted, &splitted_absorb);
- SendSpellNonMeleeDamageLog(caster, (*itr)->GetSpellProto()->Id, splitted, schoolMask, splitted_absorb, 0, false, 0, false);
+ SendSpellNonMeleeDamageLog(caster, (*itr)->GetSpellInfo()->Id, splitted, schoolMask, splitted_absorb, 0, false, 0, false);
CleanDamage cleanDamage = CleanDamage(splitted, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
- DealDamage(caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*itr)->GetSpellProto(), false);
+ DealDamage(caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*itr)->GetSpellInfo(), false);
}
// We're going to call functions which can modify content of the list during iteration over it's elements
@@ -1861,10 +1862,10 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
uint32 split_absorb = 0;
DealDamageMods(caster, splitted, &split_absorb);
- SendSpellNonMeleeDamageLog(caster, (*itr)->GetSpellProto()->Id, splitted, schoolMask, split_absorb, 0, false, 0, false);
+ SendSpellNonMeleeDamageLog(caster, (*itr)->GetSpellInfo()->Id, splitted, schoolMask, split_absorb, 0, false, 0, false);
CleanDamage cleanDamage = CleanDamage(splitted, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
- DealDamage(caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*itr)->GetSpellProto(), false);
+ DealDamage(caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*itr)->GetSpellInfo(), false);
}
}
@@ -1872,7 +1873,7 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
*absorb = dmgInfo.GetAbsorb();
}
-void Unit::CalcHealAbsorb(Unit* victim, const SpellEntry *healSpell, uint32 &healAmount, uint32 &absorb)
+void Unit::CalcHealAbsorb(Unit* victim, const SpellInfo *healSpell, uint32 &healAmount, uint32 &absorb)
{
if (!healAmount)
return;
@@ -2218,16 +2219,16 @@ uint32 Unit::CalculateDamage(WeaponAttackType attType, bool normalized, bool add
return urand((uint32)min_damage, (uint32)max_damage);
}
-float Unit::CalculateLevelPenalty(SpellEntry const* spellProto) const
+float Unit::CalculateLevelPenalty(SpellInfo const* spellProto) const
{
- if (spellProto->spellLevel <= 0 || spellProto->spellLevel >= spellProto->maxLevel)
+ if (spellProto->SpellLevel <= 0 || spellProto->SpellLevel >= spellProto->MaxLevel)
return 1.0f;
float LvlPenalty = 0.0f;
- if (spellProto->spellLevel < 20)
- LvlPenalty = 20.0f - spellProto->spellLevel * 3.75f;
- float LvlFactor = (float(spellProto->spellLevel) + 6.0f) / float(getLevel());
+ if (spellProto->SpellLevel < 20)
+ LvlPenalty = 20.0f - spellProto->SpellLevel * 3.75f;
+ float LvlFactor = (float(spellProto->SpellLevel) + 6.0f) / float(getLevel());
if (LvlFactor > 1.0f)
LvlFactor = 1.0f;
@@ -2257,7 +2258,7 @@ void Unit::SendMeleeAttackStop(Unit* victim)
sLog->outDetail("%s %u stopped attacking %s %u", (GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), GetGUIDLow(), (victim->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), victim->GetGUIDLow());
}
-bool Unit::isSpellBlocked(Unit* victim, SpellEntry const* spellProto, WeaponAttackType attackType)
+bool Unit::isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttackType attackType)
{
// These spells can't be blocked
if (spellProto && spellProto->Attributes & SPELL_ATTR0_IMPOSSIBLE_DODGE_PARRY_BLOCK)
@@ -2285,16 +2286,16 @@ bool Unit::isBlockCritical()
return false;
}
-int32 Unit::GetMechanicResistChance(const SpellEntry *spell)
+int32 Unit::GetMechanicResistChance(const SpellInfo *spell)
{
if (!spell)
return 0;
int32 resist_mech = 0;
for (uint8 eff = 0; eff < MAX_SPELL_EFFECTS; ++eff)
{
- if (spell->Effect[eff] == 0)
+ if (spell->Effects[eff].Effect == 0)
break;
- int32 effect_mech = GetEffectMechanic(spell, eff);
+ int32 effect_mech = spell->GetEffectMechanic(eff);
if (effect_mech)
{
int32 temp = GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_MECHANIC_RESISTANCE, effect_mech);
@@ -2306,7 +2307,7 @@ int32 Unit::GetMechanicResistChance(const SpellEntry *spell)
}
// Melee based spells hit result calculations
-SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellEntry const* spell)
+SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell)
{
// Spells with SPELL_ATTR3_IGNORE_HIT_RESULT will additionally fully ignore
// resist and deflect chances
@@ -2322,7 +2323,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellEntry const* spell)
int32 attackerWeaponSkill;
// skill value for these spells (for example judgements) is 5* level
- if (spell->DmgClass == SPELL_DAMAGE_CLASS_RANGED && !IsRangedWeaponSpell(spell))
+ if (spell->DmgClass == SPELL_DAMAGE_CLASS_RANGED && !spell->IsRangedWeaponSpell())
attackerWeaponSkill = getLevel() * 5;
// bonus from skills is 0.04% per skill Diff
else
@@ -2344,7 +2345,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellEntry const* spell)
// Get effects mechanic and chance
for (uint8 eff = 0; eff < MAX_SPELL_EFFECTS; ++eff)
{
- int32 effect_mech = GetEffectMechanic(spell, eff);
+ int32 effect_mech = spell->GetEffectMechanic(eff);
if (effect_mech)
{
int32 temp = victim->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_MECHANIC_RESISTANCE, effect_mech);
@@ -2473,18 +2474,18 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellEntry const* spell)
}
// TODO need use unit spell resistances in calculations
-SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellEntry const* spell)
+SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spell)
{
// Can`t miss on dead target (on skinning for example)
if (!victim->isAlive() && victim->GetTypeId() != TYPEID_PLAYER)
return SPELL_MISS_NONE;
- SpellSchoolMask schoolMask = GetSpellSchoolMask(spell);
+ SpellSchoolMask schoolMask = spell->GetSchoolMask();
// PvP - PvE spell misschances per leveldif > 2
int32 lchance = victim->GetTypeId() == TYPEID_PLAYER ? 7 : 11;
int32 thisLevel = getLevelForTarget(victim);
if (GetTypeId() == TYPEID_UNIT && ToCreature()->isTrigger())
- thisLevel = std::max<int32>(thisLevel, spell->spellLevel);
+ thisLevel = std::max<int32>(thisLevel, spell->SpellLevel);
int32 leveldif = int32(victim->getLevelForTarget(this)) - thisLevel;
// Base hit chance from attacker and victim levels
@@ -2507,7 +2508,7 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellEntry const* spell)
// Chance hit from victim SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE auras
modHitChance += victim->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE, schoolMask);
// Reduce spell hit chance for Area of effect spells from victim SPELL_AURA_MOD_AOE_AVOIDANCE aura
- if (IsAreaOfEffectSpell(spell))
+ if (spell->IsAOE())
modHitChance -= victim->GetTotalAuraModifier(SPELL_AURA_MOD_AOE_AVOIDANCE);
// Decrease hit chance from victim rating bonus
@@ -2541,12 +2542,12 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellEntry const* spell)
tmp += resist_chance;
// Chance resist debuff
- if (!IsPositiveSpell(spell->Id))
+ if (!spell->IsPositive())
{
bool bNegativeAura = false;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- if (spell->EffectApplyAuraName[i] != 0)
+ if (spell->Effects[i].ApplyAuraName != 0)
{
bNegativeAura = true;
break;
@@ -2584,7 +2585,7 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellEntry const* spell)
// Parry
// For spells
// Resist
-SpellMissInfo Unit::SpellHitResult(Unit* victim, SpellEntry const* spell, bool CanReflect)
+SpellMissInfo Unit::SpellHitResult(Unit* victim, SpellInfo const* spell, bool CanReflect)
{
// Check for immune
if (victim->IsImmunedToSpell(spell))
@@ -2592,7 +2593,7 @@ SpellMissInfo Unit::SpellHitResult(Unit* victim, SpellEntry const* spell, bool C
// All positive spells can`t miss
// TODO: client not show miss log for this spells - so need find info for this in dbc and use it!
- if (IsPositiveSpell(spell->Id)
+ if (spell->IsPositive()
&&(!IsHostileTo(victim))) // prevent from affecting enemy by "positive" spell
return SPELL_MISS_NONE;
// Check for immune
@@ -2612,7 +2613,7 @@ SpellMissInfo Unit::SpellHitResult(Unit* victim, SpellEntry const* spell, bool C
int32 reflectchance = victim->GetTotalAuraModifier(SPELL_AURA_REFLECT_SPELLS);
Unit::AuraEffectList const& mReflectSpellsSchool = victim->GetAuraEffectsByType(SPELL_AURA_REFLECT_SPELLS_SCHOOL);
for (Unit::AuraEffectList::const_iterator i = mReflectSpellsSchool.begin(); i != mReflectSpellsSchool.end(); ++i)
- if ((*i)->GetMiscValue() & GetSpellSchoolMask(spell))
+ if ((*i)->GetMiscValue() & spell->GetSchoolMask())
reflectchance += (*i)->GetAmount();
if (reflectchance > 0 && roll_chance_i(reflectchance))
{
@@ -3009,7 +3010,7 @@ void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool wi
Spell* spell = m_currentSpells[spellType];
if (spell
&& (withDelayed || spell->getState() != SPELL_STATE_DELAYED)
- && (withInstant || spell->GetCastTime() > 0))
+ && (withInstant || spell->CalcCastTime() > 0))
{
// for example, do not let self-stun aura interrupt itself
if (!spell->IsInterruptable())
@@ -3046,7 +3047,7 @@ bool Unit::IsNonMeleeSpellCasted(bool withDelayed, bool skipChanneled, bool skip
// Maybe later some special spells will be excluded too.
// if checkInstant then instant spells shouldn't count as being casted
- if (!skipInstant && m_currentSpells[CURRENT_GENERIC_SPELL] && !m_currentSpells[CURRENT_GENERIC_SPELL]->GetCastTime())
+ if (!skipInstant && m_currentSpells[CURRENT_GENERIC_SPELL] && !m_currentSpells[CURRENT_GENERIC_SPELL]->CalcCastTime())
return false;
// generic spells are casted when they are not finished and not delayed
@@ -3097,7 +3098,7 @@ Spell* Unit::FindCurrentSpellBySpellId(uint32 spell_id) const
int32 Unit::GetCurrentSpellCastTime(uint32 spell_id) const
{
if (Spell const* spell = FindCurrentSpellBySpellId(spell_id))
- return spell->GetCastTime();
+ return spell->CalcCastTime();
return 0;
}
@@ -3145,14 +3146,14 @@ void Unit::DeMorph()
SetDisplayId(GetNativeDisplayId());
}
-Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellEntry const* newAura, uint8 effMask, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, uint64 casterGUID /*= 0*/)
+Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, uint64 casterGUID /*= 0*/)
{
ASSERT(casterGUID || caster);
if (!casterGUID)
casterGUID = caster->GetGUID();
// passive and Incanter's Absorption and auras with different type can stack with themselves any number of times
- if (!IsMultiSlotAura(newAura))
+ if (!newAura->IsMultiSlotAura())
{
// check if cast item changed
uint64 castItemGUID = 0;
@@ -3160,7 +3161,7 @@ Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellEntry const* newAura, uint
castItemGUID = castItem->GetGUID();
// find current aura from spell and change it's stackamount, or refresh it's duration
- if (Aura* foundAura = GetOwnedAura(newAura->Id, casterGUID, (sSpellMgr->GetSpellCustomAttr(newAura->Id) & SPELL_ATTR0_CU_ENCHANT_PROC) ? castItemGUID : 0, 0))
+ if (Aura* foundAura = GetOwnedAura(newAura->Id, casterGUID, (newAura->AttributesCu & SPELL_ATTR0_CU_ENCHANT_PROC) ? castItemGUID : 0, 0))
{
// effect masks do not match
// extremely rare case
@@ -3178,7 +3179,7 @@ Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellEntry const* newAura, uint
if (baseAmount)
bp = *(baseAmount + i);
else
- bp = foundAura->GetSpellProto()->EffectBasePoints[i];
+ bp = foundAura->GetSpellInfo()->Effects[i].BasePoints;
int32* oldBP = const_cast<int32*>(&(foundAura->GetEffect(i)->m_baseAmount));
*oldBP = bp;
@@ -3210,7 +3211,7 @@ void Unit::_AddAura(UnitAura* aura, Unit* caster)
if (aura->IsRemoved())
return;
- aura->SetIsSingleTarget(caster && IsSingleTargetSpell(aura->GetSpellProto()));
+ aura->SetIsSingleTarget(caster && aura->GetSpellInfo()->IsSingleTarget());
if (aura->IsSingleTarget())
{
ASSERT((IsInWorld() && !IsDuringRemoveFromWorld()) || (aura->GetCasterGUID() == GetGUID()));
@@ -3221,7 +3222,7 @@ void Unit::_AddAura(UnitAura* aura, Unit* caster)
for (Unit::AuraList::iterator itr = scAuras.begin(); itr != scAuras.end();)
{
if ((*itr) != aura &&
- IsSingleTargetSpells((*itr)->GetSpellProto(), aura->GetSpellProto()))
+ (*itr)->GetSpellInfo()->IsSingleTargetWith(aura->GetSpellInfo()))
{
(*itr)->Remove();
itr = scAuras.begin();
@@ -3244,11 +3245,11 @@ AuraApplication * Unit::_CreateAuraApplication(Aura* aura, uint8 effMask)
// aura mustn't be already applied on target
ASSERT (!aura->IsAppliedOnTarget(GetGUID()) && "Unit::_CreateAuraApplication: aura musn't be applied on target");
- SpellEntry const* aurSpellInfo = aura->GetSpellProto();
+ SpellInfo const* aurSpellInfo = aura->GetSpellInfo();
uint32 aurId = aurSpellInfo->Id;
// ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load)
- if (!isAlive() && !IsDeathPersistentSpell(aurSpellInfo) &&
+ if (!isAlive() && !aurSpellInfo->IsDeathPersistent() &&
(GetTypeId() != TYPEID_PLAYER || !ToPlayer()->GetSession()->PlayerLoading()))
return NULL;
@@ -3263,7 +3264,7 @@ AuraApplication * Unit::_CreateAuraApplication(Aura* aura, uint8 effMask)
AddInterruptMask(aurSpellInfo->AuraInterruptFlags);
}
- if (AuraState aState = GetSpellAuraState(aura->GetSpellProto()))
+ if (AuraStateType aState = aura->GetSpellInfo()->GetAuraState())
m_auraStateAuras.insert(AuraStateAurasMap::value_type(aState, aurApp));
aura->_ApplyForTarget(this, caster, aurApp);
@@ -3294,14 +3295,14 @@ void Unit::_ApplyAura(AuraApplication * aurApp, uint8 effMask)
return;
// Update target aura state flag
- if (AuraState aState = GetSpellAuraState(aura->GetSpellProto()))
+ if (AuraStateType aState = aura->GetSpellInfo()->GetAuraState())
ModifyAuraState(aState, true);
if (aurApp->GetRemoveMode())
return;
// Sitdown on apply aura req seated
- if (aura->GetSpellProto()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED && !IsSitState())
+ if (aura->GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED && !IsSitState())
SetStandState(UNIT_STAND_STATE_SIT);
Unit* caster = aura->GetCaster();
@@ -3341,14 +3342,14 @@ void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMo
// Remove all pointers from lists here to prevent possible pointer invalidation on spellcast/auraapply/auraremove
m_appliedAuras.erase(i);
- if (aura->GetSpellProto()->AuraInterruptFlags)
+ if (aura->GetSpellInfo()->AuraInterruptFlags)
{
m_interruptableAuras.remove(aurApp);
UpdateInterruptMask();
}
bool auraStateFound = false;
- AuraState auraState = GetSpellAuraState(aura->GetSpellProto());
+ AuraStateType auraState = aura->GetSpellInfo()->GetAuraState();
if (auraState)
{
bool canBreak = false;
@@ -3416,47 +3417,14 @@ void Unit::_UnapplyAura(AuraApplication * aurApp, AuraRemoveMode removeMode)
ASSERT(false);
}
-void Unit::_RemoveNoStackAuraApplicationsDueToAura(Aura* aura)
-{
- // dynobj auras can stack infinite number of times
- if (aura->GetType() == DYNOBJ_AURA_TYPE)
- return;
-
- SpellEntry const* spellProto = aura->GetSpellProto();
-
- uint32 spellId = spellProto->Id;
-
- // passive spell special case (only non stackable with ranks)
- if (IsPassiveSpell(spellId) && IsPassiveSpellStackableWithRanks(spellProto))
- return;
-
- bool remove = false;
- for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
- {
- if (remove)
- {
- remove = false;
- i = m_appliedAuras.begin();
- }
-
- if (!_IsNoStackAuraDueToAura(aura, i->second->GetBase()))
- continue;
-
- RemoveAura(i, AURA_REMOVE_BY_DEFAULT);
- if (i == m_appliedAuras.end())
- break;
- remove = true;
- }
-}
-
void Unit::_RemoveNoStackAurasDueToAura(Aura* aura)
{
- SpellEntry const* spellProto = aura->GetSpellProto();
+ SpellInfo const* spellProto = aura->GetSpellInfo();
uint32 spellId = spellProto->Id;
// passive spell special case (only non stackable with ranks)
- if (IsPassiveSpell(spellId) && IsPassiveSpellStackableWithRanks(spellProto))
+ if (spellProto->IsPassiveStackableWithRanks())
return;
bool remove = false;
@@ -3468,7 +3436,7 @@ void Unit::_RemoveNoStackAurasDueToAura(Aura* aura)
i = m_ownedAuras.begin();
}
- if (!_IsNoStackAuraDueToAura(aura, i->second))
+ if (aura->CanStackWith(i->second))
continue;
RemoveOwnedAura(i, AURA_REMOVE_BY_DEFAULT);
@@ -3478,53 +3446,6 @@ void Unit::_RemoveNoStackAurasDueToAura(Aura* aura)
}
}
-bool Unit::_IsNoStackAuraDueToAura(Aura* appliedAura, Aura* existingAura) const
-{
- SpellEntry const* spellProto = appliedAura->GetSpellProto();
- // Do not check already applied aura
- if (existingAura == appliedAura)
- return false;
-
- // Do not check dynobj auras for stacking
- if (existingAura->GetType() != UNIT_AURA_TYPE)
- return false;
-
- SpellEntry const* i_spellProto = existingAura->GetSpellProto();
- uint32 i_spellId = i_spellProto->Id;
- bool sameCaster = appliedAura->GetCasterGUID() == existingAura->GetCasterGUID();
-
- if (IsPassiveSpell(i_spellId))
- {
- // passive non-stackable spells not stackable only for same caster
- if (!sameCaster)
- return false;
-
- // passive non-stackable spells not stackable only with another rank of same spell
- if (!sSpellMgr->IsRankSpellDueToSpell(spellProto, i_spellId))
- return false;
- }
-
- bool is_triggered_by_spell = false;
- // prevent triggering aura of removing aura that triggered it
- // prevent triggered aura of removing aura that triggering it (triggered effect early some aura of parent spell
- for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
- {
- if (i_spellProto->EffectTriggerSpell[j] == spellProto->Id
- || spellProto->EffectTriggerSpell[j] == i_spellProto->Id) // I do not know what is this for
- {
- is_triggered_by_spell = true;
- break;
- }
- }
-
- if (is_triggered_by_spell)
- return false;
-
- if (sSpellMgr->CanAurasStack(appliedAura, existingAura, sameCaster))
- return false;
- return true;
-}
-
void Unit::_RegisterAuraEffect(AuraEffect* aurEff, bool apply)
{
if (apply)
@@ -3700,17 +3621,17 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit
Aura* aura = iter->second;
if (aura->GetCasterGUID() == casterGUID)
{
- if (aura->GetSpellProto()->AttributesEx7 & SPELL_ATTR7_DISPEL_CHARGES)
+ if (aura->GetSpellInfo()->AttributesEx7 & SPELL_ATTR7_DISPEL_CHARGES)
aura->ModCharges(-chargesRemoved, AURA_REMOVE_BY_ENEMY_SPELL);
else
aura->ModStackAmount(-chargesRemoved, AURA_REMOVE_BY_ENEMY_SPELL);
- switch (aura->GetSpellProto()->SpellFamilyName)
+ switch (aura->GetSpellInfo()->SpellFamilyName)
{
case SPELLFAMILY_WARLOCK:
{
// Unstable Affliction (crash if before removeaura?)
- if (aura->GetSpellProto()->SpellFamilyFlags[1] & 0x0100)
+ if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x0100)
{
Unit* caster = aura->GetCaster();
if (!caster)
@@ -3727,7 +3648,7 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit
case SPELLFAMILY_DRUID:
{
// Lifebloom
- if (aura->GetSpellProto()->SpellFamilyFlags[1] & 0x10)
+ if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x10)
{
if (AuraEffect const* aurEff = aura->GetEffect(EFFECT_1))
{
@@ -3739,7 +3660,7 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit
// mana
if (Unit* caster = aura->GetCaster())
{
- int32 mana = CalculatePctU(caster->GetCreateMana(), aura->GetSpellProto()->ManaCostPercentage) * chargesRemoved / 2;
+ int32 mana = CalculatePctU(caster->GetCreateMana(), aura->GetSpellInfo()->ManaCostPercentage) * chargesRemoved / 2;
caster->CastCustomSpell(caster, 64372, &mana, NULL, NULL, true, NULL, NULL, aura->GetCasterGUID());
}
}
@@ -3749,7 +3670,7 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit
case SPELLFAMILY_SHAMAN:
{
// Flame Shock
- if (aura->GetSpellProto()->SpellFamilyFlags[0] & 0x10000000)
+ if (aura->GetSpellInfo()->SpellFamilyFlags[0] & 0x10000000)
{
if (Unit* caster = aura->GetCaster())
{
@@ -3818,7 +3739,7 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit*
}
}
- bool stealCharge = aura->GetSpellProto()->AttributesEx7 & SPELL_ATTR7_DISPEL_CHARGES;
+ bool stealCharge = aura->GetSpellInfo()->AttributesEx7 & SPELL_ATTR7_DISPEL_CHARGES;
int32 dur = std::min(2 * MINUTE * IN_MILLISECONDS, aura->GetDuration());
if (Aura* newAura = stealer->GetAura(aura->GetId(), aura->GetCasterGUID()))
@@ -3835,7 +3756,7 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit*
if (aura->IsSingleTarget())
aura->UnregisterSingleTarget();
- if (Aura* newAura = Aura::TryRefreshStackOrCreate(aura->GetSpellProto(), effMask, stealer, NULL, &baseDamage[0], NULL, aura->GetCasterGUID()))
+ if (Aura* newAura = Aura::TryRefreshStackOrCreate(aura->GetSpellInfo(), effMask, stealer, NULL, &baseDamage[0], NULL, aura->GetCasterGUID()))
{
// created aura must not be single target aura,, so stealer won't loose it on recast
if (newAura->IsSingleTarget())
@@ -3900,7 +3821,7 @@ void Unit::RemoveAurasWithAttribute(uint32 flags)
{
for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
{
- SpellEntry const* spell = iter->second->GetBase()->GetSpellProto();
+ SpellInfo const* spell = iter->second->GetBase()->GetSpellInfo();
if (spell->Attributes & flags)
RemoveAura(iter);
else
@@ -3916,7 +3837,7 @@ void Unit::RemoveNotOwnSingleTargetAuras(uint32 newPhase)
AuraApplication const* aurApp = iter->second;
Aura const* aura = aurApp->GetBase();
- if (aura->GetCasterGUID() != GetGUID() && IsSingleTargetSpell(aura->GetSpellProto()))
+ if (aura->GetCasterGUID() != GetGUID() && aura->GetSpellInfo()->IsSingleTarget())
{
if (!newPhase)
RemoveAura(iter);
@@ -3958,7 +3879,7 @@ void Unit::RemoveAurasWithInterruptFlags(uint32 flag, uint32 except)
{
Aura* aura = (*iter)->GetBase();
++iter;
- if ((aura->GetSpellProto()->AuraInterruptFlags & flag) && (!except || aura->GetId() != except))
+ if ((aura->GetSpellInfo()->AuraInterruptFlags & flag) && (!except || aura->GetId() != except))
{
uint32 removedAuras = m_removedAurasCount;
RemoveAura(aura);
@@ -3984,7 +3905,7 @@ void Unit::RemoveAurasWithFamily(SpellFamilyNames family, uint32 familyFlag1, ui
Aura const* aura = iter->second->GetBase();
if (!casterGUID || aura->GetCasterGUID() == casterGUID)
{
- SpellEntry const* spell = aura->GetSpellProto();
+ SpellInfo const* spell = aura->GetSpellInfo();
if (spell->SpellFamilyName == uint32(family) && spell->SpellFamilyFlags.HasFlag(familyFlag1, familyFlag2, familyFlag3))
{
RemoveAura(iter);
@@ -4007,7 +3928,7 @@ void Unit::RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemo
Aura const* aura = iter->second->GetBase();
if (!except || aura->GetId() != except)
{
- if (GetAllSpellMechanicMask(aura->GetSpellProto()) & mechanic_mask)
+ if (aura->GetSpellInfo()->GetAllEffectsMechanicMask() & mechanic_mask)
{
RemoveAura(iter, removemode);
continue;
@@ -4074,9 +3995,9 @@ void Unit::RemoveArenaAuras()
{
AuraApplication const* aurApp = iter->second;
Aura const* aura = aurApp->GetBase();
- if (!(aura->GetSpellProto()->AttributesEx4 & SPELL_ATTR4_UNK21) // don't remove stances, shadowform, pally/hunter auras
+ if (!(aura->GetSpellInfo()->AttributesEx4 & SPELL_ATTR4_UNK21) // don't remove stances, shadowform, pally/hunter auras
&& !aura->IsPassive() // don't remove passive auras
- && (aurApp->IsPositive() || !(aura->GetSpellProto()->AttributesEx3 & SPELL_ATTR3_DEATH_PERSISTENT))) // not negative death persistent auras
+ && (aurApp->IsPositive() || !(aura->GetSpellInfo()->AttributesEx3 & SPELL_ATTR3_DEATH_PERSISTENT))) // not negative death persistent auras
RemoveAura(iter);
else
++iter;
@@ -4111,7 +4032,7 @@ void Unit::RemoveAllAurasRequiringDeadTarget()
for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
{
Aura const* aura = iter->second->GetBase();
- if (!aura->IsPassive() && IsRequiringDeadTargetSpell(aura->GetSpellProto()))
+ if (!aura->IsPassive() && aura->GetSpellInfo()->IsRequiringDeadTarget())
_UnapplyAura(iter, AURA_REMOVE_BY_DEFAULT);
else
++iter;
@@ -4120,7 +4041,7 @@ void Unit::RemoveAllAurasRequiringDeadTarget()
for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
{
Aura* aura = iter->second;
- if (!aura->IsPassive() && IsRequiringDeadTargetSpell(aura->GetSpellProto()))
+ if (!aura->IsPassive() && aura->GetSpellInfo()->IsRequiringDeadTarget())
RemoveOwnedAura(iter, AURA_REMOVE_BY_DEFAULT);
else
++iter;
@@ -4132,7 +4053,7 @@ void Unit::RemoveAllAurasExceptType(AuraType type)
for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
{
Aura const* aura = iter->second->GetBase();
- if (!IsSpellHaveAura(aura->GetSpellProto(), type))
+ if (!aura->GetSpellInfo()->HasAura(type))
_UnapplyAura(iter, AURA_REMOVE_BY_DEFAULT);
else
++iter;
@@ -4141,7 +4062,7 @@ void Unit::RemoveAllAurasExceptType(AuraType type)
for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
{
Aura* aura = iter->second;
- if (!IsSpellHaveAura(aura->GetSpellProto(), type))
+ if (!aura->GetSpellInfo()->HasAura(type))
RemoveOwnedAura(iter, AURA_REMOVE_BY_DEFAULT);
else
++iter;
@@ -4190,15 +4111,11 @@ AuraEffect* Unit::GetAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster) c
AuraEffect* Unit::GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, uint64 caster) const
{
uint32 rankSpell = sSpellMgr->GetFirstSpellInChain(spellId);
- while (true)
+ while (rankSpell)
{
if (AuraEffect* aurEff = GetAuraEffect(rankSpell, effIndex, caster))
return aurEff;
- SpellChainNode const* chainNode = sSpellMgr->GetSpellChainNode(rankSpell);
- if (!chainNode)
- break;
- else
- rankSpell = chainNode->next;
+ rankSpell = sSpellMgr->GetNextSpellInChain(rankSpell);
}
return NULL;
}
@@ -4210,7 +4127,7 @@ AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames name, uint32 ico
{
if (effIndex != (*itr)->GetEffIndex())
continue;
- SpellEntry const* spell = (*itr)->GetSpellProto();
+ SpellInfo const* spell = (*itr)->GetSpellInfo();
if (spell->SpellIconID == iconId && spell->SpellFamilyName == uint32(name) && !spell->SpellFamilyFlags)
return *itr;
}
@@ -4222,7 +4139,7 @@ AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 f
AuraEffectList const& auras = GetAuraEffectsByType(type);
for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
{
- SpellEntry const* spell = (*i)->GetSpellProto();
+ SpellInfo const* spell = (*i)->GetSpellInfo();
if (spell->SpellFamilyName == uint32(family) && spell->SpellFamilyFlags.HasFlag(familyFlag1, familyFlag2, familyFlag3))
{
if (casterGUID && (*i)->GetCasterGUID() != casterGUID)
@@ -4253,15 +4170,11 @@ Aura* Unit::GetAura(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, ui
AuraApplication * Unit::GetAuraApplicationOfRankedSpell(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask, AuraApplication* except) const
{
uint32 rankSpell = sSpellMgr->GetFirstSpellInChain(spellId);
- while (true)
+ while (rankSpell)
{
if (AuraApplication * aurApp = GetAuraApplication(rankSpell, casterGUID, itemCasterGUID, reqEffMask, except))
return aurApp;
- SpellChainNode const* chainNode = sSpellMgr->GetSpellChainNode(rankSpell);
- if (!chainNode)
- break;
- else
- rankSpell = chainNode->next;
+ rankSpell = sSpellMgr->GetNextSpellInChain(rankSpell);
}
return NULL;
}
@@ -4323,7 +4236,7 @@ bool Unit::HasAuraTypeWithMiscvalue(AuraType auratype, int32 miscvalue) const
return false;
}
-bool Unit::HasAuraTypeWithAffectMask(AuraType auratype, SpellEntry const* affectedSpell) const
+bool Unit::HasAuraTypeWithAffectMask(AuraType auratype, SpellInfo const* affectedSpell) const
{
AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
@@ -4347,7 +4260,7 @@ bool Unit::HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid)
return false;
for (AuraApplicationList::iterator iter = m_interruptableAuras.begin(); iter != m_interruptableAuras.end(); ++iter)
{
- if (!(*iter)->IsPositive() && (*iter)->GetBase()->GetSpellProto()->AuraInterruptFlags & flag && (!guid || (*iter)->GetBase()->GetCasterGUID() == guid))
+ if (!(*iter)->IsPositive() && (*iter)->GetBase()->GetSpellInfo()->AuraInterruptFlags & flag && (!guid || (*iter)->GetBase()->GetCasterGUID() == guid))
return true;
}
return false;
@@ -4358,7 +4271,7 @@ bool Unit::HasNegativeAuraWithAttribute(uint32 flag, uint64 guid)
for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end(); ++iter)
{
Aura const* aura = iter->second->GetBase();
- if (!iter->second->IsPositive() && aura->GetSpellProto()->Attributes & flag && (!guid || aura->GetCasterGUID() == guid))
+ if (!iter->second->IsPositive() && aura->GetSpellInfo()->Attributes & flag && (!guid || aura->GetCasterGUID() == guid))
return true;
}
return false;
@@ -4368,20 +4281,20 @@ bool Unit::HasAuraWithMechanic(uint32 mechanicMask)
{
for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end(); ++iter)
{
- SpellEntry const* spellInfo = iter->second->GetBase()->GetSpellProto();
+ SpellInfo const* spellInfo = iter->second->GetBase()->GetSpellInfo();
if (spellInfo->Mechanic && (mechanicMask & (1 << spellInfo->Mechanic)))
return true;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (iter->second->HasEffect(i) && spellInfo->Effect[i] && spellInfo->EffectMechanic[i])
- if (mechanicMask & (1 << spellInfo->EffectMechanic[i]))
+ if (iter->second->HasEffect(i) && spellInfo->Effects[i].Effect && spellInfo->Effects[i].Mechanic)
+ if (mechanicMask & (1 << spellInfo->Effects[i].Mechanic))
return true;
}
return false;
}
-AuraEffect* Unit::IsScriptOverriden(SpellEntry const* spell, int32 script) const
+AuraEffect* Unit::IsScriptOverriden(SpellInfo const* spell, int32 script) const
{
AuraEffectList const& auras = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
@@ -4408,7 +4321,7 @@ uint32 Unit::GetDiseasesByCaster(uint64 casterGUID, bool remove)
for (AuraEffectList::iterator i = m_modAuras[*itr].begin(); i != m_modAuras[*itr].end();)
{
// Get auras with disease dispel type by caster
- if ((*i)->GetSpellProto()->Dispel == DISPEL_DISEASE
+ if ((*i)->GetSpellInfo()->Dispel == DISPEL_DISEASE
&& (*i)->GetCasterGUID() == casterGUID)
{
++diseases;
@@ -4605,7 +4518,7 @@ int32 Unit::GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_
return modifier;
}
-int32 Unit::GetTotalAuraModifierByAffectMask(AuraType auratype, SpellEntry const* affectedSpell) const
+int32 Unit::GetTotalAuraModifierByAffectMask(AuraType auratype, SpellInfo const* affectedSpell) const
{
int32 modifier = 0;
@@ -4618,7 +4531,7 @@ int32 Unit::GetTotalAuraModifierByAffectMask(AuraType auratype, SpellEntry const
return modifier;
}
-float Unit::GetTotalAuraMultiplierByAffectMask(AuraType auratype, SpellEntry const* affectedSpell) const
+float Unit::GetTotalAuraMultiplierByAffectMask(AuraType auratype, SpellInfo const* affectedSpell) const
{
float multiplier = 1.0f;
@@ -4631,7 +4544,7 @@ float Unit::GetTotalAuraMultiplierByAffectMask(AuraType auratype, SpellEntry con
return multiplier;
}
-int32 Unit::GetMaxPositiveAuraModifierByAffectMask(AuraType auratype, SpellEntry const* affectedSpell) const
+int32 Unit::GetMaxPositiveAuraModifierByAffectMask(AuraType auratype, SpellInfo const* affectedSpell) const
{
int32 modifier = 0;
@@ -4645,7 +4558,7 @@ int32 Unit::GetMaxPositiveAuraModifierByAffectMask(AuraType auratype, SpellEntry
return modifier;
}
-int32 Unit::GetMaxNegativeAuraModifierByAffectMask(AuraType auratype, SpellEntry const* affectedSpell) const
+int32 Unit::GetMaxNegativeAuraModifierByAffectMask(AuraType auratype, SpellInfo const* affectedSpell) const
{
int32 modifier = 0;
@@ -4722,7 +4635,7 @@ void Unit::AddGameObject(GameObject* gameObj)
if (GetTypeId() == TYPEID_PLAYER && gameObj->GetSpellId())
{
- SpellEntry const* createBySpell = sSpellStore.LookupEntry(gameObj->GetSpellId());
+ SpellInfo const* createBySpell = sSpellMgr->GetSpellInfo(gameObj->GetSpellId());
// Need disable spell use for owner
if (createBySpell && createBySpell->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases)
@@ -4752,7 +4665,7 @@ void Unit::RemoveGameObject(GameObject* gameObj, bool del)
if (GetTypeId() == TYPEID_PLAYER)
{
- SpellEntry const* createBySpell = sSpellStore.LookupEntry(spellid);
+ SpellInfo const* createBySpell = sSpellMgr->GetSpellInfo(spellid);
// Need activate spell use for owner
if (createBySpell && createBySpell->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases)
@@ -4839,7 +4752,7 @@ void Unit::SendSpellNonMeleeDamageLog(Unit* target, uint32 SpellID, uint32 Damag
SendSpellNonMeleeDamageLog(&log);
}
-void Unit::ProcDamageAndSpell(Unit* victim, uint32 procAttacker, uint32 procVictim, uint32 procExtra, uint32 amount, WeaponAttackType attType, SpellEntry const* procSpell, SpellEntry const* procAura)
+void Unit::ProcDamageAndSpell(Unit* victim, uint32 procAttacker, uint32 procVictim, uint32 procExtra, uint32 amount, WeaponAttackType attType, SpellInfo const* procSpell, SpellInfo const* procAura)
{
// Not much to do if no flags are set.
if (procAttacker)
@@ -4866,7 +4779,7 @@ void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo)
case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
data << uint32(pInfo->damage); // damage
data << uint32(pInfo->overDamage); // overkill?
- data << uint32(GetSpellSchoolMask(aura->GetSpellProto()));
+ data << uint32(aura->GetSpellInfo()->GetSchoolMask());
data << uint32(pInfo->absorb); // absorb
data << uint32(pInfo->resist); // resist
data << uint8(pInfo->critical); // new 3.1.2 critical tick
@@ -5008,9 +4921,9 @@ void Unit::SendAttackStateUpdate(uint32 HitInfo, Unit* target, uint8 /*SwingType
SendAttackStateUpdate(&dmgInfo);
}
-bool Unit::HandleHasteAuraProc(Unit* victim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 cooldown)
+bool Unit::HandleHasteAuraProc(Unit* victim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 cooldown)
{
- SpellEntry const* hasteSpell = triggeredByAura->GetSpellProto();
+ SpellInfo const* hasteSpell = triggeredByAura->GetSpellInfo();
Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER
? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : NULL;
@@ -5045,7 +4958,7 @@ bool Unit::HandleHasteAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (!triggered_spell_id)
return true;
- SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id);
+ SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!triggerEntry)
{
@@ -5054,7 +4967,7 @@ bool Unit::HandleHasteAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
}
// default case
- if ((!target && !sSpellMgr->IsSrcTargetSpell(triggerEntry)) || (target && target != this && !target->isAlive()))
+ if ((!target && triggerEntry->IsRequiringSelectedTarget()) || (target && target != this && !target->isAlive()))
return false;
if (cooldown && GetTypeId() == TYPEID_PLAYER && ToPlayer()->HasSpellCooldown(triggered_spell_id))
@@ -5071,9 +4984,9 @@ bool Unit::HandleHasteAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return true;
}
-bool Unit::HandleSpellCritChanceAuraProc(Unit* victim, uint32 /*damage*/, AuraEffect* triggeredByAura, SpellEntry const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 cooldown)
+bool Unit::HandleSpellCritChanceAuraProc(Unit* victim, uint32 /*damage*/, AuraEffect* triggeredByAura, SpellInfo const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 cooldown)
{
- SpellEntry const* triggeredByAuraSpell = triggeredByAura->GetSpellProto();
+ SpellInfo const* triggeredByAuraSpell = triggeredByAura->GetSpellInfo();
Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER
? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : NULL;
@@ -5107,7 +5020,7 @@ bool Unit::HandleSpellCritChanceAuraProc(Unit* victim, uint32 /*damage*/, AuraEf
if (!triggered_spell_id)
return true;
- SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id);
+ SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!triggerEntry)
{
@@ -5133,9 +5046,9 @@ bool Unit::HandleSpellCritChanceAuraProc(Unit* victim, uint32 /*damage*/, AuraEf
return true;
}
-bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown)
+bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown)
{
- SpellEntry const* dummySpell = triggeredByAura->GetSpellProto();
+ SpellInfo const* dummySpell = triggeredByAura->GetSpellInfo();
uint32 effIndex = triggeredByAura->GetEffIndex();
int32 triggerAmount = triggeredByAura->GetAmount();
@@ -5213,7 +5126,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (!GetAuraEffect(SPELL_AURA_MOD_MANA_REGEN_INTERRUPT, SPELLFAMILY_MAGE, 0x10000000, 0, 0))
return false;
- switch(GetFirstSchoolInMask(GetSpellSchoolMask(procSpell)))
+ switch(GetFirstSchoolInMask(procSpell->GetSchoolMask()))
{
case SPELL_SCHOOL_NORMAL:
case SPELL_SCHOOL_HOLY:
@@ -5236,7 +5149,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (!procSpell)
return false;
- switch(GetFirstSchoolInMask(GetSpellSchoolMask(procSpell)))
+ switch(GetFirstSchoolInMask(procSpell->GetSchoolMask()))
{
case SPELL_SCHOOL_NORMAL:
return false; // ignore
@@ -5726,7 +5639,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return false;
// mana cost save
- int32 cost = int32(procSpell->manaCost + CalculatePctU(GetCreateMana(), procSpell->ManaCostPercentage));
+ int32 cost = int32(procSpell->ManaCost + CalculatePctU(GetCreateMana(), procSpell->ManaCostPercentage));
basepoints0 = CalculatePctN(cost, triggerAmount);
if (basepoints0 <= 0)
return false;
@@ -5781,7 +5694,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (!procSpell)
return false;
- int32 cost = int32(procSpell->manaCost + CalculatePctU(GetCreateMana(), procSpell->ManaCostPercentage));
+ int32 cost = int32(procSpell->ManaCost + CalculatePctU(GetCreateMana(), procSpell->ManaCostPercentage));
basepoints0 = CalculatePctN(cost, triggerAmount);
if (basepoints0 <= 0)
return false;
@@ -5853,7 +5766,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// remove cooldowns on all ranks of Frost Nova
for (SpellCooldowns::const_iterator itr = cooldowns.begin(); itr != cooldowns.end(); ++itr)
{
- SpellEntry const* cdSpell = sSpellStore.LookupEntry(itr->first);
+ SpellInfo const* cdSpell = sSpellMgr->GetSpellInfo(itr->first);
// Frost Nova
if (cdSpell && cdSpell->SpellFamilyName == SPELLFAMILY_MAGE
&& cdSpell->SpellFamilyFlags[0] & 0x00000040)
@@ -5941,7 +5854,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (procSpell == 0 || !(procEx & (PROC_EX_NORMAL_HIT|PROC_EX_CRITICAL_HIT)) || this == victim)
return false;
// Need stun or root mechanic
- if (!(GetAllSpellMechanicMask(procSpell) & ((1<<MECHANIC_ROOT)|(1<<MECHANIC_STUN))))
+ if (!(procSpell->GetAllEffectsMechanicMask() & ((1<<MECHANIC_ROOT)|(1<<MECHANIC_STUN))))
return false;
switch (dummySpell->Id)
@@ -6002,7 +5915,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Remove aura (before cast for prevent infinite loop handlers)
RemoveAurasDueToSpell(triggeredByAura->GetId());
- uint32 spell = sSpellMgr->GetSpellWithRank(27285, sSpellMgr->GetSpellRank(dummySpell->Id));
+ uint32 spell = sSpellMgr->GetSpellWithRank(27285, dummySpell->GetRank());
// Cast finish spell (triggeredByAura already not exist!)
if (Unit* caster = GetUnit(*this, casterGuid))
@@ -6220,20 +6133,20 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
triggered_spell_id = 56161;
- SpellEntry const* GoPoH = sSpellStore.LookupEntry(triggered_spell_id);
+ SpellInfo const* GoPoH = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!GoPoH)
return false;
int EffIndex = 0;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; i++)
{
- if (GoPoH->Effect[i] == SPELL_EFFECT_APPLY_AURA)
+ if (GoPoH->Effects[i].Effect == SPELL_EFFECT_APPLY_AURA)
{
EffIndex = i;
break;
}
}
- int32 tickcount = GetSpellMaxDuration(GoPoH) / GoPoH->EffectAmplitude[EffIndex];
+ int32 tickcount = GoPoH->GetMaxDuration() / GoPoH->Effects[EffIndex].Amplitude;
if (!tickcount)
return false;
@@ -6275,7 +6188,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Frozen Shadoweave (Shadow's Embrace set) warning! its not only priest set
case 39372:
{
- if (!procSpell || (GetSpellSchoolMask(procSpell) & (SPELL_SCHOOL_MASK_FROST | SPELL_SCHOOL_MASK_SHADOW)) == 0)
+ if (!procSpell || (procSpell->GetSchoolMask() & (SPELL_SCHOOL_MASK_FROST | SPELL_SCHOOL_MASK_SHADOW)) == 0)
return false;
// heal amount
@@ -6296,10 +6209,10 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (procSpell->SpellFamilyFlags[0] & 0x800)
{
triggered_spell_id = 70772;
- SpellEntry const* blessHealing = sSpellStore.LookupEntry(triggered_spell_id);
+ SpellInfo const* blessHealing = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!blessHealing)
return false;
- basepoints0 = int32(CalculatePctN(damage, triggerAmount) / (GetSpellMaxDuration(blessHealing) / blessHealing->EffectAmplitude[0]));
+ basepoints0 = int32(CalculatePctN(damage, triggerAmount) / (blessHealing->GetMaxDuration() / blessHealing->Effects[0].Amplitude));
}
break;
}
@@ -6315,7 +6228,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (procSpell->SpellIconID != 62)
return false;
- int32 mana_perc = SpellMgr::CalculateSpellEffectAmount(triggeredByAura->GetSpellProto(), triggeredByAura->GetEffIndex());
+ int32 mana_perc = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcValue();
basepoints0 = int32(CalculatePctN(GetCreatePowers(POWER_MANA), mana_perc) / 10);
triggered_spell_id = 54833;
target = this;
@@ -6337,7 +6250,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
uint32 CountMin = AurEff->GetBase()->GetMaxDuration();
// just Rip's max duration without other spells
- uint32 CountMax = GetSpellMaxDuration(AurEff->GetSpellProto());
+ uint32 CountMax = AurEff->GetSpellInfo()->GetMaxDuration();
// add possible auras' and Glyph of Shred's max duration
CountMax += 3 * triggerAmount * IN_MILLISECONDS; // Glyph of Shred -> +6 seconds
@@ -6359,7 +6272,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Glyph of Rake
case 54821:
{
- if (procSpell->SpellVisual[0] == 750 && procSpell->EffectApplyAuraName[1] == 3)
+ if (procSpell->SpellVisual[0] == 750 && procSpell->Effects[1].ApplyAuraName == 3)
{
if (target->GetTypeId() == TYPEID_UNIT)
{
@@ -6390,7 +6303,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
case 28719:
{
// mana back
- basepoints0 = int32(CalculatePctN(procSpell->manaCost, 30));
+ basepoints0 = int32(CalculatePctN(procSpell->ManaCost, 30));
target = this;
triggered_spell_id = 28742;
break;
@@ -6465,10 +6378,10 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if ((procSpell->SpellFamilyFlags[0] & 0x5) && (procEx & PROC_EX_CRITICAL_HIT))
{
triggered_spell_id = 71023;
- SpellEntry const* triggeredSpell = sSpellStore.LookupEntry(triggered_spell_id);
+ SpellInfo const* triggeredSpell = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!triggeredSpell)
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount) / (GetSpellMaxDuration(triggeredSpell) / triggeredSpell->EffectAmplitude[0]);
+ basepoints0 = CalculatePctN(int32(damage), triggerAmount) / (triggeredSpell->GetMaxDuration() / triggeredSpell->Effects[0].Amplitude);
// Add remaining ticks to damage done
basepoints0 += victim->GetRemainingPeriodicAmount(GetGUID(), triggered_spell_id, SPELL_AURA_PERIODIC_DAMAGE);
}
@@ -6499,7 +6412,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
bool isWrathSpell = (procSpell->SpellFamilyFlags[0] & 1);
- if (!roll_chance_f(dummySpell->procChance * (isWrathSpell ? 0.6f : 1.0f)))
+ if (!roll_chance_f(dummySpell->ProcChance * (isWrathSpell ? 0.6f : 1.0f)))
return false;
target = this;
@@ -6570,7 +6483,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// lookup Slice and Dice
if (AuraEffect const* aur = GetAuraEffect(SPELL_AURA_MOD_MELEE_HASTE, SPELLFAMILY_ROGUE, 0x40000, 0, 0))
{
- aur->GetBase()->SetDuration(GetSpellMaxDuration(aur->GetSpellProto()), true);
+ aur->GetBase()->SetDuration(aur->GetSpellInfo()->GetMaxDuration(), true);
return true;
}
return false;
@@ -6588,7 +6501,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return false;
// energy cost save
- basepoints0 = CalculatePctN(int32(procSpell->manaCost), triggerAmount);
+ basepoints0 = CalculatePctN(int32(procSpell->ManaCost), triggerAmount);
if (basepoints0 <= 0)
return false;
@@ -6615,10 +6528,10 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (procSpell->SpellFamilyFlags[2] & 0x200)
{
if (AuraEffect const* pEff = victim->GetAuraEffect(SPELL_AURA_PERIODIC_DUMMY, SPELLFAMILY_HUNTER, 0x0, 0x80000000, 0x0, GetGUID()))
- basepoints0 = CalculatePowerCost(pEff->GetSpellProto(), this, SpellSchoolMask(pEff->GetSpellProto()->SchoolMask)) * 4/10/3;
+ basepoints0 = pEff->GetSpellInfo()->CalcPowerCost(this, SpellSchoolMask(pEff->GetSpellInfo()->SchoolMask)) * 4/10/3;
}
else
- basepoints0 = CalculatePowerCost(procSpell, this, SpellSchoolMask(procSpell->SchoolMask)) * 4/10;
+ basepoints0 = procSpell->CalcPowerCost(this, SpellSchoolMask(procSpell->SchoolMask)) * 4/10;
ToPlayer()->SetSpellModTakingSpell(spell, true);
@@ -6639,7 +6552,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Improved Mend Pet
if (dummySpell->SpellIconID == 267)
{
- int32 chance = SpellMgr::CalculateSpellEffectAmount(triggeredByAura->GetSpellProto(), triggeredByAura->GetEffIndex());
+ int32 chance = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcValue();
if (!roll_chance_i(chance))
return false;
@@ -6955,7 +6868,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
chance = 15.0f;
}
// Judgement (any)
- else if (GetSpellSpecific(procSpell) == SPELL_SPECIFIC_JUDGEMENT)
+ else if (procSpell->GetSpellSpecific() == SPELL_SPECIFIC_JUDGEMENT)
{
triggered_spell_id = 40472;
chance = 50.0f;
@@ -7172,14 +7085,14 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
}
}
- SpellEntry const* windfurySpellEntry = sSpellStore.LookupEntry(spellId);
- if (!windfurySpellEntry)
+ SpellInfo const* windfurySpellInfo = sSpellMgr->GetSpellInfo(spellId);
+ if (!windfurySpellInfo)
{
sLog->outError("Unit::HandleDummyAuraProc: non existed spell id: %u (Windfury)", spellId);
return false;
}
- int32 extra_attack_power = CalculateSpellDamage(victim, windfurySpellEntry, 1);
+ int32 extra_attack_power = CalculateSpellDamage(victim, windfurySpellInfo, 1);
// Value gained from additional AP
basepoints0 = int32(extra_attack_power / 14.0f * GetAttackTime(BASE_ATTACK) / 1000);
@@ -7262,10 +7175,10 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (procSpell->SpellFamilyFlags[1] & 0x1000)
{
triggered_spell_id = 71824;
- SpellEntry const* triggeredSpell = sSpellStore.LookupEntry(triggered_spell_id);
+ SpellInfo const* triggeredSpell = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!triggeredSpell)
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount) / (GetSpellMaxDuration(triggeredSpell) / triggeredSpell->EffectAmplitude[0]);
+ basepoints0 = CalculatePctN(int32(damage), triggerAmount) / (triggeredSpell->GetMaxDuration() / triggeredSpell->Effects[0].Amplitude);
}
break;
}
@@ -7276,10 +7189,10 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if ((procSpell->SpellFamilyFlags[0] & 0x100) && (procEx & PROC_EX_CRITICAL_HIT))
{
triggered_spell_id = 70809;
- SpellEntry const* triggeredSpell = sSpellStore.LookupEntry(triggered_spell_id);
+ SpellInfo const* triggeredSpell = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!triggeredSpell)
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount) / (GetSpellMaxDuration(triggeredSpell) / triggeredSpell->EffectAmplitude[0]);
+ basepoints0 = CalculatePctN(int32(damage), triggerAmount) / (triggeredSpell->GetMaxDuration() / triggeredSpell->Effects[0].Amplitude);
}
break;
}
@@ -7337,7 +7250,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
AuraEffectList const& auras = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE);
for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
{
- SpellEntry const* spell = (*i)->GetSpellProto();
+ SpellInfo const* spell = (*i)->GetSpellInfo();
if (spell->SpellFamilyName == uint32(SPELLFAMILY_SHAMAN) && spell->SpellFamilyFlags.HasFlag(0, 0x02000000, 0))
{
if ((*i)->GetCasterGUID() != GetGUID())
@@ -7415,7 +7328,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (GetTypeId() != TYPEID_PLAYER || !victim || !victim->isAlive() || !castItem || !castItem->IsEquipped())
return false;
- float fire_onhit = float(CalculatePctF(SpellMgr::CalculateSpellEffectAmount(dummySpell, 0), 1.0f));
+ float fire_onhit = float(CalculatePctF(dummySpell->Effects[EFFECT_0]. CalcValue(), 1.0f));
float add_spellpower = (float)(SpellBaseDamageBonus(SPELL_SCHOOL_MASK_FIRE)
+ SpellBaseDamageBonusForVictim(SPELL_SCHOOL_MASK_FIRE, victim));
@@ -7469,7 +7382,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Water Shield
if (AuraEffect const* aurEff = GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN, 0, 0x00000020, 0))
{
- uint32 spell = aurEff->GetSpellProto()->EffectTriggerSpell[aurEff->GetEffIndex()];
+ uint32 spell = aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
CastSpell(this, spell, true, castItem, triggeredByAura);
return true;
}
@@ -7524,7 +7437,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Chain lightning has [LightOverload_Proc_Chance] / [Max_Number_of_Targets] chance to proc of each individual target hit.
// A maxed LO would have a 33% / 3 = 11% chance to proc of each target.
// LO chance was already "accounted" at the proc chance roll, now need to divide the chance by [Max_Number_of_Targets]
- float chance = 100.0f / procSpell->EffectChainTarget[effIndex];
+ float chance = 100.0f / procSpell->Effects[effIndex].ChainTarget;
if (!roll_chance_f(chance))
return false;
@@ -7545,7 +7458,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Lightning Shield
if (AuraEffect const* aurEff = GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN, 0x400, 0, 0))
{
- uint32 spell = sSpellMgr->GetSpellWithRank(26364, sSpellMgr->GetSpellRank(aurEff->GetId()));
+ uint32 spell = sSpellMgr->GetSpellWithRank(26364, aurEff->GetSpellInfo()->GetRank());
// custom cooldown processing case
if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->HasSpellCooldown(spell))
@@ -7567,7 +7480,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (!target || !target->isAlive())
return false;
- triggered_spell_id = dummySpell->EffectTriggerSpell[effIndex];
+ triggered_spell_id = dummySpell->Effects[effIndex].TriggerSpell;
break;
}
// Improved Blood Presence
@@ -7604,8 +7517,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (pPet && pPet->getVictim() && damage && procSpell)
{
uint32 procDmg = damage / 2;
- pPet->SendSpellNonMeleeDamageLog(pPet->getVictim(), procSpell->Id, procDmg, GetSpellSchoolMask(procSpell), 0, 0, false, 0, false);
- pPet->DealDamage(pPet->getVictim(), procDmg, NULL, SPELL_DIRECT_DAMAGE, GetSpellSchoolMask(procSpell), procSpell, true);
+ pPet->SendSpellNonMeleeDamageLog(pPet->getVictim(), procSpell->Id, procDmg, procSpell->GetSchoolMask(), 0, 0, false, 0, false);
+ pPet->DealDamage(pPet->getVictim(), procDmg, NULL, SPELL_DIRECT_DAMAGE, procSpell->GetSchoolMask(), procSpell, true);
break;
}
else
@@ -7708,7 +7621,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (procSpell == 0 || !(procEx & (PROC_EX_NORMAL_HIT|PROC_EX_CRITICAL_HIT)) || this == victim)
return false;
// Need snare or root mechanic
- if (!(GetAllSpellMechanicMask(procSpell) & ((1<<MECHANIC_ROOT)|(1<<MECHANIC_SNARE))))
+ if (!(procSpell->GetAllEffectsMechanicMask() & ((1<<MECHANIC_ROOT)|(1<<MECHANIC_SNARE))))
return false;
triggered_spell_id = 61258;
target = this;
@@ -7735,7 +7648,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (!itr->second->active || itr->second->disabled || itr->second->state == PLAYERSPELL_REMOVED)
continue;
- SpellEntry const* spellProto = sSpellStore.LookupEntry(itr->first);
+ SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(itr->first);
if (!spellProto)
continue;
@@ -7754,7 +7667,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
continue;
// Found spell is last in chain - do not need to look more
// Optimisation for most common case
- if (chain && chain->last == itr->first)
+ if (chain && chain->last->Id == itr->first)
break;
}
}
@@ -7781,11 +7694,11 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; i++)
{
- if (procSpell->Effect[i] == SPELL_EFFECT_HEAL)
+ if (procSpell->Effects[i].Effect == SPELL_EFFECT_HEAL)
{
triggered_spell_id = 21399;
}
- else if (procSpell->Effect[i] == SPELL_EFFECT_ENERGIZE)
+ else if (procSpell->Effects[i].Effect == SPELL_EFFECT_ENERGIZE)
{
triggered_spell_id = 21400;
}
@@ -7809,7 +7722,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
triggered_spell_id = 54445;
target = this;
- float addThreat = float(CalculatePctN(SpellMgr::CalculateSpellEffectAmount(procSpell, 0, this), triggerAmount));
+ float addThreat = float(CalculatePctN(procSpell->Effects[0].CalcValue(this), triggerAmount));
victim->AddThreat(this, addThreat);
break;
}
@@ -7827,13 +7740,13 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// if not handled by custom case, get triggered spell from dummySpell proto
if (!triggered_spell_id)
- triggered_spell_id = dummySpell->EffectTriggerSpell[triggeredByAura->GetEffIndex()];
+ triggered_spell_id = dummySpell->Effects[triggeredByAura->GetEffIndex()].TriggerSpell;
// processed charge only counting case
if (!triggered_spell_id)
return true;
- SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id);
+ SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!triggerEntry)
{
sLog->outError("Unit::HandleDummyAuraProc: Spell %u have not existed triggered spell %u", dummySpell->Id, triggered_spell_id);
@@ -7841,7 +7754,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
}
// default case
- if ((!target && !sSpellMgr->IsSrcTargetSpell(triggerEntry)) || (target && target != this && !target->isAlive()))
+ if ((!target && triggerEntry->IsRequiringSelectedTarget()) || (target && target != this && !target->isAlive()))
return false;
if (cooldown_spell_id == 0)
@@ -7860,9 +7773,9 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return true;
}
-bool Unit::HandleObsModEnergyAuraProc(Unit* victim, uint32 /*damage*/, AuraEffect* triggeredByAura, SpellEntry const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 cooldown)
+bool Unit::HandleObsModEnergyAuraProc(Unit* victim, uint32 /*damage*/, AuraEffect* triggeredByAura, SpellInfo const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 cooldown)
{
- SpellEntry const* dummySpell = triggeredByAura->GetSpellProto();
+ SpellInfo const* dummySpell = triggeredByAura->GetSpellInfo();
//uint32 effIndex = triggeredByAura->GetEffIndex();
//int32 triggerAmount = triggeredByAura->GetAmount();
@@ -7893,7 +7806,7 @@ bool Unit::HandleObsModEnergyAuraProc(Unit* victim, uint32 /*damage*/, AuraEffec
if (!triggered_spell_id)
return true;
- SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id);
+ SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id);
// Try handle unknown trigger spells
if (!triggerEntry)
@@ -7903,7 +7816,7 @@ bool Unit::HandleObsModEnergyAuraProc(Unit* victim, uint32 /*damage*/, AuraEffec
}
// default case
- if ((!target && !sSpellMgr->IsSrcTargetSpell(triggerEntry)) || (target && target != this && !target->isAlive()))
+ if ((!target && triggerEntry->IsRequiringSelectedTarget()) || (target && target != this && !target->isAlive()))
return false;
if (cooldown && GetTypeId() == TYPEID_PLAYER && ToPlayer()->HasSpellCooldown(triggered_spell_id))
@@ -7917,9 +7830,9 @@ bool Unit::HandleObsModEnergyAuraProc(Unit* victim, uint32 /*damage*/, AuraEffec
ToPlayer()->AddSpellCooldown(triggered_spell_id, 0, time(NULL) + cooldown);
return true;
}
-bool Unit::HandleModDamagePctTakenAuraProc(Unit* victim, uint32 /*damage*/, AuraEffect* triggeredByAura, SpellEntry const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 cooldown)
+bool Unit::HandleModDamagePctTakenAuraProc(Unit* victim, uint32 /*damage*/, AuraEffect* triggeredByAura, SpellInfo const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 cooldown)
{
- SpellEntry const* dummySpell = triggeredByAura->GetSpellProto();
+ SpellInfo const* dummySpell = triggeredByAura->GetSpellInfo();
//uint32 effIndex = triggeredByAura->GetEffIndex();
//int32 triggerAmount = triggeredByAura->GetAmount();
@@ -7951,7 +7864,7 @@ bool Unit::HandleModDamagePctTakenAuraProc(Unit* victim, uint32 /*damage*/, Aura
if (!triggered_spell_id)
return true;
- SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id);
+ SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!triggerEntry)
{
@@ -7960,7 +7873,7 @@ bool Unit::HandleModDamagePctTakenAuraProc(Unit* victim, uint32 /*damage*/, Aura
}
// default case
- if ((!target && !sSpellMgr->IsSrcTargetSpell(triggerEntry)) || (target && target != this && !target->isAlive()))
+ if ((!target && triggerEntry->IsRequiringSelectedTarget()) || (target && target != this && !target->isAlive()))
return false;
if (cooldown && GetTypeId() == TYPEID_PLAYER && ToPlayer()->HasSpellCooldown(triggered_spell_id))
@@ -7979,9 +7892,9 @@ bool Unit::HandleModDamagePctTakenAuraProc(Unit* victim, uint32 /*damage*/, Aura
// Used in case when access to whole aura is needed
// All procs should be handled like this...
-bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, SpellEntry const* procSpell, uint32 /*procFlag*/, uint32 procEx, uint32 cooldown, bool * handled)
+bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, SpellInfo const* procSpell, uint32 /*procFlag*/, uint32 procEx, uint32 cooldown, bool * handled)
{
- SpellEntry const* dummySpell = triggeredByAura->GetSpellProto();
+ SpellInfo const* dummySpell = triggeredByAura->GetSpellInfo();
switch(dummySpell->SpellFamilyName)
{
@@ -8010,7 +7923,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
// Swift Hand of Justice
case 59906:
{
- int32 bp0 = CalculatePctN(GetMaxHealth(), SpellMgr::CalculateSpellEffectAmount(dummySpell, 0));
+ int32 bp0 = CalculatePctN(GetMaxHealth(), dummySpell->Effects[EFFECT_0]. CalcValue());
CastCustomSpell(this, 59913, &bp0, NULL, NULL, true);
*handled = true;
break;
@@ -8029,7 +7942,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
*handled = true;
if (victim->HasAura(53601))
{
- int32 bp0 = CalculatePctN(int32(damage / 12), SpellMgr::CalculateSpellEffectAmount(dummySpell, 2));
+ int32 bp0 = CalculatePctN(int32(damage / 12), dummySpell->Effects[EFFECT_2]. CalcValue());
// Item - Paladin T9 Holy 4P Bonus
if (AuraEffect const* aurEff = GetAuraEffect(67191, 0))
AddPctN(bp0, aurEff->GetAmount());
@@ -8062,10 +7975,10 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
// Lookup base amount mana restore
for (uint8 i = 0; i<MAX_SPELL_EFFECTS; i++)
{
- if (procSpell->Effect[i] == SPELL_EFFECT_ENERGIZE)
+ if (procSpell->Effects[i].Effect == SPELL_EFFECT_ENERGIZE)
{
// value multiplied by 2 because you should get twice amount
- int32 mana = SpellMgr::CalculateSpellEffectAmount(procSpell, i) * 2;
+ int32 mana = procSpell->Effects[i].CalcValue() * 2;
CastCustomSpell(this, 54986, 0, &mana, NULL, true);
}
}
@@ -8100,11 +8013,11 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
{
*handled = true;
- SpellEntry const* spInfo = sSpellStore.LookupEntry(67545);
+ SpellInfo const* spInfo = sSpellMgr->GetSpellInfo(67545);
if (!spInfo)
return false;
- int32 bp0 = int32(CalculatePctN(GetCreateMana(), SpellMgr::CalculateSpellEffectAmount(spInfo, 0)));
+ int32 bp0 = int32(CalculatePctN(GetCreateMana(), spInfo->Effects[0].CalcValue()));
CastCustomSpell(this, 67545, &bp0, NULL, NULL, true, NULL, triggeredByAura->GetEffect(EFFECT_0), GetGUID());
return true;
}
@@ -8197,7 +8110,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
// Item - Warrior T10 Protection 4P Bonus
case 70844:
{
- int32 basepoints0 = CalculatePctN(GetMaxHealth(), SpellMgr::CalculateSpellEffectAmount(dummySpell, 1));
+ int32 basepoints0 = CalculatePctN(GetMaxHealth(), dummySpell->Effects[EFFECT_1]. CalcValue());
CastCustomSpell(this, 70845, &basepoints0, NULL, NULL, true);
break;
}
@@ -8207,16 +8120,16 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
return false;
}
-bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const* procSpell, uint32 procFlags, uint32 procEx, uint32 cooldown)
+bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlags, uint32 procEx, uint32 cooldown)
{
// Get triggered aura spell info
- SpellEntry const* auraSpellInfo = triggeredByAura->GetSpellProto();
+ SpellInfo const* auraSpellInfo = triggeredByAura->GetSpellInfo();
// Basepoints of trigger aura
int32 triggerAmount = triggeredByAura->GetAmount();
// Set trigger spell id, target, custom basepoints
- uint32 trigger_spell_id = auraSpellInfo->EffectTriggerSpell[triggeredByAura->GetEffIndex()];
+ uint32 trigger_spell_id = auraSpellInfo->Effects[triggeredByAura->GetEffIndex()].TriggerSpell;
Unit* target = NULL;
int32 basepoints0 = 0;
@@ -8228,7 +8141,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : NULL;
// Try handle unknown trigger spells
- if (sSpellStore.LookupEntry(trigger_spell_id) == NULL)
+ if (sSpellMgr->GetSpellInfo(trigger_spell_id) == NULL)
{
switch (auraSpellInfo->SpellFamilyName)
{
@@ -8243,7 +8156,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
break;
case 43820: // Charm of the Witch Doctor (Amani Charm of the Witch Doctor trinket)
// Pct value stored in dummy
- basepoints0 = victim->GetCreateHealth() * SpellMgr::CalculateSpellEffectAmount(auraSpellInfo, 1) / 100;
+ basepoints0 = victim->GetCreateHealth() * auraSpellInfo->Effects[1].CalcValue() / 100;
target = victim;
break;
case 57345: // Darkmoon Card: Greatness
@@ -8331,9 +8244,9 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
Unit::AuraEffectList const& mAddFlatModifier = GetAuraEffectsByType(SPELL_AURA_DUMMY);
for (Unit::AuraEffectList::const_iterator i = mAddFlatModifier.begin(); i != mAddFlatModifier.end(); ++i)
{
- if ((*i)->GetMiscValue() == SPELLMOD_CHANCE_OF_SUCCESS && (*i)->GetSpellProto()->SpellIconID == 113)
+ if ((*i)->GetMiscValue() == SPELLMOD_CHANCE_OF_SUCCESS && (*i)->GetSpellInfo()->SpellIconID == 113)
{
- int32 value2 = CalculateSpellDamage(this, (*i)->GetSpellProto(), 2);
+ int32 value2 = CalculateSpellDamage(this, (*i)->GetSpellInfo(), 2);
basepoints0 = int32(CalculatePctN(GetMaxPower(POWER_MANA), value2));
// Drain Soul
CastCustomSpell(this, 18371, &basepoints0, NULL, NULL, true, castItem, triggeredByAura);
@@ -8349,7 +8262,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
{
if (!procSpell)
return false;
- switch(GetFirstSchoolInMask(GetSpellSchoolMask(procSpell)))
+ switch(GetFirstSchoolInMask(procSpell->GetSchoolMask()))
{
case SPELL_SCHOOL_NORMAL:
return false; // ignore
@@ -8442,11 +8355,11 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
sLog->outError("Unit::HandleProcTriggerSpell: Spell %u miss posibly Piercing Shots", auraSpellInfo->Id);
return false;
}
- SpellEntry const* TriggerPS = sSpellStore.LookupEntry(trigger_spell_id);
+ SpellInfo const* TriggerPS = sSpellMgr->GetSpellInfo(trigger_spell_id);
if (!TriggerPS)
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount) / (GetSpellMaxDuration(TriggerPS) / TriggerPS->EffectAmplitude[0]);
+ basepoints0 = CalculatePctN(int32(damage), triggerAmount) / (TriggerPS->GetMaxDuration() / TriggerPS->Effects[0].Amplitude);
basepoints0 += victim->GetRemainingPeriodicAmount(GetGUID(), trigger_spell_id, SPELL_AURA_PERIODIC_DAMAGE);
break;
}
@@ -8568,15 +8481,15 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
return false;
}
}
- SpellEntry const* originalSpell = sSpellStore.LookupEntry(originalSpellId);
+ SpellInfo const* originalSpell = sSpellMgr->GetSpellInfo(originalSpellId);
if (!originalSpell)
{
sLog->outError("Unit::HandleProcTriggerSpell: Spell %u unknown but selected as original in Illu", originalSpellId);
return false;
}
// percent stored in effect 1 (class scripts) base points
- int32 cost = int32(originalSpell->manaCost + CalculatePctU(GetCreateMana(), originalSpell->ManaCostPercentage));
- basepoints0 = CalculatePctN(cost, SpellMgr::CalculateSpellEffectAmount(auraSpellInfo, 1));
+ int32 cost = int32(originalSpell->ManaCost + CalculatePctU(GetCreateMana(), originalSpell->ManaCostPercentage));
+ basepoints0 = CalculatePctN(cost, auraSpellInfo->Effects[1].CalcValue());
trigger_spell_id = 20272;
target = this;
}
@@ -8606,7 +8519,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
{
if (!procSpell)
return false;
- basepoints0 = int32(CalculatePctN(procSpell->manaCost, 35));
+ basepoints0 = int32(CalculatePctN(procSpell->ManaCost, 35));
trigger_spell_id = 23571;
target = this;
break;
@@ -8616,7 +8529,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
// Lightning Shield (overwrite non existing triggered spell call in spell.dbc
if (auraSpellInfo->SpellFamilyFlags[0] & 0x400)
{
- trigger_spell_id = sSpellMgr->GetSpellWithRank(26364, sSpellMgr->GetSpellRank(auraSpellInfo->Id));
+ trigger_spell_id = sSpellMgr->GetSpellWithRank(26364, auraSpellInfo->GetRank());
}
// Nature's Guardian
else if (auraSpellInfo->SpellIconID == 2013)
@@ -8643,7 +8556,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
{
if (!procSpell)
return false;
- switch(GetFirstSchoolInMask(GetSpellSchoolMask(procSpell)))
+ switch(GetFirstSchoolInMask(procSpell->GetSchoolMask()))
{
case SPELL_SCHOOL_NORMAL:
return false; // ignore
@@ -8674,7 +8587,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
}
// All ok. Check current trigger spell
- SpellEntry const* triggerEntry = sSpellStore.LookupEntry(trigger_spell_id);
+ SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(trigger_spell_id);
if (triggerEntry == NULL)
{
// Not cast unknown spell
@@ -8683,7 +8596,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
}
// not allow proc extra attack spell at extra attack
- if (m_extraAttacks && IsSpellHaveEffect(triggerEntry, SPELL_EFFECT_ADD_EXTRA_ATTACKS))
+ if (m_extraAttacks && triggerEntry->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS))
return false;
// Custom requirements (not listed in procEx) Warning! damage dealing after this
@@ -8958,7 +8871,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
// Enlightenment (trigger only from mana cost spells)
case 35095:
{
- if (!procSpell || procSpell->powerType != POWER_MANA || (procSpell->manaCost == 0 && procSpell->ManaCostPercentage == 0 && procSpell->manaCostPerlevel == 0))
+ if (!procSpell || procSpell->PowerType != POWER_MANA || (procSpell->ManaCost == 0 && procSpell->ManaCostPercentage == 0 && procSpell->ManaCostPerlevel == 0))
return false;
break;
}
@@ -8992,12 +8905,12 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
// Item - Shaman T10 Enhancement 4P Bonus
if (AuraEffect const* aurEff = GetAuraEffect(70832, 0))
if (Aura const* maelstrom = GetAura(53817))
- if ((maelstrom->GetStackAmount() == maelstrom->GetSpellProto()->StackAmount) && roll_chance_i(aurEff->GetAmount()))
+ if ((maelstrom->GetStackAmount() == maelstrom->GetSpellInfo()->StackAmount) && roll_chance_i(aurEff->GetAmount()))
CastSpell(this, 70831, true, castItem, triggeredByAura);
// have rank dependent proc chance, ignore too often cases
// PPM = 2.5 * (rank of talent),
- uint32 rank = sSpellMgr->GetSpellRank(auraSpellInfo->Id);
+ uint32 rank = auraSpellInfo->GetRank();
// 5 rank -> 100% 4 rank -> 80% and etc from full rate
if (!roll_chance_i(20*rank))
return false;
@@ -9010,7 +8923,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
return false;
// Need stun, fear or silence mechanic
- if (!(GetAllSpellMechanicMask(procSpell) & ((1<<MECHANIC_SILENCE)|(1<<MECHANIC_STUN)|(1<<MECHANIC_FEAR))))
+ if (!(procSpell->GetAllEffectsMechanicMask() & ((1<<MECHANIC_SILENCE)|(1<<MECHANIC_STUN)|(1<<MECHANIC_FEAR))))
return false;
break;
}
@@ -9020,7 +8933,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
if (!procSpell)
return false;
// Need Interrupt or Silenced mechanic
- if (!(GetAllSpellMechanicMask(procSpell) & ((1<<MECHANIC_INTERRUPT)|(1<<MECHANIC_SILENCE))))
+ if (!(procSpell->GetAllEffectsMechanicMask() & ((1<<MECHANIC_INTERRUPT)|(1<<MECHANIC_SILENCE))))
return false;
break;
}
@@ -9113,10 +9026,10 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
// try detect target manually if not set
if (target == NULL)
- target = !(procFlags & (PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS)) && IsPositiveSpell(trigger_spell_id) ? this : victim;
+ target = !(procFlags & (PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS)) && triggerEntry && triggerEntry->IsPositive() ? this : victim;
// default case
- if ((!target && !sSpellMgr->IsSrcTargetSpell(triggerEntry)) || (target && target != this && !target->isAlive()))
+ if ((!target && triggerEntry->IsRequiringSelectedTarget()) || (target && target != this && !target->isAlive()))
return false;
if (basepoints0)
@@ -9130,7 +9043,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
return true;
}
-bool Unit::HandleOverrideClassScriptAuraProc(Unit* victim, uint32 /*damage*/, AuraEffect* triggeredByAura, SpellEntry const* procSpell, uint32 cooldown)
+bool Unit::HandleOverrideClassScriptAuraProc(Unit* victim, uint32 /*damage*/, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 cooldown)
{
int32 scriptId = triggeredByAura->GetMiscValue();
@@ -9213,7 +9126,7 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit* victim, uint32 /*damage*/, Au
return false;
// standard non-dummy case
- SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id);
+ SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!triggerEntry)
{
@@ -9735,7 +9648,7 @@ void Unit::RemoveAllAttackers()
}
}
-void Unit::ModifyAuraState(AuraState flag, bool apply)
+void Unit::ModifyAuraState(AuraStateType flag, bool apply)
{
if (apply)
{
@@ -9749,8 +9662,8 @@ void Unit::ModifyAuraState(AuraState flag, bool apply)
{
if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled)
continue;
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first);
- if (!spellInfo || !IsPassiveSpell(itr->first))
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
+ if (!spellInfo || !spellInfo->IsPassive())
continue;
if (spellInfo->CasterAuraState == uint32(flag))
CastSpell(this, itr->first, true, NULL);
@@ -9762,8 +9675,8 @@ void Unit::ModifyAuraState(AuraState flag, bool apply)
{
if (itr->second.state == PETSPELL_REMOVED)
continue;
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first);
- if (!spellInfo || !IsPassiveSpell(itr->first))
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
+ if (!spellInfo || !spellInfo->IsPassive())
continue;
if (spellInfo->CasterAuraState == uint32(flag))
CastSpell(this, itr->first, true, NULL);
@@ -9782,7 +9695,7 @@ void Unit::ModifyAuraState(AuraState flag, bool apply)
Unit::AuraApplicationMap& tAuras = GetAppliedAuras();
for (Unit::AuraApplicationMap::iterator itr = tAuras.begin(); itr != tAuras.end();)
{
- SpellEntry const* spellProto = (*itr).second->GetBase()->GetSpellProto();
+ SpellInfo const* spellProto = (*itr).second->GetBase()->GetSpellInfo();
if (spellProto->CasterAuraState == uint32(flag))
RemoveAura(itr);
else
@@ -9804,7 +9717,7 @@ uint32 Unit::BuildAuraStateUpdateForTarget(Unit* target) const
return auraStates;
}
-bool Unit::HasAuraState(AuraState flag, SpellEntry const* spellProto, Unit const* Caster) const
+bool Unit::HasAuraState(AuraStateType flag, SpellInfo const* spellProto, Unit const* Caster) const
{
if (Caster)
{
@@ -9968,7 +9881,7 @@ void Unit::SetMinion(Minion *minion, bool apply)
if (GetTypeId() == TYPEID_PLAYER)
{
// Send infinity cooldown - client does that automatically but after relog cooldown needs to be set again
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(minion->GetUInt32Value(UNIT_CREATED_BY_SPELL));
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(minion->GetUInt32Value(UNIT_CREATED_BY_SPELL));
if (spellInfo && (spellInfo->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE))
ToPlayer()->AddSpellAndCategoryCooldowns(spellInfo, 0, NULL, true);
}
@@ -9997,19 +9910,19 @@ void Unit::SetMinion(Minion *minion, bool apply)
else if (minion->isTotem())
{
// All summoned by totem minions must disappear when it is removed.
- if (SpellEntry const* spInfo = sSpellStore.LookupEntry(minion->ToTotem()->GetSpell()))
+ if (SpellInfo const* spInfo = sSpellMgr->GetSpellInfo(minion->ToTotem()->GetSpell()))
for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- if (spInfo->Effect[i] != SPELL_EFFECT_SUMMON)
+ if (spInfo->Effects[i].Effect != SPELL_EFFECT_SUMMON)
continue;
- RemoveAllMinionsByEntry(spInfo->EffectMiscValue[i]);
+ RemoveAllMinionsByEntry(spInfo->Effects[i].MiscValue);
}
}
if (GetTypeId() == TYPEID_PLAYER)
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(minion->GetUInt32Value(UNIT_CREATED_BY_SPELL));
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(minion->GetUInt32Value(UNIT_CREATED_BY_SPELL));
// Remove infinity cooldown
if (spellInfo && (spellInfo->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE))
ToPlayer()->SendCooldownEvent(spellInfo);
@@ -10188,7 +10101,7 @@ int32 Unit::DealHeal(Unit* victim, uint32 addhealth)
return gain;
}
-Unit* Unit::SelectMagnetTarget(Unit* victim, SpellEntry const* spellInfo)
+Unit* Unit::SelectMagnetTarget(Unit* victim, SpellInfo const* spellInfo)
{
if (!victim)
return NULL;
@@ -10379,7 +10292,7 @@ void Unit::SendHealSpellLog(Unit* victim, uint32 SpellID, uint32 Damage, uint32
SendMessageToSet(&data, true);
}
-int32 Unit::HealBySpell(Unit* victim, SpellEntry const* spellInfo, uint32 addHealth, bool critical)
+int32 Unit::HealBySpell(Unit* victim, SpellInfo const* spellInfo, uint32 addHealth, bool critical)
{
uint32 absorb = 0;
// calculate heal absorb and reduce healing
@@ -10408,7 +10321,7 @@ void Unit::EnergizeBySpell(Unit* victim, uint32 SpellID, uint32 Damage, Powers p
victim->ModifyPower(powertype, Damage);
}
-uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack)
+uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack)
{
if (!spellProto || !victim || damagetype == DIRECT_DAMAGE)
return pdamage;
@@ -10436,18 +10349,18 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32
AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
- if ((*i)->GetMiscValue() & GetSpellSchoolMask(spellProto))
+ if ((*i)->GetMiscValue() & spellProto->GetSchoolMask())
{
- if ((*i)->GetSpellProto()->EquippedItemClass == -1)
+ if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
AddPctN(DoneTotalMod, (*i)->GetAmount());
- else if (!((*i)->GetSpellProto()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK))
+ else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK))
{
- if ((*i)->GetSpellProto()->EquippedItemClass & spellProto->EquippedItemClass)
- if (((*i)->GetSpellProto()->EquippedItemSubClassMask == 0) ||
- ((*i)->GetSpellProto()->EquippedItemSubClassMask & spellProto->EquippedItemSubClassMask))
+ if ((*i)->GetSpellInfo()->EquippedItemClass & spellProto->EquippedItemClass)
+ if (((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0) ||
+ ((*i)->GetSpellInfo()->EquippedItemSubClassMask & spellProto->EquippedItemSubClassMask))
AddPctN(DoneTotalMod, (*i)->GetAmount());
}
- else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellProto()))
+ else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
AddPctN(DoneTotalMod, (*i)->GetAmount());
}
@@ -10462,7 +10375,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32
// bonus against aurastate
AuraEffectList const& mDamageDoneVersusAurastate = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE);
for (AuraEffectList::const_iterator i = mDamageDoneVersusAurastate.begin(); i != mDamageDoneVersusAurastate.end(); ++i)
- if (victim->HasAuraState(AuraState((*i)->GetMiscValue())))
+ if (victim->HasAuraState(AuraStateType((*i)->GetMiscValue())))
AddPctN(DoneTotalMod, (*i)->GetAmount());
// done scripted mod (take it from owner)
@@ -10492,14 +10405,14 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32
// effect 1 m_amount
int32 maxPercent = (*i)->GetAmount();
// effect 0 m_amount
- int32 stepPercent = CalculateSpellDamage(this, (*i)->GetSpellProto(), 0);
+ int32 stepPercent = CalculateSpellDamage(this, (*i)->GetSpellInfo(), 0);
// count affliction effects and calc additional damage in percentage
int32 modPercent = 0;
AuraApplicationMap const& victimAuras = victim->GetAppliedAuras();
for (AuraApplicationMap::const_iterator itr = victimAuras.begin(); itr != victimAuras.end(); ++itr)
{
Aura const* aura = itr->second->GetBase();
- SpellEntry const* m_spell = aura->GetSpellProto();
+ SpellInfo const* m_spell = aura->GetSpellInfo();
if (m_spell->SpellFamilyName != SPELLFAMILY_WARLOCK || !(m_spell->SpellFamilyFlags[1] & 0x0004071B || m_spell->SpellFamilyFlags[0] & 0x8044C402))
continue;
modPercent += stepPercent * aura->GetStackAmount();
@@ -10541,7 +10454,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32
case 7277:
{
// Merciless Combat
- if ((*i)->GetSpellProto()->SpellIconID == 2656)
+ if ((*i)->GetSpellInfo()->SpellIconID == 2656)
{
if (!victim->HealthAbovePct(35))
AddPctN(DoneTotalMod, (*i)->GetAmount());
@@ -10560,10 +10473,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32
case 7293:
{
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, 0, 0x02000000, 0))
- {
- if (SpellChainNode const* chain = sSpellMgr->GetSpellChainNode((*i)->GetId()))
- AddPctF(DoneTotalMod, chain->rank * 2.0f);
- }
+ AddPctF(DoneTotalMod, (*i)->GetSpellInfo()->GetRank() * 2.0f);
break;
}
// Twisted Faith
@@ -10624,7 +10534,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32
{
AuraEffectList const& mDumyAuras = GetAuraEffectsByType(SPELL_AURA_DUMMY);
for (AuraEffectList::const_iterator i = mDumyAuras.begin(); i != mDumyAuras.end(); ++i)
- if ((*i)->GetSpellProto()->SpellIconID == 3263)
+ if ((*i)->GetSpellInfo()->SpellIconID == 3263)
{
AddPctN(DoneTotalMod, (*i)->GetAmount());
break;
@@ -10698,7 +10608,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32
{
AuraEffectList const& mDumyAuras = GetAuraEffectsByType(SPELL_AURA_DUMMY);
for (AuraEffectList::const_iterator i = mDumyAuras.begin(); i != mDumyAuras.end(); ++i)
- if ((*i)->GetSpellProto()->SpellIconID == 3173)
+ if ((*i)->GetSpellInfo()->SpellIconID == 3173)
{
AddPctN(DoneTotalMod, (*i)->GetAmount());
break;
@@ -10753,8 +10663,8 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32
case 49636:
case 49638:
{
- if (SpellEntry const* proto = sSpellStore.LookupEntry(itr->first))
- AddPctN(ApCoeffMod, SpellMgr::CalculateSpellEffectAmount(proto, 0));
+ if (SpellInfo const* proto = sSpellMgr->GetSpellInfo(itr->first))
+ AddPctN(ApCoeffMod, proto->Effects[0].CalcValue());
}
break;
}
@@ -10768,13 +10678,13 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32
// from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN
// multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085)
- TakenTotalMod *= victim->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, GetSpellSchoolMask(spellProto));
+ TakenTotalMod *= victim->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, spellProto->GetSchoolMask());
// .. taken pct: dummy auras
AuraEffectList const& mDummyAuras = victim->GetAuraEffectsByType(SPELL_AURA_DUMMY);
for (AuraEffectList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i)
{
- switch((*i)->GetSpellProto()->SpellIconID)
+ switch((*i)->GetSpellInfo()->SpellIconID)
{
// Cheat Death
case 2109:
@@ -10788,7 +10698,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32
break;
// Ebon Plague
case 1933:
- if ((*i)->GetMiscValue() & (spellProto ? GetSpellSchoolMask(spellProto) : 0))
+ if ((*i)->GetMiscValue() & (spellProto ? spellProto->GetSchoolMask() : 0))
AddPctN(TakenTotalMod, (*i)->GetAmount());
break;
}
@@ -10801,7 +10711,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32
AddPctN(TakenTotalMod, (*i)->GetAmount());
// Mod damage from spell mechanic
- if (uint32 mechanicMask = GetAllSpellMechanicMask(spellProto))
+ if (uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask())
{
AuraEffectList const& mDamageDoneMechanic = victim->GetAuraEffectsByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT);
for (AuraEffectList::const_iterator i = mDamageDoneMechanic.begin(); i != mDamageDoneMechanic.end(); ++i)
@@ -10810,8 +10720,8 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32
}
// Taken/Done fixed damage bonus auras
- int32 DoneAdvertisedBenefit = SpellBaseDamageBonus(GetSpellSchoolMask(spellProto));
- int32 TakenAdvertisedBenefit = SpellBaseDamageBonusForVictim(GetSpellSchoolMask(spellProto), victim);
+ int32 DoneAdvertisedBenefit = SpellBaseDamageBonus(spellProto->GetSchoolMask());
+ int32 TakenAdvertisedBenefit = SpellBaseDamageBonusForVictim(spellProto->GetSchoolMask(), victim);
// Pets just add their bonus damage to their spell damage
// note that their spell damage is just gain of their own auras
if (HasUnitTypeMask(UNIT_MASK_GUARDIAN))
@@ -10827,7 +10737,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32
coeff = bonus->dot_damage;
if (bonus->ap_dot_bonus > 0)
{
- WeaponAttackType attType = (IsRangedWeaponSpell(spellProto) && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
+ WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
float APbonus = (float) victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS);
APbonus += GetTotalAttackPowerValue(attType);
DoneTotal += int32(bonus->ap_dot_bonus * stack * ApCoeffMod * APbonus);
@@ -10838,7 +10748,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32
coeff = bonus->direct_damage;
if (bonus->ap_bonus > 0)
{
- WeaponAttackType attType = (IsRangedWeaponSpell(spellProto) && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
+ WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
float APbonus = (float) victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS);
APbonus += GetTotalAttackPowerValue(attType);
DoneTotal += int32(bonus->ap_bonus * stack * ApCoeffMod * APbonus);
@@ -10851,33 +10761,33 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32
if (!bonus || coeff < 0)
{
// Damage Done from spell damage bonus
- int32 CastingTime = IsChanneledSpell(spellProto) ? GetSpellDuration(spellProto) : GetSpellCastTime(spellProto);
+ int32 CastingTime = spellProto->IsChanneled() ? spellProto->GetDuration() : spellProto->CalcCastTime();
// Damage over Time spells bonus calculation
float DotFactor = 1.0f;
if (damagetype == DOT)
{
- int32 DotDuration = GetSpellDuration(spellProto);
+ int32 DotDuration = spellProto->GetDuration();
// 200% limit
if (DotDuration > 0)
{
if (DotDuration > 30000)
DotDuration = 30000;
- if (!IsChanneledSpell(spellProto))
+ if (!spellProto->IsChanneled())
DotFactor = DotDuration / 15000.0f;
uint8 x = 0;
for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
- if (spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && (
- spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_DAMAGE ||
- spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH))
+ if (spellProto->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && (
+ spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE ||
+ spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH))
{
x = j;
break;
}
}
int32 DotTicks = 6;
- if (spellProto->EffectAmplitude[x] != 0)
- DotTicks = DotDuration / spellProto->EffectAmplitude[x];
+ if (spellProto->Effects[x].Amplitude != 0)
+ DotTicks = DotDuration / spellProto->Effects[x].Amplitude;
if (DotTicks)
{
DoneAdvertisedBenefit /= DotTicks;
@@ -10891,8 +10801,8 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32
// 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)
{
- if (spellProto->Effect[j] == SPELL_EFFECT_HEALTH_LEECH ||
- (spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH))
+ 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))
{
CastingTime /= 2;
break;
@@ -10947,9 +10857,9 @@ int32 Unit::SpellBaseDamageBonus(SpellSchoolMask schoolMask)
AuraEffectList const& mDamageDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE);
for (AuraEffectList::const_iterator i = mDamageDone.begin(); i != mDamageDone.end(); ++i)
if (((*i)->GetMiscValue() & schoolMask) != 0 &&
- (*i)->GetSpellProto()->EquippedItemClass == -1 &&
+ (*i)->GetSpellInfo()->EquippedItemClass == -1 &&
// -1 == any item class (not wand then)
- (*i)->GetSpellProto()->EquippedItemInventoryTypeMask == 0)
+ (*i)->GetSpellInfo()->EquippedItemInventoryTypeMask == 0)
// 0 == any inventory type (not wand then)
DoneAdvertisedBenefit += (*i)->GetAmount();
@@ -10999,7 +10909,7 @@ int32 Unit::SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask, Unit* vict
return TakenAdvertisedBenefit > 0 ? TakenAdvertisedBenefit : 0;
}
-bool Unit::isSpellCrit(Unit* victim, SpellEntry const* spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType) const
+bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType) const
{
// Mobs can't crit with spells.
if (IS_CREATURE_GUID(GetGUID()))
@@ -11038,7 +10948,7 @@ bool Unit::isSpellCrit(Unit* victim, SpellEntry const* spellProto, SpellSchoolMa
// taken
if (victim)
{
- if (!IsPositiveSpell(spellProto->Id))
+ if (!spellProto->IsPositive())
{
// Modify critical chance by victim SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE
crit_chance += victim->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE, schoolMask);
@@ -11191,7 +11101,7 @@ bool Unit::isSpellCrit(Unit* victim, SpellEntry const* spellProto, SpellSchoolMa
return false;
}
-uint32 Unit::SpellCriticalDamageBonus(SpellEntry const* spellProto, uint32 damage, Unit* victim)
+uint32 Unit::SpellCriticalDamageBonus(SpellInfo const* spellProto, uint32 damage, Unit* victim)
{
// Calculate critical bonus
int32 crit_bonus = damage;
@@ -11209,7 +11119,7 @@ uint32 Unit::SpellCriticalDamageBonus(SpellEntry const* spellProto, uint32 damag
break;
}
- crit_mod += (GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, GetSpellSchoolMask(spellProto)) - 1.0f) * 100;
+ crit_mod += (GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, spellProto->GetSchoolMask()) - 1.0f) * 100;
if (victim)
crit_mod += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, victim->GetCreatureTypeMask());
@@ -11228,7 +11138,7 @@ uint32 Unit::SpellCriticalDamageBonus(SpellEntry const* spellProto, uint32 damag
return crit_bonus;
}
-uint32 Unit::SpellCriticalHealingBonus(SpellEntry const* spellProto, uint32 damage, Unit* victim)
+uint32 Unit::SpellCriticalHealingBonus(SpellInfo const* spellProto, uint32 damage, Unit* victim)
{
// Calculate critical bonus
int32 crit_bonus;
@@ -11258,7 +11168,7 @@ uint32 Unit::SpellCriticalHealingBonus(SpellEntry const* spellProto, uint32 dama
return damage;
}
-uint32 Unit::SpellHealingBonus(Unit* victim, SpellEntry const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack)
+uint32 Unit::SpellHealingBonus(Unit* victim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack)
{
// For totems get healing bonus from owner (statue isn't totem in fact)
if (GetTypeId() == TYPEID_UNIT && ToCreature()->isTotem())
@@ -11322,7 +11232,7 @@ uint32 Unit::SpellHealingBonus(Unit* victim, SpellEntry const* spellProto, uint3
Aura const* aura = itr->second->GetBase();
if (aura->GetCasterGUID() != GetGUID())
continue;
- SpellEntry const* m_spell = aura->GetSpellProto();
+ SpellInfo const* m_spell = aura->GetSpellInfo();
if (m_spell->SpellFamilyName != SPELLFAMILY_DRUID ||
!(m_spell->SpellFamilyFlags[1] & 0x00000010 || m_spell->SpellFamilyFlags[0] & 0x50))
continue;
@@ -11343,14 +11253,14 @@ uint32 Unit::SpellHealingBonus(Unit* victim, SpellEntry const* spellProto, uint3
}
// Taken/Done fixed damage bonus auras
- int32 DoneAdvertisedBenefit = SpellBaseHealingBonus(GetSpellSchoolMask(spellProto));
- int32 TakenAdvertisedBenefit = SpellBaseHealingBonusForVictim(GetSpellSchoolMask(spellProto), victim);
+ int32 DoneAdvertisedBenefit = SpellBaseHealingBonus(spellProto->GetSchoolMask());
+ int32 TakenAdvertisedBenefit = SpellBaseHealingBonusForVictim(spellProto->GetSchoolMask(), victim);
bool scripted = false;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- switch (spellProto->EffectApplyAuraName[i])
+ switch (spellProto->Effects[i].ApplyAuraName)
{
// These auras do not use healing coeff
case SPELL_AURA_PERIODIC_LEECH:
@@ -11358,7 +11268,7 @@ uint32 Unit::SpellHealingBonus(Unit* victim, SpellEntry const* spellProto, uint3
scripted = true;
break;
}
- if (spellProto->Effect[i] == SPELL_EFFECT_HEALTH_LEECH)
+ if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH)
scripted = true;
}
@@ -11373,14 +11283,14 @@ uint32 Unit::SpellHealingBonus(Unit* victim, SpellEntry const* spellProto, uint3
coeff = bonus->dot_damage;
if (bonus->ap_dot_bonus > 0)
DoneTotal += int32(bonus->ap_dot_bonus * stack * GetTotalAttackPowerValue(
- (IsRangedWeaponSpell(spellProto) && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK));
+ (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK));
}
else
{
coeff = bonus->direct_damage;
if (bonus->ap_bonus > 0)
DoneTotal += int32(bonus->ap_bonus * stack * GetTotalAttackPowerValue(
- (IsRangedWeaponSpell(spellProto) && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK));
+ (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK));
}
}
else // scripted bonus
@@ -11413,31 +11323,31 @@ uint32 Unit::SpellHealingBonus(Unit* victim, SpellEntry const* spellProto, uint3
if ((!bonus && !scripted) || coeff < 0)
{
// Damage Done from spell damage bonus
- int32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto);
+ int32 CastingTime = !spellProto->IsChanneled() ? spellProto->CalcCastTime() : spellProto->GetDuration();
// Damage over Time spells bonus calculation
float DotFactor = 1.0f;
if (damagetype == DOT)
{
- int32 DotDuration = GetSpellDuration(spellProto);
+ int32 DotDuration = spellProto->GetDuration();
// 200% limit
if (DotDuration > 0)
{
if (DotDuration > 30000) DotDuration = 30000;
- if (!IsChanneledSpell(spellProto)) DotFactor = DotDuration / 15000.0f;
+ if (!spellProto->IsChanneled()) DotFactor = DotDuration / 15000.0f;
uint32 x = 0;
for (uint8 j = 0; j < MAX_SPELL_EFFECTS; j++)
{
- if (spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && (
- spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_DAMAGE ||
- spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH))
+ if (spellProto->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && (
+ spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE ||
+ spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH))
{
x = j;
break;
}
}
int32 DotTicks = 6;
- if (spellProto->EffectAmplitude[x] != 0)
- DotTicks = DotDuration / spellProto->EffectAmplitude[x];
+ if (spellProto->Effects[x].Amplitude != 0)
+ DotTicks = DotDuration / spellProto->Effects[x].Amplitude;
if (DotTicks)
{
DoneAdvertisedBenefit = DoneAdvertisedBenefit * int32(stack) / DotTicks;
@@ -11450,8 +11360,8 @@ uint32 Unit::SpellHealingBonus(Unit* victim, SpellEntry const* spellProto, uint3
// 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)
{
- if (spellProto->Effect[j] == SPELL_EFFECT_HEALTH_LEECH ||
- (spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH))
+ 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))
{
CastingTime /= 2;
break;
@@ -11544,7 +11454,7 @@ int32 Unit::SpellBaseHealingBonus(SpellSchoolMask schoolMask)
for (AuraEffectList::const_iterator i = mHealingDoneOfStatPercent.begin(); i != mHealingDoneOfStatPercent.end(); ++i)
{
// stat used dependent from misc value (stat index)
- Stats usedStat = Stats((*i)->GetSpellProto()->EffectMiscValue[(*i)->GetEffIndex()]);
+ Stats usedStat = Stats((*i)->GetSpellInfo()->Effects[(*i)->GetEffIndex()].MiscValue);
AdvertisedBenefit += int32(CalculatePctN(GetStat(usedStat), (*i)->GetAmount()));
}
@@ -11584,18 +11494,18 @@ bool Unit::IsImmunedToDamage(SpellSchoolMask shoolMask)
return false;
}
-bool Unit::IsImmunedToDamage(SpellEntry const* spellInfo)
+bool Unit::IsImmunedToDamage(SpellInfo const* spellInfo)
{
if (spellInfo->Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY)
return false;
- uint32 shoolMask = GetSpellSchoolMask(spellInfo);
+ uint32 shoolMask = spellInfo->GetSchoolMask();
if (spellInfo->Id != 42292 && spellInfo->Id !=59752)
{
// If m_immuneToSchool type contain this school type, IMMUNE damage.
SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr)
- if (itr->type & shoolMask && !CanSpellPierceImmuneAura(spellInfo, sSpellStore.LookupEntry(itr->spellId)))
+ if (itr->type & shoolMask && !spellInfo->CanPierceImmuneAura(sSpellMgr->GetSpellInfo(itr->spellId)))
return true;
}
@@ -11608,7 +11518,7 @@ bool Unit::IsImmunedToDamage(SpellEntry const* spellInfo)
return false;
}
-bool Unit::IsImmunedToSpell(SpellEntry const* spellInfo)
+bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo)
{
if (!spellInfo)
return false;
@@ -11642,7 +11552,7 @@ bool Unit::IsImmunedToSpell(SpellEntry const* spellInfo)
{
// State/effect immunities applied by aura expect full spell immunity
// Ignore effects with mechanic, they are supposed to be checked separately
- if (!spellInfo->EffectMechanic[i])
+ if (!spellInfo->Effects[i].Mechanic)
if (IsImmunedToSpellEffect(spellInfo, i))
return true;
}
@@ -11651,27 +11561,30 @@ bool Unit::IsImmunedToSpell(SpellEntry const* spellInfo)
{
SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr)
- if ((itr->type & GetSpellSchoolMask(spellInfo))
- && !(IsPositiveSpell(itr->spellId) && IsPositiveSpell(spellInfo->Id))
- && !CanSpellPierceImmuneAura(spellInfo, sSpellStore.LookupEntry(itr->spellId)))
+ {
+ SpellInfo const* inmmuneSpellInfo = sSpellMgr->GetSpellInfo(itr->spellId);
+ if ((itr->type & spellInfo->GetSchoolMask())
+ && !(inmmuneSpellInfo->IsPositive() && spellInfo->IsPositive())
+ && !spellInfo->CanPierceImmuneAura(inmmuneSpellInfo))
return true;
+ }
}
return false;
}
-bool Unit::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const
+bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const
{
if (!spellInfo)
return false;
// If m_immuneToEffect type contain this effect type, IMMUNE effect.
- uint32 effect = spellInfo->Effect[index];
+ uint32 effect = spellInfo->Effects[index].Effect;
SpellImmuneList const& effectList = m_spellImmune[IMMUNITY_EFFECT];
for (SpellImmuneList::const_iterator itr = effectList.begin(); itr != effectList.end(); ++itr)
if (itr->type == effect)
return true;
- if (uint32 mechanic = spellInfo->EffectMechanic[index])
+ if (uint32 mechanic = spellInfo->Effects[index].Mechanic)
{
SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
@@ -11679,7 +11592,7 @@ bool Unit::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) con
return true;
}
- if (uint32 aura = spellInfo->EffectApplyAuraName[index])
+ if (uint32 aura = spellInfo->Effects[index].ApplyAuraName)
{
SpellImmuneList const& list = m_spellImmune[IMMUNITY_STATE];
for (SpellImmuneList::const_iterator itr = list.begin(); itr != list.end(); ++itr)
@@ -11689,15 +11602,15 @@ bool Unit::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) con
AuraEffectList const& immuneAuraApply = GetAuraEffectsByType(SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL);
for (AuraEffectList::const_iterator iter = immuneAuraApply.begin(); iter != immuneAuraApply.end(); ++iter)
if (spellInfo->Dispel == DISPEL_MAGIC && // Magic debuff
- ((*iter)->GetMiscValue() & GetSpellSchoolMask(spellInfo)) && // Check school
- !IsPositiveEffect(spellInfo->Id, index)) // Harmful
+ ((*iter)->GetMiscValue() & spellInfo->GetSchoolMask()) && // Check school
+ !spellInfo->IsPositiveEffect(index)) // Harmful
return true;
}
return false;
}
-bool Unit::IsDamageToThreatSpell(SpellEntry const* spellInfo) const
+bool Unit::IsDamageToThreatSpell(SpellInfo const* spellInfo) const
{
if (!spellInfo)
return false;
@@ -11721,7 +11634,7 @@ bool Unit::IsDamageToThreatSpell(SpellEntry const* spellInfo) const
return false;
}
-void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attType, SpellEntry const* spellProto)
+void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attType, SpellInfo const* spellProto)
{
if (!victim)
return;
@@ -11773,7 +11686,7 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
bool normalized = false;
if (spellProto)
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (spellProto->Effect[i] == SPELL_EFFECT_NORMALIZED_WEAPON_DMG)
+ if (spellProto->Effects[i].Effect == SPELL_EFFECT_NORMALIZED_WEAPON_DMG)
{
normalized = true;
break;
@@ -11803,24 +11716,24 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
if (spellProto)
{
- if ((*i)->GetMiscValue() & GetSpellSchoolMask(spellProto))
+ if ((*i)->GetMiscValue() & spellProto->GetSchoolMask())
{
- if ((*i)->GetSpellProto()->EquippedItemClass == -1)
+ if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
AddPctN(DoneTotalMod, (*i)->GetAmount());
- else if (!((*i)->GetSpellProto()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK))
+ else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK))
{
- if ((*i)->GetSpellProto()->EquippedItemClass & spellProto->EquippedItemClass)
- if (((*i)->GetSpellProto()->EquippedItemSubClassMask == 0) ||
- ((*i)->GetSpellProto()->EquippedItemSubClassMask & spellProto->EquippedItemSubClassMask))
+ if ((*i)->GetSpellInfo()->EquippedItemClass & spellProto->EquippedItemClass)
+ if (((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0) ||
+ ((*i)->GetSpellInfo()->EquippedItemSubClassMask & spellProto->EquippedItemSubClassMask))
AddPctN(DoneTotalMod, (*i)->GetAmount());
}
- else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellProto()))
+ else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
AddPctN(DoneTotalMod, (*i)->GetAmount());
}
}
else if (player)
{
- if (!((*i)->GetSpellProto()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK))
+ if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK))
{
EquipmentSlots slot;
@@ -11834,10 +11747,10 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
- if (item && !item->IsBroken() && item->IsFitToSpellRequirements((*i)->GetSpellProto()))
+ if (item && !item->IsBroken() && item->IsFitToSpellRequirements((*i)->GetSpellInfo()))
AddPctN(DoneTotalMod, (*i)->GetAmount());
}
- else if (player->HasItemFitToSpellRequirements((*i)->GetSpellProto()))
+ else if (player->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
AddPctN(DoneTotalMod, (*i)->GetAmount());
}
@@ -11849,7 +11762,7 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
// bonus against aurastate
AuraEffectList const& mDamageDoneVersusAurastate = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE);
for (AuraEffectList::const_iterator i = mDamageDoneVersusAurastate.begin(); i != mDamageDoneVersusAurastate.end(); ++i)
- if (victim->HasAuraState(AuraState((*i)->GetMiscValue())))
+ if (victim->HasAuraState(AuraStateType((*i)->GetMiscValue())))
AddPctN(DoneTotalMod, (*i)->GetAmount());
// done scripted mod (take it from owner)
@@ -11867,7 +11780,7 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
case 7277:
{
// Merciless Combat
- if ((*i)->GetSpellProto()->SpellIconID == 2656)
+ if ((*i)->GetSpellInfo()->SpellIconID == 2656)
{
if (!victim->HealthAbovePct(35))
AddPctN(DoneTotalMod, (*i)->GetAmount());
@@ -11885,8 +11798,7 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
case 7293:
{
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, 0, 0x02000000, 0))
- if (SpellChainNode const* chain = sSpellMgr->GetSpellChainNode((*i)->GetId()))
- AddPctF(DoneTotalMod, chain->rank * 2.0f);
+ AddPctF(DoneTotalMod, (*i)->GetSpellInfo()->GetRank() * 2.0f);
break;
}
// Marked for Death
@@ -11941,7 +11853,7 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
if (spellProto)
{
// Mod damage from spell mechanic
- uint32 mechanicMask = GetAllSpellMechanicMask(spellProto);
+ uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask();
// Shred, Maul - "Effects which increase Bleed damage also increase Shred damage"
if (spellProto->SpellFamilyName == SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags[0] & 0x00008800)
@@ -11960,7 +11872,7 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
AuraEffectList const& mDummyAuras = victim->GetAuraEffectsByType(SPELL_AURA_DUMMY);
for (AuraEffectList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i)
{
- switch((*i)->GetSpellProto()->SpellIconID)
+ switch((*i)->GetSpellInfo()->SpellIconID)
{
// Cheat Death
case 2109:
@@ -11977,16 +11889,16 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
case 19:
case 1804:
{
- if ((*i)->GetSpellProto()->SpellFamilyName != SPELLFAMILY_PALADIN)
+ if ((*i)->GetSpellInfo()->SpellFamilyName != SPELLFAMILY_PALADIN)
continue;
- if ((*i)->GetMiscValue() & (spellProto ? GetSpellSchoolMask(spellProto) : 0))
+ if ((*i)->GetMiscValue() & (spellProto ? spellProto->GetSchoolMask() : 0))
AddPctN(TakenTotalMod, (*i)->GetAmount());
break;
}
// Ebon Plague
case 1933:
- if ((*i)->GetMiscValue() & (spellProto ? GetSpellSchoolMask(spellProto) : 0))
+ if ((*i)->GetMiscValue() & (spellProto ? spellProto->GetSchoolMask() : 0))
AddPctN(TakenTotalMod, (*i)->GetAmount());
break;
}
@@ -12058,20 +11970,20 @@ void Unit::ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
}
}
-void Unit::ApplySpellDispelImmunity(const SpellEntry * spellProto, DispelType type, bool apply)
+void Unit::ApplySpellDispelImmunity(const SpellInfo * spellProto, DispelType type, bool apply)
{
ApplySpellImmune(spellProto->Id, IMMUNITY_DISPEL, type, apply);
if (apply && spellProto->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)
{
// Create dispel mask by dispel type
- uint32 dispelMask = GetDispelMask(type);
+ uint32 dispelMask = SpellInfo::GetDispelMask(type);
// Dispel all existing auras vs current dispel type
AuraApplicationMap& auras = GetAppliedAuras();
for (AuraApplicationMap::iterator itr = auras.begin(); itr != auras.end();)
{
- SpellEntry const* spell = itr->second->GetBase()->GetSpellProto();
- if ((1<<spell->Dispel) & dispelMask)
+ SpellInfo const* spell = itr->second->GetBase()->GetSpellInfo();
+ if (spell->GetDispelMask() & dispelMask)
{
// Dispel aura
RemoveAura(itr);
@@ -12093,7 +12005,7 @@ float Unit::GetWeaponProcChance() const
return 0;
}
-float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellEntry * spellProto) const
+float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellInfo * spellProto) const
{
// proc per minute chance calculation
if (PPM <= 0) return 0.0f;
@@ -12379,7 +12291,7 @@ bool Unit::canAttack(Unit const* target, bool force) const
return true;
}
-bool Unit::isAttackableByAOE(SpellEntry const* spellProto) const
+bool Unit::isAttackableByAOE(SpellInfo const* spellProto) const
{
bool targetMustBeDead = spellProto ? bool(spellProto->AttributesEx3 & SPELL_ATTR3_REQUIRE_DEAD_TARGET) : false;
bool targetCanBeDead = spellProto ? bool(spellProto->AttributesEx2 & SPELL_ATTR2_ALLOW_DEAD_TARGET) : false;
@@ -12870,7 +12782,7 @@ float Unit::ApplyTotalThreatModifier(float fThreat, SpellSchoolMask schoolMask)
//======================================================================
-void Unit::AddThreat(Unit* victim, float fThreat, SpellSchoolMask schoolMask, SpellEntry const* threatSpell)
+void Unit::AddThreat(Unit* victim, float fThreat, SpellSchoolMask schoolMask, SpellInfo const* threatSpell)
{
// Only mobs can manage threat lists
if (CanHaveThreatList())
@@ -13081,7 +12993,7 @@ Unit* Creature::SelectVictim()
//======================================================================
//======================================================================
-float Unit::ApplyEffectModifiers(SpellEntry const* spellProto, uint8 effect_index, float value) const
+float Unit::ApplyEffectModifiers(SpellInfo const* spellProto, uint8 effect_index, float value) const
{
if (Player* modOwner = GetSpellModOwner())
{
@@ -13103,17 +13015,17 @@ float Unit::ApplyEffectModifiers(SpellEntry const* spellProto, uint8 effect_inde
}
// function uses real base points (typically value - 1)
-int32 Unit::CalculateSpellDamage(Unit const* target, SpellEntry const* spellProto, uint8 effect_index, int32 const* basePoints) const
+int32 Unit::CalculateSpellDamage(Unit const* target, SpellInfo const* spellProto, uint8 effect_index, int32 const* basePoints) const
{
- return SpellMgr::CalculateSpellEffectAmount(spellProto, effect_index, this, basePoints, target);
+ return spellProto->Effects[effect_index].CalcValue(this, basePoints, target);
}
-int32 Unit::CalcSpellDuration(SpellEntry const* spellProto)
+int32 Unit::CalcSpellDuration(SpellInfo const* spellProto)
{
uint8 comboPoints = m_movedPlayer ? m_movedPlayer->GetComboPoints() : 0;
- int32 minduration = GetSpellDuration(spellProto);
- int32 maxduration = GetSpellMaxDuration(spellProto);
+ int32 minduration = spellProto->GetDuration();
+ int32 maxduration = spellProto->GetMaxDuration();
int32 duration;
@@ -13125,7 +13037,7 @@ int32 Unit::CalcSpellDuration(SpellEntry const* spellProto)
return duration;
}
-int32 Unit::ModSpellDuration(SpellEntry const* spellProto, Unit const* target, int32 duration, bool positive)
+int32 Unit::ModSpellDuration(SpellInfo const* spellProto, Unit const* target, int32 duration, bool positive)
{
// don't mod permament auras duration
if (duration < 0)
@@ -13134,7 +13046,7 @@ int32 Unit::ModSpellDuration(SpellEntry const* spellProto, Unit const* target, i
// cut duration only of negative effects
if (!positive)
{
- int32 mechanic = GetAllSpellMechanicMask(spellProto);
+ int32 mechanic = spellProto->GetAllEffectsMechanicMask();
int32 durationMod;
int32 durationMod_always = 0;
@@ -13189,7 +13101,7 @@ int32 Unit::ModSpellDuration(SpellEntry const* spellProto, Unit const* target, i
sSpellMgr->IsSpellMemberOfSpellGroup(spellProto->Id, SPELL_GROUP_ELIXIR_BATTLE) ||
sSpellMgr->IsSpellMemberOfSpellGroup(spellProto->Id, SPELL_GROUP_ELIXIR_GUARDIAN)))
{
- if (target->HasAura(53042) && target->HasSpell(spellProto->EffectTriggerSpell[0]))
+ if (target->HasAura(53042) && target->HasSpell(spellProto->Effects[0].TriggerSpell))
duration *= 2;
}
}
@@ -13227,7 +13139,7 @@ int32 Unit::ModSpellDuration(SpellEntry const* spellProto, Unit const* target, i
return std::max(duration, 0);
}
-void Unit::ModSpellCastTime(SpellEntry const* spellProto, int32 & castTime, Spell* spell)
+void Unit::ModSpellCastTime(SpellInfo const* spellProto, int32 & castTime, Spell* spell)
{
if (!spellProto || castTime < 0)
return;
@@ -13364,35 +13276,21 @@ void Unit::ApplyDiminishingAura(DiminishingGroup group, bool apply)
}
}
-uint32 Unit::GetSpellMaxRangeForTarget(Unit* target, const SpellRangeEntry * rangeEntry)
-{
- if (!rangeEntry)
- return 0;
- if (rangeEntry->maxRangeHostile == rangeEntry->maxRangeFriend)
- return uint32(rangeEntry->maxRangeFriend);
- if (IsHostileTo(target))
- return uint32(rangeEntry->maxRangeHostile);
- return uint32(rangeEntry->maxRangeFriend);
-};
-uint32 Unit::GetSpellMinRangeForTarget(Unit* target, const SpellRangeEntry * rangeEntry)
+float Unit::GetSpellMaxRangeForTarget(Unit* target, SpellInfo const* spellInfo)
{
- if (!rangeEntry)
+ if (!spellInfo->RangeEntry)
return 0;
- if (rangeEntry->minRangeHostile == rangeEntry->minRangeFriend)
- return uint32(rangeEntry->minRangeFriend);
- if (IsHostileTo(target))
- return uint32(rangeEntry->minRangeHostile);
- return uint32(rangeEntry->minRangeFriend);
+ if (spellInfo->RangeEntry->maxRangeFriend == spellInfo->RangeEntry->maxRangeHostile)
+ return spellInfo->GetMaxRange();
+ return spellInfo->GetMaxRange(!IsHostileTo(target));
};
-uint32 Unit::GetSpellRadiusForTarget(Unit* target, const SpellRadiusEntry * radiusEntry)
+float Unit::GetSpellMinRangeForTarget(Unit* target, SpellInfo const* spellInfo)
{
- if (!radiusEntry)
+ if (!spellInfo->RangeEntry)
return 0;
- if (radiusEntry->radiusHostile == radiusEntry->radiusFriend)
- return uint32(radiusEntry->radiusFriend);
- if (IsHostileTo(target))
- return uint32(radiusEntry->radiusHostile);
- return uint32(radiusEntry->radiusFriend);
+ if (spellInfo->RangeEntry->minRangeFriend == spellInfo->RangeEntry->minRangeHostile)
+ return spellInfo->GetMinRange();
+ return spellInfo->GetMinRange(!IsHostileTo(target));
};
Unit* Unit::GetUnit(WorldObject& object, uint64 guid)
@@ -13962,13 +13860,14 @@ void CharmInfo::InitPossessCreateSpells()
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
{
uint32 spellId = m_unit->ToCreature()->m_spells[i];
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (spellInfo && spellInfo->Attributes & SPELL_ATTR0_CASTABLE_WHILE_DEAD)
- spellId = 0;
- if (IsPassiveSpell(spellId))
- m_unit->CastSpell(m_unit, spellId, true);
- else
- AddSpellToActionBar(m_unit->ToCreature()->m_spells[i], ACT_PASSIVE);
+ {
+ if (spellInfo->IsPassive())
+ m_unit->CastSpell(m_unit, spellInfo, true);
+ else
+ AddSpellToActionBar(spellInfo, ACT_PASSIVE);
+ }
}
}
}
@@ -13986,19 +13885,17 @@ void CharmInfo::InitCharmCreateSpells()
for (uint32 x = 0; x < MAX_SPELL_CHARM; ++x)
{
uint32 spellId = m_unit->ToCreature()->m_spells[x];
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
- if (spellInfo && spellInfo->Attributes & SPELL_ATTR0_CASTABLE_WHILE_DEAD)
- spellId = 0;
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
- if (!spellId)
+ if (!spellInfo || spellInfo->Attributes & SPELL_ATTR0_CASTABLE_WHILE_DEAD)
{
m_charmspells[x].SetActionAndType(spellId, ACT_DISABLED);
continue;
}
- if (IsPassiveSpell(spellId))
+ if (spellInfo->IsPassive())
{
- m_unit->CastSpell(m_unit, spellId, true);
+ m_unit->CastSpell(m_unit, spellInfo, true);
m_charmspells[x].SetActionAndType(spellId, ACT_PASSIVE);
}
else
@@ -14006,35 +13903,34 @@ void CharmInfo::InitCharmCreateSpells()
m_charmspells[x].SetActionAndType(spellId, ACT_DISABLED);
ActiveStates newstate = ACT_PASSIVE;
- if (spellInfo)
+
+ if (!spellInfo->IsAutocastable())
+ newstate = ACT_PASSIVE;
+ else
{
- if (!IsAutocastableSpell(spellId))
- newstate = ACT_PASSIVE;
- else
- {
- bool autocast = false;
- for (uint32 i = 0; i < MAX_SPELL_EFFECTS && !autocast; ++i)
- if (SpellTargetType[spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_UNIT_TARGET)
- autocast = true;
+ bool autocast = false;
+ for (uint32 i = 0; i < MAX_SPELL_EFFECTS && !autocast; ++i)
+ if (spellInfo->Effects[i].TargetA.GetType() == TARGET_TYPE_UNIT_TARGET)
+ autocast = true;
- if (autocast)
- {
- newstate = ACT_ENABLED;
- ToggleCreatureAutocast(spellId, true);
- }
- else
- newstate = ACT_DISABLED;
+ if (autocast)
+ {
+ newstate = ACT_ENABLED;
+ ToggleCreatureAutocast(spellInfo, true);
}
+ else
+ newstate = ACT_DISABLED;
}
- AddSpellToActionBar(spellId, newstate);
+ AddSpellToActionBar(spellInfo, newstate);
}
}
}
-bool CharmInfo::AddSpellToActionBar(uint32 spell_id, ActiveStates newstate)
+bool CharmInfo::AddSpellToActionBar(SpellInfo const* spellInfo, ActiveStates newstate)
{
- uint32 first_id = sSpellMgr->GetFirstSpellInChain(spell_id);
+ uint32 spell_id = spellInfo->Id;
+ uint32 first_id = spellInfo->GetFirstRankSpell()->Id;
// new spell rank can be already listed
for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
@@ -14054,7 +13950,7 @@ bool CharmInfo::AddSpellToActionBar(uint32 spell_id, ActiveStates newstate)
{
if (!PetActionBar[i].GetAction() && PetActionBar[i].IsActionBarForSpell())
{
- SetActionBar(i, spell_id, newstate == ACT_DECIDE ? IsAutocastableSpell(spell_id) ? ACT_DISABLED : ACT_PASSIVE : newstate);
+ SetActionBar(i, spell_id, newstate == ACT_DECIDE ? spellInfo->IsAutocastable() ? ACT_DISABLED : ACT_PASSIVE : newstate);
return true;
}
}
@@ -14080,13 +13976,13 @@ bool CharmInfo::RemoveSpellFromActionBar(uint32 spell_id)
return false;
}
-void CharmInfo::ToggleCreatureAutocast(uint32 spellid, bool apply)
+void CharmInfo::ToggleCreatureAutocast(SpellInfo const* spellInfo, bool apply)
{
- if (IsPassiveSpell(spellid))
+ if (spellInfo->IsPassive())
return;
for (uint32 x = 0; x < MAX_SPELL_CHARM; ++x)
- if (spellid == m_charmspells[x].GetAction())
+ if (spellInfo->Id == m_charmspells[x].GetAction())
m_charmspells[x].SetType(apply ? ACT_ENABLED : ACT_DISABLED);
}
@@ -14122,9 +14018,10 @@ void CharmInfo::LoadPetActionBar(const std::string& data)
// check correctness
if (PetActionBar[index].IsActionBarForSpell())
{
- if (!sSpellStore.LookupEntry(PetActionBar[index].GetAction()))
+ SpellInfo const* spelInfo = sSpellMgr->GetSpellInfo(PetActionBar[index].GetAction());
+ if (!spelInfo)
SetActionBar(index, 0, ACT_PASSIVE);
- else if (!IsAutocastableSpell(PetActionBar[index].GetAction()))
+ else if (!spelInfo->IsAutocastable())
SetActionBar(index, PetActionBar[index].GetAction(), ACT_PASSIVE);
}
}
@@ -14136,11 +14033,11 @@ void CharmInfo::BuildActionBar(WorldPacket* data)
*data << uint32(PetActionBar[i].packedData);
}
-void CharmInfo::SetSpellAutocast(uint32 spell_id, bool state)
+void CharmInfo::SetSpellAutocast(SpellInfo const* spellInfo, bool state)
{
for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
{
- if (spell_id == PetActionBar[i].GetAction() && PetActionBar[i].IsActionBarForSpell())
+ if (spellInfo->Id == PetActionBar[i].GetAction() && PetActionBar[i].IsActionBarForSpell())
{
PetActionBar[i].SetType(state ? ACT_ENABLED : ACT_DISABLED);
break;
@@ -14270,7 +14167,7 @@ uint32 createProcExtendMask(SpellNonMeleeDamage *damageInfo, SpellMissInfo missC
return procEx;
}
-void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellEntry const* procSpell, uint32 damage, SpellEntry const* procAura)
+void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const* procSpell, uint32 damage, SpellInfo const* procAura)
{
// Player is loaded now - do not allow passive spell casts to proc
if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetSession()->PlayerLoading())
@@ -14353,7 +14250,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag,
bool active = (damage > 0) || (procExtra & (PROC_EX_ABSORB|PROC_EX_BLOCK) && isVictim);
if (isVictim)
procExtra &= ~PROC_EX_INTERNAL_REQ_FAMILY;
- SpellEntry const* spellProto = itr->second->GetBase()->GetSpellProto();
+ SpellInfo const* spellProto = itr->second->GetBase()->GetSpellInfo();
if (!IsTriggeredAtSpellProcEvent(pTarget, triggerData.aura, procSpell, procFlag, procExtra, attType, isVictim, active, triggerData.spellProcEvent))
continue;
@@ -14401,7 +14298,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag,
continue;
bool takeCharges = false;
- SpellEntry const* spellInfo = i->aura->GetSpellProto();
+ SpellInfo const* spellInfo = i->aura->GetSpellInfo();
uint32 Id = i->aura->GetId();
// For players set spell cooldown if need
@@ -14511,7 +14408,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag,
}
case SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK:
// Skip melee hits or instant cast spells
- if (procSpell && GetSpellCastTime(procSpell) != 0)
+ if (procSpell && procSpell->CalcCastTime() != 0)
takeCharges = true;
break;
case SPELL_AURA_REFLECT_SPELLS_SCHOOL:
@@ -14523,7 +14420,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag,
case SPELL_AURA_MOD_POWER_COST_SCHOOL:
// Skip melee hits and spells ws wrong school or zero cost
if (procSpell &&
- (procSpell->manaCost != 0 || procSpell->ManaCostPercentage != 0) && // Cost check
+ (procSpell->ManaCost != 0 || procSpell->ManaCostPercentage != 0) && // Cost check
(triggeredByAura->GetMiscValue() & procSpell->SchoolMask)) // School check
takeCharges = true;
break;
@@ -14796,11 +14693,11 @@ bool Unit::IsPolymorphed() const
if (!transformId)
return false;
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(transformId);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(transformId);
if (!spellInfo)
return false;
- return GetSpellSpecific(spellInfo) == SPELL_SPECIFIC_MAGE_POLYMORPH;
+ return spellInfo->GetSpellSpecific() == SPELL_SPECIFIC_MAGE_POLYMORPH;
}
void Unit::SetDisplayId(uint32 modelId)
@@ -14971,7 +14868,7 @@ void Unit::ApplyCastTimePercentMod(float val, bool apply)
ApplyPercentModFloatValue(UNIT_MOD_CAST_SPEED, -val, apply);
}
-uint32 Unit::GetCastingTimeForBonus(SpellEntry const* spellProto, DamageEffectType damagetype, uint32 CastingTime)
+uint32 Unit::GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime)
{
// Not apply this to creature casted spells with casttime == 0
if (CastingTime == 0 && GetTypeId() == TYPEID_UNIT && !ToCreature()->isPet())
@@ -14980,7 +14877,7 @@ uint32 Unit::GetCastingTimeForBonus(SpellEntry const* spellProto, DamageEffectTy
if (CastingTime > 7000) CastingTime = 7000;
if (CastingTime < 1500) CastingTime = 1500;
- if (damagetype == DOT && !IsChanneledSpell(spellProto))
+ if (damagetype == DOT && !spellProto->IsChanneled())
CastingTime = 3500;
int32 overTime = 0;
@@ -14990,7 +14887,7 @@ uint32 Unit::GetCastingTimeForBonus(SpellEntry const* spellProto, DamageEffectTy
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; i++)
{
- switch (spellProto->Effect[i])
+ switch (spellProto->Effects[i].Effect)
{
case SPELL_EFFECT_SCHOOL_DAMAGE:
case SPELL_EFFECT_POWER_DRAIN:
@@ -15001,13 +14898,13 @@ uint32 Unit::GetCastingTimeForBonus(SpellEntry const* spellProto, DamageEffectTy
DirectDamage = true;
break;
case SPELL_EFFECT_APPLY_AURA:
- switch (spellProto->EffectApplyAuraName[i])
+ switch (spellProto->Effects[i].ApplyAuraName)
{
case SPELL_AURA_PERIODIC_DAMAGE:
case SPELL_AURA_PERIODIC_HEAL:
case SPELL_AURA_PERIODIC_LEECH:
- if (GetSpellDuration(spellProto))
- overTime = GetSpellDuration(spellProto);
+ if (spellProto->GetDuration())
+ overTime = spellProto->GetDuration();
break;
default:
// -5% per additional effect
@@ -15018,7 +14915,7 @@ uint32 Unit::GetCastingTimeForBonus(SpellEntry const* spellProto, DamageEffectTy
break;
}
- if (IsAreaEffectTarget[spellProto->EffectImplicitTargetA[i]] || IsAreaEffectTarget[spellProto->EffectImplicitTargetB[i]])
+ if (spellProto->Effects[i].IsArea())
AreaEffect = true;
}
@@ -15026,7 +14923,7 @@ uint32 Unit::GetCastingTimeForBonus(SpellEntry const* spellProto, DamageEffectTy
if (overTime > 0 && CastingTime > 0 && DirectDamage)
{
// mainly for DoTs which are 3500 here otherwise
- uint32 OriginalCastTime = GetSpellCastTime(spellProto);
+ uint32 OriginalCastTime = spellProto->CalcCastTime();
if (OriginalCastTime > 7000) OriginalCastTime = 7000;
if (OriginalCastTime < 1500) OriginalCastTime = 1500;
// Portion to Over Time
@@ -15224,9 +15121,9 @@ bool Unit::InitTamedPet(Pet * pet, uint8 level, uint32 spell_id)
return true;
}
-bool Unit::IsTriggeredAtSpellProcEvent(Unit* victim, Aura* aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const* & spellProcEvent)
+bool Unit::IsTriggeredAtSpellProcEvent(Unit* victim, Aura* aura, SpellInfo const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const* & spellProcEvent)
{
- SpellEntry const* spellProto = aura->GetSpellProto();
+ SpellInfo const* spellProto = aura->GetSpellInfo();
// let the aura be handled by new proc system if it has new entry
if (sSpellMgr->GetSpellProcEntry(spellProto->Id))
@@ -15240,7 +15137,7 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit* victim, Aura* aura, SpellEntry cons
if (spellProcEvent && spellProcEvent->procFlags) // if exist get custom spellProcEvent->procFlags
EventProcFlag = spellProcEvent->procFlags;
else
- EventProcFlag = spellProto->procFlags; // else get from spell proto
+ EventProcFlag = spellProto->ProcFlags; // else get from spell proto
// Continue if no trigger exist
if (!EventProcFlag)
return false;
@@ -15272,7 +15169,7 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit* victim, Aura* aura, SpellEntry cons
// Aura added by spell can`t trigger from self (prevent drop charges/do triggers)
// But except periodic and kill triggers (can triggered from self)
if (procSpell && procSpell->Id == spellProto->Id
- && !(spellProto->procFlags&(PROC_FLAG_TAKEN_PERIODIC | PROC_FLAG_KILL)))
+ && !(spellProto->ProcFlags&(PROC_FLAG_TAKEN_PERIODIC | PROC_FLAG_KILL)))
return false;
// Check if current equipment allows aura to proc
@@ -15304,7 +15201,7 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit* victim, Aura* aura, SpellEntry cons
}
}
// Get chance from spell
- float chance = float(spellProto->procChance);
+ float chance = float(spellProto->ProcChance);
// If in spellProcEvent exist custom chance, chance = spellProcEvent->customChance;
if (spellProcEvent && spellProcEvent->customChance)
chance = spellProcEvent->customChance;
@@ -15333,7 +15230,7 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit* victim, Aura* aura, SpellEntry cons
bool Unit::HandleAuraRaidProcFromChargeWithValue(AuraEffect* triggeredByAura)
{
// aura can be deleted at casts
- SpellEntry const* spellProto = triggeredByAura->GetSpellProto();
+ SpellInfo const* spellProto = triggeredByAura->GetSpellInfo();
uint32 effIdx = triggeredByAura->GetEffIndex();
int32 heal = triggeredByAura->GetAmount();
uint64 caster_guid = triggeredByAura->GetCasterGUID();
@@ -15354,16 +15251,9 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue(AuraEffect* triggeredByAura)
// next target selection
if (jumps > 0)
{
- float radius;
- if (spellProto->EffectRadiusIndex[effIdx])
- radius = (float)GetSpellRadiusForTarget(triggeredByAura->GetCaster(), sSpellRadiusStore.LookupEntry(spellProto->EffectRadiusIndex[effIdx]));
- else
- radius = (float)GetSpellMaxRangeForTarget(triggeredByAura->GetCaster(), sSpellRangeStore.LookupEntry(spellProto->rangeIndex));
-
if (Unit* caster = triggeredByAura->GetCaster())
{
- if (Player* modOwner = caster->GetSpellModOwner())
- modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_RADIUS, radius, NULL);
+ float radius = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcRadius(caster);
if (Unit* target = GetNextRandomRaidMemberOrPet(radius))
{
@@ -15382,7 +15272,7 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue(AuraEffect* triggeredByAura)
bool Unit::HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura)
{
// aura can be deleted at casts
- SpellEntry const* spellProto = triggeredByAura->GetSpellProto();
+ SpellInfo const* spellProto = triggeredByAura->GetSpellInfo();
uint32 damageSpellId;
switch (spellProto->Id)
@@ -15414,17 +15304,9 @@ bool Unit::HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura)
// next target selection
if (jumps > 0)
{
- float radius;
- if (spellProto->EffectRadiusIndex[effIdx])
- radius = (float)GetSpellRadiusForTarget(triggeredByAura->GetCaster(), sSpellRadiusStore.LookupEntry(spellProto->EffectRadiusIndex[effIdx]));
- else
- radius = (float)GetSpellMaxRangeForTarget(triggeredByAura->GetCaster() , sSpellRangeStore.LookupEntry(spellProto->rangeIndex));
-
if (Unit* caster = triggeredByAura->GetCaster())
{
- if (Player* modOwner = caster->GetSpellModOwner())
- modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_RADIUS, radius, NULL);
-
+ float radius = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcRadius(caster);
if (Unit* target= GetNextRandomRaidMemberOrPet(radius))
{
CastSpell(target, spellProto, true, NULL, triggeredByAura, caster_guid);
@@ -15555,7 +15437,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
AuraEffectList const& dummyAuras = victim->GetAuraEffectsByType(SPELL_AURA_DUMMY);
for (AuraEffectList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr)
{
- if ((*itr)->GetSpellProto()->SpellIconID == 1654)
+ if ((*itr)->GetSpellInfo()->SpellIconID == 1654)
{
AuraEffect const* aurEff = *itr;
// save value before aura remove
@@ -16410,7 +16292,7 @@ Aura* Unit::AddAura(uint32 spellId, Unit* target)
if (!target)
return NULL;
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
return NULL;
@@ -16420,7 +16302,7 @@ Aura* Unit::AddAura(uint32 spellId, Unit* target)
return AddAura(spellInfo, MAX_EFFECT_MASK, target);
}
-Aura* Unit::AddAura(SpellEntry const* spellInfo, uint8 effMask, Unit* target)
+Aura* Unit::AddAura(SpellInfo const* spellInfo, uint8 effMask, Unit* target)
{
if (!spellInfo)
return NULL;
@@ -16992,7 +16874,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
Unit* target = (itr->second.castFlags & NPC_CLICK_CAST_TARGET_CLICKER) ? clicker : this;
uint64 origCasterGUID = (itr->second.castFlags & NPC_CLICK_CAST_ORIG_CASTER_OWNER) ? GetOwnerGUID() : clicker->GetGUID();
- SpellEntry const* spellEntry = sSpellStore.LookupEntry(itr->second.spellId);
+ SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(itr->second.spellId);
// if (!spellEntry) should be checked at npc_spellclick load
if (seatId > -1)
@@ -17001,7 +16883,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
bool valid = false;
while (i < MAX_SPELL_EFFECTS && !valid)
{
- if (spellEntry->EffectApplyAuraName[i] == SPELL_AURA_CONTROL_VEHICLE)
+ if (spellEntry->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE)
{
valid = true;
break;
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 685bbc8108a..dac7198c61f 100755
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -317,7 +317,6 @@ enum InventorySlot
};
struct FactionTemplateEntry;
-struct SpellEntry;
struct SpellValue;
class AuraApplication;
@@ -326,6 +325,7 @@ class UnitAura;
class AuraEffect;
class Creature;
class Spell;
+class SpellInfo;
class DynamicObject;
class GameObject;
class Item;
@@ -811,7 +811,7 @@ private:
Unit* const m_attacker;
Unit* const m_victim;
uint32 m_damage;
- SpellEntry const* const m_spellInfo;
+ SpellInfo const* const m_spellInfo;
SpellSchoolMask const m_schoolMask;
DamageEffectType const m_damageType;
WeaponAttackType m_attackType;
@@ -819,7 +819,7 @@ private:
uint32 m_resist;
uint32 m_block;
public:
- explicit DamageInfo(Unit* _attacker, Unit* _victim, uint32 _damage, SpellEntry const* _spellInfo, SpellSchoolMask _schoolMask, DamageEffectType _damageType);
+ explicit DamageInfo(Unit* _attacker, Unit* _victim, uint32 _damage, SpellInfo const* _spellInfo, SpellSchoolMask _schoolMask, DamageEffectType _damageType);
explicit DamageInfo(CalcDamageInfo& dmgInfo);
void ModifyDamage(int32 amount);
@@ -829,7 +829,7 @@ public:
Unit* GetAttacker() const { return m_attacker; };
Unit* GetVictim() const { return m_victim; };
- SpellEntry const* GetSpellInfo() const { return m_spellInfo; };
+ SpellInfo const* GetSpellInfo() const { return m_spellInfo; };
SpellSchoolMask GetSchoolMask() const { return m_schoolMask; };
DamageEffectType GetDamageType() const { return m_damageType; };
WeaponAttackType GetAttackType() const { return m_attackType; };
@@ -846,10 +846,10 @@ private:
Unit* const m_target;
uint32 m_heal;
uint32 m_absorb;
- SpellEntry const* const m_spellInfo;
+ SpellInfo const* const m_spellInfo;
SpellSchoolMask const m_schoolMask;
public:
- explicit HealInfo(Unit* _healer, Unit* _target, uint32 _heal, SpellEntry const* _spellInfo, SpellSchoolMask _schoolMask)
+ explicit HealInfo(Unit* _healer, Unit* _target, uint32 _heal, SpellInfo const* _spellInfo, SpellSchoolMask _schoolMask)
: m_healer(_healer), m_target(_target), m_heal(_heal), m_spellInfo(_spellInfo), m_schoolMask(_schoolMask)
{
m_absorb = 0;
@@ -886,7 +886,7 @@ public:
uint32 GetSpellTypeMask() const { return _spellTypeMask; }
uint32 GetSpellPhaseMask() const { return _spellPhaseMask; }
uint32 GetHitMask() const { return _hitMask; }
- SpellEntry const* GetSpellInfo() const { return NULL; }
+ SpellInfo const* GetSpellInfo() const { return NULL; }
SpellSchoolMask GetSchoolMask() const { return SPELL_SCHOOL_MASK_NONE; }
DamageInfo* GetDamageInfo() const { return _damageInfo; }
HealInfo* GetHealInfo() const { return _healInfo; }
@@ -987,9 +987,9 @@ public:
GlobalCooldownMgr() {}
public:
- bool HasGlobalCooldown(SpellEntry const* spellInfo) const;
- void AddGlobalCooldown(SpellEntry const* spellInfo, uint32 gcd);
- void CancelGlobalCooldown(SpellEntry const* spellInfo);
+ bool HasGlobalCooldown(SpellInfo const* spellInfo) const;
+ void AddGlobalCooldown(SpellInfo const* spellInfo, uint32 gcd);
+ void CancelGlobalCooldown(SpellInfo const* spellInfo);
private:
GlobalCooldownList m_GlobalCooldowns;
@@ -1065,7 +1065,7 @@ enum CharmType
CHARM_TYPE_CONVERT,
};
-typedef UnitActionBarEntry CharmSpellEntry;
+typedef UnitActionBarEntry CharmSpellInfo;
enum ActionBarIndex
{
@@ -1096,20 +1096,20 @@ struct CharmInfo
void InitEmptyActionBar(bool withAttack = true);
//return true if successful
- bool AddSpellToActionBar(uint32 spellid, ActiveStates newstate = ACT_DECIDE);
+ bool AddSpellToActionBar(SpellInfo const* spellInfo, ActiveStates newstate = ACT_DECIDE);
bool RemoveSpellFromActionBar(uint32 spell_id);
void LoadPetActionBar(const std::string& data);
void BuildActionBar(WorldPacket* data);
- void SetSpellAutocast(uint32 spell_id, bool state);
+ void SetSpellAutocast(SpellInfo const* spellInfo, bool state);
void SetActionBar(uint8 index, uint32 spellOrAction, ActiveStates type)
{
PetActionBar[index].SetActionAndType(spellOrAction, type);
}
UnitActionBarEntry const* GetActionBarEntry(uint8 index) const { return &(PetActionBar[index]); }
- void ToggleCreatureAutocast(uint32 spellid, bool apply);
+ void ToggleCreatureAutocast(SpellInfo const* spellInfo, bool apply);
- CharmSpellEntry* GetCharmSpell(uint8 index) { return &(m_charmspells[index]); }
+ CharmSpellInfo* GetCharmSpell(uint8 index) { return &(m_charmspells[index]); }
GlobalCooldownMgr& GetGlobalCooldownMgr() { return m_GlobalCooldownMgr; }
@@ -1128,7 +1128,7 @@ struct CharmInfo
Unit* m_unit;
UnitActionBarEntry PetActionBar[MAX_UNIT_ACTION_BAR_INDEX];
- CharmSpellEntry m_charmspells[4];
+ CharmSpellInfo m_charmspells[4];
CommandStates m_CommandState;
uint32 m_petnumber;
bool m_barInit;
@@ -1187,7 +1187,7 @@ class Unit : public WorldObject
typedef std::pair<uint32, uint8> spellEffectPair;
typedef std::multimap<uint32, Aura*> AuraMap;
typedef std::multimap<uint32, AuraApplication*> AuraApplicationMap;
- typedef std::multimap<AuraState, AuraApplication*> AuraStateAurasMap;
+ typedef std::multimap<AuraStateType, AuraApplication*> AuraStateAurasMap;
typedef std::list<AuraEffect *> AuraEffectList;
typedef std::list<Aura *> AuraList;
typedef std::list<AuraApplication *> AuraApplicationList;
@@ -1212,10 +1212,9 @@ class Unit : public WorldObject
void ApplyDiminishingAura(DiminishingGroup group, bool apply);
void ClearDiminishings() { m_Diminishing.clear(); }
- //target dependent range checks
- uint32 GetSpellMaxRangeForTarget(Unit* target, const SpellRangeEntry * rangeEntry);
- uint32 GetSpellMinRangeForTarget(Unit* target, const SpellRangeEntry * rangeEntry);
- uint32 GetSpellRadiusForTarget(Unit* target, const SpellRadiusEntry * radiusEntry);
+ // target dependent range checks
+ float GetSpellMaxRangeForTarget(Unit* target, SpellInfo const* spellInfo);
+ float GetSpellMinRangeForTarget(Unit* target, SpellInfo const* spellInfo);
virtual void Update(uint32 time);
@@ -1392,12 +1391,12 @@ class Unit : public WorldObject
uint16 GetMaxSkillValueForLevel(Unit const* target = NULL) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; }
void DealDamageMods(Unit *pVictim, uint32 &damage, uint32* absorb);
- uint32 DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage = NULL, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *spellProto = NULL, bool durabilityLoss = true);
+ uint32 DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage = NULL, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto = NULL, bool durabilityLoss = true);
void Kill(Unit *pVictim, bool durabilityLoss = true);
int32 DealHeal(Unit *pVictim, uint32 addhealth);
- void ProcDamageAndSpell(Unit *pVictim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellEntry const *procSpell = NULL, SpellEntry const* procAura = NULL);
- void ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellEntry const* procSpell, uint32 damage , SpellEntry const* procAura = NULL);
+ void ProcDamageAndSpell(Unit *pVictim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellInfo const *procSpell = NULL, SpellInfo const* procAura = NULL);
+ void ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const* procSpell, uint32 damage , SpellInfo const* procAura = NULL);
void GetProcAurasTriggeredOnEvent(std::list<AuraApplication*>& aurasTriggeringProc, std::list<AuraApplication*>* procAuras, ProcEventInfo eventInfo);
void TriggerAurasProcOnEvent(CalcDamageInfo& damageInfo);
@@ -1410,7 +1409,7 @@ class Unit : public WorldObject
void CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *damageInfo, WeaponAttackType attackType = BASE_ATTACK);
void DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss);
- void CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellEntry const *spellInfo, WeaponAttackType attackType = BASE_ATTACK, bool crit = false);
+ void CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType = BASE_ATTACK, bool crit = false);
void DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss);
// player or player's pet resilience (-1%)
@@ -1431,15 +1430,15 @@ class Unit : public WorldObject
void ApplyResilience(const Unit* pVictim, float * crit, int32 * damage, bool isCrit, CombatRating type) const;
float MeleeSpellMissChance(const Unit *pVictim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const;
- SpellMissInfo MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell);
- SpellMissInfo MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell);
- SpellMissInfo SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool canReflect = false);
+ SpellMissInfo MeleeSpellHitResult(Unit *pVictim, SpellInfo const *spell);
+ SpellMissInfo MagicSpellHitResult(Unit *pVictim, SpellInfo const *spell);
+ SpellMissInfo SpellHitResult(Unit *pVictim, SpellInfo const *spell, bool canReflect = false);
float GetUnitDodgeChance() const;
float GetUnitParryChance() const;
float GetUnitBlockChance() const;
float GetUnitCriticalChance(WeaponAttackType attackType, const Unit *pVictim) const;
- int32 GetMechanicResistChance(const SpellEntry *spell);
+ int32 GetMechanicResistChance(const SpellInfo *spell);
bool CanUseAttackType(uint8 attacktype) const
{
switch(attacktype)
@@ -1456,7 +1455,7 @@ class Unit : public WorldObject
uint32 GetDefenseSkillValue(Unit const* target = NULL) const;
uint32 GetWeaponSkillValue(WeaponAttackType attType, Unit const* target = NULL) const;
float GetWeaponProcChance() const;
- float GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellEntry * spellProto) const;
+ float GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellInfo * spellProto) const;
MeleeHitOutcome RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttackType attType) const;
MeleeHitOutcome RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance) const;
@@ -1506,31 +1505,31 @@ class Unit : public WorldObject
bool isFrozen() const;
bool isTargetableForAttack() const;
- bool isAttackableByAOE(SpellEntry const* spellProto = NULL) const;
+ bool isAttackableByAOE(SpellInfo const* spellProto = NULL) const;
bool canAttack(Unit const* target, bool force = true) const;
virtual bool IsInWater() const;
virtual bool IsUnderWater() const;
bool isInAccessiblePlaceFor(Creature const* c) const;
void SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, uint32 OverHeal, uint32 Absorb, bool critical = false);
- int32 HealBySpell(Unit* pVictim, SpellEntry const* spellInfo, uint32 addHealth, bool critical = false);
+ int32 HealBySpell(Unit* pVictim, SpellInfo const* spellInfo, uint32 addHealth, bool critical = false);
void SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, Powers powertype);
void EnergizeBySpell(Unit *pVictim, uint32 SpellID, uint32 Damage, Powers powertype);
uint32 SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage);
void CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastSpell(Unit* Victim, SpellEntry const *spellInfo, bool triggered, Item *castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastSpell(Unit* Victim, SpellInfo const *spellInfo, bool triggered, Item *castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0, Unit* originalVictim = 0);
void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* Victim = NULL, bool triggered = true, Item *castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* Victim = NULL, bool triggered = true, Item *castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(GameObject *go, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
Aura * AddAura(uint32 spellId, Unit* target);
- Aura * AddAura(SpellEntry const *spellInfo, uint8 effMask, Unit* target);
+ Aura * AddAura(SpellInfo const *spellInfo, uint8 effMask, Unit* target);
void SetAuraStack(uint32 spellId, Unit* target, uint32 stack);
void SendPlaySpellVisual(uint32 id);
void SendPlaySpellImpact(uint64 guid, uint32 id);
- bool IsDamageToThreatSpell(SpellEntry const* spellInfo) const;
+ bool IsDamageToThreatSpell(SpellInfo const* spellInfo) const;
void DeMorph();
@@ -1664,7 +1663,7 @@ class Unit : public WorldObject
bool InitTamedPet(Pet * pet, uint8 level, uint32 spell_id);
// aura apply/remove helpers - you should better not use these
- Aura* _TryStackingOrRefreshingExistingAura(SpellEntry const* newAura, uint8 effMask, Unit* caster, int32* baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0);
+ Aura* _TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0);
void _AddAura(UnitAura* aura, Unit* caster);
AuraApplication * _CreateAuraApplication(Aura * aura, uint8 effMask);
void _ApplyAuraEffect(Aura * aura, uint8 effIndex);
@@ -1741,13 +1740,13 @@ class Unit : public WorldObject
bool HasAuraType(AuraType auraType) const;
bool HasAuraTypeWithCaster(AuraType auratype, uint64 caster) const;
bool HasAuraTypeWithMiscvalue(AuraType auratype, int32 miscvalue) const;
- bool HasAuraTypeWithAffectMask(AuraType auratype, SpellEntry const* affectedSpell) const;
+ bool HasAuraTypeWithAffectMask(AuraType auratype, SpellInfo const* affectedSpell) const;
bool HasAuraTypeWithValue(AuraType auratype, int32 value) const;
bool HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid = 0);
bool HasNegativeAuraWithAttribute(uint32 flag, uint64 guid = 0);
bool HasAuraWithMechanic(uint32 mechanicMask);
- AuraEffect * IsScriptOverriden(SpellEntry const* spell, int32 script) const;
+ AuraEffect * IsScriptOverriden(SpellInfo const* spell, int32 script) const;
uint32 GetDiseasesByCaster(uint64 casterGUID, bool remove = false);
uint32 GetDoTsByCaster(uint64 casterGUID) const;
@@ -1766,10 +1765,10 @@ class Unit : public WorldObject
int32 GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const;
int32 GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const;
- int32 GetTotalAuraModifierByAffectMask(AuraType auratype, SpellEntry const* affectedSpell) const;
- float GetTotalAuraMultiplierByAffectMask(AuraType auratype, SpellEntry const* affectedSpell) const;
- int32 GetMaxPositiveAuraModifierByAffectMask(AuraType auratype, SpellEntry const* affectedSpell) const;
- int32 GetMaxNegativeAuraModifierByAffectMask(AuraType auratype, SpellEntry const* affectedSpell) const;
+ int32 GetTotalAuraModifierByAffectMask(AuraType auratype, SpellInfo const* affectedSpell) const;
+ float GetTotalAuraMultiplierByAffectMask(AuraType auratype, SpellInfo const* affectedSpell) const;
+ int32 GetMaxPositiveAuraModifierByAffectMask(AuraType auratype, SpellInfo const* affectedSpell) const;
+ int32 GetMaxNegativeAuraModifierByAffectMask(AuraType auratype, SpellInfo const* affectedSpell) const;
float GetResistanceBuffMods(SpellSchools school, bool positive) const { return GetFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school); }
void SetResistanceBuffMods(SpellSchools school, bool positive, float val) { SetFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school, val); }
@@ -1902,7 +1901,7 @@ class Unit : public WorldObject
// Threat related methods
bool CanHaveThreatList() const;
- void AddThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL);
+ void AddThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell = NULL);
float ApplyTotalThreatModifier(float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL);
void DeleteThreatList();
void TauntApply(Unit* pVictim);
@@ -1950,45 +1949,45 @@ class Unit : public WorldObject
uint32 CalculateDamage(WeaponAttackType attType, bool normalized, bool addTotalPct);
float GetAPMultiplier(WeaponAttackType attType, bool normalized);
- void ModifyAuraState(AuraState flag, bool apply);
+ void ModifyAuraState(AuraStateType flag, bool apply);
uint32 BuildAuraStateUpdateForTarget(Unit* target) const;
- bool HasAuraState(AuraState flag, SpellEntry const *spellProto = NULL, Unit const* Caster = NULL) const ;
+ bool HasAuraState(AuraStateType flag, SpellInfo const *spellProto = NULL, Unit const* Caster = NULL) const ;
void UnsummonAllTotems();
- Unit* SelectMagnetTarget(Unit* victim, SpellEntry const *spellInfo = NULL);
+ Unit* SelectMagnetTarget(Unit* victim, SpellInfo const *spellInfo = NULL);
int32 SpellBaseDamageBonus(SpellSchoolMask schoolMask);
int32 SpellBaseHealingBonus(SpellSchoolMask schoolMask);
int32 SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask, Unit *pVictim);
int32 SpellBaseHealingBonusForVictim(SpellSchoolMask schoolMask, Unit *pVictim);
- uint32 SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint32 damage, DamageEffectType damagetype, uint32 stack = 1);
- uint32 SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1);
- bool isSpellBlocked(Unit *pVictim, SpellEntry const *spellProto, WeaponAttackType attackType = BASE_ATTACK);
+ uint32 SpellDamageBonus(Unit *pVictim, SpellInfo const *spellProto, uint32 damage, DamageEffectType damagetype, uint32 stack = 1);
+ uint32 SpellHealingBonus(Unit *pVictim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1);
+ bool isSpellBlocked(Unit *pVictim, SpellInfo const *spellProto, WeaponAttackType attackType = BASE_ATTACK);
bool isBlockCritical();
- bool isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType = BASE_ATTACK) const;
- uint32 SpellCriticalDamageBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim);
- uint32 SpellCriticalHealingBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim);
+ bool isSpellCrit(Unit *pVictim, SpellInfo const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType = BASE_ATTACK) const;
+ uint32 SpellCriticalDamageBonus(SpellInfo const *spellProto, uint32 damage, Unit *pVictim);
+ uint32 SpellCriticalHealingBonus(SpellInfo const *spellProto, uint32 damage, Unit *pVictim);
void SetLastManaUse(uint32 spellCastTime) { m_lastManaUse = spellCastTime; }
bool IsUnderLastManaUseEffect() const;
void SetContestedPvP(Player *attackedPlayer = NULL);
- void MeleeDamageBonus(Unit *pVictim, uint32 *damage, WeaponAttackType attType, SpellEntry const *spellProto = NULL);
- uint32 GetCastingTimeForBonus(SpellEntry const *spellProto, DamageEffectType damagetype, uint32 CastingTime);
+ void MeleeDamageBonus(Unit *pVictim, uint32 *damage, WeaponAttackType attType, SpellInfo const *spellProto = NULL);
+ uint32 GetCastingTimeForBonus(SpellInfo const *spellProto, DamageEffectType damagetype, uint32 CastingTime);
uint32 GetRemainingPeriodicAmount(uint64 caster, uint32 spellId, AuraType auraType, uint8 effectIndex = 0) const;
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply);
- void ApplySpellDispelImmunity(const SpellEntry * spellProto, DispelType type, bool apply);
- virtual bool IsImmunedToSpell(SpellEntry const* spellInfo);
+ void ApplySpellDispelImmunity(const SpellInfo * spellProto, DispelType type, bool apply);
+ virtual bool IsImmunedToSpell(SpellInfo const* spellInfo);
// redefined in Creature
bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask);
- bool IsImmunedToDamage(SpellEntry const* spellInfo);
- virtual bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const;
+ bool IsImmunedToDamage(SpellInfo const* spellInfo);
+ virtual bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const;
// redefined in Creature
- static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellEntry const *spellInfo = NULL, uint8 effIndex = MAX_SPELL_EFFECTS);
- uint32 CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEntry const *spellInfo, WeaponAttackType attackType=MAX_ATTACK);
- void CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist, SpellEntry const *spellInfo = NULL);
- void CalcHealAbsorb(Unit *pVictim, const SpellEntry *spellProto, uint32 &healAmount, uint32 &absorb);
+ static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo = NULL, uint8 effIndex = MAX_SPELL_EFFECTS);
+ uint32 CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=MAX_ATTACK);
+ void CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist, SpellInfo const *spellInfo = NULL);
+ void CalcHealAbsorb(Unit *pVictim, const SpellInfo *spellProto, uint32 &healAmount, uint32 &absorb);
void UpdateSpeed(UnitMoveType mtype, bool forced);
float GetSpeed(UnitMoveType mtype) const;
@@ -1999,12 +1998,12 @@ class Unit : public WorldObject
void SetHover(bool on);
bool isHover() const { return HasAuraType(SPELL_AURA_HOVER); }
- float ApplyEffectModifiers(SpellEntry const* spellProto, uint8 effect_index, float value) const;
- int32 CalculateSpellDamage(Unit const* target, SpellEntry const* spellProto, uint8 effect_index, int32 const* basePoints = NULL) const;
- int32 CalcSpellDuration(SpellEntry const* spellProto);
- int32 ModSpellDuration(SpellEntry const* spellProto, Unit const* target, int32 duration, bool positive);
- void ModSpellCastTime(SpellEntry const* spellProto, int32 & castTime, Spell* spell=NULL);
- float CalculateLevelPenalty(SpellEntry const* spellProto) const;
+ float ApplyEffectModifiers(SpellInfo const* spellProto, uint8 effect_index, float value) const;
+ int32 CalculateSpellDamage(Unit const* target, SpellInfo const* spellProto, uint8 effect_index, int32 const* basePoints = NULL) const;
+ int32 CalcSpellDuration(SpellInfo const* spellProto);
+ int32 ModSpellDuration(SpellInfo const* spellProto, Unit const* target, int32 duration, bool positive);
+ void ModSpellCastTime(SpellInfo const* spellProto, int32 & castTime, Spell* spell=NULL);
+ float CalculateLevelPenalty(SpellInfo const* spellProto) const;
void addFollower(FollowerReference* pRef) { m_FollowingRefManager.insertFirst(pRef); }
void removeFollower(FollowerReference* /*pRef*/) { /* nothing to do yet */ }
@@ -2237,15 +2236,15 @@ class Unit : public WorldObject
bool isAlwaysDetectableFor(WorldObject const* seer) const;
private:
- bool IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura * aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const *& spellProcEvent);
- bool HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
- bool HandleHasteAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
- bool HandleSpellCritChanceAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
- bool HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
- bool HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
- bool HandleAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, bool * handled);
- bool HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
- bool HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 cooldown);
+ bool IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura * aura, SpellInfo const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const *& spellProcEvent);
+ bool HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
+ bool HandleHasteAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
+ bool HandleSpellCritChanceAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
+ bool HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
+ bool HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
+ bool HandleAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, bool * handled);
+ bool HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
+ bool HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const *procSpell, uint32 cooldown);
bool HandleAuraRaidProcFromChargeWithValue(AuraEffect* triggeredByAura);
bool HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura);
diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp
index fedebb45cb0..6d84d78f095 100755
--- a/src/server/game/Entities/Vehicle/Vehicle.cpp
+++ b/src/server/game/Entities/Vehicle/Vehicle.cpp
@@ -26,6 +26,8 @@
#include "ScriptMgr.h"
#include "CreatureAI.h"
#include "ZoneScript.h"
+#include "SpellMgr.h"
+#include "SpellInfo.h"
Vehicle::Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry) : _me(unit), _vehicleInfo(vehInfo), _usableSeatNum(0), _creatureEntry(creatureEntry)
{
@@ -73,11 +75,11 @@ void Vehicle::Install()
if (!creature->m_spells[i])
continue;
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(creature->m_spells[i]);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(creature->m_spells[i]);
if (!spellInfo)
continue;
- if (spellInfo->powerType == POWER_ENERGY)
+ if (spellInfo->PowerType == POWER_ENERGY)
{
_me->setPowerType(POWER_ENERGY);
_me->SetMaxPower(POWER_ENERGY, 100);
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 79df2b9fa73..2cff8f4d219 100755
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -587,7 +587,7 @@ void ObjectMgr::LoadCreatureTemplateAddons()
creatureAddon.auras.resize(tokens.size());
for (Tokens::iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
{
- SpellEntry const *AdditionalSpellInfo = sSpellStore.LookupEntry(uint32(atol(*itr)));
+ SpellInfo const *AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr)));
if (!AdditionalSpellInfo)
{
sLog->outErrorDb("Creature (GUID: %u) has wrong spell %u defined in `auras` field in `creature_addon`.", entry, uint32(atol(*itr)));
@@ -869,7 +869,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
for (uint8 j = 0; j < CREATURE_MAX_SPELLS; ++j)
{
- if (cInfo->spells[j] && !sSpellStore.LookupEntry(cInfo->spells[j]))
+ if (cInfo->spells[j] && !sSpellMgr->GetSpellInfo(cInfo->spells[j]))
{
sLog->outErrorDb("Creature (Entry: %u) has non-existing Spell%d (%u), set to 0.", cInfo->Entry, j+1, cInfo->spells[j]);
const_cast<CreatureTemplate*>(cInfo)->spells[j] = 0;
@@ -955,7 +955,7 @@ void ObjectMgr::LoadCreatureAddons()
creatureAddon.auras.resize(tokens.size());
for (Tokens::iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
{
- SpellEntry const *AdditionalSpellInfo = sSpellStore.LookupEntry(uint32(atol(*itr)));
+ SpellInfo const *AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr)));
if (!AdditionalSpellInfo)
{
sLog->outErrorDb("Creature (GUID: %u) has wrong spell %u defined in `auras` field in `creature_addon`.", guid, uint32(atol(*itr)));
@@ -2401,7 +2401,7 @@ void ObjectMgr::LoadItemTemplates()
}
}
- if (itemTemplate.RequiredSpell && !sSpellStore.LookupEntry(itemTemplate.RequiredSpell))
+ if (itemTemplate.RequiredSpell && !sSpellMgr->GetSpellInfo(itemTemplate.RequiredSpell))
{
sLog->outErrorDb("Item (Entry: %u) has a wrong (non-existing) spell in RequiredSpell (%u)", entry, itemTemplate.RequiredSpell);
itemTemplate.RequiredSpell = 0;
@@ -2509,7 +2509,7 @@ void ObjectMgr::LoadItemTemplates()
}
else if (itemTemplate.Spells[1].SpellId != -1)
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(itemTemplate.Spells[1].SpellId);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[1].SpellId);
if (!spellInfo && !sDisableMgr->IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[1].SpellId, NULL))
{
sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId);
@@ -2557,7 +2557,7 @@ void ObjectMgr::LoadItemTemplates()
if (itemTemplate.Spells[j].SpellId && itemTemplate.Spells[j].SpellId != -1)
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(itemTemplate.Spells[j].SpellId);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[j].SpellId);
if (!spellInfo && !sDisableMgr->IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[j].SpellId, NULL))
{
sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId);
@@ -4018,7 +4018,7 @@ void ObjectMgr::LoadQuests()
if (qinfo->SrcSpell)
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(qinfo->SrcSpell);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->SrcSpell);
if (!spellInfo)
{
sLog->outErrorDb("Quest %u has `SrcSpell` = %u but spell %u doesn't exist, quest can't be done.",
@@ -4090,7 +4090,7 @@ void ObjectMgr::LoadQuests()
uint32 id = qinfo->ReqSpell[j];
if (id)
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(id);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id);
if (!spellInfo)
{
sLog->outErrorDb("Quest %u has `ReqSpellCast%d` = %u but spell %u does not exist, quest can't be done.",
@@ -4103,8 +4103,8 @@ void ObjectMgr::LoadQuests()
bool found = false;
for (uint8 k = 0; k < MAX_SPELL_EFFECTS; ++k)
{
- if ((spellInfo->Effect[k] == SPELL_EFFECT_QUEST_COMPLETE && uint32(spellInfo->EffectMiscValue[k]) == qinfo->QuestId) ||
- spellInfo->Effect[k] == SPELL_EFFECT_SEND_EVENT)
+ if ((spellInfo->Effects[k].Effect == SPELL_EFFECT_QUEST_COMPLETE && uint32(spellInfo->Effects[k].MiscValue) == qinfo->QuestId) ||
+ spellInfo->Effects[k].Effect == SPELL_EFFECT_SEND_EVENT)
{
found = true;
break;
@@ -4248,7 +4248,7 @@ void ObjectMgr::LoadQuests()
if (qinfo->RewSpell)
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(qinfo->RewSpell);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->RewSpell);
if (!spellInfo)
{
@@ -4274,7 +4274,7 @@ void ObjectMgr::LoadQuests()
if (qinfo->RewSpellCast > 0)
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(qinfo->RewSpellCast);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->RewSpellCast);
if (!spellInfo)
{
@@ -4366,18 +4366,18 @@ void ObjectMgr::LoadQuests()
}
// check QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT for spell with SPELL_EFFECT_QUEST_COMPLETE
- for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i)
+ for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i)
{
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(i);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(i);
if (!spellInfo)
continue;
for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
- if (spellInfo->Effect[j] != SPELL_EFFECT_QUEST_COMPLETE)
+ if (spellInfo->Effects[j].Effect != SPELL_EFFECT_QUEST_COMPLETE)
continue;
- uint32 quest_id = spellInfo->EffectMiscValue[j];
+ uint32 quest_id = spellInfo->Effects[j].MiscValue;
Quest const* quest = GetQuestTemplate(quest_id);
@@ -4707,7 +4707,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
case SCRIPT_COMMAND_REMOVE_AURA:
{
- if (!sSpellStore.LookupEntry(tmp.RemoveAura.SpellID))
+ if (!sSpellMgr->GetSpellInfo(tmp.RemoveAura.SpellID))
{
sLog->outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u",
tableName.c_str(), tmp.RemoveAura.SpellID, tmp.id);
@@ -4724,7 +4724,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
case SCRIPT_COMMAND_CAST_SPELL:
{
- if (!sSpellStore.LookupEntry(tmp.CastSpell.SpellID))
+ if (!sSpellMgr->GetSpellInfo(tmp.CastSpell.SpellID))
{
sLog->outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
tableName.c_str(), tmp.CastSpell.SpellID, tmp.id);
@@ -4830,7 +4830,7 @@ void ObjectMgr::LoadSpellScripts()
for (ScriptMapMap::const_iterator itr = sSpellScripts.begin(); itr != sSpellScripts.end(); ++itr)
{
uint32 spellId = uint32(itr->first) & 0x00FFFFFF;
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
@@ -4840,7 +4840,7 @@ void ObjectMgr::LoadSpellScripts()
uint8 i = (uint8)((uint32(itr->first) >> 24) & 0x000000FF);
//check for correct spellEffect
- if (!spellInfo->Effect[i] || (spellInfo->Effect[i] != SPELL_EFFECT_SCRIPT_EFFECT && spellInfo->Effect[i] != SPELL_EFFECT_DUMMY))
+ if (!spellInfo->Effects[i].Effect || (spellInfo->Effects[i].Effect != SPELL_EFFECT_SCRIPT_EFFECT && spellInfo->Effects[i].Effect != SPELL_EFFECT_DUMMY))
sLog->outErrorDb("Table `spell_scripts` - spell %u effect %u is not SPELL_EFFECT_SCRIPT_EFFECT or SPELL_EFFECT_DUMMY", spellId, i);
}
}
@@ -4857,17 +4857,17 @@ void ObjectMgr::LoadEventScripts()
evt_scripts.insert(eventId);
// Load all possible script entries from spells
- for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i)
+ for (uint32 i = 1; i < sSpellMgr->GetSpellInfoStoreSize(); ++i)
{
- SpellEntry const* spell = sSpellStore.LookupEntry(i);
+ SpellInfo const* spell = sSpellMgr->GetSpellInfo(i);
if (spell)
{
for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
- if (spell->Effect[j] == SPELL_EFFECT_SEND_EVENT)
+ if (spell->Effects[j].Effect == SPELL_EFFECT_SEND_EVENT)
{
- if (spell->EffectMiscValue[j])
- evt_scripts.insert(spell->EffectMiscValue[j]);
+ if (spell->Effects[j].MiscValue)
+ evt_scripts.insert(spell->Effects[j].MiscValue);
}
}
}
@@ -4956,8 +4956,8 @@ void ObjectMgr::LoadSpellScriptNames()
spellId = -spellId;
}
- SpellEntry const* spellEntry = sSpellStore.LookupEntry(spellId);
- if (!spellEntry)
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
+ if (!spellInfo)
{
sLog->outErrorDb("Scriptname:`%s` spell (spell_id:%d) does not exist in `Spell.dbc`.", scriptName, fields[0].GetInt32());
continue;
@@ -4970,14 +4970,14 @@ void ObjectMgr::LoadSpellScriptNames()
sLog->outErrorDb("Scriptname:`%s` spell (spell_id:%d) is not first rank of spell.", scriptName, fields[0].GetInt32());
continue;
}
- while(spellId)
+ while(spellInfo)
{
- mSpellScripts.insert(SpellScriptsMap::value_type(spellId, GetScriptId(scriptName)));
- spellId = sSpellMgr->GetNextSpellInChain(spellId);
+ mSpellScripts.insert(SpellScriptsMap::value_type(spellInfo->Id, GetScriptId(scriptName)));
+ spellInfo = sSpellMgr->GetSpellInfo(spellInfo->Id)->GetNextRankSpell();
}
}
else
- mSpellScripts.insert(SpellScriptsMap::value_type(spellId, GetScriptId(scriptName)));
+ mSpellScripts.insert(SpellScriptsMap::value_type(spellInfo->Id, GetScriptId(scriptName)));
++count;
}
while (result->NextRow());
@@ -5001,7 +5001,7 @@ void ObjectMgr::ValidateSpellScripts()
for (SpellScriptsMap::iterator itr = mSpellScripts.begin(); itr != mSpellScripts.end();)
{
- SpellEntry const* spellEntry = sSpellStore.LookupEntry(itr->first);
+ SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(itr->first);
std::vector<std::pair<SpellScriptLoader *, SpellScriptsMap::iterator> > SpellScriptLoaders;
sScriptMgr->CreateSpellScriptLoaders(itr->first, SpellScriptLoaders);
itr = mSpellScripts.upper_bound(itr->first);
@@ -5237,7 +5237,7 @@ void ObjectMgr::LoadInstanceEncounters()
break;
}
case ENCOUNTER_CREDIT_CAST_SPELL:
- if (!sSpellStore.LookupEntry(creditEntry))
+ if (!sSpellMgr->GetSpellInfo(creditEntry))
{
sLog->outErrorDb("Table `instance_encounters` has an invalid spell (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]);
continue;
@@ -6430,7 +6430,7 @@ inline void CheckGOLinkedTrapId(GameObjectTemplate const* goInfo, uint32 dataN,
inline void CheckGOSpellId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N)
{
- if (sSpellStore.LookupEntry(dataN))
+ if (sSpellMgr->GetSpellInfo(dataN))
return;
sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but Spell (Entry %u) not exist.",
@@ -7208,7 +7208,7 @@ void ObjectMgr::LoadNPCSpellClickSpells()
}
uint32 spellid = fields[1].GetUInt32();
- SpellEntry const *spellinfo = sSpellStore.LookupEntry(spellid);
+ SpellInfo const *spellinfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellinfo)
{
sLog->outErrorDb("Table npc_spellclick_spells references unknown spellid %u. Skipping entry.", spellid);
@@ -7218,7 +7218,7 @@ void ObjectMgr::LoadNPCSpellClickSpells()
uint32 auraRequired = fields[6].GetUInt32();
if (auraRequired)
{
- SpellEntry const *aurReqInfo = sSpellStore.LookupEntry(auraRequired);
+ SpellInfo const *aurReqInfo = sSpellMgr->GetSpellInfo(auraRequired);
if (!aurReqInfo)
{
sLog->outErrorDb("Table npc_spellclick_spells references unknown aura required %u. Skipping entry.", auraRequired);
@@ -7229,7 +7229,7 @@ void ObjectMgr::LoadNPCSpellClickSpells()
uint32 auraForbidden = fields[7].GetUInt32();
if (auraForbidden)
{
- SpellEntry const *aurForInfo = sSpellStore.LookupEntry(auraForbidden);
+ SpellInfo const *aurForInfo = sSpellMgr->GetSpellInfo(auraForbidden);
if (!aurForInfo)
{
sLog->outErrorDb("Table npc_spellclick_spells references unknown aura forbidden %u. Skipping entry.", auraForbidden);
@@ -8219,7 +8219,7 @@ void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost,
return;
}
- SpellEntry const *spellinfo = sSpellStore.LookupEntry(spell);
+ SpellInfo const *spellinfo = sSpellMgr->GetSpellInfo(spell);
if (!spellinfo)
{
sLog->outErrorDb("Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u), ignoring", entry, spell);
@@ -8248,28 +8248,32 @@ void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost,
trainerSpell.reqLevel = reqLevel;
if (!trainerSpell.reqLevel)
- trainerSpell.reqLevel = spellinfo->spellLevel;
+ trainerSpell.reqLevel = spellinfo->SpellLevel;
// calculate learned spell for profession case when stored cast-spell
trainerSpell.learnedSpell[0] = spell;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- if (spellinfo->Effect[i] != SPELL_EFFECT_LEARN_SPELL)
+ if (spellinfo->Effects[i].Effect != SPELL_EFFECT_LEARN_SPELL)
continue;
if (trainerSpell.learnedSpell[0] == spell)
trainerSpell.learnedSpell[0] = 0;
// player must be able to cast spell on himself
- if (spellinfo->EffectImplicitTargetA[i] != 0 && spellinfo->EffectImplicitTargetA[i] != TARGET_UNIT_TARGET_ALLY
- && spellinfo->EffectImplicitTargetA[i] != TARGET_UNIT_TARGET_ANY && spellinfo->EffectImplicitTargetA[i] != TARGET_UNIT_CASTER)
+ if (spellinfo->Effects[i].TargetA != 0 && spellinfo->Effects[i].TargetA != TARGET_UNIT_TARGET_ALLY
+ && spellinfo->Effects[i].TargetA != TARGET_UNIT_TARGET_ANY && spellinfo->Effects[i].TargetA != TARGET_UNIT_CASTER)
{
sLog->outErrorDb("Table `npc_trainer` has spell %u for trainer entry %u with learn effect which has incorrect target type, ignoring learn effect!", spell, entry);
continue;
}
- trainerSpell.learnedSpell[i] = spellinfo->EffectTriggerSpell[i];
+ trainerSpell.learnedSpell[i] = spellinfo->Effects[i].TriggerSpell;
- if (trainerSpell.learnedSpell[i] && SpellMgr::IsProfessionSpell(trainerSpell.learnedSpell[i]))
- data.trainerType = 2;
+ if (trainerSpell.learnedSpell[i])
+ {
+ SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(trainerSpell.learnedSpell[i]);
+ if (learnedSpellInfo && learnedSpellInfo->IsProfession())
+ data.trainerType = 2;
+ }
}
return;
@@ -8925,9 +8929,9 @@ void ObjectMgr::LoadFactionChangeSpells()
uint32 alliance = fields[0].GetUInt32();
uint32 horde = fields[1].GetUInt32();
- if (!sSpellStore.LookupEntry(alliance))
+ if (!sSpellMgr->GetSpellInfo(alliance))
sLog->outErrorDb("Spell %u referenced in `player_factionchange_spells` does not exist, pair skipped!", alliance);
- else if (!sSpellStore.LookupEntry(horde))
+ else if (!sSpellMgr->GetSpellInfo(horde))
sLog->outErrorDb("Spell %u referenced in `player_factionchange_spells` does not exist, pair skipped!", horde);
else
factionchange_spells[alliance] = horde;
diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp
index a5c41b3049d..b613f794388 100755
--- a/src/server/game/Loot/LootMgr.cpp
+++ b/src/server/game/Loot/LootMgr.cpp
@@ -23,6 +23,7 @@
#include "Util.h"
#include "SharedDefines.h"
#include "SpellMgr.h"
+#include "SpellInfo.h"
#include "Group.h"
static Rates const qualityToRate[MAX_ITEM_QUALITY] = {
@@ -1743,14 +1744,14 @@ void LoadLootTemplates_Spell()
uint32 count = LootTemplates_Spell.LoadAndCollectLootIds(ids_set);
// remove real entries and check existence loot
- for (uint32 spell_id = 1; spell_id < sSpellStore.GetNumRows(); ++spell_id)
+ for (uint32 spell_id = 1; spell_id < sSpellMgr->GetSpellInfoStoreSize(); ++spell_id)
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry (spell_id);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id);
if (!spellInfo)
continue;
// possible cases
- if (!IsLootCraftingSpell(spellInfo))
+ if (!spellInfo->IsLootCrafting())
continue;
if (ids_set.find(spell_id) == ids_set.end())
diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h
index d0ac891b9d9..4b7825488b9 100755
--- a/src/server/game/Miscellaneous/SharedDefines.h
+++ b/src/server/game/Miscellaneous/SharedDefines.h
@@ -1162,7 +1162,7 @@ enum GhostVisibilityType
};
// Spell aura states
-enum AuraState
+enum AuraStateType
{ // (C) used in caster aura state (T) used in target aura state
// (c) used in caster aura state-not (t) used in target aura state-not
AURA_STATE_NONE = 0, // C |
@@ -2806,7 +2806,7 @@ enum DiminishingGroup
DIMINISHING_SILENCE = 16,
DIMINISHING_SLEEP = 17,
DIMINISHING_TAUNT = 18,
- DIMINISHING_LIMITONLY = 19 // No diminishing return, but duration limited to 10 seconds
+ DIMINISHING_LIMITONLY = 19
};
enum SummonCategory
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
index a728478d811..b7ecb909653 100755
--- a/src/server/game/Scripting/ScriptMgr.cpp
+++ b/src/server/game/Scripting/ScriptMgr.cpp
@@ -210,16 +210,16 @@ struct TSpellSummary
void ScriptMgr::FillSpellSummary()
{
- SpellSummary = new TSpellSummary[GetSpellStore()->GetNumRows()];
+ SpellSummary = new TSpellSummary[sSpellMgr->GetSpellInfoStoreSize()];
- SpellEntry const* pTempSpell;
+ SpellInfo const* pTempSpell;
- for (uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i)
+ for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i)
{
SpellSummary[i].Effects = 0;
SpellSummary[i].Targets = 0;
- pTempSpell = GetSpellStore()->LookupEntry(i);
+ pTempSpell = sSpellMgr->GetSpellInfo(i);
//This spell doesn't exist
if (!pTempSpell)
continue;
@@ -227,67 +227,67 @@ void ScriptMgr::FillSpellSummary()
for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
//Spell targets self
- if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER)
+ if (pTempSpell->Effects[j].TargetA == TARGET_UNIT_CASTER)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SELF-1);
//Spell targets a single enemy
- if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ENEMY ||
- pTempSpell->EffectImplicitTargetA[j] == TARGET_DST_TARGET_ENEMY)
+ if (pTempSpell->Effects[j].TargetA == TARGET_UNIT_TARGET_ENEMY ||
+ pTempSpell->Effects[j].TargetA == TARGET_DST_TARGET_ENEMY)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SINGLE_ENEMY-1);
//Spell targets AoE at enemy
- if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_SRC ||
- pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_DST ||
- pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER ||
- pTempSpell->EffectImplicitTargetA[j] == TARGET_DEST_DYNOBJ_ENEMY)
+ if (pTempSpell->Effects[j].TargetA == TARGET_UNIT_AREA_ENEMY_SRC ||
+ pTempSpell->Effects[j].TargetA == TARGET_UNIT_AREA_ENEMY_DST ||
+ pTempSpell->Effects[j].TargetA == TARGET_SRC_CASTER ||
+ pTempSpell->Effects[j].TargetA == TARGET_DEST_DYNOBJ_ENEMY)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_AOE_ENEMY-1);
//Spell targets an enemy
- if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ENEMY ||
- pTempSpell->EffectImplicitTargetA[j] == TARGET_DST_TARGET_ENEMY ||
- pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_SRC ||
- pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_DST ||
- pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER ||
- pTempSpell->EffectImplicitTargetA[j] == TARGET_DEST_DYNOBJ_ENEMY)
+ if (pTempSpell->Effects[j].TargetA == TARGET_UNIT_TARGET_ENEMY ||
+ pTempSpell->Effects[j].TargetA == TARGET_DST_TARGET_ENEMY ||
+ pTempSpell->Effects[j].TargetA == TARGET_UNIT_AREA_ENEMY_SRC ||
+ pTempSpell->Effects[j].TargetA == TARGET_UNIT_AREA_ENEMY_DST ||
+ pTempSpell->Effects[j].TargetA == TARGET_SRC_CASTER ||
+ pTempSpell->Effects[j].TargetA == TARGET_DEST_DYNOBJ_ENEMY)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_ANY_ENEMY-1);
//Spell targets a single friend(or self)
- if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER ||
- pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ALLY ||
- pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_PARTY)
+ if (pTempSpell->Effects[j].TargetA == TARGET_UNIT_CASTER ||
+ pTempSpell->Effects[j].TargetA == TARGET_UNIT_TARGET_ALLY ||
+ pTempSpell->Effects[j].TargetA == TARGET_UNIT_TARGET_PARTY)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SINGLE_FRIEND-1);
//Spell targets aoe friends
- if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_PARTY_CASTER ||
- pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ALLY_PARTY ||
- pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER)
+ if (pTempSpell->Effects[j].TargetA == TARGET_UNIT_PARTY_CASTER ||
+ pTempSpell->Effects[j].TargetA == TARGET_UNIT_TARGET_ALLY_PARTY ||
+ pTempSpell->Effects[j].TargetA == TARGET_SRC_CASTER)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_AOE_FRIEND-1);
//Spell targets any friend(or self)
- if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER ||
- pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ALLY ||
- pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_PARTY ||
- pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_PARTY_CASTER ||
- pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ALLY_PARTY ||
- pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER)
+ if (pTempSpell->Effects[j].TargetA == TARGET_UNIT_CASTER ||
+ pTempSpell->Effects[j].TargetA == TARGET_UNIT_TARGET_ALLY ||
+ pTempSpell->Effects[j].TargetA == TARGET_UNIT_TARGET_PARTY ||
+ pTempSpell->Effects[j].TargetA == TARGET_UNIT_PARTY_CASTER ||
+ pTempSpell->Effects[j].TargetA == TARGET_UNIT_TARGET_ALLY_PARTY ||
+ pTempSpell->Effects[j].TargetA == TARGET_SRC_CASTER)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_ANY_FRIEND-1);
//Make sure that this spell includes a damage effect
- if (pTempSpell->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE ||
- pTempSpell->Effect[j] == SPELL_EFFECT_INSTAKILL ||
- pTempSpell->Effect[j] == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE ||
- pTempSpell->Effect[j] == SPELL_EFFECT_HEALTH_LEECH)
+ 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)
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->Effect[j] == SPELL_EFFECT_HEAL ||
- pTempSpell->Effect[j] == SPELL_EFFECT_HEAL_MAX_HEALTH ||
- pTempSpell->Effect[j] == SPELL_EFFECT_HEAL_MECHANICAL ||
- (pTempSpell->Effect[j] == SPELL_EFFECT_APPLY_AURA && pTempSpell->EffectApplyAuraName[j] == 8))
+ 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))
SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_HEALING-1);
//Make sure that this spell applies an aura
- if (pTempSpell->Effect[j] == SPELL_EFFECT_APPLY_AURA)
+ if (pTempSpell->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA)
SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_AURA-1);
}
}
diff --git a/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp b/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp
index 84f54786256..2bcfd9aa0d2 100755
--- a/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp
@@ -26,6 +26,7 @@
#include "Item.h"
#include "UpdateData.h"
#include "ObjectAccessor.h"
+#include "SpellInfo.h"
void WorldSession::HandleSplitItemOpcode(WorldPacket & recv_data)
{
@@ -363,7 +364,7 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket & recv_data)
{
// send DBC data for cooldowns in same way as it used in Spell::SendSpellCooldown
// use `item_template` or if not set then only use spell cooldowns
- SpellEntry const* spell = sSpellStore.LookupEntry(pProto->Spells[s].SpellId);
+ SpellInfo const* spell = sSpellMgr->GetSpellInfo(pProto->Spells[s].SpellId);
if (spell)
{
bool db_data = pProto->Spells[s].SpellCooldown >= 0 || pProto->Spells[s].SpellCategoryCooldown >= 0;
diff --git a/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp b/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp
index 3332632d25e..1bb361fb97e 100755
--- a/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp
@@ -35,6 +35,7 @@
#include "Battleground.h"
#include "ScriptMgr.h"
#include "CreatureAI.h"
+#include "SpellInfo.h"
enum StableResultCode
{
@@ -177,7 +178,8 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
valid = false;
break;
}
- if (sSpellMgr->IsPrimaryProfessionFirstRankSpell(tSpell->learnedSpell[i]))
+ SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(tSpell->learnedSpell[i]);
+ if (learnedSpellInfo && learnedSpellInfo->IsPrimaryProfessionFirstRank())
primary_prof_first_rank = true;
}
if (!valid)
@@ -201,13 +203,10 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
{
if (!tSpell->learnedSpell[i])
continue;
- if (SpellChainNode const* chain_node = sSpellMgr->GetSpellChainNode(tSpell->learnedSpell[i]))
+ if (uint32 prevSpellId = sSpellMgr->GetPrevSpellInChain(tSpell->learnedSpell[i]))
{
- if (chain_node->prev)
- {
- data << uint32(chain_node->prev);
- ++maxReq;
- }
+ data << uint32(prevSpellId);
+ ++maxReq;
}
if (maxReq == 3)
break;
diff --git a/src/server/game/Server/Protocol/Handlers/PetHandler.cpp b/src/server/game/Server/Protocol/Handlers/PetHandler.cpp
index 8a40d8345fa..a00aaf312ce 100755
--- a/src/server/game/Server/Protocol/Handlers/PetHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/PetHandler.cpp
@@ -30,6 +30,7 @@
#include "Pet.h"
#include "World.h"
#include "Group.h"
+#include "SpellInfo.h"
void WorldSession::HandleDismissCritter(WorldPacket &recv_data)
{
@@ -84,7 +85,7 @@ void WorldSession::HandlePetAction(WorldPacket & recv_data)
if (!pet->isAlive())
{
- SpellEntry const* spell = (flag == ACT_ENABLED || flag == ACT_PASSIVE) ? sSpellStore.LookupEntry(spellid) : NULL;
+ SpellInfo const* spell = (flag == ACT_ENABLED || flag == ACT_PASSIVE) ? sSpellMgr->GetSpellInfo(spellid) : NULL;
if (!spell)
return;
if (!(spell->Attributes & SPELL_ATTR0_CASTABLE_WHILE_DEAD))
@@ -288,7 +289,7 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
unit_target = ObjectAccessor::GetUnit(*_player, guid2);
// do not cast unknown spells
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellInfo)
{
sLog->outError("WORLD: unknown PET spell id %i", spellid);
@@ -301,12 +302,12 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- if (spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_AREA_ENEMY_SRC || spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_AREA_ENEMY_DST || spellInfo->EffectImplicitTargetA[i] == TARGET_DEST_DYNOBJ_ENEMY)
+ if (spellInfo->Effects[i].TargetA == TARGET_UNIT_AREA_ENEMY_SRC || spellInfo->Effects[i].TargetA == TARGET_UNIT_AREA_ENEMY_DST || spellInfo->Effects[i].TargetA == TARGET_DEST_DYNOBJ_ENEMY)
return;
}
// do not cast not learned spells
- if (!pet->HasSpell(spellid) || IsPassiveSpell(spellid))
+ if (!pet->HasSpell(spellid) || spellInfo->IsPassive())
return;
// Clear the flags as if owner clicked 'attack'. AI will reset them
@@ -554,26 +555,29 @@ void WorldSession::HandlePetSetAction(WorldPacket & recv_data)
//if it's act for spell (en/disable/cast) and there is a spell given (0 = remove spell) which pet doesn't know, don't add
if (!((act_state == ACT_ENABLED || act_state == ACT_DISABLED || act_state == ACT_PASSIVE) && spell_id && !pet->HasSpell(spell_id)))
{
- //sign for autocast
- if (act_state == ACT_ENABLED && spell_id)
+ if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id))
{
- if (pet->GetTypeId() == TYPEID_UNIT && pet->ToCreature()->isPet())
- ((Pet*)pet)->ToggleAutocast(spell_id, true);
- else
- for (Unit::ControlList::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr)
- if ((*itr)->GetEntry() == pet->GetEntry())
- (*itr)->GetCharmInfo()->ToggleCreatureAutocast(spell_id, true);
- }
- //sign for no/turn off autocast
- else if (act_state == ACT_DISABLED && spell_id)
- {
- if (pet->GetTypeId() == TYPEID_UNIT && pet->ToCreature()->isPet())
- ((Pet*)pet)->ToggleAutocast(spell_id, false);
- else
- for (Unit::ControlList::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr)
- if ((*itr)->GetEntry() == pet->GetEntry())
- (*itr)->GetCharmInfo()->ToggleCreatureAutocast(spell_id, false);
+ //sign for autocast
+ if (act_state == ACT_ENABLED)
+ {
+ if (pet->GetTypeId() == TYPEID_UNIT && pet->ToCreature()->isPet())
+ ((Pet*)pet)->ToggleAutocast(spellInfo, true);
+ else
+ for (Unit::ControlList::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr)
+ if ((*itr)->GetEntry() == pet->GetEntry())
+ (*itr)->GetCharmInfo()->ToggleCreatureAutocast(spellInfo, true);
+ }
+ //sign for no/turn off autocast
+ else if (act_state == ACT_DISABLED)
+ {
+ if (pet->GetTypeId() == TYPEID_UNIT && pet->ToCreature()->isPet())
+ ((Pet*)pet)->ToggleAutocast(spellInfo, false);
+ else
+ for (Unit::ControlList::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr)
+ if ((*itr)->GetEntry() == pet->GetEntry())
+ (*itr)->GetCharmInfo()->ToggleCreatureAutocast(spellInfo, false);
+ }
}
charmInfo->SetActionBar(position[i], spell_id, ActiveStates(act_state));
@@ -706,8 +710,9 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
return;
}
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
// do not add not learned spells/ passive spells
- if (!pet->HasSpell(spellid) || IsAutocastableSpell(spellid))
+ if (!pet->HasSpell(spellid) || spellInfo->IsAutocastable())
return;
CharmInfo *charmInfo = pet->GetCharmInfo();
@@ -718,11 +723,11 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
}
if (pet->isPet())
- ((Pet*)pet)->ToggleAutocast(spellid, state);
+ ((Pet*)pet)->ToggleAutocast(spellInfo, state);
else
- pet->GetCharmInfo()->ToggleCreatureAutocast(spellid, state);
+ pet->GetCharmInfo()->ToggleCreatureAutocast(spellInfo, state);
- charmInfo->SetSpellAutocast(spellid, state);
+ charmInfo->SetSpellAutocast(spellInfo, state);
}
void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
@@ -750,7 +755,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
return;
}
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
sLog->outError("WORLD: unknown PET spell id %i", spellId);
@@ -765,7 +770,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
}
// do not cast not learned spells
- if (!caster->HasSpell(spellId) || IsPassiveSpell(spellId))
+ if (!caster->HasSpell(spellId) || spellInfo->IsPassive())
return;
SpellCastTargets targets;
diff --git a/src/server/game/Server/Protocol/Handlers/SpellHandler.cpp b/src/server/game/Server/Protocol/Handlers/SpellHandler.cpp
index 6193b0c6213..0f309ea5fc2 100755
--- a/src/server/game/Server/Protocol/Handlers/SpellHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/SpellHandler.cpp
@@ -139,9 +139,9 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
{
for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
{
- if (SpellEntry const *spellInfo = sSpellStore.LookupEntry(proto->Spells[i].SpellId))
+ if (SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(proto->Spells[i].SpellId))
{
- if (IsNonCombatSpell(spellInfo))
+ if (spellInfo->CanBeUsedInCombat())
{
pUser->SendEquipError(EQUIP_ERR_NOT_IN_COMBAT, pItem, NULL);
return;
@@ -170,7 +170,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
pUser->SendEquipError(EQUIP_ERR_NONE, pItem, NULL);
// send spell error
- if (SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId))
+ if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId))
{
// for implicit area/coord target spells
if (!targets.GetUnitTarget())
@@ -341,7 +341,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
return;
}
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
@@ -353,7 +353,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
if (mover->GetTypeId() == TYPEID_PLAYER)
{
// not have spell in spellbook or spell passive and not casted by client
- if (!mover->ToPlayer()->HasActiveSpell (spellId) || IsPassiveSpell(spellId))
+ if (!mover->ToPlayer()->HasActiveSpell (spellId) || spellInfo->IsPassive())
{
//cheater? kick? ban?
recvPacket.rfinish(); // prevent spam at ignore packet
@@ -363,7 +363,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
else
{
// not have spell in spellbook or spell passive and not casted by client
- if ((mover->GetTypeId() == TYPEID_UNIT && !mover->ToCreature()->HasSpell(spellId)) || IsPassiveSpell(spellId))
+ if ((mover->GetTypeId() == TYPEID_UNIT && !mover->ToCreature()->HasSpell(spellId)) || spellInfo->IsPassive())
{
//cheater? kick? ban?
recvPacket.rfinish(); // prevent spam at ignore packet
@@ -373,7 +373,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
// Client is resending autoshot cast opcode when other spell is casted during shoot rotation
// Skip it to prevent "interrupt" message
- if (IsAutoRepeatRangedSpell(spellInfo) && _player->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)
+ if (spellInfo->IsAutoRepeatRangedSpell() && _player->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)
&& _player->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)->m_spellInfo == spellInfo)
{
recvPacket.rfinish();
@@ -395,7 +395,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
// auto-selection buff level base at target level (in spellInfo)
if (targets.GetUnitTarget())
{
- SpellEntry const *actualSpellInfo = sSpellMgr->SelectAuraRankForPlayerLevel(spellInfo, targets.GetUnitTarget()->getLevel());
+ SpellInfo const *actualSpellInfo = spellInfo->GetAuraRankForLevel(targets.GetUnitTarget()->getLevel());
// if rank not found then function return NULL but in explicit cast case original spell can be casted and later failed with appropriate error message
if (actualSpellInfo)
@@ -423,20 +423,20 @@ void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket)
uint32 spellId;
recvPacket >> spellId;
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
return;
// not allow remove non positive spells and spells with attr SPELL_ATTR0_CANT_CANCEL
- if (!IsPositiveSpell(spellId) || (spellInfo->Attributes & SPELL_ATTR0_CANT_CANCEL))
+ if (!spellInfo->IsPositive() || (spellInfo->Attributes & SPELL_ATTR0_CANT_CANCEL))
return;
// don't allow cancelling passive auras (some of them are visible)
- if (IsPassiveSpell(spellInfo))
+ if (spellInfo->IsPassive())
return;
// channeled spell case (it currently casted then)
- if (IsChanneledSpell(spellInfo))
+ if (spellInfo->IsChanneled())
{
if (Spell* curSpell = _player->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
if (curSpell->m_spellInfo->Id == spellId)
@@ -457,7 +457,7 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket)
recvPacket >> guid;
recvPacket >> spellId;
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
sLog->outError("WORLD: unknown PET spell id %u", spellId);
@@ -541,7 +541,7 @@ void WorldSession::HandleSelfResOpcode(WorldPacket & /*recv_data*/)
if (_player->GetUInt32Value(PLAYER_SELF_RES_SPELL))
{
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(_player->GetUInt32Value(PLAYER_SELF_RES_SPELL));
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(_player->GetUInt32Value(PLAYER_SELF_RES_SPELL));
if (spellInfo)
_player->CastSpell(_player, spellInfo, false, 0);
diff --git a/src/server/game/Server/Protocol/Handlers/TradeHandler.cpp b/src/server/game/Server/Protocol/Handlers/TradeHandler.cpp
index 6eb2dbd7084..d059e15d63b 100755
--- a/src/server/game/Server/Protocol/Handlers/TradeHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/TradeHandler.cpp
@@ -338,7 +338,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
// not accept if spell can't be casted now (cheating)
if (uint32 my_spell_id = my_trade->GetSpell())
{
- SpellEntry const* spellEntry = sSpellStore.LookupEntry(my_spell_id);
+ SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(my_spell_id);
Item* castItem = my_trade->GetSpellCastItem();
if (!spellEntry || !his_trade->GetItem(TRADE_SLOT_NONTRADED) ||
@@ -373,7 +373,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
// not accept if spell can't be casted now (cheating)
if (uint32 his_spell_id = his_trade->GetSpell())
{
- SpellEntry const* spellEntry = sSpellStore.LookupEntry(his_spell_id);
+ SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(his_spell_id);
Item* castItem = his_trade->GetSpellCastItem();
if (!spellEntry || !my_trade->GetItem(TRADE_SLOT_NONTRADED) || (his_trade->HasSpellCastItem() && !castItem))
diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp
index bdd635eb192..884d0710037 100755
--- a/src/server/game/Skills/SkillDiscovery.cpp
+++ b/src/server/game/Skills/SkillDiscovery.cpp
@@ -23,6 +23,7 @@
#include "SkillDiscovery.h"
#include "SpellMgr.h"
#include "Player.h"
+#include "SpellInfo.h"
#include <map>
struct SkillDiscoveryEntry
@@ -83,8 +84,8 @@ void LoadSkillDiscoveryTable()
if (reqSkillOrSpell > 0) // spell case
{
uint32 absReqSkillOrSpell = uint32(reqSkillOrSpell);
- SpellEntry const* reqSpellEntry = sSpellStore.LookupEntry(absReqSkillOrSpell);
- if (!reqSpellEntry)
+ SpellInfo const* reqSpellInfo = sSpellMgr->GetSpellInfo(absReqSkillOrSpell);
+ if (!reqSpellInfo)
{
if (reportedReqSpells.find(absReqSkillOrSpell) == reportedReqSpells.end())
{
@@ -95,9 +96,9 @@ void LoadSkillDiscoveryTable()
}
// mechanic discovery
- if (reqSpellEntry->Mechanic != MECHANIC_DISCOVERY &&
+ if (reqSpellInfo->Mechanic != MECHANIC_DISCOVERY &&
// explicit discovery ability
- !IsExplicitDiscoverySpell(reqSpellEntry))
+ !reqSpellInfo->IsExplicitDiscovery())
{
if (reportedReqSpells.find(absReqSkillOrSpell) == reportedReqSpells.end())
{
@@ -137,14 +138,14 @@ void LoadSkillDiscoveryTable()
sLog->outErrorDb("Some items can't be successfully discovered: have in chance field value < 0.000001 in `skill_discovery_template` DB table . List:\n%s", ssNonDiscoverableEntries.str().c_str());
// report about empty data for explicit discovery spells
- for (uint32 spell_id = 1; spell_id < sSpellStore.GetNumRows(); ++spell_id)
+ for (uint32 spell_id = 1; spell_id < sSpellMgr->GetSpellInfoStoreSize(); ++spell_id)
{
- SpellEntry const* spellEntry = sSpellStore.LookupEntry(spell_id);
+ SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(spell_id);
if (!spellEntry)
continue;
// skip not explicit discovery spells
- if (!IsExplicitDiscoverySpell(spellEntry))
+ if (!spellEntry->IsExplicitDiscovery())
continue;
if (SkillDiscoveryStore.find(int32(spell_id)) == SkillDiscoveryStore.end())
diff --git a/src/server/game/Skills/SkillExtraItems.cpp b/src/server/game/Skills/SkillExtraItems.cpp
index 64b5187c2ee..207fae93fe6 100755
--- a/src/server/game/Skills/SkillExtraItems.cpp
+++ b/src/server/game/Skills/SkillExtraItems.cpp
@@ -73,14 +73,14 @@ void LoadSkillExtraItemTable()
uint32 spellId = fields[0].GetUInt32();
- if (!sSpellStore.LookupEntry(spellId))
+ if (!sSpellMgr->GetSpellInfo(spellId))
{
sLog->outError("Skill specialization %u has non-existent spell id in `skill_extra_item_template`!", spellId);
continue;
}
uint32 requiredSpecialization = fields[1].GetUInt32();
- if (!sSpellStore.LookupEntry(requiredSpecialization))
+ if (!sSpellMgr->GetSpellInfo(requiredSpecialization))
{
sLog->outError("Skill specialization %u have not existed required specialization spell id %u in `skill_extra_item_template`!", spellId, requiredSpecialization);
continue;
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index d3676df2679..76fd348018e 100755
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -372,8 +372,8 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
};
AuraEffect::AuraEffect(Aura * base, uint8 effIndex, int32 *baseAmount, Unit* caster):
-m_base(base), m_spellProto(base->GetSpellProto()), m_effIndex(effIndex),
-m_baseAmount(baseAmount ? *baseAmount : m_spellProto->EffectBasePoints[m_effIndex]),
+m_base(base), m_spellInfo(base->GetSpellInfo()), m_effIndex(effIndex),
+m_baseAmount(baseAmount ? *baseAmount : m_spellInfo->Effects[m_effIndex].BasePoints),
m_canBeRecalculated(true), m_spellmod(NULL), m_isPeriodic(false),
m_periodicTimer(0), m_tickNumber(0)
{
@@ -414,7 +414,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
{
int32 amount;
// default amount calculation
- amount = SpellMgr::CalculateSpellEffectAmount(m_spellProto, m_effIndex, caster, &m_baseAmount, NULL);
+ amount = m_spellInfo->Effects[m_effIndex].CalcValue(caster, &m_baseAmount, NULL);
// check item enchant aura cast
if (!amount && caster)
@@ -432,7 +432,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
if (pEnchant)
{
for (int t = 0; t < MAX_ITEM_ENCHANTMENT_EFFECTS; t++)
- if (pEnchant->spellid[t] == m_spellProto->Id)
+ if (pEnchant->spellid[t] == m_spellInfo->Id)
{
amount = uint32((item_rand_suffix->prefix[k]*castItem->GetItemSuffixFactor()) / 10000);
break;
@@ -457,7 +457,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
case SPELL_AURA_MOD_ROOT:
case SPELL_AURA_TRANSFORM:
m_canBeRecalculated = false;
- if (!m_spellProto->procFlags)
+ if (!m_spellInfo->ProcFlags)
break;
amount = int32(GetBase()->GetUnitOwner()->CountPctFromMaxHealth(10));
if (caster)
@@ -466,7 +466,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
Unit::AuraEffectList const& overrideClassScripts = caster->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
for (Unit::AuraEffectList::const_iterator itr = overrideClassScripts.begin(); itr != overrideClassScripts.end(); ++itr)
{
- if ((*itr)->IsAffectedOnSpell(m_spellProto))
+ if ((*itr)->IsAffectedOnSpell(m_spellInfo))
{
// Glyph of Fear, Glyph of Frost nova and similar auras
if ((*itr)->GetMiscValue() == 7801)
@@ -482,42 +482,42 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
m_canBeRecalculated = false;
if (!caster)
break;
- switch(GetSpellProto()->SpellFamilyName)
+ switch(GetSpellInfo()->SpellFamilyName)
{
case SPELLFAMILY_MAGE:
// Ice Barrier
- if (GetSpellProto()->SpellFamilyFlags[1] & 0x1 && GetSpellProto()->SpellFamilyFlags[2] & 0x8)
+ if (GetSpellInfo()->SpellFamilyFlags[1] & 0x1 && GetSpellInfo()->SpellFamilyFlags[2] & 0x8)
{
// +80.68% from sp bonus
- DoneActualBenefit += caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) * 0.8068f;
+ DoneActualBenefit += caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask()) * 0.8068f;
// Glyph of Ice Barrier: its weird having a SPELLMOD_ALL_EFFECTS here but its blizzards doing :)
// Glyph of Ice Barrier is only applied at the spell damage bonus because it was already applied to the base value in CalculateSpellDamage
- DoneActualBenefit = caster->ApplyEffectModifiers(GetSpellProto(), m_effIndex, DoneActualBenefit);
+ DoneActualBenefit = caster->ApplyEffectModifiers(GetSpellInfo(), m_effIndex, DoneActualBenefit);
}
// Fire Ward
- else if (GetSpellProto()->SpellFamilyFlags[0] & 0x8 && GetSpellProto()->SpellFamilyFlags[2] & 0x8)
+ else if (GetSpellInfo()->SpellFamilyFlags[0] & 0x8 && GetSpellInfo()->SpellFamilyFlags[2] & 0x8)
{
// +80.68% from sp bonus
- DoneActualBenefit += caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) * 0.8068f;
+ DoneActualBenefit += caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask()) * 0.8068f;
}
// Frost Ward
- else if (GetSpellProto()->SpellFamilyFlags[0] & 0x100 && GetSpellProto()->SpellFamilyFlags[2] & 0x8)
+ else if (GetSpellInfo()->SpellFamilyFlags[0] & 0x100 && GetSpellInfo()->SpellFamilyFlags[2] & 0x8)
{
// +80.68% from sp bonus
- DoneActualBenefit += caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) * 0.8068f;
+ DoneActualBenefit += caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask()) * 0.8068f;
}
break;
case SPELLFAMILY_WARLOCK:
// Shadow Ward
- if (m_spellProto->SpellFamilyFlags[2] & 0x40)
+ if (m_spellInfo->SpellFamilyFlags[2] & 0x40)
{
// +80.68% from sp bonus
- DoneActualBenefit += caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) * 0.8068f;
+ DoneActualBenefit += caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask()) * 0.8068f;
}
break;
case SPELLFAMILY_PRIEST:
// Power Word: Shield
- if (GetSpellProto()->SpellFamilyFlags[0] & 0x1 && GetSpellProto()->SpellFamilyFlags[2] & 0x400)
+ if (GetSpellInfo()->SpellFamilyFlags[0] & 0x1 && GetSpellInfo()->SpellFamilyFlags[2] & 0x400)
{
// +80.68% from sp bonus
float bonus = 0.8068f;
@@ -526,11 +526,11 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
if (AuraEffect const* pAurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 2899, 1))
bonus += CalculatePctN(1.0f, pAurEff->GetAmount());
- DoneActualBenefit += caster->SpellBaseHealingBonus(GetSpellSchoolMask(m_spellProto)) * bonus;
+ DoneActualBenefit += caster->SpellBaseHealingBonus(m_spellInfo->GetSchoolMask()) * bonus;
// Improved PW: Shield: its weird having a SPELLMOD_ALL_EFFECTS here but its blizzards doing :)
// Improved PW: Shield is only applied at the spell healing bonus because it was already applied to the base value in CalculateSpellDamage
- DoneActualBenefit = caster->ApplyEffectModifiers(GetSpellProto(), m_effIndex, DoneActualBenefit);
- DoneActualBenefit *= caster->CalculateLevelPenalty(GetSpellProto());
+ DoneActualBenefit = caster->ApplyEffectModifiers(GetSpellInfo(), m_effIndex, DoneActualBenefit);
+ DoneActualBenefit *= caster->CalculateLevelPenalty(GetSpellInfo());
amount += int32(DoneActualBenefit);
@@ -549,15 +549,15 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
break;
case SPELLFAMILY_PALADIN:
// Sacred Shield
- if (m_spellProto->SpellFamilyFlags[1] & 0x80000)
+ if (m_spellInfo->SpellFamilyFlags[1] & 0x80000)
{
//+75.00% from sp bonus
float bonus = 0.75f;
- DoneActualBenefit += caster->SpellBaseHealingBonus(GetSpellSchoolMask(m_spellProto)) * bonus;
+ DoneActualBenefit += caster->SpellBaseHealingBonus(m_spellInfo->GetSchoolMask()) * bonus;
// Divine Guardian is only applied at the spell healing bonus because it was already applied to the base value in CalculateSpellDamage
- DoneActualBenefit = caster->ApplyEffectModifiers(GetSpellProto(), m_effIndex, DoneActualBenefit);
- DoneActualBenefit *= caster->CalculateLevelPenalty(GetSpellProto());
+ DoneActualBenefit = caster->ApplyEffectModifiers(GetSpellInfo(), m_effIndex, DoneActualBenefit);
+ DoneActualBenefit *= caster->CalculateLevelPenalty(GetSpellInfo());
amount += (int32)DoneActualBenefit;
@@ -580,24 +580,24 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
if (!caster)
break;
// Mana Shield
- if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_MAGE && GetSpellProto()->SpellFamilyFlags[0] & 0x8000 && m_spellProto->SpellFamilyFlags[2] & 0x8)
+ if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_MAGE && GetSpellInfo()->SpellFamilyFlags[0] & 0x8000 && m_spellInfo->SpellFamilyFlags[2] & 0x8)
{
// +80.53% from +spd bonus
- DoneActualBenefit += caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto)) * 0.8053f;;
+ DoneActualBenefit += caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask()) * 0.8053f;;
}
break;
case SPELL_AURA_DUMMY:
if (!caster)
break;
// Earth Shield
- if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellProto->SpellFamilyFlags[1] & 0x400)
- amount = caster->SpellHealingBonus(GetBase()->GetUnitOwner(), GetSpellProto(), amount, SPELL_DIRECT_DAMAGE);
+ if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags[1] & 0x400)
+ amount = caster->SpellHealingBonus(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE);
break;
case SPELL_AURA_PERIODIC_DAMAGE:
if (!caster)
break;
// Rupture
- if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_ROGUE && m_spellProto->SpellFamilyFlags[0] & 0x100000)
+ if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_ROGUE && m_spellInfo->SpellFamilyFlags[0] & 0x100000)
{
m_canBeRecalculated = false;
if (caster->GetTypeId() != TYPEID_PLAYER)
@@ -613,7 +613,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * AP_per_combo[cp]);
}
// Rip
- else if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID && m_spellProto->SpellFamilyFlags[0] & 0x00800000 && GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE)
+ else if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellFamilyFlags[0] & 0x00800000 && GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE)
{
m_canBeRecalculated = false;
// 0.01*$AP*cp
@@ -629,7 +629,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
amount += uint32(CalculatePctU(caster->GetTotalAttackPowerValue(BASE_ATTACK), cp));
}
// Rend
- else if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARRIOR && GetSpellProto()->SpellFamilyFlags[0] & 0x20)
+ else if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARRIOR && GetSpellInfo()->SpellFamilyFlags[0] & 0x20)
{
m_canBeRecalculated = false;
// $0.2 * (($MWB + $mwb) / 2 + $AP / 14 * $MWS) bonus per tick
@@ -638,13 +638,13 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
float mwb_min = caster->GetWeaponDamageRange(BASE_ATTACK, MINDAMAGE);
float mwb_max = caster->GetWeaponDamageRange(BASE_ATTACK, MAXDAMAGE);
float mwb = ((mwb_min + mwb_max) / 2 + ap * mws / 14000) * 0.2f;
- amount += int32(caster->ApplyEffectModifiers(m_spellProto, m_effIndex, mwb));
+ amount += int32(caster->ApplyEffectModifiers(m_spellInfo, m_effIndex, mwb));
// "If used while your target is above 75% health, Rend does 35% more damage."
// as for 3.1.3 only ranks above 9 (wrong tooltip?)
- if (sSpellMgr->GetSpellRank(m_spellProto->Id) >= 9)
+ if (m_spellInfo->GetRank() >= 9)
{
- if (GetBase()->GetUnitOwner()->HasAuraState(AURA_STATE_HEALTH_ABOVE_75_PERCENT, m_spellProto, caster))
- AddPctN(amount, SpellMgr::CalculateSpellEffectAmount(m_spellProto, 2, caster));
+ if (GetBase()->GetUnitOwner()->HasAuraState(AURA_STATE_HEALTH_ABOVE_75_PERCENT, m_spellInfo, caster))
+ AddPctN(amount, m_spellInfo->Effects[EFFECT_2].CalcValue(caster));
}
}
// Unholy Blight damage over time effect
@@ -656,25 +656,25 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
}
break;
case SPELL_AURA_PERIODIC_ENERGIZE:
- if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_GENERIC)
+ if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_GENERIC)
{
// Replenishment (0.25% from max)
// Infinite Replenishment
- if (m_spellProto->SpellIconID == 3184 && m_spellProto->SpellVisual[0] == 12495)
+ if (m_spellInfo->SpellIconID == 3184 && m_spellInfo->SpellVisual[0] == 12495)
amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 25 / 10000;
}
// Innervate
- else if (m_spellProto->Id == 29166)
+ else if (m_spellInfo->Id == 29166)
ApplyPctF(amount, float(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)) / GetTotalTicks());
// Owlkin Frenzy
- else if (m_spellProto->Id == 48391)
+ else if (m_spellInfo->Id == 48391)
ApplyPctU(amount, GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA));
break;
case SPELL_AURA_PERIODIC_HEAL:
if (!caster)
break;
// Lightwell Renew
- if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_PRIEST && m_spellProto->SpellFamilyFlags[2] & 0x4000)
+ if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_PRIEST && m_spellInfo->SpellFamilyFlags[2] & 0x4000)
{
if (caster->GetTypeId() == TYPEID_PLAYER)
// Bonus from Glyph of Lightwell
@@ -686,7 +686,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
if (!caster)
break;
// Icebound Fortitude
- if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && m_spellProto->SpellFamilyFlags[0] & 0x00100000)
+ if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && m_spellInfo->SpellFamilyFlags[0] & 0x00100000)
{
if (caster->GetTypeId() == TYPEID_PLAYER)
{
@@ -707,7 +707,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
}
}
// Hand of Salvation
- else if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_PALADIN && GetSpellProto()->SpellFamilyFlags[0] & 0x00000100)
+ else if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_PALADIN && GetSpellInfo()->SpellFamilyFlags[0] & 0x00000100)
{
//Glyph of Salvation
if (caster->GetGUID() == GetBase()->GetUnitOwner()->GetGUID())
@@ -748,7 +748,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
break;
case SPELL_AURA_MOD_INCREASE_SPEED:
// Dash - do not set speed if not in cat form
- if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID && GetSpellProto()->SpellFamilyFlags[2] & 0x00000008)
+ if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DRUID && GetSpellInfo()->SpellFamilyFlags[2] & 0x00000008)
amount = GetBase()->GetUnitOwner()->GetShapeshiftForm() == FORM_CAT ? amount : 0;
break;
default:
@@ -756,7 +756,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
}
if (DoneActualBenefit != 0.0f)
{
- DoneActualBenefit *= caster->CalculateLevelPenalty(GetSpellProto());
+ DoneActualBenefit *= caster->CalculateLevelPenalty(GetSpellInfo());
amount += (int32)DoneActualBenefit;
}
@@ -767,7 +767,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
void AuraEffect::CalculatePeriodic(Unit* caster, bool create, bool load)
{
- m_amplitude = m_spellProto->EffectAmplitude[m_effIndex];
+ m_amplitude = m_spellInfo->Effects[m_effIndex].Amplitude;
// prepare periodics
switch (GetAuraType())
@@ -826,13 +826,13 @@ void AuraEffect::CalculatePeriodic(Unit* caster, bool create, bool load)
if (caster)
{
// Haste modifies periodic time of channeled spells
- if (IsChanneledSpell(m_spellProto))
+ if (m_spellInfo->IsChanneled())
{
- if (m_spellProto->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION)
- caster->ModSpellCastTime(m_spellProto, m_amplitude);
+ if (m_spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION)
+ caster->ModSpellCastTime(m_spellInfo, m_amplitude);
}
// and periodic time of auras affected by SPELL_AURA_PERIODIC_HASTE
- else if (caster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, m_spellProto) || m_spellProto->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION)
+ else if (caster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, m_spellInfo) || m_spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION)
m_amplitude = int32(m_amplitude * caster->GetFloatValue(UNIT_MOD_CAST_SPEED));
}
}
@@ -841,7 +841,7 @@ void AuraEffect::CalculatePeriodic(Unit* caster, bool create, bool load)
{
m_tickNumber = m_amplitude ? GetBase()->GetDuration() / m_amplitude : 0;
m_periodicTimer = m_amplitude ? GetBase()->GetDuration() % m_amplitude : 0;
- if (m_spellProto->AttributesEx5 & SPELL_ATTR5_START_PERIODIC_AT_APPLY)
+ if (m_spellInfo->AttributesEx5 & SPELL_ATTR5_START_PERIODIC_AT_APPLY)
++m_tickNumber;
}
else // aura just created or reapplied
@@ -857,7 +857,7 @@ void AuraEffect::CalculatePeriodic(Unit* caster, bool create, bool load)
{
m_periodicTimer = 0;
// Start periodic on next tick or at aura apply
- if (m_amplitude && !(m_spellProto->AttributesEx5 & SPELL_ATTR5_START_PERIODIC_AT_APPLY))
+ if (m_amplitude && !(m_spellInfo->AttributesEx5 & SPELL_ATTR5_START_PERIODIC_AT_APPLY))
m_periodicTimer += m_amplitude;
}
}
@@ -868,11 +868,11 @@ void AuraEffect::CalculateSpellMod()
switch (GetAuraType())
{
case SPELL_AURA_DUMMY:
- switch(GetSpellProto()->SpellFamilyName)
+ switch(GetSpellInfo()->SpellFamilyName)
{
case SPELLFAMILY_PRIEST:
// Pain and Suffering
- if (m_spellProto->SpellIconID == 2874)
+ if (m_spellInfo->SpellIconID == 2874)
{
if (!m_spellmod)
{
@@ -921,7 +921,7 @@ void AuraEffect::CalculateSpellMod()
m_spellmod->spellId = GetId();
m_spellmod->mask[1] = 0x0004000;
}
- m_spellmod->value = GetBase()->GetUnitOwner()->CalculateSpellDamage(GetBase()->GetUnitOwner(), GetSpellProto(), 1);
+ m_spellmod->value = GetBase()->GetUnitOwner()->CalculateSpellDamage(GetBase()->GetUnitOwner(), GetSpellInfo(), 1);
break;
default:
break;
@@ -937,7 +937,7 @@ void AuraEffect::CalculateSpellMod()
m_spellmod->type = SpellModType(GetAuraType()); // SpellModType value == spell aura types
m_spellmod->spellId = GetId();
- m_spellmod->mask = GetSpellProto()->EffectSpellClassMask[GetEffIndex()];
+ m_spellmod->mask = GetSpellInfo()->Effects[GetEffIndex()].SpellClassMask;
m_spellmod->charges = GetBase()->GetCharges();
}
m_spellmod->value = GetAmount();
@@ -1057,7 +1057,7 @@ void AuraEffect::ApplySpellMod(Unit* target, bool apply)
Aura* aura = iter->second->GetBase();
// only passive auras-active auras should have amount set on spellcast and not be affected
// if aura is casted by others, it will not be affected
- if ((aura->IsPassive() || aura->GetSpellProto()->AttributesEx2 & SPELL_ATTR2_ALWAYS_APPLY_MODIFIERS) && aura->GetCasterGUID() == guid && sSpellMgr->IsAffectedByMod(aura->GetSpellProto(), m_spellmod))
+ if ((aura->IsPassive() || aura->GetSpellInfo()->AttributesEx2 & SPELL_ATTR2_ALWAYS_APPLY_MODIFIERS) && aura->GetCasterGUID() == guid && aura->GetSpellInfo()->IsAffectedBySpellMod(m_spellmod))
{
if (GetMiscValue() == SPELLMOD_ALL_EFFECTS)
{
@@ -1127,7 +1127,7 @@ void AuraEffect::UpdatePeriodic(Unit* caster)
}
break;
case SPELL_AURA_PERIODIC_DUMMY:
- switch(GetSpellProto()->SpellFamilyName)
+ switch(GetSpellInfo()->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
switch(GetId())
@@ -1223,7 +1223,7 @@ void AuraEffect::UpdatePeriodic(Unit* caster)
break;
case SPELLFAMILY_DEATHKNIGHT:
// Chains of Ice
- if (GetSpellProto()->SpellFamilyFlags[1] & 0x00004000)
+ if (GetSpellInfo()->SpellFamilyFlags[1] & 0x00004000)
{
// Get 0 effect aura
if (AuraEffect* slow = GetBase()->GetEffect(0))
@@ -1251,28 +1251,28 @@ bool AuraEffect::IsPeriodicTickCrit(Unit* target, Unit const* caster) const
Unit::AuraEffectList const& mPeriodicCritAuras= caster->GetAuraEffectsByType(SPELL_AURA_ABILITY_PERIODIC_CRIT);
for (Unit::AuraEffectList::const_iterator itr = mPeriodicCritAuras.begin(); itr != mPeriodicCritAuras.end(); ++itr)
{
- if ((*itr)->IsAffectedOnSpell(m_spellProto) && caster->isSpellCrit(target, m_spellProto, GetSpellSchoolMask(m_spellProto)))
+ if ((*itr)->IsAffectedOnSpell(m_spellInfo) && caster->isSpellCrit(target, m_spellInfo, m_spellInfo->GetSchoolMask()))
return true;
}
// Rupture - since 3.3.3 can crit
if (target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x100000, 0x0, 0x0, caster->GetGUID()))
{
- if (caster->isSpellCrit(target, m_spellProto, GetSpellSchoolMask(m_spellProto)))
+ if (caster->isSpellCrit(target, m_spellInfo, m_spellInfo->GetSchoolMask()))
return true;
}
return false;
}
-bool AuraEffect::IsAffectedOnSpell(SpellEntry const* spell) const
+bool AuraEffect::IsAffectedOnSpell(SpellInfo const* spell) const
{
if (!spell)
return false;
// Check family name
- if (spell->SpellFamilyName != m_spellProto->SpellFamilyName)
+ if (spell->SpellFamilyName != m_spellInfo->SpellFamilyName)
return false;
// Check EffectClassMask
- if (m_spellProto->EffectSpellClassMask[m_effIndex] & spell->SpellFamilyFlags)
+ if (m_spellInfo->Effects[m_effIndex].SpellClassMask & spell->SpellFamilyFlags)
return true;
return false;
}
@@ -1280,7 +1280,7 @@ bool AuraEffect::IsAffectedOnSpell(SpellEntry const* spell) const
void AuraEffect::SendTickImmune(Unit* target, Unit *caster) const
{
if (caster)
- caster->SendSpellDamageImmune(target, m_spellProto->Id);
+ caster->SendSpellDamageImmune(target, m_spellInfo->Id);
}
void AuraEffect::PeriodicTick(AuraApplication * aurApp, Unit* caster) const
@@ -1365,21 +1365,21 @@ void AuraEffect::HandleProc(AuraApplication* aurApp, ProcEventInfo& eventInfo)
void AuraEffect::CleanupTriggeredSpells(Unit* target)
{
- uint32 tSpellId = m_spellProto->EffectTriggerSpell[GetEffIndex()];
+ uint32 tSpellId = m_spellInfo->Effects[GetEffIndex()].TriggerSpell;
if (!tSpellId)
return;
- SpellEntry const* tProto = sSpellStore.LookupEntry(tSpellId);
+ SpellInfo const* tProto = sSpellMgr->GetSpellInfo(tSpellId);
if (!tProto)
return;
- if (GetSpellDuration(tProto) != -1)
+ if (tProto->GetDuration() != -1)
return;
// needed for spell 43680, maybe others
// TODO: is there a spell flag, which can solve this in a more sophisticated way?
- if (m_spellProto->EffectApplyAuraName[GetEffIndex()] == SPELL_AURA_PERIODIC_TRIGGER_SPELL &&
- uint32(GetSpellDuration(m_spellProto)) == m_spellProto->EffectAmplitude[GetEffIndex()])
+ if (m_spellInfo->Effects[GetEffIndex()].ApplyAuraName == SPELL_AURA_PERIODIC_TRIGGER_SPELL &&
+ uint32(m_spellInfo->GetDuration()) == m_spellInfo->Effects[GetEffIndex()].Amplitude)
return;
target->RemoveAurasDueToSpell(tSpellId, GetCasterGUID());
@@ -1487,7 +1487,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
{
if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled) continue;
if (itr->first == spellId || itr->first == spellId2) continue;
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR0_PASSIVE | SPELL_ATTR0_HIDDEN_CLIENTSIDE))) continue;
if (spellInfo->Stances & (1<<(GetMiscValue()-1)))
target->CastSpell(target, itr->first, true, NULL, this);
@@ -1495,7 +1495,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
// Leader of the Pack
if (target->ToPlayer()->HasSpell(17007))
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(24932);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(24932);
if (spellInfo && spellInfo->Stances & (1<<(GetMiscValue()-1)))
target->CastSpell(target, 24932, true, NULL, this);
}
@@ -1513,7 +1513,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
for (Unit::AuraEffectList::const_iterator i = mModTotalStatPct.begin(); i != mModTotalStatPct.end(); ++i)
{
// Heart of the Wild
- if ((*i)->GetSpellProto()->SpellIconID == 240 && (*i)->GetMiscValue() == 3)
+ if ((*i)->GetSpellInfo()->SpellIconID == 240 && (*i)->GetMiscValue() == 3)
{
int32 HotWMod = (*i)->GetAmount();
@@ -1561,7 +1561,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
// Survival of the Fittest
if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DRUID, 961, 0))
{
- int32 bp = 100 + SpellMgr::CalculateSpellEffectAmount(aurEff->GetSpellProto(), 2);
+ int32 bp = 100 + aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue();
target->CastCustomSpell(target, 62069, &bp, NULL, NULL, true, 0, this);
}
break;
@@ -2083,7 +2083,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
// Defensive Tactics
if (form == FORM_DEFENSIVESTANCE)
{
- if (AuraEffect const* aurEff = target->IsScriptOverriden(m_spellProto, 831))
+ if (AuraEffect const* aurEff = target->IsScriptOverriden(m_spellInfo, 831))
Rage_val += aurEff->GetAmount() * 10;
}
// Stance mastery + Tactical mastery (both passive, and last have aura only in defense stance, but need apply at any stance switch)
@@ -2093,7 +2093,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
{
if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled) continue;
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139)
Rage_val += target->CalculateSpellDamage(target, spellInfo, 0) * 10;
}
@@ -2162,7 +2162,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode,
if (apply)
{
// update active transform spell only when transform or shapeshift not set or not overwriting negative by positive case
- if (!target->GetModelForForm(target->GetShapeshiftForm()) || !IsPositiveSpell(GetId()))
+ if (!target->GetModelForForm(target->GetShapeshiftForm()) || !GetSpellInfo()->IsPositive())
{
// special case (spell specific functionality)
if (GetMiscValue() == 0)
@@ -2314,7 +2314,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode,
model_id = modelid; // Will use the default model here
// Polymorph (sheep)
- if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_MAGE && GetSpellProto()->SpellIconID == 82 && GetSpellProto()->SpellVisual[0] == 12978)
+ if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_MAGE && GetSpellInfo()->SpellIconID == 82 && GetSpellInfo()->SpellVisual[0] == 12978)
if (Unit* caster = GetCaster())
if (caster->HasAura(52648)) // Glyph of the Penguin
model_id = 26452;
@@ -2329,7 +2329,8 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode,
}
// update active transform spell only when transform or shapeshift not set or not overwriting negative by positive case
- if (!target->getTransForm() || !IsPositiveSpell(GetId()) || IsPositiveSpell(target->getTransForm()))
+ SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->getTransForm());
+ if (!transformSpellInfo || !GetSpellInfo()->IsPositive() || transformSpellInfo->IsPositive())
target->setTransForm(GetId());
// polymorph case
@@ -2629,7 +2630,7 @@ void AuraEffect::HandleAuraModPacifyAndSilence(AuraApplication const* aurApp, ui
Unit* target = aurApp->GetTarget();
// Vengeance of the Blue Flight (TODO: REMOVE THIS!)
- if (m_spellProto->Id == 45839)
+ if (m_spellInfo->Id == 45839)
{
if (apply)
target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
@@ -2831,8 +2832,8 @@ void AuraEffect::HandleAuraMounted(AuraApplication const* aurApp, uint8 mode, bo
//some spell has one aura of mount and one of vehicle
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (GetSpellProto()->Effect[i] == SPELL_EFFECT_SUMMON
- && GetSpellProto()->EffectMiscValue[i] == GetMiscValue())
+ if (GetSpellInfo()->Effects[i].Effect == SPELL_EFFECT_SUMMON
+ && GetSpellInfo()->Effects[i].MiscValue == GetMiscValue())
displayID = 0;
target->Mount(displayID, ci->VehicleId, GetMiscValue());
@@ -3372,7 +3373,7 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8
target->RemoveAurasByType(SPELL_AURA_MOD_DECREASE_SPEED);
}
- if (apply && GetSpellProto()->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)
+ if (apply && GetSpellInfo()->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)
for (std::list <AuraType>::iterator iter = immunity_list.begin(); iter != immunity_list.end(); ++iter)
target->RemoveAurasByType(*iter);
}
@@ -3428,7 +3429,7 @@ void AuraEffect::HandleModMechanicImmunity(AuraApplication const* aurApp, uint8
break;
}
- if (apply && GetSpellProto()->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)
+ if (apply && GetSpellInfo()->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)
target->RemoveAurasWithMechanic(mechanic, AURA_REMOVE_BY_DEFAULT, GetId());
}
@@ -3443,7 +3444,7 @@ void AuraEffect::HandleAuraModEffectImmunity(AuraApplication const* aurApp, uint
// when removing flag aura, handle flag drop
if (!apply && target->GetTypeId() == TYPEID_PLAYER
- && (GetSpellProto()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION))
+ && (GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION))
{
if (target->GetTypeId() == TYPEID_PLAYER)
{
@@ -3453,7 +3454,7 @@ void AuraEffect::HandleAuraModEffectImmunity(AuraApplication const* aurApp, uint
bg->EventPlayerDroppedFlag(target->ToPlayer());
}
else
- sOutdoorPvPMgr->HandleDropFlag((Player*)target, GetSpellProto()->Id);
+ sOutdoorPvPMgr->HandleDropFlag((Player*)target, GetSpellInfo()->Id);
}
}
}
@@ -3467,7 +3468,7 @@ void AuraEffect::HandleAuraModStateImmunity(AuraApplication const* aurApp, uint8
target->ApplySpellImmune(GetId(), IMMUNITY_STATE, GetMiscValue(), apply);
- if (apply && GetSpellProto()->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)
+ if (apply && GetSpellInfo()->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)
target->RemoveAurasByType(AuraType(GetMiscValue()), 0 , GetBase());
}
@@ -3480,7 +3481,7 @@ void AuraEffect::HandleAuraModSchoolImmunity(AuraApplication const* aurApp, uint
target->ApplySpellImmune(GetId(), IMMUNITY_SCHOOL, GetMiscValue(), (apply));
- if (GetSpellProto()->Mechanic == MECHANIC_BANISH)
+ if (GetSpellInfo()->Mechanic == MECHANIC_BANISH)
{
if (apply)
target->AddUnitState(UNIT_STAT_ISOLATED);
@@ -3489,7 +3490,7 @@ void AuraEffect::HandleAuraModSchoolImmunity(AuraApplication const* aurApp, uint
bool banishFound = false;
Unit::AuraEffectList const& banishAuras = target->GetAuraEffectsByType(GetAuraType());
for (Unit::AuraEffectList::const_iterator i = banishAuras.begin(); i != banishAuras.end(); ++i)
- if ((*i)->GetSpellProto()->Mechanic == MECHANIC_BANISH)
+ if ((*i)->GetSpellInfo()->Mechanic == MECHANIC_BANISH)
{
banishFound = true;
break;
@@ -3503,22 +3504,22 @@ void AuraEffect::HandleAuraModSchoolImmunity(AuraApplication const* aurApp, uint
target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
// remove all flag auras (they are positive, but they must be removed when you are immune)
- if (GetSpellProto()->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY
- && GetSpellProto()->AttributesEx2 & SPELL_ATTR2_DAMAGE_REDUCED_SHIELD)
+ if (GetSpellInfo()->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY
+ && GetSpellInfo()->AttributesEx2 & SPELL_ATTR2_DAMAGE_REDUCED_SHIELD)
target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
// TODO: optimalize this cycle - use RemoveAurasWithInterruptFlags call or something else
if ((apply)
- && GetSpellProto()->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY
- && IsPositiveSpell(GetId())) //Only positive immunity removes auras
+ && GetSpellInfo()->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY
+ && GetSpellInfo()->IsPositive()) //Only positive immunity removes auras
{
uint32 school_mask = GetMiscValue();
Unit::AuraApplicationMap& Auras = target->GetAppliedAuras();
for (Unit::AuraApplicationMap::iterator iter = Auras.begin(); iter != Auras.end();)
{
- SpellEntry const* spell = iter->second->GetBase()->GetSpellProto();
- if ((GetSpellSchoolMask(spell) & school_mask)//Check for school mask
- && CanSpellDispelAura(GetSpellProto(), spell)
+ SpellInfo const* spell = iter->second->GetBase()->GetSpellInfo();
+ if ((spell->GetSchoolMask() & school_mask)//Check for school mask
+ && GetSpellInfo()->CanDispelAura(spell)
&& !iter->second->IsPositive() //Don't remove positive spells
&& spell->Id != GetId()) //Don't remove self
{
@@ -3547,7 +3548,7 @@ void AuraEffect::HandleAuraModDispelImmunity(AuraApplication const* aurApp, uint
Unit* target = aurApp->GetTarget();
- target->ApplySpellDispelImmunity(m_spellProto, DispelType(GetMiscValue()), (apply));
+ target->ApplySpellDispelImmunity(m_spellInfo, DispelType(GetMiscValue()), (apply));
}
/*********************************************************/
@@ -3841,7 +3842,7 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8
// recalculate current HP/MP after applying aura modifications (only for spells with SPELL_ATTR0_UNK4 0x00000010 flag)
// this check is total bullshit i think
- if (GetMiscValue() == STAT_STAMINA && (m_spellProto->Attributes & SPELL_ATTR0_ABILITY))
+ if (GetMiscValue() == STAT_STAMINA && (m_spellInfo->Attributes & SPELL_ATTR0_ABILITY))
target->SetHealth(std::max<uint32>(uint32(healthPct * target->GetMaxHealth() * 0.01f), (alive ? 1 : 0)));
}
@@ -4109,7 +4110,7 @@ void AuraEffect::HandleAuraModWeaponCritPercent(AuraApplication const* aurApp, u
// with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask
// GetMiscValue() comparison with item generated damage types
- if (GetSpellProto()->EquippedItemClass == -1)
+ if (GetSpellInfo()->EquippedItemClass == -1)
{
target->ToPlayer()->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
target->ToPlayer()->HandleBaseModValue(OFFHAND_CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
@@ -4431,7 +4432,7 @@ void AuraEffect::HandleModDamageDone(AuraApplication const* aurApp, uint8 mode,
if ((GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) != 0)
{
// apply generic physical damage bonuses including wand case
- if (GetSpellProto()->EquippedItemClass == -1 || target->GetTypeId() != TYPEID_PLAYER)
+ if (GetSpellInfo()->EquippedItemClass == -1 || target->GetTypeId() != TYPEID_PLAYER)
{
target->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_VALUE, float(GetAmount()), apply);
target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, float(GetAmount()), apply);
@@ -4455,7 +4456,7 @@ void AuraEffect::HandleModDamageDone(AuraApplication const* aurApp, uint8 mode,
if ((GetMiscValue() & SPELL_SCHOOL_MASK_MAGIC) == 0)
return;
- if (GetSpellProto()->EquippedItemClass != -1 || GetSpellProto()->EquippedItemInventoryTypeMask != 0)
+ if (GetSpellInfo()->EquippedItemClass != -1 || GetSpellInfo()->EquippedItemInventoryTypeMask != 0)
{
// wand magic case (skip generic to all item spell bonuses)
// done in Player::_ApplyWeaponDependentAuraMods
@@ -4498,7 +4499,7 @@ void AuraEffect::HandleModDamagePercentDone(AuraApplication const* aurApp, uint8
if (!target)
return;
- if (target->HasItemFitToSpellRequirements(GetSpellProto()))
+ if (target->HasItemFitToSpellRequirements(GetSpellInfo()))
target->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, GetAmount() / 100.0f, apply);
}
@@ -4587,7 +4588,7 @@ void AuraEffect::HandleNoReagentUseAura(AuraApplication const* aurApp, uint8 mod
flag96 mask;
Unit::AuraEffectList const& noReagent = target->GetAuraEffectsByType(SPELL_AURA_NO_REAGENT_USE);
for (Unit::AuraEffectList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i)
- mask |= (*i)->m_spellProto->EffectSpellClassMask[(*i)->m_effIndex];
+ mask |= (*i)->m_spellInfo->Effects[(*i)->m_effIndex].SpellClassMask;
target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 , mask[0]);
target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1+1, mask[1]);
@@ -4642,8 +4643,8 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
if (apply)
{
// Overpower
- if (caster && m_spellProto->SpellFamilyName == SPELLFAMILY_WARRIOR &&
- m_spellProto->SpellFamilyFlags[0] & 0x4)
+ if (caster && m_spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR &&
+ m_spellInfo->SpellFamilyFlags[0] & 0x4)
{
// In addition, if you strike a player..
if (target->GetTypeId() != TYPEID_PLAYER)
@@ -4688,12 +4689,12 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
Aura* pet_aura = pet->GetAura(58914, GetCasterGUID());
if (owner_aura)
{
- owner_aura->SetStackAmount(owner_aura->GetSpellProto()->StackAmount);
+ owner_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
}
if (pet_aura)
{
pet_aura->SetCharges(0);
- pet_aura->SetStackAmount(owner_aura->GetSpellProto()->StackAmount);
+ pet_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
}
break;
}
@@ -4727,7 +4728,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
GetBase()->SetDuration(owner_aura->GetDuration());
// Make aura be not charged-this prevents removing charge on not crit spells
owner_aura->SetCharges(0);
- owner_aura->SetStackAmount(owner_aura->GetSpellProto()->StackAmount);
+ owner_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
}
break;
}
@@ -4805,13 +4806,13 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
}
case 71563:
if (Aura* newAura = target->AddAura(71564, target))
- newAura->SetStackAmount(newAura->GetSpellProto()->StackAmount);
+ newAura->SetStackAmount(newAura->GetSpellInfo()->StackAmount);
}
}
// AT REMOVE
else
{
- if ((IsQuestTameSpell(GetSpellProto())) && caster && caster->isAlive() && target->isAlive())
+ if ((GetSpellInfo()->IsQuestTame()) && caster && caster->isAlive() && target->isAlive())
{
uint32 finalSpelId = 0;
switch(GetId())
@@ -4840,7 +4841,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
caster->CastSpell(target, finalSpelId, true, NULL, this);
}
- switch(m_spellProto->SpellFamilyName)
+ switch(m_spellInfo->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
switch(GetId())
@@ -4893,7 +4894,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
break;
case SPELLFAMILY_MAGE:
// Living Bomb
- if (m_spellProto->SpellFamilyFlags[1] & 0x20000)
+ if (m_spellInfo->SpellFamilyFlags[1] & 0x20000)
{
AuraRemoveMode mode = aurApp->GetRemoveMode();
if (caster && (mode == AURA_REMOVE_BY_ENEMY_SPELL || mode == AURA_REMOVE_BY_EXPIRE))
@@ -4902,7 +4903,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
break;
case SPELLFAMILY_WARLOCK:
// Haunt
- if (m_spellProto->SpellFamilyFlags[1] & 0x40000)
+ if (m_spellInfo->SpellFamilyFlags[1] & 0x40000)
{
if (caster)
target->CastCustomSpell(caster, 48210, &m_amount, 0, 0, true, NULL, this, GetCasterGUID());
@@ -4910,7 +4911,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
break;
case SPELLFAMILY_DRUID:
// Lifebloom
- if (GetSpellProto()->SpellFamilyFlags[1] & 0x10)
+ if (GetSpellInfo()->SpellFamilyFlags[1] & 0x10)
{
// Final heal only on duration end
if (aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
@@ -4923,14 +4924,14 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
// restore mana
if (caster)
{
- int32 returnmana = CalculatePctU(caster->GetCreateMana(), GetSpellProto()->ManaCostPercentage) * stack / 2;
+ int32 returnmana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2;
caster->CastCustomSpell(caster, 64372, &returnmana, NULL, NULL, true, NULL, this, GetCasterGUID());
}
}
break;
case SPELLFAMILY_PRIEST:
// Vampiric Touch
- if (m_spellProto->SpellFamilyFlags[1] & 0x0400 && aurApp->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL && GetEffIndex() == 0)
+ if (m_spellInfo->SpellFamilyFlags[1] & 0x0400 && aurApp->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL && GetEffIndex() == 0)
{
if (AuraEffect const* aurEff = GetBase()->GetEffect(1))
{
@@ -4958,7 +4959,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
// AT APPLY & REMOVE
- switch(m_spellProto->SpellFamilyName)
+ switch(m_spellInfo->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
{
@@ -4976,7 +4977,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
uint32 spellId = 24659;
if (apply && caster)
{
- SpellEntry const* spell = sSpellStore.LookupEntry(spellId);
+ SpellInfo const* spell = sSpellMgr->GetSpellInfo(spellId);
for (uint32 i = 0; i < spell->StackAmount; ++i)
caster->CastSpell(target, spell->Id, true, NULL, NULL, GetCasterGUID());
@@ -4991,7 +4992,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
uint32 spellId = 24662;
if (apply && caster)
{
- SpellEntry const* spell = sSpellStore.LookupEntry(spellId);
+ SpellInfo const* spell = sSpellMgr->GetSpellInfo(spellId);
for (uint32 i = 0; i < spell->StackAmount; ++i)
caster->CastSpell(target, spell->Id, true, NULL, NULL, GetCasterGUID());
break;
@@ -5060,7 +5061,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
if (apply)
{
- switch(m_spellProto->Id)
+ switch(m_spellInfo->Id)
{
case 57819: FactionID = 1106; break; // Argent Crusade
case 57820: FactionID = 1098; break; // Knights of the Ebon Blade
@@ -5177,7 +5178,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
}
}
// Predatory Strikes
- if (target->GetTypeId() == TYPEID_PLAYER && GetSpellProto()->SpellIconID == 1563)
+ if (target->GetTypeId() == TYPEID_PLAYER && GetSpellInfo()->SpellIconID == 1563)
{
target->ToPlayer()->UpdateAttackPowerAndDamage();
}
@@ -5241,11 +5242,11 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mod
if (GetAmount() <= 0)
return;
- if (GetSpellProto()->EffectItemType[m_effIndex] == 0)
+ if (GetSpellInfo()->Effects[m_effIndex].ItemType == 0)
return;
// Soul Shard
- if (GetSpellProto()->EffectItemType[m_effIndex] == 6265)
+ if (GetSpellInfo()->Effects[m_effIndex].ItemType == 6265)
{
// Soul Shard only from units that grant XP or honor
if (!plCaster->isHonorOrXPTarget(target) ||
@@ -5253,7 +5254,7 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mod
return;
// If this is Drain Soul, check for Glyph of Drain Soul
- if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellProto()->SpellFamilyFlags[0] & 0x00004000))
+ if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000))
{
// Glyph of Drain Soul - chance to create an additional Soul Shard
if (AuraEffect* aur = caster->GetAuraEffect(58070, 0))
@@ -5267,16 +5268,16 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mod
uint32 count = m_amount;
ItemPosCountVec dest;
- InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellProto()->EffectItemType[m_effIndex], count, &noSpaceForCount);
+ InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellInfo()->Effects[m_effIndex].ItemType, count, &noSpaceForCount);
if (msg != EQUIP_ERR_OK)
{
count-=noSpaceForCount;
- plCaster->SendEquipError(msg, NULL, NULL, GetSpellProto()->EffectItemType[m_effIndex]);
+ plCaster->SendEquipError(msg, NULL, NULL, GetSpellInfo()->Effects[m_effIndex].ItemType);
if (count == 0)
return;
}
- Item* newitem = plCaster->StoreNewItem(dest, GetSpellProto()->EffectItemType[m_effIndex], true);
+ Item* newitem = plCaster->StoreNewItem(dest, GetSpellInfo()->Effects[m_effIndex].ItemType, true);
if (!newitem)
{
plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
@@ -5423,13 +5424,16 @@ void AuraEffect::HandleAuraLinked(AuraApplication const* aurApp, uint8 mode, boo
{
Unit* target = aurApp->GetTarget();
- uint32 triggeredSpellId = m_spellProto->EffectTriggerSpell[m_effIndex];
+ uint32 triggeredSpellId = m_spellInfo->Effects[m_effIndex].TriggerSpell;
+ SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggeredSpellId);
+ if (!triggeredSpellInfo)
+ return;
if (mode & AURA_EFFECT_HANDLE_REAL)
{
if (apply)
{
- Unit* caster = GetTriggeredSpellCaster(m_spellProto, GetCaster(), target);
+ Unit* caster = triggeredSpellInfo->IsRequiringSelectedTarget() ? GetCaster() : target;
if (!caster)
return;
@@ -5441,13 +5445,13 @@ void AuraEffect::HandleAuraLinked(AuraApplication const* aurApp, uint8 mode, boo
}
else
{
- uint64 casterGUID = IsSpellRequiringFocusedTarget(GetSpellProto()) ? GetCasterGUID() : target->GetGUID();
+ uint64 casterGUID = triggeredSpellInfo->IsRequiringSelectedTarget() ? GetCasterGUID() : target->GetGUID();
target->RemoveAura(triggeredSpellId, casterGUID, 0, aurApp->GetRemoveMode());
}
}
else if (mode & AURA_EFFECT_HANDLE_REAPPLY && apply)
{
- uint64 casterGUID = IsSpellRequiringFocusedTarget(GetSpellProto()) ? GetCasterGUID() : target->GetGUID();
+ uint64 casterGUID = triggeredSpellInfo->IsRequiringSelectedTarget() ? GetCasterGUID() : target->GetGUID();
// change the stack amount to be equal to stack amount of our aura
if (Aura* triggeredAura = target->GetAura(triggeredSpellId, casterGUID))
triggeredAura->ModStackAmount(GetBase()->GetStackAmount() - triggeredAura->GetStackAmount());
@@ -5575,7 +5579,7 @@ void AuraEffect::HandleAuraSetVehicle(AuraApplication const* aurApp, uint8 mode,
void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
{
- switch (GetSpellProto()->SpellFamilyName)
+ switch (GetSpellInfo()->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
switch (GetId())
@@ -5600,7 +5604,7 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
}
case 62292: // Blaze (Pool of Tar)
// should we use custom damage?
- target->CastSpell((Unit*)NULL, m_spellProto->EffectTriggerSpell[m_effIndex], true);
+ target->CastSpell((Unit*)NULL, m_spellInfo->Effects[m_effIndex].TriggerSpell, true);
break;
case 62399: // Overload Circuit
if (target->GetMap()->IsDungeon() && int(target->GetAppliedAuras().count(62399)) >= (target->GetMap()->IsHeroic() ? 4 : 2))
@@ -5611,7 +5615,7 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
}
break;
case 64821: // Fuse Armor (Razorscale)
- if (GetBase()->GetStackAmount() == GetSpellProto()->StackAmount)
+ if (GetBase()->GetStackAmount() == GetSpellInfo()->StackAmount)
{
target->CastSpell(target, 64774, true, NULL, NULL, GetCasterGUID());
target->RemoveAura(64821);
@@ -5624,18 +5628,19 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
// Mirror Image
if (GetId() == 55342)
// Set name of summons to name of caster
- target->CastSpell((Unit *)NULL, m_spellProto->EffectTriggerSpell[m_effIndex], true);
+ target->CastSpell((Unit *)NULL, m_spellInfo->Effects[m_effIndex].TriggerSpell, true);
break;
}
case SPELLFAMILY_WARLOCK:
{
- switch (GetSpellProto()->Id)
+ switch (GetSpellInfo()->Id)
{
// Demonic Circle
case 48018:
- if (GameObject* obj = target->GetGameObject(GetSpellProto()->Id))
+ if (GameObject* obj = target->GetGameObject(GetSpellInfo()->Id))
{
- if (target->IsWithinDist(obj, GetSpellMaxRange(48020, true)))
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(48020);
+ if (target->IsWithinDist(obj, spellInfo->GetMaxRange(true)))
{
if (!target->HasAura(62388))
target->CastSpell(target, 62388, true);
@@ -5649,7 +5654,7 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
}
case SPELLFAMILY_DRUID:
{
- switch (GetSpellProto()->Id)
+ switch (GetSpellInfo()->Id)
{
// Frenzied Regeneration
case 22842:
@@ -5663,7 +5668,7 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
if (rage == 0)
break;
int32 mod = (rage < 100) ? rage : 100;
- int32 points = target->CalculateSpellDamage(target, GetSpellProto(), 1);
+ int32 points = target->CalculateSpellDamage(target, GetSpellInfo(), 1);
int32 regen = target->GetMaxHealth() * (mod * points / 10) / 1000;
target->CastCustomSpell(target, 22845, &regen, 0, 0, true, 0, this);
target->SetPower(POWER_RAGE, rage-mod);
@@ -5674,7 +5679,7 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
}
case SPELLFAMILY_ROGUE:
{
- switch (GetSpellProto()->Id)
+ switch (GetSpellInfo()->Id)
{
// Master of Subtlety
case 31666:
@@ -5688,7 +5693,7 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
UnitList targets;
{
// eff_radius == 0
- float radius = GetSpellMaxRange(GetSpellProto(), false);
+ float radius = GetSpellInfo()->GetMaxRange(false);
CellPair p(Trinity::ComputeCellPair(target->GetPositionX(), target->GetPositionY()));
Cell cell(p);
@@ -5726,13 +5731,13 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
case SPELLFAMILY_HUNTER:
{
// Explosive Shot
- if (GetSpellProto()->SpellFamilyFlags[1] & 0x80000000)
+ if (GetSpellInfo()->SpellFamilyFlags[1] & 0x80000000)
{
if (caster)
caster->CastCustomSpell(53352, SPELLVALUE_BASE_POINT0, m_amount, target, true, NULL, this);
break;
}
- switch (GetSpellProto()->Id)
+ switch (GetSpellInfo()->Id)
{
// Feeding Frenzy Rank 1
case 53511:
@@ -5767,7 +5772,7 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
break;
}
// Death and Decay
- if (GetSpellProto()->SpellFamilyFlags[0] & 0x20)
+ if (GetSpellInfo()->SpellFamilyFlags[0] & 0x20)
{
if (caster)
caster->CastCustomSpell(target, 52212, &m_amount, NULL, NULL, true, 0, this);
@@ -5776,7 +5781,7 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
// Blood of the North
// Reaping
// Death Rune Mastery
- if (GetSpellProto()->SpellIconID == 3041 || GetSpellProto()->SpellIconID == 22 || GetSpellProto()->SpellIconID == 2622)
+ if (GetSpellInfo()->SpellIconID == 3041 || GetSpellInfo()->SpellIconID == 22 || GetSpellInfo()->SpellIconID == 2622)
{
if (target->GetTypeId() != TYPEID_PLAYER)
return;
@@ -5795,10 +5800,10 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) const
{
// generic casting code with custom spells and target/caster customs
- uint32 triggerSpellId = GetSpellProto()->EffectTriggerSpell[GetEffIndex()];
+ uint32 triggerSpellId = GetSpellInfo()->Effects[GetEffIndex()].TriggerSpell;
- SpellEntry const* triggeredSpellInfo = sSpellStore.LookupEntry(triggerSpellId);
- SpellEntry const* auraSpellInfo = GetSpellProto();
+ SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId);
+ SpellInfo const* auraSpellInfo = GetSpellInfo();
uint32 auraId = auraSpellInfo->Id;
// specific code for cases with no trigger spell provided in field
@@ -6075,11 +6080,11 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster)
}
// Reget trigger spell proto
- triggeredSpellInfo = sSpellStore.LookupEntry(triggerSpellId);
+ triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId);
if (triggeredSpellInfo)
{
- if (Unit* triggerCaster = GetTriggeredSpellCaster(triggeredSpellInfo, caster, target))
+ if (Unit* triggerCaster = triggeredSpellInfo->IsRequiringSelectedTarget() ? caster : target)
{
triggerCaster->CastSpell(target, triggeredSpellInfo, true, NULL, this);
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell %u Trigger %u", GetId(), triggeredSpellInfo->Id);
@@ -6096,10 +6101,10 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster)
void AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick(Unit* target, Unit* caster) const
{
- uint32 triggerSpellId = GetSpellProto()->EffectTriggerSpell[m_effIndex];
- if (SpellEntry const* triggeredSpellInfo = sSpellStore.LookupEntry(triggerSpellId))
+ uint32 triggerSpellId = GetSpellInfo()->Effects[m_effIndex].TriggerSpell;
+ if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
{
- if (Unit* triggerCaster = GetTriggeredSpellCaster(triggeredSpellInfo, caster, target))
+ if (Unit* triggerCaster = triggeredSpellInfo->IsRequiringSelectedTarget() ? caster : target)
{
int32 basepoints0 = GetAmount();
triggerCaster->CastCustomSpell(target, triggerSpellId, &basepoints0, 0, 0, true, 0, this);
@@ -6115,36 +6120,36 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
if (!caster || !target->isAlive())
return;
- if (target->HasUnitState(UNIT_STAT_ISOLATED) || target->IsImmunedToDamage(GetSpellProto()))
+ if (target->HasUnitState(UNIT_STAT_ISOLATED) || target->IsImmunedToDamage(GetSpellInfo()))
{
SendTickImmune(target, caster);
return;
}
// Consecrate ticks can miss and will not show up in the combat log
- if (GetSpellProto()->Effect[GetEffIndex()] == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
- caster->SpellHitResult(target, GetSpellProto(), false) != SPELL_MISS_NONE)
+ if (GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
+ caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
return;
// some auras remove at specific health level or more
if (GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE)
{
- switch (GetSpellProto()->Id)
+ switch (GetSpellInfo()->Id)
{
case 43093: case 31956: case 38801: // Grievous Wound
case 35321: case 38363: case 39215: // Gushing Wound
if (target->IsFullHealth())
{
- target->RemoveAurasDueToSpell(GetSpellProto()->Id);
+ target->RemoveAurasDueToSpell(GetSpellInfo()->Id);
return;
}
break;
case 38772: // Grievous Wound
{
- uint32 percent = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), 1, caster);
+ uint32 percent = GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster);
if (!target->HealthBelowPct(percent))
{
- target->RemoveAurasDueToSpell(GetSpellProto()->Id);
+ target->RemoveAurasDueToSpell(GetSpellInfo()->Id);
return;
}
break;
@@ -6161,18 +6166,18 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
if (GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE)
{
- damage = caster->SpellDamageBonus(target, GetSpellProto(), damage, DOT, GetBase()->GetStackAmount());
+ damage = caster->SpellDamageBonus(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
// Calculate armor mitigation
- if (Unit::IsDamageReducedByArmor(GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), GetEffIndex()))
+ if (Unit::IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), GetEffIndex()))
{
- uint32 damageReductedArmor = caster->CalcArmorReducedDamage(target, damage, GetSpellProto());
+ uint32 damageReductedArmor = caster->CalcArmorReducedDamage(target, damage, GetSpellInfo());
cleanDamage.mitigated_damage += damage - damageReductedArmor;
damage = damageReductedArmor;
}
// Curse of Agony damage-per-tick calculation
- if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellProto()->SpellFamilyFlags[0] & 0x400) && GetSpellProto()->SpellIconID == 544)
+ if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x400) && GetSpellInfo()->SpellIconID == 544)
{
uint32 totalTick = GetTotalTicks();
// 1..4 ticks, 1/2 from normal tick damage
@@ -6184,7 +6189,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
// 5..8 ticks have normal tick damage
}
// There is a Chance to make a Soul Shard when Drain soul does damage
- if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellProto()->SpellFamilyFlags[0] & 0x00004000))
+ if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000))
{
if (caster->GetTypeId() == TYPEID_PLAYER && caster->ToPlayer()->isHonorOrXPTarget(target))
{
@@ -6198,7 +6203,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
}
}
}
- if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_GENERIC)
+ if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_GENERIC)
{
switch (GetId())
{
@@ -6218,13 +6223,13 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
bool crit = IsPeriodicTickCrit(target, caster);
if (crit)
- damage = caster->SpellCriticalDamageBonus(m_spellProto, damage, target);
+ damage = caster->SpellCriticalDamageBonus(m_spellInfo, damage, target);
int32 dmg = damage;
caster->ApplyResilience(target, NULL, &dmg, crit, CR_CRIT_TAKEN_SPELL);
damage = dmg;
- caster->CalcAbsorbResist(target, GetSpellSchoolMask(GetSpellProto()), DOT, damage, &absorb, &resist, GetSpellProto());
+ caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, GetSpellInfo());
sLog->outDetail("PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId(), absorb);
@@ -6246,9 +6251,9 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
SpellPeriodicAuraLogInfo pInfo(this, damage, overkill, absorb, resist, 0.0f, crit);
target->SendPeriodicAuraLog(&pInfo);
- caster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, damage, BASE_ATTACK, GetSpellProto());
+ caster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo());
- caster->DealDamage(target, damage, &cleanDamage, DOT, GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), true);
+ caster->DealDamage(target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
}
void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) const
@@ -6256,14 +6261,14 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c
if (!caster || !caster->isAlive() || !target->isAlive())
return;
- if (target->HasUnitState(UNIT_STAT_ISOLATED) || target->IsImmunedToDamage(GetSpellProto()))
+ if (target->HasUnitState(UNIT_STAT_ISOLATED) || target->IsImmunedToDamage(GetSpellInfo()))
{
SendTickImmune(target, caster);
return;
}
- if (GetSpellProto()->Effect[GetEffIndex()] == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
- caster->SpellHitResult(target, GetSpellProto(), false) != SPELL_MISS_NONE)
+ if (GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
+ caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
return;
uint32 absorb = 0;
@@ -6271,16 +6276,16 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c
CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
uint32 damage = std::max(GetAmount(), 0);
- damage = caster->SpellDamageBonus(target, GetSpellProto(), damage, DOT, GetBase()->GetStackAmount());
+ damage = caster->SpellDamageBonus(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
bool crit = IsPeriodicTickCrit(target, caster);
if (crit)
- damage = caster->SpellCriticalDamageBonus(m_spellProto, damage, target);
+ damage = caster->SpellCriticalDamageBonus(m_spellInfo, damage, target);
// Calculate armor mitigation
- if (Unit::IsDamageReducedByArmor(GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), m_effIndex))
+ if (Unit::IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), m_effIndex))
{
- uint32 damageReductedArmor = caster->CalcArmorReducedDamage(target, damage, GetSpellProto());
+ uint32 damageReductedArmor = caster->CalcArmorReducedDamage(target, damage, GetSpellInfo());
cleanDamage.mitigated_damage += damage - damageReductedArmor;
damage = damageReductedArmor;
}
@@ -6289,7 +6294,7 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c
caster->ApplyResilience(target, NULL, &dmg, crit, CR_CRIT_TAKEN_SPELL);
damage = dmg;
- caster->CalcAbsorbResist(target, GetSpellSchoolMask(GetSpellProto()), DOT, damage, &absorb, &resist, m_spellProto);
+ caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, m_spellInfo);
if (target->GetHealth() < damage)
damage = uint32(target->GetHealth());
@@ -6297,7 +6302,7 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c
sLog->outDetail("PeriodicTick: %u (TypeId: %u) health leech of %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId(), absorb);
- caster->SendSpellNonMeleeDamageLog(target, GetId(), damage, GetSpellSchoolMask(GetSpellProto()), absorb, resist, false, 0, crit);
+ caster->SendSpellNonMeleeDamageLog(target, GetId(), damage, GetSpellInfo()->GetSchoolMask(), absorb, resist, false, 0, crit);
// Set trigger flag
uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
@@ -6306,15 +6311,15 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c
damage = (damage <= absorb+resist) ? 0 : (damage-absorb-resist);
if (damage)
procVictim |= PROC_FLAG_TAKEN_DAMAGE;
- caster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, damage, BASE_ATTACK, GetSpellProto());
- int32 new_damage = caster->DealDamage(target, damage, &cleanDamage, DOT, GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), false);
+ caster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo());
+ int32 new_damage = caster->DealDamage(target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), false);
- float gainMultiplier = SpellMgr::CalculateSpellEffectValueMultiplier(GetSpellProto(), GetEffIndex(), caster);
+ float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
- uint32 heal = uint32(caster->SpellHealingBonus(caster, GetSpellProto(), uint32(new_damage * gainMultiplier), DOT, GetBase()->GetStackAmount()));
+ uint32 heal = uint32(caster->SpellHealingBonus(caster, GetSpellInfo(), uint32(new_damage * gainMultiplier), DOT, GetBase()->GetStackAmount()));
- int32 gain = caster->HealBySpell(caster, GetSpellProto(), heal);
- caster->getHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellProto());
+ int32 gain = caster->HealBySpell(caster, GetSpellInfo(), heal);
+ caster->getHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellInfo());
}
void AuraEffect::HandlePeriodicHealthFunnelAuraTick(Unit* target, Unit* caster) const
@@ -6338,11 +6343,11 @@ void AuraEffect::HandlePeriodicHealthFunnelAuraTick(Unit* target, Unit* caster)
caster->ModifyHealth(-(int32)damage);
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: donator %u target %u damage %u.", caster->GetEntry(), target->GetEntry(), damage);
- float gainMultiplier = SpellMgr::CalculateSpellEffectValueMultiplier(GetSpellProto(), GetEffIndex(), caster);
+ float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
damage = int32(damage * gainMultiplier);
- caster->HealBySpell(target, GetSpellProto(), damage);
+ caster->HealBySpell(target, GetSpellInfo(), damage);
}
void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
@@ -6357,7 +6362,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
}
// heal for caster damage (must be alive)
- if (target != caster && GetSpellProto()->AttributesEx2 & SPELL_ATTR2_HEALTH_FUNNEL && !caster->isAlive())
+ if (target != caster && GetSpellInfo()->AttributesEx2 & SPELL_ATTR2_HEALTH_FUNNEL && !caster->isAlive())
return;
// don't regen when permanent aura target has full power
@@ -6402,7 +6407,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
else
{
// Wild Growth = amount + (6 - 2*doneTicks) * ticks* amount / 100
- if (m_spellProto->SpellFamilyName == SPELLFAMILY_DRUID && m_spellProto->SpellIconID == 2864)
+ if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellIconID == 2864)
{
int32 addition = int32(float(damage * GetTotalTicks()) * ((6-float(2*(GetTickNumber()-1)))/100));
@@ -6414,41 +6419,41 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
damage += addition;
}
- damage = caster->SpellHealingBonus(target, GetSpellProto(), damage, DOT, GetBase()->GetStackAmount());
+ damage = caster->SpellHealingBonus(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount());
}
bool crit = IsPeriodicTickCrit(target, caster);
if (crit)
- damage = caster->SpellCriticalHealingBonus(m_spellProto, damage, target);
+ damage = caster->SpellCriticalHealingBonus(m_spellInfo, damage, target);
sLog->outDetail("PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId());
uint32 absorb = 0;
uint32 heal = uint32(damage);
- caster->CalcHealAbsorb(target, GetSpellProto(), heal, absorb);
+ caster->CalcHealAbsorb(target, GetSpellInfo(), heal, absorb);
int32 gain = caster->DealHeal(target, heal);
SpellPeriodicAuraLogInfo pInfo(this, damage, damage - gain, absorb, 0, 0.0f, crit);
target->SendPeriodicAuraLog(&pInfo);
- target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto());
+ target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo());
bool haveCastItem = GetBase()->GetCastItemGUID() != 0;
// Health Funnel
// damage caster for heal amount
- if (target != caster && GetSpellProto()->AttributesEx2 & SPELL_ATTR2_HEALTH_FUNNEL)
+ if (target != caster && GetSpellInfo()->AttributesEx2 & SPELL_ATTR2_HEALTH_FUNNEL)
{
- uint32 damage = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), 0); // damage is not affected by spell power
+ uint32 damage = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); // damage is not affected by spell power
if ((int32)damage > gain)
damage = gain;
uint32 absorb = 0;
caster->DealDamageMods(caster, damage, &absorb);
- caster->SendSpellNonMeleeDamageLog(caster, GetId(), damage, GetSpellSchoolMask(GetSpellProto()), absorb, 0, false, 0, false);
+ caster->SendSpellNonMeleeDamageLog(caster, GetId(), damage, GetSpellInfo()->GetSchoolMask(), absorb, 0, false, 0, false);
CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
- caster->DealDamage(caster, damage, &cleanDamage, NODAMAGE, GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), true);
+ caster->DealDamage(caster, damage, &cleanDamage, NODAMAGE, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
}
uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
@@ -6456,7 +6461,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
uint32 procEx = (crit ? PROC_EX_CRITICAL_HIT : PROC_EX_NORMAL_HIT) | PROC_EX_INTERNAL_HOT;
// ignore item heals
if (!haveCastItem)
- caster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, damage, BASE_ATTACK, GetSpellProto());
+ caster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo());
}
void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) const
@@ -6466,14 +6471,14 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con
if (!caster || !caster->isAlive() || !target->isAlive() || target->getPowerType() != powerType)
return;
- if (target->HasUnitState(UNIT_STAT_ISOLATED) || target->IsImmunedToDamage(GetSpellProto()))
+ if (target->HasUnitState(UNIT_STAT_ISOLATED) || target->IsImmunedToDamage(GetSpellInfo()))
{
SendTickImmune(target, caster);
return;
}
- if (GetSpellProto()->Effect[GetEffIndex()] == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
- caster->SpellHitResult(target, GetSpellProto(), false) != SPELL_MISS_NONE)
+ if (GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
+ caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
return;
// ignore negative values (can be result apply spellmods to aura damage
@@ -6481,7 +6486,7 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con
// Special case: draining x% of mana (up to a maximum of 2*x% of the caster's maximum mana)
// It's mana percent cost spells, m_amount is percent drain from target
- if (m_spellProto->ManaCostPercentage)
+ if (m_spellInfo->ManaCostPercentage)
{
// max value
int32 maxmana = CalculatePctF(caster->GetMaxPower(powerType), drainAmount * 2.0f);
@@ -6499,7 +6504,7 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con
int32 drainedAmount = -target->ModifyPower(powerType, -drainAmount);
- float gainMultiplier = SpellMgr::CalculateSpellEffectValueMultiplier(GetSpellProto(), GetEffIndex(), caster);
+ float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
SpellPeriodicAuraLogInfo pInfo(this, drainedAmount, 0, 0, 0, gainMultiplier, false);
target->SendPeriodicAuraLog(&pInfo);
@@ -6509,7 +6514,7 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con
if (gainAmount)
{
gainedAmount = caster->ModifyPower(powerType, gainAmount);
- target->AddThreat(caster, float(gainedAmount) * 0.5f, GetSpellSchoolMask(GetSpellProto()), GetSpellProto());
+ target->AddThreat(caster, float(gainedAmount) * 0.5f, GetSpellInfo()->GetSchoolMask(), GetSpellInfo());
}
// spell-specific code
@@ -6540,8 +6545,8 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con
break;
}
// Drain Mana
- if (m_spellProto->SpellFamilyName == SPELLFAMILY_WARLOCK
- && m_spellProto->SpellFamilyFlags[0] & 0x00000010)
+ if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK
+ && m_spellInfo->SpellFamilyFlags[0] & 0x00000010)
{
int32 manaFeedVal = 0;
if (AuraEffect const* aurEff = GetBase()->GetEffect(1))
@@ -6587,7 +6592,7 @@ void AuraEffect::HandleObsModPowerAuraTick(Unit* target, Unit* caster) const
int32 gain = target->ModifyPower(powerType, amount);
if (caster)
- target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto());
+ target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo());
}
void AuraEffect::HandlePeriodicEnergizeAuraTick(Unit* target, Unit* caster) const
@@ -6619,7 +6624,7 @@ void AuraEffect::HandlePeriodicEnergizeAuraTick(Unit* target, Unit* caster) cons
int32 gain = target->ModifyPower(powerType, amount);
if (caster)
- target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto());
+ target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo());
}
void AuraEffect::HandlePeriodicPowerBurnManaAuraTick(Unit* target, Unit* caster) const
@@ -6629,7 +6634,7 @@ void AuraEffect::HandlePeriodicPowerBurnManaAuraTick(Unit* target, Unit* caster)
if (!caster || !target->isAlive() || target->getPowerType() != powerType)
return;
- if (target->HasUnitState(UNIT_STAT_ISOLATED) || target->IsImmunedToDamage(GetSpellProto()))
+ if (target->HasUnitState(UNIT_STAT_ISOLATED) || target->IsImmunedToDamage(GetSpellInfo()))
{
SendTickImmune(target, caster);
return;
@@ -6644,9 +6649,9 @@ void AuraEffect::HandlePeriodicPowerBurnManaAuraTick(Unit* target, Unit* caster)
uint32 gain = uint32(-target->ModifyPower(powerType, -damage));
- float dmgMultiplier = SpellMgr::CalculateSpellEffectValueMultiplier(GetSpellProto(), GetEffIndex(), caster);
+ float dmgMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
- SpellEntry const* spellProto = GetSpellProto();
+ SpellInfo const* spellProto = GetSpellInfo();
// maybe has to be sent different to client, but not by SMSG_PERIODICAURALOG
SpellNonMeleeDamage damageInfo(caster, target, spellProto->Id, spellProto->SchoolMask);
// no SpellDamageBonus for burn mana
@@ -6673,8 +6678,8 @@ void AuraEffect::HandleProcTriggerSpellAuraProc(AuraApplication* aurApp, ProcEve
Unit* triggerCaster = aurApp->GetTarget();
Unit* triggerTarget = eventInfo.GetProcTarget();
- uint32 triggerSpellId = GetSpellProto()->EffectTriggerSpell[GetEffIndex()];
- if (SpellEntry const* triggeredSpellInfo = sSpellStore.LookupEntry(triggerSpellId))
+ uint32 triggerSpellId = GetSpellInfo()->Effects[GetEffIndex()].TriggerSpell;
+ if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
{
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleProcTriggerSpellAuraProc: Triggering spell %u from aura %u proc", triggeredSpellInfo->Id, GetId());
triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo, true, NULL, this);
@@ -6688,8 +6693,8 @@ void AuraEffect::HandleProcTriggerSpellWithValueAuraProc(AuraApplication* aurApp
Unit* triggerCaster = aurApp->GetTarget();
Unit* triggerTarget = eventInfo.GetProcTarget();
- uint32 triggerSpellId = GetSpellProto()->EffectTriggerSpell[m_effIndex];
- if (SpellEntry const* triggeredSpellInfo = sSpellStore.LookupEntry(triggerSpellId))
+ uint32 triggerSpellId = GetSpellInfo()->Effects[m_effIndex].TriggerSpell;
+ if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
{
int32 basepoints0 = GetAmount();
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Triggering spell %u with value %d from aura %u proc", triggeredSpellInfo->Id, basepoints0, GetId());
@@ -6703,9 +6708,9 @@ void AuraEffect::HandleProcTriggerDamageAuraProc(AuraApplication* aurApp, ProcEv
{
Unit* target = aurApp->GetTarget();
Unit* triggerTarget = eventInfo.GetProcTarget();
- SpellNonMeleeDamage damageInfo(target, triggerTarget, GetId(), GetSpellProto()->SchoolMask);
- uint32 damage = target->SpellDamageBonus(triggerTarget, GetSpellProto(), GetAmount(), SPELL_DIRECT_DAMAGE);
- target->CalculateSpellDamageTaken(&damageInfo, damage, GetSpellProto());
+ SpellNonMeleeDamage damageInfo(target, triggerTarget, GetId(), GetSpellInfo()->SchoolMask);
+ uint32 damage = target->SpellDamageBonus(triggerTarget, GetSpellInfo(), GetAmount(), SPELL_DIRECT_DAMAGE);
+ target->CalculateSpellDamageTaken(&damageInfo, damage, GetSpellInfo());
target->DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
target->SendSpellNonMeleeDamageLog(&damageInfo);
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleProcTriggerDamageAuraProc: Triggering %u spell damage from aura %u proc", damage, GetId());
@@ -6743,17 +6748,13 @@ void AuraEffect::HandleRaidProcFromChargeAuraProc(AuraApplication* aurApp, ProcE
// next target selection
if (jumps > 0)
{
- Unit* caster = GetCaster();
- float radius = (float)GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(GetSpellProto()->EffectRadiusIndex[GetEffIndex()]));
-
- if (caster)
+ if (Unit* caster = GetCaster())
{
- if (Player* modOwner = caster->GetSpellModOwner())
- modOwner->ApplySpellMod(GetId(), SPELLMOD_RADIUS, radius, NULL);
+ float radius = GetSpellInfo()->Effects[GetEffIndex()].CalcRadius(caster);
if (Unit* triggerTarget = target->GetNextRandomRaidMemberOrPet(radius))
{
- target->CastSpell(triggerTarget, GetSpellProto(), true, NULL, this, GetCasterGUID());
+ target->CastSpell(triggerTarget, GetSpellInfo(), true, NULL, this, GetCasterGUID());
if (Aura* aura = triggerTarget->GetAura(GetId(), GetCasterGUID()))
aura->SetCharges(jumps);
}
@@ -6770,7 +6771,7 @@ void AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(AuraApplication* aurA
Unit* target = aurApp->GetTarget();
// Currently only Prayer of Mending
- if (!(GetSpellProto()->SpellFamilyName == SPELLFAMILY_PRIEST && GetSpellProto()->SpellFamilyFlags[1] & 0x20))
+ if (!(GetSpellInfo()->SpellFamilyName == SPELLFAMILY_PRIEST && GetSpellInfo()->SpellFamilyFlags[1] & 0x20))
{
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: received not handled spell: %u", GetId());
return;
@@ -6788,13 +6789,9 @@ void AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(AuraApplication* aurA
// next target selection
if (jumps > 0)
{
- Unit* caster = GetCaster();
- float radius = (float)GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(GetSpellProto()->EffectRadiusIndex[GetEffIndex()]));
-
- if (caster)
+ if (Unit* caster = GetCaster())
{
- if (Player* modOwner = caster->GetSpellModOwner())
- modOwner->ApplySpellMod(GetId(), SPELLMOD_RADIUS, radius, NULL);
+ float radius = GetSpellInfo()->Effects[GetEffIndex()].CalcRadius(caster);
if (Unit* triggerTarget = target->GetNextRandomRaidMemberOrPet(radius))
{
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h
index dea2e980c12..0c5e500d887 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.h
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.h
@@ -30,7 +30,7 @@ typedef void(AuraEffect::*pAuraEffectHandler)(AuraApplication const* aurApp, uin
class AuraEffect
{
friend void Aura::_InitEffects(uint8 effMask, Unit* caster, int32 *baseAmount);
- friend Aura * Unit::_TryStackingOrRefreshingExistingAura(SpellEntry const* newAura, uint8 effMask, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID);
+ friend Aura * Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID);
friend Aura::~Aura();
private:
~AuraEffect();
@@ -43,15 +43,15 @@ class AuraEffect
void GetApplicationList(std::list<AuraApplication*> & applicationList) const;
SpellModifier* GetSpellModifier() const { return m_spellmod; }
- SpellEntry const* GetSpellProto() const { return m_spellProto; }
- uint32 GetId() const { return m_spellProto->Id; }
+ SpellInfo const* GetSpellInfo() const { return m_spellInfo; }
+ uint32 GetId() const { return m_spellInfo->Id; }
uint32 GetEffIndex() const { return m_effIndex; }
int32 GetBaseAmount() const { return m_baseAmount; }
int32 GetAmplitude() const { return m_amplitude; }
- int32 GetMiscValueB() const { return m_spellProto->EffectMiscValueB[m_effIndex]; }
- int32 GetMiscValue() const { return m_spellProto->EffectMiscValue[m_effIndex]; }
- AuraType GetAuraType() const { return (AuraType)m_spellProto->EffectApplyAuraName[m_effIndex]; }
+ int32 GetMiscValueB() const { return m_spellInfo->Effects[m_effIndex].MiscValueB; }
+ int32 GetMiscValue() const { return m_spellInfo->Effects[m_effIndex].MiscValue; }
+ AuraType GetAuraType() const { return (AuraType)m_spellInfo->Effects[m_effIndex].ApplyAuraName; }
int32 GetAmount() const { return m_amount; }
void SetAmount(int32 amount) { m_amount = amount; m_canBeRecalculated = false;}
@@ -79,7 +79,7 @@ class AuraEffect
bool IsPeriodic() const { return m_isPeriodic; }
void SetPeriodic(bool isPeriodic) { m_isPeriodic = isPeriodic; }
- bool IsAffectedOnSpell(SpellEntry const *spell) const;
+ bool IsAffectedOnSpell(SpellInfo const *spell) const;
void SendTickImmune(Unit* target, Unit *caster) const;
void PeriodicTick(AuraApplication * aurApp, Unit* caster) const;
@@ -93,7 +93,7 @@ class AuraEffect
private:
Aura * const m_base;
- SpellEntry const* const m_spellProto;
+ SpellInfo const* const m_spellInfo;
uint8 const m_effIndex;
int32 const m_baseAmount;
@@ -308,8 +308,8 @@ namespace Trinity
AbsorbAuraOrderPred() { }
bool operator() (AuraEffect * aurEffA, AuraEffect * aurEffB) const
{
- SpellEntry const* spellProtoA = aurEffA->GetSpellProto();
- SpellEntry const* spellProtoB = aurEffB->GetSpellProto();
+ SpellInfo const* spellProtoA = aurEffA->GetSpellInfo();
+ SpellInfo const* spellProtoB = aurEffB->GetSpellInfo();
// Wards
if ((spellProtoA->SpellFamilyName == SPELLFAMILY_MAGE) ||
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index f737b1b61e5..b8012a32458 100755
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -123,7 +123,7 @@ void AuraApplication::_InitFlags(Unit* caster, uint8 effMask)
bool negativeFound = false;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- if (((1<<i) & effMask) && !IsPositiveEffect(GetBase()->GetId(), i))
+ if (((1<<i) & effMask) && !GetBase()->GetSpellInfo()->IsPositiveEffect(i))
{
negativeFound = true;
break;
@@ -138,7 +138,7 @@ void AuraApplication::_InitFlags(Unit* caster, uint8 effMask)
bool positiveFound = false;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- if (((1<<i) & effMask) && IsPositiveEffect(GetBase()->GetId(), i))
+ if (((1<<i) & effMask) && GetBase()->GetSpellInfo()->IsPositiveEffect(i))
{
positiveFound = true;
break;
@@ -189,13 +189,13 @@ void AuraApplication::BuildUpdatePacket(ByteBuffer& data, bool remove) const
Aura const* aura = GetBase();
data << uint32(aura->GetId());
uint32 flags = m_flags;
- if (aura->GetMaxDuration() > 0 && !(aura->GetSpellProto()->AttributesEx5 & SPELL_ATTR5_HIDE_DURATION))
+ if (aura->GetMaxDuration() > 0 && !(aura->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_HIDE_DURATION))
flags |= AFLAG_DURATION;
data << uint8(flags);
data << uint8(aura->GetCasterLevel());
// send stack amount for aura which could be stacked (never 0 - causes incorrect display) or charges
// stack amount has priority over charges (checked on retail with spell 50262)
- data << uint8(aura->GetSpellProto()->StackAmount ? aura->GetStackAmount() : aura->GetCharges());
+ data << uint8(aura->GetSpellInfo()->StackAmount ? aura->GetStackAmount() : aura->GetCharges());
if (!(flags & AFLAG_CASTER))
data.appendPackGUID(aura->GetCasterGUID());
@@ -218,7 +218,7 @@ void AuraApplication::ClientUpdate(bool remove)
m_target->SendMessageToSet(&data, true);
}
-uint8 Aura::BuildEffectMaskForOwner(SpellEntry const* spellProto, uint8 avalibleEffectMask, WorldObject* owner)
+uint8 Aura::BuildEffectMaskForOwner(SpellInfo const* spellProto, uint8 avalibleEffectMask, WorldObject* owner)
{
ASSERT(spellProto);
ASSERT(owner);
@@ -229,14 +229,14 @@ uint8 Aura::BuildEffectMaskForOwner(SpellEntry const* spellProto, uint8 avalible
case TYPEID_PLAYER:
for (uint8 i = 0; i< MAX_SPELL_EFFECTS; ++i)
{
- if (IsUnitOwnedAuraEffect(spellProto->Effect[i]))
+ if (spellProto->Effects[i].IsUnitOwnedAuraEffect())
effMask |= 1 << i;
}
break;
case TYPEID_DYNAMICOBJECT:
for (uint8 i = 0; i< MAX_SPELL_EFFECTS; ++i)
{
- if (spellProto->Effect[i] == SPELL_EFFECT_PERSISTENT_AREA_AURA)
+ if (spellProto->Effects[i].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA)
effMask |= 1 << i;
}
break;
@@ -246,7 +246,7 @@ uint8 Aura::BuildEffectMaskForOwner(SpellEntry const* spellProto, uint8 avalible
return effMask & avalibleEffectMask;
}
-Aura* Aura::TryRefreshStackOrCreate(SpellEntry const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, uint64 casterGUID /*= 0*/, bool* refresh /*= NULL*/)
+Aura* Aura::TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, uint64 casterGUID /*= 0*/, bool* refresh /*= NULL*/)
{
ASSERT(spellproto);
ASSERT(owner);
@@ -272,7 +272,7 @@ Aura* Aura::TryRefreshStackOrCreate(SpellEntry const* spellproto, uint8 tryEffMa
return Create(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID);
}
-Aura* Aura::TryCreate(SpellEntry const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, uint64 casterGUID /*= 0*/)
+Aura* Aura::TryCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, uint64 casterGUID /*= 0*/)
{
ASSERT(spellproto);
ASSERT(owner);
@@ -284,7 +284,7 @@ Aura* Aura::TryCreate(SpellEntry const* spellproto, uint8 tryEffMask, WorldObjec
return Create(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID);
}
-Aura* Aura::Create(SpellEntry const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID)
+Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID)
{
ASSERT(effMask);
ASSERT(spellproto);
@@ -306,7 +306,7 @@ Aura* Aura::Create(SpellEntry const* spellproto, uint8 effMask, WorldObject* own
if (owner->isType(TYPEMASK_UNIT))
if (!owner->IsInWorld() || ((Unit*)owner)->IsDuringRemoveFromWorld())
// owner not in world so don't allow to own not self casted single target auras
- if (casterGUID != owner->GetGUID() && IsSingleTargetSpell(spellproto))
+ if (casterGUID != owner->GetGUID() && spellproto->IsSingleTarget())
return NULL;
Aura* aura = NULL;
@@ -329,14 +329,14 @@ Aura* Aura::Create(SpellEntry const* spellproto, uint8 effMask, WorldObject* own
return aura;
}
-Aura::Aura(SpellEntry const* spellproto, WorldObject * owner, Unit* caster, Item* castItem, uint64 casterGUID) :
-m_spellProto(spellproto), m_casterGuid(casterGUID ? casterGUID : caster->GetGUID()),
+Aura::Aura(SpellInfo const* spellproto, WorldObject * owner, Unit* caster, Item* castItem, uint64 casterGUID) :
+m_spellInfo(spellproto), m_casterGuid(casterGUID ? casterGUID : caster->GetGUID()),
m_castItemGuid(castItem ? castItem->GetGUID() : 0), m_applyTime(time(NULL)),
m_owner(owner), m_timeCla(0), m_updateTargetMapInterval(0),
-m_casterLevel(caster ? caster->getLevel() : m_spellProto->spellLevel), m_procCharges(0), m_stackAmount(1),
+m_casterLevel(caster ? caster->getLevel() : m_spellInfo->SpellLevel), m_procCharges(0), m_stackAmount(1),
m_isRemoved(false), m_isSingleTarget(false), m_isUsingCharges(false)
{
- if (m_spellProto->manaPerSecond || m_spellProto->manaPerSecondPerLevel)
+ if (m_spellInfo->ManaPerSecond || m_spellInfo->ManaPerSecondPerLevel)
m_timeCla = 1 * IN_MILLISECONDS;
m_maxDuration = CalcMaxDuration(caster);
@@ -404,10 +404,10 @@ void Aura::_ApplyForTarget(Unit* target, Unit* caster, AuraApplication * auraApp
// set infinity cooldown state for spells
if (caster && caster->GetTypeId() == TYPEID_PLAYER)
{
- if (m_spellProto->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
+ if (m_spellInfo->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
{
Item* castItem = m_castItemGuid ? caster->ToPlayer()->GetItemByGuid(m_castItemGuid) : NULL;
- caster->ToPlayer()->AddSpellAndCategoryCooldowns(m_spellProto, castItem ? castItem->GetEntry() : 0, NULL, true);
+ caster->ToPlayer()->AddSpellAndCategoryCooldowns(m_spellInfo, castItem ? castItem->GetEntry() : 0, NULL, true);
}
}
}
@@ -424,7 +424,7 @@ void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * auraA
if (itr == m_applications.end())
{
sLog->outError("Aura::_UnapplyForTarget, target:%u, caster:%u, spell:%u was not found in owners application map!",
- target->GetGUIDLow(), caster->GetGUIDLow(), auraApp->GetBase()->GetSpellProto()->Id);
+ target->GetGUIDLow(), caster->GetGUIDLow(), auraApp->GetBase()->GetSpellInfo()->Id);
ASSERT(false);
}
@@ -437,9 +437,9 @@ void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * auraA
// reset cooldown state for spells
if (caster && caster->GetTypeId() == TYPEID_PLAYER)
{
- if (GetSpellProto()->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
+ if (GetSpellInfo()->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases)
- caster->ToPlayer()->SendCooldownEvent(GetSpellProto());
+ caster->ToPlayer()->SendCooldownEvent(GetSpellInfo());
}
}
@@ -519,7 +519,7 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply)
bool addUnit = true;
// check target immunities
- if (itr->first->IsImmunedToSpell(GetSpellProto())
+ if (itr->first->IsImmunedToSpell(GetSpellInfo())
|| !CanBeAppliedOn(itr->first))
addUnit = false;
@@ -542,7 +542,7 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply)
for (Unit::AuraApplicationMap::iterator iter = itr->first->GetAppliedAuras().begin(); iter != itr->first->GetAppliedAuras().end(); ++iter)
{
Aura const* aura = iter->second->GetBase();
- if (!sSpellMgr->CanAurasStack(this, aura, aura->GetCasterGUID() == GetCasterGUID()))
+ if (!CanStackWith(aura))
{
addUnit = false;
break;
@@ -658,11 +658,11 @@ void Aura::Update(uint32 diff, Unit* caster)
m_timeCla -= diff;
else if (caster)
{
- if (int32 manaPerSecond = m_spellProto->manaPerSecond + m_spellProto->manaPerSecondPerLevel * caster->getLevel())
+ if (int32 manaPerSecond = m_spellInfo->ManaPerSecond + m_spellInfo->ManaPerSecondPerLevel * caster->getLevel())
{
m_timeCla += 1000 - diff;
- Powers powertype = Powers(m_spellProto->powerType);
+ Powers powertype = Powers(m_spellInfo->PowerType);
if (powertype == POWER_HEALTH)
{
if (int32(caster->GetHealth()) > manaPerSecond)
@@ -697,12 +697,12 @@ int32 Aura::CalcMaxDuration(Unit* caster) const
if (caster)
{
modOwner = caster->GetSpellModOwner();
- maxDuration = caster->CalcSpellDuration(m_spellProto);
+ maxDuration = caster->CalcSpellDuration(m_spellInfo);
}
else
- maxDuration = GetSpellDuration(m_spellProto);
+ maxDuration = m_spellInfo->GetDuration();
- if (IsPassive() && m_spellProto->DurationIndex == 0)
+ if (IsPassive() && !m_spellInfo->DurationEntry)
maxDuration = -1;
if (!IsPermanent() && modOwner)
@@ -726,7 +726,7 @@ void Aura::RefreshDuration()
{
SetDuration(GetMaxDuration());
- if (m_spellProto->manaPerSecond || m_spellProto->manaPerSecondPerLevel)
+ if (m_spellInfo->ManaPerSecond || m_spellInfo->ManaPerSecondPerLevel)
m_timeCla = 1 * IN_MILLISECONDS;
}
@@ -751,7 +751,7 @@ void Aura::SetCharges(uint8 charges)
uint8 Aura::CalcMaxCharges(Unit* caster) const
{
- uint8 maxProcCharges = m_spellProto->procCharges;
+ uint8 maxProcCharges = m_spellInfo->ProcCharges;
if (SpellProcEntry const* procEntry = sSpellMgr->GetSpellProcEntry(GetId()))
maxProcCharges = procEntry->charges;
@@ -811,13 +811,13 @@ bool Aura::ModStackAmount(int32 num, AuraRemoveMode removeMode)
int32 stackAmount = m_stackAmount + num;
// limit the stack amount (only on stack increase, stack amount may be changed manually)
- if ((num > 0) && (stackAmount > int32(m_spellProto->StackAmount)))
+ if ((num > 0) && (stackAmount > int32(m_spellInfo->StackAmount)))
{
// not stackable aura - set stack amount to 1
- if (!m_spellProto->StackAmount)
+ if (!m_spellInfo->StackAmount)
stackAmount = 1;
else
- stackAmount = m_spellProto->StackAmount;
+ stackAmount = m_spellInfo->StackAmount;
}
// we're out of stacks, remove
else if (stackAmount <= 0)
@@ -858,12 +858,12 @@ void Aura::RefreshSpellMods()
bool Aura::IsPassive() const
{
- return IsPassiveSpell(GetSpellProto());
+ return GetSpellInfo()->IsPassive();
}
bool Aura::IsDeathPersistent() const
{
- return IsDeathPersistentSpell(GetSpellProto());
+ return GetSpellInfo()->IsDeathPersistent();
}
bool Aura::CanBeSaved() const
@@ -872,7 +872,7 @@ bool Aura::CanBeSaved() const
return false;
if (GetCasterGUID() != GetOwner()->GetGUID())
- if (IsSingleTargetSpell(GetSpellProto()))
+ if (GetSpellInfo()->IsSingleTarget())
return false;
// Can't be saved - aura handler relies on calculated amount and changes it
@@ -897,7 +897,7 @@ bool Aura::CanBeSaved() const
bool Aura::CanBeSentToClient() const
{
- return !IsPassive() || HasAreaAuraEffect(GetSpellProto()) || HasEffectType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
+ return !IsPassive() || GetSpellInfo()->HasAreaAuraEffect() || HasEffectType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
}
void Aura::UnregisterSingleTarget()
@@ -912,6 +912,27 @@ void Aura::UnregisterSingleTarget()
SetIsSingleTarget(false);
}
+int32 Aura::CalcDispelChance(Unit* auraTarget, bool offensive) const
+{
+ // we assume that aura dispel chance is 100% on start
+ // need formula for level difference based chance
+ int32 resistChance = 0;
+
+ // Apply dispel mod from aura caster
+ if (Unit* caster = GetCaster())
+ if (Player* modOwner = caster->GetSpellModOwner())
+ modOwner->ApplySpellMod(GetId(), SPELLMOD_RESIST_DISPEL_CHANCE, resistChance);
+
+ // Dispel resistance from target SPELL_AURA_MOD_DISPEL_RESIST
+ // Only affects offensive dispels
+ if (offensive && auraTarget)
+ resistChance += auraTarget->GetTotalAuraModifier(SPELL_AURA_MOD_DISPEL_RESIST);
+
+ resistChance = resistChance < 0 ? 0 : resistChance;
+ resistChance = resistChance > 100 ? 100 : resistChance;
+ return 100 - resistChance;
+}
+
void Aura::SetLoadedState(int32 maxduration, int32 duration, int32 charges, uint8 stackamount, uint8 recalculateMask, int32 * amount)
{
m_maxDuration = maxduration;
@@ -1000,15 +1021,13 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
}
// handle spell_linked_spell table
- uint32 customAttr = sSpellMgr->GetSpellCustomAttr(GetId());
if (!onReapply)
{
// apply linked auras
if (apply)
{
- if (customAttr & SPELL_ATTR0_CU_LINK_AURA)
+ if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA))
{
- std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA);
for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
{
if (*itr < 0)
@@ -1021,9 +1040,8 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
else
{
// remove linked auras
- if (customAttr & SPELL_ATTR0_CU_LINK_REMOVE)
+ if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(-(int32)GetId()))
{
- std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(-(int32)GetId());
for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
{
if (*itr < 0)
@@ -1032,9 +1050,8 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
target->CastSpell(target, *itr, true, NULL, NULL, GetCasterGUID());
}
}
- if (customAttr & SPELL_ATTR0_CU_LINK_AURA)
+ if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA))
{
- std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA);
for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
{
if (*itr < 0)
@@ -1048,9 +1065,8 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
else if (apply)
{
// modify stack amount of linked auras
- if (customAttr & SPELL_ATTR0_CU_LINK_AURA)
+ if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA))
{
- std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA);
for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
if (*itr > 0)
if (Aura* triggeredAura = target->GetAura(*itr, GetCasterGUID()))
@@ -1061,7 +1077,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
// mods at aura apply
if (apply)
{
- switch (GetSpellProto()->SpellFamilyName)
+ switch (GetSpellInfo()->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
switch(GetId())
@@ -1088,7 +1104,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (!caster)
break;
// Rejuvenation
- if (GetSpellProto()->SpellFamilyFlags[0] & 0x10 && GetEffect(EFFECT_0))
+ if (GetSpellInfo()->SpellFamilyFlags[0] & 0x10 && GetEffect(EFFECT_0))
{
// Druid T8 Restoration 4P Bonus
if (caster->HasAura(64760))
@@ -1101,23 +1117,23 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
case SPELLFAMILY_MAGE:
if (!caster)
break;
- if (GetSpellProto()->SpellFamilyFlags[0] & 0x00000001 && GetSpellProto()->SpellFamilyFlags[2] & 0x00000008)
+ if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00000001 && GetSpellInfo()->SpellFamilyFlags[2] & 0x00000008)
{
// Glyph of Fireball
if (caster->HasAura(56368))
SetDuration(0);
}
- else if (GetSpellProto()->SpellFamilyFlags[0] & 0x00000020 && GetSpellProto()->SpellVisual[0] == 13)
+ else if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00000020 && GetSpellInfo()->SpellVisual[0] == 13)
{
// Glyph of Frostbolt
if (caster->HasAura(56370))
SetDuration(0);
}
// Todo: This should be moved to similar function in spell::hit
- else if (GetSpellProto()->SpellFamilyFlags[0] & 0x01000000)
+ else if (GetSpellInfo()->SpellFamilyFlags[0] & 0x01000000)
{
// Polymorph Sound - Sheep && Penguin
- if (GetSpellProto()->SpellIconID == 82 && GetSpellProto()->SpellVisual[0] == 12978)
+ if (GetSpellInfo()->SpellIconID == 82 && GetSpellInfo()->SpellVisual[0] == 12978)
{
// Glyph of the Penguin
if (caster->HasAura(52648))
@@ -1179,29 +1195,29 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (!caster)
break;
// Devouring Plague
- if (GetSpellProto()->SpellFamilyFlags[0] & 0x02000000 && GetEffect(0))
+ if (GetSpellInfo()->SpellFamilyFlags[0] & 0x02000000 && GetEffect(0))
{
// Improved Devouring Plague
if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 3790, 1))
{
- int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * caster->SpellDamageBonus(target, GetSpellProto(), GetEffect(0)->GetAmount(), DOT) / 100;
+ int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * caster->SpellDamageBonus(target, GetSpellInfo(), GetEffect(0)->GetAmount(), DOT) / 100;
int32 heal = int32(CalculatePctN(basepoints0, 15));
caster->CastCustomSpell(target, 63675, &basepoints0, NULL, NULL, true, NULL, GetEffect(0));
caster->CastCustomSpell(caster, 75999, &heal, NULL, NULL, true, NULL, GetEffect(0));
}
}
// Renew
- else if (GetSpellProto()->SpellFamilyFlags[0] & 0x00000040 && GetEffect(0))
+ else if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00000040 && GetEffect(0))
{
// Empowered Renew
if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 3021, 1))
{
- int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * caster->SpellHealingBonus(target, GetSpellProto(), GetEffect(0)->GetAmount(), HEAL) / 100;
+ int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * caster->SpellHealingBonus(target, GetSpellInfo(), GetEffect(0)->GetAmount(), HEAL) / 100;
caster->CastCustomSpell(target, 63544, &basepoints0, NULL, NULL, true, NULL, GetEffect(0));
}
}
// Power Word: Shield
- else if (m_spellProto->SpellFamilyFlags[0] & 0x1 && m_spellProto->SpellFamilyFlags[2] & 0x400 && GetEffect(0))
+ else if (m_spellInfo->SpellFamilyFlags[0] & 0x1 && m_spellInfo->SpellFamilyFlags[2] & 0x400 && GetEffect(0))
{
// Glyph of Power Word: Shield
if (AuraEffect* glyph = caster->GetAuraEffect(55672, 0))
@@ -1214,7 +1230,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
break;
case SPELLFAMILY_ROGUE:
// Sprint (skip non player casted spells by category)
- if (GetSpellProto()->SpellFamilyFlags[0] & 0x40 && GetSpellProto()->Category == 44)
+ if (GetSpellInfo()->SpellFamilyFlags[0] & 0x40 && GetSpellInfo()->Category == 44)
// in official maybe there is only one icon?
if (target->HasAura(58039)) // Glyph of Blurred Speed
target->CastSpell(target, 61922, true); // Sprint (waterwalk)
@@ -1223,7 +1239,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (!caster)
break;
// Frost Fever and Blood Plague
- if (GetSpellProto()->SpellFamilyFlags[2] & 0x2)
+ if (GetSpellInfo()->SpellFamilyFlags[2] & 0x2)
{
// Can't proc on self
if (GetCasterGUID() == target->GetGUID())
@@ -1238,7 +1254,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
{
aurEff = *itr;
// Ebon Plaguebringer - end search if found
- if ((*itr)->GetSpellProto()->SpellIconID == 1766)
+ if ((*itr)->GetSpellInfo()->SpellIconID == 1766)
break;
}
}
@@ -1267,7 +1283,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
// mods at aura remove
else
{
- switch(GetSpellProto()->SpellFamilyName)
+ switch(GetSpellInfo()->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
switch(GetId())
@@ -1317,7 +1333,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (!caster)
break;
// Ice barrier - dispel/absorb remove
- if (removeMode == AURA_REMOVE_BY_ENEMY_SPELL && GetSpellProto()->SpellFamilyFlags[1] & 0x1)
+ if (removeMode == AURA_REMOVE_BY_ENEMY_SPELL && GetSpellInfo()->SpellFamilyFlags[1] & 0x1)
{
// Shattered Barrier
if (caster->GetDummyAuraEffect(SPELLFAMILY_MAGE, 2945, 0))
@@ -1328,7 +1344,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (!caster)
break;
// Spell Reflection
- if (GetSpellProto()->SpellFamilyFlags[1] & 0x2)
+ if (GetSpellInfo()->SpellFamilyFlags[1] & 0x2)
{
if (removeMode != AURA_REMOVE_BY_DEFAULT)
{
@@ -1351,7 +1367,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (!caster)
break;
// Curse of Doom
- if (GetSpellProto()->SpellFamilyFlags[1] & 0x02)
+ if (GetSpellInfo()->SpellFamilyFlags[1] & 0x02)
{
if (removeMode == AURA_REMOVE_BY_DEATH)
{
@@ -1360,7 +1376,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
}
}
// Improved Fear
- else if (GetSpellProto()->SpellFamilyFlags[1] & 0x00000400)
+ else if (GetSpellInfo()->SpellFamilyFlags[1] & 0x00000400)
{
if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_WARLOCK, 98, 0))
{
@@ -1392,7 +1408,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (!caster)
break;
// Shadow word: Pain // Vampiric Touch
- if (removeMode == AURA_REMOVE_BY_ENEMY_SPELL && (GetSpellProto()->SpellFamilyFlags[0] & 0x00008000 || GetSpellProto()->SpellFamilyFlags[1] & 0x00000400))
+ if (removeMode == AURA_REMOVE_BY_ENEMY_SPELL && (GetSpellInfo()->SpellFamilyFlags[0] & 0x00008000 || GetSpellInfo()->SpellFamilyFlags[1] & 0x00000400))
{
// Shadow Affinity
if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 178, 1))
@@ -1402,7 +1418,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
}
}
// Power word: shield
- else if (removeMode == AURA_REMOVE_BY_ENEMY_SPELL && GetSpellProto()->SpellFamilyFlags[0] & 0x00000001)
+ else if (removeMode == AURA_REMOVE_BY_ENEMY_SPELL && GetSpellInfo()->SpellFamilyFlags[0] & 0x00000001)
{
// Rapture
if (Aura const* aura = caster->GetAuraOfRankedSpell(47535))
@@ -1468,13 +1484,13 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (!player->HasSpellCooldown(47788))
break;
- player->RemoveSpellCooldown(GetSpellProto()->Id, true);
- player->AddSpellCooldown(GetSpellProto()->Id, 0, uint32(time(NULL) + aurEff->GetAmount()));
+ player->RemoveSpellCooldown(GetSpellInfo()->Id, true);
+ player->AddSpellCooldown(GetSpellInfo()->Id, 0, uint32(time(NULL) + aurEff->GetAmount()));
WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+4+4);
data << uint64(player->GetGUID());
data << uint8(0x0); // flags (0x1, 0x2)
- data << uint32(GetSpellProto()->Id);
+ data << uint32(GetSpellInfo()->Id);
data << uint32(aurEff->GetAmount()*IN_MILLISECONDS);
player->SendDirectMessage(&data);
}
@@ -1495,7 +1511,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
// Blood of the North
// Reaping
// Death Rune Mastery
- if (GetSpellProto()->SpellIconID == 3041 || GetSpellProto()->SpellIconID == 22 || GetSpellProto()->SpellIconID == 2622)
+ if (GetSpellInfo()->SpellIconID == 3041 || GetSpellInfo()->SpellIconID == 22 || GetSpellInfo()->SpellIconID == 2622)
{
if (!GetEffect(0) || GetEffect(0)->GetAuraType() != SPELL_AURA_PERIODIC_DUMMY)
break;
@@ -1510,7 +1526,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
break;
case SPELLFAMILY_HUNTER:
// Glyph of Freezing Trap
- if (GetSpellProto()->SpellFamilyFlags[0] & 0x00000008)
+ if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00000008)
if (caster && caster->HasAura(56845))
target->CastSpell(target, 61394, true);
break;
@@ -1518,7 +1534,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
}
// mods at aura apply or remove
- switch (GetSpellProto()->SpellFamilyName)
+ switch (GetSpellInfo()->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
switch (GetId())
@@ -1533,7 +1549,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
break;
case SPELLFAMILY_ROGUE:
// Stealth
- if (GetSpellProto()->SpellFamilyFlags[0] & 0x00400000)
+ if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00400000)
{
// Master of subtlety
if (AuraEffect const* aurEff = target->GetAuraEffectOfRankedSpell(31221, 0))
@@ -1590,7 +1606,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
break;
if (apply)
{
- if ((GetSpellProto()->Id == 31821 && target->HasAura(19746, GetCasterGUID())) || (GetSpellProto()->Id == 19746 && target->HasAura(31821)))
+ if ((GetSpellInfo()->Id == 31821 && target->HasAura(19746, GetCasterGUID())) || (GetSpellInfo()->Id == 19746 && target->HasAura(31821)))
target->CastSpell(target, 64364, true);
}
else
@@ -1609,7 +1625,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
}
break;
case SPELLFAMILY_DEATHKNIGHT:
- if (GetSpellSpecific(GetSpellProto()) == SPELL_SPECIFIC_PRESENCE)
+ if (GetSpellInfo()->GetSpellSpecific() == SPELL_SPECIFIC_PRESENCE)
{
AuraEffect *bloodPresenceAura=0; // healing by damage done
AuraEffect *frostPresenceAura=0; // increased health
@@ -1670,7 +1686,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (unholyPresenceAura)
{
// Not listed as any effect, only base points set
- int32 basePoints0 = SpellMgr::CalculateSpellEffectAmount(unholyPresenceAura->GetSpellProto(), 1);
+ int32 basePoints0 = unholyPresenceAura->GetSpellInfo()->Effects[EFFECT_1].CalcValue();
target->CastCustomSpell(target, 63622, &basePoints0 , &basePoints0, &basePoints0, true, 0, unholyPresenceAura);
}
target->CastSpell(target, 49772, true);
@@ -1699,7 +1715,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
break;
case SPELLFAMILY_WARLOCK:
// Drain Soul - If the target is at or below 25% health, Drain Soul causes four times the normal damage
- if (GetSpellProto()->SpellFamilyFlags[0] & 0x00004000)
+ if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000)
{
if (!caster)
break;
@@ -1729,7 +1745,7 @@ bool Aura::CanBeAppliedOn(Unit* target)
if (GetOwner() != target)
return false;
// not selfcasted single target auras mustn't be applied
- if (GetCasterGUID() != GetOwner()->GetGUID() && IsSingleTargetSpell(GetSpellProto()))
+ if (GetCasterGUID() != GetOwner()->GetGUID() && GetSpellInfo()->IsSingleTarget())
return false;
return true;
}
@@ -1742,6 +1758,125 @@ bool Aura::CheckAreaTarget(Unit* target)
return CallScriptCheckAreaTargetHandlers(target);
}
+bool Aura::CanStackWith(Aura const* existingAura) const
+{
+ // Can stack with self
+ if (this == existingAura)
+ return true;
+
+ // Dynobj auras always stack
+ if (existingAura->GetType() == DYNOBJ_AURA_TYPE)
+ return true;
+
+ SpellInfo const* existingSpellInfo = existingAura->GetSpellInfo();
+ bool sameCaster = GetCasterGUID() == existingAura->GetCasterGUID();
+
+ // passive auras don't stack when cast by different casters, or with another rank of the spell
+ if (IsPassive() && (!sameCaster || !m_spellInfo->IsDifferentRankOf(existingSpellInfo)))
+ return false;
+
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ {
+ // 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())
+ return true;
+ }
+
+ // check spell specific stack rules
+ if (m_spellInfo->IsAuraExclusiveBySpecificWith(existingSpellInfo)
+ || (sameCaster && m_spellInfo->IsAuraExclusiveBySpecificPerCasterWith(existingSpellInfo)))
+ return false;
+
+ // check spell group stack rules
+ SpellGroupStackRule stackRule = sSpellMgr->CheckSpellGroupStackRules(m_spellInfo, existingSpellInfo);
+ if (stackRule)
+ {
+ if (stackRule == SPELL_GROUP_STACK_RULE_EXCLUSIVE)
+ return false;
+ if (sameCaster && stackRule == SPELL_GROUP_STACK_RULE_EXCLUSIVE_FROM_SAME_CASTER)
+ return false;
+ }
+
+ if (m_spellInfo->SpellFamilyName != existingSpellInfo->SpellFamilyName)
+ return true;
+
+ if (!sameCaster)
+ {
+ if (m_spellInfo->AttributesEx3 & SPELL_ATTR3_STACK_FOR_DIFF_CASTERS)
+ return true;
+
+ // check same periodic auras
+ for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ {
+ switch (m_spellInfo->Effects[i].ApplyAuraName)
+ {
+ // DOT or HOT from different casters will stack
+ case SPELL_AURA_PERIODIC_DAMAGE:
+ case SPELL_AURA_PERIODIC_DUMMY:
+ case SPELL_AURA_PERIODIC_HEAL:
+ case SPELL_AURA_PERIODIC_TRIGGER_SPELL:
+ case SPELL_AURA_PERIODIC_ENERGIZE:
+ case SPELL_AURA_PERIODIC_MANA_LEECH:
+ case SPELL_AURA_PERIODIC_LEECH:
+ case SPELL_AURA_POWER_BURN_MANA:
+ case SPELL_AURA_OBS_MOD_POWER:
+ case SPELL_AURA_OBS_MOD_HEALTH:
+ case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE:
+ // periodic auras which target areas are not allowed to stack this way (replenishment for example)
+ if (m_spellInfo->Effects[i].IsArea() || existingSpellInfo->Effects[i].IsArea())
+ break;
+ return true;
+ default:
+ break;
+ }
+ }
+ }
+
+ bool isVehicleAura1 = false;
+ bool isVehicleAura2 = false;
+ uint8 i = 0;
+ while (i < MAX_SPELL_EFFECTS && !(isVehicleAura1 && isVehicleAura2))
+ {
+ if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE)
+ isVehicleAura1 = true;
+ if (existingSpellInfo->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE)
+ isVehicleAura2 = true;
+
+ ++i;
+ }
+
+ if (isVehicleAura1 && isVehicleAura2)
+ {
+ Vehicle* veh = NULL;
+ if (GetOwner()->ToUnit())
+ veh = GetOwner()->ToUnit()->GetVehicleKit();
+
+ if (!veh) // We should probably just let it stack. Vehicle system will prevent undefined behaviour later
+ return true;
+
+ if (!veh->GetAvailableSeatCount())
+ return false; // No empty seat available
+
+ return true; // Empty seat available (skip rest)
+ }
+
+ // spell of same spell rank chain
+ if (m_spellInfo->IsRankOf(existingSpellInfo))
+ {
+ if (m_spellInfo->IsMultiSlotAura())
+ return true;
+ if (GetCastItemGUID() && existingAura->GetCastItemGUID())
+ if (GetCastItemGUID() != existingAura->GetCastItemGUID() && (m_spellInfo->AttributesCu & SPELL_ATTR0_CU_ENCHANT_PROC))
+ return true;
+ // same spell with same caster should not stack
+ return false;
+ }
+
+ return true;
+}
+
bool Aura::IsProcOnCooldown() const
{
/*if (m_procCooldown)
@@ -1803,7 +1938,7 @@ bool Aura::IsProcTriggeredOnEvent(AuraApplication* aurApp, ProcEventInfo& eventI
Unit* target = aurApp->GetTarget();
if (IsPassive() && target->GetTypeId() == TYPEID_PLAYER)
{
- if (GetSpellProto()->EquippedItemClass == ITEM_CLASS_WEAPON)
+ if (GetSpellInfo()->EquippedItemClass == ITEM_CLASS_WEAPON)
{
if (target->ToPlayer()->IsInFeralForm())
return false;
@@ -1819,15 +1954,15 @@ bool Aura::IsProcTriggeredOnEvent(AuraApplication* aurApp, ProcEventInfo& eventI
else
item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED);
- if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_WEAPON || !((1<<item->GetTemplate()->SubClass) & GetSpellProto()->EquippedItemSubClassMask))
+ if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_WEAPON || !((1<<item->GetTemplate()->SubClass) & GetSpellInfo()->EquippedItemSubClassMask))
return false;
}
}
- else if (GetSpellProto()->EquippedItemClass == ITEM_CLASS_ARMOR)
+ else if (GetSpellInfo()->EquippedItemClass == ITEM_CLASS_ARMOR)
{
// Check if player is wearing shield
Item *item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
- if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_ARMOR || !((1<<item->GetTemplate()->SubClass) & GetSpellProto()->EquippedItemSubClassMask))
+ if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_ARMOR || !((1<<item->GetTemplate()->SubClass) & GetSpellInfo()->EquippedItemSubClassMask))
return false;
}
}
@@ -1846,7 +1981,7 @@ float Aura::CalcProcChance(SpellProcEntry const& procEntry, ProcEventInfo& event
if (eventInfo.GetDamageInfo() && procEntry.ratePerMinute != 0)
{
uint32 WeaponSpeed = caster->GetAttackTime(eventInfo.GetDamageInfo()->GetAttackType());
- chance = caster->GetPPMProcChance(WeaponSpeed, procEntry.ratePerMinute, GetSpellProto());
+ chance = caster->GetPPMProcChance(WeaponSpeed, procEntry.ratePerMinute, GetSpellInfo());
}
// apply chance modifer aura, applies also to ppm chance (see improved judgement of light spell)
if (Player* modOwner = caster->GetSpellModOwner())
@@ -1880,7 +2015,7 @@ void Aura::_DeleteRemovedApplications()
void Aura::LoadScripts()
{
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Aura::LoadScripts");
- sScriptMgr->CreateAuraScripts(m_spellProto->Id, m_loadedScripts);
+ sScriptMgr->CreateAuraScripts(m_spellInfo->Id, m_loadedScripts);
for (std::list<AuraScript *>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end() ;)
{
if (!(*itr)->_Load(this))
@@ -1918,7 +2053,7 @@ bool Aura::CallScriptEffectApplyHandlers(AuraEffect const* aurEff, AuraApplicati
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectApply.end(), effItr = (*scritr)->OnEffectApply.begin();
for (; effItr != effEndItr ; ++effItr)
{
- if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
+ if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, mode);
}
if (!preventDefault)
@@ -1937,7 +2072,7 @@ bool Aura::CallScriptEffectRemoveHandlers(AuraEffect const* aurEff, AuraApplicat
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectRemove.end(), effItr = (*scritr)->OnEffectRemove.begin();
for (; effItr != effEndItr ; ++effItr)
{
- if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
+ if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, mode);
}
if (!preventDefault)
@@ -1955,7 +2090,7 @@ void Aura::CallScriptAfterEffectApplyHandlers(AuraEffect const* aurEff, AuraAppl
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectApply.end(), effItr = (*scritr)->AfterEffectApply.begin();
for (; effItr != effEndItr ; ++effItr)
{
- if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
+ if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, mode);
}
(*scritr)->_FinishScriptCall();
@@ -1970,7 +2105,7 @@ void Aura::CallScriptAfterEffectRemoveHandlers(AuraEffect const* aurEff, AuraApp
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectRemove.end(), effItr = (*scritr)->AfterEffectRemove.begin();
for (; effItr != effEndItr ; ++effItr)
{
- if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
+ if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, mode);
}
(*scritr)->_FinishScriptCall();
@@ -1986,7 +2121,7 @@ bool Aura::CallScriptEffectPeriodicHandlers(AuraEffect const* aurEff, AuraApplic
std::list<AuraScript::EffectPeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectPeriodic.end(), effItr = (*scritr)->OnEffectPeriodic.begin();
for (; effItr != effEndItr ; ++effItr)
{
- if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
+ if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff);
}
if (!preventDefault)
@@ -2004,7 +2139,7 @@ void Aura::CallScriptEffectUpdatePeriodicHandlers(AuraEffect * aurEff)
std::list<AuraScript::EffectUpdatePeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectUpdatePeriodic.end(), effItr = (*scritr)->OnEffectUpdatePeriodic.begin();
for (; effItr != effEndItr ; ++effItr)
{
- if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
+ if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff);
}
(*scritr)->_FinishScriptCall();
@@ -2019,7 +2154,7 @@ void Aura::CallScriptEffectCalcAmountHandlers(AuraEffect const* aurEff, int32 &
std::list<AuraScript::EffectCalcAmountHandler>::iterator effEndItr = (*scritr)->DoEffectCalcAmount.end(), effItr = (*scritr)->DoEffectCalcAmount.begin();
for (; effItr != effEndItr ; ++effItr)
{
- if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
+ if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, amount, canBeRecalculated);
}
(*scritr)->_FinishScriptCall();
@@ -2034,7 +2169,7 @@ void Aura::CallScriptEffectCalcPeriodicHandlers(AuraEffect const* aurEff, bool &
std::list<AuraScript::EffectCalcPeriodicHandler>::iterator effEndItr = (*scritr)->DoEffectCalcPeriodic.end(), effItr = (*scritr)->DoEffectCalcPeriodic.begin();
for (; effItr != effEndItr ; ++effItr)
{
- if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
+ if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, isPeriodic, amplitude);
}
(*scritr)->_FinishScriptCall();
@@ -2049,7 +2184,7 @@ void Aura::CallScriptEffectCalcSpellModHandlers(AuraEffect const* aurEff, SpellM
std::list<AuraScript::EffectCalcSpellModHandler>::iterator effEndItr = (*scritr)->DoEffectCalcSpellMod.end(), effItr = (*scritr)->DoEffectCalcSpellMod.begin();
for (; effItr != effEndItr ; ++effItr)
{
- if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
+ if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, spellMod);
}
(*scritr)->_FinishScriptCall();
@@ -2064,7 +2199,7 @@ void Aura::CallScriptEffectAbsorbHandlers(AuraEffect * aurEff, AuraApplication c
std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->OnEffectAbsorb.end(), effItr = (*scritr)->OnEffectAbsorb.begin();
for (; effItr != effEndItr ; ++effItr)
{
- if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
+ if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
}
(*scritr)->_FinishScriptCall();
@@ -2079,7 +2214,7 @@ void Aura::CallScriptEffectAfterAbsorbHandlers(AuraEffect * aurEff, AuraApplicat
std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->AfterEffectAbsorb.end(), effItr = (*scritr)->AfterEffectAbsorb.begin();
for (; effItr != effEndItr ; ++effItr)
{
- if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
+ if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
}
(*scritr)->_FinishScriptCall();
@@ -2094,7 +2229,7 @@ void Aura::CallScriptEffectManaShieldHandlers(AuraEffect * aurEff, AuraApplicati
std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->OnEffectManaShield.end(), effItr = (*scritr)->OnEffectManaShield.begin();
for (; effItr != effEndItr ; ++effItr)
{
- if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
+ if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
}
(*scritr)->_FinishScriptCall();
@@ -2109,14 +2244,14 @@ void Aura::CallScriptEffectAfterManaShieldHandlers(AuraEffect * aurEff, AuraAppl
std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->AfterEffectManaShield.end(), effItr = (*scritr)->AfterEffectManaShield.begin();
for (; effItr != effEndItr ; ++effItr)
{
- if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
+ if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
}
(*scritr)->_FinishScriptCall();
}
}
-UnitAura::UnitAura(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID)
+UnitAura::UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID)
: Aura(spellproto, owner, caster, castItem, casterGUID)
{
m_AuraDRGroup = DIMINISHING_NONE;
@@ -2162,24 +2297,17 @@ void UnitAura::FillTargetMap(std::map<Unit *, uint8> & targets, Unit* caster)
continue;
UnitList targetList;
// non-area aura
- if (GetSpellProto()->Effect[effIndex] == SPELL_EFFECT_APPLY_AURA)
+ if (GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_APPLY_AURA)
{
targetList.push_back(GetUnitOwner());
}
else
{
- float radius;
- if (GetSpellProto()->Effect[effIndex] == SPELL_EFFECT_APPLY_AREA_AURA_ENEMY)
- radius = GetSpellRadiusForHostile(sSpellRadiusStore.LookupEntry(GetSpellProto()->EffectRadiusIndex[effIndex]));
- else
- radius = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(GetSpellProto()->EffectRadiusIndex[effIndex]));
-
- if (modOwner)
- modOwner->ApplySpellMod(GetId(), SPELLMOD_RADIUS, radius);
+ float radius = GetSpellInfo()->Effects[effIndex].CalcRadius(caster);
if (!GetUnitOwner()->HasUnitState(UNIT_STAT_ISOLATED))
{
- switch(GetSpellProto()->Effect[effIndex])
+ switch(GetSpellInfo()->Effects[effIndex].Effect)
{
case SPELL_EFFECT_APPLY_AREA_AURA_PARTY:
targetList.push_back(GetUnitOwner());
@@ -2228,7 +2356,7 @@ void UnitAura::FillTargetMap(std::map<Unit *, uint8> & targets, Unit* caster)
}
}
-DynObjAura::DynObjAura(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID)
+DynObjAura::DynObjAura(SpellInfo const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID)
: Aura(spellproto, owner, caster, castItem, casterGUID)
{
LoadScripts();
@@ -2256,8 +2384,8 @@ void DynObjAura::FillTargetMap(std::map<Unit *, uint8> & targets, Unit* /*caster
if (!HasEffect(effIndex))
continue;
UnitList targetList;
- if (GetSpellProto()->EffectImplicitTargetB[effIndex] == TARGET_DEST_DYNOBJ_ALLY
- || GetSpellProto()->EffectImplicitTargetB[effIndex] == TARGET_UNIT_AREA_ALLY_DST)
+ if (GetSpellInfo()->Effects[effIndex].TargetB == TARGET_DEST_DYNOBJ_ALLY
+ || GetSpellInfo()->Effects[effIndex].TargetB == TARGET_UNIT_AREA_ALLY_DST)
{
Trinity::AnyFriendlyUnitInObjectRangeCheck u_check(GetDynobjOwner(), dynObjOwnerCaster, radius);
Trinity::UnitListSearcher<Trinity::AnyFriendlyUnitInObjectRangeCheck> searcher(GetDynobjOwner(), targetList, u_check);
diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h
index 6ba2f7fe749..2a2a3e69b4f 100755
--- a/src/server/game/Spells/Auras/SpellAuras.h
+++ b/src/server/game/Spells/Auras/SpellAuras.h
@@ -20,9 +20,10 @@
#define TRINITY_SPELLAURAS_H
#include "SpellAuraDefines.h"
+#include "SpellInfo.h"
class Unit;
-struct SpellEntry;
+class SpellInfo;
struct SpellModifier;
struct ProcTriggerSpell;
struct SpellProcEntry;
@@ -82,20 +83,20 @@ class AuraApplication
class Aura
{
- friend Aura * Unit::_TryStackingOrRefreshingExistingAura(SpellEntry const* newAura, uint8 effMask, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
+ friend Aura * Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
public:
typedef std::map<uint64, AuraApplication *> ApplicationMap;
- static uint8 BuildEffectMaskForOwner(SpellEntry const* spellProto, uint8 avalibleEffectMask, WorldObject* owner);
- static Aura* TryRefreshStackOrCreate(SpellEntry const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0, bool* refresh = NULL);
- static Aura* TryCreate(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0);
- static Aura* Create(SpellEntry const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID);
- explicit Aura(SpellEntry const* spellproto, WorldObject * owner, Unit* caster, Item* castItem, uint64 casterGUID);
+ static uint8 BuildEffectMaskForOwner(SpellInfo const* spellProto, uint8 avalibleEffectMask, WorldObject* owner);
+ static Aura* TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0, bool* refresh = NULL);
+ static Aura* TryCreate(SpellInfo const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0);
+ static Aura* Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID);
+ explicit Aura(SpellInfo const* spellproto, WorldObject * owner, Unit* caster, Item* castItem, uint64 casterGUID);
void _InitEffects(uint8 effMask, Unit* caster, int32 *baseAmount);
virtual ~Aura();
- SpellEntry const* GetSpellProto() const { return m_spellProto; }
- uint32 GetId() const{ return GetSpellProto()->Id; }
+ SpellInfo const* GetSpellInfo() const { return m_spellInfo; }
+ uint32 GetId() const{ return GetSpellInfo()->Id; }
uint64 GetCastItemGUID() const { return m_castItemGuid; }
uint64 const& GetCasterGUID() const { return m_casterGuid; }
@@ -150,7 +151,7 @@ class Aura
bool IsPassive() const;
bool IsDeathPersistent() const;
- bool IsRemovedOnShapeLost(Unit* target) const { return (GetCasterGUID() == target->GetGUID() && m_spellProto->Stances && !(m_spellProto->AttributesEx2 & SPELL_ATTR2_NOT_NEED_SHAPESHIFT) && !(m_spellProto->Attributes & SPELL_ATTR0_NOT_SHAPESHIFT)); }
+ bool IsRemovedOnShapeLost(Unit* target) const { return (GetCasterGUID() == target->GetGUID() && m_spellInfo->Stances && !(m_spellInfo->AttributesEx2 & SPELL_ATTR2_NOT_NEED_SHAPESHIFT) && !(m_spellInfo->Attributes & SPELL_ATTR0_NOT_SHAPESHIFT)); }
bool CanBeSaved() const;
bool IsRemoved() const { return m_isRemoved; }
bool CanBeSentToClient() const;
@@ -158,6 +159,7 @@ class Aura
bool IsSingleTarget() const {return m_isSingleTarget;}
void SetIsSingleTarget(bool val) { m_isSingleTarget = val;}
void UnregisterSingleTarget();
+ int32 CalcDispelChance(Unit* auraTarget, bool offensive) const;
void SetLoadedState(int32 maxduration, int32 duration, int32 charges, uint8 stackamount, uint8 recalculateMask, int32 * amount);
@@ -180,6 +182,7 @@ class Aura
void HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, bool apply, bool onReapply);
bool CanBeAppliedOn(Unit* target);
bool CheckAreaTarget(Unit* target);
+ bool CanStackWith(Aura const* existingAura) const;
// Proc system
bool IsProcOnCooldown() const;
@@ -191,7 +194,6 @@ class Aura
float CalcProcChance(SpellProcEntry const& procEntry, ProcEventInfo& eventInfo) const;
void TriggerProcOnEvent(AuraApplication* aurApp, ProcEventInfo& eventInfo);
-
// AuraScript
void LoadScripts();
bool CallScriptCheckAreaTargetHandlers(Unit* target);
@@ -212,7 +214,7 @@ class Aura
private:
void _DeleteRemovedApplications();
protected:
- SpellEntry const* const m_spellProto;
+ SpellInfo const* const m_spellInfo;
uint64 const m_casterGuid;
uint64 const m_castItemGuid; // it is NOT safe to keep a pointer to the item because it may get deleted
time_t const m_applyTime;
@@ -240,9 +242,9 @@ class Aura
class UnitAura : public Aura
{
- friend Aura * Aura::Create(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
+ friend Aura * Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
protected:
- explicit UnitAura(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
+ explicit UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
public:
void _ApplyForTarget(Unit* target, Unit* caster, AuraApplication * aurApp);
void _UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * aurApp);
@@ -261,9 +263,9 @@ class UnitAura : public Aura
class DynObjAura : public Aura
{
- friend Aura * Aura::Create(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
+ friend Aura * Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
protected:
- explicit DynObjAura(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
+ explicit DynObjAura(SpellInfo const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
public:
void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 5ac19c3d6c5..7080d7629a9 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -52,6 +52,7 @@
#include "DisableMgr.h"
#include "SpellScript.h"
#include "InstanceScript.h"
+#include "SpellInfo.h"
extern pEffect SpellEffects[TOTAL_SPELL_EFFECTS];
@@ -439,17 +440,25 @@ void SpellCastTargets::OutDebug() const
sLog->outString("elevation: %f", m_elevation);
}
-Spell::Spell(Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID, bool skipCheck, bool castedClientside):
+SpellValue::SpellValue(SpellInfo const* proto)
+{
+ for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ EffectBasePoints[i] = proto->Effects[i].BasePoints;
+ MaxAffectedTargets = proto->MaxAffectedTargets;
+ RadiusMod = 1.0f;
+ AuraStackAmount = 1;
+}
+
+Spell::Spell(Unit* Caster, SpellInfo const *info, bool triggered, uint64 originalCasterGUID, bool skipCheck, bool castedClientside):
m_spellInfo(sSpellMgr->GetSpellForDifficultyFromSpell(info, Caster)),
m_caster(Caster), m_spellValue(new SpellValue(m_spellInfo))
{
- m_customAttr = sSpellMgr->GetSpellCustomAttr(m_spellInfo->Id);
m_customError = SPELL_CUSTOM_ERROR_NONE;
m_skipCheck = skipCheck;
m_selfContainer = NULL;
m_referencedFromCurrentSpell = false;
m_executedCurrently = false;
- m_needComboPoints = NeedsComboPoints(m_spellInfo);
+ m_needComboPoints = m_spellInfo->NeedsComboPoints();
m_comboPointGain = 0;
m_delayStart = 0;
m_delayAtDamageCount = 0;
@@ -468,7 +477,7 @@ m_caster(Caster), m_spellValue(new SpellValue(m_spellInfo))
m_attackType = BASE_ATTACK;
break;
case SPELL_DAMAGE_CLASS_RANGED:
- m_attackType = IsRangedWeaponSpell(m_spellInfo) ? RANGED_ATTACK : BASE_ATTACK;
+ m_attackType = m_spellInfo->IsRangedWeaponSpell() ? RANGED_ATTACK : BASE_ATTACK;
break;
default:
// Wands
@@ -479,7 +488,7 @@ m_caster(Caster), m_spellValue(new SpellValue(m_spellInfo))
break;
}
- m_spellSchoolMask = GetSpellSchoolMask(info); // Can be override for some spell (wand shoot for example)
+ m_spellSchoolMask = info->GetSchoolMask(); // Can be override for some spell (wand shoot for example)
if (m_attackType == RANGED_ATTACK)
// wand case
@@ -517,7 +526,7 @@ m_caster(Caster), m_spellValue(new SpellValue(m_spellInfo))
m_spellAura = NULL;
//Auto Shot & Shoot (wand)
- m_autoRepeat = IsAutoRepeatRangedSpell(m_spellInfo);
+ m_autoRepeat = m_spellInfo->IsAutoRepeatRangedSpell();
m_runesState = 0;
m_powerCost = 0; // setup to correct value in Spell::prepare, don't must be used before.
@@ -530,7 +539,7 @@ m_caster(Caster), m_spellValue(new SpellValue(m_spellInfo))
// Patch 1.2 notes: Spell Reflection no longer reflects abilities
m_canReflect = m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && !(m_spellInfo->Attributes & SPELL_ATTR0_ABILITY)
&& !(m_spellInfo->AttributesEx & SPELL_ATTR1_CANT_BE_REFLECTED) && !(m_spellInfo->Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY)
- && !IsPassiveSpell(m_spellInfo) && !IsPositiveSpell(m_spellInfo->Id);
+ && !m_spellInfo->IsPassive() && !m_spellInfo->IsPositive();
CleanupTargetList();
CleanupEffectExecuteData();
@@ -566,7 +575,7 @@ template<typename T>
WorldObject* Spell::FindCorpseUsing()
{
// non-standard target selection
- float max_range = GetSpellMaxRange(m_spellInfo, false);
+ float max_range = m_spellInfo->GetMaxRange(false);
CellPair p(Trinity::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY()));
Cell cell(p);
@@ -596,22 +605,22 @@ void Spell::SelectSpellTargets()
{
// not call for empty effect.
// Also some spells use not used effect targets for store targets for dummy effect in triggered spells
- if (!m_spellInfo->Effect[i])
+ if (!m_spellInfo->Effects[i].Effect)
continue;
- uint32 effectTargetType = EffectTargetType[m_spellInfo->Effect[i]];
+ uint32 effectTargetType = m_spellInfo->Effects[i].GetRequiredTargetType();
// is it possible that areaaura is not applied to caster?
if (effectTargetType == SPELL_REQUIRE_NONE)
continue;
- uint32 targetA = m_spellInfo->EffectImplicitTargetA[i];
- uint32 targetB = m_spellInfo->EffectImplicitTargetB[i];
+ uint32 targetA = m_spellInfo->Effects[i].TargetA;
+ uint32 targetB = m_spellInfo->Effects[i].TargetA;
if (targetA)
- SelectEffectTargets(i, targetA);
+ SelectEffectTargets(i, m_spellInfo->Effects[i].TargetA);
if (targetB) // In very rare case !A && B
- SelectEffectTargets(i, targetB);
+ SelectEffectTargets(i, m_spellInfo->Effects[i].TargetB);
if (effectTargetType != SPELL_REQUIRE_UNIT)
{
@@ -625,7 +634,7 @@ void Spell::SelectSpellTargets()
if (!targetA && !targetB)
{
- if (!GetSpellMaxRangeForFriend(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)))
+ if (!m_spellInfo->GetMaxRange(true))
{
AddUnitTarget(m_caster, i);
continue;
@@ -633,7 +642,7 @@ void Spell::SelectSpellTargets()
// add here custom effects that need default target.
// FOR EVERY TARGET TYPE THERE IS A DIFFERENT FILL!!
- switch(m_spellInfo->Effect[i])
+ switch(m_spellInfo->Effects[i].Effect)
{
case SPELL_EFFECT_DUMMY:
{
@@ -698,7 +707,7 @@ void Spell::SelectSpellTargets()
if (m_targets.GetUnitTarget())
AddUnitTarget(m_targets.GetUnitTarget(), i);
// Triggered spells have additional spell targets - cast them even if no explicit unit target is given (required for spell 50516 for example)
- else if (m_spellInfo->Effect[i] == SPELL_EFFECT_TRIGGER_SPELL)
+ else if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_TRIGGER_SPELL)
AddUnitTarget(m_caster, i);
break;
case SPELL_EFFECT_SUMMON_PLAYER:
@@ -737,7 +746,7 @@ void Spell::SelectSpellTargets()
AddUnitTarget(pet, i);
break;
case SPELL_EFFECT_APPLY_AURA:
- switch(m_spellInfo->EffectApplyAuraName[i])
+ switch(m_spellInfo->Effects[i].ApplyAuraName)
{
case SPELL_AURA_ADD_FLAT_MODIFIER: // some spell mods auras have 0 target modes instead expected TARGET_UNIT_CASTER(1) (and present for other ranks for same spell for example)
case SPELL_AURA_ADD_PCT_MODIFIER:
@@ -768,7 +777,7 @@ void Spell::SelectSpellTargets()
break;
}
}
- if (IsChanneledSpell(m_spellInfo))
+ if (m_spellInfo->IsChanneled())
{
uint8 mask = (1<<i);
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
@@ -813,10 +822,10 @@ void Spell::SelectSpellTargets()
if (speed > 0.0f)
m_delayMoment = (uint64)floor(m_targets.GetDist2d() / speed * 1000.0f);
}
- else if (m_spellInfo->speed > 0.0f)
+ else if (m_spellInfo->Speed > 0.0f)
{
float dist = m_caster->GetDistance(*m_targets.GetDst());
- m_delayMoment = (uint64) floor(dist / m_spellInfo->speed * 1000.0f);
+ m_delayMoment = (uint64) floor(dist / m_spellInfo->Speed * 1000.0f);
}
}
}
@@ -912,7 +921,7 @@ void Spell::CleanupTargetList()
void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
{
- if (m_spellInfo->Effect[effIndex] == 0)
+ if (!m_spellInfo->Effects[effIndex].IsEffect())
return;
if (!CheckTarget(pVictim, effIndex))
@@ -933,8 +942,8 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
ihit->scaleAura = false;
if (m_auraScaleMask && ihit->effectMask == m_auraScaleMask && m_caster != pVictim)
{
- SpellEntry const* auraSpell = sSpellStore.LookupEntry(sSpellMgr->GetFirstSpellInChain(m_spellInfo->Id));
- if (uint32(pVictim->getLevel() + 10) >= auraSpell->spellLevel)
+ SpellInfo const* auraSpell = sSpellMgr->GetSpellInfo(sSpellMgr->GetFirstSpellInChain(m_spellInfo->Id));
+ if (uint32(pVictim->getLevel() + 10) >= auraSpell->SpellLevel)
ihit->scaleAura = true;
}
return;
@@ -954,8 +963,8 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
target.scaleAura = false;
if (m_auraScaleMask && target.effectMask == m_auraScaleMask && m_caster != pVictim)
{
- SpellEntry const* auraSpell = sSpellStore.LookupEntry(sSpellMgr->GetFirstSpellInChain(m_spellInfo->Id));
- if (uint32(pVictim->getLevel() + 10) >= auraSpell->spellLevel)
+ SpellInfo const* auraSpell = sSpellMgr->GetSpellInfo(sSpellMgr->GetFirstSpellInChain(m_spellInfo->Id));
+ if (uint32(pVictim->getLevel() + 10) >= auraSpell->SpellLevel)
target.scaleAura = true;
}
@@ -971,14 +980,14 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
// Spell have speed - need calculate incoming time
// Incoming time is zero for self casts. At least I think so.
- if (m_spellInfo->speed > 0.0f && m_caster != pVictim)
+ if (m_spellInfo->Speed > 0.0f && m_caster != pVictim)
{
// calculate spell incoming interval
// TODO: this is a hack
float dist = m_caster->GetDistance(pVictim->GetPositionX(), pVictim->GetPositionY(), pVictim->GetPositionZ());
if (dist < 5.0f) dist = 5.0f;
- target.timeDelay = (uint64) floor(dist / m_spellInfo->speed * 1000.0f);
+ target.timeDelay = (uint64) floor(dist / m_spellInfo->Speed * 1000.0f);
// Calculate minimum incoming time
if (m_delayMoment == 0 || m_delayMoment>target.timeDelay)
@@ -1014,10 +1023,10 @@ void Spell::AddUnitTarget(uint64 unitGUID, uint32 effIndex)
void Spell::AddGOTarget(GameObject* go, uint32 effIndex)
{
- if (m_spellInfo->Effect[effIndex] == 0)
+ if (!m_spellInfo->Effects[effIndex].IsEffect())
return;
- switch (m_spellInfo->Effect[effIndex])
+ switch (m_spellInfo->Effects[effIndex].Effect)
{
case SPELL_EFFECT_GAMEOBJECT_DAMAGE:
case SPELL_EFFECT_GAMEOBJECT_REPAIR:
@@ -1049,13 +1058,13 @@ void Spell::AddGOTarget(GameObject* go, uint32 effIndex)
target.processed = false; // Effects not apply on target
// Spell have speed - need calculate incoming time
- if (m_spellInfo->speed > 0.0f)
+ if (m_spellInfo->Speed > 0.0f)
{
// calculate spell incoming interval
float dist = m_caster->GetDistance(go->GetPositionX(), go->GetPositionY(), go->GetPositionZ());
if (dist < 5.0f)
dist = 5.0f;
- target.timeDelay = uint64(floor(dist / m_spellInfo->speed * 1000.0f));
+ target.timeDelay = uint64(floor(dist / m_spellInfo->Speed * 1000.0f));
if (m_delayMoment == 0 || m_delayMoment > target.timeDelay)
m_delayMoment = target.timeDelay;
}
@@ -1074,7 +1083,7 @@ void Spell::AddGOTarget(uint64 goGUID, uint32 effIndex)
void Spell::AddItemTarget(Item* pitem, uint32 effIndex)
{
- if (m_spellInfo->Effect[effIndex] == 0)
+ if (!m_spellInfo->Effects[effIndex].IsEffect())
return;
// Lookup target in already in list
@@ -1109,7 +1118,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
uint8 farMask = 0;
// create far target mask
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (IsFarUnitTargetEffect(m_spellInfo->Effect[i]))
+ if (m_spellInfo->Effects[i].IsFarUnitTargetEffect())
if ((1 << i) & mask)
farMask |= (1 << i);
@@ -1131,7 +1140,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
if (unit->isAlive() != target->alive)
return;
- if (getState() == SPELL_STATE_DELAYED && !IsPositiveSpell(m_spellInfo->Id) && (getMSTime() - target->timeDelay) <= unit->m_lastSanctuaryTime)
+ if (getState() == SPELL_STATE_DELAYED && !m_spellInfo->IsPositive() && (getMSTime() - target->timeDelay) <= unit->m_lastSanctuaryTime)
return; // No missinfo in that case
// Get original caster (if exist) and calculate damage/healing from him data
@@ -1211,7 +1220,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
{
for (uint8 i = 0; i< MAX_SPELL_EFFECTS; ++i)
// If at least one effect negative spell is negative hit
- if (mask & (1<<i) && !IsPositiveEffect(m_spellInfo->Id, i))
+ if (mask & (1<<i) && !m_spellInfo->IsPositiveEffect(i))
{
positive = false;
break;
@@ -1313,7 +1322,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
caster->ProcDamageAndSpell(unit, procAttacker, procVictim, procEx, 0, m_attackType, m_spellInfo, m_triggeredByAuraSpell);
// Failed Pickpocket, reveal rogue
- if (missInfo == SPELL_MISS_RESIST && m_customAttr & SPELL_ATTR0_CU_PICKPOCKET && unitTarget->GetTypeId() == TYPEID_UNIT)
+ if (missInfo == SPELL_MISS_RESIST && m_spellInfo->AttributesCu & SPELL_ATTR0_CU_PICKPOCKET && unitTarget->GetTypeId() == TYPEID_UNIT)
{
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TALK);
if (unitTarget->ToCreature()->IsAIEnabled)
@@ -1321,11 +1330,11 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
}
}
- if (missInfo != SPELL_MISS_EVADE && m_caster && !m_caster->IsFriendlyTo(unit) && !IsPositiveSpell(m_spellInfo->Id))
+ if (missInfo != SPELL_MISS_EVADE && m_caster && !m_caster->IsFriendlyTo(unit) && !m_spellInfo->IsPositive())
{
m_caster->CombatStart(unit, !(m_spellInfo->AttributesEx3 & SPELL_ATTR3_NO_INITIAL_AGGRO));
- if (m_customAttr & SPELL_ATTR0_CU_AURA_CC)
+ if (m_spellInfo->AttributesCu & SPELL_ATTR0_CU_AURA_CC)
if (!unit->IsStandState())
unit->SetStandState(UNIT_STAND_STATE_STAND);
}
@@ -1368,7 +1377,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
return SPELL_MISS_EVADE;
// Recheck immune (only for delayed spells)
- if (m_spellInfo->speed && (unit->IsImmunedToDamage(m_spellInfo) || unit->IsImmunedToSpell(m_spellInfo)))
+ if (m_spellInfo->Speed && (unit->IsImmunedToDamage(m_spellInfo) || unit->IsImmunedToSpell(m_spellInfo)))
return SPELL_MISS_IMMUNE;
PrepareScriptHitHandlers();
@@ -1390,7 +1399,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
if (m_caster != unit)
{
// Recheck UNIT_FLAG_NON_ATTACKABLE for delayed spells
- if (m_spellInfo->speed > 0.0f && unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) && unit->GetCharmerOrOwnerGUID() != m_caster->GetGUID())
+ if (m_spellInfo->Speed > 0.0f && unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) && unit->GetCharmerOrOwnerGUID() != m_caster->GetGUID())
return SPELL_MISS_EVADE;
// check for IsHostileTo() instead of !IsFriendlyTo()
@@ -1399,14 +1408,14 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
{
unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_HITBYSPELL);
//TODO: This is a hack. But we do not know what types of stealth should be interrupted by CC
- if ((m_customAttr & SPELL_ATTR0_CU_AURA_CC) && unit->IsControlledByPlayer())
+ if ((m_spellInfo->AttributesCu & SPELL_ATTR0_CU_AURA_CC) && unit->IsControlledByPlayer())
unit->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
}
else if (m_caster->IsFriendlyTo(unit))
{
// for delayed spells ignore negative spells (after duel end) for friendly targets
// TODO: this cause soul transfer bugged
- if (m_spellInfo->speed > 0.0f && unit->GetTypeId() == TYPEID_PLAYER && !IsPositiveSpell(m_spellInfo->Id))
+ if (m_spellInfo->Speed > 0.0f && unit->GetTypeId() == TYPEID_PLAYER && !m_spellInfo->IsPositive())
return SPELL_MISS_EVADE;
// assisting case, healing and resurrection
@@ -1437,23 +1446,23 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
uint8 aura_effmask = 0;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (effectMask & (1 <<i ) && IsUnitOwnedAuraEffect(m_spellInfo->Effect[i]))
+ if (effectMask & (1 <<i ) && m_spellInfo->Effects[i].IsUnitOwnedAuraEffect())
aura_effmask |= 1 << i;
if (aura_effmask)
{
// Select rank for aura with level requirements only in specific cases
// Unit has to be target only of aura effect, both caster and target have to be players, target has to be other than unit target
- SpellEntry const* aurSpellInfo = m_spellInfo;
+ SpellInfo const* aurSpellInfo = m_spellInfo;
int32 basePoints[3];
if (scaleAura)
{
- aurSpellInfo = sSpellMgr->SelectAuraRankForPlayerLevel(m_spellInfo, unitTarget->getLevel());
+ aurSpellInfo = m_spellInfo->GetAuraRankForLevel(unitTarget->getLevel());
ASSERT(aurSpellInfo);
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- basePoints[i] = aurSpellInfo->EffectBasePoints[i];
- if (m_spellInfo->Effect[i] != aurSpellInfo->Effect[i])
+ basePoints[i] = aurSpellInfo->Effects[i].BasePoints;
+ if (m_spellInfo->Effects[i].Effect != aurSpellInfo->Effects[i].Effect)
{
aurSpellInfo = m_spellInfo;
break;
@@ -1485,7 +1494,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
((UnitAura*)m_spellAura)->SetDiminishGroup(m_diminishGroup);
- bool positive = IsPositiveSpell(m_spellAura->GetId());
+ bool positive = m_spellAura->GetSpellInfo()->IsPositive();
AuraApplication * aurApp = m_spellAura->GetApplicationOfTarget(m_originalCaster->GetGUID());
if (aurApp)
positive = aurApp->IsPositive();
@@ -1493,7 +1502,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
duration = m_originalCaster->ModSpellDuration(aurSpellInfo, unit, duration, positive);
// Haste modifies duration of channeled spells
- if (IsChanneledSpell(m_spellInfo))
+ if (m_spellInfo->IsChanneled())
{
if (m_spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION)
m_originalCaster->ModSpellCastTime(aurSpellInfo, duration, this);
@@ -1539,7 +1548,7 @@ void Spell::DoTriggersOnSpellHit(Unit *unit, uint8 effMask)
// Cast the serverside immunity shield marker
m_caster->CastSpell(unit, 61988, true);
- if (sSpellStore.LookupEntry(m_preCastSpell))
+ if (sSpellMgr->GetSpellInfo(m_preCastSpell))
// Blizz seems to just apply aura without bothering to cast
m_caster->AddAura(m_preCastSpell, unit);
}
@@ -1560,7 +1569,7 @@ void Spell::DoTriggersOnSpellHit(Unit *unit, uint8 effMask)
// SPELL_AURA_ADD_TARGET_TRIGGER auras shouldn't trigger auras without duration
// set duration of current aura to the triggered spell
- if (GetSpellDuration(i->first) == -1)
+ if (i->first->GetDuration() == -1)
{
if (Aura * triggeredAur = unit->GetAura(i->first->Id, m_caster->GetGUID()))
{
@@ -1579,13 +1588,12 @@ void Spell::DoTriggersOnSpellHit(Unit *unit, uint8 effMask)
// trigger linked auras remove/apply
// TODO: remove/cleanup this, as this table is not documented and people are doing stupid things with it
- if (m_customAttr & SPELL_ATTR0_CU_LINK_HIT)
- if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(m_spellInfo->Id + SPELL_LINK_HIT))
- for (std::vector<int32>::const_iterator i = spellTriggered->begin(); i != spellTriggered->end(); ++i)
- if (*i < 0)
- unit->RemoveAurasDueToSpell(-(*i));
- else
- unit->CastSpell(unit, *i, true, 0, 0, m_caster->GetGUID());
+ if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(m_spellInfo->Id + SPELL_LINK_HIT))
+ for (std::vector<int32>::const_iterator i = spellTriggered->begin(); i != spellTriggered->end(); ++i)
+ if (*i < 0)
+ unit->RemoveAurasDueToSpell(-(*i));
+ else
+ unit->CastSpell(unit, *i, true, 0, 0, m_caster->GetGUID());
}
void Spell::DoAllEffectOnTarget(GOTargetInfo *target)
@@ -1646,7 +1654,7 @@ bool Spell::UpdateChanneledTargetList()
uint8 channelTargetEffectMask = m_channelTargetEffectMask;
uint8 channelAuraMask = 0;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (m_spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA)
+ if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_APPLY_AURA)
channelAuraMask |= 1<<i;
channelAuraMask &= channelTargetEffectMask;
@@ -1654,7 +1662,7 @@ bool Spell::UpdateChanneledTargetList()
float range = 0;
if (channelAuraMask)
{
- range = GetSpellMaxRange(m_spellInfo, IsPositiveSpell(m_spellInfo->Id));
+ range = m_spellInfo->GetMaxRange(m_spellInfo->IsPositive());
if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
}
@@ -1825,7 +1833,7 @@ void Spell::SearchAreaTarget(std::list<Unit*> &TagUnitMap, float radius, SpellNo
else
m_caster->GetMap()->VisitAll(pos->m_positionX, pos->m_positionY, radius, notifier);
- if (m_customAttr & SPELL_ATTR0_CU_EXCLUDE_SELF)
+ if (m_spellInfo->AttributesCu & SPELL_ATTR0_CU_EXCLUDE_SELF)
TagUnitMap.remove(m_caster);
}
@@ -1865,7 +1873,7 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType, Spe
if (conditions.empty())
{
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell (ID: %u) (caster Entry: %u) does not have record in `conditions` for spell script target (ConditionSourceType 13)", m_spellInfo->Id, m_caster->GetEntry());
- if (IsPositiveSpell(m_spellInfo->Id))
+ if (m_spellInfo->IsPositive())
return SearchNearbyTarget(range, SPELL_TARGETS_ALLY, effIndex);
else
return SearchNearbyTarget(range, SPELL_TARGETS_ENEMY, effIndex);
@@ -1953,14 +1961,14 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType, Spe
}
}
-void Spell::SelectEffectTargets(uint32 i, uint32 cur)
+void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur)
{
SpellNotifyPushType pushType = PUSH_NONE;
Player *modOwner = NULL;
if (m_originalCaster)
modOwner = m_originalCaster->GetSpellModOwner();
- switch(SpellTargetType[cur])
+ switch(cur.GetType())
{
case TARGET_TYPE_UNIT_CASTER:
{
@@ -1971,8 +1979,8 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
break;
case TARGET_UNIT_CASTER_FISHING:
{
- float min_dis = GetSpellMinRange(m_spellInfo, true);
- float max_dis = GetSpellMaxRange(m_spellInfo, true);
+ float min_dis = m_spellInfo->GetMinRange(true);
+ float max_dis = m_spellInfo->GetMaxRange(true);
float dis = (float)rand_norm() * (max_dis - min_dis) + min_dis;
float x, y, z;
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE, dis);
@@ -2034,7 +2042,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
pushType = PUSH_CHAIN;
break;
case TARGET_UNIT_TARGET_ANY:
- if (!IsPositiveSpell(m_spellInfo->Id))
+ if (!m_spellInfo->IsPositive())
if (Unit *magnet = m_caster->SelectMagnetTarget(target, m_spellInfo))
if (magnet != target)
m_targets.SetUnitTarget(magnet);
@@ -2072,20 +2080,20 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
switch(cur)
{
case TARGET_UNIT_NEARBY_ENEMY:
- range = GetSpellMaxRange(m_spellInfo, false);
+ range = m_spellInfo->GetMaxRange(false);
if (modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
target = SearchNearbyTarget(range, SPELL_TARGETS_ENEMY, SpellEffIndex(i));
break;
case TARGET_UNIT_NEARBY_ALLY:
case TARGET_UNIT_NEARBY_PARTY: // TODO: fix party/raid targets
case TARGET_UNIT_NEARBY_RAID:
- range = GetSpellMaxRange(m_spellInfo, true);
+ range = m_spellInfo->GetMaxRange(true);
if (modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
target = SearchNearbyTarget(range, SPELL_TARGETS_ALLY, SpellEffIndex(i));
break;
case TARGET_UNIT_NEARBY_ENTRY:
case TARGET_GAMEOBJECT_NEARBY_ENTRY:
- range = GetSpellMaxRange(m_spellInfo, IsPositiveSpell(m_spellInfo->Id));
+ range = m_spellInfo->GetMaxRange(m_spellInfo->IsPositive());
if (modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
target = SearchNearbyTarget(range, SPELL_TARGETS_ENTRY, SpellEffIndex(i));
break;
@@ -2115,9 +2123,9 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
break;
case TARGET_TYPE_AREA_CONE:
- if (m_customAttr & SPELL_ATTR0_CU_CONE_BACK)
+ if (m_spellInfo->AttributesCu & SPELL_ATTR0_CU_CONE_BACK)
pushType = PUSH_IN_BACK;
- else if (m_customAttr & SPELL_ATTR0_CU_CONE_LINE)
+ else if (m_spellInfo->AttributesCu & SPELL_ATTR0_CU_CONE_LINE)
pushType = PUSH_IN_LINE;
else
pushType = PUSH_IN_FRONT;
@@ -2142,7 +2150,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
if (cur == TARGET_MINION)
dist = 0.0f;
else
- dist = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
+ dist = m_spellInfo->Effects[i].CalcRadius(m_caster);
if (modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, dist, this);
if (dist < objSize)
dist = objSize;
@@ -2192,7 +2200,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
float angle, dist;
float objSize = target->GetObjectSize();
- dist = (float)target->GetSpellRadiusForTarget(target, sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
+ dist = m_spellInfo->Effects[i].CalcRadius(m_caster);
if (dist < objSize)
dist = objSize;
else if (cur == TARGET_DEST_TARGET_RANDOM)
@@ -2248,8 +2256,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
default: angle = (float)rand_norm()*static_cast<float>(2*M_PI); break;
}
- float dist;
- dist = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
+ float dist = m_spellInfo->Effects[i].CalcRadius(m_caster);
if (cur == TARGET_DEST_DEST_RANDOM || cur == TARGET_DEST_DEST_RANDOM_DIR_DIST)
dist *= (float)rand_norm();
@@ -2268,7 +2275,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
if (SpellTargetPosition const* st = sSpellMgr->GetSpellTargetPosition(m_spellInfo->Id))
{
//TODO: fix this check
- if (m_spellInfo->Effect[0] == SPELL_EFFECT_TELEPORT_UNITS || m_spellInfo->Effect[1] == SPELL_EFFECT_TELEPORT_UNITS || m_spellInfo->Effect[2] == SPELL_EFFECT_TELEPORT_UNITS)
+ if (m_spellInfo->Effects[0].Effect == SPELL_EFFECT_TELEPORT_UNITS || m_spellInfo->Effects[1].Effect == SPELL_EFFECT_TELEPORT_UNITS || m_spellInfo->Effects[2].Effect == SPELL_EFFECT_TELEPORT_UNITS)
m_targets.SetDst(st->target_X, st->target_Y, st->target_Z, st->target_Orientation, (int32)st->target_mapId);
else if (st->target_mapId == m_caster->GetMapId())
m_targets.SetDst(st->target_X, st->target_Y, st->target_Z, st->target_Orientation);
@@ -2288,7 +2295,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
break;
case TARGET_DST_NEARBY_ENTRY:
{
- float range = GetSpellMaxRange(m_spellInfo, IsPositiveSpell(m_spellInfo->Id));
+ float range = m_spellInfo->GetMaxRange(m_spellInfo->IsPositive());
if (modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
if (WorldObject *target = SearchNearbyTarget(range, SPELL_TARGETS_ENTRY, SpellEffIndex(i)))
@@ -2364,7 +2371,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
}
//Chain: 2, 6, 22, 25, 45, 77
- uint32 maxTargets = m_spellInfo->EffectChainTarget[i];
+ uint32 maxTargets = m_spellInfo->Effects[i].ChainTarget;
if (modOwner)
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_JUMP_TARGETS, maxTargets, this);
@@ -2382,7 +2389,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
case TARGET_UNIT_NEARBY_ENEMY:
case TARGET_UNIT_TARGET_ENEMY:
case TARGET_UNIT_NEARBY_ENTRY: // fix me
- range = GetSpellMaxRange(m_spellInfo, false);
+ range = m_spellInfo->GetMaxRange(false);
if (modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
SearchChainTarget(unitList, range, maxTargets, SPELL_TARGETS_ENEMY);
break;
@@ -2390,7 +2397,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
case TARGET_UNIT_NEARBY_ALLY: // fix me
case TARGET_UNIT_NEARBY_PARTY:
case TARGET_UNIT_NEARBY_RAID:
- range = GetSpellMaxRange(m_spellInfo, true);
+ range = m_spellInfo->GetMaxRange(true);
if (modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
SearchChainTarget(unitList, range, maxTargets, SPELL_TARGETS_CHAINHEAL);
break;
@@ -2407,7 +2414,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
else if (pushType)
{
// Dummy, just for client
- if (EffectTargetType[m_spellInfo->Effect[i]] != SPELL_REQUIRE_UNIT)
+ if (m_spellInfo->Effects[i].GetRequiredTargetType() != SPELL_REQUIRE_UNIT)
return;
float radius;
@@ -2419,29 +2426,29 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
case TARGET_UNIT_CONE_ENEMY:
case TARGET_UNIT_CONE_ENEMY_UNKNOWN:
case TARGET_UNIT_AREA_PATH:
- radius = GetSpellRadius(m_spellInfo, i, false);
+ radius = m_spellInfo->Effects[i].CalcRadius();
targetType = SPELL_TARGETS_ENEMY;
break;
case TARGET_UNIT_AREA_ALLY_SRC:
case TARGET_UNIT_AREA_ALLY_DST:
case TARGET_UNIT_CONE_ALLY:
- radius = GetSpellRadius(m_spellInfo, i, true);
+ radius = m_spellInfo->Effects[i].CalcRadius();
targetType = SPELL_TARGETS_ALLY;
break;
case TARGET_UNIT_AREA_ENTRY_DST:
case TARGET_UNIT_AREA_ENTRY_SRC:
case TARGET_UNIT_CONE_ENTRY: // fix me
- radius = GetSpellRadius(m_spellInfo, i, IsPositiveSpell(m_spellInfo->Id));
+ radius = m_spellInfo->Effects[i].CalcRadius();
targetType = SPELL_TARGETS_ENTRY;
break;
case TARGET_GAMEOBJECT_AREA_SRC:
case TARGET_GAMEOBJECT_AREA_DST:
case TARGET_GAMEOBJECT_AREA_PATH:
- radius = GetSpellRadius(m_spellInfo, i, true);
+ radius = m_spellInfo->Effects[i].CalcRadius();
targetType = SPELL_TARGETS_GO;
break;
default:
- radius = GetSpellRadius(m_spellInfo, i, true);
+ radius = m_spellInfo->Effects[i].CalcRadius();
targetType = SPELL_TARGETS_NONE;
break;
}
@@ -2540,9 +2547,9 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
default:
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell (ID: %u) (caster Entry: %u) does not have type CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET record in `conditions` table.", m_spellInfo->Id, m_caster->GetEntry());
- if (m_spellInfo->Effect[i] == SPELL_EFFECT_TELEPORT_UNITS)
+ if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_TELEPORT_UNITS)
SearchAreaTarget(unitList, radius, pushType, SPELL_TARGETS_ENTRY, 0);
- else if (IsPositiveEffect(m_spellInfo->Id, i))
+ else if (m_spellInfo->IsPositiveEffect(i))
SearchAreaTarget(unitList, radius, pushType, SPELL_TARGETS_ALLY);
else
SearchAreaTarget(unitList, radius, pushType, SPELL_TARGETS_ENEMY);
@@ -2567,7 +2574,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
}
else
{
- if (m_spellInfo->Effect[i] == SPELL_EFFECT_ACTIVATE_OBJECT)
+ if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_ACTIVATE_OBJECT)
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell (ID: %u) (caster Entry: %u) with SPELL_EFFECT_ACTIVATE_OBJECT does not have type CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET record in `conditions` table.", m_spellInfo->Id, m_caster->GetEntry());
SearchGOAreaTarget(gobjectList, radius, pushType, SPELL_TARGETS_GO);
}
@@ -2841,17 +2848,17 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
}
// Fill aura scaling information
- if (m_caster->IsControlledByPlayer() && !IsPassiveSpell(m_spellInfo->Id) && m_spellInfo->spellLevel && !IsChanneledSpell(m_spellInfo) && !m_IsTriggeredSpell)
+ if (m_caster->IsControlledByPlayer() && !m_spellInfo->IsPassive() && m_spellInfo->SpellLevel && !m_spellInfo->IsChanneled() && !m_IsTriggeredSpell)
{
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- if (m_spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA)
+ if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_APPLY_AURA)
{
// Change aura with ranks only if basepoints are taken from spellInfo and aura is positive
- if (IsPositiveEffect(m_spellInfo->Id, i))
+ if (m_spellInfo->IsPositiveEffect(i))
{
m_auraScaleMask |= (1 << i);
- if (m_spellValue->EffectBasePoints[i] != m_spellInfo->EffectBasePoints[i])
+ if (m_spellValue->EffectBasePoints[i] != m_spellInfo->Effects[i].BasePoints)
{
m_auraScaleMask = 0;
break;
@@ -2864,7 +2871,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
m_spellState = SPELL_STATE_PREPARING;
if (triggeredByAura)
- m_triggeredByAuraSpell = triggeredByAura->GetSpellProto();
+ m_triggeredByAuraSpell = triggeredByAura->GetSpellInfo();
// create and add update event for this spell
SpellEvent* Event = new SpellEvent(this);
@@ -2889,7 +2896,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->SetSpellModTakingSpell(this, true);
// Fill cost data (not use power for item casts
- m_powerCost = m_CastItem ? 0 : CalculatePowerCost(m_spellInfo, m_caster, m_spellSchoolMask);
+ m_powerCost = m_CastItem ? 0 : m_spellInfo->CalcPowerCost(m_caster, m_spellSchoolMask);
if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
@@ -2917,13 +2924,13 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->SetSpellModTakingSpell(this, true);
// calculate cast time (calculated after first CheckCast check to prevent charge counting for first CheckCast fail)
- m_casttime = GetSpellCastTime(m_spellInfo, this);
+ m_casttime = m_spellInfo->CalcCastTime(m_caster, this);
if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
// don't allow channeled spells / spells with cast time to be casted while moving
// (even if they are interrupted on moving, spells with almost immediate effect get to have their effect processed before movement interrupter kicks in)
- if ((IsChanneledSpell(m_spellInfo) || m_casttime) && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->isMoving() && m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT)
+ if ((m_spellInfo->IsChanneled() || m_casttime) && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->isMoving() && m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT)
{
SendCastResult(SPELL_FAILED_MOVING);
finish(false);
@@ -2938,17 +2945,17 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
//Containers for channeled spells have to be set
//TODO:Apply this to all casted spells if needed
// Why check duration? 29350: channelled triggers channelled
- if (m_IsTriggeredSpell && (!IsChanneledSpell(m_spellInfo) || !GetSpellMaxDuration(m_spellInfo)))
+ if (m_IsTriggeredSpell && (!m_spellInfo->IsChanneled() || !m_spellInfo->GetMaxDuration()))
cast(true);
else
{
// stealth must be removed at cast starting (at show channel bar)
// skip triggered spell (item equip spell casting and other not explicit character casts/item uses)
- if (!m_IsTriggeredSpell && isSpellBreakStealth(m_spellInfo))
+ if (!m_IsTriggeredSpell && m_spellInfo->IsBreakingStealth())
{
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CAST);
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (EffectTargetType[m_spellInfo->Effect[i]] == SPELL_REQUIRE_UNIT)
+ if (m_spellInfo->Effects[i].GetRequiredTargetType() == SPELL_REQUIRE_UNIT)
{
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_SPELL_ATTACK);
break;
@@ -3167,7 +3174,7 @@ void Spell::cast(bool skipCheck)
TakeReagents();
}
- if (m_customAttr & SPELL_ATTR0_CU_DIRECT_DAMAGE)
+ if (m_spellInfo->AttributesCu & SPELL_ATTR0_CU_DIRECT_DAMAGE)
CalculateDamageDoneForAllTargets();
// CAST SPELL
@@ -3177,7 +3184,7 @@ void Spell::cast(bool skipCheck)
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- switch(m_spellInfo->Effect[i])
+ switch(m_spellInfo->Effects[i].Effect)
{
case SPELL_EFFECT_CHARGE:
case SPELL_EFFECT_CHARGE_DEST:
@@ -3195,7 +3202,7 @@ void Spell::cast(bool skipCheck)
SendSpellGo();
// Okay, everything is prepared. Now we need to distinguish between immediate and evented delayed spells
- if ((m_spellInfo->speed > 0.0f && !IsChanneledSpell(m_spellInfo)) || m_spellInfo->Id == 14157)
+ if ((m_spellInfo->Speed > 0.0f && !m_spellInfo->IsChanneled()) || m_spellInfo->Id == 14157)
{
// Remove used for cast item if need (it can be already NULL after TakeReagents call
// in case delayed spell remove item at cast delay start
@@ -3215,16 +3222,13 @@ void Spell::cast(bool skipCheck)
handle_immediate();
}
- if (m_customAttr & SPELL_ATTR0_CU_LINK_CAST)
+ if (const std::vector<int32> *spell_triggered = sSpellMgr->GetSpellLinked(m_spellInfo->Id))
{
- if (const std::vector<int32> *spell_triggered = sSpellMgr->GetSpellLinked(m_spellInfo->Id))
- {
- for (std::vector<int32>::const_iterator i = spell_triggered->begin(); i != spell_triggered->end(); ++i)
- if (*i < 0)
- m_caster->RemoveAurasDueToSpell(-(*i));
- else
- m_caster->CastSpell(m_targets.GetUnitTarget() ? m_targets.GetUnitTarget() : m_caster, *i, true);
- }
+ for (std::vector<int32>::const_iterator i = spell_triggered->begin(); i != spell_triggered->end(); ++i)
+ if (*i < 0)
+ m_caster->RemoveAurasDueToSpell(-(*i));
+ else
+ m_caster->CastSpell(m_targets.GetUnitTarget() ? m_targets.GetUnitTarget() : m_caster, *i, true);
}
if (m_caster->GetTypeId() == TYPEID_PLAYER)
@@ -3236,9 +3240,9 @@ void Spell::cast(bool skipCheck)
void Spell::handle_immediate()
{
// start channeling if applicable
- if (IsChanneledSpell(m_spellInfo))
+ if (m_spellInfo->IsChanneled())
{
- int32 duration = GetSpellDuration(m_spellInfo);
+ int32 duration = m_spellInfo->GetDuration();
if (duration)
{
// First mod_duration then haste - see Missile Barrage
@@ -3351,17 +3355,17 @@ void Spell::_handle_immediate_phase()
{
m_spellAura = NULL;
// handle some immediate features of the spell here
- HandleThreatSpells(m_spellInfo->Id);
+ HandleThreatSpells();
PrepareScriptHitHandlers();
for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
- if (m_spellInfo->Effect[j] == 0)
+ if (m_spellInfo->Effects[j].Effect == 0)
continue;
// apply Send Event effect to ground in case empty target lists
- if (m_spellInfo->Effect[j] == SPELL_EFFECT_SEND_EVENT && !HaveTargetsForEffect(j))
+ if (m_spellInfo->Effects[j].Effect == SPELL_EFFECT_SEND_EVENT && !HaveTargetsForEffect(j))
{
HandleEffects(NULL, NULL, NULL, j);
continue;
@@ -3382,17 +3386,17 @@ void Spell::_handle_immediate_phase()
// process ground
for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
- if (m_spellInfo->Effect[j] == 0)
+ if (m_spellInfo->Effects[j].Effect == 0)
continue;
- if (EffectTargetType[m_spellInfo->Effect[j]] == SPELL_REQUIRE_DEST)
+ if (m_spellInfo->Effects[j].GetRequiredTargetType() == SPELL_REQUIRE_DEST)
{
if (!m_targets.HasDst()) // FIXME: this will ignore dest set in effect
m_targets.SetDst(*m_caster);
HandleEffects(m_originalCaster, NULL, NULL, j);
m_effectMask |= (1<<j);
}
- else if (EffectTargetType[m_spellInfo->Effect[j]] == SPELL_REQUIRE_NONE)
+ else if (m_spellInfo->Effects[j].GetRequiredTargetType() == SPELL_REQUIRE_NONE)
{
HandleEffects(m_originalCaster, NULL, NULL, j);
m_effectMask |= (1<<j);
@@ -3406,7 +3410,7 @@ void Spell::_handle_immediate_phase()
bool positive = true;
for (uint8 i = 0; i< MAX_SPELL_EFFECTS; ++i)
// If at least one effect negative spell is negative hit
- if (m_effectMask & (1<<i) && !IsPositiveEffect(m_spellInfo->Id, i))
+ if (m_effectMask & (1<<i) && !m_spellInfo->IsPositiveEffect(i))
{
positive = false;
break;
@@ -3484,7 +3488,7 @@ void Spell::update(uint32 difftime)
// check if the player caster has moved before the spell finished
if ((m_caster->GetTypeId() == TYPEID_PLAYER && m_timer != 0) &&
m_caster->isMoving() && (m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT) &&
- (m_spellInfo->Effect[0] != SPELL_EFFECT_STUCK || !m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING)))
+ (m_spellInfo->Effects[0].Effect != SPELL_EFFECT_STUCK || !m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING)))
{
// don't cancel for melee, autorepeat, triggered and instant spells
if (!IsNextMeleeSwingSpell() && !IsAutoRepeat() && !m_IsTriggeredSpell)
@@ -3504,7 +3508,8 @@ void Spell::update(uint32 difftime)
}
if (m_timer == 0 && !IsNextMeleeSwingSpell() && !IsAutoRepeat())
- cast(m_spellInfo->CastingTimeIndex == 1);
+ // don't CheckCast for instant spells - done in spell::prepare, skip duplicate checks, needed for range checks for example
+ cast(!m_casttime);
} break;
case SPELL_STATE_CASTING:
{
@@ -3579,14 +3584,14 @@ void Spell::finish(bool ok)
return;
m_spellState = SPELL_STATE_FINISHED;
- if (IsChanneledSpell(m_spellInfo))
+ if (m_spellInfo->IsChanneled())
m_caster->UpdateInterruptMask();
if (m_caster->HasUnitState(UNIT_STAT_CASTING) && !m_caster->IsNonMeleeSpellCasted(false, false, true))
m_caster->ClearUnitState(UNIT_STAT_CASTING);
// Unsummon summon as possessed creatures on spell cancel
- if (IsChanneledSpell(m_spellInfo) && m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (m_spellInfo->IsChanneled() && m_caster->GetTypeId() == TYPEID_PLAYER)
{
if (Unit *charm = m_caster->GetCharm())
if (charm->GetTypeId() == TYPEID_UNIT
@@ -3605,7 +3610,7 @@ void Spell::finish(bool ok)
{
// Unsummon statue
uint32 spell = m_caster->GetUInt32Value(UNIT_CREATED_BY_SPELL);
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell);
if (spellInfo && spellInfo->SpellIconID == 2056)
{
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Statue %d is unsummoned in spell %d finish", m_caster->GetGUIDLow(), m_spellInfo->Id);
@@ -3670,7 +3675,7 @@ void Spell::SendCastResult(SpellCastResult result)
SendCastResult(m_caster->ToPlayer(), m_spellInfo, m_cast_count, result, m_customError);
}
-void Spell::SendCastResult(Player* caster, SpellEntry const* spellInfo, uint8 cast_count, SpellCastResult result, SpellCustomErrors customError /*= SPELL_CUSTOM_ERROR_NONE*/)
+void Spell::SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 cast_count, SpellCastResult result, SpellCustomErrors customError /*= SPELL_CUSTOM_ERROR_NONE*/)
{
if (result == SPELL_CAST_OK)
return;
@@ -3725,8 +3730,8 @@ void Spell::SendCastResult(Player* caster, SpellEntry const* spellInfo, uint8 ca
{
uint32 item = 0;
for (int8 x = 0;x < 3; x++)
- if (spellInfo->EffectItemType[x])
- item = spellInfo->EffectItemType[x];
+ if (spellInfo->Effects[x].ItemType)
+ item = spellInfo->Effects[x].ItemType;
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item);
if (pProto && pProto->ItemLimitCategory)
data << uint32(pProto->ItemLimitCategory);
@@ -3753,10 +3758,10 @@ void Spell::SendSpellStart()
castFlags |= CAST_FLAG_AMMO;
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
(m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isPet()))
- && m_spellInfo->powerType != POWER_HEALTH)
+ && m_spellInfo->PowerType != POWER_HEALTH)
castFlags |= CAST_FLAG_POWER_LEFT_SELF;
- if (m_spellInfo->runeCostID && m_spellInfo->powerType == POWER_RUNE)
+ if (m_spellInfo->RuneCostID && m_spellInfo->PowerType == POWER_RUNE)
castFlags |= CAST_FLAG_UNKNOWN_19;
WorldPacket data(SMSG_SPELL_START, (8+8+4+4+2));
@@ -3774,7 +3779,7 @@ void Spell::SendSpellStart()
m_targets.Write(data);
if (castFlags & CAST_FLAG_POWER_LEFT_SELF)
- data << uint32(m_caster->GetPower((Powers)m_spellInfo->powerType));
+ data << uint32(m_caster->GetPower((Powers)m_spellInfo->PowerType));
if (castFlags & CAST_FLAG_AMMO)
WriteAmmoToPacket(&data);
@@ -3799,27 +3804,27 @@ void Spell::SendSpellGo()
uint32 castFlags = CAST_FLAG_UNKNOWN_9;
// triggered spells with spell visual != 0
- if ((m_IsTriggeredSpell && !IsAutoRepeatRangedSpell(m_spellInfo)) || m_triggeredByAuraSpell)
+ if ((m_IsTriggeredSpell && !m_spellInfo->IsAutoRepeatRangedSpell()) || m_triggeredByAuraSpell)
castFlags |= CAST_FLAG_PENDING;
if (m_spellInfo->Attributes & SPELL_ATTR0_REQ_AMMO)
castFlags |= CAST_FLAG_AMMO; // arrows/bullets visual
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
(m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isPet()))
- && m_spellInfo->powerType != POWER_HEALTH)
+ && m_spellInfo->PowerType != POWER_HEALTH)
castFlags |= CAST_FLAG_POWER_LEFT_SELF; // should only be sent to self, but the current messaging doesn't make that possible
if ((m_caster->GetTypeId() == TYPEID_PLAYER)
&& (m_caster->getClass() == CLASS_DEATH_KNIGHT)
- && m_spellInfo->runeCostID
- && m_spellInfo->powerType == POWER_RUNE)
+ && m_spellInfo->RuneCostID
+ && m_spellInfo->PowerType == POWER_RUNE)
{
castFlags |= CAST_FLAG_UNKNOWN_19; // same as in SMSG_SPELL_START
castFlags |= CAST_FLAG_RUNE_LIST; // rune cooldowns list
castFlags |= CAST_FLAG_UNKNOWN_9; // ??
}
- if (IsSpellHaveEffect(m_spellInfo, SPELL_EFFECT_ACTIVATE_RUNE))
+ if (m_spellInfo->HasEffect(SPELL_EFFECT_ACTIVATE_RUNE))
{
castFlags |= CAST_FLAG_RUNE_LIST; // rune cooldowns list
castFlags |= CAST_FLAG_UNKNOWN_19; // same as in SMSG_SPELL_START
@@ -3852,7 +3857,7 @@ void Spell::SendSpellGo()
m_targets.Write(data);
if (castFlags & CAST_FLAG_POWER_LEFT_SELF)
- data << uint32(m_caster->GetPower((Powers)m_spellInfo->powerType));
+ data << uint32(m_caster->GetPower((Powers)m_spellInfo->PowerType));
if (castFlags & CAST_FLAG_RUNE_LIST) // rune cooldowns list
{
@@ -4013,7 +4018,7 @@ void Spell::WriteSpellGoTargets(WorldPacket * data)
}
}
// Reset m_needAliveTargetMask for non channeled spell
- if (!IsChanneledSpell(m_spellInfo))
+ if (!m_spellInfo->IsChanneled())
m_channelTargetEffectMask = 0;
}
@@ -4041,7 +4046,7 @@ void Spell::SendLogExecute()
if (!m_effectExecuteData[i])
continue;
- data << uint32(m_spellInfo->Effect[i]); // spell effect
+ data << uint32(m_spellInfo->Effects[i].Effect); // spell effect
data.append(*m_effectExecuteData[i]);
@@ -4284,7 +4289,7 @@ void Spell::TakePower()
bool hit = true;
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
- if (m_spellInfo->powerType == POWER_RAGE || m_spellInfo->powerType == POWER_ENERGY || m_spellInfo->powerType == POWER_RUNE)
+ if (m_spellInfo->PowerType == POWER_RAGE || m_spellInfo->PowerType == POWER_ENERGY || m_spellInfo->PowerType == POWER_RUNE)
if (uint64 targetGUID = m_targets.GetUnitTargetGUID())
for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
if (ihit->targetGUID == targetGUID)
@@ -4301,7 +4306,7 @@ void Spell::TakePower()
}
}
- Powers powerType = Powers(m_spellInfo->powerType);
+ Powers powerType = Powers(m_spellInfo->PowerType);
if (powerType == POWER_RUNE)
{
@@ -4313,15 +4318,15 @@ void Spell::TakePower()
return;
// health as power used
- if (m_spellInfo->powerType == POWER_HEALTH)
+ if (m_spellInfo->PowerType == POWER_HEALTH)
{
m_caster->ModifyHealth(-(int32)m_powerCost);
return;
}
- if (m_spellInfo->powerType >= MAX_POWERS)
+ if (m_spellInfo->PowerType >= MAX_POWERS)
{
- sLog->outError("Spell::TakePower: Unknown power type '%d'", m_spellInfo->powerType);
+ sLog->outError("Spell::TakePower: Unknown power type '%d'", m_spellInfo->PowerType);
return;
}
@@ -4366,7 +4371,7 @@ void Spell::TakeAmmo()
SpellCastResult Spell::CheckRuneCost(uint32 runeCostID)
{
- if (m_spellInfo->powerType != POWER_RUNE || !runeCostID)
+ if (m_spellInfo->PowerType != POWER_RUNE || !runeCostID)
return SPELL_CAST_OK;
if (m_caster->GetTypeId() != TYPEID_PLAYER)
@@ -4423,7 +4428,7 @@ void Spell::TakeRunePower(bool didHit)
if (player->getClass() != CLASS_DEATH_KNIGHT)
return;
- SpellRuneCostEntry const *runeCostData = sSpellRuneCostStore.LookupEntry(m_spellInfo->runeCostID);
+ SpellRuneCostEntry const *runeCostData = sSpellRuneCostStore.LookupEntry(m_spellInfo->RuneCostID);
if (!runeCostData || (runeCostData->NoRuneCost() && runeCostData->NoRunicPowerGain()))
return;
@@ -4539,22 +4544,22 @@ void Spell::TakeReagents()
}
}
-void Spell::HandleThreatSpells(uint32 spellId)
+void Spell::HandleThreatSpells()
{
- if (!m_targets.GetUnitTarget() || !spellId)
+ if (!m_targets.GetUnitTarget())
return;
if (!m_targets.GetUnitTarget()->CanHaveThreatList())
return;
- uint16 threat = sSpellMgr->GetSpellThreat(spellId);
+ uint16 threat = sSpellMgr->GetSpellThreat(m_spellInfo->Id);
if (!threat)
return;
m_targets.GetUnitTarget()->AddThreat(m_caster, float(threat));
- sLog->outStaticDebug("Spell %u, rank %u, added an additional %i threat", spellId, sSpellMgr->GetSpellRank(spellId), threat);
+ sLog->outStaticDebug("Spell %u, rank %u, added an additional %i threat", m_spellInfo->Id, m_spellInfo->GetRank(), threat);
}
void Spell::HandleEffects(Unit *pUnitTarget, Item *pItemTarget, GameObject *pGOTarget, uint32 i)
@@ -4567,7 +4572,7 @@ void Spell::HandleEffects(Unit *pUnitTarget, Item *pItemTarget, GameObject *pGOT
itemTarget = pItemTarget;
gameObjTarget = pGOTarget;
- uint8 eff = m_spellInfo->Effect[i];
+ uint8 eff = m_spellInfo->Effects[i].Effect;
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell: %u Effect : %u", m_spellInfo->Id, eff);
@@ -4645,7 +4650,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (checkForm)
{
// Cannot be used in this stance/form
- SpellCastResult shapeError = GetErrorAtShapeshiftedCast(m_spellInfo, m_caster->GetShapeshiftForm());
+ SpellCastResult shapeError = m_spellInfo->CheckShapeshift(m_caster->GetShapeshiftForm());
if (shapeError != SPELL_CAST_OK)
return shapeError;
@@ -4673,18 +4678,18 @@ SpellCastResult Spell::CheckCast(bool strict)
// not for triggered spells (needed by execute)
if (!m_IsTriggeredSpell)
{
- if (m_spellInfo->CasterAuraState && !m_caster->HasAuraState(AuraState(m_spellInfo->CasterAuraState), m_spellInfo, m_caster))
+ if (m_spellInfo->CasterAuraState && !m_caster->HasAuraState(AuraStateType(m_spellInfo->CasterAuraState), m_spellInfo, m_caster))
return SPELL_FAILED_CASTER_AURASTATE;
- if (m_spellInfo->CasterAuraStateNot && m_caster->HasAuraState(AuraState(m_spellInfo->CasterAuraStateNot), m_spellInfo, m_caster))
+ if (m_spellInfo->CasterAuraStateNot && m_caster->HasAuraState(AuraStateType(m_spellInfo->CasterAuraStateNot), m_spellInfo, m_caster))
return SPELL_FAILED_CASTER_AURASTATE;
// Note: spell 62473 requres casterAuraSpell = triggering spell
- if (m_spellInfo->casterAuraSpell && !m_caster->HasAura(sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->casterAuraSpell, m_caster)))
+ if (m_spellInfo->CasterAuraSpell && !m_caster->HasAura(sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->CasterAuraSpell, m_caster)))
return SPELL_FAILED_CASTER_AURASTATE;
- if (m_spellInfo->excludeCasterAuraSpell && m_caster->HasAura(sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->excludeCasterAuraSpell, m_caster)))
+ if (m_spellInfo->ExcludeCasterAuraSpell && m_caster->HasAura(sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->ExcludeCasterAuraSpell, m_caster)))
return SPELL_FAILED_CASTER_AURASTATE;
- if (reqCombat && m_caster->isInCombat() && IsNonCombatSpell(m_spellInfo))
+ if (reqCombat && m_caster->isInCombat() && !m_spellInfo->CanBeUsedInCombat())
return SPELL_FAILED_AFFECTING_COMBAT;
}
@@ -4693,7 +4698,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->isMoving())
{
// skip stuck spell to allow use it in falling case and apply spell limitations at movement
- if ((!m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING) || m_spellInfo->Effect[0] != SPELL_EFFECT_STUCK) &&
+ if ((!m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING) || m_spellInfo->Effects[0].Effect != SPELL_EFFECT_STUCK) &&
(IsAutoRepeat() || (m_spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED) != 0))
return SPELL_FAILED_MOVING;
}
@@ -4706,24 +4711,24 @@ SpellCastResult Spell::CheckCast(bool strict)
if (target)
{
// target state requirements (not allowed state), apply to self also
- if (!m_IsTriggeredSpell && m_spellInfo->TargetAuraStateNot && target->HasAuraState(AuraState(m_spellInfo->TargetAuraStateNot), m_spellInfo, m_caster))
+ if (!m_IsTriggeredSpell && m_spellInfo->TargetAuraStateNot && target->HasAuraState(AuraStateType(m_spellInfo->TargetAuraStateNot), m_spellInfo, m_caster))
return SPELL_FAILED_TARGET_AURASTATE;
- if (m_spellInfo->targetAuraSpell && !target->HasAura(sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->targetAuraSpell, m_caster)))
+ if (m_spellInfo->TargetAuraSpell && !target->HasAura(sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->TargetAuraSpell, m_caster)))
return SPELL_FAILED_TARGET_AURASTATE;
- if (m_spellInfo->excludeTargetAuraSpell && target->HasAura(sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->excludeTargetAuraSpell, m_caster)))
+ if (m_spellInfo->ExcludeTargetAuraSpell && target->HasAura(sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->ExcludeTargetAuraSpell, m_caster)))
return SPELL_FAILED_TARGET_AURASTATE;
if (!m_IsTriggeredSpell && target == m_caster && m_spellInfo->AttributesEx & SPELL_ATTR1_CANT_TARGET_SELF)
return SPELL_FAILED_BAD_TARGETS;
- bool non_caster_target = target != m_caster && !sSpellMgr->IsSpellWithCasterSourceTargetsOnly(m_spellInfo);
+ bool non_caster_target = target != m_caster && m_spellInfo->IsRequiringSelectedTarget();
if (non_caster_target)
{
// target state requirements (apply to non-self only), to allow cast affects to self like Dirty Deeds
- if (!m_IsTriggeredSpell && m_spellInfo->TargetAuraState && !target->HasAuraState(AuraState(m_spellInfo->TargetAuraState), m_spellInfo, m_caster))
+ if (!m_IsTriggeredSpell && m_spellInfo->TargetAuraState && !target->HasAuraState(AuraStateType(m_spellInfo->TargetAuraState), m_spellInfo, m_caster))
return SPELL_FAILED_TARGET_AURASTATE;
// Not allow casting on flying player or on vehicle player (if caster isnt vehicle)
@@ -4741,7 +4746,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (targetCreature->hasLootRecipient() && !targetCreature->isTappedBy(m_caster->ToPlayer()))
return SPELL_FAILED_CANT_CAST_ON_TAPPED;
- if (m_customAttr & SPELL_ATTR0_CU_PICKPOCKET)
+ if (m_spellInfo->AttributesCu & SPELL_ATTR0_CU_PICKPOCKET)
{
if (target->GetTypeId() == TYPEID_PLAYER)
return SPELL_FAILED_BAD_TARGETS;
@@ -4775,7 +4780,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// If 0 spell effect empty - client not send target data (need use selection)
// TODO: check it on next client version
if (m_targets.GetTargetMask() == TARGET_FLAG_SELF &&
- m_spellInfo->EffectImplicitTargetA[1] == TARGET_UNIT_TARGET_ENEMY)
+ m_spellInfo->Effects[1].TargetA == TARGET_UNIT_TARGET_ENEMY)
{
target = m_caster->GetUnit(*m_caster, m_caster->ToPlayer()->GetSelection());
if (target)
@@ -4793,7 +4798,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// check pet presents
for (int j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
- if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_UNIT_PET)
+ if (m_spellInfo->Effects[j].TargetA == TARGET_UNIT_PET)
{
target = m_caster->GetGuardianPet();
if (!target)
@@ -4820,11 +4825,11 @@ SpellCastResult Spell::CheckCast(bool strict)
}
// Must be behind the target
- if ((m_customAttr & SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET) && target->HasInArc(static_cast<float>(M_PI), m_caster))
+ if ((m_spellInfo->AttributesCu & SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET) && target->HasInArc(static_cast<float>(M_PI), m_caster))
return SPELL_FAILED_NOT_BEHIND;
// Target must be facing you
- if ((m_customAttr & SPELL_ATTR0_CU_REQ_TARGET_FACING_CASTER) && !target->HasInArc(static_cast<float>(M_PI), m_caster))
+ if ((m_spellInfo->AttributesCu & SPELL_ATTR0_CU_REQ_TARGET_FACING_CASTER) && !target->HasInArc(static_cast<float>(M_PI), m_caster))
return SPELL_FAILED_NOT_INFRONT;
// Target must not be in combat
@@ -4833,7 +4838,7 @@ SpellCastResult Spell::CheckCast(bool strict)
}
if (target)
- if (IsPositiveSpell(m_spellInfo->Id))
+ if (m_spellInfo->IsPositive())
if (target->IsImmunedToSpell(m_spellInfo))
return SPELL_FAILED_TARGET_AURASTATE;
}
@@ -4847,7 +4852,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// - with greater than 10 min CD without SPELL_ATTR4_USABLE_IN_ARENA flag
// - with SPELL_ATTR4_NOT_USABLE_IN_ARENA flag
if ((m_spellInfo->AttributesEx4 & SPELL_ATTR4_NOT_USABLE_IN_ARENA) ||
- (GetSpellRecoveryTime(m_spellInfo) > 10 * MINUTE * IN_MILLISECONDS && !(m_spellInfo->AttributesEx4 & SPELL_ATTR4_USABLE_IN_ARENA)))
+ (m_spellInfo->GetRecoveryTime() > 10 * MINUTE * IN_MILLISECONDS && !(m_spellInfo->AttributesEx4 & SPELL_ATTR4_USABLE_IN_ARENA)))
if (MapEntry const* mapEntry = sMapStore.LookupEntry(m_caster->GetMapId()))
if (mapEntry->IsBattleArena())
return SPELL_FAILED_NOT_IN_ARENA;
@@ -4858,7 +4863,7 @@ SpellCastResult Spell::CheckCast(bool strict)
uint32 zone, area;
m_caster->GetZoneAndAreaId(zone, area);
- SpellCastResult locRes= sSpellMgr->GetSpellAllowedInLocationError(m_spellInfo, m_caster->GetMapId(), zone, area,
+ SpellCastResult locRes= m_spellInfo->CheckLocation(m_caster->GetMapId(), zone, area,
m_caster->GetTypeId() == TYPEID_PLAYER ? m_caster->ToPlayer() : NULL);
if (locRes != SPELL_CAST_OK)
return locRes;
@@ -4866,7 +4871,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// not let players cast spells at mount (and let do it to creatures)
if (m_caster->IsMounted() && m_caster->GetTypeId() == TYPEID_PLAYER && !m_IsTriggeredSpell &&
- !IsPassiveSpell(m_spellInfo->Id) && !(m_spellInfo->Attributes & SPELL_ATTR0_CASTABLE_WHILE_MOUNTED))
+ !m_spellInfo->IsPassive() && !(m_spellInfo->Attributes & SPELL_ATTR0_CASTABLE_WHILE_MOUNTED))
{
if (m_caster->isInFlight())
return SPELL_FAILED_NOT_ON_TAXI;
@@ -4877,7 +4882,7 @@ SpellCastResult Spell::CheckCast(bool strict)
SpellCastResult castResult = SPELL_CAST_OK;
// always (except passive spells) check items (focus object can be required for any type casts)
- if (!IsPassiveSpell(m_spellInfo->Id))
+ if (!m_spellInfo->IsPassive())
{
castResult = CheckItems();
if (castResult != SPELL_CAST_OK)
@@ -4909,7 +4914,7 @@ SpellCastResult Spell::CheckCast(bool strict)
for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
{
// for effects of spells that have only one target
- switch(m_spellInfo->Effect[i])
+ switch(m_spellInfo->Effects[i].Effect)
{
case SPELL_EFFECT_DUMMY:
{
@@ -4964,7 +4969,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_BAD_TARGETS;
- if (m_spellInfo->EffectImplicitTargetA[i] != TARGET_UNIT_PET)
+ if (m_spellInfo->Effects[i].TargetA != TARGET_UNIT_PET)
break;
Pet* pet = m_caster->ToPlayer()->GetPet();
@@ -4972,12 +4977,12 @@ SpellCastResult Spell::CheckCast(bool strict)
if (!pet)
return SPELL_FAILED_NO_PET;
- SpellEntry const *learn_spellproto = sSpellStore.LookupEntry(m_spellInfo->EffectTriggerSpell[i]);
+ SpellInfo const *learn_spellproto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[i].TriggerSpell);
if (!learn_spellproto)
return SPELL_FAILED_NOT_KNOWN;
- if (m_spellInfo->spellLevel > pet->getLevel())
+ if (m_spellInfo->SpellLevel > pet->getLevel())
return SPELL_FAILED_LOWLEVEL;
break;
@@ -4991,19 +4996,19 @@ SpellCastResult Spell::CheckCast(bool strict)
if (!pet)
return SPELL_FAILED_NO_PET;
- SpellEntry const *learn_spellproto = sSpellStore.LookupEntry(m_spellInfo->EffectTriggerSpell[i]);
+ SpellInfo const *learn_spellproto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[i].TriggerSpell);
if (!learn_spellproto)
return SPELL_FAILED_NOT_KNOWN;
- if (m_spellInfo->spellLevel > pet->getLevel())
+ if (m_spellInfo->SpellLevel > pet->getLevel())
return SPELL_FAILED_LOWLEVEL;
break;
}
case SPELL_EFFECT_APPLY_GLYPH:
{
- uint32 glyphId = m_spellInfo->EffectMiscValue[i];
+ uint32 glyphId = m_spellInfo->Effects[i].MiscValue;
if (GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyphId))
if (m_caster->HasAura(gp->SpellId))
return SPELL_FAILED_UNIQUE_GLYPH;
@@ -5040,7 +5045,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// Can be area effect, Check only for players and not check if target - caster (spell can have multiply drain/burn effects)
if (m_caster->GetTypeId() == TYPEID_PLAYER)
if (Unit* target = m_targets.GetUnitTarget())
- if (target != m_caster && target->getPowerType() != Powers(m_spellInfo->EffectMiscValue[i]))
+ if (target != m_caster && target->getPowerType() != Powers(m_spellInfo->Effects[i].MiscValue))
return SPELL_FAILED_BAD_TARGETS;
break;
}
@@ -5086,13 +5091,13 @@ SpellCastResult Spell::CheckCast(bool strict)
}
case SPELL_EFFECT_OPEN_LOCK:
{
- if (m_spellInfo->EffectImplicitTargetA[i] != TARGET_GAMEOBJECT &&
- m_spellInfo->EffectImplicitTargetA[i] != TARGET_GAMEOBJECT_ITEM)
+ if (m_spellInfo->Effects[i].TargetA != TARGET_GAMEOBJECT &&
+ m_spellInfo->Effects[i].TargetA != TARGET_GAMEOBJECT_ITEM)
break;
if (m_caster->GetTypeId() != TYPEID_PLAYER // only players can open locks, gather etc.
// we need a go target in case of TARGET_GAMEOBJECT
- || (m_spellInfo->EffectImplicitTargetA[i] == TARGET_GAMEOBJECT && !m_targets.GetGOTarget()))
+ || (m_spellInfo->Effects[i].TargetA == TARGET_GAMEOBJECT && !m_targets.GetGOTarget()))
return SPELL_FAILED_BAD_TARGETS;
Item *pTempItem = NULL;
@@ -5105,7 +5110,7 @@ SpellCastResult Spell::CheckCast(bool strict)
pTempItem = m_caster->ToPlayer()->GetItemByGuid(m_targets.GetItemTargetGUID());
// we need a go target, or an openable item target in case of TARGET_GAMEOBJECT_ITEM
- if (m_spellInfo->EffectImplicitTargetA[i] == TARGET_GAMEOBJECT_ITEM &&
+ if (m_spellInfo->Effects[i].TargetA == TARGET_GAMEOBJECT_ITEM &&
!m_targets.GetGOTarget() &&
(!pTempItem || !pTempItem->GetTemplate()->LockID || !pTempItem->IsLocked()))
return SPELL_FAILED_BAD_TARGETS;
@@ -5162,7 +5167,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// This is generic summon effect
case SPELL_EFFECT_SUMMON:
{
- SummonPropertiesEntry const *SummonProperties = sSummonPropertiesStore.LookupEntry(m_spellInfo->EffectMiscValueB[i]);
+ SummonPropertiesEntry const *SummonProperties = sSummonPropertiesStore.LookupEntry(m_spellInfo->Effects[i].MiscValueB);
if (!SummonProperties)
break;
switch(SummonProperties->Category)
@@ -5283,7 +5288,7 @@ SpellCastResult Spell::CheckCast(bool strict)
for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
{
- switch(m_spellInfo->EffectApplyAuraName[i])
+ switch(m_spellInfo->Effects[i].ApplyAuraName)
{
case SPELL_AURA_DUMMY:
{
@@ -5361,8 +5366,8 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_caster->GetCharmerGUID())
return SPELL_FAILED_CHARMED;
- if (m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_CHARM
- || m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_POSSESS)
+ if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_CHARM
+ || m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_POSSESS)
{
if (m_caster->GetPetGUID())
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
@@ -5489,7 +5494,7 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
if (m_caster->HasUnitState(UNIT_STAT_CASTING) && !m_IsTriggeredSpell) //prevent spellcast interruption by another spellcast
return SPELL_FAILED_SPELL_IN_PROGRESS;
- if (m_caster->isInCombat() && IsNonCombatSpell(m_spellInfo))
+ if (m_caster->isInCombat() && !m_spellInfo->CanBeUsedInCombat())
return SPELL_FAILED_AFFECTING_COMBAT;
//dead owner (pets still alive when owners ressed?)
@@ -5502,8 +5507,8 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- if (SpellTargetType[m_spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_UNIT_TARGET
- || SpellTargetType[m_spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_DEST_TARGET)
+ if (m_spellInfo->Effects[i].TargetA.GetType() == TARGET_TYPE_UNIT_TARGET
+ || m_spellInfo->Effects[i].TargetA.GetType() == TARGET_TYPE_DEST_TARGET)
{
if (!target)
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
@@ -5545,12 +5550,12 @@ SpellCastResult Spell::CheckCasterAuras() const
{
for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- if (m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_SCHOOL_IMMUNITY)
- school_immune |= uint32(m_spellInfo->EffectMiscValue[i]);
- else if (m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MECHANIC_IMMUNITY)
- mechanic_immune |= 1 << uint32(m_spellInfo->EffectMiscValue[i]);
- else if (m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_DISPEL_IMMUNITY)
- dispel_immune |= GetDispelMask(DispelType(m_spellInfo->EffectMiscValue[i]));
+ if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_SCHOOL_IMMUNITY)
+ school_immune |= uint32(m_spellInfo->Effects[i].MiscValue);
+ else if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MECHANIC_IMMUNITY)
+ mechanic_immune |= 1 << uint32(m_spellInfo->Effects[i].MiscValue);
+ else if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_DISPEL_IMMUNITY)
+ dispel_immune |= SpellInfo::GetDispelMask(DispelType(m_spellInfo->Effects[i].MiscValue));
}
// immune movement impairment and loss of control
if (m_spellInfo->Id == 42292 || m_spellInfo->Id == 59752)
@@ -5577,7 +5582,7 @@ SpellCastResult Spell::CheckCasterAuras() const
Unit::AuraEffectList const& stunAuras = m_caster->GetAuraEffectsByType(SPELL_AURA_MOD_STUN);
for (Unit::AuraEffectList::const_iterator i = stunAuras.begin(); i != stunAuras.end(); ++i)
{
- if (!(GetAllSpellMechanicMask((*i)->GetSpellProto()) & (1<<MECHANIC_STUN)))
+ if (!((*i)->GetSpellInfo()->GetAllEffectsMechanicMask() & (1<<MECHANIC_STUN)))
{
foundNotStun = true;
break;
@@ -5608,12 +5613,12 @@ SpellCastResult Spell::CheckCasterAuras() const
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
Aura const* aura = itr->second->GetBase();
- SpellEntry const* auraInfo = aura->GetSpellProto();
- if (GetAllSpellMechanicMask(auraInfo) & mechanic_immune)
+ SpellInfo const* auraInfo = aura->GetSpellInfo();
+ if (auraInfo->GetAllEffectsMechanicMask() & mechanic_immune)
continue;
- if (GetSpellSchoolMask(auraInfo) & school_immune)
+ if (auraInfo->GetSchoolMask() & school_immune)
continue;
- if ((1<<(auraInfo->Dispel)) & dispel_immune)
+ if (auraInfo->GetDispelMask() & dispel_immune)
continue;
//Make a second check for spell failed so the right SPELL_FAILED message is returned.
@@ -5625,7 +5630,7 @@ SpellCastResult Spell::CheckCasterAuras() const
switch (part->GetAuraType())
{
case SPELL_AURA_MOD_STUN:
- if (!usableInStun || !(GetAllSpellMechanicMask(auraInfo) & (1<<MECHANIC_STUN)))
+ if (!usableInStun || !(auraInfo->GetAllEffectsMechanicMask() & (1<<MECHANIC_STUN)))
return SPELL_FAILED_STUNNED;
break;
case SPELL_AURA_MOD_CONFUSE:
@@ -5663,7 +5668,7 @@ bool Spell::CanAutoCast(Unit* target)
for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
- if (m_spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA)
+ if (m_spellInfo->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA)
{
if (m_spellInfo->StackAmount <= 1)
{
@@ -5677,7 +5682,7 @@ bool Spell::CanAutoCast(Unit* target)
return false;
}
}
- else if (IsAreaAuraEffect(m_spellInfo->Effect[j]))
+ else if (m_spellInfo->Effects[j].IsArea())
{
if (target->HasAuraEffect(m_spellInfo->Id, j))
return false;
@@ -5699,20 +5704,10 @@ bool Spell::CanAutoCast(Unit* target)
SpellCastResult Spell::CheckRange(bool strict)
{
- // self cast doesn't need range checking -- also for Starshards fix
- if (m_spellInfo->rangeIndex == 1)
- return SPELL_CAST_OK;
-
- // Don't check for instant cast spells
- if (!strict && m_casttime == 0)
- return SPELL_CAST_OK;
-
- SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex);
-
Unit* target = m_targets.GetUnitTarget();
- float max_range = (float)m_caster->GetSpellMaxRangeForTarget(target, srange);
- float min_range = (float)m_caster->GetSpellMinRangeForTarget(target, srange);
- uint32 range_type = GetSpellRangeType(srange);
+ float max_range = m_caster->GetSpellMaxRangeForTarget(target, m_spellInfo);
+ float min_range = m_caster->GetSpellMinRangeForTarget(target, m_spellInfo);
+ uint32 range_type = m_spellInfo->RangeEntry->type;
if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, max_range, this);
@@ -5759,29 +5754,29 @@ SpellCastResult Spell::CheckPower()
return SPELL_CAST_OK;
// health as power used - need check health amount
- if (m_spellInfo->powerType == POWER_HEALTH)
+ if (m_spellInfo->PowerType == POWER_HEALTH)
{
if (int32(m_caster->GetHealth()) <= m_powerCost)
return SPELL_FAILED_CASTER_AURASTATE;
return SPELL_CAST_OK;
}
// Check valid power type
- if (m_spellInfo->powerType >= MAX_POWERS)
+ if (m_spellInfo->PowerType >= MAX_POWERS)
{
- sLog->outError("Spell::CheckPower: Unknown power type '%d'", m_spellInfo->powerType);
+ sLog->outError("Spell::CheckPower: Unknown power type '%d'", m_spellInfo->PowerType);
return SPELL_FAILED_UNKNOWN;
}
//check rune cost only if a spell has PowerType == POWER_RUNE
- if (m_spellInfo->powerType == POWER_RUNE)
+ if (m_spellInfo->PowerType == POWER_RUNE)
{
- SpellCastResult failReason = CheckRuneCost(m_spellInfo->runeCostID);
+ SpellCastResult failReason = CheckRuneCost(m_spellInfo->RuneCostID);
if (failReason != SPELL_CAST_OK)
return failReason;
}
// Check power amount
- Powers powerType = Powers(m_spellInfo->powerType);
+ Powers powerType = Powers(m_spellInfo->PowerType);
if (int32(m_caster->GetPower(powerType)) < m_powerCost)
return SPELL_FAILED_NO_POWER;
else
@@ -5823,10 +5818,10 @@ SpellCastResult Spell::CheckItems()
for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
{
// skip check, pet not required like checks, and for TARGET_UNIT_PET m_targets.GetUnitTarget() is not the real target but the caster
- if (m_spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_PET)
+ if (m_spellInfo->Effects[i].TargetA == TARGET_UNIT_PET)
continue;
- if (m_spellInfo->Effect[i] == SPELL_EFFECT_HEAL)
+ if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_HEAL)
{
if (m_targets.GetUnitTarget()->IsFullHealth())
{
@@ -5841,15 +5836,15 @@ SpellCastResult Spell::CheckItems()
}
// Mana Potion, Rage Potion, Thistle Tea(Rogue), ...
- if (m_spellInfo->Effect[i] == SPELL_EFFECT_ENERGIZE)
+ if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_ENERGIZE)
{
- if (m_spellInfo->EffectMiscValue[i] < 0 || m_spellInfo->EffectMiscValue[i] >= int8(MAX_POWERS))
+ if (m_spellInfo->Effects[i].MiscValue < 0 || m_spellInfo->Effects[i].MiscValue >= int8(MAX_POWERS))
{
failReason = SPELL_FAILED_ALREADY_AT_FULL_POWER;
continue;
}
- Powers power = Powers(m_spellInfo->EffectMiscValue[i]);
+ Powers power = Powers(m_spellInfo->Effects[i].MiscValue);
if (m_targets.GetUnitTarget()->GetPower(power) == m_targets.GetUnitTarget()->GetMaxPower(power))
{
failReason = SPELL_FAILED_ALREADY_AT_FULL_POWER;
@@ -5989,32 +5984,32 @@ SpellCastResult Spell::CheckItems()
// special checks for spell effects
for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
{
- switch (m_spellInfo->Effect[i])
+ switch (m_spellInfo->Effects[i].Effect)
{
case SPELL_EFFECT_CREATE_ITEM:
case SPELL_EFFECT_CREATE_ITEM_2:
{
- if (!m_IsTriggeredSpell && m_spellInfo->EffectItemType[i])
+ if (!m_IsTriggeredSpell && m_spellInfo->Effects[i].ItemType)
{
ItemPosCountVec dest;
- InventoryResult msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->EffectItemType[i], 1);
+ InventoryResult msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->Effects[i].ItemType, 1);
if (msg != EQUIP_ERR_OK)
{
- ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(m_spellInfo->EffectItemType[i]);
+ ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(m_spellInfo->Effects[i].ItemType);
// TODO: Needs review
if (pProto && !(pProto->ItemLimitCategory))
{
- p_caster->SendEquipError(msg, NULL, NULL, m_spellInfo->EffectItemType[i]);
+ p_caster->SendEquipError(msg, NULL, NULL, m_spellInfo->Effects[i].ItemType);
return SPELL_FAILED_DONT_REPORT;
}
else
{
if (!(m_spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && (m_spellInfo->SpellFamilyFlags[0] & 0x40000000)))
return SPELL_FAILED_TOO_MANY_OF_ITEM;
- else if (!(p_caster->HasItemCount(m_spellInfo->EffectItemType[i], 1)))
+ else if (!(p_caster->HasItemCount(m_spellInfo->Effects[i].ItemType, 1)))
return SPELL_FAILED_TOO_MANY_OF_ITEM;
else
- p_caster->CastSpell(m_caster, SpellMgr::CalculateSpellEffectAmount(m_spellInfo, 1), false); // move this to anywhere
+ p_caster->CastSpell(m_caster, m_spellInfo->Effects[EFFECT_1].CalcValue(), false); // move this to anywhere
return SPELL_FAILED_DONT_REPORT;
}
}
@@ -6022,7 +6017,7 @@ SpellCastResult Spell::CheckItems()
break;
}
case SPELL_EFFECT_ENCHANT_ITEM:
- if (m_spellInfo->EffectItemType[i] && m_targets.GetItemTarget()
+ if (m_spellInfo->Effects[i].ItemType && m_targets.GetItemTarget()
&& (m_targets.GetItemTarget()->IsWeaponVellum() || m_targets.GetItemTarget()->IsArmorVellum()))
{
// cannot enchant vellum for other player
@@ -6032,10 +6027,10 @@ SpellCastResult Spell::CheckItems()
if (m_CastItem && m_CastItem->GetTemplate()->Flags & ITEM_PROTO_FLAG_TRIGGERED_CAST)
return SPELL_FAILED_TOTEM_CATEGORY;
ItemPosCountVec dest;
- InventoryResult msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->EffectItemType[i], 1);
+ InventoryResult msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->Effects[i].ItemType, 1);
if (msg != EQUIP_ERR_OK)
{
- p_caster->SendEquipError(msg, NULL, NULL, m_spellInfo->EffectItemType[i]);
+ p_caster->SendEquipError(msg, NULL, NULL, m_spellInfo->Effects[i].ItemType);
return SPELL_FAILED_DONT_REPORT;
}
}
@@ -6045,7 +6040,7 @@ SpellCastResult Spell::CheckItems()
if (!targetItem)
return SPELL_FAILED_ITEM_NOT_FOUND;
- if (targetItem->GetTemplate()->ItemLevel < m_spellInfo->baseLevel)
+ if (targetItem->GetTemplate()->ItemLevel < m_spellInfo->BaseLevel)
return SPELL_FAILED_LOWLEVEL;
bool isItemUsable = false;
@@ -6061,7 +6056,7 @@ SpellCastResult Spell::CheckItems()
}
}
- SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(m_spellInfo->EffectMiscValue[i]);
+ SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(m_spellInfo->Effects[i].MiscValue);
// do not allow adding usable enchantments to items that have use effect already
if (pEnchant && isItemUsable)
for (uint8 s = 0; s < MAX_ITEM_ENCHANTMENT_EFFECTS; ++s)
@@ -6086,7 +6081,7 @@ SpellCastResult Spell::CheckItems()
// Not allow enchant in trade slot for some enchant type
if (item->GetOwner() != m_caster)
{
- uint32 enchant_id = m_spellInfo->EffectMiscValue[i];
+ uint32 enchant_id = m_spellInfo->Effects[i].MiscValue;
SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
if (!pEnchant)
return SPELL_FAILED_ERROR;
@@ -6242,7 +6237,7 @@ SpellCastResult Spell::CheckItems()
}
case SPELL_EFFECT_CREATE_MANA_GEM:
{
- uint32 item_id = m_spellInfo->EffectItemType[i];
+ uint32 item_id = m_spellInfo->Effects[i].ItemType;
ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(item_id);
if (!pProto)
@@ -6347,7 +6342,7 @@ void Spell::DelayedChannel()
return;
//check pushback reduce
- int32 delaytime = CalculatePctN(GetSpellDuration(m_spellInfo), 25); // channeling delay is normally 25% of its time per hit
+ int32 delaytime = CalculatePctN(m_spellInfo->GetDuration(), 25); // channeling delay is normally 25% of its time per hit
int32 delayReduce = 100; // must be initialized to 100 for percent modifiers
m_caster->ToPlayer()->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this);
delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100;
@@ -6414,7 +6409,7 @@ bool Spell::CheckTargetCreatureType(Unit* target) const
spellCreatureTargetMask = 0;
// Polymorph and Grounding Totem
- if (target->GetEntry() == 5925 && m_spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && (m_spellInfo->SpellFamilyFlags[0] & 0x1000000) && m_spellInfo->EffectApplyAuraName[0] == SPELL_AURA_MOD_CONFUSE)
+ if (target->GetEntry() == 5925 && m_spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && (m_spellInfo->SpellFamilyFlags[0] & 0x1000000) && m_spellInfo->Effects[0].ApplyAuraName == SPELL_AURA_MOD_CONFUSE)
return true;
if (spellCreatureTargetMask)
@@ -6432,7 +6427,7 @@ CurrentSpellTypes Spell::GetCurrentContainer()
return(CURRENT_MELEE_SPELL);
else if (IsAutoRepeat())
return(CURRENT_AUTOREPEAT_SPELL);
- else if (IsChanneledSpell(m_spellInfo))
+ else if (m_spellInfo->IsChanneled())
return(CURRENT_CHANNELED_SPELL);
else
return(CURRENT_GENERIC_SPELL);
@@ -6441,16 +6436,16 @@ CurrentSpellTypes Spell::GetCurrentContainer()
bool Spell::CheckTarget(Unit* target, uint32 eff)
{
// Check targets for creature type mask and remove not appropriate (skip explicit self target case, maybe need other explicit targets)
- if (m_spellInfo->EffectImplicitTargetA[eff] != TARGET_UNIT_CASTER)
+ if (m_spellInfo->Effects[eff].TargetA != TARGET_UNIT_CASTER)
{
if (!CheckTargetCreatureType(target))
return false;
}
// Check Aura spell req (need for AoE spells)
- if (m_spellInfo->targetAuraSpell && !target->HasAura(sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->targetAuraSpell, m_caster)))
+ if (m_spellInfo->TargetAuraSpell && !target->HasAura(sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->TargetAuraSpell, m_caster)))
return false;
- if (m_spellInfo->excludeTargetAuraSpell && target->HasAura(sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->excludeTargetAuraSpell, m_caster)))
+ if (m_spellInfo->ExcludeTargetAuraSpell && target->HasAura(sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->ExcludeTargetAuraSpell, m_caster)))
return false;
// Check targets for not_selectable unit flag and remove
@@ -6475,11 +6470,11 @@ bool Spell::CheckTarget(Unit* target, uint32 eff)
if (!target->ToPlayer()->IsVisible())
return false;
- if (target->ToPlayer()->isGameMaster() && !IsPositiveSpell(m_spellInfo->Id))
+ if (target->ToPlayer()->isGameMaster() && !m_spellInfo->IsPositive())
return false;
}
- switch(m_spellInfo->EffectApplyAuraName[eff])
+ switch(m_spellInfo->Effects[eff].ApplyAuraName)
{
case SPELL_AURA_NONE:
default:
@@ -6505,7 +6500,7 @@ bool Spell::CheckTarget(Unit* target, uint32 eff)
return true;
//Check targets for LOS visibility (except spells without range limitations)
- switch(m_spellInfo->Effect[eff])
+ switch(m_spellInfo->Effects[eff].Effect)
{
case SPELL_EFFECT_SUMMON_PLAYER: // from anywhere
break;
@@ -6550,10 +6545,20 @@ bool Spell::CheckTarget(Unit* target, uint32 eff)
return true;
}
+bool Spell::IsNextMeleeSwingSpell() const
+{
+ return m_spellInfo->Attributes & SPELL_ATTR0_ON_NEXT_SWING;
+}
+
+bool Spell::IsAutoActionResetSpell() const
+{
+ return !m_IsTriggeredSpell && (m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_AUTOATTACK);
+}
+
bool Spell::IsNeedSendToClient() const
{
- return m_spellInfo->SpellVisual[0] || m_spellInfo->SpellVisual[1] || IsChanneledSpell(m_spellInfo) ||
- m_spellInfo->speed > 0.0f || (!m_triggeredByAuraSpell && !m_IsTriggeredSpell);
+ return m_spellInfo->SpellVisual[0] || m_spellInfo->SpellVisual[1] || m_spellInfo->IsChanneled() ||
+ m_spellInfo->Speed > 0.0f || (!m_triggeredByAuraSpell && !m_IsTriggeredSpell);
}
bool Spell::HaveTargetsForEffect(uint8 effect) const
@@ -6724,10 +6729,10 @@ bool Spell::IsValidSingleTargetSpell(Unit const* target) const
}
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- if (!IsValidSingleTargetEffect(target, Targets(m_spellInfo->EffectImplicitTargetA[i])))
+ if (!IsValidSingleTargetEffect(target, m_spellInfo->Effects[i].TargetA))
return false;
// Need to check B?
- //if (!IsValidSingleTargetEffect(m_spellInfo->EffectImplicitTargetB[i], target)
+ //if (!IsValidSingleTargetEffect(m_spellInfo->Effects[i].TargetB, target)
// return false;
}
return true;
@@ -6736,8 +6741,8 @@ bool Spell::IsValidSingleTargetSpell(Unit const* target) const
bool Spell::IsValidDeadOrAliveTarget(Unit const* target) const
{
if (target->isAlive())
- return !IsRequiringDeadTargetSpell(m_spellInfo);
- if (IsAllowingDeadTargetSpell(m_spellInfo))
+ return !m_spellInfo->IsRequiringDeadTarget();
+ if (m_spellInfo->IsAllowingDeadTarget())
return true;
return false;
}
@@ -6747,7 +6752,7 @@ void Spell::CalculateDamageDoneForAllTargets()
float multiplier[MAX_SPELL_EFFECTS];
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (m_applyMultiplierMask & (1 << i))
- multiplier[i] = SpellMgr::CalculateSpellEffectDamageMultiplier(m_spellInfo, i, m_originalCaster, this);
+ multiplier[i] = m_spellInfo->Effects[i].CalcDamageMultiplier(m_originalCaster, this);
bool usesAmmo = true;
Unit::AuraEffectList const& Auras = m_caster->GetAuraEffectsByType(SPELL_AURA_ABILITY_CONSUME_NO_AMMO);
@@ -6776,7 +6781,7 @@ void Spell::CalculateDamageDoneForAllTargets()
{
if (!(mask & 1<<i))
continue;
- switch (m_spellInfo->Effect[i])
+ switch (m_spellInfo->Effects[i].Effect)
{
case SPELL_EFFECT_SCHOOL_DAMAGE:
case SPELL_EFFECT_WEAPON_DAMAGE:
@@ -6818,7 +6823,7 @@ int32 Spell::CalculateDamageDone(Unit *unit, const uint32 effectMask, float * mu
m_damage = 0;
damage = CalculateDamage(i, NULL);
- switch(m_spellInfo->Effect[i])
+ switch(m_spellInfo->Effects[i].Effect)
{
case SPELL_EFFECT_SCHOOL_DAMAGE:
SpellDamageSchoolDmg((SpellEffIndex)i);
@@ -6836,7 +6841,7 @@ int32 Spell::CalculateDamageDone(Unit *unit, const uint32 effectMask, float * mu
if (m_damage > 0)
{
- if (IsAreaEffectTarget[m_spellInfo->EffectImplicitTargetA[i]] || IsAreaEffectTarget[m_spellInfo->EffectImplicitTargetB[i]])
+ if (m_spellInfo->Effects[i].IsArea())
{
m_damage = int32(float(m_damage) * unit->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, m_spellInfo->SchoolMask));
if (m_caster->GetTypeId() == TYPEID_UNIT)
@@ -6893,7 +6898,7 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk
reqKey = true;
// wrong locktype, skip
- if (uint32(m_spellInfo->EffectMiscValue[effIndex]) != lockInfo->Index[j])
+ if (uint32(m_spellInfo->Effects[effIndex].MiscValue) != lockInfo->Index[j])
continue;
skillId = SkillByLockType(LockType(lockInfo->Index[j]));
@@ -6908,7 +6913,7 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk
// skill bonus provided by casting spell (mostly item spells)
// add the damage modifier from the spell casted (cheat lock / skeleton key etc.)
- if (m_spellInfo->EffectImplicitTargetA[effIndex] == TARGET_GAMEOBJECT_ITEM || m_spellInfo->EffectImplicitTargetB[effIndex] == TARGET_GAMEOBJECT_ITEM)
+ if (m_spellInfo->Effects[effIndex].TargetA == TARGET_GAMEOBJECT_ITEM || m_spellInfo->Effects[effIndex].TargetB == TARGET_GAMEOBJECT_ITEM)
skillValue += uint32(CalculateDamage(effIndex, NULL));
if (skillValue < reqSkillValue)
@@ -6931,13 +6936,13 @@ void Spell::SetSpellValue(SpellValueMod mod, int32 value)
switch (mod)
{
case SPELLVALUE_BASE_POINT0:
- m_spellValue->EffectBasePoints[0] = SpellMgr::CalculateSpellEffectBaseAmount(value, m_spellInfo, 0);
+ m_spellValue->EffectBasePoints[0] = m_spellInfo->Effects[EFFECT_0].CalcBaseValue(value);
break;
case SPELLVALUE_BASE_POINT1:
- m_spellValue->EffectBasePoints[1] = SpellMgr::CalculateSpellEffectBaseAmount(value, m_spellInfo, 1);
+ m_spellValue->EffectBasePoints[1] = m_spellInfo->Effects[EFFECT_1].CalcBaseValue(value);
break;
case SPELLVALUE_BASE_POINT2:
- m_spellValue->EffectBasePoints[2] = SpellMgr::CalculateSpellEffectBaseAmount(value, m_spellInfo, 2);
+ m_spellValue->EffectBasePoints[2] = m_spellInfo->Effects[EFFECT_2].CalcBaseValue(value);
break;
case SPELLVALUE_RADIUS_MOD:
m_spellValue->RadiusMod = (float)value / 10000;
@@ -6988,7 +6993,7 @@ void Spell::SelectTrajTargets()
if (a > -0.0001f) a = 0;
DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: a %f b %f", a, b);)
- float bestDist = GetSpellMaxRange(m_spellInfo, false);
+ float bestDist = m_spellInfo->GetMaxRange(false);
UnitList::const_iterator itr = unitList.begin();
for (; itr != unitList.end(); ++itr)
@@ -7252,7 +7257,7 @@ bool Spell::CanExecuteTriggersOnHit(uint8 effMask) const
// prevents triggering/procing effects twice from spells like Eviscerate
for (uint8 i = 0;effMask && i < MAX_SPELL_EFFECTS; ++i)
{
- if (m_spellInfo->Effect[i] == SPELL_EFFECT_DUMMY)
+ if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_DUMMY)
effMask &= ~(1<<i);
}
return effMask;
@@ -7263,10 +7268,12 @@ void Spell::PrepareTriggersExecutedOnHit()
// todo: move this to scripts
if (m_spellInfo->SpellFamilyName)
{
- if (m_spellInfo->excludeCasterAuraSpell && !IsPositiveSpell(m_spellInfo->excludeCasterAuraSpell))
- m_preCastSpell = m_spellInfo->excludeCasterAuraSpell;
- else if (m_spellInfo->excludeTargetAuraSpell && !IsPositiveSpell(m_spellInfo->excludeTargetAuraSpell))
- m_preCastSpell = m_spellInfo->excludeTargetAuraSpell;
+ SpellInfo const* excludeCasterSpellInfo = sSpellMgr->GetSpellInfo(m_spellInfo->ExcludeCasterAuraSpell);
+ if (excludeCasterSpellInfo && !excludeCasterSpellInfo->IsPositive())
+ m_preCastSpell = m_spellInfo->ExcludeCasterAuraSpell;
+ SpellInfo const* excludeTargetSpellInfo = sSpellMgr->GetSpellInfo(m_spellInfo->ExcludeTargetAuraSpell);
+ if (excludeTargetSpellInfo && !excludeTargetSpellInfo->IsPositive())
+ m_preCastSpell = m_spellInfo->ExcludeTargetAuraSpell;
}
// todo: move this to scripts
@@ -7295,9 +7302,9 @@ void Spell::PrepareTriggersExecutedOnHit()
{
if (!(*i)->IsAffectedOnSpell(m_spellInfo))
continue;
- SpellEntry const *auraSpellInfo = (*i)->GetSpellProto();
+ SpellInfo const *auraSpellInfo = (*i)->GetSpellInfo();
uint32 auraSpellIdx = (*i)->GetEffIndex();
- if (SpellEntry const *spellInfo = sSpellStore.LookupEntry(auraSpellInfo->EffectTriggerSpell[auraSpellIdx]))
+ if (SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(auraSpellInfo->Effects[auraSpellIdx].TriggerSpell))
{
// calculate the chance using spell base amount, because aura amount is not updated on combo-points change
// this possibly needs fixing
diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h
index 10ca4ff2e1a..370062dc762 100755
--- a/src/server/game/Spells/Spell.h
+++ b/src/server/game/Spells/Spell.h
@@ -31,8 +31,8 @@ class WorldObject;
class Aura;
class SpellScript;
class ByteBuffer;
-
-struct SpellEntry;
+class SpellInfo;
+class SpellImplicitTargetInfo;
#define SPELL_CHANNEL_UPDATE_INTERVAL (1 * IN_MILLISECONDS)
@@ -211,14 +211,7 @@ class SpellCastTargets
struct SpellValue
{
- explicit SpellValue(SpellEntry const* proto)
- {
- for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- EffectBasePoints[i] = proto->EffectBasePoints[i];
- MaxAffectedTargets = proto->MaxAffectedTargets;
- RadiusMod = 1.0f;
- AuraStackAmount = 1;
- }
+ explicit SpellValue(SpellInfo const* proto);
int32 EffectBasePoints[MAX_SPELL_EFFECTS];
uint32 MaxAffectedTargets;
float RadiusMod;
@@ -387,7 +380,7 @@ class Spell
typedef std::set<Aura*> UsedSpellMods;
- Spell(Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID = 0, bool skipCheck = false, bool castedClientside = false);
+ Spell(Unit* Caster, SpellInfo const *info, bool triggered, uint64 originalCasterGUID = 0, bool skipCheck = false, bool castedClientside = false);
~Spell();
void prepare(SpellCastTargets const* targets, AuraEffect const* triggeredByAura = NULL);
@@ -431,7 +424,7 @@ class Spell
void WriteAmmoToPacket(WorldPacket * data);
void SelectSpellTargets();
- void SelectEffectTargets(uint32 i, uint32 cur);
+ void SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur);
void SelectTrajTargets();
template<typename T> WorldObject* FindCorpseUsing();
@@ -441,7 +434,7 @@ class Spell
void CheckSrc() { if (!m_targets.HasSrc()) m_targets.SetSrc(*m_caster); }
void CheckDst() { if (!m_targets.HasDst()) m_targets.SetDst(*m_caster); }
- static void SendCastResult(Player* caster, SpellEntry const* spellInfo, uint8 cast_count, SpellCastResult result, SpellCustomErrors customError = SPELL_CUSTOM_ERROR_NONE);
+ static void SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 cast_count, SpellCastResult result, SpellCustomErrors customError = SPELL_CUSTOM_ERROR_NONE);
void SendCastResult(SpellCastResult result);
void SendSpellStart();
void SendSpellGo();
@@ -463,9 +456,9 @@ class Spell
void SendResurrectRequest(Player* target);
void HandleEffects(Unit *pUnitTarget, Item *pItemTarget, GameObject *pGOTarget, uint32 i);
- void HandleThreatSpells(uint32 spellId);
+ void HandleThreatSpells();
- const SpellEntry * const m_spellInfo;
+ SpellInfo const* const m_spellInfo;
Item* m_CastItem;
uint64 m_castItemGUID;
uint8 m_cast_count;
@@ -477,17 +470,14 @@ class Spell
UsedSpellMods m_appliedMods;
- int32 GetCastTime() const { return m_casttime; }
+ int32 CalcCastTime() const { return m_casttime; }
bool IsAutoRepeat() const { return m_autoRepeat; }
void SetAutoRepeat(bool rep) { m_autoRepeat = rep; }
void ReSetTimer() { m_timer = m_casttime > 0 ? m_casttime : 0; }
- bool IsNextMeleeSwingSpell() const
- {
- return m_spellInfo->Attributes & SPELL_ATTR0_ON_NEXT_SWING;
- }
+ bool IsNextMeleeSwingSpell() const;
bool IsTriggered() const {return m_IsTriggeredSpell;};
bool IsChannelActive() const { return m_caster->GetUInt32Value(UNIT_CHANNEL_SPELL) != 0; }
- bool IsAutoActionResetSpell() const { return !m_IsTriggeredSpell && (m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_AUTOATTACK); }
+ bool IsAutoActionResetSpell() const;
bool IsDeletable() const { return !m_referencedFromCurrentSpell && !m_executedCurrently; }
void SetReferencedFromCurrent(bool yes) { m_referencedFromCurrentSpell = yes; }
@@ -503,7 +493,7 @@ class Spell
Unit* GetCaster() const { return m_caster; }
Unit* GetOriginalCaster() const { return m_originalCaster; }
- SpellEntry const* GetSpellInfo() const { return m_spellInfo; }
+ SpellInfo const* GetSpellInfo() const { return m_spellInfo; }
int32 GetPowerCost() const { return m_powerCost; }
void UpdatePointers(); // must be used at call Spell code after time delay (non triggered spell cast/update spell call/etc)
@@ -669,7 +659,7 @@ class Spell
bool CanExecuteTriggersOnHit(uint8 effMask) const;
void PrepareTriggersExecutedOnHit();
- typedef std::list< std::pair<SpellEntry const*, int32> > HitTriggerSpells;
+ typedef std::list< std::pair<SpellInfo const*, int32> > HitTriggerSpells;
HitTriggerSpells m_hitTriggerSpells;
// effect helpers
@@ -689,9 +679,8 @@ class Spell
// if need this can be replaced by Aura copy
// we can't store original aura link to prevent access to deleted auras
// and in same time need aura data and after aura deleting.
- SpellEntry const* m_triggeredByAuraSpell;
+ SpellInfo const* m_triggeredByAuraSpell;
- uint32 m_customAttr;
bool m_skipCheck;
uint32 m_effectMask;
uint8 m_auraScaleMask;
@@ -719,10 +708,10 @@ namespace Trinity
uint32 i_entry;
const Position * const i_pos;
bool i_requireDeadTarget;
- SpellEntry const* i_spellProto;
+ SpellInfo const* i_spellProto;
SpellNotifierCreatureAndPlayer(Unit *source, std::list<Unit*> &data, float radius, SpellNotifyPushType type,
- SpellTargets TargetType = SPELL_TARGETS_ENEMY, const Position *pos = NULL, uint32 entry = 0, SpellEntry const* spellProto = NULL)
+ SpellTargets TargetType = SPELL_TARGETS_ENEMY, const Position *pos = NULL, uint32 entry = 0, SpellInfo const* spellProto = NULL)
: i_data(&data), i_push_type(type), i_radius(radius), i_TargetType(TargetType),
i_source(source), i_entry(entry), i_pos(pos), i_spellProto(spellProto)
{
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 9fc8d6cb6dc..491e6db5394 100755
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -258,7 +258,7 @@ void Spell::EffectResurrectNew(SpellEffIndex effIndex)
return;
uint32 health = damage;
- uint32 mana = m_spellInfo->EffectMiscValue[effIndex];
+ uint32 mana = m_spellInfo->Effects[effIndex].MiscValue;
ExecuteLogEffectResurrect(effIndex, pTarget);
pTarget->setResurrectRequestData(m_caster->GetGUID(), m_caster->GetMapId(), m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ(), health, mana);
SendResurrectRequest(pTarget);
@@ -309,11 +309,11 @@ void Spell::EffectEnvirinmentalDMG(SpellEffIndex effIndex)
// Note: this hack with damage replace required until GO casting not implemented
// environment damage spells already have around enemies targeting but this not help in case not existed GO casting support
// currently each enemy selected explicitly and self cast damage, we prevent apply self casted spell bonuses/etc
- damage = SpellMgr::CalculateSpellEffectAmount(m_spellInfo, effIndex, m_caster);
+ damage = m_spellInfo->Effects[effIndex].CalcValue(m_caster);
- m_caster->CalcAbsorbResist(m_caster, GetSpellSchoolMask(m_spellInfo), SPELL_DIRECT_DAMAGE, damage, &absorb, &resist, m_spellInfo);
+ m_caster->CalcAbsorbResist(m_caster, m_spellInfo->GetSchoolMask(), SPELL_DIRECT_DAMAGE, damage, &absorb, &resist, m_spellInfo);
- m_caster->SendSpellNonMeleeDamageLog(m_caster, m_spellInfo->Id, damage, GetSpellSchoolMask(m_spellInfo), absorb, resist, false, 0, false);
+ m_caster->SendSpellNonMeleeDamageLog(m_caster, m_spellInfo->Id, damage, m_spellInfo->GetSchoolMask(), absorb, resist, false, 0, false);
if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->EnvironmentalDamage(DAMAGE_FIRE, damage);
}
@@ -333,7 +333,7 @@ void Spell::SpellDamageSchoolDmg(SpellEffIndex effIndex)
case SPELLFAMILY_GENERIC:
{
// Meteor like spells (divided damage to targets)
- if (m_customAttr & SPELL_ATTR0_CU_SHARE_DAMAGE)
+ if (m_spellInfo->AttributesCu & SPELL_ATTR0_CU_SHARE_DAMAGE)
{
uint32 count = 0;
for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
@@ -405,10 +405,26 @@ void Spell::SpellDamageSchoolDmg(SpellEffIndex effIndex)
if (unitTarget->GetGUID() == m_caster->GetGUID() || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- float radius = GetSpellRadiusForHostile(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[0]));
- if (!radius) return;
+ float radius = m_spellInfo->Effects[EFFECT_0].CalcRadius(m_caster);
+ if (!radius)
+ return;
+ float distance = m_caster->GetDistance2d(unitTarget);
+ damage = (distance > radius) ? 0 : int32(m_spellInfo->Effects[EFFECT_0].CalcValue(m_caster) * ((radius - distance)/radius));
+ break;
+ }
+ // Loken Pulsing Shockwave
+ case 59837:
+ case 52942:
+ {
+ // don't damage self and only players
+ if (unitTarget->GetGUID() == m_caster->GetGUID() || unitTarget->GetTypeId() != TYPEID_PLAYER)
+ return;
+
+ float radius = m_spellInfo->Effects[EFFECT_0].CalcRadius(m_caster);
+ if (!radius)
+ return;
float distance = m_caster->GetDistance2d(unitTarget);
- damage = (distance > radius) ? 0 : int32(SpellMgr::CalculateSpellEffectAmount(m_spellInfo, 0) * ((radius - distance)/radius));
+ damage = (distance > radius) ? 0 : int32(m_spellInfo->Effects[EFFECT_0].CalcValue(m_caster) * distance);
break;
}
// TODO: add spell specific target requirement hook for spells
@@ -440,22 +456,6 @@ void Spell::SpellDamageSchoolDmg(SpellEffIndex effIndex)
damage = (m_caster->getLevel() - 60) * 4 + 60;
break;
}
-
- // Loken Pulsing Shockwave
- case 59837:
- case 52942:
- {
- // don't damage self and only players
- if (unitTarget->GetGUID() == m_caster->GetGUID() || unitTarget->GetTypeId() != TYPEID_PLAYER)
- return;
-
- float radius = GetSpellRadiusForHostile(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[0]));
- if (!radius)
- return;
- float distance = m_caster->GetDistance2d(unitTarget);
- damage = (distance > radius) ? 0 : int32(SpellMgr::CalculateSpellEffectAmount(m_spellInfo, 0) * distance);
- break;
- }
}
break;
}
@@ -502,19 +502,19 @@ void Spell::SpellDamageSchoolDmg(SpellEffIndex effIndex)
for (Unit::AuraEffectList::const_iterator i = mPeriodic.begin(); i != mPeriodic.end(); ++i)
{
// for caster applied auras only
- if ((*i)->GetSpellProto()->SpellFamilyName != SPELLFAMILY_WARLOCK ||
+ if ((*i)->GetSpellInfo()->SpellFamilyName != SPELLFAMILY_WARLOCK ||
(*i)->GetCasterGUID() != m_caster->GetGUID())
continue;
// Immolate
- if ((*i)->GetSpellProto()->SpellFamilyFlags[0] & 0x4)
+ if ((*i)->GetSpellInfo()->SpellFamilyFlags[0] & 0x4)
{
aura = *i; // it selected always if exist
break;
}
// Shadowflame
- if ((*i)->GetSpellProto()->SpellFamilyFlags[2] & 0x00000002)
+ if ((*i)->GetSpellInfo()->SpellFamilyFlags[2] & 0x00000002)
aura = *i; // remember but wait possible Immolate as primary priority
}
@@ -522,13 +522,13 @@ void Spell::SpellDamageSchoolDmg(SpellEffIndex effIndex)
if (aura)
{
uint32 pdamage = uint32(std::max(aura->GetAmount(), 0));
- pdamage = m_caster->SpellDamageBonus(unitTarget, aura->GetSpellProto(), pdamage, DOT, aura->GetBase()->GetStackAmount());
+ pdamage = m_caster->SpellDamageBonus(unitTarget, aura->GetSpellInfo(), pdamage, DOT, aura->GetBase()->GetStackAmount());
uint32 pct_dir = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, (effIndex + 1));
- uint8 baseTotalTicks = uint8(m_caster->CalcSpellDuration(aura->GetSpellProto()) / aura->GetSpellProto()->EffectAmplitude[0]);
+ uint8 baseTotalTicks = uint8(m_caster->CalcSpellDuration(aura->GetSpellInfo()) / aura->GetSpellInfo()->Effects[EFFECT_0].Amplitude);
damage += int32(CalculatePctU(pdamage * baseTotalTicks, pct_dir));
uint32 pct_dot = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, (effIndex + 2)) / 3;
- m_spellValue->EffectBasePoints[1] = SpellMgr::CalculateSpellEffectBaseAmount(int32(CalculatePctU(pdamage * baseTotalTicks, pct_dot)), m_spellInfo, 1);
+ m_spellValue->EffectBasePoints[1] = m_spellInfo->Effects[EFFECT_1].CalcBaseValue(int32(CalculatePctU(pdamage * baseTotalTicks, pct_dot)));
apply_direct_bonus = false;
// Glyph of Conflagrate
@@ -574,10 +574,10 @@ void Spell::SpellDamageSchoolDmg(SpellEffIndex effIndex)
Unit::AuraEffectList const& ImprMindBlast = m_caster->GetAuraEffectsByType(SPELL_AURA_ADD_FLAT_MODIFIER);
for (Unit::AuraEffectList::const_iterator i = ImprMindBlast.begin(); i != ImprMindBlast.end(); ++i)
{
- if ((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_PRIEST &&
- ((*i)->GetSpellProto()->SpellIconID == 95))
+ if ((*i)->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_PRIEST &&
+ ((*i)->GetSpellInfo()->SpellIconID == 95))
{
- int chance = SpellMgr::CalculateSpellEffectAmount((*i)->GetSpellProto(), 1, m_caster);
+ int chance = (*i)->GetSpellInfo()->Effects[EFFECT_1].CalcValue(m_caster);
if (roll_chance_i(chance))
// Mind Trauma
m_caster->CastSpell(unitTarget, 48301, true, 0);
@@ -594,7 +594,7 @@ void Spell::SpellDamageSchoolDmg(SpellEffIndex effIndex)
{
// converts each extra point of energy into ($f1+$AP/410) additional damage
float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
- float multiple = ap / 410 + m_spellInfo->EffectDamageMultiplier[effIndex];
+ float multiple = ap / 410 + m_spellInfo->Effects[effIndex].DamageMultiplier;
int32 energy = -(m_caster->ModifyPower(POWER_ENERGY, -30));
damage += int32(energy * multiple);
damage += int32(CalculatePctN(m_caster->ToPlayer()->GetComboPoints() * ap, 7));
@@ -630,9 +630,9 @@ void Spell::SpellDamageSchoolDmg(SpellEffIndex effIndex)
Unit::AuraEffectList const& auraList = m_caster->ToPlayer()->GetAuraEffectsByType(SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK);
for (Unit::AuraEffectList::const_iterator iter = auraList.begin(); iter != auraList.end(); ++iter)
{
- if ((*iter)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_ROGUE && (*iter)->GetSpellProto()->SpellIconID == 1960)
+ if ((*iter)->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_ROGUE && (*iter)->GetSpellInfo()->SpellIconID == 1960)
{
- uint32 chance = SpellMgr::CalculateSpellEffectAmount((*iter)->GetSpellProto(), 2, m_caster);
+ uint32 chance = (*iter)->GetSpellInfo()->Effects[EFFECT_2].CalcValue(m_caster);
if (chance && roll_chance_i(chance))
needConsume = false;
@@ -683,7 +683,7 @@ void Spell::SpellDamageSchoolDmg(SpellEffIndex effIndex)
Unit::AuraEffectList const& decSpeedList = unitTarget->GetAuraEffectsByType(SPELL_AURA_MOD_DECREASE_SPEED);
for (Unit::AuraEffectList::const_iterator iter = decSpeedList.begin(); iter != decSpeedList.end(); ++iter)
{
- if ((*iter)->GetSpellProto()->SpellIconID == 15 && (*iter)->GetSpellProto()->Dispel == 0)
+ if ((*iter)->GetSpellInfo()->SpellIconID == 15 && (*iter)->GetSpellInfo()->Dispel == 0)
{
found = true;
break;
@@ -692,7 +692,7 @@ void Spell::SpellDamageSchoolDmg(SpellEffIndex effIndex)
// TODO: should this be put on taken but not done?
if (found)
- damage += SpellMgr::CalculateSpellEffectAmount(m_spellInfo, 1);
+ damage += m_spellInfo->Effects[EFFECT_1].CalcValue();
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
@@ -726,7 +726,7 @@ void Spell::SpellDamageSchoolDmg(SpellEffIndex effIndex)
// Shield of Righteousness
if (m_spellInfo->SpellFamilyFlags[EFFECT_1] & 0x100000)
{
- damage += CalculatePctN(m_caster->GetShieldBlockValue(), SpellMgr::CalculateSpellEffectAmount(m_spellInfo, EFFECT_1));
+ damage += CalculatePctN(m_caster->GetShieldBlockValue(), m_spellInfo->Effects[EFFECT_1].CalcValue());
break;
}
break;
@@ -797,8 +797,8 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
return;
}
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(12721);
- uint32 ticks = GetSpellDuration(spellInfo) / spellInfo->EffectAmplitude[0];
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(12721);
+ uint32 ticks = spellInfo->GetDuration() / spellInfo->Effects[EFFECT_0].Amplitude;
// Add remaining ticks to damage done
if (AuraEffect const* aurEff = unitTarget->GetAuraEffect(12721, EFFECT_0, m_caster->GetGUID()))
@@ -979,7 +979,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
damage = 12000; // maybe wrong value
damage /= count;
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(42784);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(42784);
// now deal the damage
for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
@@ -1163,7 +1163,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
}
}
}
- if (target && target->IsWithinDist2d(m_targets.GetDst(), GetSpellRadius(m_spellInfo, effIndex, false) * 2)) // now we use *2 because the location of the seat is not correct
+ if (target && target->IsWithinDist2d(m_targets.GetDst(), m_spellInfo->Effects[effIndex].CalcRadius() * 2)) // now we use *2 because the location of the seat is not correct
passenger->EnterVehicle(target, 0);
else
{
@@ -1262,7 +1262,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
// Sudden Death rage save
if (AuraEffect * aurEff = m_caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_GENERIC, 1989, EFFECT_0))
{
- int32 ragesave = SpellMgr::CalculateSpellEffectAmount(aurEff->GetSpellProto(), EFFECT_1) * 10;
+ int32 ragesave = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue() * 10;
newRage = std::max(newRage, ragesave);
}
@@ -1272,7 +1272,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
if (AuraEffect * aurEff = m_caster->GetAuraEffect(58367, EFFECT_0))
rageUsed += aurEff->GetAmount() * 10;
- bp = damage + int32(rageUsed * m_spellInfo->EffectDamageMultiplier[effIndex] + m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.2f);
+ bp = damage + int32(rageUsed * m_spellInfo->Effects[effIndex].DamageMultiplier + m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.2f);
break;
}
// Concussion Blow
@@ -1302,7 +1302,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
case 27222:
case 57946: spFactor = 0.5f; break;
}
- int32 damage = int32(SpellMgr::CalculateSpellEffectAmount(m_spellInfo, 0) + (6.3875 * m_spellInfo->baseLevel));
+ int32 damage = int32(m_spellInfo->Effects[EFFECT_0].CalcValue() + (6.3875 * m_spellInfo->BaseLevel));
int32 mana = int32(damage + (m_caster->ToPlayer()->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+SPELL_SCHOOL_SHADOW) * spFactor));
if (unitTarget && (int32(unitTarget->GetHealth()) > damage))
@@ -1447,10 +1447,10 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_DK_DEATH_STRIKE)
{
uint32 count = unitTarget->GetDiseasesByCaster(m_caster->GetGUID());
- int32 bp = int32(count * m_caster->CountPctFromMaxHealth(int32(m_spellInfo->EffectDamageMultiplier[0])));
+ int32 bp = int32(count * m_caster->CountPctFromMaxHealth(int32(m_spellInfo->Effects[EFFECT_0].DamageMultiplier)));
// Improved Death Strike
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, 2751, 0))
- AddPctN(bp, m_caster->CalculateSpellDamage(m_caster, aurEff->GetSpellProto(), 2));
+ AddPctN(bp, m_caster->CalculateSpellDamage(m_caster, aurEff->GetSpellInfo(), 2));
m_caster->CastCustomSpell(m_caster, 45470, &bp, NULL, NULL, false);
return;
}
@@ -1517,7 +1517,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
//spells triggered by dummy effect should not miss
if (spell_id)
{
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id);
if (!spellInfo)
{
@@ -1554,10 +1554,10 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
void Spell::EffectTriggerSpellWithValue(SpellEffIndex effIndex)
{
- uint32 triggered_spell_id = m_spellInfo->EffectTriggerSpell[effIndex];
+ uint32 triggered_spell_id = m_spellInfo->Effects[effIndex].TriggerSpell;
// normal case
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(triggered_spell_id);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!spellInfo)
{
@@ -1566,15 +1566,16 @@ void Spell::EffectTriggerSpellWithValue(SpellEffIndex effIndex)
}
int32 bp = damage;
- Unit* caster = GetTriggeredSpellCaster(spellInfo, m_caster, unitTarget);
+
+ Unit* caster = spellInfo->IsRequiringSelectedTarget() ? m_caster : unitTarget;
caster->CastCustomSpell(unitTarget, triggered_spell_id, &bp, &bp, &bp, true);
}
void Spell::EffectTriggerRitualOfSummoning(SpellEffIndex effIndex)
{
- uint32 triggered_spell_id = m_spellInfo->EffectTriggerSpell[effIndex];
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(triggered_spell_id);
+ uint32 triggered_spell_id = m_spellInfo->Effects[effIndex].TriggerSpell;
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!spellInfo)
{
@@ -1592,10 +1593,10 @@ void Spell::EffectForceCast(SpellEffIndex effIndex)
if (!unitTarget)
return;
- uint32 triggered_spell_id = m_spellInfo->EffectTriggerSpell[effIndex];
+ uint32 triggered_spell_id = m_spellInfo->Effects[effIndex].TriggerSpell;
// normal case
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(triggered_spell_id);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!spellInfo)
{
@@ -1637,10 +1638,10 @@ void Spell::EffectForceCastWithValue(SpellEffIndex effIndex)
if (!unitTarget)
return;
- uint32 triggered_spell_id = m_spellInfo->EffectTriggerSpell[effIndex];
+ uint32 triggered_spell_id = m_spellInfo->Effects[effIndex].TriggerSpell;
// normal case
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(triggered_spell_id);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!spellInfo)
{
@@ -1662,7 +1663,7 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex)
return;
}
- uint32 triggered_spell_id = m_spellInfo->EffectTriggerSpell[effIndex];
+ uint32 triggered_spell_id = m_spellInfo->Effects[effIndex].TriggerSpell;
Unit* originalCaster = NULL;
// special cases
@@ -1717,7 +1718,7 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex)
case 29284:
{
// Brittle Armor
- SpellEntry const* spell = sSpellStore.LookupEntry(24575);
+ SpellInfo const* spell = sSpellMgr->GetSpellInfo(24575);
if (!spell)
return;
@@ -1729,7 +1730,7 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex)
case 29286:
{
// Mercurial Shield
- SpellEntry const* spell = sSpellStore.LookupEntry(26464);
+ SpellInfo const* spell = sSpellMgr->GetSpellInfo(26464);
if (!spell)
return;
@@ -1746,14 +1747,14 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex)
// Cloak of Shadows
case 35729:
{
- uint32 dispelMask = GetDispelMask(DISPEL_ALL);
+ uint32 dispelMask = SpellInfo::GetDispelMask(DISPEL_ALL);
Unit::AuraApplicationMap& Auras = unitTarget->GetAppliedAuras();
for (Unit::AuraApplicationMap::iterator iter = Auras.begin(); iter != Auras.end();)
{
// remove all harmful spells on you...
- SpellEntry const* spell = iter->second->GetBase()->GetSpellProto();
+ SpellInfo const* spell = iter->second->GetBase()->GetSpellInfo();
if ((spell->DmgClass == SPELL_DAMAGE_CLASS_MAGIC // only affect magic spells
- || ((1<<spell->Dispel) & dispelMask))
+ || ((spell->GetDispelMask()) & dispelMask))
// ignore positive and passive auras
&& !iter->second->IsPositive() && !iter->second->GetBase()->IsPassive())
{
@@ -1784,7 +1785,7 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex)
}
// normal case
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(triggered_spell_id);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!spellInfo)
{
sLog->outError("EffectTriggerSpell of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id);
@@ -1799,17 +1800,17 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex)
// Note: not exist spells with weapon req. and IsSpellHaveCasterSourceTargets == true
// so this just for speedup places in else
- Unit* caster = GetTriggeredSpellCaster(spellInfo, m_caster, unitTarget);
+ Unit* caster = spellInfo->IsRequiringSelectedTarget() ? m_caster : unitTarget;
caster->CastSpell(unitTarget, spellInfo, true, 0, 0, (originalCaster ? originalCaster->GetGUID() : 0));
}
void Spell::EffectTriggerMissileSpell(SpellEffIndex effIndex)
{
- uint32 triggered_spell_id = m_spellInfo->EffectTriggerSpell[effIndex];
+ uint32 triggered_spell_id = m_spellInfo->Effects[effIndex].TriggerSpell;
// normal case
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(triggered_spell_id);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!spellInfo)
{
@@ -1864,7 +1865,7 @@ void Spell::EffectJumpDest(SpellEffIndex effIndex)
{
m_targets.GetDst()->GetPosition(x, y, z);
- if (m_spellInfo->EffectImplicitTargetA[effIndex] == TARGET_DEST_TARGET_BACK)
+ if (m_spellInfo->Effects[effIndex].TargetA == TARGET_DEST_TARGET_BACK)
{
// explicit cast data from client or server-side cast
// some spell at client send caster
@@ -1891,10 +1892,10 @@ void Spell::EffectJumpDest(SpellEffIndex effIndex)
void Spell::CalculateJumpSpeeds(uint8 i, float dist, float & speedXY, float & speedZ)
{
- if (m_spellInfo->EffectMiscValue[i])
- speedZ = float(m_spellInfo->EffectMiscValue[i])/10;
- else if (m_spellInfo->EffectMiscValueB[i])
- speedZ = float(m_spellInfo->EffectMiscValueB[i])/10;
+ if (m_spellInfo->Effects[i].MiscValue)
+ speedZ = float(m_spellInfo->Effects[i].MiscValue)/10;
+ else if (m_spellInfo->Effects[i].MiscValueB)
+ speedZ = float(m_spellInfo->Effects[i].MiscValueB)/10;
else
speedZ = 10.0f;
speedXY = dist * 10.0f / speedZ;
@@ -2085,7 +2086,7 @@ void Spell::EffectUnlearnSpecialization(SpellEffIndex effIndex)
return;
Player* _player = unitTarget->ToPlayer();
- uint32 spellToUnlearn = m_spellInfo->EffectTriggerSpell[effIndex];
+ uint32 spellToUnlearn = m_spellInfo->Effects[effIndex].TriggerSpell;
_player->removeSpell(spellToUnlearn);
@@ -2094,10 +2095,10 @@ void Spell::EffectUnlearnSpecialization(SpellEffIndex effIndex)
void Spell::EffectPowerDrain(SpellEffIndex effIndex)
{
- if (m_spellInfo->EffectMiscValue[effIndex] < 0 || m_spellInfo->EffectMiscValue[effIndex] >= int8(MAX_POWERS))
+ if (m_spellInfo->Effects[effIndex].MiscValue < 0 || m_spellInfo->Effects[effIndex].MiscValue >= int8(MAX_POWERS))
return;
- Powers powerType = Powers(m_spellInfo->EffectMiscValue[effIndex]);
+ Powers powerType = Powers(m_spellInfo->Effects[effIndex].MiscValue);
if (!unitTarget || !unitTarget->isAlive() || unitTarget->getPowerType() != powerType || damage < 0)
return;
@@ -2117,7 +2118,7 @@ void Spell::EffectPowerDrain(SpellEffIndex effIndex)
// Don`t restore from self drain
if (m_caster != unitTarget)
{
- gainMultiplier = SpellMgr::CalculateSpellEffectValueMultiplier(m_spellInfo, effIndex, m_originalCaster, this);
+ gainMultiplier = m_spellInfo->Effects[effIndex].CalcValueMultiplier(m_originalCaster, this);
int32 gain = int32(newDamage * gainMultiplier);
@@ -2131,7 +2132,7 @@ void Spell::EffectSendEvent(SpellEffIndex effIndex)
/*
we do not handle a flag dropping or clicking on flag in battleground by sendevent system
*/
- sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell ScriptStart %u for spellid %u in EffectSendEvent ", m_spellInfo->EffectMiscValue[effIndex], m_spellInfo->Id);
+ sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell ScriptStart %u for spellid %u in EffectSendEvent ", m_spellInfo->Effects[effIndex].MiscValue, m_spellInfo->Id);
Object* target = NULL;
if (focusObject)
@@ -2142,17 +2143,17 @@ void Spell::EffectSendEvent(SpellEffIndex effIndex)
target = gameObjTarget;
if (ZoneScript* zoneScript = m_caster->GetZoneScript())
- zoneScript->ProcessEvent(unitTarget, m_spellInfo->EffectMiscValue[effIndex]);
+ zoneScript->ProcessEvent(unitTarget, m_spellInfo->Effects[effIndex].MiscValue);
- m_caster->GetMap()->ScriptsStart(sEventScripts, m_spellInfo->EffectMiscValue[effIndex], m_caster, target);
+ m_caster->GetMap()->ScriptsStart(sEventScripts, m_spellInfo->Effects[effIndex].MiscValue, m_caster, target);
}
void Spell::EffectPowerBurn(SpellEffIndex effIndex)
{
- if (m_spellInfo->EffectMiscValue[effIndex] < 0 || m_spellInfo->EffectMiscValue[effIndex] >= int8(MAX_POWERS))
+ if (m_spellInfo->Effects[effIndex].MiscValue < 0 || m_spellInfo->Effects[effIndex].MiscValue >= int8(MAX_POWERS))
return;
- Powers powerType = Powers(m_spellInfo->EffectMiscValue[effIndex]);
+ Powers powerType = Powers(m_spellInfo->Effects[effIndex].MiscValue);
if (!unitTarget || !unitTarget->isAlive() || unitTarget->getPowerType() != powerType || damage < 0)
return;
@@ -2173,7 +2174,7 @@ void Spell::EffectPowerBurn(SpellEffIndex effIndex)
int32 newDamage = -(unitTarget->ModifyPower(powerType, -power));
// NO - Not a typo - EffectPowerBurn uses effect value multiplier - not effect damage multiplier
- float dmgMultiplier = SpellMgr::CalculateSpellEffectValueMultiplier(m_spellInfo, effIndex, m_originalCaster, this);
+ float dmgMultiplier = m_spellInfo->Effects[effIndex].CalcValueMultiplier(m_originalCaster, this);
// add log data before multiplication (need power amount, not damage)
ExecuteLogEffectTakeTargetPower(effIndex, unitTarget, powerType, newDamage, 0.0f);
@@ -2221,8 +2222,8 @@ void Spell::SpellDamageHeal(SpellEffIndex /*effIndex*/)
AuraEffect *targetAura = NULL;
for (Unit::AuraEffectList::const_iterator i = RejorRegr.begin(); i != RejorRegr.end(); ++i)
{
- if ((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID
- && (*i)->GetSpellProto()->SpellFamilyFlags[0] & 0x50)
+ if ((*i)->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DRUID
+ && (*i)->GetSpellInfo()->SpellFamilyFlags[0] & 0x50)
{
if (!targetAura || (*i)->GetBase()->GetDuration() < targetAura->GetBase()->GetDuration())
targetAura = *i;
@@ -2237,16 +2238,16 @@ void Spell::SpellDamageHeal(SpellEffIndex /*effIndex*/)
int32 tickheal = targetAura->GetAmount();
if (Unit* auraCaster = targetAura->GetCaster())
- tickheal = auraCaster->SpellHealingBonus(unitTarget, targetAura->GetSpellProto(), tickheal, DOT);
- //int32 tickheal = targetAura->GetSpellProto()->EffectBasePoints[idx] + 1;
+ tickheal = auraCaster->SpellHealingBonus(unitTarget, targetAura->GetSpellInfo(), tickheal, DOT);
+ //int32 tickheal = targetAura->GetSpellInfo()->EffectBasePoints[idx] + 1;
//It is said that talent bonus should not be included
int32 tickcount = 0;
// Rejuvenation
- if (targetAura->GetSpellProto()->SpellFamilyFlags[0] & 0x10)
+ if (targetAura->GetSpellInfo()->SpellFamilyFlags[0] & 0x10)
tickcount = 4;
// Regrowth
- else // if (targetAura->GetSpellProto()->SpellFamilyFlags[0] & 0x40)
+ else // if (targetAura->GetSpellInfo()->SpellFamilyFlags[0] & 0x40)
tickcount = 6;
addhealth += tickheal * tickcount;
@@ -2338,7 +2339,7 @@ void Spell::EffectHealthLeech(SpellEffIndex effIndex)
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "HealthLeech :%i", damage);
- float healMultiplier = SpellMgr::CalculateSpellEffectValueMultiplier(m_spellInfo, effIndex, m_originalCaster, this);
+ float healMultiplier = m_spellInfo->Effects[effIndex].CalcValueMultiplier(m_originalCaster, this);
m_damage += damage;
// get max possible damage, don't count overkill for heal
@@ -2464,8 +2465,8 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype)
void Spell::EffectCreateItem(SpellEffIndex effIndex)
{
- DoCreateItem(effIndex, m_spellInfo->EffectItemType[effIndex]);
- ExecuteLogEffectCreateItem(effIndex, m_spellInfo->EffectItemType[effIndex]);
+ DoCreateItem(effIndex, m_spellInfo->Effects[effIndex].ItemType);
+ ExecuteLogEffectCreateItem(effIndex, m_spellInfo->Effects[effIndex].ItemType);
}
void Spell::EffectCreateItem2(SpellEffIndex effIndex)
@@ -2474,13 +2475,13 @@ void Spell::EffectCreateItem2(SpellEffIndex effIndex)
return;
Player* player = (Player*)m_caster;
- uint32 item_id = m_spellInfo->EffectItemType[effIndex];
+ uint32 item_id = m_spellInfo->Effects[effIndex].ItemType;
if (item_id)
DoCreateItem(effIndex, item_id);
// special case: fake item replaced by generate using spell_loot_template
- if (IsLootCraftingSpell(m_spellInfo))
+ if (m_spellInfo->IsLootCrafting())
{
if (item_id)
{
@@ -2497,7 +2498,7 @@ void Spell::EffectCreateItem2(SpellEffIndex effIndex)
else
player->AutoStoreLoot(m_spellInfo->Id, LootTemplates_Spell); // create some random items
}
- // TODO: ExecuteLogEffectCreateItem(i, m_spellInfo->EffectItemType[i]);
+ // TODO: ExecuteLogEffectCreateItem(i, m_spellInfo->Effects[i].ItemType);
}
void Spell::EffectCreateRandomItem(SpellEffIndex /*effIndex*/)
@@ -2508,18 +2509,16 @@ void Spell::EffectCreateRandomItem(SpellEffIndex /*effIndex*/)
// create some random items
player->AutoStoreLoot(m_spellInfo->Id, LootTemplates_Spell);
- // TODO: ExecuteLogEffectCreateItem(i, m_spellInfo->EffectItemType[i]);
+ // TODO: ExecuteLogEffectCreateItem(i, m_spellInfo->Effects[i].ItemType);
}
void Spell::EffectPersistentAA(SpellEffIndex effIndex)
{
if (!m_spellAura)
{
- float radius = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[effIndex]));
- if (Player* modOwner = m_originalCaster->GetSpellModOwner())
- modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius);
-
Unit* caster = m_caster->GetEntry() == WORLD_TRIGGER ? m_originalCaster : m_caster;
+ float radius = m_spellInfo->Effects[effIndex].CalcRadius(caster);
+
// Caster not in world, might be spell triggered from aura removal
if (!caster->IsInWorld())
return;
@@ -2552,10 +2551,10 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
if (!unitTarget->isAlive())
return;
- if (m_spellInfo->EffectMiscValue[effIndex] < 0 || m_spellInfo->EffectMiscValue[effIndex] >= int8(MAX_POWERS))
+ if (m_spellInfo->Effects[effIndex].MiscValue < 0 || m_spellInfo->Effects[effIndex].MiscValue >= int8(MAX_POWERS))
return;
- Powers power = Powers(m_spellInfo->EffectMiscValue[effIndex]);
+ Powers power = Powers(m_spellInfo->Effects[effIndex].MiscValue);
// Some level depends spells
int level_multiplier = 0;
@@ -2628,8 +2627,8 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
sSpellMgr->GetSetOfSpellsInSpellGroup(SPELL_GROUP_ELIXIR_BATTLE, avalibleElixirs);
for (std::set<uint32>::iterator itr = avalibleElixirs.begin(); itr != avalibleElixirs.end() ;)
{
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(*itr);
- if (spellInfo->spellLevel < m_spellInfo->spellLevel || spellInfo->spellLevel > unitTarget->getLevel())
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(*itr);
+ if (spellInfo->SpellLevel < m_spellInfo->SpellLevel || spellInfo->SpellLevel > unitTarget->getLevel())
avalibleElixirs.erase(itr++);
else if (sSpellMgr->IsSpellMemberOfSpellGroup(*itr, SPELL_GROUP_ELIXIR_SHATTRATH))
avalibleElixirs.erase(itr++);
@@ -2657,10 +2656,10 @@ void Spell::EffectEnergizePct(SpellEffIndex effIndex)
if (!unitTarget->isAlive())
return;
- if (m_spellInfo->EffectMiscValue[effIndex] < 0 || m_spellInfo->EffectMiscValue[effIndex] >= int8(MAX_POWERS))
+ if (m_spellInfo->Effects[effIndex].MiscValue < 0 || m_spellInfo->Effects[effIndex].MiscValue >= int8(MAX_POWERS))
return;
- Powers power = Powers(m_spellInfo->EffectMiscValue[effIndex]);
+ Powers power = Powers(m_spellInfo->Effects[effIndex].MiscValue);
uint32 maxPower = unitTarget->GetMaxPower(power);
if (maxPower == 0)
@@ -2856,7 +2855,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex)
if (m_CastItem->GetOwnerGUID() != player->GetGUID())
return;
- uint32 newitemid = m_spellInfo->EffectItemType[effIndex];
+ uint32 newitemid = m_spellInfo->Effects[effIndex].ItemType;
if (!newitemid)
return;
@@ -2961,21 +2960,21 @@ void Spell::EffectProficiency(SpellEffIndex /*effIndex*/)
void Spell::EffectSummonType(SpellEffIndex effIndex)
{
- uint32 entry = m_spellInfo->EffectMiscValue[effIndex];
+ uint32 entry = m_spellInfo->Effects[effIndex].MiscValue;
if (!entry)
return;
- SummonPropertiesEntry const *properties = sSummonPropertiesStore.LookupEntry(m_spellInfo->EffectMiscValueB[effIndex]);
+ SummonPropertiesEntry const *properties = sSummonPropertiesStore.LookupEntry(m_spellInfo->Effects[effIndex].MiscValueB);
if (!properties)
{
- sLog->outError("EffectSummonType: Unhandled summon type %u", m_spellInfo->EffectMiscValueB[effIndex]);
+ sLog->outError("EffectSummonType: Unhandled summon type %u", m_spellInfo->Effects[effIndex].MiscValueB);
return;
}
if (!m_originalCaster)
return;
- int32 duration = GetSpellDuration(m_spellInfo);
+ int32 duration = m_spellInfo->GetDuration();
if (Player* modOwner = m_originalCaster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration);
@@ -3040,7 +3039,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
}
default:
{
- float radius = GetSpellRadiusForHostile(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[effIndex]));
+ float radius = m_spellInfo->Effects[effIndex].CalcRadius();
uint32 amount = damage > 0 ? damage : 1;
if (m_spellInfo->Id == 18662 || // Curse of Doom
@@ -3087,7 +3086,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
// The spell that this effect will trigger. It has SPELL_AURA_CONTROL_VEHICLE
uint32 spell = VEHICLE_SPELL_RIDE_HARDCODED;
- if (SpellEntry const* spellProto = sSpellStore.LookupEntry(SpellMgr::CalculateSpellEffectAmount(m_spellInfo, effIndex)))
+ if (SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[effIndex].CalcValue()))
spell = spellProto->Id;
// Hard coded enter vehicle spell
@@ -3123,7 +3122,7 @@ void Spell::EffectLearnSpell(SpellEffIndex effIndex)
Player* player = (Player*)unitTarget;
- uint32 spellToLearn = (m_spellInfo->Id == 483 || m_spellInfo->Id == 55884) ? damage : m_spellInfo->EffectTriggerSpell[effIndex];
+ uint32 spellToLearn = (m_spellInfo->Id == 483 || m_spellInfo->Id == 55884) ? damage : m_spellInfo->Effects[effIndex].TriggerSpell;
player->learnSpell(spellToLearn, false);
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell: Player %u has learned spell %u from NpcGUID=%u", player->GetGUIDLow(), spellToLearn, m_caster->GetGUIDLow());
@@ -3139,8 +3138,8 @@ void Spell::EffectDispel(SpellEffIndex effIndex)
DispelChargesList dispel_list;
// Create dispel mask by dispel type
- uint32 dispel_type = m_spellInfo->EffectMiscValue[effIndex];
- uint32 dispelMask = GetDispelMask(DispelType(dispel_type));
+ uint32 dispel_type = m_spellInfo->Effects[effIndex].MiscValue;
+ uint32 dispelMask = SpellInfo::GetDispelMask(DispelType(dispel_type));
// we should not be able to dispel diseases if the target is affected by unholy blight
if (dispelMask & (1 << DISPEL_DISEASE) && unitTarget->HasAura(50536))
@@ -3158,9 +3157,9 @@ void Spell::EffectDispel(SpellEffIndex effIndex)
if (aura->IsPassive())
continue;
- if ((1<<aura->GetSpellProto()->Dispel) & dispelMask)
+ if ((aura->GetSpellInfo()->GetDispelMask()) & dispelMask)
{
- if (aura->GetSpellProto()->Dispel == DISPEL_MAGIC)
+ if (aura->GetSpellInfo()->Dispel == DISPEL_MAGIC)
{
// do not remove positive auras if friendly target
// negative auras if non-friendly target
@@ -3171,7 +3170,7 @@ void Spell::EffectDispel(SpellEffIndex effIndex)
// The charges / stack amounts don't count towards the total number of auras that can be dispelled.
// Ie: A dispel on a target with 5 stacks of Winters Chill and a Polymorph has 1 / (1 + 1) -> 50% chance to dispell
// Polymorph instead of 1 / (5 + 1) -> 16%.
- bool dispel_charges = aura->GetSpellProto()->AttributesEx7 & SPELL_ATTR7_DISPEL_CHARGES;
+ bool dispel_charges = aura->GetSpellInfo()->AttributesEx7 & SPELL_ATTR7_DISPEL_CHARGES;
uint8 charges = dispel_charges ? aura->GetCharges() : aura->GetStackAmount();
if (charges > 0)
dispel_list.push_back(std::make_pair(aura, charges));
@@ -3192,16 +3191,16 @@ void Spell::EffectDispel(SpellEffIndex effIndex)
DispelChargesList::iterator itr = dispel_list.begin();
std::advance(itr, urand(0, dispel_list.size() - 1));
- bool success = false;
+ int32 chance = itr->first->CalcDispelChance(unitTarget, !unitTarget->IsFriendlyTo(m_caster));
// 2.4.3 Patch Notes: "Dispel effects will no longer attempt to remove effects that have 100% dispel resistance."
- if (!GetDispelChance(itr->first->GetCaster(), unitTarget, itr->first->GetId(), !unitTarget->IsFriendlyTo(m_caster), &success))
+ if (!chance)
{
dispel_list.erase(itr);
continue;
}
else
{
- if (success)
+ if (roll_chance_i(chance))
{
bool alreadyListed = false;
for (DispelChargesList::iterator successItr = success_list.begin(); successItr != success_list.end(); ++successItr)
@@ -3260,7 +3259,7 @@ void Spell::EffectDispel(SpellEffIndex effIndex)
// Devour Magic
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->Category == SPELLCATEGORY_DEVOUR_MAGIC)
{
- int32 heal_amount = SpellMgr::CalculateSpellEffectAmount(m_spellInfo, 1);
+ int32 heal_amount = m_spellInfo->Effects[EFFECT_1].CalcValue();
m_caster->CastCustomSpell(m_caster, 19658, &heal_amount, NULL, NULL, true);
// Glyph of Felhunter
if (Unit* pOwner = m_caster->GetOwner())
@@ -3328,8 +3327,8 @@ void Spell::EffectAddFarsight(SpellEffIndex effIndex)
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
- float radius = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[effIndex]));
- int32 duration = GetSpellDuration(m_spellInfo);
+ float radius = m_spellInfo->Effects[effIndex].CalcRadius();
+ int32 duration = m_spellInfo->GetDuration();
// Caster not in world, might be spell triggered from aura removal
if (!m_caster->IsInWorld())
return;
@@ -3365,7 +3364,7 @@ void Spell::EffectTeleUnitsFaceCaster(SpellEffIndex effIndex)
if (unitTarget->isInFlight())
return;
- float dis = (float)m_caster->GetSpellRadiusForTarget(unitTarget, sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[effIndex]));
+ float dis = m_spellInfo->Effects[effIndex].CalcRadius(m_caster);
float fx, fy, fz;
m_caster->GetClosePoint(fx, fy, fz, unitTarget->GetObjectSize(), dis);
@@ -3381,9 +3380,9 @@ void Spell::EffectLearnSkill(SpellEffIndex effIndex)
if (damage < 0)
return;
- uint32 skillid = m_spellInfo->EffectMiscValue[effIndex];
+ uint32 skillid = m_spellInfo->Effects[effIndex].MiscValue;
uint16 skillval = unitTarget->ToPlayer()->GetPureSkillValue(skillid);
- unitTarget->ToPlayer()->SetSkill(skillid, SpellMgr::CalculateSpellEffectAmount(m_spellInfo, effIndex), skillval?skillval:1, damage*75);
+ unitTarget->ToPlayer()->SetSkill(skillid, m_spellInfo->Effects[effIndex].CalcValue(), skillval?skillval:1, damage*75);
}
void Spell::EffectAddHonor(SpellEffIndex /*effIndex*/)
@@ -3418,7 +3417,7 @@ void Spell::EffectTradeSkill(SpellEffIndex /*effIndex*/)
{
if (unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- // uint32 skillid = m_spellInfo->EffectMiscValue[i];
+ // uint32 skillid = m_spellInfo->Effects[i].MiscValue;
// uint16 skillmax = unitTarget->ToPlayer()->(skillid);
// unitTarget->ToPlayer()->SetSkill(skillid, skillval?skillval:1, skillmax+75);
}
@@ -3440,7 +3439,7 @@ void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex)
p_caster->DestroyItemCount(itemTarget, count, true);
unitTarget=p_caster;
// and add a scroll
- DoCreateItem(effIndex, m_spellInfo->EffectItemType[effIndex]);
+ DoCreateItem(effIndex, m_spellInfo->Effects[effIndex].ItemType);
itemTarget=NULL;
m_targets.SetItemTarget(NULL);
}
@@ -3450,7 +3449,7 @@ void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex)
if (!(m_CastItem && m_CastItem->GetTemplate()->Flags & ITEM_PROTO_FLAG_TRIGGERED_CAST))
p_caster->UpdateCraftSkill(m_spellInfo->Id);
- uint32 enchant_id = m_spellInfo->EffectMiscValue[effIndex];
+ uint32 enchant_id = m_spellInfo->Effects[effIndex].MiscValue;
if (!enchant_id)
return;
@@ -3492,7 +3491,7 @@ void Spell::EffectEnchantItemPrismatic(SpellEffIndex effIndex)
Player* p_caster = (Player*)m_caster;
- uint32 enchant_id = m_spellInfo->EffectMiscValue[effIndex];
+ uint32 enchant_id = m_spellInfo->Effects[effIndex].MiscValue;
if (!enchant_id)
return;
@@ -3579,7 +3578,7 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex)
return;
}
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id);
if (!spellInfo)
{
sLog->outError("Spell::EffectEnchantItemTmp: unknown spell id %i", spell_id);
@@ -3605,7 +3604,7 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex)
if (!itemTarget)
return;
- uint32 enchant_id = m_spellInfo->EffectMiscValue[effIndex];
+ uint32 enchant_id = m_spellInfo->Effects[effIndex].MiscValue;
if (!enchant_id)
{
@@ -3735,7 +3734,7 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex)
owner = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself();
}
- uint32 petentry = m_spellInfo->EffectMiscValue[effIndex];
+ uint32 petentry = m_spellInfo->Effects[effIndex].MiscValue;
if (!owner)
{
@@ -3817,7 +3816,7 @@ void Spell::EffectLearnPetSpell(SpellEffIndex effIndex)
if (!pet->isAlive())
return;
- SpellEntry const *learn_spellproto = sSpellStore.LookupEntry(m_spellInfo->EffectTriggerSpell[effIndex]);
+ SpellInfo const *learn_spellproto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[effIndex].TriggerSpell);
if (!learn_spellproto)
return;
@@ -3878,7 +3877,7 @@ void Spell::SpellDamageWeaponDmg(SpellEffIndex effIndex)
// and handle all effects at once
for (uint32 j = effIndex + 1; j < MAX_SPELL_EFFECTS; ++j)
{
- switch (m_spellInfo->Effect[j])
+ switch (m_spellInfo->Effects[j].Effect)
{
case SPELL_EFFECT_WEAPON_DAMAGE:
case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL:
@@ -3965,7 +3964,7 @@ void Spell::SpellDamageWeaponDmg(SpellEffIndex effIndex)
Unit::AuraApplicationMap const& auras = unitTarget->GetAppliedAuras();
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
- if (itr->second->GetBase()->GetSpellProto()->Dispel == DISPEL_POISON)
+ if (itr->second->GetBase()->GetSpellInfo()->Dispel == DISPEL_POISON)
{
found = true;
break;
@@ -3984,7 +3983,7 @@ void Spell::SpellDamageWeaponDmg(SpellEffIndex effIndex)
if (m_spellInfo->Id == 20467)
{
spell_bonus += int32(0.08f * m_caster->GetTotalAttackPowerValue(BASE_ATTACK));
- spell_bonus += int32(0.13f * m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)));
+ spell_bonus += int32(0.13f * m_caster->SpellBaseDamageBonus(m_spellInfo->GetSchoolMask()));
}
break;
}
@@ -4022,7 +4021,7 @@ void Spell::SpellDamageWeaponDmg(SpellEffIndex effIndex)
case SPELLFAMILY_DEATHKNIGHT:
{
// Plague Strike
- if (m_spellInfo->SpellFamilyFlags[EFFECT_0] & 0x1)
+ if (m_spellInfo->SpellFamilyFlags[0] & 0x1)
{
// Glyph of Plague Strike
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(58657, EFFECT_0))
@@ -4030,9 +4029,9 @@ void Spell::SpellDamageWeaponDmg(SpellEffIndex effIndex)
break;
}
// Blood Strike
- if (m_spellInfo->SpellFamilyFlags[EFFECT_0] & 0x400000)
+ if (m_spellInfo->SpellFamilyFlags[0] & 0x400000)
{
- AddPctF(totalDamagePercentMod, SpellMgr::CalculateSpellEffectAmount(m_spellInfo, EFFECT_2) * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) / 2.0f);
+ AddPctF(totalDamagePercentMod, m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) / 2.0f);
// Glyph of Blood Strike
if (m_caster->GetAuraEffect(59332, EFFECT_0))
@@ -4041,16 +4040,16 @@ void Spell::SpellDamageWeaponDmg(SpellEffIndex effIndex)
break;
}
// Death Strike
- if (m_spellInfo->SpellFamilyFlags[EFFECT_0] & 0x10)
+ if (m_spellInfo->SpellFamilyFlags[0] & 0x10)
{
// Glyph of Death Strike
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(59336, EFFECT_0))
- if (uint32 runic = std::min<uint32>(m_caster->GetPower(POWER_RUNIC_POWER), SpellMgr::CalculateSpellEffectAmount(aurEff->GetSpellProto(), EFFECT_1)))
+ if (uint32 runic = std::min<uint32>(m_caster->GetPower(POWER_RUNIC_POWER), aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()))
AddPctN(totalDamagePercentMod, runic);
break;
}
// Obliterate (12.5% more damage per disease)
- if (m_spellInfo->SpellFamilyFlags[EFFECT_1] & 0x20000)
+ if (m_spellInfo->SpellFamilyFlags[1] & 0x20000)
{
bool consumeDiseases = true;
// Annihilation
@@ -4059,7 +4058,7 @@ void Spell::SpellDamageWeaponDmg(SpellEffIndex effIndex)
if (roll_chance_i(aurEff->GetAmount()))
consumeDiseases = false;
- AddPctF(totalDamagePercentMod, SpellMgr::CalculateSpellEffectAmount(m_spellInfo, EFFECT_2) * unitTarget->GetDiseasesByCaster(m_caster->GetGUID(), consumeDiseases) / 2.0f);
+ AddPctF(totalDamagePercentMod, m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID(), consumeDiseases) / 2.0f);
break;
}
// Blood-Caked Strike - Blood-Caked Blade
@@ -4069,9 +4068,9 @@ void Spell::SpellDamageWeaponDmg(SpellEffIndex effIndex)
break;
}
// Heart Strike
- if (m_spellInfo->SpellFamilyFlags[EFFECT_0] & 0x1000000)
+ if (m_spellInfo->SpellFamilyFlags[0] & 0x1000000)
{
- AddPctN(totalDamagePercentMod, SpellMgr::CalculateSpellEffectAmount(m_spellInfo, EFFECT_2) * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()));
+ AddPctN(totalDamagePercentMod, m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()));
break;
}
break;
@@ -4082,7 +4081,7 @@ void Spell::SpellDamageWeaponDmg(SpellEffIndex effIndex)
float weaponDamagePercentMod = 1.0f;
for (int j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
- switch (m_spellInfo->Effect[j])
+ switch (m_spellInfo->Effects[j].Effect)
{
case SPELL_EFFECT_WEAPON_DAMAGE:
case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL:
@@ -4129,7 +4128,7 @@ void Spell::SpellDamageWeaponDmg(SpellEffIndex effIndex)
{
// We assume that a spell have at most one fixed_bonus
// and at most one weaponDamagePercentMod
- switch(m_spellInfo->Effect[j])
+ switch(m_spellInfo->Effects[j].Effect)
{
case SPELL_EFFECT_WEAPON_DAMAGE:
case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL:
@@ -4205,16 +4204,16 @@ void Spell::EffectInterruptCast(SpellEffIndex effIndex)
{
if (Spell* spell = unitTarget->GetCurrentSpell(CurrentSpellTypes(i)))
{
- SpellEntry const* curSpellInfo = spell->m_spellInfo;
+ SpellInfo const* curSpellInfo = spell->m_spellInfo;
// check if we can interrupt spell
if ((spell->getState() == SPELL_STATE_CASTING
- || (spell->getState() == SPELL_STATE_PREPARING && spell->GetCastTime() > 0.0f))
+ || (spell->getState() == SPELL_STATE_PREPARING && spell->CalcCastTime() > 0.0f))
&& curSpellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_INTERRUPT && curSpellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
{
if (m_originalCaster)
{
int32 duration = m_originalCaster->ModSpellDuration(m_spellInfo, unitTarget, m_originalCaster->CalcSpellDuration(m_spellInfo), false);
- unitTarget->ProhibitSpellSchool(GetSpellSchoolMask(curSpellInfo), duration/*GetSpellDuration(m_spellInfo)*/);
+ unitTarget->ProhibitSpellSchool(curSpellInfo->GetSchoolMask(), duration/*GetSpellDuration(m_spellInfo)*/);
}
ExecuteLogEffectInterruptCast(effIndex, unitTarget, curSpellInfo->Id);
unitTarget->InterruptSpell(CurrentSpellTypes(i), false);
@@ -4225,7 +4224,7 @@ void Spell::EffectInterruptCast(SpellEffIndex effIndex)
void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
{
- uint32 gameobject_id = m_spellInfo->EffectMiscValue[effIndex];
+ uint32 gameobject_id = m_spellInfo->Effects[effIndex].MiscValue;
GameObject* pGameObj = new GameObject;
@@ -4248,7 +4247,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
return;
}
- int32 duration = GetSpellDuration(m_spellInfo);
+ int32 duration = m_spellInfo->GetDuration();
pGameObj->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
pGameObj->SetSpellId(m_spellInfo->Id);
@@ -4348,13 +4347,13 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
for (Unit::AuraEffectList::const_iterator i = mPeriodic.begin(); i != mPeriodic.end(); ++i)
{
AuraEffect const* aurEff = *i;
- SpellEntry const* spellInfo = aurEff->GetSpellProto();
+ SpellInfo const* spellInfo = aurEff->GetSpellInfo();
// search our Blood Plague and Frost Fever on target
if (spellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && spellInfo->SpellFamilyFlags[2] & 0x2 &&
aurEff->GetCasterGUID() == m_caster->GetGUID())
{
uint32 countMin = aurEff->GetBase()->GetMaxDuration();
- uint32 countMax = GetSpellMaxDuration(spellInfo);
+ uint32 countMax = spellInfo->GetMaxDuration();
// this Glyph
countMax += 9000;
@@ -4377,7 +4376,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
case 55693: // Remove Collapsing Cave Aura
if (!unitTarget)
return;
- unitTarget->RemoveAurasDueToSpell(SpellMgr::CalculateSpellEffectAmount(m_spellInfo, effIndex));
+ unitTarget->RemoveAurasDueToSpell(m_spellInfo->Effects[effIndex].CalcValue());
break;
// PX-238 Winter Wondervolt TRAP
case 26275:
@@ -4640,7 +4639,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
case 45151:
{
//Workaround for Range ... should be global for every ScriptEffect
- float radius = GetSpellRadiusForHostile(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[effIndex]));
+ float radius = m_spellInfo->Effects[effIndex].CalcRadius();
if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER && unitTarget->GetDistance(m_caster) >= radius && !unitTarget->HasAura(46394) && unitTarget != m_caster)
unitTarget->CastSpell(unitTarget, 46394, true);
@@ -4772,7 +4771,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
return;
float x, y, z;
- float radius = GetSpellRadius(m_spellInfo, effIndex, true);
+ float radius = m_spellInfo->Effects[effIndex].CalcRadius();
for (uint8 i = 0; i < 15; ++i)
{
m_caster->GetRandomPoint(*m_targets.GetDst(), radius, x, y, z);
@@ -4818,8 +4817,8 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER || effIndex != 0)
return;
- uint32 spellID = SpellMgr::CalculateSpellEffectAmount(m_spellInfo, 0);
- uint32 questID = SpellMgr::CalculateSpellEffectAmount(m_spellInfo, 1);
+ uint32 spellID = m_spellInfo->Effects[EFFECT_0].CalcValue();
+ uint32 questID = m_spellInfo->Effects[EFFECT_1].CalcValue();
if (unitTarget->ToPlayer()->GetQuestStatus(questID) == QUEST_STATUS_COMPLETE)
unitTarget->CastSpell(unitTarget, spellID, true);
@@ -5249,12 +5248,12 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
for (Unit::AuraApplicationMap::iterator iter = sealAuras.begin(); iter != sealAuras.end();)
{
Aura * aura = iter->second->GetBase();
- if (IsSealSpell(aura->GetSpellProto()))
+ if (aura->GetSpellInfo()->GetSpellSpecific() == SPELL_SPECIFIC_SEAL)
{
if (AuraEffect * aureff = aura->GetEffect(2))
if (aureff->GetAuraType() == SPELL_AURA_DUMMY)
{
- if (sSpellStore.LookupEntry(aureff->GetAmount()))
+ if (sSpellMgr->GetSpellInfo(aureff->GetAmount()))
spellId2 = aureff->GetAmount();
break;
}
@@ -5435,7 +5434,7 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
//CREATE DUEL FLAG OBJECT
GameObject* pGameObj = new GameObject;
- uint32 gameobject_id = m_spellInfo->EffectMiscValue[effIndex];
+ uint32 gameobject_id = m_spellInfo->Effects[effIndex].MiscValue;
Map* map = m_caster->GetMap();
if (!pGameObj->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id,
@@ -5451,7 +5450,7 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
pGameObj->SetUInt32Value(GAMEOBJECT_FACTION, m_caster->getFaction());
pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel()+1);
- int32 duration = GetSpellDuration(m_spellInfo);
+ int32 duration = m_spellInfo->GetDuration();
pGameObj->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
pGameObj->SetSpellId(m_spellInfo->Id);
@@ -5510,7 +5509,7 @@ void Spell::EffectStuck(SpellEffIndex /*effIndex*/)
// pTarget->TeleportTo(pTarget->m_homebindMapId, pTarget->m_homebindX, pTarget->m_homebindY, pTarget->m_homebindZ, pTarget->GetOrientation(), (unitTarget == m_caster ? TELE_TO_SPELL : 0));
// Stuck spell trigger Hearthstone cooldown
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(8690);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(8690);
if (!spellInfo)
return;
Spell spell(pTarget, spellInfo, true, 0);
@@ -5546,7 +5545,7 @@ void Spell::EffectActivateObject(SpellEffIndex /*effIndex*/)
ScriptInfo activateCommand;
activateCommand.command = SCRIPT_COMMAND_ACTIVATE_OBJECT;
- // int32 unk = m_spellInfo->EffectMiscValue[effIndex]; // This is set for EffectActivateObject spells; needs research
+ // int32 unk = m_spellInfo->Effects[effIndex].MiscValue; // This is set for EffectActivateObject spells; needs research
gameObjTarget->GetMap()->ScriptCommandStart(activateCommand, 0, m_caster, gameObjTarget);
}
@@ -5576,7 +5575,7 @@ void Spell::EffectApplyGlyph(SpellEffIndex effIndex)
}
// apply new one
- if (uint32 glyph = m_spellInfo->EffectMiscValue[effIndex])
+ if (uint32 glyph = m_spellInfo->Effects[effIndex].MiscValue)
{
if (GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph))
{
@@ -5622,10 +5621,10 @@ void Spell::EffectEnchantHeldItem(SpellEffIndex effIndex)
if (!item ->IsEquipped())
return;
- if (m_spellInfo->EffectMiscValue[effIndex])
+ if (m_spellInfo->Effects[effIndex].MiscValue)
{
- uint32 enchant_id = m_spellInfo->EffectMiscValue[effIndex];
- int32 duration = GetSpellDuration(m_spellInfo); //Try duration index first ..
+ uint32 enchant_id = m_spellInfo->Effects[effIndex].MiscValue;
+ int32 duration = m_spellInfo->GetDuration(); //Try duration index first ..
if (!duration)
duration = damage;//+1; //Base points after ..
if (!duration)
@@ -5707,7 +5706,7 @@ void Spell::EffectFeedPet(SpellEffIndex effIndex)
_player->DestroyItemCount(foodItem, count, true);
// TODO: fix crash when a spell has two effects, both pointed at the same item target
- m_caster->CastCustomSpell(pet, m_spellInfo->EffectTriggerSpell[effIndex], &benefit, NULL, NULL, true);
+ m_caster->CastCustomSpell(pet, m_spellInfo->Effects[effIndex].TriggerSpell, &benefit, NULL, NULL, true);
}
void Spell::EffectDismissPet(SpellEffIndex effIndex)
@@ -5727,10 +5726,10 @@ void Spell::EffectDismissPet(SpellEffIndex effIndex)
void Spell::EffectSummonObject(SpellEffIndex effIndex)
{
- uint32 go_id = m_spellInfo->EffectMiscValue[effIndex];
+ uint32 go_id = m_spellInfo->Effects[effIndex].MiscValue;
uint8 slot = 0;
- switch(m_spellInfo->Effect[effIndex])
+ switch(m_spellInfo->Effects[effIndex].Effect)
{
case SPELL_EFFECT_SUMMON_OBJECT_SLOT1: slot = 0; break;
case SPELL_EFFECT_SUMMON_OBJECT_SLOT2: slot = 1; break;
@@ -5775,7 +5774,7 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex)
}
//pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel());
- int32 duration = GetSpellDuration(m_spellInfo);
+ int32 duration = m_spellInfo->GetDuration();
pGameObj->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
pGameObj->SetSpellId(m_spellInfo->Id);
m_caster->AddGameObject(pGameObj);
@@ -5887,7 +5886,7 @@ void Spell::EffectReputation(SpellEffIndex effIndex)
int32 rep_change = damage;//+1; // field store reputation change -1
- uint32 faction_id = m_spellInfo->EffectMiscValue[effIndex];
+ uint32 faction_id = m_spellInfo->Effects[effIndex].MiscValue;
FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id);
@@ -5912,7 +5911,7 @@ void Spell::EffectQuestComplete(SpellEffIndex effIndex)
else
return;
- uint32 questId = m_spellInfo->EffectMiscValue[effIndex];
+ uint32 questId = m_spellInfo->Effects[effIndex].MiscValue;
if (questId)
{
Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
@@ -5950,7 +5949,7 @@ void Spell::EffectSelfResurrect(SpellEffIndex effIndex)
if (damage < 0)
{
health = uint32(-damage);
- mana = m_spellInfo->EffectMiscValue[effIndex];
+ mana = m_spellInfo->Effects[effIndex].MiscValue;
}
// percent case
else
@@ -6005,7 +6004,7 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/)
m_caster->GetMotionMaster()->MoveCharge(x, y, z);
// not all charge effects used in negative spells
- if (!IsPositiveSpell(m_spellInfo->Id) && m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (!m_spellInfo->IsPositive() && m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->Attack(target, true);
}
@@ -6053,20 +6052,20 @@ void Spell::EffectKnockBack(SpellEffIndex effIndex)
ratio = ratio * ratio * ratio * 0.1f; // volume = length^3
else
ratio = 0.1f; // dbc value ratio
- float speedxy = float(m_spellInfo->EffectMiscValue[effIndex]) * ratio;
+ float speedxy = float(m_spellInfo->Effects[effIndex].MiscValue) * ratio;
float speedz = float(damage) * ratio;
if (speedxy < 0.1f && speedz < 0.1f)
return;
float x, y;
- if (m_spellInfo->Effect[effIndex] == SPELL_EFFECT_KNOCK_BACK_DEST)
+ if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_KNOCK_BACK_DEST)
{
if (m_targets.HasDst())
m_targets.GetDst()->GetPosition(x, y);
else
return;
}
- else //if (m_spellInfo->Effect[i] == SPELL_EFFECT_KNOCK_BACK)
+ else //if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_KNOCK_BACK)
{
m_caster->GetPosition(x, y);
}
@@ -6076,7 +6075,7 @@ void Spell::EffectKnockBack(SpellEffIndex effIndex)
void Spell::EffectLeapBack(SpellEffIndex effIndex)
{
- float speedxy = float(m_spellInfo->EffectMiscValue[effIndex])/10;
+ float speedxy = float(m_spellInfo->Effects[effIndex].MiscValue)/10;
float speedz = float(damage/10);
if (!speedxy)
{
@@ -6101,7 +6100,7 @@ void Spell::EffectQuestClear(SpellEffIndex effIndex)
if (!pPlayer)
return;
- uint32 quest_id = m_spellInfo->EffectMiscValue[effIndex];
+ uint32 quest_id = m_spellInfo->Effects[effIndex].MiscValue;
Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest_id);
@@ -6134,7 +6133,7 @@ void Spell::EffectSendTaxi(SpellEffIndex effIndex)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- unitTarget->ToPlayer()->ActivateTaxiPathTo(m_spellInfo->EffectMiscValue[effIndex], m_spellInfo->Id);
+ unitTarget->ToPlayer()->ActivateTaxiPathTo(m_spellInfo->Effects[effIndex].MiscValue, m_spellInfo->Id);
}
void Spell::EffectPullTowards(SpellEffIndex effIndex)
@@ -6142,17 +6141,17 @@ void Spell::EffectPullTowards(SpellEffIndex effIndex)
if (!unitTarget)
return;
- float speedZ = (float)(SpellMgr::CalculateSpellEffectAmount(m_spellInfo, effIndex) / 10);
- float speedXY = (float)(m_spellInfo->EffectMiscValue[effIndex]/10);
+ float speedZ = (float)(m_spellInfo->Effects[effIndex].CalcValue() / 10);
+ float speedXY = (float)(m_spellInfo->Effects[effIndex].MiscValue/10);
Position pos;
- if (m_spellInfo->Effect[effIndex] == SPELL_EFFECT_PULL_TOWARDS_DEST)
+ if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_PULL_TOWARDS_DEST)
{
if (m_targets.HasDst())
pos.Relocate(*m_targets.GetDst());
else
return;
}
- else //if (m_spellInfo->Effect[i] == SPELL_EFFECT_PULL_TOWARDS)
+ else //if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_PULL_TOWARDS)
{
pos.Relocate(m_caster);
}
@@ -6165,7 +6164,7 @@ void Spell::EffectDispelMechanic(SpellEffIndex effIndex)
if (!unitTarget)
return;
- uint32 mechanic = m_spellInfo->EffectMiscValue[effIndex];
+ uint32 mechanic = m_spellInfo->Effects[effIndex].MiscValue;
std::queue < std::pair < uint32, uint64 > > dispel_list;
@@ -6175,10 +6174,9 @@ void Spell::EffectDispelMechanic(SpellEffIndex effIndex)
Aura * aura = itr->second;
if (!aura->GetApplicationOfTarget(unitTarget->GetGUID()))
continue;
- bool success = false;
- GetDispelChance(aura->GetCaster(), unitTarget, aura->GetId(), !unitTarget->IsFriendlyTo(m_caster), &success);
- if ((GetAllSpellMechanicMask(aura->GetSpellProto()) & (1 << mechanic)) && success)
- dispel_list.push(std::make_pair(aura->GetId(), aura->GetCasterGUID()));
+ if (roll_chance_i(aura->CalcDispelChance(unitTarget, !unitTarget->IsFriendlyTo(m_caster))))
+ if ((aura->GetSpellInfo()->GetAllEffectsMechanicMask() & (1 << mechanic)))
+ dispel_list.push(std::make_pair(aura->GetId(), aura->GetCasterGUID()));
}
for (; dispel_list.size(); dispel_list.pop())
@@ -6227,10 +6225,10 @@ void Spell::EffectDestroyAllTotems(SpellEffIndex /*effIndex*/)
if (totem && totem->isTotem())
{
uint32 spell_id = totem->GetUInt32Value(UNIT_CREATED_BY_SPELL);
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id);
if (spellInfo)
{
- mana += spellInfo->manaCost;
+ mana += spellInfo->ManaCost;
mana += int32(CalculatePctU(m_caster->GetCreateMana(), spellInfo->ManaCostPercentage));
}
totem->ToTotem()->UnSummon();
@@ -6246,7 +6244,7 @@ void Spell::EffectDurabilityDamage(SpellEffIndex effIndex)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- int32 slot = m_spellInfo->EffectMiscValue[effIndex];
+ int32 slot = m_spellInfo->Effects[effIndex].MiscValue;
// FIXME: some spells effects have value -1/-2
// Possibly its mean -1 all player equipped items and -2 all items
@@ -6271,7 +6269,7 @@ void Spell::EffectDurabilityDamagePCT(SpellEffIndex effIndex)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- int32 slot = m_spellInfo->EffectMiscValue[effIndex];
+ int32 slot = m_spellInfo->Effects[effIndex].MiscValue;
// FIXME: some spells effects have value -1/-2
// Possibly its mean -1 all player equipped items and -2 all items
@@ -6302,7 +6300,7 @@ void Spell::EffectModifyThreatPercent(SpellEffIndex /*effIndex*/)
void Spell::EffectTransmitted(SpellEffIndex effIndex)
{
- uint32 name_id = m_spellInfo->EffectMiscValue[effIndex];
+ uint32 name_id = m_spellInfo->Effects[effIndex].MiscValue;
GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(name_id);
@@ -6317,16 +6315,16 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
if (m_targets.HasDst())
m_targets.GetDst()->GetPosition(fx, fy, fz);
//FIXME: this can be better check for most objects but still hack
- else if (m_spellInfo->EffectRadiusIndex[effIndex] && m_spellInfo->speed == 0)
+ else if (m_spellInfo->Effects[effIndex].HasRadius() && m_spellInfo->Speed == 0)
{
- float dis = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[effIndex]));
+ float dis = m_spellInfo->Effects[effIndex].CalcRadius(m_originalCaster);
m_caster->GetClosePoint(fx, fy, fz, DEFAULT_WORLD_OBJECT_SIZE, dis);
}
else
{
//GO is always friendly to it's creator, get range for friends
- float min_dis = GetSpellMinRangeForFriend(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex));
- float max_dis = GetSpellMaxRangeForFriend(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex));
+ float min_dis = m_spellInfo->GetMinRange(true);
+ float max_dis = m_spellInfo->GetMaxRange(true);
float dis = (float)rand_norm() * (max_dis - min_dis) + min_dis;
m_caster->GetClosePoint(fx, fy, fz, DEFAULT_WORLD_OBJECT_SIZE, dis);
@@ -6362,7 +6360,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
return;
}
- int32 duration = GetSpellDuration(m_spellInfo);
+ int32 duration = m_spellInfo->GetDuration();
switch(goinfo->type)
{
@@ -6505,7 +6503,7 @@ void Spell::EffectSpiritHeal(SpellEffIndex /*effIndex*/)
if (!unitTarget->IsInWorld())
return;
- //m_spellInfo->EffectBasePoints[i]; == 99 (percent?)
+ //m_spellInfo->Effects[i].BasePoints; == 99 (percent?)
//unitTarget->ToPlayer()->setResurrect(m_caster->GetGUID(), unitTarget->GetPositionX(), unitTarget->GetPositionY(), unitTarget->GetPositionZ(), unitTarget->GetMaxHealth(), unitTarget->GetMaxPower(POWER_MANA));
unitTarget->ToPlayer()->ResurrectPlayer(1.0f);
unitTarget->ToPlayer()->SpawnCorpseBones();
@@ -6532,7 +6530,7 @@ void Spell::EffectStealBeneficialBuff(SpellEffIndex effIndex)
DispelChargesList steal_list;
// Create dispel mask by dispel type
- uint32 dispelMask = GetDispelMask(DispelType(m_spellInfo->EffectMiscValue[effIndex]));
+ uint32 dispelMask = SpellInfo::GetDispelMask(DispelType(m_spellInfo->Effects[effIndex].MiscValue));
Unit::AuraMap const& auras = unitTarget->GetOwnedAuras();
for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
@@ -6541,16 +6539,16 @@ void Spell::EffectStealBeneficialBuff(SpellEffIndex effIndex)
if (!aurApp)
continue;
- if ((1<<aura->GetSpellProto()->Dispel) & dispelMask)
+ if ((aura->GetSpellInfo()->GetDispelMask()) & dispelMask)
{
// Need check for passive? this
- if (!aurApp->IsPositive() || aura->IsPassive() || aura->GetSpellProto()->AttributesEx4 & SPELL_ATTR4_NOT_STEALABLE)
+ if (!aurApp->IsPositive() || aura->IsPassive() || aura->GetSpellInfo()->AttributesEx4 & SPELL_ATTR4_NOT_STEALABLE)
continue;
// The charges / stack amounts don't count towards the total number of auras that can be dispelled.
// Ie: A dispel on a target with 5 stacks of Winters Chill and a Polymorph has 1 / (1 + 1) -> 50% chance to dispell
// Polymorph instead of 1 / (5 + 1) -> 16%.
- bool dispel_charges = aura->GetSpellProto()->AttributesEx7 & SPELL_ATTR7_DISPEL_CHARGES;
+ bool dispel_charges = aura->GetSpellInfo()->AttributesEx7 & SPELL_ATTR7_DISPEL_CHARGES;
uint8 charges = dispel_charges ? aura->GetCharges() : aura->GetStackAmount();
if (charges > 0)
steal_list.push_back(std::make_pair(aura, charges));
@@ -6571,16 +6569,16 @@ void Spell::EffectStealBeneficialBuff(SpellEffIndex effIndex)
DispelChargesList::iterator itr = steal_list.begin();
std::advance(itr, urand(0, steal_list.size() - 1));
- bool success = false;
+ int32 chance = itr->first->CalcDispelChance(unitTarget, !unitTarget->IsFriendlyTo(m_caster));
// 2.4.3 Patch Notes: "Dispel effects will no longer attempt to remove effects that have 100% dispel resistance."
- if (!GetDispelChance(itr->first->GetCaster(), unitTarget, itr->first->GetId(), !unitTarget->IsFriendlyTo(m_caster), &success))
+ if (!chance)
{
steal_list.erase(itr);
continue;
}
else
{
- if (success)
+ if (roll_chance_i(chance))
{
success_list.push_back(std::make_pair(itr->first->GetId(), itr->first->GetCasterGUID()));
--itr->second;
@@ -6629,7 +6627,7 @@ void Spell::EffectKillCreditPersonal(SpellEffIndex effIndex)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- unitTarget->ToPlayer()->KilledMonsterCredit(m_spellInfo->EffectMiscValue[effIndex], 0);
+ unitTarget->ToPlayer()->KilledMonsterCredit(m_spellInfo->Effects[effIndex].MiscValue, 0);
}
void Spell::EffectKillCredit(SpellEffIndex effIndex)
@@ -6637,7 +6635,7 @@ void Spell::EffectKillCredit(SpellEffIndex effIndex)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- int32 creatureEntry = m_spellInfo->EffectMiscValue[effIndex];
+ int32 creatureEntry = m_spellInfo->Effects[effIndex].MiscValue;
if (!creatureEntry)
{
if (m_spellInfo->Id == 42793) // Burn Body
@@ -6653,7 +6651,7 @@ void Spell::EffectQuestFail(SpellEffIndex effIndex)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- unitTarget->ToPlayer()->FailQuest(m_spellInfo->EffectMiscValue[effIndex]);
+ unitTarget->ToPlayer()->FailQuest(m_spellInfo->Effects[effIndex].MiscValue);
}
void Spell::EffectQuestStart(SpellEffIndex effIndex)
@@ -6662,7 +6660,7 @@ void Spell::EffectQuestStart(SpellEffIndex effIndex)
return;
Player* player = unitTarget->ToPlayer();
- if (Quest const* qInfo = sObjectMgr->GetQuestTemplate(m_spellInfo->EffectMiscValue[effIndex]))
+ if (Quest const* qInfo = sObjectMgr->GetQuestTemplate(m_spellInfo->Effects[effIndex].MiscValue))
{
if (player->CanTakeQuest(qInfo, false) && player->CanAddQuest(qInfo, false))
{
@@ -6688,7 +6686,7 @@ void Spell::EffectActivateRune(SpellEffIndex effIndex)
if (count == 0) count = 1;
for (uint32 j = 0; j < MAX_RUNES && count > 0; ++j)
{
- if (plr->GetRuneCooldown(j) && plr->GetCurrentRune(j) == RuneType(m_spellInfo->EffectMiscValue[effIndex]))
+ if (plr->GetRuneCooldown(j) && plr->GetCurrentRune(j) == RuneType(m_spellInfo->Effects[effIndex].MiscValue))
{
plr->SetRuneCooldown(j, 0);
--count;
@@ -6714,7 +6712,7 @@ void Spell::EffectCreateTamedPet(SpellEffIndex effIndex)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER || unitTarget->GetPetGUID() || unitTarget->getClass() != CLASS_HUNTER)
return;
- uint32 creatureEntry = m_spellInfo->EffectMiscValue[effIndex];
+ uint32 creatureEntry = m_spellInfo->Effects[effIndex].MiscValue;
Pet* pet = unitTarget->CreateTamedPetFrom(creatureEntry, m_spellInfo->Id);
if (!pet)
return;
@@ -6738,7 +6736,7 @@ void Spell::EffectDiscoverTaxi(SpellEffIndex effIndex)
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- uint32 nodeid = m_spellInfo->EffectMiscValue[effIndex];
+ uint32 nodeid = m_spellInfo->Effects[effIndex].MiscValue;
if (sTaxiNodesStore.LookupEntry(nodeid))
unitTarget->ToPlayer()->GetSession()->SendDiscoverNewTaxiNode(nodeid);
}
@@ -6785,7 +6783,7 @@ void Spell::EffectGameObjectSetDestructionState(SpellEffIndex effIndex)
return;
Player* player = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself();
- gameObjTarget->SetDestructibleState(GameObjectDestructibleState(m_spellInfo->EffectMiscValue[effIndex]), player, true);
+ gameObjTarget->SetDestructibleState(GameObjectDestructibleState(m_spellInfo->Effects[effIndex].MiscValue), player, true);
}
void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const *properties)
@@ -6810,7 +6808,7 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const *
//float radius = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
float radius = 5.0f;
uint32 amount = damage > 0 ? damage : 1;
- int32 duration = GetSpellDuration(m_spellInfo);
+ int32 duration = m_spellInfo->GetDuration();
switch (m_spellInfo->Id)
{
case 1122: // Inferno
@@ -6874,7 +6872,7 @@ void Spell::GetSummonPosition(uint32 i, Position &pos, float radius, uint32 coun
else
{
//This is a workaround. Do not have time to write much about it
- switch (m_spellInfo->EffectImplicitTargetA[i])
+ switch (m_spellInfo->Effects[i].TargetA)
{
case TARGET_MINION:
case TARGET_DEST_CASTER_RANDOM:
@@ -6913,7 +6911,7 @@ void Spell::EffectPlayMusic(SpellEffIndex effIndex)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- uint32 soundid = m_spellInfo->EffectMiscValue[effIndex];
+ uint32 soundid = m_spellInfo->Effects[effIndex].MiscValue;
if (!sSoundEntriesStore.LookupEntry(soundid))
{
@@ -6955,7 +6953,7 @@ void Spell::EffectPlayerNotification(SpellEffIndex effIndex)
break;
}
- uint32 soundid = m_spellInfo->EffectMiscValue[effIndex];
+ uint32 soundid = m_spellInfo->Effects[effIndex].MiscValue;
if (!sSoundEntriesStore.LookupEntry(soundid))
{
@@ -6973,7 +6971,7 @@ void Spell::EffectRemoveAura(SpellEffIndex effIndex)
if (!unitTarget)
return;
// there may be need of specifying casterguid of removed auras
- unitTarget->RemoveAurasDueToSpell(m_spellInfo->EffectTriggerSpell[effIndex]);
+ unitTarget->RemoveAurasDueToSpell(m_spellInfo->Effects[effIndex].TriggerSpell);
}
void Spell::EffectCastButtons(SpellEffIndex effIndex)
@@ -6982,8 +6980,8 @@ void Spell::EffectCastButtons(SpellEffIndex effIndex)
return;
Player* p_caster = m_caster->ToPlayer();
- uint32 button_id = m_spellInfo->EffectMiscValue[effIndex] + 132;
- uint32 n_buttons = m_spellInfo->EffectMiscValueB[effIndex];
+ uint32 button_id = m_spellInfo->Effects[effIndex].MiscValue + 132;
+ uint32 n_buttons = m_spellInfo->Effects[effIndex].MiscValueB;
for (; n_buttons; n_buttons--, button_id++)
{
@@ -6998,8 +6996,8 @@ void Spell::EffectCastButtons(SpellEffIndex effIndex)
if (p_caster->HasSpellCooldown(spell_id))
continue;
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
- uint32 cost = CalculatePowerCost(spellInfo, m_caster, GetSpellSchoolMask(spellInfo));
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id);
+ uint32 cost = spellInfo->CalcPowerCost(m_caster, spellInfo->GetSchoolMask());
if (m_caster->GetPower(POWER_MANA) < cost)
break;
@@ -7020,7 +7018,7 @@ void Spell::EffectRechargeManaGem(SpellEffIndex /*effIndex*/)
if (!player)
return;
- uint32 item_id = m_spellInfo->EffectItemType[0];
+ uint32 item_id = m_spellInfo->Effects[EFFECT_0].ItemType;
ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(item_id);
if (!pProto)
@@ -7046,7 +7044,7 @@ void Spell::EffectBind(SpellEffIndex effIndex)
uint32 area_id;
WorldLocation loc;
- if (m_spellInfo->EffectImplicitTargetA[effIndex] == TARGET_DST_DB || m_spellInfo->EffectImplicitTargetB[effIndex] == TARGET_DST_DB)
+ if (m_spellInfo->Effects[effIndex].TargetA == TARGET_DST_DB || m_spellInfo->Effects[effIndex].TargetB == TARGET_DST_DB)
{
SpellTargetPosition const* st = sSpellMgr->GetSpellTargetPosition(m_spellInfo->Id);
if (!st)
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index c6f03c0e3e5..a14d53eb667 100755
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -17,9 +17,11 @@
*/
#include "SpellMgr.h"
+#include "SpellInfo.h"
#include "ObjectMgr.h"
#include "SpellAuras.h"
#include "SpellAuraDefines.h"
+#include "SharedDefines.h"
#include "DBCStores.h"
#include "World.h"
#include "Chat.h"
@@ -29,1313 +31,697 @@
#include "MapManager.h"
#include "BattlegroundIC.h"
-bool IsAreaEffectTarget[TOTAL_SPELL_TARGETS];
-SpellEffectTargetTypes EffectTargetType[TOTAL_SPELL_EFFECTS];
-SpellSelectTargetTypes SpellTargetType[TOTAL_SPELL_TARGETS];
-
-SpellMgr::SpellMgr()
+bool IsPrimaryProfessionSkill(uint32 skill)
{
- for (uint8 i = 0; i < TOTAL_SPELL_EFFECTS; ++i)
- {
- switch (i)
- {
- case SPELL_EFFECT_PERSISTENT_AREA_AURA: //27
- case SPELL_EFFECT_SUMMON: //28
- case SPELL_EFFECT_TRIGGER_MISSILE: //32
- case SPELL_EFFECT_TRANS_DOOR: //50 summon object
- case SPELL_EFFECT_SUMMON_PET: //56
- case SPELL_EFFECT_ADD_FARSIGHT: //72
- case SPELL_EFFECT_SUMMON_OBJECT_WILD: //76
- //case SPELL_EFFECT_SUMMON_CRITTER: //97 not 303
- case SPELL_EFFECT_SUMMON_OBJECT_SLOT1: //104
- case SPELL_EFFECT_SUMMON_OBJECT_SLOT2: //105
- case SPELL_EFFECT_SUMMON_OBJECT_SLOT3: //106
- case SPELL_EFFECT_SUMMON_OBJECT_SLOT4: //107
- case SPELL_EFFECT_SUMMON_DEAD_PET: //109
- case SPELL_EFFECT_TRIGGER_SPELL_2: //151 ritual of summon
- EffectTargetType[i] = SPELL_REQUIRE_DEST;
- break;
- case SPELL_EFFECT_PARRY: // 0
- case SPELL_EFFECT_BLOCK: // 0
- case SPELL_EFFECT_SKILL: // always with dummy 3 as A
- //case SPELL_EFFECT_LEARN_SPELL: // 0 may be 5 pet
- case SPELL_EFFECT_TRADE_SKILL: // 0 or 1
- case SPELL_EFFECT_PROFICIENCY: // 0
- EffectTargetType[i] = SPELL_REQUIRE_NONE;
- break;
- case SPELL_EFFECT_ENCHANT_ITEM:
- case SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY:
- case SPELL_EFFECT_DISENCHANT:
- //in 243 this is 0, in 309 it is 1
- //so both item target and unit target is pushed, and cause crash
- //case SPELL_EFFECT_FEED_PET:
- case SPELL_EFFECT_PROSPECTING:
- case SPELL_EFFECT_MILLING:
- case SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC:
- EffectTargetType[i] = SPELL_REQUIRE_ITEM;
- break;
- //caster must be pushed otherwise no sound
- case SPELL_EFFECT_APPLY_AREA_AURA_PARTY:
- case SPELL_EFFECT_APPLY_AREA_AURA_FRIEND:
- case SPELL_EFFECT_APPLY_AREA_AURA_ENEMY:
- case SPELL_EFFECT_APPLY_AREA_AURA_PET:
- case SPELL_EFFECT_APPLY_AREA_AURA_OWNER:
- case SPELL_EFFECT_APPLY_AREA_AURA_RAID:
- case SPELL_EFFECT_CHARGE:
- case SPELL_EFFECT_CHARGE_DEST:
- case SPELL_EFFECT_JUMP:
- case SPELL_EFFECT_JUMP_DEST:
- case SPELL_EFFECT_LEAP_BACK:
- EffectTargetType[i] = SPELL_REQUIRE_CASTER;
- break;
- //case SPELL_EFFECT_WMO_DAMAGE:
- //case SPELL_EFFECT_WMO_REPAIR:
- //case SPELL_EFFECT_WMO_CHANGE:
- // EffectTargetType[i] = SPELL_REQUIRE_GOBJECT;
- // break;
- default:
- EffectTargetType[i] = SPELL_REQUIRE_UNIT;
- break;
- }
- }
-
- for (uint8 i = 0; i < TOTAL_SPELL_TARGETS; ++i)
- {
- switch (i)
- {
- case TARGET_UNIT_CASTER:
- case TARGET_UNIT_CASTER_FISHING:
- case TARGET_UNIT_MASTER:
- case TARGET_UNIT_PET:
- case TARGET_UNIT_PARTY_CASTER:
- case TARGET_UNIT_RAID_CASTER:
- case TARGET_UNIT_VEHICLE:
- case TARGET_UNIT_PASSENGER_0:
- case TARGET_UNIT_PASSENGER_1:
- case TARGET_UNIT_PASSENGER_2:
- case TARGET_UNIT_PASSENGER_3:
- case TARGET_UNIT_PASSENGER_4:
- case TARGET_UNIT_PASSENGER_5:
- case TARGET_UNIT_PASSENGER_6:
- case TARGET_UNIT_PASSENGER_7:
- case TARGET_UNIT_SUMMONER:
- SpellTargetType[i] = TARGET_TYPE_UNIT_CASTER;
- break;
- case TARGET_UNIT_TARGET_MINIPET:
- case TARGET_UNIT_TARGET_ALLY:
- case TARGET_UNIT_TARGET_RAID:
- case TARGET_UNIT_TARGET_ANY:
- case TARGET_UNIT_TARGET_ENEMY:
- case TARGET_UNIT_TARGET_PARTY:
- case TARGET_UNIT_TARGET_PASSENGER:
- case TARGET_UNIT_TARGET_ALLY_PARTY:
- case TARGET_UNIT_TARGET_CLASS_RAID:
- case TARGET_UNIT_CHAINHEAL:
- SpellTargetType[i] = TARGET_TYPE_UNIT_TARGET;
- break;
- case TARGET_UNIT_NEARBY_ENEMY:
- case TARGET_UNIT_NEARBY_ALLY:
- case TARGET_UNIT_NEARBY_ENTRY:
- case TARGET_UNIT_NEARBY_PARTY:
- case TARGET_UNIT_NEARBY_RAID:
- case TARGET_GAMEOBJECT_NEARBY_ENTRY:
- SpellTargetType[i] = TARGET_TYPE_UNIT_NEARBY;
- break;
- case TARGET_UNIT_AREA_ENEMY_SRC:
- case TARGET_UNIT_AREA_ALLY_SRC:
- case TARGET_UNIT_AREA_ENTRY_SRC:
- case TARGET_UNIT_AREA_PARTY_SRC:
- case TARGET_GAMEOBJECT_AREA_SRC:
- SpellTargetType[i] = TARGET_TYPE_AREA_SRC;
- break;
- case TARGET_UNIT_AREA_ENEMY_DST:
- case TARGET_UNIT_AREA_ALLY_DST:
- case TARGET_UNIT_AREA_ENTRY_DST:
- case TARGET_UNIT_AREA_PARTY_DST:
- case TARGET_GAMEOBJECT_AREA_DST:
- SpellTargetType[i] = TARGET_TYPE_AREA_DST;
- break;
- case TARGET_UNIT_CONE_ENEMY:
- case TARGET_UNIT_CONE_ALLY:
- case TARGET_UNIT_CONE_ENTRY:
- case TARGET_UNIT_CONE_ENEMY_UNKNOWN:
- case TARGET_UNIT_AREA_PATH:
- case TARGET_GAMEOBJECT_AREA_PATH:
- SpellTargetType[i] = TARGET_TYPE_AREA_CONE;
- break;
- case TARGET_DST_CASTER:
- case TARGET_SRC_CASTER:
- case TARGET_MINION:
- case TARGET_DEST_CASTER_FRONT_LEAP:
- case TARGET_DEST_CASTER_FRONT:
- case TARGET_DEST_CASTER_BACK:
- case TARGET_DEST_CASTER_RIGHT:
- case TARGET_DEST_CASTER_LEFT:
- case TARGET_DEST_CASTER_FRONT_LEFT:
- case TARGET_DEST_CASTER_BACK_LEFT:
- case TARGET_DEST_CASTER_BACK_RIGHT:
- case TARGET_DEST_CASTER_FRONT_RIGHT:
- case TARGET_DEST_CASTER_RANDOM:
- case TARGET_DEST_CASTER_RADIUS:
- SpellTargetType[i] = TARGET_TYPE_DEST_CASTER;
- break;
- case TARGET_DST_TARGET_ENEMY:
- case TARGET_DEST_TARGET_ANY:
- case TARGET_DEST_TARGET_FRONT:
- case TARGET_DEST_TARGET_BACK:
- case TARGET_DEST_TARGET_RIGHT:
- case TARGET_DEST_TARGET_LEFT:
- case TARGET_DEST_TARGET_FRONT_LEFT:
- case TARGET_DEST_TARGET_BACK_LEFT:
- case TARGET_DEST_TARGET_BACK_RIGHT:
- case TARGET_DEST_TARGET_FRONT_RIGHT:
- case TARGET_DEST_TARGET_RANDOM:
- case TARGET_DEST_TARGET_RADIUS:
- SpellTargetType[i] = TARGET_TYPE_DEST_TARGET;
- break;
- case TARGET_DEST_DYNOBJ_ENEMY:
- case TARGET_DEST_DYNOBJ_ALLY:
- case TARGET_DEST_DYNOBJ_NONE:
- case TARGET_DEST_DEST:
- case TARGET_DEST_TRAJ:
- case TARGET_DEST_DEST_FRONT_LEFT:
- case TARGET_DEST_DEST_BACK_LEFT:
- case TARGET_DEST_DEST_BACK_RIGHT:
- case TARGET_DEST_DEST_FRONT_RIGHT:
- case TARGET_DEST_DEST_FRONT:
- case TARGET_DEST_DEST_BACK:
- case TARGET_DEST_DEST_RIGHT:
- case TARGET_DEST_DEST_LEFT:
- case TARGET_DEST_DEST_RANDOM:
- case TARGET_DEST_DEST_RANDOM_DIR_DIST:
- SpellTargetType[i] = TARGET_TYPE_DEST_DEST;
- break;
- case TARGET_DST_DB:
- case TARGET_DST_HOME:
- case TARGET_DST_NEARBY_ENTRY:
- SpellTargetType[i] = TARGET_TYPE_DEST_SPECIAL;
- break;
- case TARGET_UNIT_CHANNEL_TARGET:
- case TARGET_DEST_CHANNEL_TARGET:
- case TARGET_DEST_CHANNEL_CASTER:
- SpellTargetType[i] = TARGET_TYPE_CHANNEL;
- break;
- default:
- SpellTargetType[i] = TARGET_TYPE_DEFAULT;
- }
- }
-
- for (int32 i = 0; i < TOTAL_SPELL_TARGETS; ++i)
- {
- switch (i)
- {
- case TARGET_UNIT_AREA_ENEMY_DST:
- case TARGET_UNIT_AREA_ENEMY_SRC:
- case TARGET_UNIT_AREA_ALLY_DST:
- case TARGET_UNIT_AREA_ALLY_SRC:
- case TARGET_UNIT_AREA_ENTRY_DST:
- case TARGET_UNIT_AREA_ENTRY_SRC:
- case TARGET_UNIT_AREA_PARTY_DST:
- case TARGET_UNIT_AREA_PARTY_SRC:
- case TARGET_UNIT_TARGET_ALLY_PARTY:
- case TARGET_UNIT_PARTY_CASTER:
- case TARGET_UNIT_CONE_ENEMY:
- case TARGET_UNIT_CONE_ALLY:
- case TARGET_UNIT_CONE_ENEMY_UNKNOWN:
- case TARGET_UNIT_AREA_PATH:
- case TARGET_GAMEOBJECT_AREA_PATH:
- case TARGET_UNIT_RAID_CASTER:
- IsAreaEffectTarget[i] = true;
- break;
- default:
- IsAreaEffectTarget[i] = false;
- break;
- }
- }
-}
-
-SpellMgr::~SpellMgr()
-{
-}
-
-bool SpellMgr::IsSrcTargetSpell(SpellEntry const *spellInfo) const
-{
- for (uint8 i = 0; i< MAX_SPELL_EFFECTS; ++i)
- {
- if (SpellTargetType[spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_AREA_SRC || SpellTargetType[spellInfo->EffectImplicitTargetB[i]] == TARGET_TYPE_AREA_SRC)
- return true;
- }
- return false;
-}
-
-int32 GetSpellDuration(SpellEntry const *spellInfo)
-{
- if (!spellInfo)
- return 0;
- SpellDurationEntry const* du = sSpellDurationStore.LookupEntry(spellInfo->DurationIndex);
- if (!du)
- return 0;
- return (du->Duration[0] == -1) ? -1 : abs(du->Duration[0]);
-}
-
-int32 GetSpellMaxDuration(SpellEntry const *spellInfo)
-{
- if (!spellInfo)
- return 0;
- SpellDurationEntry const* du = sSpellDurationStore.LookupEntry(spellInfo->DurationIndex);
- if (!du)
- return 0;
- return (du->Duration[2] == -1) ? -1 : abs(du->Duration[2]);
-}
-
-uint32 GetDispelChance(Unit* auraCaster, Unit* target, uint32 spellId, bool offensive, bool *result)
-{
- // we assume that aura dispel chance is 100% on start
- // need formula for level difference based chance
- int32 resist_chance = 0;
-
- // Apply dispel mod from aura caster
- if (auraCaster)
- if (Player* modOwner = auraCaster->GetSpellModOwner())
- modOwner->ApplySpellMod(spellId, SPELLMOD_RESIST_DISPEL_CHANCE, resist_chance);
-
- // Dispel resistance from target SPELL_AURA_MOD_DISPEL_RESIST
- // Only affects offensive dispels
- if (offensive && target)
- resist_chance += target->GetTotalAuraModifier(SPELL_AURA_MOD_DISPEL_RESIST);
-
- // Try dispel
- if (result)
- *result = !roll_chance_i(resist_chance);
-
- resist_chance = resist_chance < 0 ? 0 : resist_chance;
- resist_chance = resist_chance > 100 ? 100 : resist_chance;
- return 100 - resist_chance;
-}
-
-uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell* spell)
-{
- SpellCastTimesEntry const* spellCastTimeEntry = sSpellCastTimesStore.LookupEntry(spellInfo->CastingTimeIndex);
-
- // not all spells have cast time index and this is all is pasiive abilities
- if (!spellCastTimeEntry)
- return 0;
-
- int32 castTime = spellCastTimeEntry->CastTime;
-
- if (Unit *caster = (spell ? spell->GetCaster() : NULL))
- caster->ModSpellCastTime(spellInfo, castTime, spell);
-
- if (spellInfo->Attributes & SPELL_ATTR0_REQ_AMMO && (!spell || !(spell->IsAutoRepeat())))
- castTime += 500;
-
- return (castTime > 0) ? uint32(castTime) : 0;
-}
-
-bool IsPassiveSpell(uint32 spellId)
-{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
- if (!spellInfo)
+ SkillLineEntry const *pSkill = sSkillLineStore.LookupEntry(skill);
+ if (!pSkill)
return false;
- return IsPassiveSpell(spellInfo);
-}
-
-bool IsPassiveSpell(SpellEntry const* spellInfo)
-{
- if (spellInfo->Attributes & SPELL_ATTR0_PASSIVE)
- return true;
- return false;
-}
-bool IsAutocastableSpell(uint32 spellId)
-{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
- if (!spellInfo)
- return false;
- if (spellInfo->Attributes & SPELL_ATTR0_PASSIVE)
+ if (pSkill->categoryId != SKILL_CATEGORY_PROFESSION)
return false;
- if (spellInfo->AttributesEx & SPELL_ATTR1_UNAUTOCASTABLE_BY_PET)
- return false;
- return true;
-}
-
-bool IsHigherHankOfSpell(uint32 spellId_1, uint32 spellId_2)
-{
- return sSpellMgr->GetSpellRank(spellId_1) < sSpellMgr->GetSpellRank(spellId_2);
-}
-uint32 CalculatePowerCost(SpellEntry const* spellInfo, Unit const* caster, SpellSchoolMask schoolMask)
-{
- // Spell drain all exist power on cast (Only paladin lay of Hands)
- if (spellInfo->AttributesEx & SPELL_ATTR1_DRAIN_ALL_POWER)
- {
- // If power type - health drain all
- if (spellInfo->powerType == POWER_HEALTH)
- return caster->GetHealth();
- // Else drain all power
- if (spellInfo->powerType < MAX_POWERS)
- return caster->GetPower(Powers(spellInfo->powerType));
- sLog->outError("CalculateManaCost: Unknown power type '%d' in spell %d", spellInfo->powerType, spellInfo->Id);
- return 0;
- }
-
- // Base powerCost
- int32 powerCost = spellInfo->manaCost;
- // PCT cost from total amount
- if (spellInfo->ManaCostPercentage)
- {
- switch (spellInfo->powerType)
- {
- // health as power used
- case POWER_HEALTH:
- powerCost += int32(CalculatePctU(caster->GetCreateHealth(), spellInfo->ManaCostPercentage));
- break;
- case POWER_MANA:
- powerCost += int32(CalculatePctU(caster->GetCreateMana(), spellInfo->ManaCostPercentage));
- break;
- case POWER_RAGE:
- case POWER_FOCUS:
- case POWER_ENERGY:
- case POWER_HAPPINESS:
- powerCost += int32(CalculatePctU(caster->GetMaxPower(Powers(spellInfo->powerType)), spellInfo->ManaCostPercentage));
- break;
- case POWER_RUNE:
- case POWER_RUNIC_POWER:
- sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "CalculateManaCost: Not implemented yet!");
- break;
- default:
- sLog->outError("CalculateManaCost: Unknown power type '%d' in spell %d", spellInfo->powerType, spellInfo->Id);
- return 0;
- }
- }
- SpellSchools school = GetFirstSchoolInMask(schoolMask);
- // Flat mod from caster auras by spell school
- powerCost += caster->GetInt32Value(UNIT_FIELD_POWER_COST_MODIFIER + school);
- // Shiv - costs 20 + weaponSpeed*10 energy (apply only to non-triggered spell with energy cost)
- if (spellInfo->AttributesEx4 & SPELL_ATTR4_SPELL_VS_EXTEND_COST)
- powerCost += caster->GetAttackTime(OFF_ATTACK) / 100;
- // Apply cost mod by spell
- if (Player* modOwner = caster->GetSpellModOwner())
- modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_COST, powerCost);
-
- if (spellInfo->Attributes & SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION)
- powerCost = int32(powerCost / (1.117f * spellInfo->spellLevel / caster->getLevel() -0.1327f));
-
- // PCT mod from user auras by school
- powerCost = int32(powerCost * (1.0f + caster->GetFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER + school)));
- if (powerCost < 0)
- powerCost = 0;
- return powerCost;
+ return true;
}
-bool IsSpellRequiringFocusedTarget(SpellEntry const* spellInfo)
+bool IsPartOfSkillLine(uint32 skillId, uint32 spellId)
{
- for (uint8 i = 0 ; i < MAX_SPELL_EFFECTS; ++i)
- {
- if (SpellTargetType[spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_UNIT_TARGET
- || SpellTargetType[spellInfo->EffectImplicitTargetB[i]] == TARGET_TYPE_UNIT_TARGET
- || SpellTargetType[spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_CHANNEL
- || SpellTargetType[spellInfo->EffectImplicitTargetB[i]] == TARGET_TYPE_CHANNEL
- || SpellTargetType[spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_DEST_TARGET
- || SpellTargetType[spellInfo->EffectImplicitTargetB[i]] == TARGET_TYPE_DEST_TARGET)
+ SkillLineAbilityMapBounds skillBounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellId);
+ for (SkillLineAbilityMap::const_iterator itr = skillBounds.first; itr != skillBounds.second; ++itr)
+ if (itr->second->skillId == skillId)
return true;
- }
- return false;
-}
-Unit* GetTriggeredSpellCaster(SpellEntry const* spellInfo, Unit* caster, Unit* target)
-{
- if (IsSpellRequiringFocusedTarget(spellInfo))
- return caster;
- return target;
+ return false;
}
-AuraState GetSpellAuraState(SpellEntry const* spellInfo)
+DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto, bool triggered)
{
- // Seals
- if (IsSealSpell(spellInfo))
- return AURA_STATE_JUDGEMENT;
-
- // Conflagrate aura state on Immolate and Shadowflame
- if (spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK &&
- // Immolate
- ((spellInfo->SpellFamilyFlags[0] & 4) ||
- // Shadowflame
- (spellInfo->SpellFamilyFlags[2] & 2)))
- return AURA_STATE_CONFLAGRATE;
-
- // Faerie Fire (druid versions)
- if (spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && spellInfo->SpellFamilyFlags[0] & 0x400)
- return AURA_STATE_FAERIE_FIRE;
-
- // Sting (hunter's pet ability)
- if (spellInfo->Category == 1133)
- return AURA_STATE_FAERIE_FIRE;
-
- // Victorious
- if (spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellFamilyFlags[1] & 0x00040000)
- return AURA_STATE_WARRIOR_VICTORY_RUSH;
-
- // Swiftmend state on Regrowth & Rejuvenation
- if (spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && spellInfo->SpellFamilyFlags[0] & 0x50)
- return AURA_STATE_SWIFTMEND;
-
- // Deadly poison aura state
- if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && spellInfo->SpellFamilyFlags[0] & 0x10000)
- return AURA_STATE_DEADLY_POISON;
-
- // Enrage aura state
- if (spellInfo->Dispel == DISPEL_ENRAGE)
- return AURA_STATE_ENRAGE;
-
- // Bleeding aura state
- if (GetAllSpellMechanicMask(spellInfo) & 1<<MECHANIC_BLEED)
- return AURA_STATE_BLEEDING;
-
- if (GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_FROST)
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_STUN
- || spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_ROOT)
- return AURA_STATE_FROZEN;
+ if (spellproto->IsPositive())
+ return DIMINISHING_NONE;
- switch (spellInfo->Id)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- case 71465: // Divine Surge
- return AURA_STATE_UNKNOWN22;
- default:
- break;
+ if (spellproto->Effects[i].ApplyAuraName == SPELL_AURA_MOD_TAUNT)
+ return DIMINISHING_TAUNT;
}
- return AURA_STATE_NONE;
-}
-
-SpellSpecific GetSpellSpecific(SpellEntry const* spellInfo)
-{
- switch (spellInfo->SpellFamilyName)
+ // Explicit Diminishing Groups
+ switch (spellproto->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
{
- // Food / Drinks (mostly)
- if (spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED)
- {
- bool food = false;
- bool drink = false;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- {
- switch (spellInfo->EffectApplyAuraName[i])
- {
- // Food
- case SPELL_AURA_MOD_REGEN:
- case SPELL_AURA_OBS_MOD_HEALTH:
- food = true;
- break;
- // Drink
- case SPELL_AURA_MOD_POWER_REGEN:
- case SPELL_AURA_OBS_MOD_POWER:
- drink = true;
- break;
- default:
- break;
- }
- }
-
- if (food && drink)
- return SPELL_SPECIFIC_FOOD_AND_DRINK;
- else if (food)
- return SPELL_SPECIFIC_FOOD;
- else if (drink)
- return SPELL_SPECIFIC_DRINK;
- }
- // scrolls effects
- else
- {
- uint32 firstSpell = sSpellMgr->GetFirstSpellInChain(spellInfo->Id);
- switch (firstSpell)
- {
- case 8118: // Strength
- case 8099: // Stamina
- case 8112: // Spirit
- case 8096: // Intellect
- case 8115: // Agility
- case 8091: // Armor
- return SPELL_SPECIFIC_SCROLL;
- case 12880: // Enrage (Enrage)
- case 57518: // Enrage (Wrecking Crew)
- return SPELL_SPECIFIC_WARRIOR_ENRAGE;
- }
- }
+ // Pet charge effects (Infernal Awakening, Demon Charge)
+ if (spellproto->SpellVisual[0] == 2816 && spellproto->SpellIconID == 15)
+ return DIMINISHING_CONTROLLED_STUN;
+ // Gnaw
+ else if (spellproto->Id == 47481)
+ return DIMINISHING_CONTROLLED_STUN;
break;
}
+ // Event spells
+ case SPELLFAMILY_UNK1:
+ return DIMINISHING_NONE;
case SPELLFAMILY_MAGE:
{
- // family flags 18(Molten), 25(Frost/Ice), 28(Mage)
- if (spellInfo->SpellFamilyFlags[0] & 0x12040000)
- return SPELL_SPECIFIC_MAGE_ARMOR;
-
- // Arcane brillance and Arcane intelect (normal check fails because of flags difference)
- if (spellInfo->SpellFamilyFlags[0] & 0x400)
- return SPELL_SPECIFIC_MAGE_ARCANE_BRILLANCE;
-
- if ((spellInfo->SpellFamilyFlags[0] & 0x1000000) && spellInfo->EffectApplyAuraName[0] == SPELL_AURA_MOD_CONFUSE)
- return SPELL_SPECIFIC_MAGE_POLYMORPH;
-
+ // Frostbite
+ if (spellproto->SpellFamilyFlags[1] & 0x80000000)
+ return DIMINISHING_ROOT;
+ // Shattered Barrier
+ else if (spellproto->SpellVisual[0] == 12297)
+ return DIMINISHING_ROOT;
+ // Deep Freeze
+ else if (spellproto->SpellIconID == 2939 && spellproto->SpellVisual[0] == 9963)
+ return DIMINISHING_CONTROLLED_STUN;
+ // Frost Nova / Freeze (Water Elemental)
+ else if (spellproto->SpellIconID == 193)
+ return DIMINISHING_CONTROLLED_ROOT;
+ // Dragon's Breath
+ else if (spellproto->SpellFamilyFlags[0] & 0x800000)
+ return DIMINISHING_DISORIENT;
break;
}
case SPELLFAMILY_WARRIOR:
{
- if (spellInfo->Id == 12292) // Death Wish
- return SPELL_SPECIFIC_WARRIOR_ENRAGE;
-
+ // Improved Hamstring
+ if (spellproto->AttributesEx3 & 0x80000 && spellproto->SpellIconID == 23)
+ return DIMINISHING_ROOT;
+ // Charge Stun (own diminishing)
+ else if (spellproto->SpellFamilyFlags[0] & 0x01000000)
+ return DIMINISHING_CHARGE;
break;
}
case SPELLFAMILY_WARLOCK:
{
- // only warlock curses have this
- if (spellInfo->Dispel == DISPEL_CURSE)
- return SPELL_SPECIFIC_CURSE;
-
- // Warlock (Demon Armor | Demon Skin | Fel Armor)
- if (spellInfo->SpellFamilyFlags[1] & 0x20000020 || spellInfo->SpellFamilyFlags[2] & 0x00000010)
- return SPELL_SPECIFIC_WARLOCK_ARMOR;
-
- //seed of corruption and corruption
- if (spellInfo->SpellFamilyFlags[1] & 0x10 || spellInfo->SpellFamilyFlags[0] & 0x2)
- return SPELL_SPECIFIC_WARLOCK_CORRUPTION;
+ // Death Coil
+ if (spellproto->SpellFamilyFlags[0] & 0x80000)
+ return DIMINISHING_HORROR;
+ // Seduction
+ else if (spellproto->SpellFamilyFlags[1] & 0x10000000)
+ return DIMINISHING_FEAR;
break;
}
case SPELLFAMILY_PRIEST:
{
- // Divine Spirit and Prayer of Spirit
- if (spellInfo->SpellFamilyFlags[0] & 0x20)
- return SPELL_SPECIFIC_PRIEST_DIVINE_SPIRIT;
-
+ // Psychic Horror
+ if (spellproto->SpellFamilyFlags[2] & 0x2000)
+ return DIMINISHING_HORROR;
break;
}
- case SPELLFAMILY_HUNTER:
+ case SPELLFAMILY_DRUID:
{
- // only hunter stings have this
- if (spellInfo->Dispel == DISPEL_POISON)
- return SPELL_SPECIFIC_STING;
-
- // only hunter aspects have this (but not all aspects in hunter family)
- if (spellInfo->SpellFamilyFlags.HasFlag(0x00380000, 0x00440000, 0x00001010))
- return SPELL_SPECIFIC_ASPECT;
-
+ // Pounce
+ if (spellproto->SpellFamilyFlags[0] & 0x20000)
+ return DIMINISHING_OPENING_STUN;
+ // Cyclone
+ else if (spellproto->SpellFamilyFlags[1] & 0x20)
+ return DIMINISHING_CYCLONE;
+ // Entangling Roots
+ // Nature's Grasp
+ else if (spellproto->SpellFamilyFlags[0] & 0x00000200)
+ return DIMINISHING_CONTROLLED_ROOT;
break;
}
- case SPELLFAMILY_PALADIN:
+ case SPELLFAMILY_ROGUE:
{
- if (IsSealSpell(spellInfo))
- return SPELL_SPECIFIC_SEAL;
-
- if (spellInfo->SpellFamilyFlags[0] & 0x00002190)
- return SPELL_SPECIFIC_HAND;
-
- // Judgement of Wisdom, Judgement of Light, Judgement of Justice
- if (spellInfo->Id == 20184 || spellInfo->Id == 20185 || spellInfo->Id == 20186)
- return SPELL_SPECIFIC_JUDGEMENT;
-
- // only paladin auras have this (for palaldin class family)
- if (spellInfo->SpellFamilyFlags[2] & 0x00000020)
- return SPELL_SPECIFIC_AURA;
-
+ // Gouge
+ if (spellproto->SpellFamilyFlags[0] & 0x8)
+ return DIMINISHING_DISORIENT;
+ // Blind
+ else if (spellproto->SpellFamilyFlags[0] & 0x1000000)
+ return DIMINISHING_FEAR;
+ // Cheap Shot
+ else if (spellproto->SpellFamilyFlags[0] & 0x400)
+ return DIMINISHING_OPENING_STUN;
break;
}
- case SPELLFAMILY_SHAMAN:
+ case SPELLFAMILY_HUNTER:
{
- if (IsElementalShield(spellInfo))
- return SPELL_SPECIFIC_ELEMENTAL_SHIELD;
-
+ // Scatter Shot (own diminishing)
+ if ((spellproto->SpellFamilyFlags[0] & 0x40000) && spellproto->SpellIconID == 132)
+ return DIMINISHING_SCATTER_SHOT;
+ // Entrapment (own diminishing)
+ else if (spellproto->SpellVisual[0] == 7484 && spellproto->SpellIconID == 20)
+ return DIMINISHING_ENTRAPMENT;
+ // Wyvern Sting mechanic is MECHANIC_SLEEP but the diminishing is DIMINISHING_DISORIENT
+ else if ((spellproto->SpellFamilyFlags[1] & 0x1000) && spellproto->SpellIconID == 1721)
+ return DIMINISHING_DISORIENT;
+ // Freezing Arrow
+ else if (spellproto->SpellFamilyFlags[0] & 0x8)
+ return DIMINISHING_DISORIENT;
break;
}
-
- case SPELLFAMILY_DEATHKNIGHT:
- if (spellInfo->Id == 48266 || spellInfo->Id == 48263 || spellInfo->Id == 48265)
- //if (spellInfo->Category == 47)
- return SPELL_SPECIFIC_PRESENCE;
+ case SPELLFAMILY_PALADIN:
+ {
+ // Turn Evil
+ if ((spellproto->SpellFamilyFlags[1] & 0x804000) && spellproto->SpellIconID == 309)
+ return DIMINISHING_FEAR;
break;
- }
-
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- {
- if (spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA)
+ }
+ case SPELLFAMILY_DEATHKNIGHT:
{
- switch (spellInfo->EffectApplyAuraName[i])
- {
- case SPELL_AURA_MOD_CHARM:
- case SPELL_AURA_MOD_POSSESS_PET:
- case SPELL_AURA_MOD_POSSESS:
- case SPELL_AURA_AOE_CHARM:
- return SPELL_SPECIFIC_CHARM;
- case SPELL_AURA_TRACK_CREATURES:
- case SPELL_AURA_TRACK_RESOURCES:
- case SPELL_AURA_TRACK_STEALTHED:
- return SPELL_SPECIFIC_TRACKER;
- case SPELL_AURA_PHASE:
- return SPELL_SPECIFIC_PHASE;
- }
+ // Hungering Cold (no flags)
+ if (spellproto->SpellIconID == 2797)
+ return DIMINISHING_DISORIENT;
+ break;
}
+ default:
+ break;
}
- return SPELL_SPECIFIC_NORMAL;
-}
+ // Lastly - Set diminishing depending on mechanic
+ uint32 mechanic = spellproto->GetAllEffectsMechanicMask();
+ if (mechanic & (1 << MECHANIC_CHARM))
+ return DIMINISHING_MIND_CONTROL;
+ if (mechanic & (1 << MECHANIC_SILENCE))
+ return DIMINISHING_SILENCE;
+ if (mechanic & (1 << MECHANIC_SLEEP))
+ return DIMINISHING_SLEEP;
+ if (mechanic & ((1 << MECHANIC_SAPPED) | (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_SHACKLE)))
+ return DIMINISHING_DISORIENT;
+ // Mechanic Knockout, except Blast Wave
+ if (mechanic & (1 << MECHANIC_KNOCKOUT) && spellproto->SpellIconID != 292)
+ return DIMINISHING_DISORIENT;
+ if (mechanic & (1 << MECHANIC_DISARM))
+ return DIMINISHING_DISARM;
+ if (mechanic & (1 << MECHANIC_FEAR))
+ return DIMINISHING_FEAR;
+ if (mechanic & (1 << MECHANIC_STUN))
+ return triggered ? DIMINISHING_STUN : DIMINISHING_CONTROLLED_STUN;
+ if (mechanic & (1 << MECHANIC_BANISH))
+ return DIMINISHING_BANISH;
+ if (mechanic & (1 << MECHANIC_ROOT))
+ return triggered ? DIMINISHING_ROOT : DIMINISHING_CONTROLLED_ROOT;
-// target not allow have more one spell specific from same caster
-bool IsSingleFromSpellSpecificPerCaster(SpellSpecific spellSpec1, SpellSpecific spellSpec2)
-{
- switch (spellSpec1)
- {
- case SPELL_SPECIFIC_SEAL:
- case SPELL_SPECIFIC_HAND:
- case SPELL_SPECIFIC_AURA:
- case SPELL_SPECIFIC_STING:
- case SPELL_SPECIFIC_CURSE:
- case SPELL_SPECIFIC_ASPECT:
- case SPELL_SPECIFIC_JUDGEMENT:
- case SPELL_SPECIFIC_WARLOCK_CORRUPTION:
- return spellSpec1 == spellSpec2;
- default:
- return false;
- }
+ return DIMINISHING_NONE;
}
-bool IsSingleFromSpellSpecificPerTarget(SpellSpecific spellSpec1, SpellSpecific spellSpec2)
+DiminishingReturnsType GetDiminishingReturnsGroupType(DiminishingGroup group)
{
- switch (spellSpec1)
+ switch (group)
{
- case SPELL_SPECIFIC_PHASE:
- case SPELL_SPECIFIC_TRACKER:
- case SPELL_SPECIFIC_WARLOCK_ARMOR:
- case SPELL_SPECIFIC_MAGE_ARMOR:
- case SPELL_SPECIFIC_ELEMENTAL_SHIELD:
- case SPELL_SPECIFIC_MAGE_POLYMORPH:
- case SPELL_SPECIFIC_PRESENCE:
- case SPELL_SPECIFIC_CHARM:
- case SPELL_SPECIFIC_SCROLL:
- case SPELL_SPECIFIC_WARRIOR_ENRAGE:
- case SPELL_SPECIFIC_MAGE_ARCANE_BRILLANCE:
- case SPELL_SPECIFIC_PRIEST_DIVINE_SPIRIT:
- return spellSpec1 == spellSpec2;
- case SPELL_SPECIFIC_FOOD:
- return spellSpec2 == SPELL_SPECIFIC_FOOD
- || spellSpec2 == SPELL_SPECIFIC_FOOD_AND_DRINK;
- case SPELL_SPECIFIC_DRINK:
- return spellSpec2 == SPELL_SPECIFIC_DRINK
- || spellSpec2 == SPELL_SPECIFIC_FOOD_AND_DRINK;
- case SPELL_SPECIFIC_FOOD_AND_DRINK:
- return spellSpec2 == SPELL_SPECIFIC_FOOD
- || spellSpec2 == SPELL_SPECIFIC_DRINK
- || spellSpec2 == SPELL_SPECIFIC_FOOD_AND_DRINK;
+ case DIMINISHING_TAUNT:
+ case DIMINISHING_CONTROLLED_STUN:
+ case DIMINISHING_STUN:
+ case DIMINISHING_OPENING_STUN:
+ case DIMINISHING_CYCLONE:
+ case DIMINISHING_CHARGE:
+ return DRTYPE_ALL;
default:
- return false;
+ return DRTYPE_PLAYER;
}
}
-bool IsPositiveTarget(uint32 targetA, uint32 targetB)
+DiminishingLevels GetDiminishingReturnsMaxLevel(DiminishingGroup group)
{
- // non-positive targets
- switch (targetA)
+ switch (group)
{
- case TARGET_UNIT_NEARBY_ENEMY:
- case TARGET_UNIT_TARGET_ENEMY:
- case TARGET_UNIT_AREA_ENEMY_SRC:
- case TARGET_UNIT_AREA_ENEMY_DST:
- case TARGET_UNIT_CONE_ENEMY:
- case TARGET_UNIT_AREA_PATH:
- case TARGET_DEST_DYNOBJ_ENEMY:
- case TARGET_DST_TARGET_ENEMY:
- return false;
+ case DIMINISHING_TAUNT:
+ return DIMINISHING_LEVEL_TAUNT_IMMUNE;
default:
- break;
+ return DIMINISHING_LEVEL_IMMUNE;
}
- if (targetB)
- return IsPositiveTarget(targetB, 0);
- return true;
}
-bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) const
+int32 GetDiminishingReturnsLimitDuration(DiminishingGroup group, SpellInfo const* spellproto)
{
- SpellEntry const* spellproto = sSpellStore.LookupEntry(spellId);
- if (!spellproto)
- return false;
-
- // not found a single positive spell with this attribute
- if (spellproto->Attributes & SPELL_ATTR0_NEGATIVE_1)
- return false;
+ if (!IsDiminishingReturnsGroupDurationLimited(group))
+ return 0;
+ // Explicit diminishing duration
switch (spellproto->SpellFamilyName)
{
- case SPELLFAMILY_GENERIC:
- switch (spellId)
- {
- case 34700: // Allergic Reaction
- case 61716: // Rabbit Costume
- case 61734: // Noblegarden Bunny
- case 61987: // Avenging Wrath Marker
- case 61988: // Divine Shield exclude aura
- case 62532: // Conservator's Grip
- return false;
- case 30877: // Tag Murloc
- case 62344: // Fists of Stone
- return true;
- default:
- break;
- }
- break;
- case SPELLFAMILY_MAGE:
- // Amplify Magic, Dampen Magic
- if (spellproto->SpellFamilyFlags[0] == 0x00002000)
- return true;
- // Ignite
- if (spellproto->SpellIconID == 45)
- return true;
- break;
- case SPELLFAMILY_PRIEST:
- switch (spellId)
- {
- case 64844: // Divine Hymn
- case 64904: // Hymn of Hope
- case 47585: // Dispersion
- return true;
- default:
- break;
- }
+ case SPELLFAMILY_DRUID:
+ {
+ // Faerie Fire - limit to 40 seconds in PvP (3.1)
+ if (spellproto->SpellFamilyFlags[0] & 0x400)
+ return 40 * IN_MILLISECONDS;
break;
+ }
case SPELLFAMILY_HUNTER:
- // Aspect of the Viper
- if (spellId == 34074)
- return true;
+ {
+ // Wyvern Sting
+ if (spellproto->SpellFamilyFlags[1] & 0x1000)
+ return 6 * IN_MILLISECONDS;
+ // Hunter's Mark
+ if (spellproto->SpellFamilyFlags[0] & 0x400)
+ return 120 * IN_MILLISECONDS;
break;
- case SPELLFAMILY_SHAMAN:
- if (spellId == 30708)
- return false;
+ }
+ case SPELLFAMILY_PALADIN:
+ {
+ // Repentance - limit to 6 seconds in PvP
+ if (spellproto->SpellFamilyFlags[0] & 0x4)
+ return 6 * IN_MILLISECONDS;
break;
+ }
+ case SPELLFAMILY_WARLOCK:
+ {
+ // Banish - limit to 6 seconds in PvP
+ if (spellproto->SpellFamilyFlags[1] & 0x8000000)
+ return 6 * IN_MILLISECONDS;
+ // Curse of Tongues - limit to 12 seconds in PvP
+ else if (spellproto->SpellFamilyFlags[2] & 0x800)
+ return 12 * IN_MILLISECONDS;
+ // Curse of Elements - limit to 120 seconds in PvP
+ else if (spellproto->SpellFamilyFlags[1] & 0x200)
+ return 120 * IN_MILLISECONDS;
+ break;
+ }
default:
break;
}
- switch (spellproto->Mechanic)
+ return 10 * IN_MILLISECONDS;
+}
+
+bool IsDiminishingReturnsGroupDurationLimited(DiminishingGroup group)
+{
+ switch (group)
{
- case MECHANIC_IMMUNE_SHIELD:
+ case DIMINISHING_CONTROLLED_STUN:
+ case DIMINISHING_STUN:
+ case DIMINISHING_ENTRAPMENT:
+ case DIMINISHING_CONTROLLED_ROOT:
+ case DIMINISHING_ROOT:
+ case DIMINISHING_FEAR:
+ case DIMINISHING_MIND_CONTROL:
+ case DIMINISHING_DISORIENT:
+ case DIMINISHING_CYCLONE:
+ case DIMINISHING_BANISH:
+ case DIMINISHING_LIMITONLY:
+ case DIMINISHING_OPENING_STUN:
+ case DIMINISHING_HORROR:
+ case DIMINISHING_SLEEP:
return true;
default:
- break;
+ return false;
}
+}
- // Special case: effects which determine positivity of whole spell
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- {
- if (spellproto->EffectApplyAuraName[i] == SPELL_AURA_MOD_STEALTH)
- return true;
- }
+SpellMgr::SpellMgr()
+{
+}
- switch (spellproto->Effect[effIndex])
- {
- case SPELL_EFFECT_DUMMY:
- // some explicitly required dummy effect sets
- switch (spellId)
- {
- case 28441:
- return false; // AB Effect 000
- default:
- break;
- }
- break;
- // always positive effects (check before target checks that provided non-positive result in some case for positive effects)
- case SPELL_EFFECT_HEAL:
- case SPELL_EFFECT_LEARN_SPELL:
- case SPELL_EFFECT_SKILL_STEP:
- case SPELL_EFFECT_HEAL_PCT:
- case SPELL_EFFECT_ENERGIZE_PCT:
- return true;
+SpellMgr::~SpellMgr()
+{
+ UnloadSpellInfoStore();
+}
- // non-positive aura use
- case SPELL_EFFECT_APPLY_AURA:
- case SPELL_EFFECT_APPLY_AREA_AURA_FRIEND:
+/// Some checks for spells, to prevent adding deprecated/broken spells for trainers, spell book, etc
+bool SpellMgr::IsSpellValid(SpellInfo const *spellInfo, Player *pl, bool msg)
+{
+ // not exist
+ if (!spellInfo)
+ return false;
+
+ bool need_check_reagents = false;
+
+ // check effects
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ {
+ switch (spellInfo->Effects[i].Effect)
{
- switch (spellproto->EffectApplyAuraName[effIndex])
+ case 0:
+ continue;
+
+ // craft spell for crafting non-existed item (break client recipes list show)
+ case SPELL_EFFECT_CREATE_ITEM:
+ case SPELL_EFFECT_CREATE_ITEM_2:
{
- case SPELL_AURA_MOD_DAMAGE_DONE: // dependent from bas point sign (negative -> negative)
- case SPELL_AURA_MOD_STAT:
- case SPELL_AURA_MOD_SKILL:
- case SPELL_AURA_MOD_DODGE_PERCENT:
- case SPELL_AURA_MOD_HEALING_PCT:
- case SPELL_AURA_MOD_HEALING_DONE:
- case SPELL_AURA_MOD_DAMAGE_PERCENT_DONE:
- if (SpellMgr::CalculateSpellEffectAmount(spellproto, effIndex) < 0)
- return false;
- break;
- case SPELL_AURA_MOD_DAMAGE_TAKEN: // dependent from bas point sign (positive -> negative)
- if (SpellMgr::CalculateSpellEffectAmount(spellproto, effIndex) > 0)
- return false;
- break;
- case SPELL_AURA_MOD_CRIT_PCT:
- case SPELL_AURA_MOD_SPELL_CRIT_CHANCE:
- if (SpellMgr::CalculateSpellEffectAmount(spellproto, effIndex) > 0)
- return true; // some expected positive spells have SPELL_ATTR1_NEGATIVE
- break;
- case SPELL_AURA_ADD_TARGET_TRIGGER:
- return true;
- case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE:
- case SPELL_AURA_PERIODIC_TRIGGER_SPELL:
- if (!deep)
+ if (spellInfo->Effects[i].ItemType == 0)
+ {
+ // skip auto-loot crafting spells, its not need explicit item info (but have special fake items sometime)
+ if (!spellInfo->IsLootCrafting())
{
- uint32 spellTriggeredId = spellproto->EffectTriggerSpell[effIndex];
- SpellEntry const* spellTriggeredProto = sSpellStore.LookupEntry(spellTriggeredId);
-
- if (spellTriggeredProto)
+ if (msg)
{
- // non-positive targets of main spell return early
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- {
- if (!spellTriggeredProto->Effect[i])
- continue;
- // if non-positive trigger cast targeted to positive target this main cast is non-positive
- // this will place this spell auras as debuffs
- if (IsPositiveTarget(spellTriggeredProto->EffectImplicitTargetA[effIndex], spellTriggeredProto->EffectImplicitTargetB[effIndex]) && !_isPositiveEffect(spellTriggeredId, i, true))
- return false;
- }
+ if (pl)
+ ChatHandler(pl).PSendSysMessage("Craft spell %u not have create item entry.", spellInfo->Id);
+ else
+ sLog->outErrorDb("Craft spell %u not have create item entry.", spellInfo->Id);
}
- }
- case SPELL_AURA_PROC_TRIGGER_SPELL:
- // many positive auras have negative triggered spells at damage for example and this not make it negative (it can be canceled for example)
- break;
- case SPELL_AURA_MOD_STUN: //have positive and negative spells, we can't sort its correctly at this moment.
- if (effIndex == 0 && spellproto->Effect[1] == 0 && spellproto->Effect[2] == 0)
- return false; // but all single stun aura spells is negative
- break;
- case SPELL_AURA_MOD_PACIFY_SILENCE:
- if (spellproto->Id == 24740) // Wisp Costume
- return true;
- return false;
- case SPELL_AURA_MOD_ROOT:
- case SPELL_AURA_MOD_SILENCE:
- case SPELL_AURA_GHOST:
- case SPELL_AURA_PERIODIC_LEECH:
- case SPELL_AURA_MOD_STALKED:
- case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
- case SPELL_AURA_PREVENT_RESSURECTION:
- return false;
- case SPELL_AURA_PERIODIC_DAMAGE: // used in positive spells also.
- // part of negative spell if casted at self (prevent cancel)
- if (spellproto->EffectImplicitTargetA[effIndex] == TARGET_UNIT_CASTER)
- return false;
- break;
- case SPELL_AURA_MOD_DECREASE_SPEED: // used in positive spells also
- // part of positive spell if casted at self
- if (spellproto->EffectImplicitTargetA[effIndex] != TARGET_UNIT_CASTER)
return false;
- // but not this if this first effect (didn't find better check)
- if (spellproto->Attributes & SPELL_ATTR0_NEGATIVE_1 && effIndex == 0)
- return false;
- break;
- case SPELL_AURA_MECHANIC_IMMUNITY:
+ }
+
+ }
+ // also possible IsLootCrafting case but fake item must exist anyway
+ else if (!sObjectMgr->GetItemTemplate(spellInfo->Effects[i].ItemType))
{
- // non-positive immunities
- switch (spellproto->EffectMiscValue[effIndex])
+ if (msg)
{
- case MECHANIC_BANDAGE:
- case MECHANIC_SHIELD:
- case MECHANIC_MOUNT:
- case MECHANIC_INVULNERABILITY:
- return false;
- default:
- break;
+ if (pl)
+ ChatHandler(pl).PSendSysMessage("Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType);
+ else
+ sLog->outErrorDb("Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType);
}
- break;
+ return false;
}
- case SPELL_AURA_ADD_FLAT_MODIFIER: // mods
- case SPELL_AURA_ADD_PCT_MODIFIER:
+
+ need_check_reagents = true;
+ break;
+ }
+ case SPELL_EFFECT_LEARN_SPELL:
+ {
+ SpellInfo const* spellInfo2 = sSpellMgr->GetSpellInfo(spellInfo->Effects[i].TriggerSpell);
+ if (!IsSpellValid(spellInfo2, pl, msg))
{
- // non-positive mods
- switch (spellproto->EffectMiscValue[effIndex])
+ if (msg)
{
- case SPELLMOD_COST: // dependent from bas point sign (negative -> positive)
- if (SpellMgr::CalculateSpellEffectAmount(spellproto, effIndex) > 0)
- {
- if (!deep)
- {
- bool negative = true;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- {
- if (i != effIndex)
- if (_isPositiveEffect(spellId, i, true))
- {
- negative = false;
- break;
- }
- }
- if (negative)
- return false;
- }
- }
- break;
- default:
- break;
+ if (pl)
+ ChatHandler(pl).PSendSysMessage("Spell %u learn to broken spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell);
+ else
+ sLog->outErrorDb("Spell %u learn to invalid spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell);
}
- break;
+ return false;
}
- default:
- break;
+ break;
}
- break;
}
- default:
- break;
}
- // non-positive targets
- if (!IsPositiveTarget(spellproto->EffectImplicitTargetA[effIndex], spellproto->EffectImplicitTargetB[effIndex]))
- return false;
-
- if (!deep && spellproto->EffectTriggerSpell[effIndex]
- && !spellproto->EffectApplyAuraName[effIndex]
- && IsPositiveTarget(spellproto->EffectImplicitTargetA[effIndex], spellproto->EffectImplicitTargetB[effIndex])
- && !_isPositiveSpell(spellproto->EffectTriggerSpell[effIndex], true))
- return false;
+ if (need_check_reagents)
+ {
+ for (uint8 j = 0; j < MAX_SPELL_REAGENTS; ++j)
+ {
+ if (spellInfo->Reagent[j] > 0 && !sObjectMgr->GetItemTemplate(spellInfo->Reagent[j]))
+ {
+ if (msg)
+ {
+ if (pl)
+ ChatHandler(pl).PSendSysMessage("Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]);
+ else
+ sLog->outErrorDb("Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]);
+ }
+ return false;
+ }
+ }
+ }
- // ok, positive
return true;
}
-bool IsPositiveSpell(uint32 spellId)
+uint32 SpellMgr::GetSpellDifficultyId(uint32 spellId) const
{
- if (!sSpellStore.LookupEntry(spellId)) // non-existing spells
- return false;
- return !(sSpellMgr->GetSpellCustomAttr(spellId) & SPELL_ATTR0_CU_NEGATIVE);
+ SpellDifficultySearcherMap::const_iterator i = mSpellDifficultySearcherMap.find(spellId);
+ return i == mSpellDifficultySearcherMap.end() ? 0 : (*i).second;
}
-bool IsPositiveEffect(uint32 spellId, uint32 effIndex)
+void SpellMgr::SetSpellDifficultyId(uint32 spellId, uint32 id)
{
- if (!sSpellStore.LookupEntry(spellId))
- return false;
- switch (effIndex)
- {
- default:
- case 0:
- return !(sSpellMgr->GetSpellCustomAttr(spellId) & SPELL_ATTR0_CU_NEGATIVE_EFF0);
- case 1:
- return !(sSpellMgr->GetSpellCustomAttr(spellId) & SPELL_ATTR0_CU_NEGATIVE_EFF1);
- case 2:
- return !(sSpellMgr->GetSpellCustomAttr(spellId) & SPELL_ATTR0_CU_NEGATIVE_EFF2);
- }
+ mSpellDifficultySearcherMap[spellId] = id;
}
-bool SpellMgr::_isPositiveSpell(uint32 spellId, bool deep) const
+uint32 SpellMgr::GetSpellIdForDifficulty(uint32 spellId, Unit* caster) const
{
- SpellEntry const* spellproto = sSpellStore.LookupEntry(spellId);
- if (!spellproto)
- return false;
+ if (!GetSpellInfo(spellId))
+ return spellId;
- // spells with at least one negative effect are considered negative
- // some self-applied spells have negative effects but in self casting case negative check ignored.
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (!_isPositiveEffect(spellId, i, deep))
- return false;
- return true;
-}
-
-bool IsSingleTargetSpell(SpellEntry const* spellInfo)
-{
- // all other single target spells have if it has AttributesEx5
- if (spellInfo->AttributesEx5 & SPELL_ATTR5_SINGLE_TARGET_SPELL)
- return true;
+ if (!caster || !caster->GetMap() || !caster->GetMap()->IsDungeon())
+ return spellId;
- switch (GetSpellSpecific(spellInfo))
+ uint32 mode = uint32(caster->GetMap()->GetSpawnMode());
+ if (mode >= MAX_DIFFICULTY)
{
- case SPELL_SPECIFIC_JUDGEMENT:
- return true;
- default:
- break;
+ sLog->outError("SpellMgr::GetSpellIdForDifficulty: Incorrect Difficulty for spell %u.", spellId);
+ return spellId; //return source spell
}
- return false;
-}
+ uint32 difficultyId = GetSpellDifficultyId(spellId);
+ if (!difficultyId)
+ return spellId; //return source spell, it has only REGULAR_DIFFICULTY
-bool IsSingleTargetSpells(SpellEntry const* spellInfo1, SpellEntry const* spellInfo2)
-{
- // TODO - need better check
- // Equal icon and spellfamily
- if (spellInfo1->SpellFamilyName == spellInfo2->SpellFamilyName &&
- spellInfo1->SpellIconID == spellInfo2->SpellIconID)
- return true;
-
- // TODO - need found Judgements rule
- SpellSpecific spec1 = GetSpellSpecific(spellInfo1);
- // spell with single target specific types
- switch (spec1)
+ SpellDifficultyEntry const *difficultyEntry = sSpellDifficultyStore.LookupEntry(difficultyId);
+ if (!difficultyEntry)
{
- case SPELL_SPECIFIC_JUDGEMENT:
- case SPELL_SPECIFIC_MAGE_POLYMORPH:
- if (GetSpellSpecific(spellInfo2) == spec1)
- return true;
- break;
- default:
- break;
+ sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellIdForDifficulty: SpellDifficultyEntry not found for spell %u. This should never happen.", spellId);
+ return spellId; //return source spell
}
- return false;
-}
-
-SpellCastResult GetErrorAtShapeshiftedCast(SpellEntry const* spellInfo, uint32 form)
-{
- // talents that learn spells can have stance requirements that need ignore
- // (this requirement only for client-side stance show in talent description)
- if (GetTalentSpellCost(spellInfo->Id) > 0 &&
- (spellInfo->Effect[0] == SPELL_EFFECT_LEARN_SPELL || spellInfo->Effect[1] == SPELL_EFFECT_LEARN_SPELL || spellInfo->Effect[2] == SPELL_EFFECT_LEARN_SPELL))
- return SPELL_CAST_OK;
-
- uint32 stanceMask = (form ? 1 << (form - 1) : 0);
-
- if (stanceMask & spellInfo->StancesNot) // can explicitly not be casted in this stance
- return SPELL_FAILED_NOT_SHAPESHIFT;
-
- if (stanceMask & spellInfo->Stances) // can explicitly be casted in this stance
- return SPELL_CAST_OK;
-
- bool actAsShifted = false;
- SpellShapeshiftEntry const* shapeInfo = NULL;
- if (form > 0)
+ if (difficultyEntry->SpellID[mode] <= 0 && mode > DUNGEON_DIFFICULTY_HEROIC)
{
- shapeInfo = sSpellShapeshiftStore.LookupEntry(form);
- if (!shapeInfo)
- {
- sLog->outError("GetErrorAtShapeshiftedCast: unknown shapeshift %u", form);
- return SPELL_CAST_OK;
- }
- actAsShifted = !(shapeInfo->flags1 & 1); // shapeshift acts as normal form for spells
+ sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellIdForDifficulty: spell %u mode %u spell is NULL, using mode %u", spellId, mode, mode - 2);
+ mode -= 2;
}
- if (actAsShifted)
- {
- if (spellInfo->Attributes & SPELL_ATTR0_NOT_SHAPESHIFT) // not while shapeshifted
- return SPELL_FAILED_NOT_SHAPESHIFT;
- else if (spellInfo->Stances != 0) // needs other shapeshift
- return SPELL_FAILED_ONLY_SHAPESHIFT;
- }
- else
+ if (difficultyEntry->SpellID[mode] <= 0)
{
- // needs shapeshift
- if (!(spellInfo->AttributesEx2 & SPELL_ATTR2_NOT_NEED_SHAPESHIFT) && spellInfo->Stances != 0)
- return SPELL_FAILED_ONLY_SHAPESHIFT;
+ sLog->outErrorDb("SpellMgr::GetSpellIdForDifficulty: spell %u mode %u spell is 0. Check spelldifficulty_dbc!", spellId, mode);
+ return spellId;
}
- // Check if stance disables cast of not-stance spells
- // Example: cannot cast any other spells in zombie or ghoul form
- // TODO: Find a way to disable use of these spells clientside
- if (shapeInfo && shapeInfo->flags1 & 0x400)
+ sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellIdForDifficulty: spellid for spell %u in mode %u is %d", spellId, mode, difficultyEntry->SpellID[mode]);
+ return uint32(difficultyEntry->SpellID[mode]);
+}
+
+SpellInfo const* SpellMgr::GetSpellForDifficultyFromSpell(SpellInfo const* spell, Unit* caster) const
+{
+ uint32 newSpellId = GetSpellIdForDifficulty(spell->Id, caster);
+ SpellInfo const* newSpell = GetSpellInfo(newSpellId);
+ if (!newSpell)
{
- if (!(stanceMask & spellInfo->Stances))
- return SPELL_FAILED_ONLY_SHAPESHIFT;
+ sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellForDifficultyFromSpell: spell %u not found. Check spelldifficulty_dbc!", newSpellId);
+ return spell;
}
- return SPELL_CAST_OK;
+ sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellForDifficultyFromSpell: Spell id for instance mode is %u (original %u)", newSpell->Id, spell->Id);
+ return newSpell;
}
-void SpellMgr::LoadSpellTargetPositions()
+SpellChainNode const* SpellMgr::GetSpellChainNode(uint32 spell_id) const
{
- uint32 oldMSTime = getMSTime();
+ SpellChainMap::const_iterator itr = mSpellChains.find(spell_id);
+ if (itr == mSpellChains.end())
+ return NULL;
- mSpellTargetPositions.clear(); // need for reload case
+ return &itr->second;
+}
- // 0 1 2 3 4 5
- QueryResult result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position");
- if (!result)
- {
- sLog->outString(">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty.");
- sLog->outString();
- return;
- }
+uint32 SpellMgr::GetFirstSpellInChain(uint32 spell_id) const
+{
+ if (SpellChainNode const* node = GetSpellChainNode(spell_id))
+ return node->first->Id;
- uint32 count = 0;
+ return spell_id;
+}
- do
- {
- Field *fields = result->Fetch();
+uint32 SpellMgr::GetLastSpellInChain(uint32 spell_id) const
+{
+ if (SpellChainNode const* node = GetSpellChainNode(spell_id))
+ return node->last->Id;
- uint32 Spell_ID = fields[0].GetUInt32();
+ return spell_id;
+}
- SpellTargetPosition st;
+uint32 SpellMgr::GetNextSpellInChain(uint32 spell_id) const
+{
+ if (SpellChainNode const* node = GetSpellChainNode(spell_id))
+ return node->next ? node->next->Id : NULL;
- st.target_mapId = fields[1].GetUInt32();
- st.target_X = fields[2].GetFloat();
- st.target_Y = fields[3].GetFloat();
- st.target_Z = fields[4].GetFloat();
- st.target_Orientation = fields[5].GetFloat();
+ return 0;
+}
- MapEntry const* mapEntry = sMapStore.LookupEntry(st.target_mapId);
- if (!mapEntry)
- {
- sLog->outErrorDb("Spell (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.", Spell_ID, st.target_mapId);
- continue;
- }
+uint32 SpellMgr::GetPrevSpellInChain(uint32 spell_id) const
+{
+ if (SpellChainNode const* node = GetSpellChainNode(spell_id))
+ return node->prev ? node->prev->Id : NULL;
- if (st.target_X==0 && st.target_Y==0 && st.target_Z==0)
- {
- sLog->outErrorDb("Spell (ID:%u) target coordinates not provided.", Spell_ID);
- continue;
- }
+ return 0;
+}
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(Spell_ID);
- if (!spellInfo)
- {
- sLog->outErrorDb("Spell (ID:%u) listed in `spell_target_position` does not exist.", Spell_ID);
- continue;
- }
+uint8 SpellMgr::GetSpellRank(uint32 spell_id) const
+{
+ if (SpellChainNode const* node = GetSpellChainNode(spell_id))
+ return node->rank;
- bool found = false;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- {
- if (spellInfo->EffectImplicitTargetA[i] == TARGET_DST_DB || spellInfo->EffectImplicitTargetB[i] == TARGET_DST_DB)
- {
- // additional requirements
- if (spellInfo->Effect[i]==SPELL_EFFECT_BIND && spellInfo->EffectMiscValue[i])
- {
- uint32 area_id = sMapMgr->GetAreaId(st.target_mapId, st.target_X, st.target_Y, st.target_Z);
- if (area_id != uint32(spellInfo->EffectMiscValue[i]))
- {
- sLog->outErrorDb("Spell (Id: %u) listed in `spell_target_position` expected point to zone %u bit point to zone %u.", Spell_ID, spellInfo->EffectMiscValue[i], area_id);
- break;
- }
- }
+ return 0;
+}
- found = true;
- break;
- }
- }
- if (!found)
- {
- sLog->outErrorDb("Spell (Id: %u) listed in `spell_target_position` does not have target TARGET_DST_DB (17).", Spell_ID);
- continue;
- }
+uint32 SpellMgr::GetSpellWithRank(uint32 spell_id, uint32 rank, bool strict) const
+{
+ if (SpellChainNode const* node = GetSpellChainNode(spell_id))
+ {
+ if (rank != node->rank)
+ return GetSpellWithRank(node->rank < rank ? node->next->Id : node->prev->Id, rank, strict);
+ }
+ else if (strict && rank > 1)
+ return 0;
+ return spell_id;
+}
- mSpellTargetPositions[Spell_ID] = st;
- ++count;
+SpellRequiredMapBounds SpellMgr::GetSpellsRequiredForSpellBounds(uint32 spell_id) const
+{
+ return SpellRequiredMapBounds(mSpellReq.lower_bound(spell_id), mSpellReq.upper_bound(spell_id));
+}
- } while (result->NextRow());
+SpellsRequiringSpellMapBounds SpellMgr::GetSpellsRequiringSpellBounds(uint32 spell_id) const
+{
+ return SpellsRequiringSpellMapBounds(mSpellsReqSpell.lower_bound(spell_id), mSpellsReqSpell.upper_bound(spell_id));
+}
- // Check all spells
- for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i)
+bool SpellMgr::IsSpellRequiringSpell(uint32 spellid, uint32 req_spellid) const
+{
+ SpellsRequiringSpellMapBounds spellsRequiringSpell = GetSpellsRequiringSpellBounds(req_spellid);
+ for (SpellsRequiringSpellMap::const_iterator itr = spellsRequiringSpell.first; itr != spellsRequiringSpell.second; ++itr)
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(i);
- if (!spellInfo)
- continue;
-
- bool found = false;
- for (int j = 0; j < MAX_SPELL_EFFECTS; ++j)
- {
- switch (spellInfo->EffectImplicitTargetA[j])
- {
- case TARGET_DST_DB:
- found = true;
- break;
- }
- if (found)
- break;
- switch (spellInfo->EffectImplicitTargetB[j])
- {
- case TARGET_DST_DB:
- found = true;
- break;
- }
- if (found)
- break;
- }
- if (found)
- {
-// if (!sSpellMgr->GetSpellTargetPosition(i))
-// sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell (ID: %u) does not have record in `spell_target_position`", i);
- }
+ if (itr->second == spellid)
+ return true;
}
+ return false;
+}
- sLog->outString(">> Loaded %u spell teleport coordinates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+const SpellsRequiringSpellMap SpellMgr::GetSpellsRequiringSpell()
+{
+ return this->mSpellsReqSpell;
}
-bool SpellMgr::IsAffectedByMod(SpellEntry const *spellInfo, SpellModifier *mod) const
+uint32 SpellMgr::GetSpellRequired(uint32 spell_id) const
{
- // false for spellInfo == NULL
- if (!spellInfo || !mod)
- return false;
+ SpellRequiredMap::const_iterator itr = mSpellReq.find(spell_id);
- SpellEntry const* affect_spell = sSpellStore.LookupEntry(mod->spellId);
- // False if affect_spell == NULL or spellFamily not equal
- if (!affect_spell || affect_spell->SpellFamilyName != spellInfo->SpellFamilyName)
- return false;
+ if (itr == mSpellReq.end())
+ return 0;
- // true
- if (mod->mask & spellInfo->SpellFamilyFlags)
- return true;
+ return itr->second;
+}
- return false;
+SpellLearnSkillNode const* SpellMgr::GetSpellLearnSkill(uint32 spell_id) const
+{
+ SpellLearnSkillMap::const_iterator itr = mSpellLearnSkills.find(spell_id);
+ if (itr != mSpellLearnSkills.end())
+ return &itr->second;
+ else
+ return NULL;
}
-void SpellMgr::LoadSpellProcEvents()
+SpellLearnSpellMapBounds SpellMgr::GetSpellLearnSpellMapBounds(uint32 spell_id) const
{
- uint32 oldMSTime = getMSTime();
+ return SpellLearnSpellMapBounds(mSpellLearnSpells.lower_bound(spell_id), mSpellLearnSpells.upper_bound(spell_id));
+}
- mSpellProcEventMap.clear(); // need for reload case
+bool SpellMgr::IsSpellLearnSpell(uint32 spell_id) const
+{
+ return mSpellLearnSpells.find(spell_id) != mSpellLearnSpells.end();
+}
- uint32 count = 0;
+bool SpellMgr::IsSpellLearnToSpell(uint32 spell_id1, uint32 spell_id2) const
+{
+ SpellLearnSpellMapBounds bounds = GetSpellLearnSpellMapBounds(spell_id1);
+ for (SpellLearnSpellMap::const_iterator i = bounds.first; i != bounds.second; ++i)
+ if (i->second.spell == spell_id2)
+ return true;
+ return false;
+}
- // 0 1 2 3 4 5 6 7 8 9 10
- QueryResult result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event");
- if (!result)
+SpellTargetPosition const* SpellMgr::GetSpellTargetPosition(uint32 spell_id) const
+{
+ SpellTargetPositionMap::const_iterator itr = mSpellTargetPositions.find(spell_id);
+ if (itr != mSpellTargetPositions.end())
+ return &itr->second;
+ return NULL;
+}
+
+SpellSpellGroupMapBounds SpellMgr::GetSpellSpellGroupMapBounds(uint32 spell_id) const
+{
+ spell_id = GetFirstSpellInChain(spell_id);
+ return SpellSpellGroupMapBounds(mSpellSpellGroup.lower_bound(spell_id), mSpellSpellGroup.upper_bound(spell_id));
+}
+
+uint32 SpellMgr::IsSpellMemberOfSpellGroup(uint32 spellid, SpellGroup groupid) const
+{
+ SpellSpellGroupMapBounds spellGroup = GetSpellSpellGroupMapBounds(spellid);
+ for (SpellSpellGroupMap::const_iterator itr = spellGroup.first; itr != spellGroup.second ; ++itr)
{
- sLog->outString(">> Loaded %u spell proc event conditions", count);
- sLog->outString();
- return;
+ if (itr->second == groupid)
+ return true;
}
+ return false;
+}
- uint32 customProc = 0;
- do
- {
- Field *fields = result->Fetch();
+SpellGroupSpellMapBounds SpellMgr::GetSpellGroupSpellMapBounds(SpellGroup group_id) const
+{
+ return SpellGroupSpellMapBounds(mSpellGroupSpell.lower_bound(group_id), mSpellGroupSpell.upper_bound(group_id));
+}
- uint32 entry = fields[0].GetUInt32();
+void SpellMgr::GetSetOfSpellsInSpellGroup(SpellGroup group_id, std::set<uint32>& foundSpells) const
+{
+ std::set<SpellGroup> usedGroups;
+ GetSetOfSpellsInSpellGroup(group_id, foundSpells, usedGroups);
+}
- SpellEntry const* spell = sSpellStore.LookupEntry(entry);
- if (!spell)
+void SpellMgr::GetSetOfSpellsInSpellGroup(SpellGroup group_id, std::set<uint32>& foundSpells, std::set<SpellGroup>& usedGroups) const
+{
+ if (usedGroups.find(group_id) != usedGroups.end())
+ return;
+ usedGroups.insert(group_id);
+
+ SpellGroupSpellMapBounds groupSpell = GetSpellGroupSpellMapBounds(group_id);
+ for (SpellGroupSpellMap::const_iterator itr = groupSpell.first; itr != groupSpell.second ; ++itr)
+ {
+ if (itr->second < 0)
{
- sLog->outErrorDb("Spell %u listed in `spell_proc_event` does not exist", entry);
- continue;
+ SpellGroup currGroup = (SpellGroup)abs(itr->second);
+ GetSetOfSpellsInSpellGroup(currGroup, foundSpells, usedGroups);
}
+ else
+ {
+ foundSpells.insert(itr->second);
+ }
+ }
+}
- SpellProcEventEntry spe;
-
- spe.schoolMask = fields[1].GetUInt32();
- spe.spellFamilyName = fields[2].GetUInt32();
- spe.spellFamilyMask[0] = fields[3].GetUInt32();
- spe.spellFamilyMask[1] = fields[4].GetUInt32();
- spe.spellFamilyMask[2] = fields[5].GetUInt32();
- spe.procFlags = fields[6].GetUInt32();
- spe.procEx = fields[7].GetUInt32();
- spe.ppmRate = fields[8].GetFloat();
- spe.customChance = fields[9].GetFloat();
- spe.cooldown = fields[10].GetUInt32();
-
- mSpellProcEventMap[entry] = spe;
-
- if (spell->procFlags == 0)
+SpellGroupStackRule SpellMgr::CheckSpellGroupStackRules(SpellInfo const* spellInfo1, SpellInfo const* spellInfo2) const
+{
+ uint32 spellid_1 = spellInfo1->GetFirstRankSpell()->Id;
+ uint32 spellid_2 = spellInfo2->GetFirstRankSpell()->Id;
+ if (spellid_1 == spellid_2)
+ return SPELL_GROUP_STACK_RULE_DEFAULT;
+ // find SpellGroups which are common for both spells
+ SpellSpellGroupMapBounds spellGroup1 = GetSpellSpellGroupMapBounds(spellid_1);
+ std::set<SpellGroup> groups;
+ for (SpellSpellGroupMap::const_iterator itr = spellGroup1.first; itr != spellGroup1.second ; ++itr)
+ {
+ if (IsSpellMemberOfSpellGroup(spellid_2, itr->second))
{
- if (spe.procFlags == 0)
+ bool add = true;
+ SpellGroupSpellMapBounds groupSpell = GetSpellGroupSpellMapBounds(itr->second);
+ for (SpellGroupSpellMap::const_iterator itr2 = groupSpell.first; itr2 != groupSpell.second ; ++itr2)
{
- sLog->outErrorDb("Spell %u listed in `spell_proc_event` probally not triggered spell", entry);
- continue;
+ if (itr2->second < 0)
+ {
+ SpellGroup currGroup = (SpellGroup)abs(itr2->second);
+ if (IsSpellMemberOfSpellGroup(spellid_1, currGroup) && IsSpellMemberOfSpellGroup(spellid_2, currGroup))
+ {
+ add = false;
+ break;
+ }
+ }
}
- customProc++;
+ if (add)
+ groups.insert(itr->second);
}
- ++count;
- } while (result->NextRow());
+ }
- if (customProc)
- sLog->outString(">> Loaded %u extra and %u custom spell proc event conditions in %u ms", count, customProc, GetMSTimeDiffToNow(oldMSTime));
- else
- sLog->outString(">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ SpellGroupStackRule rule = SPELL_GROUP_STACK_RULE_DEFAULT;
+
+ for (std::set<SpellGroup>::iterator itr = groups.begin() ; itr!= groups.end() ; ++itr)
+ {
+ SpellGroupStackMap::const_iterator found = mSpellGroupStack.find(*itr);
+ if (found != mSpellGroupStack.end())
+ rule = found->second;
+ if (rule)
+ break;
+ }
+ return rule;
+}
+
+SpellProcEventEntry const* SpellMgr::GetSpellProcEvent(uint32 spellId) const
+{
+ SpellProcEventMap::const_iterator itr = mSpellProcEventMap.find(spellId);
+ if (itr != mSpellProcEventMap.end())
+ return &itr->second;
+ return NULL;
}
-bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellProcEvent, uint32 EventProcFlag, SpellEntry const* procSpell, uint32 procFlags, uint32 procExtra, bool active)
+bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellProcEvent, uint32 EventProcFlag, SpellInfo const* procSpell, uint32 procFlags, uint32 procExtra, bool active)
{
// No extra req need
uint32 procEvent_procEx = PROC_EX_NONE;
@@ -1464,146 +850,12 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr
return false;
}
-void SpellMgr::LoadSpellProcs()
+SpellProcEntry const* SpellMgr::GetSpellProcEntry(uint32 spellId) const
{
- uint32 oldMSTime = getMSTime();
-
- mSpellProcMap.clear(); // need for reload case
-
- uint32 count = 0;
-
- // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
- QueryResult result = WorldDatabase.Query("SELECT spellId, schoolMask, spellFamilyName, spellFamilyMask0, spellFamilyMask1, spellFamilyMask2, typeMask, spellTypeMask, spellPhaseMask, hitMask, attributesMask, ratePerMinute, chance, cooldown, charges FROM spell_proc");
- if (!result)
- {
- sLog->outString(">> Loaded %u spell proc conditions and data", count);
- sLog->outString();
- return;
- }
-
- do
- {
- Field* fields = result->Fetch();
-
- int32 spellId = fields[0].GetInt32();
-
- bool allRanks = false;
- if (spellId <=0)
- {
- allRanks = true;
- spellId = -spellId;
- }
-
- SpellEntry const* spellEntry = sSpellStore.LookupEntry(spellId);
- if (!spellEntry)
- {
- sLog->outErrorDb("Spell %u listed in `spell_proc` does not exist", spellId);
- continue;
- }
-
- if (allRanks)
- {
- if (sSpellMgr->GetFirstSpellInChain(spellId) != uint32(spellId))
- {
- sLog->outErrorDb("Spell %u listed in `spell_proc` is not first rank of spell.", fields[0].GetInt32());
- continue;
- }
- }
-
- SpellProcEntry baseProcEntry;
-
- baseProcEntry.schoolMask = fields[1].GetUInt32();
- baseProcEntry.spellFamilyName = fields[2].GetUInt32();
- baseProcEntry.spellFamilyMask[0] = fields[3].GetUInt32();
- baseProcEntry.spellFamilyMask[1] = fields[4].GetUInt32();
- baseProcEntry.spellFamilyMask[2] = fields[5].GetUInt32();
- baseProcEntry.typeMask = fields[6].GetUInt32();
- baseProcEntry.spellTypeMask = fields[7].GetUInt32();
- baseProcEntry.spellPhaseMask = fields[8].GetUInt32();
- baseProcEntry.hitMask = fields[9].GetUInt32();
- baseProcEntry.attributesMask = fields[10].GetUInt32();
- baseProcEntry.ratePerMinute = fields[11].GetFloat();
- baseProcEntry.chance = fields[12].GetFloat();
- float cooldown = fields[13].GetFloat();
- baseProcEntry.cooldown = uint32(cooldown);
- baseProcEntry.charges = fields[14].GetUInt32();
-
- while(true)
- {
- if (mSpellProcMap.find(spellId) != mSpellProcMap.end())
- {
- sLog->outErrorDb("Spell %u listed in `spell_proc` has duplicate entry in the table", spellId);
- break;
- }
- SpellProcEntry procEntry = SpellProcEntry(baseProcEntry);
-
- // take defaults from dbcs
- if (!procEntry.typeMask)
- procEntry.typeMask = spellEntry->procFlags;
- if (!procEntry.charges)
- procEntry.charges = spellEntry->procCharges;
- if (!procEntry.chance && !procEntry.ratePerMinute)
- procEntry.chance = float(spellEntry->procChance);
-
- // validate data
- if (procEntry.schoolMask & ~SPELL_SCHOOL_MASK_ALL)
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `schoolMask` set: %u", spellId, procEntry.schoolMask);
- if (procEntry.spellFamilyName && (procEntry.spellFamilyName < 3 || procEntry.spellFamilyName > 17 || procEntry.spellFamilyName == 14 || procEntry.spellFamilyName == 16))
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `spellFamilyName` set: %u", spellId, procEntry.spellFamilyName);
- if (procEntry.chance < 0)
- {
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has negative value in `chance` field", spellId);
- procEntry.chance = 0;
- }
- if (procEntry.ratePerMinute < 0)
- {
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has negative value in `ratePerMinute` field", spellId);
- procEntry.ratePerMinute = 0;
- }
- if (cooldown < 0)
- {
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has negative value in `cooldown` field", spellId);
- procEntry.cooldown = 0;
- }
- if (procEntry.chance == 0 && procEntry.ratePerMinute == 0)
- sLog->outErrorDb("`spell_proc` table entry for spellId %u doesn't have `chance` and `ratePerMinute` values defined, proc will not be triggered", spellId);
- if (procEntry.charges > 99)
- {
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has too big value in `charges` field", spellId);
- procEntry.charges = 99;
- }
- if (!procEntry.typeMask)
- sLog->outErrorDb("`spell_proc` table entry for spellId %u doesn't have `typeMask` value defined, proc will not be triggered", spellId);
- if (procEntry.spellTypeMask & ~PROC_SPELL_PHASE_MASK_ALL)
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `spellTypeMask` set: %u", spellId, procEntry.spellTypeMask);
- if (procEntry.spellTypeMask && !(procEntry.typeMask & (SPELL_PROC_FLAG_MASK | PERIODIC_PROC_FLAG_MASK)))
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has `spellTypeMask` value defined, but it won't be used for defined `typeMask` value", spellId);
- if (!procEntry.spellPhaseMask && procEntry.typeMask & REQ_SPELL_PHASE_PROC_FLAG_MASK)
- sLog->outErrorDb("`spell_proc` table entry for spellId %u doesn't have `spellPhaseMask` value defined, but it's required for defined `typeMask` value, proc will not be triggered", spellId);
- if (procEntry.spellPhaseMask & ~PROC_SPELL_PHASE_MASK_ALL)
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `spellPhaseMask` set: %u", spellId, procEntry.spellPhaseMask);
- if (procEntry.spellPhaseMask && !(procEntry.typeMask & REQ_SPELL_PHASE_PROC_FLAG_MASK))
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has `spellPhaseMask` value defined, but it won't be used for defined `typeMask` value", spellId);
- if (procEntry.hitMask & ~PROC_HIT_MASK_ALL)
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `hitMask` set: %u", spellId, procEntry.hitMask);
- if (procEntry.hitMask && !(procEntry.typeMask & TAKEN_HIT_PROC_FLAG_MASK || (procEntry.typeMask & DONE_HIT_PROC_FLAG_MASK && (!procEntry.spellPhaseMask || procEntry.spellPhaseMask & (PROC_SPELL_PHASE_HIT | PROC_SPELL_PHASE_FINISH)))))
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has `hitMask` value defined, but it won't be used for defined `typeMask` and `spellPhaseMask` values", spellId);
-
- mSpellProcMap[spellId] = procEntry;
-
- if (allRanks)
- {
- spellId = sSpellMgr->GetNextSpellInChain(spellId);
- spellEntry = sSpellStore.LookupEntry(spellId);
- }
- else
- break;
- }
- ++count;
- } while (result->NextRow());
-
- sLog->outString(">> Loaded %u spell proc conditions and data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ SpellProcMap::const_iterator itr = mSpellProcMap.find(spellId);
+ if (itr != mSpellProcMap.end())
+ return &itr->second;
+ return NULL;
}
bool SpellMgr::CanSpellTriggerProcOnEvent(SpellProcEntry const& procEntry, ProcEventInfo& eventInfo)
@@ -1671,43 +923,609 @@ bool SpellMgr::CanSpellTriggerProcOnEvent(SpellProcEntry const& procEntry, ProcE
return true;
}
-void SpellMgr::LoadSpellBonusess()
+SpellBonusEntry const* SpellMgr::GetSpellBonusData(uint32 spellId) const
+{
+ // Lookup data
+ SpellBonusMap::const_iterator itr = mSpellBonusMap.find(spellId);
+ if (itr != mSpellBonusMap.end())
+ return &itr->second;
+ // Not found, try lookup for 1 spell rank if exist
+ if (uint32 rank_1 = GetFirstSpellInChain(spellId))
+ {
+ SpellBonusMap::const_iterator itr2 = mSpellBonusMap.find(rank_1);
+ if (itr2 != mSpellBonusMap.end())
+ return &itr2->second;
+ }
+ return NULL;
+}
+
+uint16 SpellMgr::GetSpellThreat(uint32 spellid) const
+{
+ SpellThreatMap::const_iterator itr = mSpellThreatMap.find(spellid);
+ if (itr == mSpellThreatMap.end())
+ return 0;
+
+ return itr->second;
+}
+
+SkillLineAbilityMapBounds SpellMgr::GetSkillLineAbilityMapBounds(uint32 spell_id) const
+{
+ return SkillLineAbilityMapBounds(mSkillLineAbilityMap.lower_bound(spell_id), mSkillLineAbilityMap.upper_bound(spell_id));
+}
+
+PetAura const* SpellMgr::GetPetAura(uint32 spell_id, uint8 eff)
+{
+ SpellPetAuraMap::const_iterator itr = mSpellPetAuraMap.find((spell_id<<8) + eff);
+ if (itr != mSpellPetAuraMap.end())
+ return &itr->second;
+ else
+ return NULL;
+}
+
+SpellEnchantProcEntry const* SpellMgr::GetSpellEnchantProcEvent(uint32 enchId) const
+{
+ SpellEnchantProcEventMap::const_iterator itr = mSpellEnchantProcEventMap.find(enchId);
+ if (itr != mSpellEnchantProcEventMap.end())
+ return &itr->second;
+ return NULL;
+}
+
+bool SpellMgr::IsArenaAllowedEnchancment(uint32 ench_id) const
+{
+ return mEnchantCustomAttr[ench_id];
+}
+
+const std::vector<int32>* SpellMgr::GetSpellLinked(int32 spell_id) const
+{
+ SpellLinkedMap::const_iterator itr = mSpellLinkedMap.find(spell_id);
+ return itr != mSpellLinkedMap.end() ? &(itr->second) : NULL;
+}
+
+PetLevelupSpellSet const* SpellMgr::GetPetLevelupSpellList(uint32 petFamily) const
+{
+ PetLevelupSpellMap::const_iterator itr = mPetLevelupSpellMap.find(petFamily);
+ if (itr != mPetLevelupSpellMap.end())
+ return &itr->second;
+ else
+ return NULL;
+}
+
+PetDefaultSpellsEntry const* SpellMgr::GetPetDefaultSpellsEntry(int32 id) const
+{
+ PetDefaultSpellsMap::const_iterator itr = mPetDefaultSpellsMap.find(id);
+ if (itr != mPetDefaultSpellsMap.end())
+ return &itr->second;
+ return NULL;
+}
+
+SpellAreaMapBounds SpellMgr::GetSpellAreaMapBounds(uint32 spell_id) const
+{
+ return SpellAreaMapBounds(mSpellAreaMap.lower_bound(spell_id), mSpellAreaMap.upper_bound(spell_id));
+}
+
+SpellAreaForQuestMapBounds SpellMgr::GetSpellAreaForQuestMapBounds(uint32 quest_id, bool active) const
+{
+ if (active)
+ return SpellAreaForQuestMapBounds(mSpellAreaForActiveQuestMap.lower_bound(quest_id), mSpellAreaForActiveQuestMap.upper_bound(quest_id));
+ else
+ return SpellAreaForQuestMapBounds(mSpellAreaForQuestMap.lower_bound(quest_id), mSpellAreaForQuestMap.upper_bound(quest_id));
+}
+
+SpellAreaForQuestMapBounds SpellMgr::GetSpellAreaForQuestEndMapBounds(uint32 quest_id) const
+{
+ return SpellAreaForQuestMapBounds(mSpellAreaForQuestEndMap.lower_bound(quest_id), mSpellAreaForQuestEndMap.upper_bound(quest_id));
+}
+
+SpellAreaForAuraMapBounds SpellMgr::GetSpellAreaForAuraMapBounds(uint32 spell_id) const
+{
+ return SpellAreaForAuraMapBounds(mSpellAreaForAuraMap.lower_bound(spell_id), mSpellAreaForAuraMap.upper_bound(spell_id));
+}
+
+SpellAreaForAreaMapBounds SpellMgr::GetSpellAreaForAreaMapBounds(uint32 area_id) const
+{
+ return SpellAreaForAreaMapBounds(mSpellAreaForAreaMap.lower_bound(area_id), mSpellAreaForAreaMap.upper_bound(area_id));
+}
+
+bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 newArea) const
+{
+ if (gender != GENDER_NONE) // not in expected gender
+ if (!player || gender != player->getGender())
+ return false;
+
+ if (raceMask) // not in expected race
+ if (!player || !(raceMask & player->getRaceMask()))
+ return false;
+
+ if (areaId) // not in expected zone
+ if (newZone != areaId && newArea != areaId)
+ return false;
+
+ if (questStart) // not in expected required quest state
+ if (!player || ((!questStartCanActive || !player->IsActiveQuest(questStart)) && !player->GetQuestRewardStatus(questStart)))
+ return false;
+
+ if (questEnd) // not in expected forbidden quest state
+ if (!player || player->GetQuestRewardStatus(questEnd))
+ return false;
+
+ if (auraSpell) // not have expected aura
+ if (!player || (auraSpell > 0 && !player->HasAura(auraSpell)) || (auraSpell < 0 && player->HasAura(-auraSpell)))
+ return false;
+
+ // Extra conditions -- leaving the possibility add extra conditions...
+ switch (spellId)
+ {
+ case 58600: // No fly Zone - Dalaran
+ {
+ if (!player)
+ return false;
+
+ AreaTableEntry const* pArea = GetAreaEntryByAreaID(player->GetAreaId());
+ if (!(pArea && pArea->flags & AREA_FLAG_NO_FLY_ZONE))
+ return false;
+ if (!player->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !player->HasAuraType(SPELL_AURA_FLY))
+ return false;
+ break;
+ }
+ case 68719: // Oil Refinery - Isle of Conquest.
+ case 68720: // Quarry - Isle of Conquest.
+ {
+ if (player->GetBattlegroundTypeId() != BATTLEGROUND_IC || !player->GetBattleground())
+ return false;
+
+ uint8 nodeType = spellId == 68719 ? NODE_TYPE_REFINERY : NODE_TYPE_QUARRY;
+ uint8 nodeState = player->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H;
+
+ BattlegroundIC* pIC = static_cast<BattlegroundIC*>(player->GetBattleground());
+ if (pIC->GetNodeState(nodeType) == nodeState)
+ return true;
+
+ return false;
+ }
+ }
+
+ return true;
+}
+
+void SpellMgr::LoadSpellInfos()
+{
+
+}
+
+void SpellMgr::LoadSpellRanks()
{
uint32 oldMSTime = getMSTime();
- mSpellBonusMap.clear(); // need for reload case
- uint32 count = 0;
- // 0 1 2 3 4
- QueryResult result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data");
+ // cleanup core data before reload - remove reference to ChainNode from SpellInfo
+ for (SpellChainMap::iterator itr = mSpellChains.begin(); itr != mSpellChains.end(); ++itr)
+ {
+ mSpellInfoMap[itr->first]->ChainEntry = NULL;
+ }
+ mSpellChains.clear();
+
+ QueryResult result = WorldDatabase.Query("SELECT first_spell_id, spell_id, rank from spell_ranks ORDER BY first_spell_id , rank");
+
if (!result)
{
- sLog->outString(">> Loaded %u spell bonus data", count);
+ sLog->outString(">> Loaded 0 spell rank records");
+ sLog->outString();
+ sLog->outErrorDb("`spell_ranks` table is empty!");
+ return;
+ }
+
+ uint32 rows = 0;
+ bool finished = false;
+
+ do
+ {
+ // spellid, rank
+ std::list < std::pair < int32, int32 > > rankChain;
+ int32 currentSpell = -1;
+ int32 lastSpell = -1;
+
+ // fill one chain
+ while (currentSpell == lastSpell && !finished)
+ {
+ Field *fields = result->Fetch();
+
+ currentSpell = fields[0].GetUInt32();
+ if (lastSpell == -1)
+ lastSpell = currentSpell;
+ uint32 spell_id = fields[1].GetUInt32();
+ uint32 rank = fields[2].GetUInt32();
+
+ // don't drop the row if we're moving to the next rank
+ if (currentSpell == lastSpell)
+ {
+ rankChain.push_back(std::make_pair(spell_id, rank));
+ if (!result->NextRow())
+ finished = true;
+ }
+ else
+ break;
+ }
+ // check if chain is made with valid first spell
+ SpellInfo const* first = sSpellMgr->GetSpellInfo(lastSpell);
+ if (!first)
+ {
+ sLog->outErrorDb("Spell rank identifier(first_spell_id) %u listed in `spell_ranks` does not exist!", lastSpell);
+ continue;
+ }
+ // check if chain is long enough
+ if (rankChain.size() < 2)
+ {
+ sLog->outErrorDb("There is only 1 spell rank for identifier(first_spell_id) %u in `spell_ranks`, entry is not needed!", lastSpell);
+ continue;
+ }
+ int32 curRank = 0;
+ bool valid = true;
+ // check spells in chain
+ for (std::list<std::pair<int32, int32> >::iterator itr = rankChain.begin() ; itr!= rankChain.end(); ++itr)
+ {
+ SpellInfo const* spell = sSpellMgr->GetSpellInfo(itr->first);
+ if (!spell)
+ {
+ sLog->outErrorDb("Spell %u (rank %u) listed in `spell_ranks` for chain %u does not exist!", itr->first, itr->second, lastSpell);
+ valid = false;
+ break;
+ }
+ ++curRank;
+ if (itr->second != curRank)
+ {
+ sLog->outErrorDb("Spell %u (rank %u) listed in `spell_ranks` for chain %u does not have proper rank value(should be %u)!", itr->first, itr->second, lastSpell, curRank);
+ valid = false;
+ break;
+ }
+ }
+ if (!valid)
+ continue;
+ int32 prevRank = 0;
+ // insert the chain
+ std::list<std::pair<int32, int32> >::iterator itr = rankChain.begin();
+ do
+ {
+ ++rows;
+ int32 addedSpell = itr->first;
+ mSpellChains[addedSpell].first = GetSpellInfo(lastSpell);
+ mSpellChains[addedSpell].last = GetSpellInfo(rankChain.back().first);
+ mSpellChains[addedSpell].rank = itr->second;
+ mSpellChains[addedSpell].prev = GetSpellInfo(prevRank);
+ mSpellInfoMap[addedSpell]->ChainEntry = &mSpellChains[addedSpell];
+ prevRank = addedSpell;
+ ++itr;
+ if (itr == rankChain.end())
+ {
+ mSpellChains[addedSpell].next = NULL;
+ break;
+ }
+ else
+ mSpellChains[addedSpell].next = GetSpellInfo(itr->first);
+ }
+ while (true);
+ } while (!finished);
+
+ sLog->outString(">> Loaded %u spell rank records in %u ms", rows, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outString();
+}
+
+void SpellMgr::LoadSpellRequired()
+{
+ uint32 oldMSTime = getMSTime();
+
+ mSpellsReqSpell.clear(); // need for reload case
+ mSpellReq.clear(); // need for reload case
+
+ QueryResult result = WorldDatabase.Query("SELECT spell_id, req_spell from spell_required");
+
+ if (!result)
+ {
+ sLog->outString(">> Loaded 0 spell required records");
sLog->outString();
+ sLog->outErrorDb("`spell_required` table is empty!");
return;
}
+ uint32 rows = 0;
do
{
Field *fields = result->Fetch();
- uint32 entry = fields[0].GetUInt32();
- SpellEntry const* spell = sSpellStore.LookupEntry(entry);
+ uint32 spell_id = fields[0].GetUInt32();
+ uint32 spell_req = fields[1].GetUInt32();
+ // check if chain is made with valid first spell
+ SpellInfo const* spell = sSpellMgr->GetSpellInfo(spell_id);
if (!spell)
{
- sLog->outErrorDb("Spell %u listed in `spell_bonus_data` does not exist", entry);
+ sLog->outErrorDb("spell_id %u in `spell_required` table is not found in dbcs, skipped", spell_id);
+ continue;
+ }
+ SpellInfo const* req_spell = sSpellMgr->GetSpellInfo(spell_req);
+ if (!req_spell)
+ {
+ sLog->outErrorDb("req_spell %u in `spell_required` table is not found in dbcs, skipped", spell_req);
+ continue;
+ }
+ if (GetFirstSpellInChain(spell_id) == GetFirstSpellInChain(spell_req))
+ {
+ sLog->outErrorDb("req_spell %u and spell_id %u in `spell_required` table are ranks of the same spell, entry not needed, skipped", spell_req, spell_id);
+ continue;
+ }
+ if (IsSpellRequiringSpell(spell_id, spell_req))
+ {
+ sLog->outErrorDb("duplicated entry of req_spell %u and spell_id %u in `spell_required`, skipped", spell_req, spell_id);
continue;
}
- SpellBonusEntry& sbe = mSpellBonusMap[entry];
- sbe.direct_damage = fields[1].GetFloat();
- sbe.dot_damage = fields[2].GetFloat();
- sbe.ap_bonus = fields[3].GetFloat();
- sbe.ap_dot_bonus = fields[4].GetFloat();
+ mSpellReq.insert (std::pair<uint32, uint32>(spell_id, spell_req));
+ mSpellsReqSpell.insert (std::pair<uint32, uint32>(spell_req, spell_id));
+ ++rows;
+ } while (result->NextRow());
+
+ sLog->outString(">> Loaded %u spell required records in %u ms", rows, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outString();
+}
+
+void SpellMgr::LoadSpellLearnSkills()
+{
+ uint32 oldMSTime = getMSTime();
+
+ mSpellLearnSkills.clear(); // need for reload case
+
+ // search auto-learned skills and add its to map also for use in unlearn spells/talents
+ uint32 dbc_count = 0;
+ for (uint32 spell = 0; spell < sSpellMgr->GetSpellInfoStoreSize(); ++spell)
+ {
+ SpellInfo const* entry = sSpellMgr->GetSpellInfo(spell);
+
+ if (!entry)
+ continue;
+
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ {
+ if (entry->Effects[i].Effect == SPELL_EFFECT_SKILL)
+ {
+ SpellLearnSkillNode dbc_node;
+ dbc_node.skill = entry->Effects[i].MiscValue;
+ dbc_node.step = entry->Effects[i].CalcValue();
+ if (dbc_node.skill != SKILL_RIDING)
+ dbc_node.value = 1;
+ else
+ dbc_node.value = dbc_node.step * 75;
+ dbc_node.maxvalue = dbc_node.step * 75;
+ mSpellLearnSkills[spell] = dbc_node;
+ ++dbc_count;
+ break;
+ }
+ }
+ }
+
+ sLog->outString(">> Loaded %u Spell Learn Skills from DBC in %u ms", dbc_count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outString();
+}
+
+void SpellMgr::LoadSpellLearnSpells()
+{
+ uint32 oldMSTime = getMSTime();
+
+ mSpellLearnSpells.clear(); // need for reload case
+
+ // 0 1 2
+ QueryResult result = WorldDatabase.Query("SELECT entry, SpellID, Active FROM spell_learn_spell");
+ if (!result)
+ {
+ sLog->outString(">> Loaded 0 spell learn spells");
+ sLog->outString();
+ sLog->outErrorDb("`spell_learn_spell` table is empty!");
+ return;
+ }
+
+ uint32 count = 0;
+
+ do
+ {
+ Field *fields = result->Fetch();
+
+ uint32 spell_id = fields[0].GetUInt32();
+
+ SpellLearnSpellNode node;
+ node.spell = fields[1].GetUInt32();
+ node.active = fields[2].GetBool();
+ node.autoLearned= false;
+
+ if (!sSpellMgr->GetSpellInfo(spell_id))
+ {
+ sLog->outErrorDb("Spell %u listed in `spell_learn_spell` does not exist", spell_id);
+ continue;
+ }
+
+ if (!sSpellMgr->GetSpellInfo(node.spell))
+ {
+ sLog->outErrorDb("Spell %u listed in `spell_learn_spell` learning not existed spell %u", spell_id, node.spell);
+ continue;
+ }
+
+ if (GetTalentSpellCost(node.spell))
+ {
+ sLog->outErrorDb("Spell %u listed in `spell_learn_spell` attempt learning talent spell %u, skipped", spell_id, node.spell);
+ continue;
+ }
+
+ mSpellLearnSpells.insert(SpellLearnSpellMap::value_type(spell_id, node));
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u extra spell bonus data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ // search auto-learned spells and add its to map also for use in unlearn spells/talents
+ uint32 dbc_count = 0;
+ for (uint32 spell = 0; spell < sSpellMgr->GetSpellInfoStoreSize(); ++spell)
+ {
+ SpellInfo const* entry = sSpellMgr->GetSpellInfo(spell);
+
+ if (!entry)
+ continue;
+
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ {
+ if (entry->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL)
+ {
+ SpellLearnSpellNode dbc_node;
+ dbc_node.spell = entry->Effects[i].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
+ if (!sSpellMgr->GetSpellInfo(dbc_node.spell))
+ continue;
+
+ // talent or passive spells or skill-step spells auto-casted and not need dependent learning,
+ // pet teaching spells must not be dependent learning (casted)
+ // other required explicit dependent learning
+ dbc_node.autoLearned = entry->Effects[i].TargetA == TARGET_UNIT_PET || GetTalentSpellCost(spell) > 0 || entry->IsPassive() || entry->HasEffect(SPELL_EFFECT_SKILL_STEP);
+
+ SpellLearnSpellMapBounds db_node_bounds = GetSpellLearnSpellMapBounds(spell);
+
+ bool found = false;
+ for (SpellLearnSpellMap::const_iterator itr = db_node_bounds.first; itr != db_node_bounds.second; ++itr)
+ {
+ if (itr->second.spell == dbc_node.spell)
+ {
+ sLog->outErrorDb("Spell %u auto-learn spell %u in spell.dbc then the record in `spell_learn_spell` is redundant, please fix DB.",
+ spell, dbc_node.spell);
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) // add new spell-spell pair if not found
+ {
+ mSpellLearnSpells.insert(SpellLearnSpellMap::value_type(spell, dbc_node));
+ ++dbc_count;
+ }
+ }
+ }
+ }
+
+ sLog->outString(">> Loaded %u spell learn spells + %u found in DBC in %u ms", count, dbc_count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outString();
+}
+
+void SpellMgr::LoadSpellTargetPositions()
+{
+ uint32 oldMSTime = getMSTime();
+
+ mSpellTargetPositions.clear(); // need for reload case
+
+ // 0 1 2 3 4 5
+ QueryResult result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position");
+ if (!result)
+ {
+ sLog->outString(">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty.");
+ sLog->outString();
+ return;
+ }
+
+ uint32 count = 0;
+
+ do
+ {
+ Field *fields = result->Fetch();
+
+ uint32 Spell_ID = fields[0].GetUInt32();
+
+ SpellTargetPosition st;
+
+ st.target_mapId = fields[1].GetUInt32();
+ st.target_X = fields[2].GetFloat();
+ st.target_Y = fields[3].GetFloat();
+ st.target_Z = fields[4].GetFloat();
+ st.target_Orientation = fields[5].GetFloat();
+
+ MapEntry const* mapEntry = sMapStore.LookupEntry(st.target_mapId);
+ if (!mapEntry)
+ {
+ sLog->outErrorDb("Spell (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.", Spell_ID, st.target_mapId);
+ continue;
+ }
+
+ if (st.target_X==0 && st.target_Y==0 && st.target_Z==0)
+ {
+ sLog->outErrorDb("Spell (ID:%u) target coordinates not provided.", Spell_ID);
+ continue;
+ }
+
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(Spell_ID);
+ if (!spellInfo)
+ {
+ sLog->outErrorDb("Spell (ID:%u) listed in `spell_target_position` does not exist.", Spell_ID);
+ continue;
+ }
+
+ bool found = false;
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ {
+ if (spellInfo->Effects[i].TargetA == TARGET_DST_DB || spellInfo->Effects[i].TargetB == TARGET_DST_DB)
+ {
+ // additional requirements
+ if (spellInfo->Effects[i].Effect == SPELL_EFFECT_BIND && spellInfo->Effects[i].MiscValue)
+ {
+ uint32 area_id = sMapMgr->GetAreaId(st.target_mapId, st.target_X, st.target_Y, st.target_Z);
+ if (area_id != uint32(spellInfo->Effects[i].MiscValue))
+ {
+ sLog->outErrorDb("Spell (Id: %u) listed in `spell_target_position` expected point to zone %u bit point to zone %u.", Spell_ID, spellInfo->Effects[i].MiscValue, area_id);
+ break;
+ }
+ }
+
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ sLog->outErrorDb("Spell (Id: %u) listed in `spell_target_position` does not have target TARGET_DST_DB (17).", Spell_ID);
+ continue;
+ }
+
+ mSpellTargetPositions[Spell_ID] = st;
+ ++count;
+
+ } while (result->NextRow());
+
+ /*
+ // Check all spells
+ for (uint32 i = 1; i < GetSpellInfoStoreSize; ++i)
+ {
+ SpellInfo const* spellInfo = GetSpellInfo(i);
+ if (!spellInfo)
+ continue;
+
+ bool found = false;
+ for (int j = 0; j < MAX_SPELL_EFFECTS; ++j)
+ {
+ switch (spellInfo->Effects[j].TargetA)
+ {
+ case TARGET_DST_DB:
+ found = true;
+ break;
+ }
+ if (found)
+ break;
+ switch (spellInfo->Effects[j].TargetB)
+ {
+ case TARGET_DST_DB:
+ found = true;
+ break;
+ }
+ if (found)
+ break;
+ }
+ if (found)
+ {
+ if (!sSpellMgr->GetSpellTargetPosition(i))
+ sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell (ID: %u) does not have record in `spell_target_position`", i);
+ }
+ }*/
+
+ sLog->outString(">> Loaded %u spell teleport coordinates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
@@ -1762,14 +1580,14 @@ void SpellMgr::LoadSpellGroups()
}
else
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->second);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->second);
if (!spellInfo)
{
sLog->outErrorDb("Spell %u listed in `spell_group` does not exist", itr->second);
mSpellGroupSpell.erase(itr++);
}
- else if (GetSpellRank(itr->second) > 1)
+ else if (spellInfo->GetRank() > 1)
{
sLog->outErrorDb("Spell %u listed in `spell_group` is not first rank of spell", itr->second);
mSpellGroupSpell.erase(itr++);
@@ -1841,467 +1659,475 @@ void SpellMgr::LoadSpellGroupStackRules()
sLog->outString();
}
-void SpellMgr::LoadSpellThreats()
+void SpellMgr::LoadSpellProcEvents()
{
uint32 oldMSTime = getMSTime();
- mSpellThreatMap.clear(); // need for reload case
+ mSpellProcEventMap.clear(); // need for reload case
uint32 count = 0;
- // 0 1
- QueryResult result = WorldDatabase.Query("SELECT entry, Threat FROM spell_threat");
+ // 0 1 2 3 4 5 6 7 8 9 10
+ QueryResult result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event");
if (!result)
{
- sLog->outString(">> Loaded %u aggro generating spells", count);
+ sLog->outString(">> Loaded %u spell proc event conditions", count);
sLog->outString();
return;
}
+ uint32 customProc = 0;
do
{
Field *fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
- uint16 Threat = fields[1].GetUInt16();
- if (!sSpellStore.LookupEntry(entry))
+ SpellInfo const* spell = sSpellMgr->GetSpellInfo(entry);
+ if (!spell)
{
- sLog->outErrorDb("Spell %u listed in `spell_threat` does not exist", entry);
+ sLog->outErrorDb("Spell %u listed in `spell_proc_event` does not exist", entry);
continue;
}
- mSpellThreatMap[entry] = Threat;
+ SpellProcEventEntry spe;
+
+ spe.schoolMask = fields[1].GetUInt32();
+ spe.spellFamilyName = fields[2].GetUInt32();
+ spe.spellFamilyMask[0] = fields[3].GetUInt32();
+ spe.spellFamilyMask[1] = fields[4].GetUInt32();
+ spe.spellFamilyMask[2] = fields[5].GetUInt32();
+ spe.procFlags = fields[6].GetUInt32();
+ spe.procEx = fields[7].GetUInt32();
+ spe.ppmRate = fields[8].GetFloat();
+ spe.customChance = fields[9].GetFloat();
+ spe.cooldown = fields[10].GetUInt32();
+
+ mSpellProcEventMap[entry] = spe;
+ if (spell->ProcFlags == 0)
+ {
+ if (spe.procFlags == 0)
+ {
+ sLog->outErrorDb("Spell %u listed in `spell_proc_event` probally not triggered spell", entry);
+ continue;
+ }
+ customProc++;
+ }
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u aggro generating spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ if (customProc)
+ sLog->outString(">> Loaded %u extra and %u custom spell proc event conditions in %u ms", count, customProc, GetMSTimeDiffToNow(oldMSTime));
+ else
+ sLog->outString(">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
-bool SpellMgr::IsRankSpellDueToSpell(SpellEntry const *spellInfo_1, uint32 spellId_2) const
+void SpellMgr::LoadSpellProcs()
{
- SpellEntry const* spellInfo_2 = sSpellStore.LookupEntry(spellId_2);
- if (!spellInfo_1 || !spellInfo_2) return false;
- if (spellInfo_1->Id == spellId_2) return false;
+ uint32 oldMSTime = getMSTime();
- return GetFirstSpellInChain(spellInfo_1->Id) == GetFirstSpellInChain(spellId_2);
-}
+ mSpellProcMap.clear(); // need for reload case
-bool SpellMgr::canStackSpellRanks(SpellEntry const *spellInfo)
-{
- if (IsPassiveSpell(spellInfo->Id)) // ranked passive spell
- return false;
- if (spellInfo->powerType != POWER_MANA && spellInfo->powerType != POWER_HEALTH)
- return false;
- if (IsProfessionOrRidingSpell(spellInfo->Id))
- return false;
+ uint32 count = 0;
- if (sSpellMgr->IsSkillBonusSpell(spellInfo->Id))
- return false;
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
+ QueryResult result = WorldDatabase.Query("SELECT spellId, schoolMask, spellFamilyName, spellFamilyMask0, spellFamilyMask1, spellFamilyMask2, typeMask, spellTypeMask, spellPhaseMask, hitMask, attributesMask, ratePerMinute, chance, cooldown, charges FROM spell_proc");
+ if (!result)
+ {
+ sLog->outString(">> Loaded %u spell proc conditions and data", count);
+ sLog->outString();
+ return;
+ }
- // All stance spells. if any better way, change it.
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ do
{
- switch (spellInfo->SpellFamilyName)
+ Field* fields = result->Fetch();
+
+ int32 spellId = fields[0].GetInt32();
+
+ bool allRanks = false;
+ if (spellId <=0)
{
- case SPELLFAMILY_PALADIN:
- // Paladin aura Spell
- if (spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_RAID)
- return false;
- break;
- case SPELLFAMILY_DRUID:
- // Druid form Spell
- if (spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA &&
- spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_SHAPESHIFT)
- return false;
- break;
- case SPELLFAMILY_ROGUE:
- // Rogue Stealth
- if (spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA &&
- spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_SHAPESHIFT)
- return false;
+ allRanks = true;
+ spellId = -spellId;
}
- }
- return true;
-}
-bool SpellMgr::IsProfessionOrRidingSpell(uint32 spellId)
-{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
- if (!spellInfo)
- return false;
-
- for (uint8 i = 0 ; i < MAX_SPELL_EFFECTS ; ++i)
- {
- if (spellInfo->Effect[i] == SPELL_EFFECT_SKILL)
+ SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(spellId);
+ if (!spellEntry)
{
- uint32 skill = spellInfo->EffectMiscValue[i];
+ sLog->outErrorDb("Spell %u listed in `spell_proc` does not exist", spellId);
+ continue;
+ }
- bool found = IsProfessionOrRidingSkill(skill);
- if (found)
- return true;
+ if (allRanks)
+ {
+ if (sSpellMgr->GetFirstSpellInChain(spellId) != uint32(spellId))
+ {
+ sLog->outErrorDb("Spell %u listed in `spell_proc` is not first rank of spell.", fields[0].GetInt32());
+ continue;
+ }
}
- }
- return false;
-}
-bool SpellMgr::IsProfessionSpell(uint32 spellId)
-{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
- if (!spellInfo)
- return false;
+ SpellProcEntry baseProcEntry;
- for (uint8 i = 0 ; i < MAX_SPELL_EFFECTS ; ++i)
- {
- if (spellInfo->Effect[i] == SPELL_EFFECT_SKILL)
+ baseProcEntry.schoolMask = fields[1].GetUInt32();
+ baseProcEntry.spellFamilyName = fields[2].GetUInt32();
+ baseProcEntry.spellFamilyMask[0] = fields[3].GetUInt32();
+ baseProcEntry.spellFamilyMask[1] = fields[4].GetUInt32();
+ baseProcEntry.spellFamilyMask[2] = fields[5].GetUInt32();
+ baseProcEntry.typeMask = fields[6].GetUInt32();
+ baseProcEntry.spellTypeMask = fields[7].GetUInt32();
+ baseProcEntry.spellPhaseMask = fields[8].GetUInt32();
+ baseProcEntry.hitMask = fields[9].GetUInt32();
+ baseProcEntry.attributesMask = fields[10].GetUInt32();
+ baseProcEntry.ratePerMinute = fields[11].GetFloat();
+ baseProcEntry.chance = fields[12].GetFloat();
+ float cooldown = fields[13].GetFloat();
+ baseProcEntry.cooldown = uint32(cooldown);
+ baseProcEntry.charges = fields[14].GetUInt32();
+
+ while(true)
{
- uint32 skill = spellInfo->EffectMiscValue[i];
+ if (mSpellProcMap.find(spellId) != mSpellProcMap.end())
+ {
+ sLog->outErrorDb("Spell %u listed in `spell_proc` has duplicate entry in the table", spellId);
+ break;
+ }
+ SpellProcEntry procEntry = SpellProcEntry(baseProcEntry);
- bool found = IsProfessionSkill(skill);
- if (found)
- return true;
- }
- }
- return false;
-}
+ // take defaults from dbcs
+ if (!procEntry.typeMask)
+ procEntry.typeMask = spellEntry->ProcFlags;
+ if (!procEntry.charges)
+ procEntry.charges = spellEntry->ProcCharges;
+ if (!procEntry.chance && !procEntry.ratePerMinute)
+ procEntry.chance = float(spellEntry->ProcChance);
-bool SpellMgr::IsPrimaryProfessionSpell(uint32 spellId)
-{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
- if (!spellInfo)
- return false;
+ // validate data
+ if (procEntry.schoolMask & ~SPELL_SCHOOL_MASK_ALL)
+ sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `schoolMask` set: %u", spellId, procEntry.schoolMask);
+ if (procEntry.spellFamilyName && (procEntry.spellFamilyName < 3 || procEntry.spellFamilyName > 17 || procEntry.spellFamilyName == 14 || procEntry.spellFamilyName == 16))
+ sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `spellFamilyName` set: %u", spellId, procEntry.spellFamilyName);
+ if (procEntry.chance < 0)
+ {
+ sLog->outErrorDb("`spell_proc` table entry for spellId %u has negative value in `chance` field", spellId);
+ procEntry.chance = 0;
+ }
+ if (procEntry.ratePerMinute < 0)
+ {
+ sLog->outErrorDb("`spell_proc` table entry for spellId %u has negative value in `ratePerMinute` field", spellId);
+ procEntry.ratePerMinute = 0;
+ }
+ if (cooldown < 0)
+ {
+ sLog->outErrorDb("`spell_proc` table entry for spellId %u has negative value in `cooldown` field", spellId);
+ procEntry.cooldown = 0;
+ }
+ if (procEntry.chance == 0 && procEntry.ratePerMinute == 0)
+ sLog->outErrorDb("`spell_proc` table entry for spellId %u doesn't have `chance` and `ratePerMinute` values defined, proc will not be triggered", spellId);
+ if (procEntry.charges > 99)
+ {
+ sLog->outErrorDb("`spell_proc` table entry for spellId %u has too big value in `charges` field", spellId);
+ procEntry.charges = 99;
+ }
+ if (!procEntry.typeMask)
+ sLog->outErrorDb("`spell_proc` table entry for spellId %u doesn't have `typeMask` value defined, proc will not be triggered", spellId);
+ if (procEntry.spellTypeMask & ~PROC_SPELL_PHASE_MASK_ALL)
+ sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `spellTypeMask` set: %u", spellId, procEntry.spellTypeMask);
+ if (procEntry.spellTypeMask && !(procEntry.typeMask & (SPELL_PROC_FLAG_MASK | PERIODIC_PROC_FLAG_MASK)))
+ sLog->outErrorDb("`spell_proc` table entry for spellId %u has `spellTypeMask` value defined, but it won't be used for defined `typeMask` value", spellId);
+ if (!procEntry.spellPhaseMask && procEntry.typeMask & REQ_SPELL_PHASE_PROC_FLAG_MASK)
+ sLog->outErrorDb("`spell_proc` table entry for spellId %u doesn't have `spellPhaseMask` value defined, but it's required for defined `typeMask` value, proc will not be triggered", spellId);
+ if (procEntry.spellPhaseMask & ~PROC_SPELL_PHASE_MASK_ALL)
+ sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `spellPhaseMask` set: %u", spellId, procEntry.spellPhaseMask);
+ if (procEntry.spellPhaseMask && !(procEntry.typeMask & REQ_SPELL_PHASE_PROC_FLAG_MASK))
+ sLog->outErrorDb("`spell_proc` table entry for spellId %u has `spellPhaseMask` value defined, but it won't be used for defined `typeMask` value", spellId);
+ if (procEntry.hitMask & ~PROC_HIT_MASK_ALL)
+ sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `hitMask` set: %u", spellId, procEntry.hitMask);
+ if (procEntry.hitMask && !(procEntry.typeMask & TAKEN_HIT_PROC_FLAG_MASK || (procEntry.typeMask & DONE_HIT_PROC_FLAG_MASK && (!procEntry.spellPhaseMask || procEntry.spellPhaseMask & (PROC_SPELL_PHASE_HIT | PROC_SPELL_PHASE_FINISH)))))
+ sLog->outErrorDb("`spell_proc` table entry for spellId %u has `hitMask` value defined, but it won't be used for defined `typeMask` and `spellPhaseMask` values", spellId);
- for (uint8 i = 0 ; i < MAX_SPELL_EFFECTS ; ++i)
- {
- if (spellInfo->Effect[i] == SPELL_EFFECT_SKILL)
- {
- uint32 skill = spellInfo->EffectMiscValue[i];
+ mSpellProcMap[spellId] = procEntry;
- bool found = IsPrimaryProfessionSkill(skill);
- if (found)
- return true;
+ if (allRanks)
+ {
+ spellId = sSpellMgr->GetNextSpellInChain(spellId);
+ spellEntry = sSpellMgr->GetSpellInfo(spellId);
+ }
+ else
+ break;
}
- }
- return false;
-}
+ ++count;
+ } while (result->NextRow());
-bool SpellMgr::IsPrimaryProfessionFirstRankSpell(uint32 spellId) const
-{
- return IsPrimaryProfessionSpell(spellId) && GetSpellRank(spellId) == 1;
+ sLog->outString(">> Loaded %u spell proc conditions and data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outString();
}
-bool SpellMgr::IsSkillBonusSpell(uint32 spellId) const
+void SpellMgr::LoadSpellBonusess()
{
- SkillLineAbilityMapBounds bounds = GetSkillLineAbilityMapBounds(spellId);
+ uint32 oldMSTime = getMSTime();
- for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)
+ mSpellBonusMap.clear(); // need for reload case
+ uint32 count = 0;
+ // 0 1 2 3 4
+ QueryResult result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data");
+ if (!result)
{
- SkillLineAbilityEntry const* pAbility = _spell_idx->second;
- if (!pAbility || pAbility->learnOnGetSkill != ABILITY_LEARNED_ON_GET_PROFESSION_SKILL)
- continue;
-
- if (pAbility->req_skill_value > 0)
- return true;
+ sLog->outString(">> Loaded %u spell bonus data", count);
+ sLog->outString();
+ return;
}
- return false;
-}
+ do
+ {
+ Field *fields = result->Fetch();
+ uint32 entry = fields[0].GetUInt32();
-bool SpellMgr::IsSkillTypeSpell(uint32 spellId, SkillType type) const
-{
- SkillLineAbilityMapBounds bounds = GetSkillLineAbilityMapBounds(spellId);
+ SpellInfo const* spell = sSpellMgr->GetSpellInfo(entry);
+ if (!spell)
+ {
+ sLog->outErrorDb("Spell %u listed in `spell_bonus_data` does not exist", entry);
+ continue;
+ }
- for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)
- if (_spell_idx->second->skillId == uint32(type))
- return true;
+ SpellBonusEntry& sbe = mSpellBonusMap[entry];
+ sbe.direct_damage = fields[1].GetFloat();
+ sbe.dot_damage = fields[2].GetFloat();
+ sbe.ap_bonus = fields[3].GetFloat();
+ sbe.ap_dot_bonus = fields[4].GetFloat();
- return false;
+ ++count;
+ } while (result->NextRow());
+
+ sLog->outString(">> Loaded %u extra spell bonus data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outString();
}
-// basepoints provided here have to be valid basepoints (use SpellMgr::CalculateSpellEffectBaseAmount)
-int32 SpellMgr::CalculateSpellEffectAmount(SpellEntry const* spellEntry, uint8 effIndex, Unit const* caster, int32 const* effBasePoints, Unit const* /*target*/)
+void SpellMgr::LoadSpellThreats()
{
- float basePointsPerLevel = spellEntry->EffectRealPointsPerLevel[effIndex];
- int32 basePoints = effBasePoints ? *effBasePoints : spellEntry->EffectBasePoints[effIndex];
- int32 randomPoints = int32(spellEntry->EffectDieSides[effIndex]);
+ uint32 oldMSTime = getMSTime();
+
+ mSpellThreatMap.clear(); // need for reload case
+
+ uint32 count = 0;
- // base amount modification based on spell lvl vs caster lvl
- if (caster)
+ // 0 1
+ QueryResult result = WorldDatabase.Query("SELECT entry, Threat FROM spell_threat");
+ if (!result)
{
- int32 level = int32(caster->getLevel());
- if (level > int32(spellEntry->maxLevel) && spellEntry->maxLevel > 0)
- level = int32(spellEntry->maxLevel);
- else if (level < int32(spellEntry->baseLevel))
- level = int32(spellEntry->baseLevel);
- level -= int32(spellEntry->spellLevel);
- basePoints += int32(level * basePointsPerLevel);
+ sLog->outString(">> Loaded %u aggro generating spells", count);
+ sLog->outString();
+ return;
}
- // roll in a range <1;EffectDieSides> as of patch 3.3.3
- switch (randomPoints)
+ do
{
- case 0: break;
- case 1: basePoints += 1; break; // range 1..1
- default:
- // range can have positive (1..rand) and negative (rand..1) values, so order its for irand
- int32 randvalue = (randomPoints >= 1)
- ? irand(1, randomPoints)
- : irand(randomPoints, 1);
+ Field *fields = result->Fetch();
- basePoints += randvalue;
- break;
- }
+ uint32 entry = fields[0].GetUInt32();
+ uint16 Threat = fields[1].GetUInt16();
- float value = float(basePoints);
+ if (!sSpellMgr->GetSpellInfo(entry))
+ {
+ sLog->outErrorDb("Spell %u listed in `spell_threat` does not exist", entry);
+ continue;
+ }
- // random damage
- if (caster)
- {
- // bonus amount from combo points
- if (caster->m_movedPlayer)
- if (uint8 comboPoints = caster->m_movedPlayer->GetComboPoints())
- if (float comboDamage = spellEntry->EffectPointsPerComboPoint[effIndex])
- value += comboDamage * comboPoints;
-
- value = caster->ApplyEffectModifiers(spellEntry, effIndex, value);
-
- // amount multiplication based on caster's level
- if (!basePointsPerLevel && (spellEntry->Attributes & SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION && spellEntry->spellLevel) &&
- spellEntry->Effect[effIndex] != SPELL_EFFECT_WEAPON_PERCENT_DAMAGE &&
- spellEntry->Effect[effIndex] != SPELL_EFFECT_KNOCK_BACK &&
- spellEntry->EffectApplyAuraName[effIndex] != SPELL_AURA_MOD_SPEED_ALWAYS &&
- spellEntry->EffectApplyAuraName[effIndex] != SPELL_AURA_MOD_SPEED_NOT_STACK &&
- spellEntry->EffectApplyAuraName[effIndex] != SPELL_AURA_MOD_INCREASE_SPEED &&
- spellEntry->EffectApplyAuraName[effIndex] != SPELL_AURA_MOD_DECREASE_SPEED)
- //there are many more: slow speed, -healing pct
- value *= 0.25f * exp(caster->getLevel() * (70 - spellEntry->spellLevel) / 1000.0f);
- //value = int32(value * (int32)getLevel() / (int32)(spellProto->spellLevel ? spellProto->spellLevel : 1));
- }
+ mSpellThreatMap[entry] = Threat;
- return int32(value);
-}
+ ++count;
+ } while (result->NextRow());
-int32 SpellMgr::CalculateSpellEffectBaseAmount(int32 value, SpellEntry const* spellEntry, uint8 effIndex)
-{
- if (spellEntry->EffectDieSides[effIndex] == 0)
- return value;
- else
- return value - 1;
+ sLog->outString(">> Loaded %u aggro generating spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outString();
}
-float SpellMgr::CalculateSpellEffectValueMultiplier(SpellEntry const* spellEntry, uint8 effIndex, Unit* caster, Spell* spell)
+void SpellMgr::LoadSkillLineAbilityMap()
{
- float multiplier = spellEntry->EffectValueMultiplier[effIndex];
- if (Player* modOwner = (caster ? caster->GetSpellModOwner() : NULL))
- modOwner->ApplySpellMod(spellEntry->Id, SPELLMOD_VALUE_MULTIPLIER, multiplier, spell);
- return multiplier;
-}
+ uint32 oldMSTime = getMSTime();
-float SpellMgr::CalculateSpellEffectDamageMultiplier(SpellEntry const* spellEntry, uint8 effIndex, Unit* caster, Spell* spell)
-{
- float multiplier = spellEntry->EffectDamageMultiplier[effIndex];
- if (Player* modOwner = (caster ? caster->GetSpellModOwner() : NULL))
- modOwner->ApplySpellMod(spellEntry->Id, SPELLMOD_DAMAGE_MULTIPLIER, multiplier, spell);
- return multiplier;
+ mSkillLineAbilityMap.clear();
+
+ uint32 count = 0;
+
+ for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i)
+ {
+ SkillLineAbilityEntry const* SkillInfo = sSkillLineAbilityStore.LookupEntry(i);
+ if (!SkillInfo)
+ continue;
+
+ mSkillLineAbilityMap.insert(SkillLineAbilityMap::value_type(SkillInfo->spellId, SkillInfo));
+ ++count;
+ }
+
+ sLog->outString(">> Loaded %u SkillLineAbility MultiMap Data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outString();
}
-SpellEntry const* SpellMgr::SelectAuraRankForPlayerLevel(SpellEntry const* spellInfo, uint32 playerLevel) const
+void SpellMgr::LoadSpellPetAuras()
{
- // ignore passive spells
- if (IsPassiveSpell(spellInfo->Id))
- return spellInfo;
+ uint32 oldMSTime = getMSTime();
- bool needRankSelection = false;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ mSpellPetAuraMap.clear(); // need for reload case
+
+ // 0 1 2 3
+ QueryResult result = WorldDatabase.Query("SELECT spell, effectId, pet, aura FROM spell_pet_auras");
+ if (!result)
{
- if (IsPositiveEffect(spellInfo->Id, i) && (
- spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA ||
- spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PARTY ||
- spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_RAID
-))
- {
- needRankSelection = true;
- break;
- }
+ sLog->outString(">> Loaded 0 spell pet auras. DB table `spell_pet_auras` is empty.");
+ sLog->outString();
+ return;
}
- // not required
- if (!needRankSelection)
- return spellInfo;
+ uint32 count = 0;
- for (uint32 nextSpellId = spellInfo->Id; nextSpellId != 0; nextSpellId = GetPrevSpellInChain(nextSpellId))
+ do
{
- SpellEntry const* nextSpellInfo = sSpellStore.LookupEntry(nextSpellId);
- if (!nextSpellInfo)
- break;
+ Field *fields = result->Fetch();
- // if found appropriate level
- if (playerLevel + 10 >= nextSpellInfo->spellLevel)
- return nextSpellInfo;
+ uint32 spell = fields[0].GetUInt32();
+ uint8 eff = fields[1].GetUInt8();
+ uint32 pet = fields[2].GetUInt32();
+ uint32 aura = fields[3].GetUInt32();
- // one rank less then
- }
+ SpellPetAuraMap::iterator itr = mSpellPetAuraMap.find((spell<<8) + eff);
+ if (itr != mSpellPetAuraMap.end())
+ itr->second.AddAura(pet, aura);
+ else
+ {
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
+ if (!spellInfo)
+ {
+ sLog->outErrorDb("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))
+ {
+ sLog->outError("Spell %u listed in `spell_pet_auras` does not have dummy aura or dummy effect", spell);
+ continue;
+ }
- // not found
- return NULL;
+ SpellInfo const* spellInfo2 = sSpellMgr->GetSpellInfo(aura);
+ if (!spellInfo2)
+ {
+ sLog->outErrorDb("Aura %u listed in `spell_pet_auras` does not exist", aura);
+ continue;
+ }
+
+ PetAura pa(pet, aura, spellInfo->Effects[eff].TargetA == TARGET_UNIT_PET, spellInfo->Effects[eff].CalcValue());
+ mSpellPetAuraMap[(spell<<8) + eff] = pa;
+ }
+
+ ++count;
+ } while (result->NextRow());
+
+ sLog->outString(">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outString();
}
-void SpellMgr::LoadSpellLearnSkills()
+// Fill custom data about enchancments
+void SpellMgr::LoadEnchantCustomAttr()
{
uint32 oldMSTime = getMSTime();
- mSpellLearnSkills.clear(); // need for reload case
+ uint32 size = sSpellItemEnchantmentStore.GetNumRows();
+ mEnchantCustomAttr.resize(size);
- // search auto-learned skills and add its to map also for use in unlearn spells/talents
- uint32 dbc_count = 0;
- for (uint32 spell = 0; spell < sSpellStore.GetNumRows(); ++spell)
+ uint32 count = 0;
+
+ for (uint32 i = 0; i < size; ++i)
+ mEnchantCustomAttr[i] = 0;
+
+ for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i)
{
- SpellEntry const* entry = sSpellStore.LookupEntry(spell);
+ SpellInfo const* spellInfo = GetSpellInfo(i);
+ if (!spellInfo)
+ continue;
- if (!entry)
+ // TODO: find a better check
+ if (!(spellInfo->AttributesEx2 & SPELL_ATTR2_UNK13) || !(spellInfo->Attributes & SPELL_ATTR0_NOT_SHAPESHIFT))
continue;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
- if (entry->Effect[i] == SPELL_EFFECT_SKILL)
+ if (spellInfo->Effects[j].Effect == SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY)
{
- SpellLearnSkillNode dbc_node;
- dbc_node.skill = entry->EffectMiscValue[i];
- dbc_node.step = SpellMgr::CalculateSpellEffectAmount(entry, i);
- if (dbc_node.skill != SKILL_RIDING)
- dbc_node.value = 1;
- else
- dbc_node.value = dbc_node.step * 75;
- dbc_node.maxvalue = dbc_node.step * 75;
- mSpellLearnSkills[spell] = dbc_node;
- ++dbc_count;
+ uint32 enchId = spellInfo->Effects[j].MiscValue;
+ SpellItemEnchantmentEntry const* ench = sSpellItemEnchantmentStore.LookupEntry(enchId);
+ if (!ench)
+ continue;
+ mEnchantCustomAttr[enchId] = true;
+ ++count;
break;
}
}
}
- sLog->outString(">> Loaded %u Spell Learn Skills from DBC in %u ms", dbc_count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outString(">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
-void SpellMgr::LoadSpellLearnSpells()
+void SpellMgr::LoadSpellEnchantProcData()
{
uint32 oldMSTime = getMSTime();
- mSpellLearnSpells.clear(); // need for reload case
+ mSpellEnchantProcEventMap.clear(); // need for reload case
- // 0 1 2
- QueryResult result = WorldDatabase.Query("SELECT entry, SpellID, Active FROM spell_learn_spell");
+ uint32 count = 0;
+
+ // 0 1 2 3
+ QueryResult result = WorldDatabase.Query("SELECT entry, customChance, PPMChance, procEx FROM spell_enchant_proc_data");
if (!result)
{
- sLog->outString(">> Loaded 0 spell learn spells");
+ sLog->outString(">> Loaded %u spell enchant proc event conditions", count);
sLog->outString();
- sLog->outErrorDb("`spell_learn_spell` table is empty!");
return;
}
- uint32 count = 0;
-
do
{
Field *fields = result->Fetch();
- uint32 spell_id = fields[0].GetUInt32();
-
- SpellLearnSpellNode node;
- node.spell = fields[1].GetUInt32();
- node.active = fields[2].GetBool();
- node.autoLearned= false;
+ uint32 enchantId = fields[0].GetUInt32();
- if (!sSpellStore.LookupEntry(spell_id))
+ SpellItemEnchantmentEntry const* ench = sSpellItemEnchantmentStore.LookupEntry(enchantId);
+ if (!ench)
{
- sLog->outErrorDb("Spell %u listed in `spell_learn_spell` does not exist", spell_id);
+ sLog->outErrorDb("Enchancment %u listed in `spell_enchant_proc_data` does not exist", enchantId);
continue;
}
- if (!sSpellStore.LookupEntry(node.spell))
- {
- sLog->outErrorDb("Spell %u listed in `spell_learn_spell` learning not existed spell %u", spell_id, node.spell);
- continue;
- }
+ SpellEnchantProcEntry spe;
- if (GetTalentSpellCost(node.spell))
- {
- sLog->outErrorDb("Spell %u listed in `spell_learn_spell` attempt learning talent spell %u, skipped", spell_id, node.spell);
- continue;
- }
+ spe.customChance = fields[1].GetUInt32();
+ spe.PPMChance = fields[2].GetFloat();
+ spe.procEx = fields[3].GetUInt32();
- mSpellLearnSpells.insert(SpellLearnSpellMap::value_type(spell_id, node));
+ mSpellEnchantProcEventMap[enchantId] = spe;
++count;
} while (result->NextRow());
- // search auto-learned spells and add its to map also for use in unlearn spells/talents
- uint32 dbc_count = 0;
- for (uint32 spell = 0; spell < sSpellStore.GetNumRows(); ++spell)
- {
- SpellEntry const* entry = sSpellStore.LookupEntry(spell);
-
- if (!entry)
- continue;
-
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- {
- if (entry->Effect[i] == SPELL_EFFECT_LEARN_SPELL)
- {
- SpellLearnSpellNode dbc_node;
- dbc_node.spell = entry->EffectTriggerSpell[i];
- 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
- if (!sSpellStore.LookupEntry(dbc_node.spell))
- continue;
-
- // talent or passive spells or skill-step spells auto-casted and not need dependent learning,
- // pet teaching spells must not be dependent learning (casted)
- // other required explicit dependent learning
- dbc_node.autoLearned = entry->EffectImplicitTargetA[i] == TARGET_UNIT_PET || GetTalentSpellCost(spell) > 0 || IsPassiveSpell(spell) || IsSpellHaveEffect(entry, SPELL_EFFECT_SKILL_STEP);
-
- SpellLearnSpellMapBounds db_node_bounds = GetSpellLearnSpellMapBounds(spell);
-
- bool found = false;
- for (SpellLearnSpellMap::const_iterator itr = db_node_bounds.first; itr != db_node_bounds.second; ++itr)
- {
- if (itr->second.spell == dbc_node.spell)
- {
- sLog->outErrorDb("Spell %u auto-learn spell %u in spell.dbc then the record in `spell_learn_spell` is redundant, please fix DB.",
- spell, dbc_node.spell);
- found = true;
- break;
- }
- }
-
- if (!found) // add new spell-spell pair if not found
- {
- mSpellLearnSpells.insert(SpellLearnSpellMap::value_type(spell, dbc_node));
- ++dbc_count;
- }
- }
- }
- }
-
- sLog->outString(">> Loaded %u spell learn spells + %u found in DBC in %u ms", count, dbc_count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outString(">> Loaded %u enchant proc data definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
-void SpellMgr::LoadSpellPetAuras()
+void SpellMgr::LoadSpellLinked()
{
uint32 oldMSTime = getMSTime();
- mSpellPetAuraMap.clear(); // need for reload case
+ mSpellLinkedMap.clear(); // need for reload case
- // 0 1 2 3
- QueryResult result = WorldDatabase.Query("SELECT spell, effectId, pet, aura FROM spell_pet_auras");
+ // 0 1 2
+ QueryResult result = WorldDatabase.Query("SELECT spell_trigger, spell_effect, type FROM spell_linked_spell");
if (!result)
{
- sLog->outString(">> Loaded 0 spell pet auras. DB table `spell_pet_auras` is empty.");
+ sLog->outString(">> Loaded 0 linked spells. DB table `spell_linked_spell` is empty.");
sLog->outString();
return;
}
@@ -2312,45 +2138,36 @@ void SpellMgr::LoadSpellPetAuras()
{
Field *fields = result->Fetch();
- uint32 spell = fields[0].GetUInt32();
- uint8 eff = fields[1].GetUInt8();
- uint32 pet = fields[2].GetUInt32();
- uint32 aura = fields[3].GetUInt32();
+ int32 trigger = fields[0].GetInt32();
+ int32 effect = fields[1].GetInt32();
+ int32 type = fields[2].GetInt32();
- SpellPetAuraMap::iterator itr = mSpellPetAuraMap.find((spell<<8) + eff);
- if (itr != mSpellPetAuraMap.end())
- itr->second.AddAura(pet, aura);
- else
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(abs(trigger));
+ if (!spellInfo)
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell);
- if (!spellInfo)
- {
- sLog->outErrorDb("Spell %u listed in `spell_pet_auras` does not exist", spell);
- continue;
- }
- if (spellInfo->Effect[eff] != SPELL_EFFECT_DUMMY &&
- (spellInfo->Effect[eff] != SPELL_EFFECT_APPLY_AURA ||
- spellInfo->EffectApplyAuraName[eff] != SPELL_AURA_DUMMY))
- {
- sLog->outError("Spell %u listed in `spell_pet_auras` does not have dummy aura or dummy effect", spell);
- continue;
- }
-
- SpellEntry const* spellInfo2 = sSpellStore.LookupEntry(aura);
- if (!spellInfo2)
- {
- sLog->outErrorDb("Aura %u listed in `spell_pet_auras` does not exist", aura);
- continue;
- }
+ sLog->outErrorDb("Spell %u listed in `spell_linked_spell` does not exist", abs(trigger));
+ continue;
+ }
+ spellInfo = sSpellMgr->GetSpellInfo(abs(effect));
+ if (!spellInfo)
+ {
+ sLog->outErrorDb("Spell %u listed in `spell_linked_spell` does not exist", abs(effect));
+ continue;
+ }
- PetAura pa(pet, aura, spellInfo->EffectImplicitTargetA[eff] == TARGET_UNIT_PET, SpellMgr::CalculateSpellEffectAmount(spellInfo, eff));
- mSpellPetAuraMap[(spell<<8) + eff] = pa;
+ if (type) //we will find a better way when more types are needed
+ {
+ if (trigger > 0)
+ trigger += SPELL_LINKED_MAX_SPELLS * type;
+ else
+ trigger -= SPELL_LINKED_MAX_SPELLS * type;
}
+ mSpellLinkedMap[trigger].push_back(effect);
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outString(">> Loaded %u linked spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
@@ -2390,18 +2207,18 @@ void SpellMgr::LoadPetLevelupSpellMap()
if (skillLine->learnOnGetSkill != ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL)
continue;
- SpellEntry const* spell = sSpellStore.LookupEntry(skillLine->spellId);
+ SpellInfo const* spell = sSpellMgr->GetSpellInfo(skillLine->spellId);
if (!spell) // not exist or triggered or talent
continue;
- if (!spell->spellLevel)
+ if (!spell->SpellLevel)
continue;
PetLevelupSpellSet& spellSet = mPetLevelupSpellMap[creatureFamily->ID];
if (spellSet.empty())
++family_count;
- spellSet.insert(PetLevelupSpellSet::value_type(spell->spellLevel, spell->Id));
+ spellSet.insert(PetLevelupSpellSet::value_type(spell->SpellLevel, spell->Id));
++count;
}
}
@@ -2499,18 +2316,17 @@ void SpellMgr::LoadPetDefaultSpells()
oldMSTime = getMSTime();
// different summon spells
- for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i)
+ for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i)
{
-
- SpellEntry const* spellEntry = sSpellStore.LookupEntry(i);
+ SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(i);
if (!spellEntry)
continue;
for (uint8 k = 0; k < MAX_SPELL_EFFECTS; ++k)
{
- if (spellEntry->Effect[k] == SPELL_EFFECT_SUMMON || spellEntry->Effect[k] == SPELL_EFFECT_SUMMON_PET)
+ if (spellEntry->Effects[k].Effect == SPELL_EFFECT_SUMMON || spellEntry->Effects[k].Effect == SPELL_EFFECT_SUMMON_PET)
{
- uint32 creature_id = spellEntry->EffectMiscValue[k];
+ uint32 creature_id = spellEntry->Effects[k].MiscValue;
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creature_id);
if (!cInfo)
continue;
@@ -2541,99 +2357,6 @@ void SpellMgr::LoadPetDefaultSpells()
sLog->outString();
}
-/// Some checks for spells, to prevent adding deprecated/broken spells for trainers, spell book, etc
-bool SpellMgr::IsSpellValid(SpellEntry const *spellInfo, Player *pl, bool msg)
-{
- // not exist
- if (!spellInfo)
- return false;
-
- bool need_check_reagents = false;
-
- // check effects
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- {
- switch (spellInfo->Effect[i])
- {
- case 0:
- continue;
-
- // 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->EffectItemType[i] == 0)
- {
- // skip auto-loot crafting spells, its not need explicit item info (but have special fake items sometime)
- if (!IsLootCraftingSpell(spellInfo))
- {
- if (msg)
- {
- if (pl)
- ChatHandler(pl).PSendSysMessage("Craft spell %u not have create item entry.", spellInfo->Id);
- else
- sLog->outErrorDb("Craft spell %u not have create item entry.", spellInfo->Id);
- }
- return false;
- }
-
- }
- // also possible IsLootCraftingSpell case but fake item must exist anyway
- else if (!sObjectMgr->GetItemTemplate(spellInfo->EffectItemType[i]))
- {
- if (msg)
- {
- if (pl)
- ChatHandler(pl).PSendSysMessage("Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->EffectItemType[i]);
- else
- sLog->outErrorDb("Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->EffectItemType[i]);
- }
- return false;
- }
-
- need_check_reagents = true;
- break;
- }
- case SPELL_EFFECT_LEARN_SPELL:
- {
- SpellEntry const* spellInfo2 = sSpellStore.LookupEntry(spellInfo->EffectTriggerSpell[i]);
- if (!IsSpellValid(spellInfo2, pl, msg))
- {
- if (msg)
- {
- if (pl)
- ChatHandler(pl).PSendSysMessage("Spell %u learn to broken spell %u, and then...", spellInfo->Id, spellInfo->EffectTriggerSpell[i]);
- else
- sLog->outErrorDb("Spell %u learn to invalid spell %u, and then...", spellInfo->Id, spellInfo->EffectTriggerSpell[i]);
- }
- return false;
- }
- break;
- }
- }
- }
-
- if (need_check_reagents)
- {
- for (uint8 j = 0; j < MAX_SPELL_REAGENTS; ++j)
- {
- if (spellInfo->Reagent[j] > 0 && !sObjectMgr->GetItemTemplate(spellInfo->Reagent[j]))
- {
- if (msg)
- {
- if (pl)
- ChatHandler(pl).PSendSysMessage("Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]);
- else
- sLog->outErrorDb("Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]);
- }
- return false;
- }
- }
- }
-
- return true;
-}
-
void SpellMgr::LoadSpellAreas()
{
uint32 oldMSTime = getMSTime();
@@ -2672,10 +2395,10 @@ void SpellMgr::LoadSpellAreas()
spellArea.gender = Gender(fields[7].GetUInt8());
spellArea.autocast = fields[8].GetBool();
- if (SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell))
+ if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell))
{
if (spellArea.autocast)
- const_cast<SpellEntry*>(spellInfo)->Attributes |= SPELL_ATTR0_CANT_CANCEL;
+ const_cast<SpellInfo*>(spellInfo)->Attributes |= SPELL_ATTR0_CANT_CANCEL;
}
else
{
@@ -2742,7 +2465,7 @@ void SpellMgr::LoadSpellAreas()
if (spellArea.auraSpell)
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(abs(spellArea.auraSpell));
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(abs(spellArea.auraSpell));
if (!spellInfo)
{
sLog->outErrorDb("Spell %u listed in `spell_area` have wrong aura spell (%u) requirement", spell, abs(spellArea.auraSpell));
@@ -2835,901 +2558,58 @@ void SpellMgr::LoadSpellAreas()
sLog->outString();
}
-SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spellInfo, uint32 map_id, uint32 zone_id, uint32 area_id, Player const* player)
-{
- // normal case
- if (spellInfo->AreaGroupId > 0)
- {
- bool found = false;
- AreaGroupEntry const* groupEntry = sAreaGroupStore.LookupEntry(spellInfo->AreaGroupId);
- while (groupEntry)
- {
- for (uint8 i = 0; i < MAX_GROUP_AREA_IDS; ++i)
- if (groupEntry->AreaId[i] == zone_id || groupEntry->AreaId[i] == area_id)
- found = true;
- if (found || !groupEntry->nextGroup)
- break;
- // Try search in next group
- groupEntry = sAreaGroupStore.LookupEntry(groupEntry->nextGroup);
- }
-
- if (!found)
- return SPELL_FAILED_INCORRECT_AREA;
- }
-
- // continent limitation (virtual continent)
- if (spellInfo->AttributesEx4 & SPELL_ATTR4_CAST_ONLY_IN_OUTLAND)
- {
- uint32 v_map = GetVirtualMapForMapAndZone(map_id, zone_id);
- MapEntry const* mapEntry = sMapStore.LookupEntry(v_map);
- if (!mapEntry || mapEntry->addon < 1 || !mapEntry->IsContinent())
- return SPELL_FAILED_INCORRECT_AREA;
- }
-
- // raid instance limitation
- if (spellInfo->AttributesEx6 & SPELL_ATTR6_NOT_IN_RAID_INSTANCE)
- {
- MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
- if (!mapEntry || mapEntry->IsRaid())
- return SPELL_FAILED_NOT_IN_RAID_INSTANCE;
- }
-
- // DB base check (if non empty then must fit at least single for allow)
- SpellAreaMapBounds saBounds = sSpellMgr->GetSpellAreaMapBounds(spellInfo->Id);
- if (saBounds.first != saBounds.second)
- {
- for (SpellAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
- {
- if (itr->second.IsFitToRequirements(player, zone_id, area_id))
- return SPELL_CAST_OK;
- }
- return SPELL_FAILED_INCORRECT_AREA;
- }
-
- // bg spell checks
- switch (spellInfo->Id)
- {
- case 23333: // Warsong Flag
- case 23335: // Silverwing Flag
- return map_id == 489 && player && player->InBattleground() ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
- case 34976: // Netherstorm Flag
- return map_id == 566 && player && player->InBattleground() ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
- case 2584: // Waiting to Resurrect
- case 22011: // Spirit Heal Channel
- case 22012: // Spirit Heal
- case 24171: // Resurrection Impact Visual
- case 42792: // Recently Dropped Flag
- case 43681: // Inactive
- case 44535: // Spirit Heal (mana)
- {
- MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
- if (!mapEntry)
- return SPELL_FAILED_INCORRECT_AREA;
-
- return zone_id == 4197 || (mapEntry->IsBattleground() && player && player->InBattleground()) ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
- }
- case 44521: // Preparation
- {
- if (!player)
- return SPELL_FAILED_REQUIRES_AREA;
-
- MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
- if (!mapEntry)
- return SPELL_FAILED_INCORRECT_AREA;
-
- if (!mapEntry->IsBattleground())
- return SPELL_FAILED_REQUIRES_AREA;
-
- Battleground* bg = player->GetBattleground();
- return bg && bg->GetStatus() == STATUS_WAIT_JOIN ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
- }
- case 32724: // Gold Team (Alliance)
- case 32725: // Green Team (Alliance)
- case 35774: // Gold Team (Horde)
- case 35775: // Green Team (Horde)
- {
- MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
- if (!mapEntry)
- return SPELL_FAILED_INCORRECT_AREA;
-
- return mapEntry->IsBattleArena() && player && player->InBattleground() ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
- }
- case 32727: // Arena Preparation
- {
- if (!player)
- return SPELL_FAILED_REQUIRES_AREA;
-
- MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
- if (!mapEntry)
- return SPELL_FAILED_INCORRECT_AREA;
-
- if (!mapEntry->IsBattleArena())
- return SPELL_FAILED_REQUIRES_AREA;
-
- Battleground* bg = player->GetBattleground();
- return bg && bg->GetStatus() == STATUS_WAIT_JOIN ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
- }
- }
-
- // aura limitations
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- {
- switch (spellInfo->EffectApplyAuraName[i])
- {
- case SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED:
- case SPELL_AURA_FLY:
- {
- if (player && !player->IsKnowHowFlyIn(map_id, zone_id))
- return SPELL_FAILED_INCORRECT_AREA;
- }
- }
- }
-
- return SPELL_CAST_OK;
-}
-
-void SpellMgr::LoadSkillLineAbilityMap()
-{
- uint32 oldMSTime = getMSTime();
-
- mSkillLineAbilityMap.clear();
-
- uint32 count = 0;
-
- for (uint32 i = 0; i < sSkillLineAbilityStore.GetNumRows(); ++i)
- {
- SkillLineAbilityEntry const* SkillInfo = sSkillLineAbilityStore.LookupEntry(i);
- if (!SkillInfo)
- continue;
-
- mSkillLineAbilityMap.insert(SkillLineAbilityMap::value_type(SkillInfo->spellId, SkillInfo));
- ++count;
- }
-
- sLog->outString(">> Loaded %u SkillLineAbility MultiMap Data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
-}
-
-DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto, bool triggered)
-{
- if (IsPositiveSpell(spellproto->Id))
- return DIMINISHING_NONE;
-
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- {
- if (spellproto->EffectApplyAuraName[i] == SPELL_AURA_MOD_TAUNT)
- return DIMINISHING_TAUNT;
- }
-
- // Explicit Diminishing Groups
- switch (spellproto->SpellFamilyName)
- {
- // Event spells
- case SPELLFAMILY_UNK1:
- return DIMINISHING_NONE;
- case SPELLFAMILY_DEATHKNIGHT:
- {
- // Hungering Cold (no flags)
- if (spellproto->SpellIconID == 2797)
- return DIMINISHING_DISORIENT;
- // Mark of Blood
- else if ((spellproto->SpellFamilyFlags[0] & 0x10000000) && spellproto->SpellIconID == 2285)
- return DIMINISHING_LIMITONLY;
- break;
- }
- case SPELLFAMILY_DRUID:
- {
- // Pounce
- if (spellproto->SpellFamilyFlags[0] & 0x20000)
- return DIMINISHING_OPENING_STUN;
- // Cyclone
- else if (spellproto->SpellFamilyFlags[1] & 0x20)
- return DIMINISHING_CYCLONE;
- // Entangling Roots
- // Nature's Grasp
- else if (spellproto->SpellFamilyFlags[0] & 0x00000200)
- return DIMINISHING_CONTROLLED_ROOT;
- // Faerie Fire
- else if (spellproto->SpellFamilyFlags[0] & 0x400)
- return DIMINISHING_LIMITONLY;
- break;
- }
- case SPELLFAMILY_HUNTER:
- {
- // Hunter's mark
- if ((spellproto->SpellFamilyFlags[0] & 0x400) && spellproto->SpellIconID == 538)
- return DIMINISHING_LIMITONLY;
- // Scatter Shot (own diminishing)
- else if ((spellproto->SpellFamilyFlags[0] & 0x40000) && spellproto->SpellIconID == 132)
- return DIMINISHING_SCATTER_SHOT;
- // Entrapment (own diminishing)
- else if (spellproto->SpellVisual[0] == 7484 && spellproto->SpellIconID == 20)
- return DIMINISHING_ENTRAPMENT;
- // Wyvern Sting mechanic is MECHANIC_SLEEP but the diminishing is DIMINISHING_DISORIENT
- else if ((spellproto->SpellFamilyFlags[1] & 0x1000) && spellproto->SpellIconID == 1721)
- return DIMINISHING_DISORIENT;
- // Freezing Arrow
- else if (spellproto->SpellFamilyFlags[0] & 0x8)
- return DIMINISHING_DISORIENT;
- break;
- }
- case SPELLFAMILY_PALADIN:
- {
- // Judgement of Justice - limit duration to 10s in PvP
- if (spellproto->SpellFamilyFlags[0] & 0x100000)
- return DIMINISHING_LIMITONLY;
- // Turn Evil
- else if ((spellproto->SpellFamilyFlags[1] & 0x804000) && spellproto->SpellIconID == 309)
- return DIMINISHING_FEAR;
- break;
- }
- case SPELLFAMILY_PRIEST:
- {
- // Psychic Horror
- if (spellproto->SpellFamilyFlags[2] & 0x2000)
- return DIMINISHING_HORROR;
- break;
- }
- case SPELLFAMILY_ROGUE:
- {
- // Gouge
- if (spellproto->SpellFamilyFlags[0] & 0x8)
- return DIMINISHING_DISORIENT;
- // Blind
- else if (spellproto->SpellFamilyFlags[0] & 0x1000000)
- return DIMINISHING_FEAR;
- // Cheap Shot
- else if (spellproto->SpellFamilyFlags[0] & 0x400)
- return DIMINISHING_OPENING_STUN;
- // Crippling poison - Limit to 10 seconds in PvP (No SpellFamilyFlags)
- else if (spellproto->SpellIconID == 163)
- return DIMINISHING_LIMITONLY;
- break;
- }
- case SPELLFAMILY_MAGE:
- {
- // Frostbite
- if (spellproto->SpellFamilyFlags[1] & 0x80000000)
- return DIMINISHING_ROOT;
- // Shattered Barrier
- else if (spellproto->SpellVisual[0] == 12297)
- return DIMINISHING_ROOT;
- // Deep Freeze
- else if (spellproto->SpellIconID == 2939 && spellproto->SpellVisual[0] == 9963)
- return DIMINISHING_CONTROLLED_STUN;
- // Frost Nova / Freeze (Water Elemental)
- else if (spellproto->SpellIconID == 193)
- return DIMINISHING_CONTROLLED_ROOT;
- // Dragon's Breath
- else if (spellproto->SpellFamilyFlags[0] & 0x800000)
- return DIMINISHING_DISORIENT;
- break;
- }
- case SPELLFAMILY_WARLOCK:
- {
- // Death Coil
- if (spellproto->SpellFamilyFlags[0] & 0x80000)
- return DIMINISHING_HORROR;
- // Curses/etc
- else if ((spellproto->SpellFamilyFlags[0] & 0x80000000) || (spellproto->SpellFamilyFlags[1] & 0x200))
- return DIMINISHING_LIMITONLY;
- // Seduction
- else if (spellproto->SpellFamilyFlags[1] & 0x10000000)
- return DIMINISHING_FEAR;
- break;
- }
- case SPELLFAMILY_WARRIOR:
- {
- // Hamstring - limit duration to 10s in PvP
- if (spellproto->SpellFamilyFlags[0] & 0x2)
- return DIMINISHING_LIMITONLY;
- // Improved Hamstring
- else if (spellproto->AttributesEx3 & 0x80000 && spellproto->SpellIconID == 23)
- return DIMINISHING_ROOT;
- // Charge Stun (own diminishing)
- else if (spellproto->SpellFamilyFlags[0] & 0x01000000)
- return DIMINISHING_CHARGE;
- break;
- }
- // Must be below SPELLFAMILY_WARRIOR for Charge to work
- case SPELLFAMILY_GENERIC:
- {
- // Pet charge effects (Infernal Awakening, Demon Charge)
- if (spellproto->SpellVisual[0] == 2816 && spellproto->SpellIconID == 15)
- return DIMINISHING_CONTROLLED_STUN;
- // Gnaw
- else if (spellproto->Id == 47481)
- return DIMINISHING_CONTROLLED_STUN;
- }
- default:
- break;
- }
-
- // Lastly - Set diminishing depending on mechanic
- uint32 mechanic = GetAllSpellMechanicMask(spellproto);
- if (mechanic & (1 << MECHANIC_CHARM))
- return DIMINISHING_MIND_CONTROL;
- if (mechanic & (1 << MECHANIC_SILENCE))
- return DIMINISHING_SILENCE;
- if (mechanic & (1 << MECHANIC_SLEEP))
- return DIMINISHING_SLEEP;
- if (mechanic & ((1 << MECHANIC_SAPPED) | (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_SHACKLE)))
- return DIMINISHING_DISORIENT;
- // Mechanic Knockout, except Blast Wave
- if (mechanic & (1 << MECHANIC_KNOCKOUT) && spellproto->SpellIconID != 292)
- return DIMINISHING_DISORIENT;
- if (mechanic & (1 << MECHANIC_DISARM))
- return DIMINISHING_DISARM;
- if (mechanic & (1 << MECHANIC_FEAR))
- return DIMINISHING_FEAR;
- if (mechanic & (1 << MECHANIC_STUN))
- return triggered ? DIMINISHING_STUN : DIMINISHING_CONTROLLED_STUN;
- if (mechanic & (1 << MECHANIC_BANISH))
- return DIMINISHING_BANISH;
- if (mechanic & (1 << MECHANIC_ROOT))
- return triggered ? DIMINISHING_ROOT : DIMINISHING_CONTROLLED_ROOT;
-
- return DIMINISHING_NONE;
-}
-
-int32 GetDiminishingReturnsLimitDuration(DiminishingGroup group, SpellEntry const* spellproto)
-{
- if (!IsDiminishingReturnsGroupDurationLimited(group))
- return 0;
-
- // Explicit diminishing duration
- switch (spellproto->SpellFamilyName)
- {
- case SPELLFAMILY_DRUID:
- {
- // Faerie Fire - limit to 40 seconds in PvP (3.1)
- if (spellproto->SpellFamilyFlags[0] & 0x400)
- return 40 * IN_MILLISECONDS;
- break;
- }
- case SPELLFAMILY_HUNTER:
- {
- // Wyvern Sting
- if (spellproto->SpellFamilyFlags[1] & 0x1000)
- return 6 * IN_MILLISECONDS;
- // Hunter's Mark
- if (spellproto->SpellFamilyFlags[0] & 0x400)
- return 120 * IN_MILLISECONDS;
- break;
- }
- case SPELLFAMILY_PALADIN:
- {
- // Repentance - limit to 6 seconds in PvP
- if (spellproto->SpellFamilyFlags[0] & 0x4)
- return 6 * IN_MILLISECONDS;
- break;
- }
- case SPELLFAMILY_WARLOCK:
- {
- // Banish - limit to 6 seconds in PvP
- if (spellproto->SpellFamilyFlags[1] & 0x8000000)
- return 6 * IN_MILLISECONDS;
- // Curse of Tongues - limit to 12 seconds in PvP
- else if (spellproto->SpellFamilyFlags[2] & 0x800)
- return 12 * IN_MILLISECONDS;
- // Curse of Elements - limit to 120 seconds in PvP
- else if (spellproto->SpellFamilyFlags[1] & 0x200)
- return 120 * IN_MILLISECONDS;
- break;
- }
- default:
- break;
- }
-
- return 10 * IN_MILLISECONDS;
-}
-
-bool IsDiminishingReturnsGroupDurationLimited(DiminishingGroup group)
-{
- switch (group)
- {
- case DIMINISHING_CONTROLLED_STUN:
- case DIMINISHING_STUN:
- case DIMINISHING_ENTRAPMENT:
- case DIMINISHING_CONTROLLED_ROOT:
- case DIMINISHING_ROOT:
- case DIMINISHING_FEAR:
- case DIMINISHING_MIND_CONTROL:
- case DIMINISHING_DISORIENT:
- case DIMINISHING_CYCLONE:
- case DIMINISHING_BANISH:
- case DIMINISHING_LIMITONLY:
- case DIMINISHING_OPENING_STUN:
- case DIMINISHING_HORROR:
- case DIMINISHING_SLEEP:
- return true;
- default:
- return false;
- }
-}
-
-DiminishingLevels GetDiminishingReturnsMaxLevel(DiminishingGroup group)
-{
- switch (group)
- {
- case DIMINISHING_TAUNT:
- return DIMINISHING_LEVEL_TAUNT_IMMUNE;
- default:
- return DIMINISHING_LEVEL_IMMUNE;
- }
-}
-
-DiminishingReturnsType GetDiminishingReturnsGroupType(DiminishingGroup group)
-{
- switch (group)
- {
- case DIMINISHING_TAUNT:
- case DIMINISHING_CONTROLLED_STUN:
- case DIMINISHING_STUN:
- case DIMINISHING_OPENING_STUN:
- case DIMINISHING_CYCLONE:
- case DIMINISHING_CHARGE:
- return DRTYPE_ALL;
- case DIMINISHING_FEAR:
- case DIMINISHING_CONTROLLED_ROOT:
- case DIMINISHING_ROOT:
- case DIMINISHING_MIND_CONTROL:
- case DIMINISHING_DISORIENT:
- case DIMINISHING_ENTRAPMENT:
- case DIMINISHING_SILENCE:
- case DIMINISHING_DISARM:
- case DIMINISHING_BANISH:
- case DIMINISHING_SCATTER_SHOT:
- case DIMINISHING_HORROR:
- case DIMINISHING_SLEEP:
- return DRTYPE_PLAYER;
- default:
- break;
- }
-
- return DRTYPE_NONE;
-}
-
-bool IsPartOfSkillLine(uint32 skillId, uint32 spellId)
-{
- SkillLineAbilityMapBounds skillBounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellId);
- for (SkillLineAbilityMap::const_iterator itr = skillBounds.first; itr != skillBounds.second; ++itr)
- if (itr->second->skillId == skillId)
- return true;
-
- return false;
-}
-
-bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 newArea) const
-{
- if (gender != GENDER_NONE) // not in expected gender
- if (!player || gender != player->getGender())
- return false;
-
- if (raceMask) // not in expected race
- if (!player || !(raceMask & player->getRaceMask()))
- return false;
-
- if (areaId) // not in expected zone
- if (newZone != areaId && newArea != areaId)
- return false;
-
- if (questStart) // not in expected required quest state
- if (!player || ((!questStartCanActive || !player->IsActiveQuest(questStart)) && !player->GetQuestRewardStatus(questStart)))
- return false;
-
- if (questEnd) // not in expected forbidden quest state
- if (!player || player->GetQuestRewardStatus(questEnd))
- return false;
-
- if (auraSpell) // not have expected aura
- if (!player || (auraSpell > 0 && !player->HasAura(auraSpell)) || (auraSpell < 0 && player->HasAura(-auraSpell)))
- return false;
-
- // Extra conditions -- leaving the possibility add extra conditions...
- switch (spellId)
- {
- case 58600: // No fly Zone - Dalaran
- {
- if (!player)
- return false;
-
- AreaTableEntry const* pArea = GetAreaEntryByAreaID(player->GetAreaId());
- if (!(pArea && pArea->flags & AREA_FLAG_NO_FLY_ZONE))
- return false;
- if (!player->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !player->HasAuraType(SPELL_AURA_FLY))
- return false;
- break;
- }
- case 68719: // Oil Refinery - Isle of Conquest.
- case 68720: // Quarry - Isle of Conquest.
- {
- if (player->GetBattlegroundTypeId() != BATTLEGROUND_IC || !player->GetBattleground())
- return false;
-
- uint8 nodeType = spellId == 68719 ? NODE_TYPE_REFINERY : NODE_TYPE_QUARRY;
- uint8 nodeState = player->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H;
-
- BattlegroundIC* pIC = static_cast<BattlegroundIC*>(player->GetBattleground());
- if (pIC->GetNodeState(nodeType) == nodeState)
- return true;
-
- return false;
- }
- }
-
- return true;
-}
-
-bool SpellMgr::CanAurasStack(Aura const *aura1, Aura const *aura2, bool sameCaster) const
-{
- SpellEntry const* spellInfo_1 = aura1->GetSpellProto();
- SpellEntry const* spellInfo_2 = aura2->GetSpellProto();
- SpellSpecific spellSpec_1 = GetSpellSpecific(spellInfo_1);
- SpellSpecific spellSpec_2 = GetSpellSpecific(spellInfo_2);
- if (spellSpec_1 && spellSpec_2)
- if (IsSingleFromSpellSpecificPerTarget(spellSpec_1, spellSpec_2)
- || (sameCaster && IsSingleFromSpellSpecificPerCaster(spellSpec_1, spellSpec_2)))
- return false;
-
- SpellGroupStackRule stackRule = CheckSpellGroupStackRules(spellInfo_1->Id, spellInfo_2->Id);
- if (stackRule)
- {
- if (stackRule == SPELL_GROUP_STACK_RULE_EXCLUSIVE)
- return false;
- if (sameCaster && stackRule == SPELL_GROUP_STACK_RULE_EXCLUSIVE_FROM_SAME_CASTER)
- return false;
- }
-
- if (spellInfo_1->SpellFamilyName != spellInfo_2->SpellFamilyName)
- return true;
-
- if (!sameCaster)
- {
- if (spellInfo_1->AttributesEx3 & SPELL_ATTR3_STACK_FOR_DIFF_CASTERS)
- return true;
-
- // check same periodic auras
- for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- {
- switch (spellInfo_1->EffectApplyAuraName[i])
- {
- // DOT or HOT from different casters will stack
- case SPELL_AURA_PERIODIC_DAMAGE:
- case SPELL_AURA_PERIODIC_DUMMY:
- case SPELL_AURA_PERIODIC_HEAL:
- case SPELL_AURA_PERIODIC_TRIGGER_SPELL:
- case SPELL_AURA_PERIODIC_ENERGIZE:
- case SPELL_AURA_PERIODIC_MANA_LEECH:
- case SPELL_AURA_PERIODIC_LEECH:
- case SPELL_AURA_POWER_BURN_MANA:
- case SPELL_AURA_OBS_MOD_POWER:
- case SPELL_AURA_OBS_MOD_HEALTH:
- case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE:
- // periodic auras which target areas are not allowed to stack this way (replenishment for example)
- if (IsAreaOfEffectSpellEffect(spellInfo_1, i) || IsAreaOfEffectSpellEffect(spellInfo_2, i))
- break;
- return true;
- default:
- break;
- }
- }
- }
-
- bool isVehicleAura1 = false;
- bool isVehicleAura2 = false;
- uint8 i = 0;
- while (i < MAX_SPELL_EFFECTS && !(isVehicleAura1 && isVehicleAura2))
- {
- if (spellInfo_1->EffectApplyAuraName[i] == SPELL_AURA_CONTROL_VEHICLE)
- isVehicleAura1 = true;
- if (spellInfo_2->EffectApplyAuraName[i] == SPELL_AURA_CONTROL_VEHICLE)
- isVehicleAura2 = true;
-
- ++i;
- }
-
- if (isVehicleAura1 && isVehicleAura2)
- {
- Vehicle* veh = NULL;
- if (aura1->GetOwner()->ToUnit())
- veh = aura1->GetOwner()->ToUnit()->GetVehicleKit();
-
- if (!veh) // We should probably just let it stack. Vehicle system will prevent undefined behaviour later
- return true;
-
- if (!veh->GetAvailableSeatCount())
- return false; // No empty seat available
-
- return true; // Empty seat available (skip rest)
- }
-
- uint32 spellId_1 = GetLastSpellInChain(spellInfo_1->Id);
- uint32 spellId_2 = GetLastSpellInChain(spellInfo_2->Id);
-
- // same spell
- if (spellId_1 == spellId_2)
- {
- // Hack for Incanter's Absorption
- if (spellId_1 == 44413)
- return true;
- if (aura1->GetCastItemGUID() && aura2->GetCastItemGUID())
- if (aura1->GetCastItemGUID() != aura2->GetCastItemGUID() && (GetSpellCustomAttr(spellId_1) & SPELL_ATTR0_CU_ENCHANT_PROC))
- return true;
- // same spell with same caster should not stack
- return false;
- }
-
- return true;
-}
-
-bool CanSpellDispelAura(SpellEntry const* dispelSpell, SpellEntry const* aura)
-{
- // These auras (like ressurection sickness) can't be dispelled
- if (aura->Attributes & SPELL_ATTR0_NEGATIVE_1)
- return false;
-
- // These spells (like Mass Dispel) can dispell all auras
- if (dispelSpell->Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY)
- return true;
-
- // These auras (like Divine Shield) can't be dispelled
- if (aura->Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY)
- return false;
-
- // These auras (Cyclone for example) are not dispelable
- if (aura->AttributesEx & SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE)
- return false;
-
- return true;
-}
-
-bool CanSpellPierceImmuneAura(SpellEntry const* pierceSpell, SpellEntry const* aura)
-{
- // these spells pierce all avalible spells (Resurrection Sickness for example)
- if (pierceSpell->Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY)
- return true;
-
- // these spells (Cyclone for example) can pierce all...
- if ((pierceSpell->AttributesEx & SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE)
- // ...but not these (Divine shield for example)
- && !(aura && (aura->Mechanic == MECHANIC_IMMUNE_SHIELD || aura->Mechanic == MECHANIC_INVULNERABILITY)))
- return true;
-
- return false;
-}
-
-void SpellMgr::LoadSpellEnchantProcData()
-{
- uint32 oldMSTime = getMSTime();
-
- mSpellEnchantProcEventMap.clear(); // need for reload case
-
- uint32 count = 0;
-
- // 0 1 2 3
- QueryResult result = WorldDatabase.Query("SELECT entry, customChance, PPMChance, procEx FROM spell_enchant_proc_data");
- if (!result)
- {
- sLog->outString(">> Loaded %u spell enchant proc event conditions", count);
- sLog->outString();
- return;
- }
-
- do
- {
- Field *fields = result->Fetch();
-
- uint32 enchantId = fields[0].GetUInt32();
-
- SpellItemEnchantmentEntry const* ench = sSpellItemEnchantmentStore.LookupEntry(enchantId);
- if (!ench)
- {
- sLog->outErrorDb("Enchancment %u listed in `spell_enchant_proc_data` does not exist", enchantId);
- continue;
- }
-
- SpellEnchantProcEntry spe;
-
- spe.customChance = fields[1].GetUInt32();
- spe.PPMChance = fields[2].GetFloat();
- spe.procEx = fields[3].GetUInt32();
-
- mSpellEnchantProcEventMap[enchantId] = spe;
-
- ++count;
- } while (result->NextRow());
-
- sLog->outString(">> Loaded %u enchant proc data definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
-}
-
-void SpellMgr::LoadSpellRequired()
+void SpellMgr::LoadSpellInfoStore()
{
uint32 oldMSTime = getMSTime();
- mSpellsReqSpell.clear(); // need for reload case
- mSpellReq.clear(); // need for reload case
-
- QueryResult result = WorldDatabase.Query("SELECT spell_id, req_spell from spell_required");
+ UnloadSpellInfoStore();
+ mSpellInfoMap.resize(sSpellStore.GetNumRows(), NULL);
- if (!result)
+ for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i)
{
- sLog->outString(">> Loaded 0 spell required records");
- sLog->outString();
- sLog->outErrorDb("`spell_required` table is empty!");
- return;
+ if (SpellEntry const* spellEntry = sSpellStore.LookupEntry(i))
+ mSpellInfoMap[i] = new SpellInfo(spellEntry);
}
- uint32 rows = 0;
-
- do
- {
- Field *fields = result->Fetch();
-
- uint32 spell_id = fields[0].GetUInt32();
- uint32 spell_req = fields[1].GetUInt32();
- // check if chain is made with valid first spell
- SpellEntry const* spell = sSpellStore.LookupEntry(spell_id);
- if (!spell)
- {
- sLog->outErrorDb("spell_id %u in `spell_required` table is not found in dbcs, skipped", spell_id);
- continue;
- }
- SpellEntry const* req_spell = sSpellStore.LookupEntry(spell_req);
- if (!req_spell)
- {
- sLog->outErrorDb("req_spell %u in `spell_required` table is not found in dbcs, skipped", spell_req);
- continue;
- }
- if (GetFirstSpellInChain(spell_id) == GetFirstSpellInChain(spell_req))
- {
- sLog->outErrorDb("req_spell %u and spell_id %u in `spell_required` table are ranks of the same spell, entry not needed, skipped", spell_req, spell_id);
- continue;
- }
- if (IsSpellRequiringSpell(spell_id, spell_req))
- {
- sLog->outErrorDb("duplicated entry of req_spell %u and spell_id %u in `spell_required`, skipped", spell_req, spell_id);
- continue;
- }
- mSpellReq.insert (std::pair<uint32, uint32>(spell_id, spell_req));
- mSpellsReqSpell.insert (std::pair<uint32, uint32>(spell_req, spell_id));
- ++rows;
- } while (result->NextRow());
-
- sLog->outString(">> Loaded %u spell required records in %u ms", rows, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outString(">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
-void SpellMgr::LoadSpellRanks()
+void SpellMgr::UnloadSpellInfoStore()
{
- uint32 oldMSTime = getMSTime();
-
- mSpellChains.clear(); // need for reload case
-
- QueryResult result = WorldDatabase.Query("SELECT first_spell_id, spell_id, rank from spell_ranks ORDER BY first_spell_id , rank");
-
- if (!result)
+ for (uint32 i = 0; i < mSpellInfoMap.size(); ++i)
{
- sLog->outString(">> Loaded 0 spell rank records");
- sLog->outString();
- sLog->outErrorDb("`spell_ranks` table is empty!");
- return;
+ if (mSpellInfoMap[i])
+ delete mSpellInfoMap[i];
}
-
- uint32 rows = 0;
- bool finished = false;
-
- do
- {
- // spellid, rank
- std::list < std::pair < int32, int32 > > rankChain;
- int32 currentSpell = -1;
- int32 lastSpell = -1;
-
- // fill one chain
- while (currentSpell == lastSpell && !finished)
- {
- Field *fields = result->Fetch();
-
- currentSpell = fields[0].GetUInt32();
- if (lastSpell == -1)
- lastSpell = currentSpell;
- uint32 spell_id = fields[1].GetUInt32();
- uint32 rank = fields[2].GetUInt32();
-
- // don't drop the row if we're moving to the next rank
- if (currentSpell == lastSpell)
- {
- rankChain.push_back(std::make_pair(spell_id, rank));
- if (!result->NextRow())
- finished = true;
- }
- else
- break;
- }
- // check if chain is made with valid first spell
- SpellEntry const* first = sSpellStore.LookupEntry(lastSpell);
- if (!first)
- {
- sLog->outErrorDb("Spell rank identifier(first_spell_id) %u listed in `spell_ranks` does not exist!", lastSpell);
- continue;
- }
- // check if chain is long enough
- if (rankChain.size() < 2)
- {
- sLog->outErrorDb("There is only 1 spell rank for identifier(first_spell_id) %u in `spell_ranks`, entry is not needed!", lastSpell);
- continue;
- }
- int32 curRank = 0;
- bool valid = true;
- // check spells in chain
- for (std::list<std::pair<int32, int32> >::iterator itr = rankChain.begin() ; itr!= rankChain.end(); ++itr)
- {
- SpellEntry const* spell = sSpellStore.LookupEntry(itr->first);
- if (!spell)
- {
- sLog->outErrorDb("Spell %u (rank %u) listed in `spell_ranks` for chain %u does not exist!", itr->first, itr->second, lastSpell);
- valid = false;
- break;
- }
- ++curRank;
- if (itr->second != curRank)
- {
- sLog->outErrorDb("Spell %u (rank %u) listed in `spell_ranks` for chain %u does not have proper rank value(should be %u)!", itr->first, itr->second, lastSpell, curRank);
- valid = false;
- break;
- }
- }
- if (!valid)
- continue;
- int32 prevRank = 0;
- // insert the chain
- std::list<std::pair<int32, int32> >::iterator itr = rankChain.begin();
- do
- {
- ++rows;
- int32 addedSpell = itr->first;
- mSpellChains[addedSpell].first = lastSpell;
- mSpellChains[addedSpell].last = rankChain.back().first;
- mSpellChains[addedSpell].rank = itr->second;
- mSpellChains[addedSpell].prev = prevRank;
- prevRank = addedSpell;
- ++itr;
- if (itr == rankChain.end())
- {
- mSpellChains[addedSpell].next = 0;
- break;
- }
- else
- mSpellChains[addedSpell].next = itr->first;
- }
- while (true);
- } while (!finished);
-
- sLog->outString(">> Loaded %u spell rank records in %u ms", rows, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ mSpellInfoMap.clear();
}
-// set data in core for now
void SpellMgr::LoadSpellCustomAttr()
{
uint32 oldMSTime = getMSTime();
- mSpellCustomAttr.resize(GetSpellStore()->GetNumRows(), 0); // initialize with 0 values
-
- uint32 count = 0;
-
- SpellEntry* spellInfo = NULL;
- for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i)
+ SpellInfo* spellInfo = NULL;
+ for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i)
{
- spellInfo = (SpellEntry*)sSpellStore.LookupEntry(i);
+ spellInfo = mSpellInfoMap[i];
if (!spellInfo)
continue;
for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
- switch (spellInfo->Effect[j])
+ switch (spellInfo->Effects[j].ApplyAuraName)
+ {
+ case SPELL_AURA_MOD_POSSESS:
+ case SPELL_AURA_MOD_CONFUSE:
+ case SPELL_AURA_MOD_CHARM:
+ case SPELL_AURA_AOE_CHARM:
+ case SPELL_AURA_MOD_FEAR:
+ case SPELL_AURA_MOD_STUN:
+ spellInfo->AttributesCu |= SPELL_ATTR0_CU_AURA_CC;
+ break;
+ }
+ switch (spellInfo->Effects[j].Effect)
{
case SPELL_EFFECT_SCHOOL_DAMAGE:
case SPELL_EFFECT_WEAPON_DAMAGE:
@@ -3737,27 +2617,17 @@ void SpellMgr::LoadSpellCustomAttr()
case SPELL_EFFECT_NORMALIZED_WEAPON_DMG:
case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE:
case SPELL_EFFECT_HEAL:
- mSpellCustomAttr[i] |= SPELL_ATTR0_CU_DIRECT_DAMAGE;
- ++count;
+ spellInfo->AttributesCu |= SPELL_ATTR0_CU_DIRECT_DAMAGE;
break;
case SPELL_EFFECT_CHARGE:
case SPELL_EFFECT_CHARGE_DEST:
case SPELL_EFFECT_JUMP:
case SPELL_EFFECT_JUMP_DEST:
case SPELL_EFFECT_LEAP_BACK:
- if (!spellInfo->speed && !spellInfo->SpellFamilyName)
- spellInfo->speed = SPEED_CHARGE;
- mSpellCustomAttr[i] |= SPELL_ATTR0_CU_CHARGE;
- ++count;
+ spellInfo->AttributesCu |= SPELL_ATTR0_CU_CHARGE;
break;
case SPELL_EFFECT_PICKPOCKET:
- mSpellCustomAttr[i] |= SPELL_ATTR0_CU_PICKPOCKET;
- break;
- case SPELL_EFFECT_TRIGGER_SPELL:
- if (IsPositionTarget(spellInfo->EffectImplicitTargetA[j]) ||
- spellInfo->Targets & (TARGET_FLAG_SOURCE_LOCATION | TARGET_FLAG_DEST_LOCATION))
- spellInfo->Effect[j] = SPELL_EFFECT_TRIGGER_MISSILE;
- ++count;
+ spellInfo->AttributesCu |= SPELL_ATTR0_CU_PICKPOCKET;
break;
case SPELL_EFFECT_ENCHANT_ITEM:
case SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY:
@@ -3767,88 +2637,44 @@ void SpellMgr::LoadSpellCustomAttr()
// only enchanting profession enchantments procs can stack
if (IsPartOfSkillLine(SKILL_ENCHANTING, i))
{
- uint32 enchantId = spellInfo->EffectMiscValue[j];
+ uint32 enchantId = spellInfo->Effects[j].MiscValue;
SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId);
for (uint8 s = 0; s < MAX_ITEM_ENCHANTMENT_EFFECTS; ++s)
{
if (enchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
continue;
- SpellEntry const* procInfo = sSpellStore.LookupEntry(enchant->spellid[s]);
+ SpellInfo* procInfo = (SpellInfo*)sSpellMgr->GetSpellInfo(enchant->spellid[s]);
if (!procInfo)
continue;
// if proced directly from enchantment, not via proc aura
// NOTE: Enchant Weapon - Blade Ward also has proc aura spell and is proced directly
// however its not expected to stack so this check is good
- if (IsSpellHaveAura(procInfo, SPELL_AURA_PROC_TRIGGER_SPELL))
+ if (procInfo->HasAura(SPELL_AURA_PROC_TRIGGER_SPELL))
continue;
- mSpellCustomAttr[enchant->spellid[s]] |= SPELL_ATTR0_CU_ENCHANT_PROC;
+ procInfo->AttributesCu |= SPELL_ATTR0_CU_ENCHANT_PROC;
}
}
break;
}
}
-
- switch (SpellTargetType[spellInfo->EffectImplicitTargetA[j]])
- {
- case TARGET_TYPE_UNIT_TARGET:
- case TARGET_TYPE_DEST_TARGET:
- spellInfo->Targets |= TARGET_FLAG_UNIT;
- ++count;
- break;
- default:
- break;
- }
}
- for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
- {
- switch (spellInfo->EffectApplyAuraName[j])
- {
- case SPELL_AURA_MOD_POSSESS:
- case SPELL_AURA_MOD_CONFUSE:
- case SPELL_AURA_MOD_CHARM:
- case SPELL_AURA_AOE_CHARM:
- case SPELL_AURA_MOD_FEAR:
- case SPELL_AURA_MOD_STUN:
- mSpellCustomAttr[i] |= SPELL_ATTR0_CU_AURA_CC;
- ++count;
- break;
- }
- }
+ if (!spellInfo->_IsPositiveEffect(EFFECT_0, false))
+ spellInfo->AttributesCu |= SPELL_ATTR0_CU_NEGATIVE_EFF0;
- if (!_isPositiveEffect(i, 0, false))
- {
- mSpellCustomAttr[i] |= SPELL_ATTR0_CU_NEGATIVE_EFF0;
- ++count;
- }
- if (!_isPositiveEffect(i, 1, false))
- {
- mSpellCustomAttr[i] |= SPELL_ATTR0_CU_NEGATIVE_EFF1;
- ++count;
- }
- if (!_isPositiveEffect(i, 2, false))
- {
- mSpellCustomAttr[i] |= SPELL_ATTR0_CU_NEGATIVE_EFF2;
- ++count;
- }
+ if (!spellInfo->_IsPositiveEffect(EFFECT_1, false))
+ spellInfo->AttributesCu |= SPELL_ATTR0_CU_NEGATIVE_EFF1;
- if (spellInfo->SpellVisual[0] == 3879)
- {
- mSpellCustomAttr[i] |= SPELL_ATTR0_CU_CONE_BACK;
- ++count;
- }
+ if (!spellInfo->_IsPositiveEffect(EFFECT_2, false))
+ spellInfo->AttributesCu |= SPELL_ATTR0_CU_NEGATIVE_EFF2;
- if (spellInfo->activeIconID == 2158) // flight
- {
- spellInfo->Attributes |= SPELL_ATTR0_PASSIVE;
- ++count;
- }
+ if (spellInfo->SpellVisual[0] == 3879)
+ spellInfo->AttributesCu |= SPELL_ATTR0_CU_CONE_BACK;
- // TODO: this REALLY needs to be moved to db (so it can be blamed on db guys)
- switch (i)
+ switch (spellInfo->Id)
{
case 1776: // Gouge
case 1777:
@@ -3865,8 +2691,7 @@ void SpellMgr::LoadSpellCustomAttr()
case 38764:
case 38863:
case 52743: // Head Smack
- mSpellCustomAttr[i] |= SPELL_ATTR0_CU_REQ_TARGET_FACING_CASTER;
- ++count;
+ spellInfo->AttributesCu |= SPELL_ATTR0_CU_REQ_TARGET_FACING_CASTER;
break;
case 53: // Backstab
case 2589:
@@ -3913,46 +2738,203 @@ void SpellMgr::LoadSpellCustomAttr()
case 23959: // Test Stab R50
case 24825: // Test Backstab
case 58563: // Assassinate Restless Lookout
- mSpellCustomAttr[i] |= SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET;
- ++count;
+ spellInfo->AttributesCu |= SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET;
+ break;
+ case 26029: // Dark Glare
+ case 37433: // Spout
+ case 43140: // Flame Breath
+ case 43215: // Flame Breath
+ case 70461: // Coldflame Trap
+ spellInfo->AttributesCu |= SPELL_ATTR0_CU_CONE_LINE;
+ break;
+ case 24340: // Meteor
+ case 26558: // Meteor
+ case 28884: // Meteor
+ case 36837: // Meteor
+ case 38903: // Meteor
+ case 41276: // Meteor
+ case 57467: // Meteor
+ case 26789: // Shard of the Fallen Star
+ case 31436: // Malevolent Cleave
+ case 35181: // Dive Bomb
+ case 40810: // Saber Lash
+ case 43267: // Saber Lash
+ case 43268: // Saber Lash
+ case 42384: // Brutal Swipe
+ case 45150: // Meteor Slash
+ case 64688: // Sonic Screech
+ case 72373: // Shared Suffering
+ case 71904: // Chaos Bane
+ case 70492: // Ooze Eruption
+ case 72505: // Ooze Eruption
+ case 72624: // Ooze Eruption
+ case 72625: // Ooze Eruption
+ // ONLY SPELLS WITH SPELLFAMILY_GENERIC and EFFECT_SCHOOL_DAMAGE
+ spellInfo->AttributesCu |= SPELL_ATTR0_CU_SHARE_DAMAGE;
+ break;
+ case 27820: // Mana Detonation
+ case 69782: // Ooze Flood
+ case 69796: // Ooze Flood
+ case 69798: // Ooze Flood
+ case 69801: // Ooze Flood
+ case 69538: // Ooze Combine
+ case 69553: // Ooze Combine
+ case 69610: // Ooze Combine
+ case 71447: // Bloodbolt Splash
+ case 71481: // Bloodbolt Splash
+ case 71482: // Bloodbolt Splash
+ case 71483: // Bloodbolt Splash
+ case 71390: // Pact of the Darkfallen
+ spellInfo->AttributesCu |= SPELL_ATTR0_CU_EXCLUDE_SELF;
+ break;
+ case 18500: // Wing Buffet
+ case 33086: // Wild Bite
+ case 49749: // Piercing Blow
+ case 52890: // Penetrating Strike
+ case 53454: // Impale
+ case 59446: // Impale
+ case 62383: // Shatter
+ case 64777: // Machine Gun
+ case 65239: // Machine Gun
+ case 65919: // Impale
+ case 67858: // Impale
+ case 67859: // Impale
+ case 67860: // Impale
+ case 69293: // Wing Buffet
+ case 74439: // Machine Gun
+ spellInfo->AttributesCu |= SPELL_ATTR0_CU_IGNORE_ARMOR;
+ break;
+ case 63278: // Mark of the Faceless (General Vezax)
+ spellInfo->AttributesCu |= SPELL_ATTR0_CU_IGNORE_ARMOR;
+ break;
+ case 64422: // Sonic Screech (Auriaya)
+ spellInfo->AttributesCu |= SPELL_ATTR0_CU_SHARE_DAMAGE;
+ spellInfo->AttributesCu |= SPELL_ATTR0_CU_IGNORE_ARMOR;
+ break;
+ }
+
+ switch (spellInfo->SpellFamilyName)
+ {
+ case SPELLFAMILY_WARRIOR:
+ // Shout
+ if (spellInfo->SpellFamilyFlags[0] & 0x20000 || spellInfo->SpellFamilyFlags[1] & 0x20)
+ spellInfo->AttributesCu |= SPELL_ATTR0_CU_AURA_CC;
+ break;
+ case SPELLFAMILY_DRUID:
+ // Roar
+ if (spellInfo->SpellFamilyFlags[0] & 0x8)
+ spellInfo->AttributesCu |= SPELL_ATTR0_CU_AURA_CC;
+ break;
+ default:
+ break;
+ }
+ }
+
+ CreatureAI::FillAISpellInfo();
+
+ sLog->outString(">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime));
+ sLog->outString();
+}
+
+void SpellMgr::LoadDbcDataCorrections()
+{
+ uint32 oldMSTime = getMSTime();
+
+ SpellEntry* spellInfo = NULL;
+ for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i)
+ {
+ spellInfo = (SpellEntry*)sSpellStore.LookupEntry(i);
+ if (!spellInfo)
+ continue;
+
+ for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
+ {
+ switch (spellInfo->Effect[j])
+ {
+ case SPELL_EFFECT_CHARGE:
+ case SPELL_EFFECT_CHARGE_DEST:
+ case SPELL_EFFECT_JUMP:
+ case SPELL_EFFECT_JUMP_DEST:
+ case SPELL_EFFECT_LEAP_BACK:
+ if (!spellInfo->speed && !spellInfo->SpellFamilyName)
+ spellInfo->speed = SPEED_CHARGE;
+ break;
+ case SPELL_EFFECT_TRIGGER_SPELL:
+ if (SpellImplicitTargetInfo::IsPosition(spellInfo->EffectImplicitTargetA[j]) ||
+ spellInfo->Targets & (TARGET_FLAG_SOURCE_LOCATION | TARGET_FLAG_DEST_LOCATION))
+ spellInfo->Effect[j] = SPELL_EFFECT_TRIGGER_MISSILE;
+ break;
+ }
+
+ switch (SpellImplicitTargetInfo::Type[spellInfo->EffectImplicitTargetA[j]])
+ {
+ case TARGET_TYPE_UNIT_TARGET:
+ case TARGET_TYPE_DEST_TARGET:
+ spellInfo->Targets |= TARGET_FLAG_UNIT;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (spellInfo->activeIconID == 2158) // flight
+ {
+ spellInfo->Attributes |= SPELL_ATTR0_PASSIVE;
+ }
+
+ switch (spellInfo->Id)
+ {
+ case 42835: // Spout
+ spellInfo->Effect[0] = 0; // remove damage effect, only anim is needed
+ break;
+ case 30657: // Quake
+ spellInfo->EffectTriggerSpell[0] = 30571;
+ break;
+ case 30541: // Blaze (needs conditions entry)
+ spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ENEMY;
+ spellInfo->EffectImplicitTargetB[0] = 0;
+ break;
+ case 31447: // Mark of Kaz'rogal (needs target selection script)
+ case 31298: // Sleep (needs target selection script)
+ spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER;
+ spellInfo->EffectImplicitTargetB[0] = 0;
+ break;
+ case 31344: // Howl of Azgalor
+ spellInfo->EffectRadiusIndex[0] = 12; // 100yards instead of 50000?!
+ break;
+ case 42818: // Headless Horseman - Wisp Flight Port
+ case 42821: // Headless Horseman - Wisp Flight Missile
+ spellInfo->rangeIndex = 6; // 100 yards
break;
case 36350: //They Must Burn Bomb Aura (self)
spellInfo->EffectTriggerSpell[0] = 36325; // They Must Burn Bomb Drop (DND)
- ++count;
break;
case 49838: // Stop Time
spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO;
- ++count;
break;
case 61407: // Energize Cores
case 62136: // Energize Cores
case 54069: // Energize Cores
case 56251: // Energize Cores
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_AREA_ENTRY_SRC;
- ++count;
break;
case 50785: // Energize Cores
case 59372: // Energize Cores
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_AREA_ENEMY_SRC;
- ++count;
break;
case 3286: // Bind
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ENEMY;
spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_TARGET_ENEMY;
- ++count;
break;
case 8494: // Mana Shield (rank 2)
// because of bug in dbc
spellInfo->procChance = 0;
- ++count;
break;
case 32182: // Heroism
spellInfo->excludeCasterAuraSpell = 57723; // Exhaustion
- ++count;
break;
case 2825: // Bloodlust
spellInfo->excludeCasterAuraSpell = 57724; // Sated
- ++count;
break;
case 20335: // Heart of the Crusader
case 20336:
@@ -3960,69 +2942,16 @@ void SpellMgr::LoadSpellCustomAttr()
case 63320: // Glyph of Life Tap
// Entries were not updated after spell effect change, we have to do that manually :/
spellInfo->AttributesEx3 |= SPELL_ATTR3_CAN_PROC_WITH_TRIGGERED;
- ++count;
break;
case 16007: // Draco-Incarcinatrix 900
// was 46, but effect is aura effect
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_NEARBY_ENTRY;
spellInfo->EffectImplicitTargetB[0] = TARGET_DST_NEARBY_ENTRY;
- ++count;
- break;
- case 26029: // Dark Glare
- case 37433: // Spout
- case 43140: // Flame Breath
- case 43215: // Flame Breath
- case 70461: // Coldflame Trap
- mSpellCustomAttr[i] |= SPELL_ATTR0_CU_CONE_LINE;
- ++count;
- break;
- case 24340: // Meteor
- case 26558: // Meteor
- case 28884: // Meteor
- case 36837: // Meteor
- case 38903: // Meteor
- case 41276: // Meteor
- case 57467: // Meteor
- case 26789: // Shard of the Fallen Star
- case 31436: // Malevolent Cleave
- case 35181: // Dive Bomb
- case 40810: // Saber Lash
- case 43267: // Saber Lash
- case 43268: // Saber Lash
- case 42384: // Brutal Swipe
- case 45150: // Meteor Slash
- case 64688: // Sonic Screech
- case 72373: // Shared Suffering
- case 71904: // Chaos Bane
- case 70492: // Ooze Eruption
- case 72505: // Ooze Eruption
- case 72624: // Ooze Eruption
- case 72625: // Ooze Eruption
- // ONLY SPELLS WITH SPELLFAMILY_GENERIC and EFFECT_SCHOOL_DAMAGE
- mSpellCustomAttr[i] |= SPELL_ATTR0_CU_SHARE_DAMAGE;
- ++count;
break;
case 59725: // Improved Spell Reflection - aoe aura
// Target entry seems to be wrong for this spell :/
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_PARTY_CASTER;
spellInfo->EffectRadiusIndex[0] = 45;
- ++count;
- break;
- case 27820: // Mana Detonation
- case 69782: // Ooze Flood
- case 69796: // Ooze Flood
- case 69798: // Ooze Flood
- case 69801: // Ooze Flood
- case 69538: // Ooze Combine
- case 69553: // Ooze Combine
- case 69610: // Ooze Combine
- case 71447: // Bloodbolt Splash
- case 71481: // Bloodbolt Splash
- case 71482: // Bloodbolt Splash
- case 71483: // Bloodbolt Splash
- case 71390: // Pact of the Darkfallen
- mSpellCustomAttr[i] |= SPELL_ATTR0_CU_EXCLUDE_SELF;
- ++count;
break;
case 44978: case 45001: case 45002: // Wild Magic
case 45004: case 45006: case 45010: // Wild Magic
@@ -4042,14 +2971,12 @@ void SpellMgr::LoadSpellCustomAttr()
case 62374: // Pursued
case 61588: // Blazing Harpoon
spellInfo->MaxAffectedTargets = 1;
- ++count;
break;
case 52479: // Gift of the Harvester
spellInfo->MaxAffectedTargets = 1;
// a trap always has dst = src?
spellInfo->EffectImplicitTargetA[0] = TARGET_DST_CASTER;
spellInfo->EffectImplicitTargetA[1] = TARGET_DST_CASTER;
- ++count;
break;
case 41376: // Spite
case 39992: // Needle Spine
@@ -4065,12 +2992,10 @@ void SpellMgr::LoadSpellCustomAttr()
case 66588: // Flaming Spear
case 54171: // Divine Storm
spellInfo->MaxAffectedTargets = 3;
- ++count;
break;
case 38310: // Multi-Shot
case 53385: // Divine Storm (Damage)
spellInfo->MaxAffectedTargets = 4;
- ++count;
break;
case 42005: // Bloodboil
case 38296: // Spitfire Totem
@@ -4080,7 +3005,6 @@ void SpellMgr::LoadSpellCustomAttr()
case 55665: // Life Drain - Sapphiron (H)
case 28796: // Poison Bolt Volly - Faerlina
spellInfo->MaxAffectedTargets = 5;
- ++count;
break;
case 40827: // Sinful Beam
case 40859: // Sinister Beam
@@ -4089,16 +3013,13 @@ void SpellMgr::LoadSpellCustomAttr()
case 54835: // Curse of the Plaguebringer - Noth (H)
case 54098: // Poison Bolt Volly - Faerlina (H)
spellInfo->MaxAffectedTargets = 10;
- ++count;
break;
case 50312: // Unholy Frenzy
spellInfo->MaxAffectedTargets = 15;
- ++count;
break;
case 38794: case 33711: //Murmur's Touch
spellInfo->MaxAffectedTargets = 1;
spellInfo->EffectTriggerSpell[0] = 33760;
- ++count;
break;
case 17941: // Shadow Trance
case 22008: // Netherwind Focus
@@ -4113,20 +3034,16 @@ void SpellMgr::LoadSpellCustomAttr()
case 64823: // Item - Druid T8 Balance 4P Bonus
case 44401: // Missile Barrage
spellInfo->procCharges = 1;
- ++count;
break;
case 44544: // Fingers of Frost
spellInfo->EffectSpellClassMask[0] = flag96(685904631, 1151048, 0);
- ++count;
break;
case 74396: // Fingers of Frost visual buff
spellInfo->procCharges = 2;
spellInfo->StackAmount = 0;
- ++count;
break;
case 28200: // Ascendance (Talisman of Ascendance trinket)
spellInfo->procCharges = 6;
- ++count;
break;
case 47201: // Everlasting Affliction
case 47202:
@@ -4135,63 +3052,50 @@ void SpellMgr::LoadSpellCustomAttr()
case 47205:
// add corruption to affected spells
spellInfo->EffectSpellClassMask[1][0] |= 2;
- ++count;
break;
case 49305: // Teleport to Boss 1 DND
case 64981: // Summon Random Vanquished Tentacle
spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_CASTER;
- ++count;
break;
case 51852: // The Eye of Acherus (no spawn in phase 2 in db)
spellInfo->EffectMiscValue[0] |= 1;
- ++count;
break;
case 51904: // Summon Ghouls On Scarlet Crusade (core does not know the triggered spell is summon spell)
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER;
- ++count;
break;
case 29809: // Desecration Arm - 36 instead of 37 - typo? :/
spellInfo->EffectRadiusIndex[0] = 37;
- ++count;
break;
// Master Shapeshifter: missing stance data for forms other than bear - bear version has correct data
// To prevent aura staying on target after talent unlearned
case 48420:
spellInfo->Stances = 1 << (FORM_CAT - 1);
- ++count;
break;
case 48421:
spellInfo->Stances = 1 << (FORM_MOONKIN - 1);
- ++count;
break;
case 48422:
spellInfo->Stances = 1 << (FORM_TREE - 1);
- ++count;
break;
case 47569: // Improved Shadowform (Rank 1)
// with this spell atrribute aura can be stacked several times
spellInfo->Attributes &= ~SPELL_ATTR0_NOT_SHAPESHIFT;
- ++count;
break;
case 30421: // Nether Portal - Perseverence
spellInfo->EffectBasePoints[2] += 30000;
- ++count;
break;
case 16834: // Natural shapeshifter
case 16835:
spellInfo->DurationIndex = 21;
- ++count;
break;
case 51735: // Ebon Plague
case 51734:
case 51726:
spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS;
spellInfo->SpellFamilyFlags[2] = 0x10;
- ++count;
break;
case 41013: // Parasitic Shadowfiend Passive
spellInfo->EffectApplyAuraName[0] = 4; // proc debuff, and summon infinite fiends
- ++count;
break;
case 27892: // To Anchor 1
case 27928: // To Anchor 1
@@ -4200,11 +3104,9 @@ void SpellMgr::LoadSpellCustomAttr()
case 27931: // Anchor to Skulls
case 27937: // Anchor to Skulls
spellInfo->rangeIndex = 13;
- ++count;
break;
case 48743: // Death Pact
spellInfo->AttributesEx &= ~SPELL_ATTR1_CANT_TARGET_SELF;
- ++count;
break;
// 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
@@ -4212,39 +3114,17 @@ void SpellMgr::LoadSpellCustomAttr()
case 54836: // Wrath of the Plaguebringer
spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_AREA_ALLY_SRC;
spellInfo->EffectImplicitTargetB[1] = TARGET_UNIT_AREA_ALLY_SRC;
- ++count;
break;
case 31687: // Summon Water Elemental
// 322-330 switch - effect changed to dummy, target entry not changed in client:(
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER;
- ++count;
- break;
- case 18500: // Wing Buffet
- case 33086: // Wild Bite
- case 49749: // Piercing Blow
- case 52890: // Penetrating Strike
- case 53454: // Impale
- case 59446: // Impale
- case 62383: // Shatter
- case 64777: // Machine Gun
- case 65239: // Machine Gun
- case 65919: // Impale
- case 67858: // Impale
- case 67859: // Impale
- case 67860: // Impale
- case 69293: // Wing Buffet
- case 74439: // Machine Gun
- mSpellCustomAttr[i] |= SPELL_ATTR0_CU_IGNORE_ARMOR;
- ++count;
break;
case 63675: // Improved Devouring Plague
spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_DONE_BONUS;
- ++count;
break;
case 8145: // Tremor Totem (instant pulse)
case 6474: // Earthbind Totem (instant pulse)
spellInfo->AttributesEx5 |= SPELL_ATTR5_START_PERIODIC_AT_APPLY;
- ++count;
break;
case 53241: // Marked for Death (Rank 1)
case 53243: // Marked for Death (Rank 2)
@@ -4252,25 +3132,21 @@ void SpellMgr::LoadSpellCustomAttr()
case 53245: // Marked for Death (Rank 4)
case 53246: // Marked for Death (Rank 5)
spellInfo->EffectSpellClassMask[0] = flag96(423937, 276955137, 2049);
- ++count;
break;
case 70728: // Exploit Weakness
case 70840: // Devious Minds
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER;
spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_PET;
- ++count;
break;
case 70893: // Culling The Herd
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER;
spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_MASTER;
- ++count;
break;
case 54800: // Sigil of the Frozen Conscience - change class mask to custom extended flags of Icy Touch
// 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->EffectSpellClassMask[0] = flag96(0x00000040, 0x00000000, 0x00000000);
- ++count;
break;
case 19970: // Entangling Roots (Rank 6) -- Nature's Grasp Proc
case 19971: // Entangling Roots (Rank 5) -- Nature's Grasp Proc
@@ -4281,30 +3157,25 @@ void SpellMgr::LoadSpellCustomAttr()
case 27010: // Entangling Roots (Rank 7) -- Nature's Grasp Proc
case 53313: // Entangling Roots (Rank 8) -- Nature's Grasp Proc
spellInfo->CastingTimeIndex = 1;
- ++count;
break;
case 61719: // Easter Lay Noblegarden Egg Aura - Interrupt flags copied from aura which this aura is linked with
spellInfo->AuraInterruptFlags = AURA_INTERRUPT_FLAG_HITBYSPELL | AURA_INTERRUPT_FLAG_TAKE_DAMAGE;
- ++count;
break;
// ULDUAR SPELLS
//
case 63342: // Focused Eyebeam Summon Trigger (Kologarn)
spellInfo->MaxAffectedTargets = 1;
- ++count;
break;
case 62716: // Growth of Nature (Freya)
case 65584: // Growth of Nature (Freya)
case 64381: // Strength of the Pack (Auriaya)
spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS;
- ++count;
break;
case 63018: // Searing Light (XT-002)
case 65121: // Searing Light (25m) (XT-002)
case 63024: // Gravity Bomb (XT-002)
case 64234: // Gravity Bomb (25m) (XT-002)
spellInfo->MaxAffectedTargets = 1;
- ++count;
break;
case 62834: // Boom (XT-002)
// This hack is here because we suspect our implementation of spell effect execution on targets
@@ -4313,29 +3184,17 @@ void SpellMgr::LoadSpellCustomAttr()
// The above situation causes the visual for this spell to be bugged, so we remove the instakill
// effect and implement a script hack for that.
spellInfo->Effect[EFFECT_1] = 0;
- ++count;
break;
case 64386: // Terrifying Screech (Auriaya)
case 64389: // Sentinel Blast (Auriaya)
case 64678: // Sentinel Blast (Auriaya)
spellInfo->DurationIndex = 28; // 5 seconds, wrong DBC data?
- ++count;
- break;
- case 63278: // Mark of the Faceless (General Vezax)
- mSpellCustomAttr[i] |= SPELL_ATTR0_CU_IGNORE_ARMOR;
- ++count;
- break;
- case 64422: // Sonic Screech (Auriaya)
- mSpellCustomAttr[i] |= SPELL_ATTR0_CU_SHARE_DAMAGE;
- mSpellCustomAttr[i] |= SPELL_ATTR0_CU_IGNORE_ARMOR;
- ++count;
break;
case 64321: // Potent Pheromones (Freya)
// spell should dispel area aura, but doesn't have the attribute
// may be db data bug, or blizz may keep reapplying area auras every update with checking immunity
// that will be clear if we get more spells with problem like this
spellInfo->AttributesEx |= SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY;
- ++count;
break;
// ENDOF ULDUAR SPELLS
//
@@ -4346,7 +3205,6 @@ void SpellMgr::LoadSpellCustomAttr()
// increase duration from 15 to 18 seconds because caster is already
// unsummoned when spell missile hits the ground so nothing happen in result
spellInfo->DurationIndex = 85;
- ++count;
break;
// ENDOF TRIAL OF THE CRUSADER SPELLS
//
@@ -4363,12 +3221,10 @@ void SpellMgr::LoadSpellCustomAttr()
case 70860: // Frozen Throne Teleport
case 70861: // Sindragosa's Lair Teleport
spellInfo->EffectImplicitTargetA[0] = TARGET_DST_DB;
- ++count;
break;
case 69055: // Saber Lash (Lord Marrowgar)
case 70814: // Saber Lash (Lord Marrowgar)
spellInfo->EffectRadiusIndex[0] = 8; // 5yd
- ++count;
break;
case 69075: // Bone Storm (Lord Marrowgar)
case 70834: // Bone Storm (Lord Marrowgar)
@@ -4381,25 +3237,20 @@ void SpellMgr::LoadSpellCustomAttr()
case 71161: // Plague Stench (Stinky)
case 71123: // Decimate (Stinky & Precious)
spellInfo->EffectRadiusIndex[0] = 12; // 100yd
- ++count;
break;
case 72723: // Resistant Skin (Deathbringer Saurfang adds)
// this spell initially granted Shadow damage immunity, however it was removed but the data was left in client
spellInfo->Effect[2] = 0;
- ++count;
break;
case 70460: // Coldflame Jets (Traps after Saurfang)
spellInfo->DurationIndex = 1; // 10 seconds
- ++count;
break;
case 71413: // Green Ooze Summon (Professor Putricide)
case 71414: // Orange Ooze Summon (Professor Putricide)
spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST;
- ++count;
break;
case 71159: // Awaken Plagued Zombies
spellInfo->DurationIndex = 21;
- ++count;
break;
// THIS IS HERE BECAUSE COOLDOWN ON CREATURE PROCS IS NOT IMPLEMENTED
case 71604: // Mutated Strength (Professor Putricide)
@@ -4407,65 +3258,53 @@ void SpellMgr::LoadSpellCustomAttr()
case 72674: // Mutated Strength (Professor Putricide)
case 72675: // Mutated Strength (Professor Putricide)
spellInfo->Effect[1] = 0;
- ++count;
break;
case 70911: // Unbound Plague (Professor Putricide)
case 72854: // Unbound Plague (Professor Putricide)
case 72855: // Unbound Plague (Professor Putricide)
case 72856: // Unbound Plague (Professor Putricide)
spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_TARGET_ENEMY;
- ++count;
break;
case 71518: // Unholy Infusion Quest Credit (Professor Putricide)
case 72934: // Blood Infusion Quest Credit (Blood-Queen Lana'thel)
case 72289: // Frost Infusion Quest Credit (Sindragosa)
spellInfo->EffectRadiusIndex[0] = 28; // another missing radius
- ++count;
break;
case 71708: // Empowered Flare (Blood Prince Council)
case 72785: // Empowered Flare (Blood Prince Council)
case 72786: // Empowered Flare (Blood Prince Council)
case 72787: // Empowered Flare (Blood Prince Council)
spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_DONE_BONUS;
- ++count;
break;
case 71266: // Swarming Shadows
case 72890: // Swarming Shadows
spellInfo->AreaGroupId = 0; // originally, these require area 4522, which is... outside of Icecrown Citadel
- ++count;
break;
case 70602: // Corruption
spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS;
- ++count;
break;
case 70715: // Column of Frost (visual marker)
spellInfo->DurationIndex = 32; // 6 seconds (missing)
- ++count;
break;
case 71085: // Mana Void (periodic aura)
spellInfo->DurationIndex = 9; // 30 seconds (missing)
- ++count;
break;
case 70936: // Summon Suppressor
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY;
spellInfo->EffectImplicitTargetB[0] = 0;
- ++count;
break;
case 72706: // Achievement Check (Valithria Dreamwalker)
case 71357: // Order Whelp
spellInfo->EffectRadiusIndex[0] = 22; // 200yd
- ++count;
break;
case 70598: // Sindragosa's Fury
spellInfo->EffectImplicitTargetA[0] = TARGET_DST_CASTER;
- ++count;
break;
case 69846: // Frost Bomb
spellInfo->speed = 10;
spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_TARGET_ANY;
spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_TARGET_ANY;
spellInfo->Effect[1] = 0;
- ++count;
break;
default:
break;
@@ -4473,24 +3312,12 @@ void SpellMgr::LoadSpellCustomAttr()
switch (spellInfo->SpellFamilyName)
{
- case SPELLFAMILY_WARRIOR:
- // Shout
- if (spellInfo->SpellFamilyFlags[0] & 0x20000 || spellInfo->SpellFamilyFlags[1] & 0x20)
- mSpellCustomAttr[i] |= SPELL_ATTR0_CU_AURA_CC;
- else
- break;
- ++count;
- break;
case SPELLFAMILY_DRUID:
// Starfall Target Selection
if (spellInfo->SpellFamilyFlags[2] & 0x100)
spellInfo->MaxAffectedTargets = 2;
- // Roar
- else if (spellInfo->SpellFamilyFlags[0] & 0x8)
- mSpellCustomAttr[i] |= SPELL_ATTR0_CU_AURA_CC;
else
break;
- ++count;
break;
case SPELLFAMILY_PALADIN:
// Seals of the Pure should affect Seal of Righteousness
@@ -4498,13 +3325,11 @@ void SpellMgr::LoadSpellCustomAttr()
spellInfo->EffectSpellClassMask[0][1] |= 0x20000000;
else
break;
- ++count;
break;
case SPELLFAMILY_DEATHKNIGHT:
// Icy Touch - extend FamilyFlags (unused value) for Sigil of the Frozen Conscience to use
if (spellInfo->SpellIconID == 2721 && spellInfo->SpellFamilyFlags[0] & 0x2)
spellInfo->SpellFamilyFlags[0] |= 0x40;
- ++count;
break;
}
}
@@ -4514,118 +3339,6 @@ void SpellMgr::LoadSpellCustomAttr()
properties = const_cast<SummonPropertiesEntry*>(sSummonPropertiesStore.LookupEntry(647)); // 52893
properties->Type = SUMMON_TYPE_TOTEM;
- CreatureAI::FillAISpellInfo();
-
- sLog->outString(">> Loaded %u custom spell attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outString(">> Loading spell dbc data corrections in %u ms", GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
-}
-
-// Fill custom data about enchancments
-void SpellMgr::LoadEnchantCustomAttr()
-{
- uint32 oldMSTime = getMSTime();
-
- uint32 size = sSpellItemEnchantmentStore.GetNumRows();
- mEnchantCustomAttr.resize(size);
-
- uint32 count = 0;
-
- for (uint32 i = 0; i < size; ++i)
- mEnchantCustomAttr[i] = 0;
-
- for (uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i)
- {
- SpellEntry* spellInfo = (SpellEntry*)GetSpellStore()->LookupEntry(i);
- if (!spellInfo)
- continue;
-
- // TODO: find a better check
- if (!(spellInfo->AttributesEx2 & SPELL_ATTR2_UNK13) || !(spellInfo->Attributes & SPELL_ATTR0_NOT_SHAPESHIFT))
- continue;
-
- for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
- {
- if (spellInfo->Effect[j] == SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY)
- {
- uint32 enchId = spellInfo->EffectMiscValue[j];
- SpellItemEnchantmentEntry const* ench = sSpellItemEnchantmentStore.LookupEntry(enchId);
- if (!ench)
- continue;
- mEnchantCustomAttr[enchId] = true;
- ++count;
- break;
- }
- }
- }
-
- sLog->outString(">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
-}
-
-void SpellMgr::LoadSpellLinked()
-{
- uint32 oldMSTime = getMSTime();
-
- mSpellLinkedMap.clear(); // need for reload case
-
- // 0 1 2
- QueryResult result = WorldDatabase.Query("SELECT spell_trigger, spell_effect, type FROM spell_linked_spell");
- if (!result)
- {
- sLog->outString(">> Loaded 0 linked spells. DB table `spell_linked_spell` is empty.");
- sLog->outString();
- return;
- }
-
- uint32 count = 0;
-
- do
- {
- Field *fields = result->Fetch();
-
- int32 trigger = fields[0].GetInt32();
- int32 effect = fields[1].GetInt32();
- int32 type = fields[2].GetInt32();
-
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(abs(trigger));
- if (!spellInfo)
- {
- sLog->outErrorDb("Spell %u listed in `spell_linked_spell` does not exist", abs(trigger));
- continue;
- }
- spellInfo = sSpellStore.LookupEntry(abs(effect));
- if (!spellInfo)
- {
- sLog->outErrorDb("Spell %u listed in `spell_linked_spell` does not exist", abs(effect));
- continue;
- }
-
- if (trigger > 0)
- {
- switch (type)
- {
- case 0: mSpellCustomAttr[trigger] |= SPELL_ATTR0_CU_LINK_CAST; break;
- case 1: mSpellCustomAttr[trigger] |= SPELL_ATTR0_CU_LINK_HIT; break;
- case 2: mSpellCustomAttr[trigger] |= SPELL_ATTR0_CU_LINK_AURA; break;
- }
- }
- else
- {
- mSpellCustomAttr[-trigger] |= SPELL_ATTR0_CU_LINK_REMOVE;
- }
-
- if (type) //we will find a better way when more types are needed
- {
- if (trigger > 0)
- trigger += SPELL_LINKED_MAX_SPELLS * type;
- else
- trigger -= SPELL_LINKED_MAX_SPELLS * type;
- }
- mSpellLinkedMap[trigger].push_back(effect);
-
- ++count;
- } while (result->NextRow());
-
- sLog->outString(">> Loaded %u linked spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
-}
+} \ No newline at end of file
diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h
index a18592232cb..aea4313df0c 100755
--- a/src/server/game/Spells/SpellMgr.h
+++ b/src/server/game/Spells/SpellMgr.h
@@ -20,23 +20,16 @@
#define _SPELLMGR_H
// For static or at-server-startup loaded spell data
-// For more high level function for sSpellStore data
-#include <ace/Singleton.h>
+#include <ace/Singleton.h>
+#include "Common.h"
#include "SharedDefines.h"
-#include "SpellAuraDefines.h"
-#include "DBCStructure.h"
-#include "DBCStores.h"
-
-#include "UnorderedMap.h"
-
-#include "Player.h"
-
-#include <map>
+class SpellInfo;
class Player;
-class Spell;
-struct SpellModifier;
+class Unit;
+class ProcEventInfo;
+struct SkillLineAbilityEntry;
// only used in code
enum SpellCategories
@@ -48,32 +41,6 @@ enum SpellCategories
SPELLCATEGORY_DRINK = 59,
};
-enum SpellEffectTargetTypes
-{
- SPELL_REQUIRE_NONE,
- SPELL_REQUIRE_UNIT,
- SPELL_REQUIRE_DEST,
- SPELL_REQUIRE_ITEM,
- SPELL_REQUIRE_CASTER,
- SPELL_REQUIRE_GOBJECT,
-};
-
-enum SpellSelectTargetTypes
-{
- TARGET_TYPE_DEFAULT,
- TARGET_TYPE_UNIT_CASTER,
- TARGET_TYPE_UNIT_TARGET,
- TARGET_TYPE_UNIT_NEARBY,
- TARGET_TYPE_AREA_SRC,
- TARGET_TYPE_AREA_DST,
- TARGET_TYPE_AREA_CONE,
- TARGET_TYPE_DEST_CASTER,
- TARGET_TYPE_DEST_TARGET,
- TARGET_TYPE_DEST_DEST,
- TARGET_TYPE_DEST_SPECIAL,
- TARGET_TYPE_CHANNEL,
-};
-
//SpellFamilyFlags
enum SpellFamilyFlag
{
@@ -83,22 +50,14 @@ enum SpellFamilyFlag
// Rogue
SPELLFAMILYFLAG_ROGUE_VANISH = 0x00000800,
- SPELLFAMILYFLAG_ROGUE_STEALTH = 0x00400000,
- SPELLFAMILYFLAG_ROGUE_BACKSTAB = 0x00800004,
- SPELLFAMILYFLAG_ROGUE_SAP = 0x00000080,
- SPELLFAMILYFLAG_ROGUE_FEINT = 0x08000000,
- SPELLFAMILYFLAG_ROGUE_KIDNEYSHOT = 0x00200000,
- SPELLFAMILYFLAG1_ROGUE_HUNGERFORBLOOD = 0x01000000,
SPELLFAMILYFLAG_ROGUE_VAN_EVAS_SPRINT = 0x00000860, // Vanish, Evasion, Sprint
SPELLFAMILYFLAG1_ROGUE_COLDB_SHADOWSTEP = 0x00000240, // Cold Blood, Shadowstep
SPELLFAMILYFLAG_ROGUE_KICK = 0x00000010, // Kick
SPELLFAMILYFLAG1_ROGUE_DISMANTLE = 0x00100000, // Dismantle
SPELLFAMILYFLAG_ROGUE_BLADE_FLURRY = 0x40000000, // Blade Flurry
SPELLFAMILYFLAG1_ROGUE_BLADE_FLURRY = 0x00000800, // Blade Flurry
- //SPELLFAMILYFLAG_ROGUE__FINISHING_MOVE = 0x9003E0000LL,
// Warrior
- SPELLFAMILYFLAG_WARRIOR_SUNDERARMOR = 0x00004000,
SPELLFAMILYFLAG_WARRIOR_CHARGE = 0x00000001,
SPELLFAMILYFLAG_WARRIOR_SLAM = 0x00200000,
SPELLFAMILYFLAG_WARRIOR_EXECUTE = 0x20000000,
@@ -107,9 +66,6 @@ enum SpellFamilyFlag
// Warlock
SPELLFAMILYFLAG_WARLOCK_LIFETAP = 0x00040000,
- // Priest
- SPELLFAMILYFLAG1_PRIEST_PENANCE = 0x00800000,
-
// Druid
SPELLFAMILYFLAG2_DRUID_STARFALL = 0x00000100,
@@ -121,47 +77,16 @@ enum SpellFamilyFlag
SPELLFAMILYFLAG_SHAMAN_HEALING_STREAM = 0x00002000,
SPELLFAMILYFLAG_SHAMAN_MANA_SPRING = 0x00004000,
SPELLFAMILYFLAG2_SHAMAN_LAVA_LASH = 0x00000004,
- SPELLFAMILYFLAG_SHAMAN_FLAMETONGUE = 0x00200000,
SPELLFAMILYFLAG_SHAMAN_FIRE_NOVA = 0x28000000,
// Deathknight
SPELLFAMILYFLAG_DK_DEATH_STRIKE = 0x00000010,
- SPELLFAMILYFLAG1_DK_SCOURGE_STRIKE = 0x08000000,
SPELLFAMILYFLAG_DK_DEATH_COIL = 0x00002000,
- SPELLFAMILYFLAG1_DK_HUNGERING_COLD = 0x00001000,
// TODO: Figure out a more accurate name for the following familyflag(s)
SPELLFAMILYFLAG_SHAMAN_TOTEM_EFFECTS = 0x04000000, // Seems to be linked to most totems and some totem effects
};
-// Spell clasification
-enum SpellSpecific
-{
- SPELL_SPECIFIC_NORMAL = 0,
- SPELL_SPECIFIC_SEAL = 1,
- SPELL_SPECIFIC_AURA = 3,
- SPELL_SPECIFIC_STING = 4,
- SPELL_SPECIFIC_CURSE = 5,
- SPELL_SPECIFIC_ASPECT = 6,
- SPELL_SPECIFIC_TRACKER = 7,
- SPELL_SPECIFIC_WARLOCK_ARMOR = 8,
- SPELL_SPECIFIC_MAGE_ARMOR = 9,
- SPELL_SPECIFIC_ELEMENTAL_SHIELD = 10,
- SPELL_SPECIFIC_MAGE_POLYMORPH = 11,
- SPELL_SPECIFIC_JUDGEMENT = 13,
- SPELL_SPECIFIC_WARLOCK_CORRUPTION= 17,
- SPELL_SPECIFIC_FOOD = 19,
- SPELL_SPECIFIC_DRINK = 20,
- SPELL_SPECIFIC_FOOD_AND_DRINK = 21,
- SPELL_SPECIFIC_PRESENCE = 22,
- SPELL_SPECIFIC_CHARM = 23,
- SPELL_SPECIFIC_SCROLL = 24,
- SPELL_SPECIFIC_MAGE_ARCANE_BRILLANCE = 25,
- SPELL_SPECIFIC_WARRIOR_ENRAGE = 26,
- SPELL_SPECIFIC_PRIEST_DIVINE_SPIRIT = 27,
- SPELL_SPECIFIC_HAND = 28,
- SPELL_SPECIFIC_PHASE = 29,
-};
#define SPELL_LINKED_MAX_SPELLS 200000
@@ -173,387 +98,6 @@ enum SpellLinkedType
SPELL_LINK_REMOVE = 0,
};
-bool IsSpellRequiringFocusedTarget(SpellEntry const* spellInfo);
-Unit* GetTriggeredSpellCaster(SpellEntry const* spellInfo, Unit* caster, Unit* target);
-SpellSpecific GetSpellSpecific(SpellEntry const* spellInfo);
-AuraState GetSpellAuraState(SpellEntry const* spellInfo);
-
-// Different spell properties
-inline float GetSpellRadiusForHostile(SpellRadiusEntry const *radius) { return (radius ? radius->radiusHostile : 0); }
-inline float GetSpellRadiusForFriend(SpellRadiusEntry const *radius) { return (radius ? radius->radiusFriend : 0); }
-uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell* spell = NULL);
-uint32 GetDispelChance(Unit* auraCaster, Unit* target, uint32 spellId, bool offensive, bool *result);
-inline float GetSpellMinRangeForHostile(SpellRangeEntry const *range) { return (range ? range->minRangeHostile : 0); }
-inline float GetSpellMaxRangeForHostile(SpellRangeEntry const *range) { return (range ? range->maxRangeHostile : 0); }
-inline float GetSpellMinRangeForFriend(SpellRangeEntry const *range) { return (range ? range->minRangeFriend : 0); }
-inline float GetSpellMaxRangeForFriend(SpellRangeEntry const *range) { return (range ? range->maxRangeFriend : 0); }
-inline uint32 GetSpellRangeType(SpellRangeEntry const *range) { return (range ? range->type : 0); }
-inline uint32 GetSpellRecoveryTime(SpellEntry const *spellInfo) { return spellInfo->RecoveryTime > spellInfo->CategoryRecoveryTime ? spellInfo->RecoveryTime : spellInfo->CategoryRecoveryTime; }
-int32 GetSpellDuration(SpellEntry const *spellInfo);
-int32 GetSpellMaxDuration(SpellEntry const *spellInfo);
-inline float GetSpellRadius(SpellEntry const *spellInfo, uint32 effectIdx, bool positive)
-{
- return positive
- ? GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(spellInfo->EffectRadiusIndex[effectIdx]))
- : GetSpellRadiusForHostile(sSpellRadiusStore.LookupEntry(spellInfo->EffectRadiusIndex[effectIdx]));
-}
-
-inline float GetSpellMaxRange(SpellEntry const *spellInfo, bool positive)
-{
- return positive
- ? GetSpellMaxRangeForFriend(sSpellRangeStore.LookupEntry(spellInfo->rangeIndex))
- : GetSpellMaxRangeForHostile(sSpellRangeStore.LookupEntry(spellInfo->rangeIndex));
-}
-
-inline float GetSpellMinRange(SpellEntry const *spellInfo, bool positive)
-{
- return positive
- ? GetSpellMinRangeForFriend(sSpellRangeStore.LookupEntry(spellInfo->rangeIndex))
- : GetSpellMinRangeForHostile(sSpellRangeStore.LookupEntry(spellInfo->rangeIndex));
-}
-
-inline float GetSpellMinRange(uint32 id, bool positive)
-{
- SpellEntry const *spellInfo = GetSpellStore()->LookupEntry(id);
- if (!spellInfo) return 0;
- return GetSpellMinRange(spellInfo, positive);
-}
-
-inline float GetSpellMaxRange(uint32 id, bool positive)
-{
- SpellEntry const *spellInfo = GetSpellStore()->LookupEntry(id);
- if (!spellInfo) return 0;
- return GetSpellMaxRange(spellInfo, positive);
-}
-
-/*struct DispelEntry
-{
- uint64 casterGuid;
- uint32 spellId;
- Unit* caster;
- uint8 stackAmount;
-
- bool operator < (const DispelEntry & _Right) const
- {
- return (spellId != _Right.spellId ? spellId < _Right.spellId : casterGuid < _Right.casterGuid);
- }
-};*/
-
-inline bool IsSpellHaveEffect(SpellEntry const *spellInfo, SpellEffects effect)
-{
- for (int i= 0; i < MAX_SPELL_EFFECTS; ++i)
- if (SpellEffects(spellInfo->Effect[i]) == effect)
- return true;
- return false;
-}
-
-inline bool IsSpellHaveAura(SpellEntry const *spellInfo, AuraType aura)
-{
- for (int i= 0; i < MAX_SPELL_EFFECTS; ++i)
- if (AuraType(spellInfo->EffectApplyAuraName[i]) == aura)
- return true;
- return false;
-}
-
-//bool IsNoStackAuraDueToAura(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2);
-
-inline bool IsSealSpell(SpellEntry const *spellInfo)
-{
- //Collection of all the seal family flags. No other paladin spell has any of those.
- return spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN &&
- (spellInfo->SpellFamilyFlags[1] & 0x26000C00
- || spellInfo->SpellFamilyFlags[0] & 0x0A000000);
-}
-
-inline bool IsElementalShield(SpellEntry const *spellInfo)
-{
- // family flags 10 (Lightning), 42 (Earth), 37 (Water), proc shield from T2 8 pieces bonus
- return (spellInfo->SpellFamilyFlags[1] & 0x420
- || spellInfo->SpellFamilyFlags[0] & 0x00000400)
- || spellInfo->Id == 23552;
-}
-
-inline bool IsExplicitDiscoverySpell(SpellEntry const *spellInfo)
-{
- return (((spellInfo->Effect[0] == SPELL_EFFECT_CREATE_RANDOM_ITEM
- || spellInfo->Effect[0] == SPELL_EFFECT_CREATE_ITEM_2)
- && spellInfo->Effect[1] == SPELL_EFFECT_SCRIPT_EFFECT)
- || spellInfo->Id == 64323); // Book of Glyph Mastery (Effect0 == SPELL_EFFECT_SCRIPT_EFFECT without any other data)
-}
-
-inline bool IsLootCraftingSpell(SpellEntry const *spellInfo)
-{
- return (spellInfo->Effect[0] == SPELL_EFFECT_CREATE_RANDOM_ITEM ||
- // different random cards from Inscription (121==Virtuoso Inking Set category) r without explicit item
- (spellInfo->Effect[0] == SPELL_EFFECT_CREATE_ITEM_2 &&
- (spellInfo->TotemCategory[0] != 0 || spellInfo->EffectItemType[0]==0)));
-}
-
-inline bool IsQuestTameSpell(SpellEntry const* spellInfo)
-{
- return spellInfo->Effect[0] == SPELL_EFFECT_THREAT && spellInfo->Effect[1] == SPELL_EFFECT_APPLY_AURA && spellInfo->EffectApplyAuraName[1] == SPELL_AURA_DUMMY;
-}
-
-bool IsHigherHankOfSpell(uint32 spellId_1, uint32 spellId_2);
-bool IsSingleFromSpellSpecificPerCaster(SpellSpecific spellSpec1, SpellSpecific spellSpec2);
-bool IsSingleFromSpellSpecificPerTarget(SpellSpecific spellSpec1, SpellSpecific spellSpec2);
-bool IsPassiveSpell(uint32 spellId);
-bool IsPassiveSpell(SpellEntry const* spellInfo);
-bool IsAutocastableSpell(uint32 spellId);
-
-uint32 CalculatePowerCost(SpellEntry const* spellInfo, Unit const* caster, SpellSchoolMask schoolMask);
-
-inline bool IsPassiveSpellStackableWithRanks(SpellEntry const* spellProto)
-{
- if (!IsPassiveSpell(spellProto->Id))
- return false;
-
- return !IsSpellHaveEffect(spellProto, SPELL_EFFECT_APPLY_AURA);
-}
-
-inline bool IsMultiSlotAura(SpellEntry const* spellProto)
-{
- return IsPassiveSpell(spellProto) || spellProto->Id == 44413;
-}
-
-inline bool IsDeathPersistentSpell(SpellEntry const *spellInfo)
-{
- return spellInfo->AttributesEx3 & SPELL_ATTR3_DEATH_PERSISTENT;
-}
-
-inline bool IsRequiringDeadTargetSpell(SpellEntry const *spellInfo)
-{
- return spellInfo->AttributesEx3 & SPELL_ATTR3_REQUIRE_DEAD_TARGET;
-}
-
-inline bool IsAllowingDeadTargetSpell(SpellEntry const *spellInfo)
-{
- return spellInfo->AttributesEx2 & SPELL_ATTR2_ALLOW_DEAD_TARGET;
-}
-
-inline bool IsDeadTargetSpell(SpellEntry const *spellInfo)
-{
- return IsAllowingDeadTargetSpell(spellInfo) || IsRequiringDeadTargetSpell(spellInfo);
-}
-
-inline bool IsNonCombatSpell(SpellEntry const *spellInfo)
-{
- return (spellInfo->Attributes & SPELL_ATTR0_CANT_USED_IN_COMBAT) != 0;
-}
-
-bool IsPositiveSpell(uint32 spellId);
-bool IsPositiveEffect(uint32 spellId, uint32 effIndex);
-bool IsPositiveTarget(uint32 targetA, uint32 targetB);
-bool CanSpellDispelAura(SpellEntry const* dispelSpell, SpellEntry const* aura);
-bool CanSpellPierceImmuneAura(SpellEntry const* pierceSpell, SpellEntry const* aura);
-
-bool IsSingleTargetSpell(SpellEntry const* spellInfo);
-bool IsSingleTargetSpells(SpellEntry const* spellInfo1, SpellEntry const* spellInfo2);
-
-extern bool IsAreaEffectTarget[TOTAL_SPELL_TARGETS];
-extern SpellEffectTargetTypes EffectTargetType[TOTAL_SPELL_EFFECTS];
-extern SpellSelectTargetTypes SpellTargetType[TOTAL_SPELL_TARGETS];
-
-inline bool IsCasterSourceTarget(uint32 target)
-{
- switch (SpellTargetType[target])
- {
- case TARGET_TYPE_UNIT_CASTER:
- case TARGET_TYPE_AREA_SRC:
- case TARGET_TYPE_AREA_CONE:
- case TARGET_TYPE_DEST_CASTER:
- return true;
- default:
- break;
- }
- return false;
-}
-
-inline bool IsPositionTarget(uint32 target)
-{
- switch (SpellTargetType[target])
- {
- case TARGET_TYPE_DEST_CASTER:
- case TARGET_TYPE_DEST_TARGET:
- case TARGET_TYPE_DEST_DEST:
- return true;
- default:
- break;
- }
- return false;
-}
-
-inline bool IsSpellWithCasterSourceTargetsOnly(SpellEntry const* spellInfo)
-{
- for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
- {
- uint32 targetA = spellInfo->EffectImplicitTargetA[i];
- if (targetA && !IsCasterSourceTarget(targetA))
- return false;
-
- uint32 targetB = spellInfo->EffectImplicitTargetB[i];
- if (targetB && !IsCasterSourceTarget(targetB))
- return false;
-
- if (!targetA && !targetB)
- return false;
- }
- return true;
-}
-
-inline bool IsAreaOfEffectSpell(SpellEntry const *spellInfo)
-{
- if (IsAreaEffectTarget[spellInfo->EffectImplicitTargetA[0]] || IsAreaEffectTarget[spellInfo->EffectImplicitTargetB[0]])
- return true;
- if (IsAreaEffectTarget[spellInfo->EffectImplicitTargetA[1]] || IsAreaEffectTarget[spellInfo->EffectImplicitTargetB[1]])
- return true;
- if (IsAreaEffectTarget[spellInfo->EffectImplicitTargetA[2]] || IsAreaEffectTarget[spellInfo->EffectImplicitTargetB[2]])
- return true;
- return false;
-}
-
-inline bool IsAreaOfEffectSpellEffect(SpellEntry const *spellInfo, uint8 effIndex)
-{
- if (IsAreaEffectTarget[spellInfo->EffectImplicitTargetA[effIndex]] || IsAreaEffectTarget[spellInfo->EffectImplicitTargetB[effIndex]])
- return true;
- return false;
-}
-
-inline bool IsFarUnitTargetEffect(uint32 effect)
-{
- return (effect == SPELL_EFFECT_SUMMON_PLAYER);
-}
-
-inline bool IsFarDestTargetEffect(uint32 effect)
-{
- return (effect == SPELL_EFFECT_TELEPORT_UNITS);
-}
-
-inline bool IsAreaAuraEffect(uint32 effect)
-{
- if (effect == SPELL_EFFECT_APPLY_AREA_AURA_PARTY ||
- effect == SPELL_EFFECT_APPLY_AREA_AURA_RAID ||
- effect == SPELL_EFFECT_APPLY_AREA_AURA_FRIEND ||
- effect == SPELL_EFFECT_APPLY_AREA_AURA_ENEMY ||
- effect == SPELL_EFFECT_APPLY_AREA_AURA_PET ||
- effect == SPELL_EFFECT_APPLY_AREA_AURA_OWNER)
- return true;
- return false;
-}
-
-inline bool HasAreaAuraEffect(SpellEntry const *spellInfo)
-{
- for (uint8 i=0;i<MAX_SPELL_EFFECTS;++i)
- if (IsAreaAuraEffect(spellInfo->Effect[i]))
- return true;
- return false;
-}
-
-inline bool IsUnitOwnedAuraEffect(uint32 effect)
-{
- return (IsAreaAuraEffect(effect) || effect == SPELL_EFFECT_APPLY_AURA);
-}
-
-inline bool IsDispel(SpellEntry const *spellInfo)
-{
- //spellsteal is also dispel
- if (spellInfo->Effect[0] == SPELL_EFFECT_DISPEL ||
- spellInfo->Effect[1] == SPELL_EFFECT_DISPEL ||
- spellInfo->Effect[2] == SPELL_EFFECT_DISPEL)
- return true;
- return false;
-}
-
-inline bool IsDispelSpell(SpellEntry const *spellInfo)
-{
- //spellsteal is also dispel
- if (spellInfo->Effect[0] == SPELL_EFFECT_STEAL_BENEFICIAL_BUFF ||
- spellInfo->Effect[1] == SPELL_EFFECT_STEAL_BENEFICIAL_BUFF ||
- spellInfo->Effect[2] == SPELL_EFFECT_STEAL_BENEFICIAL_BUFF
- ||IsDispel(spellInfo))
- return true;
- return false;
-}
-
-inline bool isSpellBreakStealth(SpellEntry const* spellInfo)
-{
- return !(spellInfo->AttributesEx & SPELL_ATTR1_NOT_BREAK_STEALTH);
-}
-
-inline bool IsAutoRepeatRangedSpell(SpellEntry const* spellInfo)
-{
- return spellInfo->AttributesEx2 & SPELL_ATTR2_AUTOREPEAT_FLAG;
-}
-
-inline bool IsRangedWeaponSpell(SpellEntry const* spellInfo)
-{
- //spell->DmgClass == SPELL_DAMAGE_CLASS_RANGED should be checked outside
- return (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && !(spellInfo->SpellFamilyFlags[1] & 0x10000000)) // for 53352, cannot find better way
- || (spellInfo->EquippedItemSubClassMask & ITEM_SUBCLASS_MASK_WEAPON_RANGED);
-}
-
-SpellCastResult GetErrorAtShapeshiftedCast(SpellEntry const* spellInfo, uint32 form);
-
-inline bool IsChanneledSpell(SpellEntry const* spellInfo)
-{
- return (spellInfo->AttributesEx & (SPELL_ATTR1_CHANNELED_1 | SPELL_ATTR1_CHANNELED_2));
-}
-
-inline bool NeedsComboPoints(SpellEntry const* spellInfo)
-{
- return (spellInfo->AttributesEx & (SPELL_ATTR1_REQ_COMBO_POINTS1 | SPELL_ATTR1_REQ_COMBO_POINTS2));
-}
-
-inline SpellSchoolMask GetSpellSchoolMask(SpellEntry const* spellInfo)
-{
- return SpellSchoolMask(spellInfo->SchoolMask);
-}
-
-inline uint32 GetSpellMechanicMask(SpellEntry const* spellInfo, int32 effect)
-{
- uint32 mask = 0;
- if (spellInfo->Mechanic)
- mask |= 1<<spellInfo->Mechanic;
- if (spellInfo->EffectMechanic[effect])
- mask |= 1<<spellInfo->EffectMechanic[effect];
- return mask;
-}
-
-inline uint32 GetAllSpellMechanicMask(SpellEntry const* spellInfo)
-{
- uint32 mask = 0;
- if (spellInfo->Mechanic)
- mask |= 1<<spellInfo->Mechanic;
- for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (spellInfo->Effect[i] && spellInfo->EffectMechanic[i])
- mask |= 1<<spellInfo->EffectMechanic[i];
- return mask;
-}
-
-inline Mechanics GetEffectMechanic(SpellEntry const* spellInfo, int32 effect)
-{
- if (spellInfo->EffectMechanic[effect])
- return Mechanics(spellInfo->EffectMechanic[effect]);
- if (spellInfo->Mechanic)
- return Mechanics(spellInfo->Mechanic);
- return MECHANIC_NONE;
-}
-
-inline uint32 GetDispelMask(DispelType dispel)
-{
- // If dispel all
- if (dispel == DISPEL_ALL)
- return DISPEL_ALL_MASK;
- else
- return uint32(1 << dispel);
-}
-
-// Diminishing Returns interaction with spells
-DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto, bool triggered);
-bool IsDiminishingReturnsGroupDurationLimited(DiminishingGroup group);
-DiminishingReturnsType GetDiminishingReturnsGroupType(DiminishingGroup group);
-DiminishingLevels GetDiminishingReturnsMaxLevel(DiminishingGroup group);
-int32 GetDiminishingReturnsLimitDuration(DiminishingGroup group, SpellEntry const* spellproto);
// Spell proc event related declarations (accessed using SpellMgr functions)
enum ProcFlags
@@ -596,7 +140,43 @@ enum ProcFlags
PROC_FLAG_DONE_MAINHAND_ATTACK = 0x00400000, // 22 Done main-hand melee attacks (spell and autoattack)
PROC_FLAG_DONE_OFFHAND_ATTACK = 0x00800000, // 23 Done off-hand melee attacks (spell and autoattack)
- PROC_FLAG_DEATH = 0x01000000 // 24 Died in any way
+ PROC_FLAG_DEATH = 0x01000000, // 24 Died in any way
+
+ // flag masks
+ AUTO_ATTACK_PROC_FLAG_MASK = PROC_FLAG_DONE_MELEE_AUTO_ATTACK | PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK
+ | PROC_FLAG_DONE_RANGED_AUTO_ATTACK | PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK,
+
+ MELEE_PROC_FLAG_MASK = PROC_FLAG_DONE_MELEE_AUTO_ATTACK | PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK
+ | PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS | PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS
+ | PROC_FLAG_DONE_MAINHAND_ATTACK | PROC_FLAG_DONE_OFFHAND_ATTACK,
+
+ RANGED_PROC_FLAG_MASK = PROC_FLAG_DONE_RANGED_AUTO_ATTACK | PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK
+ | PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS | PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS,
+
+ SPELL_PROC_FLAG_MASK = PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS | PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS
+ | PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS | PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS
+ | PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS | PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_POS
+ | PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG | PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_NEG
+ | PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS
+ | PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG | PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG,
+
+ SPELL_CAST_PROC_FLAG_MASK = SPELL_PROC_FLAG_MASK | PROC_FLAG_DONE_TRAP_ACTIVATION | RANGED_PROC_FLAG_MASK,
+
+ PERIODIC_PROC_FLAG_MASK = PROC_FLAG_DONE_PERIODIC | PROC_FLAG_TAKEN_PERIODIC,
+
+ DONE_HIT_PROC_FLAG_MASK = PROC_FLAG_DONE_MELEE_AUTO_ATTACK | PROC_FLAG_DONE_RANGED_AUTO_ATTACK
+ | PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS | PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS
+ | PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS | PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG
+ | PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG
+ | PROC_FLAG_DONE_PERIODIC | PROC_FLAG_DONE_MAINHAND_ATTACK | PROC_FLAG_DONE_OFFHAND_ATTACK,
+
+ TAKEN_HIT_PROC_FLAG_MASK = PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK | PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK
+ | PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS | PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS
+ | PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_POS | PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_NEG
+ | PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG
+ | PROC_FLAG_TAKEN_PERIODIC | PROC_FLAG_TAKEN_DAMAGE,
+
+ REQ_SPELL_PHASE_PROC_FLAG_MASK = SPELL_PROC_FLAG_MASK & DONE_HIT_PROC_FLAG_MASK,
};
#define MELEE_BASED_TRIGGER_MASK (PROC_FLAG_DONE_MELEE_AUTO_ATTACK | \
@@ -608,69 +188,6 @@ enum ProcFlags
PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS | \
PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS)
-// flag masks
-#define AUTO_ATTACK_PROC_FLAG_MASK (PROC_FLAG_DONE_MELEE_AUTO_ATTACK | \
- PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK | \
- PROC_FLAG_DONE_RANGED_AUTO_ATTACK | \
- PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK)
-
-#define MELEE_PROC_FLAG_MASK (PROC_FLAG_DONE_MELEE_AUTO_ATTACK | \
- PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK | \
- PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS | \
- PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS | \
- PROC_FLAG_DONE_MAINHAND_ATTACK | \
- PROC_FLAG_DONE_OFFHAND_ATTACK)
-
-#define RANGED_PROC_FLAG_MASK (PROC_FLAG_DONE_RANGED_AUTO_ATTACK | \
- PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK | \
- PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS | \
- PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS)
-
-#define SPELL_PROC_FLAG_MASK (PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS | \
- PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS | \
- PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS | \
- PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS | \
- PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS | \
- PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_POS | \
- PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG | \
- PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_NEG | \
- PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS | \
- PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS | \
- PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG | \
- PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG)
-
-#define SPELL_CAST_PROC_FLAG_MASK (SPELL_PROC_FLAG_MASK | \
- PROC_FLAG_DONE_TRAP_ACTIVATION | \
- RANGED_PROC_FLAG_MASK)
-
-#define PERIODIC_PROC_FLAG_MASK (PROC_FLAG_DONE_PERIODIC | \
- PROC_FLAG_TAKEN_PERIODIC)
-
-#define DONE_HIT_PROC_FLAG_MASK (PROC_FLAG_DONE_MELEE_AUTO_ATTACK | \
- PROC_FLAG_DONE_RANGED_AUTO_ATTACK | \
- PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS | \
- PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS | \
- PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS | \
- PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG | \
- PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS | \
- PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG | \
- PROC_FLAG_DONE_PERIODIC | \
- PROC_FLAG_DONE_MAINHAND_ATTACK | \
- PROC_FLAG_DONE_OFFHAND_ATTACK )
-
-#define TAKEN_HIT_PROC_FLAG_MASK (PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK | \
- PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK | \
- PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS | \
- PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS | \
- PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_POS | \
- PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_NEG | \
- PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS | \
- PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG | \
- PROC_FLAG_TAKEN_PERIODIC | \
- PROC_FLAG_TAKEN_DAMAGE)
-
-#define REQ_SPELL_PHASE_PROC_FLAG_MASK (SPELL_PROC_FLAG_MASK & DONE_HIT_PROC_FLAG_MASK)
-
enum ProcFlagsExLegacy
{
PROC_EX_NONE = 0x0000000, // If none can tigger on Hit/Crit only (passive spells MUST defined by SpellFamily flag)
@@ -935,10 +452,10 @@ typedef std::pair<SpellAreaForAreaMap::const_iterator, SpellAreaForAreaMap::cons
// Spell rank chain (accessed using SpellMgr functions)
struct SpellChainNode
{
- uint32 prev;
- uint32 next;
- uint32 first;
- uint32 last;
+ SpellInfo const* prev;
+ SpellInfo const* next;
+ SpellInfo const* first;
+ SpellInfo const* last;
uint8 rank;
};
@@ -989,55 +506,20 @@ struct PetDefaultSpellsEntry
// < 0 for petspelldata id, > 0 for creature_id
typedef std::map<int32, PetDefaultSpellsEntry> PetDefaultSpellsMap;
-inline bool IsPrimaryProfessionSkill(uint32 skill)
-{
- SkillLineEntry const *pSkill = sSkillLineStore.LookupEntry(skill);
- if (!pSkill)
- return false;
+typedef std::vector<uint32> SpellCustomAttribute;
+typedef std::vector<bool> EnchantCustomAttribute;
- if (pSkill->categoryId != SKILL_CATEGORY_PROFESSION)
- return false;
+typedef std::vector<SpellInfo*> SpellInfoMap;
- return true;
-}
+typedef std::map<int32, std::vector<int32> > SpellLinkedMap;
+
+bool IsPrimaryProfessionSkill(uint32 skill);
inline bool IsProfessionSkill(uint32 skill)
{
return IsPrimaryProfessionSkill(skill) || skill == SKILL_FISHING || skill == SKILL_COOKING || skill == SKILL_FIRST_AID;
}
-enum SpellCustomAttributes
-{
- SPELL_ATTR0_CU_ENCHANT_PROC = 0x00000001,
- SPELL_ATTR0_CU_CONE_BACK = 0x00000002,
- SPELL_ATTR0_CU_CONE_LINE = 0x00000004,
- SPELL_ATTR0_CU_SHARE_DAMAGE = 0x00000008,
- SPELL_ATTR0_CU_NONE1 = 0x00000010, // UNUSED
- SPELL_ATTR0_CU_NONE2 = 0x00000020, // UNUSED
- SPELL_ATTR0_CU_AURA_CC = 0x00000040,
- SPELL_ATTR0_CU_DIRECT_DAMAGE = 0x00000100,
- SPELL_ATTR0_CU_CHARGE = 0x00000200,
- SPELL_ATTR0_CU_LINK_CAST = 0x00000400,
- SPELL_ATTR0_CU_LINK_HIT = 0x00000800,
- SPELL_ATTR0_CU_LINK_AURA = 0x00001000,
- SPELL_ATTR0_CU_LINK_REMOVE = 0x00002000,
- SPELL_ATTR0_CU_PICKPOCKET = 0x00004000,
- SPELL_ATTR0_CU_EXCLUDE_SELF = 0x00008000,
- SPELL_ATTR0_CU_NEGATIVE_EFF0 = 0x00010000,
- SPELL_ATTR0_CU_NEGATIVE_EFF1 = 0x00020000,
- SPELL_ATTR0_CU_NEGATIVE_EFF2 = 0x00040000,
- SPELL_ATTR0_CU_IGNORE_ARMOR = 0x00080000,
- SPELL_ATTR0_CU_REQ_TARGET_FACING_CASTER = 0x00100000,
- SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET = 0x00200000,
-
- SPELL_ATTR0_CU_NEGATIVE = SPELL_ATTR0_CU_NEGATIVE_EFF0 | SPELL_ATTR0_CU_NEGATIVE_EFF1 | SPELL_ATTR0_CU_NEGATIVE_EFF2,
-};
-
-typedef std::vector<uint32> SpellCustomAttribute;
-typedef std::vector<bool> EnchantCustomAttribute;
-
-typedef std::map<int32, std::vector<int32> > SpellLinkedMap;
-
inline bool IsProfessionOrRidingSkill(uint32 skill)
{
return IsProfessionSkill(skill) || skill == SKILL_RIDING;
@@ -1045,6 +527,13 @@ inline bool IsProfessionOrRidingSkill(uint32 skill)
bool IsPartOfSkillLine(uint32 skillId, uint32 spellId);
+// spell diminishing returns
+DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto, bool triggered);
+DiminishingReturnsType GetDiminishingReturnsGroupType(DiminishingGroup group);
+DiminishingLevels GetDiminishingReturnsMaxLevel(DiminishingGroup group);
+int32 GetDiminishingReturnsLimitDuration(DiminishingGroup group, SpellInfo const* spellproto);
+bool IsDiminishingReturnsGroupDurationLimited(DiminishingGroup group);
+
class SpellMgr
{
friend class ACE_Singleton<SpellMgr, ACE_Null_Mutex>;
@@ -1053,551 +542,147 @@ class SpellMgr
// Accessors (const or static functions)
public:
-
- bool IsAffectedByMod(SpellEntry const *spellInfo, SpellModifier *mod) const;
-
- SpellSpellGroupMapBounds GetSpellSpellGroupMapBounds(uint32 spell_id) const
- {
- spell_id = GetFirstSpellInChain(spell_id);
- return SpellSpellGroupMapBounds(mSpellSpellGroup.lower_bound(spell_id), mSpellSpellGroup.upper_bound(spell_id));
- }
- uint32 IsSpellMemberOfSpellGroup(uint32 spellid, SpellGroup groupid) const
- {
- SpellSpellGroupMapBounds spellGroup = GetSpellSpellGroupMapBounds(spellid);
- for (SpellSpellGroupMap::const_iterator itr = spellGroup.first; itr != spellGroup.second ; ++itr)
- {
- if (itr->second == groupid)
- return true;
- }
- return false;
- }
-
- SpellGroupSpellMapBounds GetSpellGroupSpellMapBounds(SpellGroup group_id) const
- {
- return SpellGroupSpellMapBounds(mSpellGroupSpell.lower_bound(group_id), mSpellGroupSpell.upper_bound(group_id));
- }
- void GetSetOfSpellsInSpellGroup(SpellGroup group_id, std::set<uint32>& foundSpells) const
- {
- std::set<SpellGroup> usedGroups;
- GetSetOfSpellsInSpellGroup(group_id, foundSpells, usedGroups);
- }
- void GetSetOfSpellsInSpellGroup(SpellGroup group_id, std::set<uint32>& foundSpells, std::set<SpellGroup>& usedGroups) const
- {
- if (usedGroups.find(group_id) != usedGroups.end())
- return;
- usedGroups.insert(group_id);
-
- SpellGroupSpellMapBounds groupSpell = GetSpellGroupSpellMapBounds(group_id);
- for (SpellGroupSpellMap::const_iterator itr = groupSpell.first; itr != groupSpell.second ; ++itr)
- {
- if (itr->second < 0)
- {
- SpellGroup currGroup = (SpellGroup)abs(itr->second);
- GetSetOfSpellsInSpellGroup(currGroup, foundSpells, usedGroups);
- }
- else
- {
- foundSpells.insert(itr->second);
- }
- }
- }
-
- SpellGroupStackRule CheckSpellGroupStackRules(uint32 spellid_1, uint32 spellid_2) const
- {
- spellid_1 = GetFirstSpellInChain(spellid_1);
- spellid_2 = GetFirstSpellInChain(spellid_2);
- if (spellid_1 == spellid_2)
- return SPELL_GROUP_STACK_RULE_DEFAULT;
- // find SpellGroups which are common for both spells
- SpellSpellGroupMapBounds spellGroup1 = GetSpellSpellGroupMapBounds(spellid_1);
- std::set<SpellGroup> groups;
- for (SpellSpellGroupMap::const_iterator itr = spellGroup1.first; itr != spellGroup1.second ; ++itr)
- {
- if (IsSpellMemberOfSpellGroup(spellid_2, itr->second))
- {
- bool add = true;
- SpellGroupSpellMapBounds groupSpell = GetSpellGroupSpellMapBounds(itr->second);
- for (SpellGroupSpellMap::const_iterator itr2 = groupSpell.first; itr2 != groupSpell.second ; ++itr2)
- {
- if (itr2->second < 0)
- {
- SpellGroup currGroup = (SpellGroup)abs(itr2->second);
- if (IsSpellMemberOfSpellGroup(spellid_1, currGroup) && IsSpellMemberOfSpellGroup(spellid_2, currGroup))
- {
- add = false;
- break;
- }
- }
- }
- if (add)
- groups.insert(itr->second);
- }
- }
-
- SpellGroupStackRule rule = SPELL_GROUP_STACK_RULE_DEFAULT;
-
- for (std::set<SpellGroup>::iterator itr = groups.begin() ; itr!= groups.end() ; ++itr)
- {
- SpellGroupStackMap::const_iterator found = mSpellGroupStack.find(*itr);
- if (found != mSpellGroupStack.end())
- rule = found->second;
- if (rule)
- break;
- }
- return rule;
- }
-
- uint16 GetSpellThreat(uint32 spellid) const
- {
- SpellThreatMap::const_iterator itr = mSpellThreatMap.find(spellid);
- if (itr == mSpellThreatMap.end())
- return 0;
-
- return itr->second;
- }
-
- // spell proc table
- SpellProcEntry const* GetSpellProcEntry(uint32 spellId) const
- {
- SpellProcMap::const_iterator itr = mSpellProcMap.find(spellId);
- if (itr != mSpellProcMap.end())
- return &itr->second;
- return NULL;
- }
-
- bool CanSpellTriggerProcOnEvent(SpellProcEntry const& procEntry, ProcEventInfo& eventInfo);
-
- // Spell proc events
- SpellProcEventEntry const* GetSpellProcEvent(uint32 spellId) const
- {
- SpellProcEventMap::const_iterator itr = mSpellProcEventMap.find(spellId);
- if (itr != mSpellProcEventMap.end())
- return &itr->second;
- return NULL;
- }
-
- bool IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellProcEvent, uint32 EventProcFlag, SpellEntry const* procSpell, uint32 procFlags, uint32 procExtra, bool active);
-
- SpellEnchantProcEntry const* GetSpellEnchantProcEvent(uint32 enchId) const
- {
- SpellEnchantProcEventMap::const_iterator itr = mSpellEnchantProcEventMap.find(enchId);
- if (itr != mSpellEnchantProcEventMap.end())
- return &itr->second;
- return NULL;
- }
-
- // Spell bonus data
- SpellBonusEntry const* GetSpellBonusData(uint32 spellId) const
- {
- // Lookup data
- SpellBonusMap::const_iterator itr = mSpellBonusMap.find(spellId);
- if (itr != mSpellBonusMap.end())
- return &itr->second;
- // Not found, try lookup for 1 spell rank if exist
- if (uint32 rank_1 = GetFirstSpellInChain(spellId))
- {
- SpellBonusMap::const_iterator itr2 = mSpellBonusMap.find(rank_1);
- if (itr2 != mSpellBonusMap.end())
- return &itr2->second;
- }
- return NULL;
- }
-
- uint32 GetSpellIdForDifficulty(uint32 spellId, Unit* caster) const
- {
- if (!sSpellStore.LookupEntry(spellId))
- return spellId;
-
- if (!caster || !caster->GetMap() || !caster->GetMap()->IsDungeon())
- return spellId;
-
- uint32 mode = uint32(caster->GetMap()->GetSpawnMode());
- if (mode >= MAX_DIFFICULTY)
- {
- sLog->outError("SpellMgr::GetSpellIdForDifficulty: Incorrect Difficulty for spell %u.", spellId);
- return spellId; //return source spell
- }
-
- uint32 difficultyId = GetSpellDifficultyId(spellId);
- if (!difficultyId)
- return spellId; //return source spell, it has only REGULAR_DIFFICULTY
-
- SpellDifficultyEntry const *difficultyEntry = sSpellDifficultyStore.LookupEntry(difficultyId);
- if (!difficultyEntry)
- {
- sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellIdForDifficulty: SpellDifficultyEntry not found for spell %u. This should never happen.", spellId);
- return spellId; //return source spell
- }
-
- if (difficultyEntry->SpellID[mode] <= 0 && mode > DUNGEON_DIFFICULTY_HEROIC)
- {
- sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellIdForDifficulty: spell %u mode %u spell is NULL, using mode %u", spellId, mode, mode - 2);
- mode -= 2;
- }
-
- if (difficultyEntry->SpellID[mode] <= 0)
- {
- sLog->outErrorDb("SpellMgr::GetSpellIdForDifficulty: spell %u mode %u spell is 0. Check spelldifficulty_dbc!", spellId, mode);
- return spellId;
- }
-
- sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellIdForDifficulty: spellid for spell %u in mode %u is %d", spellId, mode, difficultyEntry->SpellID[mode]);
- return uint32(difficultyEntry->SpellID[mode]);
- }
-
- // Spell Difficulty data
- SpellEntry const* GetSpellForDifficultyFromSpell(SpellEntry const* spell, Unit* caster) const
- {
- uint32 newSpellId = GetSpellIdForDifficulty(spell->Id, caster);
- SpellEntry const* newSpell = sSpellStore.LookupEntry(newSpellId);
- if (!newSpell)
- {
- sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellForDifficultyFromSpell: spell %u not found in sSpellStore. Check spelldifficulty_dbc!", newSpellId);
- return spell;
- }
-
- sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellForDifficultyFromSpell: Spell id for instance mode is %u (original %u)", newSpell->Id, spell->Id);
- return newSpell;
- }
-
- // Spell target coordinates
- SpellTargetPosition const* GetSpellTargetPosition(uint32 spell_id) const
- {
- SpellTargetPositionMap::const_iterator itr = mSpellTargetPositions.find(spell_id);
- if (itr != mSpellTargetPositions.end())
- return &itr->second;
- return NULL;
- }
-
- // Spell ranks chains
- SpellChainNode const* GetSpellChainNode(uint32 spell_id) const
- {
- SpellChainMap::const_iterator itr = mSpellChains.find(spell_id);
- if (itr == mSpellChains.end())
- return NULL;
-
- return &itr->second;
- }
-
- uint32 GetFirstSpellInChain(uint32 spell_id) const
- {
- if (SpellChainNode const* node = GetSpellChainNode(spell_id))
- return node->first;
-
- return spell_id;
- }
-
+ // Spell correctess for client using
+ static bool IsSpellValid(SpellInfo const* spellInfo, Player* pl = NULL, bool msg = true);
+
+ // Spell difficulty
+ uint32 GetSpellDifficultyId(uint32 spellId) const;
+ void SetSpellDifficultyId(uint32 spellId, uint32 id);
+ uint32 GetSpellIdForDifficulty(uint32 spellId, Unit* caster) const;
+ SpellInfo const* GetSpellForDifficultyFromSpell(SpellInfo const* spell, Unit* caster) const;
+
+ // Spell Ranks table
+ SpellChainNode const* GetSpellChainNode(uint32 spell_id) const;
+ uint32 GetFirstSpellInChain(uint32 spell_id) const;
+ uint32 GetLastSpellInChain(uint32 spell_id) const;
+ uint32 GetNextSpellInChain(uint32 spell_id) const;
+ uint32 GetPrevSpellInChain(uint32 spell_id) const;
+ uint8 GetSpellRank(uint32 spell_id) const;
// not strict check returns provided spell if rank not avalible
- uint32 GetSpellWithRank(uint32 spell_id, uint32 rank, bool strict = false) const
- {
- if (SpellChainNode const* node = GetSpellChainNode(spell_id))
- {
- if (rank != node->rank)
- return GetSpellWithRank(node->rank < rank ? node->next : node->prev, rank, strict);
- }
- else if (strict && rank > 1)
- return 0;
- return spell_id;
- }
+ uint32 GetSpellWithRank(uint32 spell_id, uint32 rank, bool strict = false) const;
- uint32 GetPrevSpellInChain(uint32 spell_id) const
- {
- if (SpellChainNode const* node = GetSpellChainNode(spell_id))
- return node->prev;
-
- return 0;
- }
-
- uint32 GetNextSpellInChain(uint32 spell_id) const
- {
- if (SpellChainNode const* node = GetSpellChainNode(spell_id))
- return node->next;
-
- return 0;
- }
-
- SpellRequiredMapBounds GetSpellsRequiredForSpellBounds(uint32 spell_id) const
- {
- return SpellRequiredMapBounds(mSpellReq.lower_bound(spell_id), mSpellReq.upper_bound(spell_id));
- }
-
- SpellsRequiringSpellMapBounds GetSpellsRequiringSpellBounds(uint32 spell_id) const
- {
- return SpellsRequiringSpellMapBounds(mSpellsReqSpell.lower_bound(spell_id), mSpellsReqSpell.upper_bound(spell_id));
- }
- bool IsSpellRequiringSpell(uint32 spellid, uint32 req_spellid) const
- {
- SpellsRequiringSpellMapBounds spellsRequiringSpell = GetSpellsRequiringSpellBounds(req_spellid);
- for (SpellsRequiringSpellMap::const_iterator itr = spellsRequiringSpell.first; itr != spellsRequiringSpell.second; ++itr)
- {
- if (itr->second == spellid)
- return true;
- }
- return false;
- }
-
- uint8 GetSpellRank(uint32 spell_id) const
- {
- if (SpellChainNode const* node = GetSpellChainNode(spell_id))
- return node->rank;
-
- return 0;
- }
-
- uint32 GetLastSpellInChain(uint32 spell_id) const
- {
- if (SpellChainNode const* node = GetSpellChainNode(spell_id))
- return node->last;
-
- return spell_id;
- }
-
- bool IsArenaAllowedEnchancment(uint32 ench_id) const
- {
- return mEnchantCustomAttr[ench_id];
- }
-
- uint8 IsHighRankOfSpell(uint32 spell1, uint32 spell2) const
- {
- SpellChainMap::const_iterator itr1 = mSpellChains.find(spell1);
- SpellChainMap::const_iterator itr2 = mSpellChains.find(spell2);
- if (itr1 == mSpellChains.end() || itr2 == mSpellChains.end())
- return false;
-
- if (itr1->second.first == itr2->second.first)
- if (itr1->second.rank > itr2->second.rank)
- return true;
- return false;
- }
-
- bool IsRankSpellDueToSpell(SpellEntry const *spellInfo_1, uint32 spellId_2) const;
- static bool canStackSpellRanks(SpellEntry const *spellInfo);
- bool CanAurasStack(Aura const *aura1, Aura const *aura2, bool sameCaster) const;
-
- SpellEntry const* SelectAuraRankForPlayerLevel(SpellEntry const* spellInfo, uint32 playerLevel) const;
+ // Spell Required table
+ SpellRequiredMapBounds GetSpellsRequiredForSpellBounds(uint32 spell_id) const;
+ SpellsRequiringSpellMapBounds GetSpellsRequiringSpellBounds(uint32 spell_id) const;
+ bool IsSpellRequiringSpell(uint32 spellid, uint32 req_spellid) const;
+ const SpellsRequiringSpellMap GetSpellsRequiringSpell();
+ uint32 GetSpellRequired(uint32 spell_id) const;
// Spell learning
- SpellLearnSkillNode const* GetSpellLearnSkill(uint32 spell_id) const
- {
- SpellLearnSkillMap::const_iterator itr = mSpellLearnSkills.find(spell_id);
- if (itr != mSpellLearnSkills.end())
- return &itr->second;
- else
- return NULL;
- }
-
- bool IsSpellLearnSpell(uint32 spell_id) const
- {
- return mSpellLearnSpells.find(spell_id) != mSpellLearnSpells.end();
- }
-
- SpellLearnSpellMapBounds GetSpellLearnSpellMapBounds(uint32 spell_id) const
- {
- return SpellLearnSpellMapBounds(mSpellLearnSpells.lower_bound(spell_id), mSpellLearnSpells.upper_bound(spell_id));
- }
-
- bool IsSpellLearnToSpell(uint32 spell_id1, uint32 spell_id2) const
- {
- SpellLearnSpellMapBounds bounds = GetSpellLearnSpellMapBounds(spell_id1);
- for (SpellLearnSpellMap::const_iterator i = bounds.first; i != bounds.second; ++i)
- if (i->second.spell == spell_id2)
- return true;
- return false;
- }
-
- static bool IsProfessionOrRidingSpell(uint32 spellId);
- static bool IsProfessionSpell(uint32 spellId);
- static bool IsPrimaryProfessionSpell(uint32 spellId);
- bool IsPrimaryProfessionFirstRankSpell(uint32 spellId) const;
-
- bool IsSkillBonusSpell(uint32 spellId) const;
- bool IsSkillTypeSpell(uint32 spellId, SkillType type) const;
- static int32 CalculateSpellEffectAmount(SpellEntry const* spellEntry, uint8 effIndex, Unit const* caster = NULL, int32 const* basePoints = NULL, Unit const* target = NULL);
- static int32 CalculateSpellEffectBaseAmount(int32 value, SpellEntry const* spellEntry, uint8 effIndex);
- static float CalculateSpellEffectValueMultiplier(SpellEntry const* spellEntry, uint8 effIndex, Unit* caster, Spell* spell = NULL);
- static float CalculateSpellEffectDamageMultiplier(SpellEntry const* spellEntry, uint8 effIndex, Unit* caster, Spell* spell = NULL);
-
- // Spell correctess for client using
- static bool IsSpellValid(SpellEntry const* spellInfo, Player* pl = NULL, bool msg = true);
-
- SkillLineAbilityMapBounds GetSkillLineAbilityMapBounds(uint32 spell_id) const
- {
- return SkillLineAbilityMapBounds(mSkillLineAbilityMap.lower_bound(spell_id), mSkillLineAbilityMap.upper_bound(spell_id));
- }
+ SpellLearnSkillNode const* GetSpellLearnSkill(uint32 spell_id) const;
+ SpellLearnSpellMapBounds GetSpellLearnSpellMapBounds(uint32 spell_id) const;
+ bool IsSpellLearnSpell(uint32 spell_id) const;
+ bool IsSpellLearnToSpell(uint32 spell_id1, uint32 spell_id2) const;
- PetAura const* GetPetAura(uint32 spell_id, uint8 eff)
- {
- SpellPetAuraMap::const_iterator itr = mSpellPetAuraMap.find((spell_id<<8) + eff);
- if (itr != mSpellPetAuraMap.end())
- return &itr->second;
- else
- return NULL;
- }
+ // Spell target coordinates
+ SpellTargetPosition const* GetSpellTargetPosition(uint32 spell_id) const;
- PetLevelupSpellSet const* GetPetLevelupSpellList(uint32 petFamily) const
- {
- PetLevelupSpellMap::const_iterator itr = mPetLevelupSpellMap.find(petFamily);
- if (itr != mPetLevelupSpellMap.end())
- return &itr->second;
- else
- return NULL;
- }
+ // Spell Groups table
+ SpellSpellGroupMapBounds GetSpellSpellGroupMapBounds(uint32 spell_id) const;
+ uint32 IsSpellMemberOfSpellGroup(uint32 spellid, SpellGroup groupid) const;
- uint32 GetSpellCustomAttr(uint32 spell_id) const
- {
- if (spell_id >= mSpellCustomAttr.size())
- return 0;
- else
- return mSpellCustomAttr[spell_id];
- }
+ SpellGroupSpellMapBounds GetSpellGroupSpellMapBounds(SpellGroup group_id) const;
+ void GetSetOfSpellsInSpellGroup(SpellGroup group_id, std::set<uint32>& foundSpells) const;
+ void GetSetOfSpellsInSpellGroup(SpellGroup group_id, std::set<uint32>& foundSpells, std::set<SpellGroup>& usedGroups) const;
- const std::vector<int32> *GetSpellLinked(int32 spell_id) const
- {
- SpellLinkedMap::const_iterator itr = mSpellLinkedMap.find(spell_id);
- return itr != mSpellLinkedMap.end() ? &(itr->second) : NULL;
- }
+ // Spell Group Stack Rules table
+ SpellGroupStackRule CheckSpellGroupStackRules(SpellInfo const* spellInfo1, SpellInfo const* spellInfo2) const;
- // < 0 for petspelldata id, > 0 for creature_id
- PetDefaultSpellsEntry const* GetPetDefaultSpellsEntry(int32 id) const
- {
- PetDefaultSpellsMap::const_iterator itr = mPetDefaultSpellsMap.find(id);
- if (itr != mPetDefaultSpellsMap.end())
- return &itr->second;
- return NULL;
- }
+ // Spell proc event table
+ SpellProcEventEntry const* GetSpellProcEvent(uint32 spellId) const;
+ bool IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellProcEvent, uint32 EventProcFlag, SpellInfo const* procSpell, uint32 procFlags, uint32 procExtra, bool active);
- SpellCastResult GetSpellAllowedInLocationError(SpellEntry const *spellInfo, uint32 map_id, uint32 zone_id, uint32 area_id, Player const* player = NULL);
+ // Spell proc table
+ SpellProcEntry const* GetSpellProcEntry(uint32 spellId) const;
+ bool CanSpellTriggerProcOnEvent(SpellProcEntry const& procEntry, ProcEventInfo& eventInfo);
- SpellAreaMapBounds GetSpellAreaMapBounds(uint32 spell_id) const
- {
- return SpellAreaMapBounds(mSpellAreaMap.lower_bound(spell_id), mSpellAreaMap.upper_bound(spell_id));
- }
+ // Spell bonus data table
+ SpellBonusEntry const* GetSpellBonusData(uint32 spellId) const;
- SpellAreaForQuestMapBounds GetSpellAreaForQuestMapBounds(uint32 quest_id, bool active) const
- {
- if (active)
- return SpellAreaForQuestMapBounds(mSpellAreaForActiveQuestMap.lower_bound(quest_id), mSpellAreaForActiveQuestMap.upper_bound(quest_id));
- else
- return SpellAreaForQuestMapBounds(mSpellAreaForQuestMap.lower_bound(quest_id), mSpellAreaForQuestMap.upper_bound(quest_id));
- }
+ // Spell threat table
+ uint16 GetSpellThreat(uint32 spellid) const;
- SpellAreaForQuestMapBounds GetSpellAreaForQuestEndMapBounds(uint32 quest_id) const
- {
- return SpellAreaForQuestMapBounds(mSpellAreaForQuestEndMap.lower_bound(quest_id), mSpellAreaForQuestEndMap.upper_bound(quest_id));
- }
+ SkillLineAbilityMapBounds GetSkillLineAbilityMapBounds(uint32 spell_id) const;
- SpellAreaForAuraMapBounds GetSpellAreaForAuraMapBounds(uint32 spell_id) const
- {
- return SpellAreaForAuraMapBounds(mSpellAreaForAuraMap.lower_bound(spell_id), mSpellAreaForAuraMap.upper_bound(spell_id));
- }
+ PetAura const* GetPetAura(uint32 spell_id, uint8 eff);
- SpellAreaForAreaMapBounds GetSpellAreaForAreaMapBounds(uint32 area_id) const
- {
- return SpellAreaForAreaMapBounds(mSpellAreaForAreaMap.lower_bound(area_id), mSpellAreaForAreaMap.upper_bound(area_id));
- }
-
- bool IsSrcTargetSpell(SpellEntry const *spellInfo) const;
-
- inline bool IsCasterSourceTarget(uint32 target)
- {
- switch (SpellTargetType[target])
- {
- case TARGET_TYPE_UNIT_TARGET:
- case TARGET_TYPE_DEST_TARGET:
- return false;
- default:
- break;
- }
- return true;
- }
-
- inline bool IsSpellWithCasterSourceTargetsOnly(SpellEntry const* spellInfo)
- {
- for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (uint32 target = spellInfo->EffectImplicitTargetA[i])
- if (!IsCasterSourceTarget(target))
- return false;
- return true;
- }
- uint32 GetSpellDifficultyId(uint32 spellId) const
- {
- SpellDifficultySearcherMap::const_iterator i = mSpellDifficultySearcherMap.find(spellId);
- return i == mSpellDifficultySearcherMap.end() ? 0 : (*i).second;
- }
- void SetSpellDifficultyId(uint32 spellId, uint32 id) { mSpellDifficultySearcherMap[spellId] = id; }
+ SpellEnchantProcEntry const* GetSpellEnchantProcEvent(uint32 enchId) const;
+ bool IsArenaAllowedEnchancment(uint32 ench_id) const;
- const SpellsRequiringSpellMap GetSpellsRequiringSpell()
- {
- return this->mSpellsReqSpell;
- }
+ const std::vector<int32> *GetSpellLinked(int32 spell_id) const;
- uint32 GetSpellRequired(uint32 spell_id) const
- {
- SpellRequiredMap::const_iterator itr = mSpellReq.find(spell_id);
+ PetLevelupSpellSet const* GetPetLevelupSpellList(uint32 petFamily) const;
+ PetDefaultSpellsEntry const* GetPetDefaultSpellsEntry(int32 id) const;
- if (itr == mSpellReq.end())
- return 0;
+ // Spell area
+ SpellAreaMapBounds GetSpellAreaMapBounds(uint32 spell_id) const;
+ SpellAreaForQuestMapBounds GetSpellAreaForQuestMapBounds(uint32 quest_id, bool active) const;
+ SpellAreaForQuestMapBounds GetSpellAreaForQuestEndMapBounds(uint32 quest_id) const;
+ SpellAreaForAuraMapBounds GetSpellAreaForAuraMapBounds(uint32 spell_id) const;
+ SpellAreaForAreaMapBounds GetSpellAreaForAreaMapBounds(uint32 area_id) const;
- return itr->second;
- }
+ // SpellInfo object management
+ SpellInfo const* GetSpellInfo(uint32 spellId) const { return spellId < GetSpellInfoStoreSize() ? mSpellInfoMap[spellId] : NULL; }
+ uint32 GetSpellInfoStoreSize() const { return mSpellInfoMap.size(); }
// Modifiers
public:
// Loading data at server startup
+ void LoadSpellInfos();
void LoadSpellRanks();
void LoadSpellRequired();
void LoadSpellLearnSkills();
void LoadSpellLearnSpells();
+ void LoadSpellTargetPositions();
void LoadSpellGroups();
+ void LoadSpellGroupStackRules();
void LoadSpellProcEvents();
void LoadSpellProcs();
void LoadSpellBonusess();
- void LoadSpellTargetPositions();
void LoadSpellThreats();
void LoadSkillLineAbilityMap();
void LoadSpellPetAuras();
- void LoadSpellCustomAttr();
void LoadEnchantCustomAttr();
void LoadSpellEnchantProcData();
void LoadSpellLinked();
void LoadPetLevelupSpellMap();
void LoadPetDefaultSpells();
void LoadSpellAreas();
- void LoadSpellGroupStackRules();
+ void LoadSpellInfoStore();
+ void UnloadSpellInfoStore();
+ void LoadSpellCustomAttr();
+ void LoadDbcDataCorrections();
private:
- bool _isPositiveSpell(uint32 spellId, bool deep) const;
- bool _isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) const;
-
- SpellChainMap mSpellChains;
- SpellsRequiringSpellMap mSpellsReqSpell;
- SpellRequiredMap mSpellReq;
- SpellLearnSkillMap mSpellLearnSkills;
- SpellLearnSpellMap mSpellLearnSpells;
- SpellTargetPositionMap mSpellTargetPositions;
- SpellSpellGroupMap mSpellSpellGroup;
- SpellGroupSpellMap mSpellGroupSpell;
- SpellThreatMap mSpellThreatMap;
- SpellProcEventMap mSpellProcEventMap;
- SpellProcMap mSpellProcMap;
- SpellBonusMap mSpellBonusMap;
- SkillLineAbilityMap mSkillLineAbilityMap;
- SpellPetAuraMap mSpellPetAuraMap;
- SpellCustomAttribute mSpellCustomAttr;
- SpellLinkedMap mSpellLinkedMap;
- SpellGroupStackMap mSpellGroupStack;
- SpellEnchantProcEventMap mSpellEnchantProcEventMap;
- EnchantCustomAttribute mEnchantCustomAttr;
- PetLevelupSpellMap mPetLevelupSpellMap;
- PetDefaultSpellsMap mPetDefaultSpellsMap; // only spells not listed in related mPetLevelupSpellMap entry
- SpellAreaMap mSpellAreaMap;
- SpellAreaForQuestMap mSpellAreaForQuestMap;
- SpellAreaForQuestMap mSpellAreaForActiveQuestMap;
- SpellAreaForQuestMap mSpellAreaForQuestEndMap;
- SpellAreaForAuraMap mSpellAreaForAuraMap;
- SpellAreaForAreaMap mSpellAreaForAreaMap;
SpellDifficultySearcherMap mSpellDifficultySearcherMap;
+ SpellChainMap mSpellChains;
+ SpellsRequiringSpellMap mSpellsReqSpell;
+ SpellRequiredMap mSpellReq;
+ SpellLearnSkillMap mSpellLearnSkills;
+ SpellLearnSpellMap mSpellLearnSpells;
+ SpellTargetPositionMap mSpellTargetPositions;
+ SpellSpellGroupMap mSpellSpellGroup;
+ SpellGroupSpellMap mSpellGroupSpell;
+ SpellGroupStackMap mSpellGroupStack;
+ SpellProcEventMap mSpellProcEventMap;
+ SpellProcMap mSpellProcMap;
+ SpellBonusMap mSpellBonusMap;
+ SpellThreatMap mSpellThreatMap;
+ SpellPetAuraMap mSpellPetAuraMap;
+ SpellLinkedMap mSpellLinkedMap;
+ SpellEnchantProcEventMap mSpellEnchantProcEventMap;
+ EnchantCustomAttribute mEnchantCustomAttr;
+ SpellAreaMap mSpellAreaMap;
+ SpellAreaForQuestMap mSpellAreaForQuestMap;
+ SpellAreaForQuestMap mSpellAreaForActiveQuestMap;
+ SpellAreaForQuestMap mSpellAreaForQuestEndMap;
+ SpellAreaForAuraMap mSpellAreaForAuraMap;
+ SpellAreaForAreaMap mSpellAreaForAreaMap;
+ SkillLineAbilityMap mSkillLineAbilityMap;
+ PetLevelupSpellMap mPetLevelupSpellMap;
+ PetDefaultSpellsMap mPetDefaultSpellsMap; // only spells not listed in related mPetLevelupSpellMap entry
+ SpellInfoMap mSpellInfoMap;
};
#define sSpellMgr ACE_Singleton<SpellMgr, ACE_Null_Mutex>::instance()
diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp
index 0fe75da3da1..2edf040223a 100755
--- a/src/server/game/Spells/SpellScript.cpp
+++ b/src/server/game/Spells/SpellScript.cpp
@@ -21,7 +21,7 @@
#include "SpellScript.h"
#include "SpellMgr.h"
-bool _SpellScript::_Validate(SpellEntry const* entry)
+bool _SpellScript::_Validate(SpellInfo const* entry)
{
if (!Validate(entry))
{
@@ -59,7 +59,7 @@ _SpellScript::EffectHook::EffectHook(uint8 _effIndex)
effIndex = _effIndex;
}
-uint8 _SpellScript::EffectHook::GetAffectedEffectsMask(SpellEntry const* spellEntry)
+uint8 _SpellScript::EffectHook::GetAffectedEffectsMask(SpellInfo const* spellEntry)
{
uint8 mask = 0;
if ((effIndex == EFFECT_ALL) || (effIndex == EFFECT_FIRST_FOUND))
@@ -80,7 +80,7 @@ uint8 _SpellScript::EffectHook::GetAffectedEffectsMask(SpellEntry const* spellEn
return mask;
}
-bool _SpellScript::EffectHook::IsEffectAffected(SpellEntry const* spellEntry, uint8 effIndex)
+bool _SpellScript::EffectHook::IsEffectAffected(SpellInfo const* spellEntry, uint8 effIndex)
{
return GetAffectedEffectsMask(spellEntry) & 1<<effIndex;
}
@@ -103,13 +103,13 @@ std::string _SpellScript::EffectHook::EffIndexToString()
return "Invalid Value";
}
-bool _SpellScript::EffectNameCheck::Check(SpellEntry const* spellEntry, uint8 effIndex)
+bool _SpellScript::EffectNameCheck::Check(SpellInfo const* spellEntry, uint8 effIndex)
{
- if (!spellEntry->Effect[effIndex] && !effName)
+ if (!spellEntry->Effects[effIndex].Effect && !effName)
return true;
- if (!spellEntry->Effect[effIndex])
+ if (!spellEntry->Effects[effIndex].Effect)
return false;
- return (effName == SPELL_EFFECT_ANY) || (spellEntry->Effect[effIndex] == effName);
+ return (effName == SPELL_EFFECT_ANY) || (spellEntry->Effects[effIndex].Effect == effName);
}
std::string _SpellScript::EffectNameCheck::ToString()
@@ -125,13 +125,13 @@ std::string _SpellScript::EffectNameCheck::ToString()
}
}
-bool _SpellScript::EffectAuraNameCheck::Check(SpellEntry const* spellEntry, uint8 effIndex)
+bool _SpellScript::EffectAuraNameCheck::Check(SpellInfo const* spellEntry, uint8 effIndex)
{
- if (!spellEntry->EffectApplyAuraName[effIndex] && !effAurName)
+ if (!spellEntry->Effects[effIndex].ApplyAuraName && !effAurName)
return true;
- if (!spellEntry->EffectApplyAuraName[effIndex])
+ if (!spellEntry->Effects[effIndex].ApplyAuraName)
return false;
- return (effAurName == SPELL_EFFECT_ANY) || (spellEntry->EffectApplyAuraName[effIndex] == effAurName);
+ return (effAurName == SPELL_EFFECT_ANY) || (spellEntry->Effects[effIndex].ApplyAuraName == effAurName);
}
std::string _SpellScript::EffectAuraNameCheck::ToString()
@@ -168,7 +168,7 @@ std::string SpellScript::EffectHandler::ToString()
return "Index: " + EffIndexToString() + " Name: " +_SpellScript::EffectNameCheck::ToString();
}
-bool SpellScript::EffectHandler::CheckEffect(SpellEntry const* spellEntry, uint8 effIndex)
+bool SpellScript::EffectHandler::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex)
{
return _SpellScript::EffectNameCheck::Check(spellEntry, effIndex);
}
@@ -201,11 +201,11 @@ std::string SpellScript::UnitTargetHandler::ToString()
return oss.str();
}
-bool SpellScript::UnitTargetHandler::CheckEffect(SpellEntry const* spellEntry, uint8 effIndex)
+bool SpellScript::UnitTargetHandler::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex)
{
if (!targetType)
return false;
- return (effIndex == EFFECT_ALL) || (spellEntry->EffectImplicitTargetA[effIndex] == targetType || spellEntry->EffectImplicitTargetB[effIndex] == targetType);
+ return (effIndex == EFFECT_ALL) || (spellEntry->Effects[effIndex].TargetA == targetType || spellEntry->Effects[effIndex].TargetB == targetType);
}
void SpellScript::UnitTargetHandler::Call(SpellScript* spellScript, std::list<Unit*>& unitTargets)
@@ -213,7 +213,7 @@ void SpellScript::UnitTargetHandler::Call(SpellScript* spellScript, std::list<Un
(spellScript->*pUnitTargetHandlerScript)(unitTargets);
}
-bool SpellScript::_Validate(SpellEntry const* entry)
+bool SpellScript::_Validate(SpellInfo const* entry)
{
for (std::list<EffectHandler>::iterator itr = OnEffect.begin(); itr != OnEffect.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
@@ -261,7 +261,7 @@ Unit* SpellScript::GetOriginalCaster()
return m_spell->GetOriginalCaster();
}
-SpellEntry const* SpellScript::GetSpellInfo()
+SpellInfo const* SpellScript::GetSpellInfo()
{
return m_spell->GetSpellInfo();
}
@@ -472,10 +472,10 @@ void SpellScript::SetCustomCastResultMessage(SpellCustomErrors result)
m_spell->m_customError = result;
}
-bool AuraScript::_Validate(SpellEntry const* entry)
+bool AuraScript::_Validate(SpellInfo const* entry)
{
for (std::list<CheckAreaTargetHandler>::iterator itr = DoCheckAreaTarget.begin(); itr != DoCheckAreaTarget.end(); ++itr)
- if (!HasAreaAuraEffect(entry))
+ if (!entry->HasAreaAuraEffect())
sLog->outError("TSCR: Spell `%u` of script `%s` does not have area aura effect - handler bound to hook `DoCheckAreaTarget` of AuraScript won't be executed", entry->Id, m_scriptName->c_str());
for (std::list<EffectApplyHandler>::iterator itr = OnEffectApply.begin(); itr != OnEffectApply.end(); ++itr)
@@ -548,7 +548,7 @@ AuraScript::EffectBase::EffectBase(uint8 _effIndex, uint16 _effName)
{
}
-bool AuraScript::EffectBase::CheckEffect(SpellEntry const* spellEntry, uint8 effIndex)
+bool AuraScript::EffectBase::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex)
{
return _SpellScript::EffectAuraNameCheck::Check(spellEntry, effIndex);
}
@@ -703,9 +703,9 @@ void AuraScript::PreventDefaultAction()
}
}
-SpellEntry const* AuraScript::GetSpellProto() const
+SpellInfo const* AuraScript::GetSpellInfo() const
{
- return m_aura->GetSpellProto();
+ return m_aura->GetSpellInfo();
}
uint32 AuraScript::GetId() const
diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h
index 5c5050aef21..aa0dc044e14 100755
--- a/src/server/game/Spells/SpellScript.h
+++ b/src/server/game/Spells/SpellScript.h
@@ -24,7 +24,7 @@
#include <stack>
class Unit;
-struct SpellEntry;
+class SpellInfo;
class SpellScript;
class Spell;
class Aura;
@@ -56,7 +56,7 @@ class _SpellScript
// internal use classes & functions
// DO NOT OVERRIDE THESE IN SCRIPTS
protected:
- virtual bool _Validate(SpellEntry const* entry);
+ virtual bool _Validate(SpellInfo const* entry);
public:
_SpellScript() : m_currentScriptState(SPELL_SCRIPT_STATE_NONE) {}
@@ -70,9 +70,9 @@ class _SpellScript
{
public:
EffectHook(uint8 _effIndex);
- uint8 GetAffectedEffectsMask(SpellEntry const* spellEntry);
- bool IsEffectAffected(SpellEntry const* spellEntry, uint8 effIndex);
- virtual bool CheckEffect(SpellEntry const* spellEntry, uint8 effIndex) = 0;
+ uint8 GetAffectedEffectsMask(SpellInfo const* spellEntry);
+ bool IsEffectAffected(SpellInfo const* spellEntry, uint8 effIndex);
+ virtual bool CheckEffect(SpellInfo const* spellEntry, uint8 effIndex) = 0;
std::string EffIndexToString();
protected:
uint8 effIndex;
@@ -82,7 +82,7 @@ class _SpellScript
{
public:
EffectNameCheck(uint16 _effName) {effName = _effName;};
- bool Check(SpellEntry const* spellEntry, uint8 effIndex);
+ bool Check(SpellInfo const* spellEntry, uint8 effIndex);
std::string ToString();
private:
uint16 effName;
@@ -92,7 +92,7 @@ class _SpellScript
{
public:
EffectAuraNameCheck(uint16 _effAurName) { effAurName = _effAurName; }
- bool Check(SpellEntry const* spellEntry, uint8 effIndex);
+ bool Check(SpellInfo const* spellEntry, uint8 effIndex);
std::string ToString();
private:
uint16 effAurName;
@@ -110,7 +110,7 @@ class _SpellScript
virtual void Register() = 0;
// Function called on server startup, if returns false script won't be used in core
// use for: dbc/template data presence/correctness checks
- virtual bool Validate(SpellEntry const* /*spellEntry*/) { return true; }
+ virtual bool Validate(SpellInfo const* /*spellEntry*/) { return true; }
// Function called when script is created, if returns false script will be unloaded afterwards
// use for: initializing local script variables (DO NOT USE CONSTRUCTOR FOR THIS PURPOSE!)
virtual bool Load() { return true; }
@@ -163,7 +163,7 @@ class SpellScript : public _SpellScript
public:
EffectHandler(SpellEffectFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName);
std::string ToString();
- bool CheckEffect(SpellEntry const* spellEntry, uint8 effIndex);
+ bool CheckEffect(SpellInfo const* spellEntry, uint8 effIndex);
void Call(SpellScript* spellScript, SpellEffIndex effIndex);
private:
SpellEffectFnType pEffectHandlerScript;
@@ -183,7 +183,7 @@ class SpellScript : public _SpellScript
public:
UnitTargetHandler(SpellUnitTargetFnType _pUnitTargetHandlerScript, uint8 _effIndex, uint16 _targetType);
std::string ToString();
- bool CheckEffect(SpellEntry const* spellEntry, uint8 targetType);
+ bool CheckEffect(SpellInfo const* spellEntry, uint8 targetType);
void Call(SpellScript* spellScript, std::list<Unit*>& unitTargets);
private:
SpellUnitTargetFnType pUnitTargetHandlerScript;
@@ -198,7 +198,7 @@ class SpellScript : public _SpellScript
#define PrepareSpellScript(CLASSNAME) SPELLSCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) SPELLSCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME)
public:
- bool _Validate(SpellEntry const* entry);
+ bool _Validate(SpellInfo const* entry);
bool _Load(Spell* spell);
void _InitHit();
bool _IsEffectPrevented(SpellEffIndex effIndex) { return m_hitPreventEffectMask & (1<<effIndex); }
@@ -255,7 +255,7 @@ class SpellScript : public _SpellScript
// methods useable during all spell handling phases
Unit* GetCaster();
Unit* GetOriginalCaster();
- SpellEntry const* GetSpellInfo();
+ SpellInfo const* GetSpellInfo();
// methods useable after spell targets are set
// accessors to the "focus" targets of the spell
@@ -381,7 +381,7 @@ class AuraScript : public _SpellScript
public:
EffectBase(uint8 _effIndex, uint16 _effName);
std::string ToString();
- bool CheckEffect(SpellEntry const* spellEntry, uint8 effIndex);
+ bool CheckEffect(SpellInfo const* spellEntry, uint8 effIndex);
};
class EffectPeriodicHandler : public EffectBase
{
@@ -465,7 +465,7 @@ class AuraScript : public _SpellScript
public:
AuraScript() : _SpellScript(), m_aura(NULL), m_auraApplication(NULL), m_defaultActionPrevented(false)
{}
- bool _Validate(SpellEntry const* entry);
+ bool _Validate(SpellInfo const* entry);
bool _Load(Aura * aura);
void _PrepareScriptCall(AuraScriptHookType hookType, AuraApplication const* aurApp = NULL);
void _FinishScriptCall();
@@ -580,7 +580,7 @@ class AuraScript : public _SpellScript
// AuraScript interface - functions which are redirecting to Aura class
// returns proto of the spell
- SpellEntry const* GetSpellProto() const;
+ SpellInfo const* GetSpellInfo() const;
// returns spellid of the spell
uint32 GetId() const;
diff --git a/src/server/game/Tools/CharacterDatabaseCleaner.cpp b/src/server/game/Tools/CharacterDatabaseCleaner.cpp
index 69494e4b782..9e367ec8653 100644
--- a/src/server/game/Tools/CharacterDatabaseCleaner.cpp
+++ b/src/server/game/Tools/CharacterDatabaseCleaner.cpp
@@ -128,7 +128,7 @@ void CharacterDatabaseCleaner::CleanCharacterSkills()
bool CharacterDatabaseCleaner::SpellCheck(uint32 spell_id)
{
- return sSpellStore.LookupEntry(spell_id) && !GetTalentSpellPos(spell_id);
+ return sSpellMgr->GetSpellInfo(spell_id) && !GetTalentSpellPos(spell_id);
}
void CharacterDatabaseCleaner::CleanCharacterSpell()
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 91f6e25fc0b..8498589fcde 100755
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -1253,6 +1253,18 @@ void World::SetInitialWorldSettings()
LoadDBCStores(m_dataPath);
DetectDBCLang();
+ sLog->outString("Loading spell dbc data corrections...");
+ sSpellMgr->LoadDbcDataCorrections();
+
+ sLog->outString("Loading SpellInfo store...");
+ sSpellMgr->LoadSpellInfoStore();
+
+ sLog->outString("Loading spell custom attributes...");
+ sSpellMgr->LoadSpellCustomAttr();
+
+ // unload data which is copied to SpellMgr::mSpellInfoMap
+ sSpellStore.Clear();
+
sLog->outString("Loading Script Names...");
sObjectMgr->LoadScriptNames();
@@ -1447,9 +1459,6 @@ void World::SetInitialWorldSettings()
sLog->outString("Loading spell pet auras...");
sSpellMgr->LoadSpellPetAuras();
- sLog->outString("Loading spell extra attributes...");
- sSpellMgr->LoadSpellCustomAttr();
-
sLog->outString("Loading Spell target coordinates...");
sSpellMgr->LoadSpellTargetPositions();
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index 185cf05864d..10f7f2ad4e4 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -976,11 +976,11 @@ public:
{
// reset all states
for (int i = 1; i <= 32; ++i)
- unit->ModifyAuraState(AuraState(i), false);
+ unit->ModifyAuraState(AuraStateType(i), false);
return true;
}
- unit->ModifyAuraState(AuraState(abs(state)), state > 0);
+ unit->ModifyAuraState(AuraStateType(abs(state)), state > 0);
return true;
}
diff --git a/src/server/scripts/Commands/cs_learn.cpp b/src/server/scripts/Commands/cs_learn.cpp
index b93c995351b..eee9ebfc809 100644
--- a/src/server/scripts/Commands/cs_learn.cpp
+++ b/src/server/scripts/Commands/cs_learn.cpp
@@ -80,13 +80,13 @@ public:
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spell = handler->extractSpellIdFromLink((char*)args);
- if (!spell || !sSpellStore.LookupEntry(spell))
+ if (!spell || !sSpellMgr->GetSpellInfo(spell))
return false;
char const* allStr = strtok(NULL, " ");
bool allRanks = allStr ? (strncmp(allStr, "all", strlen(allStr)) == 0) : false;
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer()))
{
handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell);
@@ -118,13 +118,13 @@ public:
static bool HandleLearnAllGMCommand(ChatHandler* handler, const char* /*args*/)
{
- for (uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i)
+ for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i)
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(i);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(i);
if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer(), false))
continue;
- if (!sSpellMgr->IsSkillTypeSpell(i, SKILL_INTERNAL))
+ if (!spellInfo->IsAbilityOfSkillType(SKILL_INTERNAL))
continue;
handler->GetSession()->GetPlayer()->learnSpell(i, false);
@@ -154,12 +154,12 @@ public:
if (!entry)
continue;
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(entry->spellId);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(entry->spellId);
if (!spellInfo)
continue;
// skip server-side/triggered spells
- if (spellInfo->spellLevel == 0)
+ if (spellInfo->SpellLevel == 0)
continue;
// skip wrong class/race skills
@@ -218,7 +218,7 @@ public:
if (!spellId) // ??? none spells in talent
continue;
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer(), false))
continue;
@@ -297,7 +297,7 @@ public:
if (!spellid) // ??? none spells in talent
continue;
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellid);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer(), false))
continue;
@@ -456,7 +456,7 @@ public:
if (skillLine->classmask && (skillLine->classmask & classmask) == 0)
continue;
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(skillLine->spellId);
if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, player, false))
continue;
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
index 5483b5f6a3f..2cc56f9f502 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
@@ -98,7 +98,7 @@ public:
void UpdateAI(const uint32 diff);
- void SpellHit(Unit* /*source*/, const SpellEntry *spell)
+ void SpellHit(Unit* /*source*/, const SpellInfo *spell)
{
if (spell->Mechanic == MECHANIC_DISARM)
DoScriptText(SAY_DISARMED, me);
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
index 0d4e2edb813..a9dd97fef28 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
@@ -149,7 +149,7 @@ public:
CAST_CRE(pMalchezaar)->AI()->KilledUnit(who);
}
- void SpellHit(Unit* /*who*/, const SpellEntry *spell)
+ void SpellHit(Unit* /*who*/, const SpellInfo *spell)
{
if (spell->Id == SPELL_INFERNAL_RELAY)
{
@@ -305,7 +305,7 @@ public:
void EnfeebleHealthEffect()
{
- const SpellEntry *info = GetSpellStore()->LookupEntry(SPELL_ENFEEBLE_EFFECT);
+ const SpellInfo *info = sSpellMgr->GetSpellInfo(SPELL_ENFEEBLE_EFFECT);
if (!info)
return;
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp
index a0daa2b5cf7..dfa28111935 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp
@@ -486,12 +486,12 @@ public:
DrinkInturrupted = true;
}
- void SpellHit(Unit* /*pAttacker*/, const SpellEntry* Spell)
+ void SpellHit(Unit* /*pAttacker*/, const SpellInfo* Spell)
{
//We only care about interrupt effects and only if they are durring a spell currently being casted
- if ((Spell->Effect[0] != SPELL_EFFECT_INTERRUPT_CAST &&
- Spell->Effect[1] != SPELL_EFFECT_INTERRUPT_CAST &&
- Spell->Effect[2] != SPELL_EFFECT_INTERRUPT_CAST) || !me->IsNonMeleeSpellCasted(false))
+ if ((Spell->Effects[0].Effect != SPELL_EFFECT_INTERRUPT_CAST &&
+ Spell->Effects[1].Effect != SPELL_EFFECT_INTERRUPT_CAST &&
+ Spell->Effects[2].Effect != SPELL_EFFECT_INTERRUPT_CAST) || !me->IsNonMeleeSpellCasted(false))
return;
//Interrupt effect
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
index 831c1ca1f8e..3d497e3811a 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
@@ -340,7 +340,7 @@ public:
me->DespawnOrUnsummon();
}
- void SpellHit(Unit* /*caster*/, const SpellEntry *Spell)
+ void SpellHit(Unit* /*caster*/, const SpellInfo *Spell)
{
if ((Spell->SchoolMask == SPELL_SCHOOL_MASK_FIRE) && (!(rand()%10)))
{
@@ -1080,7 +1080,7 @@ public:
me->DespawnOrUnsummon();
}
- void SpellHit(Unit* /*caster*/, const SpellEntry *Spell)
+ void SpellHit(Unit* /*caster*/, const SpellInfo *Spell)
{
if (Spell->Id == SPELL_DRINK_POISON)
{
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp
index dfb864fc30f..d39f8e455ff 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp
@@ -138,14 +138,14 @@ public:
if (lList.isEmpty())
return;
- SpellEntry const* pSpell = GetSpellStore()->LookupEntry(SPELL_ORB_KILL_CREDIT);
+ SpellInfo const* pSpell = sSpellMgr->GetSpellInfo(SPELL_ORB_KILL_CREDIT);
for (Map::PlayerList::const_iterator i = lList.begin(); i != lList.end(); ++i)
{
if (Player* player = i->getSource())
{
- if (pSpell && pSpell->EffectMiscValue[0])
- player->KilledMonsterCredit(pSpell->EffectMiscValue[0], 0);
+ if (pSpell && pSpell->Effects[0].MiscValue)
+ player->KilledMonsterCredit(pSpell->Effects[0].MiscValue, 0);
}
}
}
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
index 14d8d23de4e..5402657a350 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
@@ -436,7 +436,7 @@ public:
m_bIsDuelInProgress = false;
}
- void SpellHit(Unit* pCaster, const SpellEntry* pSpell)
+ void SpellHit(Unit* pCaster, const SpellInfo* pSpell)
{
if (!m_bIsDuelInProgress && pSpell->Id == SPELL_DUEL)
{
@@ -625,7 +625,7 @@ public:
{
npc_salanar_the_horsemanAI(Creature* c) : ScriptedAI(c) {}
- void SpellHit(Unit* caster, const SpellEntry *spell)
+ void SpellHit(Unit* caster, const SpellInfo *spell)
{
if (spell->Id == DELIVER_STOLEN_HORSE)
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
index 774b301ef58..af534444468 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
@@ -71,7 +71,7 @@ public:
me->RestoreFaction();
}
- void SpellHit(Unit* caster, const SpellEntry *spell)
+ void SpellHit(Unit* caster, const SpellInfo *spell)
{
if (spell->Id == SPELL_PERSUASIVE_STRIKE && caster->GetTypeId() == TYPEID_PLAYER && me->isAlive() && !uiSpeech_counter)
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
index 95179a92d29..5262ed6620c 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
@@ -143,13 +143,6 @@ public:
mob_wisp_invisAI(Creature* c) : ScriptedAI(c)
{
Creaturetype = delay = spell = spell2 = 0;
- //that's hack but there are no info about range of this spells in dbc
- SpellEntry *wisp = GET_SPELL(SPELL_WISP_BLUE);
- if (wisp)
- wisp->rangeIndex = 6; //100 yards
- SpellEntry *port = GET_SPELL(SPELL_WISP_FLIGHT_PORT);
- if (port)
- port->rangeIndex = 6;
}
uint32 Creaturetype;
@@ -183,7 +176,7 @@ public:
DoCast(me, spell);
}
- void SpellHit(Unit* /*caster*/, const SpellEntry *spell)
+ void SpellHit(Unit* /*caster*/, const SpellInfo *spell)
{
if (spell->Id == SPELL_WISP_FLIGHT_PORT && Creaturetype == 4)
me->SetDisplayId(2027);
@@ -290,7 +283,7 @@ public:
}
}
- void SpellHit(Unit* caster, const SpellEntry* spell)
+ void SpellHit(Unit* caster, const SpellInfo* spell)
{
if (!withbody)
return;
@@ -534,7 +527,7 @@ public:
return NULL;
}
- void SpellHitTarget(Unit* unit, const SpellEntry* spell)
+ void SpellHitTarget(Unit* unit, const SpellInfo* spell)
{
if (spell->Id == SPELL_CONFLAGRATION && unit->HasAura(SPELL_CONFLAGRATION))
SaySound(SAY_CONFLAGRATION, unit);
@@ -553,7 +546,7 @@ public:
pInstance->SetData(DATA_HORSEMAN_EVENT, DONE);
}
- void SpellHit(Unit* caster, const SpellEntry* spell)
+ void SpellHit(Unit* caster, const SpellInfo* spell)
{
if (withhead)
return;
@@ -781,7 +774,7 @@ public:
void EnterCombat(Unit* /*who*/){}
- void SpellHit(Unit* /*caster*/, const SpellEntry *spell)
+ void SpellHit(Unit* /*caster*/, const SpellInfo *spell)
{
if (spell->Id == SPELL_SPROUTING)
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
index a21b5f00a22..a10f3ee4a5c 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
@@ -157,7 +157,7 @@ public:
}
}
- void SpellHit(Unit* /*who*/, const SpellEntry* pSpell)
+ void SpellHit(Unit* /*who*/, const SpellInfo* pSpell)
{
//When hit with ressurection say text
if (pSpell->Id == SPELL_SCARLETRESURRECTION)
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
index 09e913a2cf7..249463cd090 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
@@ -148,7 +148,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void SpellHit(Unit* caster, const SpellEntry *spell)
+ void SpellHit(Unit* caster, const SpellInfo *spell)
{
if (caster->GetTypeId() == TYPEID_PLAYER)
{
@@ -224,7 +224,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void SpellHit(Unit* /*caster*/, const SpellEntry *spell)
+ void SpellHit(Unit* /*caster*/, const SpellInfo *spell)
{
if (!Tagged && spell->Id == SPELL_EGAN_BLASTER)
Tagged = true;
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp
index 4e1b170b3a3..e25211f454a 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp
@@ -181,7 +181,7 @@ public:
me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
}
- void SpellHitTarget(Unit* target, const SpellEntry* spell)
+ void SpellHitTarget(Unit* target, const SpellInfo* spell)
{
switch(spell->Id)
{
@@ -476,7 +476,7 @@ public:
me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
}
- void SpellHitTarget(Unit* target, const SpellEntry* spell)
+ void SpellHitTarget(Unit* target, const SpellInfo* spell)
{
switch(spell->Id)
{
@@ -701,7 +701,7 @@ public:
void EnterCombat(Unit* /*who*/){}
- void SpellHitTarget(Unit* target, const SpellEntry* spell)
+ void SpellHitTarget(Unit* target, const SpellInfo* spell)
{
switch(spell->Id)
{
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
index b1d627c565f..b156caa911f 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
@@ -118,17 +118,6 @@ public:
boss_felmystAI(Creature* c) : ScriptedAI(c)
{
pInstance = c->GetInstanceScript();
-
- // wait for core patch be accepted
- /*SpellEntry *TempSpell = GET_SPELL(SPELL_ENCAPSULATE_EFFECT);
- if (TempSpell->SpellIconID == 2294)
- TempSpell->SpellIconID = 2295;
- TempSpell = GET_SPELL(SPELL_VAPOR_TRIGGER);
- if ((TempSpell->Attributes & SPELL_ATTR0_PASSIVE) == 0)
- TempSpell->Attributes |= SPELL_ATTR0_PASSIVE;
- TempSpell = GET_SPELL(SPELL_FOG_CHARM2);
- if ((TempSpell->Attributes & SPELL_ATTR0_PASSIVE) == 0)
- TempSpell->Attributes |= SPELL_ATTR0_PASSIVE;*/
}
InstanceScript *pInstance;
@@ -203,7 +192,7 @@ public:
pInstance->SetData(DATA_FELMYST_EVENT, DONE);
}
- void SpellHit(Unit* caster, const SpellEntry *spell)
+ void SpellHit(Unit* caster, const SpellInfo *spell)
{
// workaround for linked aura
/*if (spell->Id == SPELL_VAPOR_FORCE)
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
index 8b18129f5a0..febf43f1614 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
@@ -122,9 +122,6 @@ public:
DoorGUID = 0;
bJustReset = false;
me->setActive(true);
- SpellEntry *TempSpell = GET_SPELL(SPELL_SPECTRAL_BLAST);
- if (TempSpell)
- TempSpell->EffectImplicitTargetB[0] = TARGET_UNIT_TARGET_ENEMY;
}
InstanceScript *pInstance;
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
index cc9cb6bfa35..c713c053222 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
@@ -413,7 +413,7 @@ public:
Summons.Summon(summoned);
}
- void SpellHit(Unit* /*caster*/, const SpellEntry* Spell)
+ void SpellHit(Unit* /*caster*/, const SpellInfo* Spell)
{
float x, y, z, o;
me->GetHomePosition(x, y, z, o);
@@ -475,10 +475,10 @@ public:
me->AddUnitState(UNIT_STAT_STUNNED);
}
- void SpellHit(Unit* /*caster*/, const SpellEntry* Spell)
+ void SpellHit(Unit* /*caster*/, const SpellInfo* Spell)
{
for (uint8 i = 0; i < 3; ++i)
- if (Spell->Effect[i] == 38)
+ if (Spell->Effects[i].Effect == 38)
me->DisappearAndDie();
}
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
index 69a54643f63..089c9e9973d 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
@@ -112,10 +112,10 @@ class boss_archaedas : public CreatureScript
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
}
- void SpellHit(Unit* /*caster*/, const SpellEntry *spell)
+ void SpellHit(Unit* /*caster*/, const SpellInfo *spell)
{
// Being woken up from the altar, start the awaken sequence
- if (spell == GetSpellStore()->LookupEntry(SPELL_ARCHAEDAS_AWAKEN))
+ if (spell == sSpellMgr->GetSpellInfo(SPELL_ARCHAEDAS_AWAKEN))
{
me->MonsterYell(SAY_AGGRO, LANG_UNIVERSAL, 0);
DoPlaySoundToSet(me, SOUND_AGGRO);
@@ -267,9 +267,9 @@ class mob_archaedas_minions : public CreatureScript
bAmIAwake = true;
}
- void SpellHit (Unit* /*caster*/, const SpellEntry *spell) {
+ void SpellHit (Unit* /*caster*/, const SpellInfo *spell) {
// time to wake up, start animation
- if (spell == GetSpellStore()->LookupEntry(SPELL_ARCHAEDAS_AWAKEN))
+ if (spell == sSpellMgr->GetSpellInfo(SPELL_ARCHAEDAS_AWAKEN))
{
iAwakenTimer = 5000;
bWakingUp = true;
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
index 7d6b5c0de1c..3701383b0ae 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
@@ -37,7 +37,6 @@ enum Spells
SPELL_GUST_OF_WIND = 43621,
SPELL_ELECTRICAL_STORM = 43648,
SPELL_BERSERK = 45078,
- SPELL_ELECTRICAL_DAMAGE = 43657,
SPELL_ELECTRICAL_OVERLOAD = 43658,
SPELL_EAGLE_SWOOP = 44732
};
@@ -75,9 +74,6 @@ class boss_akilzon : public CreatureScript
{
boss_akilzonAI(Creature* c) : ScriptedAI(c)
{
- SpellEntry *TempSpell = GET_SPELL(SPELL_ELECTRICAL_DAMAGE);
- if (TempSpell)
- TempSpell->EffectBasePoints[1] = 49;//disable bugged lightning until fixed in core
pInstance = c->GetInstanceScript();
}
InstanceScript *pInstance;
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp
index b14c6935d62..0a3cdbebdfa 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp
@@ -61,7 +61,6 @@ EndScriptData */
#define SPELL_SHRED_ARMOR 43243
#define MOB_TOTEM 24224
-#define SPELL_LIGHTNING 43301
enum PhaseHalazzi
{
@@ -87,10 +86,6 @@ class boss_halazzi : public CreatureScript
boss_halazziAI(Creature* c) : ScriptedAI(c)
{
pInstance = c->GetInstanceScript();
- // need to find out what controls totem's spell cooldown
- SpellEntry *TempSpell = GET_SPELL(SPELL_LIGHTNING);
- if (TempSpell && TempSpell->CastingTimeIndex != 5)
- TempSpell->CastingTimeIndex = 5; // 2000 ms casting time
}
InstanceScript *pInstance;
@@ -147,7 +142,7 @@ class boss_halazzi : public CreatureScript
damage = 0;
}
- void SpellHit(Unit*, const SpellEntry *spell)
+ void SpellHit(Unit*, const SpellInfo *spell)
{
if (spell->Id == SPELL_TRANSFORM_SPLIT2)
EnterPhase(PHASE_HUMAN);
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp
index 1ba92565be2..4962ac285ca 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp
@@ -454,7 +454,7 @@ class mob_janalai_firebomb : public CreatureScript
void Reset() {}
- void SpellHit(Unit* /*caster*/, const SpellEntry *spell)
+ void SpellHit(Unit* /*caster*/, const SpellInfo *spell)
{
if (spell->Id == SPELL_FIRE_BOMB_THROW)
DoCast(me, SPELL_FIRE_BOMB_DUMMY, true);
@@ -685,7 +685,7 @@ public:
void UpdateAI(uint32 const /*diff*/) {}
- void SpellHit(Unit* /*caster*/, const SpellEntry* spell)
+ void SpellHit(Unit* /*caster*/, const SpellInfo* spell)
{
if (spell->Id == SPELL_HATCH_EGG)
{
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
index 9a54716ca02..83feaad071e 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
@@ -610,7 +610,7 @@ class mob_zuljin_vortex : public CreatureScript
void EnterCombat(Unit* /*pTarget*/) {}
- void SpellHit(Unit* caster, const SpellEntry* spell)
+ void SpellHit(Unit* caster, const SpellInfo* spell)
{
if (spell->Id == SPELL_ZAP_INFORM)
DoCast(caster, SPELL_ZAP_DAMAGE, true);
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
index 0f97f34ebbf..fe6780f6768 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
@@ -91,7 +91,7 @@ class npc_forest_frog : public CreatureScript
}
}
- void SpellHit(Unit* caster, const SpellEntry *spell)
+ void SpellHit(Unit* caster, const SpellInfo *spell)
{
if (spell->Id == SPELL_REMOVE_AMANI_CURSE && caster->GetTypeId() == TYPEID_PLAYER && me->GetEntry() == ENTRY_FOREST_FROG)
{
diff --git a/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp b/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp
index 7dc32e22e56..6b16eb2937b 100644
--- a/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp
+++ b/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp
@@ -120,7 +120,7 @@ public:
PlayerGUID = 0;
}
- void SpellHit(Unit* caster, const SpellEntry* spell)
+ void SpellHit(Unit* caster, const SpellInfo* spell)
{
if (!caster)
return;
diff --git a/src/server/scripts/EasternKingdoms/silvermoon_city.cpp b/src/server/scripts/EasternKingdoms/silvermoon_city.cpp
index 7fb230dcc07..a46b0ca7b38 100644
--- a/src/server/scripts/EasternKingdoms/silvermoon_city.cpp
+++ b/src/server/scripts/EasternKingdoms/silvermoon_city.cpp
@@ -85,7 +85,7 @@ public:
}
}
- void SpellHit(Unit* Hitter, const SpellEntry *Spellkind)
+ void SpellHit(Unit* Hitter, const SpellInfo *Spellkind)
{
if ((Spellkind->Id == SPELL_SHIMMERING_VESSEL) && !spellHit &&
(Hitter->GetTypeId() == TYPEID_PLAYER) && (CAST_PLR(Hitter)->IsActiveQuest(QUEST_REDEEMING_THE_DEAD)))
diff --git a/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp b/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp
index 39c4b650f9a..00f8274bf31 100644
--- a/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp
+++ b/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp
@@ -59,7 +59,7 @@ public:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE);
}
- void SpellHit(Unit* caster, const SpellEntry *spell)
+ void SpellHit(Unit* caster, const SpellInfo *spell)
{
if (caster->GetTypeId() == TYPEID_PLAYER)
{
diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp
index 4e50126cf92..aafddbd0884 100644
--- a/src/server/scripts/Examples/example_spell.cpp
+++ b/src/server/scripts/Examples/example_spell.cpp
@@ -48,10 +48,10 @@ class spell_ex_5581 : public SpellScriptLoader
// function called on server startup
// checks if script has data required for it to work
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
// check if spellid 70522 exists in dbc, we will trigger it later
- if (!sSpellStore.LookupEntry(SPELL_TRIGGERED))
+ if (!sSpellMgr->GetSpellInfo(SPELL_TRIGGERED))
return false;
return true;
}
@@ -147,10 +147,10 @@ class spell_ex_66244 : public SpellScriptLoader
PrepareAuraScript(spell_ex_66244AuraScript);
// function called on server startup
// checks if script has data required for it to work
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
// check if spellid exists in dbc, we will trigger it later
- if (!sSpellStore.LookupEntry(SPELL_TRIGGERED))
+ if (!sSpellMgr->GetSpellInfo(SPELL_TRIGGERED))
return false;
return true;
}
@@ -379,7 +379,7 @@ class spell_ex : public SpellScriptLoader
{
PrepareSpellScript(spell_ex_SpellScript);
- //bool Validate(SpellEntry const* spellEntry){return true;}
+ //bool Validate(SpellInfo const* spellEntry){return true;}
//bool Load(){return true;}
//void Unload(){}
@@ -406,7 +406,7 @@ class spell_ex : public SpellScriptLoader
class spell_ex_AuraScript : public AuraScript
{
PrepareAuraScript(spell_ex)
- //bool Validate(SpellEntry const* spellEntry){return true;}
+ //bool Validate(SpellInfo const* spellEntry){return true;}
//bool Load(){return true;}
//void Unload(){}
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
index 6d6843c9720..d590bc5cfe2 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
@@ -69,12 +69,6 @@ public:
pInstance = c->GetInstanceScript();
pGo = false;
pos = 0;
- SpellEntry *TempSpell = GET_SPELL(SPELL_SLEEP);
- if (TempSpell && TempSpell->EffectImplicitTargetA[0] != 1)
- {
- TempSpell->EffectImplicitTargetA[0] = 1;
- TempSpell->EffectImplicitTargetB[0] = 0;
- }
}
uint32 SwarmTimer;
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
index 25474b47c0f..477e0601d9e 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
@@ -60,9 +60,6 @@ public:
pInstance = c->GetInstanceScript();
pGo = false;
pos = 0;
- SpellEntry *TempSpell = GET_SPELL(SPELL_HOWL_OF_AZGALOR);
- if (TempSpell)
- TempSpell->EffectRadiusIndex[0] = 12;//100yards instead of 50000?!
}
uint32 RainTimer;
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
index f258444eb62..337c4cbb1f9 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
@@ -57,12 +57,6 @@ public:
pInstance = c->GetInstanceScript();
pGo = false;
pos = 0;
- SpellEntry *TempSpell = GET_SPELL(SPELL_MARK);
- if (TempSpell && TempSpell->EffectImplicitTargetA[0] != 1)
- {
- TempSpell->EffectImplicitTargetA[0] = 1;
- TempSpell->EffectImplicitTargetB[0] = 0;
- }
}
uint32 CleaveTimer;
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
index 2159d4bafd5..678a38ffeca 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
@@ -1215,7 +1215,7 @@ class npc_crate_helper : public CreatureScript
_marked = false;
}
- void SpellHit(Unit* /*caster*/, SpellEntry const* spell)
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
{
if (spell->Id == SPELL_ARCANE_DISRUPTION && !_marked)
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp
index adffa01afbb..2b2151daf02 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp
@@ -141,7 +141,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void SpellHit(Unit* /*caster*/, const SpellEntry* spell)
+ void SpellHit(Unit* /*caster*/, const SpellInfo* spell)
{
if (SpellCorrupt_Timer)
return;
diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
index 3fedbeb583c..d9eaf0d255c 100644
--- a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
+++ b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
@@ -225,7 +225,7 @@ public:
DoScriptText(SAY_KILL, me);
}
- void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell)
+ void SpellHit(Unit* /*pCaster*/, const SpellInfo* pSpell)
{
if (pSpell->Id == SPELL_BREATH_EAST_TO_WEST ||
pSpell->Id == SPELL_BREATH_WEST_TO_EAST ||
@@ -285,7 +285,7 @@ public:
}
}
- void SpellHitTarget(Unit* target, const SpellEntry* pSpell)
+ void SpellHitTarget(Unit* target, const SpellInfo* pSpell)
{
//Workaround - Couldn't find a way to group this spells (All Eruption)
if (((pSpell->Id >= 17086 && pSpell->Id <= 17095) ||
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
index bd66602a24b..e5b6d79f912 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
@@ -157,7 +157,7 @@ struct boss_twinemperorsAI : public ScriptedAI
}
}
- void SpellHit(Unit* caster, const SpellEntry *entry)
+ void SpellHit(Unit* caster, const SpellInfo *entry)
{
if (caster == me)
return;
diff --git a/src/server/scripts/Kalimdor/azshara.cpp b/src/server/scripts/Kalimdor/azshara.cpp
index 57001552302..d49a776fa4d 100644
--- a/src/server/scripts/Kalimdor/azshara.cpp
+++ b/src/server/scripts/Kalimdor/azshara.cpp
@@ -63,7 +63,7 @@ public:
void EnterCombat(Unit* /*who*/) { }
- void SpellHit(Unit* Hitter, const SpellEntry *Spellkind)
+ void SpellHit(Unit* Hitter, const SpellInfo *Spellkind)
{
if (!spellhit &&
Hitter->GetTypeId() == TYPEID_PLAYER &&
diff --git a/src/server/scripts/Kalimdor/azuremyst_isle.cpp b/src/server/scripts/Kalimdor/azuremyst_isle.cpp
index 35ba092e5cf..3e8bcbef02e 100644
--- a/src/server/scripts/Kalimdor/azuremyst_isle.cpp
+++ b/src/server/scripts/Kalimdor/azuremyst_isle.cpp
@@ -111,7 +111,7 @@ public:
}
}
- void SpellHit(Unit* Caster, const SpellEntry *Spell)
+ void SpellHit(Unit* Caster, const SpellInfo *Spell)
{
if (Spell->SpellFamilyFlags[2] & 0x080000000)
{
diff --git a/src/server/scripts/Kalimdor/darkshore.cpp b/src/server/scripts/Kalimdor/darkshore.cpp
index 052137f9d2e..3242797d3e7 100644
--- a/src/server/scripts/Kalimdor/darkshore.cpp
+++ b/src/server/scripts/Kalimdor/darkshore.cpp
@@ -122,7 +122,7 @@ public:
}
}
- void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell)
+ void SpellHit(Unit* /*pCaster*/, const SpellInfo* pSpell)
{
if (HasFollowState(STATE_FOLLOW_INPROGRESS | STATE_FOLLOW_PAUSED) && pSpell->Id == SPELL_AWAKEN)
ClearSleeping();
diff --git a/src/server/scripts/Kalimdor/desolace.cpp b/src/server/scripts/Kalimdor/desolace.cpp
index 997de5d9bff..71372f1d9e4 100644
--- a/src/server/scripts/Kalimdor/desolace.cpp
+++ b/src/server/scripts/Kalimdor/desolace.cpp
@@ -135,7 +135,7 @@ public:
}
}
- void SpellHit(Unit* /*pCaster*/, SpellEntry const* pSpell)
+ void SpellHit(Unit* /*pCaster*/, SpellInfo const* pSpell)
{
if (pSpell->Id == SPELL_KODO_KOMBO_GOSSIP)
{
diff --git a/src/server/scripts/Kalimdor/durotar.cpp b/src/server/scripts/Kalimdor/durotar.cpp
index 113afdc2e77..29c36c64628 100644
--- a/src/server/scripts/Kalimdor/durotar.cpp
+++ b/src/server/scripts/Kalimdor/durotar.cpp
@@ -67,7 +67,7 @@ public:
work = true;
}
- void SpellHit(Unit* caster, const SpellEntry * spell)
+ void SpellHit(Unit* caster, const SpellInfo * spell)
{
if (spell->Id == SPELL_AWAKEN_PEON && caster->GetTypeId() == TYPEID_PLAYER
&& CAST_PLR(caster)->GetQuestStatus(QUEST_LAZY_PEONS) == QUEST_STATUS_INCOMPLETE)
@@ -391,7 +391,7 @@ class npc_troll_volunteer : public CreatureScript
me->DespawnOrUnsummon();
}
- void SpellHit(Unit* caster, SpellEntry const* spell)
+ void SpellHit(Unit* caster, SpellInfo const* spell)
{
if (spell->Id == SPELL_AOE_TURNIN && caster->GetEntry() == NPC_URUZIN && !_complete)
{
@@ -424,9 +424,9 @@ class spell_mount_check : public SpellScriptLoader
class spell_mount_check_AuraScript : public AuraScript
{
PrepareAuraScript(spell_mount_check_AuraScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_MOUNTING_CHECK))
+ if (!sSpellMgr->GetSpellInfo(SPELL_MOUNTING_CHECK))
return false;
return true;
}
@@ -472,11 +472,11 @@ class spell_voljin_war_drums : public SpellScriptLoader
class spell_voljin_war_drums_SpellScript : public SpellScript
{
PrepareSpellScript(spell_voljin_war_drums_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_MOTIVATE_1))
+ if (!sSpellMgr->GetSpellInfo(SPELL_MOTIVATE_1))
return false;
- if (!sSpellStore.LookupEntry(SPELL_MOTIVATE_2))
+ if (!sSpellMgr->GetSpellInfo(SPELL_MOTIVATE_2))
return false;
return true;
}
@@ -529,12 +529,12 @@ class spell_voodoo : public SpellScriptLoader
{
PrepareSpellScript(spell_voodoo_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_BREW) || !sSpellStore.LookupEntry(SPELL_GHOSTLY) ||
- !sSpellStore.LookupEntry(SPELL_HEX1) || !sSpellStore.LookupEntry(SPELL_HEX2) ||
- !sSpellStore.LookupEntry(SPELL_HEX3) || !sSpellStore.LookupEntry(SPELL_GROW) ||
- !sSpellStore.LookupEntry(SPELL_LAUNCH))
+ if (!sSpellMgr->GetSpellInfo(SPELL_BREW) || !sSpellMgr->GetSpellInfo(SPELL_GHOSTLY) ||
+ !sSpellMgr->GetSpellInfo(SPELL_HEX1) || !sSpellMgr->GetSpellInfo(SPELL_HEX2) ||
+ !sSpellMgr->GetSpellInfo(SPELL_HEX3) || !sSpellMgr->GetSpellInfo(SPELL_GROW) ||
+ !sSpellMgr->GetSpellInfo(SPELL_LAUNCH))
return false;
return true;
}
diff --git a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp
index 13d18a44483..6e11930a441 100644
--- a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp
+++ b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp
@@ -701,16 +701,16 @@ class spell_ooze_zap : public SpellScriptLoader
{
PrepareSpellScript(spell_ooze_zap_SpellScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_OOZE_ZAP))
+ if (!sSpellMgr->GetSpellInfo(SPELL_OOZE_ZAP))
return false;
return true;
}
SpellCastResult CheckRequirement()
{
- if (!GetCaster()->HasAura(SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), EFFECT_1)))
+ if (!GetCaster()->HasAura(GetSpellInfo()->Effects[EFFECT_1].CalcValue()))
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct
if (!GetTargetUnit())
@@ -748,9 +748,9 @@ class spell_ooze_zap_channel_end : public SpellScriptLoader
{
PrepareSpellScript(spell_ooze_zap_channel_end_SpellScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_OOZE_ZAP_CHANNEL_END))
+ if (!sSpellMgr->GetSpellInfo(SPELL_OOZE_ZAP_CHANNEL_END))
return false;
return true;
}
@@ -784,9 +784,9 @@ class spell_energize_aoe : public SpellScriptLoader
{
PrepareSpellScript(spell_energize_aoe_SpellScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_ENERGIZED))
+ if (!sSpellMgr->GetSpellInfo(SPELL_ENERGIZED))
return false;
return true;
}
@@ -795,7 +795,7 @@ class spell_energize_aoe : public SpellScriptLoader
{
for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end();)
{
- if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), EFFECT_1)) == QUEST_STATUS_INCOMPLETE)
+ if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetSpellInfo()->Effects[EFFECT_1].CalcValue()) == QUEST_STATUS_INCOMPLETE)
++itr;
else
unitList.erase(itr++);
diff --git a/src/server/scripts/Kalimdor/mulgore.cpp b/src/server/scripts/Kalimdor/mulgore.cpp
index 2ee707e01ea..d0131068c3f 100644
--- a/src/server/scripts/Kalimdor/mulgore.cpp
+++ b/src/server/scripts/Kalimdor/mulgore.cpp
@@ -116,7 +116,7 @@ public:
me->UpdateEntry(NPC_KYLE_FRENZIED);
}
- void SpellHit(Unit* pCaster, SpellEntry const* pSpell)
+ void SpellHit(Unit* pCaster, SpellInfo const* pSpell)
{
if (!me->getVictim() && !bEvent && pSpell->Id == SPELL_LUNCH)
{
diff --git a/src/server/scripts/Kalimdor/the_barrens.cpp b/src/server/scripts/Kalimdor/the_barrens.cpp
index a94c98823be..f341e47c5e8 100644
--- a/src/server/scripts/Kalimdor/the_barrens.cpp
+++ b/src/server/scripts/Kalimdor/the_barrens.cpp
@@ -265,7 +265,7 @@ public:
me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE);
}
- void SpellHit(Unit* /*caster*/, const SpellEntry *spell)
+ void SpellHit(Unit* /*caster*/, const SpellInfo *spell)
{
if (spell->Id == SPELL_FLARE || spell->Id == SPELL_FOLLY)
{
diff --git a/src/server/scripts/Kalimdor/ungoro_crater.cpp b/src/server/scripts/Kalimdor/ungoro_crater.cpp
index 4dfd64f4b1e..05ba6b2234e 100644
--- a/src/server/scripts/Kalimdor/ungoro_crater.cpp
+++ b/src/server/scripts/Kalimdor/ungoro_crater.cpp
@@ -237,7 +237,7 @@ public:
}
}
- void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell)
+ void SpellHit(Unit* /*pCaster*/, const SpellInfo* pSpell)
{
if (HasFollowState(STATE_FOLLOW_INPROGRESS | STATE_FOLLOW_PAUSED) && pSpell->Id == SPELL_REVIVE_RINGO)
ClearFaint();
diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp
index 6319e30423f..51e2f833d3a 100644
--- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp
@@ -101,7 +101,7 @@ public:
}
}
- void SpellHitTarget(Unit* target, const SpellEntry *spell)
+ void SpellHitTarget(Unit* target, const SpellInfo *spell)
{
if (spell->Id == SPELL_INSANITY)
{
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp
index 4bf2a4499c5..784684ad42d 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp
@@ -312,7 +312,7 @@ class spell_baltharus_enervating_brand : public SpellScriptLoader
{
PreventDefaultAction();
Unit* target = GetTarget();
- uint32 triggerSpellId = GetSpellProto()->EffectTriggerSpell[aurEff->GetEffIndex()];
+ uint32 triggerSpellId = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
target->CastSpell(target, triggerSpellId, true);
if (Unit* caster = GetCaster())
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp
index 2dff07f39f2..c960cd1671c 100755
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp
@@ -367,7 +367,7 @@ public:
me->SetInCombatWithZone();
}
- /*void SpellHitTarget(Unit* target, const SpellEntry *pSpell)
+ /*void SpellHitTarget(Unit* target, const SpellInfo *pSpell)
{
if (pSpell->Id == SPELL_FEL_STREAK)
DoCastAOE(SPELL_FEL_INFERNO); //66517
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
index f8b831972cb..e6ab05a75e9 100755
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
@@ -772,7 +772,7 @@ public:
me->SetInCombatWithZone();
}
- void SpellHitTarget(Unit* target, const SpellEntry* spell)
+ void SpellHitTarget(Unit* target, const SpellInfo* spell)
{
if (spell->Id == SPELL_TRAMPLE && target->GetTypeId() == TYPEID_PLAYER)
{
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
index b93c2c23c65..44385ea83e2 100755
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
@@ -254,12 +254,12 @@ struct boss_twin_baseAI : public ScriptedAI
m_pInstance->SetData(DATA_HEALTH_TWIN_SHARED, me->GetHealth() >= uiDamage ? me->GetHealth() - uiDamage : 0);
}
- void SpellHit(Unit* caster, const SpellEntry* spell)
+ void SpellHit(Unit* caster, const SpellInfo* spell)
{
if (caster->ToCreature() == me)
- if (spell->Effect[0] == 136) //Effect Heal
+ if (spell->Effects[0].Effect == 136) //Effect Heal
if (m_pInstance)
- m_pInstance->SetData(DATA_HEALTH_TWIN_SHARED, me->GetHealth() + me->CountPctFromMaxHealth(spell->EffectBasePoints[0]));
+ m_pInstance->SetData(DATA_HEALTH_TWIN_SHARED, me->GetHealth() + me->CountPctFromMaxHealth(spell->Effects[EFFECT_0].CalcValue()));
}
void SummonColorballs(uint8 quantity)
diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp
index 1400c022ce6..76839177230 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp
@@ -234,7 +234,7 @@ class boss_devourer_of_souls : public CreatureScript
}
}
- void SpellHitTarget(Unit* /*target*/, const SpellEntry *spell)
+ void SpellHitTarget(Unit* /*target*/, const SpellInfo *spell)
{
if (spell->Id == H_SPELL_PHANTOM_BLAST)
threeFaced = false;
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp
index 1a3a2802327..809fa8e39ff 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp
@@ -165,7 +165,7 @@ class boss_garfrost : public CreatureScript
events.ScheduleEvent(EVENT_RESUME_ATTACK, 5000);
}
- void SpellHitTarget(Unit* target, const SpellEntry* spell)
+ void SpellHitTarget(Unit* target, const SpellInfo* spell)
{
if (spell->Id == SPELL_PERMAFROST_HELPER)
{
diff --git a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
index 79c5e9a8144..57c14993e2d 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
@@ -359,7 +359,7 @@ class boss_drakkari_elemental : public CreatureScript
me->DespawnOrUnsummon();
}
- void SpellHitTarget(Unit* target, SpellEntry const* spell)
+ void SpellHitTarget(Unit* target, SpellInfo const* spell)
{
if (spell->Id == SPELL_MERGE)
{
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
index ec891f81664..bf70e8500a7 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
@@ -447,7 +447,7 @@ class boss_prince_keleseth_icc : public CreatureScript
me->SetHealth(_spawnHealth);
}
- void SpellHit(Unit* /*caster*/, SpellEntry const* spell)
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
{
if (spell->Id == SPELL_INVOCATION_OF_BLOOD_KELESETH)
DoAction(ACTION_CAST_INVOCATION);
@@ -668,7 +668,7 @@ class boss_prince_taldaram_icc : public CreatureScript
me->SetHealth(_spawnHealth);
}
- void SpellHit(Unit* /*caster*/, SpellEntry const* spell)
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
{
if (spell->Id == SPELL_INVOCATION_OF_BLOOD_TALDARAM)
DoAction(ACTION_CAST_INVOCATION);
@@ -916,7 +916,7 @@ class boss_prince_valanar_icc : public CreatureScript
DoZoneInCombat(summon);
}
- void SpellHit(Unit* /*caster*/, SpellEntry const* spell)
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
{
if (spell->Id == SPELL_INVOCATION_OF_BLOOD_VALANAR)
DoAction(ACTION_CAST_INVOCATION);
@@ -1470,7 +1470,7 @@ class spell_taldaram_flame_ball_visual : public SpellScriptLoader
return;
// SPELL_FLAME_SPHERE_SPAWN_EFFECT
- if (GetSpellProto()->Id == SPELL_FLAME_SPHERE_SPAWN_EFFECT)
+ if (GetSpellInfo()->Id == SPELL_FLAME_SPHERE_SPAWN_EFFECT)
{
target->CastSpell(target, SPELL_BALL_OF_FLAMES, true);
target->AI()->DoAction(ACTION_FLAME_BALL_CHASE);
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp
index 651e8759efb..3fe8b7f6aa8 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp
@@ -488,13 +488,13 @@ class spell_blood_queen_vampiric_bite : public SpellScriptLoader
{
PrepareSpellScript(spell_blood_queen_vampiric_bite_SpellScript);
- bool Validate(SpellEntry const* /*spell*/)
+ bool Validate(SpellInfo const* /*spell*/)
{
- if (!sSpellStore.LookupEntry(SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR))
+ if (!sSpellMgr->GetSpellInfo(SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR))
return false;
- if (!sSpellStore.LookupEntry(SPELL_FRENZIED_BLOODTHIRST))
+ if (!sSpellMgr->GetSpellInfo(SPELL_FRENZIED_BLOODTHIRST))
return false;
- if (!sSpellStore.LookupEntry(SPELL_PRESENCE_OF_THE_DARKFALLEN))
+ if (!sSpellMgr->GetSpellInfo(SPELL_PRESENCE_OF_THE_DARKFALLEN))
return false;
return true;
}
@@ -607,9 +607,9 @@ class spell_blood_queen_bloodbolt : public SpellScriptLoader
{
PrepareSpellScript(spell_blood_queen_bloodbolt_SpellScript);
- bool Validate(SpellEntry const* /*spell*/)
+ bool Validate(SpellInfo const* /*spell*/)
{
- if (!sSpellStore.LookupEntry(SPELL_TWILIGHT_BLOODBOLT))
+ if (!sSpellMgr->GetSpellInfo(SPELL_TWILIGHT_BLOODBOLT))
return false;
return true;
}
@@ -703,9 +703,9 @@ class spell_blood_queen_pact_of_the_darkfallen_dmg : public SpellScriptLoader
{
PrepareAuraScript(spell_blood_queen_pact_of_the_darkfallen_dmg_AuraScript);
- bool Validate(SpellEntry const* /*spell*/)
+ bool Validate(SpellInfo const* /*spell*/)
{
- if (!sSpellStore.LookupEntry(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE))
+ if (!sSpellMgr->GetSpellInfo(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE))
return false;
return true;
}
@@ -713,8 +713,8 @@ class spell_blood_queen_pact_of_the_darkfallen_dmg : public SpellScriptLoader
// this is an additional effect to be executed
void PeriodicTick(AuraEffect const* aurEff)
{
- SpellEntry const* damageSpell = sSpellStore.LookupEntry(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE);
- int32 damage = SpellMgr::CalculateSpellEffectAmount(damageSpell, EFFECT_0);
+ SpellInfo const* damageSpell = sSpellMgr->GetSpellInfo(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE);
+ int32 damage = damageSpell->Effects[EFFECT_0].CalcValue();
float multiplier = 0.3375f + 0.1f * uint32(aurEff->GetTickNumber()/10); // do not convert to 0.01f - we need tick number/10 as INT (damage increases every 10 ticks)
damage = int32(damage * multiplier);
GetTarget()->CastCustomSpell(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE, SPELLVALUE_BASE_POINT0, damage, GetTarget(), true);
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
index 901ea774339..66f839fe143 100755
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
@@ -377,7 +377,7 @@ class boss_deathbringer_saurfang : public CreatureScript
instance->HandleGameObject(instance->GetData64(GO_SAURFANG_S_DOOR), false);
}
- void SpellHitTarget(Unit* target, SpellEntry const* spell)
+ void SpellHitTarget(Unit* target, SpellInfo const* spell)
{
switch (spell->Id)
{
@@ -625,7 +625,7 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
}
}
- void SpellHit(Unit* /*caster*/, SpellEntry const* spell)
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
{
if (spell->Id == SPELL_GRIP_OF_AGONY)
{
@@ -828,7 +828,7 @@ class npc_muradin_bronzebeard_icc : public CreatureScript
}
}
- void SpellHit(Unit* /*caster*/, SpellEntry const* spell)
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
{
if (spell->Id == SPELL_GRIP_OF_AGONY)
{
@@ -930,7 +930,7 @@ class npc_saurfang_event : public CreatureScript
_index = data;
}
- void SpellHit(Unit* /*caster*/, SpellEntry const* spell)
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
{
if (spell->Id == SPELL_GRIP_OF_AGONY)
{
@@ -966,11 +966,11 @@ class spell_deathbringer_blood_link : public SpellScriptLoader
{
PrepareSpellScript(spell_deathbringer_blood_link_SpellScript);
- bool Validate(SpellEntry const* /*spellInfo*/)
+ bool Validate(SpellInfo const* /*spellInfo*/)
{
- if (!sSpellStore.LookupEntry(SPELL_BLOOD_LINK_POWER))
+ if (!sSpellMgr->GetSpellInfo(SPELL_BLOOD_LINK_POWER))
return false;
- if (!sSpellStore.LookupEntry(SPELL_BLOOD_POWER))
+ if (!sSpellMgr->GetSpellInfo(SPELL_BLOOD_POWER))
return false;
return true;
}
@@ -1004,9 +1004,9 @@ class spell_deathbringer_blood_link_aura : public SpellScriptLoader
{
PrepareAuraScript(spell_deathbringer_blood_link_AuraScript);
- bool Validate(SpellEntry const* /*spellInfo*/)
+ bool Validate(SpellInfo const* /*spellInfo*/)
{
- if (!sSpellStore.LookupEntry(SPELL_MARK_OF_THE_FALLEN_CHAMPION))
+ if (!sSpellMgr->GetSpellInfo(SPELL_MARK_OF_THE_FALLEN_CHAMPION))
return false;
return true;
}
@@ -1096,9 +1096,9 @@ class spell_deathbringer_rune_of_blood : public SpellScriptLoader
{
PrepareSpellScript(spell_deathbringer_rune_of_blood_SpellScript);
- bool Validate(SpellEntry const* /*spellInfo*/)
+ bool Validate(SpellInfo const* /*spellInfo*/)
{
- if (!sSpellStore.LookupEntry(SPELL_BLOOD_LINK_DUMMY))
+ if (!sSpellMgr->GetSpellInfo(SPELL_BLOOD_LINK_DUMMY))
return false;
return true;
}
@@ -1131,9 +1131,9 @@ class spell_deathbringer_blood_nova : public SpellScriptLoader
{
PrepareSpellScript(spell_deathbringer_blood_nova_SpellScript);
- bool Validate(SpellEntry const* /*spellInfo*/)
+ bool Validate(SpellInfo const* /*spellInfo*/)
{
- if (!sSpellStore.LookupEntry(SPELL_BLOOD_LINK_DUMMY))
+ if (!sSpellMgr->GetSpellInfo(SPELL_BLOOD_LINK_DUMMY))
return false;
return true;
}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp
index dc36c6c72ab..6a58924f938 100755
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp
@@ -156,7 +156,7 @@ class boss_festergut : public CreatureScript
Talk(SAY_KILL);
}
- void SpellHitTarget(Unit* target, SpellEntry const* spell)
+ void SpellHitTarget(Unit* target, SpellInfo const* spell)
{
if (spell->Id == PUNGENT_BLIGHT_HELPER)
target->RemoveAurasDueToSpell(INOCULATED_HELPER);
@@ -387,9 +387,9 @@ class spell_festergut_gastric_bloat : public SpellScriptLoader
{
PrepareSpellScript(spell_festergut_gastric_bloat_SpellScript);
- bool Validate(SpellEntry const* /*spell*/)
+ bool Validate(SpellInfo const* /*spell*/)
{
- if (!sSpellStore.LookupEntry(SPELL_GASTRIC_EXPLOSION))
+ if (!sSpellMgr->GetSpellInfo(SPELL_GASTRIC_EXPLOSION))
return false;
return true;
}
@@ -425,9 +425,9 @@ class spell_festergut_blighted_spores : public SpellScriptLoader
{
PrepareAuraScript(spell_festergut_blighted_spores_AuraScript);
- bool Validate(SpellEntry const* /*spell*/)
+ bool Validate(SpellInfo const* /*spell*/)
{
- if (!sSpellStore.LookupEntry(SPELL_INOCULATED))
+ if (!sSpellMgr->GetSpellInfo(SPELL_INOCULATED))
return false;
return true;
}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
index b050f42fc6c..4f8ed4c536f 100755
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
@@ -572,7 +572,7 @@ class boss_lady_deathwhisper : public CreatureScript
DoCast(cultist, SPELL_DARK_MARTYRDOM_T);
}
- void SpellHitTarget(Unit* target, SpellEntry const* spell)
+ void SpellHitTarget(Unit* target, SpellInfo const* spell)
{
if (spell->Id == SPELL_DARK_MARTYRDOM_T)
{
@@ -648,7 +648,7 @@ class npc_cult_fanatic : public CreatureScript
Events.ScheduleEvent(EVENT_CULTIST_DARK_MARTYRDOM, urand(18000, 32000));
}
- void SpellHit(Unit* /*caster*/, SpellEntry const* spell)
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
{
if (spell->Id == SPELL_DARK_TRANSFORMATION)
me->UpdateEntry(NPC_DEFORMED_FANATIC);
@@ -726,7 +726,7 @@ class npc_cult_adherent : public CreatureScript
Events.ScheduleEvent(EVENT_CULTIST_DARK_MARTYRDOM, urand(18000, 32000));
}
- void SpellHit(Unit* /*caster*/, SpellEntry const* spell)
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
{
if (spell->Id == SPELL_DARK_EMPOWERMENT)
me->UpdateEntry(NPC_EMPOWERED_ADHERENT);
@@ -810,7 +810,7 @@ class npc_vengeful_shade : public CreatureScript
me->AddAura(SPELL_VENGEFUL_BLAST_PASSIVE, me);
}
- void SpellHitTarget(Unit* /*target*/, SpellEntry const* spell)
+ void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell)
{
switch (spell->Id)
{
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
index 450875662e4..094e03b9d68 100755
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
@@ -333,16 +333,16 @@ class boss_professor_putricide : public CreatureScript
{
case PHASE_COMBAT_2:
{
- SpellEntry const* spell = sSpellStore.LookupEntry(SPELL_CREATE_CONCOCTION);
+ SpellInfo const* spell = sSpellMgr->GetSpellInfo(SPELL_CREATE_CONCOCTION);
DoCast(me, SPELL_CREATE_CONCOCTION);
- events.ScheduleEvent(EVENT_PHASE_TRANSITION, GetSpellCastTime(sSpellMgr->GetSpellForDifficultyFromSpell(spell, me)) + 100);
+ events.ScheduleEvent(EVENT_PHASE_TRANSITION, sSpellMgr->GetSpellForDifficultyFromSpell(spell, me)->CalcCastTime() + 100);
break;
}
case PHASE_COMBAT_3:
{
- SpellEntry const* spell = sSpellStore.LookupEntry(SPELL_GUZZLE_POTIONS);
+ SpellInfo const* spell = sSpellMgr->GetSpellInfo(SPELL_GUZZLE_POTIONS);
DoCast(me, SPELL_GUZZLE_POTIONS);
- events.ScheduleEvent(EVENT_PHASE_TRANSITION, GetSpellCastTime(sSpellMgr->GetSpellForDifficultyFromSpell(spell, me)) + 100);
+ events.ScheduleEvent(EVENT_PHASE_TRANSITION, sSpellMgr->GetSpellForDifficultyFromSpell(spell, me)->CalcCastTime() + 100);
break;
}
default:
@@ -671,7 +671,7 @@ class npc_volatile_ooze : public CreatureScript
_newTargetSelectTimer = 0;
}
- void SpellHitTarget(Unit* /*target*/, SpellEntry const* spell)
+ void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell)
{
if (!_newTargetSelectTimer && sSpellMgr->GetSpellDifficultyId(spell->Id) == sSpellMgr->GetSpellDifficultyId(SPELL_OOZE_ERUPTION))
_newTargetSelectTimer = 1000;
@@ -719,7 +719,7 @@ class spell_putricide_gaseous_bloat : public SpellScriptLoader
Unit* target = GetTarget();
if (Unit* caster = GetCaster())
{
- target->RemoveAuraFromStack(GetSpellProto()->Id, GetCasterGUID());
+ target->RemoveAuraFromStack(GetSpellInfo()->Id, GetCasterGUID());
if (!target->HasAura(GetId())&& caster->GetTypeId() == TYPEID_UNIT)
caster->ToCreature()->DespawnOrUnsummon();
}
@@ -760,11 +760,11 @@ class spell_putricide_ooze_channel : public SpellScriptLoader
{
PrepareSpellScript(spell_putricide_ooze_channel_SpellScript);
- bool Validate(SpellEntry const* spell)
+ bool Validate(SpellInfo const* spell)
{
- if (!spell->excludeTargetAuraSpell)
+ if (!spell->ExcludeTargetAuraSpell)
return false;
- if (!sSpellStore.LookupEntry(spell->excludeTargetAuraSpell))
+ if (!sSpellMgr->GetSpellInfo(spell->ExcludeTargetAuraSpell))
return false;
return true;
}
@@ -779,7 +779,7 @@ class spell_putricide_ooze_channel : public SpellScriptLoader
void SelectTarget(std::list<Unit*>& targetList)
{
- targetList.remove_if(BeamProtectionCheck(GetSpellInfo()->excludeTargetAuraSpell));
+ targetList.remove_if(BeamProtectionCheck(GetSpellInfo()->ExcludeTargetAuraSpell));
if (targetList.empty())
{
FinishCast(SPELL_FAILED_NO_VALID_TARGETS);
@@ -896,7 +896,7 @@ class spell_putricide_slime_puddle : public SpellScriptLoader
if (Aura* size = caster->GetAura(70347))
radiusMod += size->GetStackAmount();
- uint32 triggerSpellId = GetSpellProto()->EffectTriggerSpell[aurEff->GetEffIndex()];
+ uint32 triggerSpellId = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
caster->CastCustomSpell(triggerSpellId, SPELLVALUE_RADIUS_MOD, radiusMod * 100, caster, true);
}
}
@@ -970,7 +970,7 @@ class spell_putricide_unstable_experiment : public SpellScriptLoader
break;
}
- GetCaster()->CastSpell(target, uint32(GetSpellInfo()->EffectBasePoints[stage]+1), true, NULL, NULL, GetCaster()->GetGUID());
+ GetCaster()->CastSpell(target, uint32(GetSpellInfo()->Effects[stage].CalcValue()), true, NULL, NULL, GetCaster()->GetGUID());
}
void Register()
@@ -999,7 +999,7 @@ class spell_putricide_ooze_summon : public SpellScriptLoader
PreventDefaultAction();
if (Unit* caster = GetCaster())
{
- uint32 triggerSpellId = GetSpellProto()->EffectTriggerSpell[aurEff->GetEffIndex()];
+ uint32 triggerSpellId = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
float x, y, z;
GetTarget()->GetPosition(x, y, z);
z = GetTarget()->GetMap()->GetHeight(x, y, z, true, 25.0f);
@@ -1069,7 +1069,7 @@ class spell_putricide_choking_gas_bomb : public SpellScriptLoader
if (i == skipIndex)
continue;
- uint32 spellId = uint32(SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), uint8(i)));
+ uint32 spellId = uint32(GetSpellInfo()->Effects[i].CalcValue());
GetCaster()->CastSpell(GetCaster(), spellId, true, NULL, NULL, GetCaster()->GetGUID());
}
}
@@ -1095,11 +1095,11 @@ class spell_putricide_unbound_plague : public SpellScriptLoader
{
PrepareSpellScript(spell_putricide_unbound_plague_SpellScript);
- bool Validate(SpellEntry const* /*spell*/)
+ bool Validate(SpellInfo const* /*spell*/)
{
- if (!sSpellStore.LookupEntry(SPELL_UNBOUND_PLAGUE))
+ if (!sSpellMgr->GetSpellInfo(SPELL_UNBOUND_PLAGUE))
return false;
- if (!sSpellStore.LookupEntry(SPELL_UNBOUND_PLAGUE_SEARCHER))
+ if (!sSpellMgr->GetSpellInfo(SPELL_UNBOUND_PLAGUE_SEARCHER))
return false;
return true;
}
@@ -1217,11 +1217,11 @@ class spell_putricide_mutated_plague : public SpellScriptLoader
if (!caster)
return;
- uint32 triggerSpell = GetSpellProto()->EffectTriggerSpell[aurEff->GetEffIndex()];
- SpellEntry const* spell = sSpellStore.LookupEntry(triggerSpell);
+ uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
+ SpellInfo const* spell = sSpellMgr->GetSpellInfo(triggerSpell);
spell = sSpellMgr->GetSpellForDifficultyFromSpell(spell, caster);
- int32 damage = SpellMgr::CalculateSpellEffectAmount(spell, 0, caster);
+ int32 damage = spell->Effects[EFFECT_0].CalcValue(caster);
float multiplier = 2.0f;
if (GetTarget()->GetMap()->GetSpawnMode() & 1)
multiplier = 3.0f;
@@ -1234,7 +1234,7 @@ class spell_putricide_mutated_plague : public SpellScriptLoader
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
- uint32 healSpell = uint32(SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), 0));
+ uint32 healSpell = uint32(GetSpellInfo()->Effects[EFFECT_0].CalcValue());
GetTarget()->CastSpell(GetTarget(), healSpell, true, NULL, NULL, GetCasterGUID());
}
@@ -1398,9 +1398,9 @@ class spell_putricide_mutated_transformation : public SpellScriptLoader
return;
}
- uint32 entry = uint32(GetSpellInfo()->EffectMiscValue[effIndex]);
- SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(uint32(GetSpellInfo()->EffectMiscValueB[effIndex]));
- uint32 duration = uint32(GetSpellDuration(GetSpellInfo()));
+ uint32 entry = uint32(GetSpellInfo()->Effects[effIndex].MiscValue);
+ SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(uint32(GetSpellInfo()->Effects[effIndex].MiscValueB));
+ uint32 duration = uint32(GetSpellInfo()->GetDuration());
Position pos;
caster->GetPosition(&pos);
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
index 29c034c5ed5..2af2bdd53c4 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
@@ -148,7 +148,7 @@ class boss_rotface : public CreatureScript
professor->AI()->EnterEvadeMode();
}
- void SpellHitTarget(Unit* /*target*/, SpellEntry const* spell)
+ void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell)
{
if (spell->Id == SPELL_SLIME_SPRAY)
Talk(SAY_SLIME_SPRAY);
@@ -612,9 +612,9 @@ class spell_rotface_unstable_ooze_explosion_init : public SpellScriptLoader
{
PrepareSpellScript(spell_rotface_unstable_ooze_explosion_init_SpellScript);
- bool Validate(SpellEntry const* /*spell*/)
+ bool Validate(SpellInfo const* /*spell*/)
{
- if (!sSpellStore.LookupEntry(SPELL_UNSTABLE_OOZE_EXPLOSION_TRIGGER))
+ if (!sSpellMgr->GetSpellInfo(SPELL_UNSTABLE_OOZE_EXPLOSION_TRIGGER))
return false;
return true;
}
@@ -658,7 +658,7 @@ class spell_rotface_unstable_ooze_explosion : public SpellScriptLoader
if (!GetTargetUnit())
return;
- uint32 triggered_spell_id = GetSpellInfo()->EffectTriggerSpell[effIndex];
+ uint32 triggered_spell_id = GetSpellInfo()->Effects[effIndex].TriggerSpell;
float x, y, z;
GetTargetUnit()->GetPosition(x, y, z);
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
index afcdc59a921..24cfae54627 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
@@ -321,7 +321,7 @@ class boss_sindragosa : public CreatureScript
summon->AI()->JustDied(summon);
}
- void SpellHitTarget(Unit* target, SpellEntry const* spell)
+ void SpellHitTarget(Unit* target, SpellInfo const* spell)
{
if (uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(70127, me))
if (spellId == spell->Id)
@@ -1019,9 +1019,9 @@ class spell_sindragosa_instability : public SpellScriptLoader
{
PrepareAuraScript(spell_sindragosa_instability_AuraScript);
- bool Validate(SpellEntry const* /*spell*/)
+ bool Validate(SpellInfo const* /*spell*/)
{
- if (!sSpellStore.LookupEntry(SPELL_BACKLASH))
+ if (!sSpellMgr->GetSpellInfo(SPELL_BACKLASH))
return false;
return true;
}
@@ -1053,9 +1053,9 @@ class spell_sindragosa_frost_beacon : public SpellScriptLoader
{
PrepareAuraScript(spell_sindragosa_frost_beacon_AuraScript);
- bool Validate(SpellEntry const* /*spell*/)
+ bool Validate(SpellInfo const* /*spell*/)
{
- if (!sSpellStore.LookupEntry(SPELL_ICE_TOMB_DAMAGE))
+ if (!sSpellMgr->GetSpellInfo(SPELL_ICE_TOMB_DAMAGE))
return false;
return true;
}
@@ -1088,7 +1088,7 @@ class spell_sindragosa_ice_tomb : public SpellScriptLoader
{
PrepareSpellScript(spell_sindragosa_ice_tomb_SpellScript);
- bool Validate(SpellEntry const* /*spell*/)
+ bool Validate(SpellInfo const* /*spell*/)
{
if (!sObjectMgr->GetCreatureTemplate(NPC_ICE_TOMB))
return false;
@@ -1175,9 +1175,9 @@ class spell_sindragosa_collision_filter : public SpellScriptLoader
{
PrepareSpellScript(spell_sindragosa_collision_filter_SpellScript);
- bool Validate(SpellEntry const* /*spell*/)
+ bool Validate(SpellInfo const* /*spell*/)
{
- if (!sSpellStore.LookupEntry(SPELL_ICE_TOMB_DAMAGE))
+ if (!sSpellMgr->GetSpellInfo(SPELL_ICE_TOMB_DAMAGE))
return false;
return true;
}
@@ -1210,9 +1210,9 @@ class spell_sindragosa_icy_grip : public SpellScriptLoader
{
PrepareSpellScript(spell_sindragosa_icy_grip_SpellScript);
- bool Validate(SpellEntry const* /*spell*/)
+ bool Validate(SpellInfo const* /*spell*/)
{
- if (!sSpellStore.LookupEntry(SPELL_ICY_GRIP_JUMP))
+ if (!sSpellMgr->GetSpellInfo(SPELL_ICY_GRIP_JUMP))
return false;
return true;
}
@@ -1244,9 +1244,9 @@ class spell_rimefang_icy_blast : public SpellScriptLoader
{
PrepareSpellScript(spell_rimefang_icy_blast_SpellScript);
- bool Validate(SpellEntry const* /*spell*/)
+ bool Validate(SpellInfo const* /*spell*/)
{
- if (!sSpellStore.LookupEntry(SPELL_ICY_BLAST_AREA))
+ if (!sSpellMgr->GetSpellInfo(SPELL_ICY_BLAST_AREA))
return false;
return true;
}
@@ -1296,9 +1296,9 @@ class spell_frostwarden_handler_order_whelp : public SpellScriptLoader
{
PrepareSpellScript(spell_frostwarden_handler_order_whelp_SpellScript);
- bool Validate(SpellEntry const* /*spell*/)
+ bool Validate(SpellInfo const* /*spell*/)
{
- if (!sSpellStore.LookupEntry(SPELL_FOCUS_FIRE))
+ if (!sSpellMgr->GetSpellInfo(SPELL_FOCUS_FIRE))
return false;
return true;
}
@@ -1378,7 +1378,7 @@ class spell_frostwarden_handler_focus_fire : public SpellScriptLoader
PreventDefaultAction();
if (Unit* caster = GetCaster())
{
- caster->AddThreat(GetTarget(), -float(SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_1)));
+ caster->AddThreat(GetTarget(), -float(GetSpellInfo()->Effects[EFFECT_1].CalcValue()));
caster->GetAI()->SetData(DATA_WHELP_MARKER, 0);
}
}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
index eecba1ab785..e09ab90f5c7 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
@@ -387,7 +387,7 @@ class boss_valithria_dreamwalker : public CreatureScript
}
}
- void SpellHit(Unit* /*caster*/, SpellEntry const* spell)
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
{
if (spell->Id == SPELL_DREAM_SLIP)
{
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
index 6ffe61454df..09c19dd8a71 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
@@ -826,7 +826,7 @@ class boss_sister_svalna : public CreatureScript
}
}
- void SpellHit(Unit* caster, SpellEntry const* spell)
+ void SpellHit(Unit* caster, SpellInfo const* spell)
{
if (spell->Id == SPELL_HURL_SPEAR && me->HasAura(SPELL_AETHER_SHIELD))
{
@@ -835,7 +835,7 @@ class boss_sister_svalna : public CreatureScript
}
}
- void SpellHitTarget(Unit* target, SpellEntry const* spell)
+ void SpellHitTarget(Unit* target, SpellInfo const* spell)
{
switch (spell->Id)
{
@@ -1276,7 +1276,7 @@ struct npc_argent_captainAI : public ScriptedAI
Reset();
}
- void SpellHit(Unit* /*caster*/, SpellEntry const* spell)
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
{
if (spell->Id == SPELL_REVIVE_CHAMPION && !IsUndead)
{
@@ -1505,7 +1505,7 @@ class npc_captain_grondel : public CreatureScript
switch (eventId)
{
case EVENT_GRONDEL_CHARGE_CHECK:
- if (CanCast(me->getVictim(), sSpellStore.LookupEntry(SPELL_CHARGE)))
+ if (CanCast(me->getVictim(), sSpellMgr->GetSpellInfo(SPELL_CHARGE)))
DoCastVictim(SPELL_CHARGE);
Events.ScheduleEvent(EVENT_GRONDEL_CHARGE_CHECK, 500);
break;
@@ -1717,7 +1717,7 @@ class spell_icc_sprit_alarm : public SpellScriptLoader
{
PreventHitDefaultEffect(effIndex);
uint32 trapId = 0;
- switch (GetSpellInfo()->EffectMiscValue[effIndex])
+ switch (GetSpellInfo()->Effects[effIndex].MiscValue)
{
case EVENT_AWAKEN_WARD_1:
trapId = GO_SPIRIT_ALARM_1;
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h
index 4dc9a247960..19ae50ab364 100755
--- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h
+++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h
@@ -409,9 +409,9 @@ class spell_trigger_spell_from_caster : public SpellScriptLoader
public:
spell_trigger_spell_from_caster_SpellScript(uint32 triggerId) : SpellScript(), _triggerId(triggerId) { }
- bool Validate(SpellEntry const* /*spell*/)
+ bool Validate(SpellInfo const* /*spell*/)
{
- if (!sSpellStore.LookupEntry(_triggerId))
+ if (!sSpellMgr->GetSpellInfo(_triggerId))
return false;
return true;
}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp
index 3dd1e7f13b7..01391f029ce 100755
--- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp
@@ -53,7 +53,7 @@ class icecrown_citadel_teleport : public GameObjectScript
{
player->PlayerTalkClass->ClearMenus();
player->CLOSE_GOSSIP_MENU();
- SpellEntry const* spell = sSpellStore.LookupEntry(action);
+ SpellInfo const* spell = sSpellMgr->GetSpellInfo(action);
if (!spell)
return false;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp
index 85068c968d9..97594c168ef 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp
@@ -105,7 +105,7 @@ class boss_faerlina : public CreatureScript
DoScriptText(SAY_DEATH, me);
}
- void SpellHit(Unit* caster, SpellEntry const* spell)
+ void SpellHit(Unit* caster, SpellInfo const* spell)
{
if (spell->Id == SPELL_WIDOWS_EMBRACE || spell->Id == H_SPELL_WIDOWS_EMBRACE)
{
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
index 347bb688a07..2a93d170318 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
@@ -343,7 +343,7 @@ class boss_gothik : public CreatureScript
return false;
}
- void SpellHit(Unit* /*caster*/, SpellEntry const* spell)
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
{
uint32 spellId = 0;
switch(spell->Id)
@@ -366,7 +366,7 @@ class boss_gothik : public CreatureScript
damage = 0;
}
- void SpellHitTarget(Unit* target, SpellEntry const* spell)
+ void SpellHitTarget(Unit* target, SpellInfo const* spell)
{
if (!me->isInCombat())
return;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp
index a2902ce3ab3..b2184615bb3 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp
@@ -59,7 +59,7 @@ public:
events.ScheduleEvent(EVENT_BERSERK, 12*60000);
}
- void SpellHitTarget(Unit* target, const SpellEntry *spell)
+ void SpellHitTarget(Unit* target, const SpellInfo *spell)
{
if (spell->Id == uint32(SPELL_SLIME_SPRAY))
{
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
index d22070eafb1..a6d36e7eaa2 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
@@ -132,7 +132,7 @@ public:
CheckPlayersFrostResist();
}
- void SpellHitTarget(Unit* target, const SpellEntry *spell)
+ void SpellHitTarget(Unit* target, const SpellInfo *spell)
{
if (spell->Id == SPELL_ICEBOLT)
{
diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
index 88ccae482e3..1e255c3dcbd 100644
--- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
+++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
@@ -379,7 +379,7 @@ public:
}
}
- void SpellHit(Unit* caster, const SpellEntry* spell)
+ void SpellHit(Unit* caster, const SpellInfo* spell)
{
if (spell->Id == SPELL_POWER_SPARK_MALYGOS)
{
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
index 83bfe2b083f..88eda112e52 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
@@ -298,7 +298,7 @@ public:
me->DeleteThreatList();
}
- void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell)
+ void SpellHit(Unit* /*pCaster*/, const SpellInfo* pSpell)
{
switch(pSpell->Id)
{
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
index 5d35b94217e..8800c709f67 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
@@ -173,7 +173,7 @@ class npc_azure_ring_captain : public CreatureScript
me->SetReactState(REACT_AGGRESSIVE);
}
- void SpellHitTarget(Unit* target, SpellEntry const* spell)
+ void SpellHitTarget(Unit* target, SpellInfo const* spell)
{
if (spell->Id == SPELL_ICE_BEAM)
{
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
index f7b8cc166bf..21a84ba0083 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
@@ -143,7 +143,7 @@ public:
DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me);
}
- void SpellHit(Unit* /*caster*/, const SpellEntry* spell)
+ void SpellHit(Unit* /*caster*/, const SpellInfo* spell)
{
if (spell->Id == SPELL_DISPERSE)
{
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
index 8bb4624f3c6..07cd031e66b 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
@@ -427,7 +427,7 @@ public:
}
}
- void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell)
+ void SpellHit(Unit* /*pCaster*/, const SpellInfo* pSpell)
{
// This is the dummy effect of the spells
if (pSpell->Id == SPELL_SHATTER_N || pSpell->Id == SPELL_SHATTER_H)
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp
index 387eaecf70a..fdb938fb1ef 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp
@@ -157,7 +157,7 @@ public:
DoScriptText(SAY_KILL, me);
}
- void SpellHitTarget(Unit* target, const SpellEntry* pSpell)
+ void SpellHitTarget(Unit* target, const SpellInfo* pSpell)
{
//this part should be in the core
if (pSpell->Id == SPELL_SHATTER || pSpell->Id == H_SPELL_SHATTER)
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp
index bc9a6fdc6d3..62719c24640 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp
+++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp
@@ -316,7 +316,7 @@ class boss_flame_leviathan : public CreatureScript
//TODO: effect 0 and effect 1 may be on different target
//TODO: Move to spellscript
- void SpellHitTarget(Unit* target, SpellEntry const* spell)
+ void SpellHitTarget(Unit* target, SpellInfo const* spell)
{
if (spell->Id == SPELL_PURSUED)
AttackStart(target);
@@ -328,7 +328,7 @@ class boss_flame_leviathan : public CreatureScript
DoScriptText(SAY_DEATH, me);
}
- void SpellHit(Unit* /*caster*/, SpellEntry const* spell)
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
{
if (spell->Id == SPELL_START_THE_ENGINE)
vehicle->InstallAllAccessories(false);
@@ -845,7 +845,7 @@ class npc_pool_of_tar : public CreatureScript
damage = 0;
}
- void SpellHit(Unit* /*caster*/, SpellEntry const* spell)
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
{
if (spell->SchoolMask & SPELL_SCHOOL_MASK_FIRE && !me->HasAura(SPELL_BLAZE))
me->CastSpell(me, SPELL_BLAZE, true);
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_freya.cpp
index 788e6eb846d..1ae51c01a9a 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_freya.cpp
+++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_freya.cpp
@@ -1506,7 +1506,7 @@ class npc_unstable_sun_beam : public CreatureScript
despawnTimer -= diff;
}
- void SpellHitTarget(Unit* target, SpellEntry const* spell)
+ void SpellHitTarget(Unit* target, SpellInfo const* spell)
{
if (target && spell->Id == SPELL_UNSTABLE_ENERGY)
{
@@ -1540,7 +1540,7 @@ class spell_freya_attuned_to_nature_dose_reduction : public SpellScriptLoader
void HandleScript(SpellEffIndex /*effIndex*/)
{
Unit* target = GetHitUnit();
- SpellEntry const* spellInfo = GetSpellInfo();
+ SpellInfo const* spellInfo = GetSpellInfo();
switch (spellInfo->Id)
{
case SPELL_ATTUNED_TO_NATURE_2_DOSE_REDUCTION:
@@ -1589,7 +1589,7 @@ class spell_freya_iron_roots : public SpellScriptLoader
void HandleSummon(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
- uint32 entry = uint32(GetSpellInfo()->EffectMiscValue[effIndex]);
+ uint32 entry = uint32(GetSpellInfo()->Effects[effIndex].MiscValue);
Position pos;
GetCaster()->GetPosition(&pos);
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_general_vezax.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_general_vezax.cpp
index efaeae3fad3..de7a3ef2685 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_general_vezax.cpp
+++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_general_vezax.cpp
@@ -200,7 +200,7 @@ class boss_general_vezax : public CreatureScript
DoMeleeAttackIfReady();
}
- void SpellHitTarget(Unit* who, SpellEntry const* spell)
+ void SpellHitTarget(Unit* who, SpellInfo const* spell)
{
if (who && who->GetTypeId() == TYPEID_PLAYER && spell->Id == SPELL_SHADOW_CRASH_HIT)
shadowDodger = false;
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_hodir.cpp
index 5e6cc295230..b580da091c8 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_hodir.cpp
+++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_hodir.cpp
@@ -881,7 +881,7 @@ class npc_toasty_fire : public CreatureScript
DoCast(me, SPELL_SINGED, true);
}
- void SpellHit(Unit* /*who*/, const SpellEntry* spell)
+ void SpellHit(Unit* /*who*/, const SpellInfo* spell)
{
if (spell->Id == SPELL_BLOCK_OF_ICE || spell->Id == SPELL_ICE_SHARD || spell->Id == SPELL_ICE_SHARD_HIT)
{
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp
index 9633a7c69a8..574776166f3 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp
+++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp
@@ -430,11 +430,11 @@ class spell_ignis_slag_pot : public SpellScriptLoader
{
PrepareAuraScript(spell_ignis_slag_pot_AuraScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_SLAG_POT_DAMAGE))
+ if (!sSpellMgr->GetSpellInfo(SPELL_SLAG_POT_DAMAGE))
return false;
- if (!sSpellStore.LookupEntry(SPELL_SLAG_IMBUED))
+ if (!sSpellMgr->GetSpellInfo(SPELL_SLAG_IMBUED))
return false;
return true;
}
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_kologarn.cpp
index ffb878bd19f..cad50775878 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_kologarn.cpp
+++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_kologarn.cpp
@@ -461,10 +461,10 @@ class spell_ulduar_cancel_stone_grip : public SpellScriptLoader
switch (target->GetMap()->GetDifficulty())
{
case RAID_DIFFICULTY_10MAN_NORMAL:
- target->RemoveAura(SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), EFFECT_0));
+ target->RemoveAura(GetSpellInfo()->Effects[EFFECT_0].CalcValue());
break;
case RAID_DIFFICULTY_25MAN_NORMAL:
- target->RemoveAura(SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), EFFECT_1));
+ target->RemoveAura(GetSpellInfo()->Effects[EFFECT_1].CalcValue());
break;
default:
break;
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_razorscale.cpp
index 46bf7f99ae5..7547937868d 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_razorscale.cpp
+++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_razorscale.cpp
@@ -185,7 +185,7 @@ class boss_razorscale_controller : public CreatureScript
me->SetReactState(REACT_PASSIVE);
}
- void SpellHit(Unit* /*caster*/, SpellEntry const* spell)
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
{
switch (spell->Id)
{
@@ -360,7 +360,7 @@ class boss_razorscale : public CreatureScript
controller->AI()->Reset();
}
- void SpellHit(Unit* /*caster*/, SpellEntry const* spell)
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
{
if (spell->Id == SPELL_HARPOON_TRIGGER)
++HarpoonCounter;
@@ -1004,7 +1004,7 @@ class spell_razorscale_devouring_flame : public SpellScriptLoader
{
PreventHitDefaultEffect(effIndex);
Unit* caster = GetCaster();
- uint32 entry = uint32(GetSpellInfo()->EffectMiscValue[effIndex]);
+ uint32 entry = uint32(GetSpellInfo()->Effects[effIndex].MiscValue);
WorldLocation const* summonLocation = GetTargetDest();
if (!caster || !summonLocation)
return;
diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_xt002.cpp
index 8147456a884..8840fa6669e 100644
--- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_xt002.cpp
+++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_xt002.cpp
@@ -758,9 +758,9 @@ class spell_xt002_searing_light_spawn_life_spark : public SpellScriptLoader
{
PrepareAuraScript(spell_xt002_searing_light_spawn_life_spark_AuraScript);
- bool Validate(SpellEntry const* /*spell*/)
+ bool Validate(SpellInfo const* /*spell*/)
{
- if (!sSpellStore.LookupEntry(SPELL_SUMMON_LIFE_SPARK))
+ if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_LIFE_SPARK))
return false;
return true;
}
@@ -794,9 +794,9 @@ class spell_xt002_gravity_bomb_aura : public SpellScriptLoader
{
PrepareAuraScript(spell_xt002_gravity_bomb_aura_AuraScript);
- bool Validate(SpellEntry const* /*spell*/)
+ bool Validate(SpellInfo const* /*spell*/)
{
- if (!sSpellStore.LookupEntry(SPELL_SUMMON_VOID_ZONE))
+ if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_VOID_ZONE))
return false;
return true;
}
@@ -878,18 +878,18 @@ class spell_xt002_heart_overload_periodic : public SpellScriptLoader
{
PrepareSpellScript(spell_xt002_heart_overload_periodic_SpellScript);
- bool Validate(SpellEntry const* /*spell*/)
+ bool Validate(SpellInfo const* /*spell*/)
{
- if (!sSpellStore.LookupEntry(SPELL_ENERGY_ORB))
+ if (!sSpellMgr->GetSpellInfo(SPELL_ENERGY_ORB))
return false;
- if (!sSpellStore.LookupEntry(SPELL_RECHARGE_BOOMBOT))
+ if (!sSpellMgr->GetSpellInfo(SPELL_RECHARGE_BOOMBOT))
return false;
- if (!sSpellStore.LookupEntry(SPELL_RECHARGE_PUMMELER))
+ if (!sSpellMgr->GetSpellInfo(SPELL_RECHARGE_PUMMELER))
return false;
- if (!sSpellStore.LookupEntry(SPELL_RECHARGE_SCRAPBOT))
+ if (!sSpellMgr->GetSpellInfo(SPELL_RECHARGE_SCRAPBOT))
return false;
return true;
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
index eea405e57a4..c970d27cb23 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
@@ -276,7 +276,7 @@ public:
Summons.Despawn(summoned);
}
- void SpellHit(Unit* /*caster*/, const SpellEntry *spell)
+ void SpellHit(Unit* /*caster*/, const SpellInfo *spell)
{
if (spell->Id == SPELL_HARPOON_DAMAGE)
{
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
index f7f9dcae844..dbc6d3f5613 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
@@ -191,7 +191,7 @@ public:
pInstance->SetData(DATA_KING_YMIRON_EVENT, IN_PROGRESS);
}
- void SpellHitTarget(Unit* who, SpellEntry const* spell)
+ void SpellHitTarget(Unit* who, SpellInfo const* spell)
{
if (who && who->GetTypeId() == TYPEID_PLAYER && spell->Id == 59302)
kingsBane = false;
diff --git a/src/server/scripts/Northrend/borean_tundra.cpp b/src/server/scripts/Northrend/borean_tundra.cpp
index 8a1a8e3a7b9..887a991d762 100644
--- a/src/server/scripts/Northrend/borean_tundra.cpp
+++ b/src/server/scripts/Northrend/borean_tundra.cpp
@@ -73,7 +73,7 @@ public:
casterGuid = 0;
}
- void SpellHit(Unit* caster, const SpellEntry *spell)
+ void SpellHit(Unit* caster, const SpellInfo *spell)
{
if (Phase)
return;
@@ -866,7 +866,7 @@ public:
AttackStart(who);
}
- void SpellHit(Unit* caster, const SpellEntry *spell)
+ void SpellHit(Unit* caster, const SpellInfo *spell)
{
if (spell->Id == SPELL_DRAKE_HARPOON && caster->GetTypeId() == TYPEID_PLAYER)
{
@@ -1622,7 +1622,7 @@ public:
AttackStart(who);
}
- void SpellHit(Unit* pCaster, const SpellEntry* pSpell)
+ void SpellHit(Unit* pCaster, const SpellInfo* pSpell)
{
if (pSpell->Id == SPELL_ARCANE_CHAINS && pCaster->GetTypeId() == TYPEID_PLAYER && !HealthAbovePct(50) && !bEnslaved)
{
@@ -1706,7 +1706,7 @@ public:
{
}
- void SpellHit(Unit* pUnit, const SpellEntry* pSpell)
+ void SpellHit(Unit* pUnit, const SpellInfo* pSpell)
{
if (pSpell->Id == SPELL_NEURAL_NEEDLE && pUnit->GetTypeId() == TYPEID_PLAYER)
{
diff --git a/src/server/scripts/Northrend/grizzly_hills.cpp b/src/server/scripts/Northrend/grizzly_hills.cpp
index 3885658beb1..877b649e630 100644
--- a/src/server/scripts/Northrend/grizzly_hills.cpp
+++ b/src/server/scripts/Northrend/grizzly_hills.cpp
@@ -421,7 +421,7 @@ public:
m_gender = uiData;
}
- void SpellHit(Unit* pCaster, const SpellEntry* pSpell)
+ void SpellHit(Unit* pCaster, const SpellInfo* pSpell)
{
if (pSpell->Id == SPELL_OUTHOUSE_GROANS)
{
@@ -594,7 +594,7 @@ public:
me->DespawnOrUnsummon(DespawnTimer);
}
- void SpellHit(Unit* caster, const SpellEntry *spell)
+ void SpellHit(Unit* caster, const SpellInfo *spell)
{
if (spell->Id == SPELL_RENEW_SKIRMISHER && caster->GetTypeId() == TYPEID_PLAYER
&& caster->ToPlayer()->GetQuestStatus(12288) == QUEST_STATUS_INCOMPLETE)
@@ -784,7 +784,7 @@ public:
DoMeleeAttackIfReady();
}
- void SpellHit(Unit* pCaster, const SpellEntry *pSpell)
+ void SpellHit(Unit* pCaster, const SpellInfo *pSpell)
{
if (pCaster && pCaster->GetTypeId() == TYPEID_PLAYER && pSpell->Id == SPELL_SMOKE_BOMB)
{
diff --git a/src/server/scripts/Northrend/sholazar_basin.cpp b/src/server/scripts/Northrend/sholazar_basin.cpp
index dbbd7f9a765..ebdaded0ba0 100644
--- a/src/server/scripts/Northrend/sholazar_basin.cpp
+++ b/src/server/scripts/Northrend/sholazar_basin.cpp
@@ -543,7 +543,7 @@ public:
sayTimer -= uiDiff;
}
- void SpellHit(Unit* caster, const SpellEntry* proto)
+ void SpellHit(Unit* caster, const SpellInfo* proto)
{
if (!proto || proto->Id != SPELL_OFFER)
return;
diff --git a/src/server/scripts/Northrend/storm_peaks.cpp b/src/server/scripts/Northrend/storm_peaks.cpp
index b5b9d6bcc36..4d471996ba0 100644
--- a/src/server/scripts/Northrend/storm_peaks.cpp
+++ b/src/server/scripts/Northrend/storm_peaks.cpp
@@ -638,7 +638,7 @@ public:
}
}
- void SpellHit(Unit* hitter, const SpellEntry* spell)
+ void SpellHit(Unit* hitter, const SpellInfo* spell)
{
if (!hitter || !spell)
return;
diff --git a/src/server/scripts/Northrend/zuldrak.cpp b/src/server/scripts/Northrend/zuldrak.cpp
index ee36328e3e8..be51678a7db 100644
--- a/src/server/scripts/Northrend/zuldrak.cpp
+++ b/src/server/scripts/Northrend/zuldrak.cpp
@@ -83,7 +83,7 @@ public:
me->setDeathState(DEAD);
}
- void SpellHit(Unit* pCaster, const SpellEntry* pSpell)
+ void SpellHit(Unit* pCaster, const SpellInfo* pSpell)
{
if (pSpell->Id == SPELL_UNLOCK_SHACKLE)
{
@@ -146,7 +146,7 @@ public:
void MoveInLineOfSight(Unit* /*who*/){}
- void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell)
+ void SpellHit(Unit* /*pCaster*/, const SpellInfo* pSpell)
{
if (pSpell->Id == SPELL_FREE_RAGECLAW)
{
@@ -1043,14 +1043,14 @@ public:
uint32 uiElementalSpellTimer;
uint8 uiBossRandom;
- uint32 uiSpellEntry;
+ uint32 uiSpellInfo;
bool bAddAttack;
void Reset()
{
uiBossRandom = 0;
- uiSpellEntry = 0;
+ uiSpellInfo = 0;
uiElementalSpellTimer = urand(5000, 8000);
bAddAttack = false;
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp
index 250d4927894..cec706eda08 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp
@@ -98,7 +98,7 @@ public:
void EnterCombat(Unit* /*who*/) { }
// Sonic Boom instant damage (needs core fix instead of this)
- void SpellHitTarget(Unit* target, const SpellEntry *spell)
+ void SpellHitTarget(Unit* target, const SpellInfo *spell)
{
if (target && target->isAlive() && spell && spell->Id == uint32(SPELL_SONIC_BOOM_EFFECT))
me->DealDamage(target, (target->GetHealth()*90)/100, NULL, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NATURE, spell);
diff --git a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp
index b1384a84d39..b1f17c38737 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp
@@ -163,7 +163,7 @@ public:
targets.resize(5);
//Aura each player in the targets list with Bloodboil. Aura code copied+pasted from Aura command in Level3.cpp
- /*SpellEntry const *spellInfo = GetSpellStore()->LookupEntry(SPELL_BLOODBOIL);
+ /*SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(SPELL_BLOODBOIL);
if (spellInfo)
{
for (std::list<Unit* >::const_iterator itr = targets.begin(); itr != targets.end(); ++itr)
diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
index fe2c068909d..32ad878c2ac 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
@@ -471,10 +471,6 @@ public:
{
pInstance = c->GetInstanceScript();
DoCast(me, SPELL_DUAL_WIELD, true);
-
- SpellEntry *TempSpell = GET_SPELL(SPELL_SHADOWFIEND_PASSIVE);
- if (TempSpell)
- TempSpell->EffectApplyAuraName[0] = 4; // proc debuff, and summon infinite fiends
}
InstanceScript* pInstance;
@@ -589,7 +585,7 @@ public:
done_by->AddThreat(me, -(3*(float)damage)/4); // do not let maiev tank him
}
- void SpellHit(Unit* /*caster*/, const SpellEntry *spell)
+ void SpellHit(Unit* /*caster*/, const SpellInfo *spell)
{
if (spell->Id == SPELL_GLAIVE_RETURNS) // Re-equip our warblades!
{
@@ -2167,7 +2163,7 @@ public:
{
blade_of_azzinothAI(Creature* c) : NullCreatureAI(c) {}
- void SpellHit(Unit* /*caster*/, const SpellEntry *spell)
+ void SpellHit(Unit* /*caster*/, const SpellInfo *spell)
{
if (spell->Id == SPELL_THROW_GLAIVE2 || spell->Id == SPELL_THROW_GLAIVE)
me->SetDisplayId(21431);//appear when hit by Illidan's glaive
diff --git a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
index d0e4258e986..8b057949b2e 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
@@ -536,11 +536,11 @@ public:
}
}
- void SpellHit(Unit* /*caster*/, const SpellEntry *spell)
+ void SpellHit(Unit* /*caster*/, const SpellInfo *spell)
{
if (me->GetCurrentSpell(CURRENT_GENERIC_SPELL))
for (uint8 i = 0; i < 3; ++i)
- if (spell->Effect[i] == SPELL_EFFECT_INTERRUPT_CAST)
+ if (spell->Effects[i].Effect == SPELL_EFFECT_INTERRUPT_CAST)
if (me->GetCurrentSpell(CURRENT_GENERIC_SPELL)->m_spellInfo->Id == SPELL_SOUL_SHOCK
|| me->GetCurrentSpell(CURRENT_GENERIC_SPELL)->m_spellInfo->Id == SPELL_DEADEN)
me->InterruptSpell(CURRENT_GENERIC_SPELL, false);
diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
index 4d2d866ecf5..6f5dfba9a9c 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
@@ -106,7 +106,7 @@ public:
DoScriptText(SAY_DEATH, me);
}
- void SpellHit(Unit* /*caster*/, const SpellEntry *spell)
+ void SpellHit(Unit* /*caster*/, const SpellInfo *spell)
{
if (spell->Id == SPELL_HURL_SPINE && me->HasAura(SPELL_TIDAL_SHIELD))
{
diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
index d4edaa8f36f..f4785d847a2 100644
--- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
+++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
@@ -891,9 +891,9 @@ public:
{
PrepareAuraScript(spell_boss_lady_malande_shield_AuraScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- return sSpellStore.LookupEntry(SPELL_REFLECTIVE_SHIELD_T);
+ return sSpellMgr->GetSpellInfo(SPELL_REFLECTIVE_SHIELD_T);
}
void Trigger(AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp
index f9d16f5fc6c..d058f73cb04 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp
@@ -515,7 +515,7 @@ public:
if (tempTarget && tempTarget->GetTypeId() == TYPEID_PLAYER && tempTarget->GetGUID() != me->getVictim()->GetGUID() && TargetList.size()<5)
TargetList.push_back(tempTarget);
}
- //SpellEntry *spell = GET_SPELL(SPELL_INSIDIOUS_WHISPER);
+ //SpellInfo *spell = GET_SPELL(SPELL_INSIDIOUS_WHISPER);
for (std::vector<Unit* >::const_iterator itr = TargetList.begin(); itr != TargetList.end(); ++itr)
{
if ((*itr) && (*itr)->isAlive())
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp
index 7cd0c5a09c0..d5d3d8a81ba 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp
@@ -81,13 +81,6 @@ public:
boss_the_lurker_belowAI(Creature* c) : Scripted_NoMovementAI(c), Summons(me)
{
pInstance = c->GetInstanceScript();
- SpellEntry *TempSpell = GET_SPELL(SPELL_SPOUT_ANIM);
- if (TempSpell)
- {
- TempSpell->Effect[0] = 0;//remove all spell effect, only anim is needed
- TempSpell->Effect[1] = 0;
- TempSpell->Effect[2] = 0;
- }
}
InstanceScript* pInstance;
@@ -410,9 +403,6 @@ public:
{
mob_coilfang_ambusherAI(Creature* c) : Scripted_NoMovementAI(c)
{
- SpellEntry *TempSpell = GET_SPELL(SPELL_SHOOT);
- if (TempSpell)
- TempSpell->Effect[0] = 2;//change spell effect from weapon % dmg to simple phisical dmg
}
uint32 MultiShotTimer;
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp
index bb6acdae778..83ae22222de 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp
@@ -148,7 +148,7 @@ public:
DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me);
}
- void SpellHit(Unit* /*caster*/, const SpellEntry *spell)
+ void SpellHit(Unit* /*caster*/, const SpellInfo *spell)
{
//hack :(
if (spell->Id == SPELL_WARLORDS_RAGE_PROC)
diff --git a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp
index af62a78fe8d..6479cdd3d6d 100644
--- a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp
+++ b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp
@@ -120,7 +120,7 @@ public:
}
}
- void SpellHitTarget(Unit* target, const SpellEntry* pSpell)
+ void SpellHitTarget(Unit* target, const SpellInfo* pSpell)
{
//This to emulate effect1 (77) of SPELL_GROUND_SLAM, knock back to any direction
//It's initially wrong, since this will cause fall damage, which is by comments, not intended.
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp
index 37a2dccec2f..7558a10d7bf 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp
@@ -247,7 +247,7 @@ class boss_kelidan_the_breaker : public CreatureScript
DoScriptText(SAY_NOVA, me);
- if (SpellEntry *nova = GET_SPELL(SPELL_BURNING_NOVA))
+ if (SpellInfo const* nova = sSpellMgr->GetSpellInfo(SPELL_BURNING_NOVA))
{
if (Aura * aura = Aura::TryRefreshStackOrCreate(nova, MAX_EFFECT_MASK, me, me))
aura->ApplyForTargets();
diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp
index 6034e35936c..aad3eb1a544 100644
--- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp
@@ -95,7 +95,7 @@ class boss_nazan : public CreatureScript
uint32 Turn_Timer;
bool flight;
uint64 VazrudenGUID;
- SpellEntry *liquid_fire;
+ SpellInfo *liquid_fire;
void Reset()
{
@@ -117,7 +117,7 @@ class boss_nazan : public CreatureScript
}
}
- void SpellHitTarget(Unit* target, const SpellEntry* entry)
+ void SpellHitTarget(Unit* target, const SpellInfo* entry)
{
if (target && entry->Id == uint32(SPELL_FIREBALL))
me->SummonCreature(ENTRY_LIQUID_FIRE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 30000);
diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
index ccc2f0712f8..5166a276ac3 100644
--- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
@@ -72,7 +72,7 @@ enum eSpells
SPELL_CLEAVE = 30619,
SPELL_QUAKE_TRIGGER = 30657, //must be cast with 30561 as the proc spell
SPELL_QUAKE_KNOCKBACK = 30571,
- SPELL_BLAZE_TARGET = 30541, //core bug, does not support target 7
+ SPELL_BLAZE_TARGET = 30541,
SPELL_BLAZE_TRAP = 30542,
SPELL_DEBRIS_KNOCKDOWN = 36449,
SPELL_DEBRIS_VISUAL = 30632,
@@ -124,7 +124,7 @@ class mob_abyssal : public CreatureScript
FireBlast_Timer = 6000;
}
- void SpellHit(Unit*, const SpellEntry *spell)
+ void SpellHit(Unit*, const SpellInfo *spell)
{
if (trigger == 2 && spell->Id == SPELL_BLAZE_TARGET)
{
@@ -220,20 +220,6 @@ class boss_magtheridon : public CreatureScript
pInstance = creature->GetInstanceScript();
me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 10);
me->SetFloatValue(UNIT_FIELD_COMBATREACH, 10);
-
- // target 7, random target with certain entry spell, need core fix
- SpellEntry *TempSpell;
- TempSpell = GET_SPELL(SPELL_BLAZE_TARGET);
- if (TempSpell && TempSpell->EffectImplicitTargetA[0] != 6)
- {
- TempSpell->EffectImplicitTargetA[0] = 6;
- TempSpell->EffectImplicitTargetB[0] = 0;
- }
- TempSpell = GET_SPELL(SPELL_QUAKE_TRIGGER);
- if (TempSpell && TempSpell->EffectTriggerSpell[0] != SPELL_QUAKE_KNOCKBACK)
- {
- TempSpell->EffectTriggerSpell[0] = SPELL_QUAKE_KNOCKBACK;
- }
}
CubeMap Cube;
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
index d25d10cc6a7..87df08d9bf5 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
@@ -190,7 +190,7 @@ class boss_alar : public CreatureScript
}
}
- void SpellHit(Unit*, const SpellEntry *spell)
+ void SpellHit(Unit*, const SpellInfo *spell)
{
if (spell->Id == SPELL_DIVE_BOMB_VISUAL)
{
diff --git a/src/server/scripts/Outland/blades_edge_mountains.cpp b/src/server/scripts/Outland/blades_edge_mountains.cpp
index 1ae5ff2115f..79d111bfaf8 100644
--- a/src/server/scripts/Outland/blades_edge_mountains.cpp
+++ b/src/server/scripts/Outland/blades_edge_mountains.cpp
@@ -157,7 +157,7 @@ public:
}
}
- void SpellHit(Unit* caster, const SpellEntry *spell)
+ void SpellHit(Unit* caster, const SpellInfo *spell)
{
if (spell->Id == SPELL_T_PHASE_MODULATOR && caster->GetTypeId() == TYPEID_PLAYER)
{
diff --git a/src/server/scripts/Outland/nagrand.cpp b/src/server/scripts/Outland/nagrand.cpp
index 40d40b15a58..a18f16fbf2c 100644
--- a/src/server/scripts/Outland/nagrand.cpp
+++ b/src/server/scripts/Outland/nagrand.cpp
@@ -65,7 +65,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void SpellHit(Unit* Hitter, const SpellEntry *Spellkind)
+ void SpellHit(Unit* Hitter, const SpellInfo *Spellkind)
{
if (Spellkind->Id == 32001 && !Spawn)
{
@@ -269,7 +269,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void SpellHit(Unit* /*caster*/, const SpellEntry *spell)
+ void SpellHit(Unit* /*caster*/, const SpellInfo *spell)
{
if (spell->Id == 32146)
{
@@ -690,7 +690,7 @@ public:
}
- void SpellHitTarget(Unit* /*pTarget*/, const SpellEntry* pSpell)
+ void SpellHitTarget(Unit* /*pTarget*/, const SpellInfo* pSpell)
{
if (pSpell->Id == SPELL_CHAIN_LIGHTNING)
{
@@ -877,7 +877,7 @@ public:
ScriptedAI::UpdateAI(diff);
}
- void SpellHit(Unit* caster, const SpellEntry *spell)
+ void SpellHit(Unit* caster, const SpellInfo *spell)
{
if (caster->GetTypeId() == TYPEID_PLAYER)
{
diff --git a/src/server/scripts/Outland/netherstorm.cpp b/src/server/scripts/Outland/netherstorm.cpp
index 4437a71a9af..3620f09e7c8 100644
--- a/src/server/scripts/Outland/netherstorm.cpp
+++ b/src/server/scripts/Outland/netherstorm.cpp
@@ -100,7 +100,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- /*void SpellHit(Unit* caster, const SpellEntry *spell)
+ /*void SpellHit(Unit* caster, const SpellInfo *spell)
{
//we have no way of telling the Creature was hit by spell -> got aura applied after 10-12 seconds
//then no way for the mobs to actually stop the shutdown as intended.
@@ -782,7 +782,7 @@ public:
PlayerGUID = who->GetGUID();
}
- void SpellHit(Unit* /*caster*/, const SpellEntry * /*spell*/)
+ void SpellHit(Unit* /*caster*/, const SpellInfo * /*spell*/)
{
DoCast(me, SPELL_DE_MATERIALIZE);
}
diff --git a/src/server/scripts/Outland/shadowmoon_valley.cpp b/src/server/scripts/Outland/shadowmoon_valley.cpp
index 87a279a8113..6236a7658e6 100644
--- a/src/server/scripts/Outland/shadowmoon_valley.cpp
+++ b/src/server/scripts/Outland/shadowmoon_valley.cpp
@@ -96,7 +96,7 @@ public:
CastTimer = 5000;
}
- void SpellHit(Unit* pCaster, SpellEntry const* pSpell)
+ void SpellHit(Unit* pCaster, SpellInfo const* pSpell)
{
if (bCanEat || bIsEating)
return;
@@ -228,7 +228,7 @@ public:
me->SetVisible(true);
}
- void SpellHit(Unit* caster, const SpellEntry* spell)
+ void SpellHit(Unit* caster, const SpellInfo* spell)
{
if (!caster)
return;
@@ -353,7 +353,7 @@ public:
PoisonTimer = 0;
}
- void SpellHit(Unit* caster, const SpellEntry* spell)
+ void SpellHit(Unit* caster, const SpellInfo* spell)
{
if (!caster)
return;
diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp
index 8ae4a6dbf9c..b6384d5f185 100644
--- a/src/server/scripts/Spells/spell_dk.cpp
+++ b/src/server/scripts/Spells/spell_dk.cpp
@@ -55,7 +55,7 @@ class spell_dk_anti_magic_shell_raid : public SpellScriptLoader
bool Load()
{
- absorbPct = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_0, GetCaster());
+ absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster());
return true;
}
@@ -96,14 +96,14 @@ class spell_dk_anti_magic_shell_self : public SpellScriptLoader
uint32 absorbPct, hpPct;
bool Load()
{
- absorbPct = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_0, GetCaster());
- hpPct = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_1, GetCaster());
+ absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster());
+ hpPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(GetCaster());
return true;
}
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- return sSpellStore.LookupEntry(DK_SPELL_RUNIC_POWER_ENERGIZE);
+ return sSpellMgr->GetSpellInfo(DK_SPELL_RUNIC_POWER_ENERGIZE);
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
@@ -154,19 +154,19 @@ class spell_dk_anti_magic_zone : public SpellScriptLoader
bool Load()
{
- absorbPct = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_0, GetCaster());
+ absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster());
return true;
}
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- return sSpellStore.LookupEntry(DK_SPELL_ANTI_MAGIC_SHELL_TALENT);
+ return sSpellMgr->GetSpellInfo(DK_SPELL_ANTI_MAGIC_SHELL_TALENT);
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
{
- SpellEntry const* talentSpell = sSpellStore.LookupEntry(DK_SPELL_ANTI_MAGIC_SHELL_TALENT);
- amount = SpellMgr::CalculateSpellEffectAmount(talentSpell, EFFECT_0, GetCaster());
+ SpellInfo const* talentSpell = sSpellMgr->GetSpellInfo(DK_SPELL_ANTI_MAGIC_SHELL_TALENT);
+ amount = talentSpell->Effects[EFFECT_0].CalcValue(GetCaster());
// assume caster is a player here
if (Unit* caster = GetCaster())
amount += int32(2 * caster->ToPlayer()->GetTotalAttackPowerValue(BASE_ATTACK));
@@ -200,11 +200,11 @@ class spell_dk_corpse_explosion : public SpellScriptLoader
{
PrepareSpellScript(spell_dk_corpse_explosion_SpellScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(DK_SPELL_CORPSE_EXPLOSION_TRIGGERED))
+ if (!sSpellMgr->GetSpellInfo(DK_SPELL_CORPSE_EXPLOSION_TRIGGERED))
return false;
- if (!sSpellStore.LookupEntry(DK_SPELL_GHOUL_EXPLODE))
+ if (!sSpellMgr->GetSpellInfo(DK_SPELL_GHOUL_EXPLODE))
return false;
return true;
}
@@ -222,7 +222,7 @@ class spell_dk_corpse_explosion : public SpellScriptLoader
else // Some corpse
{
bp = GetEffectValue();
- GetCaster()->CastCustomSpell(unitTarget, SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), 1), &bp, NULL, NULL, true);
+ GetCaster()->CastCustomSpell(unitTarget, GetSpellInfo()->Effects[EFFECT_1].CalcValue(), &bp, NULL, NULL, true);
// Corpse Explosion (Suicide)
unitTarget->CastSpell(unitTarget, DK_SPELL_CORPSE_EXPLOSION_TRIGGERED, true);
// Set corpse look
@@ -374,9 +374,9 @@ class spell_dk_scourge_strike : public SpellScriptLoader
{
PrepareSpellScript(spell_dk_scourge_strike_SpellScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(DK_SPELL_SCOURGE_STRIKE_TRIGGERED))
+ if (!sSpellMgr->GetSpellInfo(DK_SPELL_SCOURGE_STRIKE_TRIGGERED))
return false;
return true;
}
@@ -417,7 +417,7 @@ class spell_dk_spell_deflection : public SpellScriptLoader
bool Load()
{
- absorbPct = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_0, GetCaster());
+ absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster());
return true;
}
@@ -457,9 +457,9 @@ class spell_dk_blood_boil : public SpellScriptLoader
{
PrepareSpellScript(spell_dk_blood_boil_SpellScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(DK_SPELL_BLOOD_BOIL_TRIGGERED))
+ if (!sSpellMgr->GetSpellInfo(DK_SPELL_BLOOD_BOIL_TRIGGERED))
return false;
return true;
}
@@ -503,7 +503,7 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader
{
PrepareAuraScript(spell_dk_will_of_the_necropolis_AuraScript);
- bool Validate(SpellEntry const *spellEntry)
+ bool Validate(SpellInfo const *spellEntry)
{
// can't use other spell than will of the necropolis due to spell_ranks dependency
if (sSpellMgr->GetFirstSpellInChain(DK_SPELL_WILL_OF_THE_NECROPOLIS_AURA_R1) != sSpellMgr->GetFirstSpellInChain(spellEntry->Id))
@@ -520,7 +520,7 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader
bool Load()
{
- absorbPct = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_0, GetCaster());
+ absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster());
return true;
}
@@ -533,11 +533,11 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader
void Absorb(AuraEffect * /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
// min pct of hp is stored in effect 0 of talent spell
- uint32 rank = sSpellMgr->GetSpellRank(GetSpellProto()->Id);
- SpellEntry const* talentProto = sSpellStore.LookupEntry(sSpellMgr->GetSpellWithRank(DK_SPELL_WILL_OF_THE_NECROPOLIS_TALENT_R1, rank));
+ uint32 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
+ SpellInfo const* talentProto = sSpellMgr->GetSpellInfo(sSpellMgr->GetSpellWithRank(DK_SPELL_WILL_OF_THE_NECROPOLIS_TALENT_R1, rank));
int32 remainingHp = int32(GetTarget()->GetHealth() - dmgInfo.GetDamage());
- int32 minHp = int32(GetTarget()->CountPctFromMaxHealth(SpellMgr::CalculateSpellEffectAmount(talentProto, EFFECT_0, GetCaster())));
+ int32 minHp = int32(GetTarget()->CountPctFromMaxHealth(talentProto->Effects[EFFECT_0].CalcValue(GetCaster())));
// Damage that would take you below [effect0] health or taken while you are at [effect0]
if (remainingHp < minHp)
@@ -566,11 +566,11 @@ public:
class spell_dk_improved_blood_presence_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_improved_blood_presence_AuraScript)
- bool Validate(SpellEntry const* /*entry*/)
+ bool Validate(SpellInfo const* /*entry*/)
{
- if (!sSpellStore.LookupEntry(DK_SPELL_BLOOD_PRESENCE))
+ if (!sSpellMgr->GetSpellInfo(DK_SPELL_BLOOD_PRESENCE))
return false;
- if (!sSpellStore.LookupEntry(DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED))
+ if (!sSpellMgr->GetSpellInfo(DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED))
return false;
return true;
}
@@ -614,11 +614,11 @@ public:
class spell_dk_improved_unholy_presence_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_improved_unholy_presence_AuraScript)
- bool Validate(SpellEntry const* /*entry*/)
+ bool Validate(SpellInfo const* /*entry*/)
{
- if (!sSpellStore.LookupEntry(DK_SPELL_UNHOLY_PRESENCE))
+ if (!sSpellMgr->GetSpellInfo(DK_SPELL_UNHOLY_PRESENCE))
return false;
- if (!sSpellStore.LookupEntry(DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED))
+ if (!sSpellMgr->GetSpellInfo(DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED))
return false;
return true;
}
@@ -629,7 +629,7 @@ public:
if (target->HasAura(DK_SPELL_UNHOLY_PRESENCE) && !target->HasAura(DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED))
{
// Not listed as any effect, only base points set in dbc
- int32 basePoints0 = SpellMgr::CalculateSpellEffectAmount(aurEff->GetSpellProto(), 1);
+ int32 basePoints0 = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue();
target->CastCustomSpell(target, DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED, &basePoints0 , &basePoints0, &basePoints0, true, 0, aurEff);
}
}
diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp
index c9d8b31e0b9..fec95a2294d 100644
--- a/src/server/scripts/Spells/spell_druid.cpp
+++ b/src/server/scripts/Spells/spell_druid.cpp
@@ -40,11 +40,11 @@ class spell_dru_glyph_of_starfire : public SpellScriptLoader
{
PrepareSpellScript(spell_dru_glyph_of_starfire_SpellScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(DRUID_INCREASED_MOONFIRE_DURATION))
+ if (!sSpellMgr->GetSpellInfo(DRUID_INCREASED_MOONFIRE_DURATION))
return false;
- if (!sSpellStore.LookupEntry(DRUID_NATURES_SPLENDOR))
+ if (!sSpellMgr->GetSpellInfo(DRUID_NATURES_SPLENDOR))
return false;
return true;
}
@@ -58,7 +58,7 @@ class spell_dru_glyph_of_starfire : public SpellScriptLoader
Aura* aura = aurEff->GetBase();
uint32 countMin = aura->GetMaxDuration();
- uint32 countMax = GetSpellMaxDuration(aura->GetSpellProto()) + 9000;
+ uint32 countMax = aura->GetSpellInfo()->GetMaxDuration() + 9000;
if (caster->HasAura(DRUID_INCREASED_MOONFIRE_DURATION))
countMax += 3000;
if (caster->HasAura(DRUID_NATURES_SPLENDOR))
@@ -98,7 +98,7 @@ class spell_dru_moonkin_form_passive : public SpellScriptLoader
bool Load()
{
- absorbPct = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_0, GetCaster());
+ absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster());
return true;
}
@@ -142,7 +142,7 @@ class spell_dru_primal_tenacity : public SpellScriptLoader
bool Load()
{
- absorbPct = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_1, GetCaster());
+ absorbPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(GetCaster());
return true;
}
@@ -186,7 +186,7 @@ class spell_dru_savage_defense : public SpellScriptLoader
bool Load()
{
- absorbPct = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_0, GetCaster());
+ absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster());
return true;
}
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 5d8584e3cd1..5c41744b664 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -40,7 +40,7 @@ class spell_gen_absorb0_hitlimit1 : public SpellScriptLoader
bool Load()
{
// Max absorb stored in 1 dummy effect
- limit = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_1);
+ limit = GetSpellInfo()->Effects[EFFECT_1].CalcValue();
return true;
}
@@ -177,11 +177,11 @@ class spell_gen_parachute : public SpellScriptLoader
{
PrepareAuraScript(spell_gen_parachute_AuraScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_PARACHUTE))
+ if (!sSpellMgr->GetSpellInfo(SPELL_PARACHUTE))
return false;
- if (!sSpellStore.LookupEntry(SPELL_PARACHUTE_BUFF))
+ if (!sSpellMgr->GetSpellInfo(SPELL_PARACHUTE_BUFF))
return false;
return true;
}
@@ -320,11 +320,11 @@ class spell_gen_leeching_swarm : public SpellScriptLoader
{
PrepareAuraScript(spell_gen_leeching_swarm_AuraScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_LEECHING_SWARM_DMG))
+ if (!sSpellMgr->GetSpellInfo(SPELL_LEECHING_SWARM_DMG))
return false;
- if (!sSpellStore.LookupEntry(SPELL_LEECHING_SWARM_HEAL))
+ if (!sSpellMgr->GetSpellInfo(SPELL_LEECHING_SWARM_HEAL))
return false;
return true;
}
@@ -378,27 +378,27 @@ class spell_gen_trick : public SpellScriptLoader
class spell_gen_trick_SpellScript : public SpellScript
{
PrepareSpellScript(spell_gen_trick_SpellScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_PIRATE_COSTUME_MALE))
+ if (!sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_MALE))
return false;
- if (!sSpellStore.LookupEntry(SPELL_PIRATE_COSTUME_FEMALE))
+ if (!sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_FEMALE))
return false;
- if (!sSpellStore.LookupEntry(SPELL_NINJA_COSTUME_MALE))
+ if (!sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_MALE))
return false;
- if (!sSpellStore.LookupEntry(SPELL_NINJA_COSTUME_FEMALE))
+ if (!sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_FEMALE))
return false;
- if (!sSpellStore.LookupEntry(SPELL_LEPER_GNOME_COSTUME_MALE))
+ if (!sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_MALE))
return false;
- if (!sSpellStore.LookupEntry(SPELL_LEPER_GNOME_COSTUME_FEMALE))
+ if (!sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_FEMALE))
return false;
- if (!sSpellStore.LookupEntry(SPELL_SKELETON_COSTUME))
+ if (!sSpellMgr->GetSpellInfo(SPELL_SKELETON_COSTUME))
return false;
- if (!sSpellStore.LookupEntry(SPELL_GHOST_COSTUME_MALE))
+ if (!sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_MALE))
return false;
- if (!sSpellStore.LookupEntry(SPELL_GHOST_COSTUME_FEMALE))
+ if (!sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_FEMALE))
return false;
- if (!sSpellStore.LookupEntry(SPELL_TRICK_BUFF))
+ if (!sSpellMgr->GetSpellInfo(SPELL_TRICK_BUFF))
return false;
return true;
}
@@ -463,13 +463,13 @@ class spell_gen_trick_or_treat : public SpellScriptLoader
{
PrepareSpellScript(spell_gen_trick_or_treat_SpellScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_TRICK))
+ if (!sSpellMgr->GetSpellInfo(SPELL_TRICK))
return false;
- if (!sSpellStore.LookupEntry(SPELL_TREAT))
+ if (!sSpellMgr->GetSpellInfo(SPELL_TREAT))
return false;
- if (!sSpellStore.LookupEntry(SPELL_TRICKED_OR_TREATED))
+ if (!sSpellMgr->GetSpellInfo(SPELL_TRICKED_OR_TREATED))
return false;
return true;
}
@@ -538,11 +538,11 @@ class spell_pvp_trinket_wotf_shared_cd : public SpellScriptLoader
{
PrepareSpellScript(spell_pvp_trinket_wotf_shared_cd_SpellScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER))
+ if (!sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER))
return false;
- if (!sSpellStore.LookupEntry(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER_WOTF))
+ if (!sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER_WOTF))
return false;
return true;
}
@@ -552,9 +552,9 @@ class spell_pvp_trinket_wotf_shared_cd : public SpellScriptLoader
Player* caster = GetCaster()->ToPlayer();
if (!caster)
return;
- SpellEntry const* spellInfo = GetSpellInfo();
+ SpellInfo const* spellInfo = GetSpellInfo();
- caster->AddSpellCooldown(spellInfo->Id, 0, time(NULL) + GetSpellRecoveryTime(sSpellStore.LookupEntry(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER)) / IN_MILLISECONDS);
+ caster->AddSpellCooldown(spellInfo->Id, 0, time(NULL) + sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER)->GetRecoveryTime() / IN_MILLISECONDS);
WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+4);
data << uint64(caster->GetGUID());
data << uint8(0);
@@ -590,9 +590,9 @@ class spell_gen_animal_blood : public SpellScriptLoader
{
PrepareAuraScript(spell_gen_animal_blood_AuraScript);
- bool Validate(SpellEntry const* /*spell*/)
+ bool Validate(SpellInfo const* /*spell*/)
{
- if (!sSpellStore.LookupEntry(SPELL_SPAWN_BLOOD_POOL))
+ if (!sSpellMgr->GetSpellInfo(SPELL_SPAWN_BLOOD_POOL))
return false;
return true;
}
@@ -638,9 +638,9 @@ class spell_gen_divine_storm_cd_reset : public SpellScriptLoader
{
PrepareSpellScript(spell_gen_divine_storm_cd_reset_SpellScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_DIVINE_STORM))
+ if (!sSpellMgr->GetSpellInfo(SPELL_DIVINE_STORM))
return false;
return true;
}
@@ -819,7 +819,7 @@ class spell_generic_clone : public SpellScriptLoader
{
PreventHitDefaultEffect(effIndex);
Unit* caster = GetCaster();
- uint32 spellId = uint32(SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), effIndex));
+ uint32 spellId = uint32(GetSpellInfo()->Effects[effIndex].CalcValue());
if (Unit* target = GetHitUnit())
target->CastSpell(caster, spellId, true);
@@ -858,19 +858,19 @@ class spell_generic_clone_weapon : public SpellScriptLoader
class spell_generic_clone_weapon_SpellScript : public SpellScript
{
PrepareSpellScript(spell_generic_clone_weapon_SpellScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_COPY_WEAPON))
+ if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON))
return false;
- if (!sSpellStore.LookupEntry(SPELL_COPY_WEAPON_2))
+ if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_2))
return false;
- if (!sSpellStore.LookupEntry(SPELL_COPY_WEAPON_3))
+ if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_3))
return false;
- if (!sSpellStore.LookupEntry(SPELL_COPY_OFFHAND))
+ if (!sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND))
return false;
- if (!sSpellStore.LookupEntry(SPELL_COPY_OFFHAND_2))
+ if (!sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_2))
return false;
- if (!sSpellStore.LookupEntry(SPELL_COPY_RANGED))
+ if (!sSpellMgr->GetSpellInfo(SPELL_COPY_RANGED))
return false;
return true;
}
@@ -884,7 +884,7 @@ class spell_generic_clone_weapon : public SpellScriptLoader
if (!target)
return;
- uint32 spellId = uint32(SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), EFFECT_0));
+ uint32 spellId = uint32(GetSpellInfo()->Effects[EFFECT_0].CalcValue());
target->CastSpell(caster, spellId, true);
if (target->GetTypeId() == TYPEID_PLAYER)
@@ -959,9 +959,9 @@ class spell_gen_seaforium_blast : public SpellScriptLoader
{
PrepareSpellScript(spell_gen_seaforium_blast_SpellScript);
- bool Validate(SpellEntry const* /*spell*/)
+ bool Validate(SpellInfo const* /*spell*/)
{
- if (!sSpellStore.LookupEntry(SPELL_PLANT_CHARGES_CREDIT_ACHIEVEMENT))
+ if (!sSpellMgr->GetSpellInfo(SPELL_PLANT_CHARGES_CREDIT_ACHIEVEMENT))
return false;
return true;
}
diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp
index 931d63d954b..afc1ee056d6 100644
--- a/src/server/scripts/Spells/spell_hunter.cpp
+++ b/src/server/scripts/Spells/spell_hunter.cpp
@@ -49,13 +49,13 @@ public:
class spell_hun_chimera_shot_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hun_chimera_shot_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(HUNTER_SPELL_CHIMERA_SHOT_SERPENT))
+ if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_CHIMERA_SHOT_SERPENT))
return false;
- if (!sSpellStore.LookupEntry(HUNTER_SPELL_CHIMERA_SHOT_VIPER))
+ if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_CHIMERA_SHOT_VIPER))
return false;
- if (!sSpellStore.LookupEntry(HUNTER_SPELL_CHIMERA_SHOT_SCORPID))
+ if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_CHIMERA_SHOT_SCORPID))
return false;
return true;
}
@@ -77,7 +77,7 @@ public:
continue;
// Search only Serpent Sting, Viper Sting, Scorpid Sting auras
- flag96 familyFlag = aura->GetSpellProto()->SpellFamilyFlags;
+ flag96 familyFlag = aura->GetSpellInfo()->SpellFamilyFlags;
if (!(familyFlag[1] & 0x00000080 || familyFlag[0] & 0x0000C000))
continue;
if (AuraEffect const* aurEff = aura->GetEffect(0))
@@ -87,7 +87,7 @@ public:
{
int32 TickCount = aurEff->GetTotalTicks();
spellId = HUNTER_SPELL_CHIMERA_SHOT_SERPENT;
- basePoint = caster->SpellDamageBonus(unitTarget, aura->GetSpellProto(), aurEff->GetAmount(), DOT, aura->GetStackAmount());
+ basePoint = caster->SpellDamageBonus(unitTarget, aura->GetSpellInfo(), aurEff->GetAmount(), DOT, aura->GetStackAmount());
ApplyPctN(basePoint, TickCount * 40);
}
// Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting.
@@ -145,9 +145,9 @@ public:
class spell_hun_invigoration_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hun_invigoration_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(HUNTER_SPELL_INVIGORATION_TRIGGERED))
+ if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_INVIGORATION_TRIGGERED))
return false;
return true;
}
@@ -180,9 +180,9 @@ public:
class spell_hun_last_stand_pet_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hun_last_stand_pet_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(HUNTER_PET_SPELL_LAST_STAND_TRIGGERED))
+ if (!sSpellMgr->GetSpellInfo(HUNTER_PET_SPELL_LAST_STAND_TRIGGERED))
return false;
return true;
}
@@ -215,13 +215,13 @@ public:
class spell_hun_masters_call_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hun_masters_call_SpellScript)
- bool Validate(SpellEntry const* spellEntry)
+ bool Validate(SpellInfo const* spellEntry)
{
- if (!sSpellStore.LookupEntry(HUNTER_SPELL_MASTERS_CALL_TRIGGERED))
+ if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_MASTERS_CALL_TRIGGERED))
return false;
- if (!sSpellStore.LookupEntry(SpellMgr::CalculateSpellEffectAmount(spellEntry, EFFECT_0)))
+ if (!sSpellMgr->GetSpellInfo(spellEntry->Effects[EFFECT_0].CalcValue()))
return false;
- if (!sSpellStore.LookupEntry(SpellMgr::CalculateSpellEffectAmount(spellEntry, EFFECT_1)))
+ if (!sSpellMgr->GetSpellInfo(spellEntry->Effects[EFFECT_1].CalcValue()))
return false;
return true;
}
@@ -238,7 +238,7 @@ public:
if (Unit* ally = GetTargetUnit())
{
target->CastSpell(ally, GetEffectValue(), true);
- target->CastSpell(ally, SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), EFFECT_0), true);
+ target->CastSpell(ally, GetSpellInfo()->Effects[EFFECT_0].CalcValue(), true);
}
}
}
@@ -273,14 +273,14 @@ public:
const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap();
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
{
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(itr->first);
///! If spellId in cooldown map isn't valid, the above will return a null pointer.
if (spellInfo &&
spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER &&
spellInfo->Id != HUNTER_SPELL_READINESS &&
spellInfo->Id != HUNTER_SPELL_BESTIAL_WRATH &&
- GetSpellRecoveryTime(spellInfo) > 0)
+ spellInfo->GetRecoveryTime() > 0)
caster->ToPlayer()->RemoveSpellCooldown((itr++)->first, true);
else
++itr;
@@ -348,11 +348,11 @@ public:
class spell_hun_sniper_training_AuraScript : public AuraScript
{
PrepareAuraScript(spell_hun_sniper_training_AuraScript)
- bool Validate(SpellEntry const* /*entry*/)
+ bool Validate(SpellInfo const* /*entry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_SNIPER_TRAINING_R1))
+ if (!sSpellMgr->GetSpellInfo(SPELL_SNIPER_TRAINING_R1))
return false;
- if (!sSpellStore.LookupEntry(SPELL_SNIPER_TRAINING_BUFF_R1))
+ if (!sSpellMgr->GetSpellInfo(SPELL_SNIPER_TRAINING_BUFF_R1))
return false;
return true;
}
@@ -372,8 +372,8 @@ public:
Unit* target = GetTarget();
if (!target->HasAura(spellId))
{
- SpellEntry const* triggeredSpellInfo = sSpellStore.LookupEntry(spellId);
- Unit* triggerCaster = GetTriggeredSpellCaster(triggeredSpellInfo, caster, target);
+ SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(spellId);
+ Unit* triggerCaster = triggeredSpellInfo->IsRequiringSelectedTarget() ? caster : target;
triggerCaster->CastSpell(target, triggeredSpellInfo, true, 0, aurEff);
}
}
@@ -385,7 +385,7 @@ public:
{
int32 baseAmount = aurEff->GetBaseAmount();
int32 amount = playerTarget->isMoving() ?
- target->CalculateSpellDamage(target, GetSpellProto(), aurEff->GetEffIndex(), &baseAmount) :
+ target->CalculateSpellDamage(target, GetSpellInfo(), aurEff->GetEffIndex(), &baseAmount) :
aurEff->GetAmount() - 1;
aurEff->SetAmount(amount);
}
@@ -412,11 +412,11 @@ public:
class spell_hun_pet_heart_of_the_phoenix_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hun_pet_heart_of_the_phoenix_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED))
+ if (!sSpellMgr->GetSpellInfo(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED))
return false;
- if (!sSpellStore.LookupEntry(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF))
+ if (!sSpellMgr->GetSpellInfo(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF))
return false;
return true;
}
@@ -459,9 +459,9 @@ public:
class spell_hun_pet_carrion_feeder_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hun_pet_carrion_feeder_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED))
+ if (!sSpellMgr->GetSpellInfo(HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED))
return false;
return true;
}
diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp
index acf92d3a984..4d2cd15199b 100644
--- a/src/server/scripts/Spells/spell_item.cpp
+++ b/src/server/scripts/Spells/spell_item.cpp
@@ -42,9 +42,9 @@ public:
public:
spell_item_trigger_spell_SpellScript(uint32 triggeredSpellId) : SpellScript(), _triggeredSpellId(triggeredSpellId) { }
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(_triggeredSpellId))
+ if (!sSpellMgr->GetSpellInfo(_triggeredSpellId))
return false;
return true;
}
@@ -87,10 +87,10 @@ public:
{
PrepareSpellScript(spell_item_deviate_fish_SpellScript)
public:
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
for (uint32 spellId = SPELL_SLEEPY; spellId <= SPELL_HEALTHY_SPIRIT; ++spellId)
- if (!sSpellStore.LookupEntry(spellId))
+ if (!sSpellMgr->GetSpellInfo(spellId))
return false;
return true;
}
@@ -135,13 +135,13 @@ public:
{
public:
PrepareSpellScript(spell_item_flask_of_the_north_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_FLASK_OF_THE_NORTH_SP))
+ if (!sSpellMgr->GetSpellInfo(SPELL_FLASK_OF_THE_NORTH_SP))
return false;
- if (!sSpellStore.LookupEntry(SPELL_FLASK_OF_THE_NORTH_AP))
+ if (!sSpellMgr->GetSpellInfo(SPELL_FLASK_OF_THE_NORTH_AP))
return false;
- if (!sSpellStore.LookupEntry(SPELL_FLASK_OF_THE_NORTH_STR))
+ if (!sSpellMgr->GetSpellInfo(SPELL_FLASK_OF_THE_NORTH_STR))
return false;
return true;
}
@@ -211,11 +211,11 @@ public:
{
public:
PrepareSpellScript(spell_item_gnomish_death_ray_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_GNOMISH_DEATH_RAY_SELF))
+ if (!sSpellMgr->GetSpellInfo(SPELL_GNOMISH_DEATH_RAY_SELF))
return false;
- if (!sSpellStore.LookupEntry(SPELL_GNOMISH_DEATH_RAY_TARGET))
+ if (!sSpellMgr->GetSpellInfo(SPELL_GNOMISH_DEATH_RAY_TARGET))
return false;
return true;
}
@@ -264,17 +264,17 @@ public:
{
public:
PrepareSpellScript(spell_item_make_a_wish_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_MR_PINCHYS_BLESSING))
+ if (!sSpellMgr->GetSpellInfo(SPELL_MR_PINCHYS_BLESSING))
return false;
- if (!sSpellStore.LookupEntry(SPELL_SUMMON_MIGHTY_MR_PINCHY))
+ if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_MIGHTY_MR_PINCHY))
return false;
- if (!sSpellStore.LookupEntry(SPELL_SUMMON_FURIOUS_MR_PINCHY))
+ if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_FURIOUS_MR_PINCHY))
return false;
- if (!sSpellStore.LookupEntry(SPELL_TINY_MAGICAL_CRAWDAD))
+ if (!sSpellMgr->GetSpellInfo(SPELL_TINY_MAGICAL_CRAWDAD))
return false;
- if (!sSpellStore.LookupEntry(SPELL_MR_PINCHYS_GIFT))
+ if (!sSpellMgr->GetSpellInfo(SPELL_MR_PINCHYS_GIFT))
return false;
return true;
}
@@ -381,13 +381,13 @@ public:
{
public:
PrepareSpellScript(spell_item_net_o_matic_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_NET_O_MATIC_TRIGGERED1))
+ if (!sSpellMgr->GetSpellInfo(SPELL_NET_O_MATIC_TRIGGERED1))
return false;
- if (!sSpellStore.LookupEntry(SPELL_NET_O_MATIC_TRIGGERED2))
+ if (!sSpellMgr->GetSpellInfo(SPELL_NET_O_MATIC_TRIGGERED2))
return false;
- if (!sSpellStore.LookupEntry(SPELL_NET_O_MATIC_TRIGGERED3))
+ if (!sSpellMgr->GetSpellInfo(SPELL_NET_O_MATIC_TRIGGERED3))
return false;
return true;
}
@@ -437,13 +437,13 @@ public:
{
public:
PrepareSpellScript(spell_item_noggenfogger_elixir_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED1))
+ if (!sSpellMgr->GetSpellInfo(SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED1))
return false;
- if (!sSpellStore.LookupEntry(SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED2))
+ if (!sSpellMgr->GetSpellInfo(SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED2))
return false;
- if (!sSpellStore.LookupEntry(SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED3))
+ if (!sSpellMgr->GetSpellInfo(SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED3))
return false;
return true;
}
@@ -495,10 +495,10 @@ public:
{
public:
PrepareSpellScript(spell_item_savory_deviate_delight_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
for (uint32 spellId = SPELL_FLIP_OUT_MALE; spellId <= SPELL_YAAARRRR_FEMALE; ++spellId)
- if (!sSpellStore.LookupEntry(spellId))
+ if (!sSpellMgr->GetSpellInfo(spellId))
return false;
return true;
}
@@ -553,19 +553,19 @@ public:
{
public:
PrepareSpellScript(spell_item_six_demon_bag_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_FROSTBOLT))
+ if (!sSpellMgr->GetSpellInfo(SPELL_FROSTBOLT))
return false;
- if (!sSpellStore.LookupEntry(SPELL_POLYMORPH))
+ if (!sSpellMgr->GetSpellInfo(SPELL_POLYMORPH))
return false;
- if (!sSpellStore.LookupEntry(SPELL_SUMMON_FELHOUND_MINION))
+ if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_FELHOUND_MINION))
return false;
- if (!sSpellStore.LookupEntry(SPELL_FIREBALL))
+ if (!sSpellMgr->GetSpellInfo(SPELL_FIREBALL))
return false;
- if (!sSpellStore.LookupEntry(SPELL_CHAIN_LIGHTNING))
+ if (!sSpellMgr->GetSpellInfo(SPELL_CHAIN_LIGHTNING))
return false;
- if (!sSpellStore.LookupEntry(SPELL_ENVELOPING_WINDS))
+ if (!sSpellMgr->GetSpellInfo(SPELL_ENVELOPING_WINDS))
return false;
return true;
}
@@ -632,13 +632,13 @@ public:
{
public:
PrepareSpellScript(spell_item_underbelly_elixir_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_UNDERBELLY_ELIXIR_TRIGGERED1))
+ if (!sSpellMgr->GetSpellInfo(SPELL_UNDERBELLY_ELIXIR_TRIGGERED1))
return false;
- if (!sSpellStore.LookupEntry(SPELL_UNDERBELLY_ELIXIR_TRIGGERED2))
+ if (!sSpellMgr->GetSpellInfo(SPELL_UNDERBELLY_ELIXIR_TRIGGERED2))
return false;
- if (!sSpellStore.LookupEntry(SPELL_UNDERBELLY_ELIXIR_TRIGGERED3))
+ if (!sSpellMgr->GetSpellInfo(SPELL_UNDERBELLY_ELIXIR_TRIGGERED3))
return false;
return true;
}
@@ -688,13 +688,13 @@ public:
PrepareAuraScript(spell_item_shadowmourne_AuraScript)
spell_item_shadowmourne_AuraScript() : AuraScript() { }
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_SHADOWMOURNE_VISUAL_LOW))
+ if (!sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_VISUAL_LOW))
return false;
- if (!sSpellStore.LookupEntry(SPELL_SHADOWMOURNE_VISUAL_HIGH))
+ if (!sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_VISUAL_HIGH))
return false;
- if (!sSpellStore.LookupEntry(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF))
+ if (!sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF))
return false;
return true;
}
@@ -755,13 +755,13 @@ class spell_item_red_rider_air_rifle : public SpellScriptLoader
{
PrepareSpellScript(spell_item_red_rider_air_rifle_SpellScript);
- bool Validate(SpellEntry const* /*spell*/)
+ bool Validate(SpellInfo const* /*spell*/)
{
- if (!sSpellStore.LookupEntry(SPELL_AIR_RIFLE_HOLD_VISUAL))
+ if (!sSpellMgr->GetSpellInfo(SPELL_AIR_RIFLE_HOLD_VISUAL))
return false;
- if (!sSpellStore.LookupEntry(SPELL_AIR_RIFLE_SHOOT))
+ if (!sSpellMgr->GetSpellInfo(SPELL_AIR_RIFLE_SHOOT))
return false;
- if (!sSpellStore.LookupEntry(SPELL_AIR_RIFLE_SHOOT_SELF))
+ if (!sSpellMgr->GetSpellInfo(SPELL_AIR_RIFLE_SHOOT_SELF))
return false;
return true;
}
@@ -976,13 +976,13 @@ class spell_item_vanquished_clutches : public SpellScriptLoader
{
PrepareSpellScript(spell_item_vanquished_clutches_SpellScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_CRUSHER))
+ if (!sSpellMgr->GetSpellInfo(SPELL_CRUSHER))
return false;
- if (!sSpellStore.LookupEntry(SPELL_CONSTRICTOR))
+ if (!sSpellMgr->GetSpellInfo(SPELL_CONSTRICTOR))
return false;
- if (!sSpellStore.LookupEntry(SPELL_CORRUPTOR))
+ if (!sSpellMgr->GetSpellInfo(SPELL_CORRUPTOR))
return false;
return true;
}
@@ -1032,9 +1032,9 @@ class spell_item_ashbringer : public SpellScriptLoader
class spell_item_ashbringer_SpellScript : public SpellScript
{
PrepareSpellScript(spell_item_ashbringer_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_ASHBRINGER))
+ if (!sSpellMgr->GetSpellInfo(SPELL_ASHBRINGER))
return false;
return true;
}
diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp
index 32dca054d43..d271bf36887 100644
--- a/src/server/scripts/Spells/spell_mage.cpp
+++ b/src/server/scripts/Spells/spell_mage.cpp
@@ -46,9 +46,9 @@ class spell_mage_blast_wave : public SpellScriptLoader
class spell_mage_blast_wave_SpellScript : public SpellScript
{
PrepareSpellScript(spell_mage_blast_wave_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_MAGE_GLYPH_OF_BLAST_WAVE))
+ if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_GLYPH_OF_BLAST_WAVE))
return false;
return true;
}
@@ -90,11 +90,11 @@ class spell_mage_cold_snap : public SpellScriptLoader
const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap();
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
{
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(itr->first);
if (spellInfo->SpellFamilyName == SPELLFAMILY_MAGE &&
- (GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_FROST) &&
- spellInfo->Id != SPELL_MAGE_COLD_SNAP && GetSpellRecoveryTime(spellInfo) > 0)
+ (spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_FROST) &&
+ spellInfo->Id != SPELL_MAGE_COLD_SNAP && spellInfo->GetRecoveryTime() > 0)
{
caster->ToPlayer()->RemoveSpellCooldown((itr++)->first, true);
}
@@ -126,11 +126,11 @@ class spell_mage_polymorph_cast_visual : public SpellScriptLoader
PrepareSpellScript(spell_mage_polymorph_cast_visual_SpellScript)
static const uint32 spell_list[6];
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
// check if spell ids exist in dbc
for (int i = 0; i < 6; i++)
- if (!sSpellStore.LookupEntry(spell_list[i]))
+ if (!sSpellMgr->GetSpellInfo(spell_list[i]))
return false;
return true;
}
@@ -173,13 +173,13 @@ class spell_mage_summon_water_elemental : public SpellScriptLoader
class spell_mage_summon_water_elemental_SpellScript : public SpellScript
{
PrepareSpellScript(spell_mage_summon_water_elemental_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_MAGE_GLYPH_OF_ETERNAL_WATER))
+ if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_GLYPH_OF_ETERNAL_WATER))
return false;
- if (!sSpellStore.LookupEntry(SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY))
+ if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY))
return false;
- if (!sSpellStore.LookupEntry(SPELL_MAGE_SUMMON_WATER_ELEMENTAL_PERMANENT))
+ if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_SUMMON_WATER_ELEMENTAL_PERMANENT))
return false;
return true;
}
@@ -225,10 +225,10 @@ public:
SPELL_MAGE_FROST_WARDING_R1 = 28332,
};
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- return sSpellStore.LookupEntry(SPELL_MAGE_FROST_WARDING_TRIGGERED)
- && sSpellStore.LookupEntry(SPELL_MAGE_FROST_WARDING_R1);
+ return sSpellMgr->GetSpellInfo(SPELL_MAGE_FROST_WARDING_TRIGGERED)
+ && sSpellMgr->GetSpellInfo(SPELL_MAGE_FROST_WARDING_R1);
}
void Absorb(AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
@@ -236,7 +236,7 @@ public:
Unit* target = GetTarget();
if (AuraEffect * talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_FROST_WARDING_R1, EFFECT_0))
{
- int32 chance = SpellMgr::CalculateSpellEffectAmount(talentAurEff->GetSpellProto(), EFFECT_1);
+ int32 chance = talentAurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue();
if (roll_chance_i(chance))
{
@@ -268,10 +268,10 @@ public:
SPELL_MAGE_INCANTERS_ABSORBTION_R1 = 44394,
};
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- return sSpellStore.LookupEntry(SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED)
- && sSpellStore.LookupEntry(SPELL_MAGE_INCANTERS_ABSORBTION_R1);
+ return sSpellMgr->GetSpellInfo(SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED)
+ && sSpellMgr->GetSpellInfo(SPELL_MAGE_INCANTERS_ABSORBTION_R1);
}
void Trigger(AuraEffect * aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount)
diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp
index 5beb421c88b..9269dade108 100644
--- a/src/server/scripts/Spells/spell_paladin.cpp
+++ b/src/server/scripts/Spells/spell_paladin.cpp
@@ -58,8 +58,8 @@ public:
bool Load()
{
- healPct = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_1);
- absorbPct = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_0);
+ healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue();
+ absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
return GetUnitOwner()->ToPlayer();
}
@@ -123,15 +123,15 @@ public:
class spell_pal_blessing_of_faith_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pal_blessing_of_faith_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_DRUID))
+ if (!sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_DRUID))
return false;
- if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_PALADIN))
+ if (!sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_PALADIN))
return false;
- if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_PRIEST))
+ if (!sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_PRIEST))
return false;
- if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_SHAMAN))
+ if (!sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_SHAMAN))
return false;
return true;
}
@@ -177,9 +177,9 @@ public:
class spell_pal_blessing_of_sanctuary_AuraScript : public AuraScript
{
PrepareAuraScript(spell_pal_blessing_of_sanctuary_AuraScript)
- bool Validate(SpellEntry const* /*entry*/)
+ bool Validate(SpellInfo const* /*entry*/)
{
- if (!sSpellStore.LookupEntry(PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF))
+ if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF))
return false;
return true;
}
@@ -219,9 +219,9 @@ public:
class spell_pal_guarded_by_the_light_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pal_guarded_by_the_light_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(PALADIN_SPELL_DIVINE_PLEA))
+ if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_DIVINE_PLEA))
return false;
return true;
}
@@ -253,9 +253,9 @@ public:
class spell_pal_holy_shock_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pal_holy_shock_SpellScript)
- bool Validate(SpellEntry const *spellEntry)
+ bool Validate(SpellInfo const *spellEntry)
{
- if (!sSpellStore.LookupEntry(PALADIN_SPELL_HOLY_SHOCK_R1))
+ if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_HOLY_SHOCK_R1))
return false;
// can't use other spell than holy shock due to spell_ranks dependency
@@ -310,7 +310,7 @@ public:
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Unit* unitTarget = GetHitUnit())
- if (SpellEntry const* spell_proto = sSpellStore.LookupEntry(GetEffectValue()))
+ if (SpellInfo const* spell_proto = sSpellMgr->GetSpellInfo(GetEffectValue()))
GetCaster()->CastSpell(unitTarget, spell_proto, true, NULL);
}
diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp
index 2d35ed41bf0..c07e6dfbf7f 100644
--- a/src/server/scripts/Spells/spell_priest.cpp
+++ b/src/server/scripts/Spells/spell_priest.cpp
@@ -46,14 +46,14 @@ class spell_pri_guardian_spirit : public SpellScriptLoader
uint32 healPct;
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- return sSpellStore.LookupEntry(PRIEST_SPELL_GUARDIAN_SPIRIT_HEAL) != NULL;
+ return sSpellMgr->GetSpellInfo(PRIEST_SPELL_GUARDIAN_SPIRIT_HEAL) != NULL;
}
bool Load()
{
- healPct = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_1);
+ healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue();
return true;
}
@@ -184,9 +184,9 @@ class spell_pri_penance : public SpellScriptLoader
{
PrepareSpellScript(spell_pri_penance_SpellScript);
- bool Validate(SpellEntry const* spellEntry)
+ bool Validate(SpellInfo const* spellEntry)
{
- if (!sSpellStore.LookupEntry(PRIEST_SPELL_PENANCE_R1))
+ if (!sSpellMgr->GetSpellInfo(PRIEST_SPELL_PENANCE_R1))
return false;
// can't use other spell than this penance due to spell_ranks dependency
if (sSpellMgr->GetFirstSpellInChain(PRIEST_SPELL_PENANCE_R1) != sSpellMgr->GetFirstSpellInChain(spellEntry->Id))
@@ -240,9 +240,9 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader
{
PrepareAuraScript(spell_pri_reflective_shield_trigger_AuraScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- return sSpellStore.LookupEntry(PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED) && sSpellStore.LookupEntry(PRIEST_SPELL_REFLECTIVE_SHIELD_R1);
+ return sSpellMgr->GetSpellInfo(PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED) && sSpellMgr->GetSpellInfo(PRIEST_SPELL_REFLECTIVE_SHIELD_R1);
}
void Trigger(AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp
index c760220b5e5..c7a174ff3d5 100644
--- a/src/server/scripts/Spells/spell_quest.cpp
+++ b/src/server/scripts/Spells/spell_quest.cpp
@@ -94,11 +94,11 @@ public:
class spell_q5206_test_fetid_skull_SpellScript : public SpellScript
{
PrepareSpellScript(spell_q5206_test_fetid_skull_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_CREATE_RESONATING_SKULL))
+ if (!sSpellMgr->GetSpellInfo(SPELL_CREATE_RESONATING_SKULL))
return false;
- if (!sSpellStore.LookupEntry(SPELL_CREATE_BONE_DUST))
+ if (!sSpellMgr->GetSpellInfo(SPELL_CREATE_BONE_DUST))
return false;
return true;
}
@@ -254,11 +254,11 @@ public:
class spell_q11396_11399_scourging_crystal_controller_SpellScript : public SpellScript
{
PrepareSpellScript(spell_q11396_11399_scourging_crystal_controller_SpellScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3))
+ if (!sSpellMgr->GetSpellInfo(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3))
return false;
- if (!sSpellStore.LookupEntry(SPELL_SCOURGING_CRYSTAL_CONTROLLER))
+ if (!sSpellMgr->GetSpellInfo(SPELL_SCOURGING_CRYSTAL_CONTROLLER))
return false;
return true;
}
@@ -293,9 +293,9 @@ public:
class spell_q11396_11399_scourging_crystal_controller_dummy_SpellScript : public SpellScript
{
PrepareSpellScript(spell_q11396_11399_scourging_crystal_controller_dummy_SpellScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3))
+ if (!sSpellMgr->GetSpellInfo(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3))
return false;
return true;
}
@@ -355,13 +355,13 @@ public:
class spell_q11587_arcane_prisoner_rescue_SpellScript : public SpellScript
{
PrepareSpellScript(spell_q11587_arcane_prisoner_rescue_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_SUMMON_ARCANE_PRISONER_MALE))
+ if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ARCANE_PRISONER_MALE))
return false;
- if (!sSpellStore.LookupEntry(SPELL_SUMMON_ARCANE_PRISONER_FEMALE))
+ if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ARCANE_PRISONER_FEMALE))
return false;
- if (!sSpellStore.LookupEntry(SPELL_ARCANE_PRISONER_KILL_CREDIT))
+ if (!sSpellMgr->GetSpellInfo(SPELL_ARCANE_PRISONER_KILL_CREDIT))
return false;
return true;
}
@@ -416,19 +416,19 @@ public:
class spell_q11730_ultrasonic_screwdriver_SpellScript : public SpellScript
{
PrepareSpellScript(spell_q11730_ultrasonic_screwdriver_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_SUMMON_SCAVENGEBOT_004A8))
+ if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_SCAVENGEBOT_004A8))
return false;
- if (!sSpellStore.LookupEntry(SPELL_SUMMON_SENTRYBOT_57K))
+ if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_SENTRYBOT_57K))
return false;
- if (!sSpellStore.LookupEntry(SPELL_SUMMON_DEFENDOTANK_66D))
+ if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_DEFENDOTANK_66D))
return false;
- if (!sSpellStore.LookupEntry(SPELL_SUMMON_SCAVENGEBOT_005B6))
+ if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_SCAVENGEBOT_005B6))
return false;
- if (!sSpellStore.LookupEntry(SPELL_SUMMON_55D_COLLECTATRON))
+ if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_55D_COLLECTATRON))
return false;
- if (!sSpellStore.LookupEntry(SPELL_ROBOT_KILL_CREDIT))
+ if (!sSpellMgr->GetSpellInfo(SPELL_ROBOT_KILL_CREDIT))
return false;
return true;
}
@@ -545,15 +545,15 @@ public:
{
public:
PrepareSpellScript(spell_q12634_despawn_fruit_tosser_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_BANANAS_FALL_TO_GROUND))
+ if (!sSpellMgr->GetSpellInfo(SPELL_BANANAS_FALL_TO_GROUND))
return false;
- if (!sSpellStore.LookupEntry(SPELL_ORANGE_FALLS_TO_GROUND))
+ if (!sSpellMgr->GetSpellInfo(SPELL_ORANGE_FALLS_TO_GROUND))
return false;
- if (!sSpellStore.LookupEntry(SPELL_PAPAYA_FALLS_TO_GROUND))
+ if (!sSpellMgr->GetSpellInfo(SPELL_PAPAYA_FALLS_TO_GROUND))
return false;
- if (!sSpellStore.LookupEntry(SPELL_SUMMON_ADVENTUROUS_DWARF))
+ if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ADVENTUROUS_DWARF))
return false;
return true;
}
@@ -597,12 +597,12 @@ public:
PrepareSpellScript(spell_q12683_take_sputum_sample_SpellScript)
void HandleDummy(SpellEffIndex /*effIndex*/)
{
- uint32 reqAuraId = SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), 1);
+ uint32 reqAuraId = GetSpellInfo()->Effects[EFFECT_1].CalcValue();
Unit* pCaster = GetCaster();
if (pCaster->HasAuraEffect(reqAuraId, 0))
{
- uint32 spellId = SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), 0);
+ uint32 spellId = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
pCaster->CastSpell(pCaster, spellId, true, NULL);
}
}
@@ -694,9 +694,9 @@ public:
{
public:
PrepareSpellScript(spell_q12937_relief_for_the_fallen_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_TRIGGER_AID_OF_THE_EARTHEN))
+ if (!sSpellMgr->GetSpellInfo(SPELL_TRIGGER_AID_OF_THE_EARTHEN))
return false;
return true;
}
@@ -745,9 +745,9 @@ class spell_q10041_q10040_who_are_they : public SpellScriptLoader
{
PrepareSpellScript(spell_q10041_q10040_who_are_they_SpellScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SPELL_QUESTGIVER))
+ if (!sSpellMgr->GetSpellInfo(SPELL_QUESTGIVER))
return false;
return true;
}
diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp
index e82e7fc79fd..1915697e018 100644
--- a/src/server/scripts/Spells/spell_rogue.cpp
+++ b/src/server/scripts/Spells/spell_rogue.cpp
@@ -48,14 +48,14 @@ public:
ROG_SPELL_CHEAT_DEATH_COOLDOWN = 31231,
};
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- return sSpellStore.LookupEntry(ROG_SPELL_CHEAT_DEATH_COOLDOWN);
+ return sSpellMgr->GetSpellInfo(ROG_SPELL_CHEAT_DEATH_COOLDOWN);
}
bool Load()
{
- absorbChance = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_0);
+ absorbChance = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
return GetUnitOwner()->ToPlayer();
}
@@ -115,7 +115,7 @@ public:
bool Load()
{
- absorbPct = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_0, GetCaster());
+ absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster());
return true;
}
@@ -153,9 +153,9 @@ class spell_rog_preparation : public SpellScriptLoader
class spell_rog_preparation_SpellScript : public SpellScript
{
PrepareSpellScript(spell_rog_preparation_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(ROGUE_SPELL_GLYPH_OF_PREPARATION))
+ if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_GLYPH_OF_PREPARATION))
return false;
return true;
}
@@ -170,7 +170,7 @@ class spell_rog_preparation : public SpellScriptLoader
const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap();
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
{
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
+ SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(itr->first);
if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE)
{
@@ -217,9 +217,9 @@ public:
class spell_rog_prey_on_the_weak_AuraScript : public AuraScript
{
PrepareAuraScript(spell_rog_prey_on_the_weak_AuraScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(ROGUE_SPELL_PREY_ON_THE_WEAK))
+ if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_PREY_ON_THE_WEAK))
return false;
return true;
}
@@ -232,7 +232,7 @@ public:
{
if (!target->HasAura(ROGUE_SPELL_PREY_ON_THE_WEAK))
{
- int32 bp = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), 0);
+ int32 bp = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
target->CastCustomSpell(target, ROGUE_SPELL_PREY_ON_THE_WEAK, &bp, 0, 0, true);
}
}
@@ -260,9 +260,9 @@ class spell_rog_shiv : public SpellScriptLoader
class spell_rog_shiv_SpellScript : public SpellScript
{
PrepareSpellScript(spell_rog_shiv_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(ROGUE_SPELL_SHIV_TRIGGERED))
+ if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_SHIV_TRIGGERED))
return false;
return true;
}
@@ -348,7 +348,7 @@ class spell_rog_deadly_poison : public SpellScriptLoader
if (enchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
continue;
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(enchant->spellid[s]);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->spellid[s]);
if (!spellInfo)
{
sLog->outError("Player::CastItemCombatSpell Enchant %i, cast unknown spell %i", enchant->ID, enchant->spellid[s]);
@@ -363,7 +363,7 @@ class spell_rog_deadly_poison : public SpellScriptLoader
if (spellInfo->SpellFamilyFlags.IsEqual(0x10000, 0x80000, 0))
continue;
- if (IsPositiveSpell(enchant->spellid[s]))
+ if (spellInfo->IsPositive())
player->CastSpell(player, enchant->spellid[s], true, item);
else
player->CastSpell(target, enchant->spellid[s], true, item);
diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp
index 8f81bb88fb2..7ffec9f7051 100644
--- a/src/server/scripts/Spells/spell_shaman.cpp
+++ b/src/server/scripts/Spells/spell_shaman.cpp
@@ -50,7 +50,7 @@ public:
bool Load()
{
- absorbPct = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_0, GetCaster());
+ absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster());
return true;
}
@@ -89,9 +89,9 @@ public:
class spell_sha_fire_nova_SpellScript : public SpellScript
{
PrepareSpellScript(spell_sha_fire_nova_SpellScript)
- bool Validate(SpellEntry const* spellEntry)
+ bool Validate(SpellInfo const* spellEntry)
{
- if (!sSpellStore.LookupEntry(SHAMAN_SPELL_FIRE_NOVA_R1))
+ if (!sSpellMgr->GetSpellInfo(SHAMAN_SPELL_FIRE_NOVA_R1))
return false;
if (sSpellMgr->GetFirstSpellInChain(SHAMAN_SPELL_FIRE_NOVA_R1) != sSpellMgr->GetFirstSpellInChain(spellEntry->Id))
return false;
@@ -148,11 +148,11 @@ public:
class spell_sha_mana_tide_totem_SpellScript : public SpellScript
{
PrepareSpellScript(spell_sha_mana_tide_totem_SpellScript)
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SHAMAN_SPELL_GLYPH_OF_MANA_TIDE))
+ if (!sSpellMgr->GetSpellInfo(SHAMAN_SPELL_GLYPH_OF_MANA_TIDE))
return false;
- if (!sSpellStore.LookupEntry(SHAMAN_SPELL_MANA_TIDE_TOTEM))
+ if (!sSpellMgr->GetSpellInfo(SHAMAN_SPELL_MANA_TIDE_TOTEM))
return false;
return true;
}
@@ -198,11 +198,11 @@ public:
{
PrepareAuraScript(spell_sha_earthbind_totem_AuraScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(SHAMAN_TOTEM_SPELL_EARTHBIND_TOTEM))
+ if (!sSpellMgr->GetSpellInfo(SHAMAN_TOTEM_SPELL_EARTHBIND_TOTEM))
return false;
- if (!sSpellStore.LookupEntry(SHAMAN_TOTEM_SPELL_EARTHEN_POWER))
+ if (!sSpellMgr->GetSpellInfo(SHAMAN_TOTEM_SPELL_EARTHEN_POWER))
return false;
return true;
}
diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp
index a7b99aed6b5..2ce34be1a70 100644
--- a/src/server/scripts/Spells/spell_warlock.cpp
+++ b/src/server/scripts/Spells/spell_warlock.cpp
@@ -46,17 +46,17 @@ class spell_warl_demonic_empowerment : public SpellScriptLoader
{
PrepareSpellScript(spell_warl_demonic_empowerment_SpellScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(WARLOCK_DEMONIC_EMPOWERMENT_SUCCUBUS))
+ if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_SUCCUBUS))
return false;
- if (!sSpellStore.LookupEntry(WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER))
+ if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER))
return false;
- if (!sSpellStore.LookupEntry(WARLOCK_DEMONIC_EMPOWERMENT_FELGUARD))
+ if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_FELGUARD))
return false;
- if (!sSpellStore.LookupEntry(WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER))
+ if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER))
return false;
- if (!sSpellStore.LookupEntry(WARLOCK_DEMONIC_EMPOWERMENT_IMP))
+ if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_IMP))
return false;
return true;
}
@@ -75,7 +75,7 @@ class spell_warl_demonic_empowerment : public SpellScriptLoader
break;
case CREATURE_FAMILY_VOIDWALKER:
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER);
int32 hp = int32(targetCreature->CountPctFromMaxHealth(GetCaster()->CalculateSpellDamage(targetCreature, spellInfo, 0)));
targetCreature->CastCustomSpell(targetCreature, WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER, &hp, NULL, NULL, true);
//unitTarget->CastSpell(unitTarget, 54441, true);
@@ -119,11 +119,11 @@ class spell_warl_create_healthstone : public SpellScriptLoader
static uint32 const iTypes[8][3];
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(WARLOCK_IMPROVED_HEALTHSTONE_R1))
+ if (!sSpellMgr->GetSpellInfo(WARLOCK_IMPROVED_HEALTHSTONE_R1))
return false;
- if (!sSpellStore.LookupEntry(WARLOCK_IMPROVED_HEALTHSTONE_R2))
+ if (!sSpellMgr->GetSpellInfo(WARLOCK_IMPROVED_HEALTHSTONE_R2))
return false;
return true;
}
diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp
index 3574c5c03fc..1019456aab3 100644
--- a/src/server/scripts/Spells/spell_warrior.cpp
+++ b/src/server/scripts/Spells/spell_warrior.cpp
@@ -37,9 +37,9 @@ class spell_warr_last_stand : public SpellScriptLoader
{
PrepareSpellScript(spell_warr_last_stand_SpellScript);
- bool Validate(SpellEntry const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellStore.LookupEntry(WARRIOR_SPELL_LAST_STAND_TRIGGERED))
+ if (!sSpellMgr->GetSpellInfo(WARRIOR_SPELL_LAST_STAND_TRIGGERED))
return false;
return true;
}
diff --git a/src/server/scripts/World/boss_emerald_dragons.cpp b/src/server/scripts/World/boss_emerald_dragons.cpp
index ac101d239b5..26f3e238193 100644
--- a/src/server/scripts/World/boss_emerald_dragons.cpp
+++ b/src/server/scripts/World/boss_emerald_dragons.cpp
@@ -281,11 +281,11 @@ class spell_mark_of_nature : public SpellScriptLoader
{
PrepareSpellScript(spell_mark_of_nature_SpellScript);
- bool Validate(SpellEntry const* /*spellInfo*/)
+ bool Validate(SpellInfo const* /*spellInfo*/)
{
- if (!sSpellStore.LookupEntry(SPELL_MARK_OF_NATURE))
+ if (!sSpellMgr->GetSpellInfo(SPELL_MARK_OF_NATURE))
return false;
- if (!sSpellStore.LookupEntry(SPELL_AURA_OF_NATURE))
+ if (!sSpellMgr->GetSpellInfo(SPELL_AURA_OF_NATURE))
return false;
return true;
}
diff --git a/src/server/scripts/World/guards.cpp b/src/server/scripts/World/guards.cpp
index 52b7b233f88..6c71f3c2167 100644
--- a/src/server/scripts/World/guards.cpp
+++ b/src/server/scripts/World/guards.cpp
@@ -65,7 +65,7 @@ public:
{
if (me->GetEntry() == NPC_CENARION_HOLD_INFANTRY)
DoScriptText(RAND(SAY_GUARD_SIL_AGGRO1, SAY_GUARD_SIL_AGGRO2, SAY_GUARD_SIL_AGGRO3), me, who);
- if (SpellEntry const* spell = me->reachWithSpellAttack(who))
+ if (SpellInfo const* spell = me->reachWithSpellAttack(who))
DoCast(who, spell->Id);
}
@@ -83,7 +83,7 @@ public:
if (buffTimer <= diff)
{
//Find a spell that targets friendly and applies an aura (these are generally buffs)
- SpellEntry const *info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA);
+ SpellInfo const *info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA);
if (info && !globalCooldown)
{
@@ -111,7 +111,7 @@ public:
if (me->IsWithinMeleeRange(me->getVictim()))
{
bool healing = false;
- SpellEntry const *info = NULL;
+ SpellInfo const *info = NULL;
//Select a healing spell if less than 30% hp
if (me->HealthBelowPct(30))
@@ -147,7 +147,7 @@ public:
if (!me->IsNonMeleeSpellCasted(false))
{
bool healing = false;
- SpellEntry const *info = NULL;
+ SpellInfo const *info = NULL;
//Select a healing spell if less than 30% hp ONLY 33% of the time
if (me->HealthBelowPct(30) && 33 > urand(0, 99))
diff --git a/src/server/scripts/World/item_scripts.cpp b/src/server/scripts/World/item_scripts.cpp
index 10b0f14e632..f8095ba9c1e 100644
--- a/src/server/scripts/World/item_scripts.cpp
+++ b/src/server/scripts/World/item_scripts.cpp
@@ -65,7 +65,7 @@ public:
disabled = true;
break;
case 34475:
- if (const SpellEntry* pSpellInfo = GetSpellStore()->LookupEntry(SPELL_ARCANE_CHARGES))
+ if (const SpellInfo* pSpellInfo = sSpellMgr->GetSpellInfo(SPELL_ARCANE_CHARGES))
Spell::SendCastResult(player, pSpellInfo, 1, SPELL_FAILED_NOT_ON_GROUND);
break;
}
@@ -313,7 +313,7 @@ public:
{
player->SendEquipError(EQUIP_ERR_NONE, pItem, NULL);
- if (const SpellEntry* pSpellInfo = GetSpellStore()->LookupEntry(SPELL_PETROV_BOMB))
+ if (const SpellInfo* pSpellInfo = sSpellMgr->GetSpellInfo(SPELL_PETROV_BOMB))
Spell::SendCastResult(player, pSpellInfo, 1, SPELL_FAILED_NOT_HERE);
return true;
diff --git a/src/server/scripts/World/mob_generic_creature.cpp b/src/server/scripts/World/mob_generic_creature.cpp
index f8616c3fa5e..5cb707bb2a4 100644
--- a/src/server/scripts/World/mob_generic_creature.cpp
+++ b/src/server/scripts/World/mob_generic_creature.cpp
@@ -66,7 +66,7 @@ public:
if (BuffTimer <= diff)
{
//Find a spell that targets friendly and applies an aura (these are generally buffs)
- SpellEntry const *info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA);
+ SpellInfo const *info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA);
if (info && !GlobalCooldown)
{
@@ -94,7 +94,7 @@ public:
if (me->isAttackReady() && !me->IsNonMeleeSpellCasted(false))
{
bool Healing = false;
- SpellEntry const *info = NULL;
+ SpellInfo const *info = NULL;
//Select a healing spell if less than 30% hp
if (HealthBelowPct(30))
@@ -125,7 +125,7 @@ public:
if (!me->IsNonMeleeSpellCasted(false))
{
bool Healing = false;
- SpellEntry const *info = NULL;
+ SpellInfo const *info = NULL;
//Select a healing spell if less than 30% hp ONLY 33% of the time
if (HealthBelowPct(30) && rand() % 3 == 0)
@@ -176,13 +176,13 @@ public:
{
trigger_periodicAI(Creature* c) : NullCreatureAI(c)
{
- spell = me->m_spells[0] ? GetSpellStore()->LookupEntry(me->m_spells[0]) : NULL;
+ spell = me->m_spells[0] ? sSpellMgr->GetSpellInfo(me->m_spells[0]) : NULL;
interval = me->GetAttackTime(BASE_ATTACK);
timer = interval;
}
uint32 timer, interval;
- const SpellEntry * spell;
+ const SpellInfo * spell;
void UpdateAI(const uint32 diff)
{
diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp
index 60a67250efb..66fdf0a3fbe 100644
--- a/src/server/scripts/World/npc_professions.cpp
+++ b/src/server/scripts/World/npc_professions.cpp
@@ -217,14 +217,14 @@ int32 DoLowUnlearnCost(Player* player) //blacksmith
bool EquippedOk(Player* player, uint32 spellId)
{
- SpellEntry const* spell = GetSpellStore()->LookupEntry(spellId);
+ SpellInfo const* spell = sSpellMgr->GetSpellInfo(spellId);
if (!spell)
return false;
for (uint8 i = 0; i < 3; ++i)
{
- uint32 reqSpell = spell->EffectTriggerSpell[i];
+ uint32 reqSpell = spell->Effects[i].TriggerSpell;
if (!reqSpell)
continue;
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index 6cbdf4f90a3..22ce27d98cd 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -737,7 +737,7 @@ public:
void EnterCombat(Unit* /*who*/){}
- void SpellHit(Unit* caster, const SpellEntry *spell)
+ void SpellHit(Unit* caster, const SpellInfo *spell)
{
if (caster->GetTypeId() == TYPEID_PLAYER && me->isAlive() && spell->Id == 20804)
{
@@ -924,7 +924,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void SpellHit(Unit* pCaster, const SpellEntry *Spell)
+ void SpellHit(Unit* pCaster, const SpellInfo *Spell)
{
if (Spell->Id == SPELL_LESSER_HEAL_R2 || Spell->Id == SPELL_FORTITUDE_R1)
{
@@ -1925,7 +1925,7 @@ public:
}
// Fly away when dismissed
- void SpellHit(Unit* source, const SpellEntry *spell)
+ void SpellHit(Unit* source, const SpellInfo *spell)
{
if (spell->Id != 50515 || !me->isAlive())
return;