Files
dockipelago/worlds/tloz_ph/Util.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

69 lines
2.4 KiB
Python

from typing import Dict
from .data import LOCATIONS_DATA, DYNAMIC_FLAGS
from .data.Items import ITEMS
from .data.Hints import HINT_DATA
from .data.Entrances import ENTRANCES
def build_entrance_id_to_data():
entrances = {}
for i in ENTRANCES.values():
entrances[i.id] = i
return entrances
def build_hint_scene_to_watches() -> dict[int, list[str]]:
hint_room_to_watches: dict[int, list[str]] = {}
for name, data in HINT_DATA.items():
for scene in data["scenes"]:
hint_room_to_watches.setdefault(scene, [])
hint_room_to_watches[scene].append(name)
return hint_room_to_watches
def build_location_room_to_watches() -> Dict[int, dict[str, dict]]:
location_room_to_watches: Dict[int, dict[str, dict]] = {}
for loc_name, location in LOCATIONS_DATA.items():
room_id = location["stage_id"] * 0x100 + location["floor_id"]
location_room_to_watches.setdefault(room_id, {})
location_room_to_watches[room_id][loc_name] = location
# Add location to multiple rooms
if "additional_rooms" in location:
for room in location["additional_rooms"]:
location_room_to_watches.setdefault(room, {})
location_room_to_watches[room][loc_name] = location
return location_room_to_watches
def build_scene_to_dynamic_flag() -> Dict[int, list[dict]]:
scene_to_dynamic_flag: Dict[int, list[dict]] = {}
for flag_name, data in DYNAMIC_FLAGS.items():
data["name"] = flag_name
for scene in data.get("on_scenes", []):
scene_to_dynamic_flag.setdefault(scene, [])
scene_to_dynamic_flag[scene].append(data)
return scene_to_dynamic_flag
def build_location_name_to_id_dict() -> Dict[str, int]:
location_name_to_id: Dict[str, int] = {}
for loc_name, location in LOCATIONS_DATA.items():
# ids are for sending flags
location_name_to_id[loc_name] = location["id"]
return location_name_to_id
def build_item_name_to_id_dict() -> Dict[str, int]:
item_name_to_id: Dict[str, int] = {}
for item_name, item in ITEMS.items():
item_name_to_id[item_name] = item.id
return item_name_to_id
def build_item_id_to_name_dict() -> Dict[int, str]:
item_id_to_name: Dict[int, str] = {}
for item_name, item in ITEMS.items():
index = item.id
item_id_to_name[index] = item_name
return item_id_to_name