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)
This commit is contained in:
Adam
2020-07-23 23:00:36 -04:00
parent 76b57c124e
commit 340530daf6
3 changed files with 26 additions and 13 deletions

View File

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

View File

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

View File

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