Advertisement
FALSkills

Untitled

May 8th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. private static final int CACHED_QUANTITY_BIT = 3960;
  2. private static final int DEFAULT_QUANTITY_BIT = 6590;
  3.  
  4. private static final int BANK_INTERFACE_MASTER = 12;
  5.  
  6. private static int getCachedQuantity(){
  7. RSVarBit cache = RSVarBit.get(CACHED_QUANTITY_BIT);
  8. return cache != null ? cache.getValue() : -1;
  9. }
  10.  
  11. public static int getDefaultWithdrawQuantity(){
  12. RSVarBit var = RSVarBit.get(DEFAULT_QUANTITY_BIT);
  13. if(var == null){
  14. return 1;
  15. }
  16. switch(var.getValue()){
  17. case 0:
  18. return 1;
  19. case 1:
  20. return 5;
  21. case 2:
  22. return 10;
  23. case 3:
  24. return getCachedQuantity();
  25. case 4:
  26. return 0;
  27. }
  28. return 1;
  29. }
  30.  
  31. public static boolean setDefaultWithdrawQuantity(String quantity){
  32. int current = getDefaultWithdrawQuantity();
  33. if(quantity.equals("X")){
  34. if(current != 1 && current != 5 && current != 10 && current != 0){
  35. return true;
  36. }
  37. } else if(quantity.equals(Integer.toString(current))){
  38. return true;
  39. }
  40. RSInterface[] quant = InterfaceCache.findInterface(BANK_INTERFACE_MASTER , i -> {
  41. String[] actions = i.getActions();
  42. if(actions == null || actions.length != 1)
  43. return false;
  44. return actions[0].equals("Default quantity: " + quantity);
  45. });
  46. return quant.length > 0 && quant[0].click() && Timing.waitCondition(() -> {
  47. General.sleep(100);
  48. return getDefaultWithdrawQuantity() != current;
  49. }, 2500);
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement