Core/Spells: Fixed travel form
This commit is contained in:
@@ -6699,7 +6699,7 @@ namespace Game.Entities
|
||||
if (GetDisplayId() != GetNativeDisplayId())
|
||||
RestoreDisplayId(true);
|
||||
|
||||
if (IsDisallowedMountForm(getTransForm(), FORM_NONE, GetDisplayId()))
|
||||
if (IsDisallowedMountForm(getTransForm(), ShapeShiftForm.None, GetDisplayId()))
|
||||
{
|
||||
GetSession().SendActivateTaxiReply(ActivateTaxiReply.PlayerShapeshifted);
|
||||
return false;
|
||||
|
||||
@@ -2160,7 +2160,7 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
uint getTransForm() { return m_transform; }
|
||||
public uint getTransForm() { return m_transform; }
|
||||
|
||||
public bool HasStealthAura() { return HasAuraType(AuraType.ModStealth); }
|
||||
public bool HasInvisibilityAura() { return HasAuraType(AuraType.ModInvisibility); }
|
||||
|
||||
@@ -256,7 +256,7 @@ namespace Game.Entities
|
||||
return IsDisallowedMountForm(getTransForm(), GetShapeshiftForm(), GetDisplayId());
|
||||
}
|
||||
|
||||
bool IsDisallowedMountForm(uint spellId, ShapeShiftForm form, uint displayId)
|
||||
public bool IsDisallowedMountForm(uint spellId, ShapeShiftForm form, uint displayId)
|
||||
{
|
||||
SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(getTransForm());
|
||||
if (transformSpellInfo != null)
|
||||
|
||||
@@ -2750,6 +2750,9 @@ namespace Game.Entities
|
||||
case 24314: // Threatening Gaze
|
||||
spellInfo.AuraInterruptFlags[0] |= (uint)(SpellAuraInterruptFlags.Cast | SpellAuraInterruptFlags.Move | SpellAuraInterruptFlags.Jump);
|
||||
break;
|
||||
case 783: // Travel Form (dummy) - cannot be cast indoors.
|
||||
spellInfo.Attributes |= SpellAttr0.OutdoorsOnly;
|
||||
break;
|
||||
case 5420: // Tree of Life (Passive)
|
||||
spellInfo.Stances = 1 << ((int)ShapeShiftForm.TreeOfLife - 1);
|
||||
break;
|
||||
|
||||
@@ -880,7 +880,7 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub.Nadronox
|
||||
|
||||
void HandleEffectRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
if (GetTargetApplication().GetRemoveMode() != AuraRemoveMode.ByDeath)
|
||||
if (GetTargetApplication().GetRemoveMode() != AuraRemoveMode.Death)
|
||||
return;
|
||||
|
||||
if (GetTarget().IsGuardian())
|
||||
|
||||
@@ -36,6 +36,10 @@ namespace Scripts.Spells.Druid
|
||||
public const uint Exhilarate = 28742;
|
||||
public const uint FeralChargeBear = 16979;
|
||||
public const uint FeralChargeCat = 49376;
|
||||
public const uint FormAquatic = 1066;
|
||||
public const uint FormFlight = 33943;
|
||||
public const uint FormStag = 165961;
|
||||
public const uint FormSwiftFlight = 40120;
|
||||
public const uint FormsTrinketBear = 37340;
|
||||
public const uint FormsTrinketCat = 37341;
|
||||
public const uint FormsTrinketMoonkin = 37343;
|
||||
@@ -57,6 +61,7 @@ namespace Scripts.Spells.Druid
|
||||
public const uint StampedeCatState = 109881;
|
||||
public const uint SunfireDamage = 164815;
|
||||
public const uint SurvivalInstincts = 50322;
|
||||
public const uint TravelForm = 783;
|
||||
}
|
||||
|
||||
[Script] // 1850 - Dash
|
||||
@@ -684,6 +689,149 @@ namespace Scripts.Spells.Druid
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 783 - Travel Form (dummy)
|
||||
class spell_dru_travel_form_dummy_SpellScript : SpellScript
|
||||
{
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
Player player = GetCaster().ToPlayer();
|
||||
if (!player)
|
||||
return SpellCastResult.CustomError;
|
||||
|
||||
if (player.GetSkillValue(SkillType.Riding) < 75)
|
||||
return SpellCastResult.ApprenticeRidingRequirement;
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(player.IsInWater() ? SpellIds.FormAquatic : SpellIds.FormStag);
|
||||
return spellInfo.CheckLocation(player.GetMapId(), player.GetZoneId(), player.GetAreaId(), player);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnCheckCast.Add(new CheckCastHandler(CheckCast));
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_dru_travel_form_dummy_AuraScript : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.FormStag, SpellIds.FormAquatic, SpellIds.FormFlight, SpellIds.FormSwiftFlight);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().GetTypeId() == TypeId.Player;
|
||||
}
|
||||
|
||||
void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
uint triggeredSpellId;
|
||||
|
||||
Player player = GetTarget().ToPlayer();
|
||||
if (player.IsInWater()) // Aquatic form
|
||||
triggeredSpellId = SpellIds.FormAquatic;
|
||||
else if (player.GetSkillValue(SkillType.Riding) >= 225 && CheckLocationForForm(SpellIds.FormFlight) == SpellCastResult.SpellCastOk) // Flight form
|
||||
triggeredSpellId = player.getLevel() >= 71 ? SpellIds.FormSwiftFlight : SpellIds.FormFlight;
|
||||
else // Stag form (riding skill already checked in CheckCast)
|
||||
triggeredSpellId = SpellIds.FormStag;
|
||||
|
||||
player.AddAura(triggeredSpellId, player);
|
||||
}
|
||||
|
||||
void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
// No need to check remove mode, it's safe for auras to remove each other in AfterRemove hook.
|
||||
GetTarget().RemoveAura(SpellIds.FormStag);
|
||||
GetTarget().RemoveAura(SpellIds.FormAquatic);
|
||||
GetTarget().RemoveAura(SpellIds.FormFlight);
|
||||
GetTarget().RemoveAura(SpellIds.FormSwiftFlight);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
|
||||
AfterEffectRemove.Add(new EffectApplyHandler(AfterRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
|
||||
}
|
||||
|
||||
// Outdoor check already passed - Travel Form (dummy) has SPELL_ATTR0_OUTDOORS_ONLY attribute.
|
||||
SpellCastResult CheckLocationForForm(uint spell)
|
||||
{
|
||||
Player player = GetTarget().ToPlayer();
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell);
|
||||
return spellInfo.CheckLocation(player.GetMapId(), player.GetZoneId(), player.GetAreaId(), player);
|
||||
}
|
||||
}
|
||||
|
||||
// 1066 - Aquatic Form
|
||||
// 33943 - Flight Form
|
||||
// 40120 - Swift Flight Form
|
||||
[Script] // 165961 - Stag Form
|
||||
class spell_dru_travel_form_AuraScript : AuraScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.FormStag, SpellIds.FormAquatic, SpellIds.FormFlight, SpellIds.FormSwiftFlight);
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().GetTypeId() == TypeId.Player;
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
// If it stays 0, it removes Travel Form dummy in AfterRemove.
|
||||
triggeredSpellId = 0;
|
||||
|
||||
// We should only handle aura interrupts.
|
||||
if (GetTargetApplication().GetRemoveMode() != AuraRemoveMode.Interrupt)
|
||||
return;
|
||||
|
||||
// Check what form is appropriate
|
||||
Player player = GetTarget().ToPlayer();
|
||||
if (player.IsInWater()) // Aquatic form
|
||||
triggeredSpellId = SpellIds.FormAquatic;
|
||||
else if (player.GetSkillValue(SkillType.Riding) >= 225 && CheckLocationForForm(SpellIds.FormFlight) == SpellCastResult.SpellCastOk) // Flight form
|
||||
triggeredSpellId = player.GetSkillValue(SkillType.Riding) >= 300 ? SpellIds.FormSwiftFlight : SpellIds.FormFlight;
|
||||
else if (CheckLocationForForm(SpellIds.FormStag) == SpellCastResult.SpellCastOk) // Stag form
|
||||
triggeredSpellId = SpellIds.FormStag;
|
||||
|
||||
// If chosen form is current aura, just don't remove it.
|
||||
if (triggeredSpellId == m_scriptSpellId)
|
||||
PreventDefaultAction();
|
||||
}
|
||||
|
||||
void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Player player = GetTarget().ToPlayer();
|
||||
|
||||
if (triggeredSpellId != 0) // Apply new form
|
||||
player.AddAura(triggeredSpellId, player);
|
||||
else // If not set, simply remove Travel Form dummy
|
||||
player.RemoveAura(SpellIds.TravelForm);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.ModShapeshift, AuraEffectHandleModes.Real));
|
||||
AfterEffectRemove.Add(new EffectApplyHandler(AfterRemove, 0, AuraType.ModShapeshift, AuraEffectHandleModes.Real));
|
||||
}
|
||||
|
||||
SpellCastResult CheckLocationForForm(uint spell_id)
|
||||
{
|
||||
Player player = GetTarget().ToPlayer();
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spell_id);
|
||||
|
||||
if (!player.GetMap().IsOutdoors(player.GetPhaseShift(), player.GetPositionX(), player.GetPositionY(), player.GetPositionZ()))
|
||||
return SpellCastResult.OnlyOutdoors;
|
||||
|
||||
return spellInfo.CheckLocation(player.GetMapId(), player.GetZoneId(), player.GetAreaId(), player);
|
||||
}
|
||||
|
||||
uint triggeredSpellId;
|
||||
}
|
||||
|
||||
[Script] // 40442 - Druid Tier 6 Trinket
|
||||
class spell_dru_item_t6_trinket : AuraScript
|
||||
{
|
||||
|
||||
@@ -298,7 +298,7 @@ namespace Scripts.Spells.Hunter
|
||||
|
||||
void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
if (GetTargetApplication().GetRemoveMode() = AuraRemoveMode.Default || GetTargetApplication().GetRemoveMode() == AuraRemoveMode.Interrupt)
|
||||
if (GetTargetApplication().GetRemoveMode() == AuraRemoveMode.Default || GetTargetApplication().GetRemoveMode() == AuraRemoveMode.Interrupt)
|
||||
return;
|
||||
|
||||
if (!GetTarget().HasAura(SpellIds.MisdirectionProc))
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_dru_travel_form_dummy', 'spell_dru_travel_form');
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(783, 'spell_dru_travel_form_dummy'),
|
||||
(1066, 'spell_dru_travel_form'),
|
||||
(33943, 'spell_dru_travel_form'),
|
||||
(40120, 'spell_dru_travel_form'),
|
||||
(165961, 'spell_dru_travel_form');
|
||||
|
||||
DELETE FROM `spell_linked_spell` WHERE `spell_trigger` = 165961 AND spell_effect = 126056;
|
||||
INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES
|
||||
(165961, 126056, 1, 'Stag Form - Sound Effect: Stag Form');
|
||||
Reference in New Issue
Block a user