use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.
the class AddIgnoreMessageDecoder method decode.
@Override
public AddIgnoreMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
String username = NameUtil.decodeBase37(reader.getSigned(DataType.LONG));
return new AddIgnoreMessage(username);
}
use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.
the class EnteredAmountMessageDecoder method decode.
@Override
public EnteredAmountMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int amount = (int) reader.getUnsigned(DataType.INT);
return new EnteredAmountMessage(amount);
}
use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.
the class PrivacyOptionMessageDecoder method decode.
@Override
public PrivacyOptionMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int publicChatState = (int) reader.getUnsigned(DataType.BYTE);
int privateChatState = (int) reader.getUnsigned(DataType.BYTE);
int tradeChatState = (int) reader.getUnsigned(DataType.BYTE);
return new PrivacyOptionMessage(publicChatState, privateChatState, tradeChatState);
}
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(decompressed, recompressed, username);
}
use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.
the class RemoveFriendMessageDecoder method decode.
@Override
public RemoveFriendMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
String username = NameUtil.decodeBase37(reader.getSigned(DataType.LONG));
return new RemoveFriendMessage(username);
}
Aggregations