Skip to content

Commit

Permalink
added furnitureinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
MelonSpeedruns committed Nov 22, 2024
1 parent fc7cb17 commit d050be6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
1 change: 1 addition & 0 deletions worlds/luigimansion/LMGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def __init__(self, clean_iso_path, randomized_output_folder, export_disc_to_fold

# furnitureinfo
furniture_info_entry = JMPInfoFile(main_mansion_file, 'furnitureinfo')
update_furniture_info(furniture_info_entry, item_appear_table_entry, output_data)
furniture_info_entry.update_info_file_bytes()
main_mansion_file = self.update_rarc_info_entry(main_mansion_file, 'furnitureinfo', furniture_info_entry.info_file_entry.data)

Expand Down
25 changes: 17 additions & 8 deletions worlds/luigimansion/Patching.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ def update_item_info_table(item_info_table_entry, output_data):
"is_escape": 0
}
item_info_table_entry.info_file_field_entries.append(new_item)
# [dict(t) for t in {tuple(d.items()) for d in treasure_table_entry.info_file_field_entries}]


def update_item_appear_table(item_appear_table_entry, output_data):
Expand Down Expand Up @@ -116,7 +115,6 @@ def update_item_appear_table(item_appear_table_entry, output_data):
"item19": item_name
}
item_appear_table_entry.info_file_field_entries.append(new_item)
# [dict(t) for t in {tuple(d.items()) for d in treasure_table_entry.info_file_field_entries}]


def update_treasure_table(treasure_table_entry, output_data):
Expand All @@ -128,7 +126,7 @@ def update_treasure_table(treasure_table_entry, output_data):
item_name = ""

if item_data["door_id"] == 0:
item_name = get_item_name(item_name, item_data)
item_name = get_item_name(item_data["name"], item_data)
chest_size = 2
else:
item_name = "key_" + str(item_data["door_id"])
Expand All @@ -155,11 +153,10 @@ def update_treasure_table(treasure_table_entry, output_data):
"camera": 1
}
treasure_table_entry.info_file_field_entries.append(new_item)
# [dict(t) for t in {tuple(d.items()) for d in treasure_table_entry.info_file_field_entries}]


def get_item_name(item_name, item_data):
if item_data["door_id"] != 0:
if item_data is not None and item_data["door_id"] != 0:
return get_key_name(item_data["door_id"])

match item_name:
Expand Down Expand Up @@ -187,7 +184,7 @@ def update_key_info(key_info_entry, output_data):
for item_name, item_data in output_data["Locations"].items():
if item_name == "Ghost Foyer Key":
for x in key_info_entry.info_file_field_entries[:]:
x["name"] = get_item_name(item_name, item_data)
x["name"] = get_item_name(item_data["name"], item_data)
x["open_door_no"] = item_data["door_id"]
x["appear_flag"] = 0
x["disappear_flag"] = 0
Expand All @@ -196,6 +193,18 @@ def update_key_info(key_info_entry, output_data):
break
for x in key_info_entry.info_file_field_entries[:]:
if item_data["type"] == "Freestanding":
x["name"] = get_item_name(item_name, item_data)
x["name"] = get_item_name(item_data["name"], item_data)
x["open_door_no"] = item_data["door_id"]
break
break

def update_furniture_info(furniture_info_entry, item_appear_table_entry, output_data):
for item_name, item_data in output_data["Locations"].items():
if item_data["type"] == "Furniture":
for y in item_appear_table_entry.info_file_field_entries:
if y["item0"].startswith("key_"):
if y["item0"] == "key_" + str(item_data["door_id"]):
furniture_info_entry.info_file_field_entries[item_data["loc_enum"]]["item_table"] = item_appear_table_entry.info_file_field_entries.index(y)
break
elif y["item0"] == get_item_name(item_data["name"], None):
furniture_info_entry.info_file_field_entries[item_data["loc_enum"]]["item_table"] = item_appear_table_entry.info_file_field_entries.index(y)
break

0 comments on commit d050be6

Please sign in to comment.