Merge pull request #552 from Lucwousin/imeanitsthesamething
Use scripts for enabling and removing bankpin keylistener
This commit is contained in:
@@ -32,7 +32,7 @@ import javax.inject.Inject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.events.ScriptCallbackEvent;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.RuneLiteProperties;
|
||||
@@ -155,6 +155,7 @@ public class RuneLitePlusPlugin extends Plugin
|
||||
private RuneLitePlusKeyListener keyListener = new RuneLitePlusKeyListener();
|
||||
private int entered = -1;
|
||||
private int enterIdx;
|
||||
private boolean expectInput;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
@@ -170,6 +171,7 @@ public class RuneLitePlusPlugin extends Plugin
|
||||
|
||||
entered = -1;
|
||||
enterIdx = 0;
|
||||
expectInput = false;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -202,8 +204,9 @@ public class RuneLitePlusPlugin extends Plugin
|
||||
|
||||
else if (!config.keyboardPin())
|
||||
{
|
||||
entered = -1;
|
||||
entered = 0;
|
||||
enterIdx = 0;
|
||||
expectInput = false;
|
||||
keyManager.unregisterKeyListener(keyListener);
|
||||
}
|
||||
}
|
||||
@@ -211,33 +214,41 @@ public class RuneLitePlusPlugin extends Plugin
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
entered = -1;
|
||||
entered = 0;
|
||||
enterIdx = 0;
|
||||
expectInput = false;
|
||||
keyManager.unregisterKeyListener(keyListener);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onWidgetLoaded(WidgetLoaded event)
|
||||
private void onScriptCallbackEvent(ScriptCallbackEvent e)
|
||||
{
|
||||
if (!config.keyboardPin())
|
||||
if (e.getEventName().equals("bankpin"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
int[] intStack = client.getIntStack();
|
||||
int intStackSize = client.getIntStackSize();
|
||||
|
||||
if (event.getGroupId() == WidgetID.BANK_GROUP_ID)
|
||||
{
|
||||
// log.debug("Bank opened, removing key listener");
|
||||
keyManager.unregisterKeyListener(keyListener);
|
||||
return;
|
||||
}
|
||||
else if (event.getGroupId() != WidgetID.BANK_PIN_GROUP_ID)
|
||||
//|| !Text.standardize(client.getWidget(WidgetInfo.BANK_PIN_TOP_LEFT_TEXT).getText()).equals("bank of gielinor"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
// This'll be anywhere from -1 to 3
|
||||
// 0 = first number, 1 second, etc
|
||||
// Anything other than 0123 means the bankpin interface closes
|
||||
int enterIdx = intStack[intStackSize - 1];
|
||||
|
||||
// log.debug("Registering key listener");
|
||||
keyManager.registerKeyListener(keyListener);
|
||||
if (enterIdx < 0 || enterIdx > 3)
|
||||
{
|
||||
keyManager.unregisterKeyListener(keyListener);
|
||||
this.enterIdx = 0;
|
||||
this.entered = 0;
|
||||
expectInput = false;
|
||||
return;
|
||||
}
|
||||
else if (enterIdx == 0)
|
||||
{
|
||||
keyManager.registerKeyListener(keyListener);
|
||||
}
|
||||
|
||||
this.enterIdx = enterIdx;
|
||||
expectInput = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void handleKey(char c)
|
||||
@@ -245,37 +256,38 @@ public class RuneLitePlusPlugin extends Plugin
|
||||
if (client.getWidget(WidgetID.BANK_PIN_GROUP_ID, 0) == null
|
||||
|| !client.getWidget(WidgetInfo.BANK_PIN_TOP_LEFT_TEXT).getText().equals("Bank of Gielinor"))
|
||||
{
|
||||
// log.debug("Key was pressed, but widget wasn't open");
|
||||
entered = -1;
|
||||
entered = 0;
|
||||
enterIdx = 0;
|
||||
expectInput = false;
|
||||
keyManager.unregisterKeyListener(keyListener);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!expectInput)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int num = Character.getNumericValue(c);
|
||||
|
||||
client.runScript(685, num, enterIdx, entered, 13959181, 13959183, 13959184, 13959186, 13959188, 13959190, 13959192, 13959194, 13959196, 13959198, 13959200, 13959202, 13959171, 13959172, 13959173, 13959174, 13959178);
|
||||
// We gotta copy this cause enteridx changes while the script is executing
|
||||
int oldEnterIdx = enterIdx;
|
||||
|
||||
if (enterIdx == 0)
|
||||
// Script 685 will call 653, which in turn will set expectInput to true
|
||||
expectInput = false;
|
||||
client.runScript(685, num, enterIdx, entered, 13959181, 13959183, 13959184, 13959186, 13959188, 13959190, 13959192, 13959194, 13959196, 13959198, 13959200, 13959202, 13959171, 13959172, 13959173, 13959174, 13959178);
|
||||
|
||||
if (oldEnterIdx == 0)
|
||||
{
|
||||
entered = num * 1000;
|
||||
enterIdx++;
|
||||
}
|
||||
else if (enterIdx == 1)
|
||||
else if (oldEnterIdx == 1)
|
||||
{
|
||||
entered += num * 100;
|
||||
enterIdx++;
|
||||
}
|
||||
else if (enterIdx == 2)
|
||||
else if (oldEnterIdx == 2)
|
||||
{
|
||||
entered += num * 10;
|
||||
enterIdx++;
|
||||
}
|
||||
else if (enterIdx == 3)
|
||||
{
|
||||
entered = -1;
|
||||
enterIdx = 0;
|
||||
keyManager.unregisterKeyListener(keyListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1
runelite-client/src/main/scripts/UpdateBankPin.hash
Normal file
1
runelite-client/src/main/scripts/UpdateBankPin.hash
Normal file
@@ -0,0 +1 @@
|
||||
2A73E4C408881BB0EBDDE9BB05910C55F0313FA90BA907B722859E0183A713E7
|
||||
492
runelite-client/src/main/scripts/UpdateBankPin.rs2asm
Normal file
492
runelite-client/src/main/scripts/UpdateBankPin.rs2asm
Normal file
@@ -0,0 +1,492 @@
|
||||
.id 653
|
||||
.int_stack_count 19
|
||||
.string_stack_count 0
|
||||
.int_var_count 22
|
||||
.string_var_count 0
|
||||
iload 0
|
||||
sconst "bankpin"
|
||||
runelite_callback
|
||||
iconst 3
|
||||
if_icmpeq LABEL4
|
||||
jump LABEL20
|
||||
LABEL4:
|
||||
sconst "Finally, the FOURTH digit."
|
||||
iload 18
|
||||
if_settext
|
||||
sconst "*"
|
||||
iload 14
|
||||
if_settext
|
||||
sconst "*"
|
||||
iload 15
|
||||
if_settext
|
||||
sconst "*"
|
||||
iload 16
|
||||
if_settext
|
||||
sconst "?"
|
||||
iload 17
|
||||
if_settext
|
||||
jump LABEL128
|
||||
LABEL20:
|
||||
iload 0
|
||||
iconst 2
|
||||
if_icmpeq LABEL24
|
||||
jump LABEL40
|
||||
LABEL24:
|
||||
sconst "Time for the THIRD digit."
|
||||
iload 18
|
||||
if_settext
|
||||
sconst "*"
|
||||
iload 14
|
||||
if_settext
|
||||
sconst "*"
|
||||
iload 15
|
||||
if_settext
|
||||
sconst "?"
|
||||
iload 16
|
||||
if_settext
|
||||
sconst "?"
|
||||
iload 17
|
||||
if_settext
|
||||
jump LABEL128
|
||||
LABEL40:
|
||||
iload 0
|
||||
iconst 1
|
||||
if_icmpeq LABEL44
|
||||
jump LABEL60
|
||||
LABEL44:
|
||||
sconst "Now click the SECOND digit."
|
||||
iload 18
|
||||
if_settext
|
||||
sconst "*"
|
||||
iload 14
|
||||
if_settext
|
||||
sconst "?"
|
||||
iload 15
|
||||
if_settext
|
||||
sconst "?"
|
||||
iload 16
|
||||
if_settext
|
||||
sconst "?"
|
||||
iload 17
|
||||
if_settext
|
||||
jump LABEL128
|
||||
LABEL60:
|
||||
iload 0
|
||||
iconst 0
|
||||
if_icmpeq LABEL64
|
||||
jump LABEL80
|
||||
LABEL64:
|
||||
sconst "First click the FIRST digit."
|
||||
iload 18
|
||||
if_settext
|
||||
sconst "?"
|
||||
iload 14
|
||||
if_settext
|
||||
sconst "?"
|
||||
iload 15
|
||||
if_settext
|
||||
sconst "?"
|
||||
iload 16
|
||||
if_settext
|
||||
sconst "?"
|
||||
iload 17
|
||||
if_settext
|
||||
jump LABEL128
|
||||
LABEL80:
|
||||
sconst "Submitting..."
|
||||
iload 18
|
||||
if_settext
|
||||
sconst "*"
|
||||
iload 14
|
||||
if_settext
|
||||
sconst "*"
|
||||
iload 15
|
||||
if_settext
|
||||
sconst "*"
|
||||
iload 16
|
||||
if_settext
|
||||
sconst "*"
|
||||
iload 17
|
||||
if_settext
|
||||
iload 4
|
||||
cc_deleteall
|
||||
iload 5
|
||||
cc_deleteall
|
||||
iload 6
|
||||
cc_deleteall
|
||||
iload 7
|
||||
cc_deleteall
|
||||
iload 8
|
||||
cc_deleteall
|
||||
iload 9
|
||||
cc_deleteall
|
||||
iload 10
|
||||
cc_deleteall
|
||||
iload 11
|
||||
cc_deleteall
|
||||
iload 12
|
||||
cc_deleteall
|
||||
iload 13
|
||||
cc_deleteall
|
||||
iconst -1
|
||||
sconst ""
|
||||
iload 2
|
||||
if_setonop
|
||||
iload 2
|
||||
if_clearops
|
||||
iconst -1
|
||||
sconst ""
|
||||
iload 3
|
||||
if_setonop
|
||||
iload 3
|
||||
if_clearops
|
||||
return
|
||||
LABEL128:
|
||||
iconst 10
|
||||
define_array 73
|
||||
iconst 0
|
||||
iload 4
|
||||
set_array_int
|
||||
iconst 1
|
||||
iload 5
|
||||
set_array_int
|
||||
iconst 2
|
||||
iload 6
|
||||
set_array_int
|
||||
iconst 3
|
||||
iload 7
|
||||
set_array_int
|
||||
iconst 4
|
||||
iload 8
|
||||
set_array_int
|
||||
iconst 5
|
||||
iload 9
|
||||
set_array_int
|
||||
iconst 6
|
||||
iload 10
|
||||
set_array_int
|
||||
iconst 7
|
||||
iload 11
|
||||
set_array_int
|
||||
iconst 8
|
||||
iload 12
|
||||
set_array_int
|
||||
iconst 9
|
||||
iload 13
|
||||
set_array_int
|
||||
iconst 0
|
||||
istore 19
|
||||
iconst -1
|
||||
istore 20
|
||||
iconst 20
|
||||
istore 21
|
||||
LABEL166:
|
||||
iload 21
|
||||
iconst 0
|
||||
if_icmpgt LABEL170
|
||||
jump LABEL188
|
||||
LABEL170:
|
||||
iload 21
|
||||
iconst 1
|
||||
sub
|
||||
istore 21
|
||||
iconst 9
|
||||
random
|
||||
istore 19
|
||||
iconst 9
|
||||
get_array_int
|
||||
istore 20
|
||||
iconst 9
|
||||
iload 19
|
||||
get_array_int
|
||||
set_array_int
|
||||
iload 19
|
||||
iload 20
|
||||
set_array_int
|
||||
jump LABEL166
|
||||
LABEL188:
|
||||
iconst 0
|
||||
get_array_int
|
||||
iconst 0
|
||||
iload 0
|
||||
iload 1
|
||||
iload 2
|
||||
iload 3
|
||||
iload 4
|
||||
iload 5
|
||||
iload 6
|
||||
iload 7
|
||||
iload 8
|
||||
iload 9
|
||||
iload 10
|
||||
iload 11
|
||||
iload 12
|
||||
iload 13
|
||||
iload 14
|
||||
iload 15
|
||||
iload 16
|
||||
iload 17
|
||||
iload 18
|
||||
invoke 679
|
||||
iconst 1
|
||||
get_array_int
|
||||
iconst 1
|
||||
iload 0
|
||||
iload 1
|
||||
iload 2
|
||||
iload 3
|
||||
iload 4
|
||||
iload 5
|
||||
iload 6
|
||||
iload 7
|
||||
iload 8
|
||||
iload 9
|
||||
iload 10
|
||||
iload 11
|
||||
iload 12
|
||||
iload 13
|
||||
iload 14
|
||||
iload 15
|
||||
iload 16
|
||||
iload 17
|
||||
iload 18
|
||||
invoke 679
|
||||
iconst 2
|
||||
get_array_int
|
||||
iconst 2
|
||||
iload 0
|
||||
iload 1
|
||||
iload 2
|
||||
iload 3
|
||||
iload 4
|
||||
iload 5
|
||||
iload 6
|
||||
iload 7
|
||||
iload 8
|
||||
iload 9
|
||||
iload 10
|
||||
iload 11
|
||||
iload 12
|
||||
iload 13
|
||||
iload 14
|
||||
iload 15
|
||||
iload 16
|
||||
iload 17
|
||||
iload 18
|
||||
invoke 679
|
||||
iconst 3
|
||||
get_array_int
|
||||
iconst 3
|
||||
iload 0
|
||||
iload 1
|
||||
iload 2
|
||||
iload 3
|
||||
iload 4
|
||||
iload 5
|
||||
iload 6
|
||||
iload 7
|
||||
iload 8
|
||||
iload 9
|
||||
iload 10
|
||||
iload 11
|
||||
iload 12
|
||||
iload 13
|
||||
iload 14
|
||||
iload 15
|
||||
iload 16
|
||||
iload 17
|
||||
iload 18
|
||||
invoke 679
|
||||
iconst 4
|
||||
get_array_int
|
||||
iconst 4
|
||||
iload 0
|
||||
iload 1
|
||||
iload 2
|
||||
iload 3
|
||||
iload 4
|
||||
iload 5
|
||||
iload 6
|
||||
iload 7
|
||||
iload 8
|
||||
iload 9
|
||||
iload 10
|
||||
iload 11
|
||||
iload 12
|
||||
iload 13
|
||||
iload 14
|
||||
iload 15
|
||||
iload 16
|
||||
iload 17
|
||||
iload 18
|
||||
invoke 679
|
||||
iconst 5
|
||||
get_array_int
|
||||
iconst 5
|
||||
iload 0
|
||||
iload 1
|
||||
iload 2
|
||||
iload 3
|
||||
iload 4
|
||||
iload 5
|
||||
iload 6
|
||||
iload 7
|
||||
iload 8
|
||||
iload 9
|
||||
iload 10
|
||||
iload 11
|
||||
iload 12
|
||||
iload 13
|
||||
iload 14
|
||||
iload 15
|
||||
iload 16
|
||||
iload 17
|
||||
iload 18
|
||||
invoke 679
|
||||
iconst 6
|
||||
get_array_int
|
||||
iconst 6
|
||||
iload 0
|
||||
iload 1
|
||||
iload 2
|
||||
iload 3
|
||||
iload 4
|
||||
iload 5
|
||||
iload 6
|
||||
iload 7
|
||||
iload 8
|
||||
iload 9
|
||||
iload 10
|
||||
iload 11
|
||||
iload 12
|
||||
iload 13
|
||||
iload 14
|
||||
iload 15
|
||||
iload 16
|
||||
iload 17
|
||||
iload 18
|
||||
invoke 679
|
||||
iconst 7
|
||||
get_array_int
|
||||
iconst 7
|
||||
iload 0
|
||||
iload 1
|
||||
iload 2
|
||||
iload 3
|
||||
iload 4
|
||||
iload 5
|
||||
iload 6
|
||||
iload 7
|
||||
iload 8
|
||||
iload 9
|
||||
iload 10
|
||||
iload 11
|
||||
iload 12
|
||||
iload 13
|
||||
iload 14
|
||||
iload 15
|
||||
iload 16
|
||||
iload 17
|
||||
iload 18
|
||||
invoke 679
|
||||
iconst 8
|
||||
get_array_int
|
||||
iconst 8
|
||||
iload 0
|
||||
iload 1
|
||||
iload 2
|
||||
iload 3
|
||||
iload 4
|
||||
iload 5
|
||||
iload 6
|
||||
iload 7
|
||||
iload 8
|
||||
iload 9
|
||||
iload 10
|
||||
iload 11
|
||||
iload 12
|
||||
iload 13
|
||||
iload 14
|
||||
iload 15
|
||||
iload 16
|
||||
iload 17
|
||||
iload 18
|
||||
invoke 679
|
||||
iconst 9
|
||||
get_array_int
|
||||
iconst 9
|
||||
iload 0
|
||||
iload 1
|
||||
iload 2
|
||||
iload 3
|
||||
iload 4
|
||||
iload 5
|
||||
iload 6
|
||||
iload 7
|
||||
iload 8
|
||||
iload 9
|
||||
iload 10
|
||||
iload 11
|
||||
iload 12
|
||||
iload 13
|
||||
iload 14
|
||||
iload 15
|
||||
iload 16
|
||||
iload 17
|
||||
iload 18
|
||||
invoke 679
|
||||
iconst 1
|
||||
iload 2
|
||||
if_gettext
|
||||
iload 2
|
||||
if_setop
|
||||
iconst 686
|
||||
iconst 12345
|
||||
iload 2
|
||||
iload 3
|
||||
iload 4
|
||||
iload 5
|
||||
iload 6
|
||||
iload 7
|
||||
iload 8
|
||||
iload 9
|
||||
iload 10
|
||||
iload 11
|
||||
iload 12
|
||||
iload 13
|
||||
iload 14
|
||||
iload 15
|
||||
iload 16
|
||||
iload 17
|
||||
iload 18
|
||||
sconst "iIIIIIIIIIIIIIIIII"
|
||||
iload 2
|
||||
if_setonop
|
||||
iconst 1
|
||||
iload 3
|
||||
if_gettext
|
||||
iload 3
|
||||
if_setop
|
||||
iconst 686
|
||||
iconst 54321
|
||||
iload 2
|
||||
iload 3
|
||||
iload 4
|
||||
iload 5
|
||||
iload 6
|
||||
iload 7
|
||||
iload 8
|
||||
iload 9
|
||||
iload 10
|
||||
iload 11
|
||||
iload 12
|
||||
iload 13
|
||||
iload 14
|
||||
iload 15
|
||||
iload 16
|
||||
iload 17
|
||||
iload 18
|
||||
sconst "iIIIIIIIIIIIIIIIII"
|
||||
iload 3
|
||||
if_setonop
|
||||
return
|
||||
Reference in New Issue
Block a user