Class OffensivePrayerUpkeep
java.lang.Object
privbot.mechanics.OffensivePrayerUpkeep
Which offensive prayer to keep on, and when to give one up. A prayer click toggles, and the server refuses a prayer
the account has not unlocked or lacks the level for, so a chosen prayer that still reads off
CONFIRM_TICKS ticks after each of MAX_UNCONFIRMED clicks is dropped for the session and the next
one in the chain is kept instead (for ranged: Rigour, then Eagle Eye). Callers click only with prayer points left,
so an empty prayer bar never costs a prayer its place.
Prayers are named by their in-game names ("Rigour", "Eagle Eye"), the same names ctx.prayer takes on
every server.
What it proves: a prayer is dropped only after MAX_UNCONFIRMED clicks the caller recorded with
clicked(java.lang.String, int) each failed to read "on" within CONFIRM_TICKS. An "off" read with no click behind it never
counts against a prayer.
Unreadable looks like: the caller must not call observe(java.lang.String, boolean, int) when the prayer state could not be read. A
state that is always read "off" (no working read) is what this class exists to catch, so such a prayer will be
dropped after two clicks.
Thread rule: not thread safe; keep it on the one worker thread that ticks the prayer. No client calls.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intTicks after a click before an "off" read counts against it.Magic offensive prayers, best first.static final intClicks that never showed the prayer on before it is dropped.Melee offensive prayers, best first.Ranged offensive prayers, best first. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether a click onprayeris still waiting for its read.voidThis tick's read of the prayer being kept.The prayer to keep on: the first inchainnot given up, or null (empty chain, or all dropped).voidreset()Death and a new run: a pending click is void.
-
Field Details
-
MAX_UNCONFIRMED
public static final int MAX_UNCONFIRMEDClicks that never showed the prayer on before it is dropped.- See Also:
-
CONFIRM_TICKS
public static final int CONFIRM_TICKSTicks after a click before an "off" read counts against it.- See Also:
-
RANGED_CHAIN
-
MAGIC_CHAIN
-
MELEE_CHAIN
-
-
Constructor Details
-
OffensivePrayerUpkeep
public OffensivePrayerUpkeep()
-
-
Method Details
-
pick
-
observe
This tick's read of the prayer being kept. Returns a line to log when the read drops it, else null. A click still withinCONFIRM_TICKSis not judged yet. -
awaiting
Whether a click onprayeris still waiting for its read. -
clicked
-
reset
public void reset()Death and a new run: a pending click is void. What was dropped stays dropped (an unlock does not come back).
-