Search in sources :

Example 6 with InventoryWidgetItemQuery

use of net.runelite.api.queries.InventoryWidgetItemQuery in project runelite by runelite.

the class JewelleryCountOverlay method getJewelleryWidgetItems.

private Collection<WidgetItem> getJewelleryWidgetItems() {
    Query inventoryQuery = new InventoryWidgetItemQuery();
    WidgetItem[] inventoryWidgetItems = queryRunner.runQuery(inventoryQuery);
    Query equipmentQuery = new EquipmentItemQuery().slotEquals(WidgetInfo.EQUIPMENT_AMULET, WidgetInfo.EQUIPMENT_RING, WidgetInfo.EQUIPMENT_GLOVES, WidgetInfo.EQUIPMENT_WEAPON);
    WidgetItem[] equipmentWidgetItems = queryRunner.runQuery(equipmentQuery);
    Collection<WidgetItem> jewellery = new ArrayList<>();
    jewellery.addAll(Arrays.asList(inventoryWidgetItems));
    jewellery.addAll(Arrays.asList(equipmentWidgetItems));
    return jewellery;
}
Also used : InventoryWidgetItemQuery(net.runelite.api.queries.InventoryWidgetItemQuery) EquipmentItemQuery(net.runelite.api.queries.EquipmentItemQuery) Query(net.runelite.api.Query) EquipmentItemQuery(net.runelite.api.queries.EquipmentItemQuery) InventoryWidgetItemQuery(net.runelite.api.queries.InventoryWidgetItemQuery) ArrayList(java.util.ArrayList) WidgetItem(net.runelite.api.widgets.WidgetItem)

Example 7 with InventoryWidgetItemQuery

use of net.runelite.api.queries.InventoryWidgetItemQuery in project runelite by runelite.

the class ItemStatOverlay method render.

@Override
public Dimension render(Graphics2D graphics) {
    if (client.isMenuOpen() || (!config.relative() && !config.absolute() && !config.theoretical())) {
        return null;
    }
    WidgetItem[] inventory = queryRunner.runQuery(new InventoryWidgetItemQuery());
    Point mousePos = new Point(client.getMouseCanvasPosition().getX(), client.getMouseCanvasPosition().getY());
    for (WidgetItem item : inventory) {
        if (item.getCanvasBounds().contains(mousePos)) {
            Effect change = statChanges.get(item.getId());
            if (change != null) {
                StringBuilder b = new StringBuilder();
                StatsChanges statsChanges = change.calculate(client);
                for (StatChange c : statsChanges.getStatChanges()) {
                    b.append(buildStatChangeString(c));
                }
                tooltipManager.add(new Tooltip(b.toString()));
            }
        }
    }
    return null;
}
Also used : InventoryWidgetItemQuery(net.runelite.api.queries.InventoryWidgetItemQuery) Tooltip(net.runelite.client.ui.overlay.tooltip.Tooltip) WidgetItem(net.runelite.api.widgets.WidgetItem) Point(java.awt.Point)

Aggregations

InventoryWidgetItemQuery (net.runelite.api.queries.InventoryWidgetItemQuery)7 WidgetItem (net.runelite.api.widgets.WidgetItem)7 Query (net.runelite.api.Query)6 Point (java.awt.Point)3 EquipmentItemQuery (net.runelite.api.queries.EquipmentItemQuery)3 Rectangle (java.awt.Rectangle)2 ArrayList (java.util.ArrayList)2 Varbits (net.runelite.api.Varbits)2 Tooltip (net.runelite.client.ui.overlay.tooltip.Tooltip)2 BufferedImage (java.awt.image.BufferedImage)1 Point (net.runelite.api.Point)1 TextComponent (net.runelite.client.ui.overlay.components.TextComponent)1