Core/Auras: periodics refactor part 5: ported periodic trigger spell auras to scripts
Port From (https://github.com/TrinityCore/TrinityCore/commit/44c8ccadd701c1a4bc0ce08ee53a7a7ba55289d4)
This commit is contained in:
@@ -338,6 +338,7 @@ namespace Scripts.Spells.Generic
|
||||
public const uint ChampionAlliance = 2782;
|
||||
public const uint ChampionHorde = 2788;
|
||||
}
|
||||
|
||||
struct QuestIds
|
||||
{
|
||||
//TournamentQuests
|
||||
@@ -928,8 +929,8 @@ namespace Scripts.Spells.Generic
|
||||
OnEffectUpdatePeriodic.Add(new EffectUpdatePeriodicHandler(UpdatePeriodic, 1, AuraType.PeriodicDummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
|
||||
[Script]
|
||||
class spell_gen_chaos_blast : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
@@ -1689,6 +1690,27 @@ namespace Scripts.Spells.Generic
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 46284 - Negative Energy Periodic
|
||||
class spell_gen_negative_energy_periodic : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(spellInfo.GetEffect(0).TriggerSpell);
|
||||
}
|
||||
|
||||
void PeriodicTick(AuraEffect aurEff)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
GetTarget().CastCustomSpell(GetSpellInfo().GetEffect(aurEff.GetEffIndex()).TriggerSpell, SpellValueMod.MaxTargets, (int)(aurEff.GetTickNumber() / 10 + 1), null, true, null, aurEff);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 0, AuraType.PeriodicTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 28702 - Netherbloom
|
||||
class spell_gen_netherbloom : SpellScript
|
||||
{
|
||||
@@ -1730,7 +1752,7 @@ namespace Scripts.Spells.Generic
|
||||
}
|
||||
}
|
||||
|
||||
// 28720 - Nightmare Vine
|
||||
[Script] // 28720 - Nightmare Vine
|
||||
class spell_gen_nightmare_vine : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
@@ -1756,6 +1778,25 @@ namespace Scripts.Spells.Generic
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 27746 - Nitrous Boost
|
||||
class spell_gen_nitrous_boost : AuraScript
|
||||
{
|
||||
void PeriodicTick(AuraEffect aurEff)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
if (GetCaster() != null && GetTarget().GetPower(PowerType.Mana) >= 10)
|
||||
GetTarget().ModifyPower(PowerType.Mana, -10);
|
||||
else
|
||||
Remove();
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic .Add(new EffectPeriodicHandler(PeriodicTick, 1, AuraType.PeriodicTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 27539 - Obsidian Armor
|
||||
class spell_gen_obsidian_armor : AuraScript
|
||||
{
|
||||
@@ -1874,7 +1915,7 @@ namespace Scripts.Spells.Generic
|
||||
}
|
||||
}
|
||||
|
||||
// 35201 - Paralytic Poison
|
||||
[Script] // 35201 - Paralytic Poison
|
||||
class spell_gen_paralytic_poison : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
@@ -2076,6 +2117,37 @@ namespace Scripts.Spells.Generic
|
||||
}
|
||||
}
|
||||
|
||||
// 23493 - Restoration
|
||||
[Script] // 24379 - Restoration
|
||||
class spell_gen_restoration : AuraScript
|
||||
{
|
||||
void PeriodicTick(AuraEffect aurEff)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
Unit caster = GetCaster();
|
||||
if (caster == null)
|
||||
return;
|
||||
|
||||
uint heal = (uint)caster.CountPctFromMaxHealth(10);
|
||||
HealInfo healInfo = new(caster, GetTarget(), heal, GetSpellInfo(), GetSpellInfo().GetSchoolMask());
|
||||
caster.HealBySpell(healInfo);
|
||||
|
||||
/// @todo: should proc other auras?
|
||||
int mana = caster.GetMaxPower(PowerType.Mana);
|
||||
if (mana != 0)
|
||||
{
|
||||
mana /= 10;
|
||||
caster.EnergizeBySpell(caster, GetId(), mana, PowerType.Mana);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 0, AuraType.PeriodicTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
// 38772 Grievous Wound
|
||||
// 43937 Grievous Wound
|
||||
// 62331 Impale
|
||||
|
||||
@@ -20,6 +20,7 @@ using Framework.GameMath;
|
||||
using Game.BattleGrounds;
|
||||
using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
using Game.Loots;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
@@ -33,6 +34,9 @@ namespace Scripts.Spells.Items
|
||||
//Aegisofpreservation
|
||||
public const uint AegisHeal = 23781;
|
||||
|
||||
//ZezzaksShard
|
||||
public const uint EyeOfGrillok = 38495;
|
||||
|
||||
//Alchemiststone
|
||||
public const uint AlchemistStoneExtraHeal = 21399;
|
||||
public const uint AlchemistStoneExtraMana = 21400;
|
||||
@@ -527,6 +531,31 @@ namespace Scripts.Spells.Items
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 38554 - Absorb Eye of Grillok (31463: Zezzak's Shard)
|
||||
class spell_item_absorb_eye_of_grillok : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.EyeOfGrillok);
|
||||
}
|
||||
|
||||
void PeriodicTick(AuraEffect aurEff)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
if (!GetCaster() || !GetTarget().IsTypeId(TypeId.Unit))
|
||||
return;
|
||||
|
||||
GetCaster().CastSpell(GetCaster(), SpellIds.EyeOfGrillok, true, null, aurEff);
|
||||
GetTarget().ToCreature().DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 0, AuraType.PeriodicTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
// Item - 13503: Alchemist's Stone
|
||||
// Item - 35748: Guardian's Alchemist Stone
|
||||
// Item - 35749: Sorcerer's Alchemist Stone
|
||||
@@ -535,7 +564,6 @@ namespace Scripts.Spells.Items
|
||||
// Item - 44322: Mercurial Alchemist Stone
|
||||
// Item - 44323: Indestructible Alchemist's Stone
|
||||
// Item - 44324: Mighty Alchemist's Stone
|
||||
|
||||
[Script] // 17619 - Alchemist Stone
|
||||
class spell_item_alchemist_stone : AuraScript
|
||||
{
|
||||
@@ -576,7 +604,6 @@ namespace Scripts.Spells.Items
|
||||
|
||||
// Item - 50351: Tiny Abomination in a Jar
|
||||
// 71406 - Anger Capacitor
|
||||
|
||||
// Item - 50706: Tiny Abomination in a Jar (Heroic)
|
||||
// 71545 - Anger Capacitor
|
||||
[Script("spell_item_tiny_abomination_in_a_jar", 8)]
|
||||
@@ -1024,6 +1051,35 @@ namespace Scripts.Spells.Items
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 30427 - Extract Gas (23821: Zapthrottle Mote Extractor)
|
||||
class spell_item_extract_gas : AuraScript
|
||||
{
|
||||
void PeriodicTick(AuraEffect aurEff)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
// move loot to player inventory and despawn target
|
||||
if (GetCaster() != null && GetCaster().IsTypeId(TypeId.Player) &&
|
||||
GetTarget().IsTypeId(TypeId.Unit) &&
|
||||
GetTarget().ToCreature().GetCreatureTemplate().CreatureType == CreatureType.GasCloud)
|
||||
{
|
||||
Player player = GetCaster().ToPlayer();
|
||||
Creature creature = GetTarget().ToCreature();
|
||||
// missing lootid has been reported on startup - just return
|
||||
if (creature.GetCreatureTemplate().SkinLootId == 0)
|
||||
return;
|
||||
|
||||
player.AutoStoreLoot(creature.GetCreatureTemplate().SkinLootId, LootStorage.Skinning, ItemContext.None, true);
|
||||
creature.DespawnOrUnsummon();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 0, AuraType.PeriodicTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 7434 - Fate Rune of Unsurpassed Vigor
|
||||
class spell_item_fate_rune_of_unsurpassed_vigor : AuraScript
|
||||
{
|
||||
|
||||
@@ -46,6 +46,8 @@ namespace Scripts.Spells.Shaman
|
||||
public const uint FlameShock = 8050;
|
||||
public const uint FlameShockMaelstrom = 188389;
|
||||
public const uint FlametongueAttack = 10444;
|
||||
public const uint FlametongueWeaponEnchant = 334294;
|
||||
public const uint FlametongueWeaponAura = 319778;
|
||||
public const uint GatheringStorms = 198299;
|
||||
public const uint GatheringStormsBuff = 198300;
|
||||
public const uint ItemLightningShield = 23552;
|
||||
@@ -297,8 +299,43 @@ namespace Scripts.Spells.Shaman
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 194084 - Flametongue
|
||||
class spell_sha_flametongue : AuraScript
|
||||
[Script] // 318038 - Flametongue Weapon
|
||||
class spell_sha_flametongue_weapon : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.FlametongueWeaponEnchant);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
return caster != null && caster.IsTypeId(TypeId.Player);
|
||||
}
|
||||
|
||||
void HandleEffectHitTarget(uint index)
|
||||
{
|
||||
Player player = GetCaster().ToPlayer();
|
||||
byte slot = EquipmentSlot.MainHand;
|
||||
|
||||
if (player.GetPrimarySpecialization() == (uint)TalentSpecialization.ShamanEnhancement)
|
||||
slot = EquipmentSlot.OffHand;
|
||||
|
||||
Item targetItem = player.GetItemByPos(InventorySlots.Bag0, slot);
|
||||
if (targetItem == null || !targetItem.GetTemplate().IsRangedWeapon())
|
||||
return;
|
||||
|
||||
GetCaster().CastSpell(targetItem, SpellIds.FlametongueWeaponEnchant, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleEffectHitTarget, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 319778 - Flametongue
|
||||
class spell_sha_flametongue_weapon_aura : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
@@ -711,6 +748,24 @@ namespace Scripts.Spells.Shaman
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 28820 - Lightning Shield
|
||||
class spell_sha_t3_8p_bonus : AuraScript
|
||||
{
|
||||
void PeriodicTick(AuraEffect aurEff)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
// Need remove self if Lightning Shield not active
|
||||
if (GetTarget().GetAuraEffect(AuraType.ProcTriggerSpell, SpellFamilyNames.Shaman, new FlagArray128(0x400), GetCaster().GetGUID()) == null)
|
||||
Remove();
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic .Add(new EffectPeriodicHandler(PeriodicTick, 1, AuraType.PeriodicTriggerSpell));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 64928 - Item - Shaman T8 Elemental 4P Bonus
|
||||
class spell_sha_t8_elemental_4p_bonus : AuraScript
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user