diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 16 | ||||
| -rw-r--r-- | src/server/game/Entities/Creature/Creature.h | 3 |
2 files changed, 16 insertions, 3 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 4336680ce1f..1b31295f5e8 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -571,6 +571,8 @@ bool Creature::InitEntry(uint32 entry, CreatureData const* data /*= nullptr*/) || IsTotem() || creatureInfo->flags_extra & CREATURE_FLAG_EXTRA_NO_XP); + // TODO: migrate these in DB + _staticFlags.ApplyFlag(CREATURE_STATIC_FLAG_2_ALLOW_MOUNTED_COMBAT, (GetCreatureDifficulty()->TypeFlags & CREATURE_TYPE_FLAG_ALLOW_MOUNTED_COMBAT) != 0); _staticFlags.ApplyFlag(CREATURE_STATIC_FLAG_4_TREAT_AS_RAID_UNIT_FOR_HELPFUL_SPELLS, (GetCreatureDifficulty()->TypeFlags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT) != 0); return true; @@ -2759,8 +2761,8 @@ bool Creature::LoadCreaturesAddon() if (!creatureAddon) return false; - if (creatureAddon->mount != 0) - Mount(creatureAddon->mount); + if (uint32 mountDisplayId = _defaultMountDisplayIdOverride.value_or(creatureAddon->mount); mountDisplayId != 0) + Mount(mountDisplayId); SetStandState(UnitStandStateType(creatureAddon->standState)); ReplaceAllVisFlags(UnitVisFlags(creatureAddon->visFlags)); @@ -3330,6 +3332,14 @@ void Creature::SetCannotReachTarget(bool cannotReach) TC_LOG_DEBUG("entities.unit.chase", "Creature::SetCannotReachTarget() called with true. Details: {}", GetDebugInfo()); } +void Creature::SetDefaultMount(Optional<uint32> mountCreatureDisplayId) +{ + if (mountCreatureDisplayId && !sCreatureDisplayInfoStore.HasRecord(*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. @@ -3620,7 +3630,7 @@ void Creature::AtEngage(Unit* target) { Unit::AtEngage(target); - if (!(GetCreatureDifficulty()->TypeFlags & CREATURE_TYPE_FLAG_ALLOW_MOUNTED_COMBAT)) + if (!HasFlag(CREATURE_STATIC_FLAG_2_ALLOW_MOUNTED_COMBAT)) Dismount(); RefreshCanSwimFlag(); diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index cae422a2f09..c2d0eda0dfe 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -334,6 +334,8 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma void SetCannotReachTarget(bool cannotReach); bool CanNotReachTarget() const { return m_cannotReachTarget; } + void SetDefaultMount(Optional<uint32> mountCreatureDisplayId); + void SetHomePosition(float x, float y, float z, float o) { m_homePosition.Relocate(x, y, z, o); } void SetHomePosition(Position const& pos) { m_homePosition.Relocate(pos); } void GetHomePosition(float& x, float& y, float& z, float& ori) const { m_homePosition.GetPosition(x, y, z, ori); } @@ -535,6 +537,7 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma bool _isMissingCanSwimFlagOutOfCombat; + Optional<uint32> _defaultMountDisplayIdOverride; int32 _creatureImmunitiesId; uint32 _gossipMenuId; Optional<uint32> _trainerId; |
