Files
dockipelago/worlds/clair_obscur/Items.py
Jonathan Tinney 7971961166
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
add schedule I, sonic 1/frontiers/heroes, spirit island
2026-04-02 23:46:36 -07:00

57 lines
1.6 KiB
Python

from typing import Dict, Optional, List, Set
from BaseClasses import Item, ItemClassification
from .Const import BASE_OFFSET
from .Data import data, ClairObscurItemData
class ClairObscurItem(Item):
game = "Clair Obscur Expedition 33"
def __init__(self, name: str, classification: ItemClassification, ap_id: Optional[int], player: int) -> None:
super().__init__(name, classification, ap_id, player)
def offset_item_value(item_id: int) -> int:
"""
Returns the AP item id for a given item value
"""
return BASE_OFFSET + item_id
def reverse_offset_item_value(item_id: int) -> int:
"""
Returns the item value for a given AP item id
"""
return item_id - BASE_OFFSET
def create_item_name_to_ap_id() -> Dict[str, int]:
"""
Creates a map from item name to their AP item id
"""
name_to_ap_id = {}
for item_id, attributes in data.items.items():
name_to_ap_id[attributes.name] = offset_item_value(item_id)
return name_to_ap_id
def get_classification(item_id: int) -> ItemClassification:
return data.items[reverse_offset_item_value(item_id)].classification
def create_item_groups(items: Dict[int, ClairObscurItemData]) -> Dict[str, Set[str]]:
item_groups: Dict[str, Set[str]] = {
"Upgrade material": set(),
"Exploration capacities": set(),
"Quest item": set(),
"Journal": set(),
"Picto": set(),
"Weapon": set(),
"Character": set(),
"Area": set(),
"Trap": set()
}
for item in items.keys():
item_groups[items[item].type].add(items[item].name)
return item_groups