From f288326f6e1464b3912324988e9aaa6a7d3c6cd6 Mon Sep 17 00:00:00 2001 From: Neon Date: Thu, 8 Aug 2024 23:19:44 +0200 Subject: [PATCH] Fixed display issues with moving players entering visibility range Players moving in a straight line would be displayed as stationary when entering the 100m visibility radius of other players. This issue could cause significant discrepancies between the displayed and the actual position, as the server only broadcasts SM_MOVE packets when stopping or changing direction. --- .../aion/serverpackets/SM_PLAYER_INFO.java | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/game-server/src/com/aionemu/gameserver/network/aion/serverpackets/SM_PLAYER_INFO.java b/game-server/src/com/aionemu/gameserver/network/aion/serverpackets/SM_PLAYER_INFO.java index c48066bfe..1bae20301 100644 --- a/game-server/src/com/aionemu/gameserver/network/aion/serverpackets/SM_PLAYER_INFO.java +++ b/game-server/src/com/aionemu/gameserver/network/aion/serverpackets/SM_PLAYER_INFO.java @@ -1,5 +1,8 @@ package com.aionemu.gameserver.network.aion.serverpackets; +import com.aionemu.gameserver.controllers.movement.MovementMask; +import com.aionemu.gameserver.controllers.movement.PlayerMoveController; +import com.aionemu.gameserver.geoEngine.math.Vector3f; import com.aionemu.gameserver.model.actions.PlayerMode; import com.aionemu.gameserver.model.gameobjects.player.CustomPlayerState; import com.aionemu.gameserver.model.gameobjects.player.Player; @@ -162,7 +165,8 @@ protected void writeImpl(AionConnection con) { writeF(playerAppearance.getHeight()); writeF(0.25f); // scale writeF(2.0f); // gravity or slide surface o_O - writeF(player.getGameStats().getMovementSpeedFloat()); // move speed + float movementSpeed = player.getGameStats().getMovementSpeedFloat(); + writeF(movementSpeed); Stat2 attackSpeed = player.getGameStats().getAttackSpeed(); writeH(attackSpeed.getBase()); @@ -171,15 +175,25 @@ protected void writeImpl(AionConnection con) { writeS(player.hasStore() ? player.getStore().getStoreMessage() : ""); // private store message - // Movement - writeF(0); - writeF(0); - writeF(0); - - writeF(player.getX());// x - writeF(player.getY());// y - writeF(player.getZ());// z - writeC(0x00); // move type + PlayerMoveController pmc = player.getMoveController(); + byte movementMask = pmc.getMovementMask(); + if ((pmc.movementMask & MovementMask.ABSOLUTE) == MovementMask.ABSOLUTE) { + // calculate the vector, as click to move and target coords are not supported here + Vector3f vector = new Vector3f(pmc.getTargetX2() - player.getX(), pmc.getTargetY2() - player.getY(), + pmc.getTargetZ2() - player.getZ()).normalizeLocal().multLocal(movementSpeed); + writeF(vector.getX()); + writeF(vector.getY()); + writeF(vector.getZ()); + movementMask &= ~MovementMask.ABSOLUTE; + } else { + writeF(pmc.vectorX); + writeF(pmc.vectorY); + writeF(pmc.vectorZ); + } + writeF(player.getX()); + writeF(player.getY()); + writeF(player.getZ()); + writeC(movementMask); if (player.isUsingFlyTeleport()) { writeD(player.getFlightTeleportId());