statusbars: avoid looking up item status unless the widget is the inventory

This commit is contained in:
Adam
2019-01-25 11:01:44 -05:00
parent e97c5ba517
commit c3f9ba3daa

View File

@@ -184,43 +184,46 @@ class StatusBarsOverlay extends Overlay
final MenuEntry[] menu = client.getMenuEntries();
final int menuSize = menu.length;
final MenuEntry entry = menuSize > 0 ? menu[menuSize - 1] : null;
final Effect change = entry != null ? itemStatService.getItemStatChanges(entry.getIdentifier()) : null;
int prayerHealValue = 0;
int foodHealValue = 0;
if (change != null & entry.getParam1() == WidgetInfo.INVENTORY.getId())
if (entry != null && entry.getParam1() == WidgetInfo.INVENTORY.getId())
{
final StatsChanges statsChanges = change.calculate(client);
final Effect change = itemStatService.getItemStatChanges(entry.getIdentifier());
for (final StatChange c : statsChanges.getStatChanges())
if (change != null)
{
final String strVar = c.getTheoretical();
final StatsChanges statsChanges = change.calculate(client);
if (Strings.isNullOrEmpty(strVar))
for (final StatChange c : statsChanges.getStatChanges())
{
continue;
}
final String strVar = c.getTheoretical();
final Integer value = Ints.tryParse(strVar.startsWith("+") ? strVar.substring(1) : strVar);
if (Strings.isNullOrEmpty(strVar))
{
continue;
}
if (value == null)
{
continue;
}
final Integer value = Ints.tryParse(strVar.startsWith("+") ? strVar.substring(1) : strVar);
if (c.getStat().getName().equals(Skill.HITPOINTS.getName()))
{
foodHealValue = value;
}
if (value == null)
{
continue;
}
if (c.getStat().getName().equals(Skill.PRAYER.getName()))
{
prayerHealValue = value;
}
if (c.getStat().getName().equals(Skill.HITPOINTS.getName()))
{
foodHealValue = value;
}
if (foodHealValue != 0 && prayerHealValue != 0)
{
break;
if (c.getStat().getName().equals(Skill.PRAYER.getName()))
{
prayerHealValue = value;
}
if (foodHealValue != 0 && prayerHealValue != 0)
{
break;
}
}
}
}