Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • [Guide] Using The New Item Containers!


    Notorious
     Share

    Recommended Posts

    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

    • 1 month later...

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.