client: Simplify ItemContainer usage
Because itemManager#getItemPrice() canonicalizes the passed item ID, it is no longer necessary to get noted items' base IDs or otherwise canonicalize item IDs before interacting with the method.
This commit is contained in:
@@ -211,12 +211,7 @@ public class ExaminePlugin extends Plugin
|
||||
}
|
||||
|
||||
itemComposition = itemManager.getItemComposition(itemId);
|
||||
|
||||
if (itemComposition != null)
|
||||
{
|
||||
final int id = itemManager.canonicalize(itemComposition.getId());
|
||||
getItemPrice(id, itemComposition, itemQuantity);
|
||||
}
|
||||
getItemPrice(itemComposition.getId(), itemComposition, itemQuantity);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -188,7 +188,7 @@ class ItemPricesOverlay extends Overlay
|
||||
|
||||
private String getItemStackValueText(Item item)
|
||||
{
|
||||
int id = item.getId();
|
||||
int id = itemManager.canonicalize(item.getId());
|
||||
int qty = item.getQuantity();
|
||||
|
||||
// Special case for coins and platinum tokens
|
||||
@@ -202,11 +202,6 @@ class ItemPricesOverlay extends Overlay
|
||||
}
|
||||
|
||||
ItemComposition itemDef = itemManager.getItemComposition(id);
|
||||
if (itemDef.getNote() != -1)
|
||||
{
|
||||
id = itemDef.getLinkedNoteId();
|
||||
itemDef = itemManager.getItemComposition(id);
|
||||
}
|
||||
|
||||
// Only check prices for things with store prices
|
||||
if (itemDef.getPrice() <= 0)
|
||||
|
||||
@@ -801,8 +801,7 @@ public class LootTrackerPlugin extends Plugin
|
||||
private LootTrackerItem buildLootTrackerItem(int itemId, int quantity)
|
||||
{
|
||||
final ItemComposition itemComposition = itemManager.getItemComposition(itemId);
|
||||
final int realItemId = itemComposition.getNote() != -1 ? itemComposition.getLinkedNoteId() : itemId;
|
||||
final int gePrice = itemManager.getItemPrice(realItemId);
|
||||
final int gePrice = itemManager.getItemPrice(itemId);
|
||||
final int haPrice = Math.round(itemComposition.getPrice() * Constants.HIGH_ALCHEMY_MULTIPLIER);
|
||||
final boolean ignored = ignoredItems.contains(itemComposition.getName());
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.google.inject.testing.fieldbinder.BoundFieldModule;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.ItemComposition;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
@@ -82,6 +83,7 @@ public class ExaminePluginTest
|
||||
public void testItem()
|
||||
{
|
||||
when(client.getWidget(anyInt(), anyInt())).thenReturn(mock(Widget.class));
|
||||
when(itemManager.getItemComposition(anyInt())).thenReturn(mock(ItemComposition.class));
|
||||
|
||||
MenuOptionClicked menuOptionClicked = new MenuOptionClicked();
|
||||
menuOptionClicked.setMenuOption("Examine");
|
||||
@@ -100,6 +102,7 @@ public class ExaminePluginTest
|
||||
public void testLargeStacks()
|
||||
{
|
||||
when(client.getWidget(anyInt(), anyInt())).thenReturn(mock(Widget.class));
|
||||
when(itemManager.getItemComposition(anyInt())).thenReturn(mock(ItemComposition.class));
|
||||
|
||||
MenuOptionClicked menuOptionClicked = new MenuOptionClicked();
|
||||
menuOptionClicked.setMenuOption("Examine");
|
||||
|
||||
Reference in New Issue
Block a user