v0.4.0: Cloudflare Pages deploy tooling, items search in URL, spirit bear patch lookup

This commit is contained in:
voson
2026-07-27 16:28:31 +08:00
parent 1d0428b4a3
commit adb8f303c2
13 changed files with 674 additions and 27 deletions
+8
View File
@@ -50,6 +50,10 @@ HERO_ABILITIES_PATH = DATA / "hero_abilities.json"
DEFAULT_WINDOW_DAYS = 365
# Bundled shared badges — never fetched from CDN (many innate keys 404).
SKIP_ABILITY_ICON_KEYS = frozenset({"innate", "talent_tree"})
# Non-hero units that Valve places in patchnotes heroes[] under a pseudo hero_id
# absent from herolist. Resolve to a Chinese name + portrait key so the preview
# never shows #1961. Portrait files live in assets/hero_portraits/<key>.png.
UNIT_NAMES = {1961: {"key": "spirit_bear", "name_loc": "熊灵"}}
def _date(ts: int) -> str:
@@ -231,6 +235,10 @@ def build_lookup(
meta = hero_index.get(hid)
if meta:
heroes[str(hid)] = {"key": meta["key"], "name_loc": meta["name_loc"]}
elif hid in UNIT_NAMES:
# Non-hero unit (e.g. 1961 = 熊灵): bundled portrait in hero_portraits.
u = UNIT_NAMES[hid]
heroes[str(hid)] = {"key": u["key"], "name_loc": u["name_loc"]}
return {"items": items, "abilities": abilities, "heroes": heroes}