diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 6982f1b9e7..5b6673526c 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -2550,6 +2550,9 @@ bool Creature::LoadCreaturesAddon() if (!creatureAddon) return false; + if (uint32 mountDisplayId = _defaultMountDisplayIdOverride.value_or(creatureAddon->mount); mountDisplayId != 0) + Mount(mountDisplayId); + if (creatureAddon->mount != 0) Mount(creatureAddon->mount); @@ -2941,6 +2944,14 @@ void Creature::SetPosition(float x, float y, float z, float o) GetVehicleKit()->RelocatePassengers(); } +void Creature::SetDefaultMount(Optional mountCreatureDisplayId) +{ + if (mountCreatureDisplayId && !sCreatureDisplayInfoStore.LookupEntry(*mountCreatureDisplayId)) + mountCreatureDisplayId.reset(); + + _defaultMountDisplayIdOverride = mountCreatureDisplayId; +} + float Creature::GetAggroRange(Unit const* target) const { // Determines the aggro range for creatures (usually pets), used mainly for aggressive pet target selection. @@ -3240,7 +3251,7 @@ void Creature::AtEngage(Unit* target) GetThreatManager().ResetUpdateTimer(); - if (!(GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_MOUNTED_COMBAT_ALLOWED)) + if (!(GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_MOUNTED_COMBAT_ALLOWED) && !HasStaticFlag(CREATURE_STATIC_FLAG_2_ALLOW_MOUNTED_COMBAT)) Dismount(); MovementGeneratorType const movetype = GetMotionMaster()->GetCurrentMovementGeneratorType(); diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index b610e740fa..dbf120e498 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -317,6 +317,8 @@ class TC_GAME_API Creature : public Unit, public GridObject, public Ma void SetCannotReachTarget(bool cannotReach) { if (cannotReach == m_cannotReachTarget) return; m_cannotReachTarget = cannotReach; m_cannotReachTimer = 0; } bool CanNotReachTarget() const { return m_cannotReachTarget; } + void SetDefaultMount(Optional mountCreatureDisplayId); + void SetPosition(float x, float y, float z, float o); void SetPosition(const Position &pos) { SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); } @@ -502,6 +504,7 @@ class TC_GAME_API Creature : public Unit, public GridObject, public Ma CreatureMovementInfo _creatureMovementInfo; + Optional _defaultMountDisplayIdOverride; float _noNpcDamageBelowPctHealth; };