spirez 0.1.0__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {spirez-0.1.0 → spirez-0.2.0}/PKG-INFO +3 -2
- {spirez-0.1.0 → spirez-0.2.0}/README.md +2 -1
- {spirez-0.1.0 → spirez-0.2.0}/pyproject.toml +2 -2
- {spirez-0.1.0 → spirez-0.2.0}/pyproject.toml.orig +2 -2
- spirez-0.2.0/src/spirez/__init__.py +2 -0
- spirez-0.2.0/src/spirez/cli.py +56 -0
- spirez-0.1.0/src/spirez/__init__.py +0 -2
- spirez-0.1.0/src/spirez/cli.py +0 -32
- {spirez-0.1.0 → spirez-0.2.0}/LICENSE +0 -0
- {spirez-0.1.0 → spirez-0.2.0}/src/spirez/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: spirez
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Slay the Spire 2 run statistics.
|
|
5
5
|
Author: m09
|
|
6
6
|
Author-email: m09 <142691+m09@users.noreply.github.com>
|
|
@@ -15,7 +15,8 @@ Slay the Spire 2 run statistics.
|
|
|
15
15
|
|
|
16
16
|
`spirez` prints the solo win rate of each character, read from the run history
|
|
17
17
|
of the first profile of the Linux Steam version. It keeps the runs of ascension
|
|
18
|
-
10, or of another level with `spirez --ascension LEVEL
|
|
18
|
+
10, or of another level with `spirez --ascension LEVEL`, and prints the standard
|
|
19
|
+
and dread game modes separately, or other modes with `spirez --mode MODE...`.
|
|
19
20
|
|
|
20
21
|
## Development
|
|
21
22
|
|
|
@@ -4,7 +4,8 @@ Slay the Spire 2 run statistics.
|
|
|
4
4
|
|
|
5
5
|
`spirez` prints the solo win rate of each character, read from the run history
|
|
6
6
|
of the first profile of the Linux Steam version. It keeps the runs of ascension
|
|
7
|
-
10, or of another level with `spirez --ascension LEVEL
|
|
7
|
+
10, or of another level with `spirez --ascension LEVEL`, and prints the standard
|
|
8
|
+
and dread game modes separately, or other modes with `spirez --mode MODE...`.
|
|
8
9
|
|
|
9
10
|
## Development
|
|
10
11
|
|
|
@@ -6,7 +6,7 @@ license-files = ["LICENSE"]
|
|
|
6
6
|
name = "spirez"
|
|
7
7
|
readme = "README.md"
|
|
8
8
|
requires-python = ">= 3.13"
|
|
9
|
-
version = "0.
|
|
9
|
+
version = "0.2.0"
|
|
10
10
|
|
|
11
11
|
[[project.authors]]
|
|
12
12
|
name = "m09"
|
|
@@ -66,7 +66,7 @@ commit = true
|
|
|
66
66
|
tag = true
|
|
67
67
|
push = true
|
|
68
68
|
commit_message = "Bump version to {new_version}"
|
|
69
|
-
current_version = "0.
|
|
69
|
+
current_version = "0.2.0"
|
|
70
70
|
pre_commit_hook = "scripts/bumpver_pre_commit.sh"
|
|
71
71
|
tag_message = "{new_version}"
|
|
72
72
|
version_pattern = "MAJOR.MINOR.PATCH"
|
|
@@ -9,7 +9,7 @@ license-files = ["LICENSE"]
|
|
|
9
9
|
name = "spirez"
|
|
10
10
|
readme = "README.md"
|
|
11
11
|
requires-python = ">= 3.13"
|
|
12
|
-
version = "0.
|
|
12
|
+
version = "0.2.0"
|
|
13
13
|
|
|
14
14
|
[project.scripts]
|
|
15
15
|
spirez = "spirez.cli:main"
|
|
@@ -48,7 +48,7 @@ commit = true
|
|
|
48
48
|
tag = true
|
|
49
49
|
push = true
|
|
50
50
|
commit_message = "Bump version to {new_version}"
|
|
51
|
-
current_version = "0.
|
|
51
|
+
current_version = "0.2.0"
|
|
52
52
|
pre_commit_hook = "scripts/bumpver_pre_commit.sh"
|
|
53
53
|
tag_message = "{new_version}"
|
|
54
54
|
version_pattern = "MAJOR.MINOR.PATCH"
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
from argparse import ArgumentParser
|
|
2
|
+
from collections import Counter
|
|
3
|
+
from json import loads
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
_RUNS_GLOB = ".local/share/SlayTheSpire2/steam/*/profile1/saves/history/*.run"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _format_row(name: str, wins: int, losses: int) -> str:
|
|
10
|
+
rate = wins / (wins + losses) if wins + losses else 0
|
|
11
|
+
return f"{name:21} {wins:3}W {losses:3}L {rate:7.2%}"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _print_mode(mode: str, results: Counter[tuple[str, bool]]) -> None:
|
|
15
|
+
print(mode)
|
|
16
|
+
for character in sorted({character for character, _ in results}):
|
|
17
|
+
print(
|
|
18
|
+
_format_row(character, results[character, True], results[character, False])
|
|
19
|
+
)
|
|
20
|
+
wins = sum(count for (_, win), count in results.items() if win)
|
|
21
|
+
print(_format_row("total", wins, results.total() - wins))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def main() -> None:
|
|
25
|
+
parser = ArgumentParser(description="Print solo win rates per character.")
|
|
26
|
+
parser.add_argument(
|
|
27
|
+
"-a", "--ascension", type=int, default=10, help="Ascension level to keep."
|
|
28
|
+
)
|
|
29
|
+
parser.add_argument(
|
|
30
|
+
"-m",
|
|
31
|
+
"--mode",
|
|
32
|
+
nargs="+",
|
|
33
|
+
default=["standard", "dread"],
|
|
34
|
+
help="Game modes to print (default: standard dread).",
|
|
35
|
+
)
|
|
36
|
+
args = parser.parse_args()
|
|
37
|
+
|
|
38
|
+
results: dict[str, Counter[tuple[str, bool]]] = {
|
|
39
|
+
mode: Counter() for mode in args.mode
|
|
40
|
+
}
|
|
41
|
+
for path in Path.home().glob(_RUNS_GLOB):
|
|
42
|
+
run = loads(path.read_text(encoding="utf-8"))
|
|
43
|
+
mode = run.get("game_mode")
|
|
44
|
+
if (
|
|
45
|
+
mode not in results
|
|
46
|
+
or run.get("ascension") != args.ascension
|
|
47
|
+
or len(run.get("players", [])) != 1
|
|
48
|
+
):
|
|
49
|
+
continue
|
|
50
|
+
character = run["players"][0].get("character", "?")
|
|
51
|
+
results[mode][character, bool(run.get("win"))] += 1
|
|
52
|
+
|
|
53
|
+
for i, (mode, mode_results) in enumerate(results.items()):
|
|
54
|
+
if i:
|
|
55
|
+
print()
|
|
56
|
+
_print_mode(mode, mode_results)
|
spirez-0.1.0/src/spirez/cli.py
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
from argparse import ArgumentParser
|
|
2
|
-
from collections import Counter
|
|
3
|
-
from json import loads
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
|
|
6
|
-
_RUNS_GLOB = ".local/share/SlayTheSpire2/steam/*/profile1/saves/history/*.run"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def _format_row(name: str, wins: int, losses: int) -> str:
|
|
10
|
-
rate = wins / (wins + losses) if wins + losses else 0
|
|
11
|
-
return f"{name:21} {wins:3}W {losses:3}L {rate:7.2%}"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def main() -> None:
|
|
15
|
-
parser = ArgumentParser(description="Print solo win rates per character.")
|
|
16
|
-
parser.add_argument(
|
|
17
|
-
"-a", "--ascension", type=int, default=10, help="Ascension level to keep."
|
|
18
|
-
)
|
|
19
|
-
args = parser.parse_args()
|
|
20
|
-
|
|
21
|
-
wins: Counter[str] = Counter()
|
|
22
|
-
losses: Counter[str] = Counter()
|
|
23
|
-
for path in Path.home().glob(_RUNS_GLOB):
|
|
24
|
-
run = loads(path.read_text(encoding="utf-8"))
|
|
25
|
-
if run.get("ascension") != args.ascension or len(run.get("players", [])) != 1:
|
|
26
|
-
continue
|
|
27
|
-
character = run["players"][0].get("character", "?")
|
|
28
|
-
(wins if run.get("win") else losses)[character] += 1
|
|
29
|
-
|
|
30
|
-
for character in sorted(wins.keys() | losses.keys()):
|
|
31
|
-
print(_format_row(character, wins[character], losses[character]))
|
|
32
|
-
print(_format_row("total", wins.total(), losses.total()))
|
|
File without changes
|
|
File without changes
|