This website requires JavaScript.
0
Issues
Pull Requests
Milestones
Explore
0
Create…
New Repository
New Migration
New Organization
public
Signed in as
public
Profile
Starred
Subscriptions
Settings
Help
Sign Out
yws
/
lc-mcp
Watch
1
Star
0
Fork
0
Code
Issues
Pull Requests
Actions
Packages
Projects
Releases
Wiki
Activity
Files
lc-mcp
/
lc_mcp
/
or
Cancel
Edit File
Preview
Preview Changes
Spaces
Tabs
2
4
8
Wrap
No wrap
# -*- coding: utf-8 -*- """任务启动前的配置检查。 10-04/05 的几次长时间空转都源于配置: AALC 不报错, 只是一直原地打转。 这里把已知的坑在启动前拦下来, 返回人能看懂的原因。 check() 只吃普通 dict, 不依赖 AALC, 便于单测; collect() 负责从 AALC cfg 取值。 """ import os # 窗口边框 + 标题栏(100% 缩放下实测 16x39, 留一点余量) FRAME_W, FRAME_H = 16, 40 ALLOW_LUNACY_ENV = 'LCP_ALLOW_LUNACY' def collect(cfg): teams = {} for key, team in (cfg.get_value('teams') or {}).items(): data = team.model_dump() if hasattr(team, 'model_dump') else dict(team) teams[str(key)] = data return { 'simulator': bool(cfg.get_value('simulator')), 'mirror': bool(cfg.get_value('mirror')), 'set_win_size': int(cfg.get_value('set_win_size')), 'set_lunacy_to_enkephalin': int(cfg.get_value('set_lunacy_to_enkephalin') or 0), 'teams_active_queue': list(cfg.get_value('teams_active_queue') or []), 'teams': teams, } def desktop_size(): """主显示器分辨率(进程已由 bootstrap 设为 DPI aware, 取到的是物理像素)。""" from ctypes import windll return windll.user32.GetSystemMetrics(0), windll.user32.GetSystemMetrics(1) def check(values, task, desktop=None, env=None): """返回问题列表; 空列表表示可以启动。""" env = os.environ if env is None else env problems = [] lunacy = values.get('set_lunacy_to_enkephalin', 0) if lunacy and task != 'enkephalin' and env.get(ALLOW_LUNACY_ENV) != '1': problems.append( 'set_lunacy_to_enkephalin=%s: 体力不足时会花狂气换体力。狂气只用于抽卡, 请在 AALC 里改成 0' '(确需使用时设环境变量 %s=1)' % (lunacy, ALLOW_LUNACY_ENV)) # all 只在 AALC 里勾选了镜牢时才会编队 if task == 'mirror' or (task == 'all' and values.get('mirror')): teams = values.get('teams', {}) for num in values.get('teams_active_queue', []): team = teams.get(str(num)) if team is None: problems.append('teams_active_queue 里的队伍 %s 没有配置' % num) continue order = list(team.get('sinner_order') or []) # team_formation 从 1 开始按顺序找罪人, 缺 1 就一个都不选, 然后无限重试编队 if 1 not in order: problems.append( '队伍 %s 的 sinner_order 没有罪人(全是 0): 镜牢编队会选空队伍并无限重试。' '在 AALC 队伍设置里勾选罪人并排序' % num) if not values.get('simulator') and desktop: size = values.get('set_win_size', 0) need_w = int(size * 16 / 9) + FRAME_W need_h = size + FRAME_H if need_w > desktop[0] or need_h > desktop[1]: problems.append( 'set_win_size=%s 需要 %sx%s 的窗口(含标题栏), 桌面只有 %sx%s: 窗口会被压扁成非 16:9,' ' 模板匹配全部失效。改小 set_win_size(如 720)或调大桌面分辨率' % (size, need_w, need_h, desktop[0], desktop[1])) return problems
Commit Changes
Add a Signed-off-by trailer by the committer at the end of the commit log message.
Commit directly to the
codex/local-wip-20261022
branch.
Create a
new branch
for this commit and start a pull request.
Commit Changes
Cancel