Core/Creatures: Implemented CREATURE_STATIC_FLAG_2_ALLOW_MOUNTED_COMBAT and overriding default mount from creature addon
Port From (https://github.com/TrinityCore/TrinityCore/commit/9463933eda630be97e3ab16cf66e419d2f696109)
This commit is contained in:
@@ -29,6 +29,7 @@ namespace Game.Entities
|
||||
|
||||
bool _isMissingCanSwimFlagOutOfCombat;
|
||||
|
||||
uint? _defaultMountDisplayIdOverride;
|
||||
int _creatureImmunitiesId;
|
||||
uint _gossipMenuId;
|
||||
uint? _trainerId;
|
||||
|
||||
@@ -283,6 +283,9 @@ namespace Game.Entities
|
||||
ApplyAllStaticFlags(m_creatureDifficulty.StaticFlags);
|
||||
|
||||
_staticFlags.ApplyFlag(CreatureStaticFlags.NoXp, creatureInfo.CreatureType == CreatureType.Critter || IsPet() || IsTotem() || creatureInfo.FlagsExtra.HasFlag(CreatureFlagsExtra.NoXP));
|
||||
|
||||
// TODO: migrate these in DB
|
||||
_staticFlags.ApplyFlag(CreatureStaticFlags2.AllowMountedCombat, GetCreatureDifficulty().TypeFlags.HasFlag(CreatureTypeFlags.AllowMountedCombat));
|
||||
_staticFlags.ApplyFlag(CreatureStaticFlags4.TreatAsRaidUnitForHelpfulSpells, GetCreatureDifficulty().TypeFlags.HasFlag(CreatureTypeFlags.TreatAsRaidUnit));
|
||||
|
||||
return true;
|
||||
@@ -1056,7 +1059,7 @@ namespace Game.Entities
|
||||
{
|
||||
base.AtEngage(target);
|
||||
|
||||
if (!GetCreatureDifficulty().TypeFlags.HasFlag(CreatureTypeFlags.AllowMountedCombat))
|
||||
if (!HasFlag(CreatureStaticFlags2.AllowMountedCombat))
|
||||
Dismount();
|
||||
|
||||
RefreshCanSwimFlag();
|
||||
@@ -2522,8 +2525,9 @@ namespace Game.Entities
|
||||
CreatureAddon creatureAddon = GetCreatureAddon();
|
||||
if (creatureAddon == null)
|
||||
return false;
|
||||
|
||||
if (creatureAddon.mount != 0)
|
||||
|
||||
uint mountDisplayId = _defaultMountDisplayIdOverride.GetValueOrDefault(creatureAddon.mount);
|
||||
if ( mountDisplayId != 0)
|
||||
Mount(creatureAddon.mount);
|
||||
|
||||
SetStandState((UnitStandStateType)creatureAddon.standState);
|
||||
@@ -3122,6 +3126,14 @@ namespace Game.Entities
|
||||
Log.outDebug(LogFilter.Unit, $"Creature::SetCannotReachTarget() called with true. Details: {GetDebugInfo()}");
|
||||
}
|
||||
|
||||
void SetDefaultMount(uint? mountCreatureDisplayId)
|
||||
{
|
||||
if (mountCreatureDisplayId.HasValue && !CliDB.CreatureDisplayInfoStorage.HasRecord(mountCreatureDisplayId.Value))
|
||||
mountCreatureDisplayId = null;
|
||||
|
||||
_defaultMountDisplayIdOverride = mountCreatureDisplayId;
|
||||
}
|
||||
|
||||
public float GetAggroRange(Unit target)
|
||||
{
|
||||
// Determines the aggro range for creatures (usually pets), used mainly for aggressive pet target selection.
|
||||
|
||||
Reference in New Issue
Block a user