summary refs log tree commit diff stats
path: root/items.py
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-03-21 10:46:53 -0500
committerGitHub <noreply@github.com>2024-03-21 16:46:53 +0100
commitcb83f8d340ee13746ce2c63c7cd1b247244eb65a (patch)
treef8a25fead6c0089dc78c7335b18518651cc7fad8 /items.py
parente016228d2b76fa367889c9d98d6eb9e783f98cb4 (diff)
downloadlingo-apworld-cb83f8d340ee13746ce2c63c7cd1b247244eb65a.tar.gz
lingo-apworld-cb83f8d340ee13746ce2c63c7cd1b247244eb65a.tar.bz2
lingo-apworld-cb83f8d340ee13746ce2c63c7cd1b247244eb65a.zip
Lingo: Add item/location groups (#2789)
Diffstat (limited to 'items.py')
-rw-r--r--items.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/items.py b/items.py index 623cd79..b9c4eb7 100644 --- a/items.py +++ b/items.py
@@ -42,14 +42,16 @@ class LingoItem(Item):
42 42
43 43
44ALL_ITEM_TABLE: Dict[str, ItemData] = {} 44ALL_ITEM_TABLE: Dict[str, ItemData] = {}
45ITEMS_BY_GROUP: Dict[str, List[str]] = {}
45 46
46 47
47def load_item_data(): 48def load_item_data():
48 global ALL_ITEM_TABLE 49 global ALL_ITEM_TABLE, ITEMS_BY_GROUP
49 50
50 for color in ["Black", "Red", "Blue", "Yellow", "Green", "Orange", "Gray", "Brown", "Purple"]: 51 for color in ["Black", "Red", "Blue", "Yellow", "Green", "Orange", "Gray", "Brown", "Purple"]:
51 ALL_ITEM_TABLE[color] = ItemData(get_special_item_id(color), ItemClassification.progression, 52 ALL_ITEM_TABLE[color] = ItemData(get_special_item_id(color), ItemClassification.progression,
52 "colors", [], []) 53 "colors", [], [])
54 ITEMS_BY_GROUP.setdefault("Colors", []).append(color)
53 55
54 door_groups: Dict[str, List[str]] = {} 56 door_groups: Dict[str, List[str]] = {}
55 for room_name, doors in DOORS_BY_ROOM.items(): 57 for room_name, doors in DOORS_BY_ROOM.items():
@@ -57,11 +59,11 @@ def load_item_data():
57 if door.skip_item is True or door.event is True: 59 if door.skip_item is True or door.event is True:
58 continue 60 continue
59 61
60 if door.group is None: 62 if door.door_group is None:
61 door_mode = "doors" 63 door_mode = "doors"
62 else: 64 else:
63 door_mode = "complex door" 65 door_mode = "complex door"
64 door_groups.setdefault(door.group, []) 66 door_groups.setdefault(door.door_group, [])
65 67
66 if room_name in PROGRESSION_BY_ROOM and door_name in PROGRESSION_BY_ROOM[room_name]: 68 if room_name in PROGRESSION_BY_ROOM and door_name in PROGRESSION_BY_ROOM[room_name]:
67 door_mode = "special" 69 door_mode = "special"
@@ -70,10 +72,15 @@ def load_item_data():
70 ItemData(get_door_item_id(room_name, door_name), 72 ItemData(get_door_item_id(room_name, door_name),
71 ItemClassification.filler if door.junk_item else ItemClassification.progression, door_mode, 73 ItemClassification.filler if door.junk_item else ItemClassification.progression, door_mode,
72 door.has_doors, door.painting_ids) 74 door.has_doors, door.painting_ids)
75 ITEMS_BY_GROUP.setdefault("Doors", []).append(door.item_name)
76
77 if door.item_group is not None:
78 ITEMS_BY_GROUP.setdefault(door.item_group, []).append(door.item_name)
73 79
74 for group, group_door_ids in door_groups.items(): 80 for group, group_door_ids in door_groups.items():
75 ALL_ITEM_TABLE[group] = ItemData(get_door_group_item_id(group), 81 ALL_ITEM_TABLE[group] = ItemData(get_door_group_item_id(group),
76 ItemClassification.progression, "door group", True, []) 82 ItemClassification.progression, "door group", True, [])
83 ITEMS_BY_GROUP.setdefault("Doors", []).append(group)
77 84
78 special_items: Dict[str, ItemClassification] = { 85 special_items: Dict[str, ItemClassification] = {
79 ":)": ItemClassification.filler, 86 ":)": ItemClassification.filler,
@@ -90,6 +97,11 @@ def load_item_data():
90 ALL_ITEM_TABLE[item_name] = ItemData(get_special_item_id(item_name), classification, 97 ALL_ITEM_TABLE[item_name] = ItemData(get_special_item_id(item_name), classification,
91 "special", False, []) 98 "special", False, [])
92 99
100 if classification == ItemClassification.filler:
101 ITEMS_BY_GROUP.setdefault("Junk", []).append(item_name)
102 elif classification == ItemClassification.trap:
103 ITEMS_BY_GROUP.setdefault("Traps", []).append(item_name)
104
93 for item_name in PROGRESSIVE_ITEMS: 105 for item_name in PROGRESSIVE_ITEMS:
94 ALL_ITEM_TABLE[item_name] = ItemData(get_progressive_item_id(item_name), 106 ALL_ITEM_TABLE[item_name] = ItemData(get_progressive_item_id(item_name),
95 ItemClassification.progression, "special", False, []) 107 ItemClassification.progression, "special", False, [])