Reid Posted May 28, 2014 Posted May 28, 2014 anyone care to share? since the current osbot one sucks!
Swizzbeat Posted May 28, 2014 Posted May 28, 2014 final Inventory inven = client.getInventory(); for (final Item item : inven.getItems()) { if (item != null && Arrays.asList(item.getDefinition().getActions()).contains("Drop")) { inven.interactWithId(item.getId(), "Drop"); } } Wrote in 5 seconds without IDE.
Wiz Khalifa Posted May 28, 2014 Posted May 28, 2014 final Inventory inven = client.getInventory(); for (final Item item : inven.getItems()) { if (item != null && Arrays.asList(item.getDefinition().getActions()).contains("Drop")) { inven.interactWithId(item.getId(), "Drop"); } } Wrote in 5 seconds without IDE. Tbh, I don't think that will drop faster then the normal one..
Swizzbeat Posted May 28, 2014 Posted May 28, 2014 Tbh, I don't think that will drop faster then the normal one.. Dunno, I forget the exact formula for getting menu destinations.
Botre Posted May 29, 2014 Posted May 29, 2014 For OSB2 public class DropItems { private final Script script; @SuppressWarnings("unused") private final Bot b; public DropItems(final Script script, final Bot b) { this.script = script; this.b = b; } public void dropAllExcept(ArrayList<String> blacklist) throws InterruptedException { Item[] i = script.inventory.getItems(); for (Item inventoryItem : i) { if (!blacklist.contains(inventoryItem.getName()) && Arrays .asList(inventoryItem.getDefinition().getActions()) .contains("Drop")) { int s = script.inventory.getSlot(inventoryItem); Timer failsafe = new Timer(0L); while (script.inventory.getSlot(inventoryItem) == s && failsafe.getElapsed() < 5000L) { inventoryItem.interact("Drop"); Script.sleep(750); } } if (script.inventory.isItemSelected()) { script.inventory.deselectItem(); } } } }
Joseph Posted May 31, 2014 Posted May 31, 2014 (edited) For OSB2 public class DropItems { private final Script script; @SuppressWarnings("unused") private final Bot b; public DropItems(final Script script, final Bot b) { this.script = script; this.b = b; } public void dropAllExcept(ArrayList<String> blacklist) throws InterruptedException { Item[] i = script.inventory.getItems(); for (Item inventoryItem : i) { if (!blacklist.contains(inventoryItem.getName()) && Arrays .asList(inventoryItem.getDefinition().getActions()) .contains("Drop")) { int s = script.inventory.getSlot(inventoryItem); Timer failsafe = new Timer(0L); while (script.inventory.getSlot(inventoryItem) == s && failsafe.getElapsed() < 5000L) { inventoryItem.interact("Drop"); Script.sleep(750); } } if (script.inventory.isItemSelected()) { script.inventory.deselectItem(); } } } } Why did you use an Array List in the parameter, it will be easier and look better with an array of strings "String...blacklist". example: public void dropAllExcept(String...blacklist) throws InterruptedException { List<String> list = new ArrayList<String>(); for (String s: blacklist) { if (s!=null) list.add(s); } //then you could do the rest in here using the arrayList } initialize it as a List then convert it into an array list List<String> list = new ArrayList<String>(); Edited May 31, 2014 by josedpay
Botre Posted May 31, 2014 Posted May 31, 2014 Why did you use an Array List in the parameter, it will be easier and look better with an array of strings "String...blacklist". example: public void dropAllExcept(String...blacklist) throws InterruptedException { List<String> list = new ArrayList<String>(); for (String s: blacklist) { if (s!=null) list.add(s); } //then you could do the rest in here using the arrayList } initialize it as a List then convert it into an array list List<String> list = new ArrayList<String>(); The fixed length of simple arrays is the reason why I don't use them much anymore except for constants (my blacklists are usually dynamic, this allows me to have one smart flexible blacklist instead of multiple constant ones). I prefer the collection interface because it offers much more flexibility imo.