Jump to content

Banking api ~ almost finished


TheScrub

Recommended Posts

need to make scrolling methods

public boolean bankIsOpen() {
		if (script.client.getInterface(12) != null) {
			RS2InterfaceChild c = getChild(12,21);
			if (c != null && c.isVisible()) {
				return true;
			}
		}
		return false;
	}
	
	private RS2InterfaceChild getChild(int parent, int child) {
		if (script.client.getInterface(parent) != null) {
			RS2InterfaceChild c = script.client.getInterface(parent).getChild(
					child);
			if (c != null && c.isVisible()) {
				return c;
			}
		}
		return null;
	}

	public int getScrollHeight() {
		if (!bankIsOpen()) {
			return -1;
                        }
				return getChild(12, 6).getScrollPosition();

	}

	public int getColumn(int slot) {
		return slot / 8;
	}

	public int getRow(int slot) {
		return slot % 8;
	}



        // you can view the first 6 columns at the height of 0
	public int getMinScrollHeightNeeded(int slot) {
		return getColumn(slot) > 5 ? (getColumn(slot) - 5) * 37 : 0;
	}

	public int getMaxScrollHeightNeeded(int slot) {
		return getMinScrollHeightNeeded(slot) + (37 * 5);
	}

	public boolean slotVisable(int slot) {
		return (getScrollHeight() >= getMinScrollHeightNeeded(slot) && getScrollHeight() <= getMaxScrollHeightNeeded(slot));
	}

	public boolean needToScrollUp(int slot) {
		return !slotVisable(slot)
				&& getScrollHeight() > getMaxScrollHeightNeeded(slot);
	}

	public boolean needToScrollDown(int slot) {
		return !slotVisable(slot)
				&& getScrollHeight() < getMinScrollHeightNeeded(slot);
	}

	public boolean needToScroll(int slot) {
		return needToScrollDown(slot) || needToScrollUp(slot);
	}

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

    public boolean contains(int item) {
        Item[] items = getBankItems();
        if (items != null && items.length > 0) {
            for (Item i : items) {
                if (i != null && i.getId() > 0 && i.getId() == item) {
                    return true;
                }
            }
        }
        return false;
    }

    public int getSlotForName(String name) {
        if (bankIsOpen()) {
            Item[] array = getBankItems();
            for (int i = 0; i < array.length; i++) {
                if (array[i] != null) {
                    if (array[i].getName() != null) {
                        if (array[i].getName().equalsIgnoreCase(name)) {
                            return i;
                        }
                    }
                }
            }
        }
        return -1;
    }
Edited by TheScrub
Link to comment
Share on other sites

ive been knowing that, but that just make you look like a straight bot

 

You can find the min and max numbers to be able to see each row in the bank and then randomise it so the row you want can come out on the top, around the middle or at the bottom. That isn't botlike at all. I actually do this in a lot of my scripts with the timings between actions, walking coordinate randomisation, delay between opening bank and using it, etc.

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...