Vogelbekdier 1 Share Posted April 28, 2021 Is there any efficient way to be able to customise the drop order and path of the droppAll() Method? I came across the following trying to achieve this but because of the random mouse movements I cannot get this to work. int[] dropOrder = {0,1,2,3,7,6,5,4,8,9,10,11,15,14,13,12,16,17,18,19,23,22,21,20,24,25,26,27}; Integer[] droppables = {7936}; public void dropOnlyThese (Integer[] droppables, int[] dropOrder) { // the grid construction should be in your constructor. // this is for the sake of example Rectangle[] invRects = new Rectangle[28]; for (int r = 0; r < invRects.length; r++) { int x = 568 + 42 * (r % 4); int y = 228 + 36 * (r / 4); invRects[r] = new Rectangle(x, y, 42, 36); } Instance instance = Client.getInstance(); Canvas canvas = Instance.getCanvas(); instance.setKeyboardInputEnabled(true); Mouse.getMouseSettings(); MouseSettings.setSpeed(Calculations.random(7, 11)); canvas.dispatchEvent(new KeyEvent(canvas, KeyEvent.KEY_PRESSED, System.currentTimeMillis(), 0, KeyEvent.VK_SHIFT, KeyEvent.CHAR_UNDEFINED)); for (int r = 0; r < dropOrder.length; r++) { if (Inventory.getItemInSlot(dropOrder[r]) != null && Arrays.asList(droppables).contains(Inventory.getItemInSlot(dropOrder[r]).getID())) { Mouse.click(invRects[dropOrder[r]]); } try { Thread.sleep(250); // randomize & speed this up } catch (InterruptedException e) { e.printStackTrace(); } } canvas.dispatchEvent(new KeyEvent(canvas, KeyEvent.KEY_RELEASED, System.currentTimeMillis(), 0, KeyEvent.VK_SHIFT, KeyEvent.CHAR_UNDEFINED)); Mouse.getMouseSettings().resetSpeed(); instance.setKeyboardInputEnabled(false); } Link to comment Share on other sites More sharing options...
Aeglen 229 Share Posted April 28, 2021 As far as I know, you'd need to implement your own dropAll to do that. I'd suggest iterating over the items in the inventory rather than their rectangles, the code above seems silly for doing that. Link to comment Share on other sites More sharing options...
Pseudo 179 Share Posted April 28, 2021 [code] Keyboard.pressShift(); for (int i : dropOrder) {//dropOrder being an array of type int[] of the order you want to drop the items Item item = Inventory.getItemInSlot(i); if (item != null //any further criteria can be added here) { if (item.interact()) { //sleep(s)? } } Keyboard.releaseShift(); [/code] Link to comment Share on other sites More sharing options...
Vogelbekdier 1 Author Share Posted May 3, 2021 On 4/28/2021 at 7:34 PM, Pseudo said: [code] Keyboard.pressShift(); for (int i : dropOrder) {//dropOrder being an array of type int[] of the order you want to drop the items Item item = Inventory.getItemInSlot(i); if (item != null //any further criteria can be added here) { if (item.interact()) { //sleep(s)? } } Keyboard.releaseShift(); [/code] Great reply! Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.