Core/Combat: Disable triggers entering combat
Port From (https://github.com/TrinityCore/TrinityCore/commit/1dfcb7086e17902f0904ee6c09bc55a229b65cc1)
This commit is contained in:
@@ -210,6 +210,7 @@ namespace Framework.Constants
|
||||
UnitIsQuestBoss = 0x80000000 // Not verified
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum CreatureFlagsExtra : uint
|
||||
{
|
||||
InstanceBind = 0x01, // Creature Kill Bind Instance With Killer And Killer'S Group
|
||||
@@ -225,7 +226,7 @@ namespace Framework.Constants
|
||||
GhostVisibility = 0x400, // creature will be only visible for dead players
|
||||
UseOffhandAttack = 0x800, // creature will use offhand attacks
|
||||
NoSellVendor = 0x1000, // players can't sell items to this vendor
|
||||
Unused13 = 0x2000,
|
||||
NoCombat = 0x2000, // creature is not allowed to enter combat
|
||||
Worldevent = 0x4000, // Custom Flag For World Event Creatures (Left Room For Merging)
|
||||
Guard = 0x8000, // Creature Is Guard
|
||||
Unused16 = 0x00010000,
|
||||
@@ -246,7 +247,7 @@ namespace Framework.Constants
|
||||
Unused31 = 0x80000000,
|
||||
|
||||
// Masks
|
||||
AllUnused = (Unused13 | Unused16 | Unused22 | Unused23 | Unused24 | Unused25 | Unused26 | Unused27 | Unused31),
|
||||
AllUnused = (Unused16 | Unused22 | Unused23 | Unused24 | Unused25 | Unused26 | Unused27 | Unused31),
|
||||
|
||||
DBAllowed = (0xFFFFFFFF & ~(AllUnused | DungeonBoss))
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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(); }
|
||||
|
||||
Reference in New Issue
Block a user