publish eve_rock_watcher.py

This commit is contained in:
brockdarnold 2026-06-15 04:30:13 +00:00
parent 19ed799e40
commit 19880dbf36

View file

@ -268,6 +268,12 @@ def main():
switch_secs = cp.getint("rock", "switch_secs", fallback=45) if sec else 45
cooldown = cp.getint("rock", "cooldown_secs", fallback=60) if sec else 60
status_secs = cp.getint("rock", "status_secs", fallback=90) if sec else 90
# OCR rock reads are noisy: the Selected-Item quantity jumps as you click around, and
# survey-region detection false-matches the overview's ore names -> invented rocks +
# wrong "~1s, switch now" ETAs. Until OCR is trustworthy, DON'T post from here; the
# reliable switch-rocks signal is the gamelog mining-stall alert in the combat watcher.
# Flip [rock] post_rock=true to re-enable once OCR reads are validated.
post_rock = cp.getboolean("rock", "post_rock", fallback=False) if sec else False
if "--test" in sys.argv:
import pytesseract
@ -341,7 +347,7 @@ def main():
# the rock you're emptying = the one with the least time left
actives.sort(key=lambda x: x[3])
for key, ore, units, tleft in actives:
if tleft <= switch_secs and now - last_alert.get(key, 0) > cooldown:
if post_rock and tleft <= switch_secs and now - last_alert.get(key, 0) > cooldown:
last_alert[key] = now
others = [(o, u) for (k, o, u) in keyed if k != key]
nxt = max(others, key=lambda x: x[1]) if others else None
@ -352,7 +358,7 @@ def main():
w.notify(cp, "Switch rocks", msg, priority="high", tags="pick,gem")
print(f"[rock] ALERT {msg}")
# periodic live readout of the rock you're on (so you see the countdown)
if actives and not w.bot_muted(cp) and now - last_status >= status_secs:
if post_rock and actives and not w.bot_muted(cp) and now - last_status >= status_secs:
key, ore, units, tleft = actives[0]
empty_at = int(now + tleft)
others = [(o, u) for (k, o, u) in keyed if k != key]