Class ThreatQuery
java.lang.Object
privbot.mechanics.ThreatQuery
What a
ctx.threats.snapshot(..) call should include. Immutable: every method returns a new query.
within(int): only things this many tiles (square distance) from the local player are kept. Default 24.npcs(TargetSpec): only NPCs the spec matches are kept. Default: every NPC in range.prayers(String...): the in-game names of the prayers to check; only those can appear inThreatSnapshot.activePrayers(). Default: none checked, so none are read.
Pure data: no client calls, safe on any thread.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe radius used whenwithin(int)is not called. -
Method Summary
Modifier and TypeMethodDescriptionstatic ThreatQueryall()booleannpcs(TargetSpec spec) npcSpec()intradius()within(int tiles)
-
Field Details
-
DEFAULT_RADIUS
-
-
Method Details
-
all
- Returns:
- a query with the defaults (radius 24, every NPC, no prayers)
-
within
- 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
- Parameters:
spec- which NPCs to keep; null keeps every NPC- Returns:
- a copy that keeps only NPCs the spec matches
-
prayers
- 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
- Returns:
- the NPC filter, or null for every NPC
-
prayerNames
-
keeps
- Parameters:
npc- an NPC view- Returns:
- whether the NPC filter keeps it (the radius is applied by the reader, not here)
-