use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.
the class ItemOnItemMessageDecoder method decode.
@Override
public ItemOnItemMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int targetId = (int) reader.getUnsigned(DataType.SHORT);
int usedSlot = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
int usedId = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
int targetInterface = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
int targetSlot = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
int usedInterface = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
return new ItemOnItemMessage(usedInterface, usedId, usedSlot, targetInterface, targetId, targetSlot);
}
use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.
the class MouseClickedMessageDecoder method decode.
@Override
public MouseClickedMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int value = (int) reader.getUnsigned(DataType.INT);
long delay = (value >> 20) * 50;
boolean right = (value >> 19 & 0x1) == 1;
int cords = value & 0x3FFFF;
int x = cords % 765;
int y = cords / 765;
return new MouseClickedMessage(delay, right, x, y);
}
use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.
the class ThirdItemOptionMessageDecoder method decode.
@Override
public ItemOptionMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int slot = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
int id = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
int interfaceId = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
return new ItemOptionMessage(3, interfaceId, id, slot);
}
use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.
the class SecondItemActionMessageDecoder method decode.
@Override
public ItemActionMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int slot = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
int id = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
int interfaceId = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
return new ItemActionMessage(2, interfaceId, id, slot);
}
use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.
the class SecondPlayerActionMessageDecoder method decode.
@Override
public PlayerActionMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int index = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
return new PlayerActionMessage(2, index);
}
Aggregations