Core/Combat: Disable triggers entering combat

Port From (https://github.com/TrinityCore/TrinityCore/commit/1dfcb7086e17902f0904ee6c09bc55a229b65cc1)
This commit is contained in:
hondacrx
2022-03-01 17:38:12 -05:00
parent 62cb6ffd33
commit 6f1b2f5cd5
3 changed files with 14 additions and 3 deletions
+6
View File
@@ -57,6 +57,12 @@ namespace Game.Combat
return false;
if (a.HasUnitState(UnitState.InFlight) || b.HasUnitState(UnitState.InFlight))
return false;
Creature aCreature = a.ToCreature();
if (aCreature?.IsCombatDisallowed())
return false;
Creature bCreature = b.ToCreature();
if (bCreature?.IsCombatDisallowed())
return false;
if (a.IsFriendlyTo(b) || b.IsFriendlyTo(a))
return false;
Player playerA = a.GetCharmerOrOwnerPlayerOrPlayerItself();
+5 -1
View File
@@ -3098,7 +3098,11 @@ namespace Game.Entities
{
return GetCreatureTemplate().FlagsExtra.HasAnyFlag(CreatureFlagsExtra.Guard);
}
bool IsCombatDisallowed()
{
return GetCreatureTemplate().FlagsExtra.HasFlag(CreatureFlagsExtra.NoCombat);
}
public bool CanWalk() { return GetMovementTemplate().IsGroundAllowed(); }
public override bool CanSwim() { return GetMovementTemplate().IsSwimAllowed() || IsPet();}
public override bool CanFly() { return GetMovementTemplate().IsFlightAllowed() || IsFlying(); }