luna icon indicating copy to clipboard operation
luna copied to clipboard

Forced movement update block not working

Open lare96 opened this issue 8 years ago • 2 comments

Not exactly sure what's wrong with it, when I test it nothing happens. Will have to look into it more

lare96 avatar Jul 11 '16 13:07 lare96

This is needed for proper agility, so moving it to high priority.

lare96 avatar Nov 22 '18 05:11 lare96

I could be wrong but it looks like there's a type mismatch on the server/client. I suspect that this is the root cause of the issue.

Luna via ForcedMovementUpdateBlock.java

    @Override
    public void encodeForPlayer(Player player, ByteMessage msg) {
        ForcedMovement movement = unwrap(player.getForcedMovement());
        msg.put(movement.getStartPosition().getX(), ValueType.ADD);
        msg.put(movement.getStartPosition().getY(), ValueType.NEGATE);
        msg.put(movement.getEndPosition().getX(), ValueType.SUBTRACT);
        msg.put(movement.getEndPosition().getY());
        msg.putShort(movement.getDurationX());
        msg.putShort(movement.getDurationY(), ValueType.ADD);
        msg.put(movement.getDirection().getId());
    }

Luna-client via Client.java

private void updatePlayer(final Buffer stream, final int updateType, final Player player, final int playerId) {
        if ((updateType & 0x400) != 0) {
            player.startX = stream.getUnsignedByteS();
            player.startY = stream.getUnsignedByteS();
            player.endX = stream.getUnsignedByteS();
            player.endY = stream.getUnsignedByteS();
            player.tickStart = stream.getUnsignedShortA() + tick;
            player.tickEnd = stream.getUnsignedLEShortA() + tick;
            player.direction = stream.getUnsignedByteS();
            player.resetPath();
        }

notjuanortiz avatar Jun 29 '21 12:06 notjuanortiz