client: change item layer item uages to TileItem

This commit is contained in:
Adam
2019-07-23 10:59:14 -04:00
parent 2ffe3affbc
commit 29533cd6c7
10 changed files with 47 additions and 64 deletions

View File

@@ -67,17 +67,9 @@ public class ContainerCalculationTest
@Test
public void testCalculate()
{
Item coins = mock(Item.class);
when(coins.getId())
.thenReturn(ItemID.COINS_995);
when(coins.getQuantity())
.thenReturn(Integer.MAX_VALUE);
Item coins = new Item(ItemID.COINS_995, Integer.MAX_VALUE);
Item whip = mock(Item.class);
when(whip.getId())
.thenReturn(ItemID.ABYSSAL_WHIP);
when(whip.getQuantity())
.thenReturn(1_000_000_000);
Item whip = new Item(ItemID.ABYSSAL_WHIP, 1_000_000_000);
Item[] items = ImmutableList.of(
coins,

View File

@@ -136,8 +136,7 @@ public class ItemChargePluginTest
when(client.getItemContainer(eq(InventoryID.EQUIPMENT))).thenReturn(equipmentItemContainer);
Item[] items = new Item[EquipmentInventorySlot.RING.getSlotIdx() + 1];
when(equipmentItemContainer.getItems()).thenReturn(items);
Item ring = mock(Item.class);
when(ring.getId()).thenReturn(ItemID.RING_OF_FORGING);
Item ring = new Item(ItemID.RING_OF_FORGING, 1);
items[EquipmentInventorySlot.RING.getSlotIdx()] = ring;
// Run message
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", USED_RING_OF_FORGING, "", 0);

View File

@@ -100,18 +100,13 @@ public class ItemsKeptOnDeathPluginTest
when(itemManager.canonicalize(id)).thenReturn(id);
when(itemManager.getItemPrice(id, true)).thenReturn(price);
return mockItem(id, qty);
return item(id, qty);
}
// Creates a mocked item
private Item mockItem(final int id, final int qty)
// Creates a new item
private static Item item(final int id, final int qty)
{
Item item = mock(Item.class);
when(item.getId()).thenReturn(id);
when(item.getQuantity()).thenReturn(qty);
return item;
return new Item(id, qty);
}
@Test

View File

@@ -111,12 +111,12 @@ public class MotherlodePluginTest
// Create before inventory
ItemContainer inventory = mock(ItemContainer.class);
Item[] items = new Item[]{
mockItem(ItemID.RUNITE_ORE, 1),
mockItem(ItemID.GOLDEN_NUGGET, 4),
mockItem(ItemID.COAL, 1),
mockItem(ItemID.COAL, 1),
mockItem(ItemID.COAL, 1),
mockItem(ItemID.COAL, 1),
item(ItemID.RUNITE_ORE, 1),
item(ItemID.GOLDEN_NUGGET, 4),
item(ItemID.COAL, 1),
item(ItemID.COAL, 1),
item(ItemID.COAL, 1),
item(ItemID.COAL, 1),
};
when(inventory.getItems())
@@ -130,16 +130,16 @@ public class MotherlodePluginTest
inventory = mock(ItemContainer.class);
// +1 rune, +4 nugget, +2 coal, +1 addy
items = new Item[]{
mockItem(ItemID.RUNITE_ORE, 1),
mockItem(ItemID.RUNITE_ORE, 1),
mockItem(ItemID.GOLDEN_NUGGET, 8),
mockItem(ItemID.COAL, 1),
mockItem(ItemID.COAL, 1),
mockItem(ItemID.COAL, 1),
mockItem(ItemID.COAL, 1),
mockItem(ItemID.COAL, 1),
mockItem(ItemID.COAL, 1),
mockItem(ItemID.ADAMANTITE_ORE, 1),
item(ItemID.RUNITE_ORE, 1),
item(ItemID.RUNITE_ORE, 1),
item(ItemID.GOLDEN_NUGGET, 8),
item(ItemID.COAL, 1),
item(ItemID.COAL, 1),
item(ItemID.COAL, 1),
item(ItemID.COAL, 1),
item(ItemID.COAL, 1),
item(ItemID.COAL, 1),
item(ItemID.ADAMANTITE_ORE, 1),
};
when(inventory.getItems())
@@ -156,11 +156,8 @@ public class MotherlodePluginTest
verifyNoMoreInteractions(motherlodeSession);
}
private static Item mockItem(int itemId, int quantity)
private static Item item(int itemId, int quantity)
{
Item item = mock(Item.class);
when(item.getId()).thenReturn(itemId);
when(item.getQuantity()).thenReturn(quantity);
return item;
return new Item(itemId, quantity);
}
}