Class ThreatQuery

java.lang.Object
privbot.mechanics.ThreatQuery

public final class ThreatQuery extends Object
What a ctx.threats.snapshot(..) call should include. Immutable: every method returns a new query.

Pure data: no client calls, safe on any thread.

  • Field Details

  • Method Details

    • all

      public static ThreatQuery all()
      Returns:
      a query with the defaults (radius 24, every NPC, no prayers)
    • within

      public ThreatQuery within(int tiles)
      Parameters:
      tiles - the largest distance, in tiles, from the local player (a negative value is treated as 0)
      Returns:
      a copy with that radius
    • npcs

      public ThreatQuery npcs(TargetSpec spec)
      Parameters:
      spec - which NPCs to keep; null keeps every NPC
      Returns:
      a copy that keeps only NPCs the spec matches
    • prayers

      public ThreatQuery prayers(String... names)
      Parameters:
      names - in-game prayer names, for example "Protect from Magic"; null or blank names are dropped
      Returns:
      a copy that checks those prayers
    • radius

      public int radius()
      Returns:
      the radius in tiles
    • npcSpec

      public TargetSpec npcSpec()
      Returns:
      the NPC filter, or null for every NPC
    • prayerNames

      public List<String> prayerNames()
      Returns:
      the prayer names to check (possibly empty)
    • keeps

      public boolean keeps(NpcView npc)
      Parameters:
      npc - an NPC view
      Returns:
      whether the NPC filter keeps it (the radius is applied by the reader, not here)