{"record":{"id":"884c60d200520de2","repo":"babalae/better-genshin-impact","slug":"method","errorCode":null,"errorMessage":"战斗策略脚本中出现未知的方法：{method}","messagePattern":"战斗策略脚本中出现未知的方法：(.+?)","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/AutoFight/Script/Method.cs","lineNumber":95,"sourceCode":"    public List<string> Alias { get; private set; }\n\n    public Method(List<string> alias)\n    {\n        Alias = alias;\n    }\n\n    public static Method GetEnumByCode(string method)\n    {\n        foreach (var m in Values)\n        {\n            if (m.Alias.Contains(method))\n            {\n                return m;\n            }\n        }\n\n        Logger.LogError($\"战斗策略脚本中出现未知的方法：{method}\");\n        throw new ArgumentException($\"战斗策略脚本中出现未知的方法：{method}\");\n    }\n}","sourceCodeStart":77,"sourceCodeEnd":97,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/AutoFight/Script/Method.cs#L77-L97","documentation":"Thrown by Method.GetEnumByCode when the provided method string does not match any alias in the known Method values. The Method class defines combat commands (skill/e, burst/q, attack, charge, wait, walk, dash, jump, etc.) with alias lists. If the input matches none, it is an unrecognized command in the combat script.","triggerScenarios":"CombatScriptParser creates a CombatCommand from a parsed command string, and the method name extracted from it is not in any Method.Alias list. For example: `香菱 unskill(1)`, `香菱 E1`, or a typo like `skil(1)`.","commonSituations":"User writes a TXT combat script with a misspelled or unsupported method name. Also occurs when using a method that was commented out in Values (e.g., 'aim'/'r' is commented out in the Values yield at line 57). Version updates that renamed or removed methods can also trigger this.","solutions":["Check the method name in the error message ({method}) against the supported list in Method.cs.","Common valid names: skill/e, burst/q, attack/普攻, charge/重击, wait/after, walk, dash/冲刺, jump/j, and macro commands (click, keydown, etc.).","Note: 'aim'/'r' is NOT available (commented out in Values) even though an Aim Method is defined.","Fix typos and ensure the method name is one of the recognized aliases."],"exampleFix":"// before (typo)\n// 香菱 skil(1),e(2)\n\n// after\n// 香菱 skill(1),e(2)","handlingStrategy":"try-catch","validationCode":"// Pre-validate method name against known aliases\nstatic readonly HashSet<string> KnownMethodAliases = new(StringComparer.OrdinalIgnoreCase)\n{\n    \"skill\", \"e\", \"burst\", \"q\", \"attack\", \"普攻\", \"普通攻击\",\n    \"charge\", \"重击\", \"wait\", \"after\", \"等待\", \"ready\", \"完成\",\n    \"check\", \"检测\", \"walk\", \"行走\", \"w\", \"a\", \"s\", \"d\",\n    \"dash\", \"冲刺\", \"jump\", \"j\", \"跳跃\",\n    \"mousedown\", \"mouseup\", \"click\", \"moveby\", \"keydown\", \"keyup\", \"keypress\",\n    \"scroll\", \"verticalscroll\", \"round\"\n};\n\nif (!KnownMethodAliases.Contains(methodName))\n    Log.LogWarning(\"未知的方法名: {Method}\", methodName);","typeGuard":null,"tryCatchPattern":"try\n{\n    var method = Method.GetEnumByCode(cmd);\n}\ncatch (ArgumentException e) when (e.Message.Contains(\"未知的方法\"))\n{\n    Logger.LogWarning(\"跳过未知指令: {Cmd}\", cmd);\n    // Skip or prompt user to fix the script\n}","preventionTips":["Refer to Method.cs for the complete list of valid method names and aliases.","Note: 'aim'/'r' is defined but commented out in Values — it will throw even though it exists.","When updating from older versions, check for renamed or removed methods.","Test combat scripts after version updates."],"tags":["combat-script","method","unknown-command","parser"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}