Core/Units: Named unit flags

Port From (https://github.com/TrinityCore/TrinityCore/commit/b4952db4640ee3ec6a7df8545b5c582202f36405)
This commit is contained in:
hondacrx
2022-02-28 13:16:41 -05:00
parent b538ed9a24
commit 64b23b9de9
4 changed files with 22 additions and 13 deletions
+16 -7
View File
@@ -62,8 +62,8 @@ namespace Framework.Constants
PetInCombat = 0x800, PetInCombat = 0x800,
Pvp = 0x1000, Pvp = 0x1000,
Silenced = 0x2000, Silenced = 0x2000,
CannotSwim = 0x4000, CantSwim = 0x4000,
Swimming = 0x8000, // shows swim animation in water CanSwim = 0x8000, // shows swim animation in water
NonAttackable2 = 0x10000, NonAttackable2 = 0x10000,
Pacified = 0x20000, Pacified = 0x20000,
Stunned = 0x40000, Stunned = 0x40000,
@@ -85,11 +85,11 @@ namespace Framework.Constants
public enum UnitFlags2 : uint public enum UnitFlags2 : uint
{ {
FeignDeath = 0x01, FeignDeath = 0x01,
Unk1 = 0x02, HideBody = 0x02,
IgnoreReputation = 0x04, IgnoreReputation = 0x04,
ComprehendLang = 0x08, ComprehendLang = 0x08,
MirrorImage = 0x10, MirrorImage = 0x10,
InstantlyAppearModel = 0x20, DontFadeIn = 0x20,
ForceMove = 0x40, ForceMove = 0x40,
DisarmOffhand = 0x80, DisarmOffhand = 0x80,
DisablePredStats = 0x100, DisablePredStats = 0x100,
@@ -98,12 +98,21 @@ namespace Framework.Constants
RegeneratePower = 0x800, RegeneratePower = 0x800,
RestrictPartyInteraction = 0x1000, RestrictPartyInteraction = 0x1000,
PreventSpellClick = 0x2000, PreventSpellClick = 0x2000,
AllowEnemyInteract = 0x4000, InteractWhileHostile = 0x4000,
DisableTurn = 0x8000, CannotTurn = 0x8000,
Unk2 = 0x10000, Unk2 = 0x10000,
PlayDeathAnim = 0x20000, PlayDeathAnim = 0x20000,
AllowCheatSpells = 0x40000, AllowCheatSpells = 0x40000,
NoActions = 0x800000 TreatAsRaidUnitForHelpfulSpells = 0x100000,
LargeAoi = 0x00200000,
GiganticAoi = 0x400000,
NoActions = 0x800000,
AiWillOnlySwimIfTargetSwims = 0x1000000,
DontGenerateCombatLogWhenEngagedWithNpcs = 0x2000000,
UntargetableByClient = 0x4000000,
AttackerIgnoresMinimumRanges = 0x8000000,
UninteractibleIfHostile = 0x10000000,
InfiniteAoi = 0x40000000,
} }
public enum UnitFlags3 : uint public enum UnitFlags3 : uint
+3 -3
View File
@@ -2994,7 +2994,7 @@ namespace Game.Entities
} }
} }
if (!HasUnitFlag2(UnitFlags2.DisableTurn)) if (!HasUnitFlag2(UnitFlags2.CannotTurn))
{ {
// Face the target - we need to do this before the unit state is modified for no-turn spells // Face the target - we need to do this before the unit state is modified for no-turn spells
if (target) if (target)
@@ -3041,7 +3041,7 @@ namespace Game.Entities
if (IsPet()) // player pets do not use delay system if (IsPet()) // player pets do not use delay system
{ {
if (!HasUnitFlag2(UnitFlags2.DisableTurn)) if (!HasUnitFlag2(UnitFlags2.CannotTurn))
ReacquireSpellFocusTarget(); ReacquireSpellFocusTarget();
} }
else // don't allow re-target right away to prevent visual bugs else // don't allow re-target right away to prevent visual bugs
@@ -3060,7 +3060,7 @@ namespace Game.Entities
SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Target), _spellFocusInfo.Target); SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Target), _spellFocusInfo.Target);
if (!HasUnitFlag2(UnitFlags2.DisableTurn)) if (!HasUnitFlag2(UnitFlags2.CannotTurn))
{ {
if (!_spellFocusInfo.Target.IsEmpty()) if (!_spellFocusInfo.Target.IsEmpty())
{ {
+1 -1
View File
@@ -499,7 +499,7 @@ namespace Game.Entities
if (attType != WeaponAttackType.BaseAttack && attType != WeaponAttackType.OffAttack) if (attType != WeaponAttackType.BaseAttack && attType != WeaponAttackType.OffAttack)
return; return;
if (IsTypeId(TypeId.Unit) && !HasUnitFlag(UnitFlags.Possessed) && !HasUnitFlag2(UnitFlags2.DisableTurn)) if (IsTypeId(TypeId.Unit) && !HasUnitFlag(UnitFlags.Possessed) && !HasUnitFlag2(UnitFlags2.CannotTurn))
SetFacingToObject(victim, false); // update client side facing to face the target (prevents visual glitches when casting untargeted spells) SetFacingToObject(victim, false); // update client side facing to face the target (prevents visual glitches when casting untargeted spells)
// melee attack spell casted at main hand attack only - no normal melee dmg dealt // melee attack spell casted at main hand attack only - no normal melee dmg dealt
+2 -2
View File
@@ -52,7 +52,7 @@ namespace Game.Entities
public virtual bool CanSwim() public virtual bool CanSwim()
{ {
// Mirror client behavior, if this method returns false then client will not use swimming animation and for players will apply gravity as if there was no water // Mirror client behavior, if this method returns false then client will not use swimming animation and for players will apply gravity as if there was no water
if (HasUnitFlag(UnitFlags.CannotSwim)) if (HasUnitFlag(UnitFlags.CantSwim))
return false; return false;
if (HasUnitFlag(UnitFlags.PlayerControlled)) // is player if (HasUnitFlag(UnitFlags.PlayerControlled)) // is player
return true; return true;
@@ -61,7 +61,7 @@ namespace Game.Entities
if (IsPet() && HasUnitFlag(UnitFlags.PetInCombat)) if (IsPet() && HasUnitFlag(UnitFlags.PetInCombat))
return true; return true;
return HasUnitFlag(UnitFlags.Rename | UnitFlags.Swimming); return HasUnitFlag(UnitFlags.Rename | UnitFlags.CanSwim);
} }
public bool IsInWater() public bool IsInWater()
{ {