use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.
the class ItemOnObjectMessageDecoder method decode.
@Override
public ItemOnObjectMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int objectId = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
int interfaceId = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
int itemId = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
int y = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
int slot = (int) reader.getUnsigned(DataType.SHORT);
int x = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
return new ItemOnObjectMessage(interfaceId, itemId, slot, objectId, x, y);
}
use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.
the class MagicOnNpcMessageDecoder method decode.
@Override
public MagicOnNpcMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int index = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
int spell = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
return new MagicOnNpcMessage(index, spell);
}
use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.
the class RemoveIgnoreMessageDecoder method decode.
@Override
public RemoveIgnoreMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
String username = NameUtil.decodeBase37(reader.getSigned(DataType.LONG));
return new RemoveIgnoreMessage(username);
}
use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.
the class FifthPlayerActionMessageDecoder 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(5, index);
}
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, clicks, x, y;
if (reader.getLength() == 2) {
read = (int) reader.getUnsigned(DataType.SHORT);
clicks = read >> 12;
x = read >> 6 & 0x3f;
y = read & 0x3f;
return new FlaggedMouseEventMessage(clicks, x, y, true);
} else if (reader.getLength() == 3) {
read = (int) reader.getUnsigned(DataType.TRI_BYTE) & ~0x800000;
} else {
read = (int) reader.getUnsigned(DataType.INT) & ~0xc0000000;
}
clicks = read >> 19;
x = (read & 0x7f) % 765;
y = (read & 0x7f) / 765;
return new FlaggedMouseEventMessage(clicks, x, y, false);
}
Aggregations