Core/Entities: don't allow client control if player is still affected by any lose of control state
Port From (https://github.com/TrinityCore/TrinityCore/commit/29bfa32fc39de1d93fbdb272d48689174c547725)
This commit is contained in:
@@ -484,11 +484,11 @@ namespace Framework.Constants
|
|||||||
|
|
||||||
Unattackable = InFlight,
|
Unattackable = InFlight,
|
||||||
Moving = RoamingMove | ConfusedMove | FleeingMove | ChaseMove | FollowMove,
|
Moving = RoamingMove | ConfusedMove | FleeingMove | ChaseMove | FollowMove,
|
||||||
Controlled = (Confused | Stunned | Fleeing),
|
Controlled = Confused | Stunned | Fleeing,
|
||||||
LostControl = (Controlled | Jumping | Charging),
|
LostControl = Controlled | Possessed | Jumping | Charging,
|
||||||
Sightless = (LostControl | Evade),
|
Sightless = LostControl | Evade,
|
||||||
CannotAutoattack = (LostControl | Casting),
|
CannotAutoattack = LostControl | Casting,
|
||||||
CannotTurn = (LostControl | Rotating),
|
CannotTurn = LostControl | Rotating,
|
||||||
NotMove = Root | Stunned | Died | Distracted,
|
NotMove = Root | Stunned | Died | Distracted,
|
||||||
|
|
||||||
AllErasable = AllStateSupported & ~IgnorePathfinding,
|
AllErasable = AllStateSupported & ~IgnorePathfinding,
|
||||||
|
|||||||
@@ -820,7 +820,8 @@ namespace Game.BattleGrounds
|
|||||||
|
|
||||||
void BlockMovement(Player player)
|
void BlockMovement(Player player)
|
||||||
{
|
{
|
||||||
player.SetClientControl(player, false); // movement disabled NOTE: the effect will be automatically removed by client when the player is teleported from the Battleground, so no need to send with byte(1) in RemovePlayerAtLeave()
|
// movement disabled NOTE: the effect will be automatically removed by client when the player is teleported from the battleground, so no need to send with uint8(1) in RemovePlayerAtLeave()
|
||||||
|
player.SetClientControl(player, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool SendPacket)
|
public virtual void RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool SendPacket)
|
||||||
|
|||||||
@@ -1113,12 +1113,14 @@ namespace Game.Entities
|
|||||||
if (HasAuraType(AuraType.ModStun))
|
if (HasAuraType(AuraType.ModStun))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
ClearUnitState(state);
|
||||||
SetStunned(false);
|
SetStunned(false);
|
||||||
break;
|
break;
|
||||||
case UnitState.Root:
|
case UnitState.Root:
|
||||||
if (HasAuraType(AuraType.ModRoot) || HasAuraType(AuraType.ModRoot2) || GetVehicle() != null)
|
if (HasAuraType(AuraType.ModRoot) || HasAuraType(AuraType.ModRoot2) || GetVehicle() != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
ClearUnitState(state);
|
||||||
if (!HasUnitState(UnitState.Stunned))
|
if (!HasUnitState(UnitState.Stunned))
|
||||||
SetRooted(false);
|
SetRooted(false);
|
||||||
break;
|
break;
|
||||||
@@ -1126,33 +1128,32 @@ namespace Game.Entities
|
|||||||
if (HasAuraType(AuraType.ModConfuse))
|
if (HasAuraType(AuraType.ModConfuse))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
ClearUnitState(state);
|
||||||
SetConfused(false);
|
SetConfused(false);
|
||||||
break;
|
break;
|
||||||
case UnitState.Fleeing:
|
case UnitState.Fleeing:
|
||||||
if (HasAuraType(AuraType.ModFear))
|
if (HasAuraType(AuraType.ModFear))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
ClearUnitState(state);
|
||||||
SetFeared(false);
|
SetFeared(false);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearUnitState(state);
|
|
||||||
|
|
||||||
// Unit States might have been already cleared but auras still present. I need to check with HasAuraType
|
// Unit States might have been already cleared but auras still present. I need to check with HasAuraType
|
||||||
if (HasAuraType(AuraType.ModStun))
|
if (HasAuraType(AuraType.ModStun))
|
||||||
SetStunned(true);
|
SetStunned(true);
|
||||||
else
|
|
||||||
{
|
|
||||||
if (HasAuraType(AuraType.ModRoot) || HasAuraType(AuraType.ModRoot2))
|
|
||||||
SetRooted(true);
|
|
||||||
|
|
||||||
if (HasAuraType(AuraType.ModConfuse))
|
if (HasAuraType(AuraType.ModRoot) || HasAuraType(AuraType.ModRoot2))
|
||||||
SetConfused(true);
|
SetRooted(true);
|
||||||
else if (HasAuraType(AuraType.ModFear))
|
|
||||||
SetFeared(true);
|
if (HasAuraType(AuraType.ModConfuse))
|
||||||
}
|
SetConfused(true);
|
||||||
|
|
||||||
|
if (HasAuraType(AuraType.ModFear))
|
||||||
|
SetFeared(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1251,8 +1252,12 @@ namespace Game.Entities
|
|||||||
|
|
||||||
Player player = ToPlayer();
|
Player player = ToPlayer();
|
||||||
if (player)
|
if (player)
|
||||||
if (player.HasUnitState(UnitState.Possessed))
|
{
|
||||||
player.SetClientControl(this, !apply);
|
if (apply)
|
||||||
|
player.SetClientControl(this, false);
|
||||||
|
else if (!HasUnitState(UnitState.LostControl))
|
||||||
|
player.SetClientControl(this, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetConfused(bool apply)
|
void SetConfused(bool apply)
|
||||||
@@ -1275,8 +1280,12 @@ namespace Game.Entities
|
|||||||
|
|
||||||
Player player = ToPlayer();
|
Player player = ToPlayer();
|
||||||
if (player)
|
if (player)
|
||||||
if (player.HasUnitState(UnitState.Possessed))
|
{
|
||||||
player.SetClientControl(this, !apply);
|
if (apply)
|
||||||
|
player.SetClientControl(this, false);
|
||||||
|
else if (!HasUnitState(UnitState.LostControl))
|
||||||
|
player.SetClientControl(this, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanFreeMove()
|
public bool CanFreeMove()
|
||||||
|
|||||||
@@ -541,7 +541,9 @@ namespace Game.Entities
|
|||||||
NeedChangeAI = true;
|
NeedChangeAI = true;
|
||||||
IsAIEnabled = false;
|
IsAIEnabled = false;
|
||||||
}
|
}
|
||||||
player.SetClientControl(this, true);
|
|
||||||
|
if (!HasUnitState(UnitState.LostControl))
|
||||||
|
player.SetClientControl(this, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
EngageWithTarget(charmer);
|
EngageWithTarget(charmer);
|
||||||
|
|||||||
Reference in New Issue
Block a user