@Override public Event read(Player player, GameMessage msg) throws Exception { int opcode = msg.getOpcode(); int size = msg.getSize(); ByteMessage payload = msg.getPayload(); if (opcode == 248) { // Minimap click. size -= 14; player.interruptAction(); } else if (opcode == 164) { // Yellow <x> click. player.interruptAction(); } else if (opcode == 98) { // Red <x> click. // impl } int pathSize = (size - 5) / 2; int[][] path = new int[pathSize][2]; int x = payload.getShort(false, ByteTransform.A, ByteOrder.LITTLE); for (int i = 0; i < pathSize; i++) { path[i][0] = payload.get(); path[i][1] = payload.get(); } int y = payload.getShort(false, ByteOrder.LITTLE); boolean running = payload.get(false, ByteTransform.S) == 1; WalkingQueue walkingQueue = player.getWalkingQueue(); walkingQueue.setRunningPath(running); walkingQueue.clear(); Step[] steps = new Step[pathSize + 1]; walkingQueue.addFirst(steps[0] = new Step(x, y)); for (int i = 0; i < pathSize; i++) { walkingQueue.add(steps[i + 1] = new Step(path[i][0] + x, path[i][1] + y)); } return new WalkingEvent(steps, running); }