Core/Unit: UNIT_FLAG renames

Port From (https://github.com/TrinityCore/TrinityCore/commit/f1ac141f25500a0f6ffd3c32b1185de2d9f9c940)
This commit is contained in:
hondacrx
2021-09-26 14:00:30 -04:00
parent 2595e859a2
commit 9afc755dec
15 changed files with 50 additions and 50 deletions
+2 -2
View File
@@ -51,7 +51,7 @@ namespace Framework.Constants
ServerControlled = 0x01, ServerControlled = 0x01,
NonAttackable = 0x02, NonAttackable = 0x02,
RemoveClientControl = 0x04, // This is a legacy flag used to disable movement player's movement while controlling other units, SMSG_CLIENT_CONTROL replaces this functionality clientside now. CONFUSED and FLEEING flags have the same effect on client movement asDISABLE_MOVE_CONTROL in addition to preventing spell casts/autoattack (they all allow climbing steeper hills and emotes while moving) RemoveClientControl = 0x04, // This is a legacy flag used to disable movement player's movement while controlling other units, SMSG_CLIENT_CONTROL replaces this functionality clientside now. CONFUSED and FLEEING flags have the same effect on client movement asDISABLE_MOVE_CONTROL in addition to preventing spell casts/autoattack (they all allow climbing steeper hills and emotes while moving)
PvpAttackable = 0x08, PlayerControlled = 0x08, //controlled by player, use _IMMUNE_TO_PC instead of _IMMUNE_TO_NPC
Rename = 0x10, Rename = 0x10,
Preparation = 0x20, Preparation = 0x20,
Unk6 = 0x40, Unk6 = 0x40,
@@ -72,7 +72,7 @@ namespace Framework.Constants
Disarmed = 0x200000, Disarmed = 0x200000,
Confused = 0x400000, Confused = 0x400000,
Fleeing = 0x800000, Fleeing = 0x800000,
PlayerControlled = 0x1000000, Possessed = 0x1000000, // under direct client control by a player (possess or vehicle)
NotSelectable = 0x2000000, NotSelectable = 0x2000000,
Skinnable = 0x4000000, Skinnable = 0x4000000,
Mount = 0x8000000, Mount = 0x8000000,
+1 -1
View File
@@ -81,7 +81,7 @@ namespace Game.Chat
player.SetPvpFlags(UnitPVPStateFlags.PvP); player.SetPvpFlags(UnitPVPStateFlags.PvP);
player.SetUnitFlags(UnitFlags.PvpAttackable); player.SetUnitFlags(UnitFlags.PlayerControlled);
//-1 is default value //-1 is default value
player.SetWatchedFactionIndex(0xFFFFFFFF); player.SetWatchedFactionIndex(0xFFFFFFFF);
+4 -4
View File
@@ -158,8 +158,8 @@ namespace Game.Combat
if (!IsInCombatWith(refe.Key)) if (!IsInCombatWith(refe.Key))
{ {
Unit target = refe.Value.GetOther(who); Unit target = refe.Value.GetOther(who);
if ((_owner.IsImmuneToPC() && target.HasUnitFlag(UnitFlags.PvpAttackable)) || if ((_owner.IsImmuneToPC() && target.HasUnitFlag(UnitFlags.PlayerControlled)) ||
(_owner.IsImmuneToNPC() && !target.HasUnitFlag(UnitFlags.PvpAttackable))) (_owner.IsImmuneToNPC() && !target.HasUnitFlag(UnitFlags.PlayerControlled)))
continue; continue;
SetInCombatWith(target); SetInCombatWith(target);
} }
@@ -169,8 +169,8 @@ namespace Game.Combat
if (!IsInCombatWith(refe.Key)) if (!IsInCombatWith(refe.Key))
{ {
Unit target = refe.Value.GetOther(who); Unit target = refe.Value.GetOther(who);
if ((_owner.IsImmuneToPC() && target.HasUnitFlag(UnitFlags.PvpAttackable)) || if ((_owner.IsImmuneToPC() && target.HasUnitFlag(UnitFlags.PlayerControlled)) ||
(_owner.IsImmuneToNPC() && !target.HasUnitFlag(UnitFlags.PvpAttackable))) (_owner.IsImmuneToNPC() && !target.HasUnitFlag(UnitFlags.PlayerControlled)))
continue; continue;
SetInCombatWith(target); SetInCombatWith(target);
} }
+1 -1
View File
@@ -782,7 +782,7 @@ namespace Game.Combat
if (a.IsCreature() && a.ToCreature().IsTrigger()) if (a.IsCreature() && a.ToCreature().IsTrigger())
return false; return false;
if (a.HasUnitFlag(UnitFlags.PvpAttackable)) if (a.HasUnitFlag(UnitFlags.PlayerControlled))
{ {
if (b.HasUnitFlag(UnitFlags.ImmuneToPc)) if (b.HasUnitFlag(UnitFlags.ImmuneToPc))
return false; return false;
+1 -1
View File
@@ -1693,7 +1693,7 @@ namespace Game.Entities
return false; return false;
// This set of checks is should be done only for creatures // This set of checks is should be done only for creatures
if ((IsImmuneToNPC() && !who.HasUnitFlag(UnitFlags.PvpAttackable)) || (IsImmuneToPC() && who.HasUnitFlag(UnitFlags.PvpAttackable))) if ((IsImmuneToNPC() && !who.HasUnitFlag(UnitFlags.PlayerControlled)) || (IsImmuneToPC() && who.HasUnitFlag(UnitFlags.PlayerControlled)))
return false; return false;
// Do not attack non-combat pets // Do not attack non-combat pets
+14 -14
View File
@@ -2085,9 +2085,9 @@ namespace Game.Entities
Unit unit = ToUnit(); Unit unit = ToUnit();
Unit targetUnit = target.ToUnit(); Unit targetUnit = target.ToUnit();
if (unit && unit.HasUnitFlag(UnitFlags.PvpAttackable)) if (unit && unit.HasUnitFlag(UnitFlags.PlayerControlled))
{ {
if (targetUnit && targetUnit.HasUnitFlag(UnitFlags.PvpAttackable)) if (targetUnit && targetUnit.HasUnitFlag(UnitFlags.PlayerControlled))
{ {
if (selfPlayerOwner && targetPlayerOwner) if (selfPlayerOwner && targetPlayerOwner)
{ {
@@ -2341,24 +2341,24 @@ namespace Game.Entities
// ignore immunity flags when assisting // ignore immunity flags when assisting
if (bySpell == null || (isPositiveSpell && !bySpell.HasAttribute(SpellAttr6.AssistIgnoreImmuneFlag))) if (bySpell == null || (isPositiveSpell && !bySpell.HasAttribute(SpellAttr6.AssistIgnoreImmuneFlag)))
{ {
if (unit != null && !unit.HasUnitFlag(UnitFlags.PvpAttackable) && unitTarget != null && unitTarget.IsImmuneToNPC()) if (unit != null && !unit.HasUnitFlag(UnitFlags.PlayerControlled) && unitTarget != null && unitTarget.IsImmuneToNPC())
return false; return false;
if (unitTarget != null && !unitTarget.HasUnitFlag(UnitFlags.PvpAttackable) && unit && unit.IsImmuneToNPC()) if (unitTarget != null && !unitTarget.HasUnitFlag(UnitFlags.PlayerControlled) && unit && unit.IsImmuneToNPC())
return false; return false;
if (bySpell == null || !bySpell.HasAttribute(SpellAttr8.AttackIgnoreImmuneToPCFlag)) if (bySpell == null || !bySpell.HasAttribute(SpellAttr8.AttackIgnoreImmuneToPCFlag))
{ {
if (unit != null && unit.HasUnitFlag(UnitFlags.PvpAttackable) && unitTarget && unitTarget.IsImmuneToPC()) if (unit != null && unit.HasUnitFlag(UnitFlags.PlayerControlled) && unitTarget && unitTarget.IsImmuneToPC())
return false; return false;
if (unitTarget != null && unitTarget.HasUnitFlag(UnitFlags.PvpAttackable) && unit && unit.IsImmuneToPC()) if (unitTarget != null && unitTarget.HasUnitFlag(UnitFlags.PlayerControlled) && unit && unit.IsImmuneToPC())
return false; return false;
} }
} }
// CvC case - can attack each other only when one of them is hostile // CvC case - can attack each other only when one of them is hostile
if (unit && !unit.HasUnitFlag(UnitFlags.PvpAttackable) && unitTarget != null && !unitTarget.HasUnitFlag(UnitFlags.PvpAttackable)) if (unit && !unit.HasUnitFlag(UnitFlags.PlayerControlled) && unitTarget != null && !unitTarget.HasUnitFlag(UnitFlags.PlayerControlled))
return IsHostileTo(target) || target.IsHostileTo(this); return IsHostileTo(target) || target.IsHostileTo(this);
// PvP, PvC, CvP case // PvP, PvC, CvP case
@@ -2366,8 +2366,8 @@ namespace Game.Entities
if (IsFriendlyTo(target) || target.IsFriendlyTo(this)) if (IsFriendlyTo(target) || target.IsFriendlyTo(this))
return false; return false;
Player playerAffectingAttacker = unit != null && unit.HasUnitFlag(UnitFlags.PvpAttackable) ? GetAffectingPlayer() : null; Player playerAffectingAttacker = unit != null && unit.HasUnitFlag(UnitFlags.PlayerControlled) ? GetAffectingPlayer() : null;
Player playerAffectingTarget = unitTarget != null && unitTarget.HasUnitFlag(UnitFlags.PvpAttackable) ? target.GetAffectingPlayer() : null; Player playerAffectingTarget = unitTarget != null && unitTarget.HasUnitFlag(UnitFlags.PlayerControlled) ? target.GetAffectingPlayer() : null;
// Not all neutral creatures can be attacked (even some unfriendly faction does not react aggresive to you, like Sporaggar) // Not all neutral creatures can be attacked (even some unfriendly faction does not react aggresive to you, like Sporaggar)
if ((playerAffectingAttacker && !playerAffectingTarget) || (!playerAffectingAttacker && playerAffectingTarget)) if ((playerAffectingAttacker && !playerAffectingTarget) || (!playerAffectingAttacker && playerAffectingTarget))
@@ -2408,7 +2408,7 @@ namespace Game.Entities
// PvP case - can't attack when attacker or target are in sanctuary // PvP case - can't attack when attacker or target are in sanctuary
// however, 13850 client doesn't allow to attack when one of the unit's has sanctuary flag and is pvp // however, 13850 client doesn't allow to attack when one of the unit's has sanctuary flag and is pvp
if (unitTarget && unitTarget.HasUnitFlag(UnitFlags.PvpAttackable) && unit && unit.HasUnitFlag(UnitFlags.PvpAttackable) && (unitTarget.IsInSanctuary() || unit.IsInSanctuary())) if (unitTarget && unitTarget.HasUnitFlag(UnitFlags.PlayerControlled) && unit && unit.HasUnitFlag(UnitFlags.PlayerControlled) && (unitTarget.IsInSanctuary() || unit.IsInSanctuary()))
return false; return false;
// additional checks - only PvP case // additional checks - only PvP case
@@ -2477,7 +2477,7 @@ namespace Game.Entities
if (isNegativeSpell || bySpell == null || !bySpell.HasAttribute(SpellAttr6.AssistIgnoreImmuneFlag)) if (isNegativeSpell || bySpell == null || !bySpell.HasAttribute(SpellAttr6.AssistIgnoreImmuneFlag))
{ {
if (unit != null && unit.HasUnitFlag(UnitFlags.PvpAttackable)) if (unit != null && unit.HasUnitFlag(UnitFlags.PlayerControlled))
{ {
if (bySpell == null || !bySpell.HasAttribute(SpellAttr8.AttackIgnoreImmuneToPCFlag)) if (bySpell == null || !bySpell.HasAttribute(SpellAttr8.AttackIgnoreImmuneToPCFlag))
if (unitTarget != null && unitTarget.IsImmuneToPC()) if (unitTarget != null && unitTarget.IsImmuneToPC())
@@ -2495,10 +2495,10 @@ namespace Game.Entities
return false; return false;
// PvP case // PvP case
if (unitTarget != null && unitTarget.HasUnitFlag(UnitFlags.PvpAttackable)) if (unitTarget != null && unitTarget.HasUnitFlag(UnitFlags.PlayerControlled))
{ {
Player targetPlayerOwner = target.GetAffectingPlayer(); Player targetPlayerOwner = target.GetAffectingPlayer();
if (unit != null && unit.HasUnitFlag(UnitFlags.PvpAttackable)) if (unit != null && unit.HasUnitFlag(UnitFlags.PlayerControlled))
{ {
Player selfPlayerOwner = GetAffectingPlayer(); Player selfPlayerOwner = GetAffectingPlayer();
if (selfPlayerOwner != null && targetPlayerOwner != null) if (selfPlayerOwner != null && targetPlayerOwner != null)
@@ -2519,7 +2519,7 @@ namespace Game.Entities
} }
// PvC case - player can assist creature only if has specific type flags // PvC case - player can assist creature only if has specific type flags
// !target.HasFlag(UNIT_FIELD_FLAGS, UnitFlags.PvpAttackable) && // !target.HasFlag(UNIT_FIELD_FLAGS, UnitFlags.PvpAttackable) &&
else if (unit != null && unit.HasUnitFlag(UnitFlags.PvpAttackable)) else if (unit != null && unit.HasUnitFlag(UnitFlags.PlayerControlled))
{ {
if (bySpell == null || !bySpell.HasAttribute(SpellAttr6.AssistIgnoreImmuneFlag)) if (bySpell == null || !bySpell.HasAttribute(SpellAttr6.AssistIgnoreImmuneFlag))
{ {
+2 -2
View File
@@ -209,14 +209,14 @@ namespace Game.Entities
petlevel = owner.GetLevel(); petlevel = owner.GetLevel();
SetClass(Class.Mage); SetClass(Class.Mage);
SetUnitFlags(UnitFlags.PvpAttackable); // this enables popup window (pet dismiss, cancel) SetUnitFlags(UnitFlags.PlayerControlled); // this enables popup window (pet dismiss, cancel)
break; break;
case PetType.Hunter: case PetType.Hunter:
SetClass(Class.Warrior); SetClass(Class.Warrior);
SetGender(Gender.None); SetGender(Gender.None);
SetSheath(SheathState.Melee); SetSheath(SheathState.Melee);
SetPetFlags(result.Read<bool>(9) ? UnitPetFlags.CanBeAbandoned : UnitPetFlags.CanBeRenamed | UnitPetFlags.CanBeAbandoned); SetPetFlags(result.Read<bool>(9) ? UnitPetFlags.CanBeAbandoned : UnitPetFlags.CanBeRenamed | UnitPetFlags.CanBeAbandoned);
SetUnitFlags(UnitFlags.PvpAttackable); // this enables popup window (pet abandon, cancel) SetUnitFlags(UnitFlags.PlayerControlled); // this enables popup window (pet abandon, cancel)
break; break;
default: default:
if (!IsPetGhoul()) if (!IsPetGhoul())
+2 -2
View File
@@ -217,7 +217,7 @@ namespace Game.Entities
if ((RealmType)WorldConfig.GetIntValue(WorldCfg.GameType) == RealmType.PVP || (RealmType)WorldConfig.GetIntValue(WorldCfg.GameType) == RealmType.RPPVP) if ((RealmType)WorldConfig.GetIntValue(WorldCfg.GameType) == RealmType.PVP || (RealmType)WorldConfig.GetIntValue(WorldCfg.GameType) == RealmType.RPPVP)
{ {
AddPvpFlag(UnitPVPStateFlags.PvP); AddPvpFlag(UnitPVPStateFlags.PvP);
AddUnitFlag(UnitFlags.PvpAttackable); AddUnitFlag(UnitFlags.PlayerControlled);
} }
AddUnitFlag2(UnitFlags2.RegeneratePower); AddUnitFlag2(UnitFlags2.RegeneratePower);
@@ -5814,7 +5814,7 @@ namespace Game.Entities
UnitFlags.Stunned | UnitFlags.InCombat | UnitFlags.Disarmed | UnitFlags.Stunned | UnitFlags.InCombat | UnitFlags.Disarmed |
UnitFlags.Confused | UnitFlags.Fleeing | UnitFlags.NotSelectable | UnitFlags.Confused | UnitFlags.Fleeing | UnitFlags.NotSelectable |
UnitFlags.Skinnable | UnitFlags.Mount | UnitFlags.TaxiFlight); UnitFlags.Skinnable | UnitFlags.Mount | UnitFlags.TaxiFlight);
AddUnitFlag(UnitFlags.PvpAttackable); // must be set AddUnitFlag(UnitFlags.PlayerControlled); // must be set
AddUnitFlag2(UnitFlags2.RegeneratePower);// must be set AddUnitFlag2(UnitFlags2.RegeneratePower);// must be set
+2 -2
View File
@@ -517,7 +517,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.PlayerControlled) && !HasUnitFlag2(UnitFlags2.DisableTurn)) if (IsTypeId(TypeId.Unit) && !HasUnitFlag(UnitFlags.Possessed) && !HasUnitFlag2(UnitFlags2.DisableTurn))
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
@@ -600,7 +600,7 @@ namespace Game.Entities
if (attType != WeaponAttackType.BaseAttack && attType != WeaponAttackType.OffAttack) if (attType != WeaponAttackType.BaseAttack && attType != WeaponAttackType.OffAttack)
return; // ignore ranged case return; // ignore ranged case
if (IsTypeId(TypeId.Unit) && !HasUnitFlag(UnitFlags.PlayerControlled) && !HasUnitFlag2(UnitFlags2.DisableTurn)) if (IsTypeId(TypeId.Unit) && !HasUnitFlag(UnitFlags.Possessed) && !HasUnitFlag2(UnitFlags2.DisableTurn))
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)
CalcDamageInfo damageInfo = new(); CalcDamageInfo damageInfo = new();
+1 -1
View File
@@ -54,7 +54,7 @@ namespace Game.Entities
// 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.CannotSwim))
return false; return false;
if (HasUnitFlag(UnitFlags.PvpAttackable)) // is player if (HasUnitFlag(UnitFlags.PlayerControlled)) // is player
return true; return true;
if (HasUnitFlag2((UnitFlags2)0x1000000)) if (HasUnitFlag2((UnitFlags2)0x1000000))
return false; return false;
+10 -10
View File
@@ -147,7 +147,7 @@ namespace Game.Entities
if (IsTypeId(TypeId.Player)) if (IsTypeId(TypeId.Player))
{ {
minion.m_ControlledByPlayer = true; minion.m_ControlledByPlayer = true;
minion.AddUnitFlag(UnitFlags.PvpAttackable); minion.AddUnitFlag(UnitFlags.PlayerControlled);
} }
// Can only have one pet. If a new one is summoned, dismiss the old one. // Can only have one pet. If a new one is summoned, dismiss the old one.
@@ -406,12 +406,12 @@ namespace Game.Entities
switch (type) switch (type)
{ {
case CharmType.Vehicle: case CharmType.Vehicle:
AddUnitFlag(UnitFlags.PlayerControlled); AddUnitFlag(UnitFlags.Possessed);
playerCharmer.SetClientControl(this, true); playerCharmer.SetClientControl(this, true);
playerCharmer.VehicleSpellInitialize(); playerCharmer.VehicleSpellInitialize();
break; break;
case CharmType.Possess: case CharmType.Possess:
AddUnitFlag(UnitFlags.PlayerControlled); AddUnitFlag(UnitFlags.Possessed);
charmer.AddUnitFlag(UnitFlags.RemoveClientControl); charmer.AddUnitFlag(UnitFlags.RemoveClientControl);
playerCharmer.SetClientControl(this, true); playerCharmer.SetClientControl(this, true);
playerCharmer.PossessSpellInitialize(); playerCharmer.PossessSpellInitialize();
@@ -507,14 +507,14 @@ namespace Game.Entities
case CharmType.Vehicle: case CharmType.Vehicle:
playerCharmer.SetClientControl(this, false); playerCharmer.SetClientControl(this, false);
playerCharmer.SetClientControl(charmer, true); playerCharmer.SetClientControl(charmer, true);
RemoveUnitFlag(UnitFlags.PlayerControlled); RemoveUnitFlag(UnitFlags.Possessed);
break; break;
case CharmType.Possess: case CharmType.Possess:
ClearUnitState(UnitState.Possessed); ClearUnitState(UnitState.Possessed);
playerCharmer.SetClientControl(this, false); playerCharmer.SetClientControl(this, false);
playerCharmer.SetClientControl(charmer, true); playerCharmer.SetClientControl(charmer, true);
charmer.RemoveUnitFlag(UnitFlags.RemoveClientControl); charmer.RemoveUnitFlag(UnitFlags.RemoveClientControl);
RemoveUnitFlag(UnitFlags.PlayerControlled); RemoveUnitFlag(UnitFlags.Possessed);
break; break;
case CharmType.Charm: case CharmType.Charm:
if (IsTypeId(TypeId.Unit) && charmer.GetClass() == Class.Warlock) if (IsTypeId(TypeId.Unit) && charmer.GetClass() == Class.Warlock)
@@ -594,7 +594,7 @@ namespace Game.Entities
charm.m_ControlledByPlayer = true; charm.m_ControlledByPlayer = true;
// @todo maybe we can use this flag to check if controlled by player // @todo maybe we can use this flag to check if controlled by player
charm.AddUnitFlag(UnitFlags.PvpAttackable); charm.AddUnitFlag(UnitFlags.PlayerControlled);
} }
else else
charm.m_ControlledByPlayer = false; charm.m_ControlledByPlayer = false;
@@ -635,19 +635,19 @@ namespace Game.Entities
if (charm.IsTypeId(TypeId.Player)) if (charm.IsTypeId(TypeId.Player))
{ {
charm.m_ControlledByPlayer = true; charm.m_ControlledByPlayer = true;
charm.AddUnitFlag(UnitFlags.PvpAttackable); charm.AddUnitFlag(UnitFlags.PlayerControlled);
charm.ToPlayer().UpdatePvPState(); charm.ToPlayer().UpdatePvPState();
} }
else if (player) else if (player)
{ {
charm.m_ControlledByPlayer = true; charm.m_ControlledByPlayer = true;
charm.AddUnitFlag(UnitFlags.PvpAttackable); charm.AddUnitFlag(UnitFlags.PlayerControlled);
charm.SetPvpFlags(player.GetPvpFlags()); charm.SetPvpFlags(player.GetPvpFlags());
} }
else else
{ {
charm.m_ControlledByPlayer = false; charm.m_ControlledByPlayer = false;
charm.RemoveUnitFlag(UnitFlags.PvpAttackable); charm.RemoveUnitFlag(UnitFlags.PlayerControlled);
charm.SetPvpFlags(UnitPVPStateFlags.None); charm.SetPvpFlags(UnitPVPStateFlags.None);
} }
@@ -791,7 +791,7 @@ namespace Game.Entities
pet.SetCreatedBySpell(spell_id); pet.SetCreatedBySpell(spell_id);
if (IsTypeId(TypeId.Player)) if (IsTypeId(TypeId.Player))
pet.AddUnitFlag(UnitFlags.PvpAttackable); pet.AddUnitFlag(UnitFlags.PlayerControlled);
if (!pet.InitStatsForLevel(level)) if (!pet.InitStatsForLevel(level))
{ {
+4 -4
View File
@@ -2843,11 +2843,11 @@ namespace Game.Entities
{ {
List<CombatReference> toEnd = new(); List<CombatReference> toEnd = new();
foreach (var pair in m_combatManager.GetPvECombatRefs()) foreach (var pair in m_combatManager.GetPvECombatRefs())
if (pair.Value.GetOther(this).HasUnitFlag(UnitFlags.PvpAttackable)) if (pair.Value.GetOther(this).HasUnitFlag(UnitFlags.PlayerControlled))
toEnd.Add(pair.Value); toEnd.Add(pair.Value);
foreach (var pair in m_combatManager.GetPvPCombatRefs()) foreach (var pair in m_combatManager.GetPvPCombatRefs())
if (pair.Value.GetOther(this).HasUnitFlag(UnitFlags.PvpAttackable)) if (pair.Value.GetOther(this).HasUnitFlag(UnitFlags.PlayerControlled))
toEnd.Add(pair.Value); toEnd.Add(pair.Value);
foreach (CombatReference refe in toEnd) foreach (CombatReference refe in toEnd)
@@ -2877,11 +2877,11 @@ namespace Game.Entities
{ {
List<CombatReference> toEnd = new(); List<CombatReference> toEnd = new();
foreach (var pair in m_combatManager.GetPvECombatRefs()) foreach (var pair in m_combatManager.GetPvECombatRefs())
if (!pair.Value.GetOther(this).HasUnitFlag(UnitFlags.PvpAttackable)) if (!pair.Value.GetOther(this).HasUnitFlag(UnitFlags.PlayerControlled))
toEnd.Add(pair.Value); toEnd.Add(pair.Value);
foreach (var pair in m_combatManager.GetPvPCombatRefs()) foreach (var pair in m_combatManager.GetPvPCombatRefs())
if (!pair.Value.GetOther(this).HasUnitFlag(UnitFlags.PvpAttackable)) if (!pair.Value.GetOther(this).HasUnitFlag(UnitFlags.PlayerControlled))
toEnd.Add(pair.Value); toEnd.Add(pair.Value);
foreach (CombatReference refe in toEnd) foreach (CombatReference refe in toEnd)
+2 -2
View File
@@ -4543,13 +4543,13 @@ namespace Game.Spells
{ {
target.SetFaction((uint)GetMiscValue()); target.SetFaction((uint)GetMiscValue());
if (target.IsTypeId(TypeId.Player)) if (target.IsTypeId(TypeId.Player))
target.RemoveUnitFlag(UnitFlags.PvpAttackable); target.RemoveUnitFlag(UnitFlags.PlayerControlled);
} }
else else
{ {
target.RestoreFaction(); target.RestoreFaction();
if (target.IsTypeId(TypeId.Player)) if (target.IsTypeId(TypeId.Player))
target.AddUnitFlag(UnitFlags.PvpAttackable); target.AddUnitFlag(UnitFlags.PlayerControlled);
} }
} }
+3 -3
View File
@@ -1935,7 +1935,7 @@ namespace Game.Spells
if (m_originalCaster && unit.IsInCombat() && m_spellInfo.HasInitialAggro()) if (m_originalCaster && unit.IsInCombat() && m_spellInfo.HasInitialAggro())
{ {
if (m_originalCaster.HasUnitFlag(UnitFlags.PvpAttackable)) // only do explicit combat forwarding for PvP enabled units if (m_originalCaster.HasUnitFlag(UnitFlags.PlayerControlled)) // only do explicit combat forwarding for PvP enabled units
m_originalCaster.GetCombatManager().InheritCombatStatesFrom(unit); // for creature v creature combat, the threat forward does it for us m_originalCaster.GetCombatManager().InheritCombatStatesFrom(unit); // for creature v creature combat, the threat forward does it for us
unit.GetThreatManager().ForwardThreatForAssistingMe(m_originalCaster, 0.0f, null, true); unit.GetThreatManager().ForwardThreatForAssistingMe(m_originalCaster, 0.0f, null, true);
} }
@@ -2337,7 +2337,7 @@ namespace Game.Spells
} }
// focus if not controlled creature // focus if not controlled creature
if (m_caster.GetTypeId() == TypeId.Unit && !m_caster.ToUnit().HasUnitFlag(UnitFlags.PlayerControlled)) if (m_caster.GetTypeId() == TypeId.Unit && !m_caster.ToUnit().HasUnitFlag(UnitFlags.Possessed))
{ {
if (!(m_spellInfo.IsNextMeleeSwingSpell() || IsAutoRepeat())) if (!(m_spellInfo.IsNextMeleeSwingSpell() || IsAutoRepeat()))
{ {
@@ -2600,7 +2600,7 @@ namespace Game.Spells
// if the spell allows the creature to turn while casting, then adjust server-side orientation to face the target now // if the spell allows the creature to turn while casting, then adjust server-side orientation to face the target now
// client-side orientation is handled by the client itself, as the cast target is targeted due to Creature::FocusTarget // client-side orientation is handled by the client itself, as the cast target is targeted due to Creature::FocusTarget
if (m_caster.IsTypeId(TypeId.Unit) && !m_caster.ToUnit().HasUnitFlag(UnitFlags.PlayerControlled)) if (m_caster.IsTypeId(TypeId.Unit) && !m_caster.ToUnit().HasUnitFlag(UnitFlags.Possessed))
{ {
if (!m_spellInfo.HasAttribute(SpellAttr5.DontTurnDuringCast)) if (!m_spellInfo.HasAttribute(SpellAttr5.DontTurnDuringCast))
{ {
+1 -1
View File
@@ -1021,7 +1021,7 @@ namespace Scripts.World.NpcSpecial
if (Patient) if (Patient)
{ {
//303, this flag appear to be required for client side item.spell to work (TARGET_SINGLE_FRIEND) //303, this flag appear to be required for client side item.spell to work (TARGET_SINGLE_FRIEND)
Patient.AddUnitFlag(UnitFlags.PvpAttackable); Patient.AddUnitFlag(UnitFlags.PlayerControlled);
Patients.Add(Patient.GetGUID()); Patients.Add(Patient.GetGUID());
((npc_injured_patient)Patient.GetAI()).DoctorGUID = me.GetGUID(); ((npc_injured_patient)Patient.GetAI()).DoctorGUID = me.GetGUID();