aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Spells
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2017-12-15 00:14:55 -0300
committerariel- <ariel-@users.noreply.github.com>2017-12-15 01:46:52 -0300
commita36e804ae4639be40be17282e6c79fad9a769517 (patch)
treeddd718a5dee49d189de257cbd2748f6474e4b914 /src/server/scripts/Spells
parent193bd3b45264326011814a5ee7694b9bbe13eb75 (diff)
Core/Auras: periodics refactor part 5: ported periodic trigger spell auras to scripts
Diffstat (limited to 'src/server/scripts/Spells')
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp79
-rw-r--r--src/server/scripts/Spells/spell_item.cpp66
-rw-r--r--src/server/scripts/Spells/spell_paladin.cpp25
-rw-r--r--src/server/scripts/Spells/spell_shaman.cpp45
4 files changed, 215 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index bc3ce8a88a7..fc24a7221ee 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -1980,6 +1980,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->Effects[EFFECT_0].TriggerSpell });
+ }
+
+ void PeriodicTick(AuraEffect const* aurEff)
+ {
+ PreventDefaultAction();
+
+ GetTarget()->CastCustomSpell(GetSpellInfo()->Effects[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
@@ -2061,6 +2084,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,
@@ -2454,6 +2498,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
@@ -3707,8 +3783,10 @@ void AddSC_generic_spell_scripts()
new spell_gen_mount("spell_x53_touring_rocket", 0, 0, 0, SPELL_X53_TOURING_ROCKET_150, SPELL_X53_TOURING_ROCKET_280, SPELL_X53_TOURING_ROCKET_310);
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);
RegisterAuraScript(spell_gen_one_tick_dummy);
RegisterSpellScript(spell_gen_oracle_wolvar_reputation);
@@ -3725,6 +3803,7 @@ void AddSC_generic_spell_scripts()
RegisterSpellScript(spell_gen_pet_summoned);
RegisterSpellScript(spell_gen_profession_research);
RegisterSpellScript(spell_gen_remove_flight_auras);
+ RegisterAuraScript(spell_gen_restoration);
RegisterSpellAndAuraScriptPair(spell_gen_replenishment, spell_gen_replenishment_aura);
RegisterAuraScript(spell_gen_remove_on_health_pct);
RegisterAuraScript(spell_gen_remove_on_full_health);
diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp
index e78bd3804be..5399a91830e 100644
--- a/src/server/scripts/Spells/spell_item.cpp
+++ b/src/server/scripts/Spells/spell_item.cpp
@@ -27,6 +27,7 @@
#include "Creature.h"
#include "CreatureAIImpl.h"
#include "DBCStores.h"
+#include "LootMgr.h"
#include "Map.h"
#include "ObjectMgr.h"
#include "Player.h"
@@ -106,6 +107,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_ALCHEMISTS_STONE_EXTRA_HEAL = 21399,
@@ -759,6 +792,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, 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
{
@@ -3808,6 +3872,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_alchemists_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");
@@ -3827,6 +3892,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_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp
index 28455808c01..d3d1ed57ccf 100644
--- a/src/server/scripts/Spells/spell_paladin.cpp
+++ b/src/server/scripts/Spells/spell_paladin.cpp
@@ -335,6 +335,30 @@ class spell_pal_avenging_wrath : public SpellScriptLoader
}
};
+// 53563 - Beacon of Light
+class spell_pal_beacon_of_light : public AuraScript
+{
+ PrepareAuraScript(spell_pal_beacon_of_light);
+
+ bool Validate(SpellInfo const* spellInfo) override
+ {
+ return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell });
+ }
+
+ void PeriodicTick(AuraEffect const* aurEff)
+ {
+ PreventDefaultAction();
+
+ // area aura owner casts the spell
+ GetAura()->GetUnitOwner()->CastSpell(GetTarget(), GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true, nullptr, aurEff, GetAura()->GetUnitOwner()->GetGUID());
+ }
+
+ void Register() override
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_pal_beacon_of_light::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
+ }
+};
+
// 37877 - Blessing of Faith
class spell_pal_blessing_of_faith : public SpellScriptLoader
{
@@ -2363,6 +2387,7 @@ void AddSC_paladin_spell_scripts()
new spell_pal_aura_mastery();
new spell_pal_aura_mastery_immune();
new spell_pal_avenging_wrath();
+ RegisterAuraScript(spell_pal_beacon_of_light);
new spell_pal_blessing_of_faith();
new spell_pal_blessing_of_sanctuary();
new spell_pal_divine_purpose();
diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp
index 4585f4435f4..c2ec92843ff 100644
--- a/src/server/scripts/Spells/spell_shaman.cpp
+++ b/src/server/scripts/Spells/spell_shaman.cpp
@@ -1544,6 +1544,29 @@ class spell_sha_mana_spring_totem : public SpellScriptLoader
}
};
+// 16191 - Mana Tide
+class spell_sha_mana_tide : public AuraScript
+{
+ PrepareAuraScript(spell_sha_mana_tide);
+
+ bool Validate(SpellInfo const* spellInfo) override
+ {
+ return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell });
+ }
+
+ void PeriodicTick(AuraEffect const* aurEff)
+ {
+ PreventDefaultAction();
+
+ GetTarget()->CastCustomSpell(GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), nullptr, true, nullptr, aurEff);
+ }
+
+ void Register() override
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_sha_mana_tide::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
+ }
+};
+
// 39610 - Mana Tide Totem
class spell_sha_mana_tide_totem : public SpellScriptLoader
{
@@ -1976,6 +1999,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, 0x400, 0, 0))
+ 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
{
@@ -2293,6 +2336,7 @@ void AddSC_shaman_spell_scripts()
new spell_sha_lightning_shield();
new spell_sha_maelstrom_weapon();
new spell_sha_mana_spring_totem();
+ RegisterAuraScript(spell_sha_mana_tide);
new spell_sha_mana_tide_totem();
new spell_sha_nature_guardian();
new spell_sha_sentry_totem();
@@ -2303,6 +2347,7 @@ void AddSC_shaman_spell_scripts()
new spell_sha_thunderstorm();
new spell_sha_totemic_mastery();
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();