diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsConfig.java index 61b734c836..c1e7f9ffde 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsConfig.java @@ -53,6 +53,28 @@ public interface BankTagsConfig extends Config return true; } + @ConfigItem( + keyName = "removeSeparators", + name = "Remove tab separators in Tag Tabs", + description = "Removes tab separators and corrects item layouts in Tag Tabs to mimic a regular tab", + position = 3 + ) + default boolean removeSeparators() + { + return true; + } + + @ConfigItem( + keyName = "hidePlaceholders", + name = "Hide placeholders", + description = "Hide placeholders in tag tabs or tag search.", + position = 4 + ) + default boolean hidePlaceholders() + { + return false; + } + @ConfigItem( keyName = "position", name = "", 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..4dc2a3c1fa 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 @@ -2,6 +2,7 @@ * Copyright (c) 2018, Adam * Copyright (c) 2018, Ron Young * Copyright (c) 2018, Tomas Slusny + * Copyright (c) 2018, Lucas * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -130,6 +131,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis private SpriteManager spriteManager; private boolean shiftPressed = false; + private int nextRowIndex = 0; @Provides BankTagsConfig getConfig(ConfigManager configManager) @@ -157,6 +159,13 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis shiftPressed = false; } + private boolean isSearching() + { + return client.getVar(VarClientInt.INPUT_TYPE) == InputType.SEARCH.getType() + || (client.getVar(VarClientInt.INPUT_TYPE) <= 0 + && client.getVar(VarClientStr.INPUT_TEXT) != null && client.getVar(VarClientStr.INPUT_TEXT).length() > 0); + } + @Subscribe public void onScriptCallbackEvent(ScriptCallbackEvent event) { @@ -195,8 +204,19 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis if (tagManager.findTag(itemId, search)) { - // return true - intStack[intStackSize - 2] = 1; + if (!config.hidePlaceholders()) + { + // return true + intStack[intStackSize - 2] = 1; + } + + // not a placeholder + else if (itemManager.getItemComposition(itemId).getPlaceholderTemplateId() == -1) + { + // return true + intStack[intStackSize - 2] = 1; + } + break; } else if (!tagSearch) { @@ -207,6 +227,61 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis intStack[intStackSize - 1] = tabInterface.isActive() ? 1 : 0; break; } + + if (!config.removeSeparators() || !isSearching() || !tabInterface.isActive()) + { + return; + } + + switch (eventName) + { + case "lineSpace": + // prevent Y value being incremented to account for line separators + intStack[intStackSize - 1] = 0; + break; + case "tabTextSpace": + // prevent Y value being incremented to account for "Tab x" text + intStack[intStackSize - 1] = 0; + break; + case "hideLine": + // hide the widget for the line separator + intStack[intStackSize - 1] = 1; + break; + case "hideTabText": + // hide the widget for the "Tab x" text + intStack[intStackSize - 1] = 1; + break; + case "rowIndex": + // remember the next index in the row so we can start the next tab's items there + nextRowIndex = intStack[intStackSize - 1]; + break; + case "rowIndexInit": + // set the index to our remembered value instead of 0 + intStack[intStackSize - 1] = nextRowIndex; + break; + case "bankLayoutInit": + // reset the row index if the bank is rebuilt + nextRowIndex = 0; + break; + case "newBankRow": + // if we haven't filled a row when the current tab is finished building, + // adjust the y offset to continue the next tab on the same row + if (nextRowIndex != 0) + { + intStack[intStackSize - 2] = intStack[intStackSize - 2] - 32; + } + // if we have filled the row, adjust the y offset to maintain appropriate row spacing + else + { + intStack[intStackSize - 2] = intStack[intStackSize - 2] + 4; + } + break; + case "addLastRow": + // after all tabs are finished building, add an extra row of space + // this ensures the scrollbar is set to the correct height + intStack[intStackSize - 1] = intStack[intStackSize - 1] + 32; + break; + } } @Subscribe diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java index e0b1af23eb..566c96f7d9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java @@ -642,6 +642,15 @@ public class TabInterface Widget draggedOn = client.getDraggedOnWidget(); Widget draggedWidget = client.getDraggedWidget(); + // round-about way to prevent drag reordering when in a tag tab, now that it looks like a normal tab + // returning early from drag release and nulling out the drag release listener have no effect, + // probably a better way to do this though + if (draggedWidget.getId() == WidgetInfo.BANK_ITEM_CONTAINER.getId() && isActive() + && config.removeSeparators()) + { + client.setDraggedOnWidget(null); + } + if (!isDragging || draggedOn == null) { return; diff --git a/runelite-client/src/main/scripts/BankBuildTab.hash b/runelite-client/src/main/scripts/BankBuildTab.hash new file mode 100644 index 0000000000..430b55f587 --- /dev/null +++ b/runelite-client/src/main/scripts/BankBuildTab.hash @@ -0,0 +1 @@ +57892EA7C7677AF80D1DA094F34C8A8738F2F4E5DDA2E861680F7D598664B216 \ No newline at end of file diff --git a/runelite-client/src/main/scripts/BankBuildTab.rs2asm b/runelite-client/src/main/scripts/BankBuildTab.rs2asm new file mode 100644 index 0000000000..972c1cb457 --- /dev/null +++ b/runelite-client/src/main/scripts/BankBuildTab.rs2asm @@ -0,0 +1,238 @@ +.id 509 +.int_stack_count 12 +.string_stack_count 0 +.int_var_count 18 +.string_var_count 0 + iconst 0 + istore 12 + iload 11 + iconst 0 + if_icmpeq LABEL6 + jump LABEL19 +LABEL6: + iload 2 + iconst 0 + if_icmpgt LABEL10 + jump LABEL19 +LABEL10: + invoke 514 + iconst 1 + if_icmpeq LABEL14 + jump LABEL19 +LABEL14: + iload 8 + iconst 15 + sconst "tabTextSpace" ; + runelite_callback ; + add + istore 12 + jump LABEL21 +LABEL19: + iload 8 + istore 12 +LABEL21: + iconst -1 + istore 13 + iconst 0 + istore 14 + iconst 0 + istore 15 + iconst 0 + sconst "rowIndexInit" ; + runelite_callback ; + istore 16 + iconst 0 + istore 17 +LABEL31: + iload 0 + iload 1 + if_icmplt LABEL35 + jump LABEL107 +LABEL35: + iload 3 + iload 0 + cc_find + iconst 1 + if_icmpeq LABEL41 + jump LABEL102 +LABEL41: + iconst 95 + iload 0 + inv_getobj + istore 13 + iload 13 + invoke 279 + iconst 1 + if_icmpeq LABEL50 + jump LABEL102 +LABEL50: + iconst 0 + cc_sethide + iload 13 + iconst 95 + iload 0 + inv_getnum + iload 3 + iload 4 + iload 5 + iload 6 + iload 7 + invoke 278 + iload 15 + iconst 1 + add + istore 15 + iload 12 + iload 17 + iconst 36 + multiply + add + istore 14 + iconst 51 + iload 16 + iconst 36 + iload 9 + add + multiply + add + iload 14 + iconst 0 + iconst 0 + cc_setposition + iload 14 + iconst 32 + add + istore 14 + iload 16 + iload 10 + if_icmplt LABEL91 + jump LABEL96 +LABEL91: + iload 16 + iconst 1 + add + sconst "rowIndex" ; + runelite_callback ; + istore 16 + jump LABEL102 +LABEL96: + iconst 0 + iload 17 + iconst 1 + add + istore 17 + sconst "rowIndex" ; + runelite_callback ; + istore 16 +LABEL102: + iload 0 + iconst 1 + add + istore 0 + jump LABEL31 +LABEL107: + iload 14 + iconst 0 + if_icmple LABEL111 + jump LABEL114 +LABEL111: + iload 8 + iload 15 + return +LABEL114: + iload 11 + iconst 0 + if_icmpeq LABEL118 + jump LABEL189 +LABEL118: + iload 16 + iconst 0 + if_icmpgt LABEL122 + jump LABEL166 +LABEL122: + iload 3 + iconst 816 + iconst 9 + iconst 2 + multiply + add + iload 2 + add + cc_find + iconst 1 + if_icmpeq LABEL134 + jump LABEL166 +LABEL134: + iconst 0 + sconst "hideTabText" ; + runelite_callback ; + cc_sethide + iconst 51 + iload 16 + iconst 36 + iload 9 + add + multiply + add + iload 14 + iconst 32 + sub + iconst 0 + iconst 0 + cc_setposition + iconst 8 + iload 16 + sub + istore 16 + iload 16 + iconst 36 + multiply + iload 16 + iconst 1 + sub + iload 9 + multiply + add + iconst 32 + iconst 0 + iconst 0 + cc_setsize +LABEL166: + iload 12 + iload 8 + if_icmpgt LABEL170 + jump LABEL189 +LABEL170: + iload 3 + iconst 816 + iconst 9 + add + iload 2 + add + iconst 1 + sub + cc_find + iconst 1 + if_icmpeq LABEL182 + jump LABEL189 +LABEL182: + iconst 51 + iload 8 + iconst 0 + iconst 0 + cc_setposition + iconst 0 + sconst "hideTabText" ; + runelite_callback ; + cc_sethide +LABEL189: + iload 14 + iload 2 ; + sconst "newBankRow" ; + runelite_callback ; + pop_int ; + iload 15 + return + iconst 0 + iconst 0 + return diff --git a/runelite-client/src/main/scripts/BankLayoutTabSeparator.hash b/runelite-client/src/main/scripts/BankLayoutTabSeparator.hash new file mode 100644 index 0000000000..aaf9322bfa --- /dev/null +++ b/runelite-client/src/main/scripts/BankLayoutTabSeparator.hash @@ -0,0 +1 @@ +F7482938547BB43B14BCE44F35FC7555EBA9EF3A9D2E4AAEA916DF2855387F07 \ No newline at end of file diff --git a/runelite-client/src/main/scripts/BankLayoutTabSeparator.rs2asm b/runelite-client/src/main/scripts/BankLayoutTabSeparator.rs2asm new file mode 100644 index 0000000000..4dc759c716 --- /dev/null +++ b/runelite-client/src/main/scripts/BankLayoutTabSeparator.rs2asm @@ -0,0 +1,36 @@ +.id 510 +.int_stack_count 3 +.string_stack_count 0 +.int_var_count 3 +.string_var_count 0 + iload 1 + iconst 816 + iload 0 + add + iconst 1 + sub + cc_find + iconst 1 + if_icmpeq LABEL10 + jump LABEL19 +LABEL10: + iconst 51 + iload 2 + iconst 5 + add + iconst 0 + iconst 0 + cc_setposition + iconst 0 + sconst "hideLine" ; + runelite_callback ; + cc_sethide +LABEL19: + iload 2 + iconst 12 + sconst "lineSpace" ; + runelite_callback ; + add + return + iconst 0 + return diff --git a/runelite-client/src/main/scripts/BankSearchLayout.rs2asm b/runelite-client/src/main/scripts/BankSearchLayout.rs2asm index c5e48d23e5..f04b85c687 100644 --- a/runelite-client/src/main/scripts/BankSearchLayout.rs2asm +++ b/runelite-client/src/main/scripts/BankSearchLayout.rs2asm @@ -3,6 +3,8 @@ .string_stack_count 0 .int_var_count 36 .string_var_count 1 + sconst "bankLayoutInit" ; + runelite_callback ; get_varbit 5102 iconst 1 if_icmpeq LABEL4 @@ -10,12 +12,12 @@ LABEL4: iconst 0 iload 10 - if_sethide + if_sethide jump LABEL13 LABEL8: iconst 1 iload 10 - if_sethide + if_sethide iload 12 invoke 41 LABEL13: @@ -31,10 +33,10 @@ LABEL19: LABEL21: iload 17 iload 15 - if_sethide + if_sethide iload 17 iload 16 - if_sethide + if_sethide get_varbit 8352 iconst 1 if_icmpeq LABEL31 @@ -49,22 +51,22 @@ LABEL34: LABEL36: iload 17 iload 13 - if_sethide + if_sethide iload 17 iload 14 - if_sethide + if_sethide iconst 441 iconst 0 iconst 0 iconst 0 iload 15 - if_setposition + if_setposition iconst 444 iconst 7 iconst 0 iconst 0 iload 16 - if_setposition + if_setposition get_varbit 8352 iconst 1 if_icmpeq LABEL58 @@ -76,27 +78,27 @@ LABEL58: jump LABEL85 LABEL62: iload 13 - if_getx + if_getx iload 13 - if_gety + if_gety iconst 0 iconst 0 iload 15 - if_setposition + if_setposition iload 14 - if_getx + if_getx iload 14 - if_gety + if_gety iconst 0 iconst 0 iload 16 - if_setposition + if_setposition iconst 37 iconst 37 iconst 1 iconst 0 iload 5 - if_setsize + if_setsize jump LABEL121 LABEL85: get_varbit 8352 @@ -114,7 +116,7 @@ LABEL93: iconst 1 iconst 0 iload 5 - if_setsize + if_setsize jump LABEL121 LABEL100: get_varbit 8352 @@ -132,7 +134,7 @@ LABEL108: iconst 1 iconst 0 iload 5 - if_setsize + if_setsize jump LABEL121 LABEL115: iconst 0 @@ -140,13 +142,13 @@ LABEL115: iconst 1 iconst 0 iload 5 - if_setsize + if_setsize LABEL121: iconst 1 iload 11 - if_sethide + if_sethide iload 11 - cc_deleteall + cc_deleteall iconst 0 istore 18 get_varbit 4170 @@ -199,7 +201,7 @@ LABEL165: LABEL171: iconst 1 iload 9 - if_sethide + if_sethide iconst 11 istore 19 iconst 0 @@ -207,54 +209,54 @@ LABEL171: iconst 1 iconst 1 iload 1 - if_setsize + if_setsize iconst 460 iconst 39 iconst 0 iconst 1 iload 3 - if_setsize + if_setsize iconst 16 iconst 39 iconst 0 iconst 1 iload 4 - if_setsize + if_setsize iconst 30 iconst 48 iconst 2 iconst 0 iload 2 - if_setposition + if_setposition jump LABEL228 LABEL201: iconst 0 iload 9 - if_sethide + if_sethide iconst 0 iconst 0 iconst 1 iconst 1 iload 1 - if_setsize + if_setsize iconst 460 iconst 81 iconst 0 iconst 1 iload 3 - if_setsize + if_setsize iconst 16 iconst 81 iconst 0 iconst 1 iload 4 - if_setsize + if_setsize iconst 12 iconst 42 iconst 2 iconst 0 iload 2 - if_setposition + if_setposition LABEL228: iload 4 iload 3 @@ -264,8 +266,8 @@ LABEL228: iconst 816 iconst 9 iconst 3 - multiply - add + multiply + add istore 21 LABEL239: iload 20 @@ -275,17 +277,17 @@ LABEL239: LABEL243: iload 3 iload 20 - cc_find + cc_find iconst 1 if_icmpeq LABEL249 jump LABEL251 LABEL249: iconst 1 - cc_sethide + cc_sethide LABEL251: iload 20 iconst 1 - add + add istore 20 jump LABEL239 LABEL256: @@ -293,22 +295,22 @@ LABEL256: istore 20 iconst 8 iconst 1 - sub + sub istore 22 iload 3 - if_getwidth + if_getwidth iconst 51 - sub + sub iconst 35 - sub + sub istore 23 iload 23 iconst 8 iconst 36 - multiply - sub + multiply + sub iload 22 - div + div istore 24 iconst -1 istore 25 @@ -341,51 +343,51 @@ LABEL300: LABEL304: iload 3 iload 20 - cc_find + cc_find iconst 1 if_icmpeq LABEL310 jump LABEL312 LABEL310: iconst 1 - cc_sethide + cc_sethide LABEL312: iconst 95 iload 20 - inv_getobj + inv_getobj iconst -1 if_icmpne LABEL318 jump LABEL324 LABEL318: iload 29 iconst 1 - add + add iload 20 istore 30 istore 29 LABEL324: iload 20 iconst 1 - add + add istore 20 jump LABEL300 LABEL329: get_varbit 4171 get_varbit 4172 - add + add get_varbit 4173 - add + add get_varbit 4174 - add + add get_varbit 4175 - add + add get_varbit 4176 - add + add get_varbit 4177 - add + add get_varbit 4178 - add + add get_varbit 4179 - add + add istore 31 iload 31 iconst 0 @@ -394,13 +396,13 @@ LABEL329: LABEL351: iconst 816 iconst 1 - sub + sub istore 30 LABEL355: iload 31 iload 30 iconst 1 - add + add iconst 0 iload 3 iload 4 @@ -416,7 +418,7 @@ LABEL355: istore 28 iload 27 iload 26 - add + add istore 27 iconst 0 istore 20 @@ -433,7 +435,7 @@ LABEL382: iload 20 iload 20 get_varbit 4171 - add + add iconst 1 iload 3 iload 4 @@ -449,11 +451,11 @@ LABEL382: istore 28 iload 27 iload 26 - add + add istore 27 iload 20 get_varbit 4171 - add + add istore 20 LABEL412: get_varbit 4172 @@ -469,7 +471,7 @@ LABEL416: iload 20 iload 20 get_varbit 4172 - add + add iconst 2 iload 3 iload 4 @@ -485,11 +487,11 @@ LABEL416: istore 28 iload 27 iload 26 - add + add istore 27 iload 20 get_varbit 4172 - add + add istore 20 LABEL446: get_varbit 4173 @@ -505,7 +507,7 @@ LABEL450: iload 20 iload 20 get_varbit 4173 - add + add iconst 3 iload 3 iload 4 @@ -521,11 +523,11 @@ LABEL450: istore 28 iload 27 iload 26 - add + add istore 27 iload 20 get_varbit 4173 - add + add istore 20 LABEL480: get_varbit 4174 @@ -541,7 +543,7 @@ LABEL484: iload 20 iload 20 get_varbit 4174 - add + add iconst 4 iload 3 iload 4 @@ -557,11 +559,11 @@ LABEL484: istore 28 iload 27 iload 26 - add + add istore 27 iload 20 get_varbit 4174 - add + add istore 20 LABEL514: get_varbit 4175 @@ -577,7 +579,7 @@ LABEL518: iload 20 iload 20 get_varbit 4175 - add + add iconst 5 iload 3 iload 4 @@ -593,11 +595,11 @@ LABEL518: istore 28 iload 27 iload 26 - add + add istore 27 iload 20 get_varbit 4175 - add + add istore 20 LABEL548: get_varbit 4176 @@ -613,7 +615,7 @@ LABEL552: iload 20 iload 20 get_varbit 4176 - add + add iconst 6 iload 3 iload 4 @@ -629,11 +631,11 @@ LABEL552: istore 28 iload 27 iload 26 - add + add istore 27 iload 20 get_varbit 4176 - add + add istore 20 LABEL582: get_varbit 4177 @@ -649,7 +651,7 @@ LABEL586: iload 20 iload 20 get_varbit 4177 - add + add iconst 7 iload 3 iload 4 @@ -665,11 +667,11 @@ LABEL586: istore 28 iload 27 iload 26 - add + add istore 27 iload 20 get_varbit 4177 - add + add istore 20 LABEL616: get_varbit 4178 @@ -685,7 +687,7 @@ LABEL620: iload 20 iload 20 get_varbit 4178 - add + add iconst 8 iload 3 iload 4 @@ -701,11 +703,11 @@ LABEL620: istore 28 iload 27 iload 26 - add + add istore 27 iload 20 get_varbit 4178 - add + add istore 20 LABEL650: get_varbit 4179 @@ -721,7 +723,7 @@ LABEL654: iload 20 iload 20 get_varbit 4179 - add + add iconst 9 iload 3 iload 4 @@ -737,11 +739,11 @@ LABEL654: istore 28 iload 27 iload 26 - add + add istore 27 iload 20 get_varbit 4179 - add + add istore 20 LABEL684: invoke 514 @@ -764,7 +766,7 @@ LABEL695: sconst "" join_string 4 iload 6 - if_settext + if_settext get_varc_int 5 iconst 11 if_icmpeq LABEL706 @@ -772,7 +774,7 @@ LABEL695: LABEL706: sconst "Show items whose names contain the following text: (" iload 27 - tostring + tostring sconst " found)" join_string 3 iload 27 ; load number of matches @@ -780,7 +782,7 @@ LABEL706: runelite_callback ; invoke callback pop_int ; pop number of matches iconst 10616876 - if_settext + if_settext LABEL713: jump LABEL728 LABEL714: @@ -790,7 +792,7 @@ LABEL714: sconst "" join_string 4 iload 6 - if_settext + if_settext get_varc_int 5 iconst 11 if_icmpeq LABEL725 @@ -800,7 +802,7 @@ LABEL725: sconst "setSearchBankInputText" ; load event name runelite_callback ; invoke callback iconst 10616876 - if_settext + if_settext LABEL728: jump LABEL732 LABEL729: @@ -808,7 +810,7 @@ LABEL729: sconst "setBankTitle" ; runelite_callback ; iload 6 - if_settext + if_settext LABEL732: iload 0 iload 1 @@ -824,6 +826,8 @@ LABEL732: iload 11 iload 12 iload 28 + sconst "addLastRow" ; + runelite_callback ; iload 29 iload 13 iload 14 @@ -861,14 +865,14 @@ LABEL772: LABEL776: iload 3 iload 20 - cc_find + cc_find iconst 1 if_icmpeq LABEL782 jump LABEL851 LABEL782: iconst 95 iload 20 - inv_getobj + inv_getobj istore 25 iload 25 iconst -1 @@ -877,7 +881,7 @@ LABEL782: LABEL790: iload 29 iconst 1 - add + add istore 29 LABEL794: iload 20 @@ -891,11 +895,11 @@ LABEL798: jump LABEL849 LABEL802: iconst 0 - cc_sethide + cc_sethide iload 25 iconst 95 iload 20 - inv_getnum + inv_getnum iload 3 iload 4 iload 10 @@ -904,22 +908,22 @@ LABEL802: invoke 278 iload 35 iconst 36 - multiply + multiply istore 28 iconst 51 iload 34 iconst 36 iload 24 - add - multiply - add + add + multiply + add iload 28 iconst 0 iconst 0 - cc_setposition + cc_setposition iload 28 iconst 32 - add + add istore 28 iload 34 iload 22 @@ -928,25 +932,25 @@ LABEL802: LABEL837: iload 34 iconst 1 - add + add istore 34 jump LABEL848 LABEL842: iconst 0 iload 35 iconst 1 - add + add istore 35 istore 34 LABEL848: jump LABEL851 LABEL849: iconst 1 - cc_sethide + cc_sethide LABEL851: iload 20 iconst 1 - add + add istore 20 jump LABEL772 LABEL856: @@ -960,22 +964,22 @@ LABEL860: iconst 115 iconst 207 get_varbit 4150 - enum + enum join_string 2 sconst "setBankTitle" ; runelite_callback ; iload 6 - if_settext + if_settext jump LABEL876 LABEL870: sconst "Tab " get_varbit 4150 - tostring + tostring join_string 2 sconst "setBankTitle" ; runelite_callback ; iload 6 - if_settext + if_settext LABEL876: iload 0 iload 1