Search in sources :

Example 16 with GamePacketReader

use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.

the class SwitchItemMessageDecoder method decode.

@Override
public SwitchItemMessage decode(GamePacket packet) {
    GamePacketReader reader = new GamePacketReader(packet);
    int newSlot = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
    boolean inserting = reader.getUnsigned(DataType.BYTE, DataTransformation.ADD) == 1;
    int interfaceId = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
    int oldSlot = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
    return new SwitchItemMessage(interfaceId, inserting, oldSlot, newSlot);
}
Also used : GamePacketReader(org.apollo.net.codec.game.GamePacketReader) SwitchItemMessage(org.apollo.game.message.impl.SwitchItemMessage)

Example 17 with GamePacketReader

use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.

the class TakeTileItemMessageDecoder method decode.

@Override
public TakeTileItemMessage decode(GamePacket packet) {
    GamePacketReader reader = new GamePacketReader(packet);
    int id = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
    int x = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
    int y = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
    return new TakeTileItemMessage(id, new Position(x, y));
}
Also used : GamePacketReader(org.apollo.net.codec.game.GamePacketReader) Position(org.apollo.game.model.Position) TakeTileItemMessage(org.apollo.game.message.impl.TakeTileItemMessage)

Example 18 with GamePacketReader

use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.

the class ThirdObjectActionMessageDecoder method decode.

@Override
public ObjectActionMessage decode(GamePacket packet) {
    GamePacketReader reader = new GamePacketReader(packet);
    int y = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
    int id = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
    int x = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
    return new ObjectActionMessage(3, id, new Position(x, y));
}
Also used : ObjectActionMessage(org.apollo.game.message.impl.ObjectActionMessage) GamePacketReader(org.apollo.net.codec.game.GamePacketReader) Position(org.apollo.game.model.Position)

Example 19 with GamePacketReader

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

Example 20 with GamePacketReader

use of org.apollo.net.codec.game.GamePacketReader in project apollo by apollo-rsps.

the class SecondNpcActionMessageDecoder method decode.

@Override
public NpcActionMessage decode(GamePacket packet) {
    GamePacketReader reader = new GamePacketReader(packet);
    int index = (int) reader.getSigned(DataType.SHORT, DataTransformation.ADD);
    return new NpcActionMessage(2, index);
}
Also used : GamePacketReader(org.apollo.net.codec.game.GamePacketReader) NpcActionMessage(org.apollo.game.message.impl.NpcActionMessage)

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