net.runelite.api.Item Java Examples
The following examples show how to use
net.runelite.api.Item.
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: EmoteClueTest.java From plugins with GNU General Public License v3.0 | 6 votes |
@Test public void itemRequirementsFullBarrowsSetNonDegraged() { EmoteClue barrowsClue = EmoteClue.forText("Do a jig at the barrows chest. Beware of double agents! Equip any full barrows set."); ItemRequirement[] requirements = barrowsClue.getItemRequirements(); assertEquals(1, requirements.length); ItemRequirement fullBarrowsSetRequirement = requirements[0]; assertTrue("Full Ahrim set, nondegraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(AHRIMS_STAFF), item(AHRIMS_HOOD), item(AHRIMS_ROBETOP), item(AHRIMS_ROBESKIRT) })); assertTrue("Full Dharok set, nondegraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(DHAROKS_GREATAXE), item(DHAROKS_HELM), item(DHAROKS_PLATEBODY), item(DHAROKS_PLATELEGS) })); assertTrue("Full Guthan set, nondegraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(GUTHANS_WARSPEAR), item(GUTHANS_HELM), item(GUTHANS_PLATEBODY), item(GUTHANS_CHAINSKIRT) })); assertTrue("Full Karil set, nondegraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(KARILS_CROSSBOW), item(KARILS_COIF), item(KARILS_LEATHERTOP), item(KARILS_LEATHERSKIRT) })); assertTrue("Full Torag set, nondegraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(TORAGS_HAMMERS), item(TORAGS_HELM), item(TORAGS_PLATEBODY), item(TORAGS_PLATELEGS) })); assertTrue("Full Verac set, nondegraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(VERACS_FLAIL), item(VERACS_HELM), item(VERACS_BRASSARD), item(VERACS_PLATESKIRT) })); }
Example #2
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 #3
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 #4
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 #5
Source File: EmoteClueTest.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Test public void itemRequirementsFullBarrowsSetNonDegraged() { EmoteClue barrowsClue = EmoteClue.forText("Do a jig at the barrows chest. Beware of double agents! Equip any full barrows set."); ItemRequirement[] requirements = barrowsClue.getItemRequirements(); assertEquals(1, requirements.length); ItemRequirement fullBarrowsSetRequirement = requirements[0]; assertTrue("Full Ahrim set, nondegraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(AHRIMS_STAFF), item(AHRIMS_HOOD), item(AHRIMS_ROBETOP), item(AHRIMS_ROBESKIRT) })); assertTrue("Full Dharok set, nondegraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(DHAROKS_GREATAXE), item(DHAROKS_HELM), item(DHAROKS_PLATEBODY), item(DHAROKS_PLATELEGS) })); assertTrue("Full Guthan set, nondegraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(GUTHANS_WARSPEAR), item(GUTHANS_HELM), item(GUTHANS_PLATEBODY), item(GUTHANS_CHAINSKIRT) })); assertTrue("Full Karil set, nondegraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(KARILS_CROSSBOW), item(KARILS_COIF), item(KARILS_LEATHERTOP), item(KARILS_LEATHERSKIRT) })); assertTrue("Full Torag set, nondegraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(TORAGS_HAMMERS), item(TORAGS_HELM), item(TORAGS_PLATEBODY), item(TORAGS_PLATELEGS) })); assertTrue("Full Verac set, nondegraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(VERACS_FLAIL), item(VERACS_HELM), item(VERACS_BRASSARD), item(VERACS_PLATESKIRT) })); }
Example #6
Source File: EmoteClueTest.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Test public void itemRequirementsFullBarrowsSetDegraded() { EmoteClue barrowsClue = EmoteClue.forText("Do a jig at the barrows chest. Beware of double agents! Equip any full barrows set."); ItemRequirement[] requirements = barrowsClue.getItemRequirements(); assertEquals(1, requirements.length); ItemRequirement fullBarrowsSetRequirement = requirements[0]; assertTrue("Full Ahrim set, degraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(AHRIMS_STAFF_50), item(AHRIMS_HOOD_50), item(AHRIMS_ROBETOP_50), item(AHRIMS_ROBESKIRT_50) })); assertTrue("Full Dharok set, degraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(DHAROKS_GREATAXE_50), item(DHAROKS_HELM_50), item(DHAROKS_PLATEBODY_50), item(DHAROKS_PLATELEGS_50) })); assertTrue("Full Guthan set, degraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(GUTHANS_WARSPEAR_50), item(GUTHANS_HELM_50), item(GUTHANS_PLATEBODY_50), item(GUTHANS_CHAINSKIRT_50) })); assertTrue("Full Karil set, degraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(KARILS_CROSSBOW_50), item(KARILS_COIF_50), item(KARILS_LEATHERTOP_50), item(KARILS_LEATHERSKIRT_50) })); assertTrue("Full Torag set, degraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(TORAGS_HAMMERS_50), item(TORAGS_HELM_50), item(TORAGS_PLATEBODY_50), item(TORAGS_PLATELEGS_50) })); assertTrue("Full Verac set, degraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(VERACS_FLAIL_50), item(VERACS_HELM_50), item(VERACS_BRASSARD_50), item(VERACS_PLATESKIRT_50) })); }
Example #7
Source File: PuzzleSolverOverlay.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
private int[] getItemIds(ItemContainer container, boolean useNormalSolver) { int[] itemIds = new int[DIMENSION * DIMENSION]; Item[] items = container.getItems(); for (int i = 0; i < items.length; i++) { itemIds[i] = items[i].getId(); } // If blank is in the last position, items doesn't contain it, so let's add it manually if (itemIds.length > items.length) { itemIds[items.length] = BLANK_TILE_VALUE; } return convertToSolverFormat(itemIds, useNormalSolver); }
Example #8
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 #9
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 #10
Source File: PuzzleSolverOverlay.java From plugins with GNU General Public License v3.0 | 6 votes |
private int[] getItemIds(ItemContainer container, boolean useNormalSolver) { int[] itemIds = new int[DIMENSION * DIMENSION]; Item[] items = container.getItems(); for (int i = 0; i < items.length; i++) { itemIds[i] = items[i].getId(); } // If blank is in the last position, items doesn't contain it, so let's add it manually if (itemIds.length > items.length) { itemIds[items.length] = BLANK_TILE_VALUE; } return convertToSolverFormat(itemIds, useNormalSolver); }
Example #11
Source File: MultipleOfItemRequirement.java From plugins with GNU General Public License v3.0 | 6 votes |
@Override public boolean fulfilledBy(Item[] items) { int quantityFound = 0; for (Item item : items) { if (item.getId() == itemId) { quantityFound += item.getQuantity(); if (quantityFound >= quantity) { return true; } } } return false; }
Example #12
Source File: CastleWarsBandage.java From plugins with GNU General Public License v3.0 | 6 votes |
private boolean hasBracelet(ItemContainer equipmentContainer) { if (equipmentContainer == null) { return false; } final Item gloves = equipmentContainer.getItem(EquipmentInventorySlot.GLOVES.getSlotIdx()); if (gloves != null) { return BRACELETS.contains(gloves.getId()); } return false; }
Example #13
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 #14
Source File: SlotLimitationRequirement.java From plugins with GNU General Public License v3.0 | 6 votes |
@Override public boolean fulfilledBy(Item[] items) { for (EquipmentInventorySlot slot : slots) { if (slot.getSlotIdx() >= items.length) { continue; //We can't check the slot, because there is nothing in it, the array hasn't been resized } if (items[slot.getSlotIdx()].getId() != -1) { return false; } } return true; }
Example #15
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 #16
Source File: SlotLimitationRequirement.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Override public boolean fulfilledBy(Item[] items) { for (EquipmentInventorySlot slot : slots) { if (slot.getSlotIdx() >= items.length) { continue; //We can't check the slot, because there is nothing in it, the array hasn't been resized } if (items[slot.getSlotIdx()].getId() != -1) { return false; } } return true; }
Example #17
Source File: EmoteClueTest.java From plugins with GNU General Public License v3.0 | 6 votes |
@Test public void itemRequirementsFullBarrowsSetDegraded() { EmoteClue barrowsClue = EmoteClue.forText("Do a jig at the barrows chest. Beware of double agents! Equip any full barrows set."); ItemRequirement[] requirements = barrowsClue.getItemRequirements(); assertEquals(1, requirements.length); ItemRequirement fullBarrowsSetRequirement = requirements[0]; assertTrue("Full Ahrim set, degraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(AHRIMS_STAFF_50), item(AHRIMS_HOOD_50), item(AHRIMS_ROBETOP_50), item(AHRIMS_ROBESKIRT_50) })); assertTrue("Full Dharok set, degraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(DHAROKS_GREATAXE_50), item(DHAROKS_HELM_50), item(DHAROKS_PLATEBODY_50), item(DHAROKS_PLATELEGS_50) })); assertTrue("Full Guthan set, degraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(GUTHANS_WARSPEAR_50), item(GUTHANS_HELM_50), item(GUTHANS_PLATEBODY_50), item(GUTHANS_CHAINSKIRT_50) })); assertTrue("Full Karil set, degraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(KARILS_CROSSBOW_50), item(KARILS_COIF_50), item(KARILS_LEATHERTOP_50), item(KARILS_LEATHERSKIRT_50) })); assertTrue("Full Torag set, degraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(TORAGS_HAMMERS_50), item(TORAGS_HELM_50), item(TORAGS_PLATEBODY_50), item(TORAGS_PLATELEGS_50) })); assertTrue("Full Verac set, degraded", fullBarrowsSetRequirement.fulfilledBy(new Item[]{ item(VERACS_FLAIL_50), item(VERACS_HELM_50), item(VERACS_BRASSARD_50), item(VERACS_PLATESKIRT_50) })); }
Example #18
Source File: CustomSwapper.java From ExternalPlugins with GNU General Public License v3.0 | 5 votes |
@Subscribe public void onCommandExecuted(CommandExecuted event) { if (event.getCommand().equalsIgnoreCase("copycs")) { final ItemContainer e = client.getItemContainer(InventoryID.EQUIPMENT); if (e == null) { log.error("CopyCS: Can't find equipment container."); return; } final StringBuilder sb = new StringBuilder(); for (Item item : e.getItems()) { if (item.getId() == -1 || item.getId() == 0) { continue; } sb.append(item.getId()); sb.append(":"); sb.append("Equip"); sb.append("\n"); } final String string = sb.toString(); Clipboard.store(string); } }
Example #19
Source File: SuppliesTrackerPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
/** * Checks for changes between the provided inventories in runes specifically to add those runes * to the supply tracker * <p> * we can't in general just check for when inventory slots change but this method is only run * immediately after the player performs a cast animation or cast menu click/entry * * @param itemContainer the new inventory * @param oldInv the old inventory */ private void checkUsedRunes(ItemContainer itemContainer, Item[] oldInv) { try { for (int i = 0; i < itemContainer.getItems().length; i++) { Item newItem = itemContainer.getItems()[i]; Item oldItem = oldInv[i]; boolean isRune = false; for (int runeId : RUNE_IDS) { if (oldItem.getId() == runeId) { isRune = true; break; } } if (isRune && (newItem.getId() != oldItem.getId() || newItem.getQuantity() != oldItem.getQuantity())) { int quantity = oldItem.getQuantity(); if (newItem.getId() == oldItem.getId()) { quantity -= newItem.getQuantity(); } // ensure that only positive quantities are added since it is reported // that sometimes checkUsedRunes is called on the same tick that a player // gains runes in their inventory if (quantity > 0 && quantity < 35) { buildEntries(oldItem.getId(), quantity); } } } } catch (IndexOutOfBoundsException ignored) { } }
Example #20
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 #21
Source File: WintertodtPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
@Subscribe private void onItemContainerChanged(ItemContainerChanged event) { final ItemContainer container = event.getItemContainer(); if (!isInWintertodt || container != client.getItemContainer(InventoryID.INVENTORY)) { return; } final Item[] inv = container.getItems(); numRoots = 0; numKindling = 0; for (Item item : inv) { switch (item.getId()) { case BRUMA_ROOT: ++numRoots; break; case BRUMA_KINDLING: ++numKindling; break; } } //If we're currently fletching but there are no more roots, go ahead and abort fletching immediately if (numRoots == 0 && currentActivity == WintertodtActivity.FLETCHING) { currentActivity = WintertodtActivity.IDLE; } //Otherwise, if we're currently feeding the brazier but we've run out of both roots and kindling, abort the feeding activity else if (numRoots == 0 && numKindling == 0 && currentActivity == WintertodtActivity.FEEDING_BRAZIER) { currentActivity = WintertodtActivity.IDLE; } }
Example #22
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 #23
Source File: AmmoPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
private void checkInventory(final Item[] items) { // Check for weapon slot items. This overrides the ammo slot, // as the player will use the thrown weapon (eg. chinchompas, knives, darts) if (items.length > EquipmentInventorySlot.WEAPON.getSlotIdx()) { final Item weapon = items[EquipmentInventorySlot.WEAPON.getSlotIdx()]; final ItemDefinition weaponComp = itemManager.getItemDefinition(weapon.getId()); if (weaponComp.isStackable()) { updateInfobox(weapon, weaponComp); return; } } if (items.length <= EquipmentInventorySlot.AMMO.getSlotIdx()) { removeInfobox(); return; } final Item ammo = items[EquipmentInventorySlot.AMMO.getSlotIdx()]; final ItemDefinition comp = itemManager.getItemDefinition(ammo.getId()); if (!comp.isStackable()) { removeInfobox(); return; } updateInfobox(ammo, comp); }
Example #24
Source File: SkillChallengeClue.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
private static List<LineComponent> getRequirements(ClueScrollPlugin plugin, boolean requireEquipped, ItemRequirement ... requirements) { List<LineComponent> components = new ArrayList<>(); Item[] equipment = plugin.getEquippedItems(); Item[] inventory = plugin.getInventoryItems(); // If equipment is null, the player is wearing nothing if (equipment == null) { equipment = new Item[0]; } // If inventory is null, the player has nothing in their inventory if (inventory == null) { inventory = new Item[0]; } Item[] combined = new Item[equipment.length + inventory.length]; System.arraycopy(equipment, 0, combined, 0, equipment.length); System.arraycopy(inventory, 0, combined, equipment.length, inventory.length); for (ItemRequirement requirement : requirements) { boolean equipmentFulfilled = requirement.fulfilledBy(equipment); boolean combinedFulfilled = requirement.fulfilledBy(combined); components.add(LineComponent.builder() .left(requirement.getCollectiveName(plugin.getClient())) .leftColor(TITLED_CONTENT_COLOR) .right(combinedFulfilled ? "\u2713" : "\u2717") .rightColor(equipmentFulfilled || (combinedFulfilled && !requireEquipped) ? Color.GREEN : (combinedFulfilled ? Color.ORANGE : Color.RED)) .build()); } return components; }
Example #25
Source File: ItemChargePlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
private void updateJewelleryInfobox(ItemWithSlot item, Item[] items) { for (final EquipmentInventorySlot equipmentInventorySlot : item.getSlots()) { updateJewelleryInfobox(item, items, equipmentInventorySlot); } }
Example #26
Source File: AmmoPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
private void checkInventory(final Item[] items) { // Check for weapon slot items. This overrides the ammo slot, // as the player will use the thrown weapon (eg. chinchompas, knives, darts) if (items.length > EquipmentInventorySlot.WEAPON.getSlotIdx()) { final Item weapon = items[EquipmentInventorySlot.WEAPON.getSlotIdx()]; final ItemComposition weaponComp = itemManager.getItemComposition(weapon.getId()); if (weaponComp.isStackable()) { updateInfobox(weapon, weaponComp); return; } } if (items.length <= EquipmentInventorySlot.AMMO.getSlotIdx()) { removeInfobox(); return; } final Item ammo = items[EquipmentInventorySlot.AMMO.getSlotIdx()]; final ItemComposition comp = itemManager.getItemComposition(ammo.getId()); if (!comp.isStackable()) { removeInfobox(); return; } updateInfobox(ammo, comp); }
Example #27
Source File: FishingPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
private boolean canPlayerFish(final ItemContainer itemContainer) { if (itemContainer == null) { return false; } for (Item item : itemContainer.getItems()) { switch (item.getId()) { case ItemID.DRAGON_HARPOON: case ItemID.INFERNAL_HARPOON: case ItemID.INFERNAL_HARPOON_UNCHARGED: case ItemID.HARPOON: case ItemID.BARBTAIL_HARPOON: case ItemID.BIG_FISHING_NET: case ItemID.SMALL_FISHING_NET: case ItemID.SMALL_FISHING_NET_6209: case ItemID.FISHING_ROD: case ItemID.FLY_FISHING_ROD: case ItemID.PEARL_BARBARIAN_ROD: case ItemID.PEARL_FISHING_ROD: case ItemID.PEARL_FLY_FISHING_ROD: case ItemID.BARBARIAN_ROD: case ItemID.OILY_FISHING_ROD: case ItemID.LOBSTER_POT: case ItemID.KARAMBWAN_VESSEL: case ItemID.KARAMBWAN_VESSEL_3159: case ItemID.CORMORANTS_GLOVE: case ItemID.CORMORANTS_GLOVE_22817: return true; } } return false; }
Example #28
Source File: AnyRequirementCollection.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Override public boolean fulfilledBy(Item[] items) { for (ItemRequirement requirement : requirements) { if (requirement.fulfilledBy(items)) { return true; } } return false; }
Example #29
Source File: SingleItemRequirement.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Override public boolean fulfilledBy(Item[] items) { for (Item item : items) { if (item.getId() == itemId) { return true; } } return false; }
Example #30
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; } }