fix(web): finalize quick battle and commission procurement for 2.0.9

This commit is contained in:
AttilaNet
2026-11-13 11:28:14 +08:00
parent cfce3e0bc5
commit 7845751cf6
21 changed files with 2442 additions and 117 deletions
+23 -3
View File
@@ -7,6 +7,26 @@ from .model import Action, Planner, seconds
CN = timezone(timedelta(hours=8))
def commission_reason_kind(reason):
text = str(reason or "")
for kind, words in (
("quota", ("次数已用完", "次数已耗尽", "额度已用完")),
("city_locked", ("城市尚未解锁", "城市未解锁", "城市仍未解锁", "城市还未解锁")),
("offline", ("离线", "未登录", "登录失效", "offline")),
("uncertain_write", ("未确认请求", "待核对", "结果不明", "禁止重发")),
("cooldown", ("冷却", "孵化/成长中", "开放时段", "开放日期", "开放星期", "跨日")),
("busy", ("已有委托", "正在探索", "占用", "忙碌", "busy")),
("protection", ("保护", "保留种类", "锁定")),
("temp_resource", ("不足", "金币", "体力", "可提交", "可用", "缺口")),
("prerequisite", ("前置", "前提", "引导", "图鉴", "角色等级", "关卡尚未", "入口关卡")),
("policy", ("未启用", "策略限定", "未开启", "限定城市")),
("model_unsupported", ("未支持", "尚不支持", "未验证", "尚未验证", "Unsupported", "运行时", "模拟器", "配置缺失")),
):
if any(word in text for word in words):
return kind
return "ready" if not text or text in ("可接取", "资源已齐备") else "prerequisite"
def commission_priority(info):
try:
reward = int((info.get("reward") or {}).get("ke") or 0)
@@ -234,10 +254,10 @@ class TaskPlanner:
rejected.append(candidate | {"reason": reason})
return []
def reservations(self, snapshot):
def reservations(self, snapshot, *, extra_tasks=()):
types, eggs = set(), {}
for task in self.current(snapshot):
info = self.catalog.data["task_info"][str(task["typeId"])]
for task in [*self.current(snapshot), *extra_tasks]:
info = task.get("info") or self.catalog.data["task_info"][str(task["typeId"])]
for step in info.get("steps", [])[max(0, int(task.get("curStep", 1)) - 1):]:
value = step.get("statusValue") or {}
key = str(value.get("type", ""))