item charges: simplify infobox creation logic

This looks at the worn items and matches them to known items with
charges, instead of checking the worn items for each known item with
charges. Additionally it associates guthix rest to potions, because
previously they did not have a config option, and adds an infobox for
the chronicle.
This commit is contained in:
Adam
2021-05-09 12:46:51 -04:00
parent 18bd40c702
commit 6dca841c87
8 changed files with 202 additions and 429 deletions

View File

@@ -32,6 +32,7 @@ import java.util.concurrent.ScheduledExecutorService;
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.InventoryID;
import net.runelite.api.Item;
import net.runelite.api.ItemContainer;
import net.runelite.api.ItemID;
import net.runelite.api.events.ChatMessage;
@@ -173,6 +174,7 @@ public class ItemChargePluginTest
ItemContainer equipmentItemContainer = mock(ItemContainer.class);
when(client.getItemContainer(InventoryID.EQUIPMENT)).thenReturn(equipmentItemContainer);
when(equipmentItemContainer.contains(ItemID.RING_OF_FORGING)).thenReturn(true);
when(equipmentItemContainer.getItems()).thenReturn(new Item[0]);
// Run message
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", USED_RING_OF_FORGING, "", 0);
itemChargePlugin.onChatMessage(chatMessage);