use of net.runelite.api.widgets.WidgetItem in project runelite by runelite.
the class TitheFarmInventoryOverlay method render.
@Override
public Dimension render(Graphics2D graphics) {
if (!config.showWateringCanOverlay()) {
return null;
}
graphics.setFont(FontManager.getRunescapeSmallFont());
Query inventoryQuery = new InventoryWidgetItemQuery();
WidgetItem[] inventoryItems = queryRunner.runQuery(inventoryQuery);
for (WidgetItem item : inventoryItems) {
WateringCan wateringCan = WateringCan.getWateringCan(item.getId());
if (wateringCan == null) {
continue;
}
final Rectangle bounds = item.getCanvasBounds();
textComponent.setPosition(new Point(bounds.x, bounds.y + 16));
textComponent.setColor(wateringCan.getColor());
textComponent.setText(String.valueOf(wateringCan.getCharges()));
textComponent.render(graphics);
}
return null;
}
use of net.runelite.api.widgets.WidgetItem in project runelite by runelite.
the class BindNeckOverlay method render.
@Override
public Dimension render(Graphics2D graphics) {
if (!config.showBindNeck()) {
return null;
}
graphics.setFont(FontManager.getRunescapeSmallFont());
for (WidgetItem necklace : getNecklaceWidgetItems()) {
final Color color = bindingCharges == 1 ? Color.RED : Color.WHITE;
final Rectangle bounds = necklace.getCanvasBounds();
final String text = bindingCharges <= 0 ? "?" : bindingCharges + "";
final TextComponent textComponent = new TextComponent();
textComponent.setPosition(new Point(bounds.x, bounds.y + 16));
textComponent.setText(text);
textComponent.setColor(color);
textComponent.render(graphics);
}
return null;
}
use of net.runelite.api.widgets.WidgetItem in project runelite by runelite.
the class RunecraftOverlay method render.
@Override
public Dimension render(Graphics2D graphics) {
if (!config.showPouch()) {
return null;
}
Query query = new InventoryWidgetItemQuery();
WidgetItem[] widgetItems = queryRunner.runQuery(query);
graphics.setFont(FontManager.getRunescapeSmallFont());
for (WidgetItem item : widgetItems) {
Varbits varbits;
switch(item.getId()) {
case ItemID.SMALL_POUCH:
varbits = Varbits.POUCH_SMALL;
break;
case ItemID.MEDIUM_POUCH:
case MEDIUM_POUCH_DAMAGED:
varbits = Varbits.POUCH_MEDIUM;
break;
case ItemID.LARGE_POUCH:
case LARGE_POUCH_DAMAGED:
varbits = Varbits.POUCH_LARGE;
break;
case ItemID.GIANT_POUCH:
case GIANT_POUCH_DAMAGED:
varbits = Varbits.POUCH_GIANT;
break;
default:
continue;
}
final Rectangle bounds = item.getCanvasBounds();
final TextComponent textComponent = new TextComponent();
textComponent.setPosition(new Point(bounds.x, bounds.y + 16));
textComponent.setText(String.valueOf(client.getSetting(varbits)));
textComponent.render(graphics);
}
return null;
}
use of net.runelite.api.widgets.WidgetItem in project runelite by runelite.
the class ShopItemQuery method getShopItems.
private Collection<WidgetItem> getShopItems(Client client) {
Collection<WidgetItem> widgetItems = new ArrayList<>();
Widget shop = client.getWidget(WidgetInfo.SHOP_ITEMS_CONTAINER);
if (shop != null && !shop.isHidden()) {
Widget[] children = shop.getDynamicChildren();
for (int i = 1; i < children.length; i++) {
// set bounds to same size as default inventory
Rectangle bounds = children[i].getBounds();
bounds.setBounds(bounds.x - 1, bounds.y - 1, 32, 32);
widgetItems.add(new WidgetItem(children[i].getItemId(), children[i].getItemQuantity(), i - 1, bounds));
}
}
return widgetItems;
}
use of net.runelite.api.widgets.WidgetItem in project runelite by runelite.
the class JewelleryCountOverlay method render.
@Override
public Dimension render(Graphics2D graphics) {
graphics.setFont(FontManager.getRunescapeSmallFont());
for (WidgetItem item : getJewelleryWidgetItems()) {
JewelleryCharges charges = JewelleryCharges.getCharges(item.getId());
if (charges == null) {
continue;
}
final Rectangle bounds = item.getCanvasBounds();
final TextComponent textComponent = new TextComponent();
textComponent.setPosition(new Point(bounds.x, bounds.y + 16));
textComponent.setText(String.valueOf(charges.getCharges()));
textComponent.render(graphics);
}
return null;
}
Aggregations