Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static final int CACHED_QUANTITY_BIT = 3960;
- private static final int DEFAULT_QUANTITY_BIT = 6590;
- private static final int BANK_INTERFACE_MASTER = 12;
- private static int getCachedQuantity(){
- RSVarBit cache = RSVarBit.get(CACHED_QUANTITY_BIT);
- return cache != null ? cache.getValue() : -1;
- }
- public static int getDefaultWithdrawQuantity(){
- RSVarBit var = RSVarBit.get(DEFAULT_QUANTITY_BIT);
- if(var == null){
- return 1;
- }
- switch(var.getValue()){
- case 0:
- return 1;
- case 1:
- return 5;
- case 2:
- return 10;
- case 3:
- return getCachedQuantity();
- case 4:
- return 0;
- }
- return 1;
- }
- public static boolean setDefaultWithdrawQuantity(String quantity){
- int current = getDefaultWithdrawQuantity();
- if(quantity.equals("X")){
- if(current != 1 && current != 5 && current != 10 && current != 0){
- return true;
- }
- } else if(quantity.equals(Integer.toString(current))){
- return true;
- }
- RSInterface[] quant = InterfaceCache.findInterface(BANK_INTERFACE_MASTER , i -> {
- String[] actions = i.getActions();
- if(actions == null || actions.length != 1)
- return false;
- return actions[0].equals("Default quantity: " + quantity);
- });
- return quant.length > 0 && quant[0].click() && Timing.waitCondition(() -> {
- General.sleep(100);
- return getDefaultWithdrawQuantity() != current;
- }, 2500);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement