-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoffline_rip.py
66 lines (46 loc) · 1.25 KB
/
offline_rip.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import sys
from typing import Optional
import codecs
from bot import GameConfig
deaths = {}
game: Optional[GameConfig] = None
def update():
global deaths
deaths = {"today": 0, "total": game.rip_total}
# enabled = bot.game.rip_enabled
# asyncio.ensure_future(obscog.enable_rip(enabled))
display_rip()
def display_rip():
with codecs.open("rip_display.txt", "w", "utf8") as f:
if game.inexact:
f.write("☠: {today}+ (всего: ≈{total})".format(**deaths))
return
if game.infinite:
f.write("☠: ∞".format(**deaths))
return
f.write("☠: {today} (всего: {total})".format(**deaths))
def write_rip():
display_rip()
game.rip_total = deaths["total"]
game.save()
def do_rip(n=1):
deaths["today"] += n
deaths["total"] += n
write_rip()
return (
"iarspiRip {today}".format(**deaths)
if n > 0
else "MercyWing1 PinkMercy MercyWing2"
)
def main():
global game
game = GameConfig.get_or_none(game="Horizon Zero Dawn")
assert game is not None
update()
if len(sys.argv) == 2:
nrip = int(sys.argv[1])
else:
nrip = 1
do_rip(nrip)
if __name__ == "__main__":
main()