驱动点击兜底 + 队名可配置;补 11-15 实机记录

Browse Source
- driver_input: 只在"原地连点"(与上次点击相差<=4px)时先挪开 10px 再点, 强制产生 MOUSEMOVE;
  按下 60→100ms, 到位等待 50→80ms (LCP_DRIVER_PRESS_MS / SETTLE_MS / WIGGLE 可调)
- aalc_patches: 「获得E.G.O饰品」弹窗第 3 次起绕过驱动代理改软件点击(pyautogui),
  第 8 次发回车, 20 次才中止; 新增 data/team_names.json 覆盖体系默认队名
  (LCP_TEAM_NAMES=0 关闭)
- docs: 2026-11-15 实测(6 连刷 6/6、键盘 4/4 进入、卡包按体系、镜像迷宫+震颤),
  ISSUES 状态更新 + I-14 前台被抢

单测: 709 passed。
This commit is contained in:
Codex Agent
2026-11-15 14:15:02 +08:00
parent a04b443b6a
commit bda1ffb390
8 changed files with 307 additions and 11 deletions
+3 -1
View File
@@ -375,9 +375,11 @@ class DriverFailureTest(unittest.TestCase):
drv._dll.mouse_up.assert_called_with(1) drv._dll.mouse_up.assert_called_with(1)
self.assertFalse(drv.ready) self.assertFalse(drv.ready)
self.assertFalse(drv.click(30, 40)) self.assertFalse(drv.click(30, 40))
# 急停前的"抖动"移动(见 DriverInput.click 注释 4)允许存在, 急停之后不能再有输入
moves = drv._dll.moveR.call_count
self.assertFalse(drv.move_relative(20, 30)) self.assertFalse(drv.move_relative(20, 30))
self.assertFalse(drv.down()) self.assertFalse(drv.down())
drv._dll.moveR.assert_not_called() self.assertEqual(drv._dll.moveR.call_count, moves)
self.assertEqual(drv._pressed, set()) self.assertEqual(drv._pressed, set())
def test_release_even_if_sleep_is_interrupted(self): def test_release_even_if_sleep_is_interrupted(self):
+20
View File
@@ -86,6 +86,26 @@ class GuardTest(unittest.TestCase):
record.assert_called_once_with('gift_confirm', 'button_center', 'repeated', clicks=2) record.assert_called_once_with('gift_confirm', 'button_center', 'repeated', clicks=2)
self.assertEqual(auto.click_element(CONFIRM), False) # 关了就找不到 self.assertEqual(auto.click_element(CONFIRM), False) # 关了就找不到
def test_repeat_clicks_bypass_the_driver_proxy(self):
# 2026-11-15: 罗技驱动的物理点击点不掉这个弹窗, 同一坐标用 pyautogui 软件点击可以。
# 第 3 次起必须绕过驱动代理, 直接调底层 handler。
auto = self.install(Popup(closes_on_button=False))
inner = []
auto.input_handler = SimpleNamespace(
_handler=SimpleNamespace(mouse_click=lambda x, y, *a, **k: inner.append((x, y))))
self.hit(auto, 3)
self.assertEqual(len(inner), 1)
self.assertEqual(inner[0], BUTTON)
self.assertEqual(auto.button_clicks, []) # 没再走驱动代理的 mouse_click
def test_enter_fallback_when_software_click_also_fails(self):
auto = self.install(Popup(closes_on_button=False))
inner = []
auto.input_handler = SimpleNamespace(
_handler=SimpleNamespace(mouse_click=lambda x, y, *a, **k: inner.append((x, y))))
auto.key_press = mock.Mock()
self.hit(auto, ap.GIFT_CONFIRM_ENTER_AT)
auto.key_press.assert_called_once_with('enter')
def test_stuck_popup_ends_the_task(self): def test_stuck_popup_ends_the_task(self):
auto = self.install(Popup(closes_on_button=False)) auto = self.install(Popup(closes_on_button=False))
with mock.patch.object(ap.decisions, 'record'), self.assertRaises(ap.TaskAbort): with mock.patch.object(ap.decisions, 'record'), self.assertRaises(ap.TaskAbort):
+46
View File
@@ -616,3 +616,49 @@ class EnterSwitchTest(unittest.TestCase):
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
class TeamNamesFileTest(unittest.TestCase):
def _write(self, data):
import json
import tempfile
fh = tempfile.NamedTemporaryFile('w', suffix='.json', delete=False, encoding='utf-8')
json.dump(data, fh, ensure_ascii=False)
fh.close()
self.addCleanup(lambda: os.unlink(fh.name))
return fh.name
def test_reads_overrides(self):
path = self._write({'_说明': ['x'], 'tremor': ['镜像迷宫', '震颤']})
self.assertEqual(aalc_patches.load_team_names(path, log=lambda *_: None),
{'tremor': ('镜像迷宫', '震颤')})
def test_bad_file_falls_back_to_empty(self):
path = self._write(['not', 'a', 'dict'])
self.assertEqual(aalc_patches.load_team_names(path, log=lambda *_: None), {})
def test_missing_file_falls_back_to_empty(self):
self.assertEqual(
aalc_patches.load_team_names(os.path.join(os.path.dirname(__file__), 'no-such.json'),
log=lambda *_: None), {})
def test_override_goes_first_then_defaults(self):
path = self._write({'tremor': ['镜像迷宫']})
module = types.ModuleType('tasks.mirror.mirror')
module.Mirror = _FakeMirror
module.select_battle_team = lambda num: True
auto_mod = types.ModuleType('module.automation')
auto_mod.auto = mock.Mock()
tasks_pkg = types.ModuleType('tasks'); tasks_pkg.__path__ = []
mirror_pkg = types.ModuleType('tasks.mirror'); mirror_pkg.__path__ = []
mirror_pkg.mirror = module
with mock.patch.dict(sys.modules, {'tasks': tasks_pkg, 'tasks.mirror': mirror_pkg,
'tasks.mirror.mirror': module,
'module': types.ModuleType('module'),
'module.automation': auto_mod}):
aalc_patches.install_system_team_selection(log=lambda *_: None,
env={'LCP_TEAM_NAMES': path})
module.Mirror({'system': 'tremor'}, 1)
with mock.patch.object(aalc_patches, '_select_team_by_name', return_value=True) as sel:
module.select_battle_team(1)
self.assertEqual(sel.call_args[0][1], ('镜像迷宫', '震颤'))