Initialize local project and fix ranch growth synchronization

This commit is contained in:
AttilaNet
2026-11-07 22:14:49 +08:00
commit 657f5f33b5
1417 changed files with 202171 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
from dataclasses import dataclass
from .quests import condition_ok, indexed
@dataclass
class Stage:
stage_id: str
level: str
name: str
city: int
unlocked: bool
passed: bool
open: bool
stamina: int
tickets: str
def stages(catalog, snapshot):
history = snapshot.raw.get("history", {})
result = []
for key, row in catalog.data["stage_info"].items():
special = catalog.data.get("stage_sp", {}).get(key, {})
opened = not row.get("closed") and condition_ok(special.get("condition"), snapshot)
for level, info in row.get("level", {}).items():
unlocked = indexed(indexed(history.get("unlockStage"), key), level, False) == True
passed = indexed(indexed(history.get("passStage"), key), level, False) == True
base = row.get("cost") or {}
tickets = ", ".join(f"{i['typeId']}×{i['num']}" for i in base.get("items", []))
result.append(Stage(key, str(level), row.get("name", key), int(row.get("city", 0)), unlocked, passed, opened,
int(base.get("ti", 0)) + int(info.get("cost", 0)), tickets))
return result