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
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
from collections.abc import Mapping
|
|
from types import MappingProxyType
|
|
from typing import Final
|
|
|
|
from BaseClasses import Item, ItemClassification
|
|
from .Data import portals, obelisks, mirror_shards
|
|
|
|
|
|
class ItemData:
|
|
id: int
|
|
item_name: str
|
|
progression: ItemClassification
|
|
rom_id: int
|
|
frequency: int
|
|
|
|
def __init__(self, id: int | None = 0, item_name: str = "", progression: int = 0, rom_id: str = "0x0", frequency: int = 1):
|
|
self.id = id
|
|
self.item_name = item_name
|
|
self.progression = ItemClassification(progression)
|
|
self.rom_id = int(rom_id, 16)
|
|
self.frequency = frequency
|
|
|
|
|
|
|
|
class GLItem(Item):
|
|
game: str = "Gauntlet Legends"
|
|
|
|
def import_items() -> tuple[ItemData, ...]:
|
|
import json
|
|
import pkgutil
|
|
|
|
return json.loads(pkgutil.get_data(__name__, "json/items.json").decode("utf-8"), object_hook=lambda d: ItemData(**d))
|
|
|
|
item_list: Final[tuple[ItemData, ...]] = import_items()
|
|
item_table: Final[Mapping[str, ItemData]] = MappingProxyType({item.item_name: item for item in item_list})
|
|
items_by_id: Final[Mapping[int, ItemData]] = MappingProxyType({item.id: item for item in item_list})
|
|
|
|
gauntlet_item_name_groups = {
|
|
"Runestone": [f"Runestone {i}" for i in range(1, 14)],
|
|
"Portal": portals.keys(),
|
|
"Obelisk": obelisks,
|
|
"Mirror Shard": mirror_shards
|
|
}
|