Sicilian7 9 Share Posted September 15, 2020 Currently the Bank API allows setting things like Bank.setWithdrawMode(BankMode.NOTE) Bank.setRearrangeMode(BankMode.SWAP) It would be really nice if the API also had support for something like follows: Bank.setWithdrawAmount(BankMode.ONE) Bank.setWithdrawAmount(BankMode.FIVE) Bank.setWithdrawAmount(BankMode.TEN) Bank.setWithdrawAmount(BankMode.ALL) Bank.setWithdrawAmount(BankMode.X,14) Shouldn't be too hard to add. The widgets are: Widgets.getWidgetChild(12,27); //1 Widgets.getWidgetChild(12,29); //5 Widgets.getWidgetChild(12,31); //10 Widgets.getWidgetChild(12,33); //X Widgets.getWidgetChild(12,35); //ALL I can provide more code for the devs, but this really should be part of the API due to its usefulness. The only tricky part might be setting the X widget, since it asks you to input an amount if no amount has been entered before. Link to comment Share on other sites More sharing options...
Neffarion 486 Share Posted September 15, 2020 public enum WithdrawQuantity { ONE(0, "1"), FIVE(1, "5"), TEN(2, "10"), CUSTOM(3, "X"), ALL(4, "All"); private static final int PLAYER_SETTING_QUANTITY = 1666; private static final int PLAYER_SETTING_CUSTOM_QUANTITY_VALUE = 304; private static final int WIDGET_ID = 12; private final int settingValue; private final String widgetText; WithdrawQuantity(int settingValue, String widgetText) { this.settingValue = settingValue; this.widgetText = widgetText; } private static int getPlayerSettingValue() { return ((PlayerSettings.getConfig(PLAYER_SETTING_QUANTITY) >> 2) & 0b111); } public static int getCustomQuantityValue() { return ((PlayerSettings.getConfig(PLAYER_SETTING_CUSTOM_QUANTITY_VALUE) >> 1)); } public static WithdrawQuantity getCurrentSetting() { WithdrawQuantity[] all = WithdrawQuantity.values(); int value = getPlayerSettingValue(); return Arrays.stream(all).filter(i -> i.getSettingValue() == value).findFirst().orElse(null); } private int getSettingValue() { return this.settingValue; } private String getWidgetText() { return widgetText; } private WidgetChild getButton() { String text = this.getWidgetText(); Widget bank = Widgets.getWidget(WIDGET_ID); if (bank != null && bank.isVisible()) { List<WidgetChild> childList = bank.getChildren(); for (WidgetChild c : childList) { if (c != null && c.isVisible() && c.getText().equalsIgnoreCase(text)) { int id = c.getID(); WidgetChild p = childList.stream().filter(i -> i != null && i.isVisible() && i.getID() == (id - 1) && i.getActions() != null && i.getActions().length > 0).findFirst().orElse(null); if (p != null && p.isVisible()) { String[] actions = p.getActions(); for (String a : actions) { if (a.trim().toLowerCase().contains("default quantity")) { return c; } } } } } } return null; } public static boolean setWithdrawQuantity(WithdrawQuantity quantity) { if (getCurrentSetting() == quantity) { return true; } WidgetChild widget = quantity.getButton(); if (widget != null && widget.isVisible()) { return widget.interact(); } return false; } public static boolean setWithdrawXValue(int value) { if(getCustomQuantityValue() == value){ return true; } WidgetChild xWidget = WithdrawQuantity.CUSTOM.getButton(); if (xWidget != null && xWidget.isVisible()) { if (xWidget.interact("Set custom quantity")) { Keyboard.type(String.valueOf(value), true); SleepProvider.sleep(2500); } } return WithdrawQuantity.getCustomQuantityValue() == value; } } Link to comment Share on other sites More sharing options...
Sicilian7 9 Author Share Posted September 15, 2020 @Neffarion Awesome stuff! Someone should add this to the API. Link to comment Share on other sites More sharing options...
Pandemic 2798 Share Posted September 15, 2020 We're currently on a feature freeze for DB3, but we could possibly add this after the official rollout . Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.