Skip to content

Hunting Buddy Plugins

Mahtra edited this page Aug 2, 2026 · 1 revision

Hunting-Buddy Plugins

hunting-buddy supports the shared Script Plugin System - read that page first for how plugins are written, loaded, and dispatched. This page lists the hooks hunting-buddy fires.

Plugin file scripts/custom/hunting-buddy-plugin-<name>.rb
Register with HuntingBuddy.register_plugin(MyPlugin.new)
Global handle $HUNTING_BUDDY
Debug flag $debug_mode_hunting

Hook catalog

In the signatures below, buddy is the live HuntingBuddy instance. Kind is either decision (first non-nil return wins) or notify (all plugins called, return ignored).

Hook Kind Fires
after_initialize(buddy) notify Once, when hunting-buddy has finished constructing
find_room(buddy, zones_to_search, waiting_room) decision When hunting-buddy needs to choose a room to hunt in
before_hunt(buddy, hunting_room:) notify Once, before the hunt loop begins
hunt_tick(buddy, counter:) decision Once per hunt-loop iteration
hunt_status(buddy, counter:, duration:) notify On the periodic status update (every 60th tick, roughly once a minute)
after_hunt(buddy, hunting_room:, counter:) notify Once, after the hunt loop ends
cleanup(buddy) notify Once, during teardown

Decision hooks:

  • find_room - return a non-nil result to take over room selection (this becomes hunting-buddy's find_hunting_room? result); return nil to let hunting-buddy find the room itself. zones_to_search and waiting_room are the context hunting-buddy computed.
  • hunt_tick - return :break to stop the hunt loop. counter is the 1-based iteration count.

Implement only the hooks you need, and tolerate new ones appearing over time.

Example: log the hunt lifecycle

# scripts/custom/hunting-buddy-plugin-lifelog.rb
class LifeLogPlugin
  def after_initialize(_buddy)
    echo '[lifelog] hunting-buddy loaded'
  end

  def before_hunt(_buddy, hunting_room:)
    echo "[lifelog] starting hunt in room #{hunting_room}"
  end

  def after_hunt(_buddy, hunting_room:, counter:)
    echo "[lifelog] hunt ended after #{counter} ticks in room #{hunting_room}"
  end
end

HuntingBuddy.register_plugin(LifeLogPlugin.new)

Clone this wiki locally