Java Code Examples for net.runelite.api.ItemContainer#contains()

The following examples show how to use net.runelite.api.ItemContainer#contains() . 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: ThreeStepCrypticClue.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
private boolean checkForPart(final ItemContainer itemContainer, int clueScrollPart, int index)
{
	// If we have the part then that step is done
	if (itemContainer.contains(clueScrollPart))
	{
		final Map.Entry<CrypticClue, Boolean> entry = clueSteps.get(index);

		if (!entry.getValue())
		{
			entry.setValue(true);
			return true;
		}
	}

	return false;
}
 
Example 2
Source File: ThreeStepCrypticClue.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private boolean checkForPart(final ItemContainer itemContainer, int clueScrollPart, int index)
{
	// If we have the part then that step is done
	if (itemContainer.contains(clueScrollPart))
	{
		final Map.Entry<CrypticClue, Boolean> entry = clueSteps.get(index);

		if (!entry.getValue())
		{
			entry.setValue(true);
			return true;
		}
	}

	return false;
}
 
Example 3
Source File: DriftNetPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
public void onItemContainerChanged(final ItemContainerChanged event)
{
	final ItemContainer itemContainer = event.getItemContainer();
	if (itemContainer != client.getItemContainer(InventoryID.INVENTORY))
	{
		return;
	}

	driftNetsInInventory = itemContainer.contains(ItemID.DRIFT_NET);
}
 
Example 4
Source File: BlastFurnaceClickBoxOverlay.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private boolean hasIceGloves()
{
	ItemContainer equipmentContainer = client.getItemContainer(InventoryID.EQUIPMENT);
	if (equipmentContainer == null)
	{
		return false;
	}

	return equipmentContainer.contains(ItemID.ICE_GLOVES);
}
 
Example 5
Source File: DriftNetPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onItemContainerChanged(final ItemContainerChanged event)
{
	final ItemContainer itemContainer = event.getItemContainer();
	if (itemContainer != client.getItemContainer(InventoryID.INVENTORY))
	{
		return;
	}

	driftNetsInInventory = itemContainer.contains(ItemID.DRIFT_NET);
}
 
Example 6
Source File: BlastFurnaceClickBoxOverlay.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private boolean hasIceGloves()
{
	ItemContainer equipmentContainer = client.getItemContainer(InventoryID.EQUIPMENT);
	if (equipmentContainer == null)
	{
		return false;
	}

	return equipmentContainer.contains(ItemID.ICE_GLOVES);
}
 
Example 7
Source File: RoguesDenPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onItemContainerChanged(ItemContainerChanged event)
{
	if (event.getContainerId() != InventoryID.INVENTORY.getId())
	{
		return;
	}

	ItemContainer itemContainer = event.getItemContainer();
	hasGem = itemContainer.contains(ItemID.MYSTIC_JEWEL);
}
 
Example 8
Source File: ClueScrollPlugin.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe
public void onItemContainerChanged(final ItemContainerChanged event)
{
	if (event.getItemContainer() == client.getItemContainer(InventoryID.EQUIPMENT))
	{
		equippedItems = event.getItemContainer().getItems();
		return;
	}

	if (event.getItemContainer() != client.getItemContainer(InventoryID.INVENTORY))
	{
		return;
	}

	inventoryItems = event.getItemContainer().getItems();

	// Check if item was removed from inventory
	if (clue != null && clueItemId != null)
	{
		ItemContainer itemContainer = event.getItemContainer();

		// Check if clue was removed from inventory
		if (!itemContainer.contains(clueItemId))
		{
			resetClue(true);
		}
	}

	// if three step clue check for clue scroll pieces
	if (clue instanceof ThreeStepCrypticClue)
	{
		if (((ThreeStepCrypticClue) clue).update(event.getContainerId(), event.getItemContainer()))
		{
			worldMapPointsSet = false;
			npcsToMark.clear();

			if (config.displayHintArrows())
			{
				client.clearHintArrow();
			}

			checkClueNPCs(clue, client.getCachedNPCs());
		}
	}
}
 
Example 9
Source File: ClueScrollPlugin.java    From runelite with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Subscribe
public void onItemContainerChanged(final ItemContainerChanged event)
{
	if (event.getItemContainer() == client.getItemContainer(InventoryID.EQUIPMENT))
	{
		equippedItems = event.getItemContainer().getItems();
		return;
	}

	if (event.getItemContainer() != client.getItemContainer(InventoryID.INVENTORY))
	{
		return;
	}

	inventoryItems = event.getItemContainer().getItems();

	// Check if item was removed from inventory
	if (clue != null && clueItemId != null)
	{
		ItemContainer itemContainer = event.getItemContainer();

		// Check if clue was removed from inventory
		if (!itemContainer.contains(clueItemId))
		{
			resetClue(true);
		}
	}

	// if three step clue check for clue scroll pieces
	if (clue instanceof ThreeStepCrypticClue)
	{
		if (((ThreeStepCrypticClue) clue).update(event.getContainerId(), event.getItemContainer()))
		{
			worldMapPointsSet = false;
			npcsToMark.clear();

			if (config.displayHintArrows())
			{
				client.clearHintArrow();
			}

			checkClueNPCs(clue, client.getCachedNPCs());
		}
	}
}