runelite-client: Call scripts with the correct number of arguments
This commit is contained in:
@@ -89,7 +89,7 @@ public class ChatboxPanelManager
|
||||
private void unsafeCloseInput()
|
||||
{
|
||||
client.runScript(
|
||||
ScriptID.RESET_CHATBOX_INPUT,
|
||||
ScriptID.MESSAGE_LAYER_CLOSE,
|
||||
0,
|
||||
1
|
||||
);
|
||||
@@ -101,7 +101,7 @@ public class ChatboxPanelManager
|
||||
|
||||
private void unsafeOpenInput(ChatboxInput input)
|
||||
{
|
||||
client.runScript(ScriptID.CLEAR_CHATBOX_PANEL);
|
||||
client.runScript(ScriptID.MESSAGE_LAYER_OPEN, 0);
|
||||
|
||||
eventBus.register(input);
|
||||
if (input instanceof KeyListener)
|
||||
|
||||
@@ -37,20 +37,6 @@ import net.runelite.client.callback.ClientThread;
|
||||
|
||||
public class BankSearch
|
||||
{
|
||||
// Widget indexes for searching
|
||||
private static final int INNER_CONTAINER_IDX = 2;
|
||||
private static final int SETTINGS_IDX = 4;
|
||||
private static final int ITEM_CONTAINER_IDX = 7;
|
||||
private static final int SCROLLBAR_IDX = 8;
|
||||
private static final int BOTTOM_BAR_IDX = 9;
|
||||
private static final int SEARCH_BUTTON_BACKGROUND_IDX = 15;
|
||||
private static final int TITLE_BAR_IDX = 16;
|
||||
private static final int ITEM_COUNT_IDX = 17;
|
||||
private static final int TAB_BAR_IDX = 18;
|
||||
private static final int INCINERATOR_IDX = 19;
|
||||
private static final int INCINERATOR_CONFIRM_IDX = 20;
|
||||
private static final int HIDDEN_WIDGET_IDX = 21;
|
||||
|
||||
private final Client client;
|
||||
private final ClientThread clientThread;
|
||||
|
||||
@@ -64,51 +50,38 @@ public class BankSearch
|
||||
this.clientThread = clientThread;
|
||||
}
|
||||
|
||||
public void search(InputType inputType, String search, Boolean closeInput)
|
||||
public void search(InputType inputType, String search, boolean closeInput)
|
||||
{
|
||||
clientThread.invoke(() ->
|
||||
{
|
||||
Widget bankContainer = client.getWidget(WidgetInfo.BANK_CONTAINER);
|
||||
Widget bankContainer = client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER);
|
||||
if (bankContainer == null || bankContainer.isHidden())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Object[] widgetIds = bankContainer.getOnLoadListener();
|
||||
Object[] scriptArgs = bankContainer.getOnInvTransmitListener();
|
||||
|
||||
// In case the widget ids array is incorrect, do not proceed
|
||||
if (widgetIds == null || widgetIds.length < 21)
|
||||
if (scriptArgs == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// This ensures that any chatbox input (e.g from search) will not remain visible when
|
||||
// selecting/changing tab
|
||||
if (closeInput)
|
||||
{
|
||||
client.runScript(ScriptID.RESET_CHATBOX_INPUT, 0, 0);
|
||||
client.runScript(ScriptID.MESSAGE_LAYER_CLOSE, 0, 0);
|
||||
}
|
||||
|
||||
client.setVar(VarClientInt.INPUT_TYPE, inputType.getType());
|
||||
client.setVar(VarClientStr.INPUT_TEXT, search);
|
||||
|
||||
client.runScript(ScriptID.BANK_LAYOUT,
|
||||
WidgetInfo.BANK_CONTAINER.getId(),
|
||||
widgetIds[INNER_CONTAINER_IDX],
|
||||
widgetIds[SETTINGS_IDX],
|
||||
widgetIds[ITEM_CONTAINER_IDX],
|
||||
widgetIds[SCROLLBAR_IDX],
|
||||
widgetIds[BOTTOM_BAR_IDX],
|
||||
widgetIds[TITLE_BAR_IDX],
|
||||
widgetIds[ITEM_COUNT_IDX],
|
||||
widgetIds[SEARCH_BUTTON_BACKGROUND_IDX],
|
||||
widgetIds[TAB_BAR_IDX],
|
||||
widgetIds[INCINERATOR_IDX],
|
||||
widgetIds[INCINERATOR_CONFIRM_IDX],
|
||||
widgetIds[HIDDEN_WIDGET_IDX]);
|
||||
client.runScript(scriptArgs);
|
||||
});
|
||||
}
|
||||
|
||||
public void reset(Boolean closeChat)
|
||||
public void reset(boolean closeChat)
|
||||
{
|
||||
search(InputType.NONE, "", closeChat);
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ public class TabInterface
|
||||
{
|
||||
bankSearch.reset(true);
|
||||
|
||||
clientThread.invokeLater(() -> client.runScript(ScriptID.RESET_CHATBOX_INPUT, 0, 0));
|
||||
clientThread.invokeLater(() -> client.runScript(ScriptID.MESSAGE_LAYER_CLOSE, 0, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -56,7 +56,7 @@ public class ChatboxPerformancePlugin extends Plugin
|
||||
{
|
||||
if (client.getGameState() == GameState.LOGGED_IN)
|
||||
{
|
||||
clientThread.invokeLater(() -> client.runScript(ScriptID.RESET_CHATBOX_INPUT));
|
||||
clientThread.invokeLater(() -> client.runScript(ScriptID.MESSAGE_LAYER_CLOSE, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class ChatboxPerformancePlugin extends Plugin
|
||||
{
|
||||
if (client.getGameState() == GameState.LOGGED_IN)
|
||||
{
|
||||
clientThread.invokeLater(() -> client.runScript(ScriptID.RESET_CHATBOX_INPUT));
|
||||
clientThread.invokeLater(() -> client.runScript(ScriptID.MESSAGE_LAYER_CLOSE, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user