-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitems.py
82 lines (54 loc) · 1.68 KB
/
items.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
from typing import List, Type
from rng import RNG
class Item:
uid: int
seed: int
verbose: int
name: str
def __init__(self, uid: int, seed: int, verbose: int = 0):
self.uid = uid
self.seed = seed
self.verbose = verbose
verbose_str: str = ""
if verbose > 2:
verbose_str += (
"Item id: " + str(self.uid) + " (Seed: " + str(hex(self.seed)) + ")"
)
class Collectible(Item):
name: str = "Collectible"
class Pill(Item):
name: str = "Pill"
class Trinket(Item):
name: str = "Trinket"
class Card(Item):
name: str = "Card"
class ItemsArray:
item_class: Type[Item]
size: int
def __init__(self, seed_generator: RNG, verbose: int = 0):
if not hasattr(self, "item_class"):
raise AttributeError("Base class cannot be instanced directly")
self.seed_generator = seed_generator
self.verbose = verbose
self.items: List[Item] = []
verbose_str: str = ""
if verbose > 0:
verbose_str += "Generating Items Array: " + self.__class__.__name__
if verbose_str:
print(verbose_str)
for var in range(0, self.size):
self.items.append(
self.item_class(var, self.seed_generator.next(), self.verbose)
)
class CollectiblesArray(ItemsArray):
item_class: Type[Item] = Collectible
size: int = 0x2DB
class TrinketsArray(ItemsArray):
item_class: Type[Item] = Trinket
size: int = 0xBE
class PillsArray(ItemsArray):
item_class: Type[Item] = Pill
size: int = 0x32
class CardsArray(ItemsArray):
item_class: Type[Item] = Card
size: int = 0x62