From 5396ebd84f32cac325068afd92594d997a191988 Mon Sep 17 00:00:00 2001 From: wrjones104 Date: Fri, 26 Jun 2026 15:31:01 -0400 Subject: [PATCH 1/2] fix(item_rewards.py): skip "Empty" items and handle missing item qualities This commit updates the `item_rewards.py` file to address two issues: 1. It skips processing for items named "Empty". 2. It ensures that items not present in `chest_item_tiers` are handled by adding them with a default quality level. --- worlds/ff6wc/item_rewards.py | 44 ++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/worlds/ff6wc/item_rewards.py b/worlds/ff6wc/item_rewards.py index f823d84ae160..b50c420ffa5a 100644 --- a/worlds/ff6wc/item_rewards.py +++ b/worlds/ff6wc/item_rewards.py @@ -80,7 +80,10 @@ def build_ir_from_placements(wc_event_locations: list[Location]) -> list[str]: if loc.item and loc.item.player == loc.player: ap_item_id = loc.item.code if ap_item_id in inventory_item_ap_id_to_name: - wc_item_id = Rom.item_name_id[inventory_item_ap_id_to_name[ap_item_id]] + item_name = inventory_item_ap_id_to_name[ap_item_id] + if item_name == "Empty": + continue + wc_item_id = Rom.item_name_id[item_name] items_in_wc_event_locations[loc.name] = wc_item_id items_in_wc_event_locations_list = sorted(set(items_in_wc_event_locations.values())) @@ -109,6 +112,15 @@ def item_qualities() -> Mapping[int, int]: for item_tier, key in zip(tiers, sort_keys, strict=True): for wc_id in item_tier: qualities[wc_id] = key + + # Add items not present in chest_item_tiers + if "Cursed Shld" in Rom.item_name_id: + qualities[Rom.item_name_id["Cursed Shld"]] = 1 + if "ArchplgoItem" in Rom.item_name_id: + qualities[Rom.item_name_id["ArchplgoItem"]] = 1 + if "Empty" in Rom.item_name_id: + qualities[Rom.item_name_id["Empty"]] = 10 + return qualities @@ -126,14 +138,17 @@ def limit_event_items(wc_event_locations: list[Location], random: Random) -> Non if loc.item and loc.item.player == loc.player: ap_item_id = loc.item.code if ap_item_id in inventory_item_ap_id_to_name: - wc_item_id = Rom.item_name_id[inventory_item_ap_id_to_name[ap_item_id]] + item_name = inventory_item_ap_id_to_name[ap_item_id] + if item_name == "Empty": + continue + wc_item_id = Rom.item_name_id[item_name] items_in_wc_event_locations[loc.name] = wc_item_id locations_by_name[loc.name] = loc qualities = item_qualities() def sort_key(wc_item_id: int) -> int: - return qualities[wc_item_id] + return qualities.get(wc_item_id, 10) items_by_quality = sorted(set(items_in_wc_event_locations.values()), key=sort_key) @@ -144,14 +159,15 @@ def sort_key(wc_item_id: int) -> int: # print(f"{[Rom.item_id_name_weight[i_id][0] for i_id in smaller_set]=}") - for loc_name, loc in locations_by_name.items(): - wc_item_id = items_in_wc_event_locations[loc_name] - if wc_item_id not in smaller_set: - replacement = random.choice(smaller_set) - replacement_name = Rom.item_id_name_weight[replacement][0] - replacement_code = item_name_to_id[replacement_name] - assert loc.item, f"{loc=}" - loc.item.name = replacement_name - loc.item.code = replacement_code - loc.item.classification = ItemClassification.useful - loc.locked = True + if smaller_set: + for loc_name, loc in locations_by_name.items(): + wc_item_id = items_in_wc_event_locations[loc_name] + if wc_item_id not in smaller_set: + replacement = random.choice(smaller_set) + replacement_name = Rom.item_id_name_weight[replacement][0] + replacement_code = item_name_to_id[replacement_name] + assert loc.item, f"{loc=}" + loc.item.name = replacement_name + loc.item.code = replacement_code + loc.item.classification = ItemClassification.useful + loc.locked = True From e1b0c4a53431ec3f0217c600231bf30af839c56d Mon Sep 17 00:00:00 2001 From: wrjones104 Date: Sat, 27 Jun 2026 15:47:46 -0400 Subject: [PATCH 2/2] Remove incorrect 'Empty' If --- worlds/ff6wc/item_rewards.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/worlds/ff6wc/item_rewards.py b/worlds/ff6wc/item_rewards.py index b50c420ffa5a..a43625f1fecf 100644 --- a/worlds/ff6wc/item_rewards.py +++ b/worlds/ff6wc/item_rewards.py @@ -81,8 +81,6 @@ def build_ir_from_placements(wc_event_locations: list[Location]) -> list[str]: ap_item_id = loc.item.code if ap_item_id in inventory_item_ap_id_to_name: item_name = inventory_item_ap_id_to_name[ap_item_id] - if item_name == "Empty": - continue wc_item_id = Rom.item_name_id[item_name] items_in_wc_event_locations[loc.name] = wc_item_id