Merge pull request #1416 from Abextm/script-fixes

Fix scripts broken in 4/12/18 update
This commit is contained in:
Tomas Slusny
2018-04-12 15:32:37 +02:00
committed by GitHub
12 changed files with 126 additions and 43 deletions

View File

@@ -36,4 +36,10 @@ public class MenuOptionClicked
private MenuAction menuAction;
private int id;
private int widgetId;
private boolean consumed;
public void consume()
{
this.consumed = true;
}
}

View File

@@ -339,7 +339,7 @@ public class Hooks
}
}
public static void menuActionHook(int actionParam, int widgetId, int menuAction, int id, String menuOption, String menuTarget, int var6, int var7)
public static boolean menuActionHook(int actionParam, int widgetId, int menuAction, int id, String menuOption, String menuTarget, int var6, int var7)
{
/* Along the way, the RuneScape client may change a menuAction by incrementing it with 2000.
* I have no idea why, but it does. Their code contains the same conditional statement.
@@ -360,6 +360,8 @@ public class Hooks
log.debug("Menu action clicked: {}", menuOptionClicked);
eventBus.post(menuOptionClicked);
return menuOptionClicked.isConsumed();
}
public static void addChatMessage(int type, String name, String message, String sender)

View File

@@ -65,7 +65,7 @@ public class BankTagsPlugin extends Plugin
private static final String EDIT_TAGS_MENU_OPTION = "Edit-tags";
private static final int EDIT_TAGS_MENU_INDEX = 9;
private static final int EDIT_TAGS_MENU_INDEX = 8;
@Inject
private Client client;
@@ -203,6 +203,7 @@ public class BankTagsPlugin extends Plugin
&& event.getMenuAction() == MenuAction.EXAMINE_ITEM_BANK_EQ
&& event.getId() == EDIT_TAGS_MENU_INDEX)
{
event.consume();
int inventoryIndex = event.getActionParam();
ItemContainer bankContainer = client.getItemContainer(InventoryID.BANK);
if (bankContainer == null)

View File

@@ -102,4 +102,9 @@ public class Hooks
{
throw new RuntimeException();
}
public static boolean menuActionHook(int actionParam, int widgetId, int menuAction, int id, String menuOption, String menuTarget, int var6, int var7)
{
throw new RuntimeException();
}
}

View File

@@ -77,6 +77,7 @@ import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.callback.Hooks;
import static net.runelite.client.callback.Hooks.eventBus;
import net.runelite.rs.api.RSClanMemberManager;
import net.runelite.rs.api.RSClient;
@@ -786,4 +787,20 @@ public abstract class RSClientMixin implements RSClient
client.setHintArrowX(point.getX());
client.setHintArrowY(point.getY());
}
@Copy("menuAction")
static void rs$menuAction(int var0, int var1, int var2, int var3, String var4, String var5, int var6, int var7)
{
throw new RuntimeException();
}
@Replace("menuAction")
static void rl$menuAction(int var0, int var1, int var2, int var3, String var4, String var5, int var6, int var7)
{
if (Hooks.menuActionHook(var0, var1, var2, var3, var4, var5, var6, var7))
{
return;
}
rs$menuAction(var0, var1, var2, var3, var4, var5, var6, var7);
}
}

View File

@@ -48,7 +48,7 @@
; Set text
sload 0
load_int 10616867 ; 162:35
load_int 10616868 ; 162:36
widget_put_text_widget
; Init the widgets
@@ -59,7 +59,7 @@
load_int 10002
load_int -2147483639 ; typedKey
load_string "i"
load_int 10616868
load_int 10616869
widget_put_key_listener_widget
; Restore the chatbox on exit
@@ -67,7 +67,7 @@
load_int 1
load_int 1
load_string "ii"
load_int 10616868
load_int 10616869
widget_put_dialog_abort_listener_widget
; 70% sure this opens the keyboard on mobile
@@ -76,6 +76,8 @@
if_icmpeq LABEL25
jump LABEL26
LABEL25:
load_int 1
load_int 10
invoke 1983
LABEL26:

View File

@@ -1 +1 @@
27446C2A53527645827D4EDE100B50607D0D2177947649C7E9BEA155FDF78BBC
36E6536190084AD0420E92E64AC53C3614DB124A2E0F31D42B36E6622F46BDDE

View File

@@ -14,7 +14,7 @@ LABEL5:
load_string "Show items whose names contain the following text:"
load_string "setSearchBankInputText" ; load event name
runelite_callback ; invoke callback
load_int 10616867
load_int 10616868
widget_put_text_widget
load_int 11
put_varc 5
@@ -27,17 +27,19 @@ LABEL5:
load_int -2147483639
sload 0
load_string "izs"
load_int 10616868
load_int 10616869
widget_put_key_listener_widget
load_int 138
load_string ""
load_int 10616868
load_int 10616869
widget_put_dialog_abort_listener_widget
invoke 1972
load_int 1
if_icmpeq LABEL30
jump LABEL31
jump LABEL33
LABEL30:
load_int 0
load_int 80
invoke 1983
LABEL31:
LABEL33:
return

View File

@@ -1 +1 @@
775947F74263107B801155B8D1DB27DBA42F08CE7A14CB07526C5D88288D89F5
7671F8FE2112D88F9584F4B7F7C1A8BFC4DFB759DED66FC132217298061EB594

View File

@@ -265,7 +265,7 @@ LABEL226:
load_int 320
invoke 42
LABEL229:
get_viewport_size
get_viewport_size
istore 9
istore 8
iload 2
@@ -317,7 +317,7 @@ LABEL260:
load_int 73
iload 1
load_int 10551307
get_enum_value
get_enum_value
iload 5
iload 6
iload 7
@@ -329,7 +329,7 @@ LABEL283:
load_int 73
iload 1
load_int 10551307
get_enum_value
get_enum_value
iload 3
load_int 0
load_int 0
@@ -339,7 +339,7 @@ LABEL293:
load_int 73
iload 1
load_int 10551309
get_enum_value
get_enum_value
istore 14
iload 14
load_int -1
@@ -403,22 +403,22 @@ LABEL347:
load_int 73
iload 1
load_int 10551311
get_enum_value
get_enum_value
istore 14
iload 14
load_int -1
if_icmpne LABEL357
jump LABEL390
jump LABEL412
LABEL357:
load_int 73
load_int 73
iload 1
load_int 10551303
get_enum_value
get_enum_value
widget_get_index_widget
load_int 1
if_icmpeq LABEL366
jump LABEL384
jump LABEL395
LABEL366:
get_varbit 4692
load_int 0
@@ -431,24 +431,50 @@ LABEL370:
load_int 0
iload 14
widget_put_position_widget
jump LABEL383
jump LABEL394
LABEL377:
invoke 1972
load_int 1
if_icmpeq LABEL381
jump LABEL388
LABEL381:
load_int 8
load_int 36
load_int 2
load_int 0
iload 14
widget_put_position_widget
jump LABEL394
LABEL388:
load_int 0
load_int 36
load_int 2
load_int 0
iload 14
widget_put_position_widget
LABEL383:
jump LABEL390
LABEL384:
LABEL394:
jump LABEL412
LABEL395:
invoke 1972
load_int 1
if_icmpeq LABEL399
jump LABEL406
LABEL399:
load_int 8
load_int 0
load_int 2
load_int 0
iload 14
widget_put_position_widget
jump LABEL412
LABEL406:
load_int 0
load_int 0
load_int 2
load_int 0
iload 14
widget_put_position_widget
LABEL390:
LABEL412:
iload 0
iload 1
invoke 920

View File

@@ -1 +1 @@
BD8E0D58CD175BCE02F9A63A35E5F025E87A3A31C4DFAA8282926B69CD5FD60B
99623BD5CD95F5C19641A0BD0764B85E0322A58AADD8412C94B81B5C33FE1C07

View File

@@ -6,7 +6,7 @@
iload 0
load_int -1
if_icmpne LABEL4
jump LABEL130
jump LABEL147
LABEL4:
widget_put_actions_null
iload 0
@@ -37,7 +37,7 @@ LABEL9:
iload 6
load_string "IiIiiIIII"
widget_put_drag_release_listener
jump LABEL111
jump LABEL128
LABEL33:
iload 0
4209
@@ -65,11 +65,23 @@ LABEL38:
iload 6
load_string "IiIiiIIII"
widget_put_drag_release_listener
jump LABEL111
jump LABEL128
LABEL59:
iload 0
iload 1
1200
invoke 1972
load_int 1
if_icmpeq LABEL66
jump LABEL72
LABEL66:
load_int 1
load_string "Withdraw-"
invoke 2227
concat_string
widget_put_action
jump LABEL75
LABEL72:
load_int 1 ; if the bank tags plugin is not active this will not get changed and thus
; overridden by the Withdraw-1 option
load_string "Edit-tags" ; push menu action name
@@ -83,6 +95,7 @@ LABEL59:
load_int 1
load_string "Withdraw-1"
widget_put_action
LABEL75:
load_int 2
load_string "Withdraw-5"
widget_put_action
@@ -91,16 +104,16 @@ LABEL59:
widget_put_action
get_varbit 3960
load_int 0
if_icmpgt LABEL75
jump LABEL81
LABEL75:
if_icmpgt LABEL85
jump LABEL91
LABEL85:
load_int 4
load_string "Withdraw-"
get_varbit 3960
int_to_string
string_append 2
widget_put_action
LABEL81:
LABEL91:
load_int 5
load_string "Withdraw-X"
widget_put_action
@@ -110,15 +123,24 @@ LABEL81:
load_int 7
load_string "Withdraw-All-but-1"
widget_put_action
get_varbit 6347
load_int 0
if_icmpgt LABEL104
jump LABEL107
LABEL104:
load_int 8
load_string "Withdraw-1"
widget_put_action
LABEL107:
get_varbit 3755
load_int 0
if_icmpeq LABEL94
jump LABEL97
LABEL94:
load_int 8
if_icmpeq LABEL111
jump LABEL114
LABEL111:
load_int 9
load_string "Placeholder"
widget_put_action
LABEL97:
LABEL114:
load_int 0
widget_put_opacity
load_int 285
@@ -133,7 +155,7 @@ LABEL97:
iload 6
load_string "IiIiiIIII"
widget_put_drag_release_listener
LABEL111:
LABEL128:
load_int 10
load_string "Examine"
widget_put_action
@@ -152,8 +174,8 @@ LABEL111:
load_int 0
load_string "IiiiIi"
widget_put_drag_start_listener
jump LABEL142
LABEL130:
jump LABEL159
LABEL147:
load_int 255
widget_put_opacity
load_int 6512
@@ -166,5 +188,5 @@ LABEL130:
load_int -1
load_string ""
widget_put_drag_release_listener
LABEL142:
return
LABEL159:
return