runelite-client: fix jewelery plugin npe when eqipment tab is not visable
This commit is contained in:
@@ -28,6 +28,8 @@ public enum WidgetInfo
|
|||||||
{
|
{
|
||||||
INVENTORY(WidgetID.INVENTORY_GROUP_ID, 0),
|
INVENTORY(WidgetID.INVENTORY_GROUP_ID, 0),
|
||||||
|
|
||||||
|
EQUIPMENT(WidgetID.EQUIPMENT_GROUP_ID, 0),
|
||||||
|
|
||||||
EQUIPMENT_HELMET(WidgetID.EQUIPMENT_GROUP_ID, WidgetID.Equipment.HELMET),
|
EQUIPMENT_HELMET(WidgetID.EQUIPMENT_GROUP_ID, WidgetID.Equipment.HELMET),
|
||||||
EQUIPMENT_CAPE(WidgetID.EQUIPMENT_GROUP_ID, WidgetID.Equipment.CAPE),
|
EQUIPMENT_CAPE(WidgetID.EQUIPMENT_GROUP_ID, WidgetID.Equipment.CAPE),
|
||||||
EQUIPMENT_AMULET(WidgetID.EQUIPMENT_GROUP_ID, WidgetID.Equipment.AMULET),
|
EQUIPMENT_AMULET(WidgetID.EQUIPMENT_GROUP_ID, WidgetID.Equipment.AMULET),
|
||||||
|
|||||||
@@ -81,34 +81,34 @@ class JewelryCountOverlay extends Overlay
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget[] equipment =
|
Widget equipment = client.getWidget(WidgetInfo.EQUIPMENT);
|
||||||
{
|
|
||||||
client.getWidget(WidgetInfo.EQUIPMENT_AMULET).getChild(1), client.getWidget(WidgetInfo.EQUIPMENT_RING).getChild(1),
|
|
||||||
client.getWidget(WidgetInfo.EQUIPMENT_GLOVES).getChild(1)
|
|
||||||
};
|
|
||||||
|
|
||||||
if (equipment == null)
|
if (equipment != null)
|
||||||
{
|
{
|
||||||
return null;
|
Widget[] equipmentSlots =
|
||||||
}
|
|
||||||
|
|
||||||
for (Widget widget : equipment)
|
|
||||||
{
|
|
||||||
JewelryCharges charges = JewelryCharges.getCharges(widget.getItemId());
|
|
||||||
|
|
||||||
if (charges == null || widget.isHidden())
|
|
||||||
{
|
{
|
||||||
continue;
|
client.getWidget(WidgetInfo.EQUIPMENT_AMULET).getChild(1), client.getWidget(WidgetInfo.EQUIPMENT_RING).getChild(1),
|
||||||
|
client.getWidget(WidgetInfo.EQUIPMENT_GLOVES).getChild(1)
|
||||||
|
};
|
||||||
|
|
||||||
|
for (Widget widget : equipmentSlots)
|
||||||
|
{
|
||||||
|
JewelryCharges charges = JewelryCharges.getCharges(widget.getItemId());
|
||||||
|
|
||||||
|
if (charges == null || widget.isHidden())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle widgetBounds = widget.getBounds();
|
||||||
|
|
||||||
|
//to match inventory text
|
||||||
|
widgetBounds.x -= 5;
|
||||||
|
widgetBounds.y -= 1;
|
||||||
|
|
||||||
|
renderWidgetText(graphics, widgetBounds, charges.getCharges(), Color.white);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle widgetBounds = widget.getBounds();
|
|
||||||
|
|
||||||
//to match inventory text
|
|
||||||
widgetBounds.x -= 5;
|
|
||||||
widgetBounds.y -= 1;
|
|
||||||
|
|
||||||
renderWidgetText(graphics, widgetBounds, charges.getCharges(), Color.white);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user