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.

Looting Bag

Featured Replies

How to initialize: 

	LootingBag lootingBag;
	
	@Override
	public void onStart() {
		lootingBag = new LootingBag(this);
	}

Picture:

7IaS4_zps1b44c264.jpg           7IaSL_zps76bc0afb.jpg

 

Snippet:


import java.awt.Point;
import java.awt.Rectangle;
import org.osbot.script.Script;
import org.osbot.script.rs2.model.Item;
import org.osbot.script.rs2.ui.Tab;

public class LootingBag {

	private Script script;
	
	//Important:
	private int parent = 81;
	private int close = 2;
	private int items = 7;
	private int bankDepositParent = 15;
	private int bankDepositChild = 5;
	
	//For Slots:
	private int startWidth = 558;
	private int startHeight = 231;
	private int width = 33;
	private int height = 30;
	
	public LootingBag(Script script) {
		this.script = script;
	}

	public boolean isOpen()	{
		return script.client.getInterface(parent)!=null;
	}

	public boolean close() throws InterruptedException	{
		if (isOpen() && script.client.getInterface(parent).getChild(close)!=null)
			return script.client.getInterface(parent).getChild(close).interact();			
		return false;
	}

	public Item get(int id)	{
		if (isOpen())
			for (Item item: getItems())
				if (item!=null && item.getId() == id)
					return item;
		return null;
	}
	
	public Item get(String name)	{
		if (isOpen())
			for (Item item: getItems())
				if (item!=null && item.getName().equalsIgnoreCase(name))
					return item;
		return null;
	}

	public Item[] getItems()	{
		if (isOpen())
			if (script.client.getInterface(parent).getChild(items)!=null)
				return script.client.getInterface(parent).getItems(items);
		return null;
	}
		
	public boolean contains(Item item)	{
		if (isOpen()){
			for (Item i: getItems())
				if (i!=null && i.getId()!=-1)
					return i.getId() == item.getId();
		}
		return false;
	}
		
	public boolean isEmpty()	{
		return getTotal() > 0 ? false: true;
	}
	
	public int getAmount(Item item)	{
		if (isOpen())
			return item.getAmount();
		return -1;
	}

	public int getTotal()	{
		int total = 0;
		if (isOpen()){
			for (Item item: getItems())
				if (item!=null && item.getId() != -1)
					total++;
			return total;
		}
		return -1;
	}
	
	public int getSlot(Item item)	{
		if (isOpen() && contains(item))	{
			for (int i =0; i<getItems().length; i++)	{
				if (getItems()[i] !=null)
					if (getItems()[i].equals(item))
						return i;
			}
		}
		return -1;
	}

	public Point getPoint(int slot)	{
		int column = slot / 4;
		int row = slot % 4;
		int x = (int) (this.startWidth + (row * this.width) +(row * 10));
		int y = (int) (this.startHeight + (column * this.height) +(column * 3));
		return new Point(x, y);
	}

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

	public boolean bankDepositOpen()	{
		return script.client.getInterface(this.bankDepositParent)!=null;
	}
	
	//will finish up
	public boolean emptyBagIntoBank()	{
		if (script.client.getBank().isOpen()){
			
		}
		return false;
	}
	
	//will finish up
	public boolean interact(String action) throws InterruptedException	{
		if (!this.isOpen())
			if (!script.currentTab().equals(Tab.INVENTORY))
				this.script.openTab(Tab.INVENTORY);
			else
				return script.client.getInventory().interactWithName("Looting Bag", action);
		return true;
	}

	/* i removed the deposit enum going to create a new interaction method
	public boolean depositIntoBag(int id, Deposit deposit, int amount) throws InterruptedException	{
		if (isOpen() && contains(id))	{
			Rectangle rec = getRectangle(getSlot(id));
			if (rec !=null)	{
				if (!deposit.equals(Deposit.STORE_X))	
					return script.selectOption(null, new RectangleDestination(rec),	deposit.toString());
				else{
					script.selectOption(null, new RectangleDestination(rec), deposit.toString());
					script.sleep(2000);
					script.type(Integer.toString(amount));
					return true;
				}
			}
		}
		return false;
	}
	*/
}
 

 

 

 

Edited by josedpay

code looks shitty as fuck.

btw what's a looting bag and how do you get one?

code looks shitty as fuck.

btw what's a looting bag and how do you get one?

At least he did release something which will function. Proper criticism is better than that. :P

  • Author

code looks shitty as fuck.

btw what's a looting bag and how do you get one?

If you ain't going to give positive criticism then what about fuck off, you ungrateful prick

And a looting bag is a bag you receive in the wildy. The bag gives you 28 more inventory space. Only works In the wild, any npc in the wild drop them. Anything you put in the bag can't be removed unless you deposit them in the bank.

If you ain't going to give positive criticism then what about fuck off, you ungrateful prick

And a looting bag is a bag you receive in the wildy. The bag gives you 28 more inventory space. Only works In the wild, any npc in the wild drop them. Anything you put in the bag can't be removed unless you deposit them in the bank.

 

You're calling me an ungrateful prick for something I'm never going to use. I help people out on this forum from time to time but it's hardly worth it. This community isn't really advancing so why bother.

You're calling me an ungrateful prick for something I'm never going to use. I help people out on this forum from time to time but it's hardly worth it. This community isn't really advancing so why bother.

Every time I see you post you act like you're some Java wizard that knows absolutely everything. I'm not saying you're not knowledgeable, but stop trying to act like a hardass on an internet forum.

Every time I see you post you act like you're some Java wizard that knows absolutely everything. I'm not saying you're not knowledgeable, but stop trying to act like a hardass on an internet forum.

isnt that what forums are used for?

On topic, good job josedpay - I'm sure some people will find this useful

Every time I see you post you act like you're some Java wizard that knows absolutely everything. I'm not saying you're not knowledgeable, but stop trying to act like a hardass on an internet forum.

Respect the Kenneh. Kenneh is God #3.

Every time I see you post you act like you're some Java wizard that knows absolutely everything. I'm not saying you're not knowledgeable, but stop trying to act like a hardass on an internet forum.

 

I try. Like, I really try sometimes. I considered coming to osb and making scripts but every time I do, I remember that the API just terrible and I literally have to re-write everything myself. I get about halfway done with writing some usable API I realize that it's just not worth it and trash my project.

Respect the Kenneh. Kenneh is God #3.

 

Who are one and two? I shall kill them!

I try. Like, I really try sometimes. I considered coming to osb and making scripts but every time I do, I remember that the API just terrible and I literally have to re-write everything myself. I get about halfway done with writing some usable API I realize that it's just not worth it and trash my project.

 

Who are one and two? I shall kill them!

Harrynoob and I.

You were 4. .-. harry and kenneh were my inspirations as a child. :) You're just a dog_.

I was expecting 1 :(
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.