Search in sources :

Example 1 with SwitchItemMessage

use of org.apollo.game.message.impl.SwitchItemMessage 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 2 with SwitchItemMessage

use of org.apollo.game.message.impl.SwitchItemMessage in project apollo by apollo-rsps.

the class SwitchItemMessageDecoder method decode.

@Override
public SwitchItemMessage decode(GamePacket packet) {
    GamePacketReader reader = new GamePacketReader(packet);
    int interfaceId = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
    boolean inserting = reader.getUnsigned(DataType.BYTE, DataTransformation.NEGATE) == 1;
    int oldSlot = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
    int newSlot = (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)

Aggregations

SwitchItemMessage (org.apollo.game.message.impl.SwitchItemMessage)2 GamePacketReader (org.apollo.net.codec.game.GamePacketReader)2