diff options
| author | Sorikoff <46191832+Sorikoff@users.noreply.github.com> | 2019-04-16 07:49:39 +0000 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2021-11-30 22:30:53 +0100 |
| commit | d72e809ecf9349d45127e743d23a8391bddabc41 (patch) | |
| tree | 1a84e02130f5c4125e8e9bc75b5017f5785effdb /src/server/scripts/Spells | |
| parent | c19a4db1c12b8864d6c486ee8e2f0e058fb4155a (diff) | |
Scripts/Spells: Migrate Some Scripted Spells to Scripts (#23185)
* Migrate spells to scripts
* Simplify code
* I need to sleep
* Update chapter1.cpp
* Use actual damage
* No need in null check here
(cherry picked from commit 2cfaeb14004cfbb5500855472ad89ab9238df13d)
Diffstat (limited to 'src/server/scripts/Spells')
| -rw-r--r-- | src/server/scripts/Spells/spell_dk.cpp | 41 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 35 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_item.cpp | 68 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_quest.cpp | 29 |
4 files changed, 173 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 3f61ed7058c..bff1d8a1ba3 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -597,6 +597,46 @@ class spell_dk_ghoul_explode : public SpellScript } }; +// 69961 - Glyph of Scourge Strike +class spell_dk_glyph_of_scourge_strike_script : public SpellScript +{ + PrepareSpellScript(spell_dk_glyph_of_scourge_strike_script); + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + Unit* target = GetHitUnit(); + + Unit::AuraEffectList const& mPeriodic = target->GetAuraEffectsByType(SPELL_AURA_PERIODIC_DAMAGE); + for (Unit::AuraEffectList::const_iterator i = mPeriodic.begin(); i != mPeriodic.end(); ++i) + { + AuraEffect const* aurEff = *i; + SpellInfo const* spellInfo = aurEff->GetSpellInfo(); + // search our Blood Plague and Frost Fever on target + if (spellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && spellInfo->SpellFamilyFlags[2] & 0x2 && + aurEff->GetCasterGUID() == caster->GetGUID()) + { + uint32 countMin = aurEff->GetBase()->GetMaxDuration(); + uint32 countMax = spellInfo->GetMaxDuration(); + + // this Glyph + countMax += 9000; + + if (countMin < countMax) + { + aurEff->GetBase()->SetDuration(aurEff->GetBase()->GetDuration() + 3000); + aurEff->GetBase()->SetMaxDuration(countMin + 3000); + } + } + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_dk_glyph_of_scourge_strike_script::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + // 206940 - Mark of Blood class spell_dk_mark_of_blood : public AuraScript { @@ -789,6 +829,7 @@ void AddSC_deathknight_spell_scripts() RegisterAuraScript(spell_dk_death_strike_enabler); RegisterSpellScript(spell_dk_festering_strike); RegisterSpellScript(spell_dk_ghoul_explode); + RegisterSpellScript(spell_dk_glyph_of_scourge_strike_script); RegisterAuraScript(spell_dk_mark_of_blood); RegisterAuraScript(spell_dk_necrosis); RegisterSpellScript(spell_dk_pet_geist_transform); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 5c680852ab5..4d4d760fd68 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1657,6 +1657,23 @@ class spell_steal_essence_visual : public AuraScript } }; +// 46642 - 5,000 Gold +class spell_gen_5000_gold : public SpellScript +{ + PrepareSpellScript(spell_gen_5000_gold); + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Player* target = GetHitPlayer()) + target->ModifyMoney(5000 * GOLD); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_gen_5000_gold::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + enum FishingSpells { SPELL_FISHING_NO_FISHING_POLE = 131476, @@ -2635,6 +2652,22 @@ class spell_gen_remove_flight_auras : public SpellScript } }; +// 20589 - Escape artist +class spell_gen_remove_impairing_auras : public SpellScript +{ + PrepareSpellScript(spell_gen_remove_impairing_auras); + + void HandleScriptEffect(SpellEffIndex /* effIndex */) + { + GetHitUnit()->RemoveMovementImpairingAuras(true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_gen_remove_impairing_auras::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + // 23493 - Restoration // 24379 - Restoration class spell_gen_restoration : public AuraScript @@ -4438,6 +4471,7 @@ void AddSC_generic_spell_scripts() RegisterSpellScript(spell_ethereal_pet_onsummon); RegisterSpellScript(spell_ethereal_pet_aura_remove); RegisterAuraScript(spell_steal_essence_visual); + RegisterSpellScript(spell_gen_5000_gold); RegisterSpellScript(spell_gen_fishing); RegisterSpellScript(spell_gen_gadgetzan_transporter_backfire); RegisterAuraScript(spell_gen_gift_of_naaru); @@ -4475,6 +4509,7 @@ void AddSC_generic_spell_scripts() RegisterSpellScript(spell_gen_profession_research); RegisterSpellScript(spell_gen_pvp_trinket); RegisterSpellScript(spell_gen_remove_flight_auras); + RegisterSpellScript(spell_gen_remove_impairing_auras); RegisterAuraScript(spell_gen_restoration); RegisterSpellAndAuraScriptPair(spell_gen_replenishment, spell_gen_replenishment_aura); // Running Wild diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 37d2664ec72..db9a822dab8 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -651,6 +651,35 @@ class spell_item_decahedral_dwarven_dice : public SpellScript } }; +enum GoblinWeatherMachine +{ + SPELL_PERSONALIZED_WEATHER1 = 46740, + SPELL_PERSONALIZED_WEATHER2 = 46739, + SPELL_PERSONALIZED_WEATHER3 = 46738, + SPELL_PERSONALIZED_WEATHER4 = 46736 +}; + +// 46203 - Goblin Weather Machine +class spell_item_goblin_weather_machine : public SpellScript +{ + PrepareSpellScript(spell_item_goblin_weather_machine); + + void HandleScript(SpellEffIndex /* effIndex */) + { + Unit* target = GetHitUnit(); + + uint32 spellId = RAND(SPELL_PERSONALIZED_WEATHER1, SPELL_PERSONALIZED_WEATHER2, SPELL_PERSONALIZED_WEATHER3, + SPELL_PERSONALIZED_WEATHER4); + target->CastSpell(target, spellId, CastSpellExtraArgs(TRIGGERED_FULL_MASK) + .SetOriginalCastId(GetSpell()->m_castId)); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_goblin_weather_machine::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + // 8342 - Defibrillate (Goblin Jumper Cables) have 33% chance on success // 22999 - Defibrillate (Goblin Jumper Cables XL) have 50% chance on success // 54732 - Defibrillate (Gnomish Army Knife) have 67% chance on success @@ -3629,6 +3658,43 @@ class spell_item_taunt_flag_targeting : public SpellScript } }; +enum MirrensDrinkingHat +{ + ITEM_LOCH_MODAN_LAGER = 23584, + ITEM_STOUTHAMMER_LITE = 23585, + ITEM_AERIE_PEAK_PALE_ALE = 23586 +}; + +// 29830 - Mirren's Drinking Hat +class spell_item_mirrens_drinking_hat : public SpellScript +{ + PrepareSpellScript(spell_item_mirrens_drinking_hat); + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + uint32 itemId; + switch (urand(1, 6)) + { + case 1: + case 2: + case 3: + itemId = ITEM_LOCH_MODAN_LAGER; break; + case 4: + case 5: + itemId = ITEM_STOUTHAMMER_LITE; break; + case 6: + itemId = ITEM_AERIE_PEAK_PALE_ALE; break; + } + if (itemId) + CreateItem(itemId, ItemContext::NONE); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_mirrens_drinking_hat::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + // 13180 - Gnomish Mind Control Cap enum MindControlCap { @@ -4141,6 +4207,7 @@ void AddSC_item_spell_scripts() 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"); RegisterSpellScript(spell_item_decahedral_dwarven_dice); + RegisterSpellScript(spell_item_goblin_weather_machine); 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); @@ -4226,6 +4293,7 @@ void AddSC_item_spell_scripts() RegisterAuraScript(spell_item_darkmoon_card_greatness); RegisterAuraScript(spell_item_mana_drain); RegisterSpellScript(spell_item_taunt_flag_targeting); + RegisterSpellScript(spell_item_mirrens_drinking_hat); 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); diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index de570569a09..924024dbba5 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -87,6 +87,34 @@ class spell_q55_sacred_cleansing : public SpellScriptLoader } }; +enum BendingShinbone +{ + SPELL_BENDING_SHINBONE1 = 8854, + SPELL_BENDING_SHINBONE2 = 8855 +}; + +class spell_q1846_bending_shinbone : public SpellScript +{ + PrepareSpellScript(spell_q1846_bending_shinbone); + + void HandleScriptEffect(SpellEffIndex /* effIndex */) + { + Item* target = GetHitItem(); + Unit* caster = GetCaster(); + if (!target && caster->GetTypeId() != TYPEID_PLAYER) + return; + + uint32 const spellId = roll_chance_i(20) ? SPELL_BENDING_SHINBONE1 : SPELL_BENDING_SHINBONE2; + caster->CastSpell(caster, spellId, CastSpellExtraArgs(TRIGGERED_FULL_MASK) + .SetOriginalCastId(GetSpell()->m_castId)); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_q1846_bending_shinbone::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + // 9712 - Thaumaturgy Channel enum ThaumaturgyChannel { @@ -2979,6 +3007,7 @@ class spell_q14386_call_attack_mastiffs : public SpellScript void AddSC_quest_spell_scripts() { new spell_q55_sacred_cleansing(); + RegisterSpellScript(spell_q1846_bending_shinbone); new spell_q2203_thaumaturgy_channel(); new spell_q5206_test_fetid_skull(); new spell_q6124_6129_apply_salve(); |
