Jump to content

Bank withdraw methods


Joseph

Recommended Posts

~Hopefully this could make us look less like a bot.~

 

i made a couple of bank methods that contains

 

  • withdraw-(last amount) Both item id and item name.
  • deposit Inventory tab.
  • deposit worn item tab.

only method you need to use are 

  • withdrawAmount(int itemId, int amount);
  • withdrawAmount(String itemName, int amount);
  • depositInventory();
  • depositEquipments();

 

link

http://pastebin.com/j9ngMFDB

 

source code:

	public boolean withdrawAmount(int itemId, int amount) throws InterruptedException	{	
	int slot = this.client.getBank().getSlotForId(itemId);
	Rectangle rec = client.getBank().getAbsoluteSlotPosition(slot);
        MouseDestination des = new RectangleDestination((int)rec.getMinX(), (int)rec.getMinY(), 30, 30);
        MouseDestination selection = new RectangleDestination(this.client.getMenuX(), this.client.getMenuY()+65, this.client.getMenuWidth(), 10);
        
		if (!client.getBank().isOpen())	{
			return false;
		}else{
			if (!client.getBank().contains(itemId))	{
				return false;
			}else{
				if (!client.getBank().isSlotVisible(slot))	{
					this.client.getBank().scrollToSlot(slot);
				}else{
					if (!client.isMenuOpen())	{
						this.client.moveMouseTo(des, false, true, true);
					}else{
						if (client.getMenu() != null)	{
							if (hasOption("withdraw-"+amount))	{
								return this.client.moveMouseTo(selection, false, true, false);
							}else{
								//fix this, mouse move off of screen, withdraw x too fast, add a wait for interface.
								return this.client.getBank().withdrawX(itemId, amount);
							}
						}
					}
				}
			}
		}
		return false;	
	}

	public boolean withdrawAmount(String itemName, int amount)	throws InterruptedException{
	int slot = this.client.getBank().getSlotForId(getIdOfItemName(itemName));
	Rectangle rec = client.getBank().getAbsoluteSlotPosition(slot);
        MouseDestination des = new RectangleDestination((int)rec.getMinX(), (int)rec.getMinY(), 30, 30);
        MouseDestination selection = new RectangleDestination(this.client.getMenuX(), this.client.getMenuY()+65, this.client.getMenuWidth(), 10);
        
		if (!client.getBank().isOpen())	{
			return false;
		}else{
			if (!client.getBank().contains(itemName))	{
				return false;
			}else{
				if (!client.getBank().isSlotVisible(slot))	{
					this.client.getBank().scrollToSlot(slot);
				}else{
					if (!client.isMenuOpen())	{
						this.client.moveMouseTo(des, false, true, true);
					}else{
						if (client.getMenu() != null)	{
							if (hasOption("withdraw-"+amount))	{
								return this.client.moveMouseTo(selection, false, true, false);
							}else{
								//fix this, mouse move off of screen, withdraw x too fast, add a wait for interface.
								return this.client.getBank().withdrawX(getIdOfItemName(itemName), amount);
							}
						}
					}
				}
			}
		}
		
		return false;
	}

	public boolean hasOption(String option){
        for (int i = 0; i < client.getMenuCount(); i++){
            if (client.getMenu().get(i).action.equalsIgnoreCase(option))	{
            	return true;
            }
        }
        return false;
    }
	
	public int getIdOfItemName(String name) {
        for (Item item : client.getBank().getItems()) {
                if (item != null && item.getName().equalsIgnoreCase(name)) {
                        return item.getId();
                }
        }
        return -1;
	}
	
	public boolean depositInventory() throws InterruptedException	{
        MouseDestination des = new RectangleDestination(426,288,33,33);
		
		if (!client.getBank().isOpen())	{
			return false;
		}else{
			if (!client.getInventory().isEmpty())	{
				return this.client.moveMouseTo(des, false, true, false);
			}else{
				log("You inventory is empty");
				return true;
			}
		}
	}
	
	public boolean depositEquipments() throws InterruptedException	{
        MouseDestination des = new RectangleDestination(463,288,33,33);
		
        if (!client.getBank().isOpen())	{
        	return false;
        }else{
	        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))	{
	        	return client.moveMouseTo(des, false, true, false);
	        }else{
	        	log("Your not wearing anything");
	        	return true;
	        }
        }
	} 

 

Depending on the community, i might add more methods like:

  • search tab
  • withdraw-all-but-one

 

 

credits to @Pain: for helping me with menu contains string method

Edited by josedpay
  • Like 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...