Core/Players: Changed flight masters to suppress positive transforms/shapeshifts instead of preventing starting flight

This commit is contained in:
hondacrx
2018-07-25 12:17:32 -04:00
parent d42dba9ac1
commit 75619e833f
5 changed files with 37 additions and 17 deletions
+7 -8
View File
@@ -6694,13 +6694,12 @@ namespace Game.Entities
if (npc != null) if (npc != null)
{ {
// not let cheating with start flight mounted // not let cheating with start flight mounted
if (IsMounted()) RemoveAurasByType(AuraType.Mounted);
{
GetSession().SendActivateTaxiReply(ActivateTaxiReply.PlayerAlreadyMounted);
return false;
}
if (IsInDisallowedMountForm()) if (GetDisplayId() != GetNativeDisplayId())
RestoreDisplayId(true);
if (IsDisallowedMountForm(getTransForm(), FORM_NONE, GetDisplayId()))
{ {
GetSession().SendActivateTaxiReply(ActivateTaxiReply.PlayerShapeshifted); GetSession().SendActivateTaxiReply(ActivateTaxiReply.PlayerShapeshifted);
return false; return false;
@@ -6718,8 +6717,8 @@ namespace Game.Entities
{ {
RemoveAurasByType(AuraType.Mounted); RemoveAurasByType(AuraType.Mounted);
if (IsInDisallowedMountForm()) if (GetDisplayId() != GetNativeDisplayId())
RemoveAurasByType(AuraType.ModShapeshift); RestoreDisplayId(true);
Spell spell = GetCurrentSpell(CurrentSpellTypes.Generic); Spell spell = GetCurrentSpell(CurrentSpellTypes.Generic);
if (spell != null) if (spell != null)
+26 -6
View File
@@ -252,13 +252,17 @@ namespace Game.Entities
} }
public bool IsInDisallowedMountForm() public bool IsInDisallowedMountForm()
{
return IsDisallowedMountForm(getTransForm(), GetShapeshiftForm(), GetDisplayId());
}
bool IsDisallowedMountForm(uint spellId, ShapeShiftForm form, uint displayId)
{ {
SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(getTransForm()); SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(getTransForm());
if (transformSpellInfo != null) if (transformSpellInfo != null)
if (transformSpellInfo.HasAttribute(SpellAttr0.CastableWhileMounted)) if (transformSpellInfo.HasAttribute(SpellAttr0.CastableWhileMounted))
return false; return false;
ShapeShiftForm form = GetShapeshiftForm();
if (form != 0) if (form != 0)
{ {
SpellShapeshiftFormRecord shapeshift = CliDB.SpellShapeshiftFormStorage.LookupByKey(form); SpellShapeshiftFormRecord shapeshift = CliDB.SpellShapeshiftFormStorage.LookupByKey(form);
@@ -268,10 +272,10 @@ namespace Game.Entities
if (!shapeshift.Flags.HasAnyFlag(SpellShapeshiftFormFlags.IsNotAShapeshift)) if (!shapeshift.Flags.HasAnyFlag(SpellShapeshiftFormFlags.IsNotAShapeshift))
return true; return true;
} }
if (GetDisplayId() == GetNativeDisplayId()) if (displayId == GetNativeDisplayId())
return false; return false;
CreatureDisplayInfoRecord display = CliDB.CreatureDisplayInfoStorage.LookupByKey(GetDisplayId()); CreatureDisplayInfoRecord display = CliDB.CreatureDisplayInfoStorage.LookupByKey(displayId);
if (display == null) if (display == null)
return true; return true;
@@ -2545,7 +2549,7 @@ namespace Game.Entities
public uint GetDisplayId() { return GetUInt32Value(UnitFields.DisplayId); } public uint GetDisplayId() { return GetUInt32Value(UnitFields.DisplayId); }
public void RestoreDisplayId() public void RestoreDisplayId(bool ignorePositiveAurasPreventingMounting = false)
{ {
AuraEffect handledAura = null; AuraEffect handledAura = null;
// try to receive model from transform auras // try to receive model from transform auras
@@ -2559,7 +2563,18 @@ namespace Game.Entities
if (aurApp != null) if (aurApp != null)
{ {
if (handledAura == null) if (handledAura == null)
handledAura = eff; {
if (!ignorePositiveAurasPreventingMounting)
handledAura = eff;
else
{
CreatureTemplate ci = Global.ObjectMgr.GetCreatureTemplate((uint)eff.GetMiscValue());
if (ci != null)
if (!IsDisallowedMountForm(eff.GetId(), ShapeShiftForm.None, ObjectManager.ChooseDisplayId(ci)))
handledAura = eff;
}
}
// prefer negative auras // prefer negative auras
if (!aurApp.IsPositive()) if (!aurApp.IsPositive())
{ {
@@ -2575,7 +2590,12 @@ namespace Game.Entities
handledAura.HandleEffect(this, AuraEffectHandleModes.SendForClient, true); handledAura.HandleEffect(this, AuraEffectHandleModes.SendForClient, true);
// we've found shapeshift // we've found shapeshift
else if ((modelId = GetModelForForm(GetShapeshiftForm())) != 0) else if ((modelId = GetModelForForm(GetShapeshiftForm())) != 0)
SetDisplayId(modelId); {
if (!ignorePositiveAurasPreventingMounting || !IsDisallowedMountForm(0, GetShapeshiftForm(), modelId))
SetDisplayId(modelId);
else
SetDisplayId(GetNativeDisplayId());
}
// no auras found - set modelid to default // no auras found - set modelid to default
else else
SetDisplayId(GetNativeDisplayId()); SetDisplayId(GetNativeDisplayId());
+1 -1
View File
@@ -163,7 +163,7 @@ namespace Game
// change druid form appearance // change druid form appearance
if (artifactAppearance.OverrideShapeshiftDisplayID != 0 && artifactAppearance.OverrideShapeshiftFormID != 0 && _player.GetShapeshiftForm() == (ShapeShiftForm)artifactAppearance.OverrideShapeshiftFormID) if (artifactAppearance.OverrideShapeshiftDisplayID != 0 && artifactAppearance.OverrideShapeshiftFormID != 0 && _player.GetShapeshiftForm() == (ShapeShiftForm)artifactAppearance.OverrideShapeshiftFormID)
_player.RestoreDisplayId(); _player.RestoreDisplayId(_player.IsMounted());
} }
} }
@@ -442,6 +442,7 @@ namespace Game.Movement
} }
owner.RemoveFlag(PlayerFields.Flags, PlayerFlags.TaxiBenchmark); owner.RemoveFlag(PlayerFields.Flags, PlayerFlags.TaxiBenchmark);
owner.RestoreDisplayId();
} }
public override void DoReset(Player owner) public override void DoReset(Player owner)
+2 -2
View File
@@ -1394,7 +1394,7 @@ namespace Game.Spells
} }
if (modelid > 0) if (modelid > 0)
target.RestoreDisplayId(); target.RestoreDisplayId(target.IsMounted());
switch (form) switch (form)
{ {
@@ -1659,7 +1659,7 @@ namespace Game.Spells
if (target.GetTransForm() == GetId()) if (target.GetTransForm() == GetId())
target.setTransForm(0); target.setTransForm(0);
target.RestoreDisplayId(); target.RestoreDisplayId(target.IsMounted());
// Dragonmaw Illusion (restore mount model) // Dragonmaw Illusion (restore mount model)
if (GetId() == 42016 && target.GetMountID() == 16314) if (GetId() == 42016 && target.GetMountID() == 16314)