Skip to content
Open
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
.vscode/
.vs/
/*.code-workspace
.idea
.idea
.venv/
6 changes: 6 additions & 0 deletions schemas/Manual.items.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@
}
}
},
"classification": {
"description": "(Optional) The classification of this item.",
"type": "string",
"enum": ["filler", "trap", "useful", "progression", "progression, skip_balancing", "trap, useful", "trap, progression", "trap, progression, skip_balancing"],
"default": "filler"
},
"progression": {
"description": "(Optional) Is this item needed to unlock locations? For more information on item classifications, see: https://github.com/ArchipelagoMW/Archipelago/blob/main/docs/world%20api.md#items",
"type": "boolean",
Expand Down
8 changes: 8 additions & 0 deletions src/DataValidation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from functools import reduce
import logging
import re
import json
Expand Down Expand Up @@ -207,6 +208,13 @@ def checkItemsThatShouldBeRequired():
# progression_skip_balancing is also progression, so no check needed
if item.get("progression_skip_balancing"):
continue

# if the string classification contains progresion then no check needed
if item.get("classification"):
classification = reduce((lambda a, b: a | b), {ItemClassification[str_classification.strip()] for str_classification in item["classification"].split(",")})
if ItemClassification.progression in classification:
continue

# if any of the advanced type is already progression then no check needed
if item.get("classification_count"):
has_progression = False
Expand Down
6 changes: 4 additions & 2 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from functools import reduce
import logging
import os
from typing import Callable, Optional, ClassVar, Counter, Any
Expand Down Expand Up @@ -269,7 +270,6 @@ def create_item(self, name: str, class_override: Optional['ItemClassification']=
classification: ItemClassification = ItemClassification.filler
if class_override is not None:
classification = class_override

elif item.get("classification_count"):
# This should only be run if create_item is called outside of create_items
not_prog_classes: list[ItemClassification] = []
Expand All @@ -285,8 +285,10 @@ def create_item(self, name: str, class_override: Optional['ItemClassification']=
classification |= self.random.choice(progression_classes)
elif not_prog_classes:
classification |= not_prog_classes[0]

else:
if item.get("classification"):
classification = reduce((lambda a, b: a | b), {ItemClassification[str_classification.strip()] for str_classification in item["classification"].split(",")})

if item.get("trap"):
classification |= ItemClassification.trap

Expand Down
2 changes: 1 addition & 1 deletion src/data/items.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"Characters",
"Right Side"
],
"progression": true,
"classification": "progression",
"sort-key": "row-1-6"
},
{
Expand Down