Advertisement
FALSkills

Untitled

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