|
43 | 43 | import net.runelite.api.ItemComposition; |
44 | 44 | import net.runelite.api.ItemContainer; |
45 | 45 | import net.runelite.api.IterableHashTable; |
| 46 | +import net.runelite.api.MenuAction; |
46 | 47 | import net.runelite.api.MessageNode; |
47 | 48 | import net.runelite.api.Player; |
48 | 49 | import net.runelite.api.Skill; |
|
52 | 53 | import net.runelite.api.events.ChatMessage; |
53 | 54 | import net.runelite.api.events.GameStateChanged; |
54 | 55 | import net.runelite.api.events.ItemContainerChanged; |
| 56 | +import net.runelite.api.events.MenuOptionClicked; |
55 | 57 | import net.runelite.api.events.WidgetLoaded; |
56 | 58 | import net.runelite.api.gameval.InterfaceID; |
57 | 59 | import net.runelite.api.gameval.InventoryID; |
@@ -583,7 +585,7 @@ public void testWintertodtRewardCart() |
583 | 585 | when(client.getLocalPlayer()).thenReturn(player); |
584 | 586 | when(client.getBoostedSkillLevel(Skill.FIREMAKING)).thenReturn(99); |
585 | 587 |
|
586 | | - doNothing().when(lootTrackerPlugin).addLoot(any(), anyInt(), any(), any(), anyCollection()); |
| 588 | + doNothing().when(lootTrackerPlugin).addLoot(any(), anyInt(), any(), any(), any(Collection.class)); |
587 | 589 |
|
588 | 590 | ItemContainer itemContainer = mock(ItemContainer.class); |
589 | 591 | when(itemContainer.getItems()).thenReturn(new Item[]{ |
@@ -686,4 +688,63 @@ public void testLargeSalvage() |
686 | 688 |
|
687 | 689 | verify(lootTrackerPlugin).addLoot("Large salvage", -1, LootRecordType.EVENT, null, Collections.singletonList(new ItemStack(ItemID.NAILS, 4))); |
688 | 690 | } |
| 691 | + |
| 692 | + @Test |
| 693 | + public void testBirdNests() { |
| 694 | + List<ItemStack> initialItems = Collections.singletonList( |
| 695 | + new ItemStack(ItemID.BIRD_NEST_SEEDS_JAN2019, 2) |
| 696 | + ); |
| 697 | + sendInvChange(InventoryID.INV, initialItems); |
| 698 | + |
| 699 | + MenuOptionClicked searchBirdNest = mock(MenuOptionClicked.class); |
| 700 | + when(searchBirdNest.getMenuAction()).thenReturn(MenuAction.CC_OP); |
| 701 | + when(searchBirdNest.isItemOp()).thenReturn(true); |
| 702 | + when(searchBirdNest.getMenuOption()).thenReturn("Search"); |
| 703 | + when(searchBirdNest.getItemId()).thenReturn(ItemID.BIRD_NEST_SEEDS_JAN2019); |
| 704 | + lootTrackerPlugin.onMenuOptionClicked(searchBirdNest); |
| 705 | + |
| 706 | + List<ItemStack> itemsAfterOneSearch = Arrays.asList( |
| 707 | + new ItemStack(ItemID.BIRD_NEST_EMPTY, 1), |
| 708 | + new ItemStack(ItemID.BIRD_NEST_SEEDS_JAN2019, 1), |
| 709 | + new ItemStack(ItemID.ACORN, 1) |
| 710 | + ); |
| 711 | + ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", "You take an acorn out of the bird's nest.", "", 0); |
| 712 | + lootTrackerPlugin.onChatMessage(chatMessage); |
| 713 | + sendInvChange(InventoryID.INV, itemsAfterOneSearch); |
| 714 | + verify(lootTrackerPlugin).addLoot("Bird nest", -1, LootRecordType.EVENT, null, Arrays.asList( |
| 715 | + new ItemStack(ItemID.ACORN, 1), |
| 716 | + new ItemStack(ItemID.BIRD_NEST_EMPTY, 1) |
| 717 | + )); |
| 718 | + |
| 719 | + lootTrackerPlugin.onMenuOptionClicked(searchBirdNest); |
| 720 | + |
| 721 | + List<ItemStack> itemsAfterTwoSearches = Arrays.asList( |
| 722 | + new ItemStack(ItemID.BIRD_NEST_EMPTY, 2), |
| 723 | + new ItemStack(ItemID.ACORN, 1), |
| 724 | + new ItemStack(ItemID.CELASTRUS_TREE_SEED, 1) |
| 725 | + ); |
| 726 | + chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", "You take a celastrus tree seed out of the bird's nest.", "", 0); |
| 727 | + lootTrackerPlugin.onChatMessage(chatMessage); |
| 728 | + sendInvChange(InventoryID.INV, itemsAfterTwoSearches); |
| 729 | + verify(lootTrackerPlugin).addLoot("Bird nest", -1, LootRecordType.EVENT, null, Arrays.asList( |
| 730 | + new ItemStack(ItemID.BIRD_NEST_EMPTY, 1), |
| 731 | + new ItemStack(ItemID.CELASTRUS_TREE_SEED, 1) |
| 732 | + )); |
| 733 | + |
| 734 | + // Additional test to make sure ignoring reset didn't break anything |
| 735 | + List<ItemStack> itemsPostBirdNestTest = Arrays.asList( |
| 736 | + new ItemStack(ItemID.SAILING_LARGE_SHIPWRECK_SALVAGE, 1) |
| 737 | + ); |
| 738 | + |
| 739 | + sendInvChange(InventoryID.INV, itemsPostBirdNestTest); |
| 740 | + |
| 741 | + chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", "You sort through the large salvage and find: 4 x Steel nails.", "", 0); |
| 742 | + lootTrackerPlugin.onChatMessage(chatMessage); |
| 743 | + |
| 744 | + sendInvChange(InventoryID.INV, Collections.singletonList( |
| 745 | + new ItemStack(ItemID.NAILS, 4) |
| 746 | + )); |
| 747 | + |
| 748 | + verify(lootTrackerPlugin).addLoot("Large salvage", -1, LootRecordType.EVENT, null, Collections.singletonList(new ItemStack(ItemID.NAILS, 4))); |
| 749 | + } |
689 | 750 | } |
0 commit comments