use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.
the class FirstItemOptionMessageDecoder method decode.
@Override
public ItemOptionMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int interfaceId = (int) reader.getSigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
int slot = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
int id = (int) reader.getSigned(DataType.SHORT, DataOrder.LITTLE);
return new ItemOptionMessage(1, interfaceId, id, slot);
}
use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.
the class FirstObjectActionMessageDecoder method decode.
@Override
public ObjectActionMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int x = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
int id = (int) reader.getUnsigned(DataType.SHORT);
int y = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
return new ObjectActionMessage(1, id, new Position(x, y));
}
use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.
the class FlaggedMouseEventMessageDecoder method decode.
@Override
public FlaggedMouseEventMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int read;
if (reader.getLength() == 2) {
read = (int) reader.getUnsigned(DataType.SHORT);
int clicks = read >> 12;
int dX = read >> 6 & 0x3f;
int dY = read & 0x3f;
return new FlaggedMouseEventMessage(clicks, dX, dY, true);
} else if (reader.getLength() == 3) {
read = (int) reader.getUnsigned(DataType.TRI_BYTE) & ~0x800000;
} else {
read = (int) reader.getUnsigned(DataType.INT) & ~0xc0000000;
}
int clicks = read >> 19;
int x = (read & 0x7f) % 765;
int y = (read & 0x7f) / 765;
return new FlaggedMouseEventMessage(clicks, x, y, false);
}
use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.
the class FlashingTabClickedMessageDecoder method decode.
@Override
public FlashingTabClickedMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int tab = (int) reader.getUnsigned(DataType.BYTE);
return new FlashingTabClickedMessage(tab);
}
use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.
the class ButtonMessageDecoder method decode.
@Override
public ButtonMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int interfaceId = (int) reader.getUnsigned(DataType.SHORT);
return new ButtonMessage(interfaceId);
}
Aggregations