Class SustainPolicy
What it proves: a returned item was held in the given inventory snapshot with the needed action ("Eat" for
foods and combo foods, "Drink" for brews, restores and boost doses). Priority order: unreadable, then HP below
the eat threshold (food, else brew, else out of food), then HP below the brew threshold, then prayer below the
restore threshold, then the first due boost, else nothing. decide(privbot.mechanics.SustainPlan, java.lang.Integer, java.lang.Integer, java.lang.Integer, privbot.hooks.container.ItemContainerSnapshot, java.util.Map<net.runelite.api.Skill, java.lang.Integer>, long) never returns COMBO_EAT; for an EAT the
caller asks comboAfterEat(privbot.mechanics.SustainPlan, java.lang.Integer, java.lang.Integer, privbot.hooks.container.ItemContainerSnapshot) with the same readings, and sends the combo click straight after the first.
Unreadable looks like: UNREADABLE when the inventory is unavailable or HP or max HP is null (or max HP is not
positive). A null prayer only skips the prayer rule; it is not a "no". A boost of Integer.MIN_VALUE, or a
skill missing from the boost map, is unreadable and that boost is not due.
Thread rule: pure, but BoostDosePolicy keeps state, so call from the one worker thread that owns the
plan. No client calls.
-
Method Summary
Modifier and TypeMethodDescriptionstatic SustainChoicecomboAfterEat(SustainPlan plan, Integer hp, Integer maxHp, ItemContainerSnapshot inv) Call with the readings taken before the first Eat: the combo click goes out straight after it in the same tick, so HP has not changed yet.static SustainChoicedecide(SustainPlan plan, Integer hp, Integer maxHp, Integer prayer, ItemContainerSnapshot inv, Map<net.runelite.api.Skill, Integer> boostBySkill, long now)
-
Method Details
-
decide
public static SustainChoice decide(SustainPlan plan, Integer hp, Integer maxHp, Integer prayer, ItemContainerSnapshot inv, Map<net.runelite.api.Skill, Integer> boostBySkill, long now) - Parameters:
plan- what to eat and drinkhp- current hitpoints, or null when unreadablemaxHp- maximum hitpoints, or null when unreadableprayer- current prayer points, or null when unreadableinv- the inventory snapshotboostBySkill- observed boost per skill;Integer.MIN_VALUEor a missing key is unreadablenow- the current time in milliseconds, for the boost throttle- Returns:
- the choice; never null
-
comboAfterEat
public static SustainChoice comboAfterEat(SustainPlan plan, Integer hp, Integer maxHp, ItemContainerSnapshot inv) Call with the readings taken before the first Eat: the combo click goes out straight after it in the same tick, so HP has not changed yet. Pass the inventory without the first food's slot. A combo eat is a second food in the same tick, and only when the plan lists combo foods, HP is below the eat threshold, and one is carried.- Returns:
- COMBO_EAT with the first carried combo food; UNREADABLE when the inventory, HP or max HP is unreadable; otherwise NONE
-