Notorious 342 Share Posted February 5, 2015 Hello guys, I wanted to walk you through some of new features that will be added next update (v1.4 +). One of these new features will be the addition of the new Item Containers classes! Well what is a Item Container?: A item container is a Widget in game which holds item values. Such as Inventory, Equipment, Shop, and Bank. Item Containers being added to the API: @org.dreambot.api.methods.container.impl.Inventory @org.dreambot.api.methods.container.impl.Shop @org.dreambot.api.methods.container.impl.equipment.Equipment @org.dreambot.api.methods.container.impl.bank.Bank These classes all extend from: @org.dreambot.api.methods.container.AbstractItemContainer- This class can also be used to create your own Item Containers! What makes these containers different to the originals? Well my entire goal while creating these classes was ease of usage. Trying to make everything as simple and efficient as it needs to be! Also did I say you can treat these containers as java.util.List! Giving you all the added features of list methods, such as size(), isEmpty(), indexOf(), and so much more! Item Container Method Examples: Print all items in the Inventory which are not null: Before: for(Item i : getInventory().getItems()){ if(i != null){ log(String.format("[%d] %s\t%d", i.getSlot(), i.getName(), i.getAmount())); } } Now: getItemContainer().getInventory().stream().filter(i -> i != null).forEach(i -> log(String.format("[%d] %s\t%d", i.getSlot(), i.getName(), i.getAmount()))); Get all lobsters in your Inventory: Before: getInventory().getAll(new Filter<Item>() { @Override public boolean match(Item item) { return item != null && item.getName().equalsIgnoreCase("Lobster"); } }); Now: getItemContainer().getInventory().all(new NameFilter<>("Lobster")); These are just a few tiny examples of the many features these classes have to offer! If you guys have any more questions, suggestions, or just want to learn more, feel free to ask! These will be available in the next update (v1.4 +)! Link to comment Share on other sites More sharing options...
Wizard 20 Share Posted February 5, 2015 Finally using streams! Link to comment Share on other sites More sharing options...
Dashboard 34 Share Posted February 5, 2015 Trivial, but you should use an example for getting all lobsters in your inventory as you should only have one slot in your bank anyways. Good job. Link to comment Share on other sites More sharing options...
Dogerina 330 Share Posted February 5, 2015 cool Link to comment Share on other sites More sharing options...
Fran 99 Share Posted March 6, 2015 Viewing this thread now, ItemContainer looking good Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.