net.runelite.api.ItemID Java Examples
The following examples show how to use
net.runelite.api.ItemID.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GrandExchangePluginTest.java From plugins with GNU General Public License v3.0 | 6 votes |
@Test public void testDuplicateTrade() { SavedOffer savedOffer = new SavedOffer(); savedOffer.setItemId(ItemID.ABYSSAL_WHIP); savedOffer.setQuantitySold(1); savedOffer.setTotalQuantity(10); savedOffer.setPrice(1000); savedOffer.setSpent(25); savedOffer.setState(GrandExchangeOfferState.BUYING); when(configManager.getConfiguration("geoffer.adam", "0")).thenReturn(GSON.toJson(savedOffer)); GrandExchangeOffer grandExchangeOffer = mock(GrandExchangeOffer.class); when(grandExchangeOffer.getQuantitySold()).thenReturn(1); when(grandExchangeOffer.getItemId()).thenReturn(ItemID.ABYSSAL_WHIP); when(grandExchangeOffer.getTotalQuantity()).thenReturn(10); when(grandExchangeOffer.getPrice()).thenReturn(1000); lenient().when(grandExchangeOffer.getSpent()).thenReturn(25); when(grandExchangeOffer.getState()).thenReturn(GrandExchangeOfferState.BUYING); grandExchangePlugin.submitTrade(0, grandExchangeOffer); verify(grandExchangeClient, never()).submit(any(GrandExchangeTrade.class)); }
Example #2
Source File: AgilityPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Subscribe public void onItemSpawned(ItemSpawned itemSpawned) { if (obstacles.isEmpty()) { return; } final TileItem item = itemSpawned.getItem(); final Tile tile = itemSpawned.getTile(); if (item.getId() == ItemID.MARK_OF_GRACE) { marksOfGrace.add(tile); } if (item.getId() == ItemID.STICK) { stickTile = tile; } }
Example #3
Source File: MotherlodeSession.java From plugins with GNU General Public License v3.0 | 6 votes |
void incrementGemFound(int gemID) { lastGemFound = Instant.now(); switch (gemID) { case ItemID.UNCUT_DIAMOND: diamondsFound++; break; case ItemID.UNCUT_RUBY: rubiesFound++; break; case ItemID.UNCUT_EMERALD: emeraldsFound++; break; case ItemID.UNCUT_SAPPHIRE: sapphiresFound++; break; default: log.debug("Invalid gem type specified. The gem count will not be incremented."); } }
Example #4
Source File: MotherlodeSession.java From plugins with GNU General Public License v3.0 | 6 votes |
void updateOreFound(int item, int count) { switch (item) { case ItemID.GOLDEN_NUGGET: nuggetsFound += count; break; case ItemID.COAL: coalFound += count; break; case ItemID.GOLD_ORE: goldFound += count; break; case ItemID.MITHRIL_ORE: mithrilFound += count; break; case ItemID.ADAMANTITE_ORE: adamantiteFound += count; break; case ItemID.RUNITE_ORE: runiteFound += count; break; default: log.debug("Invalid ore specified. The ore count will not be updated."); } }
Example #5
Source File: ExaminePluginTest.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Test 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"); menuOptionClicked.setMenuAction(MenuAction.EXAMINE_ITEM); menuOptionClicked.setId(ItemID.ABYSSAL_WHIP); examinePlugin.onMenuOptionClicked(menuOptionClicked); ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.ITEM_EXAMINE, "", "100000 x Abyssal whip", "", 0); examinePlugin.onChatMessage(chatMessage); verify(examineClient, never()).submitItem(anyInt(), anyString()); }
Example #6
Source File: ExaminePluginTest.java From plugins with GNU General Public License v3.0 | 6 votes |
@Test public void testLargeStacks() { when(client.getWidget(anyInt(), anyInt())).thenReturn(mock(Widget.class)); when(itemManager.getItemDefinition(anyInt())).thenReturn(mock(ItemDefinition.class)); MenuOptionClicked menuOptionClicked = new MenuOptionClicked( "Examine", "Something", ItemID.ABYSSAL_WHIP, MenuOpcode.EXAMINE_ITEM.getId(), 123, 456, false ); examinePlugin.onMenuOptionClicked(menuOptionClicked); ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.ITEM_EXAMINE, "", "100000 x Abyssal whip", "", 0); examinePlugin.onChatMessage(chatMessage); verify(examineClient, never()).submitItem(anyInt(), anyString()); }
Example #7
Source File: ExaminePluginTest.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Test 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"); menuOptionClicked.setMenuAction(MenuAction.EXAMINE_ITEM); menuOptionClicked.setId(ItemID.ABYSSAL_WHIP); examinePlugin.onMenuOptionClicked(menuOptionClicked); ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.ITEM_EXAMINE, "", "A weapon from the abyss.", "", 0); examinePlugin.onChatMessage(chatMessage); // This passes due to not mocking the ItemComposition for the whip verify(examineClient).submitItem(anyInt(), anyString()); }
Example #8
Source File: GrandExchangePluginTest.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Test public void testDuplicateTrade() { SavedOffer savedOffer = new SavedOffer(); savedOffer.setItemId(ItemID.ABYSSAL_WHIP); savedOffer.setQuantitySold(1); savedOffer.setTotalQuantity(10); savedOffer.setPrice(1000); savedOffer.setSpent(25); savedOffer.setState(GrandExchangeOfferState.BUYING); when(configManager.getConfiguration("geoffer.adam", "0")).thenReturn(GSON.toJson(savedOffer)); GrandExchangeOffer grandExchangeOffer = mock(GrandExchangeOffer.class); when(grandExchangeOffer.getQuantitySold()).thenReturn(1); when(grandExchangeOffer.getItemId()).thenReturn(ItemID.ABYSSAL_WHIP); when(grandExchangeOffer.getTotalQuantity()).thenReturn(10); when(grandExchangeOffer.getPrice()).thenReturn(1000); lenient().when(grandExchangeOffer.getSpent()).thenReturn(25); when(grandExchangeOffer.getState()).thenReturn(GrandExchangeOfferState.BUYING); grandExchangePlugin.submitTrade(0, grandExchangeOffer); verify(grandExchangeClient, never()).submit(any(GrandExchangeTrade.class)); }
Example #9
Source File: MotherlodeSession.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
void updateOreFound(int item, int count) { switch (item) { case ItemID.GOLDEN_NUGGET: nuggetsFound += count; break; case ItemID.COAL: coalFound += count; break; case ItemID.GOLD_ORE: goldFound += count; break; case ItemID.MITHRIL_ORE: mithrilFound += count; break; case ItemID.ADAMANTITE_ORE: adamantiteFound += count; break; case ItemID.RUNITE_ORE: runiteFound += count; break; default: log.debug("Invalid ore specified. The ore count will not be updated."); } }
Example #10
Source File: PortalWeaknessOverlay.java From plugins with GNU General Public License v3.0 | 6 votes |
@Inject PortalWeaknessOverlay( final PestControlPlugin plugin, final Client client, final ItemManager itemManager, final SkillIconManager skillIconManager ) { this.plugin = plugin; this.client = client; this.magicImage = skillIconManager.getSkillImage(Skill.MAGIC); this.rangedImage = skillIconManager.getSkillImage(Skill.RANGED); this.stabImage = itemManager.getImage(ItemID.WHITE_DAGGER); this.slashImage = itemManager.getImage(ItemID.WHITE_SCIMITAR); this.crushImage = itemManager.getImage(ItemID.WHITE_WARHAMMER); setPosition(OverlayPosition.DYNAMIC); setLayer(OverlayLayer.UNDER_WIDGETS); }
Example #11
Source File: BankPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
private Multiset<Integer> getBankItemSet() { ItemContainer itemContainer = client.getItemContainer(InventoryID.BANK); if (itemContainer == null) { return HashMultiset.create(); } Multiset<Integer> set = HashMultiset.create(); for (Item item : itemContainer.getItems()) { if (item.getId() != ItemID.BANK_FILLER) { set.add(item.getId(), item.getQuantity()); } } return set; }
Example #12
Source File: PrayerAlertOverlay.java From plugins with GNU General Public License v3.0 | 5 votes |
private boolean checkInventoryForPotion() { ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY); Item[] inventoryItems; boolean hasPrayerPotion = false; int[] potionID = {ItemID.PRAYER_POTION1, ItemID.PRAYER_POTION2, ItemID.PRAYER_POTION3, ItemID.PRAYER_POTION4, ItemID.PRAYER_POTION1_20396, ItemID.PRAYER_POTION2_20395, ItemID.PRAYER_POTION3_20394, ItemID.PRAYER_POTION4_20393, ItemID.PRAYER_MIX1, ItemID.PRAYER_MIX2, ItemID.SUPER_RESTORE1, ItemID.SUPER_RESTORE2, ItemID.SUPER_RESTORE3, ItemID.SUPER_RESTORE4, ItemID.SUPER_RESTORE_MIX1, ItemID.SUPER_RESTORE_MIX2}; if (inventory != null) { inventoryItems = inventory.getItems(); for (Item item : inventoryItems) { for (int prayerPotionId : potionID) { if (item.getId() == prayerPotionId) { hasPrayerPotion = true; break; } } } } return hasPrayerPotion; }
Example #13
Source File: GrandExchangePluginTest.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Test public void testSubmitTrade() { // 1 @ 25 SavedOffer savedOffer = new SavedOffer(); savedOffer.setItemId(ItemID.ABYSSAL_WHIP); savedOffer.setQuantitySold(1); savedOffer.setTotalQuantity(10); savedOffer.setPrice(1000); savedOffer.setSpent(25); savedOffer.setState(GrandExchangeOfferState.BUYING); when(configManager.getConfiguration("geoffer.adam", "0")).thenReturn(GSON.toJson(savedOffer)); // buy 2 @ 10/ea GrandExchangeOffer grandExchangeOffer = mock(GrandExchangeOffer.class); when(grandExchangeOffer.getQuantitySold()).thenReturn(1 + 2); when(grandExchangeOffer.getItemId()).thenReturn(ItemID.ABYSSAL_WHIP); when(grandExchangeOffer.getTotalQuantity()).thenReturn(10); when(grandExchangeOffer.getPrice()).thenReturn(1000); when(grandExchangeOffer.getSpent()).thenReturn(25 + 10 * 2); when(grandExchangeOffer.getState()).thenReturn(GrandExchangeOfferState.BUYING); grandExchangePlugin.submitTrade(0, grandExchangeOffer); ArgumentCaptor<GrandExchangeTrade> captor = ArgumentCaptor.forClass(GrandExchangeTrade.class); verify(grandExchangeClient).submit(captor.capture()); GrandExchangeTrade trade = captor.getValue(); assertTrue(trade.isBuy()); assertEquals(ItemID.ABYSSAL_WHIP, trade.getItemId()); assertEquals(2, trade.getDqty()); assertEquals(10, trade.getTotal()); assertEquals(45, trade.getSpent()); assertEquals(20, trade.getDspent()); }
Example #14
Source File: MiningPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
@Subscribe private void onMenuOptionClicked(MenuOptionClicked event) { //TODO: should work hopefully if (event.getMenuOpcode() != MenuOpcode.RUNELITE || event.getParam1() != WidgetInfo.INVENTORY.getId()) { return; } ItemContainer inventoryItemContainer = client.getItemContainer(InventoryID.INVENTORY); Item[] inventoryItems = new Item[0]; if (inventoryItemContainer != null) { inventoryItems = inventoryItemContainer.getItems(); } switch (event.getOption().toLowerCase()) { case FILL_OPTION: int coalInInventoryCount = (int) Arrays.stream(inventoryItems).filter(i -> i.getId() == ItemID.COAL).count(); updateAmountOfCoalInBag(coalInInventoryCount); break; case EMPTY_OPTION: int emptyInventorySpaceCount = (int) Arrays.stream(inventoryItems).filter(i -> i.getId() != -1).count(); int difference = MAX_INVENTORY_SPACE - emptyInventorySpaceCount; updateAmountOfCoalInBag(-difference); break; } }
Example #15
Source File: BronzeManPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
/** * Unlocks default items like a bond to a newly made profile **/ private void unlockDefaultItems() { if (config.startItemsUnlocked()) { return; } config.startItemsUnlocked(true); queueItemUnlock(ItemID.COINS_995); queueItemUnlock(ItemID.OLD_SCHOOL_BOND); log.info("Unlocked starter items"); }
Example #16
Source File: AgilityPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Subscribe public void onItemDespawned(ItemDespawned itemDespawned) { final TileItem item = itemDespawned.getItem(); final Tile tile = itemDespawned.getTile(); marksOfGrace.remove(tile); if (item.getId() == ItemID.STICK && stickTile == tile) { stickTile = null; } }
Example #17
Source File: HighAlchemyOverlay.java From plugins with GNU General Public License v3.0 | 5 votes |
@Override public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem itemWidget) { Widget widget = itemWidget.getWidget(); int interfaceGroup = TO_GROUP(widget.getId()); if (!plugin.getInterfaceGroups().contains(interfaceGroup)) { return; } final int natPrice = itemManager.getItemPrice(ItemID.NATURE_RUNE, true); final int alchPriceNoStaff = natPrice + 5 * itemManager.getItemPrice(ItemID.FIRE_RUNE, true); final int id = getNotedId(itemId); final int gePrice = getGEPrice(id); final int haPrice = getHAPrice(id); final int materialCost = config.usingFireRunes() ? alchPriceNoStaff : natPrice; final int desiredProfit = config.minProfit(); final int haProfit = getHAProfit(haPrice, gePrice, materialCost); if (gePrice > 0 && haPrice > 0 && haProfit >= desiredProfit) { final Color color = config.getHighlightColor(); if (color != null) { Rectangle bounds = itemWidget.getCanvasBounds(); final BufferedImage outline = itemManager.getItemOutline(itemId, itemWidget.getQuantity(), color); graphics.drawImage(outline, (int) bounds.getX() + 1, (int) bounds.getY() + 1, null); } } }
Example #18
Source File: EnchantmentRoom.java From plugins with GNU General Public License v3.0 | 5 votes |
private void onItemSpawned(ItemSpawned itemSpawned) { final TileItem item = itemSpawned.getItem(); final Tile tile = itemSpawned.getTile(); if (item.getId() == ItemID.DRAGONSTONE_6903) { WorldPoint location = tile.getWorldLocation(); log.debug("Adding dragonstone at {}", location); dragonstones.add(location); } }
Example #19
Source File: DarkEssence.java From ExternalPlugins with GNU General Public License v3.0 | 5 votes |
@Override public void modifyEntry(OneClickPlugin plugin, MenuEntry event) { if (plugin.findItem(ItemID.DARK_ESSENCE_BLOCK).getLeft() == -1) { return; } event.setTarget("<col=ff9040>Chisel<col=ffffff> -> <col=ff9040>Dark essence block"); event.setForceLeftClick(true); }
Example #20
Source File: DarkEssence.java From ExternalPlugins with GNU General Public License v3.0 | 5 votes |
@Override public void modifyClick(OneClickPlugin plugin, MenuEntry event) { if (plugin.updateSelectedItem(ItemID.DARK_ESSENCE_BLOCK)) { event.setOpcode(MenuOpcode.ITEM_USE_ON_WIDGET_ITEM.getId()); } }
Example #21
Source File: Karambwans.java From ExternalPlugins with GNU General Public License v3.0 | 5 votes |
@Override public void modifyEntry(OneClickPlugin plugin, MenuEntry event) { if (plugin.findItem(ItemID.RAW_KARAMBWAN).getLeft() == -1) { return; } event.setOption("Use"); event.setTarget("<col=ff9040>Raw karambwan<col=ffffff> -> " + event.getTarget()); event.setForceLeftClick(true); }
Example #22
Source File: TabManager.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
TagTab load(String tag) { TagTab tagTab = find(tag); if (tagTab == null) { tag = Text.standardize(tag); String item = configManager.getConfiguration(CONFIG_GROUP, ICON_SEARCH + tag); int itemid = NumberUtils.toInt(item, ItemID.SPADE); tagTab = new TagTab(itemid, tag); } return tagTab; }
Example #23
Source File: AgilityPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
@Subscribe private void onItemDespawned(ItemDespawned itemDespawned) { final TileItem item = itemDespawned.getItem(); final Tile tile = itemDespawned.getTile(); marksOfGrace.remove(tile); if (item.getId() == ItemID.STICK && stickTile == tile) { stickTile = null; } }
Example #24
Source File: RoguesDenPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Subscribe public void onItemContainerChanged(ItemContainerChanged event) { if (event.getContainerId() != InventoryID.INVENTORY.getId()) { return; } ItemContainer itemContainer = event.getItemContainer(); hasGem = itemContainer.contains(ItemID.MYSTIC_JEWEL); }
Example #25
Source File: OverviewTabPanel.java From plugins with GNU General Public License v3.0 | 5 votes |
OverviewTabPanel(ItemManager itemManager, TimeTrackingConfig config, TimeTrackingPanel pluginPanel, FarmingTracker farmingTracker, BirdHouseTracker birdHouseTracker, ClockManager clockManager, FarmingContractManager farmingContractManager) { this.config = config; this.farmingTracker = farmingTracker; this.birdHouseTracker = birdHouseTracker; this.clockManager = clockManager; this.farmingContractManager = farmingContractManager; setLayout(new GridLayout(0, 1, 0, 8)); setBackground(ColorScheme.DARK_GRAY_COLOR); timerOverview = new OverviewItemPanel(itemManager, pluginPanel, Tab.CLOCK, "Timers"); add(timerOverview); stopwatchOverview = new OverviewItemPanel(itemManager, pluginPanel, Tab.CLOCK, "Stopwatches"); add(stopwatchOverview); birdHouseOverview = new OverviewItemPanel(itemManager, pluginPanel, Tab.BIRD_HOUSE, "Bird Houses"); add(birdHouseOverview); farmingOverviews = Stream.of(Tab.FARMING_TABS) .filter(v -> v != Tab.OVERVIEW) .collect(ImmutableMap.toImmutableMap( Function.identity(), t -> { OverviewItemPanel p = new OverviewItemPanel(itemManager, pluginPanel, t, t.getName()); add(p); return p; } )); farmingContractOverview = new OverviewItemPanel(itemManager, () -> pluginPanel.switchTab(farmingContractManager.getContractTab()), farmingContractManager::hasContract, ItemID.SEED_PACK, "Farming Contract"); add(farmingContractOverview); }
Example #26
Source File: EnchantmentRoom.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Subscribe public void onItemSpawned(ItemSpawned itemSpawned) { final TileItem item = itemSpawned.getItem(); final Tile tile = itemSpawned.getTile(); if (item.getId() == ItemID.DRAGONSTONE_6903) { WorldPoint location = tile.getWorldLocation(); log.debug("Adding dragonstone at {}", location); dragonstones.add(location); } }
Example #27
Source File: ItemStatPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
private int getCurrentGP() { final ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY); if (inventory == null) { return 0; } return inventory.count(ItemID.COINS_995); }
Example #28
Source File: CannonPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
private void addCounter() { if (!config.showInfobox() || counter != null) { return; } counter = new CannonCounter(itemManager.getImage(ItemID.CANNONBALL), this); counter.setTooltip("Cannonballs"); infoBoxManager.addInfoBox(counter); }
Example #29
Source File: BlastMineRockOverlay.java From plugins with GNU General Public License v3.0 | 5 votes |
@Inject private BlastMineRockOverlay(final Client client, final BlastMinePlugin plugin, final BlastMinePluginConfig config, final ItemManager itemManager) { setPosition(OverlayPosition.DYNAMIC); setLayer(OverlayLayer.ABOVE_SCENE); this.client = client; this.plugin = plugin; this.config = config; chiselIcon = itemManager.getImage(ItemID.CHISEL); dynamiteIcon = itemManager.getImage(ItemID.DYNAMITE); tinderboxIcon = itemManager.getImage(ItemID.TINDERBOX); }
Example #30
Source File: MotherlodePlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
@Subscribe private void onChatMessage(ChatMessage event) { if (!inMlm || event.getType() != ChatMessageType.SPAM) { return; } String chatMessage = event.getMessage(); switch (chatMessage) { case "You manage to mine some pay-dirt.": session.incrementPayDirtMined(); break; case "You just found a Diamond!": session.incrementGemFound(ItemID.UNCUT_DIAMOND); break; case "You just found a Ruby!": session.incrementGemFound(ItemID.UNCUT_RUBY); break; case "You just found an Emerald!": session.incrementGemFound(ItemID.UNCUT_EMERALD); break; case "You just found a Sapphire!": session.incrementGemFound(ItemID.UNCUT_SAPPHIRE); break; } }