@Override public void poll() { for (GroundItem groundItem : ctx.groundItems.select().select(priceFilter).within(20)) { if (groundItem.valid()) { final int price = GeItem.price(groundItem.id()); priceMap.put(groundItem.id(), price); } } Condition.sleep(600); }
@Override public void repaint(Graphics graphics) { if (show) { final FontMetrics fm = graphics.getFontMetrics(); graphics.setFont(calibri); for (GroundItem groundItem : ctx.groundItems.select().select(displayFilter)) { graphics.setColor(Color.BLACK); final Point center = groundItem.centerPoint(); final String displayString = groundItem.name() + " x" + groundItem.stackSize() + " - $" + format.format((priceMap.get(groundItem.id()) * groundItem.stackSize())); final int width = fm.stringWidth(displayString); final int height = fm.getHeight(); graphics.fillRoundRect( center.x - (width / 2), center.y + (height / 2), width + 4, height + 5, 10, 10); graphics.setColor(Color.WHITE); graphics.drawString( displayString, center.x - (width / 2) + 2, center.y + (height / 2) + height); } } }
@Override public boolean accept(GroundItem groundItem) { return priceMap.containsKey(groundItem.id()) && groundItem.inViewport(); }
@Override public boolean accept(GroundItem groundItem) { return !priceMap.containsKey(groundItem.id()); }