luna
luna copied to clipboard
Forced movement update block not working
Not exactly sure what's wrong with it, when I test it nothing happens. Will have to look into it more
This is needed for proper agility, so moving it to high priority.
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();
}