From fa5512d4c38623712e098871e99acf914d4760bc Mon Sep 17 00:00:00 2001 From: Handiwork Date: Mon, 7 Mar 2022 23:02:38 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=8C=89=E7=85=A7=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E4=B8=BAtasks.json=E9=85=8D=E7=BD=AE=E4=BA=86=20json=20schema,?= =?UTF-8?q?=20=E5=B9=B6=E5=AF=B9tasks.json=E4=B8=AD=E4=B8=8D=E7=AC=A6?= =?UTF-8?q?=E5=90=88=E6=96=87=E6=A1=A3=E7=9A=84=E5=86=85=E5=AE=B9=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E4=BA=86=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 - .vscode/settings.json | 10 + docs/maa_tasks_schema.json | 212 ++++++++ docs/任务流程协议.md | 12 + resource/tasks.json | 754 +++++++++++++------------- src/MeoAssistant/MeoAssistant.vcxproj | 2 +- 6 files changed, 604 insertions(+), 387 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 docs/maa_tasks_schema.json diff --git a/.gitignore b/.gitignore index 6cc417ce52..ffada5046b 100644 --- a/.gitignore +++ b/.gitignore @@ -432,4 +432,3 @@ screen.png adb_screen.png tools/**/*.png resource/infrast -.vscode diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..9b303dc30a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "json.schemas": [ + { + "fileMatch": [ + "resource/tasks.json" + ], + "url": "./docs/maa_tasks_schema.json" + } + ] +} diff --git a/docs/maa_tasks_schema.json b/docs/maa_tasks_schema.json new file mode 100644 index 0000000000..68e7a38c3e --- /dev/null +++ b/docs/maa_tasks_schema.json @@ -0,0 +1,212 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "maa task config", + "patternProperties": { + "^(?!\\$)": { + "type": "object", + "oneOf": [ + { + "$ref": "#/definitions/JustReturnTask" + }, + { + "$ref": "#/definitions/MatchTemplateTask" + }, + { + "$ref": "#/definitions/OcrDetectTask" + }, + { + "$ref": "#/definitions/HashTask" + } + ] + } + }, + "definitions": { + "Rectangle": { + "type": "array", + "maxItems": 4, + "minItems": 4, + "items": { + "type": "number" + } + }, + "TaskNameList": { + "type": "array", + "items": { + "type": "string", + "description": "要执行的任务" + } + }, + "BaseTask": { + "properties": { + "algorithm": { + "type": "string", + "description": "算法类型" + }, + "action": { + "type": "string", + "pattern": "ClickSelf|ClickRand|DoNothing|Stop|ClickRect|SwipeToTheLeft|SwipeToTheRight", + "default": "DoNothing", + "description": "可选项,表示识别到后的动作\n不填写时默认为 DoNothing" + }, + "next": { + "$ref": "#/definitions/TaskNameList", + "description": "可选项,表示执行完当前任务后,下一个要执行的任务\n会从前往后依次去识别,去执行第一个匹配上的\n不填写默认执行完当前任务直接停止" + }, + "maxTimes": { + "type": "number", + "description": "可选项,表示该任务最大执行次数\n不填写时默认无穷大\n达到最大次数后,若存在 exceededNext 字段,则执行 exceededNext;否则直接任务停止" + }, + "exceededNext": { + "$ref": "#/definitions/TaskNameList", + "description": "可选项,表示达到了最大执行次数后要执行的任务\n不填写时,达到了最大执行次数则停止;填写后就执行这里的,而不是 next 里的" + }, + "preDelay": { + "type": "number", + "description": "可选项,表示识别到后延迟多久才执行 action,单位毫秒;不填写时默认 0" + }, + "rearDelay": { + "type": "number", + "description": "可选项,表示 action 执行完后延迟多久才去识别 next, 单位毫秒;不填写时默认 0" + }, + "roi": { + "$ref": "#/definitions/Rectangle", + "description": "可选项,表示识别的范围,格式为 [ x, y, width, height ]\n以 1280 * 720 为基准自动缩放;不填写时默认 [ 0, 0, 1280, 720 ]\n尽量填写,减小识别范围可以减少性能消耗,加快识别速度" + }, + "cache": { + "type": "boolean", + "default": true, + "description": "可选项,表示该任务是否使用缓存,默认为 true;\n第一次识别到后,以后永远只在第一次识别到的位置进行识别,开启可大幅节省性能\n但仅适用于待识别目标位置完全不会变的任务,若待识别目标位置会变请设为 false" + }, + "rectMove": { + "$ref": "#/definitions/Rectangle", + "description": "可选项,识别后的目标移动,不建议使用该选项。以 1280 * 720 为基准自动缩放\n例如识别到了 A 图标,但实际要点击的是 A 图标旁边的某个位置,则进行移动后再点击。可以的话尽量直接识别要点击的位置,不建议使用该选项" + }, + "reduceOtherTimes": { + "type": "array", + "items": { + "type": "string", + "description": "要执行的任务" + }, + "description": "可选项,执行后减少其他任务的执行计数。\n可选项,执行后减少其他任务的执行计数。" + }, + "specificRect": { + "$ref": "#/definitions/Rectangle", + "description": "仅当 action 为 ClickRect 时有效且必选,表示指定的点击位置(范围内随机一点)。以 1280 * 720 为基准自动缩放" + } + } + }, + "JustReturnTask": { + "allOf": [ + { + "$ref": "#/definitions/BaseTask" + } + ], + "properties": { + "algorithm": { + "type": "string", + "pattern": "JustReturn" + } + }, + "description": "不进行识别,直接执行 action", + "required": [ + "algorithm" + ] + }, + "MatchTemplateTask": { + "allOf": [ + { + "$ref": "#/definitions/BaseTask" + } + ], + "properties": { + "algorithm": { + "type": "string", + "pattern": "MatchTemplate" + }, + "template": { + "type": "string", + "default": "", + "description": "可选项,要匹配的图片文件名\n不填时写默认 \"任务名.png\"" + }, + "templThreshold": { + "type": "number", + "default": 0.8, + "description": "可选项,图片模板匹配得分的阈值,超过阈值才认为识别到了。\n默认 0.8, 可根据日志查看实际得分是多少" + }, + "maskRange": { + "type": "array", + "maxItems": 2, + "minimum": 2, + "items": { + "type": "number" + }, + "default": [ + 1, + 255 + ], + "description": "可选项,灰度掩码范围。例如将图片不需要识别的部分涂成黑色(灰度值为 0),然后设置 [ 1, 255 ], 匹配的时候即刻忽略涂黑的部分" + } + }, + "description": "匹配图片" + }, + "OcrDetectTask": { + "allOf": [ + { + "$ref": "#/definitions/BaseTask" + } + ], + "properties": { + "algorithm": { + "type": "string", + "pattern": "OcrDetect" + }, + "text": { + "type": "array", + "items": { + "type": "string" + }, + "description": "必选项,要识别的文字内容,只要任一匹配上了即认为识别到了" + }, + "fullMatch": { + "type": "boolean", + "default": false, + "description": "可选项,文字识别是否需要全字匹配(不能多字),默认为 false\nfalse 时只要是子串即可:例如 text: [ \"开始\" ],实际识别到了 \"开始行动\",也算识别成功;\ntrue 时则必须识别到了 \"开始\",多一个字都不行" + }, + "ocrReplace": { + "type": "array", + "items": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "items": { + "type": "string" + } + }, + "description": "可选项,针对常见识别错的文字进行替换(支持正则)" + } + }, + "description": "文字识别", + "required": [ + "algorithm", + "text" + ] + }, + "HashTask": { + "allOf": [ + { + "$ref": "#/definitions/BaseTask" + } + ], + "properties": { + "algorithm": { + "type": "string", + "pattern": "Hash" + } + }, + "description": "哈希计算", + "required": [ + "algorithm" + ] + } + } +} diff --git a/docs/任务流程协议.md b/docs/任务流程协议.md index 6f1be1c42e..a51a30753b 100644 --- a/docs/任务流程协议.md +++ b/docs/任务流程协议.md @@ -132,3 +132,15 @@ } } ``` + +## Schema 检验 + +本项目为 `tasks.json` 配置了 json schema 检验,schema 文件为`docs/maa_tasks_schema.json`。 + +### Visual Studio + +在 `MeoAssistant.vcxporj` 中已对其进行配置,开箱即用。提示效果较为晦涩,且有部分信息缺失。 + +### Visual Studio Code + +在 `.vscode/settings.json` 中已对其进行配置,用 vscode 打开该**项目文件夹**即可使用。提示效果较好。 diff --git a/resource/tasks.json b/resource/tasks.json index 99079054b1..b7e4994089 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -1,7 +1,7 @@ { "StartUp": { - "algorithm": "justreturn", - "action": "doNothing", + "algorithm": "JustReturn", + "action": "DoNothing", "next": [ "GameStart", "StartToWakeUp", @@ -13,8 +13,8 @@ ] }, "LS-5": { - "algorithm": "justreturn", - "action": "doNothing", + "algorithm": "JustReturn", + "action": "DoNothing", "next": [ "StageResourceToLS5", "StageLS", @@ -29,26 +29,26 @@ 300, 60 ], - "action": "clickSelf", + "action": "ClickSelf", "next": [ "SwipeToStageLS" ] }, "SwipeToStageLS": { - "algorithm": "justReturn", - "action": "swipeToTheLeft", + "algorithm": "JustReturn", + "action": "SwipeToTheLeft", "next": [ "StageLS" ] }, "StageLS": { - "action": "clickSelf", + "action": "ClickSelf", "next": [ "StageLS5" ] }, "StageLS5": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 850, 140, @@ -57,8 +57,8 @@ ] }, "BI-8": { - "algorithm": "justreturn", - "action": "doNothing", + "algorithm": "JustReturn", + "action": "DoNothing", "next": [ "StageBreakIceToBI8", "StageBIToBI8", @@ -77,14 +77,14 @@ 1, 255 ], - "action": "clickSelf", + "action": "ClickSelf", "next": [ "StageBIToBI8" ] }, "StageBIToBI8": { "template": "StageBI.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 1000, 250, @@ -97,8 +97,8 @@ ] }, "SwipeToStageBI8": { - "algorithm": "justReturn", - "action": "swipeToTheRight", + "algorithm": "JustReturn", + "action": "SwipeToTheRight", "maxTimes": 3, "exceededNext": [ "StageBI8" @@ -109,7 +109,7 @@ ] }, "StageBI8": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 200, 350, @@ -118,8 +118,8 @@ ] }, "BI-7": { - "algorithm": "justreturn", - "action": "doNothing", + "algorithm": "JustReturn", + "action": "DoNothing", "next": [ "StageBreakIceToBI7", "StageBIToBI7", @@ -138,14 +138,14 @@ 1, 255 ], - "action": "clickSelf", + "action": "ClickSelf", "next": [ "StageBIToBI7" ] }, "StageBIToBI7": { "template": "StageBI.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 1000, 250, @@ -158,8 +158,8 @@ ] }, "SwipeToStageBI7": { - "algorithm": "justReturn", - "action": "swipeToTheRight", + "algorithm": "JustReturn", + "action": "SwipeToTheRight", "maxTimes": 3, "exceededNext": [ "StageBI7" @@ -170,7 +170,7 @@ ] }, "StageBI7": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 50, 250, @@ -179,8 +179,8 @@ ] }, "CA-5": { - "algorithm": "justreturn", - "action": "doNothing", + "algorithm": "JustReturn", + "action": "DoNothing", "next": [ "StageResourceToCA5", "StageCA", @@ -195,26 +195,26 @@ 300, 60 ], - "action": "clickSelf", + "action": "ClickSelf", "next": [ "SwipeToStageCA" ] }, "SwipeToStageCA": { - "algorithm": "justReturn", - "action": "swipeToTheLeft", + "algorithm": "JustReturn", + "action": "SwipeToTheLeft", "next": [ "StageCA" ] }, "StageCA": { - "action": "clickSelf", + "action": "ClickSelf", "next": [ "StageCA5" ] }, "StageCA5": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 850, 140, @@ -223,8 +223,8 @@ ] }, "AP-5": { - "algorithm": "justreturn", - "action": "doNothing", + "algorithm": "JustReturn", + "action": "DoNothing", "next": [ "StageResourceToAP5", "StageAP", @@ -239,26 +239,26 @@ 300, 60 ], - "action": "clickSelf", + "action": "ClickSelf", "next": [ "SwipeToStageAP" ] }, "SwipeToStageAP": { - "algorithm": "justReturn", - "action": "swipeToTheLeft", + "algorithm": "JustReturn", + "action": "SwipeToTheLeft", "next": [ "StageAP" ] }, "StageAP": { - "action": "clickSelf", + "action": "ClickSelf", "next": [ "StageAP5" ] }, "StageAP5": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 850, 140, @@ -267,8 +267,8 @@ ] }, "CE-5": { - "algorithm": "justreturn", - "action": "doNothing", + "algorithm": "JustReturn", + "action": "DoNothing", "next": [ "StageResourceToCE5", "StageCE", @@ -283,26 +283,26 @@ 300, 60 ], - "action": "clickSelf", + "action": "ClickSelf", "next": [ "SwipeToStageCE" ] }, "SwipeToStageCE": { - "algorithm": "justReturn", - "action": "swipeToTheLeft", + "algorithm": "JustReturn", + "action": "SwipeToTheLeft", "next": [ "StageCE" ] }, "StageCE": { - "action": "clickSelf", + "action": "ClickSelf", "next": [ "StageCE5" ] }, "StageCE5": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 850, 140, @@ -313,7 +313,7 @@ "Annihilation": { "doc": "剿灭作战,一般本周的满了也不会有人再刷的,所以只识别右上角ToDoList里的剿灭就可以了", "template": "StageAnnihilation.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 900, 70, @@ -326,8 +326,8 @@ ] }, "StageBegin": { - "algorithm": "justreturn", - "action": "doNothing", + "algorithm": "JustReturn", + "action": "DoNothing", "next": [ "ReturnToTerminal", "Terminal", @@ -335,8 +335,8 @@ ] }, "FightBegin": { - "algorithm": "justreturn", - "action": "doNothing", + "algorithm": "JustReturn", + "action": "DoNothing", "next": [ "UsePrts", "StartButton1", @@ -346,7 +346,7 @@ ] }, "GameStart": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 550, 600, @@ -364,7 +364,7 @@ }, "ReturnToTerminal": { "template": "Return.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 0, 0, @@ -380,7 +380,7 @@ }, "ReturnToTerminalConfirm": { "template": "PopupConfirm.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 630, 400, @@ -394,7 +394,7 @@ ] }, "UsePrts": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 1000, 550, @@ -417,7 +417,7 @@ 480, 320 ], - "action": "clickSelf", + "action": "ClickSelf", "next": [ "StartButton2", "UseMedicine", @@ -426,7 +426,7 @@ ] }, "StartButton2": { - "action": "clickSelf", + "action": "ClickSelf", "rearDelay": 20000, "roi": [ 1000, @@ -455,7 +455,7 @@ 380, 150 ], - "action": "doNothing", + "action": "DoNothing", "rearDelay": 5000, "next": [ "PRTS", @@ -477,7 +477,7 @@ 219, 141 ], - "action": "doNothing", + "action": "DoNothing", "rearDelay": 5000, "next": [ "PRTS2", @@ -489,8 +489,8 @@ ] }, "WaitAfterPRTS": { - "algorithm": "justreturn", - "action": "doNothing", + "algorithm": "JustReturn", + "action": "DoNothing", "next": [ "PRTS", "PRTS2", @@ -500,8 +500,8 @@ }, "ClickCornerAfterPRTS": { "ClickCorner_Doc": "点击屏幕右边,不会点到掉落物品,且不会关掉关卡选择的一块区域", - "algorithm": "justreturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 1000, 10, @@ -529,7 +529,7 @@ 440, 280 ], - "action": "doNothing", + "action": "DoNothing", "next": [ "ClickCorner" ] @@ -540,8 +540,8 @@ }, "ClickCorner": { "ClickCorner_Doc": "点击屏幕右边,不会点到掉落物品,且不会关掉关卡选择的一块区域", - "algorithm": "justreturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 1000, 10, @@ -558,7 +558,7 @@ ] }, "UseMedicine": { - "action": "doNothing", + "action": "DoNothing", "templThreshold": 0.7, "roi": [ 580, @@ -571,7 +571,7 @@ ] }, "MedicineConfirm": { - "action": "clickSelf", + "action": "ClickSelf", "maxTimes": 0, "roi": [ 1000, @@ -591,7 +591,7 @@ ] }, "UseStone": { - "action": "doNothing", + "action": "DoNothing", "roi": [ 600, 130, @@ -604,7 +604,7 @@ }, "StoneConfirm": { "template": "MedicineConfirm.png", - "action": "clickSelf", + "action": "ClickSelf", "maxTimes": 0, "roi": [ 1000, @@ -624,7 +624,7 @@ ] }, "NoStone": { - "action": "doNothing", + "action": "DoNothing", "roi": [ 800, 250, @@ -636,8 +636,8 @@ ] }, "CloseStonePage": { - "algorithm": "justreturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 0, 200, @@ -655,14 +655,14 @@ 1280, 480 ], - "action": "doNothing", + "action": "DoNothing", "next": [ "AbandonAction", "OfflineConfirmAfterBattle" ] }, "AbandonAction": { - "action": "clickSelf", + "action": "ClickSelf", "reduceOtherTimes": [ "StartButton1", "StartButton2" @@ -682,7 +682,7 @@ }, "OfflineConfirmAfterBattle": { "template": "PopupConfirm.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 630, 400, @@ -698,7 +698,7 @@ ] }, "OfflineConfirm": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 310, 409, @@ -716,7 +716,7 @@ ] }, "StartToWakeUp": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 520, 460, @@ -731,7 +731,7 @@ ] }, "CloseAnno": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 1100, @@ -746,7 +746,7 @@ ] }, "Terminal": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 880, 100, @@ -767,7 +767,7 @@ "text": [ "今日配给" ], - "action": "clickRect", + "action": "ClickRect", "specificRect": [ 1000, 1, @@ -786,8 +786,8 @@ ] }, "LastBattle": { - "algorithm": "justReturn", - "action": "doNothing", + "algorithm": "JustReturn", + "action": "DoNothing", "next": [ "StartButton1", "GoLastBattle" @@ -805,15 +805,15 @@ 280, 100 ], - "action": "clickSelf", + "action": "ClickSelf", "next": [ "UsePrts", "StartButton1" ] }, "RecruitBegin": { - "algorithm": "justreturn", - "action": "doNothing", + "algorithm": "JustReturn", + "action": "DoNothing", "next": [ "RecruitFinish", "RecruitFlag", @@ -824,7 +824,7 @@ }, "ReturnToRecruit": { "template": "Return.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 0, 0, @@ -840,7 +840,7 @@ }, "ReturnToRecruitConfirm": { "template": "PopupConfirm.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 630, 400, @@ -855,7 +855,7 @@ }, "ReturnToRecruitCloseAnno": { "template": "CloseAnno.png", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 1100, @@ -870,7 +870,7 @@ ] }, "Recruit": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 900, 450, @@ -886,7 +886,7 @@ ] }, "RecruitFinish": { - "action": "clickSelf", + "action": "ClickSelf", "templThreshold": 0.7, "cache": false, "roi": [ @@ -902,7 +902,7 @@ ] }, "RecruitSkip": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 1100, 0, @@ -915,8 +915,8 @@ ] }, "RecruitSkipWithoutButton": { - "algorithm": "justReturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 1180, 15, @@ -931,7 +931,7 @@ }, "StartRecruit": { "algorithm": "OcrDetect", - "action": "clickSelf", + "action": "ClickSelf", "rearDelay": 500, "text": [ "开始招" @@ -958,7 +958,7 @@ }, "RecruitNow": { "algorithm": "OcrDetect", - "action": "clickSelf", + "action": "ClickSelf", "rearDelay": 500, "cache": false, "text": [ @@ -975,7 +975,7 @@ ] }, "RecruitNowConfirm": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 640, 450, @@ -988,8 +988,8 @@ ] }, "AwardBegin": { - "algorithm": "justreturn", - "action": "doNothing", + "algorithm": "JustReturn", + "action": "DoNothing", "next": [ "ReturnToAward", "Award", @@ -1001,7 +1001,7 @@ }, "Award": { "template": "Task.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 700, 530, @@ -1016,7 +1016,7 @@ ] }, "ReceiveAward": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 950, 50, @@ -1028,8 +1028,8 @@ ] }, "CloseTaskAward": { - "algorithm": "justReturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 600, 600, @@ -1042,8 +1042,8 @@ }, "CloseTaskAwardDouble": { "Doc": "有时候奖励出的太慢了,所以这里多点一次", - "algorithm": "justReturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 600, 600, @@ -1070,7 +1070,7 @@ ] }, "DailyTask": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 400, 0, @@ -1083,7 +1083,7 @@ ] }, "WeeklyTask": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 400, 0, @@ -1097,7 +1097,7 @@ }, "ReturnToAward": { "template": "Return.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 0, 0, @@ -1113,7 +1113,7 @@ }, "ReturnToAwardConfirm": { "template": "PopupConfirm.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 630, 400, @@ -1128,7 +1128,7 @@ }, "ReturnToAwardCloseAnno": { "template": "CloseAnno.png", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 1100, @@ -1143,8 +1143,8 @@ ] }, "VisitBegin": { - "algorithm": "justreturn", - "action": "doNothing", + "algorithm": "JustReturn", + "action": "DoNothing", "next": [ "Friends", "FriendsList", @@ -1157,7 +1157,7 @@ }, "ReturnToFriends": { "template": "Return.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 0, 0, @@ -1173,7 +1173,7 @@ }, "ReturnToFriendsConfirm": { "template": "PopupConfirm.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 630, 400, @@ -1188,7 +1188,7 @@ }, "ReturnToFriendsCloseAnno": { "template": "CloseAnno.png", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 1100, @@ -1204,7 +1204,7 @@ }, "Friends": { "templThreshold": 0.7, - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 250, 500, @@ -1217,7 +1217,7 @@ ] }, "FriendsList": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 0, 150, @@ -1240,13 +1240,13 @@ 300, 150 ], - "action": "doNothing", + "action": "DoNothing", "next": [ "ReturnToHome" ] }, "StartToVisit": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 900, @@ -1261,7 +1261,7 @@ ] }, "VisitNext": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 1080, 570, @@ -1280,7 +1280,7 @@ "text": [ "访问下位" ], - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 1080, 570, @@ -1295,8 +1295,8 @@ ] }, "MallBegin": { - "algorithm": "justreturn", - "action": "doNothing", + "algorithm": "JustReturn", + "action": "DoNothing", "next": [ "ReturnToMall", "Mall", @@ -1305,7 +1305,7 @@ }, "ReturnToMall": { "template": "Return.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 0, 0, @@ -1321,7 +1321,7 @@ }, "ReturnToMallConfirm": { "template": "PopupConfirm.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 630, 400, @@ -1336,7 +1336,7 @@ }, "ReturnToMallCloseAnno": { "template": "CloseAnno.png", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 1100, @@ -1352,7 +1352,7 @@ }, "Mall": { "algorithm": "OcrDetect", - "action": "clickSelf", + "action": "ClickSelf", "text": [ "中心" ], @@ -1370,7 +1370,7 @@ }, "MallLoading": { "algorithm": "OcrDetect", - "action": "doNothing", + "action": "DoNothing", "text": [ "正在提交", "反馈至神经" @@ -1397,7 +1397,7 @@ 280, 300 ], - "action": "clickSelf", + "action": "ClickSelf", "next": [ "CollectCredit", "MallLoading", @@ -1405,7 +1405,7 @@ ] }, "CollectCredit": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 900, 0, @@ -1418,8 +1418,8 @@ "rearDelay": 2000 }, "CloseCollectCredit": { - "algorithm": "justReturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 1000, 1, @@ -1432,7 +1432,7 @@ ] }, "CrisisPopup": { - "action": "clickRect", + "action": "ClickRect", "roi": [ 450, 130, @@ -1452,7 +1452,7 @@ "今日参与", "已达上限" ], - "action": "doNothing", + "action": "DoNothing", "roi": [ 900, 50, @@ -1464,7 +1464,7 @@ ] }, "VisitNextBlack": { - "action": "doNothing", + "action": "DoNothing", "roi": [ 1080, 570, @@ -1477,7 +1477,7 @@ }, "ReturnToHome": { "template": "Return.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 0, 0, @@ -1493,7 +1493,7 @@ }, "ReturnToHomeConfirm": { "template": "PopupConfirm.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 630, 400, @@ -1508,7 +1508,7 @@ }, "ReturnToHomeCloseAnno": { "template": "CloseAnno.png", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 1100, @@ -1524,7 +1524,7 @@ }, "HomeFlag": { "template": "Terminal.png", - "action": "stop", + "action": "Stop", "roi": [ 880, 100, @@ -1583,12 +1583,12 @@ ] }, "Stop": { - "algorithm": "justreturn", - "action": "stop" + "algorithm": "JustReturn", + "action": "Stop" }, "RecruitTime": { "template": "RecruitTimeReduce.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 350, 150, @@ -1623,7 +1623,7 @@ ] }, "RecruitRefresh": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 850, 340, @@ -1635,7 +1635,7 @@ ] }, "RecruitNoRefresh": { - "action": "doNothing", + "action": "DoNothing", "roi": [ 850, 340, @@ -1645,7 +1645,7 @@ }, "RecruitRefreshConfirm": { "template": "PopupConfirm.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 630, 400, @@ -1659,7 +1659,7 @@ }, "RecruitLoading": { "algorithm": "OcrDetect", - "action": "doNothing", + "action": "DoNothing", "text": [ "正在提交", "反馈至神经" @@ -1676,7 +1676,7 @@ ] }, "RecruitConfirm": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 860, 540, @@ -1688,8 +1688,8 @@ ] }, "InfrastBegin": { - "algorithm": "justreturn", - "action": "doNothing", + "algorithm": "JustReturn", + "action": "DoNothing", "next": [ "EnterInfrast", "InfrastEnteredFlag", @@ -1706,7 +1706,7 @@ 180, 80 ], - "action": "clickSelf", + "action": "ClickSelf", "next": [ "EnterInfrast", "InfrastNotification", @@ -1718,7 +1718,7 @@ }, "ReturnToInfrastConfirm": { "template": "PopupConfirm.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 630, 400, @@ -1735,7 +1735,7 @@ }, "ReturnToInfrastCloseAnno": { "template": "CloseAnno.png", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 1100, @@ -1752,8 +1752,8 @@ ] }, "Return": { - "algorithm": "justReturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 20, 20, @@ -1769,7 +1769,7 @@ 160, 160 ], - "action": "clickSelf", + "action": "ClickSelf", "next": [ "InfrastEnteredFlag", "EnterInfrast" @@ -1778,7 +1778,7 @@ }, "InfrastEnteredFlag": { "template": "InfrastOverview.png", - "action": "doNothing", + "action": "DoNothing", "roi": [ 0, 100, @@ -1798,7 +1798,7 @@ 300 ], "cache": false, - "action": "clickSelf", + "action": "ClickSelf", "next": [ "InfrastReward", "InfrastExitReward" @@ -1811,7 +1811,7 @@ "订单交付", "信赖" ], - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 0, 600, @@ -1826,8 +1826,8 @@ }, "InfrastExitReward": { "Doc": "干员疲劳、线索收集 是不能一键收获的,所以要先退出一键收获的界面,这里点击的是控制中枢左侧那一片空白的区域", - "algorithm": "justreturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 250, 100, @@ -1839,7 +1839,7 @@ ] }, "DroneAssistMfg": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 1180, 500, @@ -1854,7 +1854,7 @@ ] }, "DroneAssistTrade": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 250, @@ -1868,7 +1868,7 @@ ] }, "DroneMax": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 900, 300, @@ -1880,7 +1880,7 @@ ] }, "DroneConfirm": { - "action": "clickSelf", + "action": "ClickSelf", "rearDelay": 3500, "roi": [ 630, @@ -1895,7 +1895,7 @@ ] }, "DeliverableOrder": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 250, 300, @@ -1911,11 +1911,11 @@ "DroneAssist-Trade-Stop": { "Doc": "如果找到了“无人机加速”按钮,却没有找到订单交付:说明上一次无人机没有把一个订单加速完成,也说明没有更多的无人机了,所以直接stop", "template": "DroneAssistTrade.png", - "action": "stop" + "action": "Stop" }, "ShamareThumbnail": { "algorithm": "JustReturn", - "action": "doNothing", + "action": "DoNothing", "next": [ "ShamareThumbnail1", "ShamareThumbnail2", @@ -1923,7 +1923,7 @@ ] }, "ShamareThumbnail1": { - "action": "doNothing", + "action": "DoNothing", "templThreshold": 0.9, "cache": false, "roi": [ @@ -1934,7 +1934,7 @@ ] }, "ShamareThumbnail2": { - "action": "doNothing", + "action": "DoNothing", "templThreshold": 0.9, "cache": false, "roi": [ @@ -1945,7 +1945,7 @@ ] }, "ShamareThumbnail3": { - "action": "doNothing", + "action": "DoNothing", "templThreshold": 0.9, "cache": false, "roi": [ @@ -1956,7 +1956,7 @@ ] }, "InfrastSkillsUpper": { - "algorithm": "justReturn", + "algorithm": "JustReturn", "roi": [ 400, 280, @@ -1965,7 +1965,7 @@ ] }, "InfrastSkillsLower": { - "algorithm": "justReturn", + "algorithm": "JustReturn", "roi": [ 400, 560, @@ -1974,8 +1974,8 @@ ] }, "InfrastOperNameHash": { - "algorithm": "hash", - "hash": [], + "algorithm": "Hash", + "Hash": [], "threshold": 65, "rectMove_Doc": "基于笑脸的位置移动", "rectMove": [ @@ -1990,8 +1990,8 @@ ] }, "InfrastOperFaceHash": { - "algorithm": "hash", - "hash": [], + "algorithm": "Hash", + "Hash": [], "threshold": 30, "rectMove_Doc": "基于笑脸的位置移动", "rectMove": [ @@ -2043,8 +2043,8 @@ ] }, "InfrastOperListSwipeBegin": { - "algorithm": "justReturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 1080, 200, @@ -2056,8 +2056,8 @@ "Doc": "这里的preDelay作为滑动duration使用,rearDelay作为滑动额外延时使用" }, "InfrastOperListSwipeEnd": { - "algorithm": "justReturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 700, 200, @@ -2066,8 +2066,8 @@ ] }, "InfrastOperListSwipeToTheLeftBegin": { - "algorithm": "justReturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 1080, 200, @@ -2080,8 +2080,8 @@ "Doc": "这里的preDelay作为滑动duration使用,rearDelay作为滑动额外延时使用,maxTimes作为重复次数使用" }, "InfrastOperListSwipeToTheLeftEnd": { - "algorithm": "justReturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 400, 200, @@ -2300,7 +2300,7 @@ }, "InfrastStationedInfo": { "algorithm": "OcrDetect", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "text": [ "进驻信息" @@ -2319,7 +2319,7 @@ "InfrastEnterOperList": { "algorithm": "OcrDetect", "cache": false, - "action": "clickSelf", + "action": "ClickSelf", "text": [ "心情", "休息中", @@ -2335,8 +2335,8 @@ "rearDelay": 1000 }, "InfrastClearButton": { - "algorithm": "justReturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 430, 655, @@ -2346,8 +2346,8 @@ "rearDelay": 1000 }, "InfrastConfirmButton": { - "algorithm": "justReturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 1105, 655, @@ -2361,7 +2361,7 @@ ] }, "InfrastConfirmButtonWait": { - "algorithm": "ocrDetect", + "algorithm": "OcrDetect", "text": [ "正在提交", "反馈至神经" @@ -2379,8 +2379,8 @@ ] }, "InfrastBottomLeftTab": { - "algorithm": "justReturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 0, 540, @@ -2391,8 +2391,8 @@ "rearDelay": 2000 }, "InfrastDormConfirmButton": { - "algorithm": "justReturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 1105, 655, @@ -2407,7 +2407,7 @@ ] }, "InfrastDormConfirmButtonWait": { - "algorithm": "ocrDetect", + "algorithm": "OcrDetect", "text": [ "正在提交", "反馈至神经" @@ -2427,7 +2427,7 @@ }, "InfrastDormDoubleConfirmButton": { "template": "DormConfirm.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 630, 620, @@ -2442,7 +2442,7 @@ ] }, "InfrastEnterFacility": { - "algorithm": "justReturn", + "algorithm": "JustReturn", "rearDelay": 2000 }, "InfrastFacilityListTabMfg": { @@ -2613,8 +2613,8 @@ "rearDelay": 1000 }, "InfrastAddOperatorReceptionAggressive": { - "algorithm": "justReturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 30, 200, @@ -2746,8 +2746,8 @@ ] }, "InfrastClueOnTheRightSwipeBegin": { - "algorithm": "justReturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 900, 600, @@ -2760,8 +2760,8 @@ "Doc": "这里的preDelay作为滑动duration使用,rearDelay作为滑动额外延时使用,maxTimes作为重复次数使用" }, "InfrastClueOnTheRightSwipeEnd": { - "algorithm": "justReturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 900, 200, @@ -2777,7 +2777,7 @@ 170, 177 ], - "action": "clickSelf", + "action": "ClickSelf", "next": [ "InfrastClueSelfFull", "CloseCluePage" @@ -2803,7 +2803,7 @@ }, "CloseCluePageThenSendClue": { "template": "CloseCluePage.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 930, 50, @@ -2817,7 +2817,7 @@ }, "InfrastClueSelfNew": { "template": "ClueNew.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 1150, 100, @@ -2836,7 +2836,7 @@ }, "GetSelfClue": { "template": "GetClue1.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 680, 540, @@ -2851,7 +2851,7 @@ }, "InfrastClueFriendNew": { "template": "ClueNew.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 1150, 220, @@ -2870,7 +2870,7 @@ }, "GetFriendClue": { "template": "GetClue2.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 800, 600, @@ -2884,7 +2884,7 @@ }, "CloseCluePage": { "template": "CloseCluePage.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 930, 50, @@ -2899,7 +2899,7 @@ ] }, "SendClueFlag": { - "action": "doNothing", + "action": "DoNothing", "doc": "这里识别的是自己的线索的new:如果获取完自己的线索、再获取完好友送的线索,自己的线索new还亮着,则说明自己的线索没获取成功,即线索满了", "next": [ "SendClues" @@ -2914,7 +2914,7 @@ }, "UnlockClues": { "template": "UnlockClues.png", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "templThreshold": 0.9, "roi": [ @@ -2933,7 +2933,7 @@ "Doc": "点了一次解锁了还在这个界面,说明是识别错了", "cache": false, "template": "UnlockClues.png", - "action": "clickSelf", + "action": "ClickSelf", "templThreshold": 0.9, "roi": [ 200, @@ -2943,7 +2943,7 @@ ] }, "ReceptionFlag": { - "action": "doNothing", + "action": "DoNothing", "roi": [ 350, 0, @@ -2965,7 +2965,7 @@ }, "EndOfClueExchangeClose": { "template": "Return.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 0, 0, @@ -2978,7 +2978,7 @@ "rearDelay": 3000 }, "SendClues": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 1157, 346, @@ -2996,7 +2996,7 @@ ] }, "SelectClue": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 2, 133, @@ -3022,7 +3022,7 @@ }, "ClueGiveTo1st": { "template": "ClusCanBeSent.png", - "action": "doNothing", + "action": "DoNothing", "cache": false, "maskRange": [ 1, @@ -3040,7 +3040,7 @@ }, "ClueGiveTo1stConfirm": { "template": "SendClueConfirm.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 1150, 50, @@ -3054,7 +3054,7 @@ }, "ClueGiveTo2nd": { "template": "ClusCanBeSent.png", - "action": "doNothing", + "action": "DoNothing", "cache": false, "maskRange": [ 1, @@ -3072,7 +3072,7 @@ }, "ClueGiveTo2ndConfirm": { "template": "SendClueConfirm.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 1150, 200, @@ -3086,7 +3086,7 @@ }, "ClueGiveTo3rd": { "template": "ClusCanBeSent.png", - "action": "doNothing", + "action": "DoNothing", "cache": false, "maskRange": [ 1, @@ -3104,7 +3104,7 @@ }, "ClueGiveTo3rdConfirm": { "template": "SendClueConfirm.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 1150, 350, @@ -3118,7 +3118,7 @@ }, "ClueGiveTo4th": { "template": "ClusCanBeSent.png", - "action": "doNothing", + "action": "DoNothing", "cache": false, "maskRange": [ 1, @@ -3136,7 +3136,7 @@ }, "ClueGiveTo4thConfirm": { "template": "SendClueConfirm.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 1150, 500, @@ -3149,7 +3149,7 @@ ] }, "CloseSendClue": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 1225, 16, @@ -3163,7 +3163,7 @@ ] }, "ClueGiveToNextPage": { - "action": "clickSelf", + "action": "ClickSelf", "templThreshold": 0.95, "roi": [ 1184, @@ -3271,28 +3271,18 @@ 25 ] }, - "BattleOperRoleCaster": { - }, - "BattleOperRoleMedic": { - }, - "BattleOperRolePioneer": { - }, - "BattleOperRoleSniper": { - }, - "BattleOperRoleSpecial": { - }, - "BattleOperRoleSupport": { - }, - "BattleOperRoleTank": { - }, - "BattleOperRoleWarrior": { - }, - "BattleOperRoleDrone": { - }, + "BattleOperRoleCaster": {}, + "BattleOperRoleMedic": {}, + "BattleOperRolePioneer": {}, + "BattleOperRoleSniper": {}, + "BattleOperRoleSpecial": {}, + "BattleOperRoleSupport": {}, + "BattleOperRoleTank": {}, + "BattleOperRoleWarrior": {}, + "BattleOperRoleDrone": {}, "BattleOperCostRange": { - "algorithm": "hash", - "hash": [ - ], + "algorithm": "Hash", + "Hash": [], "rectMove": [ -10, 12, @@ -3301,91 +3291,88 @@ ] }, "BattleOperCostChannelH": { - "algorithm": "hash", - "hash": [ - ], + "algorithm": "Hash", + "Hash": [], "maskRange": [ 0, 255 ] }, "BattleOperCostChannelS": { - "algorithm": "hash", - "hash": [ - ], + "algorithm": "Hash", + "Hash": [], "maskRange": [ 0, 50 ] }, "BattleOperCostChannelV": { - "algorithm": "hash", - "hash": [ - ], + "algorithm": "Hash", + "Hash": [], "maskRange": [ 80, 255 ] }, "BattleOperCost0": { - "algorithm": "hash", - "hash": [ + "algorithm": "Hash", + "Hash": [ "1ff83ffc3c3e780e700ee007e007e007e007e007e007f00f780e7c1e3ffc1ff8" ] }, "BattleOperCost1": { - "algorithm": "hash", - "hash": [ + "algorithm": "Hash", + "Hash": [ "00ff03ff1fff7fffffffff3f003f003f003f003f003f003f003f003f003f003f" ] }, "BattleOperCost2": { - "algorithm": "hash", - "hash": [ + "algorithm": "Hash", + "Hash": [ "3ffe7ffefc3ff81fe01f001f001f003e007e01fc07f81fe03fc07e00ffffffff" ] }, "BattleOperCost3": { - "algorithm": "hash", - "hash": [ + "algorithm": "Hash", + "Hash": [ "3ffe7ffffc3ff81fe01f001f03fe07fc07fe003f001fe01fe01ff83fffff7ffe", "07f01ffe700e700700070007000c0078003c000700070007e007700e1e7e0ff0" ] }, "BattleOperCost4": { - "algorithm": "hash", - "hash": [ + "algorithm": "Hash", + "Hash": [ "007c00fc01fc03fc03fc0fbc1f3c3f3c7e3cfc3cffffffffffff003c003c003c" ] }, "BattleOperCost5": { - "algorithm": "hash", - "hash": [ + "algorithm": "Hash", + "Hash": [ "3ffe7c007c0078007ff87ffe7ffe7c3f781f0007e007f81ffc1fffff7ffe3ffc", "3ffe38003800780070007ff87ffe703e000f000fc00ff81ffc3f7ffe3ffc07e0" ] }, "BattleOperCost6": { - "algorithm": "hash", - "hash": [ + "algorithm": "Hash", + "Hash": [ "03c003800f001f003e003ff87ffc7c3ef00ee00fe007e00ff00e7c3e3ffc1ff8" ] }, "BattleOperCost7": { - "algorithm": "hash", - "hash": [ + "algorithm": "Hash", + "Hash": [ "ffffffff003e007e007c00f800f801f001f003c003c00f801f001f003e003e00" ] }, "BattleOperCost8": { - "algorithm": "hash", - "hash": [ + "algorithm": "Hash", + "Hash": [ "3ffc7ffe7c3e700e700e7c7e7ffc3ffc7ffefefef00fe00ff00ff03ffffe7ffe" ] }, "BattleOperCost9": { - "algorithm": "hash", - "hash": [ + "algorithm": "Hash", + "Hash": [ "3ffc7ffe7c3ff00ff007f007f00ffc0f7fff3ffe1ffe00fc01f803f00ff00fc0" ] }, @@ -3418,94 +3405,91 @@ ] }, "BattleHpChannelH": { - "algorithm": "hash", - "hash": [ - ], + "algorithm": "Hash", + "Hash": [], "maskRange": [ 0, 1 ] }, "BattleHpChannelS": { - "algorithm": "hash", - "hash": [ - ], + "algorithm": "Hash", + "Hash": [], "maskRange": [ 120, 150 ] }, "BattleHpChannelV": { - "algorithm": "hash", - "hash": [ - ], + "algorithm": "Hash", + "Hash": [], "maskRange": [ 170, 255 ] }, "BattleHp0": { - "algorithm": "hash", - "hash": [ + "algorithm": "Hash", + "Hash": [ "03e007fc3c0638066003400140014001c001400140016003600338061e1c07f8" ] }, "BattleHp1": { - "algorithm": "hash", - "hash": [ + "algorithm": "Hash", + "Hash": [ "003f01ff1ffffe0f000700070007000700070007000700070007000700070007" ] }, "BattleHp2": { - "algorithm": "hash", - "hash": [ + "algorithm": "Hash", + "Hash": [ "07e03c3c2007c0030003000300030007001c003800e003c004003800f800ffff" ] }, "BattleHp3": { - "algorithm": "hash", - "hash": [ + "algorithm": "Hash", + "Hash": [ "0ff07e78700ee00700070006000e03f80078000e000700078007e00e703e1ff8" ] }, "BattleHp4": { - "algorithm": "hash", - "hash": [ + "algorithm": "Hash", + "Hash": [ "0010003c007c007c01dc039c061c0c1c381c301c783effff001c001c001c001c" ] }, "BattleHp5": { - "algorithm": "hash", - "hash": [ + "algorithm": "Hash", + "Hash": [ "1ff87ffe7000600060006000fff0f038e00e0006000700078007e00e703e1ff0" ] }, "BattleHp6": { - "algorithm": "hash", - "hash": [ + "algorithm": "Hash", + "Hash": [ "018002000e000c0010003fe07808f004c006800380018003c007e006300c1ff0" ] }, "BattleHp7": { - "algorithm": "hash", - "hash": [ + "algorithm": "Hash", + "Hash": [ "7fffffff00070006000e003800380070004001c0018003800e000e001c001000" ] }, "BattleHp8": { - "algorithm": "hash", - "hash": [ + "algorithm": "Hash", + "Hash": [ "0ff01038600ee006e006600670081ff01c7860068007800180018007600e1ff8" ] }, "BattleHp9": { - "algorithm": "hash", - "hash": [ + "algorithm": "Hash", + "Hash": [ "07e01e78700e6006e007e007e0076006700e1ffe011800700060008001800700" ] }, "BattleSpeedUp": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 1025, 0, @@ -3540,7 +3524,7 @@ }, "BattleUseSkillBegin": { "algorithm": "JustReturn", - "action": "doNothing", + "action": "DoNothing", "rearDelay": 1000, "next": [ "BattleUseSkill" @@ -3557,7 +3541,7 @@ 380, 150 ], - "action": "clickRect", + "action": "ClickRect", "specificRect": [ 820, 380, @@ -3567,7 +3551,7 @@ }, "StartToWakeUpToRoguelike1": { "template": "StartToWakeUp.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 520, 460, @@ -3585,7 +3569,7 @@ "text": [ "今日配给" ], - "action": "clickRect", + "action": "ClickRect", "specificRect": [ 1000, 1, @@ -3605,7 +3589,7 @@ }, "CloseAnnoToRoguelike1": { "template": "CloseAnno.png", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 1100, @@ -3621,7 +3605,7 @@ }, "TerminalToRoguelike1": { "template": "Terminal.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 880, 100, @@ -3636,7 +3620,7 @@ "rearDelay": 1000 }, "Roguelike1TodoEnter": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 908, @@ -3651,7 +3635,7 @@ }, "ReturnToRoguelike1": { "template": "Return.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 0, 0, @@ -3670,7 +3654,7 @@ }, "ReturnToRoguelike1Confirm": { "template": "PopupConfirm.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 630, 400, @@ -3685,7 +3669,7 @@ }, "OfflineConfirmToRoguelike1": { "template": "OfflineConfirm.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 310, 409, @@ -3699,7 +3683,7 @@ ] }, "Roguelike1Begin": { - "algorithm": "justReturn", + "algorithm": "JustReturn", "next": [ "Roguelike1Start", "Roguelike1ExitThenAbandon", @@ -3715,7 +3699,7 @@ ] }, "Roguelike1Continue": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 1032, @@ -3730,7 +3714,7 @@ ] }, "Roguelike1Start": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 1026, @@ -3746,7 +3730,7 @@ }, "Roguelike1InitalDrop": { "Doc": "古堡观光(简单模式)初始会有一个免费道具,点确认", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 569, 583, @@ -3759,7 +3743,7 @@ }, "Roguelike1LastReward": { "Doc": "你的上一次探索突破了至少两层困难,这一次可以获得更多支援——热水壶", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 174, @@ -3773,7 +3757,7 @@ }, "Roguelike1LastReward2": { "Doc": "你的上一次探索突破了至少两层困难,这一次可以获得更多支援—— 5 源石锭", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 174, @@ -3787,7 +3771,7 @@ }, "Roguelike1LastReward3": { "Doc": "你的上一次探索突破了至少两层困难,这一次可以获得更多支援—— 3 目标生命", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 174, @@ -3801,7 +3785,7 @@ }, "Roguelike1LastRewardRand": { "Doc": "你的上一次探索突破了至少两层困难,这一次可以获得更多支援—— 问号", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 174, @@ -3815,7 +3799,7 @@ }, "Roguelike1LastRewardConfirm": { "template": "Roguelike1RecruitConfirm.png", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 174, @@ -3828,7 +3812,7 @@ ] }, "Roguelike1Recruit1": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 0, @@ -3841,7 +3825,7 @@ ] }, "Roguelike1RecruitConfirm": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 0, @@ -3858,7 +3842,7 @@ ] }, "Roguelike1Team3": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 601, @@ -3871,7 +3855,7 @@ ] }, "Roguelike1TeamConfirm": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 0, @@ -3884,7 +3868,7 @@ ] }, "Roguelike1RecruitMain": { - "action": "clickSelf", + "action": "ClickSelf", "template": "Roguelike1Recruit.png", "cache": false, "roi": [ @@ -3899,7 +3883,7 @@ "rearDelay": 1000 }, "Roguelike1RecruitOther": { - "action": "clickSelf", + "action": "ClickSelf", "template": "Roguelike1Recruit.png", "cache": false, "roi": [ @@ -3915,7 +3899,7 @@ }, "Roguelike1ChooseOper": { "algorithm": "OcrDetect", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "Doc": "所有肉鸽可能招募的干员,不在列表里的不会则被招募,可以手动修改,在前面的会优先招募", "Doc2": "画面中如果既有低星又有高星,说明希望不够(高星是灰的不让选,但也被识别到了),所以尽量把低星的放前面,优先招募", @@ -3998,7 +3982,7 @@ ] }, "Roguelike1ChooseOperConfirm": { - "action": "clickself", + "action": "ClickSelf", "roi": [ 1016, 602, @@ -4013,7 +3997,7 @@ }, "Roguelike1RecruitSkip": { "template": "RecruitSkip.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 1100, 0, @@ -4029,8 +4013,8 @@ }, "Roguelike1RecruitWithoutButton": { "template": "RecruitSkipWithoutButton.png", - "algorithm": "justReturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 1180, 15, @@ -4045,7 +4029,7 @@ ] }, "Roguelike1EnterAfterRecruit": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 1078, 234, @@ -4065,7 +4049,7 @@ }, "Roguelike1StageTrader": { "Doc": "诡异行商(交易所)", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 0, @@ -4086,7 +4070,7 @@ ] }, "Roguelike1StageTraderEnter": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 1035, @@ -4102,7 +4086,7 @@ }, "Roguelike1StageSafeHouse": { "Doc": "安全的角落", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 0, @@ -4123,7 +4107,7 @@ ] }, "Roguelike1StageSafeHouseEnter": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 1037, @@ -4140,7 +4124,7 @@ }, "Roguelike1StageTraderInvestSystem": { "templThreshold": 0.75, - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 365, 51, @@ -4152,7 +4136,7 @@ ] }, "Roguelike1StageTraderInvestSystemEnter": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 417, 228, @@ -4166,7 +4150,7 @@ ] }, "Roguelike1StageTraderInvestConfirm": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 852, 422, @@ -4186,7 +4170,7 @@ ] }, "Roguelike1StageTraderInvestSystemError": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 508, @@ -4217,7 +4201,7 @@ ] }, "Roguelike1StageTraderInvestCancel": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 507, 418, @@ -4232,7 +4216,7 @@ ] }, "Roguelike1StageTraderInvestSystemLeave": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 682, 420, @@ -4244,7 +4228,7 @@ ] }, "Roguelike1StageTraderLeave": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 1046, @@ -4260,7 +4244,7 @@ ] }, "Roguelike1ExitThenAbandon": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 0, 0, @@ -4273,7 +4257,7 @@ ] }, "Roguelike1Abandon": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 1076, 243, @@ -4285,7 +4269,7 @@ ] }, "Roguelike1AbandonConfirm": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 720, 413, @@ -4298,7 +4282,7 @@ ] }, "Roguelike1StageTraderLeaveConfirm": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 985, @@ -4318,7 +4302,7 @@ }, "Roguelike1StageEncounter": { "Doc": "不期而遇(随机奖励)", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 0, @@ -4340,7 +4324,7 @@ }, "Roguelike1StageBoons": { "Doc": "古堡馈赠(随机奖励)", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 0, @@ -4361,7 +4345,7 @@ ] }, "Roguelike1StageEncounterEnter": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 1037, @@ -4377,7 +4361,7 @@ ] }, "Roguelike1StageEncounterFree": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 1100, @@ -4392,7 +4376,7 @@ ] }, "Roguelike1StageEncounterLeave": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 1100, @@ -4407,7 +4391,7 @@ ] }, "Roguelike1StageEncounterUnknown": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 950, @@ -4422,7 +4406,7 @@ ] }, "Roguelike1StageEncounterLeaveConfirm": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 1069, @@ -4444,7 +4428,7 @@ }, "Roguelike1StageEncounterSpecialClose": { "Doc": "关掉“大锁”", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 570, 400, @@ -4458,7 +4442,7 @@ }, "Roguelike1StageEncounterGiveUpRecruit": { "template": "Roguelike1ChooseOperConfirm.png", - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 1016, 602, @@ -4471,7 +4455,7 @@ ] }, "Roguelike1StageEncounterGiveUpRecruitConfirm": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 613, 410, @@ -4484,8 +4468,8 @@ ] }, "Roguelike1StageEncounterClickToLeave": { - "algorithm": "justReturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 600, 600, @@ -4501,7 +4485,7 @@ }, "Roguelike1StageCambatDps": { "Doc": "普通作战", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 0, @@ -4523,7 +4507,7 @@ "next_Doc": "普通作战和紧急作战的图比较像,有时候会识别错,这里的next把两个开始的按钮都放进来,提高容错" }, "Roguelike1StageCambatDpsEnter": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 1036, @@ -4537,7 +4521,7 @@ }, "Roguelike1StageEmergencyDps": { "Doc": "紧急作战", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 0, @@ -4559,7 +4543,7 @@ "next_Doc": "普通作战和紧急作战的图比较像,有时候会识别错,这里的next把两个开始的按钮都放进来,提高容错" }, "Roguelike1StageEmergencyDpsEnter": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 1036, @@ -4573,7 +4557,7 @@ }, "Roguelike1StageDreadfulFoe": { "Doc": "险路恶敌(boss关卡)", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 0, @@ -4596,7 +4580,7 @@ "next_Doc": "普通作战和紧急作战的图比较像,有时候会识别错,这里的next把两个开始的按钮都放进来,提高容错" }, "Roguelike1StageDreadfulFoeEnter": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 1036, @@ -4609,7 +4593,7 @@ ] }, "Roguelike1QuickFormation": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 817, 0, @@ -4644,7 +4628,7 @@ ] }, "Roguelike1FormationConfirm": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 1015, 601, @@ -4656,7 +4640,7 @@ ] }, "Roguelike1StartAction": { - "action": "clickSelf", + "action": "ClickSelf", "roi": [ 905, 593, @@ -4681,7 +4665,7 @@ 380, 150 ], - "action": "doNothing", + "action": "DoNothing", "rearDelay": 5000, "next": [ "Roguelike1InBattleFlag", @@ -4702,8 +4686,8 @@ ] }, "Roguelike1ClickToDrops": { - "algorithm": "justReturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 600, 600, @@ -4755,7 +4739,7 @@ }, "Roguelike1GetDrop1": { "Doc": "源石锭,绿色的“拿走”按钮", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 0, @@ -4769,7 +4753,7 @@ }, "Roguelike1GetDrop2": { "Doc": "希望,黄色的“拿走”按钮", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 0, @@ -4784,7 +4768,7 @@ }, "Roguelike1GetDrop3": { "Doc": "未知的剧目,黄色的“翻开”按钮", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 0, @@ -4798,7 +4782,7 @@ }, "Roguelike1GetDropRecruit": { "Doc": "招募券,白色的“招募”按钮", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 0, @@ -4814,7 +4798,7 @@ ] }, "Roguelike1GetDropCompleted": { - "action": "clickRect", + "action": "ClickRect", "specificRect": [ 600, 600, @@ -4828,7 +4812,7 @@ }, "Roguelike1GetDropLeave": { "Doc": "不要了,走了(", - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 0, @@ -4842,7 +4826,7 @@ ] }, "Roguelike1GetDropLeaveConfirm": { - "action": "clickSelf", + "action": "ClickSelf", "cache": false, "roi": [ 0, @@ -4885,8 +4869,8 @@ ] }, "Roguelike1ClickToStartPoint": { - "algorithm": "justReturn", - "action": "clickRect", + "algorithm": "JustReturn", + "action": "ClickRect", "specificRect": [ 600, 600, diff --git a/src/MeoAssistant/MeoAssistant.vcxproj b/src/MeoAssistant/MeoAssistant.vcxproj index a01c444ea5..5507ee5019 100644 --- a/src/MeoAssistant/MeoAssistant.vcxproj +++ b/src/MeoAssistant/MeoAssistant.vcxproj @@ -271,7 +271,7 @@ xcopy /e /y /i /c $(SolutionDir)3rdparty\resource $(TargetDir)resource - + \ No newline at end of file From f5eb37583a98d4e0aa37c50b1476f41f37d1b975 Mon Sep 17 00:00:00 2001 From: MistEO Date: Tue, 8 Mar 2022 10:03:30 +0800 Subject: [PATCH 2/4] =?UTF-8?q?docs.=E4=BF=AE=E5=A4=8D=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/回调消息协议.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/回调消息协议.md b/docs/回调消息协议.md index 4646d776c2..fb729a5931 100644 --- a/docs/回调消息协议.md +++ b/docs/回调消息协议.md @@ -63,8 +63,7 @@ Todo "details": { "adb": string, // AsstConnect 接口 adb_path 参数 "address": string, // AsstConnect 接口 address 参数 - "config": string, // AsstConnect 接口 config 参数 - "uuid": string // 设备唯一码(连接失败时为空) + "config": string // AsstConnect 接口 config 参数 } } From f6ab307db0807b6dbf9a85019d3ba01980d4bff0 Mon Sep 17 00:00:00 2001 From: MistEO Date: Tue, 8 Mar 2022 10:08:55 +0800 Subject: [PATCH 3/4] =?UTF-8?q?chore.=E5=90=8C=E6=AD=A5=E5=9B=9E=E8=B0=83?= =?UTF-8?q?=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MeoAssistant/Controller.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/MeoAssistant/Controller.cpp b/src/MeoAssistant/Controller.cpp index add5f9dc68..47a2c5fbdf 100644 --- a/src/MeoAssistant/Controller.cpp +++ b/src/MeoAssistant/Controller.cpp @@ -618,7 +618,12 @@ bool asst::Controller::connect(const std::string & adb_path, const std::string & json::value info = json::object{ { "what", "ConnectFailed" }, { "why", "ConfigNotFound" }, - { "details", json::object{} } + { "uuid", ""}, + { "details", json::object { + { "adb", adb_path }, + { "address", address }, + { "config", config } + }} }; m_callback(AsstMsg::ConnectionInfo, info, m_callback_arg); return false; @@ -652,8 +657,7 @@ bool asst::Controller::connect(const std::string & adb_path, const std::string & { "details", json::object { { "adb", adb_path }, { "address", address }, - { "config", config }, - { "uuid", "" } + { "config", config } }} }; m_callback(AsstMsg::ConnectionInfo, info, m_callback_arg); From 21c0a73647b873e99bb18582e6daea175a8f86e5 Mon Sep 17 00:00:00 2001 From: MistEO Date: Tue, 8 Mar 2022 17:27:00 +0800 Subject: [PATCH 4/4] =?UTF-8?q?chore.=E6=9B=B4=E6=96=B0meojson,=20?= =?UTF-8?q?=E5=B9=B6=E6=9B=B4=E6=96=B0=E4=B8=80=E4=BA=9B=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3rdparty/include/meojson/json.hpp | 408 +++++++++++++++++++++++++----- src/MeoAssistant/Controller.cpp | 121 ++++----- src/MeoAssistant/Controller.h | 1 + 3 files changed, 405 insertions(+), 125 deletions(-) diff --git a/3rdparty/include/meojson/json.hpp b/3rdparty/include/meojson/json.hpp index c584f86a17..cae2541caf 100644 --- a/3rdparty/include/meojson/json.hpp +++ b/3rdparty/include/meojson/json.hpp @@ -128,6 +128,30 @@ namespace json value& operator[](const std::string& key); value& operator[](std::string&& key); + value operator|(const object& rhs)&; + value operator|(object&& rhs)&; + value operator|(const object& rhs)&&; + value operator|(object&& rhs)&&; + + value& operator|=(const object& rhs); + value& operator|=(object&& rhs); + + //value operator&(const object& rhs)&; + //value operator&(object&& rhs)&; + //value operator&(const object& rhs)&&; + //value operator&(object&& rhs)&&; + + //value& operator&=(const object& rhs); + //value& operator&=(object&& rhs); + + value operator+(const array& rhs)&; + value operator+(array&& rhs)&; + value operator+(const array& rhs)&&; + value operator+(array&& rhs)&&; + + value& operator+=(const array& rhs); + value& operator+=(array&& rhs); + explicit operator bool() const { return as_boolean(); } explicit operator int() const { return as_integer(); } explicit operator long() const { return as_long(); } @@ -141,14 +165,19 @@ namespace json private: static var_t deep_copy(const var_t& src); + template - decltype(auto) get(std::tuple keys_then_default_value, std::index_sequence) const; + decltype(auto) get( + std::tuple keys_then_default_value, + std::index_sequence) const; template decltype(auto) get_aux(T&& default_value, FirstKey&& first, RestKeys &&... rest) const; template decltype(auto) get_aux(T&& default_value, UniqueKey&& first) const; + const std::string& as_basic_type_str() const; + std::string& as_basic_type_str(); value_type _type = value_type::Null; var_t _raw_data; @@ -164,6 +193,7 @@ namespace json { public: using raw_array = std::vector; + using value_type = raw_array::value_type; using iterator = raw_array::iterator; using const_iterator = raw_array::const_iterator; using reverse_iterator = raw_array::reverse_iterator; @@ -225,6 +255,14 @@ namespace json const value& operator[](size_t pos) const; value& operator[](size_t pos); + array operator+(const array& rhs)&; + array operator+(array&& rhs)&; + array operator+(const array& rhs)&&; + array operator+(array&& rhs)&&; + + array& operator+=(const array& rhs); + array& operator+=(array&& rhs); + array& operator=(const array&) = default; array& operator=(array&&) noexcept = default; @@ -243,13 +281,14 @@ namespace json { public: using raw_object = std::unordered_map; + using value_type = raw_object::value_type; using iterator = raw_object::iterator; using const_iterator = raw_object::const_iterator; public: object() = default; object(const object& rhs) = default; - object(object&& rhs) = default; + object(object&& rhs) noexcept = default; object(const raw_object& raw_obj); object(raw_object&& raw_obj); object(std::initializer_list init_list); @@ -283,6 +322,7 @@ namespace json const value& get(const std::string& key) const; template decltype(auto) emplace(Args &&...args); + template decltype(auto) insert(Args &&...args); void clear() noexcept; bool earse(const std::string& key); @@ -297,6 +337,22 @@ namespace json value& operator[](const std::string& key); value& operator[](std::string&& key); + object operator|(const object& rhs)&; + object operator|(object&& rhs)&; + object operator|(const object& rhs)&&; + object operator|(object&& rhs)&&; + + object& operator|=(const object& rhs); + object& operator|=(object&& rhs); + + //object operator&(const object& rhs)&; + //object operator&(object&& rhs)&; + //object operator&(const object& rhs)&&; + //object operator&(object&& rhs)&&; + + //object& operator&=(const object& rhs); + //object& operator&=(object&& rhs); + object& operator=(const object&) = default; object& operator=(object&&) = default; @@ -454,20 +510,12 @@ namespace json MEOJSON_INLINE const value& value::at(size_t pos) const { - if (is_array()) { - return std::get(_raw_data)->at(pos); - } - - throw exception("Wrong Type or data empty"); + return as_array().at(pos); } MEOJSON_INLINE const value& value::at(const std::string& key) const { - if (is_object()) { - return std::get(_raw_data)->at(key); - } - - throw exception("Wrong Type or data empty"); + return as_object().at(key); } template @@ -533,7 +581,7 @@ namespace json MEOJSON_INLINE bool value::as_boolean() const { if (is_boolean()) { - if (std::string b_str = std::get(_raw_data); + if (const std::string& b_str = as_basic_type_str(); b_str == "true") { return true; } @@ -552,7 +600,7 @@ namespace json MEOJSON_INLINE int value::as_integer() const { if (is_number()) { - return std::stoi(std::get(_raw_data)); + return std::stoi(as_basic_type_str()); } else { throw exception("Wrong Type"); @@ -574,7 +622,7 @@ namespace json MEOJSON_INLINE long value::as_long() const { if (is_number()) { - return std::stol(std::get(_raw_data)); + return std::stol(as_basic_type_str()); } else { throw exception("Wrong Type"); @@ -584,7 +632,7 @@ namespace json MEOJSON_INLINE unsigned long value::as_unsigned_long() const { if (is_number()) { - return std::stoul(std::get(_raw_data)); + return std::stoul(as_basic_type_str()); } else { throw exception("Wrong Type"); @@ -594,7 +642,7 @@ namespace json MEOJSON_INLINE long long value::as_long_long() const { if (is_number()) { - return std::stoll(std::get(_raw_data)); + return std::stoll(as_basic_type_str()); } else { throw exception("Wrong Type"); @@ -604,7 +652,7 @@ namespace json MEOJSON_INLINE unsigned long long value::as_unsigned_long_long() const { if (is_number()) { - return std::stoull(std::get(_raw_data)); + return std::stoull(as_basic_type_str()); } else { throw exception("Wrong Type"); @@ -614,7 +662,7 @@ namespace json MEOJSON_INLINE float value::as_float() const { if (is_number()) { - return std::stof(std::get(_raw_data)); + return std::stof(as_basic_type_str()); } else { throw exception("Wrong Type"); @@ -624,7 +672,7 @@ namespace json MEOJSON_INLINE double value::as_double() const { if (is_number()) { - return std::stod(std::get(_raw_data)); + return std::stod(as_basic_type_str()); } else { throw exception("Wrong Type"); @@ -634,7 +682,7 @@ namespace json MEOJSON_INLINE long double value::as_long_double() const { if (is_number()) { - return std::stold(std::get(_raw_data)); + return std::stold(as_basic_type_str()); } else { throw exception("Wrong Type"); @@ -644,7 +692,7 @@ namespace json MEOJSON_INLINE const std::string value::as_string() const { if (is_string()) { - return escape_string(std::get(_raw_data)); + return escape_string(as_basic_type_str()); } else { throw exception("Wrong Type"); @@ -671,11 +719,11 @@ namespace json MEOJSON_INLINE array& value::as_array() { - if (is_array()) { - return *std::get(_raw_data); - } - else if (empty()) { + if (empty()) { *this = array(); + } + + if (is_array()) { return *std::get(_raw_data); } @@ -684,17 +732,26 @@ namespace json MEOJSON_INLINE object& value::as_object() { - if (is_object()) { - return *std::get(_raw_data); - } - else if (empty()) { + if (empty()) { *this = object(); + } + + if (is_object()) { return *std::get(_raw_data); } throw exception("Wrong Type or data empty"); } + MEOJSON_INLINE const std::string& value::as_basic_type_str() const + { + return std::get(_raw_data); + } + MEOJSON_INLINE std::string& value::as_basic_type_str() + { + return std::get(_raw_data); + } + template MEOJSON_INLINE decltype(auto) value::array_emplace(Args &&...args) { @@ -719,13 +776,13 @@ namespace json return "null"; case value_type::Boolean: case value_type::Number: - return std::get(_raw_data); + return as_basic_type_str(); case value_type::String: - return '"' + std::get(_raw_data) + '"'; + return '"' + as_basic_type_str() + '"'; case value_type::Array: - return std::get(_raw_data)->to_string(); + return as_array().to_string(); case value_type::Object: - return std::get(_raw_data)->to_string(); + return as_object().to_string(); default: throw exception("Unknown Value Type"); } @@ -739,13 +796,13 @@ namespace json return "null"; case value_type::Boolean: case value_type::Number: - return std::get(_raw_data); + return as_basic_type_str(); case value_type::String: - return '"' + std::get(_raw_data) + '"'; + return '"' + as_basic_type_str() + '"'; case value_type::Array: - return std::get(_raw_data)->format(shift_str, basic_shift_count); + return as_array().format(shift_str, basic_shift_count); case value_type::Object: - return std::get(_raw_data)->format(shift_str, basic_shift_count); + return as_object().format(shift_str, basic_shift_count); default: throw exception("Unknown Value Type"); } @@ -763,50 +820,130 @@ namespace json MEOJSON_INLINE const value& value::operator[](size_t pos) const { - if (is_array()) { - return std::get(_raw_data)->operator[](pos); - } // Array not support to create by operator[] - throw exception("Wrong Type"); + return as_array()[pos]; } MEOJSON_INLINE value& value::operator[](size_t pos) { - if (is_array()) { - return std::get(_raw_data)->operator[](pos); - } // Array not support to create by operator[] - throw exception("Wrong Type"); + return as_array()[pos]; } MEOJSON_INLINE value& value::operator[](const std::string& key) { - if (is_object()) { - return std::get(_raw_data)->operator[](key); - } - // Create a new value by operator[] - else if (empty()) { + if (empty()) { *this = object(); - return std::get(_raw_data)->operator[](key); } - throw exception("Wrong Type"); + return as_object()[key]; } MEOJSON_INLINE value& value::operator[](std::string&& key) { - if (is_object()) { - return std::get(_raw_data)->operator[](key); - } - // Create a new value by operator[] - else if (empty()) { + if (empty()) { *this = object(); - return std::get(_raw_data)->operator[](key); } - throw exception("Wrong Type"); + return as_object()[std::move(key)]; + } + + MEOJSON_INLINE value value::operator|(const object& rhs)& + { + return as_object() | rhs; + } + + MEOJSON_INLINE value value::operator|(object&& rhs)& + { + return as_object() | std::move(rhs); + } + + MEOJSON_INLINE value value::operator|(const object& rhs)&& + { + return std::move(as_object()) | rhs; + } + + MEOJSON_INLINE value value::operator|(object&& rhs)&& + { + return std::move(as_object()) | std::move(rhs); + } + + MEOJSON_INLINE value& value::operator|=(const object& rhs) + { + as_object() |= rhs; + return *this; + } + + MEOJSON_INLINE value& value::operator|=(object&& rhs) + { + as_object() |= std::move(rhs); + return *this; + } + + //MEOJSON_INLINE value value::operator&(const object& rhs)& + //{ + // return as_object() & rhs; + //} + + //MEOJSON_INLINE value value::operator&(object&& rhs)& + //{ + // return as_object() & std::move(rhs); + //} + + //MEOJSON_INLINE value value::operator&(const object& rhs)&& + //{ + // return std::move(as_object()) & rhs; + //} + + //MEOJSON_INLINE value value::operator&(object&& rhs)&& + //{ + // return std::move(as_object()) & std::move(rhs); + //} + + //MEOJSON_INLINE value& value::operator&=(const object& rhs) + //{ + // as_object() &= rhs; + // return *this; + //} + + //MEOJSON_INLINE value& value::operator&=(object&& rhs) + //{ + // as_object() &= std::move(rhs); + // return *this; + //} + + MEOJSON_INLINE value value::operator+(const array& rhs)& + { + return as_array() + rhs; + } + + MEOJSON_INLINE value value::operator+(array&& rhs)& + { + return as_array() + std::move(rhs); + } + + MEOJSON_INLINE value value::operator+(const array& rhs)&& + { + return std::move(as_array()) + rhs; + } + + MEOJSON_INLINE value value::operator+(array&& rhs)&& + { + return std::move(as_array()) + std::move(rhs); + } + + MEOJSON_INLINE value& value::operator+=(const array& rhs) + { + as_array() += rhs; + return *this; + } + + MEOJSON_INLINE value& value::operator+=(array&& rhs) + { + as_array() += std::move(rhs); + return *this; } template @@ -1195,6 +1332,50 @@ namespace json return _array_data[pos]; } + MEOJSON_INLINE array array::operator+(const array& rhs)& + { + array temp = *this; + temp._array_data.insert(_array_data.end(), rhs.begin(), rhs.end()); + return temp; + } + + MEOJSON_INLINE array array::operator+(array&& rhs)& + { + array temp = *this; + temp._array_data.insert(_array_data.end(), + std::make_move_iterator(rhs.begin()), + std::make_move_iterator(rhs.end())); + return temp; + } + + MEOJSON_INLINE array array::operator+(const array& rhs)&& + { + _array_data.insert(_array_data.end(), rhs.begin(), rhs.end()); + return std::move(*this); + } + + MEOJSON_INLINE array array::operator+(array&& rhs)&& + { + _array_data.insert(_array_data.end(), + std::make_move_iterator(rhs.begin()), + std::make_move_iterator(rhs.end())); + return std::move(*this); + } + + MEOJSON_INLINE array& array::operator+=(const array& rhs) + { + _array_data.insert(_array_data.end(), rhs.begin(), rhs.end()); + return *this; + } + + MEOJSON_INLINE array& array::operator+=(array&& rhs) + { + _array_data.insert(_array_data.end(), + std::make_move_iterator(rhs.begin()), + std::make_move_iterator(rhs.end())); + return *this; + } + // const raw_array &array::raw_data() const // { // return _array_data; @@ -1211,6 +1392,11 @@ namespace json return _object_data.emplace(std::forward(args)...); } + template decltype(auto) object::insert(Args &&...args) + { + return _object_data.insert(std::forward(args)...); + } + MEOJSON_INLINE std::ostream& operator<<(std::ostream& out, const array& arr) { // TODO: format output @@ -1528,6 +1714,108 @@ namespace json return _object_data[std::move(key)]; } + MEOJSON_INLINE object object::operator|(const object& rhs)& + { + object temp = *this; + temp._object_data.insert(rhs.begin(), rhs.end()); + return temp; + } + + MEOJSON_INLINE object object::operator|(object&& rhs)& + { + object temp = *this; + //temp._object_data.merge(std::move(rhs._object_data)); + temp._object_data.insert( + std::make_move_iterator(rhs.begin()), + std::make_move_iterator(rhs.end())); + return temp; + } + + MEOJSON_INLINE object object::operator|(const object& rhs)&& + { + _object_data.insert(rhs.begin(), rhs.end()); + return std::move(*this); + } + + MEOJSON_INLINE object object::operator|(object&& rhs)&& + { + //_object_data.merge(std::move(rhs._object_data)); + _object_data.insert( + std::make_move_iterator(rhs.begin()), + std::make_move_iterator(rhs.end())); + return std::move(*this); + } + + MEOJSON_INLINE object& object::operator|=(const object& rhs) + { + _object_data.insert(rhs.begin(), rhs.end()); + return *this; + } + + MEOJSON_INLINE object& object::operator|=(object&& rhs) + { + _object_data.insert( + std::make_move_iterator(rhs.begin()), + std::make_move_iterator(rhs.end())); + return *this; + } + + //MEOJSON_INLINE object object::operator&(const object& rhs)& + //{ + // object temp; + // for (const auto& [key, value] : *this) { + // if (rhs.contains(key)) { + // temp.emplace(key, value); + // } + // } + // return temp; + //} + + //MEOJSON_INLINE object object::operator&(object&& rhs)& + //{ + // object temp; + // for (const auto& [key, value] : *this) { + // if (rhs.contains(key)) { + // temp.emplace(key, value); + // } + // } + // return temp; + //} + + //MEOJSON_INLINE object object::operator&(const object& rhs)&& + //{ + // object temp; + // for (auto&& [key, value] : *this) { + // if (rhs.contains(key)) { + // temp.emplace(key, std::move(value)); + // } + // } + // return temp; + //} + + //MEOJSON_INLINE object object::operator&(object&& rhs)&& + //{ + // object temp; + // for (auto&& [key, value] : *this) { + // if (rhs.contains(key)) { + // temp.emplace(key, std::move(value)); + // } + // } + // return temp; + //} + + //MEOJSON_INLINE object& object::operator&=(const object& rhs) + //{ + // *this = std::move(*this) & rhs; + // return *this; + //} + + //MEOJSON_INLINE object& object::operator&=(object&& rhs) + //{ + // *this = std::move(*this) & std::move(rhs); + // return *this; + //} + // const raw_object &object::raw_data() const // { // return _object_data; diff --git a/src/MeoAssistant/Controller.cpp b/src/MeoAssistant/Controller.cpp index 47a2c5fbdf..429372791b 100644 --- a/src/MeoAssistant/Controller.cpp +++ b/src/MeoAssistant/Controller.cpp @@ -354,6 +354,16 @@ void asst::Controller::random_delay() const Log.trace("random_delay |", rand_delay, "ms"); std::this_thread::sleep_for(std::chrono::milliseconds(rand_delay)); } +} + +void asst::Controller::clear_info() noexcept +{ + m_adb = decltype(m_adb)(); + m_uuid.clear(); + m_width = 0; + m_height = 0; + m_control_scale = 1.0; + m_scale_size = decltype(m_scale_size)(); } int asst::Controller::push_cmd(const std::string & cmd) @@ -613,18 +623,25 @@ bool asst::Controller::connect(const std::string & adb_path, const std::string & { LogTraceFunction; - auto adb_ret = Resrc.cfg().get_adb_cfg(config); - if (!adb_ret) { - json::value info = json::object{ - { "what", "ConnectFailed" }, - { "why", "ConfigNotFound" }, - { "uuid", ""}, + clear_info(); + + auto get_info_json = [&]() -> json::value { + return json::object{ + { "uuid", m_uuid}, { "details", json::object { { "adb", adb_path }, { "address", address }, { "config", config } }} }; + }; + + auto adb_ret = Resrc.cfg().get_adb_cfg(config); + if (!adb_ret) { + json::value info = get_info_json() | + json::object{ + { "what", "ConnectFailed" }, + { "why", "ConfigNotFound" }}; m_callback(AsstMsg::ConnectionInfo, info, m_callback_arg); return false; } @@ -650,15 +667,10 @@ bool asst::Controller::connect(const std::string & adb_path, const std::string & auto connect_ret = call_command(cmd_replace(adb_cfg.connect)); // 端口即使错误,命令仍然会返回0,TODO 对connect_result进行判断 if (!connect_ret) { - json::value info = json::object{ - { "what", "ConnectFailed" }, - { "why", "Connection command failed to exec" }, - { "uuid", ""}, - { "details", json::object { - { "adb", adb_path }, - { "address", address }, - { "config", config } - }} + json::value info = get_info_json() | + json::object{ + { "what", "ConnectFailed" }, + { "why", "Connection command failed to exec" } }; m_callback(AsstMsg::ConnectionInfo, info, m_callback_arg); return false; @@ -669,16 +681,11 @@ bool asst::Controller::connect(const std::string & adb_path, const std::string & { auto uuid_ret = call_command(cmd_replace(adb_cfg.uuid)); if (!uuid_ret) { - json::value info = json::object{ - { "what", "ConnectFailed" }, - { "why", "Uuid command failed to exec" }, - { "uuid", "" }, - { "details", json::object { - { "adb", adb_path }, - { "address", address }, - { "config", config } - }} - }; + json::value info = get_info_json() | + json::object{ + { "what", "ConnectFailed" }, + { "why", "Uuid command failed to exec" } + }; m_callback(AsstMsg::ConnectionInfo, info, m_callback_arg); return false; } @@ -690,17 +697,12 @@ bool asst::Controller::connect(const std::string & adb_path, const std::string & uuid_str.erase(std::remove(uuid_str.begin(), uuid_str.end(), ' '), uuid_str.end()); m_uuid = std::move(uuid_str); - json::value info = json::object{ - { "what", "UuidGetted" }, - { "why", "" }, - { "uuid", m_uuid }, - { "details", json::object { - { "uuid", m_uuid }, - { "adb", adb_path }, - { "address", address }, - { "config", config } - }} - }; + json::value info = get_info_json() | + json::object{ + { "what", "UuidGetted" }, + { "why", "" } + }; + info["details"]["uuid"] = m_uuid; m_callback(AsstMsg::ConnectionInfo, info, m_callback_arg); } @@ -730,16 +732,11 @@ bool asst::Controller::connect(const std::string & adb_path, const std::string & { auto display_ret = call_command(cmd_replace(adb_cfg.display)); if (!display_ret) { - json::value info = json::object{ - { "what", "ConnectFailed" }, - { "why", "Display command failed to exec" }, - { "uuid", m_uuid }, - { "details", json::object { - { "adb", adb_path }, - { "address", address }, - { "config", config } - }} - }; + json::value info = get_info_json() | + json::object{ + { "what", "ConnectFailed" }, + { "why", "Display command failed to exec" } + }; m_callback(AsstMsg::ConnectionInfo, info, m_callback_arg); return false; } @@ -760,18 +757,17 @@ bool asst::Controller::connect(const std::string & adb_path, const std::string & m_width = (std::max)(size_value1, size_value2); m_height = (std::min)(size_value1, size_value2); - json::value info = json::object{ + json::value info = get_info_json() | + json::object{ { "what", "ResolutionGetted" }, - { "why", "" }, - { "uuid", m_uuid }, - { "details", json::object { - { "adb", adb_path }, - { "address", address }, - { "config", config }, + { "why", "" } + }; + + info["details"] |= json::object { { "width", m_width }, { "height", m_height } - }} - }; + }; + m_callback(AsstMsg::ConnectionInfo, info, m_callback_arg); } @@ -795,16 +791,11 @@ bool asst::Controller::connect(const std::string & adb_path, const std::string & } { - json::value info = json::object{ - { "what", "Connected" }, - { "why", "" }, - { "uuid", m_uuid }, - { "details", json::object { - { "adb", adb_path }, - { "address", address }, - { "config", config } - }} - }; + json::value info = get_info_json() | + json::object{ + { "what", "Connected" }, + { "why", "" } + }; m_callback(AsstMsg::ConnectionInfo, info, m_callback_arg); } diff --git a/src/MeoAssistant/Controller.h b/src/MeoAssistant/Controller.h index dcdcd7f228..745f25938d 100644 --- a/src/MeoAssistant/Controller.h +++ b/src/MeoAssistant/Controller.h @@ -70,6 +70,7 @@ namespace asst Point rand_point_in_rect(const Rect& rect); void random_delay() const; + void clear_info() noexcept; // 转换data中所有的crlf为lf:有些模拟器自带的adb,exec-out输出的\n,会被替换成\r\n,导致解码错误,所以这里转一下回来(点名批评mumu) static void convert_lf(std::vector& data);