Guest User

BankPin

a guest
Nov 19th, 2013
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. package org.red.randoms;
  2.  
  3. import com.runemate.game.api.hybrid.local.hud.widgets.Widget;
  4. import com.runemate.game.api.hybrid.local.hud.widgets.WidgetComponent;
  5. import com.runemate.game.api.hybrid.local.hud.widgets.Widgets;
  6. import com.runemate.game.api.script.Execution;
  7.  
  8. import java.util.concurrent.Executors;
  9.  
  10. /**
  11. * Created with IntelliJ IDEA.
  12. * User: Michael
  13. * Date: 11/19/13
  14. * Time: 2:11 PM
  15. * To change this template use File | Settings | File Templates.
  16. */
  17. public class BankPin extends Randoms {
  18.  
  19. private String bankPin = "0001";
  20. private String[] bankPins = new String[4];
  21.  
  22. @Override
  23. public boolean loop() {
  24. bankPins = getPins();
  25. if (Widgets.getAt(13, 151) == null) return true;
  26. int idx = getIdx();
  27. for (int i = 110; i < 110 + 10; i++) {
  28. WidgetComponent widget = Widgets.getAt(13, i);
  29. System.out.println(bankPins[idx]);
  30. if (widget.getText().equals(bankPins[idx])) {
  31. widget.click();
  32. Execution.delay(1000, 1500);
  33. break;
  34. }
  35. }
  36. return false;
  37. }
  38.  
  39. @Override
  40. public boolean execute() {
  41. for (Widget widget : Widgets.getVisible()) {
  42. if (widget.getIndex() == 13) {
  43. return true;
  44. }
  45. }
  46. return false;
  47. }
  48.  
  49. public int getIdx() {
  50. WidgetComponent clickText = Widgets.getAt(13, 151);
  51. if (clickText != null) {
  52. if (clickText.getText().equals("First click the FIRST digit."))
  53. return 0;
  54. else if (clickText.getText().equals("Now click the SECOND digit."))
  55. return 1;
  56. else if (clickText.getText().equals("Time for the THIRD digit."))
  57. return 2;
  58. else if (clickText.getText().equals("Finally, the FOURTH digit."))
  59. return 3;
  60. }
  61. return -1;
  62. }
  63.  
  64. public String[] getPins() {
  65. char[] pin = bankPin.toCharArray();
  66. for (int i = 0; i < 4; i++) {
  67. bankPins[i] = String.valueOf(pin[i]);
  68. }
  69. return bankPins;
  70. }
  71. }
Add Comment
Please, Sign In to add comment