Skip to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Deposit Box Class

Featured Replies

Class 

import java.awt.Point;
import java.awt.Rectangle;

import org.osbot.script.Script;
import org.osbot.script.mouse.RectangleDestination;
import org.osbot.script.rs2.model.Item;
import org.osbot.script.rs2.ui.RS2InterfaceChild;

/*
*Written by TheScrub ~ OSBOT
*/

public class DepositBox {
	private final int START_WIDTH = 135;
	private final int START_HEIGHT = 82;
	// width+ height includes spacing lengths
	private final int WIDTH = 41;
	private final int HEIGHT = 44;
	private Script script;
	private final int PARENTID = 11;
	private final int CHILDID = 61;
	private final int INFOID = 60;

	public DepositBox(Script script) {
		this.script = script;

	}

	public Item[] getItems() {
		if (boxIsOpen()) {
			if (script.client.getInterface(PARENTID) != null) {
				RS2InterfaceChild rc = script.client.getInterface(PARENTID)
						.getChild(CHILDID);
				if (rc != null && rc.isVisible()) {
					return script.client.getInterface(PARENTID).getItems(
							CHILDID);
				}
			}
		}
		return null;
	}

	public int getItemSlot(Item item) {
		Item[] array = getItems();
		if (array != null && array.length > 0) {
			for (int i = 0; i < array.length; i++) {
				if (array[i] != null) {
					if (array[i].equals(item)) {
						return i;
					}
				}
			}
		}

		return -1;
	}

	public int getItemSlot(String item) {
		Item[] array = getItems();
		if (array != null && array.length > 0) {
			for (int i = 0; i < array.length; i++) {
				if (array[i] != null) {
					if (array[i].getName() != null) {
						if (array[i].getName().equalsIgnoreCase(item)) {
							return i;
						}
					}
				}
			}
		}

		return -1;
	}

	public int getItemSlot(int item) {
		Item[] array = getItems();
		if (array != null && array.length > 0) {
			for (int i = 0; i < array.length; i++) {
				if (array[i] != null) {
					if (array[i].getName() != null) {
						if (array[i].getId() == item) {
							return i;
						}
					}
				}
			}
		}

		return -1;
	}

	public boolean contains(String item) {
		if (boxIsOpen()) {
			Item[] array = getItems();
			if (array.length > 0) {
				for (Item i : array) {
					if (i != null) {
						if (i.getName() != null) {
							if (i.getName().equalsIgnoreCase(item)) {
								return true;
							}
						}
					}
				}
			}
		}
		return false;
	}

	public boolean contains(int item) {
		if (boxIsOpen()) {
			Item[] array = getItems();
			if (array.length > 0) {
				for (Item i : array) {
					if (i != null) {
						if (i.getId() == item) {
							return true;
						}

					}
				}
			}
		}
		return false;
	}

	public boolean contains(Item item) {
		if (boxIsOpen()) {
			Item[] array = getItems();
			if (array.length > 0) {
				for (Item i : array) {
					if (i != null) {
						if (i.equals(item)) {
							return true;

						}
					}
				}
			}
		}
		return false;
	}

	private Point getPoint(int slot) {
		int column = slot / 7;
		int row = slot % 7;
		int x = (int) (START_WIDTH + (row * WIDTH));
		int y = START_HEIGHT + (column * HEIGHT);
		return new Point(x, y);
	}

	public Rectangle getRectangle(int slot) {
		Point p = getPoint(slot);
		return new Rectangle(p.x, p.y, 18, 18);
	}

	public boolean boxIsOpen() {
		if (script.client.getInterface(PARENTID) != null) {
			RS2InterfaceChild rc = script.client.getInterface(PARENTID)
					.getChild(CHILDID);
			if (rc != null && rc.isVisible()) {
				return true;
			}
		}
		return false;
	}

	public String getBoxInfo() {
		if (boxIsOpen()) {
			if (script.client.getInterface(PARENTID).getChild(INFOID)
					.getMessage() != null) {
				return script.client.getInterface(PARENTID).getChild(INFOID)
						.getMessage();
			}
		}
		return null;
	}

	public boolean interact(Rectangle rec, String action)
			throws InterruptedException {
		if (rec != null && action != null && !action.isEmpty()) {
			return script.selectOption(null, new RectangleDestination(rec),
					action);
		}
		return false;
	}

}


 

rectangles are abit off but they work fine as it counts as the item still

 

6rBOQ.png

Edited by TheScrub

So how long did it take you to get the squares right?

Combine some of your if statements, there's no reason not to.

  • 1 month later...

You Legend!

Was just about to make one of these, since I'm short on time, ill use this for now. Much love QwPha8E.png

Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.