diff --git a/Source/Scripts/Spells/Items.cs b/Source/Scripts/Spells/Items.cs index 36d050b37..b4b92c6d9 100644 --- a/Source/Scripts/Spells/Items.cs +++ b/Source/Scripts/Spells/Items.cs @@ -275,6 +275,7 @@ namespace Scripts.Spells.Items //Nitroboots public const uint NitroBoostsSuccess = 54861; public const uint NitroBoostsBackfire = 46014; + public const uint NitroBoostsParachute = 54649; //Teachlanguage public const uint LearnGnomishBinary = 50242; @@ -2521,6 +2522,42 @@ namespace Scripts.Spells.Items } } + [Script] + class spell_item_nitro_boosts_backfire : AuraScript + { + public override bool Validate(SpellInfo spell) + { + return ValidateSpellInfo(SpellIds.NitroBoostsParachute); + } + + void HandleApply(AuraEffect effect, AuraEffectHandleModes mode) + { + lastZ = GetTarget().GetPositionZ(); + } + + void HandlePeriodicDummy(AuraEffect effect) + { + PreventDefaultAction(); + float curZ = GetTarget().GetPositionZ(); + if (curZ < lastZ) + { + if (RandomHelper.randChance(80)) // we don't have enough sniffs to verify this, guesstimate + GetTarget().CastSpell(GetTarget(), SpellIds.NitroBoostsParachute, true, null, effect); + GetAura().Remove(); + } + else + lastZ = curZ; + } + + public override void Register() + { + OnEffectApply.Add(new EffectApplyHandler(HandleApply, 1, AuraType.PeriodicTriggerSpell, AuraEffectHandleModes.Real)); + OnEffectPeriodic.Add(new EffectPeriodicHandler(HandlePeriodicDummy, 1, AuraType.PeriodicTriggerSpell)); + } + + float lastZ = MapConst.InvalidHeight; + } + [Script] class spell_item_teach_language : SpellScript { diff --git a/sql/updates/world/master/2020_08_19_00_world_2017_07_18_01_world.sql b/sql/updates/world/master/2020_08_19_00_world_2017_07_18_01_world.sql new file mode 100644 index 000000000..8123ceafc --- /dev/null +++ b/sql/updates/world/master/2020_08_19_00_world_2017_07_18_01_world.sql @@ -0,0 +1,2 @@ +-- correct typo in script name +UPDATE `spell_script_names` SET `ScriptName`="spell_item_nitro_boosts" WHERE `ScriptName`="spell_item_nitro_boots"; diff --git a/sql/updates/world/master/2020_08_19_01_world_2017_07_18_03_world.sql b/sql/updates/world/master/2020_08_19_01_world_2017_07_18_03_world.sql new file mode 100644 index 000000000..17bcc875f --- /dev/null +++ b/sql/updates/world/master/2020_08_19_01_world_2017_07_18_03_world.sql @@ -0,0 +1,3 @@ +-- +DELETE FROM `spell_script_names` WHERE `scriptname`='spell_item_nitro_boosts_backfire'; +INSERT INTO `spell_script_names` (`spell_id`,`scriptname`) VALUES (54621,'spell_item_nitro_boosts_backfire');