From 340530daf6941549f5ec83b5e47e17326141a39a Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 23 Jul 2020 23:00:36 -0400 Subject: [PATCH] tagtabs: show tab separators in tag tabs This changes tag tabs to actually put the bank in search mode, still without providing any search input, so that the bank tab builder will draw tab separators (both the separator line and tab text label) --- .../main/java/net/runelite/api/ScriptID.java | 3 +++ .../plugins/banktags/BankTagsPlugin.java | 17 ++++++++++++++--- .../src/main/scripts/BankSearchFilter.rs2asm | 19 +++++++++---------- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/ScriptID.java b/runelite-api/src/main/java/net/runelite/api/ScriptID.java index c0c8322d04..2ad014aacd 100644 --- a/runelite-api/src/main/java/net/runelite/api/ScriptID.java +++ b/runelite-api/src/main/java/net/runelite/api/ScriptID.java @@ -296,4 +296,7 @@ public final class ScriptID @ScriptArguments(integer = 19) public static final int BANKMAIN_FINISHBUILDING = 505; + + @ScriptArguments() + public static final int BANKMAIN_SEARCHING = 514; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java index 7af659873e..8c527a2b4c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java @@ -313,9 +313,9 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener final int itemId = intStack[intStackSize - 1]; final String searchfilter = stringStack[stringStackSize - 1]; - // This event fires regardless of the bank being in search mode. If we have a current - // tab set then the bank should be not in search mode (and the filter empty). Otherwise - // the filter is either empty for no search or contains the search filter. + // This event only fires when the bank is in search mode. It will fire even if there is no search + // input. We prevent having a tag tab open while also performing a normal search, so if a tag tab + // is active here it must mean we have placed the bank into search mode. See onScriptPostFired(). TagTab activeTab = tabInterface.getActiveTab(); String search = activeTab != null ? TAG_SEARCH + activeTab.getTag() : searchfilter; @@ -499,6 +499,17 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener @Subscribe public void onScriptPostFired(ScriptPostFired event) { + if (event.getScriptId() == ScriptID.BANKMAIN_SEARCHING) + { + // The return value of bankmain_searching is on the stack. If we have a tag tab active + // make it return true to put the bank in a searching state. + if (tabInterface.getActiveTab() != null || tabInterface.isTagTabActive()) + { + client.getIntStack()[client.getIntStackSize() - 1] = 1; // true + } + return; + } + if (event.getScriptId() != ScriptID.BANKMAIN_BUILD || !config.removeSeparators()) { return; diff --git a/runelite-client/src/main/scripts/BankSearchFilter.rs2asm b/runelite-client/src/main/scripts/BankSearchFilter.rs2asm index 506aa4530b..0555737bdb 100644 --- a/runelite-client/src/main/scripts/BankSearchFilter.rs2asm +++ b/runelite-client/src/main/scripts/BankSearchFilter.rs2asm @@ -10,16 +10,6 @@ invoke 514 iconst 1 if_icmpeq LABEL8 - - iconst 1 ; return value - default to true to match anything - iload 0 ; load item id - sconst "" ; we are not searching, so there is no search string - sconst "bankSearchFilter" ; push event name - runelite_callback ; invoke callback - pop_int ; pop item id - pop_string ; pop search string - return ; return rv - jump LABEL34 LABEL8: get_varc_string 359 ; Skip truncating of varcstr 22 by not calling 280 @@ -29,6 +19,15 @@ LABEL8: string_length iconst 0 if_icmpgt LABEL15 + ; this is a bank search with no input string. the bank tag plugin uses it to perform its tab searches. + iconst 1 ; return value - default to true to match anything + iload 0 ; load item id + sconst "" ; we are not searching, so there is no search string + sconst "bankSearchFilter" ; push event name + runelite_callback ; invoke callback + pop_int ; pop item id + pop_string ; pop search string + return ; return rv jump LABEL34 LABEL15: iload 0