Class WithdrawOption
java.lang.Object
privbot.hooks.bank.WithdrawOption
One withdraw quantity PrivBot can actually send on this server, e.g.
"Withdraw-10" -> 10.
Like a shop's buy options, each bank quantity is its own action, so the usable quantities are exactly the ones PrivBot knows how to send on this server. Any other quantity is not offered rather than guessed at.
Unlike ShopOption this type also models Withdraw-All, which
has no fixed amount. "All" is only ever selected when the caller explicitly asks for everything —
it is never chosen to satisfy a numeric target, where it would overshoot without bound.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intSentinel amount for the unboundedWithdraw-Alloption. -
Method Summary
Modifier and TypeMethodDescriptionstatic WithdrawOptionThe unboundedWithdraw-Alloption.static WithdrawOptionallOf(List<WithdrawOption> options) TheWithdraw-Allentry, or null when this server has none PrivBot can send.intamount()Units withdrawn per click, orALLfor the unbounded option.static WithdrawOptionbestFor(List<WithdrawOption> options, int remaining) Picks the largest fixed option that does not exceedremaining.booleanisAll()True forWithdraw-All, which has no fixed quantity.label()The label the client renders for this option — carried into the dispatched menu entry.static WithdrawOptionA fixed-quantity option.toString()
-
Field Details
-
ALL
public static final int ALLSentinel amount for the unboundedWithdraw-Alloption.- See Also:
-
-
Method Details
-
label
The label the client renders for this option — carried into the dispatched menu entry. -
amount
public int amount()Units withdrawn per click, orALLfor the unbounded option. -
isAll
public boolean isAll()True forWithdraw-All, which has no fixed quantity. -
of
A fixed-quantity option.- Throws:
IllegalArgumentException- whenamountis not positive
-
all
The unboundedWithdraw-Alloption. -
bestFor
Picks the largest fixed option that does not exceedremaining. When every fixed option is larger, returns the smallest one — overshooting slightly beats deadlocking on a bank whose smallest increment exceeds what is still needed.Withdraw-Allis never returned: it cannot serve a numeric target.- Parameters:
options- any order; only fixed-quantity entries are considered- Returns:
- null when
optionsholds no fixed-quantity entry
-
allOf
TheWithdraw-Allentry, or null when this server has none PrivBot can send. -
toString
-