Scripts/Item: Change Nitro -> Boosts <- to use the correct knockup effect for their backfire. Also, script that knockup effect to work properly ("usually" deploy a rescue parachute).

Port From (https://github.com/TrinityCore/TrinityCore/commit/89006f621e0c59d88ab6102d2c67071aaeeb8ee9)
This commit is contained in:
hondacrx
2020-08-22 15:10:55 -04:00
parent f2cd72aaf6
commit 40330f9bac
3 changed files with 42 additions and 0 deletions
+37
View File
@@ -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
{
@@ -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";
@@ -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');