Advertisement
Guest User

osbot Withdraw methods

a guest
Nov 7th, 2013
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.30 KB | None | 0 0
  1.     public boolean withdrawAmount(int itemId, int amount) throws InterruptedException   {  
  2.         int slot = this.client.getBank().getSlotForId(itemId);
  3.         Rectangle rec = client.getBank().getAbsoluteSlotPosition(slot);
  4.         MouseDestination des = new RectangleDestination((int)rec.getMinX(), (int)rec.getMinY(), 30, 30);
  5.         MouseDestination selection = new RectangleDestination(this.client.getMenuX(), this.client.getMenuY()+65, this.client.getMenuWidth(), 10);
  6.        
  7.         if (!client.getBank().isOpen()) {
  8.             return false;
  9.         }else{
  10.             if (!client.getBank().contains(itemId)) {
  11.                 return false;
  12.             }else{
  13.                 if (!client.getBank().isSlotVisible(slot))  {
  14.                     this.client.getBank().scrollToSlot(slot);
  15.                 }else{
  16.                     if (!client.isMenuOpen())   {
  17.                         this.client.moveMouseTo(des, false, true, true);
  18.                     }else{
  19.                         if (client.getMenu() != null)   {
  20.                             if (hasOption("withdraw-"+amount))  {
  21.                                 return this.client.moveMouseTo(selection, false, true, false);
  22.                             }else{
  23.                                 //fix this, mouse move off of screen, withdraw x too fast, add a wait for interface.
  24.                                 return this.client.getBank().withdrawX(itemId, amount);
  25.                             }
  26.                         }
  27.                     }
  28.                 }
  29.             }
  30.         }
  31.         return false;  
  32.     }
  33.  
  34.     public boolean withdrawAmount(String itemName, int amount)  throws InterruptedException{
  35.         int slot = this.client.getBank().getSlotForId(getIdOfItemName(itemName));
  36.         Rectangle rec = client.getBank().getAbsoluteSlotPosition(slot);
  37.         MouseDestination des = new RectangleDestination((int)rec.getMinX(), (int)rec.getMinY(), 30, 30);
  38.         MouseDestination selection = new RectangleDestination(this.client.getMenuX(), this.client.getMenuY()+65, this.client.getMenuWidth(), 10);
  39.        
  40.         if (!client.getBank().isOpen()) {
  41.             return false;
  42.         }else{
  43.             if (!client.getBank().contains(itemName))   {
  44.                 return false;
  45.             }else{
  46.                 if (!client.getBank().isSlotVisible(slot))  {
  47.                     this.client.getBank().scrollToSlot(slot);
  48.                 }else{
  49.                     if (!client.isMenuOpen())   {
  50.                         this.client.moveMouseTo(des, false, true, true);
  51.                     }else{
  52.                         if (client.getMenu() != null)   {
  53.                             if (hasOption("withdraw-"+amount))  {
  54.                                 return this.client.moveMouseTo(selection, false, true, false);
  55.                             }else{
  56.                                 //fix this, mouse move off of screen, withdraw x too fast, add a wait for interface.
  57.                                 return this.client.getBank().withdrawX(getIdOfItemName(itemName), amount);
  58.                             }
  59.                         }
  60.                     }
  61.                 }
  62.             }
  63.         }
  64.        
  65.         return false;
  66.     }
  67.  
  68.     public boolean hasOption(String option){
  69.         for (int i = 0; i < client.getMenuCount(); i++){
  70.             if (client.getMenu().get(i).action.equalsIgnoreCase(option))    {
  71.                 return true;
  72.             }
  73.         }
  74.         return false;
  75.     }
  76.    
  77.     public int getIdOfItemName(String name) {
  78.         for (Item item : client.getBank().getItems()) {
  79.                 if (item != null && item.getName().equalsIgnoreCase(name)) {
  80.                         return item.getId();
  81.                 }
  82.         }
  83.         return -1;
  84.     }
  85.    
  86.     public boolean depositInventory() throws InterruptedException   {
  87.         MouseDestination des = new RectangleDestination(426,288,33,33);
  88.        
  89.         if (!client.getBank().isOpen()) {
  90.             return false;
  91.         }else{
  92.             if (!client.getInventory().isEmpty())   {
  93.                 return this.client.moveMouseTo(des, false, true, false);
  94.             }else{
  95.                 log("You inventory is empty");
  96.                 return true;
  97.             }
  98.         }
  99.     }
  100.    
  101.     public boolean depositEquipments() throws InterruptedException  {
  102.         MouseDestination des = new RectangleDestination(463,288,33,33);
  103.        
  104.         if (!client.getBank().isOpen()) {
  105.             return false;
  106.         }else{
  107.             if (equipmentTab.isWearingItem(EquipmentSlot.AMULET)|| equipmentTab.isWearingItem(EquipmentSlot.ARROWS)|| equipmentTab.isWearingItem(EquipmentSlot.CAPE)|| equipmentTab.isWearingItem(EquipmentSlot.CHEST)|| equipmentTab.isWearingItem(EquipmentSlot.FEET)||equipmentTab.isWearingItem(EquipmentSlot.HANDS)|| equipmentTab.isWearingItem(EquipmentSlot.HAT)|| equipmentTab.isWearingItem(EquipmentSlot.LEGS)|| equipmentTab.isWearingItem(EquipmentSlot.RING)|| equipmentTab.isWearingItem(EquipmentSlot.SHIELD)|| equipmentTab.isWearingItem(EquipmentSlot.WEAPON))   {
  108.                 return client.moveMouseTo(des, false, true, false);
  109.             }else{
  110.                 log("Your not wearing anything");
  111.                 return true;
  112.             }
  113.         }
  114.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement