net.runelite.api.InventoryID Java Examples
The following examples show how to use
net.runelite.api.InventoryID.
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: ItemChargePlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
private void updateAmuletOfBountyCharges(final int value) { config.amuletOfBounty(value); if (config.showInfoboxes() && config.showAmuletOfBountyCharges()) { final ItemContainer itemContainer = client.getItemContainer(InventoryID.EQUIPMENT); if (itemContainer == null) { return; } updateJewelleryInfobox(ItemWithSlot.AMULET_OF_BOUNTY, itemContainer.getItems()); } }
Example #2
Source File: SpecialCounterPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
private SpecialWeapon usedSpecialWeapon() { ItemContainer equipment = client.getItemContainer(InventoryID.EQUIPMENT); if (equipment == null) { return null; } Item weapon = equipment.getItem(EquipmentInventorySlot.WEAPON.getSlotIdx()); if (weapon == null) { return null; } for (SpecialWeapon specialWeapon : SpecialWeapon.values()) { if (specialWeapon.getItemID() == weapon.getId()) { return specialWeapon; } } return null; }
Example #3
Source File: ItemChargePlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
private void updateExplorerRingCharges(final int value) { // Note: Varbit counts upwards. We count down from the maximum charges. config.explorerRing(MAX_EXPLORER_RING_CHARGES - value); if (config.showInfoboxes() && config.showExplorerRingCharges()) { final ItemContainer itemContainer = client.getItemContainer(InventoryID.EQUIPMENT); if (itemContainer == null) { return; } updateJewelleryInfobox(ItemWithSlot.EXPLORER_RING, itemContainer.getItems()); } }
Example #4
Source File: MotherlodePlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Subscribe public void onItemContainerChanged(ItemContainerChanged event) { final ItemContainer container = event.getItemContainer(); if (!inMlm || !shouldUpdateOres || inventorySnapshot == null || container != client.getItemContainer(InventoryID.INVENTORY)) { return; } // Build set of current inventory Multiset<Integer> current = HashMultiset.create(); Arrays.stream(container.getItems()) .filter(item -> MLM_ORE_TYPES.contains(item.getId())) .forEach(item -> current.add(item.getId(), item.getQuantity())); // Take the difference Multiset<Integer> delta = Multisets.difference(current, inventorySnapshot); // Update the session delta.forEachEntry(session::updateOreFound); inventorySnapshot = null; shouldUpdateOres = false; }
Example #5
Source File: KourendLibraryPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
private void updatePlayerBooks() { ItemContainer itemContainer = client.getItemContainer(InventoryID.INVENTORY); EnumSet<Book> books = EnumSet.noneOf(Book.class); if (itemContainer != null) { for (Item item : itemContainer.getItems()) { Book book = Book.byId(item.getId()); if (book != null) { books.add(book); } } } playerBooks = books; }
Example #6
Source File: StealingArtefactsPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
@Subscribe private void onItemContainerChanged(ItemContainerChanged event) { if (isConfigSettingEnabled() && !stealingArtefactsHouse.equals(StealingArtefactsHouse.CAPTAIN_KHALED) && event.getContainerId() == InventoryID.INVENTORY.getId() && isPlayerInRegion(REGION_ID_HOUSE) && containsArtefact(event.getItemContainer())) { resetHouse(); removeWorldMapPoint(); removeHintArrow(); if (displayHintArrow) { addWorldMapPoint(); addHintArrow(); } } }
Example #7
Source File: MaxHitPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
private void updateMaxHitWidget() { Widget equipmentStats = client.getWidget(WidgetInfo.EQUIPMENT_INVENTORY_ITEMS_CONTAINER); ItemContainer equipmentContainer = client.getItemContainer(InventoryID.EQUIPMENT); Item[] equipedItems = new Item[14]; if (equipmentStats != null && !equipmentStats.isHidden()) { if (equipmentContainer != null) { equipedItems = equipmentContainer.getItems(); } MeleeMaxHitCalculator meleeMaxHitCalculator = new MeleeMaxHitCalculator(this.client, equipedItems); RangeMaxHitCalculator rangeMaxHitCalculator = new RangeMaxHitCalculator(this.client, equipedItems); MagicMaxHitCalculator magicMaxHitCalculator = new MagicMaxHitCalculator(this.client, equipedItems); MaxHit maxHit = new MaxHit(meleeMaxHitCalculator.getMaxHit(), rangeMaxHitCalculator.getMaxHit(), magicMaxHitCalculator.getMaxHit()); this.setWidgetMaxHit(maxHit); } }
Example #8
Source File: BankPlugin.java From runelite with BSD 2-Clause "Simplified" License | 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 #9
Source File: FishingPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Subscribe public void onItemContainerChanged(ItemContainerChanged event) { if (event.getItemContainer() != client.getItemContainer(InventoryID.INVENTORY) && event.getItemContainer() != client.getItemContainer(InventoryID.EQUIPMENT)) { return; } final boolean showOverlays = session.getLastFishCaught() != null || canPlayerFish(client.getItemContainer(InventoryID.INVENTORY)) || canPlayerFish(client.getItemContainer(InventoryID.EQUIPMENT)); if (!showOverlays) { currentSpot = null; } spotOverlay.setHidden(!showOverlays); fishingSpotMinimapOverlay.setHidden(!showOverlays); }
Example #10
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 #11
Source File: BankPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
private Item[] getBankTabItems() { final ItemContainer container = client.getItemContainer(InventoryID.BANK); if (container == null) { return null; } final Item[] items = container.getItems(); int currentTab = client.getVar(Varbits.CURRENT_BANK_TAB); if (currentTab > 0) { int startIndex = 0; for (int i = currentTab - 1; i > 0; i--) { startIndex += client.getVar(TAB_VARBITS.get(i - 1)); } int itemCount = client.getVar(TAB_VARBITS.get(currentTab - 1)); return Arrays.copyOfRange(items, startIndex, startIndex + itemCount); } return items; }
Example #12
Source File: SpecialCounterPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
private SpecialWeapon usedSpecialWeapon() { ItemContainer equipment = client.getItemContainer(InventoryID.EQUIPMENT); if (equipment == null) { return null; } Item weapon = equipment.getItem(EquipmentInventorySlot.WEAPON.getSlotIdx()); if (weapon == null) { return null; } for (SpecialWeapon specialWeapon : SpecialWeapon.values()) { if (specialWeapon.getItemID() == weapon.getId()) { return specialWeapon; } } return null; }
Example #13
Source File: KourendLibraryPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
private void updatePlayerBooks() { ItemContainer itemContainer = client.getItemContainer(InventoryID.INVENTORY); EnumSet<Book> books = EnumSet.noneOf(Book.class); if (itemContainer != null) { for (Item item : itemContainer.getItems()) { Book book = Book.byId(item.getId()); if (book != null) { books.add(book); } } } playerBooks = books; }
Example #14
Source File: GraveyardRoom.java From plugins with GNU General Public License v3.0 | 6 votes |
private void onItemContainerChanged(ItemContainerChanged event) { if (!inside()) { return; } ItemContainer container = event.getItemContainer(); if (container == client.getItemContainer(InventoryID.INVENTORY)) { int score = score(container.getItems()); if (counter == null) { BufferedImage image = itemManager.getImage(ANIMALS_BONES); counter = new GraveyardCounter(image, plugin); infoBoxManager.addInfoBox(counter); } counter.setCount(score); } }
Example #15
Source File: GraveyardRoom.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Subscribe public void onItemContainerChanged(ItemContainerChanged event) { if (!inside()) { return; } ItemContainer container = event.getItemContainer(); if (container == client.getItemContainer(InventoryID.INVENTORY)) { this.score = score(container.getItems()); if (counter == null) { BufferedImage image = itemManager.getImage(ANIMALS_BONES); counter = new GraveyardCounter(image, plugin); infoBoxManager.addInfoBox(counter); } counter.setCount(score); } }
Example #16
Source File: ItemChargePlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
private void updateBindingNecklaceCharges(final int value) { config.bindingNecklace(value); if (config.showInfoboxes() && config.showBindingNecklaceCharges()) { final ItemContainer itemContainer = client.getItemContainer(InventoryID.EQUIPMENT); if (itemContainer == null) { return; } updateJewelleryInfobox(ItemWithSlot.BINDING_NECKLACE, itemContainer.getItems()); } }
Example #17
Source File: ItemChargePlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
private void updateExpeditiousCharges(final int value) { config.expeditious(value); if (config.showInfoboxes() && config.showSlayerBracelets()) { final ItemContainer itemContainer = client.getItemContainer(InventoryID.EQUIPMENT); if (itemContainer == null) { return; } updateJewelleryInfobox(ItemWithSlot.EXPEDITIOUS_BRACELET, itemContainer.getItems()); } }
Example #18
Source File: ItemChargePlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
private void updateBraceletOfSlaughterCharges(final int value) { config.slaughter(value); if (config.showInfoboxes() && config.showSlayerBracelets()) { final ItemContainer itemContainer = client.getItemContainer(InventoryID.EQUIPMENT); if (itemContainer == null) { return; } updateJewelleryInfobox(ItemWithSlot.BRACELET_OF_SLAUGHTER, itemContainer.getItems()); } }
Example #19
Source File: ItemChargePlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
private void updateBindingNecklaceCharges(final int value) { config.bindingNecklace(value); if (config.showInfoboxes() && config.showBindingNecklaceCharges()) { final ItemContainer itemContainer = client.getItemContainer(InventoryID.EQUIPMENT); if (itemContainer == null) { return; } updateJewelleryInfobox(ItemWithSlot.BINDING_NECKLACE, itemContainer.getItems()); } }
Example #20
Source File: ItemChargePlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
private void updateExplorerRingCharges(final int value) { // Note: Varbit counts upwards. We count down from the maximum charges. config.explorerRing(MAX_EXPLORER_RING_CHARGES - value); if (config.showInfoboxes() && config.showExplorerRingCharges()) { final ItemContainer itemContainer = client.getItemContainer(InventoryID.EQUIPMENT); if (itemContainer == null) { return; } updateJewelleryInfobox(ItemWithSlot.EXPLORER_RING, itemContainer.getItems()); } }
Example #21
Source File: FishingPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
@Subscribe private void onItemContainerChanged(ItemContainerChanged event) { if (event.getItemContainer() != client.getItemContainer(InventoryID.INVENTORY) && event.getItemContainer() != client.getItemContainer(InventoryID.EQUIPMENT)) { return; } final boolean showOverlays = session.getLastFishCaught() != null || canPlayerFish(client.getItemContainer(InventoryID.INVENTORY)) || canPlayerFish(client.getItemContainer(InventoryID.EQUIPMENT)); if (!showOverlays) { currentSpot = null; } spotOverlay.setHidden(!showOverlays); fishingSpotMinimapOverlay.setHidden(!showOverlays); }
Example #22
Source File: ItemChargePlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
private void updateRingOfForgingCharges(final int value) { config.ringOfForging(value); if (config.showInfoboxes() && config.showRingOfForgingCount()) { final ItemContainer itemContainer = client.getItemContainer(InventoryID.EQUIPMENT); if (itemContainer == null) { return; } updateJewelleryInfobox(ItemWithSlot.RING_OF_FORGING, itemContainer.getItems()); } }
Example #23
Source File: ItemDropper.java From ExternalPlugins with GNU General Public License v3.0 | 6 votes |
@Subscribe public void onItemContainerChanged(ItemContainerChanged event) { if (event.getItemContainer() != client.getItemContainer(InventoryID.INVENTORY)) { return; } int quant = 0; for (Item item : event.getItemContainer().getItems()) { if (ids.contains(item.getId())) { quant++; } } if (iterating && quant == 0) { iterating = false; clearNames(); } }
Example #24
Source File: PrayerPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
@Subscribe private void onItemContainerChanged(final ItemContainerChanged event) { final ItemContainer container = event.getItemContainer(); final ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY); final ItemContainer equipment = client.getItemContainer(InventoryID.EQUIPMENT); if (container != null && (container.equals(inventory) || container.equals(equipment))) { doseOverlay.setHasHolyWrench(false); doseOverlay.setHasPrayerRestore(false); doseOverlay.setBonusPrayer(0); if (inventory != null) { checkContainerForPrayer(inventory.getItems()); } if (equipment != null) { prayerBonus = checkContainerForPrayer(equipment.getItems()); } } }
Example #25
Source File: ZalcanoUtil.java From plugins with GNU General Public License v3.0 | 6 votes |
/** * Courtesy of OP * * @param itemId * @return */ int countStackInInventory(int itemId) { ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY); if (inventory != null) { Item[] items = inventory.getItems(); for (int i = 0; i < 28; ++i) { if (i < items.length) { Item item = items[i]; if (item.getId() >= 0 && item.getId() == itemId) { return item.getQuantity(); } } } } return 0; }
Example #26
Source File: MotherlodePlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
@Subscribe void onItemContainerChanged(ItemContainerChanged event) { final ItemContainer container = event.getItemContainer(); if (!inMlm || !shouldUpdateOres || inventorySnapshot == null || container != client.getItemContainer(InventoryID.INVENTORY)) { return; } // Build set of current inventory Multiset<Integer> current = HashMultiset.create(); Arrays.stream(container.getItems()) .filter(item -> MLM_ORE_TYPES.contains(item.getId())) .forEach(item -> current.add(item.getId(), item.getQuantity())); // Take the difference Multiset<Integer> delta = Multisets.difference(current, inventorySnapshot); // Update the session delta.forEachEntry(session::updateOreFound); inventorySnapshot = null; shouldUpdateOres = false; }
Example #27
Source File: LeftClickCast.java From ExternalPlugins with GNU General Public License v3.0 | 5 votes |
@Subscribe public void onItemContainerChanged(ItemContainerChanged event) { final ItemContainer ic = event.getItemContainer(); if (client.getItemContainer(InventoryID.EQUIPMENT) != ic) { return; } isMage = false; for (Item item : ic.getItems()) { final String name = client.getItemDefinition(item.getId()).getName().toLowerCase(); if (name.contains("staff") || name.contains("wand")) { isMage = true; break; } } if (config.disableStaffChecks()) { isMage = true; } }
Example #28
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 #29
Source File: CastleWarsBandage.java From plugins with GNU General Public License v3.0 | 5 votes |
@Override public StatsChanges calculate(Client client) { final ItemContainer equipmentContainer = client.getItemContainer(InventoryID.EQUIPMENT); final double percH = hasBracelet(equipmentContainer) ? BRACELET_HP_PERC : BASE_HP_PERC; final StatChange hitPoints = heal(HITPOINTS, perc(percH, 0)).effect(client); final StatChange runEnergy = heal(RUN_ENERGY, 30).effect(client); final StatsChanges changes = new StatsChanges(2); changes.setStatChanges(new StatChange[]{hitPoints, runEnergy}); changes.setPositivity(Stream.of(changes.getStatChanges()) .map(StatChange::getPositivity) .max(Comparator.comparing(Enum::ordinal)).get()); return changes; }
Example #30
Source File: PrayerPotion.java From plugins with GNU General Public License v3.0 | 5 votes |
@Override public int heals(Client client) { boolean hasHolyWrench = false; ItemContainer equipContainer = client.getItemContainer(InventoryID.EQUIPMENT); if (equipContainer != null) { Item[] equip = equipContainer.getItems(); final int ring = ItemUtil.safeGetItemIdAtIndex(equip, EquipmentInventorySlot.RING.getSlotIdx()); final int cape = ItemUtil.safeGetItemIdAtIndex(equip, EquipmentInventorySlot.CAPE.getSlotIdx()); hasHolyWrench = ring == ItemID.RING_OF_THE_GODS_I; hasHolyWrench |= HOLY_WRENCH_IDS.contains(cape); } if (!hasHolyWrench) { ItemContainer invContainer = client.getItemContainer(InventoryID.INVENTORY); if (invContainer != null) { hasHolyWrench = ItemUtil.containsAnyItemId(invContainer.getItems(), HOLY_WRENCH_IDS); } } double percent = hasHolyWrench ? perc + .02 : perc; int max = getStat().getMaximum(client); return (((int) (max * percent)) * (delta >= 0 ? 1 : -1)) + delta; }