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:
@@ -877,7 +877,7 @@ namespace Framework.Constants
|
||||
Snow = 0x01, // Snow (Only Dun Morogh, Naxxramas, Razorfen Downs And Winterspring)
|
||||
Unk1 = 0x02, // Razorfen Downs, Naxxramas And Acherus: The Ebon Hold (3.3.5a)
|
||||
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
|
||||
SlaveCapital2 = 0x20, // Slave Capital City Flag?
|
||||
AllowDuels = 0x40, // Allow To Duel Here
|
||||
|
||||
@@ -99,6 +99,17 @@ namespace Game.DataStorage
|
||||
|
||||
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
|
||||
|
||||
@@ -273,8 +273,8 @@ namespace Scripts.Spells.Items
|
||||
public const uint BrewfestMountTransformReverse = 52845;
|
||||
|
||||
//Nitroboots
|
||||
public const uint NitroBootsSuccess = 54861;
|
||||
public const uint NitroBootsBackfire = 46014;
|
||||
public const uint NitroBoostsSuccess = 54861;
|
||||
public const uint NitroBoostsBackfire = 46014;
|
||||
|
||||
//Teachlanguage
|
||||
public const uint LearnGnomishBinary = 50242;
|
||||
@@ -2491,7 +2491,7 @@ namespace Scripts.Spells.Items
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_item_nitro_boots : SpellScript
|
||||
class spell_item_nitro_boosts : SpellScript
|
||||
{
|
||||
public override bool Load()
|
||||
{
|
||||
@@ -2502,14 +2502,17 @@ namespace Scripts.Spells.Items
|
||||
|
||||
public override bool Validate(SpellInfo spell)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.NitroBootsSuccess, SpellIds.NitroBootsBackfire);
|
||||
return ValidateSpellInfo(SpellIds.NitroBoostsSuccess, SpellIds.NitroBoostsBackfire);
|
||||
}
|
||||
|
||||
void HandleDummy(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
bool success = caster.GetMap().IsDungeon() || RandomHelper.randChance(95);
|
||||
caster.CastSpell(caster, success ? SpellIds.NitroBootsSuccess : SpellIds.NitroBootsBackfire, true, GetCastItem());
|
||||
AreaTableRecord areaEntry = CliDB.AreaTableStorage.LookupByKey(caster.GetAreaId());
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user