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.
This commit is contained in:
Adam
2019-09-16 14:08:40 -04:00
committed by Adam
parent 7172e77f98
commit 4d63ce7334
2 changed files with 11 additions and 19 deletions

View File

@@ -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":

View File

@@ -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