use of org.apollo.game.message.impl.ItemOnItemMessage in project apollo by apollo-rsps.
the class ItemOnItemMessageDecoder method decode.
@Override
public ItemOnItemMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int targetSlot = (int) reader.getUnsigned(DataType.SHORT);
int usedSlot = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
int targetId = (int) reader.getSigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
int targetInterface = (int) reader.getUnsigned(DataType.SHORT);
int usedId = (int) reader.getSigned(DataType.SHORT, DataOrder.LITTLE);
int usedInterface = (int) reader.getUnsigned(DataType.SHORT);
return new ItemOnItemMessage(usedInterface, usedId, usedSlot, targetInterface, targetId, targetSlot);
}
use of org.apollo.game.message.impl.ItemOnItemMessage in project apollo by apollo-rsps.
the class ItemOnItemVerificationHandlerTests method terminateWithNoTargetItem.
@Test
public void terminateWithNoTargetItem() throws Exception {
Player player = mock(Player.class);
Inventory inventory = new Inventory(28);
inventory.set(1, new Item(4151, 1));
when(player.getInventory()).thenReturn(inventory);
ItemOnItemMessage itemOnItemMessage = new ItemOnItemMessage(BankConstants.SIDEBAR_INVENTORY_ID, 4151, 1, BankConstants.SIDEBAR_INVENTORY_ID, 4152, 2);
itemOnItemVerificationHandler.handle(player, itemOnItemMessage);
assertTrue("ItemOnItemVerificationHandler: failed terminating message with invalid target item", itemOnItemMessage.terminated());
}
use of org.apollo.game.message.impl.ItemOnItemMessage in project apollo by apollo-rsps.
the class ItemOnItemMessageDecoder method decode.
@Override
public ItemOnItemMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int targetId = (int) reader.getUnsigned(DataType.SHORT);
int usedSlot = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
int usedId = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
int targetInterface = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
int targetSlot = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
int usedInterface = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
return new ItemOnItemMessage(usedInterface, usedId, usedSlot, targetInterface, targetId, targetSlot);
}
Aggregations