Neodork Posted August 7, 2013 Share Posted August 7, 2013 (edited) Hello OSBot scripters, Today I bring to you, a new store class library. I plan to maintain and modify this to work flawlessly. Until the OSBot team is able to add it into their API. I happen to know that there is already an library like this. However that library wasn't maintained or offered support for which I plan to do. Any feedback given will be appreciated and considered. 1. Setting up: A. You add the class files to your source and compile them with it. B. You import the Jar as an external library and include it with your script for usage. 2. Store example: //Make a store instance Store store = new Store(this.bot.getAPI()); //Check if store is open if(store.isOpen()){ //Buy something }else{ //Open the store } 3. Item example: //get item from the store StoreItem item = store.getStoreItem("Bronze arrow"); //interacting with the item if(item != null && item.getAmount>0){ item.interact("Buy 10"); sleep(1000); } Link:Store.javaStoreItem.javaReleases: v0.2 - Store.jar v0.1 - Store.jar Changelogs: - Changed the return type of close to void- Fixed buying 2nd row items. @Merccy - Base concept@bfir3 - Accurate item amount. Edited September 11, 2013 by Neodork 2 Link to comment Share on other sites More sharing options...
Skype Posted August 7, 2013 Share Posted August 7, 2013 Good job Link to comment Share on other sites More sharing options...
Peter Posted August 7, 2013 Share Posted August 7, 2013 Nice work man hope you release more snippets. Link to comment Share on other sites More sharing options...
Assume Posted August 11, 2013 Share Posted August 11, 2013 (edited) StoreItem#interact(String action) is bad. Better StoreItem#buy(int amount). You handle the rest. I didn't check the source so this method may exist but if it doesn't make it. I'm guessing StoreItem extends w/e the item class in OSBot is (I don't develop for this client). StoreItem i = Inventory.get(id). StoreItem.sell(int amount) Edited August 11, 2013 by Assume Link to comment Share on other sites More sharing options...
Neodork Posted August 11, 2013 Author Share Posted August 11, 2013 StoreItem#interact(String action) is bad. Better StoreItem#buy(int amount). You handle the rest. I didn't check the source so this method may exist but if it doesn't make it. I'm guessing StoreItem extends w/e the item class in OSBot is (I don't develop for this client). StoreItem i = Inventory.get(id). StoreItem.sell(int amount) Actually storeItem.interact(String action); is the right way to go, because it is not necessarily used for buying, you can also select the value action for example. In this case the interact method can be used to select all options in the store. I would not understand the logic of passing an integer argument as the is no Buy X action in a store. I don't intend to use all fields the OSBot so I didn't extend it. Also casting from a super class to a subclass is not possible. Link to comment Share on other sites More sharing options...
Diamonds Posted August 11, 2013 Share Posted August 11, 2013 nice work, keep it up Link to comment Share on other sites More sharing options...
Neodork Posted August 17, 2013 Author Share Posted August 17, 2013 Updated the source on request of . - Changed the return type of close to void - Fixed buying 2nd row items. Link to comment Share on other sites More sharing options...
RWS Posted August 17, 2013 Share Posted August 17, 2013 Thanks. This works great now. Brilliant help, thanks. Link to comment Share on other sites More sharing options...
QBots Posted August 17, 2013 Share Posted August 17, 2013 I might be wrong, but cant you just use Store store = new Store(this); Pretty sure using this will just use everything. Meaning, less typing and less confusing. Link to comment Share on other sites More sharing options...
Neodork Posted August 20, 2013 Author Share Posted August 20, 2013 I might be wrong, but cant you just use Store store = new Store(this); Pretty sure using this will just use everything. Meaning, less typing and less confusing. I could do that, but in that case I would be passing an instance of Script to the Store library. There is no need for us to use the methods inside the Script class all we need is to use the MethodProvider which is the super class of Script. But if you prefer to pass the instance of the class Script to the Store library I won't stop you. You're able to cast from sub to super class so there will be no problem in doing so. Link to comment Share on other sites More sharing options...