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:
hondacrx
2024-02-27 13:54:39 -05:00
parent 382ffa093a
commit 29af2a63b7
3 changed files with 17 additions and 4 deletions
+1 -1
View File
@@ -2032,7 +2032,7 @@ namespace Framework.Constants
SuppressPointsStacking = 0x40,
ChainFromInitialTarget = 0x80,
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*/
AddTargetCombatReachToAOE = 0x800, /*NYI*/
IsHarmful = 0x1000,
@@ -29,6 +29,7 @@ namespace Game.Entities
bool _isMissingCanSwimFlagOutOfCombat;
uint? _defaultMountDisplayIdOverride;
int _creatureImmunitiesId;
uint _gossipMenuId;
uint? _trainerId;
+15 -3
View File
@@ -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.