manager

The loot and sustain machines.

Methods
2
Fields
None

Getting one

manager

Methods

MethodReturnsDescription
newLoot(LootConfig)LootManagerHandleA looter for config. It reads no game state, and a config it cannot use raises here.
newSustain()SustainManagerHandleAn eat-and-drink machine on its defaults: see SustainManagerHandle.run.

Method details

newLoot

newLoot: (Manager, LootConfig) -> LootManagerHandle

A looter for config. It reads no game state, and a config it cannot use raises here.

local loot = manager:newLoot({
    priority = { { ids = { ItemID.ABYSSAL_WHIP } } },
    lowValue = { { ids = { ItemID.COINS } } },
    highValueStackThreshold = 50000,
    drop = { ItemID.LOBSTER },
})

function plugin:onGameTick()
    local status, reason = loot:run()
    if status == "idle" then
        -- nothing to take: `reason` is a `LootWaitReason` when it deferred, and `nil`
        -- when there is no loot. Get on with the fight.
    end
    -- "running": it acted, or is waiting for its last click to land
end
config
What to pick up.

newSustain

newSustain: (Manager) -> SustainManagerHandle

An eat-and-drink machine on its defaults: see SustainManagerHandle.run.

local sustain = manager:newSustain()

function plugin:onGameTick()
    local status, reason = sustain:run()
    if status == "running" then return end -- a consume is in flight: this tick is taken
    if reason == SustainWaitReason.NO_SUPPLIES then
        -- a threshold fired and there is nothing to consume: time to bank
    end
    -- "idle": get on with the fight
end