Core/Movement: Don't rely on client for water state detection
Port From (https://github.com/TrinityCore/TrinityCore/commit/931a3871f88737ca13277ee88444b9808b366039)
This commit is contained in:
@@ -1894,9 +1894,9 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
return m_isInWater;
|
return m_isInWater;
|
||||||
}
|
}
|
||||||
public void SetInWater(bool apply)
|
public override void SetInWater(bool inWater)
|
||||||
{
|
{
|
||||||
if (m_isInWater == apply)
|
if (m_isInWater == inWater)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//define player in water by opcodes
|
//define player in water by opcodes
|
||||||
@@ -1904,11 +1904,12 @@ namespace Game.Entities
|
|||||||
//which can't swim and move guid back into ThreatList when
|
//which can't swim and move guid back into ThreatList when
|
||||||
//on surface.
|
//on surface.
|
||||||
// @todo exist also swimming mobs, and function must be symmetric to enter/leave water
|
// @todo exist also swimming mobs, and function must be symmetric to enter/leave water
|
||||||
m_isInWater = apply;
|
m_isInWater = inWater;
|
||||||
|
|
||||||
// remove auras that need water/land
|
// Call base
|
||||||
RemoveAurasWithInterruptFlags((apply ? SpellAuraInterruptFlags.NotAbovewater : SpellAuraInterruptFlags.NotUnderwater));
|
base.SetInWater(inWater);
|
||||||
|
|
||||||
|
// Update threat tables
|
||||||
GetHostileRefManager().UpdateThreatTables();
|
GetHostileRefManager().UpdateThreatTables();
|
||||||
}
|
}
|
||||||
public void ValidateMovementInfo(MovementInfo mi)
|
public void ValidateMovementInfo(MovementInfo mi)
|
||||||
|
|||||||
@@ -783,16 +783,21 @@ namespace Game.Entities
|
|||||||
ProcessTerrainStatusUpdate(data.LiquidStatus, data.LiquidInfo);
|
ProcessTerrainStatusUpdate(data.LiquidStatus, data.LiquidInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void SetInWater(bool inWater)
|
||||||
|
{
|
||||||
|
// remove appropriate auras if we are swimming/not swimming respectively
|
||||||
|
if (inWater)
|
||||||
|
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.NotAbovewater);
|
||||||
|
else
|
||||||
|
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.NotUnderwater);
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void ProcessTerrainStatusUpdate(ZLiquidStatus status, Optional<LiquidData> liquidData)
|
public virtual void ProcessTerrainStatusUpdate(ZLiquidStatus status, Optional<LiquidData> liquidData)
|
||||||
{
|
{
|
||||||
if (IsFlying() || !IsControlledByPlayer())
|
if (IsFlying() || !IsControlledByPlayer())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// remove appropriate auras if we are swimming/not swimming respectively
|
SetInWater(status & ZLiquidStatus.Swimming);
|
||||||
if (status.HasAnyFlag(ZLiquidStatus.Swimming))
|
|
||||||
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.NotAbovewater);
|
|
||||||
else
|
|
||||||
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.NotUnderwater);
|
|
||||||
|
|
||||||
// liquid aura handling
|
// liquid aura handling
|
||||||
LiquidTypeRecord curLiquid = null;
|
LiquidTypeRecord curLiquid = null;
|
||||||
|
|||||||
@@ -140,12 +140,6 @@ namespace Game
|
|||||||
if (opcode == ClientOpcodes.MoveFallLand || opcode == ClientOpcodes.MoveStartSwim)
|
if (opcode == ClientOpcodes.MoveFallLand || opcode == ClientOpcodes.MoveStartSwim)
|
||||||
mover.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.Landing); // Parachutes
|
mover.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.Landing); // Parachutes
|
||||||
|
|
||||||
if (plrMover && movementInfo.HasMovementFlag(MovementFlag.Swimming) != plrMover.IsInWater())
|
|
||||||
{
|
|
||||||
// now client not include swimming flag in case jumping under water
|
|
||||||
plrMover.SetInWater(!plrMover.IsInWater() || plrMover.GetMap().IsUnderWater(plrMover.GetPhaseShift(), movementInfo.Pos.posX, movementInfo.Pos.posY, movementInfo.Pos.posZ));
|
|
||||||
}
|
|
||||||
|
|
||||||
uint mstime = GameTime.GetGameTimeMS();
|
uint mstime = GameTime.GetGameTimeMS();
|
||||||
|
|
||||||
if (m_clientTimeDelay == 0)
|
if (m_clientTimeDelay == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user