publish eve_combat_watcher.py
This commit is contained in:
parent
383a4491c4
commit
f78abe3c9f
1 changed files with 16 additions and 0 deletions
|
|
@ -106,6 +106,10 @@ def main():
|
||||||
# compress reminder: ping when raw ore piled up since your last compression crosses this
|
# compress reminder: ping when raw ore piled up since your last compression crosses this
|
||||||
# many m³ (default 18,000 ≈ what Brock sits on). Tune via [combat] compress_at_m3.
|
# many m³ (default 18,000 ≈ what Brock sits on). Tune via [combat] compress_at_m3.
|
||||||
compress_at_m3 = g("compress_at_m3", 18000)
|
compress_at_m3 = g("compress_at_m3", 18000)
|
||||||
|
# after this long with no ore flowing, treat the session as over and auto-pause ALL
|
||||||
|
# watchers (drop a marker bot_mining() honors) so quitting never spams Discord.
|
||||||
|
pause_secs = g("mining_pause_secs", 300)
|
||||||
|
PAUSE_MARKER = os.path.join(w.HERE, ".mining_paused")
|
||||||
|
|
||||||
if "--test" in sys.argv:
|
if "--test" in sys.argv:
|
||||||
w.notify(cp, "Gamelog watcher test", "Combat/tackle/hold/bounty alerts will reach you.",
|
w.notify(cp, "Gamelog watcher test", "Combat/tackle/hold/bounty alerts will reach you.",
|
||||||
|
|
@ -156,6 +160,12 @@ def main():
|
||||||
f"({int(time.time()-last_mine)}s) — rock depleted or out of range. "
|
f"({int(time.time()-last_mine)}s) — rock depleted or out of range. "
|
||||||
"Lock a new rock.", priority="high", tags="pick")
|
"Lock a new rock.", priority="high", tags="pick")
|
||||||
print("[gamelog] mining stall — switch-rocks alert")
|
print("[gamelog] mining stall — switch-rocks alert")
|
||||||
|
# stopped for good (you quit / warped off)? auto-pause every watcher so the rest
|
||||||
|
# of the session is silent until ore flows again.
|
||||||
|
if last_mine and time.time() - last_mine > pause_secs \
|
||||||
|
and not os.path.exists(PAUSE_MARKER):
|
||||||
|
open(PAUSE_MARKER, "w").close()
|
||||||
|
print("[gamelog] mining idle — auto-paused watchers")
|
||||||
time.sleep(1); continue
|
time.sleep(1); continue
|
||||||
clean = TAG.sub("", line)
|
clean = TAG.sub("", line)
|
||||||
|
|
||||||
|
|
@ -164,6 +174,12 @@ def main():
|
||||||
last_mine = time.time()
|
last_mine = time.time()
|
||||||
last_ore = mm.group(2)
|
last_ore = mm.group(2)
|
||||||
mine_alerted = False # re-arm: lasers are pulling again
|
mine_alerted = False # re-arm: lasers are pulling again
|
||||||
|
if os.path.exists(PAUSE_MARKER): # ore flowing -> resume all watchers
|
||||||
|
try:
|
||||||
|
os.remove(PAUSE_MARKER)
|
||||||
|
print("[gamelog] mining resumed — watchers un-paused")
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
raw_m3 += int(mm.group(1).replace(",", "")) * ore_vol(mm.group(2))
|
raw_m3 += int(mm.group(1).replace(",", "")) * ore_vol(mm.group(2))
|
||||||
if raw_m3 >= compress_at_m3 and not compress_alerted \
|
if raw_m3 >= compress_at_m3 and not compress_alerted \
|
||||||
and w.bot_mining(cp) and not w.bot_muted(cp):
|
and w.bot_mining(cp) and not w.bot_muted(cp):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue