use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.
the class ItemOnNpcMessageDecoder method decode.
@Override
public ItemOnNpcMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int id = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
int index = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
int slot = (int) reader.getSigned(DataType.SHORT, DataOrder.LITTLE);
int interfaceId = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
return new ItemOnNpcMessage(id, index, slot, interfaceId);
}
use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.
the class MagicOnItemMessageDecoder method decode.
@Override
public MagicOnItemMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int slot = (int) reader.getUnsigned(DataType.SHORT);
int id = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
int interfaceId = (int) reader.getUnsigned(DataType.SHORT);
int spell = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
return new MagicOnItemMessage(interfaceId, id, slot, spell);
}
use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.
the class MagicOnPlayerMessageDecoder method decode.
@Override
public MagicOnPlayerMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int index = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
int spell = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
return new MagicOnPlayerMessage(index, spell);
}
use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.
the class PrivateChatMessageDecoder method decode.
@Override
public PrivateChatMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
String username = NameUtil.decodeBase37(reader.getSigned(DataType.LONG));
int length = packet.getLength() - Long.BYTES;
byte[] originalCompressed = new byte[length];
reader.getBytes(originalCompressed);
String decompressed = TextUtil.decompress(originalCompressed, length);
decompressed = TextUtil.filterInvalidCharacters(decompressed);
decompressed = TextUtil.capitalize(decompressed);
byte[] recompressed = new byte[length];
TextUtil.compress(decompressed, recompressed);
return new PrivateChatMessage(new String(decompressed), recompressed, username);
}
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);
}
Aggregations