Java Code Examples for net.runelite.api.ItemID#RING_OF_FORGING

The following examples show how to use net.runelite.api.ItemID#RING_OF_FORGING . 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 runelite with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private void updateJewelleryInfobox(ItemWithSlot type, Item[] items, EquipmentInventorySlot slot)
{
	removeInfobox(type, slot);

	if (slot.getSlotIdx() >= items.length)
	{
		return;
	}

	final int id = items[slot.getSlotIdx()].getId();
	if (id < 0)
	{
		return;
	}

	final ItemWithCharge itemWithCharge = ItemWithCharge.findItem(id);
	int charges = -1;

	if (itemWithCharge == null)
	{
		if (id == ItemID.DODGY_NECKLACE && type == ItemWithSlot.DODGY_NECKLACE)
		{
			charges = config.dodgyNecklace();
		}
		else if (id == ItemID.BINDING_NECKLACE && type == ItemWithSlot.BINDING_NECKLACE)
		{
			charges = config.bindingNecklace();
		}
		else if ((id >= ItemID.EXPLORERS_RING_1 && id <= ItemID.EXPLORERS_RING_4) && type == ItemWithSlot.EXPLORER_RING)
		{
			charges = config.explorerRing();
		}
		else if (id == ItemID.RING_OF_FORGING && type == ItemWithSlot.RING_OF_FORGING)
		{
			charges = config.ringOfForging();
		}
		else if (id == ItemID.AMULET_OF_CHEMISTRY && type == ItemWithSlot.AMULET_OF_CHEMISTY)
		{
			charges = config.amuletOfChemistry();
		}
		else if (id == ItemID.AMULET_OF_BOUNTY && type == ItemWithSlot.AMULET_OF_BOUNTY)
		{
			charges = config.amuletOfBounty();
		}
	}
	else if (itemWithCharge.getType() == type.getType())
	{
		charges = itemWithCharge.getCharges();
	}

	if (charges <= 0)
	{
		return;
	}

	final String name = itemManager.getItemComposition(id).getName();
	final BufferedImage image = itemManager.getImage(id);
	final ItemChargeInfobox infobox = new ItemChargeInfobox(this, image, name, charges, type, slot);
	infoBoxManager.addInfoBox(infobox);
}
 
Example 2
Source File: ItemChargeOverlay.java    From runelite with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem itemWidget)
{
	if (!displayOverlay())
	{
		return;
	}

	graphics.setFont(FontManager.getRunescapeSmallFont());

	int charges;
	if (itemId == ItemID.DODGY_NECKLACE)
	{
		if (!config.showDodgyCount())
		{
			return;
		}

		charges = config.dodgyNecklace();
	}
	else if (itemId == ItemID.BINDING_NECKLACE)
	{
		if (!config.showBindingNecklaceCharges())
		{
			return;
		}

		charges = config.bindingNecklace();
	}
	else if (itemId >= ItemID.EXPLORERS_RING_1 && itemId <= ItemID.EXPLORERS_RING_4)
	{
		if (!config.showExplorerRingCharges())
		{
			return;
		}

		charges = config.explorerRing();
	}
	else if (itemId == ItemID.RING_OF_FORGING)
	{
		if (!config.showRingOfForgingCount())
		{
			return;
		}

		charges = config.ringOfForging();
	}
	else if (itemId == ItemID.AMULET_OF_CHEMISTRY)
	{
		if (!config.showAmuletOfChemistryCharges())
		{
			return;
		}

		charges = config.amuletOfChemistry();
	}
	else if (itemId == ItemID.AMULET_OF_BOUNTY)
	{
		if (!config.showAmuletOfBountyCharges())
		{
			return;
		}

		charges = config.amuletOfBounty();
	}
	else
	{
		ItemWithCharge chargeItem = ItemWithCharge.findItem(itemId);
		if (chargeItem == null)
		{
			return;
		}

		ItemChargeType type = chargeItem.getType();
		if ((type == TELEPORT && !config.showTeleportCharges())
			|| (type == FUNGICIDE_SPRAY && !config.showFungicideCharges())
			|| (type == IMPBOX && !config.showImpCharges())
			|| (type == WATERCAN && !config.showWateringCanCharges())
			|| (type == WATERSKIN && !config.showWaterskinCharges())
			|| (type == BELLOWS && !config.showBellowCharges())
			|| (type == FRUIT_BASKET && !config.showBasketCharges())
			|| (type == SACK && !config.showSackCharges())
			|| (type == ABYSSAL_BRACELET && !config.showAbyssalBraceletCharges())
			|| (type == AMULET_OF_CHEMISTRY && !config.showAmuletOfChemistryCharges())
			|| (type == AMULET_OF_BOUNTY && !config.showAmuletOfBountyCharges())
			|| (type == POTION && !config.showPotionDoseCount()))
		{
			return;
		}

		charges = chargeItem.getCharges();
	}

	final Rectangle bounds = itemWidget.getCanvasBounds();
	final TextComponent textComponent = new TextComponent();
	textComponent.setPosition(new Point(bounds.x - 1, bounds.y + 15));
	textComponent.setText(charges < 0 ? "?" : String.valueOf(charges));
	textComponent.setColor(itemChargePlugin.getColor(charges));
	textComponent.render(graphics);
}