forked from mirror/Archipelago
Some checks failed
Analyze modified files / flake8 (push) Failing after 2m28s
Build / build-win (push) Has been cancelled
Build / build-ubuntu2204 (push) Has been cancelled
ctest / Test C++ ubuntu-latest (push) Has been cancelled
ctest / Test C++ windows-latest (push) Has been cancelled
Analyze modified files / mypy (push) Has been cancelled
Build and Publish Docker Images / Push Docker image to Docker Hub (push) Successful in 5m4s
Native Code Static Analysis / scan-build (push) Failing after 5m2s
type check / pyright (push) Successful in 1m7s
unittests / Test Python 3.11.2 ubuntu-latest (push) Failing after 16m23s
unittests / Test Python 3.12 ubuntu-latest (push) Failing after 28m19s
unittests / Test Python 3.13 ubuntu-latest (push) Failing after 14m49s
unittests / Test hosting with 3.13 on ubuntu-latest (push) Successful in 5m0s
unittests / Test Python 3.13 macos-latest (push) Has been cancelled
unittests / Test Python 3.11 windows-latest (push) Has been cancelled
unittests / Test Python 3.13 windows-latest (push) Has been cancelled
34 lines
1018 B
Python
34 lines
1018 B
Python
import typing
|
|
|
|
from BaseClasses import Item, ItemClassification
|
|
from .Data import item_classifications
|
|
|
|
|
|
class ItemData:
|
|
id: int
|
|
item_name: str
|
|
progression: ItemClassification
|
|
rom_id: int
|
|
frequency: int = 1
|
|
|
|
def __init__(self, id: int | None, item_name: str, progression: str, rom_id: int = 0x0, frequency: int = 1):
|
|
self.id = id
|
|
self.item_name = item_name
|
|
self.progression = item_classifications[progression]
|
|
self.rom_id = rom_id
|
|
self.frequency = frequency
|
|
|
|
|
|
class TTYDItem(Item):
|
|
game: str = "Paper Mario: The Thousand-Year Door"
|
|
|
|
def import_items() -> typing.List[ItemData]:
|
|
import json
|
|
import pkgutil
|
|
|
|
return json.loads(pkgutil.get_data(__name__, "json/items.json").decode("utf-8"), object_hook=lambda d: ItemData(**d))
|
|
|
|
itemList: typing.List[ItemData] = import_items()
|
|
item_table: typing.Dict[str, ItemData] = {item.item_name: item for item in itemList}
|
|
items_by_id: typing.Dict[int, ItemData] = {item.id: item for item in itemList}
|