Files
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

31 lines
1.1 KiB
Python

from typing import Any
def build_location_name_to_id_dict(data: dict[str, dict[str, Any]]) -> dict[str, int]:
location_name_to_id: dict[str, int] = {}
for loc_name, location in data.items():
if "id" in location:
index = location["id"]
elif location["flag_byte"] is not None:
index = location["flag_byte"] * 0x100 + (location["bit_mask"] if "bit_mask" in location else 0x20)
else:
continue
location_name_to_id[loc_name] = index
return location_name_to_id
def build_item_name_to_id_dict(data: dict[str, dict[str, Any]]) -> dict[str, int]:
item_name_to_id: dict[str, int] = {}
for item_name, item in data.items():
index = item["id"] * 0x100 + (item["subid"] if "subid" in item else 0)
item_name_to_id[item_name] = index
return item_name_to_id
def build_item_id_to_name_dict(data: dict[str, dict[str, Any]]) -> dict[int, str]:
item_id_to_name: dict[int, str] = {}
for item_name, item in data.items():
index = item["id"] * 0x100 + (item["subid"] if "subid" in item else 0)
item_id_to_name[index] = item_name
return item_id_to_name