Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion schemas/Manual.items.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@
"type": ["boolean", "integer"],
"default": false
},
"id": {
"description": "(Optional) Skips the item ID forward to the given value.\nThis can be used to provide buffer space for future items.",
"type": "integer"
},
"_comment": {"$ref": "#/definitions/comment"}
},
"required": ["name"]
Expand All @@ -107,4 +111,4 @@
}
}
}
}
}
6 changes: 5 additions & 1 deletion schemas/Manual.locations.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@
"type": "boolean",
"default": false
},
"id": {
"description": "(Optional) Skips the item ID forward to the given value.\nThis can be used to provide buffer space for future items.",
"type": "integer"
},
"_comment": {"$ref": "#/definitions/comment"}
}
},
Expand All @@ -118,4 +122,4 @@
}
}
}
}
}
7 changes: 7 additions & 0 deletions src/Items.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@

# add sequential generated ids to the lists
for key, val in enumerate(item_table):
if "id" in item_table[key]:
item_id = item_table[key]["id"]
if item_id >= count:
count = item_id
else:
raise ValueError(f"{item_table[key]['name']} has an invalid ID. ID must be at least {count + 1}")

item_table[key]["id"] = count
item_table[key]["progression"] = val["progression"] if "progression" in val else False
count += 1
Expand Down
7 changes: 7 additions & 0 deletions src/Locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
if "victory" in location_table[key] and location_table[key]["victory"]:
victory_names.append(location_table[key]["name"])

if "id" in location_table[key]:
item_id = location_table[key]["id"]
if item_id >= count:
count = item_id
else:
raise ValueError(f"{location_table[key]['name']} has an invalid ID. ID must be at least {count + 1}")

location_table[key]["id"] = count

if not "region" in location_table[key]:
Expand Down