Core/Creatures: Implemented CREATURE_STATIC_FLAG_3_NO_THREAT_FEEDBACK

Port From (https://github.com/TrinityCore/TrinityCore/commit/3fd1a2b78c8791576679e93ce1d43038db2212c5)
This commit is contained in:
hondacrx
2024-02-21 18:03:12 -05:00
parent 71e03da934
commit d175373d44
2 changed files with 21 additions and 5 deletions
+17 -4
View File
@@ -669,6 +669,10 @@ namespace Game.Combat
void SendClearAllThreatToClients() void SendClearAllThreatToClients()
{ {
Creature owner = _owner.ToCreature();
if (owner != null && owner.IsThreatFeedbackDisabled())
return;
ThreatClear threatClear = new(); ThreatClear threatClear = new();
threatClear.UnitGUID = _owner.GetGUID(); threatClear.UnitGUID = _owner.GetGUID();
_owner.SendMessageToSet(threatClear, false); _owner.SendMessageToSet(threatClear, false);
@@ -676,6 +680,10 @@ namespace Game.Combat
public void SendRemoveToClients(Unit victim) public void SendRemoveToClients(Unit victim)
{ {
Creature owner = _owner.ToCreature();
if (owner != null && owner.IsThreatFeedbackDisabled())
return;
ThreatRemove threatRemove = new(); ThreatRemove threatRemove = new();
threatRemove.UnitGUID = _owner.GetGUID(); threatRemove.UnitGUID = _owner.GetGUID();
threatRemove.AboutGUID = victim.GetGUID(); threatRemove.AboutGUID = victim.GetGUID();
@@ -684,6 +692,10 @@ namespace Game.Combat
void SendThreatListToClients(bool newHighest) void SendThreatListToClients(bool newHighest)
{ {
Creature owner = _owner.ToCreature();
if (owner != null && owner.IsThreatFeedbackDisabled())
return;
void fillSharedPacketDataAndSend(dynamic packet) void fillSharedPacketDataAndSend(dynamic packet)
{ {
packet.UnitGUID = _owner.GetGUID(); packet.UnitGUID = _owner.GetGUID();
@@ -961,16 +973,17 @@ namespace Game.Combat
public bool IsTaunting() { return _taunted >= TauntState.Taunt; } public bool IsTaunting() { return _taunted >= TauntState.Taunt; }
public bool IsDetaunted() { return _taunted == TauntState.Detaunt; } public bool IsDetaunted() { return _taunted == TauntState.Detaunt; }
public void SetThreat(float amount) public void SetThreat(float amount)
{ {
_baseAmount = amount; _baseAmount = amount;
ListNotifyChanged(); ListNotifyChanged();
} }
public void ModifyThreatByPercent(int percent) public void ModifyThreatByPercent(int percent)
{ {
if (percent != 0) if (percent != 0)
ScaleThreat(0.01f * (100f + percent)); } ScaleThreat(0.01f * (100f + percent));
}
public void ListNotifyChanged() { _mgr.ListNotifyChanged(); } public void ListNotifyChanged() { _mgr.ListNotifyChanged(); }
+4 -1
View File
@@ -3352,7 +3352,10 @@ namespace Game.Entities
public override void SetImmuneToPC(bool apply) { SetImmuneToPC(apply, HasReactState(ReactStates.Passive)); } public override void SetImmuneToPC(bool apply) { SetImmuneToPC(apply, HasReactState(ReactStates.Passive)); }
public override void SetImmuneToNPC(bool apply) { SetImmuneToNPC(apply, HasReactState(ReactStates.Passive)); } public override void SetImmuneToNPC(bool apply) { SetImmuneToNPC(apply, HasReactState(ReactStates.Passive)); }
void SetUnkillable(bool unkillable) { _staticFlags.ApplyFlag(CreatureStaticFlags.Unkillable, unkillable); } public bool IsThreatFeedbackDisabled() { return _staticFlags.HasFlag(CreatureStaticFlags3.NoThreatFeedback); }
public void SetNoThreatFeedback(bool noThreatFeedback) { _staticFlags.ApplyFlag(CreatureStaticFlags3.NoThreatFeedback, noThreatFeedback); }
public void SetUnkillable(bool unkillable) { _staticFlags.ApplyFlag(CreatureStaticFlags.Unkillable, unkillable); }
public bool IsInEvadeMode() { return HasUnitState(UnitState.Evade); } public bool IsInEvadeMode() { return HasUnitState(UnitState.Evade); }
public bool IsEvadingAttacks() { return IsInEvadeMode() || CanNotReachTarget(); } public bool IsEvadingAttacks() { return IsInEvadeMode() || CanNotReachTarget(); }