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;
|
||||
}
|
||||
public void SetInWater(bool apply)
|
||||
public override void SetInWater(bool inWater)
|
||||
{
|
||||
if (m_isInWater == apply)
|
||||
if (m_isInWater == inWater)
|
||||
return;
|
||||
|
||||
//define player in water by opcodes
|
||||
@@ -1904,11 +1904,12 @@ namespace Game.Entities
|
||||
//which can't swim and move guid back into ThreatList when
|
||||
//on surface.
|
||||
// @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
|
||||
RemoveAurasWithInterruptFlags((apply ? SpellAuraInterruptFlags.NotAbovewater : SpellAuraInterruptFlags.NotUnderwater));
|
||||
// Call base
|
||||
base.SetInWater(inWater);
|
||||
|
||||
// Update threat tables
|
||||
GetHostileRefManager().UpdateThreatTables();
|
||||
}
|
||||
public void ValidateMovementInfo(MovementInfo mi)
|
||||
|
||||
@@ -783,16 +783,21 @@ namespace Game.Entities
|
||||
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)
|
||||
{
|
||||
if (IsFlying() || !IsControlledByPlayer())
|
||||
return;
|
||||
|
||||
// remove appropriate auras if we are swimming/not swimming respectively
|
||||
if (status.HasAnyFlag(ZLiquidStatus.Swimming))
|
||||
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.NotAbovewater);
|
||||
else
|
||||
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.NotUnderwater);
|
||||
SetInWater(status & ZLiquidStatus.Swimming);
|
||||
|
||||
// liquid aura handling
|
||||
LiquidTypeRecord curLiquid = null;
|
||||
|
||||
@@ -140,12 +140,6 @@ namespace Game
|
||||
if (opcode == ClientOpcodes.MoveFallLand || opcode == ClientOpcodes.MoveStartSwim)
|
||||
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();
|
||||
|
||||
if (m_clientTimeDelay == 0)
|
||||
|
||||
Reference in New Issue
Block a user