Roused 22 Posted April 24, 2023 If you're like me, you may have noticed that the dropping patterns of Inventory.dropAll do not mimic what you actually do when you drop all holding shift. In my case, (when playing legitimately) I tend to drop the first item, then the one below it, then the seond, then below, etc. I created a class to mimic this instead of the built-in one (which also drops more quickly). You can use this code to implement it in your projects, if you'd like. ItemDropper.dropAll() - drops all items in your inventory. ItemDropper.dropAllExceptTopRow() - drops all items except the top row. Feedback/suggestions welcome. Happy scripting! import org.dreambot.api.input.Mouse; import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.input.Keyboard; import org.dreambot.api.methods.tabs.Tab; import org.dreambot.api.methods.tabs.Tabs; import org.dreambot.api.methods.widget.Widgets; import org.dreambot.api.utilities.Sleep; import java.awt.*; import java.util.HashMap; import java.util.Map; public class ItemDropper { private final static Map<Integer, Rectangle> itemClickboxes = new HashMap<Integer, Rectangle>() {{ put(0, Widgets.getWidget(149).getChild(0).getChild(0).getRectangle()); put(1, Widgets.getWidget(149).getChild(0).getChild(1).getRectangle()); put(2, Widgets.getWidget(149).getChild(0).getChild(2).getRectangle()); put(3, Widgets.getWidget(149).getChild(0).getChild(3).getRectangle()); put(4, Widgets.getWidget(149).getChild(0).getChild(4).getRectangle()); put(5, Widgets.getWidget(149).getChild(0).getChild(5).getRectangle()); put(6, Widgets.getWidget(149).getChild(0).getChild(6).getRectangle()); put(7, Widgets.getWidget(149).getChild(0).getChild(7).getRectangle()); put(8, Widgets.getWidget(149).getChild(0).getChild(8).getRectangle()); put(9, Widgets.getWidget(149).getChild(0).getChild(9).getRectangle()); put(10, Widgets.getWidget(149).getChild(0).getChild(10).getRectangle()); put(11, Widgets.getWidget(149).getChild(0).getChild(11).getRectangle()); put(12, Widgets.getWidget(149).getChild(0).getChild(12).getRectangle()); put(13, Widgets.getWidget(149).getChild(0).getChild(13).getRectangle()); put(14, Widgets.getWidget(149).getChild(0).getChild(14).getRectangle()); put(15, Widgets.getWidget(149).getChild(0).getChild(15).getRectangle()); put(16, Widgets.getWidget(149).getChild(0).getChild(16).getRectangle()); put(17, Widgets.getWidget(149).getChild(0).getChild(17).getRectangle()); put(18, Widgets.getWidget(149).getChild(0).getChild(18).getRectangle()); put(19, Widgets.getWidget(149).getChild(0).getChild(19).getRectangle()); put(20, Widgets.getWidget(149).getChild(0).getChild(20).getRectangle()); put(21, Widgets.getWidget(149).getChild(0).getChild(21).getRectangle()); put(22, Widgets.getWidget(149).getChild(0).getChild(22).getRectangle()); put(23, Widgets.getWidget(149).getChild(0).getChild(23).getRectangle()); put(24, Widgets.getWidget(149).getChild(0).getChild(24).getRectangle()); put(25, Widgets.getWidget(149).getChild(0).getChild(25).getRectangle()); put(26, Widgets.getWidget(149).getChild(0).getChild(26).getRectangle()); put(27, Widgets.getWidget(149).getChild(0).getChild(27).getRectangle()); }}; public static void dropAll(){ if (!Tabs.isOpen(Tab.INVENTORY)){ Tabs.open(Tab.INVENTORY); Sleep.sleepUntil(() -> Tabs.isOpen(Tab.INVENTORY), 1200, 20); } Keyboard.pressShift(); //First two rows for (int i = 0; i <= 3; i ++){ mouseClick(i); Sleep.sleep(Calculations.random(5, 15)); mouseClick(i + 4); } //Second two rows for (int i = 8; i <= 11; i ++){ mouseClick(i); Sleep.sleep(Calculations.random(5, 15)); mouseClick(i + 4); } //Third two rows for (int i = 16; i <= 19; i ++){ mouseClick(i); Sleep.sleep(Calculations.random(5, 15)); mouseClick(i + 4); } //Fourth two rows for (int i = 24; i <= 27; i ++){ mouseClick(i); Sleep.sleep(Calculations.random(5, 15)); mouseClick(i + 4); } Keyboard.releaseShift(); } public static void dropAllExceptTopRow(){ if (!Tabs.isOpen(Tab.INVENTORY)){ Tabs.open(Tab.INVENTORY); Sleep.sleepUntil(() -> Tabs.isOpen(Tab.INVENTORY), 1200, 20); } Keyboard.pressShift(); //Second two rows for (int i = 4; i <= 7; i ++){ mouseClick(i); Sleep.sleep(Calculations.random(5, 15)); mouseClick(i + 4); } //Third two rows for (int i = 12; i <= 15; i ++){ mouseClick(i); Sleep.sleep(Calculations.random(5, 15)); mouseClick(i + 4); } //Fourth two rows for (int i = 20; i <= 23; i ++){ mouseClick(i); Sleep.sleep(Calculations.random(5, 15)); mouseClick(i + 4); } Keyboard.releaseShift(); } private static void mouseClick(int index){ Mouse.move(itemClickboxes.get(index)); Mouse.click(); } } Luxe 1
hashbang 8 Posted May 4, 2023 Nice work, but you could just use DropPattern from the DreamBot API StandardDropPattern dp = new StandardDropPattern(new int[] {0, 4, 8, 12, 16, 20, 24, 25, 21, 17, 13, 9, 5, 1, 2, 6, 10, 14, 18, 22, 26, 27, 23, 19, 15, 11, 7, 3}); Inventory.setDropPattern(dp); Luxe 1
Roused 22 Author Posted May 4, 2023 7 hours ago, hashbang said: Nice work, but you could just use DropPattern from the DreamBot API StandardDropPattern dp = new StandardDropPattern(new int[] {0, 4, 8, 12, 16, 20, 24, 25, 21, 17, 13, 9, 5, 1, 2, 6, 10, 14, 18, 22, 26, 27, 23, 19, 15, 11, 7, 3}); Inventory.setDropPattern(dp); omg haha amazing! thank you! much easier
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now