queries: replace some isHidden checks with isSelfHidden

The parents are known to be not hidden in these cases
This commit is contained in:
Adam
2018-06-25 20:27:06 -04:00
parent e7574b4ff5
commit afa46b6538
4 changed files with 11 additions and 8 deletions

View File

@@ -61,15 +61,16 @@ public class BankItemQuery extends WidgetItemQuery
Widget[] children = bank.getDynamicChildren(); Widget[] children = bank.getDynamicChildren();
for (int i = 0; i < children.length; i++) for (int i = 0; i < children.length; i++)
{ {
if (children[i].getItemId() == ITEM_EMPTY || children[i].isHidden()) Widget child = children[i];
if (child.getItemId() == ITEM_EMPTY || child.isSelfHidden())
{ {
continue; continue;
} }
// set bounds to same size as default inventory // set bounds to same size as default inventory
Rectangle bounds = children[i].getBounds(); Rectangle bounds = child.getBounds();
bounds.setBounds(bounds.x - 1, bounds.y - 1, 32, 32); bounds.setBounds(bounds.x - 1, bounds.y - 1, 32, 32);
// Index is set to 0 because the widget's index does not correlate to the order in the bank // Index is set to 0 because the widget's index does not correlate to the order in the bank
widgetItems.add(new WidgetItem(children[i].getItemId(), children[i].getItemQuantity(), 0, bounds)); widgetItems.add(new WidgetItem(child.getItemId(), child.getItemQuantity(), 0, bounds));
} }
} }
return widgetItems; return widgetItems;

View File

@@ -89,7 +89,7 @@ public class EquipmentItemQuery extends WidgetItemQuery
Widget parentWidget = client.getWidget(slot); Widget parentWidget = client.getWidget(slot);
Widget itemWidget = parentWidget.getChild(1); Widget itemWidget = parentWidget.getChild(1);
// Check if background icon is hidden. if hidden, item is equipped. // Check if background icon is hidden. if hidden, item is equipped.
boolean equipped = parentWidget.getChild(2).isHidden(); boolean equipped = parentWidget.getChild(2).isSelfHidden();
// set bounds to same size as default inventory // set bounds to same size as default inventory
Rectangle bounds = itemWidget.getBounds(); Rectangle bounds = itemWidget.getBounds();
bounds.setBounds(bounds.x - 1, bounds.y - 1, 32, 32); bounds.setBounds(bounds.x - 1, bounds.y - 1, 32, 32);

View File

@@ -81,10 +81,11 @@ public class InventoryWidgetItemQuery extends WidgetItemQuery
Widget[] children = inventory.getDynamicChildren(); Widget[] children = inventory.getDynamicChildren();
for (int i = 0; i < children.length; i++) for (int i = 0; i < children.length; i++)
{ {
Widget child = children[i];
// set bounds to same size as default inventory // set bounds to same size as default inventory
Rectangle bounds = children[i].getBounds(); Rectangle bounds = child.getBounds();
bounds.setBounds(bounds.x - 1, bounds.y - 1, 32, 32); bounds.setBounds(bounds.x - 1, bounds.y - 1, 32, 32);
widgetItems.add(new WidgetItem(children[i].getItemId(), children[i].getItemQuantity(), i, bounds)); widgetItems.add(new WidgetItem(child.getItemId(), child.getItemQuantity(), i, bounds));
} }
break; break;
} }

View File

@@ -59,10 +59,11 @@ public class ShopItemQuery extends WidgetItemQuery
Widget[] children = shop.getDynamicChildren(); Widget[] children = shop.getDynamicChildren();
for (int i = 1; i < children.length; i++) for (int i = 1; i < children.length; i++)
{ {
Widget child = children[i];
// set bounds to same size as default inventory // set bounds to same size as default inventory
Rectangle bounds = children[i].getBounds(); Rectangle bounds = child.getBounds();
bounds.setBounds(bounds.x - 1, bounds.y - 1, 32, 32); bounds.setBounds(bounds.x - 1, bounds.y - 1, 32, 32);
widgetItems.add(new WidgetItem(children[i].getItemId(), children[i].getItemQuantity(), i - 1, bounds)); widgetItems.add(new WidgetItem(child.getItemId(), child.getItemQuantity(), i - 1, bounds));
} }
} }
return widgetItems; return widgetItems;