diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/scripts/Spells/spell_item.cpp | 5172 |
1 files changed, 2126 insertions, 3046 deletions
diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index df34e4f5af2..bf39b8c83f0 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -87,36 +87,25 @@ enum AegisOfPreservation }; // 23780 - Aegis of Preservation -class spell_item_aegis_of_preservation : public SpellScriptLoader +class spell_item_aegis_of_preservation : public AuraScript { - public: - spell_item_aegis_of_preservation() : SpellScriptLoader("spell_item_aegis_of_preservation") { } - - class spell_item_aegis_of_preservation_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_aegis_of_preservation_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_AEGIS_HEAL }); - } + PrepareAuraScript(spell_item_aegis_of_preservation); - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) - { - PreventDefaultAction(); - GetTarget()->CastSpell(GetTarget(), SPELL_AEGIS_HEAL, true, nullptr, aurEff); - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_AEGIS_HEAL }); + } - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_item_aegis_of_preservation_AuraScript::HandleProc, EFFECT_1, SPELL_AURA_PROC_TRIGGER_SPELL); - } - }; + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) + { + PreventDefaultAction(); + GetTarget()->CastSpell(GetTarget(), SPELL_AEGIS_HEAL, true, nullptr, aurEff); + } - AuraScript* GetAuraScript() const override - { - return new spell_item_aegis_of_preservation_AuraScript(); - } + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_item_aegis_of_preservation::HandleProc, EFFECT_1, SPELL_AURA_PROC_TRIGGER_SPELL); + } }; enum AlchemistStone @@ -135,54 +124,47 @@ enum AlchemistStone // Item - 44324: Mighty Alchemist's Stone // 17619 - Alchemist Stone -class spell_item_alchemist_stone : public SpellScriptLoader +class spell_item_alchemist_stone : public AuraScript { - public: - spell_item_alchemist_stone() : SpellScriptLoader("spell_item_alchemist_stone") { } + PrepareAuraScript(spell_item_alchemist_stone); - class spell_item_alchemist_stone_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( { - PrepareAuraScript(spell_item_alchemist_stone_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_ALCHEMIST_STONE_EXTRA_HEAL, SPELL_ALCHEMIST_STONE_EXTRA_MANA }); - } - - bool CheckProc(ProcEventInfo& eventInfo) - { - return eventInfo.GetDamageInfo()->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_POTION; - } + SPELL_ALCHEMIST_STONE_EXTRA_HEAL, + SPELL_ALCHEMIST_STONE_EXTRA_MANA + }); + } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); + bool CheckProc(ProcEventInfo& eventInfo) + { + return eventInfo.GetDamageInfo()->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_POTION; + } - uint32 spellId = 0; - int32 amount = int32(eventInfo.GetDamageInfo()->GetDamage() * 0.4f); + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); - if (eventInfo.GetDamageInfo()->GetSpellInfo()->HasEffect(SPELL_EFFECT_HEAL)) - spellId = SPELL_ALCHEMIST_STONE_EXTRA_HEAL; - else if (eventInfo.GetDamageInfo()->GetSpellInfo()->HasEffect(SPELL_EFFECT_ENERGIZE)) - spellId = SPELL_ALCHEMIST_STONE_EXTRA_MANA; + uint32 spellId = 0; + int32 amount = int32(eventInfo.GetDamageInfo()->GetDamage() * 0.4f); - if (!spellId) - return; + if (eventInfo.GetDamageInfo()->GetSpellInfo()->HasEffect(SPELL_EFFECT_HEAL)) + spellId = SPELL_ALCHEMIST_STONE_EXTRA_HEAL; + else if (eventInfo.GetDamageInfo()->GetSpellInfo()->HasEffect(SPELL_EFFECT_ENERGIZE)) + spellId = SPELL_ALCHEMIST_STONE_EXTRA_MANA; - GetTarget()->CastCustomSpell(spellId, SPELLVALUE_BASE_POINT0, amount, GetTarget(), true, nullptr, aurEff); - } + if (!spellId) + return; - void Register() override - { - DoCheckProc += AuraCheckProcFn(spell_item_alchemist_stone_AuraScript::CheckProc); - OnEffectProc += AuraEffectProcFn(spell_item_alchemist_stone_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + GetTarget()->CastCustomSpell(spellId, SPELLVALUE_BASE_POINT0, amount, GetTarget(), true, nullptr, aurEff); + } - AuraScript* GetAuraScript() const override - { - return new spell_item_alchemist_stone_AuraScript(); - } + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_item_alchemist_stone::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_item_alchemist_stone::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; enum AngerCapacitor @@ -251,32 +233,21 @@ class spell_item_anger_capacitor : public SpellScriptLoader }; // 26400 - Arcane Shroud -class spell_item_arcane_shroud : public SpellScriptLoader +class spell_item_arcane_shroud : public AuraScript { - public: - spell_item_arcane_shroud() : SpellScriptLoader("spell_item_arcane_shroud") { } + PrepareAuraScript(spell_item_arcane_shroud); - class spell_item_arcane_shroud_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_arcane_shroud_AuraScript); - - void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) - { - int32 diff = GetUnitOwner()->getLevel() - 60; - if (diff > 0) - amount += 2 * diff; - } - - void Register() override - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_item_arcane_shroud_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_THREAT); - } - }; + void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + int32 diff = GetUnitOwner()->getLevel() - 60; + if (diff > 0) + amount += 2 * diff; + } - AuraScript* GetAuraScript() const override - { - return new spell_item_arcane_shroud_AuraScript(); - } + void Register() override + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_item_arcane_shroud::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_THREAT); + } }; enum AuraOfMadness @@ -299,113 +270,95 @@ enum AuraOfMadness // Item - 31859: Darkmoon Card: Madness // 39446 - Aura of Madness -class spell_item_aura_of_madness : public SpellScriptLoader +class spell_item_aura_of_madness : public AuraScript { - public: - spell_item_aura_of_madness() : SpellScriptLoader("spell_item_aura_of_madness") { } + PrepareAuraScript(spell_item_aura_of_madness); - class spell_item_aura_of_madness_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_aura_of_madness_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return sBroadcastTextStore.LookupEntry(SAY_MADNESS) && ValidateSpellInfo( - { - SPELL_SOCIOPATH, - SPELL_DELUSIONAL, - SPELL_KLEPTOMANIA, - SPELL_MEGALOMANIA, - SPELL_PARANOIA, - SPELL_MANIC, - SPELL_NARCISSISM, - SPELL_MARTYR_COMPLEX, - SPELL_DEMENTIA - }); - } - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - static std::vector<uint32> const triggeredSpells[MAX_CLASSES] = - { - //CLASS_NONE - { }, - //CLASS_WARRIOR - { SPELL_SOCIOPATH, SPELL_DELUSIONAL, SPELL_KLEPTOMANIA, SPELL_PARANOIA, SPELL_MANIC, SPELL_MARTYR_COMPLEX }, - //CLASS_PALADIN - { SPELL_SOCIOPATH, SPELL_DELUSIONAL, SPELL_KLEPTOMANIA, SPELL_MEGALOMANIA, SPELL_PARANOIA, SPELL_MANIC, SPELL_NARCISSISM, SPELL_MARTYR_COMPLEX, SPELL_DEMENTIA }, - //CLASS_HUNTER - { SPELL_DELUSIONAL, SPELL_MEGALOMANIA, SPELL_PARANOIA, SPELL_MANIC, SPELL_NARCISSISM, SPELL_MARTYR_COMPLEX, SPELL_DEMENTIA }, - //CLASS_ROGUE - { SPELL_SOCIOPATH, SPELL_DELUSIONAL, SPELL_KLEPTOMANIA, SPELL_PARANOIA, SPELL_MANIC, SPELL_MARTYR_COMPLEX }, - //CLASS_PRIEST - { SPELL_MEGALOMANIA, SPELL_PARANOIA, SPELL_MANIC, SPELL_NARCISSISM, SPELL_MARTYR_COMPLEX, SPELL_DEMENTIA }, - //CLASS_DEATH_KNIGHT - { SPELL_SOCIOPATH, SPELL_DELUSIONAL, SPELL_KLEPTOMANIA, SPELL_PARANOIA, SPELL_MANIC, SPELL_MARTYR_COMPLEX }, - //CLASS_SHAMAN - { SPELL_MEGALOMANIA, SPELL_PARANOIA, SPELL_MANIC, SPELL_NARCISSISM, SPELL_MARTYR_COMPLEX, SPELL_DEMENTIA }, - //CLASS_MAGE - { SPELL_MEGALOMANIA, SPELL_PARANOIA, SPELL_MANIC, SPELL_NARCISSISM, SPELL_MARTYR_COMPLEX, SPELL_DEMENTIA }, - //CLASS_WARLOCK - { SPELL_MEGALOMANIA, SPELL_PARANOIA, SPELL_MANIC, SPELL_NARCISSISM, SPELL_MARTYR_COMPLEX, SPELL_DEMENTIA }, - //CLASS_UNK - { }, - //CLASS_DRUID - { SPELL_SOCIOPATH, SPELL_DELUSIONAL, SPELL_KLEPTOMANIA, SPELL_MEGALOMANIA, SPELL_PARANOIA, SPELL_MANIC, SPELL_NARCISSISM, SPELL_MARTYR_COMPLEX, SPELL_DEMENTIA } - }; + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( + { + SPELL_SOCIOPATH, + SPELL_DELUSIONAL, + SPELL_KLEPTOMANIA, + SPELL_MEGALOMANIA, + SPELL_PARANOIA, + SPELL_MANIC, + SPELL_NARCISSISM, + SPELL_MARTYR_COMPLEX, + SPELL_DEMENTIA + }) && sBroadcastTextStore.LookupEntry(SAY_MADNESS); + } - PreventDefaultAction(); - Unit* caster = eventInfo.GetActor(); - uint32 spellId = Trinity::Containers::SelectRandomContainerElement(triggeredSpells[caster->getClass()]); - caster->CastSpell(caster, spellId, true, nullptr, aurEff); + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + static std::vector<uint32> const triggeredSpells[MAX_CLASSES] = + { + //CLASS_NONE + { }, + //CLASS_WARRIOR + { SPELL_SOCIOPATH, SPELL_DELUSIONAL, SPELL_KLEPTOMANIA, SPELL_PARANOIA, SPELL_MANIC, SPELL_MARTYR_COMPLEX }, + //CLASS_PALADIN + { SPELL_SOCIOPATH, SPELL_DELUSIONAL, SPELL_KLEPTOMANIA, SPELL_MEGALOMANIA, SPELL_PARANOIA, SPELL_MANIC, SPELL_NARCISSISM, SPELL_MARTYR_COMPLEX, SPELL_DEMENTIA }, + //CLASS_HUNTER + { SPELL_DELUSIONAL, SPELL_MEGALOMANIA, SPELL_PARANOIA, SPELL_MANIC, SPELL_NARCISSISM, SPELL_MARTYR_COMPLEX, SPELL_DEMENTIA }, + //CLASS_ROGUE + { SPELL_SOCIOPATH, SPELL_DELUSIONAL, SPELL_KLEPTOMANIA, SPELL_PARANOIA, SPELL_MANIC, SPELL_MARTYR_COMPLEX }, + //CLASS_PRIEST + { SPELL_MEGALOMANIA, SPELL_PARANOIA, SPELL_MANIC, SPELL_NARCISSISM, SPELL_MARTYR_COMPLEX, SPELL_DEMENTIA }, + //CLASS_DEATH_KNIGHT + { SPELL_SOCIOPATH, SPELL_DELUSIONAL, SPELL_KLEPTOMANIA, SPELL_PARANOIA, SPELL_MANIC, SPELL_MARTYR_COMPLEX }, + //CLASS_SHAMAN + { SPELL_MEGALOMANIA, SPELL_PARANOIA, SPELL_MANIC, SPELL_NARCISSISM, SPELL_MARTYR_COMPLEX, SPELL_DEMENTIA }, + //CLASS_MAGE + { SPELL_MEGALOMANIA, SPELL_PARANOIA, SPELL_MANIC, SPELL_NARCISSISM, SPELL_MARTYR_COMPLEX, SPELL_DEMENTIA }, + //CLASS_WARLOCK + { SPELL_MEGALOMANIA, SPELL_PARANOIA, SPELL_MANIC, SPELL_NARCISSISM, SPELL_MARTYR_COMPLEX, SPELL_DEMENTIA }, + //CLASS_UNK + { }, + //CLASS_DRUID + { SPELL_SOCIOPATH, SPELL_DELUSIONAL, SPELL_KLEPTOMANIA, SPELL_MEGALOMANIA, SPELL_PARANOIA, SPELL_MANIC, SPELL_NARCISSISM, SPELL_MARTYR_COMPLEX, SPELL_DEMENTIA } + }; - if (roll_chance_i(10)) - caster->Unit::Say(SAY_MADNESS); - } + PreventDefaultAction(); + Unit* caster = eventInfo.GetActor(); + uint32 spellId = Trinity::Containers::SelectRandomContainerElement(triggeredSpells[caster->getClass()]); + caster->CastSpell(caster, spellId, true, nullptr, aurEff); - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_item_aura_of_madness_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + if (roll_chance_i(10)) + caster->Unit::Say(SAY_MADNESS); + } - AuraScript* GetAuraScript() const override - { - return new spell_item_aura_of_madness_AuraScript(); - } + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_item_aura_of_madness::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; // 41404 - Dementia -class spell_item_dementia : public SpellScriptLoader +class spell_item_dementia : public AuraScript { - public: - spell_item_dementia() : SpellScriptLoader("spell_item_dementia") { } + PrepareAuraScript(spell_item_dementia); - class spell_item_dementia_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( { - PrepareAuraScript(spell_item_dementia_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_DEMENTIA_POS, SPELL_DEMENTIA_NEG }); - } - - void HandlePeriodicDummy(AuraEffect const* aurEff) - { - PreventDefaultAction(); - GetTarget()->CastSpell(GetTarget(), RAND(SPELL_DEMENTIA_POS, SPELL_DEMENTIA_NEG), true, nullptr, aurEff); - } + SPELL_DEMENTIA_POS, + SPELL_DEMENTIA_NEG + }); + } - void Register() override - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_item_dementia_AuraScript::HandlePeriodicDummy, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; + void HandlePeriodicDummy(AuraEffect const* aurEff) + { + PreventDefaultAction(); + GetTarget()->CastSpell(GetTarget(), RAND(SPELL_DEMENTIA_POS, SPELL_DEMENTIA_NEG), true, nullptr, aurEff); + } - AuraScript* GetAuraScript() const override - { - return new spell_item_dementia_AuraScript(); - } + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_item_dementia::HandlePeriodicDummy, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } }; // 64411 - Blessing of Ancient Kings (Val'anyr, Hammer of Ancient Kings) @@ -414,57 +367,46 @@ enum BlessingOfAncientKings SPELL_PROTECTION_OF_ANCIENT_KINGS = 64413 }; -class spell_item_blessing_of_ancient_kings : public SpellScriptLoader +class spell_item_blessing_of_ancient_kings : public AuraScript { - public: - spell_item_blessing_of_ancient_kings() : SpellScriptLoader("spell_item_blessing_of_ancient_kings") { } - - class spell_item_blessing_of_ancient_kings_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_blessing_of_ancient_kings_AuraScript); + PrepareAuraScript(spell_item_blessing_of_ancient_kings); - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_PROTECTION_OF_ANCIENT_KINGS }); - } - - bool CheckProc(ProcEventInfo& eventInfo) - { - return eventInfo.GetProcTarget() != nullptr; - } - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - - HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PROTECTION_OF_ANCIENT_KINGS }); + } - int32 absorb = int32(CalculatePct(healInfo->GetHeal(), 15.0f)); - if (AuraEffect* protEff = eventInfo.GetProcTarget()->GetAuraEffect(SPELL_PROTECTION_OF_ANCIENT_KINGS, EFFECT_0, eventInfo.GetActor()->GetGUID())) - { - // The shield can grow to a maximum size of 20,000 damage absorbtion - protEff->SetAmount(std::min<int32>(protEff->GetAmount() + absorb, 20000)); + bool CheckProc(ProcEventInfo& eventInfo) + { + return eventInfo.GetProcTarget() != nullptr; + } - // Refresh and return to prevent replacing the aura - protEff->GetBase()->RefreshDuration(); - } - else - GetTarget()->CastCustomSpell(SPELL_PROTECTION_OF_ANCIENT_KINGS, SPELLVALUE_BASE_POINT0, absorb, eventInfo.GetProcTarget(), true, nullptr, aurEff); - } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); - void Register() override - { - DoCheckProc += AuraCheckProcFn(spell_item_blessing_of_ancient_kings_AuraScript::CheckProc); - OnEffectProc += AuraEffectProcFn(spell_item_blessing_of_ancient_kings_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + HealInfo* healInfo = eventInfo.GetHealInfo(); + if (!healInfo || !healInfo->GetHeal()) + return; - AuraScript* GetAuraScript() const override + int32 absorb = int32(CalculatePct(healInfo->GetHeal(), 15.0f)); + if (AuraEffect* protEff = eventInfo.GetProcTarget()->GetAuraEffect(SPELL_PROTECTION_OF_ANCIENT_KINGS, EFFECT_0, eventInfo.GetActor()->GetGUID())) { - return new spell_item_blessing_of_ancient_kings_AuraScript(); + // The shield can grow to a maximum size of 20,000 damage absorbtion + protEff->SetAmount(std::min<int32>(protEff->GetAmount() + absorb, 20000)); + + // Refresh and return to prevent replacing the aura + protEff->GetBase()->RefreshDuration(); } + else + GetTarget()->CastCustomSpell(SPELL_PROTECTION_OF_ANCIENT_KINGS, SPELLVALUE_BASE_POINT0, absorb, eventInfo.GetProcTarget(), true, nullptr, aurEff); + } + + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_item_blessing_of_ancient_kings::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_item_blessing_of_ancient_kings::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; enum DeadlyPrecision @@ -473,64 +415,42 @@ enum DeadlyPrecision }; // 71564 - Deadly Precision -class spell_item_deadly_precision : public SpellScriptLoader +class spell_item_deadly_precision : public AuraScript { - public: - spell_item_deadly_precision() : SpellScriptLoader("spell_item_deadly_precision") { } + PrepareAuraScript(spell_item_deadly_precision); - class spell_item_deadly_precision_charm_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_deadly_precision_charm_AuraScript); - - void HandleStackDrop(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/) - { - PreventDefaultAction(); - GetTarget()->RemoveAuraFromStack(GetId(), GetTarget()->GetGUID()); - } - - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_item_deadly_precision_charm_AuraScript::HandleStackDrop, EFFECT_0, SPELL_AURA_MOD_RATING); - } - }; + void HandleStackDrop(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/) + { + PreventDefaultAction(); + GetTarget()->RemoveAuraFromStack(GetId(), GetTarget()->GetGUID()); + } - AuraScript* GetAuraScript() const override - { - return new spell_item_deadly_precision_charm_AuraScript(); - } + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_item_deadly_precision::HandleStackDrop, EFFECT_0, SPELL_AURA_MOD_RATING); + } }; // 71563 - Deadly Precision Dummy -class spell_item_deadly_precision_dummy : public SpellScriptLoader +class spell_item_deadly_precision_dummy : public SpellScript { - public: - spell_item_deadly_precision_dummy() : SpellScriptLoader("spell_item_deadly_precision_dummy") { } - - class spell_item_deadly_precision_dummy_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_deadly_precision_dummy_SpellScript); + PrepareSpellScript(spell_item_deadly_precision_dummy); - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_DEADLY_PRECISION }); - } - - void HandleDummy(SpellEffIndex /*effIndex*/) - { - SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_DEADLY_PRECISION, GetCastDifficulty()); - GetCaster()->CastCustomSpell(spellInfo->Id, SPELLVALUE_AURA_STACK, spellInfo->StackAmount, GetCaster(), true); - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_DEADLY_PRECISION }); + } - void Register() override - { - OnEffectHit += SpellEffectFn(spell_item_deadly_precision_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_APPLY_AURA); - } - }; + void HandleDummy(SpellEffIndex /*effIndex*/) + { + SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_DEADLY_PRECISION, GetCastDifficulty()); + GetCaster()->CastCustomSpell(spellInfo->Id, SPELLVALUE_AURA_STACK, spellInfo->StackAmount, GetCaster(), true); + } - SpellScript* GetSpellScript() const override - { - return new spell_item_deadly_precision_dummy_SpellScript(); - } + void Register() override + { + OnEffectHit += SpellEffectFn(spell_item_deadly_precision_dummy::HandleDummy, EFFECT_0, SPELL_EFFECT_APPLY_AURA); + } }; enum DeathbringersWill @@ -629,52 +549,41 @@ class spell_item_deathbringers_will : public SpellScriptLoader }; // 47770 - Roll Dice -class spell_item_decahedral_dwarven_dice : public SpellScriptLoader +class spell_item_decahedral_dwarven_dice : public SpellScript { - public: - spell_item_decahedral_dwarven_dice() : SpellScriptLoader("spell_item_decahedral_dwarven_dice") { } + PrepareSpellScript(spell_item_decahedral_dwarven_dice); - class spell_item_decahedral_dwarven_dice_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_decahedral_dwarven_dice_SpellScript); - - enum - { - TEXT_DECAHEDRAL_DWARVEN_DICE = 26147 - }; - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - if (!sBroadcastTextStore.LookupEntry(TEXT_DECAHEDRAL_DWARVEN_DICE)) - return false; - return true; - } + enum + { + TEXT_DECAHEDRAL_DWARVEN_DICE = 26147 + }; - bool Load() override - { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + if (!sBroadcastTextStore.LookupEntry(TEXT_DECAHEDRAL_DWARVEN_DICE)) + return false; + return true; + } - void HandleScript(SpellEffIndex /*effIndex*/) - { - GetCaster()->TextEmote(TEXT_DECAHEDRAL_DWARVEN_DICE, GetHitUnit()); + bool Load() override + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } - static uint32 const minimum = 1; - static uint32 const maximum = 100; + void HandleScript(SpellEffIndex /*effIndex*/) + { + GetCaster()->TextEmote(TEXT_DECAHEDRAL_DWARVEN_DICE, GetHitUnit()); - GetCaster()->ToPlayer()->DoRandomRoll(minimum, maximum); - } + static uint32 const minimum = 1; + static uint32 const maximum = 100; - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_decahedral_dwarven_dice_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + GetCaster()->ToPlayer()->DoRandomRoll(minimum, maximum); + } - SpellScript* GetSpellScript() const override - { - return new spell_item_decahedral_dwarven_dice_SpellScript(); - } + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_decahedral_dwarven_dice::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } }; // 8342 - Defibrillate (Goblin Jumper Cables) have 33% chance on success @@ -739,36 +648,25 @@ enum DesperateDefense }; // 33896 - Desperate Defense -class spell_item_desperate_defense : public SpellScriptLoader +class spell_item_desperate_defense : public AuraScript { - public: - spell_item_desperate_defense() : SpellScriptLoader("spell_item_desperate_defense") { } + PrepareAuraScript(spell_item_desperate_defense); - class spell_item_desperate_defense_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_desperate_defense_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_DESPERATE_RAGE }); - } - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) - { - PreventDefaultAction(); - GetTarget()->CastSpell(GetTarget(), SPELL_DESPERATE_RAGE, true, nullptr, aurEff); - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_DESPERATE_RAGE }); + } - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_item_desperate_defense_AuraScript::HandleProc, EFFECT_2, SPELL_AURA_PROC_TRIGGER_SPELL); - } - }; + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) + { + PreventDefaultAction(); + GetTarget()->CastSpell(GetTarget(), SPELL_DESPERATE_RAGE, true, nullptr, aurEff); + } - AuraScript* GetAuraScript() const override - { - return new spell_item_desperate_defense_AuraScript(); - } + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_item_desperate_defense::HandleProc, EFFECT_2, SPELL_AURA_PROC_TRIGGER_SPELL); + } }; // http://www.wowhead.com/item=6522 Deviate Fish @@ -782,42 +680,31 @@ enum DeviateFishSpells SPELL_HEALTHY_SPIRIT = 8068, }; -class spell_item_deviate_fish : public SpellScriptLoader +class spell_item_deviate_fish : public SpellScript { - public: - spell_item_deviate_fish() : SpellScriptLoader("spell_item_deviate_fish") { } - - class spell_item_deviate_fish_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_deviate_fish_SpellScript); + PrepareSpellScript(spell_item_deviate_fish); - bool Load() override - { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_SLEEPY, SPELL_INVIGORATE, SPELL_SHRINK, SPELL_PARTY_TIME, SPELL_HEALTHY_SPIRIT }); - } + bool Load() override + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } - void HandleDummy(SpellEffIndex /*effIndex*/) - { - Unit* caster = GetCaster(); - uint32 spellId = urand(SPELL_SLEEPY, SPELL_HEALTHY_SPIRIT); - caster->CastSpell(caster, spellId, true, nullptr); - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_SLEEPY, SPELL_INVIGORATE, SPELL_SHRINK, SPELL_PARTY_TIME, SPELL_HEALTHY_SPIRIT }); + } - void Register() override - { - OnEffectHit += SpellEffectFn(spell_item_deviate_fish_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + uint32 spellId = urand(SPELL_SLEEPY, SPELL_HEALTHY_SPIRIT); + caster->CastSpell(caster, spellId, true, nullptr); + } - SpellScript* GetSpellScript() const override - { - return new spell_item_deviate_fish_SpellScript(); - } + void Register() override + { + OnEffectHit += SpellEffectFn(spell_item_deviate_fish::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; enum DiscerningEyeBeastMisc @@ -826,70 +713,48 @@ enum DiscerningEyeBeastMisc }; // 59915 - Discerning Eye of the Beast Dummy -class spell_item_discerning_eye_beast_dummy : public SpellScriptLoader +class spell_item_discerning_eye_beast_dummy : public AuraScript { - public: - spell_item_discerning_eye_beast_dummy() : SpellScriptLoader("spell_item_discerning_eye_beast_dummy") { } + PrepareAuraScript(spell_item_discerning_eye_beast_dummy); - class spell_item_discerning_eye_beast_dummy_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_discerning_eye_beast_dummy_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_DISCERNING_EYE_BEAST }); - } - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - eventInfo.GetActor()->CastSpell(nullptr, SPELL_DISCERNING_EYE_BEAST, true, nullptr, aurEff); - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_DISCERNING_EYE_BEAST }); + } - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_item_discerning_eye_beast_dummy_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + eventInfo.GetActor()->CastSpell(nullptr, SPELL_DISCERNING_EYE_BEAST, true, nullptr, aurEff); + } - AuraScript* GetAuraScript() const override - { - return new spell_item_discerning_eye_beast_dummy_AuraScript(); - } + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_item_discerning_eye_beast_dummy::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; // 71610, 71641 - Echoes of Light (Althor's Abacus) -class spell_item_echoes_of_light : public SpellScriptLoader +class spell_item_echoes_of_light : public SpellScript { - public: - spell_item_echoes_of_light() : SpellScriptLoader("spell_item_echoes_of_light") { } + PrepareSpellScript(spell_item_echoes_of_light); - class spell_item_echoes_of_light_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_echoes_of_light_SpellScript); - - void FilterTargets(std::list<WorldObject*>& targets) - { - if (targets.size() < 2) - return; - - targets.sort(Trinity::HealthPctOrderPred()); + void FilterTargets(std::list<WorldObject*>& targets) + { + if (targets.size() < 2) + return; - WorldObject* target = targets.front(); - targets.clear(); - targets.push_back(target); - } + targets.sort(Trinity::HealthPctOrderPred()); - void Register() override - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_item_echoes_of_light_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ALLY); - } - }; + WorldObject* target = targets.front(); + targets.clear(); + targets.push_back(target); + } - SpellScript* GetSpellScript() const override - { - return new spell_item_echoes_of_light_SpellScript(); - } + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_item_echoes_of_light::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ALLY); + } }; // 7434 - Fate Rune of Unsurpassed Vigor @@ -898,36 +763,25 @@ enum FateRuneOfUnsurpassedVigor SPELL_UNSURPASSED_VIGOR = 25733 }; -class spell_item_fate_rune_of_unsurpassed_vigor : public SpellScriptLoader +class spell_item_fate_rune_of_unsurpassed_vigor : public AuraScript { - public: - spell_item_fate_rune_of_unsurpassed_vigor() : SpellScriptLoader("spell_item_fate_rune_of_unsurpassed_vigor") { } - - class spell_item_fate_rune_of_unsurpassed_vigor_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_fate_rune_of_unsurpassed_vigor_AuraScript); + PrepareAuraScript(spell_item_fate_rune_of_unsurpassed_vigor); - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_UNSURPASSED_VIGOR }); - } - - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/) - { - PreventDefaultAction(); - GetTarget()->CastSpell(GetTarget(), SPELL_UNSURPASSED_VIGOR, true); - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_UNSURPASSED_VIGOR }); + } - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_item_fate_rune_of_unsurpassed_vigor_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/) + { + PreventDefaultAction(); + GetTarget()->CastSpell(GetTarget(), SPELL_UNSURPASSED_VIGOR, true); + } - AuraScript* GetAuraScript() const override - { - return new spell_item_fate_rune_of_unsurpassed_vigor_AuraScript(); - } + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_item_fate_rune_of_unsurpassed_vigor::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; // http://www.wowhead.com/item=47499 Flask of the North @@ -939,74 +793,58 @@ enum FlaskOfTheNorthSpells SPELL_FLASK_OF_THE_NORTH_STR = 67018, }; -class spell_item_flask_of_the_north : public SpellScriptLoader +class spell_item_flask_of_the_north : public SpellScript { - public: - spell_item_flask_of_the_north() : SpellScriptLoader("spell_item_flask_of_the_north") { } - - class spell_item_flask_of_the_north_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_flask_of_the_north_SpellScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo( - { - SPELL_FLASK_OF_THE_NORTH_SP, - SPELL_FLASK_OF_THE_NORTH_AP, - SPELL_FLASK_OF_THE_NORTH_STR - }); - } - - void HandleDummy(SpellEffIndex /*effIndex*/) - { - Unit* caster = GetCaster(); - std::vector<uint32> possibleSpells; - switch (caster->getClass()) - { - case CLASS_WARLOCK: - case CLASS_MAGE: - case CLASS_PRIEST: - possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_SP); - break; - case CLASS_DEATH_KNIGHT: - case CLASS_WARRIOR: - possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_STR); - break; - case CLASS_ROGUE: - case CLASS_HUNTER: - possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_AP); - break; - case CLASS_DRUID: - case CLASS_PALADIN: - possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_SP); - possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_STR); - break; - case CLASS_SHAMAN: - possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_SP); - possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_AP); - break; - } + PrepareSpellScript(spell_item_flask_of_the_north); - if (possibleSpells.empty()) - { - TC_LOG_WARN("spells", "Missing spells for class %u in script spell_item_flask_of_the_north", caster->getClass()); - return; - } - - caster->CastSpell(caster, Trinity::Containers::SelectRandomContainerElement(possibleSpells), true); - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_FLASK_OF_THE_NORTH_SP, SPELL_FLASK_OF_THE_NORTH_AP, SPELL_FLASK_OF_THE_NORTH_STR }); + } - void Register() override - { - OnEffectHit += SpellEffectFn(spell_item_flask_of_the_north_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + std::vector<uint32> possibleSpells; + switch (caster->getClass()) + { + case CLASS_WARLOCK: + case CLASS_MAGE: + case CLASS_PRIEST: + possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_SP); + break; + case CLASS_DEATH_KNIGHT: + case CLASS_WARRIOR: + possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_STR); + break; + case CLASS_ROGUE: + case CLASS_HUNTER: + possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_AP); + break; + case CLASS_DRUID: + case CLASS_PALADIN: + possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_SP); + possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_STR); + break; + case CLASS_SHAMAN: + possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_SP); + possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_AP); + break; + } - SpellScript* GetSpellScript() const override + if (possibleSpells.empty()) { - return new spell_item_flask_of_the_north_SpellScript(); + TC_LOG_WARN("spells", "Missing spells for class %u in script spell_item_flask_of_the_north", caster->getClass()); + return; } + + caster->CastSpell(caster, Trinity::Containers::SelectRandomContainerElement(possibleSpells), true); + } + + void Register() override + { + OnEffectHit += SpellEffectFn(spell_item_flask_of_the_north::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; enum FrozenShadoweave @@ -1016,42 +854,31 @@ enum FrozenShadoweave // 39372 - Frozen Shadoweave // Frozen Shadoweave set 3p bonus -class spell_item_frozen_shadoweave : public SpellScriptLoader +class spell_item_frozen_shadoweave : public AuraScript { - public: - spell_item_frozen_shadoweave() : SpellScriptLoader("spell_item_frozen_shadoweave") { } - - class spell_item_frozen_shadoweave_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_frozen_shadoweave_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_SHADOWMEND }); - } + PrepareAuraScript(spell_item_frozen_shadoweave); - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - DamageInfo* damageInfo = eventInfo.GetDamageInfo(); - if (!damageInfo || !damageInfo->GetDamage()) - return; - - int32 amount = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount()); - Unit* caster = eventInfo.GetActor(); - caster->CastCustomSpell(SPELL_SHADOWMEND, SPELLVALUE_BASE_POINT0, amount, nullptr, true, nullptr, aurEff); - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_SHADOWMEND }); + } - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_item_frozen_shadoweave_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + if (!damageInfo || !damageInfo->GetDamage()) + return; + + int32 amount = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount()); + Unit* caster = eventInfo.GetActor(); + caster->CastCustomSpell(SPELL_SHADOWMEND, SPELLVALUE_BASE_POINT0, amount, nullptr, true, nullptr, aurEff); + } - AuraScript* GetAuraScript() const override - { - return new spell_item_frozen_shadoweave_AuraScript(); - } + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_item_frozen_shadoweave::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; // http://www.wowhead.com/item=10645 Gnomish Death Ray @@ -1062,42 +889,31 @@ enum GnomishDeathRay SPELL_GNOMISH_DEATH_RAY_TARGET = 13279, }; -class spell_item_gnomish_death_ray : public SpellScriptLoader +class spell_item_gnomish_death_ray : public SpellScript { - public: - spell_item_gnomish_death_ray() : SpellScriptLoader("spell_item_gnomish_death_ray") { } - - class spell_item_gnomish_death_ray_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_gnomish_death_ray_SpellScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_GNOMISH_DEATH_RAY_SELF, SPELL_GNOMISH_DEATH_RAY_TARGET }); - } + PrepareSpellScript(spell_item_gnomish_death_ray); - void HandleDummy(SpellEffIndex /*effIndex*/) - { - Unit* caster = GetCaster(); - if (Unit* target = GetHitUnit()) - { - if (urand(0, 99) < 15) - caster->CastSpell(caster, SPELL_GNOMISH_DEATH_RAY_SELF, true); // failure - else - caster->CastSpell(target, SPELL_GNOMISH_DEATH_RAY_TARGET, true); - } - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_gnomish_death_ray_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_GNOMISH_DEATH_RAY_SELF, SPELL_GNOMISH_DEATH_RAY_TARGET }); + } - SpellScript* GetSpellScript() const override + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (Unit* target = GetHitUnit()) { - return new spell_item_gnomish_death_ray_SpellScript(); + if (urand(0, 99) < 15) + caster->CastSpell(caster, SPELL_GNOMISH_DEATH_RAY_SELF, true); // failure + else + caster->CastSpell(target, SPELL_GNOMISH_DEATH_RAY_TARGET, true); } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_gnomish_death_ray::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; // Item 10721: Gnomish Harm Prevention Belt @@ -1107,34 +923,23 @@ enum HarmPreventionBelt SPELL_FORCEFIELD_COLLAPSE = 13235 }; -class spell_item_harm_prevention_belt : public SpellScriptLoader +class spell_item_harm_prevention_belt : public AuraScript { -public: - spell_item_harm_prevention_belt() : SpellScriptLoader("spell_item_harm_prevention_belt") { } + PrepareAuraScript(spell_item_harm_prevention_belt); - class spell_item_harm_prevention_belt_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareAuraScript(spell_item_harm_prevention_belt_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_FORCEFIELD_COLLAPSE }); - } - - void HandleProc(ProcEventInfo& /*eventInfo*/) - { - GetTarget()->CastSpell(nullptr, SPELL_FORCEFIELD_COLLAPSE, true); - } + return ValidateSpellInfo({ SPELL_FORCEFIELD_COLLAPSE }); + } - void Register() override - { - OnProc += AuraProcFn(spell_item_harm_prevention_belt_AuraScript::HandleProc); - } - }; + void HandleProc(ProcEventInfo& /*eventInfo*/) + { + GetTarget()->CastSpell(nullptr, SPELL_FORCEFIELD_COLLAPSE, true); + } - AuraScript* GetAuraScript() const override + void Register() override { - return new spell_item_harm_prevention_belt_AuraScript(); + OnProc += AuraProcFn(spell_item_harm_prevention_belt::HandleProc); } }; @@ -1219,41 +1024,30 @@ class spell_item_heartpierce : public SpellScriptLoader }; // 40971 - Bonus Healing (Crystal Spire of Karabor) -class spell_item_crystal_spire_of_karabor : public SpellScriptLoader +class spell_item_crystal_spire_of_karabor : public AuraScript { - public: - spell_item_crystal_spire_of_karabor() : SpellScriptLoader("spell_item_crystal_spire_of_karabor") { } - - class spell_item_crystal_spire_of_karabor_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_crystal_spire_of_karabor_AuraScript); + PrepareAuraScript(spell_item_crystal_spire_of_karabor); - bool Validate(SpellInfo const* spellInfo) override - { - return spellInfo->GetEffect(EFFECT_0) != nullptr; - } - - bool CheckProc(ProcEventInfo& eventInfo) - { - int32 pct = GetSpellInfo()->GetEffect(EFFECT_0)->CalcValue(); - if (HealInfo* healInfo = eventInfo.GetHealInfo()) - if (Unit* healTarget = healInfo->GetTarget()) - if (healTarget->GetHealth() - healInfo->GetEffectiveHeal() <= healTarget->CountPctFromMaxHealth(pct)) - return true; + bool Validate(SpellInfo const* spellInfo) override + { + return spellInfo->GetEffect(EFFECT_0) != nullptr; + } - return false; - } + bool CheckProc(ProcEventInfo& eventInfo) + { + int32 pct = GetSpellInfo()->GetEffect(EFFECT_0)->CalcValue(); + if (HealInfo* healInfo = eventInfo.GetHealInfo()) + if (Unit* healTarget = healInfo->GetTarget()) + if (healTarget->GetHealth() - healInfo->GetEffectiveHeal() <= healTarget->CountPctFromMaxHealth(pct)) + return true; - void Register() override - { - DoCheckProc += AuraCheckProcFn(spell_item_crystal_spire_of_karabor_AuraScript::CheckProc); - } - }; + return false; + } - AuraScript* GetAuraScript() const override - { - return new spell_item_crystal_spire_of_karabor_AuraScript(); - } + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_item_crystal_spire_of_karabor::CheckProc); + } }; // http://www.wowhead.com/item=27388 Mr. Pinchy @@ -1267,56 +1061,45 @@ enum MakeAWish SPELL_MR_PINCHYS_GIFT = 33064, }; -class spell_item_make_a_wish : public SpellScriptLoader +class spell_item_make_a_wish : public SpellScript { - public: - spell_item_make_a_wish() : SpellScriptLoader("spell_item_make_a_wish") { } - - class spell_item_make_a_wish_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_make_a_wish_SpellScript); - - bool Load() override - { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo( - { - SPELL_MR_PINCHYS_BLESSING, - SPELL_SUMMON_MIGHTY_MR_PINCHY, - SPELL_SUMMON_FURIOUS_MR_PINCHY, - SPELL_TINY_MAGICAL_CRAWDAD, - SPELL_MR_PINCHYS_GIFT - }); - } + PrepareSpellScript(spell_item_make_a_wish); - void HandleDummy(SpellEffIndex /*effIndex*/) - { - Unit* caster = GetCaster(); - uint32 spellId = SPELL_MR_PINCHYS_GIFT; - switch (urand(1, 5)) - { - case 1: spellId = SPELL_MR_PINCHYS_BLESSING; break; - case 2: spellId = SPELL_SUMMON_MIGHTY_MR_PINCHY; break; - case 3: spellId = SPELL_SUMMON_FURIOUS_MR_PINCHY; break; - case 4: spellId = SPELL_TINY_MAGICAL_CRAWDAD; break; - } - caster->CastSpell(caster, spellId, true, nullptr); - } + bool Load() override + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } - void Register() override - { - OnEffectHit += SpellEffectFn(spell_item_make_a_wish_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( + { + SPELL_MR_PINCHYS_BLESSING, + SPELL_SUMMON_MIGHTY_MR_PINCHY, + SPELL_SUMMON_FURIOUS_MR_PINCHY, + SPELL_TINY_MAGICAL_CRAWDAD, + SPELL_MR_PINCHYS_GIFT + }); + } - SpellScript* GetSpellScript() const override - { - return new spell_item_make_a_wish_SpellScript(); + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + uint32 spellId = SPELL_MR_PINCHYS_GIFT; + switch (urand(1, 5)) + { + case 1: spellId = SPELL_MR_PINCHYS_BLESSING; break; + case 2: spellId = SPELL_SUMMON_MIGHTY_MR_PINCHY; break; + case 3: spellId = SPELL_SUMMON_FURIOUS_MR_PINCHY; break; + case 4: spellId = SPELL_TINY_MAGICAL_CRAWDAD; break; } + caster->CastSpell(caster, spellId, true, nullptr); + } + + void Register() override + { + OnEffectHit += SpellEffectFn(spell_item_make_a_wish::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; enum MarkOfConquest @@ -1327,97 +1110,75 @@ enum MarkOfConquest // Item - 27920: Mark of Conquest // Item - 27921: Mark of Conquest // 33510 - Health Restore -class spell_item_mark_of_conquest : public SpellScriptLoader +class spell_item_mark_of_conquest : public AuraScript { - public: - spell_item_mark_of_conquest() : SpellScriptLoader("spell_item_mark_of_conquest") { } - - class spell_item_mark_of_conquest_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_mark_of_conquest_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_MARK_OF_CONQUEST_ENERGIZE }); - } - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - if (eventInfo.GetTypeMask() & (PROC_FLAG_DONE_RANGED_AUTO_ATTACK | PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS)) - { - // in that case, do not cast heal spell - PreventDefaultAction(); - // but mana instead - eventInfo.GetActor()->CastSpell(nullptr, SPELL_MARK_OF_CONQUEST_ENERGIZE, true, nullptr, aurEff); - } - } + PrepareAuraScript(spell_item_mark_of_conquest); - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_item_mark_of_conquest_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); - } - }; + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_MARK_OF_CONQUEST_ENERGIZE }); + } - AuraScript* GetAuraScript() const override + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + if (eventInfo.GetTypeMask() & (PROC_FLAG_DONE_RANGED_AUTO_ATTACK | PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS)) { - return new spell_item_mark_of_conquest_AuraScript(); + // in that case, do not cast heal spell + PreventDefaultAction(); + // but mana instead + eventInfo.GetActor()->CastSpell(nullptr, SPELL_MARK_OF_CONQUEST_ENERGIZE, true, nullptr, aurEff); } + } + + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_item_mark_of_conquest::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } }; // http://www.wowhead.com/item=32686 Mingo's Fortune Giblets // 40802 Mingo's Fortune Generator -class spell_item_mingos_fortune_generator : public SpellScriptLoader +class spell_item_mingos_fortune_generator : public SpellScript { - public: - spell_item_mingos_fortune_generator() : SpellScriptLoader("spell_item_mingos_fortune_generator") { } - - class spell_item_mingos_fortune_generator_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_mingos_fortune_generator_SpellScript); - - void HandleDummy(SpellEffIndex effIndex) - { - // Selecting one from Bloodstained Fortune item - uint32 newitemid; - switch (urand(1, 20)) - { - case 1: newitemid = 32688; break; - case 2: newitemid = 32689; break; - case 3: newitemid = 32690; break; - case 4: newitemid = 32691; break; - case 5: newitemid = 32692; break; - case 6: newitemid = 32693; break; - case 7: newitemid = 32700; break; - case 8: newitemid = 32701; break; - case 9: newitemid = 32702; break; - case 10: newitemid = 32703; break; - case 11: newitemid = 32704; break; - case 12: newitemid = 32705; break; - case 13: newitemid = 32706; break; - case 14: newitemid = 32707; break; - case 15: newitemid = 32708; break; - case 16: newitemid = 32709; break; - case 17: newitemid = 32710; break; - case 18: newitemid = 32711; break; - case 19: newitemid = 32712; break; - case 20: newitemid = 32713; break; - default: - return; - } + PrepareSpellScript(spell_item_mingos_fortune_generator); - CreateItem(effIndex, newitemid, ItemContext::NONE); - } + void HandleDummy(SpellEffIndex effIndex) + { + // Selecting one from Bloodstained Fortune item + uint32 newitemid; + switch (urand(1, 20)) + { + case 1: newitemid = 32688; break; + case 2: newitemid = 32689; break; + case 3: newitemid = 32690; break; + case 4: newitemid = 32691; break; + case 5: newitemid = 32692; break; + case 6: newitemid = 32693; break; + case 7: newitemid = 32700; break; + case 8: newitemid = 32701; break; + case 9: newitemid = 32702; break; + case 10: newitemid = 32703; break; + case 11: newitemid = 32704; break; + case 12: newitemid = 32705; break; + case 13: newitemid = 32706; break; + case 14: newitemid = 32707; break; + case 15: newitemid = 32708; break; + case 16: newitemid = 32709; break; + case 17: newitemid = 32710; break; + case 18: newitemid = 32711; break; + case 19: newitemid = 32712; break; + case 20: newitemid = 32713; break; + default: + return; + } - void Register() override - { - OnEffectHit += SpellEffectFn(spell_item_mingos_fortune_generator_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + CreateItem(effIndex, newitemid, ItemContext::NONE); + } - SpellScript* GetSpellScript() const override - { - return new spell_item_mingos_fortune_generator_SpellScript(); - } + void Register() override + { + OnEffectHit += SpellEffectFn(spell_item_mingos_fortune_generator::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; // 71875, 71877 - Item - Black Bruise: Necrotic Touch Proc @@ -1426,47 +1187,36 @@ enum NecroticTouch SPELL_ITEM_NECROTIC_TOUCH_PROC = 71879 }; -class spell_item_necrotic_touch : public SpellScriptLoader +class spell_item_necrotic_touch : public AuraScript { - public: - spell_item_necrotic_touch() : SpellScriptLoader("spell_item_necrotic_touch") { } - - class spell_item_necrotic_touch_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_necrotic_touch_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_ITEM_NECROTIC_TOUCH_PROC }); - } + PrepareAuraScript(spell_item_necrotic_touch); - bool CheckProc(ProcEventInfo& eventInfo) - { - return eventInfo.GetProcTarget() && eventInfo.GetProcTarget()->IsAlive(); - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_ITEM_NECROTIC_TOUCH_PROC }); + } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - DamageInfo* damageInfo = eventInfo.GetDamageInfo(); - if (!damageInfo || !damageInfo->GetDamage()) - return; + bool CheckProc(ProcEventInfo& eventInfo) + { + return eventInfo.GetProcTarget() && eventInfo.GetProcTarget()->IsAlive(); + } - int32 bp = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount()); - GetTarget()->CastCustomSpell(SPELL_ITEM_NECROTIC_TOUCH_PROC, SPELLVALUE_BASE_POINT0, bp, eventInfo.GetProcTarget(), true, nullptr, aurEff); - } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + if (!damageInfo || !damageInfo->GetDamage()) + return; - void Register() override - { - DoCheckProc += AuraCheckProcFn(spell_item_necrotic_touch_AuraScript::CheckProc); - OnEffectProc += AuraEffectProcFn(spell_item_necrotic_touch_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + int32 bp = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount()); + GetTarget()->CastCustomSpell(SPELL_ITEM_NECROTIC_TOUCH_PROC, SPELLVALUE_BASE_POINT0, bp, eventInfo.GetProcTarget(), true, nullptr, aurEff); + } - AuraScript* GetAuraScript() const override - { - return new spell_item_necrotic_touch_AuraScript(); - } + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_item_necrotic_touch::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_item_necrotic_touch::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; // http://www.wowhead.com/item=10720 Gnomish Net-o-Matic Projector @@ -1478,50 +1228,39 @@ enum NetOMaticSpells SPELL_NET_O_MATIC_TRIGGERED3 = 13099, }; -class spell_item_net_o_matic : public SpellScriptLoader +class spell_item_net_o_matic : public SpellScript { - public: - spell_item_net_o_matic() : SpellScriptLoader("spell_item_net_o_matic") { } + PrepareSpellScript(spell_item_net_o_matic); - class spell_item_net_o_matic_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( { - PrepareSpellScript(spell_item_net_o_matic_SpellScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo( - { - SPELL_NET_O_MATIC_TRIGGERED1, - SPELL_NET_O_MATIC_TRIGGERED2, - SPELL_NET_O_MATIC_TRIGGERED3 - }); - } - - void HandleDummy(SpellEffIndex /*effIndex*/) - { - if (Unit* target = GetHitUnit()) - { - uint32 spellId = SPELL_NET_O_MATIC_TRIGGERED3; - uint32 roll = urand(0, 99); - if (roll < 2) // 2% for 30 sec self root (off-like chance unknown) - spellId = SPELL_NET_O_MATIC_TRIGGERED1; - else if (roll < 4) // 2% for 20 sec root, charge to target (off-like chance unknown) - spellId = SPELL_NET_O_MATIC_TRIGGERED2; - - GetCaster()->CastSpell(target, spellId, true, nullptr); - } - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_net_o_matic_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + SPELL_NET_O_MATIC_TRIGGERED1, + SPELL_NET_O_MATIC_TRIGGERED2, + SPELL_NET_O_MATIC_TRIGGERED3 + }); + } - SpellScript* GetSpellScript() const override + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) { - return new spell_item_net_o_matic_SpellScript(); + uint32 spellId = SPELL_NET_O_MATIC_TRIGGERED3; + uint32 roll = urand(0, 99); + if (roll < 2) // 2% for 30 sec self root (off-like chance unknown) + spellId = SPELL_NET_O_MATIC_TRIGGERED1; + else if (roll < 4) // 2% for 20 sec root, charge to target (off-like chance unknown) + spellId = SPELL_NET_O_MATIC_TRIGGERED2; + + GetCaster()->CastSpell(target, spellId, true, nullptr); } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_net_o_matic::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; // http://www.wowhead.com/item=8529 Noggenfogger Elixir @@ -1533,88 +1272,66 @@ enum NoggenfoggerElixirSpells SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED3 = 16591, }; -class spell_item_noggenfogger_elixir : public SpellScriptLoader +class spell_item_noggenfogger_elixir : public SpellScript { - public: - spell_item_noggenfogger_elixir() : SpellScriptLoader("spell_item_noggenfogger_elixir") { } - - class spell_item_noggenfogger_elixir_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_noggenfogger_elixir_SpellScript); - - bool Load() override - { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo( - { - SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED1, - SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED2, - SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED3 - }); - } - - void HandleDummy(SpellEffIndex /*effIndex*/) - { - Unit* caster = GetCaster(); - uint32 spellId = SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED3; - switch (urand(1, 3)) - { - case 1: spellId = SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED1; break; - case 2: spellId = SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED2; break; - } + PrepareSpellScript(spell_item_noggenfogger_elixir); - caster->CastSpell(caster, spellId, true, nullptr); - } + bool Load() override + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } - void Register() override - { - OnEffectHit += SpellEffectFn(spell_item_noggenfogger_elixir_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( + { + SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED1, + SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED2, + SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED3 + }); + } - SpellScript* GetSpellScript() const override + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + uint32 spellId = SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED3; + switch (urand(1, 3)) { - return new spell_item_noggenfogger_elixir_SpellScript(); + case 1: spellId = SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED1; break; + case 2: spellId = SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED2; break; } + + caster->CastSpell(caster, spellId, true, nullptr); + } + + void Register() override + { + OnEffectHit += SpellEffectFn(spell_item_noggenfogger_elixir::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; // 29601 - Enlightenment (Pendant of the Violet Eye) -class spell_item_pendant_of_the_violet_eye : public SpellScriptLoader +class spell_item_pendant_of_the_violet_eye : public AuraScript { - public: - spell_item_pendant_of_the_violet_eye() : SpellScriptLoader("spell_item_pendant_of_the_violet_eye") { } + PrepareAuraScript(spell_item_pendant_of_the_violet_eye); - class spell_item_pendant_of_the_violet_eye_AuraScript : public AuraScript + bool CheckProc(ProcEventInfo& eventInfo) + { + if (Spell const* spell = eventInfo.GetProcSpell()) { - PrepareAuraScript(spell_item_pendant_of_the_violet_eye_AuraScript); - - bool CheckProc(ProcEventInfo& eventInfo) - { - if (Spell const* spell = eventInfo.GetProcSpell()) - { - std::vector<SpellPowerCost> const& costs = spell->GetPowerCost(); - auto m = std::find_if(costs.begin(), costs.end(), [](SpellPowerCost const& cost) { return cost.Power == POWER_MANA && cost.Amount > 0; }); - if (m != costs.end()) - return true; - } - - return false; - } + std::vector<SpellPowerCost> const& costs = spell->GetPowerCost(); + auto m = std::find_if(costs.begin(), costs.end(), [](SpellPowerCost const& cost) { return cost.Power == POWER_MANA && cost.Amount > 0; }); + if (m != costs.end()) + return true; + } - void Register() override - { - DoCheckProc += AuraCheckProcFn(spell_item_pendant_of_the_violet_eye_AuraScript::CheckProc); - } - }; + return false; + } - AuraScript* GetAuraScript() const override - { - return new spell_item_pendant_of_the_violet_eye_AuraScript(); - } + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_item_pendant_of_the_violet_eye::CheckProc); + } }; enum PersistentShieldMisc @@ -1623,50 +1340,39 @@ enum PersistentShieldMisc }; // 26467 - Persistent Shield -class spell_item_persistent_shield : public SpellScriptLoader +class spell_item_persistent_shield : public AuraScript { - public: - spell_item_persistent_shield() : SpellScriptLoader("spell_item_persistent_shield") { } - - class spell_item_persistent_shield_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_persistent_shield_AuraScript); + PrepareAuraScript(spell_item_persistent_shield); - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_PERSISTENT_SHIELD_TRIGGERED }); - } - - bool CheckProc(ProcEventInfo& eventInfo) - { - return eventInfo.GetHealInfo() && eventInfo.GetHealInfo()->GetHeal(); - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PERSISTENT_SHIELD_TRIGGERED }); + } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); - int32 bp0 = CalculatePct(eventInfo.GetHealInfo()->GetHeal(), 15); + bool CheckProc(ProcEventInfo& eventInfo) + { + return eventInfo.GetHealInfo() && eventInfo.GetHealInfo()->GetHeal(); + } - // Scarab Brooch does not replace stronger shields - if (AuraEffect const* shield = target->GetAuraEffect(SPELL_PERSISTENT_SHIELD_TRIGGERED, EFFECT_0, caster->GetGUID())) - if (shield->GetAmount() > bp0) - return; + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + Unit* caster = eventInfo.GetActor(); + Unit* target = eventInfo.GetProcTarget(); + int32 bp0 = CalculatePct(eventInfo.GetHealInfo()->GetHeal(), 15); - caster->CastCustomSpell(SPELL_PERSISTENT_SHIELD_TRIGGERED, SPELLVALUE_BASE_POINT0, bp0, target, true, nullptr, aurEff); - } + // Scarab Brooch does not replace stronger shields + if (AuraEffect const* shield = target->GetAuraEffect(SPELL_PERSISTENT_SHIELD_TRIGGERED, EFFECT_0, caster->GetGUID())) + if (shield->GetAmount() > bp0) + return; - void Register() override - { - DoCheckProc += AuraCheckProcFn(spell_item_persistent_shield_AuraScript::CheckProc); - OnEffectProc += AuraEffectProcFn(spell_item_persistent_shield_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); - } - }; + caster->CastCustomSpell(SPELL_PERSISTENT_SHIELD_TRIGGERED, SPELLVALUE_BASE_POINT0, bp0, target, true, nullptr, aurEff); + } - AuraScript* GetAuraScript() const override - { - return new spell_item_persistent_shield_AuraScript(); - } + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_item_persistent_shield::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_item_persistent_shield::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } }; enum PetHealing @@ -1677,71 +1383,49 @@ enum PetHealing // 37381 - Pet Healing // Hunter T5 2P Bonus // Warlock T5 2P Bonus -class spell_item_pet_healing : public SpellScriptLoader +class spell_item_pet_healing : public AuraScript { - public: - spell_item_pet_healing() : SpellScriptLoader("spell_item_pet_healing") { } + PrepareAuraScript(spell_item_pet_healing); - class spell_item_pet_healing_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_pet_healing_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_HEALTH_LINK }); - } - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - DamageInfo* damageInfo = eventInfo.GetDamageInfo(); - if (!damageInfo || !damageInfo->GetDamage()) - return; - - int32 bp = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount()); - Unit* caster = eventInfo.GetActor(); - caster->CastCustomSpell(SPELL_HEALTH_LINK, SPELLVALUE_BASE_POINT0, bp, nullptr, true, nullptr, aurEff); - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_HEALTH_LINK }); + } - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_item_pet_healing_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + if (!damageInfo || !damageInfo->GetDamage()) + return; + + int32 bp = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount()); + Unit* caster = eventInfo.GetActor(); + caster->CastCustomSpell(SPELL_HEALTH_LINK, SPELLVALUE_BASE_POINT0, bp, nullptr, true, nullptr, aurEff); + } - AuraScript* GetAuraScript() const override - { - return new spell_item_pet_healing_AuraScript(); - } + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_item_pet_healing::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; // 17512 - Piccolo of the Flaming Fire -class spell_item_piccolo_of_the_flaming_fire : public SpellScriptLoader +class spell_item_piccolo_of_the_flaming_fire : public SpellScript { - public: - spell_item_piccolo_of_the_flaming_fire() : SpellScriptLoader("spell_item_piccolo_of_the_flaming_fire") { } + PrepareSpellScript(spell_item_piccolo_of_the_flaming_fire); - class spell_item_piccolo_of_the_flaming_fire_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_piccolo_of_the_flaming_fire_SpellScript); - - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Player* target = GetHitPlayer()) - target->HandleEmoteCommand(EMOTE_STATE_DANCE); - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_piccolo_of_the_flaming_fire_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Player* target = GetHitPlayer()) + target->HandleEmoteCommand(EMOTE_STATE_DANCE); + } - SpellScript* GetSpellScript() const override - { - return new spell_item_piccolo_of_the_flaming_fire_SpellScript(); - } + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_piccolo_of_the_flaming_fire::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } }; // http://www.wowhead.com/item=6657 Savory Deviate Delight @@ -1754,49 +1438,44 @@ enum SavoryDeviateDelight SPELL_YAAARRRR_FEMALE = 8222, }; -class spell_item_savory_deviate_delight : public SpellScriptLoader +class spell_item_savory_deviate_delight : public SpellScript { - public: - spell_item_savory_deviate_delight() : SpellScriptLoader("spell_item_savory_deviate_delight") { } - - class spell_item_savory_deviate_delight_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_savory_deviate_delight_SpellScript); - - bool Load() override - { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_FLIP_OUT_MALE, SPELL_FLIP_OUT_FEMALE, SPELL_YAAARRRR_MALE, SPELL_YAAARRRR_FEMALE }); - } + PrepareSpellScript(spell_item_savory_deviate_delight); - void HandleDummy(SpellEffIndex /*effIndex*/) - { - Unit* caster = GetCaster(); - uint32 spellId = 0; - switch (urand(1, 2)) - { - // Flip Out - ninja - case 1: spellId = (caster->getGender() == GENDER_MALE ? SPELL_FLIP_OUT_MALE : SPELL_FLIP_OUT_FEMALE); break; - // Yaaarrrr - pirate - case 2: spellId = (caster->getGender() == GENDER_MALE ? SPELL_YAAARRRR_MALE : SPELL_YAAARRRR_FEMALE); break; - } - caster->CastSpell(caster, spellId, true, nullptr); - } - - void Register() override - { - OnEffectHit += SpellEffectFn(spell_item_savory_deviate_delight_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + bool Load() override + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } - SpellScript* GetSpellScript() const override + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( { - return new spell_item_savory_deviate_delight_SpellScript(); + SPELL_FLIP_OUT_MALE, + SPELL_FLIP_OUT_FEMALE, + SPELL_YAAARRRR_MALE, + SPELL_YAAARRRR_FEMALE + }); + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + uint32 spellId = 0; + switch (urand(1, 2)) + { + // Flip Out - ninja + case 1: spellId = (caster->getGender() == GENDER_MALE ? SPELL_FLIP_OUT_MALE : SPELL_FLIP_OUT_FEMALE); break; + // Yaaarrrr - pirate + case 2: spellId = (caster->getGender() == GENDER_MALE ? SPELL_YAAARRRR_MALE : SPELL_YAAARRRR_FEMALE); break; } + caster->CastSpell(caster, spellId, true, nullptr); + } + + void Register() override + { + OnEffectHit += SpellEffectFn(spell_item_savory_deviate_delight::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; // 48129 - Scroll of Recall @@ -1812,64 +1491,53 @@ enum ScrollOfRecall SPELL_SCROLL_OF_RECALL_FAIL_HORDE_1 = 60328, }; -class spell_item_scroll_of_recall : public SpellScriptLoader +class spell_item_scroll_of_recall : public SpellScript { - public: - spell_item_scroll_of_recall() : SpellScriptLoader("spell_item_scroll_of_recall") { } - - class spell_item_scroll_of_recall_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_scroll_of_recall_SpellScript); - - bool Load() override - { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } - - void HandleScript(SpellEffIndex effIndex) - { - Unit* caster = GetCaster(); - uint8 maxSafeLevel = 0; - switch (GetSpellInfo()->Id) - { - case SPELL_SCROLL_OF_RECALL_I: // Scroll of Recall - maxSafeLevel = 40; - break; - case SPELL_SCROLL_OF_RECALL_II: // Scroll of Recall II - maxSafeLevel = 70; - break; - case SPELL_SCROLL_OF_RECALL_III: // Scroll of Recal III - maxSafeLevel = 80; - break; - default: - break; - } + PrepareSpellScript(spell_item_scroll_of_recall); - if (caster->getLevel() > maxSafeLevel) - { - caster->CastSpell(caster, SPELL_LOST, true); + bool Load() override + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } - // ALLIANCE from 60323 to 60330 - HORDE from 60328 to 60335 - uint32 spellId = SPELL_SCROLL_OF_RECALL_FAIL_ALLIANCE_1; - if (GetCaster()->ToPlayer()->GetTeam() == HORDE) - spellId = SPELL_SCROLL_OF_RECALL_FAIL_HORDE_1; + void HandleScript(SpellEffIndex effIndex) + { + Unit* caster = GetCaster(); + uint8 maxSafeLevel = 0; + switch (GetSpellInfo()->Id) + { + case SPELL_SCROLL_OF_RECALL_I: // Scroll of Recall + maxSafeLevel = 40; + break; + case SPELL_SCROLL_OF_RECALL_II: // Scroll of Recall II + maxSafeLevel = 70; + break; + case SPELL_SCROLL_OF_RECALL_III: // Scroll of Recal III + maxSafeLevel = 80; + break; + default: + break; + } - GetCaster()->CastSpell(GetCaster(), spellId + urand(0, 7), true); + if (caster->getLevel() > maxSafeLevel) + { + caster->CastSpell(caster, SPELL_LOST, true); - PreventHitDefaultEffect(effIndex); - } - } + // ALLIANCE from 60323 to 60330 - HORDE from 60328 to 60335 + uint32 spellId = SPELL_SCROLL_OF_RECALL_FAIL_ALLIANCE_1; + if (GetCaster()->ToPlayer()->GetTeam() == HORDE) + spellId = SPELL_SCROLL_OF_RECALL_FAIL_HORDE_1; - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_scroll_of_recall_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_TELEPORT_UNITS); - } - }; + GetCaster()->CastSpell(GetCaster(), spellId + urand(0, 7), true); - SpellScript* GetSpellScript() const override - { - return new spell_item_scroll_of_recall_SpellScript(); + PreventHitDefaultEffect(effIndex); } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_scroll_of_recall::HandleScript, EFFECT_0, SPELL_EFFECT_TELEPORT_UNITS); + } }; // 71169 - Shadow's Fate (Shadowmourne questline) @@ -1879,71 +1547,49 @@ enum ShadowsFate NPC_SINDRAGOSA = 36853 }; -class spell_item_unsated_craving : public SpellScriptLoader +class spell_item_unsated_craving : public AuraScript { - public: - spell_item_unsated_craving() : SpellScriptLoader("spell_item_unsated_craving") { } + PrepareAuraScript(spell_item_unsated_craving); - class spell_item_unsated_craving_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_unsated_craving_AuraScript); - - bool CheckProc(ProcEventInfo& procInfo) - { - Unit* caster = procInfo.GetActor(); - if (!caster || caster->GetTypeId() != TYPEID_PLAYER) - return false; + bool CheckProc(ProcEventInfo& procInfo) + { + Unit* caster = procInfo.GetActor(); + if (!caster || caster->GetTypeId() != TYPEID_PLAYER) + return false; - Unit* target = procInfo.GetActionTarget(); - if (!target || target->GetTypeId() != TYPEID_UNIT || target->IsCritter() || (target->GetEntry() != NPC_SINDRAGOSA && target->IsSummon())) - return false; + Unit* target = procInfo.GetActionTarget(); + if (!target || target->GetTypeId() != TYPEID_UNIT || target->IsCritter() || (target->GetEntry() != NPC_SINDRAGOSA && target->IsSummon())) + return false; - return true; - } - - void Register() override - { - DoCheckProc += AuraCheckProcFn(spell_item_unsated_craving_AuraScript::CheckProc); - } - }; + return true; + } - AuraScript* GetAuraScript() const override - { - return new spell_item_unsated_craving_AuraScript(); - } + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_item_unsated_craving::CheckProc); + } }; -class spell_item_shadows_fate : public SpellScriptLoader +class spell_item_shadows_fate : public AuraScript { - public: - spell_item_shadows_fate() : SpellScriptLoader("spell_item_shadows_fate") { } + PrepareAuraScript(spell_item_shadows_fate); - class spell_item_shadows_fate_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_shadows_fate_AuraScript); - - void HandleProc(ProcEventInfo& procInfo) - { - PreventDefaultAction(); + void HandleProc(ProcEventInfo& procInfo) + { + PreventDefaultAction(); - Unit* caster = procInfo.GetActor(); - Unit* target = GetCaster(); - if (!caster || !target) - return; + Unit* caster = procInfo.GetActor(); + Unit* target = GetCaster(); + if (!caster || !target) + return; - caster->CastSpell(target, SPELL_SOUL_FEAST, TRIGGERED_FULL_MASK); - } - - void Register() override - { - OnProc += AuraProcFn(spell_item_shadows_fate_AuraScript::HandleProc); - } - }; + caster->CastSpell(target, SPELL_SOUL_FEAST, TRIGGERED_FULL_MASK); + } - AuraScript* GetAuraScript() const override - { - return new spell_item_shadows_fate_AuraScript(); - } + void Register() override + { + OnProc += AuraProcFn(spell_item_shadows_fate::HandleProc); + } }; enum Shadowmourne @@ -1956,120 +1602,98 @@ enum Shadowmourne }; // 71903 - Item - Shadowmourne Legendary -class spell_item_shadowmourne : public SpellScriptLoader +class spell_item_shadowmourne : public AuraScript { - public: - spell_item_shadowmourne() : SpellScriptLoader("spell_item_shadowmourne") { } + PrepareAuraScript(spell_item_shadowmourne); - class spell_item_shadowmourne_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( { - PrepareAuraScript(spell_item_shadowmourne_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo( - { - SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE, - SPELL_SHADOWMOURNE_SOUL_FRAGMENT, - SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF - }); - } - - bool CheckProc(ProcEventInfo& eventInfo) - { - if (GetTarget()->HasAura(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF)) // cant collect shards while under effect of Chaos Bane buff - return false; - return eventInfo.GetProcTarget() && eventInfo.GetProcTarget()->IsAlive(); - } + SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE, + SPELL_SHADOWMOURNE_SOUL_FRAGMENT, + SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF + }); + } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - GetTarget()->CastSpell(GetTarget(), SPELL_SHADOWMOURNE_SOUL_FRAGMENT, true, nullptr, aurEff); + bool CheckProc(ProcEventInfo& eventInfo) + { + if (GetTarget()->HasAura(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF)) // cant collect shards while under effect of Chaos Bane buff + return false; + return eventInfo.GetProcTarget() && eventInfo.GetProcTarget()->IsAlive(); + } - // this can't be handled in AuraScript of SoulFragments because we need to know victim - if (Aura* soulFragments = GetTarget()->GetAura(SPELL_SHADOWMOURNE_SOUL_FRAGMENT)) - { - if (soulFragments->GetStackAmount() >= 10) - { - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE, true, nullptr, aurEff); - soulFragments->Remove(); - } - } - } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + GetTarget()->CastSpell(GetTarget(), SPELL_SHADOWMOURNE_SOUL_FRAGMENT, true, nullptr, aurEff); - void Register() override + // this can't be handled in AuraScript of SoulFragments because we need to know victim + if (Aura* soulFragments = GetTarget()->GetAura(SPELL_SHADOWMOURNE_SOUL_FRAGMENT)) + { + if (soulFragments->GetStackAmount() >= 10) { - DoCheckProc += AuraCheckProcFn(spell_item_shadowmourne_AuraScript::CheckProc); - OnEffectProc += AuraEffectProcFn(spell_item_shadowmourne_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE, true, nullptr, aurEff); + soulFragments->Remove(); } - }; - - AuraScript* GetAuraScript() const override - { - return new spell_item_shadowmourne_AuraScript(); } + } + + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_item_shadowmourne::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_item_shadowmourne::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; // 71905 - Soul Fragment -class spell_item_shadowmourne_soul_fragment : public SpellScriptLoader +class spell_item_shadowmourne_soul_fragment : public AuraScript { - public: - spell_item_shadowmourne_soul_fragment() : SpellScriptLoader("spell_item_shadowmourne_soul_fragment") { } + PrepareAuraScript(spell_item_shadowmourne_soul_fragment); - class spell_item_shadowmourne_soul_fragment_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( { - PrepareAuraScript(spell_item_shadowmourne_soul_fragment_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo( - { - SPELL_SHADOWMOURNE_VISUAL_LOW, - SPELL_SHADOWMOURNE_VISUAL_HIGH, - SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF - }); - } - - void OnStackChange(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Unit* target = GetTarget(); - switch (GetStackAmount()) - { - case 1: - target->CastSpell(target, SPELL_SHADOWMOURNE_VISUAL_LOW, true); - break; - case 6: - target->RemoveAurasDueToSpell(SPELL_SHADOWMOURNE_VISUAL_LOW); - target->CastSpell(target, SPELL_SHADOWMOURNE_VISUAL_HIGH, true); - break; - case 10: - target->RemoveAurasDueToSpell(SPELL_SHADOWMOURNE_VISUAL_HIGH); - target->CastSpell(target, SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF, true); - break; - default: - break; - } - } + SPELL_SHADOWMOURNE_VISUAL_LOW, + SPELL_SHADOWMOURNE_VISUAL_HIGH, + SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF + }); + } - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Unit* target = GetTarget(); + void OnStackChange(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + switch (GetStackAmount()) + { + case 1: + target->CastSpell(target, SPELL_SHADOWMOURNE_VISUAL_LOW, true); + break; + case 6: target->RemoveAurasDueToSpell(SPELL_SHADOWMOURNE_VISUAL_LOW); + target->CastSpell(target, SPELL_SHADOWMOURNE_VISUAL_HIGH, true); + break; + case 10: target->RemoveAurasDueToSpell(SPELL_SHADOWMOURNE_VISUAL_HIGH); - } + target->CastSpell(target, SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF, true); + break; + default: + break; + } + } - void Register() override - { - AfterEffectApply += AuraEffectApplyFn(spell_item_shadowmourne_soul_fragment_AuraScript::OnStackChange, EFFECT_0, SPELL_AURA_MOD_STAT, AuraEffectHandleModes(AURA_EFFECT_HANDLE_REAL | AURA_EFFECT_HANDLE_REAPPLY)); - AfterEffectRemove += AuraEffectRemoveFn(spell_item_shadowmourne_soul_fragment_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_REAL); - } - }; + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + target->RemoveAurasDueToSpell(SPELL_SHADOWMOURNE_VISUAL_LOW); + target->RemoveAurasDueToSpell(SPELL_SHADOWMOURNE_VISUAL_HIGH); + } - AuraScript* GetAuraScript() const override - { - return new spell_item_shadowmourne_soul_fragment_AuraScript(); - } + void Register() override + { + AfterEffectApply += AuraEffectApplyFn(spell_item_shadowmourne_soul_fragment::OnStackChange, EFFECT_0, SPELL_AURA_MOD_STAT, AuraEffectHandleModes(AURA_EFFECT_HANDLE_REAL | AURA_EFFECT_HANDLE_REAPPLY)); + AfterEffectRemove += AuraEffectRemoveFn(spell_item_shadowmourne_soul_fragment::OnRemove, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_REAL); + } }; // http://www.wowhead.com/item=7734 Six Demon Bag @@ -2084,69 +1708,58 @@ enum SixDemonBagSpells SPELL_ENVELOPING_WINDS = 25189, }; -class spell_item_six_demon_bag : public SpellScriptLoader +class spell_item_six_demon_bag : public SpellScript { - public: - spell_item_six_demon_bag() : SpellScriptLoader("spell_item_six_demon_bag") { } - - class spell_item_six_demon_bag_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_six_demon_bag_SpellScript); + PrepareSpellScript(spell_item_six_demon_bag); - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo( - { - SPELL_FROSTBOLT, - SPELL_POLYMORPH, - SPELL_SUMMON_FELHOUND_MINION, - SPELL_FIREBALL, - SPELL_CHAIN_LIGHTNING, - SPELL_ENVELOPING_WINDS - }); - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( + { + SPELL_FROSTBOLT, + SPELL_POLYMORPH, + SPELL_SUMMON_FELHOUND_MINION, + SPELL_FIREBALL, + SPELL_CHAIN_LIGHTNING, + SPELL_ENVELOPING_WINDS + }); + } - void HandleDummy(SpellEffIndex /*effIndex*/) + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (Unit* target = GetHitUnit()) + { + uint32 spellId = 0; + uint32 rand = urand(0, 99); + if (rand < 25) // Fireball (25% chance) + spellId = SPELL_FIREBALL; + else if (rand < 50) // Frostball (25% chance) + spellId = SPELL_FROSTBOLT; + else if (rand < 70) // Chain Lighting (20% chance) + spellId = SPELL_CHAIN_LIGHTNING; + else if (rand < 80) // Polymorph (10% chance) { - Unit* caster = GetCaster(); - if (Unit* target = GetHitUnit()) - { - uint32 spellId = 0; - uint32 rand = urand(0, 99); - if (rand < 25) // Fireball (25% chance) - spellId = SPELL_FIREBALL; - else if (rand < 50) // Frostball (25% chance) - spellId = SPELL_FROSTBOLT; - else if (rand < 70) // Chain Lighting (20% chance) - spellId = SPELL_CHAIN_LIGHTNING; - else if (rand < 80) // Polymorph (10% chance) - { - spellId = SPELL_POLYMORPH; - if (urand(0, 100) <= 30) // 30% chance to self-cast - target = caster; - } - else if (rand < 95) // Enveloping Winds (15% chance) - spellId = SPELL_ENVELOPING_WINDS; - else // Summon Felhund minion (5% chance) - { - spellId = SPELL_SUMMON_FELHOUND_MINION; - target = caster; - } - - caster->CastSpell(target, spellId, true, GetCastItem()); - } + spellId = SPELL_POLYMORPH; + if (urand(0, 100) <= 30) // 30% chance to self-cast + target = caster; } - - void Register() override + else if (rand < 95) // Enveloping Winds (15% chance) + spellId = SPELL_ENVELOPING_WINDS; + else // Summon Felhund minion (5% chance) { - OnEffectHitTarget += SpellEffectFn(spell_item_six_demon_bag_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + spellId = SPELL_SUMMON_FELHOUND_MINION; + target = caster; } - }; - SpellScript* GetSpellScript() const override - { - return new spell_item_six_demon_bag_SpellScript(); + caster->CastSpell(target, spellId, true, GetCastItem()); } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_six_demon_bag::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; enum SwiftHandJusticeMisc @@ -2155,68 +1768,46 @@ enum SwiftHandJusticeMisc }; // 59906 - Swift Hand of Justice Dummy -class spell_item_swift_hand_justice_dummy : public SpellScriptLoader +class spell_item_swift_hand_justice_dummy : public AuraScript { - public: - spell_item_swift_hand_justice_dummy() : SpellScriptLoader("spell_item_swift_hand_justice_dummy") { } - - class spell_item_swift_hand_justice_dummy_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_swift_hand_justice_dummy_AuraScript); + PrepareAuraScript(spell_item_swift_hand_justice_dummy); - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_SWIFT_HAND_OF_JUSTICE_HEAL }); - } - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_SWIFT_HAND_OF_JUSTICE_HEAL }); + } - Unit* caster = eventInfo.GetActor(); - int32 amount = caster->CountPctFromMaxHealth(aurEff->GetAmount()); - caster->CastCustomSpell(SPELL_SWIFT_HAND_OF_JUSTICE_HEAL, SPELLVALUE_BASE_POINT0, amount, nullptr, true, nullptr, aurEff); - } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_item_swift_hand_justice_dummy_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + Unit* caster = eventInfo.GetActor(); + int32 amount = caster->CountPctFromMaxHealth(aurEff->GetAmount()); + caster->CastCustomSpell(SPELL_SWIFT_HAND_OF_JUSTICE_HEAL, SPELLVALUE_BASE_POINT0, amount, nullptr, true, nullptr, aurEff); + } - AuraScript* GetAuraScript() const override - { - return new spell_item_swift_hand_justice_dummy_AuraScript(); - } + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_item_swift_hand_justice_dummy::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; // 28862 - The Eye of Diminution -class spell_item_the_eye_of_diminution : public SpellScriptLoader +class spell_item_the_eye_of_diminution : public AuraScript { - public: - spell_item_the_eye_of_diminution() : SpellScriptLoader("spell_item_the_eye_of_diminution") { } - - class spell_item_the_eye_of_diminution_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_the_eye_of_diminution_AuraScript); + PrepareAuraScript(spell_item_the_eye_of_diminution); - void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) - { - int32 diff = GetUnitOwner()->getLevel() - 60; - if (diff > 0) - amount += diff; - } - - void Register() override - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_item_the_eye_of_diminution_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_THREAT); - } - }; + void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + int32 diff = GetUnitOwner()->getLevel() - 60; + if (diff > 0) + amount += diff; + } - AuraScript* GetAuraScript() const override - { - return new spell_item_the_eye_of_diminution_AuraScript(); - } + void Register() override + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_item_the_eye_of_diminution::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_THREAT); + } }; // http://www.wowhead.com/item=44012 Underbelly Elixir @@ -2228,51 +1819,40 @@ enum UnderbellyElixirSpells SPELL_UNDERBELLY_ELIXIR_TRIGGERED3 = 59843, }; -class spell_item_underbelly_elixir : public SpellScriptLoader +class spell_item_underbelly_elixir : public SpellScript { - public: - spell_item_underbelly_elixir() : SpellScriptLoader("spell_item_underbelly_elixir") { } + PrepareSpellScript(spell_item_underbelly_elixir); - class spell_item_underbelly_elixir_SpellScript : public SpellScript + bool Load() override + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( { - PrepareSpellScript(spell_item_underbelly_elixir_SpellScript); - - bool Load() override - { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo( - { - SPELL_UNDERBELLY_ELIXIR_TRIGGERED1, - SPELL_UNDERBELLY_ELIXIR_TRIGGERED2, - SPELL_UNDERBELLY_ELIXIR_TRIGGERED3 - }); - } - - void HandleDummy(SpellEffIndex /*effIndex*/) - { - Unit* caster = GetCaster(); - uint32 spellId = SPELL_UNDERBELLY_ELIXIR_TRIGGERED3; - switch (urand(1, 3)) - { - case 1: spellId = SPELL_UNDERBELLY_ELIXIR_TRIGGERED1; break; - case 2: spellId = SPELL_UNDERBELLY_ELIXIR_TRIGGERED2; break; - } - caster->CastSpell(caster, spellId, true, nullptr); - } - - void Register() override - { - OnEffectHit += SpellEffectFn(spell_item_underbelly_elixir_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + SPELL_UNDERBELLY_ELIXIR_TRIGGERED1, + SPELL_UNDERBELLY_ELIXIR_TRIGGERED2, + SPELL_UNDERBELLY_ELIXIR_TRIGGERED3 + }); + } - SpellScript* GetSpellScript() const override + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + uint32 spellId = SPELL_UNDERBELLY_ELIXIR_TRIGGERED3; + switch (urand(1, 3)) { - return new spell_item_underbelly_elixir_SpellScript(); + case 1: spellId = SPELL_UNDERBELLY_ELIXIR_TRIGGERED1; break; + case 2: spellId = SPELL_UNDERBELLY_ELIXIR_TRIGGERED2; break; } + caster->CastSpell(caster, spellId, true, nullptr); + } + + void Register() override + { + OnEffectHit += SpellEffectFn(spell_item_underbelly_elixir::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; enum WormholeGeneratorPandariaSpell @@ -2302,88 +1882,66 @@ uint32 const WormholeTargetLocations[] = }; // 126755 - Wormhole: Pandaria -class spell_item_wormhole_pandaria : public SpellScriptLoader +class spell_item_wormhole_pandaria : public SpellScript { - public: - spell_item_wormhole_pandaria() : SpellScriptLoader("spell_item_wormhole_pandaria") { } - - class spell_item_wormhole_pandaria_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_wormhole_pandaria_SpellScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo(WormholeTargetLocations); - } + PrepareSpellScript(spell_item_wormhole_pandaria); - void HandleTeleport(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - uint32 spellId = Trinity::Containers::SelectRandomContainerElement(WormholeTargetLocations); - GetCaster()->CastSpell(GetHitUnit(), spellId, true); - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo(WormholeTargetLocations); + } - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_wormhole_pandaria_SpellScript::HandleTeleport, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void HandleTeleport(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + uint32 spellId = Trinity::Containers::SelectRandomContainerElement(WormholeTargetLocations); + GetCaster()->CastSpell(GetHitUnit(), spellId, true); + } - SpellScript* GetSpellScript() const override - { - return new spell_item_wormhole_pandaria_SpellScript(); - } + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_wormhole_pandaria::HandleTeleport, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; // 47776 - Roll 'dem Bones -class spell_item_worn_troll_dice : public SpellScriptLoader +class spell_item_worn_troll_dice : public SpellScript { - public: - spell_item_worn_troll_dice() : SpellScriptLoader("spell_item_worn_troll_dice") { } - - class spell_item_worn_troll_dice_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_worn_troll_dice_SpellScript); - - enum - { - TEXT_WORN_TROLL_DICE = 26152 - }; + PrepareSpellScript(spell_item_worn_troll_dice); - bool Validate(SpellInfo const* /*spellInfo*/) override - { - if (!sBroadcastTextStore.LookupEntry(TEXT_WORN_TROLL_DICE)) - return false; - return true; - } + enum + { + TEXT_WORN_TROLL_DICE = 26152 + }; - bool Load() override - { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + if (!sBroadcastTextStore.LookupEntry(TEXT_WORN_TROLL_DICE)) + return false; + return true; + } - void HandleScript(SpellEffIndex /*effIndex*/) - { - GetCaster()->TextEmote(TEXT_WORN_TROLL_DICE, GetHitUnit()); + bool Load() override + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } - static uint32 const minimum = 1; - static uint32 const maximum = 6; + void HandleScript(SpellEffIndex /*effIndex*/) + { + GetCaster()->TextEmote(TEXT_WORN_TROLL_DICE, GetHitUnit()); - // roll twice - GetCaster()->ToPlayer()->DoRandomRoll(minimum, maximum); - GetCaster()->ToPlayer()->DoRandomRoll(minimum, maximum); - } + static uint32 const minimum = 1; + static uint32 const maximum = 6; - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_worn_troll_dice_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + // roll twice + GetCaster()->ToPlayer()->DoRandomRoll(minimum, maximum); + GetCaster()->ToPlayer()->DoRandomRoll(minimum, maximum); + } - SpellScript* GetSpellScript() const override - { - return new spell_item_worn_troll_dice_SpellScript(); - } + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_worn_troll_dice::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } }; enum AirRifleSpells @@ -2393,47 +1951,41 @@ enum AirRifleSpells SPELL_AIR_RIFLE_SHOOT_SELF = 65577, }; -class spell_item_red_rider_air_rifle : public SpellScriptLoader +class spell_item_red_rider_air_rifle : public SpellScript { - public: - spell_item_red_rider_air_rifle() : SpellScriptLoader("spell_item_red_rider_air_rifle") { } + PrepareSpellScript(spell_item_red_rider_air_rifle); - class spell_item_red_rider_air_rifle_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo( { - PrepareSpellScript(spell_item_red_rider_air_rifle_SpellScript); - - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_AIR_RIFLE_HOLD_VISUAL, SPELL_AIR_RIFLE_SHOOT, SPELL_AIR_RIFLE_SHOOT_SELF }); - } - - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - Unit* caster = GetCaster(); - if (Unit* target = GetHitUnit()) - { - caster->CastSpell(caster, SPELL_AIR_RIFLE_HOLD_VISUAL, true); - // needed because this spell shares GCD with its triggered spells (which must not be cast with triggered flag) - if (Player* player = caster->ToPlayer()) - player->GetSpellHistory()->CancelGlobalCooldown(GetSpellInfo()); - if (urand(0, 4)) - caster->CastSpell(target, SPELL_AIR_RIFLE_SHOOT, false); - else - caster->CastSpell(caster, SPELL_AIR_RIFLE_SHOOT_SELF, false); - } - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_red_rider_air_rifle_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + SPELL_AIR_RIFLE_HOLD_VISUAL, + SPELL_AIR_RIFLE_SHOOT, + SPELL_AIR_RIFLE_SHOOT_SELF + }); + } - SpellScript* GetSpellScript() const override - { - return new spell_item_red_rider_air_rifle_SpellScript(); + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + Unit* caster = GetCaster(); + if (Unit* target = GetHitUnit()) + { + caster->CastSpell(caster, SPELL_AIR_RIFLE_HOLD_VISUAL, true); + // needed because this spell shares GCD with its triggered spells (which must not be cast with triggered flag) + if (Player* player = caster->ToPlayer()) + player->GetSpellHistory()->CancelGlobalCooldown(GetSpellInfo()); + if (urand(0, 4)) + caster->CastSpell(target, SPELL_AIR_RIFLE_SHOOT, false); + else + caster->CastSpell(caster, SPELL_AIR_RIFLE_SHOOT_SELF, false); } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_red_rider_air_rifle::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } }; enum GenericData @@ -2456,83 +2008,61 @@ enum CreateHeartCandy ITEM_HEART_CANDY_8 = 21820, }; -class spell_item_create_heart_candy : public SpellScriptLoader +class spell_item_create_heart_candy : public SpellScript { - public: - spell_item_create_heart_candy() : SpellScriptLoader("spell_item_create_heart_candy") { } - - class spell_item_create_heart_candy_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_create_heart_candy_SpellScript); + PrepareSpellScript(spell_item_create_heart_candy); - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Player* target = GetHitPlayer()) - { - static const uint32 items[] = {ITEM_HEART_CANDY_1, ITEM_HEART_CANDY_2, ITEM_HEART_CANDY_3, ITEM_HEART_CANDY_4, ITEM_HEART_CANDY_5, ITEM_HEART_CANDY_6, ITEM_HEART_CANDY_7, ITEM_HEART_CANDY_8}; - target->AddItem(items[urand(0, 7)], 1); - } - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_create_heart_candy_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; - - SpellScript* GetSpellScript() const override + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Player* target = GetHitPlayer()) { - return new spell_item_create_heart_candy_SpellScript(); + static const uint32 items[] = {ITEM_HEART_CANDY_1, ITEM_HEART_CANDY_2, ITEM_HEART_CANDY_3, ITEM_HEART_CANDY_4, ITEM_HEART_CANDY_5, ITEM_HEART_CANDY_6, ITEM_HEART_CANDY_7, ITEM_HEART_CANDY_8}; + target->AddItem(items[urand(0, 7)], 1); } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_create_heart_candy::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } }; -class spell_item_book_of_glyph_mastery : public SpellScriptLoader +class spell_item_book_of_glyph_mastery : public SpellScript { - public: - spell_item_book_of_glyph_mastery() : SpellScriptLoader("spell_item_book_of_glyph_mastery") { } + PrepareSpellScript(spell_item_book_of_glyph_mastery); - class spell_item_book_of_glyph_mastery_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_book_of_glyph_mastery_SpellScript); - - bool Load() override - { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } - - SpellCastResult CheckRequirement() - { - if (HasDiscoveredAllSpells(GetSpellInfo()->Id, GetCaster()->ToPlayer())) - { - SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_LEARNED_EVERYTHING); - return SPELL_FAILED_CUSTOM_ERROR; - } + bool Load() override + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } - return SPELL_CAST_OK; - } + SpellCastResult CheckRequirement() + { + if (HasDiscoveredAllSpells(GetSpellInfo()->Id, GetCaster()->ToPlayer())) + { + SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_LEARNED_EVERYTHING); + return SPELL_FAILED_CUSTOM_ERROR; + } - void HandleScript(SpellEffIndex /*effIndex*/) - { - Player* caster = GetCaster()->ToPlayer(); - uint32 spellId = GetSpellInfo()->Id; + return SPELL_CAST_OK; + } - // learn random explicit discovery recipe (if any) - if (uint32 discoveredSpellId = GetExplicitDiscoverySpell(spellId, caster)) - caster->LearnSpell(discoveredSpellId, false); - } + void HandleScript(SpellEffIndex /*effIndex*/) + { + Player* caster = GetCaster()->ToPlayer(); + uint32 spellId = GetSpellInfo()->Id; - void Register() override - { - OnCheckCast += SpellCheckCastFn(spell_item_book_of_glyph_mastery_SpellScript::CheckRequirement); - OnEffectHitTarget += SpellEffectFn(spell_item_book_of_glyph_mastery_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + // learn random explicit discovery recipe (if any) + if (uint32 discoveredSpellId = GetExplicitDiscoverySpell(spellId, caster)) + caster->LearnSpell(discoveredSpellId, false); + } - SpellScript* GetSpellScript() const override - { - return new spell_item_book_of_glyph_mastery_SpellScript(); - } + void Register() override + { + OnCheckCast += SpellCheckCastFn(spell_item_book_of_glyph_mastery::CheckRequirement); + OnEffectHitTarget += SpellEffectFn(spell_item_book_of_glyph_mastery::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } }; enum GiftOfTheHarvester @@ -2541,38 +2071,27 @@ enum GiftOfTheHarvester MAX_GHOULS = 5, }; -class spell_item_gift_of_the_harvester : public SpellScriptLoader +class spell_item_gift_of_the_harvester : public SpellScript { - public: - spell_item_gift_of_the_harvester() : SpellScriptLoader("spell_item_gift_of_the_harvester") { } + PrepareSpellScript(spell_item_gift_of_the_harvester); - class spell_item_gift_of_the_harvester_SpellScript : public SpellScript + SpellCastResult CheckRequirement() + { + std::list<TempSummon*> ghouls; + GetCaster()->GetAllMinionsByEntry(ghouls, NPC_GHOUL); + if (ghouls.size() >= MAX_GHOULS) { - PrepareSpellScript(spell_item_gift_of_the_harvester_SpellScript); - - SpellCastResult CheckRequirement() - { - std::list<TempSummon*> ghouls; - GetCaster()->GetAllMinionsByEntry(ghouls, NPC_GHOUL); - if (ghouls.size() >= MAX_GHOULS) - { - SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_TOO_MANY_GHOULS); - return SPELL_FAILED_CUSTOM_ERROR; - } - - return SPELL_CAST_OK; - } + SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_TOO_MANY_GHOULS); + return SPELL_FAILED_CUSTOM_ERROR; + } - void Register() override - { - OnCheckCast += SpellCheckCastFn(spell_item_gift_of_the_harvester_SpellScript::CheckRequirement); - } - }; + return SPELL_CAST_OK; + } - SpellScript* GetSpellScript() const override - { - return new spell_item_gift_of_the_harvester_SpellScript(); - } + void Register() override + { + OnCheckCast += SpellCheckCastFn(spell_item_gift_of_the_harvester::CheckRequirement); + } }; enum Sinkholes @@ -2582,37 +2101,26 @@ enum Sinkholes NPC_NORTHWEST_SINKHOLE = 25666, }; -class spell_item_map_of_the_geyser_fields : public SpellScriptLoader +class spell_item_map_of_the_geyser_fields : public SpellScript { - public: - spell_item_map_of_the_geyser_fields() : SpellScriptLoader("spell_item_map_of_the_geyser_fields") { } - - class spell_item_map_of_the_geyser_fields_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_map_of_the_geyser_fields_SpellScript); - - SpellCastResult CheckSinkholes() - { - Unit* caster = GetCaster(); - if (caster->FindNearestCreature(NPC_SOUTH_SINKHOLE, 30.0f, true) || - caster->FindNearestCreature(NPC_NORTHEAST_SINKHOLE, 30.0f, true) || - caster->FindNearestCreature(NPC_NORTHWEST_SINKHOLE, 30.0f, true)) - return SPELL_CAST_OK; - - SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_BE_CLOSE_TO_SINKHOLE); - return SPELL_FAILED_CUSTOM_ERROR; - } + PrepareSpellScript(spell_item_map_of_the_geyser_fields); - void Register() override - { - OnCheckCast += SpellCheckCastFn(spell_item_map_of_the_geyser_fields_SpellScript::CheckSinkholes); - } - }; + SpellCastResult CheckSinkholes() + { + Unit* caster = GetCaster(); + if (caster->FindNearestCreature(NPC_SOUTH_SINKHOLE, 30.0f, true) || + caster->FindNearestCreature(NPC_NORTHEAST_SINKHOLE, 30.0f, true) || + caster->FindNearestCreature(NPC_NORTHWEST_SINKHOLE, 30.0f, true)) + return SPELL_CAST_OK; + + SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_BE_CLOSE_TO_SINKHOLE); + return SPELL_FAILED_CUSTOM_ERROR; + } - SpellScript* GetSpellScript() const override - { - return new spell_item_map_of_the_geyser_fields_SpellScript(); - } + void Register() override + { + OnCheckCast += SpellCheckCastFn(spell_item_map_of_the_geyser_fields::CheckSinkholes); + } }; enum VanquishedClutchesSpells @@ -2622,37 +2130,31 @@ enum VanquishedClutchesSpells SPELL_CORRUPTOR = 64984, }; -class spell_item_vanquished_clutches : public SpellScriptLoader +class spell_item_vanquished_clutches : public SpellScript { - public: - spell_item_vanquished_clutches() : SpellScriptLoader("spell_item_vanquished_clutches") { } + PrepareSpellScript(spell_item_vanquished_clutches); - class spell_item_vanquished_clutches_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( { - PrepareSpellScript(spell_item_vanquished_clutches_SpellScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_CRUSHER, SPELL_CONSTRICTOR, SPELL_CORRUPTOR }); - } - - void HandleDummy(SpellEffIndex /*effIndex*/) - { - uint32 spellId = RAND(SPELL_CRUSHER, SPELL_CONSTRICTOR, SPELL_CORRUPTOR); - Unit* caster = GetCaster(); - caster->CastSpell(caster, spellId, true); - } + SPELL_CRUSHER, + SPELL_CONSTRICTOR, + SPELL_CORRUPTOR + }); + } - void Register() override - { - OnEffectHit += SpellEffectFn(spell_item_vanquished_clutches_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void HandleDummy(SpellEffIndex /*effIndex*/) + { + uint32 spellId = RAND(SPELL_CRUSHER, SPELL_CONSTRICTOR, SPELL_CORRUPTOR); + Unit* caster = GetCaster(); + caster->CastSpell(caster, spellId, true); + } - SpellScript* GetSpellScript() const override - { - return new spell_item_vanquished_clutches_SpellScript(); - } + void Register() override + { + OnEffectHit += SpellEffectFn(spell_item_vanquished_clutches::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; enum AshbringerSounds @@ -2671,43 +2173,32 @@ enum AshbringerSounds SOUND_ASHBRINGER_12 = 8928, // "Kill them all!" }; -class spell_item_ashbringer : public SpellScriptLoader +class spell_item_ashbringer : public SpellScript { - public: - spell_item_ashbringer() : SpellScriptLoader("spell_item_ashbringer") { } - - class spell_item_ashbringer_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_ashbringer_SpellScript); - - bool Load() override - { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } + PrepareSpellScript(spell_item_ashbringer); - void OnDummyEffect(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); + bool Load() override + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } - Player* player = GetCaster()->ToPlayer(); - uint32 sound_id = RAND( SOUND_ASHBRINGER_1, SOUND_ASHBRINGER_2, SOUND_ASHBRINGER_3, SOUND_ASHBRINGER_4, SOUND_ASHBRINGER_5, SOUND_ASHBRINGER_6, - SOUND_ASHBRINGER_7, SOUND_ASHBRINGER_8, SOUND_ASHBRINGER_9, SOUND_ASHBRINGER_10, SOUND_ASHBRINGER_11, SOUND_ASHBRINGER_12 ); + void OnDummyEffect(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); - // Ashbringers effect (spellID 28441) retriggers every 5 seconds, with a chance of making it say one of the above 12 sounds - if (urand(0, 60) < 1) - player->PlayDirectSound(sound_id, player); - } + Player* player = GetCaster()->ToPlayer(); + uint32 sound_id = RAND( SOUND_ASHBRINGER_1, SOUND_ASHBRINGER_2, SOUND_ASHBRINGER_3, SOUND_ASHBRINGER_4, SOUND_ASHBRINGER_5, SOUND_ASHBRINGER_6, + SOUND_ASHBRINGER_7, SOUND_ASHBRINGER_8, SOUND_ASHBRINGER_9, SOUND_ASHBRINGER_10, SOUND_ASHBRINGER_11, SOUND_ASHBRINGER_12 ); - void Register() override - { - OnEffectHit += SpellEffectFn(spell_item_ashbringer_SpellScript::OnDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + // Ashbringers effect (spellID 28441) retriggers every 5 seconds, with a chance of making it say one of the above 12 sounds + if (urand(0, 60) < 1) + player->PlayDirectSound(sound_id, player); + } - SpellScript* GetSpellScript() const override - { - return new spell_item_ashbringer_SpellScript(); - } + void Register() override + { + OnEffectHit += SpellEffectFn(spell_item_ashbringer::OnDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; enum MagicEater @@ -2720,79 +2211,57 @@ enum MagicEater SPELL_WELL_FED_5 = 57291, }; -class spell_magic_eater_food : public SpellScriptLoader +class spell_magic_eater_food : public AuraScript { - public: - spell_magic_eater_food() : SpellScriptLoader("spell_magic_eater_food") { } - - class spell_magic_eater_food_AuraScript : public AuraScript - { - PrepareAuraScript(spell_magic_eater_food_AuraScript); + PrepareAuraScript(spell_magic_eater_food); - void HandleTriggerSpell(AuraEffect const* /*aurEff*/) - { - PreventDefaultAction(); - Unit* target = GetTarget(); - switch (urand(0, 5)) - { - case 0: - target->CastSpell(target, SPELL_WILD_MAGIC, true); - break; - case 1: - target->CastSpell(target, SPELL_WELL_FED_1, true); - break; - case 2: - target->CastSpell(target, SPELL_WELL_FED_2, true); - break; - case 3: - target->CastSpell(target, SPELL_WELL_FED_3, true); - break; - case 4: - target->CastSpell(target, SPELL_WELL_FED_4, true); - break; - case 5: - target->CastSpell(target, SPELL_WELL_FED_5, true); - break; - } - } - - void Register() override - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_magic_eater_food_AuraScript::HandleTriggerSpell, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; - - AuraScript* GetAuraScript() const override - { - return new spell_magic_eater_food_AuraScript(); + void HandleTriggerSpell(AuraEffect const* /*aurEff*/) + { + PreventDefaultAction(); + Unit* target = GetTarget(); + switch (urand(0, 5)) + { + case 0: + target->CastSpell(target, SPELL_WILD_MAGIC, true); + break; + case 1: + target->CastSpell(target, SPELL_WELL_FED_1, true); + break; + case 2: + target->CastSpell(target, SPELL_WELL_FED_2, true); + break; + case 3: + target->CastSpell(target, SPELL_WELL_FED_3, true); + break; + case 4: + target->CastSpell(target, SPELL_WELL_FED_4, true); + break; + case 5: + target->CastSpell(target, SPELL_WELL_FED_5, true); + break; } + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_magic_eater_food::HandleTriggerSpell, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } }; -class spell_item_shimmering_vessel : public SpellScriptLoader +class spell_item_shimmering_vessel : public SpellScript { - public: - spell_item_shimmering_vessel() : SpellScriptLoader("spell_item_shimmering_vessel") { } - - class spell_item_shimmering_vessel_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_shimmering_vessel_SpellScript); + PrepareSpellScript(spell_item_shimmering_vessel); - void HandleDummy(SpellEffIndex /* effIndex */) - { - if (Creature* target = GetHitCreature()) - target->setDeathState(JUST_RESPAWNED); - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_shimmering_vessel_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void HandleDummy(SpellEffIndex /* effIndex */) + { + if (Creature* target = GetHitCreature()) + target->setDeathState(JUST_RESPAWNED); + } - SpellScript* GetSpellScript() const override - { - return new spell_item_shimmering_vessel_SpellScript(); - } + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_shimmering_vessel::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; enum PurifyHelboarMeat @@ -2801,41 +2270,34 @@ enum PurifyHelboarMeat SPELL_SUMMON_TOXIC_HELBOAR_MEAT = 29278, }; -class spell_item_purify_helboar_meat : public SpellScriptLoader +class spell_item_purify_helboar_meat : public SpellScript { - public: - spell_item_purify_helboar_meat() : SpellScriptLoader("spell_item_purify_helboar_meat") { } + PrepareSpellScript(spell_item_purify_helboar_meat); - class spell_item_purify_helboar_meat_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_purify_helboar_meat_SpellScript); - - bool Load() override - { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } - - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_SUMMON_PURIFIED_HELBOAR_MEAT, SPELL_SUMMON_TOXIC_HELBOAR_MEAT }); - } + bool Load() override + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } - void HandleDummy(SpellEffIndex /* effIndex */) - { - Unit* caster = GetCaster(); - caster->CastSpell(caster, roll_chance_i(50) ? SPELL_SUMMON_PURIFIED_HELBOAR_MEAT : SPELL_SUMMON_TOXIC_HELBOAR_MEAT, true, nullptr); - } + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo( + { + SPELL_SUMMON_PURIFIED_HELBOAR_MEAT, + SPELL_SUMMON_TOXIC_HELBOAR_MEAT + }); + } - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_purify_helboar_meat_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* caster = GetCaster(); + caster->CastSpell(caster, roll_chance_i(50) ? SPELL_SUMMON_PURIFIED_HELBOAR_MEAT : SPELL_SUMMON_TOXIC_HELBOAR_MEAT, true, nullptr); + } - SpellScript* GetSpellScript() const override - { - return new spell_item_purify_helboar_meat_SpellScript(); - } + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_purify_helboar_meat::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; enum CrystalPrison @@ -2843,42 +2305,31 @@ enum CrystalPrison OBJECT_IMPRISONED_DOOMGUARD = 179644, }; -class spell_item_crystal_prison_dummy_dnd : public SpellScriptLoader +class spell_item_crystal_prison_dummy_dnd : public SpellScript { - public: - spell_item_crystal_prison_dummy_dnd() : SpellScriptLoader("spell_item_crystal_prison_dummy_dnd") { } - - class spell_item_crystal_prison_dummy_dnd_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_crystal_prison_dummy_dnd_SpellScript); - - bool Validate(SpellInfo const* /*spell*/) override - { - if (!sObjectMgr->GetGameObjectTemplate(OBJECT_IMPRISONED_DOOMGUARD)) - return false; - return true; - } + PrepareSpellScript(spell_item_crystal_prison_dummy_dnd); - void HandleDummy(SpellEffIndex /* effIndex */) - { - if (Creature* target = GetHitCreature()) - if (target->isDead() && !target->IsPet()) - { - GetCaster()->SummonGameObject(OBJECT_IMPRISONED_DOOMGUARD, *target, QuaternionData::fromEulerAnglesZYX(target->GetOrientation(), 0.0f, 0.0f), uint32(target->GetRespawnTime()-time(nullptr))); - target->DespawnOrUnsummon(); - } - } + bool Validate(SpellInfo const* /*spell*/) override + { + if (!sObjectMgr->GetGameObjectTemplate(OBJECT_IMPRISONED_DOOMGUARD)) + return false; + return true; + } - void Register() override + void HandleDummy(SpellEffIndex /* effIndex */) + { + if (Creature* target = GetHitCreature()) + if (target->isDead() && !target->IsPet()) { - OnEffectHitTarget += SpellEffectFn(spell_item_crystal_prison_dummy_dnd_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + GetCaster()->SummonGameObject(OBJECT_IMPRISONED_DOOMGUARD, *target, QuaternionData::fromEulerAnglesZYX(target->GetOrientation(), 0.0f, 0.0f), uint32(target->GetRespawnTime()-time(nullptr))); + target->DespawnOrUnsummon(); } - }; + } - SpellScript* GetSpellScript() const override - { - return new spell_item_crystal_prison_dummy_dnd_SpellScript(); - } + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_crystal_prison_dummy_dnd::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; enum ReindeerTransformation @@ -2890,65 +2341,55 @@ enum ReindeerTransformation SPELL_REINDEER_60 = 25858, }; -class spell_item_reindeer_transformation : public SpellScriptLoader -{ - public: - spell_item_reindeer_transformation() : SpellScriptLoader("spell_item_reindeer_transformation") { } - class spell_item_reindeer_transformation_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_reindeer_transformation_SpellScript); - - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo( - { - SPELL_FLYING_REINDEER_310, - SPELL_FLYING_REINDEER_280, - SPELL_FLYING_REINDEER_60, - SPELL_REINDEER_100, - SPELL_REINDEER_60 - }); - } +class spell_item_reindeer_transformation : public SpellScript +{ + PrepareSpellScript(spell_item_reindeer_transformation); - void HandleDummy(SpellEffIndex /* effIndex */) - { - Unit* caster = GetCaster(); - if (caster->HasAuraType(SPELL_AURA_MOUNTED)) - { - float flyspeed = caster->GetSpeedRate(MOVE_FLIGHT); - float speed = caster->GetSpeedRate(MOVE_RUN); - - caster->RemoveAurasByType(SPELL_AURA_MOUNTED); - //5 different spells used depending on mounted speed and if mount can fly or not - - if (flyspeed >= 4.1f) - // Flying Reindeer - caster->CastSpell(caster, SPELL_FLYING_REINDEER_310, true); //310% flying Reindeer - else if (flyspeed >= 3.8f) - // Flying Reindeer - caster->CastSpell(caster, SPELL_FLYING_REINDEER_280, true); //280% flying Reindeer - else if (flyspeed >= 1.6f) - // Flying Reindeer - caster->CastSpell(caster, SPELL_FLYING_REINDEER_60, true); //60% flying Reindeer - else if (speed >= 2.0f) - // Reindeer - caster->CastSpell(caster, SPELL_REINDEER_100, true); //100% ground Reindeer - else - // Reindeer - caster->CastSpell(caster, SPELL_REINDEER_60, true); //60% ground Reindeer - } - } + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo( + { + SPELL_FLYING_REINDEER_310, + SPELL_FLYING_REINDEER_280, + SPELL_FLYING_REINDEER_60, + SPELL_REINDEER_100, + SPELL_REINDEER_60 + }); + } - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_reindeer_transformation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* caster = GetCaster(); + if (caster->HasAuraType(SPELL_AURA_MOUNTED)) + { + float flyspeed = caster->GetSpeedRate(MOVE_FLIGHT); + float speed = caster->GetSpeedRate(MOVE_RUN); + + caster->RemoveAurasByType(SPELL_AURA_MOUNTED); + //5 different spells used depending on mounted speed and if mount can fly or not + + if (flyspeed >= 4.1f) + // Flying Reindeer + caster->CastSpell(caster, SPELL_FLYING_REINDEER_310, true); //310% flying Reindeer + else if (flyspeed >= 3.8f) + // Flying Reindeer + caster->CastSpell(caster, SPELL_FLYING_REINDEER_280, true); //280% flying Reindeer + else if (flyspeed >= 1.6f) + // Flying Reindeer + caster->CastSpell(caster, SPELL_FLYING_REINDEER_60, true); //60% flying Reindeer + else if (speed >= 2.0f) + // Reindeer + caster->CastSpell(caster, SPELL_REINDEER_100, true); //100% ground Reindeer + else + // Reindeer + caster->CastSpell(caster, SPELL_REINDEER_60, true); //60% ground Reindeer + } + } - SpellScript* GetSpellScript() const override + void Register() override { - return new spell_item_reindeer_transformation_SpellScript(); + OnEffectHitTarget += SpellEffectFn(spell_item_reindeer_transformation::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -2958,42 +2399,31 @@ enum NighInvulnerability SPELL_COMPLETE_VULNERABILITY = 30457, }; -class spell_item_nigh_invulnerability : public SpellScriptLoader +class spell_item_nigh_invulnerability : public SpellScript { - public: - spell_item_nigh_invulnerability() : SpellScriptLoader("spell_item_nigh_invulnerability") { } - - class spell_item_nigh_invulnerability_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_nigh_invulnerability_SpellScript); + PrepareSpellScript(spell_item_nigh_invulnerability); - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_NIGH_INVULNERABILITY, SPELL_COMPLETE_VULNERABILITY }); - } - - void HandleDummy(SpellEffIndex /* effIndex */) - { - Unit* caster = GetCaster(); - if (Item* castItem = GetCastItem()) - { - if (roll_chance_i(86)) // Nigh-Invulnerability - success - caster->CastSpell(caster, SPELL_NIGH_INVULNERABILITY, true, castItem); - else // Complete Vulnerability - backfire in 14% casts - caster->CastSpell(caster, SPELL_COMPLETE_VULNERABILITY, true, castItem); - } - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_nigh_invulnerability_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo({ SPELL_NIGH_INVULNERABILITY, SPELL_COMPLETE_VULNERABILITY }); + } - SpellScript* GetSpellScript() const override + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* caster = GetCaster(); + if (Item* castItem = GetCastItem()) { - return new spell_item_nigh_invulnerability_SpellScript(); + if (roll_chance_i(86)) // Nigh-Invulnerability - success + caster->CastSpell(caster, SPELL_NIGH_INVULNERABILITY, true, castItem); + else // Complete Vulnerability - backfire in 14% casts + caster->CastSpell(caster, SPELL_COMPLETE_VULNERABILITY, true, castItem); } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_nigh_invulnerability::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; enum Poultryzer @@ -3002,36 +2432,25 @@ enum Poultryzer SPELL_POULTRYIZER_BACKFIRE = 30504, }; -class spell_item_poultryizer : public SpellScriptLoader +class spell_item_poultryizer : public SpellScript { - public: - spell_item_poultryizer() : SpellScriptLoader("spell_item_poultryizer") { } - - class spell_item_poultryizer_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_poultryizer_SpellScript); + PrepareSpellScript(spell_item_poultryizer); - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_POULTRYIZER_SUCCESS, SPELL_POULTRYIZER_BACKFIRE }); - } - - void HandleDummy(SpellEffIndex /* effIndex */) - { - if (GetCastItem() && GetHitUnit()) - GetCaster()->CastSpell(GetHitUnit(), roll_chance_i(80) ? SPELL_POULTRYIZER_SUCCESS : SPELL_POULTRYIZER_BACKFIRE, true, GetCastItem()); - } + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo({ SPELL_POULTRYIZER_SUCCESS, SPELL_POULTRYIZER_BACKFIRE }); + } - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_poultryizer_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void HandleDummy(SpellEffIndex /* effIndex */) + { + if (GetCastItem() && GetHitUnit()) + GetCaster()->CastSpell(GetHitUnit(), roll_chance_i(80) ? SPELL_POULTRYIZER_SUCCESS : SPELL_POULTRYIZER_BACKFIRE, true, GetCastItem()); + } - SpellScript* GetSpellScript() const override - { - return new spell_item_poultryizer_SpellScript(); - } + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_poultryizer::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; enum SocretharsStone @@ -3040,50 +2459,39 @@ enum SocretharsStone SPELL_SOCRETHAR_FROM_SEAT = 35744, }; -class spell_item_socrethars_stone : public SpellScriptLoader +class spell_item_socrethars_stone : public SpellScript { - public: - spell_item_socrethars_stone() : SpellScriptLoader("spell_item_socrethars_stone") { } - - class spell_item_socrethars_stone_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_socrethars_stone_SpellScript); + PrepareSpellScript(spell_item_socrethars_stone); - bool Load() override - { - return (GetCaster()->GetAreaId() == 3900 || GetCaster()->GetAreaId() == 3742); - } - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_SOCRETHAR_TO_SEAT, SPELL_SOCRETHAR_FROM_SEAT }); - } - - void HandleDummy(SpellEffIndex /* effIndex */) - { - Unit* caster = GetCaster(); - switch (caster->GetAreaId()) - { - case 3900: - caster->CastSpell(caster, SPELL_SOCRETHAR_TO_SEAT, true); - break; - case 3742: - caster->CastSpell(caster, SPELL_SOCRETHAR_FROM_SEAT, true); - break; - default: - return; - } - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_socrethars_stone_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + bool Load() override + { + return (GetCaster()->GetAreaId() == 3900 || GetCaster()->GetAreaId() == 3742); + } + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo({ SPELL_SOCRETHAR_TO_SEAT, SPELL_SOCRETHAR_FROM_SEAT }); + } - SpellScript* GetSpellScript() const override - { - return new spell_item_socrethars_stone_SpellScript(); + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* caster = GetCaster(); + switch (caster->GetAreaId()) + { + case 3900: + caster->CastSpell(caster, SPELL_SOCRETHAR_TO_SEAT, true); + break; + case 3742: + caster->CastSpell(caster, SPELL_SOCRETHAR_FROM_SEAT, true); + break; + default: + return; } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_socrethars_stone::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; enum DemonBroiledSurprise @@ -3093,56 +2501,45 @@ enum DemonBroiledSurprise NPC_ABYSSAL_FLAMEBRINGER = 19973, }; -class spell_item_demon_broiled_surprise : public SpellScriptLoader +class spell_item_demon_broiled_surprise : public SpellScript { - public: - spell_item_demon_broiled_surprise() : SpellScriptLoader("spell_item_demon_broiled_surprise") { } + PrepareSpellScript(spell_item_demon_broiled_surprise); - class spell_item_demon_broiled_surprise_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_demon_broiled_surprise_SpellScript); - - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_CREATE_DEMON_BROILED_SURPRISE }) && - sObjectMgr->GetCreatureTemplate(NPC_ABYSSAL_FLAMEBRINGER) && - sObjectMgr->GetQuestTemplate(QUEST_SUPER_HOT_STEW); - } + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo({ SPELL_CREATE_DEMON_BROILED_SURPRISE }) && + sObjectMgr->GetCreatureTemplate(NPC_ABYSSAL_FLAMEBRINGER) && + sObjectMgr->GetQuestTemplate(QUEST_SUPER_HOT_STEW); + } - bool Load() override - { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } + bool Load() override + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } - void HandleDummy(SpellEffIndex /* effIndex */) - { - Unit* player = GetCaster(); - player->CastSpell(player, SPELL_CREATE_DEMON_BROILED_SURPRISE, false); - } + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* player = GetCaster(); + player->CastSpell(player, SPELL_CREATE_DEMON_BROILED_SURPRISE, false); + } - SpellCastResult CheckRequirement() - { - Player* player = GetCaster()->ToPlayer(); - if (player->GetQuestStatus(QUEST_SUPER_HOT_STEW) != QUEST_STATUS_INCOMPLETE) - return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; - - if (Creature* creature = player->FindNearestCreature(NPC_ABYSSAL_FLAMEBRINGER, 10, false)) - if (creature->isDead()) - return SPELL_CAST_OK; - return SPELL_FAILED_NOT_HERE; - } + SpellCastResult CheckRequirement() + { + Player* player = GetCaster()->ToPlayer(); + if (player->GetQuestStatus(QUEST_SUPER_HOT_STEW) != QUEST_STATUS_INCOMPLETE) + return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_demon_broiled_surprise_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); - OnCheckCast += SpellCheckCastFn(spell_item_demon_broiled_surprise_SpellScript::CheckRequirement); - } - }; + if (Creature* creature = player->FindNearestCreature(NPC_ABYSSAL_FLAMEBRINGER, 10, false)) + if (creature->isDead()) + return SPELL_CAST_OK; + return SPELL_FAILED_NOT_HERE; + } - SpellScript* GetSpellScript() const override - { - return new spell_item_demon_broiled_surprise_SpellScript(); - } + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_demon_broiled_surprise::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); + OnCheckCast += SpellCheckCastFn(spell_item_demon_broiled_surprise::CheckRequirement); + } }; enum CompleteRaptorCapture @@ -3150,42 +2547,31 @@ enum CompleteRaptorCapture SPELL_RAPTOR_CAPTURE_CREDIT = 42337, }; -class spell_item_complete_raptor_capture : public SpellScriptLoader +class spell_item_complete_raptor_capture : public SpellScript { - public: - spell_item_complete_raptor_capture() : SpellScriptLoader("spell_item_complete_raptor_capture") { } - - class spell_item_complete_raptor_capture_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_complete_raptor_capture_SpellScript); - - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_RAPTOR_CAPTURE_CREDIT }); - } - - void HandleDummy(SpellEffIndex /* effIndex */) - { - Unit* caster = GetCaster(); - if (GetHitCreature()) - { - GetHitCreature()->DespawnOrUnsummon(); - - //cast spell Raptor Capture Credit - caster->CastSpell(caster, SPELL_RAPTOR_CAPTURE_CREDIT, true, nullptr); - } - } + PrepareSpellScript(spell_item_complete_raptor_capture); - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_complete_raptor_capture_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo({ SPELL_RAPTOR_CAPTURE_CREDIT }); + } - SpellScript* GetSpellScript() const override + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* caster = GetCaster(); + if (GetHitCreature()) { - return new spell_item_complete_raptor_capture_SpellScript(); + GetHitCreature()->DespawnOrUnsummon(); + + //cast spell Raptor Capture Credit + caster->CastSpell(caster, SPELL_RAPTOR_CAPTURE_CREDIT, true, nullptr); } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_complete_raptor_capture::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; enum ImpaleLeviroth @@ -3194,42 +2580,31 @@ enum ImpaleLeviroth SPELL_LEVIROTH_SELF_IMPALE = 49882 }; -class spell_item_impale_leviroth : public SpellScriptLoader +class spell_item_impale_leviroth : public SpellScript { - public: - spell_item_impale_leviroth() : SpellScriptLoader("spell_item_impale_leviroth") { } + PrepareSpellScript(spell_item_impale_leviroth); - class spell_item_impale_leviroth_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_impale_leviroth_SpellScript); - - bool Validate(SpellInfo const* /*spell*/) override - { - if (!sObjectMgr->GetCreatureTemplate(NPC_LEVIROTH)) - return false; - return true; - } - - void HandleDummy(SpellEffIndex /*effIndex*/) - { - if (Creature* target = GetHitCreature()) - if (target->GetEntry() == NPC_LEVIROTH && !target->HealthBelowPct(95)) - { - target->CastSpell(target, SPELL_LEVIROTH_SELF_IMPALE, true); - target->ResetPlayerDamageReq(); - } - } + bool Validate(SpellInfo const* /*spell*/) override + { + if (!sObjectMgr->GetCreatureTemplate(NPC_LEVIROTH)) + return false; + return true; + } - void Register() override + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Creature* target = GetHitCreature()) + if (target->GetEntry() == NPC_LEVIROTH && !target->HealthBelowPct(95)) { - OnEffectHitTarget += SpellEffectFn(spell_item_impale_leviroth_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + target->CastSpell(target, SPELL_LEVIROTH_SELF_IMPALE, true); + target->ResetPlayerDamageReq(); } - }; + } - SpellScript* GetSpellScript() const override - { - return new spell_item_impale_leviroth_SpellScript(); - } + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_impale_leviroth::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; enum BrewfestMountTransformation @@ -3242,65 +2617,54 @@ enum BrewfestMountTransformation SPELL_BREWFEST_MOUNT_TRANSFORM_REVERSE = 52845, }; -class spell_item_brewfest_mount_transformation : public SpellScriptLoader +class spell_item_brewfest_mount_transformation : public SpellScript { - public: - spell_item_brewfest_mount_transformation() : SpellScriptLoader("spell_item_brewfest_mount_transformation") { } + PrepareSpellScript(spell_item_brewfest_mount_transformation); - class spell_item_brewfest_mount_transformation_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo( { - PrepareSpellScript(spell_item_brewfest_mount_transformation_SpellScript); - - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo( - { - SPELL_MOUNT_RAM_100, - SPELL_MOUNT_RAM_60, - SPELL_MOUNT_KODO_100, - SPELL_MOUNT_KODO_60 - }); - } + SPELL_MOUNT_RAM_100, + SPELL_MOUNT_RAM_60, + SPELL_MOUNT_KODO_100, + SPELL_MOUNT_KODO_60 + }); + } - void HandleDummy(SpellEffIndex /* effIndex */) - { - Player* caster = GetCaster()->ToPlayer(); - if (caster->HasAuraType(SPELL_AURA_MOUNTED)) - { - caster->RemoveAurasByType(SPELL_AURA_MOUNTED); - uint32 spell_id; - - switch (GetSpellInfo()->Id) - { - case SPELL_BREWFEST_MOUNT_TRANSFORM: - if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f) - spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100; - else - spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60; - break; - case SPELL_BREWFEST_MOUNT_TRANSFORM_REVERSE: - if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f) - spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100; - else - spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60; - break; - default: - return; - } - caster->CastSpell(caster, spell_id, true); - } - } + void HandleDummy(SpellEffIndex /* effIndex */) + { + Player* caster = GetCaster()->ToPlayer(); + if (caster->HasAuraType(SPELL_AURA_MOUNTED)) + { + caster->RemoveAurasByType(SPELL_AURA_MOUNTED); + uint32 spell_id; - void Register() override + switch (GetSpellInfo()->Id) { - OnEffectHitTarget += SpellEffectFn(spell_item_brewfest_mount_transformation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + case SPELL_BREWFEST_MOUNT_TRANSFORM: + if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f) + spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100; + else + spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60; + break; + case SPELL_BREWFEST_MOUNT_TRANSFORM_REVERSE: + if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f) + spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100; + else + spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60; + break; + default: + return; } - }; - - SpellScript* GetSpellScript() const override - { - return new spell_item_brewfest_mount_transformation_SpellScript(); + caster->CastSpell(caster, spell_id, true); } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_brewfest_mount_transformation::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; enum NitroBoosts @@ -3310,95 +2674,73 @@ enum NitroBoosts SPELL_NITRO_BOOSTS_PARACHUTE = 54649, }; -class spell_item_nitro_boosts : public SpellScriptLoader +class spell_item_nitro_boosts : public SpellScript { - public: - spell_item_nitro_boosts() : SpellScriptLoader("spell_item_nitro_boosts") { } - - class spell_item_nitro_boosts_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_nitro_boosts_SpellScript); - - bool Load() override - { - if (!GetCastItem()) - return false; - return true; - } + PrepareSpellScript(spell_item_nitro_boosts); - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_NITRO_BOOSTS_SUCCESS, SPELL_NITRO_BOOSTS_BACKFIRE }); - } + bool Load() override + { + if (!GetCastItem()) + return false; + return true; + } - void HandleDummy(SpellEffIndex /* effIndex */) - { - Unit* caster = GetCaster(); - AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(caster->GetAreaId()); - bool success = true; - if (areaEntry && areaEntry->IsFlyable() && !caster->GetMap()->IsDungeon()) - success = roll_chance_i(95); // nitro boosts can only fail in flying-enabled locations on 3.3.5 - caster->CastSpell(caster, success ? SPELL_NITRO_BOOSTS_SUCCESS : SPELL_NITRO_BOOSTS_BACKFIRE, true, GetCastItem()); - } + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo({ SPELL_NITRO_BOOSTS_SUCCESS, SPELL_NITRO_BOOSTS_BACKFIRE }); + } - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_nitro_boosts_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* caster = GetCaster(); + AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(caster->GetAreaId()); + bool success = true; + if (areaEntry && areaEntry->IsFlyable() && !caster->GetMap()->IsDungeon()) + success = roll_chance_i(95); // nitro boosts can only fail in flying-enabled locations on 3.3.5 + caster->CastSpell(caster, success ? SPELL_NITRO_BOOSTS_SUCCESS : SPELL_NITRO_BOOSTS_BACKFIRE, true, GetCastItem()); + } - SpellScript* GetSpellScript() const override - { - return new spell_item_nitro_boosts_SpellScript(); - } + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_nitro_boosts::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; -class spell_item_nitro_boosts_backfire : public SpellScriptLoader +class spell_item_nitro_boosts_backfire : public AuraScript { - public: - spell_item_nitro_boosts_backfire() : SpellScriptLoader("spell_item_nitro_boosts_backfire") { } - - class spell_item_nitro_boosts_backfire_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_nitro_boosts_backfire_AuraScript); - - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_NITRO_BOOSTS_PARACHUTE }); - } - - void HandleApply(AuraEffect const* /*effect*/, AuraEffectHandleModes /*mode*/) - { - lastZ = GetTarget()->GetPositionZ(); - } - - void HandlePeriodicDummy(AuraEffect const* effect) - { - PreventDefaultAction(); - float curZ = GetTarget()->GetPositionZ(); - if (curZ < lastZ) - { - if (roll_chance_i(80)) // we don't have enough sniffs to verify this, guesstimate - GetTarget()->CastSpell(GetTarget(), SPELL_NITRO_BOOSTS_PARACHUTE, true, nullptr, effect); - GetAura()->Remove(); - } - else - lastZ = curZ; - } + PrepareAuraScript(spell_item_nitro_boosts_backfire); - void Register() override - { - OnEffectApply += AuraEffectApplyFn(spell_item_nitro_boosts_backfire_AuraScript::HandleApply, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); - OnEffectPeriodic += AuraEffectPeriodicFn(spell_item_nitro_boosts_backfire_AuraScript::HandlePeriodicDummy, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo({ SPELL_NITRO_BOOSTS_PARACHUTE }); + } - float lastZ = INVALID_HEIGHT; - }; + void HandleApply(AuraEffect const* /*effect*/, AuraEffectHandleModes /*mode*/) + { + lastZ = GetTarget()->GetPositionZ(); + } - AuraScript* GetAuraScript() const override + void HandlePeriodicDummy(AuraEffect const* effect) + { + PreventDefaultAction(); + float curZ = GetTarget()->GetPositionZ(); + if (curZ < lastZ) { - return new spell_item_nitro_boosts_backfire_AuraScript(); + if (roll_chance_i(80)) // we don't have enough sniffs to verify this, guesstimate + GetTarget()->CastSpell(GetTarget(), SPELL_NITRO_BOOSTS_PARACHUTE, true, nullptr, effect); + GetAura()->Remove(); } + else + lastZ = curZ; + } + + void Register() override + { + OnEffectApply += AuraEffectApplyFn(spell_item_nitro_boosts_backfire::HandleApply, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_item_nitro_boosts_backfire::HandlePeriodicDummy, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + + float lastZ = INVALID_HEIGHT; }; enum TeachLanguage @@ -3440,53 +2782,42 @@ enum RocketBoots SPELL_ROCKET_BOOTS_PROC = 30452, }; -class spell_item_rocket_boots : public SpellScriptLoader +class spell_item_rocket_boots : public SpellScript { - public: - spell_item_rocket_boots() : SpellScriptLoader("spell_item_rocket_boots") { } + PrepareSpellScript(spell_item_rocket_boots); - class spell_item_rocket_boots_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_rocket_boots_SpellScript); - - bool Load() override - { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } - - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_ROCKET_BOOTS_PROC }); - } + bool Load() override + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } - void HandleDummy(SpellEffIndex /* effIndex */) - { - Player* caster = GetCaster()->ToPlayer(); - if (Battleground* bg = caster->GetBattleground()) - bg->EventPlayerDroppedFlag(caster); + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo({ SPELL_ROCKET_BOOTS_PROC }); + } - caster->GetSpellHistory()->ResetCooldown(SPELL_ROCKET_BOOTS_PROC); - caster->CastSpell(caster, SPELL_ROCKET_BOOTS_PROC, true, nullptr); - } + void HandleDummy(SpellEffIndex /* effIndex */) + { + Player* caster = GetCaster()->ToPlayer(); + if (Battleground* bg = caster->GetBattleground()) + bg->EventPlayerDroppedFlag(caster); - SpellCastResult CheckCast() - { - if (GetCaster()->IsInWater()) - return SPELL_FAILED_ONLY_ABOVEWATER; - return SPELL_CAST_OK; - } + caster->GetSpellHistory()->ResetCooldown(SPELL_ROCKET_BOOTS_PROC); + caster->CastSpell(caster, SPELL_ROCKET_BOOTS_PROC, true, nullptr); + } - void Register() override - { - OnCheckCast += SpellCheckCastFn(spell_item_rocket_boots_SpellScript::CheckCast); - OnEffectHitTarget += SpellEffectFn(spell_item_rocket_boots_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + SpellCastResult CheckCast() + { + if (GetCaster()->IsInWater()) + return SPELL_FAILED_ONLY_ABOVEWATER; + return SPELL_CAST_OK; + } - SpellScript* GetSpellScript() const override - { - return new spell_item_rocket_boots_SpellScript(); - } + void Register() override + { + OnCheckCast += SpellCheckCastFn(spell_item_rocket_boots::CheckCast); + OnEffectHitTarget += SpellEffectFn(spell_item_rocket_boots::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; enum PygmyOil @@ -3495,75 +2826,53 @@ enum PygmyOil SPELL_PYGMY_OIL_SMALLER_AURA = 53805, }; -class spell_item_pygmy_oil : public SpellScriptLoader +class spell_item_pygmy_oil : public SpellScript { - public: - spell_item_pygmy_oil() : SpellScriptLoader("spell_item_pygmy_oil") { } - - class spell_item_pygmy_oil_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_pygmy_oil_SpellScript); - - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_PYGMY_OIL_PYGMY_AURA, SPELL_PYGMY_OIL_SMALLER_AURA }); - } + PrepareSpellScript(spell_item_pygmy_oil); - void HandleDummy(SpellEffIndex /* effIndex */) - { - Unit* caster = GetCaster(); - if (Aura* aura = caster->GetAura(SPELL_PYGMY_OIL_PYGMY_AURA)) - aura->RefreshDuration(); - else - { - aura = caster->GetAura(SPELL_PYGMY_OIL_SMALLER_AURA); - if (!aura || aura->GetStackAmount() < 5 || !roll_chance_i(50)) - caster->CastSpell(caster, SPELL_PYGMY_OIL_SMALLER_AURA, true); - else - { - aura->Remove(); - caster->CastSpell(caster, SPELL_PYGMY_OIL_PYGMY_AURA, true); - } - } - } + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo({ SPELL_PYGMY_OIL_PYGMY_AURA, SPELL_PYGMY_OIL_SMALLER_AURA }); + } - void Register() override + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* caster = GetCaster(); + if (Aura* aura = caster->GetAura(SPELL_PYGMY_OIL_PYGMY_AURA)) + aura->RefreshDuration(); + else + { + aura = caster->GetAura(SPELL_PYGMY_OIL_SMALLER_AURA); + if (!aura || aura->GetStackAmount() < 5 || !roll_chance_i(50)) + caster->CastSpell(caster, SPELL_PYGMY_OIL_SMALLER_AURA, true); + else { - OnEffectHitTarget += SpellEffectFn(spell_item_pygmy_oil_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + aura->Remove(); + caster->CastSpell(caster, SPELL_PYGMY_OIL_PYGMY_AURA, true); } - }; - - SpellScript* GetSpellScript() const override - { - return new spell_item_pygmy_oil_SpellScript(); } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_pygmy_oil::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; -class spell_item_unusual_compass : public SpellScriptLoader +class spell_item_unusual_compass : public SpellScript { - public: - spell_item_unusual_compass() : SpellScriptLoader("spell_item_unusual_compass") { } - - class spell_item_unusual_compass_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_unusual_compass_SpellScript); - - void HandleDummy(SpellEffIndex /* effIndex */) - { - Unit* caster = GetCaster(); - caster->SetFacingTo(frand(0.0f, 2.0f * float(M_PI))); - } + PrepareSpellScript(spell_item_unusual_compass); - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_unusual_compass_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* caster = GetCaster(); + caster->SetFacingTo(frand(0.0f, 2.0f * float(M_PI))); + } - SpellScript* GetSpellScript() const override - { - return new spell_item_unusual_compass_SpellScript(); - } + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_unusual_compass::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; enum ChickenCover @@ -3574,108 +2883,75 @@ enum ChickenCover QUEST_FLOWN_THE_COOP = 12532, }; -class spell_item_chicken_cover : public SpellScriptLoader +class spell_item_chicken_cover : public SpellScript { - public: - spell_item_chicken_cover() : SpellScriptLoader("spell_item_chicken_cover") { } - - class spell_item_chicken_cover_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_chicken_cover_SpellScript); + PrepareSpellScript(spell_item_chicken_cover); - bool Load() override - { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } - - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_CHICKEN_NET, SPELL_CAPTURE_CHICKEN_ESCAPE }) && - sObjectMgr->GetQuestTemplate(QUEST_CHICKEN_PARTY) && - sObjectMgr->GetQuestTemplate(QUEST_FLOWN_THE_COOP); - } + bool Load() override + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } - void HandleDummy(SpellEffIndex /* effIndex */) - { - Player* caster = GetCaster()->ToPlayer(); - if (Unit* target = GetHitUnit()) - { - if (!target->HasAura(SPELL_CHICKEN_NET) && (caster->GetQuestStatus(QUEST_CHICKEN_PARTY) == QUEST_STATUS_INCOMPLETE || caster->GetQuestStatus(QUEST_FLOWN_THE_COOP) == QUEST_STATUS_INCOMPLETE)) - { - caster->CastSpell(caster, SPELL_CAPTURE_CHICKEN_ESCAPE, true); - target->KillSelf(); - } - } - } + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo({ SPELL_CHICKEN_NET, SPELL_CAPTURE_CHICKEN_ESCAPE }) && + sObjectMgr->GetQuestTemplate(QUEST_CHICKEN_PARTY) && + sObjectMgr->GetQuestTemplate(QUEST_FLOWN_THE_COOP); + } - void Register() override + void HandleDummy(SpellEffIndex /* effIndex */) + { + Player* caster = GetCaster()->ToPlayer(); + if (Unit* target = GetHitUnit()) + { + if (!target->HasAura(SPELL_CHICKEN_NET) && (caster->GetQuestStatus(QUEST_CHICKEN_PARTY) == QUEST_STATUS_INCOMPLETE || caster->GetQuestStatus(QUEST_FLOWN_THE_COOP) == QUEST_STATUS_INCOMPLETE)) { - OnEffectHitTarget += SpellEffectFn(spell_item_chicken_cover_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + caster->CastSpell(caster, SPELL_CAPTURE_CHICKEN_ESCAPE, true); + target->KillSelf(); } - }; - - SpellScript* GetSpellScript() const override - { - return new spell_item_chicken_cover_SpellScript(); } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_chicken_cover::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; -class spell_item_muisek_vessel : public SpellScriptLoader +class spell_item_muisek_vessel : public SpellScript { - public: - spell_item_muisek_vessel() : SpellScriptLoader("spell_item_muisek_vessel") { } - - class spell_item_muisek_vessel_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_muisek_vessel_SpellScript); - - void HandleDummy(SpellEffIndex /*effIndex*/) - { - if (Creature* target = GetHitCreature()) - if (target->isDead()) - target->DespawnOrUnsummon(); - } + PrepareSpellScript(spell_item_muisek_vessel); - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_muisek_vessel_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Creature* target = GetHitCreature()) + if (target->isDead()) + target->DespawnOrUnsummon(); + } - SpellScript* GetSpellScript() const override - { - return new spell_item_muisek_vessel_SpellScript(); - } + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_muisek_vessel::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; enum GreatmothersSoulcather { SPELL_FORCE_CAST_SUMMON_GNOME_SOUL = 46486, }; -class spell_item_greatmothers_soulcatcher : public SpellScriptLoader +class spell_item_greatmothers_soulcatcher : public SpellScript { -public: - spell_item_greatmothers_soulcatcher() : SpellScriptLoader("spell_item_greatmothers_soulcatcher") { } + PrepareSpellScript(spell_item_greatmothers_soulcatcher); - class spell_item_greatmothers_soulcatcher_SpellScript : public SpellScript + void HandleDummy(SpellEffIndex /*effIndex*/) { - PrepareSpellScript(spell_item_greatmothers_soulcatcher_SpellScript); - - void HandleDummy(SpellEffIndex /*effIndex*/) - { - if (GetHitUnit()) - GetCaster()->CastSpell(GetCaster(), SPELL_FORCE_CAST_SUMMON_GNOME_SOUL); - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_greatmothers_soulcatcher_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + if (GetHitUnit()) + GetCaster()->CastSpell(GetCaster(), SPELL_FORCE_CAST_SUMMON_GNOME_SOUL); + } - SpellScript* GetSpellScript() const override + void Register() override { - return new spell_item_greatmothers_soulcatcher_SpellScript(); + OnEffectHitTarget += SpellEffectFn(spell_item_greatmothers_soulcatcher::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -3742,60 +3018,49 @@ enum SoulPreserver SPELL_SOUL_PRESERVER_SHAMAN = 60515, }; -class spell_item_soul_preserver : public SpellScriptLoader +class spell_item_soul_preserver : public AuraScript { -public: - spell_item_soul_preserver() : SpellScriptLoader("spell_item_soul_preserver") { } + PrepareAuraScript(spell_item_soul_preserver); - class spell_item_soul_preserver_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareAuraScript(spell_item_soul_preserver_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo( - { - SPELL_SOUL_PRESERVER_DRUID, - SPELL_SOUL_PRESERVER_PALADIN, - SPELL_SOUL_PRESERVER_PRIEST, - SPELL_SOUL_PRESERVER_SHAMAN - }); - } - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + return ValidateSpellInfo( { - PreventDefaultAction(); - - Unit* caster = eventInfo.GetActor(); - - switch (caster->getClass()) - { - case CLASS_DRUID: - caster->CastSpell(caster, SPELL_SOUL_PRESERVER_DRUID, true, nullptr, aurEff); - break; - case CLASS_PALADIN: - caster->CastSpell(caster, SPELL_SOUL_PRESERVER_PALADIN, true, nullptr, aurEff); - break; - case CLASS_PRIEST: - caster->CastSpell(caster, SPELL_SOUL_PRESERVER_PRIEST, true, nullptr, aurEff); - break; - case CLASS_SHAMAN: - caster->CastSpell(caster, SPELL_SOUL_PRESERVER_SHAMAN, true, nullptr, aurEff); - break; - default: - break; - } - } + SPELL_SOUL_PRESERVER_DRUID, + SPELL_SOUL_PRESERVER_PALADIN, + SPELL_SOUL_PRESERVER_PRIEST, + SPELL_SOUL_PRESERVER_SHAMAN + }); + } - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_item_soul_preserver_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + + Unit* caster = eventInfo.GetActor(); + + switch (caster->getClass()) + { + case CLASS_DRUID: + caster->CastSpell(caster, SPELL_SOUL_PRESERVER_DRUID, true, nullptr, aurEff); + break; + case CLASS_PALADIN: + caster->CastSpell(caster, SPELL_SOUL_PRESERVER_PALADIN, true, nullptr, aurEff); + break; + case CLASS_PRIEST: + caster->CastSpell(caster, SPELL_SOUL_PRESERVER_PRIEST, true, nullptr, aurEff); + break; + case CLASS_SHAMAN: + caster->CastSpell(caster, SPELL_SOUL_PRESERVER_SHAMAN, true, nullptr, aurEff); + break; + default: + break; } - }; + } - AuraScript* GetAuraScript() const override + void Register() override { - return new spell_item_soul_preserver_AuraScript(); + OnEffectProc += AuraEffectProcFn(spell_item_soul_preserver::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); } }; @@ -3885,40 +3150,29 @@ class spell_item_sunwell_neck : public SpellScriptLoader } }; -class spell_item_toy_train_set_pulse : public SpellScriptLoader +class spell_item_toy_train_set_pulse : public SpellScript { -public: - spell_item_toy_train_set_pulse() : SpellScriptLoader("spell_item_toy_train_set_pulse") { } + PrepareSpellScript(spell_item_toy_train_set_pulse); - class spell_item_toy_train_set_pulse_SpellScript : public SpellScript + void HandleDummy(SpellEffIndex /*index*/) { - PrepareSpellScript(spell_item_toy_train_set_pulse_SpellScript); - - void HandleDummy(SpellEffIndex /*index*/) + if (Player* target = GetHitUnit()->ToPlayer()) { - if (Player* target = GetHitUnit()->ToPlayer()) - { - target->HandleEmoteCommand(EMOTE_ONESHOT_TRAIN); - if (EmotesTextSoundEntry const* soundEntry = sDB2Manager.GetTextSoundEmoteFor(TEXT_EMOTE_TRAIN, target->getRace(), target->getGender(), target->getClass())) - target->PlayDistanceSound(soundEntry->SoundID); - } - } - - void HandleTargets(std::list<WorldObject*>& targetList) - { - targetList.remove_if([](WorldObject const* obj) { return obj->GetTypeId() != TYPEID_PLAYER; }); + target->HandleEmoteCommand(EMOTE_ONESHOT_TRAIN); + if (EmotesTextSoundEntry const* soundEntry = sDB2Manager.GetTextSoundEmoteFor(TEXT_EMOTE_TRAIN, target->getRace(), target->getGender(), target->getClass())) + target->PlayDistanceSound(soundEntry->SoundID); } + } - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_toy_train_set_pulse_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_item_toy_train_set_pulse_SpellScript::HandleTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ALLY); - } - }; + void HandleTargets(std::list<WorldObject*>& targetList) + { + targetList.remove_if([](WorldObject const* obj) { return obj->GetTypeId() != TYPEID_PLAYER; }); + } - SpellScript* GetSpellScript() const override + void Register() override { - return new spell_item_toy_train_set_pulse_SpellScript(); + OnEffectHitTarget += SpellEffectFn(spell_item_toy_train_set_pulse::HandleDummy, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_item_toy_train_set_pulse::HandleTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ALLY); } }; @@ -3932,66 +3186,55 @@ enum DeathChoiceSpells SPELL_DEATH_CHOICE_HEROIC_STRENGTH = 67773 }; -class spell_item_death_choice : public SpellScriptLoader +class spell_item_death_choice : public AuraScript { -public: - spell_item_death_choice() : SpellScriptLoader("spell_item_death_choice") { } + PrepareAuraScript(spell_item_death_choice); - class spell_item_death_choice_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareAuraScript(spell_item_death_choice_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override + return ValidateSpellInfo( { - return ValidateSpellInfo( - { - SPELL_DEATH_CHOICE_NORMAL_STRENGTH, - SPELL_DEATH_CHOICE_NORMAL_AGILITY, - SPELL_DEATH_CHOICE_HEROIC_STRENGTH, - SPELL_DEATH_CHOICE_HEROIC_AGILITY - }); - } + SPELL_DEATH_CHOICE_NORMAL_STRENGTH, + SPELL_DEATH_CHOICE_NORMAL_AGILITY, + SPELL_DEATH_CHOICE_HEROIC_STRENGTH, + SPELL_DEATH_CHOICE_HEROIC_AGILITY + }); + } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); - Unit* caster = eventInfo.GetActor(); - float str = caster->GetStat(STAT_STRENGTH); - float agi = caster->GetStat(STAT_AGILITY); + Unit* caster = eventInfo.GetActor(); + float str = caster->GetStat(STAT_STRENGTH); + float agi = caster->GetStat(STAT_AGILITY); - switch (aurEff->GetId()) + switch (aurEff->GetId()) + { + case SPELL_DEATH_CHOICE_NORMAL_AURA: { - case SPELL_DEATH_CHOICE_NORMAL_AURA: - { - if (str > agi) - caster->CastSpell(caster, SPELL_DEATH_CHOICE_NORMAL_STRENGTH, true, nullptr, aurEff); - else - caster->CastSpell(caster, SPELL_DEATH_CHOICE_NORMAL_AGILITY, true, nullptr, aurEff); - break; - } - case SPELL_DEATH_CHOICE_HEROIC_AURA: - { - if (str > agi) - caster->CastSpell(caster, SPELL_DEATH_CHOICE_HEROIC_STRENGTH, true, nullptr, aurEff); - else - caster->CastSpell(caster, SPELL_DEATH_CHOICE_HEROIC_AGILITY, true, nullptr, aurEff); - break; - } - default: - break; + if (str > agi) + caster->CastSpell(caster, SPELL_DEATH_CHOICE_NORMAL_STRENGTH, true, nullptr, aurEff); + else + caster->CastSpell(caster, SPELL_DEATH_CHOICE_NORMAL_AGILITY, true, nullptr, aurEff); + break; } + case SPELL_DEATH_CHOICE_HEROIC_AURA: + { + if (str > agi) + caster->CastSpell(caster, SPELL_DEATH_CHOICE_HEROIC_STRENGTH, true, nullptr, aurEff); + else + caster->CastSpell(caster, SPELL_DEATH_CHOICE_HEROIC_AGILITY, true, nullptr, aurEff); + break; + } + default: + break; } + } - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_item_death_choice_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); - } - }; - - AuraScript* GetAuraScript() const override + void Register() override { - return new spell_item_death_choice_AuraScript(); + OnEffectProc += AuraEffectProcFn(spell_item_death_choice::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); } }; @@ -4076,128 +3319,110 @@ private: // 57345 - Darkmoon Card: Greatness enum DarkmoonCardSpells { - SPELL_DARKMOON_CARD_STRENGHT = 60229, + SPELL_DARKMOON_CARD_STRENGTH = 60229, SPELL_DARKMOON_CARD_AGILITY = 60233, SPELL_DARKMOON_CARD_INTELLECT = 60234, SPELL_DARKMOON_CARD_VERSATILITY = 60235, }; -class spell_item_darkmoon_card_greatness : public SpellScriptLoader +class spell_item_darkmoon_card_greatness : public AuraScript { -public: - spell_item_darkmoon_card_greatness() : SpellScriptLoader("spell_item_darkmoon_card_greatness") { } + PrepareAuraScript(spell_item_darkmoon_card_greatness); - class spell_item_darkmoon_card_greatness_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareAuraScript(spell_item_darkmoon_card_greatness_AuraScript); + return ValidateSpellInfo( + { + SPELL_DARKMOON_CARD_STRENGTH, + SPELL_DARKMOON_CARD_AGILITY, + SPELL_DARKMOON_CARD_INTELLECT, + SPELL_DARKMOON_CARD_VERSATILITY + }); + } - bool Validate(SpellInfo const* /*spellInfo*/) override + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + + Unit* caster = eventInfo.GetActor(); + float str = caster->GetStat(STAT_STRENGTH); + float agi = caster->GetStat(STAT_AGILITY); + float intl = caster->GetStat(STAT_INTELLECT); + float vers = 0.0f; // caster->GetStat(STAT_VERSATILITY); + float stat = 0.0f; + + uint32 spellTrigger = SPELL_DARKMOON_CARD_STRENGTH; + + if (str > stat) { - return ValidateSpellInfo( - { - SPELL_DARKMOON_CARD_STRENGHT, - SPELL_DARKMOON_CARD_AGILITY, - SPELL_DARKMOON_CARD_INTELLECT, - SPELL_DARKMOON_CARD_VERSATILITY - }); + spellTrigger = SPELL_DARKMOON_CARD_STRENGTH; + stat = str; } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + if (agi > stat) { - PreventDefaultAction(); + spellTrigger = SPELL_DARKMOON_CARD_AGILITY; + stat = agi; + } - Unit* caster = eventInfo.GetActor(); - float str = caster->GetStat(STAT_STRENGTH); - float agi = caster->GetStat(STAT_AGILITY); - float intl = caster->GetStat(STAT_INTELLECT); - float vers = 0.0f; // caster->GetStat(STAT_VERSATILITY); - float stat = 0.0f; - - uint32 spellTrigger = SPELL_DARKMOON_CARD_STRENGHT; - - if (str > stat) - { - spellTrigger = SPELL_DARKMOON_CARD_STRENGHT; - stat = str; - } - - if (agi > stat) - { - spellTrigger = SPELL_DARKMOON_CARD_AGILITY; - stat = agi; - } - - if (intl > stat) - { - spellTrigger = SPELL_DARKMOON_CARD_INTELLECT; - stat = intl; - } - - if (vers > stat) - { - spellTrigger = SPELL_DARKMOON_CARD_VERSATILITY; - stat = vers; - } - - caster->CastSpell(caster, spellTrigger, true, nullptr, aurEff); + if (intl > stat) + { + spellTrigger = SPELL_DARKMOON_CARD_INTELLECT; + stat = intl; } - void Register() override + if (vers > stat) { - OnEffectProc += AuraEffectProcFn(spell_item_darkmoon_card_greatness_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + spellTrigger = SPELL_DARKMOON_CARD_VERSATILITY; + stat = vers; } - }; - AuraScript* GetAuraScript() const override + caster->CastSpell(caster, spellTrigger, true, nullptr, aurEff); + } + + void Register() override { - return new spell_item_darkmoon_card_greatness_AuraScript(); + OnEffectProc += AuraEffectProcFn(spell_item_darkmoon_card_greatness::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); } }; -// 27522, 40336 - Mana Drain +// 27522,40336 - Mana Drain enum ManaDrainSpells { SPELL_MANA_DRAIN_ENERGIZE = 29471, SPELL_MANA_DRAIN_LEECH = 27526 }; -class spell_item_mana_drain : public SpellScriptLoader +class spell_item_mana_drain : public AuraScript { -public: - spell_item_mana_drain() : SpellScriptLoader("spell_item_mana_drain") { } + PrepareAuraScript(spell_item_mana_drain); - class spell_item_mana_drain_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareAuraScript(spell_item_mana_drain_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_MANA_DRAIN_ENERGIZE, SPELL_MANA_DRAIN_LEECH }); - } - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + return ValidateSpellInfo( { - PreventDefaultAction(); + SPELL_MANA_DRAIN_ENERGIZE, + SPELL_MANA_DRAIN_LEECH + }); + } - Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetActionTarget(); + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); - if (caster->IsAlive()) - caster->CastSpell(caster, SPELL_MANA_DRAIN_ENERGIZE, true, nullptr, aurEff); + Unit* caster = eventInfo.GetActor(); + Unit* target = eventInfo.GetActionTarget(); - if (target && target->IsAlive()) - caster->CastSpell(target, SPELL_MANA_DRAIN_LEECH, true, nullptr, aurEff); - } + if (caster->IsAlive()) + caster->CastSpell(caster, SPELL_MANA_DRAIN_ENERGIZE, true, nullptr, aurEff); - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_item_mana_drain_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); - } - }; + if (target && target->IsAlive()) + caster->CastSpell(target, SPELL_MANA_DRAIN_LEECH, true, nullptr, aurEff); + } - AuraScript* GetAuraScript() const override + void Register() override { - return new spell_item_mana_drain_AuraScript(); + OnEffectProc += AuraEffectProcFn(spell_item_mana_drain::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); } }; @@ -4209,57 +3434,46 @@ enum TauntFlag }; // 51640 - Taunt Flag Targeting -class spell_item_taunt_flag_targeting : public SpellScriptLoader +class spell_item_taunt_flag_targeting : public SpellScript { - public: - spell_item_taunt_flag_targeting() : SpellScriptLoader("spell_item_taunt_flag_targeting") { } - - class spell_item_taunt_flag_targeting_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_taunt_flag_targeting_SpellScript); + PrepareSpellScript(spell_item_taunt_flag_targeting); - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_TAUNT_FLAG }) && - sBroadcastTextStore.LookupEntry(EMOTE_PLANTS_FLAG); - } - - void FilterTargets(std::list<WorldObject*>& targets) - { - targets.remove_if([](WorldObject* obj) -> bool - { - return obj->GetTypeId() != TYPEID_PLAYER && obj->GetTypeId() != TYPEID_CORPSE; - }); + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_TAUNT_FLAG }) && + sBroadcastTextStore.LookupEntry(EMOTE_PLANTS_FLAG); + } - if (targets.empty()) - { - FinishCast(SPELL_FAILED_NO_VALID_TARGETS); - return; - } + void FilterTargets(std::list<WorldObject*>& targets) + { + targets.remove_if([](WorldObject* obj) -> bool + { + return obj->GetTypeId() != TYPEID_PLAYER && obj->GetTypeId() != TYPEID_CORPSE; + }); - Trinity::Containers::RandomResize(targets, 1); - } + if (targets.empty()) + { + FinishCast(SPELL_FAILED_NO_VALID_TARGETS); + return; + } - void HandleDummy(SpellEffIndex /*effIndex*/) - { - // we *really* want the unit implementation here - // it sends a packet like seen on sniff - GetCaster()->Unit::TextEmote(EMOTE_PLANTS_FLAG, GetHitUnit(), false); + Trinity::Containers::RandomResize(targets, 1); + } - GetCaster()->CastSpell(GetHitUnit(), SPELL_TAUNT_FLAG, true); - } + void HandleDummy(SpellEffIndex /*effIndex*/) + { + // we *really* want the unit implementation here + // it sends a packet like seen on sniff + GetCaster()->Unit::TextEmote(EMOTE_PLANTS_FLAG, GetHitUnit(), false); - void Register() override - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_item_taunt_flag_targeting_SpellScript::FilterTargets, EFFECT_0, TARGET_CORPSE_SRC_AREA_ENEMY); - OnEffectHitTarget += SpellEffectFn(spell_item_taunt_flag_targeting_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + GetCaster()->CastSpell(GetHitUnit(), SPELL_TAUNT_FLAG, true); + } - SpellScript* GetSpellScript() const override - { - return new spell_item_taunt_flag_targeting_SpellScript(); - } + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_item_taunt_flag_targeting::FilterTargets, EFFECT_0, TARGET_CORPSE_SRC_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_item_taunt_flag_targeting::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; // 13180 - Gnomish Mind Control Cap @@ -4271,49 +3485,38 @@ enum MindControlCap SPELL_DULLARD = 67809 }; -class spell_item_mind_control_cap : public SpellScriptLoader +class spell_item_mind_control_cap : public SpellScript { - public: - spell_item_mind_control_cap() : SpellScriptLoader("spell_item_mind_control_cap") { } + PrepareSpellScript(spell_item_mind_control_cap); - class spell_item_mind_control_cap_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_mind_control_cap_SpellScript); - - bool Load() override - { - if (!GetCastItem()) - return false; - return true; - } - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_GNOMISH_MIND_CONTROL_CAP, SPELL_DULLARD }); - } - - void HandleDummy(SpellEffIndex /* effIndex */) - { - Unit* caster = GetCaster(); - if (Unit* target = GetHitUnit()) - { - if (roll_chance_i(ROLL_CHANCE_NO_BACKFIRE)) - caster->CastSpell(target, roll_chance_i(ROLL_CHANCE_DULLARD) ? SPELL_DULLARD : SPELL_GNOMISH_MIND_CONTROL_CAP, true, GetCastItem()); - else - target->CastSpell(caster, SPELL_GNOMISH_MIND_CONTROL_CAP, true); // backfire - 5% chance - } - } + bool Load() override + { + if (!GetCastItem()) + return false; + return true; + } - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_mind_control_cap_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo({ SPELL_GNOMISH_MIND_CONTROL_CAP, SPELL_DULLARD }); + } - SpellScript* GetSpellScript() const override + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* caster = GetCaster(); + if (Unit* target = GetHitUnit()) { - return new spell_item_mind_control_cap_SpellScript(); + if (roll_chance_i(ROLL_CHANCE_NO_BACKFIRE)) + caster->CastSpell(target, roll_chance_i(ROLL_CHANCE_DULLARD) ? SPELL_DULLARD : SPELL_GNOMISH_MIND_CONTROL_CAP, true, GetCastItem()); + else + target->CastSpell(caster, SPELL_GNOMISH_MIND_CONTROL_CAP, true); // backfire - 5% chance } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_mind_control_cap::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; // 8344 - Universal Remote (Gnomish Universal Remote) @@ -4324,51 +3527,40 @@ enum UniversalRemote SPELL_TARGET_LOCK = 8347 }; -class spell_item_universal_remote : public SpellScriptLoader +class spell_item_universal_remote : public SpellScript { - public: - spell_item_universal_remote() : SpellScriptLoader("spell_item_universal_remote") { } - - class spell_item_universal_remote_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_universal_remote_SpellScript); - - bool Load() override - { - if (!GetCastItem()) - return false; - return true; - } + PrepareSpellScript(spell_item_universal_remote); - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_CONTROL_MACHINE, SPELL_MOBILITY_MALFUNCTION, SPELL_TARGET_LOCK }); - } - - void HandleDummy(SpellEffIndex /*effIndex*/) - { - if (Unit* target = GetHitUnit()) - { - uint8 chance = urand(0, 99); - if (chance < 15) - GetCaster()->CastSpell(target, SPELL_TARGET_LOCK, true, GetCastItem()); - else if (chance < 25) - GetCaster()->CastSpell(target, SPELL_MOBILITY_MALFUNCTION, true, GetCastItem()); - else - GetCaster()->CastSpell(target, SPELL_CONTROL_MACHINE, true, GetCastItem()); - } - } + bool Load() override + { + if (!GetCastItem()) + return false; + return true; + } - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_item_universal_remote_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_CONTROL_MACHINE, SPELL_MOBILITY_MALFUNCTION, SPELL_TARGET_LOCK }); + } - SpellScript* GetSpellScript() const override - { - return new spell_item_universal_remote_SpellScript(); + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + { + uint8 chance = urand(0, 99); + if (chance < 15) + GetCaster()->CastSpell(target, SPELL_TARGET_LOCK, true, GetCastItem()); + else if (chance < 25) + GetCaster()->CastSpell(target, SPELL_MOBILITY_MALFUNCTION, true, GetCastItem()); + else + GetCaster()->CastSpell(target, SPELL_CONTROL_MACHINE, true, GetCastItem()); } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_universal_remote::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; enum ZandalarianCharms @@ -4432,77 +3624,55 @@ class spell_item_zandalarian_charm : public SpellScriptLoader uint32 _spellId; }; -class spell_item_artifical_stamina : public SpellScriptLoader +class spell_item_artifical_stamina : public AuraScript { -public: - spell_item_artifical_stamina() : SpellScriptLoader("spell_item_artifical_stamina") { } + PrepareAuraScript(spell_item_artifical_stamina); - class spell_item_artifical_stamina_AuraScript : public AuraScript + bool Validate(SpellInfo const* spellInfo) override { - PrepareAuraScript(spell_item_artifical_stamina_AuraScript); - - bool Validate(SpellInfo const* spellInfo) override - { - return spellInfo->GetEffect(EFFECT_1) != nullptr; - } - - bool Load() override - { - return GetOwner()->GetTypeId() == TYPEID_PLAYER; - } + return spellInfo->GetEffect(EFFECT_1) != nullptr; + } - void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) - { - if (Item* artifact = GetOwner()->ToPlayer()->GetItemByGuid(GetAura()->GetCastItemGUID())) - amount = GetSpellInfo()->GetEffect(EFFECT_1)->BasePoints * artifact->GetTotalPurchasedArtifactPowers() / 100; - } + bool Load() override + { + return GetOwner()->GetTypeId() == TYPEID_PLAYER; + } - void Register() override - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_item_artifical_stamina_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE); - } - }; + void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (Item* artifact = GetOwner()->ToPlayer()->GetItemByGuid(GetAura()->GetCastItemGUID())) + amount = GetSpellInfo()->GetEffect(EFFECT_1)->BasePoints * artifact->GetTotalPurchasedArtifactPowers() / 100; + } - AuraScript* GetAuraScript() const override + void Register() override { - return new spell_item_artifical_stamina_AuraScript(); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_item_artifical_stamina::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE); } }; -class spell_item_artifical_damage : public SpellScriptLoader +class spell_item_artifical_damage : public AuraScript { -public: - spell_item_artifical_damage() : SpellScriptLoader("spell_item_artifical_damage") { } + PrepareAuraScript(spell_item_artifical_damage); - class spell_item_artifical_damage_AuraScript : public AuraScript + bool Validate(SpellInfo const* spellInfo) override { - PrepareAuraScript(spell_item_artifical_damage_AuraScript); - - bool Validate(SpellInfo const* spellInfo) override - { - return spellInfo->GetEffect(EFFECT_1) != nullptr; - } - - bool Load() override - { - return GetOwner()->GetTypeId() == TYPEID_PLAYER; - } + return spellInfo->GetEffect(EFFECT_1) != nullptr; + } - void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) - { - if (Item* artifact = GetOwner()->ToPlayer()->GetItemByGuid(GetAura()->GetCastItemGUID())) - amount = GetSpellInfo()->GetEffect(EFFECT_1)->BasePoints * artifact->GetTotalPurchasedArtifactPowers() / 100; - } + bool Load() override + { + return GetOwner()->GetTypeId() == TYPEID_PLAYER; + } - void Register() override - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_item_artifical_damage_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); - } - }; + void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (Item* artifact = GetOwner()->ToPlayer()->GetItemByGuid(GetAura()->GetCastItemGUID())) + amount = GetSpellInfo()->GetEffect(EFFECT_1)->BasePoints * artifact->GetTotalPurchasedArtifactPowers() / 100; + } - AuraScript* GetAuraScript() const override + void Register() override { - return new spell_item_artifical_damage_AuraScript(); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_item_artifical_damage::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); } }; @@ -4522,131 +3692,87 @@ enum AuraProcRemoveSpells }; // 28200 - Ascendance -class spell_item_talisman_of_ascendance : public SpellScriptLoader +class spell_item_talisman_of_ascendance : public AuraScript { - public: - spell_item_talisman_of_ascendance() : SpellScriptLoader("spell_item_talisman_of_ascendance") { } + PrepareAuraScript(spell_item_talisman_of_ascendance); - class spell_item_talisman_of_ascendance_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_talisman_of_ascendance_AuraScript); - - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_TALISMAN_OF_ASCENDANCE }); - } - - void OnRemove(AuraEffect const* effect, AuraEffectHandleModes /*mode*/) - { - GetTarget()->RemoveAurasDueToSpell(effect->GetSpellEffectInfo()->TriggerSpell); - } + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo({ SPELL_TALISMAN_OF_ASCENDANCE }); + } - void Register() override - { - OnEffectRemove += AuraEffectRemoveFn(spell_item_talisman_of_ascendance_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); - } - }; + void OnRemove(AuraEffect const* effect, AuraEffectHandleModes /*mode*/) + { + GetTarget()->RemoveAurasDueToSpell(effect->GetSpellEffectInfo()->TriggerSpell); + } - AuraScript* GetAuraScript() const override - { - return new spell_item_talisman_of_ascendance_AuraScript(); - } + void Register() override + { + OnEffectRemove += AuraEffectRemoveFn(spell_item_talisman_of_ascendance::OnRemove, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + } }; // 29602 - Jom Gabbar -class spell_item_jom_gabbar : public SpellScriptLoader +class spell_item_jom_gabbar : public AuraScript { - public: - spell_item_jom_gabbar() : SpellScriptLoader("spell_item_jom_gabbar") { } - - class spell_item_jom_gabbar_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_jom_gabbar_AuraScript); + PrepareAuraScript(spell_item_jom_gabbar); - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_JOM_GABBAR }); - } - - void OnRemove(AuraEffect const* effect, AuraEffectHandleModes /*mode*/) - { - GetTarget()->RemoveAurasDueToSpell(effect->GetSpellEffectInfo()->TriggerSpell); - } + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo({ SPELL_JOM_GABBAR }); + } - void Register() override - { - OnEffectRemove += AuraEffectRemoveFn(spell_item_jom_gabbar_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); - } - }; + void OnRemove(AuraEffect const* effect, AuraEffectHandleModes /*mode*/) + { + GetTarget()->RemoveAurasDueToSpell(effect->GetSpellEffectInfo()->TriggerSpell); + } - AuraScript* GetAuraScript() const override - { - return new spell_item_jom_gabbar_AuraScript(); - } + void Register() override + { + OnEffectRemove += AuraEffectRemoveFn(spell_item_jom_gabbar::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + } }; // 45040 - Battle Trance -class spell_item_battle_trance : public SpellScriptLoader +class spell_item_battle_trance : public AuraScript { - public: - spell_item_battle_trance() : SpellScriptLoader("spell_item_battle_trance") { } + PrepareAuraScript(spell_item_battle_trance); - class spell_item_battle_trance_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_battle_trance_AuraScript); - - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_BATTLE_TRANCE }); - } - - void OnRemove(AuraEffect const* effect, AuraEffectHandleModes /*mode*/) - { - GetTarget()->RemoveAurasDueToSpell(effect->GetSpellEffectInfo()->TriggerSpell); - } + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo({ SPELL_BATTLE_TRANCE }); + } - void Register() override - { - OnEffectRemove += AuraEffectRemoveFn(spell_item_battle_trance_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); - } - }; + void OnRemove(AuraEffect const* effect, AuraEffectHandleModes /*mode*/) + { + GetTarget()->RemoveAurasDueToSpell(effect->GetSpellEffectInfo()->TriggerSpell); + } - AuraScript* GetAuraScript() const override - { - return new spell_item_battle_trance_AuraScript(); - } + void Register() override + { + OnEffectRemove += AuraEffectRemoveFn(spell_item_battle_trance::OnRemove, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + } }; // 90900 - World-Queller Focus -class spell_item_world_queller_focus : public SpellScriptLoader +class spell_item_world_queller_focus : public AuraScript { - public: - spell_item_world_queller_focus() : SpellScriptLoader("spell_item_world_queller_focus") { } - - class spell_item_world_queller_focus_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_world_queller_focus_AuraScript); + PrepareAuraScript(spell_item_world_queller_focus); - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_WORLD_QUELLER_FOCUS }); - } - - void OnRemove(AuraEffect const* effect, AuraEffectHandleModes /*mode*/) - { - GetTarget()->RemoveAurasDueToSpell(effect->GetSpellEffectInfo()->TriggerSpell); - } + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo({ SPELL_WORLD_QUELLER_FOCUS }); + } - void Register() override - { - OnEffectRemove += AuraEffectRemoveFn(spell_item_world_queller_focus_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); - } - }; + void OnRemove(AuraEffect const* effect, AuraEffectHandleModes /*mode*/) + { + GetTarget()->RemoveAurasDueToSpell(effect->GetSpellEffectInfo()->TriggerSpell); + } - AuraScript* GetAuraScript() const override - { - return new spell_item_world_queller_focus_AuraScript(); - } + void Register() override + { + OnEffectRemove += AuraEffectRemoveFn(spell_item_world_queller_focus::OnRemove, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + } }; // 118089 - Azure Water Strider @@ -4654,209 +3780,163 @@ class spell_item_world_queller_focus : public SpellScriptLoader // 127272 - Orange Water Strider // 127274 - Jade Water Strider // 127278 - Golden Water Strider -class spell_item_water_strider : public SpellScriptLoader +class spell_item_water_strider : public AuraScript { - public: - spell_item_water_strider() : SpellScriptLoader("spell_item_water_strider") { } - - class spell_item_water_strider_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_water_strider_AuraScript); + PrepareAuraScript(spell_item_water_strider); - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo( - { - SPELL_AZURE_WATER_STRIDER, - SPELL_CRIMSON_WATER_STRIDER, - SPELL_ORANGE_WATER_STRIDER, - SPELL_JADE_WATER_STRIDER, - SPELL_GOLDEN_WATER_STRIDER - }); - } - - void OnRemove(AuraEffect const* /*effect*/, AuraEffectHandleModes /*mode*/) - { - GetTarget()->RemoveAurasDueToSpell(GetSpellInfo()->GetEffect(EFFECT_1)->TriggerSpell); - } + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo( + { + SPELL_AZURE_WATER_STRIDER, + SPELL_CRIMSON_WATER_STRIDER, + SPELL_ORANGE_WATER_STRIDER, + SPELL_JADE_WATER_STRIDER, + SPELL_GOLDEN_WATER_STRIDER + }); + } - void Register() override - { - OnEffectRemove += AuraEffectRemoveFn(spell_item_water_strider_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_MOUNTED, AURA_EFFECT_HANDLE_REAL); - } - }; + void OnRemove(AuraEffect const* /*effect*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->RemoveAurasDueToSpell(GetSpellInfo()->GetEffect(EFFECT_1)->TriggerSpell); + } - AuraScript* GetAuraScript() const override - { - return new spell_item_water_strider_AuraScript(); - } + void Register() override + { + OnEffectRemove += AuraEffectRemoveFn(spell_item_water_strider::OnRemove, EFFECT_0, SPELL_AURA_MOUNTED, AURA_EFFECT_HANDLE_REAL); + } }; // 144671 - Brutal Kinship // 145738 - Brutal Kinship -class spell_item_brutal_kinship : public SpellScriptLoader +class spell_item_brutal_kinship : public AuraScript { - public: - spell_item_brutal_kinship() : SpellScriptLoader("spell_item_brutal_kinship") { } + PrepareAuraScript(spell_item_brutal_kinship); - class spell_item_brutal_kinship_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_brutal_kinship_AuraScript); - - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_BRUTAL_KINSHIP_1, SPELL_BRUTAL_KINSHIP_2 }); - } - - void OnRemove(AuraEffect const* effect, AuraEffectHandleModes /*mode*/) - { - GetTarget()->RemoveAurasDueToSpell(effect->GetSpellEffectInfo()->TriggerSpell); - } + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo({ SPELL_BRUTAL_KINSHIP_1, SPELL_BRUTAL_KINSHIP_2 }); + } - void Register() override - { - OnEffectRemove += AuraEffectRemoveFn(spell_item_brutal_kinship_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); - } - }; + void OnRemove(AuraEffect const* effect, AuraEffectHandleModes /*mode*/) + { + GetTarget()->RemoveAurasDueToSpell(effect->GetSpellEffectInfo()->TriggerSpell); + } - AuraScript* GetAuraScript() const override - { - return new spell_item_brutal_kinship_AuraScript(); - } + void Register() override + { + OnEffectRemove += AuraEffectRemoveFn(spell_item_brutal_kinship::OnRemove, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + } }; // 45051 - Mad Alchemist's Potion (34440) -class spell_item_mad_alchemists_potion : public SpellScriptLoader +class spell_item_mad_alchemists_potion : public SpellScript { -public: - spell_item_mad_alchemists_potion() : SpellScriptLoader("spell_item_mad_alchemists_potion") {} + PrepareSpellScript(spell_item_mad_alchemists_potion); - class mad_alchemists_potion_SpellScript : public SpellScript + void SecondaryEffect() { - PrepareSpellScript(mad_alchemists_potion_SpellScript); + std::vector<uint32> availableElixirs = + { + // Battle Elixirs + 33720, // Onslaught Elixir (28102) + 54452, // Adept's Elixir (28103) + 33726, // Elixir of Mastery (28104) + 28490, // Elixir of Major Strength (22824) + 28491, // Elixir of Healing Power (22825) + 28493, // Elixir of Major Frost Power (22827) + 54494, // Elixir of Major Agility (22831) + 28501, // Elixir of Major Firepower (22833) + 28503,// Elixir of Major Shadow Power (22835) + 38954, // Fel Strength Elixir (31679) + // Guardian Elixirs + 39625, // Elixir of Major Fortitude (32062) + 39626, // Earthen Elixir (32063) + 39627, // Elixir of Draenic Wisdom (32067) + 39628, // Elixir of Ironskin (32068) + 28502, // Elixir of Major Defense (22834) + 28514, // Elixir of Empowerment (22848) + // Other + 28489, // Elixir of Camouflage (22823) + 28496 // Elixir of the Searching Eye (22830) + }; + + Unit* target = GetCaster(); - void SecondaryEffect() + if (target->GetPowerType() == POWER_MANA) + availableElixirs.push_back(28509); // Elixir of Major Mageblood (22840) + + uint32 chosenElixir = Trinity::Containers::SelectRandomContainerElement(availableElixirs); + + bool useElixir = true; + + SpellGroup chosenSpellGroup = SPELL_GROUP_NONE; + if (sSpellMgr->IsSpellMemberOfSpellGroup(chosenElixir, SPELL_GROUP_ELIXIR_BATTLE)) + chosenSpellGroup = SPELL_GROUP_ELIXIR_BATTLE; + if (sSpellMgr->IsSpellMemberOfSpellGroup(chosenElixir, SPELL_GROUP_ELIXIR_GUARDIAN)) + chosenSpellGroup = SPELL_GROUP_ELIXIR_GUARDIAN; + // If another spell of the same group is already active the elixir should not be cast + if (chosenSpellGroup != SPELL_GROUP_NONE) { - std::vector<uint32> availableElixirs = + Unit::AuraApplicationMap const& auraMap = target->GetAppliedAuras(); + for (auto itr = auraMap.begin(); itr != auraMap.end(); ++itr) { - // Battle Elixirs - 33720, // Onslaught Elixir (28102) - 54452, // Adept's Elixir (28103) - 33726, // Elixir of Mastery (28104) - 28490, // Elixir of Major Strength (22824) - 28491, // Elixir of Healing Power (22825) - 28493, // Elixir of Major Frost Power (22827) - 54494, // Elixir of Major Agility (22831) - 28501, // Elixir of Major Firepower (22833) - 28503,// Elixir of Major Shadow Power (22835) - 38954, // Fel Strength Elixir (31679) - // Guardian Elixirs - 39625, // Elixir of Major Fortitude (32062) - 39626, // Earthen Elixir (32063) - 39627, // Elixir of Draenic Wisdom (32067) - 39628, // Elixir of Ironskin (32068) - 28502, // Elixir of Major Defense (22834) - 28514, // Elixir of Empowerment (22848) - // Other - 28489, // Elixir of Camouflage (22823) - 28496 // Elixir of the Searching Eye (22830) - }; - - Unit* target = GetCaster(); - - if (target->GetPowerType() == POWER_MANA) - availableElixirs.push_back(28509); // Elixir of Major Mageblood (22840) - - uint32 chosenElixir = Trinity::Containers::SelectRandomContainerElement(availableElixirs); - - bool useElixir = true; - - SpellGroup chosenSpellGroup = SPELL_GROUP_NONE; - if (sSpellMgr->IsSpellMemberOfSpellGroup(chosenElixir, SPELL_GROUP_ELIXIR_BATTLE)) - chosenSpellGroup = SPELL_GROUP_ELIXIR_BATTLE; - if (sSpellMgr->IsSpellMemberOfSpellGroup(chosenElixir, SPELL_GROUP_ELIXIR_GUARDIAN)) - chosenSpellGroup = SPELL_GROUP_ELIXIR_GUARDIAN; - // If another spell of the same group is already active the elixir should not be cast - if (chosenSpellGroup != SPELL_GROUP_NONE) - { - Unit::AuraApplicationMap const& auraMap = target->GetAppliedAuras(); - for (auto itr = auraMap.begin(); itr != auraMap.end(); ++itr) + uint32 spellId = itr->second->GetBase()->GetId(); + if (sSpellMgr->IsSpellMemberOfSpellGroup(spellId, chosenSpellGroup) && spellId != chosenElixir) { - uint32 spellId = itr->second->GetBase()->GetId(); - if (sSpellMgr->IsSpellMemberOfSpellGroup(spellId, chosenSpellGroup) && spellId != chosenElixir) - { - useElixir = false; - break; - } + useElixir = false; + break; } } - - if (useElixir) - target->CastSpell(target, chosenElixir, true, GetCastItem()); - } - - void Register() override - { - AfterCast += SpellCastFn(mad_alchemists_potion_SpellScript::SecondaryEffect); } - }; + if (useElixir) + target->CastSpell(target, chosenElixir, true, GetCastItem()); + } - SpellScript* GetSpellScript() const override + void Register() override { - return new mad_alchemists_potion_SpellScript(); + AfterCast += SpellCastFn(spell_item_mad_alchemists_potion::SecondaryEffect); } }; // 53750 - Crazy Alchemist's Potion (40077) -class spell_item_crazy_alchemists_potion : public SpellScriptLoader +class spell_item_crazy_alchemists_potion : public SpellScript { -public: - spell_item_crazy_alchemists_potion() : SpellScriptLoader("spell_item_crazy_alchemists_potion") {} + PrepareSpellScript(spell_item_crazy_alchemists_potion); - class crazy_alchemists_potion_SpellScript : public SpellScript + void SecondaryEffect() { - PrepareSpellScript(crazy_alchemists_potion_SpellScript); + std::vector<uint32> availableElixirs = + { + 43185, // Runic Healing Potion (33447) + 53750, // Crazy Alchemist's Potion (40077) + 53761, // Powerful Rejuvenation Potion (40087) + 53762, // Indestructible Potion (40093) + 53908, // Potion of Speed (40211) + 53909, // Potion of Wild Magic (40212) + 53910, // Mighty Arcane Protection Potion (40213) + 53911, // Mighty Fire Protection Potion (40214) + 53913, // Mighty Frost Protection Potion (40215) + 53914, // Mighty Nature Protection Potion (40216) + 53915 // Mighty Shadow Protection Potion (40217) + }; - void SecondaryEffect() - { - std::vector<uint32> availableElixirs = - { - 43185, // Runic Healing Potion (33447) - 53750, // Crazy Alchemist's Potion (40077) - 53761, // Powerful Rejuvenation Potion (40087) - 53762, // Indestructible Potion (40093) - 53908, // Potion of Speed (40211) - 53909, // Potion of Wild Magic (40212) - 53910, // Mighty Arcane Protection Potion (40213) - 53911, // Mighty Fire Protection Potion (40214) - 53913, // Mighty Frost Protection Potion (40215) - 53914, // Mighty Nature Protection Potion (40216) - 53915 // Mighty Shadow Protection Potion (40217) - }; - - Unit* target = GetCaster(); - - if (!target->IsInCombat()) - availableElixirs.push_back(53753); // Potion of Nightmares (40081) - if (target->GetPowerType() == POWER_MANA) - availableElixirs.push_back(43186); // Runic Mana Potion(33448) - - uint32 chosenElixir = Trinity::Containers::SelectRandomContainerElement(availableElixirs); + Unit* target = GetCaster(); - target->CastSpell(target, chosenElixir, true, GetCastItem()); - } + if (!target->IsInCombat()) + availableElixirs.push_back(53753); // Potion of Nightmares (40081) + if (target->GetPowerType() == POWER_MANA) + availableElixirs.push_back(43186); // Runic Mana Potion(33448) - void Register() override - { - AfterCast += SpellCastFn(crazy_alchemists_potion_SpellScript::SecondaryEffect); - } + uint32 chosenElixir = Trinity::Containers::SelectRandomContainerElement(availableElixirs); - }; + target->CastSpell(target, chosenElixir, true, GetCastItem()); + } - SpellScript* GetSpellScript() const override + void Register() override { - return new crazy_alchemists_potion_SpellScript(); + AfterCast += SpellCastFn(spell_item_crazy_alchemists_potion::SecondaryEffect); } }; @@ -4905,116 +3985,116 @@ void AddSC_item_spell_scripts() // 23075 Mithril Mechanical Dragonling new spell_item_trigger_spell("spell_item_mithril_mechanical_dragonling", SPELL_MITHRIL_MECHANICAL_DRAGONLING); - new spell_item_aegis_of_preservation(); - new spell_item_arcane_shroud(); - new spell_item_alchemist_stone(); + RegisterAuraScript(spell_item_aegis_of_preservation); + RegisterAuraScript(spell_item_alchemist_stone); new spell_item_anger_capacitor<8>("spell_item_tiny_abomination_in_a_jar"); new spell_item_anger_capacitor<7>("spell_item_tiny_abomination_in_a_jar_hero"); - new spell_item_aura_of_madness(); - new spell_item_dementia(); - new spell_item_blessing_of_ancient_kings(); - new spell_item_deadly_precision(); - new spell_item_deadly_precision_dummy(); + RegisterAuraScript(spell_item_arcane_shroud); + RegisterAuraScript(spell_item_aura_of_madness); + RegisterAuraScript(spell_item_dementia); + RegisterAuraScript(spell_item_blessing_of_ancient_kings); + RegisterAuraScript(spell_item_deadly_precision); + RegisterSpellScript(spell_item_deadly_precision_dummy); new spell_item_deathbringers_will<SPELL_STRENGTH_OF_THE_TAUNKA, SPELL_AGILITY_OF_THE_VRYKUL, SPELL_POWER_OF_THE_TAUNKA, SPELL_AIM_OF_THE_IRON_DWARVES, SPELL_SPEED_OF_THE_VRYKUL>("spell_item_deathbringers_will_normal"); new spell_item_deathbringers_will<SPELL_STRENGTH_OF_THE_TAUNKA_HERO, SPELL_AGILITY_OF_THE_VRYKUL_HERO, SPELL_POWER_OF_THE_TAUNKA_HERO, SPELL_AIM_OF_THE_IRON_DWARVES_HERO, SPELL_SPEED_OF_THE_VRYKUL_HERO>("spell_item_deathbringers_will_heroic"); - new spell_item_decahedral_dwarven_dice(); + RegisterSpellScript(spell_item_decahedral_dwarven_dice); new spell_item_defibrillate("spell_item_goblin_jumper_cables", 67, SPELL_GOBLIN_JUMPER_CABLES_FAIL); new spell_item_defibrillate("spell_item_goblin_jumper_cables_xl", 50, SPELL_GOBLIN_JUMPER_CABLES_XL_FAIL); new spell_item_defibrillate("spell_item_gnomish_army_knife", 33); - new spell_item_desperate_defense(); - new spell_item_deviate_fish(); - new spell_item_discerning_eye_beast_dummy(); - new spell_item_echoes_of_light(); - new spell_item_fate_rune_of_unsurpassed_vigor(); - new spell_item_flask_of_the_north(); - new spell_item_frozen_shadoweave(); - new spell_item_gnomish_death_ray(); - new spell_item_harm_prevention_belt(); + RegisterAuraScript(spell_item_desperate_defense); + RegisterSpellScript(spell_item_deviate_fish); + RegisterAuraScript(spell_item_discerning_eye_beast_dummy); + RegisterSpellScript(spell_item_echoes_of_light); + RegisterAuraScript(spell_item_fate_rune_of_unsurpassed_vigor); + RegisterSpellScript(spell_item_flask_of_the_north); + RegisterAuraScript(spell_item_frozen_shadoweave); + RegisterSpellScript(spell_item_gnomish_death_ray); + RegisterAuraScript(spell_item_harm_prevention_belt); new spell_item_heartpierce<SPELL_INVIGORATION_ENERGY, SPELL_INVIGORATION_MANA, SPELL_INVIGORATION_RAGE, SPELL_INVIGORATION_RP>("spell_item_heartpierce"); new spell_item_heartpierce<SPELL_INVIGORATION_ENERGY_HERO, SPELL_INVIGORATION_MANA_HERO, SPELL_INVIGORATION_RAGE_HERO, SPELL_INVIGORATION_RP_HERO>("spell_item_heartpierce_hero"); - new spell_item_crystal_spire_of_karabor(); - new spell_item_make_a_wish(); - new spell_item_mark_of_conquest(); - new spell_item_mingos_fortune_generator(); - new spell_item_necrotic_touch(); - new spell_item_net_o_matic(); - new spell_item_noggenfogger_elixir(); - new spell_item_pendant_of_the_violet_eye(); - new spell_item_persistent_shield(); - new spell_item_pet_healing(); - new spell_item_piccolo_of_the_flaming_fire(); - new spell_item_savory_deviate_delight(); - new spell_item_scroll_of_recall(); - new spell_item_unsated_craving(); - new spell_item_shadows_fate(); - new spell_item_shadowmourne(); - new spell_item_shadowmourne_soul_fragment(); - new spell_item_six_demon_bag(); - new spell_item_swift_hand_justice_dummy(); - new spell_item_the_eye_of_diminution(); - new spell_item_underbelly_elixir(); - new spell_item_wormhole_pandaria(); - new spell_item_worn_troll_dice(); - new spell_item_red_rider_air_rifle(); - - new spell_item_create_heart_candy(); - new spell_item_book_of_glyph_mastery(); - new spell_item_gift_of_the_harvester(); - new spell_item_map_of_the_geyser_fields(); - new spell_item_vanquished_clutches(); - - new spell_item_ashbringer(); - new spell_magic_eater_food(); - new spell_item_shimmering_vessel(); - new spell_item_purify_helboar_meat(); - new spell_item_crystal_prison_dummy_dnd(); - new spell_item_reindeer_transformation(); - new spell_item_nigh_invulnerability(); - new spell_item_poultryizer(); - new spell_item_socrethars_stone(); - new spell_item_demon_broiled_surprise(); - new spell_item_complete_raptor_capture(); - new spell_item_impale_leviroth(); - new spell_item_brewfest_mount_transformation(); - new spell_item_nitro_boosts(); - new spell_item_nitro_boosts_backfire(); + RegisterAuraScript(spell_item_crystal_spire_of_karabor); + RegisterSpellScript(spell_item_make_a_wish); + RegisterAuraScript(spell_item_mark_of_conquest); + RegisterSpellScript(spell_item_mingos_fortune_generator); + RegisterAuraScript(spell_item_necrotic_touch); + RegisterSpellScript(spell_item_net_o_matic); + RegisterSpellScript(spell_item_noggenfogger_elixir); + RegisterAuraScript(spell_item_pendant_of_the_violet_eye); + RegisterAuraScript(spell_item_persistent_shield); + RegisterAuraScript(spell_item_pet_healing); + RegisterSpellScript(spell_item_piccolo_of_the_flaming_fire); + RegisterSpellScript(spell_item_savory_deviate_delight); + RegisterSpellScript(spell_item_scroll_of_recall); + RegisterAuraScript(spell_item_unsated_craving); + RegisterAuraScript(spell_item_shadows_fate); + RegisterAuraScript(spell_item_shadowmourne); + RegisterAuraScript(spell_item_shadowmourne_soul_fragment); + RegisterSpellScript(spell_item_six_demon_bag); + RegisterAuraScript(spell_item_swift_hand_justice_dummy); + RegisterAuraScript(spell_item_the_eye_of_diminution); + RegisterSpellScript(spell_item_underbelly_elixir); + RegisterSpellScript(spell_item_wormhole_pandaria); + RegisterSpellScript(spell_item_worn_troll_dice); + RegisterSpellScript(spell_item_red_rider_air_rifle); + + RegisterSpellScript(spell_item_create_heart_candy); + RegisterSpellScript(spell_item_book_of_glyph_mastery); + RegisterSpellScript(spell_item_gift_of_the_harvester); + RegisterSpellScript(spell_item_map_of_the_geyser_fields); + RegisterSpellScript(spell_item_vanquished_clutches); + + RegisterSpellScript(spell_item_ashbringer); + RegisterAuraScript(spell_magic_eater_food); + RegisterSpellScript(spell_item_shimmering_vessel); + RegisterSpellScript(spell_item_purify_helboar_meat); + RegisterSpellScript(spell_item_crystal_prison_dummy_dnd); + RegisterSpellScript(spell_item_reindeer_transformation); + RegisterSpellScript(spell_item_nigh_invulnerability); + RegisterSpellScript(spell_item_poultryizer); + RegisterSpellScript(spell_item_socrethars_stone); + RegisterSpellScript(spell_item_demon_broiled_surprise); + RegisterSpellScript(spell_item_complete_raptor_capture); + RegisterSpellScript(spell_item_impale_leviroth); + RegisterSpellScript(spell_item_brewfest_mount_transformation); + RegisterSpellScript(spell_item_nitro_boosts); + RegisterAuraScript(spell_item_nitro_boosts_backfire); RegisterSpellScript(spell_item_teach_language); - new spell_item_rocket_boots(); - new spell_item_pygmy_oil(); - new spell_item_unusual_compass(); - new spell_item_chicken_cover(); - new spell_item_muisek_vessel(); - new spell_item_greatmothers_soulcatcher(); + RegisterSpellScript(spell_item_rocket_boots); + RegisterSpellScript(spell_item_pygmy_oil); + RegisterSpellScript(spell_item_unusual_compass); + RegisterSpellScript(spell_item_chicken_cover); + RegisterSpellScript(spell_item_muisek_vessel); + RegisterSpellScript(spell_item_greatmothers_soulcatcher); new spell_item_shard_of_the_scale<SPELL_PURIFIED_CAUTERIZING_HEAL, SPELL_PURIFIED_SEARING_FLAMES>("spell_item_purified_shard_of_the_scale"); new spell_item_shard_of_the_scale<SPELL_SHINY_CAUTERIZING_HEAL, SPELL_SHINY_SEARING_FLAMES>("spell_item_shiny_shard_of_the_scale"); - new spell_item_soul_preserver(); + RegisterAuraScript(spell_item_soul_preserver); new spell_item_sunwell_neck<SPELL_LIGHTS_WRATH, SPELL_ARCANE_BOLT>("spell_item_sunwell_exalted_caster_neck"); new spell_item_sunwell_neck<SPELL_LIGHTS_STRENGTH, SPELL_ARCANE_STRIKE>("spell_item_sunwell_exalted_melee_neck"); new spell_item_sunwell_neck<SPELL_LIGHTS_WARD, SPELL_ARCANE_INSIGHT>("spell_item_sunwell_exalted_tank_neck"); new spell_item_sunwell_neck<SPELL_LIGHTS_SALVATION, SPELL_ARCANE_SURGE>("spell_item_sunwell_exalted_healer_neck"); - new spell_item_toy_train_set_pulse(); - new spell_item_death_choice(); + RegisterSpellScript(spell_item_toy_train_set_pulse); + RegisterAuraScript(spell_item_death_choice); new spell_item_trinket_stack("spell_item_lightning_capacitor", SPELL_LIGHTNING_CAPACITOR_STACK, SPELL_LIGHTNING_CAPACITOR_TRIGGER); new spell_item_trinket_stack("spell_item_thunder_capacitor", SPELL_THUNDER_CAPACITOR_STACK, SPELL_THUNDER_CAPACITOR_TRIGGER); new spell_item_trinket_stack("spell_item_toc25_normal_caster_trinket", SPELL_TOC25_CASTER_TRINKET_NORMAL_STACK, SPELL_TOC25_CASTER_TRINKET_NORMAL_TRIGGER); new spell_item_trinket_stack("spell_item_toc25_heroic_caster_trinket", SPELL_TOC25_CASTER_TRINKET_HEROIC_STACK, SPELL_TOC25_CASTER_TRINKET_HEROIC_TRIGGER); - new spell_item_darkmoon_card_greatness(); - new spell_item_mana_drain(); - new spell_item_taunt_flag_targeting(); - new spell_item_mind_control_cap(); - new spell_item_universal_remote(); + RegisterAuraScript(spell_item_darkmoon_card_greatness); + RegisterAuraScript(spell_item_mana_drain); + RegisterSpellScript(spell_item_taunt_flag_targeting); + RegisterSpellScript(spell_item_mind_control_cap); + RegisterSpellScript(spell_item_universal_remote); new spell_item_zandalarian_charm("spell_item_unstable_power", SPELL_UNSTABLE_POWER_AURA_STACK); new spell_item_zandalarian_charm("spell_item_restless_strength", SPELL_RESTLESS_STRENGTH_AURA_STACK); - new spell_item_artifical_stamina(); - new spell_item_artifical_damage(); - new spell_item_talisman_of_ascendance(); - new spell_item_battle_trance(); - new spell_item_world_queller_focus(); - new spell_item_water_strider(); - new spell_item_brutal_kinship(); - - new spell_item_mad_alchemists_potion(); - new spell_item_crazy_alchemists_potion(); + RegisterAuraScript(spell_item_artifical_stamina); + RegisterAuraScript(spell_item_artifical_damage); + RegisterAuraScript(spell_item_talisman_of_ascendance); + RegisterAuraScript(spell_item_battle_trance); + RegisterAuraScript(spell_item_world_queller_focus); + RegisterAuraScript(spell_item_water_strider); + RegisterAuraScript(spell_item_brutal_kinship); + + RegisterSpellScript(spell_item_mad_alchemists_potion); + RegisterSpellScript(spell_item_crazy_alchemists_potion); RegisterAuraScript(spell_item_heart_of_azeroth); } |
