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:
@@ -2032,7 +2032,7 @@ namespace Framework.Constants
|
|||||||
SuppressPointsStacking = 0x40,
|
SuppressPointsStacking = 0x40,
|
||||||
ChainFromInitialTarget = 0x80,
|
ChainFromInitialTarget = 0x80,
|
||||||
UncontrolledNoBackwards = 0x100, /*NYI*/
|
UncontrolledNoBackwards = 0x100, /*NYI*/
|
||||||
AuraPointsStack = 0x000200, /*NYI*/ // refreshing periodic auras with this attribute will add remaining damage to new aura
|
AuraPointsStack = 0x000200, // refreshing periodic auras with this attribute will add remaining damage to new aura
|
||||||
NoCopyDamageInterruptsOrProcs = 0x400, /*NYI*/
|
NoCopyDamageInterruptsOrProcs = 0x400, /*NYI*/
|
||||||
AddTargetCombatReachToAOE = 0x800, /*NYI*/
|
AddTargetCombatReachToAOE = 0x800, /*NYI*/
|
||||||
IsHarmful = 0x1000,
|
IsHarmful = 0x1000,
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
bool _isMissingCanSwimFlagOutOfCombat;
|
bool _isMissingCanSwimFlagOutOfCombat;
|
||||||
|
|
||||||
|
uint? _defaultMountDisplayIdOverride;
|
||||||
int _creatureImmunitiesId;
|
int _creatureImmunitiesId;
|
||||||
uint _gossipMenuId;
|
uint _gossipMenuId;
|
||||||
uint? _trainerId;
|
uint? _trainerId;
|
||||||
|
|||||||
@@ -283,6 +283,9 @@ namespace Game.Entities
|
|||||||
ApplyAllStaticFlags(m_creatureDifficulty.StaticFlags);
|
ApplyAllStaticFlags(m_creatureDifficulty.StaticFlags);
|
||||||
|
|
||||||
_staticFlags.ApplyFlag(CreatureStaticFlags.NoXp, creatureInfo.CreatureType == CreatureType.Critter || IsPet() || IsTotem() || creatureInfo.FlagsExtra.HasFlag(CreatureFlagsExtra.NoXP));
|
_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));
|
_staticFlags.ApplyFlag(CreatureStaticFlags4.TreatAsRaidUnitForHelpfulSpells, GetCreatureDifficulty().TypeFlags.HasFlag(CreatureTypeFlags.TreatAsRaidUnit));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -1056,7 +1059,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
base.AtEngage(target);
|
base.AtEngage(target);
|
||||||
|
|
||||||
if (!GetCreatureDifficulty().TypeFlags.HasFlag(CreatureTypeFlags.AllowMountedCombat))
|
if (!HasFlag(CreatureStaticFlags2.AllowMountedCombat))
|
||||||
Dismount();
|
Dismount();
|
||||||
|
|
||||||
RefreshCanSwimFlag();
|
RefreshCanSwimFlag();
|
||||||
@@ -2522,8 +2525,9 @@ namespace Game.Entities
|
|||||||
CreatureAddon creatureAddon = GetCreatureAddon();
|
CreatureAddon creatureAddon = GetCreatureAddon();
|
||||||
if (creatureAddon == null)
|
if (creatureAddon == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (creatureAddon.mount != 0)
|
uint mountDisplayId = _defaultMountDisplayIdOverride.GetValueOrDefault(creatureAddon.mount);
|
||||||
|
if ( mountDisplayId != 0)
|
||||||
Mount(creatureAddon.mount);
|
Mount(creatureAddon.mount);
|
||||||
|
|
||||||
SetStandState((UnitStandStateType)creatureAddon.standState);
|
SetStandState((UnitStandStateType)creatureAddon.standState);
|
||||||
@@ -3122,6 +3126,14 @@ namespace Game.Entities
|
|||||||
Log.outDebug(LogFilter.Unit, $"Creature::SetCannotReachTarget() called with true. Details: {GetDebugInfo()}");
|
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)
|
public float GetAggroRange(Unit target)
|
||||||
{
|
{
|
||||||
// Determines the aggro range for creatures (usually pets), used mainly for aggressive pet target selection.
|
// Determines the aggro range for creatures (usually pets), used mainly for aggressive pet target selection.
|
||||||
|
|||||||
Reference in New Issue
Block a user