statusbars: avoid looking up item status unless the widget is the inventory
This commit is contained in:
@@ -184,43 +184,46 @@ class StatusBarsOverlay extends Overlay
|
|||||||
final MenuEntry[] menu = client.getMenuEntries();
|
final MenuEntry[] menu = client.getMenuEntries();
|
||||||
final int menuSize = menu.length;
|
final int menuSize = menu.length;
|
||||||
final MenuEntry entry = menuSize > 0 ? menu[menuSize - 1] : null;
|
final MenuEntry entry = menuSize > 0 ? menu[menuSize - 1] : null;
|
||||||
final Effect change = entry != null ? itemStatService.getItemStatChanges(entry.getIdentifier()) : null;
|
|
||||||
int prayerHealValue = 0;
|
int prayerHealValue = 0;
|
||||||
int foodHealValue = 0;
|
int foodHealValue = 0;
|
||||||
|
if (entry != null && entry.getParam1() == WidgetInfo.INVENTORY.getId())
|
||||||
if (change != 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)
|
final Integer value = Ints.tryParse(strVar.startsWith("+") ? strVar.substring(1) : strVar);
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c.getStat().getName().equals(Skill.HITPOINTS.getName()))
|
if (value == null)
|
||||||
{
|
{
|
||||||
foodHealValue = value;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c.getStat().getName().equals(Skill.PRAYER.getName()))
|
if (c.getStat().getName().equals(Skill.HITPOINTS.getName()))
|
||||||
{
|
{
|
||||||
prayerHealValue = value;
|
foodHealValue = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foodHealValue != 0 && prayerHealValue != 0)
|
if (c.getStat().getName().equals(Skill.PRAYER.getName()))
|
||||||
{
|
{
|
||||||
break;
|
prayerHealValue = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foodHealValue != 0 && prayerHealValue != 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user