Search in sources :

Example 1 with ItemOnNpcMessage

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

the class ItemOnNpcMessageDecoder method decode.

@Override
public ItemOnNpcMessage decode(GamePacket packet) {
    GamePacketReader reader = new GamePacketReader(packet);
    int index = (int) reader.getUnsigned(DataType.SHORT);
    int id = (int) reader.getSigned(DataType.SHORT, DataOrder.LITTLE);
    int widget = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
    int slot = (int) reader.getUnsigned(DataType.SHORT);
    return new ItemOnNpcMessage(id, index, slot, widget);
}
Also used : GamePacketReader(org.apollo.net.codec.game.GamePacketReader) ItemOnNpcMessage(org.apollo.game.message.impl.ItemOnNpcMessage)

Example 2 with ItemOnNpcMessage

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

Aggregations

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