Search in sources :

Example 11 with GamePacketReader

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);
}
Also used : GamePacketReader(org.apollo.net.codec.game.GamePacketReader) AddIgnoreMessage(org.apollo.game.message.impl.AddIgnoreMessage)

Example 12 with GamePacketReader

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);
}
Also used : GamePacketReader(org.apollo.net.codec.game.GamePacketReader) EnteredAmountMessage(org.apollo.game.message.impl.EnteredAmountMessage)

Example 13 with GamePacketReader

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);
}
Also used : GamePacketReader(org.apollo.net.codec.game.GamePacketReader) PrivacyOptionMessage(org.apollo.game.message.impl.PrivacyOptionMessage)

Example 14 with GamePacketReader

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);
}
Also used : GamePacketReader(org.apollo.net.codec.game.GamePacketReader) PrivateChatMessage(org.apollo.game.message.impl.PrivateChatMessage)

Example 15 with GamePacketReader

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);
}
Also used : GamePacketReader(org.apollo.net.codec.game.GamePacketReader) RemoveFriendMessage(org.apollo.game.message.impl.RemoveFriendMessage)

Aggregations

GamePacketReader (org.apollo.net.codec.game.GamePacketReader)97 ItemActionMessage (org.apollo.game.message.impl.ItemActionMessage)10 ItemOptionMessage (org.apollo.game.message.impl.ItemOptionMessage)10 NpcActionMessage (org.apollo.game.message.impl.NpcActionMessage)10 PlayerActionMessage (org.apollo.game.message.impl.PlayerActionMessage)10 Position (org.apollo.game.model.Position)10 ObjectActionMessage (org.apollo.game.message.impl.ObjectActionMessage)6 AddFriendMessage (org.apollo.game.message.impl.AddFriendMessage)2 AddIgnoreMessage (org.apollo.game.message.impl.AddIgnoreMessage)2 ArrowKeyMessage (org.apollo.game.message.impl.ArrowKeyMessage)2 ButtonMessage (org.apollo.game.message.impl.ButtonMessage)2 DialogueContinueMessage (org.apollo.game.message.impl.DialogueContinueMessage)2 EnteredAmountMessage (org.apollo.game.message.impl.EnteredAmountMessage)2 FlaggedMouseEventMessage (org.apollo.game.message.impl.FlaggedMouseEventMessage)2 FlashingTabClickedMessage (org.apollo.game.message.impl.FlashingTabClickedMessage)2 ItemOnItemMessage (org.apollo.game.message.impl.ItemOnItemMessage)2 ItemOnNpcMessage (org.apollo.game.message.impl.ItemOnNpcMessage)2 ItemOnObjectMessage (org.apollo.game.message.impl.ItemOnObjectMessage)2 MagicOnItemMessage (org.apollo.game.message.impl.MagicOnItemMessage)2 MagicOnNpcMessage (org.apollo.game.message.impl.MagicOnNpcMessage)2