Class LootSpec
java.lang.Object
privbot.mechanics.LootSpec
Which ground items are worth picking up: by exact name, by id, or by stack value. Immutable.
What it proves: wants(java.lang.String, int, int) is true when the name is listed (exact, case-insensitive, trimmed), or the id is
listed, or a value rule is set and quantity * price(name) >= threshold. With no names, ids or value rule
nothing is wanted.
Unreadable looks like: a null name never matches by name or value. A price lookup that throws counts as "no
value" for that item, never as wanted. range and maxPicks are settings for the caller; this
class does not enforce them.
Thread rule: pure, safe on any thread, provided the price function is.
-
Nested Class Summary
Nested Classes -
Method Summary
-
Method Details
-
builder
- Returns:
- a new builder: no rules, range 8, unlimited picks
-
range
public int range()- Returns:
- how many tiles around the player to look
-
maxPicks
public int maxPicks()- Returns:
- the most items to pick up per visit (
Integer.MAX_VALUEfor unlimited)
-
wants
- Parameters:
name- the item name, or nullid- the item idquantity- the stack size- Returns:
- whether it is worth picking up
-