diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index 84d27b64a..77d0c1523 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -4790,277 +4790,9 @@ namespace Game.Spells void HandlePeriodicTriggerSpellAuraTick(Unit target, Unit caster) { - // generic casting code with custom spells and target/caster customs uint triggerSpellId = GetSpellEffectInfo().TriggerSpell; SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId, GetBase().GetCastDifficulty()); - SpellInfo auraSpellInfo = GetSpellInfo(); - uint auraId = auraSpellInfo.Id; - - // specific code for cases with no trigger spell provided in field - if (triggeredSpellInfo == null) - { - switch (auraSpellInfo.SpellFamilyName) - { - case SpellFamilyNames.Generic: - { - switch (auraId) - { - // Brood Affliction: Bronze - case 23170: - triggerSpellId = 23171; - break; - // Restoration - case 24379: - case 23493: - { - if (caster != null) - { - uint heal = (uint)caster.CountPctFromMaxHealth(10); - HealInfo healInfo = new HealInfo(caster, target, heal, auraSpellInfo, auraSpellInfo.GetSchoolMask()); - caster.HealBySpell(healInfo); - - // @todo: should proc other auras? - int mana = caster.GetMaxPower(PowerType.Mana); - if (mana != 0) - { - mana /= 10; - caster.EnergizeBySpell(caster, 23493, mana, PowerType.Mana); - } - } - return; - } - // Nitrous Boost - case 27746: - if (caster != null && target.GetPower(PowerType.Mana) >= 10) - { - target.ModifyPower(PowerType.Mana, -10); - target.SendEnergizeSpellLog(caster, 27746, 10, 0, PowerType.Mana); - } - else - target.RemoveAurasDueToSpell(27746); - return; - // Frost Blast - case 27808: - if (caster != null) - caster.CastCustomSpell(29879, SpellValueMod.BasePoint0, (int)target.CountPctFromMaxHealth(21), target, true, null, this); - return; - // Inoculate Nestlewood Owlkin - case 29528: - if (!target.IsTypeId(TypeId.Unit)) // prevent error reports in case ignored player target - return; - break; - // Feed Captured Animal - case 29917: - triggerSpellId = 29916; - break; - // Extract Gas - case 30427: - { - // move loot to player inventory and despawn target - if (caster != null && caster.IsTypeId(TypeId.Player) && - target.IsTypeId(TypeId.Unit) && - target.ToCreature().GetCreatureTemplate().CreatureType == CreatureType.GasCloud) - { - Player player = caster.ToPlayer(); - Creature creature = target.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(); - } - return; - } - // Quake - case 30576: - triggerSpellId = 30571; - break; - // Doom - // @todo effect trigger spell may be independant on spell targets, and executed in spell finish phase - // so instakill will be naturally done before trigger spell - case 31347: - { - target.CastSpell(target, 31350, true, null, this); - target.KillSelf(); - return; - } - // Spellcloth - case 31373: - { - // Summon Elemental after create item - target.SummonCreature(17870, 0, 0, 0, target.GetOrientation(), TempSummonType.DeadDespawn, 0); - return; - } - // Flame Quills - case 34229: - { - // cast 24 spells 34269-34289, 34314-34316 - for (uint spell_id = 34269; spell_id != 34290; ++spell_id) - target.CastSpell(target, spell_id, true, null, this); - for (uint spell_id = 34314; spell_id != 34317; ++spell_id) - target.CastSpell(target, spell_id, true, null, this); - return; - } - // Remote Toy - case 37027: - triggerSpellId = 37029; - break; - // Eye of Grillok - case 38495: - triggerSpellId = 38530; - break; - // Absorb Eye of Grillok (Zezzak's Shard) - case 38554: - { - if (caster == null || !target.IsTypeId(TypeId.Unit)) - return; - - caster.CastSpell(caster, 38495, true, null, this); - - Creature creatureTarget = target.ToCreature(); - - creatureTarget.DespawnOrUnsummon(); - return; - } - // Tear of Azzinoth Summon Channel - it's not really supposed to do anything, and this only prevents the console spam - case 39857: - triggerSpellId = 39856; - break; - // Personalized Weather - case 46736: - triggerSpellId = 46737; - break; - } - break; - } - case SpellFamilyNames.Shaman: - { - switch (auraId) - { - // Lightning Shield (The Earthshatterer set trigger after cast Lighting Shield) - case 28820: - { - // Need remove self if Lightning Shield not active - if (target.GetAuraEffect(AuraType.ProcTriggerSpell, SpellFamilyNames.Shaman, new FlagArray128(0x400, 0, 0)) == null) - target.RemoveAurasDueToSpell(28820); - return; - } - // Totemic Mastery (Skyshatter Regalia (Shaman Tier 6) - bonus) - case 38443: - { - bool all = true; - for (int i = (int)SummonSlot.Totem; i < SharedConst.MaxSummonSlot; ++i) - { - if (target.m_SummonSlot[i].IsEmpty()) - { - all = false; - break; - } - } - - if (all) - target.CastSpell(target, 38437, true, null, this); - else - target.RemoveAurasDueToSpell(38437); - return; - } - } - break; - } - default: - break; - } - } - else - { - // Spell exist but require custom code - switch (auraId) - { - // Pursuing Spikes (Anub'arak) - case 65920: - case 65922: - case 65923: - { - Unit permafrostCaster = null; - Aura permafrostAura = target.GetAura(66193); - if (permafrostAura == null) - permafrostAura = target.GetAura(67855); - if (permafrostAura == null) - permafrostAura = target.GetAura(67856); - if (permafrostAura == null) - permafrostAura = target.GetAura(67857); - - if (permafrostAura != null) - permafrostCaster = permafrostAura.GetCaster(); - - if (permafrostCaster != null) - { - Creature permafrostCasterCreature = permafrostCaster.ToCreature(); - if (permafrostCasterCreature != null) - permafrostCasterCreature.DespawnOrUnsummon(3000); - - target.CastSpell(target, 66181, false); - target.RemoveAllAuras(); - Creature targetCreature = target.ToCreature(); - if (targetCreature != null) - targetCreature.DisappearAndDie(); - } - break; - } - // Mana Tide - case 16191: - target.CastCustomSpell(target, triggerSpellId, m_amount, 0, 0, true, null, this); - return; - // Negative Energy Periodic - case 46284: - target.CastCustomSpell(triggerSpellId, SpellValueMod.MaxTargets, (int)(_ticksDone / 10 + 1), null, true, null, this); - return; - // Poison (Grobbulus) - case 28158: - case 54362: - // Slime Pool (Dreadscale & Acidmaw) - case 66882: - target.CastCustomSpell(triggerSpellId, SpellValueMod.RadiusMod, (int)(((_ticksDone / 60.0f) * 0.9f + 0.1f) * 10000.0f * 2.0f / 3.0f), null, true, null, this); - return; - // Slime Spray - temporary here until preventing default effect works again - // added on 9.10.2010 - case 69508: - { - if (caster != null) - caster.CastSpell(target, triggerSpellId, true, null, null, caster.GetGUID()); - return; - } - case 24745: // Summon Templar, Trigger - case 24747: // Summon Templar Fire, Trigger - case 24757: // Summon Templar Air, Trigger - case 24759: // Summon Templar Earth, Trigger - case 24761: // Summon Templar Water, Trigger - case 24762: // Summon Duke, Trigger - case 24766: // Summon Duke Fire, Trigger - case 24769: // Summon Duke Air, Trigger - case 24771: // Summon Duke Earth, Trigger - case 24773: // Summon Duke Water, Trigger - case 24785: // Summon Royal, Trigger - case 24787: // Summon Royal Fire, Trigger - case 24791: // Summon Royal Air, Trigger - case 24792: // Summon Royal Earth, Trigger - case 24793: // Summon Royal Water, Trigger - { - // All this spells trigger a spell that requires reagents; if the - // triggered spell is cast as "triggered", reagents are not consumed - if (caster != null) - caster.CastSpell(target, triggerSpellId, false); - return; - } - } - } - - // Reget trigger spell proto - triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId, GetBase().GetCastDifficulty()); - if (triggeredSpellInfo != null) { Unit triggerCaster = triggeredSpellInfo.NeedsToBeTriggeredByCaster(m_spellInfo) ? caster : target; diff --git a/Source/Game/Spells/SpellManager.cs b/Source/Game/Spells/SpellManager.cs index b4f04549e..ec3ff1e99 100644 --- a/Source/Game/Spells/SpellManager.cs +++ b/Source/Game/Spells/SpellManager.cs @@ -2984,6 +2984,25 @@ namespace Game.Entities case 43327: spellInfo.GetEffect(1).ApplyAuraPeriod = 1 * Time.InMilliseconds; break; + // specific code for cases with no trigger spell provided in field + case 23170: // Brood Affliction: Bronze + spellInfo.GetEffect(0).TriggerSpell = 23171; + break; + case 29917: // Feed Captured Animal + spellInfo.GetEffect(0).TriggerSpell = 29916; + break; + case 37027: // Remote Toy + spellInfo.GetEffect(0).TriggerSpell = 37029; + break; + case 38495: // Eye of Grillok + spellInfo.GetEffect(0).TriggerSpell = 38530; + break; + case 39857: // Tear of Azzinoth Summon Channel - it's not really supposed to do anything, and this only prevents the console spam + spellInfo.GetEffect(0).TriggerSpell = 39856; + break; + case 46736:// Personalized Weather + spellInfo.GetEffect(1).TriggerSpell = 46737; + break; case 63026: // Summon Aspirant Test NPC (HACK: Target shouldn't be changed) case 63137: // Summon Valiant Test (HACK: Target shouldn't be changed; summon position should be untied from spell destination) spellInfo.GetEffect(0).TargetA = new SpellImplicitTargetInfo(Targets.DestDb); diff --git a/Source/Scripts/Spells/Generic.cs b/Source/Scripts/Spells/Generic.cs index f09fe9c8c..a0ff33e23 100644 --- a/Source/Scripts/Spells/Generic.cs +++ b/Source/Scripts/Spells/Generic.cs @@ -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 diff --git a/Source/Scripts/Spells/Items.cs b/Source/Scripts/Spells/Items.cs index 2c791494f..ed90a4dfb 100644 --- a/Source/Scripts/Spells/Items.cs +++ b/Source/Scripts/Spells/Items.cs @@ -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 { diff --git a/Source/Scripts/Spells/Shaman.cs b/Source/Scripts/Spells/Shaman.cs index b78059d4f..1ecc05437 100644 --- a/Source/Scripts/Spells/Shaman.cs +++ b/Source/Scripts/Spells/Shaman.cs @@ -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 { diff --git a/sql/updates/world/master/2021_03_13_01_world_2017_12_15_03_world_335.sql b/sql/updates/world/master/2021_03_13_01_world_2017_12_15_03_world_335.sql new file mode 100644 index 000000000..9b3615f65 --- /dev/null +++ b/sql/updates/world/master/2021_03_13_01_world_2017_12_15_03_world_335.sql @@ -0,0 +1,36 @@ +-- UPDATE `spell_dbc` SET `EffectTriggerSpell1`=30571 WHERE `Id`=30576; +UPDATE `serverside_spell_effect` SET `EffectTriggerSpell`=30576 WHERE `SpellID`=30576 AND `EffectIndex`=0 AND `DifficultyID`=0; +DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_gen_restoration','spell_gen_nitrous_boost','spell_kelthuzad_frost_blast','spell_inoculate_nestlewood','spell_item_extract_gas','spell_alar_flame_quills','spell_item_absorb_eye_of_grillok','spell_sha_t3_8p_bonus','spell_pursuing_spikes',/*'spell_sha_mana_tide',*/'spell_gen_negative_energy_periodic','spell_jormungars_slime_pool',/*'spell_pal_beacon_of_light',*/'spell_silithus_summon_cultist_periodic'); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(23493, 'spell_gen_restoration'), +(24379, 'spell_gen_restoration'), +(27746, 'spell_gen_nitrous_boost'), +(27808, 'spell_kelthuzad_frost_blast'), +(29528, 'spell_inoculate_nestlewood'), +(30427, 'spell_item_extract_gas'), +(34229, 'spell_alar_flame_quills'), +(38554, 'spell_item_absorb_eye_of_grillok'), +(28820, 'spell_sha_t3_8p_bonus'), +(65920, 'spell_pursuing_spikes'), +(65922, 'spell_pursuing_spikes'), +(65923, 'spell_pursuing_spikes'), +-- (16191, 'spell_sha_mana_tide'), +(46284, 'spell_gen_negative_energy_periodic'), +(66882, 'spell_jormungars_slime_pool'), +-- (53563, 'spell_pal_beacon_of_light'), +(24745, 'spell_silithus_summon_cultist_periodic'), +(24747, 'spell_silithus_summon_cultist_periodic'), +(24757, 'spell_silithus_summon_cultist_periodic'), +(24759, 'spell_silithus_summon_cultist_periodic'), +(24761, 'spell_silithus_summon_cultist_periodic'), +(24762, 'spell_silithus_summon_cultist_periodic'), +(24766, 'spell_silithus_summon_cultist_periodic'), +(24769, 'spell_silithus_summon_cultist_periodic'), +(24771, 'spell_silithus_summon_cultist_periodic'), +(24773, 'spell_silithus_summon_cultist_periodic'), +(24785, 'spell_silithus_summon_cultist_periodic'), +(24787, 'spell_silithus_summon_cultist_periodic'), +(24791, 'spell_silithus_summon_cultist_periodic'), +(24792, 'spell_silithus_summon_cultist_periodic'), +(24793, 'spell_silithus_summon_cultist_periodic'), +(46595, 'spell_silithus_summon_cultist_periodic');