Scripts/Item: Fix Nitro Boosts to only fail in flyable areas.

Port From (https://github.com/TrinityCore/TrinityCore/commit/ba7d8e9ace2de730034cd8b2b901f19f04129ef9)
This commit is contained in:
hondacrx
2020-08-22 15:03:06 -04:00
parent 9314d5a9bc
commit f90597a156
3 changed files with 21 additions and 7 deletions
+1 -1
View File
@@ -877,7 +877,7 @@ namespace Framework.Constants
Snow = 0x01, // Snow (Only Dun Morogh, Naxxramas, Razorfen Downs And Winterspring) Snow = 0x01, // Snow (Only Dun Morogh, Naxxramas, Razorfen Downs And Winterspring)
Unk1 = 0x02, // Razorfen Downs, Naxxramas And Acherus: The Ebon Hold (3.3.5a) Unk1 = 0x02, // Razorfen Downs, Naxxramas And Acherus: The Ebon Hold (3.3.5a)
Unk2 = 0x04, // Only Used For Areas On Map 571 (Development Before) Unk2 = 0x04, // Only Used For Areas On Map 571 (Development Before)
SlaveCapital = 0x08, // City And City Subsones SlaveCapital = 0x08, // City And City Subzones
Unk3 = 0x10, // Can'T Find Common Meaning Unk3 = 0x10, // Can'T Find Common Meaning
SlaveCapital2 = 0x20, // Slave Capital City Flag? SlaveCapital2 = 0x20, // Slave Capital City Flag?
AllowDuels = 0x40, // Allow To Duel Here AllowDuels = 0x40, // Allow To Duel Here
@@ -99,6 +99,17 @@ namespace Game.DataStorage
return Flags[0].HasAnyFlag(AreaFlags.Sanctuary); return Flags[0].HasAnyFlag(AreaFlags.Sanctuary);
} }
public bool IsFlyable()
{
if (Flags[0].HasAnyFlag(AreaFlags.Outland))
{
if (!Flags[0].HasAnyFlag(AreaFlags.NoFlyZone))
return true;
}
return false;
}
} }
public sealed class AreaTriggerRecord public sealed class AreaTriggerRecord
+9 -6
View File
@@ -273,8 +273,8 @@ namespace Scripts.Spells.Items
public const uint BrewfestMountTransformReverse = 52845; public const uint BrewfestMountTransformReverse = 52845;
//Nitroboots //Nitroboots
public const uint NitroBootsSuccess = 54861; public const uint NitroBoostsSuccess = 54861;
public const uint NitroBootsBackfire = 46014; public const uint NitroBoostsBackfire = 46014;
//Teachlanguage //Teachlanguage
public const uint LearnGnomishBinary = 50242; public const uint LearnGnomishBinary = 50242;
@@ -2491,7 +2491,7 @@ namespace Scripts.Spells.Items
} }
[Script] [Script]
class spell_item_nitro_boots : SpellScript class spell_item_nitro_boosts : SpellScript
{ {
public override bool Load() public override bool Load()
{ {
@@ -2502,14 +2502,17 @@ namespace Scripts.Spells.Items
public override bool Validate(SpellInfo spell) public override bool Validate(SpellInfo spell)
{ {
return ValidateSpellInfo(SpellIds.NitroBootsSuccess, SpellIds.NitroBootsBackfire); return ValidateSpellInfo(SpellIds.NitroBoostsSuccess, SpellIds.NitroBoostsBackfire);
} }
void HandleDummy(uint effIndex) void HandleDummy(uint effIndex)
{ {
Unit caster = GetCaster(); Unit caster = GetCaster();
bool success = caster.GetMap().IsDungeon() || RandomHelper.randChance(95); AreaTableRecord areaEntry = CliDB.AreaTableStorage.LookupByKey(caster.GetAreaId());
caster.CastSpell(caster, success ? SpellIds.NitroBootsSuccess : SpellIds.NitroBootsBackfire, true, GetCastItem()); bool success = true;
if (areaEntry != null && areaEntry.IsFlyable() && !caster.GetMap().IsDungeon())
success = RandomHelper.randChance(95);
caster.CastSpell(caster, success ? SpellIds.NitroBoostsSuccess : SpellIds.NitroBoostsBackfire, true, GetCastItem());
} }
public override void Register() public override void Register()