Add decoding for Monopoly reward keys and switch reward metadata to be looked up by decoded id. Implement decode_reward_key() and infer_reward_type(); replace the previous raw-key KNOWN_REWARDS approach with REWARDS_BY_ID built from mappings/*.json. Add mappings/items.json and expand mappings/arcs.json. Update decoder to produce reward_id, use REWARDS_BY_ID, and change guess_quantity() to accept reward_id. Refactor pool_mappings to reuse the new mapping loader, and update tests and docs to validate mapping files and document the reward key encoding/behavior.
28 lines
827 B
Python
28 lines
827 B
Python
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from nte_history_exporter.mappings import load_mapping_file
|
|
|
|
POOL_MAPPING_FILES = {
|
|
"permanent": "permanent_board.json",
|
|
"limited_character": "limited_character_board.json",
|
|
"arc_miracle_box": "arc_miracle_box.json",
|
|
}
|
|
|
|
|
|
def load_pool_mapping(pool_key: str) -> dict[str, Any]:
|
|
return load_mapping_file(POOL_MAPPING_FILES[pool_key])
|
|
|
|
|
|
def load_pool_mappings() -> dict[str, dict[str, Any]]:
|
|
return {pool_key: load_pool_mapping(pool_key) for pool_key in POOL_MAPPING_FILES}
|
|
|
|
|
|
def pool_meta_from_mapping(mapping: dict[str, Any]) -> dict[str, Any]:
|
|
return {
|
|
"id": mapping["banner"]["id"],
|
|
"name": mapping["banner"]["name"],
|
|
"system": mapping["system"]["name"],
|
|
"shared_pity": mapping["banner"]["shared_pity"],
|
|
}
|