diff options
| author | ariel- <ariel-@users.noreply.github.com> | 2017-12-15 00:14:55 -0300 |
|---|---|---|
| committer | funjoker <funjoker109@gmail.com> | 2021-03-15 20:17:31 +0100 |
| commit | 44c8ccadd701c1a4bc0ce08ee53a7a7ba55289d4 (patch) | |
| tree | 51509fbe5b77c2b6abfadc53e4caf19c9ae71000 /src/server/scripts/Spells | |
| parent | d9b145615dd2bafe1ae74e6dc11c9b86a0fb6f28 (diff) | |
Core/Auras: periodics refactor part 5: ported periodic trigger spell auras to scripts
(cherry picked from commit a36e804ae4639be40be17282e6c79fad9a769517)
Diffstat (limited to 'src/server/scripts/Spells')
| -rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 79 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_item.cpp | 66 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_shaman.cpp | 21 |
3 files changed, 166 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index d3a080b2c74..3695e39a40d 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1791,6 +1791,29 @@ class spell_gen_moss_covered_feet : public AuraScript } }; +// 46284 - Negative Energy Periodic +class spell_gen_negative_energy_periodic : public AuraScript +{ + PrepareAuraScript(spell_gen_negative_energy_periodic); + + bool Validate(SpellInfo const* spellInfo) override + { + return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0)->TriggerSpell }); + } + + void PeriodicTick(AuraEffect const* aurEff) + { + PreventDefaultAction(); + + GetTarget()->CastCustomSpell(GetSpellInfo()->GetEffect(aurEff->GetEffIndex())->TriggerSpell, SPELLVALUE_MAX_TARGETS, aurEff->GetTickNumber() / 10 + 1, nullptr, true, nullptr, aurEff); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_negative_energy_periodic::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } +}; + enum Netherbloom : uint32 { SPELL_NETHERBLOOM_POLLEN_1 = 28703 @@ -1872,6 +1895,27 @@ class spell_gen_nightmare_vine : public SpellScript } }; +// 27746 - Nitrous Boost +class spell_gen_nitrous_boost : public AuraScript +{ + PrepareAuraScript(spell_gen_nitrous_boost); + + void PeriodicTick(AuraEffect const* /*aurEff*/) + { + PreventDefaultAction(); + + if (GetCaster() && GetTarget()->GetPower(POWER_MANA) >= 10) + GetTarget()->ModifyPower(POWER_MANA, -10); + else + Remove(); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_nitrous_boost::PeriodicTick, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } +}; + enum ObsidianArmor { SPELL_GEN_OBSIDIAN_ARMOR_HOLY = 27536, @@ -2264,6 +2308,38 @@ class spell_gen_remove_flight_auras : public SpellScript } }; +// 23493 - Restoration +// 24379 - Restoration +class spell_gen_restoration : public AuraScript +{ + PrepareAuraScript(spell_gen_restoration); + + void PeriodicTick(AuraEffect const* /*aurEff*/) + { + PreventDefaultAction(); + + Unit* caster = GetCaster(); + if (!caster) + return; + + int32 heal = caster->CountPctFromMaxHealth(10); + HealInfo healInfo(caster, GetTarget(), heal, GetSpellInfo(), GetSpellInfo()->GetSchoolMask()); + caster->HealBySpell(healInfo); + + /// @todo: should proc other auras? + if (int32 mana = caster->GetMaxPower(POWER_MANA)) + { + mana /= 10; + caster->EnergizeBySpell(caster, GetId(), mana, POWER_MANA); + } + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_restoration::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } +}; + // 38772 Grievous Wound // 43937 Grievous Wound // 62331 Impale @@ -3819,8 +3895,10 @@ void AddSC_generic_spell_scripts() new spell_gen_lifebloom("spell_faction_champion_dru_lifebloom", SPELL_FACTION_CHAMPIONS_DRU_LIFEBLOOM_FINAL_HEAL); RegisterSpellScript(spell_gen_mounted_charge); RegisterAuraScript(spell_gen_moss_covered_feet); + RegisterAuraScript(spell_gen_negative_energy_periodic); RegisterSpellScript(spell_gen_netherbloom); RegisterSpellScript(spell_gen_nightmare_vine); + RegisterAuraScript(spell_gen_nitrous_boost); RegisterAuraScript(spell_gen_obsidian_armor); RegisterSpellScript(spell_gen_oracle_wolvar_reputation); RegisterSpellScript(spell_gen_orc_disguise); @@ -3836,6 +3914,7 @@ void AddSC_generic_spell_scripts() RegisterSpellScript(spell_gen_profession_research); RegisterSpellScript(spell_gen_pvp_trinket); RegisterSpellScript(spell_gen_remove_flight_auras); + RegisterAuraScript(spell_gen_restoration); RegisterSpellAndAuraScriptPair(spell_gen_replenishment, spell_gen_replenishment_aura); // Running Wild RegisterSpellAndAuraScriptPair(spell_gen_running_wild, spell_gen_running_wild_aura); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index c19cd6e1657..3fff26738fe 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -28,6 +28,7 @@ #include "DB2Stores.h" #include "Item.h" #include "Log.h" +#include "LootMgr.h" #include "Map.h" #include "ObjectMgr.h" #include "Player.h" @@ -109,6 +110,38 @@ class spell_item_aegis_of_preservation : public AuraScript } }; +enum ZezzaksShard +{ + SPELL_EYE_OF_GRILLOK = 38495 +}; + +// 38554 - Absorb Eye of Grillok (31463: Zezzak's Shard) +class spell_item_absorb_eye_of_grillok : public AuraScript +{ + PrepareAuraScript(spell_item_absorb_eye_of_grillok); + + bool Validate(SpellInfo const* /*spellInfo*/) + { + return ValidateSpellInfo({ SPELL_EYE_OF_GRILLOK }); + } + + void PeriodicTick(AuraEffect const* aurEff) + { + PreventDefaultAction(); + + if (!GetCaster() || GetTarget()->GetTypeId() != TYPEID_UNIT) + return; + + GetCaster()->CastSpell(GetCaster(), SPELL_EYE_OF_GRILLOK, true, nullptr, aurEff); + GetTarget()->ToCreature()->DespawnOrUnsummon(); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_item_absorb_eye_of_grillok::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } +}; + enum AlchemistStone { SPELL_ALCHEMIST_STONE_EXTRA_HEAL = 21399, @@ -758,6 +791,37 @@ class spell_item_echoes_of_light : public SpellScript } }; +// 30427 - Extract Gas (23821: Zapthrottle Mote Extractor) +class spell_item_extract_gas : public AuraScript +{ + PrepareAuraScript(spell_item_extract_gas); + + void PeriodicTick(AuraEffect const* aurEff) + { + PreventDefaultAction(); + + // move loot to player inventory and despawn target + if (GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER && + GetTarget()->GetTypeId() == TYPEID_UNIT && + GetTarget()->ToCreature()->GetCreatureTemplate()->type == CREATURE_TYPE_GAS_CLOUD) + { + Player* player = GetCaster()->ToPlayer(); + Creature* creature = GetTarget()->ToCreature(); + // missing lootid has been reported on startup - just return + if (!creature->GetCreatureTemplate()->SkinLootId) + return; + + player->AutoStoreLoot(creature->GetCreatureTemplate()->SkinLootId, LootTemplates_Skinning, ItemContext::NONE, true); + creature->DespawnOrUnsummon(); + } + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_item_extract_gas::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } +}; + // 7434 - Fate Rune of Unsurpassed Vigor enum FateRuneOfUnsurpassedVigor { @@ -3986,6 +4050,7 @@ void AddSC_item_spell_scripts() new spell_item_trigger_spell("spell_item_mithril_mechanical_dragonling", SPELL_MITHRIL_MECHANICAL_DRAGONLING); RegisterAuraScript(spell_item_aegis_of_preservation); + RegisterAuraScript(spell_item_absorb_eye_of_grillok); 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"); @@ -4005,6 +4070,7 @@ void AddSC_item_spell_scripts() RegisterSpellScript(spell_item_deviate_fish); RegisterAuraScript(spell_item_discerning_eye_beast_dummy); RegisterSpellScript(spell_item_echoes_of_light); + RegisterAuraScript(spell_item_extract_gas); RegisterAuraScript(spell_item_fate_rune_of_unsurpassed_vigor); RegisterSpellScript(spell_item_flask_of_the_north); RegisterAuraScript(spell_item_frozen_shadoweave); diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index ff962ece703..48fda95f406 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -1036,6 +1036,26 @@ class spell_sha_t3_6p_bonus : public SpellScriptLoader } }; +// 28820 - Lightning Shield +class spell_sha_t3_8p_bonus : public AuraScript +{ + PrepareAuraScript(spell_sha_t3_8p_bonus); + + void PeriodicTick(AuraEffect const* /*aurEff*/) + { + PreventDefaultAction(); + + // Need remove self if Lightning Shield not active + if (!GetTarget()->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN, flag128(0x400), GetCaster()->GetGUID())) + Remove(); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_sha_t3_8p_bonus::PeriodicTick, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } +}; + // 64928 - Item - Shaman T8 Elemental 4P Bonus class spell_sha_t8_elemental_4p_bonus : public SpellScriptLoader { @@ -1282,6 +1302,7 @@ void AddSC_shaman_spell_scripts() new spell_sha_path_of_flames_spread(); new spell_sha_tidal_waves(); new spell_sha_t3_6p_bonus(); + RegisterAuraScript(spell_sha_t3_8p_bonus); new spell_sha_t8_elemental_4p_bonus(); new spell_sha_t9_elemental_4p_bonus(); new spell_sha_t10_elemental_4p_bonus(); |
