Class Prayer

java.lang.Object
privbot.hooks.Prayer

public final class Prayer extends Object
Prayer activation, deactivation, and state checks. When the prayer interaction helper and ClientThread are provided (via PrivContext), toggles use the same prayer-tab and Orion mouse-handler paths as the manual click; otherwise falls back to a raw menu dispatch.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Which prayer book the prayer tab has mounted, as mountedBook() reads it.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Activates the prayer with this in-game name ("Protect from Melee") if it is not already active.
    boolean
    Deactivates the prayer with this in-game name if it is currently active.
    boolean
    flick(String name)
    Flicks the prayer with this in-game name: activates it, then deactivates it on the same tick, with no sleep between the two.
    boolean
    Whether the prayer with this in-game name is active; false also for an unknown name and when unreadable (use observedActive(String) for decisions).
    boolean
    Whether quick prayers are on: the client's quick-prayer flag where it can be read (Impact, Elorin, SpawnPK), varbit QUICK_PRAYER_VARBIT on Orion.
    The prayer book the client has mounted: Prayer.Book.CURSES or Prayer.Book.NORMAL where the client says which book its prayer tab shows (Elorin), Prayer.Book.UNKNOWN when it cannot be read and on every other server.
    Whether the prayer with this in-game name ("Protect from Melee") is on, with "cannot tell" kept apart: isActive(String) answers false for that, and a guard that re-toggles a prayer it cannot read turns it OFF.
    Whether quick prayers are on, or UNREADABLE where isQuickPrayersActive() would log UNSUPPORTED and answer false (this client's quick-prayer flag cannot be read, or Orion's varbit could not be read).
    boolean
    setQuickPrayers(boolean on)
    Turn quick prayers on or off, clicking the orb only when the current state disagrees.
    boolean
    toggle(String name)
    Sends a toggle for the prayer with this in-game name, whatever its current state.
    boolean
    Click the quick-prayer orb once, the way this server's own orb click is sent.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isQuickPrayersActive

      public boolean isQuickPrayersActive()
      Whether quick prayers are on: the client's quick-prayer flag where it can be read (Impact, Elorin, SpawnPK), varbit QUICK_PRAYER_VARBIT on Orion.
    • toggleQuickPrayers

      public boolean toggleQuickPrayers()
      Click the quick-prayer orb once, the way this server's own orb click is sent.
    • setQuickPrayers

      public boolean setQuickPrayers(boolean on)
      Turn quick prayers on or off, clicking the orb only when the current state disagrees.
    • activate

      public boolean activate(String name)
      Activates the prayer with this in-game name ("Protect from Melee") if it is not already active.
      Parameters:
      name - the prayer's in-game name
      Returns:
      false for an unknown name (logged); true once the activation was handed on
    • deactivate

      public boolean deactivate(String name)
      Deactivates the prayer with this in-game name if it is currently active.
      Parameters:
      name - the prayer's in-game name
      Returns:
      false for an unknown name (logged); true once the deactivation was handed on
    • toggle

      public boolean toggle(String name)
      Sends a toggle for the prayer with this in-game name, whatever its current state. Prefer activate(String) / deactivate(String) for state-aware control.
      Parameters:
      name - the prayer's in-game name
      Returns:
      false for an unknown name (logged)
    • flick

      public boolean flick(String name)
      Flicks the prayer with this in-game name: activates it, then deactivates it on the same tick, with no sleep between the two.
      Parameters:
      name - the prayer's in-game name
      Returns:
      false for an unknown name (logged)
    • mountedBook

      public Prayer.Book mountedBook()
      The prayer book the client has mounted: Prayer.Book.CURSES or Prayer.Book.NORMAL where the client says which book its prayer tab shows (Elorin), Prayer.Book.UNKNOWN when it cannot be read and on every other server. Pick the prayer name by the book ("Deflect Magic" on curses, "Protect from Magic" otherwise) and hold the switch on UNKNOWN: a guessed book clicks buttons that are not drawn.
      Returns:
      the mounted book, never null
    • isActive

      public boolean isActive(String name)
      Whether the prayer with this in-game name is active; false also for an unknown name and when unreadable (use observedActive(String) for decisions).
      Parameters:
      name - the prayer's in-game name
      Returns:
      whether it reads active
    • observedActive

      public Observed<Boolean> observedActive(String name)
      Whether the prayer with this in-game name ("Protect from Melee") is on, with "cannot tell" kept apart: isActive(String) answers false for that, and a guard that re-toggles a prayer it cannot read turns it OFF.
      Parameters:
      name - the prayer's in-game name
      Returns:
      TRUE / FALSE, or UNREADABLE (also for an unknown name)
    • observedQuickPrayersActive

      public Observed<Boolean> observedQuickPrayersActive()
      Whether quick prayers are on, or UNREADABLE where isQuickPrayersActive() would log UNSUPPORTED and answer false (this client's quick-prayer flag cannot be read, or Orion's varbit could not be read).
      Returns:
      TRUE / FALSE, or UNREADABLE