publish eve_rock_watcher.py
This commit is contained in:
parent
19ed799e40
commit
19880dbf36
1 changed files with 8 additions and 2 deletions
|
|
@ -268,6 +268,12 @@ def main():
|
||||||
switch_secs = cp.getint("rock", "switch_secs", fallback=45) if sec else 45
|
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
|
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
|
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:
|
if "--test" in sys.argv:
|
||||||
import pytesseract
|
import pytesseract
|
||||||
|
|
@ -341,7 +347,7 @@ def main():
|
||||||
# the rock you're emptying = the one with the least time left
|
# the rock you're emptying = the one with the least time left
|
||||||
actives.sort(key=lambda x: x[3])
|
actives.sort(key=lambda x: x[3])
|
||||||
for key, ore, units, tleft in actives:
|
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
|
last_alert[key] = now
|
||||||
others = [(o, u) for (k, o, u) in keyed if k != key]
|
others = [(o, u) for (k, o, u) in keyed if k != key]
|
||||||
nxt = max(others, key=lambda x: x[1]) if others else None
|
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")
|
w.notify(cp, "Switch rocks", msg, priority="high", tags="pick,gem")
|
||||||
print(f"[rock] ALERT {msg}")
|
print(f"[rock] ALERT {msg}")
|
||||||
# periodic live readout of the rock you're on (so you see the countdown)
|
# 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]
|
key, ore, units, tleft = actives[0]
|
||||||
empty_at = int(now + tleft)
|
empty_at = int(now + tleft)
|
||||||
others = [(o, u) for (k, o, u) in keyed if k != key]
|
others = [(o, u) for (k, o, u) in keyed if k != key]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue