Swizzbeat Posted February 11, 2014 Posted February 11, 2014 (edited) The OSBot methods are slow and unreliable so I wrote my own. Thanks to @TheScrub for cluing me in on what interface in the bank had the items! public boolean bankContains(int item) { for (Item i : sI.client.getInterface(12).getItems(6)) { if (i != null && i.getId() == item) { return true; } } return false; } public boolean bankContains(String item) { for (Item i : sI.client.getInterface(12).getItems(6)) { if (i != null && i.getName().equalsIgnoreCase(item.toLowerCase())) { return true; } } return false; } public boolean rightClickBankItem(int item) throws InterruptedException { if (!bankContains(item)) { return false; } int slot = sI.client.getBank().getSlotForId(item); if (!sI.client.getBank().isSlotVisible(slot)) { sI.client.getBank().scrollToSlot(slot); } Rectangle rect = sI.client.getBank().getAbsoluteSlotPosition(slot); sI.client.moveMouseTo(new RectangleDestination((int) rect.getX(), (int) rect.getY(), (int) rect.getWidth(), (int) rect.getHeight()), false, true, true); return sI.client.isMenuOpen(); } public boolean rightClickBankItem(String item) throws InterruptedException { if (!bankContains(item)) { return false; } int slot = sI.client.getBank().getSlotForId(sI.client.getBank().getItemForName(item).getId()); if (!sI.client.getBank().isSlotVisible(slot)) { sI.client.getBank().scrollToSlot(slot); } Rectangle rect = sI.client.getBank().getAbsoluteSlotPosition(slot); sI.client.moveMouseTo(new RectangleDestination((int) rect.getX(), (int) rect.getY(), (int) rect.getWidth(), (int) rect.getHeight()), false, true, true); return sI.client.isMenuOpen(); } public boolean selectOpenMenuOption(String option) throws InterruptedException { if (sI.client.isMenuOpen()) { List<Option> options = sI.client.getMenu(); for (int i= 0; i < options.size(); i++) { if (options.get(i).action.equalsIgnoreCase(option.toLowerCase())) { return sI.client.moveMouse(new RectangleDestination(sI.client.getMenuX(), sI.client.getMenuY()+19+(i*15), sI.client.getMenuWidth(), 15), false); } } } return false; } public boolean withdraw(int id, int amount) throws InterruptedException { if (!bankContains(id)) { return false; } if (rightClickBankItem(id)) { if (sI.client.isMenuOpen()) { List<Option> options = sI.client.getMenu(); for (int i= 0; i < options.size(); i++) { if (options.get(i).action.equalsIgnoreCase("withdraw-" + amount)) { return sI.client.moveMouse(new RectangleDestination(sI.client.getMenuX(), sI.client.getMenuY()+19+(i*15), sI.client.getMenuWidth(), 15), false); } else if (options.get(i).action.equalsIgnoreCase("withdraw-x")) { sI.client.moveMouseTo(new RectangleDestination(sI.client.getMenuX(), sI.client.getMenuY()+21+i*14, sI.client.getMenuWidth(), 10), false, true, false); sI.sleep(MethodProvider.random(615, 963)); sI.client.typeString(Integer.toString(amount)); return true; } } } } return false; } public boolean withdraw(String name, int amount) throws InterruptedException { if (!bankContains(name)) { return false; } if (rightClickBankItem(name)) { if (sI.client.isMenuOpen()) { List<Option> options = sI.client.getMenu(); for (int i= 0; i < options.size(); i++) { if (options.get(i).action.equalsIgnoreCase("withdraw-" + amount)) { return sI.client.moveMouseTo(new RectangleDestination(sI.client.getMenuX(), sI.client.getMenuY()+21+i*14, sI.client.getMenuWidth(), 10), false, true, false); } else if (options.get(i).action.equalsIgnoreCase("withdraw-x")) { sI.client.moveMouse(new RectangleDestination(sI.client.getMenuX(), sI.client.getMenuY()+19+(i*15), sI.client.getMenuWidth(), 15), false); sI.sleep(MethodProvider.random(615, 963)); sI.client.typeString(Integer.toString(amount)); return true; } } } } return false; } Edited May 6, 2014 by Swizzbeat 3
Ricky Posted February 11, 2014 Posted February 11, 2014 (edited) How would this be used? sike idc i dont code Edited February 11, 2014 by Ricky
Lolwutermelon Posted February 12, 2014 Posted February 12, 2014 Nice, the current OSBot banking API sucks, it takes a good 10 seconds to enter the pin.
GoldenGates Posted February 12, 2014 Posted February 12, 2014 wow. released evelenty fiveth banking api much creativity such amazingment
Dreamliner Posted February 12, 2014 Posted February 12, 2014 How would this be used? sike idc i dont code Then why the hell are you even posting? OT: Great methods. Mine look similar for my fast actions with banking/items
zScripz Posted February 13, 2014 Posted February 13, 2014 (edited) the problem with osbot's banking is the scrolling yet here you continue to use osbot's scrolling.. not h8ing just saying nothing will change with this Edited February 13, 2014 by zScripz
Swizzbeat Posted February 13, 2014 Author Posted February 13, 2014 the problem with osbot's banking is the scrolling yet here you continue to use osbot's scrolling.. not h8ing just saying nothing will change with this I've never had an issue with it O_o but I could rewrite it, what would you change?
zScripz Posted February 13, 2014 Posted February 13, 2014 I've never had an issue with it O_o but I could rewrite it, what would you change? It only searches for items below the current point it is at if it gets to low in the bank, so basically it won't go up :P
Swizzbeat Posted February 13, 2014 Author Posted February 13, 2014 It only searches for items below the current point it is at if it gets to low in the bank, so basically it won't go up Weird, I've been using this and it works just fine scrolling both up and down! Maybe it's just been luck :p
zScripz Posted February 13, 2014 Posted February 13, 2014 Weird, I've been using this and it works just fine scrolling both up and down! Maybe it's just been luck Hmm let me try :P I'll tell you. Could be that I'm just withdrawing too many items too
Swizzbeat Posted February 13, 2014 Author Posted February 13, 2014 Hmm let me try I'll tell you. Could be that I'm just withdrawing too many items too You might get a bug where it will miss-click the option, I have that fixed in the local version I'm using but still have to update the one here :p it's just a small miscalculation of the option rectangle.
zScripz Posted February 16, 2014 Posted February 16, 2014 2 things, 1. You need to use absoluteSlotPosition 2. It withdraws stuff really fast :P But anyways thanks for this! Used this as a base for my own bank api :P
Swizzbeat Posted February 16, 2014 Author Posted February 16, 2014 2 things, 1. You need to use absoluteSlotPosition 2. It withdraws stuff really fast But anyways thanks for this! Used this as a base for my own bank api Yeah I changed that in my local version! But the mouse destination in this snippet is actually wrong and will missclick sometimes, here's the updated one: sI.client.moveMouse(new RectangleDestination(sI.client.getMenuX(), sI.client.getMenuY()+19+(i*15), sI.client.getMenuWidth(), 15), false);
YinZ Posted February 18, 2014 Posted February 18, 2014 system.out.println(Post Count); ^ Capital S Please!
Dreamliner Posted February 19, 2014 Posted February 19, 2014 system.out.println(Post Count);System.out.println("Post Count");