From 4d63ce73346915b0165730829c1be0efd55dd9b7 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 16 Sep 2019 14:08:40 -0400 Subject: [PATCH] bank tags: use item name string indexof from script This allows additional plugins to use the bankSearchFilter event to selectively add or remove matches, as the bank tag plugin is no longer performing the string contains check. --- .../plugins/banktags/BankTagsPlugin.java | 9 ++------ .../src/main/scripts/BankSearchFilter.rs2asm | 21 ++++++++----------- 2 files changed, 11 insertions(+), 19 deletions(-) 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 6a3a7f3416..ea8f6b2792 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 @@ -169,10 +169,6 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis switch (eventName) { - case "bankTagsActive": - // tell the script the bank tag plugin is active - intStack[intStackSize - 1] = 1; - break; case "setSearchBankInputText": stringStack[stringStackSize - 1] = SEARCH_BANK_INPUT_TEXT; break; @@ -184,7 +180,6 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis } case "bankSearchFilter": int itemId = intStack[intStackSize - 1]; - String itemName = stringStack[stringStackSize - 2]; String search = stringStack[stringStackSize - 1]; boolean tagSearch = search.startsWith(TAG_SEARCH); @@ -198,9 +193,9 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis // return true intStack[intStackSize - 2] = 1; } - else if (!tagSearch) + else if (tagSearch) { - intStack[intStackSize - 2] = itemName.contains(search) ? 1 : 0; + intStack[intStackSize - 2] = 0; } break; case "getSearchingTagTab": diff --git a/runelite-client/src/main/scripts/BankSearchFilter.rs2asm b/runelite-client/src/main/scripts/BankSearchFilter.rs2asm index fd3f415b5d..5f9db325af 100644 --- a/runelite-client/src/main/scripts/BankSearchFilter.rs2asm +++ b/runelite-client/src/main/scripts/BankSearchFilter.rs2asm @@ -1,7 +1,7 @@ .id 279 .int_stack_count 1 .string_stack_count 0 -.int_var_count 1 +.int_var_count 2 ; +1 for storage of search filter result .string_var_count 2 sconst "" sstore 0 @@ -30,16 +30,7 @@ LABEL19: oc_name lowercase sstore 0 -LABEL1337:; check if the bank tags plugin is active - iconst 1 ; true - iconst 0 ; load active boolean - sconst "bankTagsActive" ; push event name - runelite_callback ; invoke callback - if_icmpeq LABEL1338 ; if the plugin is active then jump to the label that decides if the - ; item should be shown - jump LABEL23 ; if the plugin is not active then jump to the normal label -LABEL1338:; let the bank tag plugin decide if the item should be shown - iconst 0 ; load return value + iconst -1 ; load return value iload 0 ; load item id sload 0 ; load item name sload 1 ; load search string @@ -48,7 +39,13 @@ LABEL1338:; let the bank tag plugin decide if the item should be shown pop_int ; pop item id pop_string ; pop search string pop_string ; pop item name - return ; return value + istore 1 ; store return value for the below comparisons + iload 1 + iconst 0 + if_icmpeq LABEL32 ; return 0 + iload 1 + iconst 1 + if_icmpeq LABEL30 ; return 1 LABEL23: sload 0 sload 1