Keep multi-account refresh responsive and batch monster feeding

This commit is contained in:
AttilaNet
2026-11-08 00:24:21 +08:00
parent 5f0a9eaac3
commit 67b4658e00
23 changed files with 780 additions and 107 deletions
+4 -3
View File
@@ -37,14 +37,15 @@ class SweepRunner:
def team_ids(self, snapshot, policy):
team = next((t for t in snapshot.raw.get("teams", []) if t.get("teamName") == policy.team and t.get("teamType") == "battleTeam"), {})
ids = [int(mid) for mid in team.get("monsters", []) if mid and int(mid) > 0]
return [mid for mid in ids if mid in snapshot.monsters]
monsters = snapshot.monsters
return [mid for mid in ids if mid in monsters]
def reason(self, snapshot, stage, policy):
def reason(self, snapshot, stage, policy, *, team_ids=None):
if self.state.get("pending"):
return "有未完成的扫荡,请先在游戏内检查"
if not stage.sweep:
return stage.reason
if not self.team_ids(snapshot, policy):
if not (self.team_ids(snapshot, policy) if team_ids is None else team_ids):
return "所选战队无有效魔物"
positions = self.catalog.data.get("stage_task_positions", {})
for task in snapshot.raw.get("currentTasks", []):