runelite-client: avoid Widget::getDynamicChildren where trivial

This commit is contained in:
Max Weber
2020-07-11 01:39:58 -06:00
committed by Adam
parent ed5868b526
commit 6c6238d60f
5 changed files with 11 additions and 15 deletions

View File

@@ -363,8 +363,8 @@ public class BankPlugin extends Plugin
return;
}
final Widget[] children = titleContainer.getDynamicChildren();
if (children == null || children.length < 2)
final Widget title = titleContainer.getChild(1);
if (title == null)
{
return;
}
@@ -377,7 +377,6 @@ public class BankPlugin extends Plugin
final String titleText = createValueText(prices);
final Widget title = children[1];
title.setText(SEED_VAULT_TITLE + titleText);
}

View File

@@ -1113,7 +1113,7 @@ public class TabInterface
incinerator.setOriginalWidth(INCINERATOR_WIDTH);
incinerator.setOriginalY(INCINERATOR_HEIGHT);
Widget child = incinerator.getDynamicChildren()[0];
Widget child = incinerator.getChild(0);
child.setOriginalHeight(INCINERATOR_HEIGHT);
child.setOriginalWidth(INCINERATOR_WIDTH);
child.setWidthMode(WidgetSizeMode.ABSOLUTE);

View File

@@ -293,28 +293,25 @@ public class ExaminePlugin extends Plugin
|| WidgetID.PLAYER_TRADE_SCREEN_GROUP_ID == widgetGroup
|| WidgetID.PLAYER_TRADE_INVENTORY_GROUP_ID == widgetGroup)
{
Widget[] children = widget.getDynamicChildren();
if (actionParam < children.length)
Widget widgetItem = widget.getChild(actionParam);
if (widgetItem != null)
{
Widget widgetItem = children[actionParam];
return new int[]{widgetItem.getItemQuantity(), widgetItem.getItemId()};
}
}
else if (WidgetInfo.SHOP_ITEMS_CONTAINER.getGroupId() == widgetGroup)
{
Widget[] children = widget.getDynamicChildren();
if (actionParam < children.length)
Widget widgetItem = widget.getChild(actionParam);
if (widgetItem != null)
{
Widget widgetItem = children[actionParam];
return new int[]{1, widgetItem.getItemId()};
}
}
else if (WidgetID.SEED_VAULT_GROUP_ID == widgetGroup)
{
Widget[] children = client.getWidget(SEED_VAULT_ITEM_CONTAINER).getDynamicChildren();
if (actionParam < children.length)
Widget widgetItem = client.getWidget(SEED_VAULT_ITEM_CONTAINER).getChild(actionParam);
if (widgetItem != null)
{
Widget widgetItem = children[actionParam];
return new int[]{widgetItem.getItemQuantity(), widgetItem.getItemId()};
}
}

View File

@@ -99,7 +99,7 @@ public class XpDropPlugin extends Plugin
if (config.hideSkillIcons())
{
// keep only text
xpdrop.setChildren(Arrays.copyOf(children, 1));
Arrays.fill(children, 1, children.length, null);
}
PrayerType prayer = getActivePrayerType();

View File

@@ -618,7 +618,7 @@ public class GrandExchangePlugin extends Plugin
case WidgetID.GRAND_EXCHANGE_GROUP_ID:
Widget grandExchangeOffer = client.getWidget(WidgetInfo.GRAND_EXCHANGE_OFFER_CONTAINER);
grandExchangeText = client.getWidget(WidgetInfo.GRAND_EXCHANGE_OFFER_TEXT);
grandExchangeItem = grandExchangeOffer.getDynamicChildren()[OFFER_CONTAINER_ITEM];
grandExchangeItem = grandExchangeOffer.getChild(OFFER_CONTAINER_ITEM);
break;
// Grand exchange was closed (if it was open before).
case WidgetID.INVENTORY_GROUP_ID: