Jump to content

Buy Item From Shop


Owner3

Recommended Posts

private Rectangle getShopItemBounds(int itemId) {		int slot = -1;				for (int i = 0; i < client.getInterface(300).getChild(75).getInv().length; i++) {			if (client.getInterface(300).getChild(75).getInv()[i] - 2 == itemId) {				slot = i + 1;				break;			}		}				if (slot == -1) {			return null;		}				int row = (int) Math.ceil((slot / 8.0) - 1);		int column = slot > 8 ? slot - (row * 8) : slot;		column--;				int x = 80 + (column * 16) + (column * 31);		int y = 69 + (row * 16) + (row * 31);		return new Rectangle(x, y, 31, 31);	}		/**	 * Buys an item from the shop.	 * @param Item the item.	 * @throws InterruptedException if another thread has interrupted the current thread.	 */	private void buyShopItem(Item item) throws InterruptedException {		Rectangle itemBounds = getShopItemBounds(item.getId());		RectangleDestination destination = new RectangleDestination(itemBounds);		selectOption(null, destination, "Buy 10", false);		sleep(100);		selectOption(null, destination, "Buy 10", false);		sleep(100);		selectOption(null, destination, "Buy 10", false);	}
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...