add equipment tab jewelry count
add equipment tab jewelry count add equipment tab jewelry count add equipment tab jewelry count add equipment tab jewelry count
This commit is contained in:
@@ -28,6 +28,7 @@ class WidgetID
|
|||||||
{
|
{
|
||||||
static final int BANK_GROUP_ID = 12;
|
static final int BANK_GROUP_ID = 12;
|
||||||
static final int INVENTORY_GROUP_ID = 149;
|
static final int INVENTORY_GROUP_ID = 149;
|
||||||
|
static final int EQUIPMENT_GROUP_ID = 387;
|
||||||
static final int PESTRCONTROL_GROUP_ID = 408;
|
static final int PESTRCONTROL_GROUP_ID = 408;
|
||||||
static final int CLAN_CHAT_GROUP_ID = 7;
|
static final int CLAN_CHAT_GROUP_ID = 7;
|
||||||
static final int MINIMAP_GROUP_ID = 160;
|
static final int MINIMAP_GROUP_ID = 160;
|
||||||
@@ -66,6 +67,21 @@ class WidgetID
|
|||||||
static final int ITEM_CONTAINER = 12;
|
static final int ITEM_CONTAINER = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static class Equipment
|
||||||
|
{
|
||||||
|
static final int HELMET = 6;
|
||||||
|
static final int CAPE = 7;
|
||||||
|
static final int AMULET = 8;
|
||||||
|
static final int WEAPON = 9;
|
||||||
|
static final int BODY = 10;
|
||||||
|
static final int SHIELD = 11;
|
||||||
|
static final int LEGS = 12;
|
||||||
|
static final int GLOVES = 13;
|
||||||
|
static final int BOOTS = 14;
|
||||||
|
static final int RING = 15;
|
||||||
|
static final int AMMO = 16;
|
||||||
|
}
|
||||||
|
|
||||||
static class Minimap
|
static class Minimap
|
||||||
{
|
{
|
||||||
static final int XP_ORB = 1;
|
static final int XP_ORB = 1;
|
||||||
|
|||||||
@@ -28,6 +28,18 @@ public enum WidgetInfo
|
|||||||
{
|
{
|
||||||
INVENTORY(WidgetID.INVENTORY_GROUP_ID, 0),
|
INVENTORY(WidgetID.INVENTORY_GROUP_ID, 0),
|
||||||
|
|
||||||
|
EQUIPMENT_HELMET(WidgetID.EQUIPMENT_GROUP_ID, WidgetID.Equipment.HELMET),
|
||||||
|
EQUIPMENT_CAPE(WidgetID.EQUIPMENT_GROUP_ID, WidgetID.Equipment.CAPE),
|
||||||
|
EQUIPMENT_AMULET(WidgetID.EQUIPMENT_GROUP_ID, WidgetID.Equipment.AMULET),
|
||||||
|
EQUIPMENT_WEAPON(WidgetID.EQUIPMENT_GROUP_ID, WidgetID.Equipment.WEAPON),
|
||||||
|
EQUIPMENT_BODY(WidgetID.EQUIPMENT_GROUP_ID, WidgetID.Equipment.BODY),
|
||||||
|
EQUIPMENT_SHIELD(WidgetID.EQUIPMENT_GROUP_ID, WidgetID.Equipment.SHIELD),
|
||||||
|
EQUIPMENT_LEGS(WidgetID.EQUIPMENT_GROUP_ID, WidgetID.Equipment.LEGS),
|
||||||
|
EQUIPMENT_GLOVES(WidgetID.EQUIPMENT_GROUP_ID, WidgetID.Equipment.GLOVES),
|
||||||
|
EQUIPMENT_BOOTS(WidgetID.EQUIPMENT_GROUP_ID, WidgetID.Equipment.BOOTS),
|
||||||
|
EQUIPMENT_RING(WidgetID.EQUIPMENT_GROUP_ID, WidgetID.Equipment.RING),
|
||||||
|
EQUIPMENT_AMMO(WidgetID.EQUIPMENT_GROUP_ID, WidgetID.Equipment.AMMO),
|
||||||
|
|
||||||
PESTCONTROL_PURPLE_SHIELD(WidgetID.PESTRCONTROL_GROUP_ID, WidgetID.PestControl.PURPLE_SHIELD),
|
PESTCONTROL_PURPLE_SHIELD(WidgetID.PESTRCONTROL_GROUP_ID, WidgetID.PestControl.PURPLE_SHIELD),
|
||||||
PESTCONTROL_BLUE_SHIELD(WidgetID.PESTRCONTROL_GROUP_ID, WidgetID.PestControl.BLUE_SHIELD),
|
PESTCONTROL_BLUE_SHIELD(WidgetID.PESTRCONTROL_GROUP_ID, WidgetID.PestControl.BLUE_SHIELD),
|
||||||
PESTCONTROL_YELLOW_SHIELD(WidgetID.PESTRCONTROL_GROUP_ID, WidgetID.PestControl.YELLOW_SHIELD),
|
PESTCONTROL_YELLOW_SHIELD(WidgetID.PESTRCONTROL_GROUP_ID, WidgetID.PestControl.YELLOW_SHIELD),
|
||||||
|
|||||||
@@ -25,6 +25,8 @@
|
|||||||
package net.runelite.client.plugins.jewelrycount;
|
package net.runelite.client.plugins.jewelrycount;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
import net.runelite.api.widgets.Widget;
|
import net.runelite.api.widgets.Widget;
|
||||||
@@ -58,36 +60,74 @@ class JewelryCountOverlay extends Overlay
|
|||||||
|
|
||||||
Widget inventory = client.getWidget(WidgetInfo.INVENTORY);
|
Widget inventory = client.getWidget(WidgetInfo.INVENTORY);
|
||||||
|
|
||||||
if (inventory == null || inventory.isHidden())
|
if (inventory == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (WidgetItem item : inventory.getWidgetItems())
|
if (!inventory.isHidden())
|
||||||
{
|
{
|
||||||
JewelryCharges charges = JewelryCharges.getCharges(item.getId());
|
for (WidgetItem item : inventory.getWidgetItems())
|
||||||
|
{
|
||||||
|
JewelryCharges charges = JewelryCharges.getCharges(item.getId());
|
||||||
|
|
||||||
if (charges == null)
|
if (charges == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
renderWidgetText(graphics, item.getCanvasBounds(), charges.getCharges(), Color.white);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget[] equipment =
|
||||||
|
{
|
||||||
|
client.getWidget(WidgetInfo.EQUIPMENT_AMULET).getChild(1), client.getWidget(WidgetInfo.EQUIPMENT_RING).getChild(1)
|
||||||
|
};
|
||||||
|
|
||||||
|
if (equipment == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Widget widget : equipment)
|
||||||
|
{
|
||||||
|
JewelryCharges charges = JewelryCharges.getCharges(widget.getItemId());
|
||||||
|
|
||||||
|
if (charges == null || widget.isHidden())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle slotBounds = item.getCanvasBounds();
|
Rectangle widgetBounds = widget.getBounds();
|
||||||
FontMetrics fm = graphics.getFontMetrics();
|
|
||||||
String jewelryCharge = Integer.toString(charges.getCharges());
|
|
||||||
|
|
||||||
int x = (int) (slotBounds.getX() + slotBounds.getWidth()) - fm.stringWidth(jewelryCharge);
|
//to match inventory text
|
||||||
int y = (int) (slotBounds.getY() + fm.getHeight());
|
widgetBounds.x -= -5;
|
||||||
|
widgetBounds.y -= -1;
|
||||||
|
|
||||||
//text shadow
|
renderWidgetText(graphics, widgetBounds, charges.getCharges(), Color.white);
|
||||||
graphics.setColor(Color.black);
|
|
||||||
graphics.drawString(jewelryCharge, x + 1, y + 1);
|
|
||||||
|
|
||||||
graphics.setColor(Color.white);
|
|
||||||
graphics.drawString(jewelryCharge, x, y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void renderWidgetText(Graphics2D graphics, Rectangle bounds, int charges, Color color)
|
||||||
|
{
|
||||||
|
String text = charges + "";
|
||||||
|
FontMetrics fm = graphics.getFontMetrics();
|
||||||
|
Rectangle2D textBounds = fm.getStringBounds(text, graphics);
|
||||||
|
|
||||||
|
int textX = (int) (bounds.getX() + bounds.getWidth() - textBounds.getWidth());
|
||||||
|
int textY = (int) (bounds.getY() + (textBounds.getHeight()));
|
||||||
|
|
||||||
|
//text shadow
|
||||||
|
graphics.setColor(Color.BLACK);
|
||||||
|
graphics.drawString(text, textX + 1, textY + 1);
|
||||||
|
|
||||||
|
graphics.setColor(color);
|
||||||
|
graphics.drawString(text, textX, textY);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user