Core/Creatures: Implement Ground/FlyingMountDisplayID from creature_summoned_data

Port From (https://github.com/TrinityCore/TrinityCore/commit/8cbc3923a18add49dd483e0e6e9d851f1d4d59f7)
This commit is contained in:
hondacrx
2022-07-16 19:41:59 -04:00
parent 62c5f44f37
commit 3a46790636
2 changed files with 65 additions and 0 deletions
+38
View File
@@ -4695,6 +4695,44 @@ namespace Scripts.Spells.Generic
}
}
[Script] // 147066 - (Serverside/Non-DB2) Generic - Mount Check Aura
class spell_gen_mount_check_aura : AuraScript
{
void OnPeriodic(AuraEffect aurEff)
{
Unit target = GetTarget();
uint mountDisplayId = 0;
TempSummon tempSummon = target.ToTempSummon();
if (tempSummon == null)
return;
Player summoner = tempSummon.GetSummoner()?.ToPlayer();
if (summoner == null)
return;
if (summoner.IsMounted() && (!summoner.IsInCombat() || summoner.IsFlying()))
{
CreatureSummonedData summonedData = Global.ObjectMgr.GetCreatureSummonedData(tempSummon.GetEntry());
if (summonedData != null)
{
if (summoner.IsFlying() && summonedData.FlyingMountDisplayID.HasValue)
mountDisplayId = summonedData.FlyingMountDisplayID.Value;
else if (summonedData.GroundMountDisplayID.HasValue)
mountDisplayId = summonedData.GroundMountDisplayID.Value;
}
}
if (mountDisplayId != target.GetMountDisplayId())
target.SetMountDisplayId(mountDisplayId);
}
public override void Register()
{
OnEffectPeriodic.Add(new EffectPeriodicHandler(OnPeriodic, 0, AuraType.PeriodicDummy));
}
}
// 40307 - Stasis Field
class StasisFieldSearcher : ICheck<Unit>
{