""" Make the in-game skill assignment match config/params.ini (layer 2 of hotkeys). For each skill in the build rules (utils/skill_preflight.get_build_skill_checks) this opens the in-game skill picker ('s'), finds the skill icon by template, hovers it and presses the hotkey from params.ini - that assigns the bind on the character (server-side for online chars; no file can be edited instead). Each bind is then verified by pressing the hotkey and matching the slot icon. Prerequisites: 1. Controls layer verified: python tools/set_controls_keyo.py 2. Skill icon templates exist: run tools/capture_skill_hotkeys.py once with correct binds, OR they ship in assets/templates/ui/skills/. Without a template for a skill, that skill is reported as 'template missing'. 3. D2R in a game (town), nothing else on screen. Usage (from repo root): tools/set_binds_from_params.py """ import os import sys import time import ctypes sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src")) ctypes.windll.user32.SetProcessDPIAware() from config import Config from screen import start_detecting_window, stop_detecting_window from utils.skill_preflight import get_build_skill_checks from utils.skill_hotkey_setter import bind_skill_hotkey def main(): print("Focus the D2R window (in a game). Binding starts in 5s...") time.sleep(5) start_detecting_window() try: checks = get_build_skill_checks(Config()) if not checks: raise SystemExit(f"no build rules for char type {Config().char.get('type')!r}") results = [bind_skill_hotkey(c) for c in checks] finally: stop_detecting_window() print("\nResults:") ok = True for r in results: state = "OK" if (r.bound and r.verified) else ("BOUND, UNVERIFIED" if r.bound else "FAILED") ok &= r.bound and r.verified print(f" {r.skill:16s} -> {r.hotkey:>4s} {state} {r.reason}") print("\nAll binds match params.ini." if ok else "\nSome binds failed - fix in-game or capture missing templates " "(tools/capture_skill_hotkeys.py), then re-run.") if __name__ == "__main__": main()