diff --git a/Source/Game/Entities/Player/Player.cs b/Source/Game/Entities/Player/Player.cs index 7fdced130..3a57f43fd 100644 --- a/Source/Game/Entities/Player/Player.cs +++ b/Source/Game/Entities/Player/Player.cs @@ -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) diff --git a/Source/Game/Entities/Unit/Unit.Movement.cs b/Source/Game/Entities/Unit/Unit.Movement.cs index 58ced6e0d..4cb8914c9 100644 --- a/Source/Game/Entities/Unit/Unit.Movement.cs +++ b/Source/Game/Entities/Unit/Unit.Movement.cs @@ -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) { 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; diff --git a/Source/Game/Handlers/MovementHandler.cs b/Source/Game/Handlers/MovementHandler.cs index 106f673ec..ecc7d6d55 100644 --- a/Source/Game/Handlers/MovementHandler.cs +++ b/Source/Game/Handlers/MovementHandler.cs @@ -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)