|
2 | 2 | from .LocationList import location_table
|
3 | 3 | from BaseClasses import Location
|
4 | 4 |
|
| 5 | +non_indexed_location_types = {'Boss', 'Event', 'Drop', 'HintStone', 'Hint'} |
| 6 | + |
5 | 7 | location_id_offset = 67000
|
6 | 8 | locnames_pre_70 = {
|
7 | 9 | "Gift from Sages",
|
|
18 | 20 | else 0)
|
19 | 21 |
|
20 | 22 | location_name_to_id = {name: (location_id_offset + index) for (index, name) in enumerate(new_name_order)
|
21 |
| - if location_table[name][0] not in {'Boss', 'Event', 'Drop', 'HintStone', 'Hint'}} |
| 23 | + if location_table[name][0] not in non_indexed_location_types} |
22 | 24 |
|
23 | 25 | class DisableType(Enum):
|
24 | 26 | ENABLED = 0
|
@@ -83,3 +85,57 @@ def LocationFactory(locations, player: int):
|
83 | 85 | return ret
|
84 | 86 |
|
85 | 87 |
|
| 88 | +def build_location_name_groups() -> dict: |
| 89 | + |
| 90 | + def fix_sing(t) -> tuple: |
| 91 | + if isinstance(t, str): |
| 92 | + return (t,) |
| 93 | + return t |
| 94 | + |
| 95 | + def rename(d, k1, k2) -> None: |
| 96 | + d[k2] = d[k1] |
| 97 | + del d[k1] |
| 98 | + |
| 99 | + # whoever wrote the location table didn't realize they need to add a comma to mark a singleton as a tuple |
| 100 | + # so we have to check types unfortunately |
| 101 | + tags = set() |
| 102 | + for v in location_table.values(): |
| 103 | + if v[5] is not None: |
| 104 | + tags.update(fix_sing(v[5])) |
| 105 | + |
| 106 | + sorted_tags = sorted(list(tags)) |
| 107 | + |
| 108 | + ret = { |
| 109 | + tag: {k for k, v in location_table.items() |
| 110 | + if v[5] is not None |
| 111 | + and tag in fix_sing(v[5]) |
| 112 | + and v[0] not in non_indexed_location_types} |
| 113 | + for tag in sorted_tags |
| 114 | + } |
| 115 | + |
| 116 | + # Delete tags which are a combination of other tags |
| 117 | + del ret['Death Mountain'] |
| 118 | + del ret['Forest'] |
| 119 | + del ret['Gerudo'] |
| 120 | + del ret['Kakariko'] |
| 121 | + del ret['Market'] |
| 122 | + |
| 123 | + # Delete Vanilla and MQ tags because they are just way too broad |
| 124 | + del ret['Vanilla'] |
| 125 | + del ret['Master Quest'] |
| 126 | + |
| 127 | + rename(ret, 'Beehive', 'Beehives') |
| 128 | + rename(ret, 'Cow', 'Cows') |
| 129 | + rename(ret, 'Crate', 'Crates') |
| 130 | + rename(ret, 'Deku Scrub', 'Deku Scrubs') |
| 131 | + rename(ret, 'FlyingPot', 'Flying Pots') |
| 132 | + rename(ret, 'Freestanding', 'Freestanding Items') |
| 133 | + rename(ret, 'Pot', 'Pots') |
| 134 | + rename(ret, 'RupeeTower', 'Rupee Groups') |
| 135 | + rename(ret, 'SmallCrate', 'Small Crates') |
| 136 | + rename(ret, 'the Market', 'Market') |
| 137 | + rename(ret, 'the Graveyard', 'Graveyard') |
| 138 | + rename(ret, 'the Lost Woods', 'Lost Woods') |
| 139 | + |
| 140 | + return ret |
| 141 | + |
0 commit comments