koro 1.1.6__py3-none-any.whl → 2.0.0rc2__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- koro/__init__.py +8 -8
- koro/slot/__init__.py +21 -0
- koro/{file → slot}/bin.py +12 -36
- koro/slot/file.py +67 -0
- koro/slot/save.py +135 -0
- koro/slot/xml.py +783 -0
- koro/stage/__init__.py +98 -0
- koro/stage/model.py +284 -0
- koro/stage/part.py +1704 -0
- {koro-1.1.6.dist-info → koro-2.0.0rc2.dist-info}/METADATA +7 -2
- koro-2.0.0rc2.dist-info/RECORD +14 -0
- {koro-1.1.6.dist-info → koro-2.0.0rc2.dist-info}/WHEEL +1 -1
- koro/file/__init__.py +0 -40
- koro/file/dir.py +0 -212
- koro/file/lvl.py +0 -40
- koro/file/zip.py +0 -223
- koro/item/__init__.py +0 -0
- koro/item/group.py +0 -48
- koro/item/level.py +0 -108
- koro/item/save.py +0 -29
- koro-1.1.6.dist-info/RECORD +0 -15
- {koro-1.1.6.dist-info → koro-2.0.0rc2.dist-info}/LICENSE +0 -0
- {koro-1.1.6.dist-info → koro-2.0.0rc2.dist-info}/top_level.txt +0 -0
koro/item/level.py
DELETED
@@ -1,108 +0,0 @@
|
|
1
|
-
from abc import ABC, abstractmethod
|
2
|
-
from collections.abc import Sized
|
3
|
-
from dataclasses import dataclass
|
4
|
-
from enum import Enum, unique
|
5
|
-
from typing import Final
|
6
|
-
from warnings import warn
|
7
|
-
|
8
|
-
__all__ = ["Level", "LevelNotFoundError", "LevelStatistics", "Theme"]
|
9
|
-
|
10
|
-
|
11
|
-
@unique
|
12
|
-
class Theme(Enum):
|
13
|
-
THE_EMPTY_LOT = 0
|
14
|
-
NEIGHBORS_HOUSE = 1
|
15
|
-
SIZZLIN_DESERT = 2
|
16
|
-
CHILL_MOUNTAIN = 3
|
17
|
-
OCEAN_TREASURE = 4
|
18
|
-
SPACE_STATION = 5
|
19
|
-
STUMP_TEMPLE = 6
|
20
|
-
CANDY_ISLAND = 7
|
21
|
-
HAUNTED_HOUSE = 8
|
22
|
-
CITY = 9
|
23
|
-
TUTORIAL = 11
|
24
|
-
HAUNTED_HOUSE_DARKNESS = 12
|
25
|
-
NIGHT_CITY = 13
|
26
|
-
|
27
|
-
def __str__(self) -> str:
|
28
|
-
return (
|
29
|
-
"The Empty Lot",
|
30
|
-
"Neighbor's House",
|
31
|
-
"Sizzlin' Desert",
|
32
|
-
"Chill Mountain",
|
33
|
-
"Ocean Treasure",
|
34
|
-
"Space Station",
|
35
|
-
"Stump Temple",
|
36
|
-
"Candy Island",
|
37
|
-
"Haunted House",
|
38
|
-
"City",
|
39
|
-
None,
|
40
|
-
"Tutorial",
|
41
|
-
"Haunted House Darkness",
|
42
|
-
"Night City",
|
43
|
-
)[self.value]
|
44
|
-
|
45
|
-
|
46
|
-
@dataclass(frozen=True, match_args=False, kw_only=True, slots=True)
|
47
|
-
class LevelStatistics:
|
48
|
-
crystals: int
|
49
|
-
filesize: int
|
50
|
-
theme: Theme
|
51
|
-
|
52
|
-
|
53
|
-
class LevelNotFoundError(LookupError):
|
54
|
-
pass
|
55
|
-
|
56
|
-
|
57
|
-
class Level(ABC, Sized):
|
58
|
-
__slots__ = ()
|
59
|
-
|
60
|
-
def about(self) -> LevelStatistics:
|
61
|
-
content: Final[bytes] = self.read()
|
62
|
-
return LevelStatistics(
|
63
|
-
crystals=content.count(b"<anmtype> 49 </anmtype>"),
|
64
|
-
filesize=len(content),
|
65
|
-
theme=Theme(int(content[87:89])),
|
66
|
-
)
|
67
|
-
|
68
|
-
@abstractmethod
|
69
|
-
def __bool__(self) -> bool:
|
70
|
-
"""Return whether this level exists."""
|
71
|
-
|
72
|
-
@abstractmethod
|
73
|
-
def delete(self) -> None:
|
74
|
-
"""Delete this level if it exists, otherwise raise LevelNotFoundError."""
|
75
|
-
pass
|
76
|
-
|
77
|
-
def encode(self) -> bytes:
|
78
|
-
"""Return a bytes object that when written to a file can overwrite an official level."""
|
79
|
-
warn(
|
80
|
-
FutureWarning(
|
81
|
-
"The use of this function is deprecated as the new BIN format is compatible with the official levels and can be substituted into the game directly."
|
82
|
-
)
|
83
|
-
)
|
84
|
-
data: Final[bytearray] = bytearray(self.read())
|
85
|
-
header: Final[bytes] = (
|
86
|
-
b"\x00\x00\x00\x01\x00\x00\x00\x08"
|
87
|
-
+ len(data).to_bytes(4, byteorder="big")
|
88
|
-
+ b"\x00\x00\x00\x01"
|
89
|
-
)
|
90
|
-
i: int = 0
|
91
|
-
while i < len(data):
|
92
|
-
data.insert(i, 255)
|
93
|
-
i += 9
|
94
|
-
return header + data + b"\x00"
|
95
|
-
|
96
|
-
def __len__(self) -> int:
|
97
|
-
"""The file size of this level."""
|
98
|
-
return len(self.read())
|
99
|
-
|
100
|
-
@abstractmethod
|
101
|
-
def read(self) -> bytes:
|
102
|
-
"""Return the contents of this level if it exists, otherwise raise LevelNotFoundError."""
|
103
|
-
pass
|
104
|
-
|
105
|
-
@abstractmethod
|
106
|
-
def write(self, new_content: bytes, /) -> None:
|
107
|
-
"""Replace the contents of this level, or create it if it doesn't exist."""
|
108
|
-
pass
|
koro/item/save.py
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
from abc import ABC
|
2
|
-
from collections.abc import Iterator, Mapping
|
3
|
-
from enum import Enum, unique
|
4
|
-
from typing import Generic, TypeGuard, TypeVar
|
5
|
-
|
6
|
-
from .group import Group
|
7
|
-
|
8
|
-
__all__ = ["Save", "Page"]
|
9
|
-
|
10
|
-
_G = TypeVar("_G", bound=Group)
|
11
|
-
|
12
|
-
|
13
|
-
@unique
|
14
|
-
class Page(Enum):
|
15
|
-
ORIGINAL = 0
|
16
|
-
FRIEND = 1
|
17
|
-
|
18
|
-
|
19
|
-
class Save(ABC, Generic[_G], Mapping[Page, _G]):
|
20
|
-
__slots__ = ()
|
21
|
-
|
22
|
-
def __contains__(self, key: object, /) -> TypeGuard[Page]:
|
23
|
-
return isinstance(key, Page)
|
24
|
-
|
25
|
-
def __iter__(self) -> Iterator[Page]:
|
26
|
-
return iter(Page)
|
27
|
-
|
28
|
-
def __len__(self) -> int:
|
29
|
-
return 2
|
koro-1.1.6.dist-info/RECORD
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
koro/__init__.py,sha256=5K5KQt899Y9FEEce0zLbKgi7lMlUIVR5tNN5xkgM-DE,201
|
2
|
-
koro/file/__init__.py,sha256=1uei7uDZD9P05n-HC5SKVSNlvKHXjYqV1GRAjt1lG_w,974
|
3
|
-
koro/file/bin.py,sha256=bW6Wm1u1sdDC457OUyuthNL3n7CMY-YAZx-8XwzOWvw,7590
|
4
|
-
koro/file/dir.py,sha256=pnMQJAQRlzcm_MC14goDeKlQ3llKhywM1FdADHM8xds,6632
|
5
|
-
koro/file/lvl.py,sha256=lrVpQyZFj1JlVPYx-OkcCne8VdjHCWQIuOX0pls1Dto,1130
|
6
|
-
koro/file/zip.py,sha256=qqyr-FmrgEj4xHuvhpCw_QMcieqIXrKn4xCYpITNAvQ,7435
|
7
|
-
koro/item/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
-
koro/item/group.py,sha256=bvKnQzXULy3dw-YA5Hn7E9ErbgZlMGxR-K2ucjYNnaw,1583
|
9
|
-
koro/item/level.py,sha256=KXiOK3RGC72WK4lduf3RO9Cs1zXaJRk0EfJCDndA4bs,3068
|
10
|
-
koro/item/save.py,sha256=LUV79vW3gY__jVVVG1kcYW-wzsGCRlYq126nulbT37Y,607
|
11
|
-
koro-1.1.6.dist-info/LICENSE,sha256=Q2ptU2E48gOsMzhYz_kqVovmJ5d1KzrblLyqD2_-fvY,1235
|
12
|
-
koro-1.1.6.dist-info/METADATA,sha256=C6SlospRWQZyUSD0jPKhDgX6IEflZeAvByp_VNDBgak,628
|
13
|
-
koro-1.1.6.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
14
|
-
koro-1.1.6.dist-info/top_level.txt,sha256=Msq6ssMwv56hnBQqwaTdJJkxM7x7BZ-3JfQbkepQAEY,5
|
15
|
-
koro-1.1.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|