diff --git a/resource/config.json b/resource/config.json index 671fb4561c..83e1eca113 100644 --- a/resource/config.json +++ b/resource/config.json @@ -1,170 +1,170 @@ { - "version": "0.8", - "options": { - "connectType": 0, - "connectType_Doc": "连接类型:0-连接电脑上的模拟器,1-连接USB连接的安卓设备,2-连接局域网中的安卓设备。默认0", - "connectRemoteAddress": "", - "connectRemoteAddress_Doc": "连接局域网中的安卓设备的地址,仅在connectType为2时生效。格式举例:192.168.1.123:5678", - "taskDelay": 1000, - "taskDelay_Doc": "识别的延迟:越快识别频率越快,但会增加CPU消耗。单位毫秒,默认1000", - "printWindow": false, - "printWindow_Doc": "截图功能:开启后每次结算界面会截图到screenshot目录下。true-开启,false-关闭,默认false", - "penguinReport": true, - "penguinReport_Doc": "企鹅数据汇报:每次到结算界面,是否汇报掉落数据至企鹅数据 https://penguin-stats.cn/。true-开启,false-关闭,默认true", - "penguinReportCmdLine": "curl -H \"Content-Type: application/json\" -d \"[body]\" \"https://penguin-stats.cn/PenguinStats/api/v2/report\"", - "penguinReportCmdLine_Doc": "企鹅数据汇报的命令,想打印详细信息可以尝试添加 -v -i", - "controlDelayRange": [ - 0, - 0 - ], - "controlDelayRange_Doc": "点击随机延时:每次点击操作会进行随机延时,降低封号风险(好像也没听说过谁被封号的)。格式为 [ 最小延时, 最大延时 ],单位为毫秒。例如想设置3~5秒延时,即修改为[ 3000, 5000 ],默认0~0", - "ocrThreadNumber": 4, - "ocrThreadNumber_Doc": "文字识别库OcrLite的线程数量,理论上开的高点识别会快点,但是会更卡。默认4", - "adbExtraSwipeDist": 50, - "adbExtraSwipeDist_Doc": "额外的滑动距离:adb有bug,同样的参数,偶尔会划得非常远。额外做一个短程滑动,把之前的停下来", - "adbExtraSwipeDuration": 1000, - "adbExtraSwipeDuration_Doc": "额外的滑动持续时间:adb有bug,同样的参数,偶尔会划得非常远。额外做一个短程滑动,把之前的停下来。若小于0,则关闭额外滑动功能" + "version": "0.8", + "options": { + "connectType": 0, + "connectType_Doc": "连接类型:0-连接电脑上的模拟器,1-连接USB连接的安卓设备,2-连接局域网中的安卓设备。默认0", + "connectRemoteAddress": "", + "connectRemoteAddress_Doc": "连接局域网中的安卓设备的地址,仅在connectType为2时生效。格式举例:192.168.1.123:5678", + "taskDelay": 1000, + "taskDelay_Doc": "识别的延迟:越快识别频率越快,但会增加CPU消耗。单位毫秒,默认1000", + "printWindow": false, + "printWindow_Doc": "截图功能:开启后每次结算界面会截图到screenshot目录下。true-开启,false-关闭,默认false", + "penguinReport": true, + "penguinReport_Doc": "企鹅数据汇报:每次到结算界面,是否汇报掉落数据至企鹅数据 https://penguin-stats.cn/。true-开启,false-关闭,默认true", + "penguinReportCmdLine": "curl -H \"Content-Type: application/json\" -d \"[body]\" \"https://penguin-stats.cn/PenguinStats/api/v2/report\"", + "penguinReportCmdLine_Doc": "企鹅数据汇报的命令,想打印详细信息可以尝试添加 -v -i", + "controlDelayRange": [ + 0, + 0 + ], + "controlDelayRange_Doc": "点击随机延时:每次点击操作会进行随机延时,降低封号风险(好像也没听说过谁被封号的)。格式为 [ 最小延时, 最大延时 ],单位为毫秒。例如想设置3~5秒延时,即修改为[ 3000, 5000 ],默认0~0", + "ocrThreadNumber": 4, + "ocrThreadNumber_Doc": "文字识别库OcrLite的线程数量,理论上开的高点识别会快点,但是会更卡。默认4", + "adbExtraSwipeDist": 50, + "adbExtraSwipeDist_Doc": "额外的滑动距离:adb有bug,同样的参数,偶尔会划得非常远。额外做一个短程滑动,把之前的停下来", + "adbExtraSwipeDuration": 1000, + "adbExtraSwipeDuration_Doc": "额外的滑动持续时间:adb有bug,同样的参数,偶尔会划得非常远。额外做一个短程滑动,把之前的停下来。若小于0,则关闭额外滑动功能" + }, + "emulator_Doc": "下面的和模拟器窗口捕获逻辑有关,不需要修改", + "emulator": { + "BlueStacks": { + "handle": { + "class": "BS2CHINAUI", + "window": "BlueStacks App Player" + }, + "adb": { + "path": "[EmulatorPath]Engine\\ProgramFiles\\HD-Adb.exe", + "devices": "[Adb] devices", + "addressRegex": "(.+)\tdevice", + "connect": "[Adb] connect [Address]", + "click": "[Adb] -s [Address] shell input tap [x] [y]", + "swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]", + "display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '", + "displayFormat": "cur=%dx%d", + "screencap": "[Adb] -s [Address] exec-out screencap -p" + } }, - "emulator_Doc": "下面的和模拟器窗口捕获逻辑有关,不需要修改", - "emulator": { - "BlueStacks": { - "handle": { - "class": "BS2CHINAUI", - "window": "BlueStacks App Player" - }, - "adb": { - "path": "[EmulatorPath]Engine\\ProgramFiles\\HD-Adb.exe", - "devices": "[Adb] devices", - "addressRegex": "(.+)\tdevice", - "connect": "[Adb] connect [Address]", - "click": "[Adb] -s [Address] shell input tap [x] [y]", - "swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]", - "display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '", - "displayFormat": "cur=%dx%d", - "screencap": "[Adb] -s [Address] exec-out screencap -p" - } - }, - "BlueStacksInternational": { - "handle": { - "class": "", - "window": "BlueStacks" - }, - "adb": { - "path": "[EmulatorPath]HD-Adb.exe", - "devices": "[Adb] devices", - "addressRegex": "(.+)\tdevice", - "connect": "[Adb] connect [Address]", - "click": "[Adb] -s [Address] shell input tap [x] [y]", - "swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]", - "display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '", - "displayFormat": "cur=%dx%d", - "screencap": "[Adb] -s [Address] exec-out screencap -p" - } - }, - "MuMuEmulator": { - "handle": { - "class": "Qt5QWindowIcon", - "window": "明日方舟 - MuMu模拟器" - }, - "adb": { - "path": "[EmulatorPath]..\\vmonitor\\bin\\adb_server.exe", - "devices": "[Adb] devices", - "addressRegex": "(.+)\tdevice", - "connect": "[Adb] connect [Address]", - "click": "[Adb] -s [Address] shell input tap [x] [y]", - "swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]", - "display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '", - "displayFormat": "cur=%dx%d", - "screencap": "[Adb] -s [Address] exec-out screencap -p" - } - }, - "LDPlayer": { - "handle": { - "class": "LDPlayerMainFrame", - "window": "" - }, - "adb": { - "path": "[EmulatorPath]adb.exe", - "devices": "[Adb] devices", - "addressRegex": "(.+)\tdevice", - "connect": "[Adb] connect [Address]", - "click": "[Adb] -s [Address] shell input tap [x] [y]", - "swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]", - "display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '", - "displayFormat": "cur=%dx%d", - "screencap": "[Adb] -s [Address] shell screencap -p" - } - }, - "Nox": { - "handle": { - "class": "Qt5QWindowIcon", - "window": "夜神模拟器" - }, - "adb": { - "path": "[EmulatorPath]nox_adb.exe", - "devices": "[Adb] devices", - "addressRegex": "(.+)\tdevice", - "connect": "[Adb] connect [Address]", - "click": "[Adb] -s [Address] shell input tap [x] [y]", - "swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]", - "display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '", - "displayFormat": "cur=%dx%d", - "screencap": "[Adb] -s [Address] exec-out screencap -p" - } - }, - "XYAZ": { - "handle": { - "class": "Qt5QWindowIcon", - "window": "逍遥模拟器" - }, - "adb": { - "path": "[EmulatorPath]adb.exe", - "devices": "[Adb] devices", - "addressRegex": "(.+)\tdevice", - "connect": "[Adb] connect [Address]", - "click": "[Adb] -s [Address] shell input tap [x] [y]", - "swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]", - "display": "[Adb] -s [Address] shell dumpsys window displays | grep init=", - "displayFormat": " init=%dx%d", - "screencap": "[Adb] -s [Address] shell screencap -p" - } - }, - "Remote": { - "handle": { - "class": "Remote Class", - "window": "Remote Window", - "Doc": "这俩不是用来捕获窗口的,是为了兼容现有的捕获模拟器的字段,随手写的,这两个字段实际不会使用到" - }, - "adb": { - "path": "[ExecDir]platform-tools\\adb.exe", - "devices": "[Adb] devices", - "addressRegex": "(.+)\tdevice", - "connect": "[Adb] connect [Address]", - "click": "[Adb] -s [Address] shell input tap [x] [y]", - "swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]", - "display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '", - "displayFormat": "cur=%dx%d", - "screencap": "[Adb] -s [Address] exec-out screencap -p" - } - }, - "USB": { - "handle": { - "class": "USB Class", - "window": "USB Window", - "Doc": "这俩不是用来捕获窗口的,是为了兼容现有的捕获模拟器的字段,随手写的,这两个字段实际不会使用到" - }, - "adb": { - "Doc": "USB连接暂时不兼容多设备的情况", - "path": "[ExecDir]platform-tools\\adb.exe", - "devices": "[Adb] devices", - "addressRegex": "(.+)\tdevice", - "connect": "[Adb] connect [Address]", - "click": "[Adb] -s [Address] shell input tap [x] [y]", - "swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]", - "display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '", - "displayFormat": "cur=%dx%d", - "screencap": "[Adb] -s [Address] exec-out screencap -p" - } - } + "BlueStacksInternational": { + "handle": { + "class": "", + "window": "BlueStacks" + }, + "adb": { + "path": "[EmulatorPath]HD-Adb.exe", + "devices": "[Adb] devices", + "addressRegex": "(.+)\tdevice", + "connect": "[Adb] connect [Address]", + "click": "[Adb] -s [Address] shell input tap [x] [y]", + "swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]", + "display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '", + "displayFormat": "cur=%dx%d", + "screencap": "[Adb] -s [Address] exec-out screencap -p" + } + }, + "MuMuEmulator": { + "handle": { + "class": "Qt5QWindowIcon", + "window": "明日方舟 - MuMu模拟器" + }, + "adb": { + "path": "[EmulatorPath]..\\vmonitor\\bin\\adb_server.exe", + "devices": "[Adb] devices", + "addressRegex": "(.+)\tdevice", + "connect": "[Adb] connect [Address]", + "click": "[Adb] -s [Address] shell input tap [x] [y]", + "swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]", + "display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '", + "displayFormat": "cur=%dx%d", + "screencap": "[Adb] -s [Address] exec-out screencap -p" + } + }, + "LDPlayer": { + "handle": { + "class": "LDPlayerMainFrame", + "window": "" + }, + "adb": { + "path": "[EmulatorPath]adb.exe", + "devices": "[Adb] devices", + "addressRegex": "(.+)\tdevice", + "connect": "[Adb] connect [Address]", + "click": "[Adb] -s [Address] shell input tap [x] [y]", + "swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]", + "display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '", + "displayFormat": "cur=%dx%d", + "screencap": "[Adb] -s [Address] shell screencap -p" + } + }, + "Nox": { + "handle": { + "class": "Qt5QWindowIcon", + "window": "夜神模拟器" + }, + "adb": { + "path": "[EmulatorPath]nox_adb.exe", + "devices": "[Adb] devices", + "addressRegex": "(.+)\tdevice", + "connect": "[Adb] connect [Address]", + "click": "[Adb] -s [Address] shell input tap [x] [y]", + "swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]", + "display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '", + "displayFormat": "cur=%dx%d", + "screencap": "[Adb] -s [Address] exec-out screencap -p" + } + }, + "XYAZ": { + "handle": { + "class": "Qt5QWindowIcon", + "window": "逍遥模拟器" + }, + "adb": { + "path": "[EmulatorPath]adb.exe", + "devices": "[Adb] devices", + "addressRegex": "(.+)\tdevice", + "connect": "[Adb] connect [Address]", + "click": "[Adb] -s [Address] shell input tap [x] [y]", + "swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]", + "display": "[Adb] -s [Address] shell dumpsys window displays | grep init=", + "displayFormat": " init=%dx%d", + "screencap": "[Adb] -s [Address] shell screencap -p" + } + }, + "Remote": { + "handle": { + "class": "Remote Class", + "window": "Remote Window", + "Doc": "这俩不是用来捕获窗口的,是为了兼容现有的捕获模拟器的字段,随手写的,这两个字段实际不会使用到" + }, + "adb": { + "path": "[ExecDir]platform-tools\\adb.exe", + "devices": "[Adb] devices", + "addressRegex": "(.+)\tdevice", + "connect": "[Adb] connect [Address]", + "click": "[Adb] -s [Address] shell input tap [x] [y]", + "swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]", + "display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '", + "displayFormat": "cur=%dx%d", + "screencap": "[Adb] -s [Address] exec-out screencap -p" + } + }, + "USB": { + "handle": { + "class": "USB Class", + "window": "USB Window", + "Doc": "这俩不是用来捕获窗口的,是为了兼容现有的捕获模拟器的字段,随手写的,这两个字段实际不会使用到" + }, + "adb": { + "Doc": "USB连接暂时不兼容多设备的情况", + "path": "[ExecDir]platform-tools\\adb.exe", + "devices": "[Adb] devices", + "addressRegex": "(.+)\tdevice", + "connect": "[Adb] connect [Address]", + "click": "[Adb] -s [Address] shell input tap [x] [y]", + "swipe": "[Adb] -s [Address] shell input swipe [x1] [y1] [x2] [y2] [duration]", + "display": "[Adb] -s [Address] shell dumpsys window displays | grep init= | awk ' { print $3 } '", + "displayFormat": "cur=%dx%d", + "screencap": "[Adb] -s [Address] exec-out screencap -p" + } } + } } \ No newline at end of file diff --git a/resource/infrast.json b/resource/infrast.json index b73bccb3bc..a32cce665e 100644 --- a/resource/infrast.json +++ b/resource/infrast.json @@ -1,1833 +1,1833 @@ { - "facility": [ - "Mfg", - "Trade", - "Power", - "Office", - "Reception" + "facility": [ + "Mfg", + "Trade", + "Power", + "Office", + "Reception" + ], + "Mfg": { + "Mfg_Doc": "制造站", + "products": [ + "CombatRecord", + "PureGold" ], - "Mfg": { - "Mfg_Doc": "制造站", - "products": [ - "CombatRecord", - "PureGold" + "maxNumOfOpers": 3, + "skills_Doc": "技能ID默认就是模板名(不带.png),name和intro实际都不产生作用,给人看的", + "skills": [ + { + "name": [ + "咪波·制造型" ], - "maxNumOfOpers": 3, - "skills_Doc": "技能ID默认就是模板名(不带.png),name和intro实际都不产生作用,给人看的", - "skills": [ - { - "name": [ - "咪波·制造型" - ], - "intro": "进驻制造站时,生产力+30%", - "template": "Bskill_man_spd3.png", - "efficient": { - "all": 30 - } - }, - { - "name": [ - "标准化·β", - "莱茵科技·β", - "红松骑士团·β" - ], - "intro": "进驻制造站时,生产力+25%", - "template": "Bskill_man_spd2.png", - "efficient": { - "all": 25 - } - }, - { - "name": [ - "标准化·α", - "莱茵科技·α", - "红松骑士团·α", - "磐蟹·豆豆" - ], - "intro": "进驻制造站时,生产力+15%", - "template": "Bskill_man_spd1.png", - "efficient": { - "all": 15 - } - }, - { - "name": [ - "大就是好!" - ], - "intro": "进驻制造站时,当前制造站内干员根据自身提升的仓库容量提供一定的生产力。提升16格以下的,每格仓库容量提供1%生产力;提升大于16格的,每格仓库容量提供3%生产力(无法与回收利用叠加,且优先生效)", - "template": "Bskill_man_spd_variable31.png" - }, - { - "name": [ - "配合意识" - ], - "intro": "进驻制造站时,当前制造站内其他干员提供的每5%生产力(不包含根据设施数量提供加成的生产力),额外提供5%生产力,最多提供40%生产力", - "template": "Bskill_man_spd_variable21.png", - "efficient": { - "all": 40 - } - }, - { - "name": [ - "回收利用" - ], - "intro": "进驻制造站时,当前制造站内干员提升的每格仓库容量,提供2%生产力", - "template": "Bskill_man_spd_variable11.png" - }, - { - "name": [ - "意识实体" - ], - "intro": "进驻制造站时,每1点思维链环+1%生产力", - "template": "Bskill_man_spd_bd2.png" - }, - { - "name": [ - "念力" - ], - "intro": "进驻制造站时,每2点思维链环+1%生产力", - "template": "Bskill_man_spd_bd1.png" - }, - { - "name": [ - "超感" - ], - "intro": "进驻制造站时,宿舍内每有1名干员则感知信息+1,同时每1点感知信息转化为1点思维链环", - "template": "Bskill_man_spd_bd_n1.png" - }, - { - "name": [ - "慢性子", - "延时摄影" - ], - "intro": "进驻制造站后,生产力首小时+15%,此后每小时+2%,最终达到+25%", - "template": "Bskill_man_spd_add2.png", - "efficient": { - "all": 23 - } - }, - { - "name": [ - "急性子", - "“等不及”" - ], - "intro": "进驻制造站后,生产力首小时+20%,此后每小时+1%,最终达到+25%", - "template": "Bskill_man_spd_add1.png", - "efficient": { - "all": 24 - } - }, - { - "name": [ - "再生能源" - ], - "intro": "进驻制造站时,每个贸易站为当前制造站贵金属类配方的生产力+20%", - "template": "Bskill_man_spd&trade.png", - "efficient": { - "PureGold_reg": "[NumOfTrade] * 20" - } - }, - { - "name": [ - "仿生海龙" - ], - "intro": "进驻制造站时,当前制造站内其他干员提供的生产力全部归零(不包含根据设施数量提供加成的生产力),每个发电站为当前制造站+15%的生产力", - "template": "Bskill_man_spd&power3.png" - }, - { - "name": [ - "自动化·β" - ], - "intro": "进驻制造站时,当前制造站内其他干员提供的生产力全部归零(不包含根据设施数量提供加成的生产力),每个发电站为当前制造站+10%的生产力", - "template": "Bskill_man_spd&power2.png" - }, - { - "name": [ - "自动化·α" - ], - "intro": "进驻制造站时,当前制造站内其他干员提供的生产力全部归零(不包含根据设施数量提供加成的生产力),每个发电站为当前制造站+5%的生产力", - "template": "Bskill_man_spd&power1.png" - }, - { - "name": [ - "仓库整备·β" - ], - "intro": "进驻制造站时,仓库容量上限+10,生产力+10%", - "template": "Bskill_man_spd&limit3.png", - "efficient": { - "all": 10 - } - }, - { - "name": [ - "仓库整备·α" - ], - "intro": "进驻制造站时,仓库容量上限+6,生产力+10%", - "template": "Bskill_man_spd&limit1.png", - "efficient": { - "all": 10 - } - }, - { - "name": [ - "“可靠”助手" - ], - "intro": "进驻制造站时,生产力-20%,仓库容量上限+17,心情每小时消耗-0.25", - "template": "Bskill_man_spd&limit&cost4.png" - }, - { - "name": [ - "特立独行", - "麻烦制造者" - ], - "intro": "进驻制造站时,生产力+25%,仓库容量上限-12,心情每小时消耗+0.25", - "template": "Bskill_man_spd&limit&cost3.png", - "efficient": { - "all": 24.9 - } - }, - { - "name": [ - "工匠精神·β" - ], - "intro": "进驻制造站时,生产力-5%,仓库容量上限+19,心情每小时消耗-0.25", - "template": "Bskill_man_spd&limit&cost2.png" - }, - { - "name": [ - "工匠精神·α" - ], - "intro": "进驻制造站时,生产力-5%,仓库容量上限+16,心情每小时消耗-0.15", - "template": "Bskill_man_spd&limit&cost1.png" - }, - { - "name": [ - "意识协议" - ], - "intro": "进驻制造站时,当前制造站内每个标准化类技能为自身+5%的生产力", - "template": "Bskill_man_skill_spd.png" - }, - { - "name": [ - "源石工艺·β", - "地质学·β", - "火山学家", - "源石研究" - ], - "intro": "进驻制造站时,源石类配方的生产力+35%", - "template": "Bskill_man_originium2.png" - }, - { - "name": [ - "源石工艺·α", - "地质学·α" - ], - "intro": "进驻制造站时,源石类配方的生产力+30%", - "template": "Bskill_man_originium1.png" - }, - { - "name": [ - "探险者" - ], - "intro": "进驻制造站时,仓库容量上限+16,心情每小时消耗-0.25", - "template": "Bskill_man_limit&cost3.png" - }, - { - "name": [ - "囤积者" - ], - "intro": "进驻制造站时,仓库容量上限+10,心情每小时消耗-0.25", - "template": "Bskill_man_limit&cost2.png" - }, - { - "name": [ - "拾荒者", - "智慧之境", - "“都想要”", - "磐蟹·阿盘" - ], - "intro": "进驻制造站时,仓库容量上限+8,心情每小时消耗-0.25", - "template": "Bskill_man_limit&cost1.png" - }, - { - "name": [ - "金属工艺·β" - ], - "intro": "进驻制造站时,贵金属类配方的生产力+35%", - "template": "Bskill_man_gold2.png", - "efficient": { - "PureGold": 35.1, - "Doc": "单产品加成的技能一概+0.1分,为了从同效率的技能中胜出来,优先使用单产品技能。把通用技能留给更多的制造站" - } - }, - { - "name": [ - "金属工艺·α" - ], - "intro": "进驻制造站时,贵金属类配方的生产力+30%", - "template": "Bskill_man_gold1.png", - "efficient": { - "PureGold": 30.1 - } - }, - { - "name": [ - "拳术指导录像" - ], - "intro": "进驻制造站时,作战记录类配方的生产力+35%", - "template": "Bskill_man_exp3.png", - "efficient": { - "CombatRecord": 35.1 - } - }, - { - "name": [ - "作战指导录像" - ], - "intro": "进驻制造站时,作战记录类配方的生产力+30%", - "template": "Bskill_man_exp2.png", - "efficient": { - "CombatRecord": 30.1 - } - }, - { - "name": [ - "胜利之计" - ], - "intro": "进驻制造站时,作战记录类配方的生产力+25%", - "template": "Bskill_man_exp1.png", - "efficient": { - "CombatRecord": 25.1 - } - }, - { - "name": [ - "剪辑·β" - ], - "intro": "进驻制造站时,生产作战记录类配方时,仓库容量上限+15", - "template": "Bskill_man_exp&limit2.png" - }, - { - "name": [ - "剪辑·α" - ], - "intro": "进驻制造站时,生产作战记录类配方时,仓库容量上限+12", - "template": "Bskill_man_exp&limit1.png" - }, - { - "name": [ - "Vlog" - ], - "intro": "进驻制造站时,生产作战记录类配方时,心情每小时消耗-0.25", - "template": "Bskill_man_exp&cost.png" - }, - { - "name": [ - "团队精神" - ], - "intro": "进驻制造站时,消除当前制造站内所有干员自身心情消耗的影响", - "template": "Bskill_man_cost_all.png" - } + "intro": "进驻制造站时,生产力+30%", + "template": "Bskill_man_spd3.png", + "efficient": { + "all": 30 + } + }, + { + "name": [ + "标准化·β", + "莱茵科技·β", + "红松骑士团·β" ], - "skillsGroup_Doc": "相关技能组参考https://bbs.nga.cn/read.php?tid=25965441", - "skillsGroup": [ - { - "intro": "水月组", - "necessary": [ - { - "intro": "水月-2", - "skills": [ - "Bskill_man_skill_spd", - "Bskill_man_spd2" - ], - "efficient": { - "all": 30 - } - } - ], - "optional": [ - { - "intro": "标准化·β", - "skills": [ - "Bskill_man_spd2" - ], - "efficient": { - "all": 30 - } - }, - { - "intro": "标准化·α", - "skills": [ - "Bskill_man_spd1" - ], - "efficient": { - "all": 20 - } - } - ] - }, - { - "intro": "红云组", - "necessary": [ - { - "intro": "红云-1", - "skills": [ - "Bskill_man_spd_variable11", - "Bskill_man_limit&cost1" - ], - "efficient": { - "all": 16 - } - } - ], - "optional": [ - { - "intro": "稀音-2", - "skills": [ - "Bskill_man_spd_add2", - "Bskill_man_exp&limit1" - ], - "efficient": { - "CombatRecord": 47 - } - }, - { - "intro": "帕拉斯-2", - "skills": [ - "Bskill_man_limit&cost1", - "Bskill_man_exp1" - ], - "efficient": { - "CombatRecord": 41 - } - }, - { - "intro": "刻俄柏-2", - "skills": [ - "Bskill_man_spd_add1", - "Bskill_man_limit&cost1" - ], - "efficient": { - "all": 40 - } - }, - { - "intro": "火神-2", - "skills": [ - "Bskill_man_spd&limit&cost2" - ], - "efficient": { - "all": 33 - } - }, - { - "intro": "石棉-2", - "skills": [ - "Bskill_man_spd&limit&cost3", - "Bskill_man_limit&cost3" - ], - "efficient": { - "all": 33 - } - }, - { - "intro": "豆苗-1", - "skills": [ - "Bskill_man_spd1", - "Bskill_man_limit&cost1" - ], - "efficient": { - "all": 31 - } - }, - { - "intro": "黑角、蛇屠箱", - "skills": [ - "Bskill_man_spd&limit3" - ], - "efficient": { - "all": 30 - } - }, - { - "intro": "卡达-1", - "skills": [ - "Bskill_man_exp&cost", - "Bskill_man_exp&limit2" - ], - "efficient": { - "all": 30 - } - }, - { - "intro": "米格鲁、卡缇", - "skills": [ - "Bskill_man_spd&limit1" - ], - "efficient": { - "all": 22 - } - }, - { - "intro": "刻俄柏", - "skills": [ - "Bskill_man_limit&cost1" - ], - "efficient": { - "all": 16 - } - }, - { - "intro": "贝娜", - "skills": [ - "Bskill_man_spd&limit&cost4" - ], - "efficient": { - "all": 14 - } - }, - { - "intro": "帕拉斯", - "skills": [ - "Bskill_man_limit&cost1" - ], - "efficient": { - "all": 14 - } - } - ] - }, - { - "intro": "泡泡组", - "necessary": [ - { - "intro": "泡泡-1", - "skills": [ - "Bskill_man_limit&cost2", - "Bskill_man_spd_variable31" - ], - "efficient": { - "all": 10 - } - } - ], - "optional": [ - { - "intro": "火神-2", - "skills": [ - "Bskill_man_spd&limit&cost2" - ], - "efficient": { - "all": 52 - } - }, - { - "intro": "稀音-2", - "skills": [ - "Bskill_man_spd_add2", - "Bskill_man_exp&limit1" - ], - "efficient": { - "CombatRecord": 35 - } - }, - { - "intro": "帕拉斯-2", - "skills": [ - "Bskill_man_limit&cost1", - "Bskill_man_exp1" - ], - "efficient": { - "CombatRecord": 33 - } - }, - { - "intro": "刻俄柏-2", - "skills": [ - "Bskill_man_spd_add1", - "Bskill_man_limit&cost1" - ], - "efficient": { - "all": 32 - } - }, - { - "intro": "贝娜", - "skills": [ - "Bskill_man_spd&limit&cost4" - ], - "efficient": { - "all": 31 - } - }, - { - "intro": "豆苗-1", - "skills": [ - "Bskill_man_spd1", - "Bskill_man_limit&cost1" - ], - "efficient": { - "all": 23 - } - }, - { - "intro": "石棉-2", - "skills": [ - "Bskill_man_spd&limit&cost3", - "Bskill_man_limit&cost3" - ], - "efficient": { - "all": 29 - } - }, - { - "intro": "黑角、蛇屠箱", - "skills": [ - "Bskill_man_spd&limit3" - ], - "efficient": { - "all": 20 - } - }, - { - "intro": "米格鲁、卡缇", - "skills": [ - "Bskill_man_spd&limit1" - ], - "efficient": { - "all": 16 - } - }, - { - "intro": "卡达-1", - "skills": [ - "Bskill_man_exp&cost", - "Bskill_man_exp&limit2" - ], - "efficient": { - "all": 15 - } - }, - { - "intro": "刻俄柏", - "skills": [ - "Bskill_man_limit&cost1" - ], - "efficient": { - "all": 8 - } - }, - { - "intro": "帕拉斯", - "skills": [ - "Bskill_man_limit&cost1" - ], - "efficient": { - "all": 8 - } - } - ] - }, - { - "intro": "温蒂-2组", - "conditions": { - "NumOfPower": 3 - }, - "necessary": [ - { - "intro": "温蒂-2", - "skills": [ - "Bskill_man_spd&power3" - ], - "efficient": { - "all": 45 - } - } - ], - "optional": [ - { - "intro": "森蚺-2", - "skills": [ - "Bskill_man_spd&power2" - ], - "efficient": { - "all": 30 - } - }, - { - "intro": "清流-1", - "skills": [ - "Bskill_man_spd&trade" - ], - "efficient": { - "PureGold_reg": "[NumOfTrade] * 20" - } - }, - { - "intro": "森蚺、异客2", - "skills": [ - "Bskill_man_spd&power1" - ], - "efficient": { - "all": 15 - } - } - ] - }, - { - "intro": "温蒂组", - "conditions": { - "NumOfPower": 3 - }, - "necessary": [ - { - "intro": "温蒂、森蚺-2", - "skills": [ - "Bskill_man_spd&power2" - ], - "efficient": { - "all": 30 - } - } - ], - "optional": [ - { - "intro": "温蒂、森蚺-2", - "skills": [ - "Bskill_man_spd&power2" - ], - "efficient": { - "all": 30 - } - }, - { - "intro": "清流-1", - "skills": [ - "Bskill_man_spd&trade" - ], - "efficient": { - "PureGold_reg": "[NumOfTrade] * 20" - } - }, - { - "intro": "森蚺、异客2", - "skills": [ - "Bskill_man_spd&power1" - ], - "efficient": { - "all": 15 - } - } - ] - }, - { - "intro": "温蒂-2组: 2电站", - "conditions": { - "NumOfPower": 2 - }, - "necessary": [ - { - "intro": "温蒂-2", - "skills": [ - "Bskill_man_spd&power3" - ], - "efficient": { - "all": 30 - } - } - ], - "optional": [ - { - "intro": "森蚺-2", - "skills": [ - "Bskill_man_spd&power2" - ], - "efficient": { - "all": 20 - } - }, - { - "intro": "清流-1", - "skills": [ - "Bskill_man_spd&trade" - ], - "efficient": { - "PureGold_reg": "[NumOfTrade] * 20" - } - }, - { - "intro": "森蚺、异客2", - "skills": [ - "Bskill_man_spd&power1" - ], - "efficient": { - "all": 10 - } - } - ] - }, - { - "intro": "温蒂组: 2电站", - "conditions": { - "NumOfPower": 2 - }, - "necessary": [ - { - "intro": "温蒂、森蚺-2", - "skills": [ - "Bskill_man_spd&power2" - ], - "efficient": { - "all": 30 - } - } - ], - "optional": [ - { - "intro": "温蒂、森蚺-2", - "skills": [ - "Bskill_man_spd&power2" - ], - "efficient": { - "all": 20 - } - }, - { - "intro": "清流-1", - "skills": [ - "Bskill_man_spd&trade" - ], - "efficient": { - "PureGold_reg": "[NumOfTrade] * 20" - } - }, - { - "intro": "森蚺、异客2", - "skills": [ - "Bskill_man_spd&power1" - ], - "efficient": { - "all": 10 - } - } - ] + "intro": "进驻制造站时,生产力+25%", + "template": "Bskill_man_spd2.png", + "efficient": { + "all": 25 + } + }, + { + "name": [ + "标准化·α", + "莱茵科技·α", + "红松骑士团·α", + "磐蟹·豆豆" + ], + "intro": "进驻制造站时,生产力+15%", + "template": "Bskill_man_spd1.png", + "efficient": { + "all": 15 + } + }, + { + "name": [ + "大就是好!" + ], + "intro": "进驻制造站时,当前制造站内干员根据自身提升的仓库容量提供一定的生产力。提升16格以下的,每格仓库容量提供1%生产力;提升大于16格的,每格仓库容量提供3%生产力(无法与回收利用叠加,且优先生效)", + "template": "Bskill_man_spd_variable31.png" + }, + { + "name": [ + "配合意识" + ], + "intro": "进驻制造站时,当前制造站内其他干员提供的每5%生产力(不包含根据设施数量提供加成的生产力),额外提供5%生产力,最多提供40%生产力", + "template": "Bskill_man_spd_variable21.png", + "efficient": { + "all": 40 + } + }, + { + "name": [ + "回收利用" + ], + "intro": "进驻制造站时,当前制造站内干员提升的每格仓库容量,提供2%生产力", + "template": "Bskill_man_spd_variable11.png" + }, + { + "name": [ + "意识实体" + ], + "intro": "进驻制造站时,每1点思维链环+1%生产力", + "template": "Bskill_man_spd_bd2.png" + }, + { + "name": [ + "念力" + ], + "intro": "进驻制造站时,每2点思维链环+1%生产力", + "template": "Bskill_man_spd_bd1.png" + }, + { + "name": [ + "超感" + ], + "intro": "进驻制造站时,宿舍内每有1名干员则感知信息+1,同时每1点感知信息转化为1点思维链环", + "template": "Bskill_man_spd_bd_n1.png" + }, + { + "name": [ + "慢性子", + "延时摄影" + ], + "intro": "进驻制造站后,生产力首小时+15%,此后每小时+2%,最终达到+25%", + "template": "Bskill_man_spd_add2.png", + "efficient": { + "all": 23 + } + }, + { + "name": [ + "急性子", + "“等不及”" + ], + "intro": "进驻制造站后,生产力首小时+20%,此后每小时+1%,最终达到+25%", + "template": "Bskill_man_spd_add1.png", + "efficient": { + "all": 24 + } + }, + { + "name": [ + "再生能源" + ], + "intro": "进驻制造站时,每个贸易站为当前制造站贵金属类配方的生产力+20%", + "template": "Bskill_man_spd&trade.png", + "efficient": { + "PureGold_reg": "[NumOfTrade] * 20" + } + }, + { + "name": [ + "仿生海龙" + ], + "intro": "进驻制造站时,当前制造站内其他干员提供的生产力全部归零(不包含根据设施数量提供加成的生产力),每个发电站为当前制造站+15%的生产力", + "template": "Bskill_man_spd&power3.png" + }, + { + "name": [ + "自动化·β" + ], + "intro": "进驻制造站时,当前制造站内其他干员提供的生产力全部归零(不包含根据设施数量提供加成的生产力),每个发电站为当前制造站+10%的生产力", + "template": "Bskill_man_spd&power2.png" + }, + { + "name": [ + "自动化·α" + ], + "intro": "进驻制造站时,当前制造站内其他干员提供的生产力全部归零(不包含根据设施数量提供加成的生产力),每个发电站为当前制造站+5%的生产力", + "template": "Bskill_man_spd&power1.png" + }, + { + "name": [ + "仓库整备·β" + ], + "intro": "进驻制造站时,仓库容量上限+10,生产力+10%", + "template": "Bskill_man_spd&limit3.png", + "efficient": { + "all": 10 + } + }, + { + "name": [ + "仓库整备·α" + ], + "intro": "进驻制造站时,仓库容量上限+6,生产力+10%", + "template": "Bskill_man_spd&limit1.png", + "efficient": { + "all": 10 + } + }, + { + "name": [ + "“可靠”助手" + ], + "intro": "进驻制造站时,生产力-20%,仓库容量上限+17,心情每小时消耗-0.25", + "template": "Bskill_man_spd&limit&cost4.png" + }, + { + "name": [ + "特立独行", + "麻烦制造者" + ], + "intro": "进驻制造站时,生产力+25%,仓库容量上限-12,心情每小时消耗+0.25", + "template": "Bskill_man_spd&limit&cost3.png", + "efficient": { + "all": 24.9 + } + }, + { + "name": [ + "工匠精神·β" + ], + "intro": "进驻制造站时,生产力-5%,仓库容量上限+19,心情每小时消耗-0.25", + "template": "Bskill_man_spd&limit&cost2.png" + }, + { + "name": [ + "工匠精神·α" + ], + "intro": "进驻制造站时,生产力-5%,仓库容量上限+16,心情每小时消耗-0.15", + "template": "Bskill_man_spd&limit&cost1.png" + }, + { + "name": [ + "意识协议" + ], + "intro": "进驻制造站时,当前制造站内每个标准化类技能为自身+5%的生产力", + "template": "Bskill_man_skill_spd.png" + }, + { + "name": [ + "源石工艺·β", + "地质学·β", + "火山学家", + "源石研究" + ], + "intro": "进驻制造站时,源石类配方的生产力+35%", + "template": "Bskill_man_originium2.png" + }, + { + "name": [ + "源石工艺·α", + "地质学·α" + ], + "intro": "进驻制造站时,源石类配方的生产力+30%", + "template": "Bskill_man_originium1.png" + }, + { + "name": [ + "探险者" + ], + "intro": "进驻制造站时,仓库容量上限+16,心情每小时消耗-0.25", + "template": "Bskill_man_limit&cost3.png" + }, + { + "name": [ + "囤积者" + ], + "intro": "进驻制造站时,仓库容量上限+10,心情每小时消耗-0.25", + "template": "Bskill_man_limit&cost2.png" + }, + { + "name": [ + "拾荒者", + "智慧之境", + "“都想要”", + "磐蟹·阿盘" + ], + "intro": "进驻制造站时,仓库容量上限+8,心情每小时消耗-0.25", + "template": "Bskill_man_limit&cost1.png" + }, + { + "name": [ + "金属工艺·β" + ], + "intro": "进驻制造站时,贵金属类配方的生产力+35%", + "template": "Bskill_man_gold2.png", + "efficient": { + "PureGold": 35.1, + "Doc": "单产品加成的技能一概+0.1分,为了从同效率的技能中胜出来,优先使用单产品技能。把通用技能留给更多的制造站" + } + }, + { + "name": [ + "金属工艺·α" + ], + "intro": "进驻制造站时,贵金属类配方的生产力+30%", + "template": "Bskill_man_gold1.png", + "efficient": { + "PureGold": 30.1 + } + }, + { + "name": [ + "拳术指导录像" + ], + "intro": "进驻制造站时,作战记录类配方的生产力+35%", + "template": "Bskill_man_exp3.png", + "efficient": { + "CombatRecord": 35.1 + } + }, + { + "name": [ + "作战指导录像" + ], + "intro": "进驻制造站时,作战记录类配方的生产力+30%", + "template": "Bskill_man_exp2.png", + "efficient": { + "CombatRecord": 30.1 + } + }, + { + "name": [ + "胜利之计" + ], + "intro": "进驻制造站时,作战记录类配方的生产力+25%", + "template": "Bskill_man_exp1.png", + "efficient": { + "CombatRecord": 25.1 + } + }, + { + "name": [ + "剪辑·β" + ], + "intro": "进驻制造站时,生产作战记录类配方时,仓库容量上限+15", + "template": "Bskill_man_exp&limit2.png" + }, + { + "name": [ + "剪辑·α" + ], + "intro": "进驻制造站时,生产作战记录类配方时,仓库容量上限+12", + "template": "Bskill_man_exp&limit1.png" + }, + { + "name": [ + "Vlog" + ], + "intro": "进驻制造站时,生产作战记录类配方时,心情每小时消耗-0.25", + "template": "Bskill_man_exp&cost.png" + }, + { + "name": [ + "团队精神" + ], + "intro": "进驻制造站时,消除当前制造站内所有干员自身心情消耗的影响", + "template": "Bskill_man_cost_all.png" + } + ], + "skillsGroup_Doc": "相关技能组参考https://bbs.nga.cn/read.php?tid=25965441", + "skillsGroup": [ + { + "intro": "水月组", + "necessary": [ + { + "intro": "水月-2", + "skills": [ + "Bskill_man_skill_spd", + "Bskill_man_spd2" + ], + "efficient": { + "all": 30 } + } + ], + "optional": [ + { + "intro": "标准化·β", + "skills": [ + "Bskill_man_spd2" + ], + "efficient": { + "all": 30 + } + }, + { + "intro": "标准化·α", + "skills": [ + "Bskill_man_spd1" + ], + "efficient": { + "all": 20 + } + } ] - }, - "Trade": { - "products": [ - "Money" - ], - "maxNumOfOpers": 3, - "skills": [ - { - "name": [ - "“愿者上钩”" - ], - "intro": "进驻贸易站时,宿舍内每有1名干员则人间烟火+1,同时每有1点人间烟火,则订单获取效率+1%", - "template": "Bskill_tra_bd_n2.png" - }, - { - "name": [ - "订单流可视化·α" - ], - "intro": "进驻贸易站时,订单获取效率+5%,每有4条赤金生产线,则赤金生产线额外+2", - "template": "Bskill_tra_flow_gc1.png", - "efficient": { - "all": 5 - } - }, - { - "name": [ - "订单流可视化·β" - ], - "intro": "进驻贸易站时,订单获取效率+5%,每有2条赤金生产线,则赤金生产线额外+2", - "template": "Bskill_tra_flow_gc2.png", - "efficient": { - "all": 5 - } - }, - { - "name": [ - "物流规划·α" - ], - "intro": "进驻贸易站时,订单获取效率+5%,每有4条赤金生产线,则当前贸易站订单获取效率额外+15%", - "template": "Bskill_tra_flow_gs1.png", - "efficient": { - "all": 5 - } - }, - { - "name": [ - "物流规划·β" - ], - "intro": "进驻贸易站时,订单获取效率+5%,每有2条赤金生产线,则当前贸易站订单获取效率额外+15%", - "template": "Bskill_tra_flow_gs2.png", - "efficient": { - "all": 5 - } - }, - { - "name": [ - "醉翁之意·α" - ], - "intro": "当与德克萨斯在同一个贸易站时,心情每小时消耗-0.1,订单上限+2", - "template": "Bskill_tra_Lappland1.png" - }, - { - "name": [ - "醉翁之意·β" - ], - "intro": "当与德克萨斯在同一个贸易站时,心情每小时消耗-0.1,订单上限+4", - "template": "Bskill_tra_Lappland2.png" - }, - { - "name": [ - "谈判" - ], - "intro": "进驻贸易站时,订单上限+5,心情每小时消耗-0.25", - "template": "Bskill_tra_limit&cost.png" - }, - { - "name": [ - "市井之道" - ], - "intro": "进驻贸易站时,当前贸易站内其他干员提供的每10%订单获取效率使订单上限-1(订单最少为1),同时每有1笔订单就+4%订单获取效率", - "template": "Bskill_tra_limit_count.png" - }, - { - "name": [ - "摊贩经济" - ], - "intro": "进驻贸易站时,当前订单数与订单上限每差1笔订单,则订单获取效率+4%", - "template": "Bskill_tra_limit_diff.png" - }, - { - "name": [ - "投资·α" - ], - "intro": "进驻贸易站后,如果下笔赤金订单交付数大于3,则其龙门币收益+250,心情每小时消耗-0.25", - "template": "Bskill_tra_long1.png" - }, - { - "name": [ - "投资·β" - ], - "intro": "进驻贸易站后,如果下笔赤金订单交付数大于3,则其龙门币收益+500,心情每小时消耗-0.25", - "template": "Bskill_tra_long2.png" - }, - { - "name": [ - "交际" - ], - "intro": "进驻贸易站时,订单获取效率+30%,心情每小时消耗-0.25", - "template": "Bskill_tra_spd&cost.png", - "efficient": { - "all": 30.1 - } - }, - { - "name": [ - "虔诚筹款·α" - ], - "intro": "进驻贸易站时,每间宿舍每级+1%获取效率", - "template": "Bskill_tra_spd&dorm1.png", - "efficient": { - "all": 20 - } - }, - { - "name": [ - "虔诚筹款·β" - ], - "intro": "进驻贸易站时,每间宿舍每级+2%获取效率", - "template": "Bskill_tra_spd&dorm2.png", - "efficient": { - "all": 40 - } - }, - { - "name": [ - "订单管理·α" - ], - "intro": "进驻贸易站时,订单获取效率+10%,且订单上限+2", - "template": "Bskill_tra_spd&limit1.png", - "efficient": { - "all": 10 - } - }, - { - "name": [ - "订单管理·β" - ], - "intro": "进驻贸易站时,订单获取效率+10%,且订单上限+4", - "template": "Bskill_tra_spd&limit2.png", - "efficient": { - "all": 10 - } - }, - { - "name": [ - "喀兰贸易·α" - ], - "intro": "进驻贸易站时,订单获取效率+15%,且订单上限+2", - "template": "Bskill_tra_spd&limit3.png", - "efficient": { - "all": 15 - } - }, - { - "name": [ - "喀兰贸易·β" - ], - "intro": "进驻贸易站时,订单获取效率+15%,且订单上限+4", - "template": "Bskill_tra_spd&limit4.png", - "efficient": { - "all": 15 - } - }, - { - "name": [ - "喀兰之主" - ], - "intro": "进驻贸易站时,订单获取效率+20%,且订单上限+4", - "template": "Bskill_tra_spd&limit5.png", - "efficient": { - "all": 20 - } - }, - { - "name": [ - "供应管理" - ], - "intro": "进驻贸易站时,订单获取效率+25%,且订单上限+1", - "template": "Bskill_tra_spd&limit6.png", - "efficient": { - "all": 25 - } - }, - { - "name": [ - "使命必达", - "少当家" - ], - "intro": "进驻贸易站时,订单获取效率+30%,且订单上限+1", - "template": "Bskill_tra_spd&limit7.png", - "efficient": { - "all": 30 - } - }, - { - "name": [ - "天道酬勤·α" - ], - "intro": "进驻贸易站时,当前贸易站内干员提供的每5%订单获取效率,额外提供5%效率,最多提供25%效率", - "template": "Bskill_tra_spd_variable21.png", - "efficient": { - "all": 25 - } - }, - { - "name": [ - "天道酬勤·β" - ], - "intro": "进驻贸易站时,当前贸易站内干员提供的每5%订单获取效率,额外提供5%效率,最多提供35%效率", - "template": "Bskill_tra_spd_variable22.png", - "efficient": { - "all": 35 - } - }, - { - "name": [ - "企鹅物流·α", - "峯驰物流", - "订单分发·α" - ], - "intro": "进驻贸易站时,订单获取效率+20%", - "template": "Bskill_tra_spd1.png", - "efficient": { - "all": 20 - } - }, - { - "name": [ - "企鹅物流·β", - "订单分发·β" - ], - "intro": "进驻贸易站时,订单获取效率+30%", - "template": "Bskill_tra_spd2.png", - "efficient": { - "all": 30 - } - }, - { - "name": [ - "物流专家" - ], - "intro": "进驻贸易站时,订单获取效率+35%", - "template": "Bskill_tra_spd3.png", - "efficient": { - "all": 35 - } - }, - { - "name": [ - "恩怨" - ], - "intro": "当与拉普兰德在同一个贸易站时,心情每小时消耗+0.3,订单获取效率+65%", - "template": "Bskill_tra_texas1.png" - }, - { - "name": [ - "默契" - ], - "intro": "当与能天使在同一个贸易站时,心情每小时消耗-0.3", - "template": "Bskill_tra_texas2.png" - }, - { - "name": [ - "低语" - ], - "intro": "进驻贸易站时,当前贸易站内其他干员提供的订单获取效率全部归零,且每人为自身+45%订单获取效率,同时全体心情每小时消耗+0.25", - "template": "Bskill_tra_vodfox.png" - }, - { - "name": [ - "裁缝·α" - ], - "intro": "进驻贸易站时,小幅提升当前贸易站高品质贵金属订单的出现概率(工作时长影响概率),心情每小时消耗-0.25", - "template": "Bskill_tra_wt&cost1.png" - }, - { - "name": [ - "裁缝·β", - "手工艺品·β" - ], - "intro": "进驻贸易站时,提升当前贸易站高品质贵金属订单的出现概率(工作时长影响概率),心情每小时消耗-0.25", - "template": "Bskill_tra_wt&cost2.png" + }, + { + "intro": "红云组", + "necessary": [ + { + "intro": "红云-1", + "skills": [ + "Bskill_man_spd_variable11", + "Bskill_man_limit&cost1" + ], + "efficient": { + "all": 16 } + } ], - "skillsGroup_Doc": "相关技能组参考https://bbs.nga.cn/read.php?tid=25965441", - "skillsGroup": [ - { - "intro": "德2拉2组", - "necessary": [ - { - "intro": "德克萨斯-2", - "skills": [ - "Bskill_tra_texas1", - "Bskill_tra_texas2" - ], - "efficient": { - "all": 64.9 - } - }, - { - "intro": "拉普兰德-2", - "skills": [ - "Bskill_tra_Lappland2" - ], - "efficient": { - "all": 0 - } - } - ], - "optional": [ - { - "intro": "孑-0", - "skills": [ - "Bskill_tra_limit_diff" - ], - "efficient": { - "all": 43 - } - }, - { - "intro": "孑-1", - "skills": [ - "Bskill_tra_limit_diff", - "Bskill_tra_limit_count" - ], - "efficient": { - "all": 32 - } - }, - { - "intro": "能天使-2", - "skills": [ - "Bskill_tra_spd3" - ], - "efficient": { - "all": 35.2 - }, - "Doc": "能天使1的技能别人也有,识别上不了,管不了了" - } - ], - "allowExternal": true - }, - { - "intro": "德2拉0组", - "necessary": [ - { - "intro": "德克萨斯-2", - "skills": [ - "Bskill_tra_texas1", - "Bskill_tra_texas2" - ], - "efficient": { - "all": 64.9 - } - }, - { - "intro": "拉普兰德-0", - "skills": [ - "Bskill_tra_Lappland1" - ], - "efficient": { - "all": 0 - } - } - ], - "optional": [ - { - "intro": "能天使-2", - "skills": [ - "Bskill_tra_spd3" - ], - "efficient": { - "all": 35.2 - }, - "Doc": "能天使1的技能别人也有,识别上不了,管不了了" - } - ], - "allowExternal": true - }, - { - "intro": "德0拉2组", - "necessary": [ - { - "intro": "德克萨斯-0", - "skills": [ - "Bskill_tra_texas1" - ], - "efficient": { - "all": 64.9 - } - }, - { - "intro": "拉普兰德-2", - "skills": [ - "Bskill_tra_Lappland2" - ], - "efficient": { - "all": 0 - } - } - ], - "optional": [ - { - "intro": "孑-0", - "skills": [ - "Bskill_tra_limit_diff" - ], - "efficient": { - "all": 43 - } - }, - { - "intro": "孑-1", - "skills": [ - "Bskill_tra_limit_diff", - "Bskill_tra_limit_count" - ], - "efficient": { - "all": 32 - } - } - ], - "allowExternal": true - }, - { - "intro": "德0拉0组", - "necessary": [ - { - "intro": "德克萨斯-0", - "skills": [ - "Bskill_tra_texas1" - ], - "efficient": { - "all": 64.9 - } - }, - { - "intro": "拉普兰德-0", - "skills": [ - "Bskill_tra_Lappland1" - ], - "efficient": { - "all": 0 - } - } - ], - "optional": [], - "allowExternal": true - }, - { - "intro": "巫恋组", - "necessary": [ - { - "intro": "巫恋-2", - "skills": [ - "Bskill_tra_wt&cost1", - "Bskill_tra_vodfox" - ], - "efficient": { - "all": 90.1 - } - } - ], - "optional": [ - { - "intro": "龙舌兰-2", - "skills": [ - "Bskill_tra_long2" - ], - "efficient": { - "all": 80 - }, - "Doc": "这里具体效率不同攻略各执一词,写个大概的,反正别的组合也没这么高的,大差不差能第一就行_(:з」∠)_" - }, - { - "intro": "龙舌兰-1", - "skills": [ - "Bskill_tra_long1" - ], - "efficient": { - "all": 40 - } - }, - { - "intro": "柏喙-2、卡夫卡-2", - "skills": [ - "Bskill_tra_wt&cost2" - ], - "efficient": { - "all": 2 - } - }, - { - "intro": "柏喙-1、卡夫卡-1", - "skills": [ - "Bskill_tra_wt&cost1" - ], - "efficient": { - "all": 1 - } - } - ], - "allowExternal": true - }, - { - "intro": "孑-0组", - "necessary": [ - { - "intro": "孑-0", - "skills": [ - "Bskill_tra_limit_diff" - ], - "efficient": { - "all": 27 - } - } - ], - "optional": [ - { - "intro": "银灰-2", - "skills": [ - "Bskill_tra_spd&limit5" - ], - "efficient": { - "all": 36 - } - }, - { - "intro": "喀兰贸易·β", - "skills": [ - "Bskill_tra_spd&limit4" - ], - "efficient": { - "all": 31 - } - }, - { - "intro": "拜松、可颂", - "skills": [ - "Bskill_tra_spd&limit7", - "Bskill_tra_spd1" - ], - "efficient": { - "all": 34 - } - }, - { - "intro": "供应管理", - "skills": [ - "Bskill_tra_spd&limit6" - ], - "efficient": { - "all": 29 - } - }, - { - "intro": "喀兰贸易·α", - "skills": [ - "Bskill_tra_spd&limit3" - ], - "efficient": { - "all": 23 - } - } - ] - }, - { - "intro": "孑-1组", - "necessary": [ - { - "intro": "孑-1", - "skills": [ - "Bskill_tra_limit_count", - "Bskill_tra_limit_diff" - ], - "efficient": { - "all": 40 - } - } - ], - "optional": [ - { - "intro": "银灰-2", - "skills": [ - "Bskill_tra_spd&limit5" - ], - "efficient": { - "all": 28 - } - }, - { - "intro": "喀兰贸易·β", - "skills": [ - "Bskill_tra_spd&limit4" - ], - "efficient": { - "all": 27 - } - }, - { - "intro": "拜松-2、可颂-2", - "skills": [ - "Bskill_tra_spd&limit7", - "Bskill_tra_spd1" - ], - "efficient": { - "all": 22 - } - }, - { - "intro": "订单管理·β", - "skills": [ - "Bskill_tra_spd&limit6" - ], - "efficient": { - "all": 22 - } - }, - { - "intro": "谈判", - "skills": [ - "Bskill_tra_limit&cost" - ], - "efficient": { - "all": 20 - } - } - ] + "optional": [ + { + "intro": "稀音-2", + "skills": [ + "Bskill_man_spd_add2", + "Bskill_man_exp&limit1" + ], + "efficient": { + "CombatRecord": 47 } + }, + { + "intro": "帕拉斯-2", + "skills": [ + "Bskill_man_limit&cost1", + "Bskill_man_exp1" + ], + "efficient": { + "CombatRecord": 41 + } + }, + { + "intro": "刻俄柏-2", + "skills": [ + "Bskill_man_spd_add1", + "Bskill_man_limit&cost1" + ], + "efficient": { + "all": 40 + } + }, + { + "intro": "火神-2", + "skills": [ + "Bskill_man_spd&limit&cost2" + ], + "efficient": { + "all": 33 + } + }, + { + "intro": "石棉-2", + "skills": [ + "Bskill_man_spd&limit&cost3", + "Bskill_man_limit&cost3" + ], + "efficient": { + "all": 33 + } + }, + { + "intro": "豆苗-1", + "skills": [ + "Bskill_man_spd1", + "Bskill_man_limit&cost1" + ], + "efficient": { + "all": 31 + } + }, + { + "intro": "黑角、蛇屠箱", + "skills": [ + "Bskill_man_spd&limit3" + ], + "efficient": { + "all": 30 + } + }, + { + "intro": "卡达-1", + "skills": [ + "Bskill_man_exp&cost", + "Bskill_man_exp&limit2" + ], + "efficient": { + "all": 30 + } + }, + { + "intro": "米格鲁、卡缇", + "skills": [ + "Bskill_man_spd&limit1" + ], + "efficient": { + "all": 22 + } + }, + { + "intro": "刻俄柏", + "skills": [ + "Bskill_man_limit&cost1" + ], + "efficient": { + "all": 16 + } + }, + { + "intro": "贝娜", + "skills": [ + "Bskill_man_spd&limit&cost4" + ], + "efficient": { + "all": 14 + } + }, + { + "intro": "帕拉斯", + "skills": [ + "Bskill_man_limit&cost1" + ], + "efficient": { + "all": 14 + } + } ] - }, - "Power": { - "maxNumOfOpers": 1, - "products": [ - "Drone" - ], - "skills": [ - { - "name": [ - "脉冲电弧·β" - ], - "intro": "进驻发电站时,无人机每小时充能速度+20%", - "template": "Bskill_pow_spd3.png", - "efficient": { - "all": 20 - } - }, - { - "name": [ - "脉冲电弧·α" - ], - "intro": "进驻发电站时,无人机每小时充能速度+15%", - "template": "Bskill_pow_spd2.png", - "efficient": { - "all": 15 - } - }, - { - "name": [ - "热能充能·α" - ], - "intro": "进驻发电站时,无人机每小时充能速度+10%", - "template": "Bskill_pow_spd1.png", - "efficient": { - "all": 10 - } - }, - { - "name": [ - "热情澎湃" - ], - "intro": "进驻发电站时,无人机每小时充能速度+10%", - "template": "Bskill_pow_spd&cost.png", - "efficient": { - "all": 0.1 - } + }, + { + "intro": "泡泡组", + "necessary": [ + { + "intro": "泡泡-1", + "skills": [ + "Bskill_man_limit&cost2", + "Bskill_man_spd_variable31" + ], + "efficient": { + "all": 10 } + } ], - "skillsGroup": [] - }, - "Office": { - "maxNumOfOpers": 1, - "products": [ - "HR" - ], - "skills": [ - { - "name": [ - "准时下班" - ], - "intro": "进驻人力办公室时,人脉资源的联络速度+45%,心情每小时消耗+2", - "template": "Bskill_hire_skgoat.png", - "efficient": { - "all": 44.9 - } - }, - { - "name": [ - "天灾信使·β" - ], - "intro": "进驻人力办公室时,人脉资源的联络速度+45%", - "template": "Bskill_hire_spd5.png", - "efficient": { - "all": 45 - } - }, - { - "name": [ - "心理学" - ], - "intro": "进驻人力办公室时,人脉资源的联络速度+40%", - "template": "Bskill_hire_spd4.png", - "efficient": { - "all": 40 - } - }, - { - "name": [ - "洞悉人心" - ], - "intro": "进驻人力办公室时,人脉资源的联络速度+35%,同时每个招募位(不包含初始招募位)额外+5%会客室线索搜集速度", - "template": "Bskill_hire_spd&clue.png", - "efficient": { - "all": 35.1 - } - }, - { - "name": [ - "天灾信使·α" - ], - "intro": "进驻人力办公室时,人脉资源的联络速度+30%", - "template": "Bskill_hire_spd2.png", - "efficient": { - "all": 30 - } - }, - { - "name": [ - "人事管理·α" - ], - "intro": "进驻人力办公室时,人脉资源的联络速度+20%", - "template": "Bskill_hire_spd1.png", - "efficient": { - "all": 20 - } - }, - { - "name": [ - "人望" - ], - "intro": "进驻人力办公室时,人脉资源的联络速度+20%,每产生1次联络次数,增加乌萨斯学生自治团线索的概率(工作时长和招募位影响概率)", - "template": "Bskill_hire_spd&ursus2.png", - "efficient": { - "all": 20 - } - }, - { - "name": [ - "内幕" - ], - "intro": "进驻人力办公室时,人脉资源的联络速度+20%,每产生1次联络次数,增加黑钢国际线索的概率(工作时长和招募位影响概率)", - "template": "Bskill_hire_spd&blacksteel2.png", - "efficient": { - "all": 20 - } - }, - { - "name": [ - "巡游" - ], - "intro": "进驻人力办公室时,人脉资源的联络速度+20%,同时每个招募位(不包含初始招募位)+10点记忆碎片", - "template": "Bskill_hire_spd_bd_n1_n1.png", - "efficient": { - "all": 20 - } - }, - { - "name": [ - "追忆" - ], - "intro": "进驻人力办公室时,每1点记忆碎片转化为1点感知信息,心情耗尽时清空所有记忆碎片和自身累积的感知信息", - "template": "Bskill_hire_spd_memento.png" - }, - { - "name": [ - "救援队·资源清点" - ], - "intro": "进驻人力办公室时,人脉资源的联络速度+20%,心情每小时消耗-0.25", - "template": "Bskill_hire_spd&cost2.png", - "efficient": { - "all": 20.1 - } - }, - { - "name": [ - "救援队·灾后普查" - ], - "intro": "进驻人力办公室时,每个招募位(不包含初始招募位)+10点人间烟火", - "template": "Bskill_hire_spd_bd_n2.png" - }, - { - "name": [ - "语言学" - ], - "intro": "进驻人力办公室时,人脉资源的联络速度+20%,每1点情报储备额外+5%联络速度,每1瓶乌萨斯特饮额外+5%联络速度", - "template": "Bskill_hire_blitz.png", - "efficient": { - "all": 20.1 - } - }, - { - "name": [ - "救援队·珠算" - ], - "intro": "进驻人力办公室时,人脉资源的联络速度+10%,心情每小时消耗-0.25", - "template": "Bskill_hire_spd&cost1.png", - "efficient": { - "all": 10.1 - } + "optional": [ + { + "intro": "火神-2", + "skills": [ + "Bskill_man_spd&limit&cost2" + ], + "efficient": { + "all": 52 } - ], - "skillsGroup": [] - }, - "Reception": { - "Doc": "会客室", - "maxNumOfOpers": 2, - "products": [ - "General", - "No1", - "No2", - "No3", - "No4", - "No5", - "No6", - "No7" - ], - "skills": [ - { - "name": [ - "信使·罗德岛制药" - ], - "intro": "进驻会客室时,线索搜集速度提升10%,且更容易获得罗德岛制药线索(工作时长影响概率)", - "template": "Bskill_meet_rhodes2.png", - "efficient": { - "General": 10, - "No7": 30 - } - }, - { - "name": [ - "通讯员" - ], - "intro": "进驻会客室时,更容易获得罗德岛制药线索(工作时长影响概率)", - "template": "Bskill_meet_blacksteel2.png", - "efficient": { - "No7": 10 - } - }, - { - "name": [ - "插旗" - ], - "intro": "进驻会客室后,每当新搜集到的线索不是罗德岛制药时,则额外增加罗德岛制药线索的出现概率(工作时长影响概率)", - "template": "Bskill_meet_flag_rhodes.png", - "efficient": { - "No7": 15 - } - }, - { - "name": [ - "讯使" - ], - "intro": "进驻会客室时,线索搜集速度提升10%,且更容易获得喀兰贸易线索(工作时长影响概率)", - "template": "Bskill_meet_kjerag2.png", - "efficient": { - "General": 10, - "No6": 30 - } - }, - { - "name": [ - "传讯者" - ], - "intro": "进驻会客室时,线索搜集速度提升10%,且更容易获得格拉斯哥帮线索(工作时长影响概率)", - "template": "Bskill_meet_glasgow2.png", - "efficient": { - "General": 10, - "No5": 30 - } - }, - { - "name": [ - "军师" - ], - "intro": "进驻会客室时,线索搜集速度提升10%,且更容易获得乌萨斯学生自治团线索(工作时长影响概率)", - "template": "Bskill_meet_ursus2.png", - "efficient": { - "General": 10, - "No4": 30 - } - }, - { - "name": [ - "秘密搜查" - ], - "intro": "进驻会客室时,更容易获得乌萨斯学生自治团线索(工作时长影响概率)", - "template": "Bskill_meet_ursus1.png", - "efficient": { - "No4": 10 - } - }, - { - "name": [ - "甄别" - ], - "intro": "进驻会客室后,每当新搜集到的线索不是乌萨斯学生自治团时,则额外增加乌萨斯学生自治团线索的出现概率(工作时长影响概率)", - "template": "Bskill_meet_flag_ursus.png", - "efficient": { - "No4": 15 - } - }, - { - "name": [ - "B.P.R.S" - ], - "intro": "进驻会客室时,线索搜集速度提升10%,且更容易获得黑钢国际线索(工作时长影响概率)", - "template": "Bskill_meet_blacksteel2.png", - "efficient": { - "General": 10, - "No3": 30 - } - }, - { - "name": [ - "信使·企鹅物流" - ], - "intro": "进驻会客室时,线索搜集速度提升10%,且更容易获得企鹅物流线索(工作时长影响概率)", - "template": "Bskill_meet_penguin2.png", - "efficient": { - "General": 10, - "No2": 30 - } - }, - { - "name": [ - "皇家探员(自称)" - ], - "intro": "进驻会客室时,更容易获得企鹅物流线索(工作时长影响概率)", - "template": "Bskill_meet_penguin1.png", - "efficient": { - "No2": 10 - } - }, - { - "name": [ - "守望者" - ], - "intro": "进驻会客室时,线索搜集速度提升10%,且更容易获得莱茵生命线索(工作时长影响概率)", - "template": "Bskill_meet_rhine2.png", - "efficient": { - "General": 10, - "No1": 30 - } - }, - { - "name": [ - "哥伦比亚史" - ], - "intro": "进驻会客室后,每当新搜集到的线索不是莱茵生命时,则额外增加莱茵生命线索的出现概率(工作时长影响概率)", - "template": "Bskill_meet_flag_rhine.png", - "efficient": { - "No1": 15 - } - }, - { - "name": [ - "警司" - ], - "intro": "进驻会客室时,线索搜集速度提升25%", - "template": "Bskill_meet_spd3.png", - "efficient": { - "all": 25 - } - }, - { - "name": [ - "线索搜集·β" - ], - "intro": "进驻会客室时,线索搜集速度提升20%", - "template": "Bskill_meet_spd2.png", - "efficient": { - "all": 20 - } - }, - { - "name": [ - "线索搜集·α" - ], - "intro": "进驻会客室时,线索搜集速度提升10%", - "template": "Bskill_meet_spd1.png", - "efficient": { - "all": 10 - } + }, + { + "intro": "稀音-2", + "skills": [ + "Bskill_man_spd_add2", + "Bskill_man_exp&limit1" + ], + "efficient": { + "CombatRecord": 35 } + }, + { + "intro": "帕拉斯-2", + "skills": [ + "Bskill_man_limit&cost1", + "Bskill_man_exp1" + ], + "efficient": { + "CombatRecord": 33 + } + }, + { + "intro": "刻俄柏-2", + "skills": [ + "Bskill_man_spd_add1", + "Bskill_man_limit&cost1" + ], + "efficient": { + "all": 32 + } + }, + { + "intro": "贝娜", + "skills": [ + "Bskill_man_spd&limit&cost4" + ], + "efficient": { + "all": 31 + } + }, + { + "intro": "豆苗-1", + "skills": [ + "Bskill_man_spd1", + "Bskill_man_limit&cost1" + ], + "efficient": { + "all": 23 + } + }, + { + "intro": "石棉-2", + "skills": [ + "Bskill_man_spd&limit&cost3", + "Bskill_man_limit&cost3" + ], + "efficient": { + "all": 29 + } + }, + { + "intro": "黑角、蛇屠箱", + "skills": [ + "Bskill_man_spd&limit3" + ], + "efficient": { + "all": 20 + } + }, + { + "intro": "米格鲁、卡缇", + "skills": [ + "Bskill_man_spd&limit1" + ], + "efficient": { + "all": 16 + } + }, + { + "intro": "卡达-1", + "skills": [ + "Bskill_man_exp&cost", + "Bskill_man_exp&limit2" + ], + "efficient": { + "all": 15 + } + }, + { + "intro": "刻俄柏", + "skills": [ + "Bskill_man_limit&cost1" + ], + "efficient": { + "all": 8 + } + }, + { + "intro": "帕拉斯", + "skills": [ + "Bskill_man_limit&cost1" + ], + "efficient": { + "all": 8 + } + } + ] + }, + { + "intro": "温蒂-2组", + "conditions": { + "NumOfPower": 3 + }, + "necessary": [ + { + "intro": "温蒂-2", + "skills": [ + "Bskill_man_spd&power3" + ], + "efficient": { + "all": 45 + } + } ], - "skillsGroup": [] - } + "optional": [ + { + "intro": "森蚺-2", + "skills": [ + "Bskill_man_spd&power2" + ], + "efficient": { + "all": 30 + } + }, + { + "intro": "清流-1", + "skills": [ + "Bskill_man_spd&trade" + ], + "efficient": { + "PureGold_reg": "[NumOfTrade] * 20" + } + }, + { + "intro": "森蚺、异客2", + "skills": [ + "Bskill_man_spd&power1" + ], + "efficient": { + "all": 15 + } + } + ] + }, + { + "intro": "温蒂组", + "conditions": { + "NumOfPower": 3 + }, + "necessary": [ + { + "intro": "温蒂、森蚺-2", + "skills": [ + "Bskill_man_spd&power2" + ], + "efficient": { + "all": 30 + } + } + ], + "optional": [ + { + "intro": "温蒂、森蚺-2", + "skills": [ + "Bskill_man_spd&power2" + ], + "efficient": { + "all": 30 + } + }, + { + "intro": "清流-1", + "skills": [ + "Bskill_man_spd&trade" + ], + "efficient": { + "PureGold_reg": "[NumOfTrade] * 20" + } + }, + { + "intro": "森蚺、异客2", + "skills": [ + "Bskill_man_spd&power1" + ], + "efficient": { + "all": 15 + } + } + ] + }, + { + "intro": "温蒂-2组: 2电站", + "conditions": { + "NumOfPower": 2 + }, + "necessary": [ + { + "intro": "温蒂-2", + "skills": [ + "Bskill_man_spd&power3" + ], + "efficient": { + "all": 30 + } + } + ], + "optional": [ + { + "intro": "森蚺-2", + "skills": [ + "Bskill_man_spd&power2" + ], + "efficient": { + "all": 20 + } + }, + { + "intro": "清流-1", + "skills": [ + "Bskill_man_spd&trade" + ], + "efficient": { + "PureGold_reg": "[NumOfTrade] * 20" + } + }, + { + "intro": "森蚺、异客2", + "skills": [ + "Bskill_man_spd&power1" + ], + "efficient": { + "all": 10 + } + } + ] + }, + { + "intro": "温蒂组: 2电站", + "conditions": { + "NumOfPower": 2 + }, + "necessary": [ + { + "intro": "温蒂、森蚺-2", + "skills": [ + "Bskill_man_spd&power2" + ], + "efficient": { + "all": 30 + } + } + ], + "optional": [ + { + "intro": "温蒂、森蚺-2", + "skills": [ + "Bskill_man_spd&power2" + ], + "efficient": { + "all": 20 + } + }, + { + "intro": "清流-1", + "skills": [ + "Bskill_man_spd&trade" + ], + "efficient": { + "PureGold_reg": "[NumOfTrade] * 20" + } + }, + { + "intro": "森蚺、异客2", + "skills": [ + "Bskill_man_spd&power1" + ], + "efficient": { + "all": 10 + } + } + ] + } + ] + }, + "Trade": { + "products": [ + "Money" + ], + "maxNumOfOpers": 3, + "skills": [ + { + "name": [ + "“愿者上钩”" + ], + "intro": "进驻贸易站时,宿舍内每有1名干员则人间烟火+1,同时每有1点人间烟火,则订单获取效率+1%", + "template": "Bskill_tra_bd_n2.png" + }, + { + "name": [ + "订单流可视化·α" + ], + "intro": "进驻贸易站时,订单获取效率+5%,每有4条赤金生产线,则赤金生产线额外+2", + "template": "Bskill_tra_flow_gc1.png", + "efficient": { + "all": 5 + } + }, + { + "name": [ + "订单流可视化·β" + ], + "intro": "进驻贸易站时,订单获取效率+5%,每有2条赤金生产线,则赤金生产线额外+2", + "template": "Bskill_tra_flow_gc2.png", + "efficient": { + "all": 5 + } + }, + { + "name": [ + "物流规划·α" + ], + "intro": "进驻贸易站时,订单获取效率+5%,每有4条赤金生产线,则当前贸易站订单获取效率额外+15%", + "template": "Bskill_tra_flow_gs1.png", + "efficient": { + "all": 5 + } + }, + { + "name": [ + "物流规划·β" + ], + "intro": "进驻贸易站时,订单获取效率+5%,每有2条赤金生产线,则当前贸易站订单获取效率额外+15%", + "template": "Bskill_tra_flow_gs2.png", + "efficient": { + "all": 5 + } + }, + { + "name": [ + "醉翁之意·α" + ], + "intro": "当与德克萨斯在同一个贸易站时,心情每小时消耗-0.1,订单上限+2", + "template": "Bskill_tra_Lappland1.png" + }, + { + "name": [ + "醉翁之意·β" + ], + "intro": "当与德克萨斯在同一个贸易站时,心情每小时消耗-0.1,订单上限+4", + "template": "Bskill_tra_Lappland2.png" + }, + { + "name": [ + "谈判" + ], + "intro": "进驻贸易站时,订单上限+5,心情每小时消耗-0.25", + "template": "Bskill_tra_limit&cost.png" + }, + { + "name": [ + "市井之道" + ], + "intro": "进驻贸易站时,当前贸易站内其他干员提供的每10%订单获取效率使订单上限-1(订单最少为1),同时每有1笔订单就+4%订单获取效率", + "template": "Bskill_tra_limit_count.png" + }, + { + "name": [ + "摊贩经济" + ], + "intro": "进驻贸易站时,当前订单数与订单上限每差1笔订单,则订单获取效率+4%", + "template": "Bskill_tra_limit_diff.png" + }, + { + "name": [ + "投资·α" + ], + "intro": "进驻贸易站后,如果下笔赤金订单交付数大于3,则其龙门币收益+250,心情每小时消耗-0.25", + "template": "Bskill_tra_long1.png" + }, + { + "name": [ + "投资·β" + ], + "intro": "进驻贸易站后,如果下笔赤金订单交付数大于3,则其龙门币收益+500,心情每小时消耗-0.25", + "template": "Bskill_tra_long2.png" + }, + { + "name": [ + "交际" + ], + "intro": "进驻贸易站时,订单获取效率+30%,心情每小时消耗-0.25", + "template": "Bskill_tra_spd&cost.png", + "efficient": { + "all": 30.1 + } + }, + { + "name": [ + "虔诚筹款·α" + ], + "intro": "进驻贸易站时,每间宿舍每级+1%获取效率", + "template": "Bskill_tra_spd&dorm1.png", + "efficient": { + "all": 20 + } + }, + { + "name": [ + "虔诚筹款·β" + ], + "intro": "进驻贸易站时,每间宿舍每级+2%获取效率", + "template": "Bskill_tra_spd&dorm2.png", + "efficient": { + "all": 40 + } + }, + { + "name": [ + "订单管理·α" + ], + "intro": "进驻贸易站时,订单获取效率+10%,且订单上限+2", + "template": "Bskill_tra_spd&limit1.png", + "efficient": { + "all": 10 + } + }, + { + "name": [ + "订单管理·β" + ], + "intro": "进驻贸易站时,订单获取效率+10%,且订单上限+4", + "template": "Bskill_tra_spd&limit2.png", + "efficient": { + "all": 10 + } + }, + { + "name": [ + "喀兰贸易·α" + ], + "intro": "进驻贸易站时,订单获取效率+15%,且订单上限+2", + "template": "Bskill_tra_spd&limit3.png", + "efficient": { + "all": 15 + } + }, + { + "name": [ + "喀兰贸易·β" + ], + "intro": "进驻贸易站时,订单获取效率+15%,且订单上限+4", + "template": "Bskill_tra_spd&limit4.png", + "efficient": { + "all": 15 + } + }, + { + "name": [ + "喀兰之主" + ], + "intro": "进驻贸易站时,订单获取效率+20%,且订单上限+4", + "template": "Bskill_tra_spd&limit5.png", + "efficient": { + "all": 20 + } + }, + { + "name": [ + "供应管理" + ], + "intro": "进驻贸易站时,订单获取效率+25%,且订单上限+1", + "template": "Bskill_tra_spd&limit6.png", + "efficient": { + "all": 25 + } + }, + { + "name": [ + "使命必达", + "少当家" + ], + "intro": "进驻贸易站时,订单获取效率+30%,且订单上限+1", + "template": "Bskill_tra_spd&limit7.png", + "efficient": { + "all": 30 + } + }, + { + "name": [ + "天道酬勤·α" + ], + "intro": "进驻贸易站时,当前贸易站内干员提供的每5%订单获取效率,额外提供5%效率,最多提供25%效率", + "template": "Bskill_tra_spd_variable21.png", + "efficient": { + "all": 25 + } + }, + { + "name": [ + "天道酬勤·β" + ], + "intro": "进驻贸易站时,当前贸易站内干员提供的每5%订单获取效率,额外提供5%效率,最多提供35%效率", + "template": "Bskill_tra_spd_variable22.png", + "efficient": { + "all": 35 + } + }, + { + "name": [ + "企鹅物流·α", + "峯驰物流", + "订单分发·α" + ], + "intro": "进驻贸易站时,订单获取效率+20%", + "template": "Bskill_tra_spd1.png", + "efficient": { + "all": 20 + } + }, + { + "name": [ + "企鹅物流·β", + "订单分发·β" + ], + "intro": "进驻贸易站时,订单获取效率+30%", + "template": "Bskill_tra_spd2.png", + "efficient": { + "all": 30 + } + }, + { + "name": [ + "物流专家" + ], + "intro": "进驻贸易站时,订单获取效率+35%", + "template": "Bskill_tra_spd3.png", + "efficient": { + "all": 35 + } + }, + { + "name": [ + "恩怨" + ], + "intro": "当与拉普兰德在同一个贸易站时,心情每小时消耗+0.3,订单获取效率+65%", + "template": "Bskill_tra_texas1.png" + }, + { + "name": [ + "默契" + ], + "intro": "当与能天使在同一个贸易站时,心情每小时消耗-0.3", + "template": "Bskill_tra_texas2.png" + }, + { + "name": [ + "低语" + ], + "intro": "进驻贸易站时,当前贸易站内其他干员提供的订单获取效率全部归零,且每人为自身+45%订单获取效率,同时全体心情每小时消耗+0.25", + "template": "Bskill_tra_vodfox.png" + }, + { + "name": [ + "裁缝·α" + ], + "intro": "进驻贸易站时,小幅提升当前贸易站高品质贵金属订单的出现概率(工作时长影响概率),心情每小时消耗-0.25", + "template": "Bskill_tra_wt&cost1.png" + }, + { + "name": [ + "裁缝·β", + "手工艺品·β" + ], + "intro": "进驻贸易站时,提升当前贸易站高品质贵金属订单的出现概率(工作时长影响概率),心情每小时消耗-0.25", + "template": "Bskill_tra_wt&cost2.png" + } + ], + "skillsGroup_Doc": "相关技能组参考https://bbs.nga.cn/read.php?tid=25965441", + "skillsGroup": [ + { + "intro": "德2拉2组", + "necessary": [ + { + "intro": "德克萨斯-2", + "skills": [ + "Bskill_tra_texas1", + "Bskill_tra_texas2" + ], + "efficient": { + "all": 64.9 + } + }, + { + "intro": "拉普兰德-2", + "skills": [ + "Bskill_tra_Lappland2" + ], + "efficient": { + "all": 0 + } + } + ], + "optional": [ + { + "intro": "孑-0", + "skills": [ + "Bskill_tra_limit_diff" + ], + "efficient": { + "all": 43 + } + }, + { + "intro": "孑-1", + "skills": [ + "Bskill_tra_limit_diff", + "Bskill_tra_limit_count" + ], + "efficient": { + "all": 32 + } + }, + { + "intro": "能天使-2", + "skills": [ + "Bskill_tra_spd3" + ], + "efficient": { + "all": 35.2 + }, + "Doc": "能天使1的技能别人也有,识别上不了,管不了了" + } + ], + "allowExternal": true + }, + { + "intro": "德2拉0组", + "necessary": [ + { + "intro": "德克萨斯-2", + "skills": [ + "Bskill_tra_texas1", + "Bskill_tra_texas2" + ], + "efficient": { + "all": 64.9 + } + }, + { + "intro": "拉普兰德-0", + "skills": [ + "Bskill_tra_Lappland1" + ], + "efficient": { + "all": 0 + } + } + ], + "optional": [ + { + "intro": "能天使-2", + "skills": [ + "Bskill_tra_spd3" + ], + "efficient": { + "all": 35.2 + }, + "Doc": "能天使1的技能别人也有,识别上不了,管不了了" + } + ], + "allowExternal": true + }, + { + "intro": "德0拉2组", + "necessary": [ + { + "intro": "德克萨斯-0", + "skills": [ + "Bskill_tra_texas1" + ], + "efficient": { + "all": 64.9 + } + }, + { + "intro": "拉普兰德-2", + "skills": [ + "Bskill_tra_Lappland2" + ], + "efficient": { + "all": 0 + } + } + ], + "optional": [ + { + "intro": "孑-0", + "skills": [ + "Bskill_tra_limit_diff" + ], + "efficient": { + "all": 43 + } + }, + { + "intro": "孑-1", + "skills": [ + "Bskill_tra_limit_diff", + "Bskill_tra_limit_count" + ], + "efficient": { + "all": 32 + } + } + ], + "allowExternal": true + }, + { + "intro": "德0拉0组", + "necessary": [ + { + "intro": "德克萨斯-0", + "skills": [ + "Bskill_tra_texas1" + ], + "efficient": { + "all": 64.9 + } + }, + { + "intro": "拉普兰德-0", + "skills": [ + "Bskill_tra_Lappland1" + ], + "efficient": { + "all": 0 + } + } + ], + "optional": [], + "allowExternal": true + }, + { + "intro": "巫恋组", + "necessary": [ + { + "intro": "巫恋-2", + "skills": [ + "Bskill_tra_wt&cost1", + "Bskill_tra_vodfox" + ], + "efficient": { + "all": 90.1 + } + } + ], + "optional": [ + { + "intro": "龙舌兰-2", + "skills": [ + "Bskill_tra_long2" + ], + "efficient": { + "all": 80 + }, + "Doc": "这里具体效率不同攻略各执一词,写个大概的,反正别的组合也没这么高的,大差不差能第一就行_(:з」∠)_" + }, + { + "intro": "龙舌兰-1", + "skills": [ + "Bskill_tra_long1" + ], + "efficient": { + "all": 40 + } + }, + { + "intro": "柏喙-2、卡夫卡-2", + "skills": [ + "Bskill_tra_wt&cost2" + ], + "efficient": { + "all": 2 + } + }, + { + "intro": "柏喙-1、卡夫卡-1", + "skills": [ + "Bskill_tra_wt&cost1" + ], + "efficient": { + "all": 1 + } + } + ], + "allowExternal": true + }, + { + "intro": "孑-0组", + "necessary": [ + { + "intro": "孑-0", + "skills": [ + "Bskill_tra_limit_diff" + ], + "efficient": { + "all": 27 + } + } + ], + "optional": [ + { + "intro": "银灰-2", + "skills": [ + "Bskill_tra_spd&limit5" + ], + "efficient": { + "all": 36 + } + }, + { + "intro": "喀兰贸易·β", + "skills": [ + "Bskill_tra_spd&limit4" + ], + "efficient": { + "all": 31 + } + }, + { + "intro": "拜松、可颂", + "skills": [ + "Bskill_tra_spd&limit7", + "Bskill_tra_spd1" + ], + "efficient": { + "all": 34 + } + }, + { + "intro": "供应管理", + "skills": [ + "Bskill_tra_spd&limit6" + ], + "efficient": { + "all": 29 + } + }, + { + "intro": "喀兰贸易·α", + "skills": [ + "Bskill_tra_spd&limit3" + ], + "efficient": { + "all": 23 + } + } + ] + }, + { + "intro": "孑-1组", + "necessary": [ + { + "intro": "孑-1", + "skills": [ + "Bskill_tra_limit_count", + "Bskill_tra_limit_diff" + ], + "efficient": { + "all": 40 + } + } + ], + "optional": [ + { + "intro": "银灰-2", + "skills": [ + "Bskill_tra_spd&limit5" + ], + "efficient": { + "all": 28 + } + }, + { + "intro": "喀兰贸易·β", + "skills": [ + "Bskill_tra_spd&limit4" + ], + "efficient": { + "all": 27 + } + }, + { + "intro": "拜松-2、可颂-2", + "skills": [ + "Bskill_tra_spd&limit7", + "Bskill_tra_spd1" + ], + "efficient": { + "all": 22 + } + }, + { + "intro": "订单管理·β", + "skills": [ + "Bskill_tra_spd&limit6" + ], + "efficient": { + "all": 22 + } + }, + { + "intro": "谈判", + "skills": [ + "Bskill_tra_limit&cost" + ], + "efficient": { + "all": 20 + } + } + ] + } + ] + }, + "Power": { + "maxNumOfOpers": 1, + "products": [ + "Drone" + ], + "skills": [ + { + "name": [ + "脉冲电弧·β" + ], + "intro": "进驻发电站时,无人机每小时充能速度+20%", + "template": "Bskill_pow_spd3.png", + "efficient": { + "all": 20 + } + }, + { + "name": [ + "脉冲电弧·α" + ], + "intro": "进驻发电站时,无人机每小时充能速度+15%", + "template": "Bskill_pow_spd2.png", + "efficient": { + "all": 15 + } + }, + { + "name": [ + "热能充能·α" + ], + "intro": "进驻发电站时,无人机每小时充能速度+10%", + "template": "Bskill_pow_spd1.png", + "efficient": { + "all": 10 + } + }, + { + "name": [ + "热情澎湃" + ], + "intro": "进驻发电站时,无人机每小时充能速度+10%", + "template": "Bskill_pow_spd&cost.png", + "efficient": { + "all": 0.1 + } + } + ], + "skillsGroup": [] + }, + "Office": { + "maxNumOfOpers": 1, + "products": [ + "HR" + ], + "skills": [ + { + "name": [ + "准时下班" + ], + "intro": "进驻人力办公室时,人脉资源的联络速度+45%,心情每小时消耗+2", + "template": "Bskill_hire_skgoat.png", + "efficient": { + "all": 44.9 + } + }, + { + "name": [ + "天灾信使·β" + ], + "intro": "进驻人力办公室时,人脉资源的联络速度+45%", + "template": "Bskill_hire_spd5.png", + "efficient": { + "all": 45 + } + }, + { + "name": [ + "心理学" + ], + "intro": "进驻人力办公室时,人脉资源的联络速度+40%", + "template": "Bskill_hire_spd4.png", + "efficient": { + "all": 40 + } + }, + { + "name": [ + "洞悉人心" + ], + "intro": "进驻人力办公室时,人脉资源的联络速度+35%,同时每个招募位(不包含初始招募位)额外+5%会客室线索搜集速度", + "template": "Bskill_hire_spd&clue.png", + "efficient": { + "all": 35.1 + } + }, + { + "name": [ + "天灾信使·α" + ], + "intro": "进驻人力办公室时,人脉资源的联络速度+30%", + "template": "Bskill_hire_spd2.png", + "efficient": { + "all": 30 + } + }, + { + "name": [ + "人事管理·α" + ], + "intro": "进驻人力办公室时,人脉资源的联络速度+20%", + "template": "Bskill_hire_spd1.png", + "efficient": { + "all": 20 + } + }, + { + "name": [ + "人望" + ], + "intro": "进驻人力办公室时,人脉资源的联络速度+20%,每产生1次联络次数,增加乌萨斯学生自治团线索的概率(工作时长和招募位影响概率)", + "template": "Bskill_hire_spd&ursus2.png", + "efficient": { + "all": 20 + } + }, + { + "name": [ + "内幕" + ], + "intro": "进驻人力办公室时,人脉资源的联络速度+20%,每产生1次联络次数,增加黑钢国际线索的概率(工作时长和招募位影响概率)", + "template": "Bskill_hire_spd&blacksteel2.png", + "efficient": { + "all": 20 + } + }, + { + "name": [ + "巡游" + ], + "intro": "进驻人力办公室时,人脉资源的联络速度+20%,同时每个招募位(不包含初始招募位)+10点记忆碎片", + "template": "Bskill_hire_spd_bd_n1_n1.png", + "efficient": { + "all": 20 + } + }, + { + "name": [ + "追忆" + ], + "intro": "进驻人力办公室时,每1点记忆碎片转化为1点感知信息,心情耗尽时清空所有记忆碎片和自身累积的感知信息", + "template": "Bskill_hire_spd_memento.png" + }, + { + "name": [ + "救援队·资源清点" + ], + "intro": "进驻人力办公室时,人脉资源的联络速度+20%,心情每小时消耗-0.25", + "template": "Bskill_hire_spd&cost2.png", + "efficient": { + "all": 20.1 + } + }, + { + "name": [ + "救援队·灾后普查" + ], + "intro": "进驻人力办公室时,每个招募位(不包含初始招募位)+10点人间烟火", + "template": "Bskill_hire_spd_bd_n2.png" + }, + { + "name": [ + "语言学" + ], + "intro": "进驻人力办公室时,人脉资源的联络速度+20%,每1点情报储备额外+5%联络速度,每1瓶乌萨斯特饮额外+5%联络速度", + "template": "Bskill_hire_blitz.png", + "efficient": { + "all": 20.1 + } + }, + { + "name": [ + "救援队·珠算" + ], + "intro": "进驻人力办公室时,人脉资源的联络速度+10%,心情每小时消耗-0.25", + "template": "Bskill_hire_spd&cost1.png", + "efficient": { + "all": 10.1 + } + } + ], + "skillsGroup": [] + }, + "Reception": { + "Doc": "会客室", + "maxNumOfOpers": 2, + "products": [ + "General", + "No1", + "No2", + "No3", + "No4", + "No5", + "No6", + "No7" + ], + "skills": [ + { + "name": [ + "信使·罗德岛制药" + ], + "intro": "进驻会客室时,线索搜集速度提升10%,且更容易获得罗德岛制药线索(工作时长影响概率)", + "template": "Bskill_meet_rhodes2.png", + "efficient": { + "General": 10, + "No7": 30 + } + }, + { + "name": [ + "通讯员" + ], + "intro": "进驻会客室时,更容易获得罗德岛制药线索(工作时长影响概率)", + "template": "Bskill_meet_blacksteel2.png", + "efficient": { + "No7": 10 + } + }, + { + "name": [ + "插旗" + ], + "intro": "进驻会客室后,每当新搜集到的线索不是罗德岛制药时,则额外增加罗德岛制药线索的出现概率(工作时长影响概率)", + "template": "Bskill_meet_flag_rhodes.png", + "efficient": { + "No7": 15 + } + }, + { + "name": [ + "讯使" + ], + "intro": "进驻会客室时,线索搜集速度提升10%,且更容易获得喀兰贸易线索(工作时长影响概率)", + "template": "Bskill_meet_kjerag2.png", + "efficient": { + "General": 10, + "No6": 30 + } + }, + { + "name": [ + "传讯者" + ], + "intro": "进驻会客室时,线索搜集速度提升10%,且更容易获得格拉斯哥帮线索(工作时长影响概率)", + "template": "Bskill_meet_glasgow2.png", + "efficient": { + "General": 10, + "No5": 30 + } + }, + { + "name": [ + "军师" + ], + "intro": "进驻会客室时,线索搜集速度提升10%,且更容易获得乌萨斯学生自治团线索(工作时长影响概率)", + "template": "Bskill_meet_ursus2.png", + "efficient": { + "General": 10, + "No4": 30 + } + }, + { + "name": [ + "秘密搜查" + ], + "intro": "进驻会客室时,更容易获得乌萨斯学生自治团线索(工作时长影响概率)", + "template": "Bskill_meet_ursus1.png", + "efficient": { + "No4": 10 + } + }, + { + "name": [ + "甄别" + ], + "intro": "进驻会客室后,每当新搜集到的线索不是乌萨斯学生自治团时,则额外增加乌萨斯学生自治团线索的出现概率(工作时长影响概率)", + "template": "Bskill_meet_flag_ursus.png", + "efficient": { + "No4": 15 + } + }, + { + "name": [ + "B.P.R.S" + ], + "intro": "进驻会客室时,线索搜集速度提升10%,且更容易获得黑钢国际线索(工作时长影响概率)", + "template": "Bskill_meet_blacksteel2.png", + "efficient": { + "General": 10, + "No3": 30 + } + }, + { + "name": [ + "信使·企鹅物流" + ], + "intro": "进驻会客室时,线索搜集速度提升10%,且更容易获得企鹅物流线索(工作时长影响概率)", + "template": "Bskill_meet_penguin2.png", + "efficient": { + "General": 10, + "No2": 30 + } + }, + { + "name": [ + "皇家探员(自称)" + ], + "intro": "进驻会客室时,更容易获得企鹅物流线索(工作时长影响概率)", + "template": "Bskill_meet_penguin1.png", + "efficient": { + "No2": 10 + } + }, + { + "name": [ + "守望者" + ], + "intro": "进驻会客室时,线索搜集速度提升10%,且更容易获得莱茵生命线索(工作时长影响概率)", + "template": "Bskill_meet_rhine2.png", + "efficient": { + "General": 10, + "No1": 30 + } + }, + { + "name": [ + "哥伦比亚史" + ], + "intro": "进驻会客室后,每当新搜集到的线索不是莱茵生命时,则额外增加莱茵生命线索的出现概率(工作时长影响概率)", + "template": "Bskill_meet_flag_rhine.png", + "efficient": { + "No1": 15 + } + }, + { + "name": [ + "警司" + ], + "intro": "进驻会客室时,线索搜集速度提升25%", + "template": "Bskill_meet_spd3.png", + "efficient": { + "all": 25 + } + }, + { + "name": [ + "线索搜集·β" + ], + "intro": "进驻会客室时,线索搜集速度提升20%", + "template": "Bskill_meet_spd2.png", + "efficient": { + "all": 20 + } + }, + { + "name": [ + "线索搜集·α" + ], + "intro": "进驻会客室时,线索搜集速度提升10%", + "template": "Bskill_meet_spd1.png", + "efficient": { + "all": 10 + } + } + ], + "skillsGroup": [] + } } \ No newline at end of file diff --git a/resource/tasks.json b/resource/tasks.json index 1f9b9f9fa1..28d0afe236 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -1,1501 +1,1501 @@ { - "SanityBegin": { - "algorithm": "justreturn", - "action": "doNothing", - "next": [ - "UsePrts", - "StartButton1", - "StartButton2", - "PRTS", - "UseMedicine", - "UseStone", - "EndOfAction", - "PrtsErrorConfirm", - "OfflineConfirm", - "StartToWakeUp", - "TodaysSupplies", - "CloseAnno", - "Terminal", - "LastBattle" - ] - }, - "UsePrts": { - "templThreshold": 0.9, - "action": "clickSelf", - "next": [ - "StartButton1" - ] - }, - "StartButton1": { - "algorithm": "OcrDetect", - "text": [ - "开始行动" - ], - "roi": [ - 800, - 400, - 480, - 320 - ], - "action": "clickSelf", - "next": [ - "StartButton2", - "UseMedicine", - "UseStone" - ] - }, - "StartButton2": { - "action": "clickSelf", - "rearDelay": 20000, - "templThreshold": 0.95, - "next": [ - "PRTS", - "StartButton2", - "OfflineConfirm" - ] - }, - "PRTS": { - "algorithm": "OcrDetect", - "text": [ - "剩余可放置角色", - "接管作战" - ], - "roi": [ - 0, - 530, - 1279, - 189 - ], - "action": "doNothing", - "rearDelay": 5000, - "next": [ - "PRTS", - "PrtsErrorConfirm", - "EndOfAction", - "OfflineConfirm", - "WaitAfterPRTS" - ] - }, - "WaitAfterPRTS": { - "rearDelay": 3000, - "algorithm": "justreturn", - "action": "doNothing", - "next": [ - "PRTS", - "EndOfAction", - "ClickCornerAfterPRTS" - ] - }, - "ClickCornerAfterPRTS": { - "ClickCorner_Doc": "点击屏幕右边,不会点到掉落物品,且不会关掉关卡选择的一块区域", - "algorithm": "justreturn", - "action": "clickRect", - "specificRect": [ - 1000, - 1, - 270, - 340 - ], - "next": [ - "EndOfAction", - "StartButton1", - "StartButton2", - "UseMedicine", - "UseStone", - "ClickCornerAfterPRTS" - ] - }, - "EndOfAction": { - "algorithm": "OcrDetect", - "text": [ - "行动结束" - ], - "preDelay": 5000, - "action": "stageDrops", - "action_Doc": "为“行动结束”特化的action,包含截图、识别关卡掉落等功能", - "next": [ - "ClickCorner" - ] - }, - "ClickCorner": { - "ClickCorner_Doc": "点击屏幕右边,不会点到掉落物品,且不会关掉关卡选择的一块区域", - "algorithm": "justreturn", - "action": "clickRect", - "rearDelay": 2000, - "specificRect": [ - 1000, - 1, - 270, - 340 - ], - "next": [ - "StartButton1", - "StartButton2", - "UseMedicine", - "UseStone", - "EndOfAction" - ] - }, - "UseMedicine": { - "action": "doNothing", - "next": [ - "MedicineConfirm" - ] - }, - "MedicineConfirm": { - "action": "clickSelf", - "maxTimes": 0, - "reduceOtherTimes": [ - "StartButton1" - ], - "next": [ - "StartButton1" - ] - }, - "UseStone": { - "action": "doNothing", - "next": [ - "StoneConfirm" - ] - }, - "StoneConfirm": { - "template": "MedicineConfirm.png", - "action": "clickSelf", - "maxTimes": 0, - "reduceOtherTimes": [ - "StartButton1" - ], - "next": [ - "StartButton1" - ] - }, - "PrtsErrorConfirm": { - "templThreshold": 0.8, - "cache": false, - "action": "doNothing", - "next": [ - "AbandonAction", - "OfflineConfirmAfterBattle" - ] - }, - "AbandonAction": { - "action": "clickSelf", - "cache": false, - "reduceOtherTimes": [ - "StartButton1", - "StartButton2" - ], - "next": [ - "EndOfAction", - "StartToWakeUp", - "OfflineConfirm" - ] - }, - "OfflineConfirmAfterBattle": { - "template": "PopupConfirm.png", - "action": "clickSelf", - "cache": false, - "next": [ - "PRTS", - "PrtsErrorConfirm", - "OfflineConfirm", - "StartToWakeUp" - ] - }, - "OfflineConfirm": { - "action": "clickSelf", - "cache": false, - "reduceOtherTimes": [ - "StartButton1", - "StartButton2" - ], - "next": [ - "CloseAnno", - "StartToWakeUp", - "OfflineConfirm" - ] - }, - "StartToWakeUp": { - "action": "clickSelf", - "cache": false, - "next": [ - "Terminal", - "CloseAnno", - "OfflineConfirm", - "TodaysSupplies" - ] - }, - "CloseAnno": { - "action": "clickSelf", - "cache": false, - "next": [ - "Terminal", - "CloseAnno", - "TodaysSupplies" - ] - }, - "Terminal": { - "cache": false, - "action": "clickSelf", - "next": [ - "LastBattle", - "CloseAnno", - "TodaysSupplies" - ] - }, - "TodaysSupplies": { - "algorithm": "OcrDetect", - "cache": false, - "text": [ - "今日配给" - ], - "action": "clickRect", - "specificRect": [ - 1000, - 1, - 270, - 340 - ], - "next": [ - "CloseAnno", - "Terminal" - ] - }, - "LastBattle": { - "algorithm": "OcrDetect", - "cache": false, - "text": [ - "上一次作战", - "前往上一次" - ], - "action": "clickSelf", - "next": [ - "StartButton1" - ] - }, - "VisitBegin": { - "algorithm": "justreturn", - "action": "doNothing", - "next": [ - "Friends", - "FriendsList", - "StartToVisit", - "VisitNext", - "VisitNextBlack", - "ReturnToFriends" - ] - }, - "ReturnToFriends": { - "template": "Return.png", - "templThreshold": 0.85, - "histThreshold": 0.85, - "rearDelay": 1000, - "action": "clickSelf", - "next": [ - "Friends", - "ReturnToFriends" - ] - }, - "Friends": { - "templThreshold": 0.85, - "action": "clickSelf", - "next": [ - "FriendsList", - "Friends" - ] - }, - "FriendsList": { - "action": "clickSelf", - "next": [ - "StartToVisit", - "NoFriends" - ] - }, - "NoFriends": { - "action": "doNothing", - "next": [ - "ReturnToMall" - ] - }, - "StartToVisit": { - "templThreshold": 0.8, - "action": "clickSelf", - "rearDelay": 3000, - "next": [ - "VisitNext", - "VisitNextBlack", - "VisitNextOcr" - ] - }, - "VisitNext": { - "action": "clickSelf", - "cache": false, - "rearDelay": 2000, - "roi": [ - 1080, - 570, - 195, - 130 - ], - "exceededNext": [ - "ReturnToMall" - ], - "next": [ - "VisitLimited", - "VisitNext", - "VisitNextBlack", - "VisitNextOcr" - ] - }, - "VisitNextOcr": { - "algorithm": "OcrDetect", - "text": [ - "访问下位" - ], - "action": "clickSelf", - "rearDelay": 2000, - "roi": [ - 1080, - 570, - 195, - 130 - ], - "exceededNext": [ - "ReturnToMall" - ], - "next": [ - "VisitLimited", - "VisitNext", - "VisitNextBlack", - "VisitNextOcr" - ] - }, - "ReturnToMall": { - "rearDelay": 1000, - "template": "Return.png", - "templThreshold": 0.85, - "histThreshold": 0.85, - "action": "clickSelf", - "next": [ - "Mall", - "ReturnToMallConfirm", - "ReturnToMall" - ] - }, - "ReturnToMallConfirm": { - "template": "PopupConfirm.png", - "action": "clickSelf", - "rearDelay": 3000, - "next": [ - "ReturnToMall" - ] - }, - "Mall": { - "action": "clickSelf", - "next": [ - "CreditStore", - "CreditStoreOcr" - ] - }, - "CreditStore": { - "templThreshold": 0.85, - "rearDelay": 1000, - "action": "clickSelf", - "next": [ - "CollectCredit", - "Stop" - ] - }, - "CreditStoreOcr": { - "algorithm": "OcrDetect", - "text": [ - "信用交易所" - ], - "roi": [ - 1000, - 0, - 280, - 300 - ], - "rearDelay": 1000, - "action": "clickSelf", - "next": [ - "CollectCredit", - "Stop" - ] - }, - "CollectCredit": { - "action": "clickSelf", - "rearDelay": 2000, - "next": [ - "CloseCollectCredit" - ] - }, - "CloseCollectCredit": { - "algorithm": "justReturn", - "action": "clickRect", - "specificRect": [ - 1000, - 1, - 270, - 340 - ], - "next": [ - "Stop" - ] - }, - "VisitLimited": { - "algorithm": "OcrDetect", - "text": [ - "今日参与", - "已达上限" - ], - "action": "doNothing", - "roi": [ - 900, - 50, - 375, - 140 - ], - "next": [ - "ReturnToMall" - ] - }, - "VisitNextBlack": { - "action": "doNothing", - "roi": [ - 1080, - 570, - 195, - 130 - ], - "next": [ - "ReturnToMall" - ] - }, - "CreditShop-Commoditys": { - "template": "CreditPoint.png", - "rectMove": [ - -60, - -180, - 220, - 220 - ] - }, - "CreditShop-SoldOut": { - "template": "SoldOut.png" - }, - "CreditShop-BuyIt": { - "template": "BuyIt.png", - "preDelay": 1000, - "rearDelay": 1000 - }, - "CreditShop-NoMoney": { - "algorithm": "OcrDetect", - "text": [ - "信用不足", - "无法购买" - ], - "roi": [ - 940, - 60, - 339, - 110 - ] - }, - "CreditShop-NotToBuy": { - "algorithm": "OcrDetect", - "Doc": "这里的text,是子串搜索,即商品名中只要含有任一text,就不买", - "text": [ - "碳", - "家具" - ], - "roi": [ - 0, - -30, - 220, - 70 - ] - }, - "Stop": { - "algorithm": "justreturn", - "action": "stop", - "next": [] - }, - "RecruitTime": { - "template": "RecruitTimeReduce.png", - "templThreshold": 0.89, - "action": "clickSelf", - "rectMove": [ - 7, - 94, - 129, - 44 - ] - }, - "RecruitTags": { - "algorithm": "OcrDetect", - "text": [], - "roi": [ - 200, - 200, - 800, - 500 - ], - "ocrReplace": [ - [ - "沮击", - "狙击" - ], - [ - "犯击", - "狙击" - ], - [ - "泪击", - "狙击" - ], - [ - "都出", - "输出" - ], - [ - "都乐", - "输出" - ], - [ - "抓出", - "输出" - ], - [ - "都任", - "输出" - ], - [ - "新于", - "新手" - ], - [ - "防拍", - "防护" - ] - ] - }, - "OperatorBegin": { - "algorithm": "justreturn", - "action": "doNothing", - "next": [ - "EnterOperator", - "ReturnToOperator" - ] - }, - "EnterOperator": { - "rearDelay": 1000, - "templThreshold": 0.7, - "action": "clickSelf", - "next": [ - "Stop" - ] - }, - "ReturnToOperator": { - "template": "Return.png", - "templThreshold": 0.85, - "histThreshold": 0.85, - "rearDelay": 1000, - "action": "clickSelf", - "next": [ - "EnterOperator", - "ReturnToOperator" - ] - }, - "InfrastBegin": { - "algorithm": "justreturn", - "action": "doNothing", - "next": [ - "EnterInfrast", - "InfrastEnteredFlag", - "InfrastNotification", - "ReturnToInfrast" - ] - }, - "ReturnToInfrast": { - "template": "Return.png", - "templThreshold": 0.85, - "histThreshold": 0.85, - "rearDelay": 1000, - "action": "clickSelf", - "next": [ - "EnterInfrast", - "InfrastNotification", - "InfrastEnteredFlag", - "ReturnToInfrast" - ] - }, - "Return": { - "algorithm": "justReturn", - "action": "clickRect", - "specificRect": [ - 20, - 20, - 135, - 35 - ], - "rearDelay": 1000 - }, - "EnterInfrast": { - "templThreshold": 0.85, - "histThreshold": 0.85, - "rearDelay": 3000, - "action": "clickSelf", - "next": [ - "InfrastEnteredFlag" - ] - }, - "InfrastEnteredFlag": { - "template": "InfrastOverview.png", - "templThreshold": 0.8, - "action": "doNothing", - "next": [ - "InfrastNotification", - "InfrastSwipeToTheLeft" - ] - }, - "InfrastSwipeToTheLeft": { - "algorithm": "justReturn", - "action": "swipeToTheLeft", - "next": [ - "Stop" - ] - }, - "Trade": { - "templThreshold": 0.8, - "cache": false, - "action": "clickSelf", - "rearDelay": 1000, - "next": [ - "ManufacturingLeftBottom" - ] - }, - "TradeMini": { - "templThreshold": 0.8, - "cache": false, - "action": "clickSelf", - "rearDelay": 1000, - "next": [ - "ManufacturingLeftBottom" - ] - }, - "Manufacturing": { - "templThreshold": 0.8, - "cache": false, - "action": "clickSelf", - "rearDelay": 1000, - "next": [ - "ManufacturingLeftBottom" - ] - }, - "ManufacturingMini": { - "templThreshold": 0.8, - "cache": false, - "action": "clickSelf", - "rearDelay": 1000, - "next": [ - "ManufacturingLeftBottom" - ] - }, - "ManufacturingLeftBottom": { - "Doc": "制造站点进去之后,左下角那个“中级作战记录 制造中”", - "algorithm": "justreturn", - "action": "clickRect", - "specificRect": [ - 1, - 535, - 525, - 180 - ], - "next": [ - "Manufacturing1st" - ] - }, - "Manufacturing1st": { - "Doc": "设施列表里第一个(第一个制造站或者贸易站)", - "algorithm": "justreturn", - "action": "clickRect", - "specificRect": [ - 1, - 183, - 220, - 60 - ], - "next": [ - "Stop" - ] - }, - "InfrastNotification": { - "templThreshold": 0.8, - "action": "clickSelf", - "next": [ - "InfrastReward", - "InfrastExitReward" - ] - }, - "InfrastReward": { - "algorithm": "OcrDetect", - "text": [ - "可收获", - "订单交付", - "信赖" - ], - "rearDelay": 1000, - "action": "clickSelf", - "roi": [ - 0, - 600, - 800, - 118 - ], - "cache": false, - "next": [ - "InfrastReward", - "InfrastExitReward" - ] - }, - "InfrastExitReward": { - "Doc": "干员疲劳、线索收集 是不能一键收获的,所以要先退出一键收获的界面,这里点击的是控制中枢左侧那一片空白的区域", - "algorithm": "justreturn", - "action": "clickRect", - "specificRect": [ - 250, - 100, - 380, - 140 - ], - "next": [ - "Stop" - ] - }, - "DroneAssist-MFG": { - "action": "clickSelf", - "cache": false, - "maxTimes": 1, - "Doc": "不同于贸易站,制造站的无人机是一次性全用掉的,所以只执行一次就够了", - "next": [ - "DroneMax", - "DroneConfirm" - ] - }, - "DroneAssist-Trade": { - "action": "clickSelf", - "cache": false, - "next": [ - "DroneMax", - "DroneConfirm" - ] - }, - "DroneMax": { - "action": "clickSelf", - "next": [ - "DroneConfirm" - ] - }, - "DroneConfirm": { - "action": "clickSelf", - "rearDelay": 3000, - "templThreshold": 0.8, - "next": [ - "DeliverableOrder", - "DroneAssist-Trade-Stop", - "DroneAssist-MFG" - ] - }, - "DeliverableOrder": { - "cache": false, - "action": "clickSelf", - "next": [ - "DeliverableOrder", - "DroneAssist-Trade" - ] - }, - "DroneAssist-Trade-Stop": { - "Doc": "如果找到了“无人机加速”按钮,却没有找到订单交付:说明上一次无人机没有把一个订单加速完成,也说明没有更多的无人机了,所以直接stop", - "template": "DroneAssist-Trade.png", - "action": "stop", - "cache": false - }, - "InfrastSkillsUpper": { - "algorithm": "justReturn", - "roi": [ - 400, - 280, - 880, - 80 - ] - }, - "InfrastSkillsLower": { - "algorithm": "justReturn", - "roi": [ - 400, - 560, - 880, - 80 - ] - }, - "InfrastSkillsHash": { - "algorithm": "justReturn", - "rectMove_Doc": "基于笑脸的位置移动", - "rectMove": [ - 0, - -202, - 74, - 100 - ] - }, - "InfrastSmileyOnRest": { - "template": "SmileyOnRest.png", - "maskRange": [ - 100, - 255 - ], - "cache": false, - "templThreshold": 0.8 - }, - "InfrastSmileyOnWork": { - "template": "SmileyOnWork.png", - "maskRange": [ - 100, - 255 - ], - "cache": false, - "templThreshold": 0.8 - }, - "InfrastSmileyOnDistract": { - "template": "SmileyOnDistract.png", - "maskRange": [ - 100, - 255 - ], - "cache": false, - "templThreshold": 0.8 - }, - "InfrastSkills": { - "template": "empty.png", - "templThreshold": 0.9, - "histThreshold": 100, - "histThreshold_Doc": "该任务里的Hist阈值,是特化了拿来做灰度图平均值的,懒得重新写个字段了", - "cache": false, - "rectMove_Doc": "基于笑脸的位置移动", - "rectMove": [ - -8, - -42, - 82, - 40 - ], - "maskRange": [ - 1, - 255 - ] - }, - "InfrastOperListSwipeBegin": { - "algorithm": "justReturn", - "action": "clickRect", - "specificRect": [ - 1080, - 200, - 100, - 300 - ], - "preDelay": 1000, - "rearDelay": 300, - "Doc": "这里的preDelay作为滑动duration使用,rearDelay作为滑动额外延时使用" - }, - "InfrastOperListSwipeEnd": { - "algorithm": "justReturn", - "action": "clickRect", - "specificRect": [ - 700, - 200, - 100, - 300 - ] - }, - "InfrastOperListSwipeToTheLeftBegin": { - "algorithm": "justReturn", - "action": "clickRect", - "specificRect": [ - 1080, - 200, - 200, - 300 - ], - "preDelay": 100, - "rearDelay": 2000, - "maxTimes": 2, - "Doc": "这里的preDelay作为滑动duration使用,rearDelay作为滑动额外延时使用,maxTimes作为重复次数使用" - }, - "InfrastOperListSwipeToTheLeftEnd": { - "algorithm": "justReturn", - "action": "clickRect", - "specificRect": [ - 400, - 200, - 200, - 300 - ] - }, - "InfrastOperMoodProgressBar": { - "template": "empty.png", - "templThreshold": 160, - "histThreshold": 20, - "Doc": "这里的templThreshold,作为进度条最小灰度阈值使用;histThreshold作为进度条相邻点最大变化阈值使用。懒得重新弄个字段了", - "cache": false, - "rectMove_Doc": "基于笑脸的位置移动", - "rectMove": [ - 21, - 8, - 85, - 4 - ] - }, - "InfrastMfg": { - "template": "Manufacturing.png", - "cache": false, - "maskRange": [ - 1, - 255 - ] - }, - "InfrastMfgMini": { - "template": "ManufacturingMini.png", - "cache": false, - "maskRange": [ - 1, - 255 - ] - }, - "InfrastTrade": { - "template": "Trade.png", - "cache": false, - "maskRange": [ - 1, - 255 - ] - }, - "InfrastTradeMini": { - "template": "TradeMini.png", - "cache": false, - "maskRange": [ - 1, - 255 - ] - }, - "InfrastPower": { - "template": "Power.png", - "cache": false, - "maskRange": [ - 1, - 255 - ], - "templThreshold": 0.95 - }, - "InfrastPowerMini": { - "template": "PowerMini.png", - "cache": false, - "maskRange": [ - 1, - 255 - ], - "templThreshold": 0.95 - }, - "InfrastDorm": { - "template": "Dorm.png", - "cache": false, - "maskRange": [ - 1, - 255 - ], - "templThreshold": 0.95 - }, - "InfrastDormMini": { - "template": "DormMini.png", - "cache": false, - "maskRange": [ - 1, - 255 - ], - "templThreshold": 0.95 - }, - "InfrastOffice": { - "template": "Office.png", - "cache": false, - "maskRange": [ - 1, - 255 - ], - "templThreshold": 0.95 - }, - "InfrastOfficeMini": { - "template": "OfficeMini.png", - "cache": false, - "maskRange": [ - 1, - 255 - ], - "templThreshold": 0.95 - }, - "InfrastReception": { - "template": "Reception.png", - "cache": false, - "maskRange": [ - 1, - 255 - ], - "templThreshold": 0.95 - }, - "InfrastReceptionMini": { - "template": "ReceptionMini.png", - "cache": false, - "maskRange": [ - 1, - 255 - ], - "templThreshold": 0.95 - }, - "InfrastControlCenter": { - "template": "ControlCenter.png", - "cache": false, - "maskRange": [ - 1, - 255 - ], - "templThreshold": 0.95 - }, - "InfrastControlCenterMini": { - "template": "ControlCenterMini.png", - "cache": false, - "maskRange": [ - 1, - 255 - ], - "templThreshold": 0.95 - }, - "InfrastStationedInfo": { - "algorithm": "OcrDetect", - "cache": false, - "text": [ - "进驻信息" - ], - "roi": [ - 0, - 0, - 150, - 720 - ], - "rearDelay": 1000 - }, - "InfrastEnterOperList": { - "algorithm": "OcrDetect", - "cache": false, - "text": [ - "心情", - "休息中", - "工作中", - "进驻" - ], - "roi": [ - 800, - 0, - 480, - 650 - ], - "rearDelay": 1000 - }, - "InfrastClearButton": { - "algorithm": "justReturn", - "action": "clickRect", - "specificRect": [ - 430, - 655, - 150, - 40 - ], - "rearDelay": 1000 - }, - "InfrastConfirmButton": { - "action": "clickRect", - "specificRect": [ - 1105, - 655, - 150, - 40 - ], - "rearDelay": 500, - "Doc": "这个任务复用了,上半部分用来检测确认按钮点击成功没;下部部分用来点击", - "algorithm": "ocrDetect", - "cache": false, - "text": [ - "正在提交", - "反馈至神经" - ], - "roi": [ - 700, - 640, - 300, - 80 - ] - }, - "InfrastBottomLeftTab": { - "algorithm": "justReturn", - "action": "clickRect", - "specificRect": [ - 0, - 540, - 520, - 180 - ], - "rearDelay": 1000 - }, - "InfrastDormConfirmButton": { - "template": "DormConfirm.png", - "action": "clickSelf", - "cache": false, - "rearDelay": 1000 - }, - "InfrastEnterFacility": { - "algorithm": "justReturn", - "rearDelay": 2000 - }, - "InfrastFacilityListTabMfg": { - "template": "FacilityListTabMfg.png", - "cache": false, - "roi": [ - 0, - 0, - 250, - 720 - ], - "rearDelay": 1000 - }, - "InfrastFacilityListTabTrade": { - "template": "FacilityListTabTrade.png", - "cache": false, - "roi": [ - 0, - 0, - 250, - 720 - ], - "rearDelay": 1000 - }, - "InfrastFlagCombatRecord": { - "template": "InfrastMfgDogFoodFlag.png", - "cache": false, - "roi": [ - 1000, - 0, - 280, - 720 - ] - }, - "InfrastFlagPureGold": { - "template": "InfrastMfgPureGoldFlag.png", - "cache": false, - "roi": [ - 1000, - 0, - 280, - 720 - ] - }, - "InfrastFlagMoney": { - "template": "InfrastTradeMoneyFlag.png", - "cache": false, - "roi": [ - 900, - 500, - 380, - 220 - ] - }, - "InfrastAddOperatorMfgGentle": { - "template": "AddOperatorMfgGentle.png", - "cache": false, - "roi": [ - 200, - 500, - 500, - 220 - ], - "rearDelay": 1000 - }, - "InfrastAddOperatorMfgAggressive": { - "template": "AddOperatorMfgAggressive.png", - "cache": false, - "roi": [ - 200, - 500, - 500, - 100 - ], - "rectMove": [ - 5, - 50, - 80, - 80 - ], - "rearDelay": 1000 - }, - "InfrastAddOperatorTradeGentle": { - "template": "AddOperatorTradeGentle.png", - "cache": false, - "roi": [ - 200, - 500, - 500, - 220 - ], - "rearDelay": 1000 - }, - "InfrastAddOperatorTradeAggressive": { - "template": "AddOperatorTradeAggressive.png", - "cache": false, - "roi": [ - 200, - 500, - 500, - 100 - ], - "rectMove": [ - 5, - 50, - 80, - 80 - ], - "rearDelay": 1000 - }, - "InfrastAddOperatorReceptionGentle": { - "template": "AddOperatorReceptionGentle.png", - "cache": false, - "roi": [ - 0, - 0, - 300, - 720 - ], - "rearDelay": 1000 - }, - "InfrastAddOperatorReceptionAggressive": { - "algorithm": "justReturn", - "action": "clickRect", - "specificRect": [ - 30, - 200, - 200, - 300 - ], - "rearDelay": 1000 - }, - "InfrastOperSelected": { - "template": "empty.png", - "cache": false, - "templThreshold": 8000, - "templThreshold_Doc": "这个任务中作为符合range的像素点数量阈值", - "maskRange": [ - 95, - 105 - ], - "rectMove": [ - 0, - -230, - 74, - 283 - ] - }, - "InfrastOperOnShift": { - "template": "OnShift.png", - "cache": false, - "templThreshold": 0.8, - "rectMove": [ - 0, - -95, - 70, - 50 - ] - }, - "InfrastClueVacancyNo1": { - "template": "ClueVacancyNo1.png", - "cache": false, - "templThreshold": 0.75, - "roi": [ - 0, - 100, - 500, - 250 - ], - "rearDelay": 1000 - }, - "InfrastClueVacancyNo2": { - "template": "ClueVacancyNo2.png", - "cache": false, - "templThreshold": 0.75, - "roi": [ - 200, - 200, - 500, - 250 - ], - "rearDelay": 1000 - }, - "InfrastClueVacancyNo3": { - "template": "ClueVacancyNo3.png", - "cache": false, - "templThreshold": 0.75, - "roi": [ - 400, - 100, - 500, - 250 - ], - "rearDelay": 1000 - }, - "InfrastClueVacancyNo4": { - "template": "ClueVacancyNo4.png", - "cache": false, - "templThreshold": 0.75, - "roi": [ - 650, - 150, - 500, - 250 - ], - "rearDelay": 1000 - }, - "InfrastClueVacancyNo5": { - "template": "ClueVacancyNo5.png", - "cache": false, - "templThreshold": 0.75, - "roi": [ - 300, - 420, - 500, - 250 - ], - "rearDelay": 1000 - }, - "InfrastClueVacancyNo6": { - "template": "ClueVacancyNo6.png", - "cache": false, - "templThreshold": 0.75, - "roi": [ - 500, - 350, - 500, - 250 - ], - "rearDelay": 1000 - }, - "InfrastClueVacancyNo7": { - "template": "ClueVacancyNo7.png", - "cache": false, - "templThreshold": 0.75, - "roi": [ - 50, - 350, - 500, - 250 - ], - "rearDelay": 1000 - }, - "InfrastClue": { - "template": "Clue.png", - "cache": false, - "maskRange": [ - 1, - 255 - ], - "roi": [ - 800, - 0, - 480, - 720 - ] - }, - "InfrastClueOnTheRightSwipeBegin": { - "algorithm": "justReturn", - "action": "clickRect", - "specificRect": [ - 900, - 600, - 300, - 100 - ], - "preDelay": 500, - "rearDelay": 500, - "maxTimes": 1, - "Doc": "这里的preDelay作为滑动duration使用,rearDelay作为滑动额外延时使用,maxTimes作为重复次数使用" - }, - "InfrastClueOnTheRightSwipeEnd": { - "algorithm": "justReturn", - "action": "clickRect", - "specificRect": [ - 900, - 200, - 300, - 100 - ] - }, - "InfrastClueNew": { - "template": "ClueNew.png", - "action": "clickSelf", - "roi": [ - 1000, - 0, - 280, - 720 - ], - "cache": false, - "rectMove": [ - -45, - 15, - 60, - 60 - ], - "next": [ - "GetClue1", - "GetClue2" - ] - }, - "GetClue1": { - "template": "GetClue1.png", - "action": "clickSelf", - "cache": false, - "next": [ - "InfrastClueNew", - "CloseCluePage" - ], - "rearDelay": 2000 - }, - "GetClue2": { - "template": "GetClue2.png", - "action": "clickSelf", - "cache": false, - "next": [ - "InfrastClueNew" - ], - "rearDelay": 2000 - }, - "CloseCluePage": { - "template": "CloseCluePage.png", - "action": "clickSelf", - "cache": false, - "next": [ - "InfrastClueNew" - ], - "rearDelay": 1000 - }, - "UnlockClues": { - "template": "UnlockClues.png", - "action": "clickSelf", - "cache": false, - "rearDelay": 5000 - } + "SanityBegin": { + "algorithm": "justreturn", + "action": "doNothing", + "next": [ + "UsePrts", + "StartButton1", + "StartButton2", + "PRTS", + "UseMedicine", + "UseStone", + "EndOfAction", + "PrtsErrorConfirm", + "OfflineConfirm", + "StartToWakeUp", + "TodaysSupplies", + "CloseAnno", + "Terminal", + "LastBattle" + ] + }, + "UsePrts": { + "templThreshold": 0.9, + "action": "clickSelf", + "next": [ + "StartButton1" + ] + }, + "StartButton1": { + "algorithm": "OcrDetect", + "text": [ + "开始行动" + ], + "roi": [ + 800, + 400, + 480, + 320 + ], + "action": "clickSelf", + "next": [ + "StartButton2", + "UseMedicine", + "UseStone" + ] + }, + "StartButton2": { + "action": "clickSelf", + "rearDelay": 20000, + "templThreshold": 0.95, + "next": [ + "PRTS", + "StartButton2", + "OfflineConfirm" + ] + }, + "PRTS": { + "algorithm": "OcrDetect", + "text": [ + "剩余可放置角色", + "接管作战" + ], + "roi": [ + 0, + 530, + 1279, + 189 + ], + "action": "doNothing", + "rearDelay": 5000, + "next": [ + "PRTS", + "PrtsErrorConfirm", + "EndOfAction", + "OfflineConfirm", + "WaitAfterPRTS" + ] + }, + "WaitAfterPRTS": { + "rearDelay": 3000, + "algorithm": "justreturn", + "action": "doNothing", + "next": [ + "PRTS", + "EndOfAction", + "ClickCornerAfterPRTS" + ] + }, + "ClickCornerAfterPRTS": { + "ClickCorner_Doc": "点击屏幕右边,不会点到掉落物品,且不会关掉关卡选择的一块区域", + "algorithm": "justreturn", + "action": "clickRect", + "specificRect": [ + 1000, + 1, + 270, + 340 + ], + "next": [ + "EndOfAction", + "StartButton1", + "StartButton2", + "UseMedicine", + "UseStone", + "ClickCornerAfterPRTS" + ] + }, + "EndOfAction": { + "algorithm": "OcrDetect", + "text": [ + "行动结束" + ], + "preDelay": 5000, + "action": "stageDrops", + "action_Doc": "为“行动结束”特化的action,包含截图、识别关卡掉落等功能", + "next": [ + "ClickCorner" + ] + }, + "ClickCorner": { + "ClickCorner_Doc": "点击屏幕右边,不会点到掉落物品,且不会关掉关卡选择的一块区域", + "algorithm": "justreturn", + "action": "clickRect", + "rearDelay": 2000, + "specificRect": [ + 1000, + 1, + 270, + 340 + ], + "next": [ + "StartButton1", + "StartButton2", + "UseMedicine", + "UseStone", + "EndOfAction" + ] + }, + "UseMedicine": { + "action": "doNothing", + "next": [ + "MedicineConfirm" + ] + }, + "MedicineConfirm": { + "action": "clickSelf", + "maxTimes": 0, + "reduceOtherTimes": [ + "StartButton1" + ], + "next": [ + "StartButton1" + ] + }, + "UseStone": { + "action": "doNothing", + "next": [ + "StoneConfirm" + ] + }, + "StoneConfirm": { + "template": "MedicineConfirm.png", + "action": "clickSelf", + "maxTimes": 0, + "reduceOtherTimes": [ + "StartButton1" + ], + "next": [ + "StartButton1" + ] + }, + "PrtsErrorConfirm": { + "templThreshold": 0.8, + "cache": false, + "action": "doNothing", + "next": [ + "AbandonAction", + "OfflineConfirmAfterBattle" + ] + }, + "AbandonAction": { + "action": "clickSelf", + "cache": false, + "reduceOtherTimes": [ + "StartButton1", + "StartButton2" + ], + "next": [ + "EndOfAction", + "StartToWakeUp", + "OfflineConfirm" + ] + }, + "OfflineConfirmAfterBattle": { + "template": "PopupConfirm.png", + "action": "clickSelf", + "cache": false, + "next": [ + "PRTS", + "PrtsErrorConfirm", + "OfflineConfirm", + "StartToWakeUp" + ] + }, + "OfflineConfirm": { + "action": "clickSelf", + "cache": false, + "reduceOtherTimes": [ + "StartButton1", + "StartButton2" + ], + "next": [ + "CloseAnno", + "StartToWakeUp", + "OfflineConfirm" + ] + }, + "StartToWakeUp": { + "action": "clickSelf", + "cache": false, + "next": [ + "Terminal", + "CloseAnno", + "OfflineConfirm", + "TodaysSupplies" + ] + }, + "CloseAnno": { + "action": "clickSelf", + "cache": false, + "next": [ + "Terminal", + "CloseAnno", + "TodaysSupplies" + ] + }, + "Terminal": { + "cache": false, + "action": "clickSelf", + "next": [ + "LastBattle", + "CloseAnno", + "TodaysSupplies" + ] + }, + "TodaysSupplies": { + "algorithm": "OcrDetect", + "cache": false, + "text": [ + "今日配给" + ], + "action": "clickRect", + "specificRect": [ + 1000, + 1, + 270, + 340 + ], + "next": [ + "CloseAnno", + "Terminal" + ] + }, + "LastBattle": { + "algorithm": "OcrDetect", + "cache": false, + "text": [ + "上一次作战", + "前往上一次" + ], + "action": "clickSelf", + "next": [ + "StartButton1" + ] + }, + "VisitBegin": { + "algorithm": "justreturn", + "action": "doNothing", + "next": [ + "Friends", + "FriendsList", + "StartToVisit", + "VisitNext", + "VisitNextBlack", + "ReturnToFriends" + ] + }, + "ReturnToFriends": { + "template": "Return.png", + "templThreshold": 0.85, + "histThreshold": 0.85, + "rearDelay": 1000, + "action": "clickSelf", + "next": [ + "Friends", + "ReturnToFriends" + ] + }, + "Friends": { + "templThreshold": 0.85, + "action": "clickSelf", + "next": [ + "FriendsList", + "Friends" + ] + }, + "FriendsList": { + "action": "clickSelf", + "next": [ + "StartToVisit", + "NoFriends" + ] + }, + "NoFriends": { + "action": "doNothing", + "next": [ + "ReturnToMall" + ] + }, + "StartToVisit": { + "templThreshold": 0.8, + "action": "clickSelf", + "rearDelay": 3000, + "next": [ + "VisitNext", + "VisitNextBlack", + "VisitNextOcr" + ] + }, + "VisitNext": { + "action": "clickSelf", + "cache": false, + "rearDelay": 2000, + "roi": [ + 1080, + 570, + 195, + 130 + ], + "exceededNext": [ + "ReturnToMall" + ], + "next": [ + "VisitLimited", + "VisitNext", + "VisitNextBlack", + "VisitNextOcr" + ] + }, + "VisitNextOcr": { + "algorithm": "OcrDetect", + "text": [ + "访问下位" + ], + "action": "clickSelf", + "rearDelay": 2000, + "roi": [ + 1080, + 570, + 195, + 130 + ], + "exceededNext": [ + "ReturnToMall" + ], + "next": [ + "VisitLimited", + "VisitNext", + "VisitNextBlack", + "VisitNextOcr" + ] + }, + "ReturnToMall": { + "rearDelay": 1000, + "template": "Return.png", + "templThreshold": 0.85, + "histThreshold": 0.85, + "action": "clickSelf", + "next": [ + "Mall", + "ReturnToMallConfirm", + "ReturnToMall" + ] + }, + "ReturnToMallConfirm": { + "template": "PopupConfirm.png", + "action": "clickSelf", + "rearDelay": 3000, + "next": [ + "ReturnToMall" + ] + }, + "Mall": { + "action": "clickSelf", + "next": [ + "CreditStore", + "CreditStoreOcr" + ] + }, + "CreditStore": { + "templThreshold": 0.85, + "rearDelay": 1000, + "action": "clickSelf", + "next": [ + "CollectCredit", + "Stop" + ] + }, + "CreditStoreOcr": { + "algorithm": "OcrDetect", + "text": [ + "信用交易所" + ], + "roi": [ + 1000, + 0, + 280, + 300 + ], + "rearDelay": 1000, + "action": "clickSelf", + "next": [ + "CollectCredit", + "Stop" + ] + }, + "CollectCredit": { + "action": "clickSelf", + "rearDelay": 2000, + "next": [ + "CloseCollectCredit" + ] + }, + "CloseCollectCredit": { + "algorithm": "justReturn", + "action": "clickRect", + "specificRect": [ + 1000, + 1, + 270, + 340 + ], + "next": [ + "Stop" + ] + }, + "VisitLimited": { + "algorithm": "OcrDetect", + "text": [ + "今日参与", + "已达上限" + ], + "action": "doNothing", + "roi": [ + 900, + 50, + 375, + 140 + ], + "next": [ + "ReturnToMall" + ] + }, + "VisitNextBlack": { + "action": "doNothing", + "roi": [ + 1080, + 570, + 195, + 130 + ], + "next": [ + "ReturnToMall" + ] + }, + "CreditShop-Commoditys": { + "template": "CreditPoint.png", + "rectMove": [ + -60, + -180, + 220, + 220 + ] + }, + "CreditShop-SoldOut": { + "template": "SoldOut.png" + }, + "CreditShop-BuyIt": { + "template": "BuyIt.png", + "preDelay": 1000, + "rearDelay": 1000 + }, + "CreditShop-NoMoney": { + "algorithm": "OcrDetect", + "text": [ + "信用不足", + "无法购买" + ], + "roi": [ + 940, + 60, + 339, + 110 + ] + }, + "CreditShop-NotToBuy": { + "algorithm": "OcrDetect", + "Doc": "这里的text,是子串搜索,即商品名中只要含有任一text,就不买", + "text": [ + "碳", + "家具" + ], + "roi": [ + 0, + -30, + 220, + 70 + ] + }, + "Stop": { + "algorithm": "justreturn", + "action": "stop", + "next": [] + }, + "RecruitTime": { + "template": "RecruitTimeReduce.png", + "templThreshold": 0.89, + "action": "clickSelf", + "rectMove": [ + 7, + 94, + 129, + 44 + ] + }, + "RecruitTags": { + "algorithm": "OcrDetect", + "text": [], + "roi": [ + 200, + 200, + 800, + 500 + ], + "ocrReplace": [ + [ + "沮击", + "狙击" + ], + [ + "犯击", + "狙击" + ], + [ + "泪击", + "狙击" + ], + [ + "都出", + "输出" + ], + [ + "都乐", + "输出" + ], + [ + "抓出", + "输出" + ], + [ + "都任", + "输出" + ], + [ + "新于", + "新手" + ], + [ + "防拍", + "防护" + ] + ] + }, + "OperatorBegin": { + "algorithm": "justreturn", + "action": "doNothing", + "next": [ + "EnterOperator", + "ReturnToOperator" + ] + }, + "EnterOperator": { + "rearDelay": 1000, + "templThreshold": 0.7, + "action": "clickSelf", + "next": [ + "Stop" + ] + }, + "ReturnToOperator": { + "template": "Return.png", + "templThreshold": 0.85, + "histThreshold": 0.85, + "rearDelay": 1000, + "action": "clickSelf", + "next": [ + "EnterOperator", + "ReturnToOperator" + ] + }, + "InfrastBegin": { + "algorithm": "justreturn", + "action": "doNothing", + "next": [ + "EnterInfrast", + "InfrastEnteredFlag", + "InfrastNotification", + "ReturnToInfrast" + ] + }, + "ReturnToInfrast": { + "template": "Return.png", + "templThreshold": 0.85, + "histThreshold": 0.85, + "rearDelay": 1000, + "action": "clickSelf", + "next": [ + "EnterInfrast", + "InfrastNotification", + "InfrastEnteredFlag", + "ReturnToInfrast" + ] + }, + "Return": { + "algorithm": "justReturn", + "action": "clickRect", + "specificRect": [ + 20, + 20, + 135, + 35 + ], + "rearDelay": 1000 + }, + "EnterInfrast": { + "templThreshold": 0.85, + "histThreshold": 0.85, + "rearDelay": 3000, + "action": "clickSelf", + "next": [ + "InfrastEnteredFlag" + ] + }, + "InfrastEnteredFlag": { + "template": "InfrastOverview.png", + "templThreshold": 0.8, + "action": "doNothing", + "next": [ + "InfrastNotification", + "InfrastSwipeToTheLeft" + ] + }, + "InfrastSwipeToTheLeft": { + "algorithm": "justReturn", + "action": "swipeToTheLeft", + "next": [ + "Stop" + ] + }, + "Trade": { + "templThreshold": 0.8, + "cache": false, + "action": "clickSelf", + "rearDelay": 1000, + "next": [ + "ManufacturingLeftBottom" + ] + }, + "TradeMini": { + "templThreshold": 0.8, + "cache": false, + "action": "clickSelf", + "rearDelay": 1000, + "next": [ + "ManufacturingLeftBottom" + ] + }, + "Manufacturing": { + "templThreshold": 0.8, + "cache": false, + "action": "clickSelf", + "rearDelay": 1000, + "next": [ + "ManufacturingLeftBottom" + ] + }, + "ManufacturingMini": { + "templThreshold": 0.8, + "cache": false, + "action": "clickSelf", + "rearDelay": 1000, + "next": [ + "ManufacturingLeftBottom" + ] + }, + "ManufacturingLeftBottom": { + "Doc": "制造站点进去之后,左下角那个“中级作战记录 制造中”", + "algorithm": "justreturn", + "action": "clickRect", + "specificRect": [ + 1, + 535, + 525, + 180 + ], + "next": [ + "Manufacturing1st" + ] + }, + "Manufacturing1st": { + "Doc": "设施列表里第一个(第一个制造站或者贸易站)", + "algorithm": "justreturn", + "action": "clickRect", + "specificRect": [ + 1, + 183, + 220, + 60 + ], + "next": [ + "Stop" + ] + }, + "InfrastNotification": { + "templThreshold": 0.8, + "action": "clickSelf", + "next": [ + "InfrastReward", + "InfrastExitReward" + ] + }, + "InfrastReward": { + "algorithm": "OcrDetect", + "text": [ + "可收获", + "订单交付", + "信赖" + ], + "rearDelay": 1000, + "action": "clickSelf", + "roi": [ + 0, + 600, + 800, + 118 + ], + "cache": false, + "next": [ + "InfrastReward", + "InfrastExitReward" + ] + }, + "InfrastExitReward": { + "Doc": "干员疲劳、线索收集 是不能一键收获的,所以要先退出一键收获的界面,这里点击的是控制中枢左侧那一片空白的区域", + "algorithm": "justreturn", + "action": "clickRect", + "specificRect": [ + 250, + 100, + 380, + 140 + ], + "next": [ + "Stop" + ] + }, + "DroneAssist-MFG": { + "action": "clickSelf", + "cache": false, + "maxTimes": 1, + "Doc": "不同于贸易站,制造站的无人机是一次性全用掉的,所以只执行一次就够了", + "next": [ + "DroneMax", + "DroneConfirm" + ] + }, + "DroneAssist-Trade": { + "action": "clickSelf", + "cache": false, + "next": [ + "DroneMax", + "DroneConfirm" + ] + }, + "DroneMax": { + "action": "clickSelf", + "next": [ + "DroneConfirm" + ] + }, + "DroneConfirm": { + "action": "clickSelf", + "rearDelay": 3000, + "templThreshold": 0.8, + "next": [ + "DeliverableOrder", + "DroneAssist-Trade-Stop", + "DroneAssist-MFG" + ] + }, + "DeliverableOrder": { + "cache": false, + "action": "clickSelf", + "next": [ + "DeliverableOrder", + "DroneAssist-Trade" + ] + }, + "DroneAssist-Trade-Stop": { + "Doc": "如果找到了“无人机加速”按钮,却没有找到订单交付:说明上一次无人机没有把一个订单加速完成,也说明没有更多的无人机了,所以直接stop", + "template": "DroneAssist-Trade.png", + "action": "stop", + "cache": false + }, + "InfrastSkillsUpper": { + "algorithm": "justReturn", + "roi": [ + 400, + 280, + 880, + 80 + ] + }, + "InfrastSkillsLower": { + "algorithm": "justReturn", + "roi": [ + 400, + 560, + 880, + 80 + ] + }, + "InfrastSkillsHash": { + "algorithm": "justReturn", + "rectMove_Doc": "基于笑脸的位置移动", + "rectMove": [ + 0, + -202, + 74, + 100 + ] + }, + "InfrastSmileyOnRest": { + "template": "SmileyOnRest.png", + "maskRange": [ + 100, + 255 + ], + "cache": false, + "templThreshold": 0.8 + }, + "InfrastSmileyOnWork": { + "template": "SmileyOnWork.png", + "maskRange": [ + 100, + 255 + ], + "cache": false, + "templThreshold": 0.8 + }, + "InfrastSmileyOnDistract": { + "template": "SmileyOnDistract.png", + "maskRange": [ + 100, + 255 + ], + "cache": false, + "templThreshold": 0.8 + }, + "InfrastSkills": { + "template": "empty.png", + "templThreshold": 0.9, + "histThreshold": 100, + "histThreshold_Doc": "该任务里的Hist阈值,是特化了拿来做灰度图平均值的,懒得重新写个字段了", + "cache": false, + "rectMove_Doc": "基于笑脸的位置移动", + "rectMove": [ + -8, + -42, + 82, + 40 + ], + "maskRange": [ + 1, + 255 + ] + }, + "InfrastOperListSwipeBegin": { + "algorithm": "justReturn", + "action": "clickRect", + "specificRect": [ + 1080, + 200, + 100, + 300 + ], + "preDelay": 1000, + "rearDelay": 300, + "Doc": "这里的preDelay作为滑动duration使用,rearDelay作为滑动额外延时使用" + }, + "InfrastOperListSwipeEnd": { + "algorithm": "justReturn", + "action": "clickRect", + "specificRect": [ + 700, + 200, + 100, + 300 + ] + }, + "InfrastOperListSwipeToTheLeftBegin": { + "algorithm": "justReturn", + "action": "clickRect", + "specificRect": [ + 1080, + 200, + 200, + 300 + ], + "preDelay": 100, + "rearDelay": 2000, + "maxTimes": 2, + "Doc": "这里的preDelay作为滑动duration使用,rearDelay作为滑动额外延时使用,maxTimes作为重复次数使用" + }, + "InfrastOperListSwipeToTheLeftEnd": { + "algorithm": "justReturn", + "action": "clickRect", + "specificRect": [ + 400, + 200, + 200, + 300 + ] + }, + "InfrastOperMoodProgressBar": { + "template": "empty.png", + "templThreshold": 160, + "histThreshold": 20, + "Doc": "这里的templThreshold,作为进度条最小灰度阈值使用;histThreshold作为进度条相邻点最大变化阈值使用。懒得重新弄个字段了", + "cache": false, + "rectMove_Doc": "基于笑脸的位置移动", + "rectMove": [ + 21, + 8, + 85, + 4 + ] + }, + "InfrastMfg": { + "template": "Manufacturing.png", + "cache": false, + "maskRange": [ + 1, + 255 + ] + }, + "InfrastMfgMini": { + "template": "ManufacturingMini.png", + "cache": false, + "maskRange": [ + 1, + 255 + ] + }, + "InfrastTrade": { + "template": "Trade.png", + "cache": false, + "maskRange": [ + 1, + 255 + ] + }, + "InfrastTradeMini": { + "template": "TradeMini.png", + "cache": false, + "maskRange": [ + 1, + 255 + ] + }, + "InfrastPower": { + "template": "Power.png", + "cache": false, + "maskRange": [ + 1, + 255 + ], + "templThreshold": 0.95 + }, + "InfrastPowerMini": { + "template": "PowerMini.png", + "cache": false, + "maskRange": [ + 1, + 255 + ], + "templThreshold": 0.95 + }, + "InfrastDorm": { + "template": "Dorm.png", + "cache": false, + "maskRange": [ + 1, + 255 + ], + "templThreshold": 0.95 + }, + "InfrastDormMini": { + "template": "DormMini.png", + "cache": false, + "maskRange": [ + 1, + 255 + ], + "templThreshold": 0.95 + }, + "InfrastOffice": { + "template": "Office.png", + "cache": false, + "maskRange": [ + 1, + 255 + ], + "templThreshold": 0.95 + }, + "InfrastOfficeMini": { + "template": "OfficeMini.png", + "cache": false, + "maskRange": [ + 1, + 255 + ], + "templThreshold": 0.95 + }, + "InfrastReception": { + "template": "Reception.png", + "cache": false, + "maskRange": [ + 1, + 255 + ], + "templThreshold": 0.95 + }, + "InfrastReceptionMini": { + "template": "ReceptionMini.png", + "cache": false, + "maskRange": [ + 1, + 255 + ], + "templThreshold": 0.95 + }, + "InfrastControlCenter": { + "template": "ControlCenter.png", + "cache": false, + "maskRange": [ + 1, + 255 + ], + "templThreshold": 0.95 + }, + "InfrastControlCenterMini": { + "template": "ControlCenterMini.png", + "cache": false, + "maskRange": [ + 1, + 255 + ], + "templThreshold": 0.95 + }, + "InfrastStationedInfo": { + "algorithm": "OcrDetect", + "cache": false, + "text": [ + "进驻信息" + ], + "roi": [ + 0, + 0, + 150, + 720 + ], + "rearDelay": 1000 + }, + "InfrastEnterOperList": { + "algorithm": "OcrDetect", + "cache": false, + "text": [ + "心情", + "休息中", + "工作中", + "进驻" + ], + "roi": [ + 800, + 0, + 480, + 650 + ], + "rearDelay": 1000 + }, + "InfrastClearButton": { + "algorithm": "justReturn", + "action": "clickRect", + "specificRect": [ + 430, + 655, + 150, + 40 + ], + "rearDelay": 1000 + }, + "InfrastConfirmButton": { + "action": "clickRect", + "specificRect": [ + 1105, + 655, + 150, + 40 + ], + "rearDelay": 500, + "Doc": "这个任务复用了,上半部分用来检测确认按钮点击成功没;下部部分用来点击", + "algorithm": "ocrDetect", + "cache": false, + "text": [ + "正在提交", + "反馈至神经" + ], + "roi": [ + 700, + 640, + 300, + 80 + ] + }, + "InfrastBottomLeftTab": { + "algorithm": "justReturn", + "action": "clickRect", + "specificRect": [ + 0, + 540, + 520, + 180 + ], + "rearDelay": 1000 + }, + "InfrastDormConfirmButton": { + "template": "DormConfirm.png", + "action": "clickSelf", + "cache": false, + "rearDelay": 1000 + }, + "InfrastEnterFacility": { + "algorithm": "justReturn", + "rearDelay": 2000 + }, + "InfrastFacilityListTabMfg": { + "template": "FacilityListTabMfg.png", + "cache": false, + "roi": [ + 0, + 0, + 250, + 720 + ], + "rearDelay": 1000 + }, + "InfrastFacilityListTabTrade": { + "template": "FacilityListTabTrade.png", + "cache": false, + "roi": [ + 0, + 0, + 250, + 720 + ], + "rearDelay": 1000 + }, + "InfrastFlagCombatRecord": { + "template": "InfrastMfgDogFoodFlag.png", + "cache": false, + "roi": [ + 1000, + 0, + 280, + 720 + ] + }, + "InfrastFlagPureGold": { + "template": "InfrastMfgPureGoldFlag.png", + "cache": false, + "roi": [ + 1000, + 0, + 280, + 720 + ] + }, + "InfrastFlagMoney": { + "template": "InfrastTradeMoneyFlag.png", + "cache": false, + "roi": [ + 900, + 500, + 380, + 220 + ] + }, + "InfrastAddOperatorMfgGentle": { + "template": "AddOperatorMfgGentle.png", + "cache": false, + "roi": [ + 200, + 500, + 500, + 220 + ], + "rearDelay": 1000 + }, + "InfrastAddOperatorMfgAggressive": { + "template": "AddOperatorMfgAggressive.png", + "cache": false, + "roi": [ + 200, + 500, + 500, + 100 + ], + "rectMove": [ + 5, + 50, + 80, + 80 + ], + "rearDelay": 1000 + }, + "InfrastAddOperatorTradeGentle": { + "template": "AddOperatorTradeGentle.png", + "cache": false, + "roi": [ + 200, + 500, + 500, + 220 + ], + "rearDelay": 1000 + }, + "InfrastAddOperatorTradeAggressive": { + "template": "AddOperatorTradeAggressive.png", + "cache": false, + "roi": [ + 200, + 500, + 500, + 100 + ], + "rectMove": [ + 5, + 50, + 80, + 80 + ], + "rearDelay": 1000 + }, + "InfrastAddOperatorReceptionGentle": { + "template": "AddOperatorReceptionGentle.png", + "cache": false, + "roi": [ + 0, + 0, + 300, + 720 + ], + "rearDelay": 1000 + }, + "InfrastAddOperatorReceptionAggressive": { + "algorithm": "justReturn", + "action": "clickRect", + "specificRect": [ + 30, + 200, + 200, + 300 + ], + "rearDelay": 1000 + }, + "InfrastOperSelected": { + "template": "empty.png", + "cache": false, + "templThreshold": 8000, + "templThreshold_Doc": "这个任务中作为符合range的像素点数量阈值", + "maskRange": [ + 95, + 105 + ], + "rectMove": [ + 0, + -230, + 74, + 283 + ] + }, + "InfrastOperOnShift": { + "template": "OnShift.png", + "cache": false, + "templThreshold": 0.8, + "rectMove": [ + 0, + -95, + 70, + 50 + ] + }, + "InfrastClueVacancyNo1": { + "template": "ClueVacancyNo1.png", + "cache": false, + "templThreshold": 0.75, + "roi": [ + 0, + 100, + 500, + 250 + ], + "rearDelay": 1000 + }, + "InfrastClueVacancyNo2": { + "template": "ClueVacancyNo2.png", + "cache": false, + "templThreshold": 0.75, + "roi": [ + 200, + 200, + 500, + 250 + ], + "rearDelay": 1000 + }, + "InfrastClueVacancyNo3": { + "template": "ClueVacancyNo3.png", + "cache": false, + "templThreshold": 0.75, + "roi": [ + 400, + 100, + 500, + 250 + ], + "rearDelay": 1000 + }, + "InfrastClueVacancyNo4": { + "template": "ClueVacancyNo4.png", + "cache": false, + "templThreshold": 0.75, + "roi": [ + 650, + 150, + 500, + 250 + ], + "rearDelay": 1000 + }, + "InfrastClueVacancyNo5": { + "template": "ClueVacancyNo5.png", + "cache": false, + "templThreshold": 0.75, + "roi": [ + 300, + 420, + 500, + 250 + ], + "rearDelay": 1000 + }, + "InfrastClueVacancyNo6": { + "template": "ClueVacancyNo6.png", + "cache": false, + "templThreshold": 0.75, + "roi": [ + 500, + 350, + 500, + 250 + ], + "rearDelay": 1000 + }, + "InfrastClueVacancyNo7": { + "template": "ClueVacancyNo7.png", + "cache": false, + "templThreshold": 0.75, + "roi": [ + 50, + 350, + 500, + 250 + ], + "rearDelay": 1000 + }, + "InfrastClue": { + "template": "Clue.png", + "cache": false, + "maskRange": [ + 1, + 255 + ], + "roi": [ + 800, + 0, + 480, + 720 + ] + }, + "InfrastClueOnTheRightSwipeBegin": { + "algorithm": "justReturn", + "action": "clickRect", + "specificRect": [ + 900, + 600, + 300, + 100 + ], + "preDelay": 500, + "rearDelay": 500, + "maxTimes": 1, + "Doc": "这里的preDelay作为滑动duration使用,rearDelay作为滑动额外延时使用,maxTimes作为重复次数使用" + }, + "InfrastClueOnTheRightSwipeEnd": { + "algorithm": "justReturn", + "action": "clickRect", + "specificRect": [ + 900, + 200, + 300, + 100 + ] + }, + "InfrastClueNew": { + "template": "ClueNew.png", + "action": "clickSelf", + "roi": [ + 1000, + 0, + 280, + 720 + ], + "cache": false, + "rectMove": [ + -45, + 15, + 60, + 60 + ], + "next": [ + "GetClue1", + "GetClue2" + ] + }, + "GetClue1": { + "template": "GetClue1.png", + "action": "clickSelf", + "cache": false, + "next": [ + "InfrastClueNew", + "CloseCluePage" + ], + "rearDelay": 2000 + }, + "GetClue2": { + "template": "GetClue2.png", + "action": "clickSelf", + "cache": false, + "next": [ + "InfrastClueNew" + ], + "rearDelay": 2000 + }, + "CloseCluePage": { + "template": "CloseCluePage.png", + "action": "clickSelf", + "cache": false, + "next": [ + "InfrastClueNew" + ], + "rearDelay": 1000 + }, + "UnlockClues": { + "template": "UnlockClues.png", + "action": "clickSelf", + "cache": false, + "rearDelay": 5000 + } } \ No newline at end of file diff --git a/src/MeoAssistance/AbstractConfiger.cpp b/src/MeoAssistance/AbstractConfiger.cpp index 44643a38ff..bad9bb4391 100644 --- a/src/MeoAssistance/AbstractConfiger.cpp +++ b/src/MeoAssistance/AbstractConfiger.cpp @@ -1,4 +1,4 @@ -#include "AbstractConfiger.h" +#include "AbstractConfiger.h" #include @@ -24,4 +24,4 @@ bool asst::AbstractConfiger::load(const std::string& filename) return false; } return true; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/AbstractConfiger.h b/src/MeoAssistance/AbstractConfiger.h index ef8903b241..c3e7a4cb00 100644 --- a/src/MeoAssistance/AbstractConfiger.h +++ b/src/MeoAssistance/AbstractConfiger.h @@ -1,19 +1,22 @@ -#pragma once +#pragma once #include "AbstractResource.h" #include -namespace json { +namespace json +{ class value; } -namespace asst { +namespace asst +{ class AbstractConfiger : public AbstractResource { public: virtual ~AbstractConfiger() = default; virtual bool load(const std::string& filename) override; + protected: virtual bool parse(const json::value& json) = 0; }; diff --git a/src/MeoAssistance/AbstractImageAnalyzer.cpp b/src/MeoAssistance/AbstractImageAnalyzer.cpp index 8f2002bca3..7dc85203f9 100644 --- a/src/MeoAssistance/AbstractImageAnalyzer.cpp +++ b/src/MeoAssistance/AbstractImageAnalyzer.cpp @@ -1,16 +1,14 @@ -#include "AbstractImageAnalyzer.h" +#include "AbstractImageAnalyzer.h" #include "AsstUtils.hpp" asst::AbstractImageAnalyzer::AbstractImageAnalyzer(const cv::Mat& image) - : m_image(image) - , m_roi(empty_rect_to_full(Rect(), image)) + : m_image(image), m_roi(empty_rect_to_full(Rect(), image)) #ifdef LOG_TRACE , m_image_draw(image.clone()) #endif -{ -} +{} asst::AbstractImageAnalyzer::AbstractImageAnalyzer(const cv::Mat& image, const Rect& roi) : m_image(image), @@ -73,4 +71,4 @@ std::string asst::AbstractImageAnalyzer::calc_hash(const Rect& roi) const pix++; } return hash_value.str(); -} \ No newline at end of file +} diff --git a/src/MeoAssistance/AbstractImageAnalyzer.h b/src/MeoAssistance/AbstractImageAnalyzer.h index 691868ff2e..165bceb5b2 100644 --- a/src/MeoAssistance/AbstractImageAnalyzer.h +++ b/src/MeoAssistance/AbstractImageAnalyzer.h @@ -1,10 +1,11 @@ -#pragma once +#pragma once #include #include "AsstDef.h" -namespace asst { +namespace asst +{ class AbstractImageAnalyzer { public: @@ -20,8 +21,8 @@ namespace asst { virtual void set_roi(const Rect& roi) noexcept; virtual bool analyze() = 0; - std::string calc_hash() const; // 使用m_roi - std::string calc_hash(const Rect& roi) const;// 使用参数roi + std::string calc_hash() const; // 使用m_roi + std::string calc_hash(const Rect& roi) const; // 使用参数roi AbstractImageAnalyzer& operator=(const AbstractImageAnalyzer&) = delete; AbstractImageAnalyzer& operator=(AbstractImageAnalyzer&&) = delete; @@ -36,4 +37,4 @@ namespace asst { cv::Mat m_image_draw; #endif }; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/AbstractResource.h b/src/MeoAssistance/AbstractResource.h index 04e67bf3a0..6c7e84e8b7 100644 --- a/src/MeoAssistance/AbstractResource.h +++ b/src/MeoAssistance/AbstractResource.h @@ -1,8 +1,9 @@ -#pragma once +#pragma once #include -namespace asst { +namespace asst +{ class AbstractResource { public: diff --git a/src/MeoAssistance/AbstractTask.cpp b/src/MeoAssistance/AbstractTask.cpp index c20d97fd1c..00fdc3fe98 100644 --- a/src/MeoAssistance/AbstractTask.cpp +++ b/src/MeoAssistance/AbstractTask.cpp @@ -1,4 +1,4 @@ -#include "AbstractTask.h" +#include "AbstractTask.h" #include #include @@ -6,8 +6,8 @@ #include -#include "Controller.h" #include "AsstUtils.hpp" +#include "Controller.h" #include "Logger.hpp" #include "Resource.h" @@ -42,7 +42,8 @@ bool AbstractTask::sleep(unsigned millisecond) while (!need_exit() && duration < millisecond) { duration = std::chrono::duration_cast( - std::chrono::system_clock::now() - start).count(); + std::chrono::system_clock::now() - start) + .count(); std::this_thread::yield(); } m_callback(AsstMsg::EndOfSleep, callback_json, m_callback_arg); @@ -81,4 +82,4 @@ void asst::AbstractTask::click_return_button() ctrler.click(ReturnButtonRect); sleep(return_task_ptr->rear_delay); -} \ No newline at end of file +} diff --git a/src/MeoAssistance/AbstractTask.h b/src/MeoAssistance/AbstractTask.h index 395d732d56..8a5257d1a6 100644 --- a/src/MeoAssistance/AbstractTask.h +++ b/src/MeoAssistance/AbstractTask.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include @@ -9,7 +9,8 @@ namespace cv class Mat; } -namespace asst { +namespace asst +{ class AbstractTask { public: @@ -26,6 +27,7 @@ namespace asst { virtual void set_task_chain(std::string name) { m_task_chain = std::move(name); } virtual const std::string& get_task_chain() { return m_task_chain; } virtual void on_run_fails(int retry_times) { ; } + protected: virtual bool sleep(unsigned millisecond); virtual bool save_image(const cv::Mat& iamge, const std::string& dir); @@ -39,4 +41,4 @@ namespace asst { std::string m_task_chain; int m_retry_times = INT_MAX; }; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/Assistance.cpp b/src/MeoAssistance/Assistance.cpp index 1e858c91da..c7cbdebd80 100644 --- a/src/MeoAssistance/Assistance.cpp +++ b/src/MeoAssistance/Assistance.cpp @@ -1,571 +1,570 @@ -#include "Assistance.h" - -#include -#include - -#include -#include - -#include "Controller.h" -#include "Logger.hpp" -#include "AsstUtils.hpp" -#include "Resource.h" - -#include "ProcessTask.h" -#include "RecruitTask.h" -#include "ScreenCaptureTask.h" -#include "CreditShoppingTask.h" -#include "InfrastDormTask.h" -#include "InfrastMfgTask.h" -#include "InfrastTradeTask.h" -#include "InfrastPowerTask.h" -#include "InfrastOfficeTask.h" -#include "InfrastInfoTask.h" -#include "InfrastReceptionTask.h" - -using namespace asst; - -Assistance::Assistance(AsstCallback callback, void* callback_arg) - : m_callback(callback), m_callback_arg(callback_arg) -{ - LogTraceFunction; - - bool resource_ret = resource.load(utils::get_resource_dir()); - if (!resource_ret) { - const std::string& error = resource.get_last_error(); - log.error("resource broken", error); - if (m_callback == nullptr) { - return; - } - json::value callback_json; - callback_json["type"] = "resource broken"; - callback_json["what"] = error; - m_callback(AsstMsg::InitFaild, callback_json, m_callback_arg); - } - - m_working_thread = std::thread(std::bind(&Assistance::working_proc, this)); - m_msg_thread = std::thread(std::bind(&Assistance::msg_proc, this)); -} - -Assistance::~Assistance() -{ - LogTraceFunction; - - m_thread_exit = true; - m_thread_idle = true; - m_condvar.notify_all(); - m_msg_condvar.notify_all(); - - if (m_working_thread.joinable()) { - m_working_thread.join(); - } - if (m_msg_thread.joinable()) { - m_msg_thread.join(); - } -} - -bool asst::Assistance::catch_default() -{ - LogTraceFunction; - - auto& opt = resource.cfg().get_options(); - switch (opt.connect_type) { - case ConnectType::Emulator: - return catch_emulator(); - case ConnectType::USB: - return catch_usb(); - case ConnectType::Remote: - return catch_remote(opt.connect_remote_address); - default: - return false; - } -} - -bool Assistance::catch_emulator(const std::string& emulator_name) -{ - LogTraceFunction; - - stop(); - - bool ret = false; - //std::string cor_name = emulator_name; - auto& cfg = resource.cfg(); - - std::unique_lock lock(m_mutex); - - // 自动匹配模拟器,逐个找 - if (emulator_name.empty()) { - for (const auto& [name, info] : cfg.get_emulators_info()) { - ret = ctrler.try_capture(info); - if (ret) { - //cor_name = name; - break; - } - } - } - else { // 指定的模拟器 - auto& info = cfg.get_emulators_info().at(emulator_name); - ret = ctrler.try_capture(info); - } - - m_inited = ret; - return ret; -} - -bool asst::Assistance::catch_usb() -{ - LogTraceFunction; - - stop(); - - bool ret = false; - auto& cfg = resource.cfg(); - - std::unique_lock lock(m_mutex); - - EmulatorInfo remote_info = cfg.get_emulators_info().at("USB"); - - ret = ctrler.try_capture(remote_info, true); - - m_inited = ret; - return ret; -} - -bool asst::Assistance::catch_remote(const std::string& address) -{ - LogTraceFunction; - - stop(); - - bool ret = false; - auto& cfg = resource.cfg(); - - std::unique_lock lock(m_mutex); - - EmulatorInfo remote_info = cfg.get_emulators_info().at("Remote"); - remote_info.adb.connect = utils::string_replace_all(remote_info.adb.connect, "[Address]", address); - remote_info.adb.click = utils::string_replace_all(remote_info.adb.click, "[Address]", address); - remote_info.adb.swipe = utils::string_replace_all(remote_info.adb.swipe, "[Address]", address); - remote_info.adb.display = utils::string_replace_all(remote_info.adb.display, "[Address]", address); - remote_info.adb.screencap = utils::string_replace_all(remote_info.adb.screencap, "[Address]", address); - - ret = ctrler.try_capture(remote_info, true); - - m_inited = ret; - return ret; +#include "Assistance.h" + +#include +#include + +#include +#include + +#include "AsstUtils.hpp" +#include "Controller.h" +#include "Logger.hpp" +#include "Resource.h" + +#include "CreditShoppingTask.h" +#include "InfrastDormTask.h" +#include "InfrastInfoTask.h" +#include "InfrastMfgTask.h" +#include "InfrastOfficeTask.h" +#include "InfrastPowerTask.h" +#include "InfrastReceptionTask.h" +#include "InfrastTradeTask.h" +#include "ProcessTask.h" +#include "RecruitTask.h" +#include "ScreenCaptureTask.h" + +using namespace asst; + +Assistance::Assistance(AsstCallback callback, void* callback_arg) + : m_callback(callback), m_callback_arg(callback_arg) +{ + LogTraceFunction; + + bool resource_ret = resource.load(utils::get_resource_dir()); + if (!resource_ret) { + const std::string& error = resource.get_last_error(); + log.error("resource broken", error); + if (m_callback == nullptr) { + return; + } + json::value callback_json; + callback_json["type"] = "resource broken"; + callback_json["what"] = error; + m_callback(AsstMsg::InitFaild, callback_json, m_callback_arg); + } + + m_working_thread = std::thread(std::bind(&Assistance::working_proc, this)); + m_msg_thread = std::thread(std::bind(&Assistance::msg_proc, this)); +} + +Assistance::~Assistance() +{ + LogTraceFunction; + + m_thread_exit = true; + m_thread_idle = true; + m_condvar.notify_all(); + m_msg_condvar.notify_all(); + + if (m_working_thread.joinable()) { + m_working_thread.join(); + } + if (m_msg_thread.joinable()) { + m_msg_thread.join(); + } +} + +bool asst::Assistance::catch_default() +{ + LogTraceFunction; + + auto& opt = resource.cfg().get_options(); + switch (opt.connect_type) { + case ConnectType::Emulator: + return catch_emulator(); + case ConnectType::USB: + return catch_usb(); + case ConnectType::Remote: + return catch_remote(opt.connect_remote_address); + default: + return false; + } +} + +bool Assistance::catch_emulator(const std::string& emulator_name) +{ + LogTraceFunction; + + stop(); + + bool ret = false; + //std::string cor_name = emulator_name; + auto& cfg = resource.cfg(); + + std::unique_lock lock(m_mutex); + + // 自动匹配模拟器,逐个找 + if (emulator_name.empty()) { + for (const auto& [name, info] : cfg.get_emulators_info()) { + ret = ctrler.try_capture(info); + if (ret) { + //cor_name = name; + break; + } + } + } + else { // 指定的模拟器 + auto& info = cfg.get_emulators_info().at(emulator_name); + ret = ctrler.try_capture(info); + } + + m_inited = ret; + return ret; +} + +bool asst::Assistance::catch_usb() +{ + LogTraceFunction; + + stop(); + + bool ret = false; + auto& cfg = resource.cfg(); + + std::unique_lock lock(m_mutex); + + EmulatorInfo remote_info = cfg.get_emulators_info().at("USB"); + + ret = ctrler.try_capture(remote_info, true); + + m_inited = ret; + return ret; +} + +bool asst::Assistance::catch_remote(const std::string& address) +{ + LogTraceFunction; + + stop(); + + bool ret = false; + auto& cfg = resource.cfg(); + + std::unique_lock lock(m_mutex); + + EmulatorInfo remote_info = cfg.get_emulators_info().at("Remote"); + remote_info.adb.connect = utils::string_replace_all(remote_info.adb.connect, "[Address]", address); + remote_info.adb.click = utils::string_replace_all(remote_info.adb.click, "[Address]", address); + remote_info.adb.swipe = utils::string_replace_all(remote_info.adb.swipe, "[Address]", address); + remote_info.adb.display = utils::string_replace_all(remote_info.adb.display, "[Address]", address); + remote_info.adb.screencap = utils::string_replace_all(remote_info.adb.screencap, "[Address]", address); + + ret = ctrler.try_capture(remote_info, true); + + m_inited = ret; + return ret; } bool asst::Assistance::catch_fake() -{ - LogTraceFunction; - +{ + LogTraceFunction; + stop(); m_inited = true; return true; -} - -bool asst::Assistance::start_sanity() -{ - return start_process_task("SanityBegin", ProcessTaskRetryTimesDefault); -} - -bool asst::Assistance::start_visit(bool with_shopping) -{ - LogTraceFunction; - if (!m_thread_idle || !m_inited) { - return false; - } - - std::unique_lock lock(m_mutex); - resource.templ().clear_hists(); - - append_match_task("VisitBegin", { "VisitBegin" }, ProcessTaskRetryTimesDefault); - - if (with_shopping) { - auto shopping_task_ptr = std::make_shared(task_callback, (void*)this); - shopping_task_ptr->set_task_chain("VisitBegin"); - m_tasks_deque.emplace_back(shopping_task_ptr); - } - - m_thread_idle = false; - m_condvar.notify_one(); - - return true; -} - -bool Assistance::start_process_task(const std::string& task, int retry_times, bool block) -{ - LogTraceFunction; - log.trace("Start |", task, block ? "block" : "non block"); - if (!m_thread_idle || !m_inited) { - return false; - } - - std::unique_lock lock; - if (block) { - lock = std::unique_lock(m_mutex); - //clear_exec_times(); - resource.templ().clear_hists(); - } - - append_match_task(task, { task }, retry_times); - - m_thread_idle = false; - m_condvar.notify_one(); - - return true; -} - -#ifdef LOG_TRACE -bool Assistance::start_debug_task() -{ - LogTraceFunction; - if (!m_thread_idle || !m_inited) { - return false; - } - - std::unique_lock lock(m_mutex); - - { - constexpr static const char* DebugTaskChain = "Debug"; - auto shift_task_ptr = std::make_shared(task_callback, (void*)this); - //shift_task_ptr->set_facility("Mfg"); - //shift_task_ptr->set_product("CombatRecord"); - shift_task_ptr->set_task_chain(DebugTaskChain); - m_tasks_deque.emplace_back(shift_task_ptr); - } - - m_thread_idle = false; - m_condvar.notify_one(); - - return true; -} -#endif - -bool Assistance::start_recruiting(const std::vector& required_level, bool set_time) -{ - LogTraceFunction; - if (!m_thread_idle || !m_inited) { - return false; - } - - std::unique_lock lock(m_mutex); - - auto task_ptr = std::make_shared(task_callback, (void*)this); - task_ptr->set_param(required_level, set_time); - task_ptr->set_retry_times(OpenRecruitTaskRetyrTimesDefault); - task_ptr->set_task_chain("OpenRecruit"); - m_tasks_deque.emplace_back(task_ptr); - - m_thread_idle = false; - m_condvar.notify_one(); - - return true; -} - -bool asst::Assistance::start_infrast_shift(InfrastWorkMode work_mode, const std::vector& order, UsesOfDrones uses_of_drones, double dorm_threshold) -{ - LogTraceFunction; - if (!m_thread_idle || !m_inited) { - return false; - } - - // 偏激模式还没来得及做,保留用户接口,内部先按激进模式走 - if (work_mode == InfrastWorkMode::Extreme) { - work_mode = InfrastWorkMode::Aggressive; - } - - constexpr static const char* InfrastTaskCahin = "Infrast"; - - // 这个流程任务,结束的时候是处于基建主界面的。既可以用于进入基建,也可以用于从设施里返回基建主界面 - append_match_task(InfrastTaskCahin, { "InfrastBegin" }); - - auto info_task_ptr = std::make_shared(task_callback, (void*)this); - info_task_ptr->set_work_mode(work_mode); - m_tasks_deque.emplace_back(info_task_ptr); - - // 因为后期要考虑多任务间的联动等,所以这些任务的声明暂时不妨到for循环中 - auto dorm_task_ptr = std::make_shared(task_callback, (void*)this); - dorm_task_ptr->set_work_mode(work_mode); - dorm_task_ptr->set_task_chain(InfrastTaskCahin); - dorm_task_ptr->set_mood_threshold(dorm_threshold); - auto mfg_task_ptr = std::make_shared(task_callback, (void*)this); - mfg_task_ptr->set_work_mode(work_mode); - mfg_task_ptr->set_task_chain(InfrastTaskCahin); - auto trade_task_ptr = std::make_shared(task_callback, (void*)this); - trade_task_ptr->set_work_mode(work_mode); - trade_task_ptr->set_task_chain(InfrastTaskCahin); - auto power_task_ptr = std::make_shared(task_callback, (void*)this); - power_task_ptr->set_work_mode(work_mode); - power_task_ptr->set_task_chain(InfrastTaskCahin); - auto office_task_ptr = std::make_shared(task_callback, (void*)this); - office_task_ptr->set_work_mode(work_mode); - office_task_ptr->set_task_chain(InfrastTaskCahin); - auto recpt_task_ptr = std::make_shared(task_callback, (void*)this); - recpt_task_ptr->set_work_mode(work_mode); - recpt_task_ptr->set_task_chain(InfrastTaskCahin); - - for (const auto& facility : order) { - if (facility == "Dorm") { - m_tasks_deque.emplace_back(dorm_task_ptr); - } - else if (facility == "Mfg") { - m_tasks_deque.emplace_back(mfg_task_ptr); - if (UsesOfDrones::DronesMfg & uses_of_drones) { - append_match_task(InfrastTaskCahin, { "DroneAssist-MFG" }); - } - } - else if (facility == "Trade") { - m_tasks_deque.emplace_back(trade_task_ptr); - if (UsesOfDrones::DronesTrade & uses_of_drones) { - append_match_task(InfrastTaskCahin, { "DroneAssist-Trade" }); - } - } - else if (facility == "Power") { - m_tasks_deque.emplace_back(power_task_ptr); - } - else if (facility == "Office") { - m_tasks_deque.emplace_back(office_task_ptr); - } - else if (facility == "Reception") { - m_tasks_deque.emplace_back(recpt_task_ptr); - } - else { - log.error("start_infrast_shift | Unknown facility", facility); - } - append_match_task(InfrastTaskCahin, { "InfrastBegin" }); - } - - m_thread_idle = false; - m_condvar.notify_one(); - - return true; -} - -void Assistance::stop(bool block) -{ - LogTraceFunction; - log.trace("Stop |", block ? "block" : "non block"); - - m_thread_idle = true; - - std::unique_lock lock; - if (block) { // 外部调用 - lock = std::unique_lock(m_mutex); - } - decltype(m_tasks_deque) empty; - m_tasks_deque.swap(empty); - clear_exec_times(); - resource.templ().clear_hists(); -} - -bool Assistance::set_param(const std::string& type, const std::string& param, const std::string& value) -{ - LogTraceFunction; - log.trace("SetParam |", type, param, value); - - return resource.task().set_param(type, param, value); -} - -void Assistance::working_proc() -{ - LogTraceFunction; - auto p_this = this; - - int retry_times = 0; - while (!m_thread_exit) { - //LogTraceScope("Assistance::working_proc Loop"); - std::unique_lock lock(m_mutex); - - if (!m_thread_idle && !m_tasks_deque.empty()) { - //controller.set_idle(false); - - auto start_time = std::chrono::system_clock::now(); - auto task_ptr = m_tasks_deque.front(); - // 先pop出来,如果执行失败再还原回去 - m_tasks_deque.pop_front(); - - task_ptr->set_exit_flag(&m_thread_idle); - bool ret = task_ptr->run(); - if (ret) { - retry_times = 0; - if (m_tasks_deque.empty()) { - json::value task_all_completed_json; - task_all_completed_json["task_chain"] = task_ptr->get_task_chain(); - task_callback(AsstMsg::TaskChainCompleted, task_all_completed_json, p_this); - } - } - else { - // 失败了累加失败次数,超限了再pop - if (retry_times >= task_ptr->get_retry_times()) { - json::value task_error_json; - task_error_json["retry_limit"] = task_ptr->get_retry_times(); - task_error_json["retry_times"] = retry_times; - task_error_json["task_chain"] = task_ptr->get_task_chain(); - task_callback(AsstMsg::TaskError, task_error_json, p_this); - - retry_times = 0; - continue; - } - else { - ++retry_times; - // 执行失败再还原回去 - m_tasks_deque.emplace_front(task_ptr); - task_ptr->on_run_fails(retry_times); - } - } - - auto& delay = resource.cfg().get_options().task_delay; - m_condvar.wait_until(lock, start_time + std::chrono::milliseconds(delay), - [&]() -> bool { return m_thread_idle; }); - } - else { - m_thread_idle = true; - //controller.set_idle(true); - m_condvar.wait(lock); - } - } -} - -void Assistance::msg_proc() -{ - LogTraceFunction; - - while (!m_thread_exit) { - //LogTraceScope("Assistance::msg_proc Loop"); - std::unique_lock lock(m_msg_mutex); - if (!m_msg_queue.empty()) { - // 结构化绑定只能是引用,后续的pop会使引用失效,所以需要重新构造一份,这里采用了move的方式 - auto&& [temp_msg, temp_detail] = m_msg_queue.front(); - AsstMsg msg = std::move(temp_msg); - json::value detail = std::move(temp_detail); - m_msg_queue.pop(); - lock.unlock(); - - if (m_callback) { - m_callback(msg, detail, m_callback_arg); - } - } - else { - m_msg_condvar.wait(lock); - } - } -} - -void Assistance::task_callback(AsstMsg msg, const json::value& detail, void* custom_arg) -{ - log.trace("Assistance::task_callback |", msg, detail.to_string()); - - Assistance* p_this = (Assistance*)custom_arg; - json::value more_detail = detail; - switch (msg) { - case AsstMsg::PtrIsNull: - case AsstMsg::ImageIsEmpty: - p_this->stop(false); - break; - //case AsstMsg::WindowMinimized: - // p_this->controller.show_window(); - // break; - case AsstMsg::AppendProcessTask: - more_detail["type"] = "ProcessTask"; - [[fallthrough]]; - case AsstMsg::AppendTask: - p_this->append_task(more_detail, true); - return; // 这俩消息Assistance会新增任务,外部不需要处理,直接拦掉 - break; - case AsstMsg::StageDrops: - more_detail = p_this->organize_stage_drop(more_detail); - break; - default: - break; - } - - // Todo: 有些不需要回调给外部的消息,得在这里给拦截掉 - // 加入回调消息队列,由回调消息线程外抛给外部 - p_this->append_callback(msg, std::move(more_detail)); -} - -void asst::Assistance::append_match_task( - const std::string& task_chain, const std::vector& tasks, int retry_times, bool front) -{ - auto task_ptr = std::make_shared(task_callback, (void*)this); - task_ptr->set_task_chain(task_chain); - task_ptr->set_tasks(tasks); - task_ptr->set_retry_times(retry_times); - if (front) { - m_tasks_deque.emplace_front(task_ptr); - } - else { - m_tasks_deque.emplace_back(task_ptr); - } -} - -void asst::Assistance::append_task(const json::value& detail, bool front) -{ - std::string task_type = detail.at("type").as_string(); - std::string task_chain = detail.get("task_chain", ""); - int retry_times = detail.get("retry_times", INT_MAX); - - if (task_type == "ProcessTask") { - std::vector next_vec; - if (detail.exist("tasks")) { - json::array next_arr = detail.at("tasks").as_array(); - for (const json::value& next_json : next_arr) { - next_vec.emplace_back(next_json.as_string()); - } - } - else if (detail.exist("task")) { - next_vec.emplace_back(detail.at("task").as_string()); - } - append_match_task(task_chain, next_vec, retry_times, front); - } - // else if // TODO -} - -void asst::Assistance::append_callback(AsstMsg msg, json::value detail) -{ - std::unique_lock lock(m_msg_mutex); - m_msg_queue.emplace(msg, std::move(detail)); - m_msg_condvar.notify_one(); -} - -void Assistance::clear_exec_times() -{ - resource.task().clear_exec_times(); - resource.item().clear_drop_count(); -} - -json::value asst::Assistance::organize_stage_drop(const json::value& rec) -{ - json::value dst = rec; - auto& item = resource.item(); - for (json::value& drop : dst["drops"].as_array()) { - std::string id = drop["itemId"].as_string(); - int quantity = drop["quantity"].as_integer(); - item.increase_drop_count(id, quantity); - const std::string& name = item.get_item_name(id); - drop["itemName"] = name.empty() ? "未知材料" : name; - } - std::vector statistics_vec; - for (auto&& [id, count] : item.get_drop_count()) { - json::value info; - info["itemId"] = id; - const std::string& name = item.get_item_name(id); - info["itemName"] = name.empty() ? "未知材料" : name; - info["count"] = count; - statistics_vec.emplace_back(std::move(info)); - } - // 排个序,数量多的放前面 - std::sort(statistics_vec.begin(), statistics_vec.end(), - [](const json::value& lhs, const json::value& rhs) ->bool - { - return lhs.at("count").as_integer() > rhs.at("count").as_integer(); - }); - - dst["statistics"] = json::array(std::move(statistics_vec)); - - log.trace("organize_stage_drop | ", dst.to_string()); - - return dst; -} \ No newline at end of file +} + +bool asst::Assistance::start_sanity() +{ + return start_process_task("SanityBegin", ProcessTaskRetryTimesDefault); +} + +bool asst::Assistance::start_visit(bool with_shopping) +{ + LogTraceFunction; + if (!m_thread_idle || !m_inited) { + return false; + } + + std::unique_lock lock(m_mutex); + resource.templ().clear_hists(); + + append_match_task("VisitBegin", { "VisitBegin" }, ProcessTaskRetryTimesDefault); + + if (with_shopping) { + auto shopping_task_ptr = std::make_shared(task_callback, (void*)this); + shopping_task_ptr->set_task_chain("VisitBegin"); + m_tasks_deque.emplace_back(shopping_task_ptr); + } + + m_thread_idle = false; + m_condvar.notify_one(); + + return true; +} + +bool Assistance::start_process_task(const std::string& task, int retry_times, bool block) +{ + LogTraceFunction; + log.trace("Start |", task, block ? "block" : "non block"); + if (!m_thread_idle || !m_inited) { + return false; + } + + std::unique_lock lock; + if (block) { + lock = std::unique_lock(m_mutex); + //clear_exec_times(); + resource.templ().clear_hists(); + } + + append_match_task(task, { task }, retry_times); + + m_thread_idle = false; + m_condvar.notify_one(); + + return true; +} + +#ifdef LOG_TRACE +bool Assistance::start_debug_task() +{ + LogTraceFunction; + if (!m_thread_idle || !m_inited) { + return false; + } + + std::unique_lock lock(m_mutex); + + { + constexpr static const char* DebugTaskChain = "Debug"; + auto shift_task_ptr = std::make_shared(task_callback, (void*)this); + //shift_task_ptr->set_facility("Mfg"); + //shift_task_ptr->set_product("CombatRecord"); + shift_task_ptr->set_task_chain(DebugTaskChain); + m_tasks_deque.emplace_back(shift_task_ptr); + } + + m_thread_idle = false; + m_condvar.notify_one(); + + return true; +} +#endif + +bool Assistance::start_recruiting(const std::vector& required_level, bool set_time) +{ + LogTraceFunction; + if (!m_thread_idle || !m_inited) { + return false; + } + + std::unique_lock lock(m_mutex); + + auto task_ptr = std::make_shared(task_callback, (void*)this); + task_ptr->set_param(required_level, set_time); + task_ptr->set_retry_times(OpenRecruitTaskRetyrTimesDefault); + task_ptr->set_task_chain("OpenRecruit"); + m_tasks_deque.emplace_back(task_ptr); + + m_thread_idle = false; + m_condvar.notify_one(); + + return true; +} + +bool asst::Assistance::start_infrast_shift(InfrastWorkMode work_mode, const std::vector& order, UsesOfDrones uses_of_drones, double dorm_threshold) +{ + LogTraceFunction; + if (!m_thread_idle || !m_inited) { + return false; + } + + // 偏激模式还没来得及做,保留用户接口,内部先按激进模式走 + if (work_mode == InfrastWorkMode::Extreme) { + work_mode = InfrastWorkMode::Aggressive; + } + + constexpr static const char* InfrastTaskCahin = "Infrast"; + + // 这个流程任务,结束的时候是处于基建主界面的。既可以用于进入基建,也可以用于从设施里返回基建主界面 + append_match_task(InfrastTaskCahin, { "InfrastBegin" }); + + auto info_task_ptr = std::make_shared(task_callback, (void*)this); + info_task_ptr->set_work_mode(work_mode); + m_tasks_deque.emplace_back(info_task_ptr); + + // 因为后期要考虑多任务间的联动等,所以这些任务的声明暂时不妨到for循环中 + auto dorm_task_ptr = std::make_shared(task_callback, (void*)this); + dorm_task_ptr->set_work_mode(work_mode); + dorm_task_ptr->set_task_chain(InfrastTaskCahin); + dorm_task_ptr->set_mood_threshold(dorm_threshold); + auto mfg_task_ptr = std::make_shared(task_callback, (void*)this); + mfg_task_ptr->set_work_mode(work_mode); + mfg_task_ptr->set_task_chain(InfrastTaskCahin); + auto trade_task_ptr = std::make_shared(task_callback, (void*)this); + trade_task_ptr->set_work_mode(work_mode); + trade_task_ptr->set_task_chain(InfrastTaskCahin); + auto power_task_ptr = std::make_shared(task_callback, (void*)this); + power_task_ptr->set_work_mode(work_mode); + power_task_ptr->set_task_chain(InfrastTaskCahin); + auto office_task_ptr = std::make_shared(task_callback, (void*)this); + office_task_ptr->set_work_mode(work_mode); + office_task_ptr->set_task_chain(InfrastTaskCahin); + auto recpt_task_ptr = std::make_shared(task_callback, (void*)this); + recpt_task_ptr->set_work_mode(work_mode); + recpt_task_ptr->set_task_chain(InfrastTaskCahin); + + for (const auto& facility : order) { + if (facility == "Dorm") { + m_tasks_deque.emplace_back(dorm_task_ptr); + } + else if (facility == "Mfg") { + m_tasks_deque.emplace_back(mfg_task_ptr); + if (UsesOfDrones::DronesMfg & uses_of_drones) { + append_match_task(InfrastTaskCahin, { "DroneAssist-MFG" }); + } + } + else if (facility == "Trade") { + m_tasks_deque.emplace_back(trade_task_ptr); + if (UsesOfDrones::DronesTrade & uses_of_drones) { + append_match_task(InfrastTaskCahin, { "DroneAssist-Trade" }); + } + } + else if (facility == "Power") { + m_tasks_deque.emplace_back(power_task_ptr); + } + else if (facility == "Office") { + m_tasks_deque.emplace_back(office_task_ptr); + } + else if (facility == "Reception") { + m_tasks_deque.emplace_back(recpt_task_ptr); + } + else { + log.error("start_infrast_shift | Unknown facility", facility); + } + append_match_task(InfrastTaskCahin, { "InfrastBegin" }); + } + + m_thread_idle = false; + m_condvar.notify_one(); + + return true; +} + +void Assistance::stop(bool block) +{ + LogTraceFunction; + log.trace("Stop |", block ? "block" : "non block"); + + m_thread_idle = true; + + std::unique_lock lock; + if (block) { // 外部调用 + lock = std::unique_lock(m_mutex); + } + decltype(m_tasks_deque) empty; + m_tasks_deque.swap(empty); + clear_exec_times(); + resource.templ().clear_hists(); +} + +bool Assistance::set_param(const std::string& type, const std::string& param, const std::string& value) +{ + LogTraceFunction; + log.trace("SetParam |", type, param, value); + + return resource.task().set_param(type, param, value); +} + +void Assistance::working_proc() +{ + LogTraceFunction; + auto p_this = this; + + int retry_times = 0; + while (!m_thread_exit) { + //LogTraceScope("Assistance::working_proc Loop"); + std::unique_lock lock(m_mutex); + + if (!m_thread_idle && !m_tasks_deque.empty()) { + //controller.set_idle(false); + + auto start_time = std::chrono::system_clock::now(); + auto task_ptr = m_tasks_deque.front(); + // 先pop出来,如果执行失败再还原回去 + m_tasks_deque.pop_front(); + + task_ptr->set_exit_flag(&m_thread_idle); + bool ret = task_ptr->run(); + if (ret) { + retry_times = 0; + if (m_tasks_deque.empty()) { + json::value task_all_completed_json; + task_all_completed_json["task_chain"] = task_ptr->get_task_chain(); + task_callback(AsstMsg::TaskChainCompleted, task_all_completed_json, p_this); + } + } + else { + // 失败了累加失败次数,超限了再pop + if (retry_times >= task_ptr->get_retry_times()) { + json::value task_error_json; + task_error_json["retry_limit"] = task_ptr->get_retry_times(); + task_error_json["retry_times"] = retry_times; + task_error_json["task_chain"] = task_ptr->get_task_chain(); + task_callback(AsstMsg::TaskError, task_error_json, p_this); + + retry_times = 0; + continue; + } + else { + ++retry_times; + // 执行失败再还原回去 + m_tasks_deque.emplace_front(task_ptr); + task_ptr->on_run_fails(retry_times); + } + } + + auto& delay = resource.cfg().get_options().task_delay; + m_condvar.wait_until(lock, start_time + std::chrono::milliseconds(delay), + [&]() -> bool { return m_thread_idle; }); + } + else { + m_thread_idle = true; + //controller.set_idle(true); + m_condvar.wait(lock); + } + } +} + +void Assistance::msg_proc() +{ + LogTraceFunction; + + while (!m_thread_exit) { + //LogTraceScope("Assistance::msg_proc Loop"); + std::unique_lock lock(m_msg_mutex); + if (!m_msg_queue.empty()) { + // 结构化绑定只能是引用,后续的pop会使引用失效,所以需要重新构造一份,这里采用了move的方式 + auto&& [temp_msg, temp_detail] = m_msg_queue.front(); + AsstMsg msg = std::move(temp_msg); + json::value detail = std::move(temp_detail); + m_msg_queue.pop(); + lock.unlock(); + + if (m_callback) { + m_callback(msg, detail, m_callback_arg); + } + } + else { + m_msg_condvar.wait(lock); + } + } +} + +void Assistance::task_callback(AsstMsg msg, const json::value& detail, void* custom_arg) +{ + log.trace("Assistance::task_callback |", msg, detail.to_string()); + + Assistance* p_this = (Assistance*)custom_arg; + json::value more_detail = detail; + switch (msg) { + case AsstMsg::PtrIsNull: + case AsstMsg::ImageIsEmpty: + p_this->stop(false); + break; + //case AsstMsg::WindowMinimized: + // p_this->controller.show_window(); + // break; + case AsstMsg::AppendProcessTask: + more_detail["type"] = "ProcessTask"; + [[fallthrough]]; + case AsstMsg::AppendTask: + p_this->append_task(more_detail, true); + return; // 这俩消息Assistance会新增任务,外部不需要处理,直接拦掉 + break; + case AsstMsg::StageDrops: + more_detail = p_this->organize_stage_drop(more_detail); + break; + default: + break; + } + + // Todo: 有些不需要回调给外部的消息,得在这里给拦截掉 + // 加入回调消息队列,由回调消息线程外抛给外部 + p_this->append_callback(msg, std::move(more_detail)); +} + +void asst::Assistance::append_match_task( + const std::string& task_chain, const std::vector& tasks, int retry_times, bool front) +{ + auto task_ptr = std::make_shared(task_callback, (void*)this); + task_ptr->set_task_chain(task_chain); + task_ptr->set_tasks(tasks); + task_ptr->set_retry_times(retry_times); + if (front) { + m_tasks_deque.emplace_front(task_ptr); + } + else { + m_tasks_deque.emplace_back(task_ptr); + } +} + +void asst::Assistance::append_task(const json::value& detail, bool front) +{ + std::string task_type = detail.at("type").as_string(); + std::string task_chain = detail.get("task_chain", ""); + int retry_times = detail.get("retry_times", INT_MAX); + + if (task_type == "ProcessTask") { + std::vector next_vec; + if (detail.exist("tasks")) { + json::array next_arr = detail.at("tasks").as_array(); + for (const json::value& next_json : next_arr) { + next_vec.emplace_back(next_json.as_string()); + } + } + else if (detail.exist("task")) { + next_vec.emplace_back(detail.at("task").as_string()); + } + append_match_task(task_chain, next_vec, retry_times, front); + } + // else if // TODO +} + +void asst::Assistance::append_callback(AsstMsg msg, json::value detail) +{ + std::unique_lock lock(m_msg_mutex); + m_msg_queue.emplace(msg, std::move(detail)); + m_msg_condvar.notify_one(); +} + +void Assistance::clear_exec_times() +{ + resource.task().clear_exec_times(); + resource.item().clear_drop_count(); +} + +json::value asst::Assistance::organize_stage_drop(const json::value& rec) +{ + json::value dst = rec; + auto& item = resource.item(); + for (json::value& drop : dst["drops"].as_array()) { + std::string id = drop["itemId"].as_string(); + int quantity = drop["quantity"].as_integer(); + item.increase_drop_count(id, quantity); + const std::string& name = item.get_item_name(id); + drop["itemName"] = name.empty() ? "未知材料" : name; + } + std::vector statistics_vec; + for (auto&& [id, count] : item.get_drop_count()) { + json::value info; + info["itemId"] = id; + const std::string& name = item.get_item_name(id); + info["itemName"] = name.empty() ? "未知材料" : name; + info["count"] = count; + statistics_vec.emplace_back(std::move(info)); + } + // 排个序,数量多的放前面 + std::sort(statistics_vec.begin(), statistics_vec.end(), + [](const json::value& lhs, const json::value& rhs) -> bool { + return lhs.at("count").as_integer() > rhs.at("count").as_integer(); + }); + + dst["statistics"] = json::array(std::move(statistics_vec)); + + log.trace("organize_stage_drop | ", dst.to_string()); + + return dst; +} diff --git a/src/MeoAssistance/Assistance.h b/src/MeoAssistance/Assistance.h index 852632990d..86ed5e5b9e 100644 --- a/src/MeoAssistance/Assistance.h +++ b/src/MeoAssistance/Assistance.h @@ -1,23 +1,25 @@ -#pragma once +#pragma once -#include -#include #include -#include -#include -#include -#include #include +#include +#include +#include +#include +#include +#include +#include "AbstractTask.h" #include "AsstDef.h" #include "AsstMsg.h" -#include "AbstractTask.h" -namespace cv { +namespace cv +{ class Mat; } -namespace asst { +namespace asst +{ class Controller; class Identify; @@ -71,7 +73,7 @@ namespace asst { void append_task(const json::value& detail, bool front = false); void append_callback(AsstMsg msg, json::value detail); void clear_exec_times(); - json::value organize_stage_drop(const json::value& rec); // 整理关卡掉落的材料信息 + json::value organize_stage_drop(const json::value& rec); // 整理关卡掉落的材料信息 bool m_inited = false; @@ -90,4 +92,4 @@ namespace asst { std::mutex m_msg_mutex; std::condition_variable m_msg_condvar; }; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/AsstCaller.cpp b/src/MeoAssistance/AsstCaller.cpp index df85f63793..394573d8f2 100644 --- a/src/MeoAssistance/AsstCaller.cpp +++ b/src/MeoAssistance/AsstCaller.cpp @@ -1,13 +1,13 @@ -#include "AsstCaller.h" +#include "AsstCaller.h" #include #include -#include "Version.h" +#include "Assistance.h" #include "AsstDef.h" #include "AsstUtils.hpp" -#include "Assistance.h" +#include "Version.h" #if 0 #if _MSC_VER @@ -15,7 +15,8 @@ BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved -) { +) +{ UNREFERENCED_PARAMETER(hModule); UNREFERENCED_PARAMETER(lpReserved); switch (ul_reason_for_call) { @@ -105,19 +106,19 @@ bool AsstCatchRemote(void* p_asst, const char* address) } return ((asst::Assistance*)p_asst)->catch_remote(address); -} - -bool AsstCatchFake(void* p_asst) +} + +bool AsstCatchFake(void* p_asst) { #ifdef LOG_TRACE if (p_asst == nullptr) { return false; } - return ((asst::Assistance*)p_asst)->catch_fake(); -#else - return false; -#endif // LOG_TRACE + return ((asst::Assistance*)p_asst)->catch_fake(); +#else + return false; +#endif // LOG_TRACE } bool AsstStartSanity(void* p_asst) @@ -188,11 +189,7 @@ bool AsstStartInfrastShift(void* p_asst, int work_mode, const char** order, int std::vector order_vector; order_vector.assign(order, order + order_size); - return ((asst::Assistance*)p_asst)->start_infrast_shift( - static_cast(work_mode), - order_vector, - static_cast(uses_of_drones), - dorm_threshold); + return ((asst::Assistance*)p_asst)->start_infrast_shift(static_cast(work_mode), order_vector, static_cast(uses_of_drones), dorm_threshold); } bool AsstStartDebugTask(void* p_asst) @@ -205,4 +202,4 @@ bool AsstStartDebugTask(void* p_asst) #else return false; #endif // LOG_TRACE -} \ No newline at end of file +} diff --git a/src/MeoAssistance/AsstDef.h b/src/MeoAssistance/AsstDef.h index dcd6cb77f6..bb5b9df6d2 100644 --- a/src/MeoAssistance/AsstDef.h +++ b/src/MeoAssistance/AsstDef.h @@ -1,18 +1,19 @@ -#pragma once +#pragma once +#include +#include #include #include #include #include -#include -#include namespace json { class value; } -namespace asst { +namespace asst +{ constexpr double DoubleDiff = 1e-12; struct Point @@ -33,7 +34,8 @@ namespace asst { Rect(const Rect&) noexcept = default; Rect(Rect&&) noexcept = default; Rect(int x, int y, int width, int height) - : x(x), y(y), width(width), height(height) {} + : x(x), y(y), width(width), height(height) + {} Rect operator*(double rhs) const { return { x, y, static_cast(width * rhs), static_cast(height * rhs) }; @@ -43,11 +45,19 @@ namespace asst { int half_width_scale = static_cast(width * (1 - scale) / 2); int half_hight_scale = static_cast(height * (1 - scale) / 2); Rect dst(x + half_width_scale, y + half_hight_scale, - static_cast(width * scale), static_cast(height * scale)); - if (dst.x < 0) { dst.x = 0; } - if (dst.y < 0) { dst.y = 0; } - if (dst.width + dst.x >= max_width) { dst.width = max_width - dst.x; } - if (dst.height + dst.y >= max_height) { dst.height = max_height - dst.y; } + static_cast(width * scale), static_cast(height * scale)); + if (dst.x < 0) { + dst.x = 0; + } + if (dst.y < 0) { + dst.y = 0; + } + if (dst.width + dst.x >= max_width) { + dst.width = max_width - dst.x; + } + if (dst.height + dst.y >= max_height) { + dst.height = max_height - dst.y; + } return dst; } Rect& operator=(const Rect&) noexcept = default; @@ -59,16 +69,11 @@ namespace asst { } bool include(const Rect& rhs) const noexcept { - return x <= rhs.x - && y <= rhs.y - && (x + width) >= (rhs.x + rhs.width) - && (y + height) >= (rhs.y + rhs.height); + return x <= rhs.x && y <= rhs.y && (x + width) >= (rhs.x + rhs.width) && (y + height) >= (rhs.y + rhs.height); } - std::string to_string() const { - return "[ " + std::to_string(x) + ", " - + std::to_string(y) + ", " - + std::to_string(width) + ", " - + std::to_string(height) + " ]"; + std::string to_string() const + { + return "[ " + std::to_string(x) + ", " + std::to_string(y) + ", " + std::to_string(width) + ", " + std::to_string(height) + " ]"; } int x = 0; @@ -77,19 +82,22 @@ namespace asst { int height = 0; }; - struct TextRect { + struct TextRect + { TextRect() = default; TextRect(const TextRect&) = default; TextRect(TextRect&&) noexcept = default; explicit operator std::string() const noexcept { return text; } explicit operator Rect() const noexcept { return rect; } - std::string to_string() const { + std::string to_string() const + { return text + " : " + rect.to_string(); } TextRect& operator=(const TextRect&) = default; TextRect& operator=(TextRect&&) noexcept = default; - bool operator==(const TextRect& rhs) const noexcept { + bool operator==(const TextRect& rhs) const noexcept + { return text == rhs.text && rect == rhs.rect; } @@ -98,7 +106,8 @@ namespace asst { }; using TextRectProc = std::function; - enum class AlgorithmType { + enum class AlgorithmType + { Invaild = -1, JustReturn, MatchTemplate, @@ -106,7 +115,8 @@ namespace asst { OcrDetect }; - struct MatchRect { + struct MatchRect + { MatchRect() = default; MatchRect(const MatchRect&) = default; MatchRect(MatchRect&&) noexcept = default; @@ -121,92 +131,98 @@ namespace asst { }; } -namespace std { - template<> - class hash { +namespace std +{ + template <> + class hash + { public: size_t operator()(const asst::Rect& rect) const { - return std::hash()(rect.x) - ^ std::hash()(rect.y) - ^ std::hash()(rect.width) - ^ std::hash()(rect.height); + return std::hash()(rect.x) ^ std::hash()(rect.y) ^ std::hash()(rect.width) ^ std::hash()(rect.height); } }; - template<> - class hash { + template <> + class hash + { public: size_t operator()(const asst::TextRect& tr) const { - return std::hash()(tr.text) - ^ std::hash()(tr.rect); + return std::hash()(tr.text) ^ std::hash()(tr.rect); } }; } -namespace asst { - enum class ProcessTaskAction { +namespace asst +{ + enum class ProcessTaskAction + { Invalid = 0, BasicClick = 0x100, - ClickSelf = BasicClick | 1, // 点击自身位置 - ClickRect = BasicClick | 2, // 点击指定区域 - ClickRand = BasicClick | 4, // 点击随机区域 - DoNothing = 0x200, // 什么都不做 - Stop = 0x400, // 停止当前Task - StageDrops = 0x800, // 关卡结束,特化动作 + ClickSelf = BasicClick | 1, // 点击自身位置 + ClickRect = BasicClick | 2, // 点击指定区域 + ClickRand = BasicClick | 4, // 点击随机区域 + DoNothing = 0x200, // 什么都不做 + Stop = 0x400, // 停止当前Task + StageDrops = 0x800, // 关卡结束,特化动作 BasicSwipe = 0x1000, - SwipeToTheLeft = BasicSwipe | 1, // 往左划一下 - SwipeToTheRight = BasicSwipe | 2, // 往右划一下 + SwipeToTheLeft = BasicSwipe | 1, // 往左划一下 + SwipeToTheRight = BasicSwipe | 2, // 往右划一下 }; // 任务信息 - struct TaskInfo { + struct TaskInfo + { virtual ~TaskInfo() = default; - std::string name; // 任务名 - AlgorithmType algorithm = // 图像算法类型 + std::string name; // 任务名 + AlgorithmType algorithm = // 图像算法类型 AlgorithmType::Invaild; - ProcessTaskAction action = // 要进行的操作 + ProcessTaskAction action = // 要进行的操作 ProcessTaskAction::Invalid; - std::vector next; // 下一个可能的任务(列表) - int exec_times = 0; // 任务已执行了多少次 - int max_times = INT_MAX; // 任务最多执行多少次 - std::vector exceeded_next; // 达到最多次数了之后,下一个可能的任务(列表) - std::vector reduce_other_times; // 执行了该任务后,需要减少别的任务的执行次数。例如执行了吃理智药,则说明上一次点击蓝色开始行动按钮没生效,所以蓝色开始行动要-1 - asst::Rect specific_rect; // 指定区域,目前仅针对ClickRect任务有用,会点这个区域 - int pre_delay = 0; // 执行该任务前的延时 - int rear_delay = 0; // 执行该任务后的延时 - int retry_times = INT_MAX; // 未找到图像时的重试次数 - Rect roi; // 要识别的区域,若为0则全图识别 - Rect rect_move; // 识别结果移动:有些结果识别到的,和要点击的不是同一个位置。即识别到了res,点击res + result_move的位置 + std::vector next; // 下一个可能的任务(列表) + int exec_times = 0; // 任务已执行了多少次 + int max_times = INT_MAX; // 任务最多执行多少次 + std::vector exceeded_next; // 达到最多次数了之后,下一个可能的任务(列表) + std::vector reduce_other_times; // 执行了该任务后,需要减少别的任务的执行次数。例如执行了吃理智药,则说明上一次点击蓝色开始行动按钮没生效,所以蓝色开始行动要-1 + asst::Rect specific_rect; // 指定区域,目前仅针对ClickRect任务有用,会点这个区域 + int pre_delay = 0; // 执行该任务前的延时 + int rear_delay = 0; // 执行该任务后的延时 + int retry_times = INT_MAX; // 未找到图像时的重试次数 + Rect roi; // 要识别的区域,若为0则全图识别 + Rect rect_move; // 识别结果移动:有些结果识别到的,和要点击的不是同一个位置。即识别到了res,点击res + result_move的位置 }; // 文字识别任务的信息 - struct OcrTaskInfo : public TaskInfo { + struct OcrTaskInfo : public TaskInfo + { virtual ~OcrTaskInfo() = default; - std::vector text; // 文字的容器,匹配到这里面任一个,就算匹配上了 - bool need_full_match = false; // 是否需要全匹配,否则搜索到子串就算匹配上了 + std::vector text; // 文字的容器,匹配到这里面任一个,就算匹配上了 + bool need_full_match = false; // 是否需要全匹配,否则搜索到子串就算匹配上了 std::unordered_map - replace_map; // 部分文字容易识别错,字符串强制replace之后,再进行匹配 - bool cache = false; // 是否使用历史区域 - std::unordered_set region_of_appeared; // 曾经出现过的区域:上次处理该任务时,在一些rect里识别到过text,这次优先在这些rect里识别,省点性能 + replace_map; // 部分文字容易识别错,字符串强制replace之后,再进行匹配 + bool cache = false; // 是否使用历史区域 + std::unordered_set region_of_appeared; // 曾经出现过的区域:上次处理该任务时,在一些rect里识别到过text,这次优先在这些rect里识别,省点性能 }; // 图片匹配任务的信息 - struct MatchTaskInfo : public TaskInfo { + struct MatchTaskInfo : public TaskInfo + { virtual ~MatchTaskInfo() = default; - std::string templ_name; // 匹配模板图片文件名 - double templ_threshold = 0; // 模板匹配阈值 - double hist_threshold = 0; // 直方图比较阈值 - std::pair mask_range; // 掩码的二值化范围 - bool cache = false; // 是否使用缓存(直方图),false时就一直用模板匹配。默认为true + std::string templ_name; // 匹配模板图片文件名 + double templ_threshold = 0; // 模板匹配阈值 + double hist_threshold = 0; // 直方图比较阈值 + std::pair mask_range; // 掩码的二值化范围 + bool cache = false; // 是否使用缓存(直方图),false时就一直用模板匹配。默认为true }; - struct HandleInfo { + struct HandleInfo + { std::string class_name; std::string window_name; }; - struct AdbCmd { + struct AdbCmd + { std::string path; std::string devices; std::string address_regex; @@ -222,7 +238,8 @@ namespace asst { int display_height = 0; }; - struct EmulatorInfo { + struct EmulatorInfo + { std::string name; HandleInfo handle; AdbCmd adb; @@ -232,50 +249,58 @@ namespace asst { /* 基建相关 */ // 设施信息 - struct InfrastFacilityInfo { + struct InfrastFacilityInfo + { std::string id; std::vector products; int max_num_of_opers = 0; }; - enum class InfrastSmileyType { + enum class InfrastSmileyType + { Invalid = -1, - Rest, // 休息完成,绿色笑脸 - Work, // 工作中,黄色笑脸 - Distract // 注意力涣散,红色哭脸 + Rest, // 休息完成,绿色笑脸 + Work, // 工作中,黄色笑脸 + Distract // 注意力涣散,红色哭脸 }; - struct InfrastSmileyInfo { + struct InfrastSmileyInfo + { InfrastSmileyType type; Rect rect; }; - struct InfrastOperMoodInfo { - std::string hash; // 干员部分立绘的hash,作为唯一标识 + struct InfrastOperMoodInfo + { + std::string hash; // 干员部分立绘的hash,作为唯一标识 InfrastSmileyInfo smiley; - double percentage = 0; // 心情进度条的百分比 + double percentage = 0; // 心情进度条的百分比 Rect rect; - bool working = false; // 干员是否在工作中 - bool selected = false; // 干员是否已被选择(蓝色的选择框) + bool working = false; // 干员是否在工作中 + bool selected = false; // 干员是否已被选择(蓝色的选择框) }; - struct InfrastSkill { + struct InfrastSkill + { std::string id; std::string templ_name; - std::vector names; // 很多基建技能是一样的,就是名字不同。所以一个技能id可能对应多个名字 + std::vector names; // 很多基建技能是一样的,就是名字不同。所以一个技能id可能对应多个名字 std::string intro; std::unordered_map - efficient; // 技能效率,key:产品名(赤金、经验书等), value: 效率数值 + efficient; // 技能效率,key:产品名(赤金、经验书等), value: 效率数值 std::unordered_map - efficient_regex; // 技能效率正则,key:产品名(赤金、经验书等), value: 效率正则。如不为空,会先对正则进行计算,再加上efficient里面的值 + efficient_regex; // 技能效率正则,key:产品名(赤金、经验书等), value: 效率正则。如不为空,会先对正则进行计算,再加上efficient里面的值 - bool operator==(const InfrastSkill& skill) const noexcept { + bool operator==(const InfrastSkill& skill) const noexcept + { return id == skill.id; } }; } -namespace std { - template<> - class hash { +namespace std +{ + template <> + class hash + { public: size_t operator()(const asst::InfrastSkill& skill) const { @@ -287,9 +312,11 @@ namespace std { namespace asst { // 基建单个干员的技能 - struct InfrastSkillsComb { + struct InfrastSkillsComb + { InfrastSkillsComb() = default; - InfrastSkillsComb(std::unordered_set skill_vec) { + InfrastSkillsComb(std::unordered_set skill_vec) + { skills = std::move(skill_vec); for (const auto& s : skills) { for (const auto& [key, value] : s.efficient) { @@ -300,7 +327,8 @@ namespace asst } } } - bool operator==(const InfrastSkillsComb& rhs) const { + bool operator==(const InfrastSkillsComb& rhs) const + { return skills == rhs.skills; } @@ -310,27 +338,30 @@ namespace asst std::unordered_map efficient_regex; }; // 基建 干员技能信息 - struct InfrastOperSkillInfo { + struct InfrastOperSkillInfo + { InfrastOperSkillInfo() = default; InfrastOperSkillInfo(InfrastSkillsComb skills_comb) : skills_comb(std::move(skills_comb)) {} - std::string hash; // 有些干员的技能是完全一样的,做个hash区分一下不同干员 + std::string hash; // 有些干员的技能是完全一样的,做个hash区分一下不同干员 InfrastSkillsComb skills_comb; Rect rect; - bool selected = false; // 干员是否已被选择(蓝色的选择框) + bool selected = false; // 干员是否已被选择(蓝色的选择框) }; // 基建技能组 - struct InfrastSkillsGroup { - std::string intro; // 文字介绍,实际不起作用 - std::unordered_map conditions; // 技能组合可用条件,例如:key 发电站数量,value 3 - std::vector necessary; // 必选技能。这里面的缺少任一,则该技能组合不可用 - std::vector optional; // 可选技能。 - bool allow_external = false; // 当干员数没满3个的时候,是否允许补充外部干员 + struct InfrastSkillsGroup + { + std::string intro; // 文字介绍,实际不起作用 + std::unordered_map conditions; // 技能组合可用条件,例如:key 发电站数量,value 3 + std::vector necessary; // 必选技能。这里面的缺少任一,则该技能组合不可用 + std::vector optional; // 可选技能。 + bool allow_external = false; // 当干员数没满3个的时候,是否允许补充外部干员 }; - enum class InfrastWorkMode { + enum class InfrastWorkMode + { Invaild = -1, - Gentle, // 温和换班模式:会对干员人数不满的设施进行换班,计算单设施内最优解,尽量不破坏原有的干员组合;即若设施内干员是满的,则不对该设施进行换班 - Aggressive, // 激进换班模式:会对每一个设施进行换班,计算单设施内最优解,但不会将其他设施中的干员替换过来;即按工作状态排序,仅选择前面的干员 - Extreme // 偏激换班模式:会对每一个设施进行换班,计算全局的单设施内最优解,为追求更高效率,会将其他设施内的干员也替换过来;即按技能排序,计算所有拥有该设施技能的干员效率,无论他在不在其他地方工作 + Gentle, // 温和换班模式:会对干员人数不满的设施进行换班,计算单设施内最优解,尽量不破坏原有的干员组合;即若设施内干员是满的,则不对该设施进行换班 + Aggressive, // 激进换班模式:会对每一个设施进行换班,计算单设施内最优解,但不会将其他设施中的干员替换过来;即按工作状态排序,仅选择前面的干员 + Extreme // 偏激换班模式:会对每一个设施进行换班,计算全局的单设施内最优解,为追求更高效率,会将其他设施内的干员也替换过来;即按技能排序,计算所有拥有该设施技能的干员效率,无论他在不在其他地方工作 }; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/AsstMsg.h b/src/MeoAssistance/AsstMsg.h index 5fb6f4170f..81491c370a 100644 --- a/src/MeoAssistance/AsstMsg.h +++ b/src/MeoAssistance/AsstMsg.h @@ -1,95 +1,98 @@ -#pragma once +#pragma once -#include -#include -#include #include +#include +#include +#include #include -namespace asst { - enum class AsstMsg { +namespace asst +{ + enum class AsstMsg + { /* Error Msg */ - PtrIsNull, // 指针为空 - ImageIsEmpty, // 图像为空 - WindowMinimized, // [已弃用] 窗口被最小化了 - InitFaild, // 初始化失败 - TaskError, // 任务错误(任务一直出错,retry次数达到上限) - OcrResultError, // Ocr识别结果错误 + PtrIsNull, // 指针为空 + ImageIsEmpty, // 图像为空 + WindowMinimized, // [已弃用] 窗口被最小化了 + InitFaild, // 初始化失败 + TaskError, // 任务错误(任务一直出错,retry次数达到上限) + OcrResultError, // Ocr识别结果错误 /* Info Msg: about Task */ - TaskStart = 1000, // 任务开始 - TaskMatched, // 任务匹配成功 - ReachedLimit, // 单个原子任务达到次数上限 - ReadyToSleep, // 准备开始睡眠 - EndOfSleep, // 睡眠结束 - AppendProcessTask, // 新增流程任务,Assistance内部消息,外部不需要处理 - AppendTask, // 新增任务,Assistance内部消息,外部不需要处理 - TaskCompleted, // 单个原子任务完成 - PrintWindow, // 截图消息 - ProcessTaskStopAction, // 流程任务执行到了Stop的动作 - TaskChainCompleted, // 任务链完成 - ProcessTaskNotMatched, // 流程任务识别错误 + TaskStart = 1000, // 任务开始 + TaskMatched, // 任务匹配成功 + ReachedLimit, // 单个原子任务达到次数上限 + ReadyToSleep, // 准备开始睡眠 + EndOfSleep, // 睡眠结束 + AppendProcessTask, // 新增流程任务,Assistance内部消息,外部不需要处理 + AppendTask, // 新增任务,Assistance内部消息,外部不需要处理 + TaskCompleted, // 单个原子任务完成 + PrintWindow, // 截图消息 + ProcessTaskStopAction, // 流程任务执行到了Stop的动作 + TaskChainCompleted, // 任务链完成 + ProcessTaskNotMatched, // 流程任务识别错误 /* Info Msg: about Identify */ - TextDetected = 2000, // 识别到文字 - ImageFindResult, // 查找图像的结果 - ImageMatched, // 图像匹配成功 - StageDrops, // 关卡掉落信息 + TextDetected = 2000, // 识别到文字 + ImageFindResult, // 查找图像的结果 + ImageMatched, // 图像匹配成功 + StageDrops, // 关卡掉落信息 /* Open Recruit Msg */ - RecruitTagsDetected = 3000, // 公招识别到了Tags - RecruitSpecialTag, // 公招识别到了特殊的Tag - RecruitResult, // 公开招募结果 + RecruitTagsDetected = 3000, // 公招识别到了Tags + RecruitSpecialTag, // 公招识别到了特殊的Tag + RecruitResult, // 公开招募结果 /* Infrast Msg */ - OpersDetected = 4000, // 识别到了干员s - OpersIdtfResult, // 干员识别结果(总的) - InfrastComb, // 当前房间的最优干员组合 - EnterFacility, // 进入某个房间 - StationInfo, // 当前房间信息 - ReadyToShift, // 准备换班 - ShiftCompleted, // 换班完成(单个房间) - NoNeedToShift // 无需换班(单个房间) + OpersDetected = 4000, // 识别到了干员s + OpersIdtfResult, // 干员识别结果(总的) + InfrastComb, // 当前房间的最优干员组合 + EnterFacility, // 进入某个房间 + StationInfo, // 当前房间信息 + ReadyToShift, // 准备换班 + ShiftCompleted, // 换班完成(单个房间) + NoNeedToShift // 无需换班(单个房间) }; static std::ostream& operator<<(std::ostream& os, const AsstMsg& type) { static const std::unordered_map _type_name = { - {AsstMsg::PtrIsNull, "PtrIsNull"}, - {AsstMsg::ImageIsEmpty, "ImageIsEmpty"}, - {AsstMsg::WindowMinimized, "WindowMinimized"}, - {AsstMsg::InitFaild, "InitFaild"}, - {AsstMsg::TaskStart, "TaskStart"}, - {AsstMsg::ImageFindResult, "ImageFindResult"}, - {AsstMsg::ImageMatched, "ImageMatched"}, - {AsstMsg::StageDrops, "StageDrops"}, - {AsstMsg::TaskMatched, "TaskMatched"}, - {AsstMsg::ReachedLimit, "ReachedLimit"}, - {AsstMsg::ReadyToSleep, "ReadyToSleep"}, - {AsstMsg::EndOfSleep, "EndOfSleep"}, - {AsstMsg::AppendProcessTask, "AppendProcessTask"}, - {AsstMsg::TaskCompleted, "TaskCompleted"}, - {AsstMsg::TaskChainCompleted, "TaskChainCompleted"}, - {AsstMsg::PrintWindow, "PrintWindow"}, - {AsstMsg::TaskError, "TaskError"}, - {AsstMsg::ProcessTaskNotMatched, "ProcessTaskNotMatched"}, - {AsstMsg::ProcessTaskStopAction, "ProcessTaskStopAction"}, - {AsstMsg::TextDetected, "TextDetected"}, - {AsstMsg::RecruitTagsDetected, "RecruitTagsDetected"}, - {AsstMsg::OcrResultError, "OcrResultError"}, - {AsstMsg::RecruitSpecialTag, "RecruitSpecialTag"}, - {AsstMsg::RecruitResult, "RecruitResult"}, - {AsstMsg::AppendTask, "AppendTask"}, - {AsstMsg::OpersDetected, "OpersDetected"}, - {AsstMsg::OpersIdtfResult, "OpersIdtfResult"}, - {AsstMsg::InfrastComb, "InfrastComb"}, - {AsstMsg::EnterFacility, "EnterFacility"}, - {AsstMsg::StationInfo, "StationInfo"}, - {AsstMsg::ReadyToShift, "ReadyToShift"}, - {AsstMsg::ShiftCompleted, "ShiftCompleted"}, - {AsstMsg::NoNeedToShift, "NoNeedToShift"} + { AsstMsg::PtrIsNull, "PtrIsNull" }, + { AsstMsg::ImageIsEmpty, "ImageIsEmpty" }, + { AsstMsg::WindowMinimized, "WindowMinimized" }, + { AsstMsg::InitFaild, "InitFaild" }, + { AsstMsg::TaskStart, "TaskStart" }, + { AsstMsg::ImageFindResult, "ImageFindResult" }, + { AsstMsg::ImageMatched, "ImageMatched" }, + { AsstMsg::StageDrops, "StageDrops" }, + { AsstMsg::TaskMatched, "TaskMatched" }, + { AsstMsg::ReachedLimit, "ReachedLimit" }, + { AsstMsg::ReadyToSleep, "ReadyToSleep" }, + { AsstMsg::EndOfSleep, "EndOfSleep" }, + { AsstMsg::AppendProcessTask, "AppendProcessTask" }, + { AsstMsg::TaskCompleted, "TaskCompleted" }, + { AsstMsg::TaskChainCompleted, "TaskChainCompleted" }, + { AsstMsg::PrintWindow, "PrintWindow" }, + { AsstMsg::TaskError, "TaskError" }, + { AsstMsg::ProcessTaskNotMatched, "ProcessTaskNotMatched" }, + { AsstMsg::ProcessTaskStopAction, "ProcessTaskStopAction" }, + { AsstMsg::TextDetected, "TextDetected" }, + { AsstMsg::RecruitTagsDetected, "RecruitTagsDetected" }, + { AsstMsg::OcrResultError, "OcrResultError" }, + { AsstMsg::RecruitSpecialTag, "RecruitSpecialTag" }, + { AsstMsg::RecruitResult, "RecruitResult" }, + { AsstMsg::AppendTask, "AppendTask" }, + { AsstMsg::OpersDetected, "OpersDetected" }, + { AsstMsg::OpersIdtfResult, "OpersIdtfResult" }, + { AsstMsg::InfrastComb, "InfrastComb" }, + { AsstMsg::EnterFacility, "EnterFacility" }, + { AsstMsg::StationInfo, "StationInfo" }, + { AsstMsg::ReadyToShift, "ReadyToShift" }, + { AsstMsg::ShiftCompleted, "ShiftCompleted" }, + { AsstMsg::NoNeedToShift, "NoNeedToShift" } }; return os << _type_name.at(type); } - enum UsesOfDrones { + enum UsesOfDrones + { DronesNotUse = 0, DronesTrade = 0x100, DronesTradeMoney = DronesTrade & 0x10, @@ -104,4 +107,4 @@ namespace asst { // const json::value& 消息详情json,每种消息不同,Todo,需要补充个协议文档啥的 // void* 外部调用者自定义参数,每次回调会带出去,建议传个(void*)this指针进来 using AsstCallback = std::function; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/AsstUtils.hpp b/src/MeoAssistance/AsstUtils.hpp index 3e904c8c34..856440dc9a 100644 --- a/src/MeoAssistance/AsstUtils.hpp +++ b/src/MeoAssistance/AsstUtils.hpp @@ -1,12 +1,14 @@ -#pragma once +#pragma once +#include #include #include #include -#include -namespace asst { - namespace utils { +namespace asst +{ + namespace utils + { static std::string get_cur_dir() { static std::string cur_dir; @@ -43,8 +45,7 @@ namespace asst { std::string::size_type pos2 = str.find(delimiter); std::vector result; - while (std::string::npos != pos2) - { + while (std::string::npos != pos2) { result.emplace_back(str.substr(pos1, pos2 - pos1)); pos1 = pos2 + delimiter.size(); @@ -62,8 +63,8 @@ namespace asst { GetLocalTime(&curtime); char buff[64] = { 0 }; sprintf_s(buff, "%04d-%02d-%02d %02d:%02d:%02d.%03d", - curtime.wYear, curtime.wMonth, curtime.wDay, - curtime.wHour, curtime.wMinute, curtime.wSecond, curtime.wMilliseconds); + curtime.wYear, curtime.wMonth, curtime.wDay, + curtime.wHour, curtime.wMinute, curtime.wSecond, curtime.wMilliseconds); return buff; } @@ -79,8 +80,10 @@ namespace asst { memset(str, 0, len + 1); WideCharToMultiByte(CP_UTF8, 0, wstr, -1, str, len, NULL, NULL); std::string strTemp = str; - if (wstr) delete[] wstr; - if (str) delete[] str; + if (wstr) + delete[] wstr; + if (str) + delete[] str; return strTemp; } @@ -96,12 +99,14 @@ namespace asst { memset(szGBK, 0, len + 1); WideCharToMultiByte(CP_ACP, 0, wszGBK, -1, szGBK, len, NULL, NULL); std::string strTemp(szGBK); - if (wszGBK) delete[] wszGBK; - if (szGBK) delete[] szGBK; + if (wszGBK) + delete[] wszGBK; + if (szGBK) + delete[] szGBK; return strTemp; } - template + template constexpr inline RetTy make_rect(const ArgType& rect) { return RetTy{ rect.x, rect.y, rect.width, rect.height }; @@ -123,10 +128,7 @@ namespace asst { constexpr static uchar Bom_1 = 0xBB; constexpr static uchar Bom_2 = 0xBF; - if (str.size() >= 3 - && static_cast(str.at(0)) == Bom_0 - && static_cast(str.at(1)) == Bom_1 - && static_cast(str.at(2)) == Bom_2) { + if (str.size() >= 3 && static_cast(str.at(0)) == Bom_0 && static_cast(str.at(1)) == Bom_1 && static_cast(str.at(2)) == Bom_2) { str.assign(str.begin() + 3, str.end()); return str; } @@ -141,9 +143,7 @@ namespace asst { hash2.insert(hash2.begin(), HammingFlags - hash2.size(), '0'); int dist = 0; for (int i = 0; i < HammingFlags; i = i + 16) { - unsigned long long x - = strtoull(hash1.substr(i, 16).c_str(), NULL, 16) - ^ strtoull(hash2.substr(i, 16).c_str(), NULL, 16); + unsigned long long x = strtoull(hash1.substr(i, 16).c_str(), NULL, 16) ^ strtoull(hash2.substr(i, 16).c_str(), NULL, 16); while (x) { dist++; x = x & (x - 1); @@ -193,4 +193,4 @@ namespace asst { // return str; //} } -} \ No newline at end of file +} diff --git a/src/MeoAssistance/Controller.cpp b/src/MeoAssistance/Controller.cpp index 17a02671eb..8adbd620f0 100644 --- a/src/MeoAssistance/Controller.cpp +++ b/src/MeoAssistance/Controller.cpp @@ -1,13 +1,13 @@ -#include "Controller.h" +#include "Controller.h" -#include #include +#include -#include -#include #include #include #include +#include +#include #include @@ -56,7 +56,7 @@ asst::Controller::~Controller() m_thread_exit = true; //m_thread_idle = true; m_cmd_condvar.notify_all(); - m_completed_id = UINT_MAX; // make all WinMacor::wait to exit + m_completed_id = UINT_MAX; // make all WinMacor::wait to exit if (m_cmd_thread.joinable()) { m_cmd_thread.join(); @@ -75,7 +75,7 @@ Rect asst::Controller::shaped_correct(const Rect& rect) const } // 明日方舟在异形屏上,有的地方是按比例缩放的,有的地方又是直接位移。没法整,这里简单粗暴一点截一个长条 Rect dst = rect; - if (m_scale_size.first != GeneralConfiger::WindowWidthDefault) { // 说明是宽屏 + if (m_scale_size.first != GeneralConfiger::WindowWidthDefault) { // 说明是宽屏 dst.x = 0; dst.width = m_scale_size.first - 1; } @@ -93,7 +93,7 @@ void asst::Controller::pipe_working_proc() while (!m_thread_exit) { std::unique_lock cmd_queue_lock(m_cmd_queue_mutex); - if (!m_cmd_queue.empty()) { // 队列中有任务就执行任务 + if (!m_cmd_queue.empty()) { // 队列中有任务就执行任务 std::string cmd = m_cmd_queue.front(); m_cmd_queue.pop(); cmd_queue_lock.unlock(); @@ -127,8 +127,8 @@ bool Controller::try_capture(const EmulatorInfo& info, bool without_handle) const HandleInfo& handle_info = info.handle; std::string adb_dir; - if (!without_handle) { // 使用模拟器自带的adb - // 转成宽字符的 + if (!without_handle) { // 使用模拟器自带的adb +// 转成宽字符的 wchar_t* class_wbuff = nullptr; if (!handle_info.class_name.empty()) { size_t class_len = (handle_info.class_name.size() + 1) * 2; @@ -194,7 +194,7 @@ bool Controller::try_capture(const EmulatorInfo& info, bool without_handle) adb_dir = '"' + utils::string_replace_all(m_emulator_info.adb.path, "[EmulatorPath]", adb_dir) + '"'; adb_dir = utils::string_replace_all(adb_dir, "[ExecDir]", utils::get_cur_dir()); } - else { // 使用辅助自带的标准adb + else { // 使用辅助自带的标准adb m_emulator_info = info; adb_dir = '"' + utils::string_replace_all(m_emulator_info.adb.path, "[ExecDir]", utils::get_cur_dir()) + '"'; } @@ -249,15 +249,13 @@ bool Controller::try_capture(const EmulatorInfo& info, bool without_handle) static_cast(GeneralConfiger::WindowWidthDefault) / static_cast(GeneralConfiger::WindowHeightDefault); double cur_ratio = static_cast(m_emulator_info.adb.display_width) / static_cast(m_emulator_info.adb.display_height); - if (cur_ratio >= DefaultRatio // 说明是宽屏或默认16:9,按照高度计算缩放 - || std::fabs(cur_ratio - DefaultRatio) < DoubleDiff) - { + if (cur_ratio >= DefaultRatio // 说明是宽屏或默认16:9,按照高度计算缩放 + || std::fabs(cur_ratio - DefaultRatio) < DoubleDiff) { int scale_width = cur_ratio * GeneralConfiger::WindowHeightDefault; m_scale_size = std::make_pair(scale_width, GeneralConfiger::WindowHeightDefault); m_control_scale = static_cast(m_emulator_info.adb.display_height) / static_cast(GeneralConfiger::WindowHeightDefault); } - else - { // 否则可能是偏正方形的屏幕,按宽度计算 + else { // 否则可能是偏正方形的屏幕,按宽度计算 int scale_height = GeneralConfiger::WindowWidthDefault / cur_ratio; m_scale_size = std::make_pair(GeneralConfiger::WindowWidthDefault, scale_height); m_control_scale = static_cast(m_emulator_info.adb.display_width) / static_cast(GeneralConfiger::WindowWidthDefault); @@ -290,7 +288,7 @@ std::pair> Controller::call_command(const std:: static std::mutex pipe_mutex; std::unique_lock pipe_lock(pipe_mutex); - PROCESS_INFORMATION process_info = { 0 }; // 进程信息结构体 + PROCESS_INFORMATION process_info = { 0 }; // 进程信息结构体 ::CreateProcessA(NULL, const_cast(cmd.c_str()), NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, &m_child_startup_info, &process_info); std::vector pipe_data; @@ -447,8 +445,7 @@ int Controller::click(const Rect& rect, bool block) int asst::Controller::click_without_scale(const Point& p, bool block) { - if (p.x < 0 || p.x >= m_emulator_info.adb.display_width - || p.y < 0 || p.y >= m_emulator_info.adb.display_height) { + if (p.x < 0 || p.x >= m_emulator_info.adb.display_width || p.y < 0 || p.y >= m_emulator_info.adb.display_height) { log.error("click point out of range"); } std::string cur_cmd = utils::string_replace_all(m_emulator_info.adb.click, "[x]", std::to_string(p.x)); @@ -483,10 +480,7 @@ int asst::Controller::swipe(const Rect& r1, const Rect& r2, int duration, bool b int asst::Controller::swipe_without_scale(const Point& p1, const Point& p2, int duration, bool block, int extra_delay, bool extra_swipe) { - if (p1.x < 0 || p1.x >= m_emulator_info.adb.display_width - || p1.y < 0 || p1.y >= m_emulator_info.adb.display_height - || p2.x < 0 || p2.x >= m_emulator_info.adb.display_width - || p2.y < 0 || p2.y >= m_emulator_info.adb.display_height) { + if (p1.x < 0 || p1.x >= m_emulator_info.adb.display_width || p1.y < 0 || p1.y >= m_emulator_info.adb.display_height || p2.x < 0 || p2.x >= m_emulator_info.adb.display_width || p2.y < 0 || p2.y >= m_emulator_info.adb.display_height) { log.error("swipe point out of range"); } std::string cur_cmd = utils::string_replace_all(m_emulator_info.adb.swipe, "[x1]", std::to_string(p1.x)); @@ -502,7 +496,7 @@ int asst::Controller::swipe_without_scale(const Point& p1, const Point& p2, int int id = 0; - int extra_swipe_dist = resource.cfg().get_options().adb_extra_swipe_dist/* * m_control_scale*/; + int extra_swipe_dist = resource.cfg().get_options().adb_extra_swipe_dist /* * m_control_scale*/; int extra_swipe_duration = resource.cfg().get_options().adb_extra_swipe_duration; // 额外的滑动:adb有bug,同样的参数,偶尔会划得非常远。额外做一个短程滑动,把之前的停下来 @@ -567,4 +561,4 @@ cv::Mat asst::Controller::get_image(bool raw) cv::resize(m_cache_image, resize_mat, size, cv::INPAINT_NS); return resize_mat; } -} \ No newline at end of file +} diff --git a/src/MeoAssistance/Controller.h b/src/MeoAssistance/Controller.h index 72b7cffd2d..1adcaf5766 100644 --- a/src/MeoAssistance/Controller.h +++ b/src/MeoAssistance/Controller.h @@ -1,15 +1,15 @@ -#pragma once +#pragma once -#include -#include #include +#include +#include -#include // for pimpl -#include -#include -#include -#include #include +#include // for pimpl +#include +#include +#include +#include #include @@ -17,7 +17,8 @@ #include "AsstDef.h" -namespace asst { +namespace asst +{ class Controller { public: @@ -25,7 +26,8 @@ namespace asst { Controller(Controller&&) = delete; ~Controller(); - static Controller& get_instance() { + static Controller& get_instance() + { static Controller unique_instance; return unique_instance; } @@ -52,6 +54,7 @@ namespace asst { Controller& operator=(const Controller&) = delete; Controller& operator=(Controller&&) = delete; + private: Controller(); @@ -71,19 +74,19 @@ namespace asst { std::condition_variable m_cmd_condvar; std::queue m_cmd_queue; std::atomic m_completed_id = 0; - unsigned m_push_id = 0; // push_id的自增总是伴随着queue的push,肯定是要上锁的,所以没必要原子 + unsigned m_push_id = 0; // push_id的自增总是伴随着queue的push,肯定是要上锁的,所以没必要原子 //std::shared_mutex m_image_mutex; cv::Mat m_cache_image; bool m_image_convert_lf = false; - constexpr static int PipeBuffSize = 1048576; // 管道缓冲区大小 - HANDLE m_pipe_read = nullptr; // 读管道句柄 - HANDLE m_pipe_write = nullptr; // 写管道句柄 - HANDLE m_pipe_child_read = nullptr; // 子进程的读管道句柄 - HANDLE m_pipe_child_write = nullptr; // 子进程的写管道句柄 - SECURITY_ATTRIBUTES m_pipe_sec_attr = { 0 }; // 管道安全描述符 - STARTUPINFOA m_child_startup_info = { 0 }; // 子进程启动信息 + constexpr static int PipeBuffSize = 1048576; // 管道缓冲区大小 + HANDLE m_pipe_read = nullptr; // 读管道句柄 + HANDLE m_pipe_write = nullptr; // 写管道句柄 + HANDLE m_pipe_child_read = nullptr; // 子进程的读管道句柄 + HANDLE m_pipe_child_write = nullptr; // 子进程的写管道句柄 + SECURITY_ATTRIBUTES m_pipe_sec_attr = { 0 }; // 管道安全描述符 + STARTUPINFOA m_child_startup_info = { 0 }; // 子进程启动信息 EmulatorInfo m_emulator_info; HWND m_handle = nullptr; diff --git a/src/MeoAssistance/CreditShopImageAnalyzer.cpp b/src/MeoAssistance/CreditShopImageAnalyzer.cpp index 795115e998..5eb8b70fcf 100644 --- a/src/MeoAssistance/CreditShopImageAnalyzer.cpp +++ b/src/MeoAssistance/CreditShopImageAnalyzer.cpp @@ -1,8 +1,8 @@ -#include "CreditShopImageAnalyzer.h" +#include "CreditShopImageAnalyzer.h" +#include "MatchImageAnalyzer.h" #include "MultiMatchImageAnalyzer.h" #include "OcrImageAnalyzer.h" -#include "MatchImageAnalyzer.h" #include "Resource.h" #include "AsstUtils.hpp" @@ -13,9 +13,7 @@ bool asst::CreditShopImageAnalyzer::analyze() m_need_to_buy.clear(); m_result.clear(); - return commoditys_analyze() - && whether_to_buy_analyze() - && sold_out_analyze(); + return commoditys_analyze() && whether_to_buy_analyze() && sold_out_analyze(); } bool asst::CreditShopImageAnalyzer::commoditys_analyze() @@ -71,7 +69,7 @@ bool asst::CreditShopImageAnalyzer::whether_to_buy_analyze() } const auto& ocr_res = ocr_analyzer.get_result(); -#ifdef LOG_TRACE +#ifdef LOG_TRACE cv::rectangle(m_image_draw, utils::make_rect(commodity), cv::Scalar(0, 0, 255), 2); #endif m_need_to_buy.emplace_back(commodity); @@ -94,7 +92,7 @@ bool asst::CreditShopImageAnalyzer::sold_out_analyze() for (const Rect& commodity : m_need_to_buy) { sold_out_analyzer.set_roi(commodity); if (sold_out_analyzer.analyze()) { -#ifdef LOG_TRACE +#ifdef LOG_TRACE cv::rectangle(m_image_draw, utils::make_rect(commodity), cv::Scalar(0, 0, 255)); cv::putText(m_image_draw, "Sold Out", cv::Point(commodity.x, commodity.y), 1, 2, cv::Scalar(255, 0, 0)); #endif // LOG_TRACE @@ -106,4 +104,4 @@ bool asst::CreditShopImageAnalyzer::sold_out_analyze() } return !m_result.empty(); -} \ No newline at end of file +} diff --git a/src/MeoAssistance/CreditShopImageAnalyzer.h b/src/MeoAssistance/CreditShopImageAnalyzer.h index 250475c136..bc1c463817 100644 --- a/src/MeoAssistance/CreditShopImageAnalyzer.h +++ b/src/MeoAssistance/CreditShopImageAnalyzer.h @@ -1,7 +1,8 @@ -#pragma once +#pragma once #include "AbstractImageAnalyzer.h" -namespace asst { +namespace asst +{ class CreditShopImageAnalyzer final : public AbstractImageAnalyzer { public: @@ -11,15 +12,19 @@ namespace asst { virtual bool analyze() override; - const std::vector& get_result() const noexcept { + const std::vector& get_result() const noexcept + { return m_result; } + private: // 该分析器不支持外部设置ROI - virtual void set_roi(const Rect& roi) noexcept override { + virtual void set_roi(const Rect& roi) noexcept override + { AbstractImageAnalyzer::set_roi(roi); } - virtual void set_image(const cv::Mat& image, const Rect& roi) { + virtual void set_image(const cv::Mat& image, const Rect& roi) + { AbstractImageAnalyzer::set_image(image, roi); } bool commoditys_analyze(); diff --git a/src/MeoAssistance/CreditShoppingTask.cpp b/src/MeoAssistance/CreditShoppingTask.cpp index 945458875a..6091419bd2 100644 --- a/src/MeoAssistance/CreditShoppingTask.cpp +++ b/src/MeoAssistance/CreditShoppingTask.cpp @@ -1,7 +1,7 @@ -#include "CreditShoppingTask.h" +#include "CreditShoppingTask.h" -#include #include +#include #include @@ -14,8 +14,8 @@ bool asst::CreditShoppingTask::run() { json::value task_start_json = json::object{ - { "task_type", "CreditShoppingTask" }, - { "task_chain", m_task_chain} + { "task_type", "CreditShoppingTask" }, + { "task_chain", m_task_chain } }; m_callback(AsstMsg::TaskStart, task_start_json, m_callback_arg); @@ -83,4 +83,4 @@ bool asst::CreditShoppingTask::run() } return true; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/CreditShoppingTask.h b/src/MeoAssistance/CreditShoppingTask.h index 0c8b2396a4..95ff695bc7 100644 --- a/src/MeoAssistance/CreditShoppingTask.h +++ b/src/MeoAssistance/CreditShoppingTask.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "AbstractTask.h" @@ -6,13 +6,15 @@ #include "AsstDef.h" -namespace asst { +namespace asst +{ class CreditShoppingTask : public AbstractTask { public: using AbstractTask::AbstractTask; virtual ~CreditShoppingTask() = default; virtual bool run() override; + private: }; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/GeneralConfiger.cpp b/src/MeoAssistance/GeneralConfiger.cpp index 856bff6851..18bc364180 100644 --- a/src/MeoAssistance/GeneralConfiger.cpp +++ b/src/MeoAssistance/GeneralConfiger.cpp @@ -1,4 +1,4 @@ -#include "GeneralConfiger.h" +#include "GeneralConfiger.h" #include @@ -53,4 +53,4 @@ bool asst::GeneralConfiger::parse(const json::value& json) } return true; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/GeneralConfiger.h b/src/MeoAssistance/GeneralConfiger.h index 9e42d7ee88..5816f0c537 100644 --- a/src/MeoAssistance/GeneralConfiger.h +++ b/src/MeoAssistance/GeneralConfiger.h @@ -1,34 +1,37 @@ -#pragma once +#pragma once #include "AbstractConfiger.h" +#include #include #include -#include #include "AsstDef.h" -namespace asst { - enum class ConnectType { +namespace asst +{ + enum class ConnectType + { Emulator, USB, Remote }; - struct Options { - ConnectType connect_type; // 连接类型 - std::string connect_remote_address; // 连接局域网中的安卓设备的地址,仅在connectType为Remote时生效 - int task_delay = 0; // 任务间延时:越快操作越快,但会增加CPU消耗 - int control_delay_lower = 0; // 点击随机延时下限:每次点击操作会进行随机延时 - int control_delay_upper = 0; // 点击随机延时上限:每次点击操作会进行随机延时 - bool print_window = false; // 截图功能:开启后每次结算界面会截图到screenshot目录下 - bool penguin_report = false; // 企鹅数据汇报:每次到结算界面,是否汇报掉落数据至企鹅数据 https://penguin-stats.cn/ - std::string penguin_report_cmd_line;// 企鹅数据汇报的命令 - std::string penguin_report_server; // 企鹅数据汇报接口"server"字段,"CN", "US", "JP" and "KR". - int ocr_gpu_index = -1; // OcrLite使用GPU编号,-1(使用CPU)/0(使用GPU0)/1(使用GPU1)/... - int ocr_thread_number = 0; // OcrLite线程数量 - int adb_extra_swipe_dist = 0; // 额外的滑动距离:adb有bug,同样的参数,偶尔会划得非常远。额外做一个短程滑动,把之前的停下来 - int adb_extra_swipe_duration = -1; // 额外的滑动持续时间:adb有bug,同样的参数,偶尔会划得非常远。额外做一个短程滑动,把之前的停下来。若小于0,则关闭额外滑动功能 + struct Options + { + ConnectType connect_type; // 连接类型 + std::string connect_remote_address; // 连接局域网中的安卓设备的地址,仅在connectType为Remote时生效 + int task_delay = 0; // 任务间延时:越快操作越快,但会增加CPU消耗 + int control_delay_lower = 0; // 点击随机延时下限:每次点击操作会进行随机延时 + int control_delay_upper = 0; // 点击随机延时上限:每次点击操作会进行随机延时 + bool print_window = false; // 截图功能:开启后每次结算界面会截图到screenshot目录下 + bool penguin_report = false; // 企鹅数据汇报:每次到结算界面,是否汇报掉落数据至企鹅数据 https://penguin-stats.cn/ + std::string penguin_report_cmd_line; // 企鹅数据汇报的命令 + std::string penguin_report_server; // 企鹅数据汇报接口"server"字段,"CN", "US", "JP" and "KR". + int ocr_gpu_index = -1; // OcrLite使用GPU编号,-1(使用CPU)/0(使用GPU0)/1(使用GPU1)/... + int ocr_thread_number = 0; // OcrLite线程数量 + int adb_extra_swipe_dist = 0; // 额外的滑动距离:adb有bug,同样的参数,偶尔会划得非常远。额外做一个短程滑动,把之前的停下来 + int adb_extra_swipe_duration = -1; // 额外的滑动持续时间:adb有bug,同样的参数,偶尔会划得非常远。额外做一个短程滑动,把之前的停下来。若小于0,则关闭额外滑动功能 }; class GeneralConfiger : public AbstractConfiger diff --git a/src/MeoAssistance/InfrastAbstractTask.cpp b/src/MeoAssistance/InfrastAbstractTask.cpp index ac7c5d6013..d985c77e17 100644 --- a/src/MeoAssistance/InfrastAbstractTask.cpp +++ b/src/MeoAssistance/InfrastAbstractTask.cpp @@ -1,18 +1,17 @@ -#include "InfrastAbstractTask.h" +#include "InfrastAbstractTask.h" +#include "AsstMsg.h" +#include "Controller.h" +#include "InfrastFacilityImageAnalyzer.h" +#include "Logger.hpp" #include "MatchImageAnalyzer.h" #include "OcrImageAnalyzer.h" -#include "InfrastFacilityImageAnalyzer.h" -#include "Controller.h" #include "Resource.h" -#include "Logger.hpp" -#include "AsstMsg.h" void asst::InfrastAbstractTask::set_work_mode(InfrastWorkMode work_mode) noexcept { m_work_mode = work_mode; - switch (work_mode) - { + switch (work_mode) { case InfrastWorkMode::Gentle: m_work_mode_name = "Gentle"; break; @@ -32,8 +31,8 @@ bool asst::InfrastAbstractTask::enter_facility(const std::string& facility, int { LogTraceFunction; json::value enter_json = json::object{ - { "facility", facility }, - { "index", index} + { "facility", facility }, + { "index", index } }; m_callback(AsstMsg::EnterFacility, enter_json, m_callback_arg); @@ -215,4 +214,4 @@ void asst::InfrastAbstractTask::swipe_to_the_right_of_main_ui() static int extra_delay = resource.task().task_ptr("InfrastOperListSwipeToTheLeftBegin")->rear_delay; ctrler.swipe(begin_rect, end_rect, duration, true, extra_delay, false); -} \ No newline at end of file +} diff --git a/src/MeoAssistance/InfrastAbstractTask.h b/src/MeoAssistance/InfrastAbstractTask.h index 92413a57b6..8cb990ece0 100644 --- a/src/MeoAssistance/InfrastAbstractTask.h +++ b/src/MeoAssistance/InfrastAbstractTask.h @@ -1,31 +1,33 @@ -#pragma once +#pragma once #include "AbstractTask.h" #include "AsstDef.h" -namespace asst { +namespace asst +{ class InfrastAbstractTask : public AbstractTask { public: using AbstractTask::AbstractTask; virtual ~InfrastAbstractTask() = default; virtual void set_work_mode(InfrastWorkMode work_mode) noexcept; + protected: virtual bool enter_facility(const std::string& facility, int index = 0); - virtual bool enter_oper_list_page(); // 从刚点进基建的界面,到干员列表页 + virtual bool enter_oper_list_page(); // 从刚点进基建的界面,到干员列表页 - virtual void swipe_to_the_left_of_operlist(); // 滑动到干员列表的最左侧 - virtual void swipe_to_the_left_of_main_ui(); // 滑动基建的主界面到最左侧 - virtual void swipe_to_the_right_of_main_ui(); // 滑动基建的主界面到最右侧 + virtual void swipe_to_the_left_of_operlist(); // 滑动到干员列表的最左侧 + virtual void swipe_to_the_left_of_main_ui(); // 滑动基建的主界面到最左侧 + virtual void swipe_to_the_right_of_main_ui(); // 滑动基建的主界面到最右侧 virtual void sync_swipe_of_operlist(bool reverse = false); virtual void async_swipe_of_operlist(bool reverse = false); virtual void await_swipe(); - virtual bool click_bottomleft_tab(); // 点击进入设施后,左下角的tab(我也不知道这玩意该叫啥) - virtual bool click_clear_button(); // 点击干员选择页面的“清空选择”按钮 - virtual bool click_confirm_button(); // 点击干员选择页面的“确认”按钮 + virtual bool click_bottomleft_tab(); // 点击进入设施后,左下角的tab(我也不知道这玩意该叫啥) + virtual bool click_clear_button(); // 点击干员选择页面的“清空选择”按钮 + virtual bool click_confirm_button(); // 点击干员选择页面的“确认”按钮 int m_last_swipe_id = 0; InfrastWorkMode m_work_mode = InfrastWorkMode::Gentle; std::string m_work_mode_name = "Gentle"; }; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/InfrastClueImageAnalyzer.cpp b/src/MeoAssistance/InfrastClueImageAnalyzer.cpp index 7f241cabe3..9c09c7abff 100644 --- a/src/MeoAssistance/InfrastClueImageAnalyzer.cpp +++ b/src/MeoAssistance/InfrastClueImageAnalyzer.cpp @@ -1,4 +1,4 @@ -#include "InfrastClueImageAnalyzer.h" +#include "InfrastClueImageAnalyzer.h" #include "MultiMatchImageAnalyzer.h" #include "Resource.h" @@ -19,7 +19,7 @@ bool asst::InfrastClueImageAnalyzer::clue_detect() const auto task_ptr = std::dynamic_pointer_cast( resource.task().task_ptr("InfrastClue")); clue_analyzer.set_task_info(*task_ptr); - clue_analyzer.set_roi(m_roi); // 改任务以外部设置的roi为准 + clue_analyzer.set_roi(m_roi); // 改任务以外部设置的roi为准 if (!clue_analyzer.analyze()) { return false; } @@ -35,4 +35,4 @@ bool asst::InfrastClueImageAnalyzer::clue_analyze() { // todo return false; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/InfrastClueImageAnalyzer.h b/src/MeoAssistance/InfrastClueImageAnalyzer.h index 7283d2d0f4..46ffb8b9c2 100644 --- a/src/MeoAssistance/InfrastClueImageAnalyzer.h +++ b/src/MeoAssistance/InfrastClueImageAnalyzer.h @@ -1,7 +1,8 @@ -#pragma once +#pragma once #include "AbstractImageAnalyzer.h" -namespace asst { +namespace asst +{ class InfrastClueImageAnalyzer : public AbstractImageAnalyzer { public: @@ -10,14 +11,16 @@ namespace asst { virtual bool analyze() override; - const std::vector>& get_result() const noexcept { + const std::vector>& get_result() const noexcept + { return m_result; } + protected: bool clue_detect(); bool clue_analyze(); - bool m_need_detailed = false; // 是否需要详细分析(线索号);false时只检测,不识别 + bool m_need_detailed = false; // 是否需要详细分析(线索号);false时只检测,不识别 std::vector> m_result; }; } diff --git a/src/MeoAssistance/InfrastClueVacancyImageAnalyzer.cpp b/src/MeoAssistance/InfrastClueVacancyImageAnalyzer.cpp index 9d4eb2cace..1339e0ba3d 100644 --- a/src/MeoAssistance/InfrastClueVacancyImageAnalyzer.cpp +++ b/src/MeoAssistance/InfrastClueVacancyImageAnalyzer.cpp @@ -1,9 +1,9 @@ -#include "InfrastClueVacancyImageAnalyzer.h" +#include "InfrastClueVacancyImageAnalyzer.h" -#include "MatchImageAnalyzer.h" -#include "Resource.h" #include "AsstUtils.hpp" #include "Logger.hpp" +#include "MatchImageAnalyzer.h" +#include "Resource.h" bool asst::InfrastClueVacancyImageAnalyzer::analyze() { @@ -28,4 +28,4 @@ bool asst::InfrastClueVacancyImageAnalyzer::analyze() } return !m_clue_vacancy.empty(); -} \ No newline at end of file +} diff --git a/src/MeoAssistance/InfrastClueVacancyImageAnalyzer.h b/src/MeoAssistance/InfrastClueVacancyImageAnalyzer.h index ad21c8683c..eb17d6bcb2 100644 --- a/src/MeoAssistance/InfrastClueVacancyImageAnalyzer.h +++ b/src/MeoAssistance/InfrastClueVacancyImageAnalyzer.h @@ -1,7 +1,8 @@ -#pragma once +#pragma once #include "AbstractImageAnalyzer.h" -namespace asst { +namespace asst +{ class InfrastClueVacancyImageAnalyzer final : public AbstractImageAnalyzer { public: @@ -12,19 +13,24 @@ namespace asst { virtual bool analyze() override; constexpr static int MaxNumOfClue = 7; - void set_to_be_analyzed(std::vector to_be_analyzed) noexcept { + void set_to_be_analyzed(std::vector to_be_analyzed) noexcept + { m_to_be_analyzed = std::move(to_be_analyzed); } - const std::unordered_map& get_vacancy() const noexcept { + const std::unordered_map& get_vacancy() const noexcept + { return m_clue_vacancy; } + private: // 该分析器不支持外部设置ROI - virtual void set_roi(const Rect& roi) noexcept override { + virtual void set_roi(const Rect& roi) noexcept override + { AbstractImageAnalyzer::set_roi(roi); } - virtual void set_image(const cv::Mat& image, const Rect& roi) { + virtual void set_image(const cv::Mat& image, const Rect& roi) + { AbstractImageAnalyzer::set_image(image, roi); } diff --git a/src/MeoAssistance/InfrastConfiger.cpp b/src/MeoAssistance/InfrastConfiger.cpp index 6a26c237ab..ad2ee72662 100644 --- a/src/MeoAssistance/InfrastConfiger.cpp +++ b/src/MeoAssistance/InfrastConfiger.cpp @@ -1,4 +1,4 @@ -#include "InfrastConfiger.h" +#include "InfrastConfiger.h" #include @@ -53,8 +53,7 @@ bool asst::InfrastConfiger::parse(const json::value& json) else { for (const std::string& pd : products) { if (std::string pd_reg_key = pd + reg_suffix; - efficient.exist(pd_reg_key)) - { + efficient.exist(pd_reg_key)) { skill.efficient_regex.emplace(pd, efficient.at(pd_reg_key).as_string()); skill.efficient.emplace(pd, 0); } @@ -116,8 +115,7 @@ bool asst::InfrastConfiger::parse(const json::value& json) else { for (const std::string& pd : products) { if (std::string pd_reg_key = pd + reg_suffix; - efficient.exist(pd_reg_key)) - { + efficient.exist(pd_reg_key)) { comb.efficient_regex.emplace(pd, efficient.at(pd_reg_key).as_string()); comb.efficient.emplace(pd, 0); } @@ -166,8 +164,7 @@ bool asst::InfrastConfiger::parse(const json::value& json) else { for (const std::string& pd : products) { if (std::string pd_reg_key = pd + reg_suffix; - efficient.exist(pd_reg_key)) - { + efficient.exist(pd_reg_key)) { comb.efficient_regex.emplace(pd, efficient.at(pd_reg_key).as_string()); comb.efficient.emplace(pd, 0); } @@ -199,4 +196,4 @@ bool asst::InfrastConfiger::parse(const json::value& json) m_facilities_info.emplace(facility_name, std::move(fac_info)); } return true; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/InfrastConfiger.h b/src/MeoAssistance/InfrastConfiger.h index e226437453..e1d08118a7 100644 --- a/src/MeoAssistance/InfrastConfiger.h +++ b/src/MeoAssistance/InfrastConfiger.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "AbstractConfiger.h" #include @@ -6,13 +6,15 @@ #include "AsstDef.h" -namespace asst { +namespace asst +{ class InfrastConfiger : public AbstractConfiger { public: virtual ~InfrastConfiger() = default; - const std::unordered_set& get_templ_required() const noexcept { + const std::unordered_set& get_templ_required() const noexcept + { return m_templ_required; } const std::unordered_map& @@ -20,13 +22,16 @@ namespace asst { { return m_skills.at(facility_name); } - const std::vector& get_skills_group(const std::string& facility) const { + const std::vector& get_skills_group(const std::string& facility) const + { return m_skills_groups.at(facility); } - const InfrastFacilityInfo& get_facility_info(const std::string& facility) const { + const InfrastFacilityInfo& get_facility_info(const std::string& facility) const + { return m_facilities_info.at(facility); } - const std::unordered_map& get_facility_info() const noexcept { + const std::unordered_map& get_facility_info() const noexcept + { return m_facilities_info; } diff --git a/src/MeoAssistance/InfrastDormTask.cpp b/src/MeoAssistance/InfrastDormTask.cpp index 219eb69f7b..024c954f61 100644 --- a/src/MeoAssistance/InfrastDormTask.cpp +++ b/src/MeoAssistance/InfrastDormTask.cpp @@ -1,19 +1,19 @@ -#include "InfrastDormTask.h" +#include "InfrastDormTask.h" +#include "Controller.h" +#include "InfrastMoodImageAnalyzer.h" +#include "Logger.hpp" #include "MatchImageAnalyzer.h" #include "OcrImageAnalyzer.h" -#include "InfrastMoodImageAnalyzer.h" #include "Resource.h" -#include "Controller.h" -#include "Logger.hpp" const std::string asst::InfrastDormTask::FacilityName = "Dorm"; bool asst::InfrastDormTask::run() { json::value task_start_json = json::object{ - { "task_type", "InfrastDormTask" }, - { "task_chain", m_task_chain} + { "task_type", "InfrastDormTask" }, + { "task_chain", m_task_chain } }; m_callback(AsstMsg::TaskStart, task_start_json, m_callback_arg); @@ -51,8 +51,7 @@ bool asst::InfrastDormTask::run() log.trace("quantity_selected:", quantity_selected, ", just break"); break; } - switch (mood_info.smiley.type) - { + switch (mood_info.smiley.type) { case InfrastSmileyType::Rest: // 如果当前页面休息完成的人数超过5个,说明已经已经把所有心情不满的滑过一遍、没有更多的了,直接退出即可 if (++quantity_resting > MaxNumOfOpers) { @@ -64,10 +63,7 @@ bool asst::InfrastDormTask::run() case InfrastSmileyType::Work: case InfrastSmileyType::Distract: // 干员没有被选择的情况下,心情小于30%,或不在工作,就进驻宿舍 - if (mood_info.selected == false - && (mood_info.percentage < m_mood_threshold - || mood_info.working == false)) - { + if (mood_info.selected == false && (mood_info.percentage < m_mood_threshold || mood_info.working == false)) { ctrler.click(mood_info.rect); if (++quantity_selected >= MaxNumOfOpers) { log.trace("quantity_selected:", quantity_selected, ", just break"); @@ -127,4 +123,4 @@ bool asst::InfrastDormTask::click_confirm_button() sleep(sec_cfm_task_ptr->rear_delay); } return false; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/InfrastDormTask.h b/src/MeoAssistance/InfrastDormTask.h index 7d0098168a..929b82c5bf 100644 --- a/src/MeoAssistance/InfrastDormTask.h +++ b/src/MeoAssistance/InfrastDormTask.h @@ -1,7 +1,8 @@ -#pragma once +#pragma once #include "InfrastAbstractTask.h" -namespace asst { +namespace asst +{ class InfrastDormTask : public InfrastAbstractTask { public: @@ -9,12 +10,14 @@ namespace asst { virtual ~InfrastDormTask() = default; virtual bool run() override; - void set_mood_threshold(double mood_threshold) noexcept { + void set_mood_threshold(double mood_threshold) noexcept + { m_mood_threshold = mood_threshold; } const static std::string FacilityName; const static int MaxNumOfOpers = 5; + private: virtual bool click_confirm_button() override; diff --git a/src/MeoAssistance/InfrastFacilityImageAnalyzer.cpp b/src/MeoAssistance/InfrastFacilityImageAnalyzer.cpp index a16e6d4a22..22be5df570 100644 --- a/src/MeoAssistance/InfrastFacilityImageAnalyzer.cpp +++ b/src/MeoAssistance/InfrastFacilityImageAnalyzer.cpp @@ -1,9 +1,9 @@ -#include "InfrastFacilityImageAnalyzer.h" +#include "InfrastFacilityImageAnalyzer.h" -#include "Resource.h" -#include "MultiMatchImageAnalyzer.h" #include "AsstUtils.hpp" #include "Logger.hpp" +#include "MultiMatchImageAnalyzer.h" +#include "Resource.h" bool asst::InfrastFacilityImageAnalyzer::analyze() { @@ -59,9 +59,9 @@ bool asst::InfrastFacilityImageAnalyzer::analyze() const auto& cur_res = mm_analyzer.get_result(); auto cur_max_iter = std::max_element(cur_res.cbegin(), cur_res.cend(), - [](const MatchRect& lhs, const MatchRect& rhs) -> bool { - return lhs.score < rhs.score; - }); + [](const MatchRect& lhs, const MatchRect& rhs) -> bool { + return lhs.score < rhs.score; + }); if (cur_max_iter == cur_res.cend()) { continue; } @@ -92,4 +92,4 @@ bool asst::InfrastFacilityImageAnalyzer::analyze() } return !m_result.empty(); -} \ No newline at end of file +} diff --git a/src/MeoAssistance/InfrastFacilityImageAnalyzer.h b/src/MeoAssistance/InfrastFacilityImageAnalyzer.h index 5c90a86c2e..180e8d88aa 100644 --- a/src/MeoAssistance/InfrastFacilityImageAnalyzer.h +++ b/src/MeoAssistance/InfrastFacilityImageAnalyzer.h @@ -1,7 +1,8 @@ -#pragma once +#pragma once #include "AbstractImageAnalyzer.h" -namespace asst { +namespace asst +{ class InfrastFacilityImageAnalyzer final : public AbstractImageAnalyzer { public: @@ -11,11 +12,13 @@ namespace asst { virtual bool analyze() override; - void set_to_be_analyzed(std::vector facilities) noexcept { + void set_to_be_analyzed(std::vector facilities) noexcept + { m_to_be_analyzed = std::move(facilities); } - int get_quantity(const std::string& name) const { + int get_quantity(const std::string& name) const + { if (auto iter = m_result.find(name); iter == m_result.cend()) { return 0; @@ -24,7 +27,8 @@ namespace asst { return iter->second.size(); } } - Rect get_rect(const std::string& name, int index) const { + Rect get_rect(const std::string& name, int index) const + { if (auto iter = m_result.find(name); iter == m_result.cend()) { return Rect(); @@ -38,15 +42,19 @@ namespace asst { } } } - const std::unordered_map>& get_result() const noexcept { + const std::unordered_map>& get_result() const noexcept + { return m_result; } + private: // 该分析器不支持外部设置ROI - virtual void set_roi(const Rect& roi) noexcept override { + virtual void set_roi(const Rect& roi) noexcept override + { AbstractImageAnalyzer::set_roi(roi); } - virtual void set_image(const cv::Mat& image, const Rect& roi) { + virtual void set_image(const cv::Mat& image, const Rect& roi) + { AbstractImageAnalyzer::set_image(image, roi); } diff --git a/src/MeoAssistance/InfrastInfoTask.cpp b/src/MeoAssistance/InfrastInfoTask.cpp index 781089288d..ab3b2df82a 100644 --- a/src/MeoAssistance/InfrastInfoTask.cpp +++ b/src/MeoAssistance/InfrastInfoTask.cpp @@ -1,16 +1,16 @@ -#include "InfrastInfoTask.h" +#include "InfrastInfoTask.h" #include "Controller.h" -#include "RuntimeStatus.h" -#include "Resource.h" #include "InfrastFacilityImageAnalyzer.h" #include "Logger.hpp" +#include "Resource.h" +#include "RuntimeStatus.h" bool asst::InfrastInfoTask::run() { json::value task_start_json = json::object{ - { "task_type", "InfrastInfoTask" }, - { "task_chain", m_task_chain} + { "task_type", "InfrastInfoTask" }, + { "task_chain", m_task_chain } }; m_callback(AsstMsg::TaskStart, task_start_json, m_callback_arg); @@ -29,4 +29,4 @@ bool asst::InfrastInfoTask::run() } return true; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/InfrastInfoTask.h b/src/MeoAssistance/InfrastInfoTask.h index a3ba4ea1da..066bd489ef 100644 --- a/src/MeoAssistance/InfrastInfoTask.h +++ b/src/MeoAssistance/InfrastInfoTask.h @@ -1,7 +1,8 @@ -#pragma once +#pragma once #include "InfrastAbstractTask.h" -namespace asst { +namespace asst +{ class InfrastInfoTask : public InfrastAbstractTask { public: @@ -10,4 +11,4 @@ namespace asst { virtual bool run() override; }; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/InfrastMfgTask.cpp b/src/MeoAssistance/InfrastMfgTask.cpp index 56c8daebf5..c2b292fc54 100644 --- a/src/MeoAssistance/InfrastMfgTask.cpp +++ b/src/MeoAssistance/InfrastMfgTask.cpp @@ -1,16 +1,16 @@ -#include "InfrastMfgTask.h" +#include "InfrastMfgTask.h" -#include "Resource.h" #include "Controller.h" #include "MatchImageAnalyzer.h" +#include "Resource.h" const std::string asst::InfrastMfgTask::FacilityName = "Mfg"; bool asst::InfrastMfgTask::run() { json::value task_start_json = json::object{ - { "task_type", "InfrastMfgTask" }, - { "task_chain", m_task_chain} + { "task_type", "InfrastMfgTask" }, + { "task_chain", m_task_chain } }; m_callback(AsstMsg::TaskStart, task_start_json, m_callback_arg); @@ -24,4 +24,4 @@ bool asst::InfrastMfgTask::run() shift_facility_list(); return true; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/InfrastMfgTask.h b/src/MeoAssistance/InfrastMfgTask.h index 14930a11d7..ea826dd084 100644 --- a/src/MeoAssistance/InfrastMfgTask.h +++ b/src/MeoAssistance/InfrastMfgTask.h @@ -1,7 +1,8 @@ -#pragma once +#pragma once #include "InfrastProductionTask.h" -namespace asst { +namespace asst +{ class InfrastMfgTask : public InfrastProductionTask { public: diff --git a/src/MeoAssistance/InfrastMoodImageAnalyzer.cpp b/src/MeoAssistance/InfrastMoodImageAnalyzer.cpp index 739773f517..7cdc365ba0 100644 --- a/src/MeoAssistance/InfrastMoodImageAnalyzer.cpp +++ b/src/MeoAssistance/InfrastMoodImageAnalyzer.cpp @@ -1,10 +1,10 @@ -#include "InfrastMoodImageAnalyzer.h" +#include "InfrastMoodImageAnalyzer.h" -#include "Resource.h" -#include "InfrastSmileyImageAnalyzer.h" -#include "MatchImageAnalyzer.h" #include "AsstUtils.hpp" +#include "InfrastSmileyImageAnalyzer.h" #include "Logger.hpp" +#include "MatchImageAnalyzer.h" +#include "Resource.h" bool asst::InfrastMoodImageAnalyzer::analyze() { @@ -18,8 +18,8 @@ bool asst::InfrastMoodImageAnalyzer::analyze() for (auto&& info : m_result) { log.trace(info.hash, info.rect.to_string(), - "smiley:", (int)info.smiley.type, "mood:", info.percentage, - "selected:", info.selected, "working:", info.working); + "smiley:", (int)info.smiley.type, "mood:", info.percentage, + "selected:", info.selected, "working:", info.working); } return true; @@ -28,19 +28,19 @@ bool asst::InfrastMoodImageAnalyzer::analyze() void asst::InfrastMoodImageAnalyzer::sort_result() { std::sort(m_result.begin(), m_result.end(), - [](const InfrastOperMoodInfo& lhs, const InfrastOperMoodInfo& rhs) ->bool { - // 先按心情排序,心情低的放前面 - if (std::fabs(lhs.percentage - rhs.percentage) > DoubleDiff) { - return lhs.percentage < rhs.percentage; - } - // 心情一样的就按位置排序,左边的放前面 - if (std::abs(lhs.rect.x - rhs.rect.x) > 5) { - return lhs.rect.x < rhs.rect.x; - } - else { - return lhs.rect.y < rhs.rect.y; - } - }); + [](const InfrastOperMoodInfo& lhs, const InfrastOperMoodInfo& rhs) -> bool { + // 先按心情排序,心情低的放前面 + if (std::fabs(lhs.percentage - rhs.percentage) > DoubleDiff) { + return lhs.percentage < rhs.percentage; + } + // 心情一样的就按位置排序,左边的放前面 + if (std::abs(lhs.rect.x - rhs.rect.x) > 5) { + return lhs.rect.x < rhs.rect.x; + } + else { + return lhs.rect.y < rhs.rect.y; + } + }); } bool asst::InfrastMoodImageAnalyzer::mood_detect() @@ -72,8 +72,7 @@ bool asst::InfrastMoodImageAnalyzer::mood_detect() prg_rect.y += smiley.rect.y; // mood_analyze是可以识别长度不够的心情条的 // 这里主要是为了算立绘hash,宽度不够的hash不好算,直接忽略了 - if (prg_rect.x + prg_rect.width >= roi.x + roi.width - || prg_rect.x < roi.x) { + if (prg_rect.x + prg_rect.width >= roi.x + roi.width || prg_rect.x < roi.x) { continue; } #ifdef LOG_TRACE @@ -127,15 +126,14 @@ bool asst::InfrastMoodImageAnalyzer::mood_analyze() cv::Mat prg_gray; cv::cvtColor(prg_image, prg_gray, cv::COLOR_BGR2GRAY); - int max_white_length = 0; // 最长横扫的白色长度,即作为进度条长度 + int max_white_length = 0; // 最长横扫的白色长度,即作为进度条长度 for (int i = 0; i != prg_gray.rows; ++i) { int cur_white_length = 0; cv::uint8_t left_value = prg_lower_limit; for (int j = 0; j != prg_gray.cols; ++j) { auto value = prg_gray.at(i, j); // 当前点的颜色,需要大于最低阈值;且与相邻点的差值不能过大,否则就认为当前点不是进度条 - if (value >= prg_lower_limit - && left_value < value + prg_diff_thres) { + if (value >= prg_lower_limit && left_value < value + prg_diff_thres) { left_value = value; ++cur_white_length; if (max_white_length < cur_white_length) { @@ -154,8 +152,7 @@ bool asst::InfrastMoodImageAnalyzer::mood_analyze() } // 如果进度条的长度等于ROI的宽度,则说明这个进度条不完整,可能图像再往右滑,还有一部分进度条 // 所以忽略掉这个结果 - if (roi.width != iter->rect.width - && max_white_length == prg_gray.cols) { + if (roi.width != iter->rect.width && max_white_length == prg_gray.cols) { iter = m_result.erase(iter); continue; } @@ -213,8 +210,7 @@ bool asst::InfrastMoodImageAnalyzer::selected_analyze() for (int i = 0; i != h_channel.rows; ++i) { for (int j = 0; j != h_channel.cols; ++j) { cv::uint8_t value = h_channel.at(i, j); - if (mask_lowb < value - && value < mask_uppb) { + if (mask_lowb < value && value < mask_uppb) { ++count; } } @@ -247,4 +243,4 @@ bool asst::InfrastMoodImageAnalyzer::working_analyze() } } return true; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/InfrastMoodImageAnalyzer.h b/src/MeoAssistance/InfrastMoodImageAnalyzer.h index 22a0514c3f..e3b5f133a2 100644 --- a/src/MeoAssistance/InfrastMoodImageAnalyzer.h +++ b/src/MeoAssistance/InfrastMoodImageAnalyzer.h @@ -1,7 +1,8 @@ -#pragma once +#pragma once #include "AbstractImageAnalyzer.h" -namespace asst { +namespace asst +{ class InfrastMoodImageAnalyzer final : public AbstractImageAnalyzer { public: @@ -13,16 +14,19 @@ namespace asst { void sort_result(); - const std::vector& get_result() const noexcept { + const std::vector& get_result() const noexcept + { return m_result; } private: // 该分析器不支持外部设置ROI - virtual void set_roi(const Rect& roi) noexcept override { + virtual void set_roi(const Rect& roi) noexcept override + { AbstractImageAnalyzer::set_roi(roi); } - virtual void set_image(const cv::Mat& image, const Rect& roi) { + virtual void set_image(const cv::Mat& image, const Rect& roi) + { AbstractImageAnalyzer::set_image(image, roi); } diff --git a/src/MeoAssistance/InfrastOfficeTask.cpp b/src/MeoAssistance/InfrastOfficeTask.cpp index 28fba685e6..20c5d7c769 100644 --- a/src/MeoAssistance/InfrastOfficeTask.cpp +++ b/src/MeoAssistance/InfrastOfficeTask.cpp @@ -1,4 +1,4 @@ -#include "InfrastOfficeTask.h" +#include "InfrastOfficeTask.h" #include "Controller.h" @@ -7,8 +7,8 @@ const std::string asst::InfrastOfficeTask::FacilityName = "Office"; bool asst::InfrastOfficeTask::run() { json::value task_start_json = json::object{ - { "task_type", "InfrastOfficeTask" }, - { "task_chain", m_task_chain} + { "task_type", "InfrastOfficeTask" }, + { "task_chain", m_task_chain } }; m_callback(AsstMsg::TaskStart, task_start_json, m_callback_arg); @@ -32,14 +32,13 @@ bool asst::InfrastOfficeTask::run() swipe_to_the_left_of_operlist(); auto find_iter = std::find_if(m_all_available_opers.begin(), m_all_available_opers.end(), - [&](const InfrastOperSkillInfo& info) -> bool { - return info.selected; - }); + [&](const InfrastOperSkillInfo& info) -> bool { + return info.selected; + }); bool need_shift = true; if (find_iter != m_all_available_opers.end()) { - switch (m_work_mode) - { + switch (m_work_mode) { case InfrastWorkMode::Gentle: // 如果之前有干员在,那就不换人,直接退出 m_all_available_opers.erase(find_iter); @@ -69,4 +68,4 @@ bool asst::InfrastOfficeTask::run() click_return_button(); return true; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/InfrastOfficeTask.h b/src/MeoAssistance/InfrastOfficeTask.h index 7fac28fddf..cbce372309 100644 --- a/src/MeoAssistance/InfrastOfficeTask.h +++ b/src/MeoAssistance/InfrastOfficeTask.h @@ -1,7 +1,8 @@ -#pragma once +#pragma once #include "InfrastProductionTask.h" -namespace asst { +namespace asst +{ class InfrastOfficeTask : public InfrastProductionTask { public: @@ -11,6 +12,7 @@ namespace asst { const static std::string FacilityName; const static int MaxNumOfOpers = 1; + private: }; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/InfrastPowerTask.cpp b/src/MeoAssistance/InfrastPowerTask.cpp index 7bc911435a..edc4cdbf50 100644 --- a/src/MeoAssistance/InfrastPowerTask.cpp +++ b/src/MeoAssistance/InfrastPowerTask.cpp @@ -1,4 +1,4 @@ -#include "InfrastPowerTask.h" +#include "InfrastPowerTask.h" #include "Controller.h" @@ -7,8 +7,8 @@ const std::string asst::InfrastPowerTask::FacilityName = "Power"; bool asst::InfrastPowerTask::run() { json::value task_start_json = json::object{ - { "task_type", "InfrastPowerTask" }, - { "task_chain", m_task_chain} + { "task_type", "InfrastPowerTask" }, + { "task_chain", m_task_chain } }; m_callback(AsstMsg::TaskStart, task_start_json, m_callback_arg); @@ -41,13 +41,12 @@ bool asst::InfrastPowerTask::run() } auto find_iter = std::find_if(m_all_available_opers.begin(), m_all_available_opers.end(), - [&](const InfrastOperSkillInfo& info) -> bool { - return info.selected; - }); + [&](const InfrastOperSkillInfo& info) -> bool { + return info.selected; + }); bool need_shift = true; if (find_iter != m_all_available_opers.end()) { - switch (m_work_mode) - { + switch (m_work_mode) { case InfrastWorkMode::Gentle: // 如果之前有干员在,那就不换人,直接退出 m_all_available_opers.erase(find_iter); @@ -78,4 +77,4 @@ bool asst::InfrastPowerTask::run() } return true; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/InfrastPowerTask.h b/src/MeoAssistance/InfrastPowerTask.h index c3835af2d1..fc1b0d5ad2 100644 --- a/src/MeoAssistance/InfrastPowerTask.h +++ b/src/MeoAssistance/InfrastPowerTask.h @@ -1,7 +1,8 @@ -#pragma once +#pragma once #include "InfrastProductionTask.h" -namespace asst { +namespace asst +{ class InfrastPowerTask : public InfrastProductionTask { public: @@ -12,6 +13,7 @@ namespace asst { const static std::string FacilityName; const static int MaxNumOfOpers = 1; const static int MaxNumOfFacility = 3; + private: }; } diff --git a/src/MeoAssistance/InfrastProductionTask.cpp b/src/MeoAssistance/InfrastProductionTask.cpp index 1067d8a07e..2220745f11 100644 --- a/src/MeoAssistance/InfrastProductionTask.cpp +++ b/src/MeoAssistance/InfrastProductionTask.cpp @@ -1,16 +1,16 @@ -#include "InfrastProductionTask.h" +#include "InfrastProductionTask.h" #include #include -#include "Resource.h" +#include "AsstUtils.hpp" #include "Controller.h" #include "InfrastSkillsImageAnalyzer.h" -#include "MultiMatchImageAnalyzer.h" -#include "MatchImageAnalyzer.h" -#include "AsstUtils.hpp" #include "Logger.hpp" +#include "MatchImageAnalyzer.h" +#include "MultiMatchImageAnalyzer.h" +#include "Resource.h" #include "RuntimeStatus.h" //bool asst::InfrastProductionTask::run() @@ -159,10 +159,10 @@ size_t asst::InfrastProductionTask::opers_detect() for (const auto& cur_info : cur_all_info) { auto find_iter = std::find_if(m_all_available_opers.cbegin(), m_all_available_opers.cend(), - [&cur_info](const InfrastOperSkillInfo& info) -> bool { - int dist = utils::hamming(cur_info.hash, info.hash); - return dist < HashDistThres; - }); + [&cur_info](const InfrastOperSkillInfo& info) -> bool { + int dist = utils::hamming(cur_info.hash, info.hash); + return dist < HashDistThres; + }); // 如果两个的hash距离过小,则认为是同一个干员,不进行插入 if (find_iter != m_all_available_opers.cend()) { continue; @@ -209,9 +209,9 @@ bool asst::InfrastProductionTask::optimal_calc() optimal_opers.reserve(max_num_of_opers); double max_efficient = 0; std::sort(m_all_available_opers.begin(), m_all_available_opers.end(), - [&](const InfrastOperSkillInfo& lhs, const InfrastOperSkillInfo& rhs) -> bool { - return lhs.skills_comb.efficient.at(m_product) > rhs.skills_comb.efficient.at(m_product); - }); + [&](const InfrastOperSkillInfo& lhs, const InfrastOperSkillInfo& rhs) -> bool { + return lhs.skills_comb.efficient.at(m_product) > rhs.skills_comb.efficient.at(m_product); + }); for (const auto& oper : m_all_available_opers) { std::string skill_str; @@ -258,9 +258,9 @@ bool asst::InfrastProductionTask::optimal_calc() // necessary里的技能,一个都不能少 for (const InfrastSkillsComb& nec_skills : group.necessary) { auto find_iter = std::find_if(cur_available_opers.cbegin(), cur_available_opers.cend(), - [&](const InfrastOperSkillInfo& arg) -> bool { - return arg.skills_comb == nec_skills; - }); + [&](const InfrastOperSkillInfo& arg) -> bool { + return arg.skills_comb == nec_skills; + }); if (find_iter == cur_available_opers.cend()) { group_unavailable = true; break; @@ -275,18 +275,18 @@ bool asst::InfrastProductionTask::optimal_calc() // 排个序,因为产物不同,效率可能会发生变化,所以配置文件里默认的顺序不一定准确 auto optional = group.optional; std::sort(optional.begin(), optional.end(), - [&](const InfrastSkillsComb& lhs, const InfrastSkillsComb& rhs) -> bool { - return lhs.efficient.at(m_product) > rhs.efficient.at(m_product); - }); + [&](const InfrastSkillsComb& lhs, const InfrastSkillsComb& rhs) -> bool { + return lhs.efficient.at(m_product) > rhs.efficient.at(m_product); + }); // 可能有多个干员有同样的技能,所以这里需要循环找同一个技能,直到找不到为止 for (const InfrastSkillsComb& opt : optional) { auto find_iter = cur_available_opers.cbegin(); while (cur_opers.size() != max_num_of_opers) { find_iter = std::find_if(find_iter, cur_available_opers.cend(), - [&](const InfrastOperSkillInfo& arg) -> bool { - return arg.skills_comb.skills == opt.skills; - }); + [&](const InfrastOperSkillInfo& arg) -> bool { + return arg.skills_comb.skills == opt.skills; + }); if (find_iter != cur_available_opers.cend()) { cur_opers.emplace_back(opt); cur_efficient += opt.efficient.at(m_product); @@ -378,9 +378,9 @@ bool asst::InfrastProductionTask::opers_choose() std::vector selected_hash; for (auto opt_iter = m_optimal_opers.begin(); opt_iter != m_optimal_opers.end();) { auto find_iter = std::find_if(cur_all_info.cbegin(), cur_all_info.cend(), - [&](const InfrastOperSkillInfo& lhs) -> bool { - return lhs.skills_comb == opt_iter->skills_comb; - }); + [&](const InfrastOperSkillInfo& lhs) -> bool { + return lhs.skills_comb == opt_iter->skills_comb; + }); if (find_iter == cur_all_info.cend()) { ++opt_iter; continue; @@ -393,9 +393,9 @@ bool asst::InfrastProductionTask::opers_choose() selected_hash.emplace_back(find_iter->hash); { auto avlb_iter = std::find_if(m_all_available_opers.cbegin(), m_all_available_opers.cend(), - [&](const InfrastOperSkillInfo& lhs) -> bool { - return lhs.skills_comb == opt_iter->skills_comb; - }); + [&](const InfrastOperSkillInfo& lhs) -> bool { + return lhs.skills_comb == opt_iter->skills_comb; + }); m_all_available_opers.erase(avlb_iter); } cur_all_info.erase(find_iter); @@ -434,4 +434,4 @@ bool asst::InfrastProductionTask::facility_list_detect() } return true; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/InfrastProductionTask.h b/src/MeoAssistance/InfrastProductionTask.h index 2210de1510..7e558bd503 100644 --- a/src/MeoAssistance/InfrastProductionTask.h +++ b/src/MeoAssistance/InfrastProductionTask.h @@ -1,10 +1,11 @@ -#pragma once +#pragma once #include "InfrastAbstractTask.h" #include "AsstDef.h" -namespace asst { +namespace asst +{ // 生产类设施的任务,适用于制造站/贸易站 class InfrastProductionTask : public InfrastAbstractTask { @@ -12,17 +13,20 @@ namespace asst { using InfrastAbstractTask::InfrastAbstractTask; virtual ~InfrastProductionTask() = default; //virtual bool run() override; - void set_facility(std::string facility_name) noexcept { + void set_facility(std::string facility_name) noexcept + { m_facility = std::move(facility_name); } - void set_product(std::string product_name) noexcept { + void set_product(std::string product_name) noexcept + { m_product = std::move(product_name); } + protected: bool shift_facility_list(); bool facility_list_detect(); bool opers_detect_with_swipe(); - size_t opers_detect(); // 返回当前页面的干员数 + size_t opers_detect(); // 返回当前页面的干员数 bool optimal_calc(); bool opers_choose(); diff --git a/src/MeoAssistance/InfrastReceptionTask.cpp b/src/MeoAssistance/InfrastReceptionTask.cpp index 4b8337b977..7819458ea9 100644 --- a/src/MeoAssistance/InfrastReceptionTask.cpp +++ b/src/MeoAssistance/InfrastReceptionTask.cpp @@ -1,20 +1,20 @@ -#include "InfrastReceptionTask.h" +#include "InfrastReceptionTask.h" #include "Controller.h" -#include "Resource.h" -#include "InfrastClueVacancyImageAnalyzer.h" #include "InfrastClueImageAnalyzer.h" -#include "MatchImageAnalyzer.h" +#include "InfrastClueVacancyImageAnalyzer.h" #include "Logger.hpp" +#include "MatchImageAnalyzer.h" #include "ProcessTaskImageAnalyzer.h" +#include "Resource.h" const std::string asst::InfrastReceptionTask::FacilityName = "Reception"; bool asst::InfrastReceptionTask::run() { json::value task_start_json = json::object{ - { "task_type", "InfrastReceptionTask" }, - { "task_chain", m_task_chain} + { "task_type", "InfrastReceptionTask" }, + { "task_chain", m_task_chain } }; m_callback(AsstMsg::TaskStart, task_start_json, m_callback_arg); @@ -78,7 +78,8 @@ bool asst::InfrastReceptionTask::proc_clue() LogTraceFunction; const static std::string clue_vacancy = "InfrastClueVacancy"; const static std::vector clue_suffix = { - "No1", "No2", "No3", "No4", "No5", "No6", "No7" }; + "No1", "No2", "No3", "No4", "No5", "No6", "No7" + }; proc_vacancy(); @@ -124,7 +125,8 @@ bool asst::InfrastReceptionTask::proc_vacancy() LogTraceFunction; const static std::string clue_vacancy = "InfrastClueVacancy"; const static std::vector clue_suffix = { - "No1", "No2", "No3", "No4", "No5", "No6", "No7" }; + "No1", "No2", "No3", "No4", "No5", "No6", "No7" + }; for (const std::string& clue : clue_suffix) { if (need_exit()) { @@ -163,15 +165,13 @@ bool asst::InfrastReceptionTask::shift() MatchImageAnalyzer add_analyzer(image); const auto raw_task_ptr = resource.task().task_ptr("InfrastAddOperator" + m_facility + m_work_mode_name); - switch (raw_task_ptr->algorithm) - { + switch (raw_task_ptr->algorithm) { case AlgorithmType::JustReturn: if (raw_task_ptr->action == ProcessTaskAction::ClickRect) { ctrler.click(raw_task_ptr->specific_rect); } break; - case AlgorithmType::MatchTemplate: - { + case AlgorithmType::MatchTemplate: { const auto add_task_ptr = std::dynamic_pointer_cast(raw_task_ptr); add_analyzer.set_task_info(*add_task_ptr); @@ -179,8 +179,7 @@ bool asst::InfrastReceptionTask::shift() return true; } ctrler.click(add_analyzer.get_result().rect); - } - break; + } break; default: break; } @@ -223,4 +222,4 @@ bool asst::InfrastReceptionTask::swipe_to_the_bottom_of_clue_list_on_the_right() } sleep(extra_delay); return false; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/InfrastReceptionTask.h b/src/MeoAssistance/InfrastReceptionTask.h index 94eec97a4a..049df12b00 100644 --- a/src/MeoAssistance/InfrastReceptionTask.h +++ b/src/MeoAssistance/InfrastReceptionTask.h @@ -1,7 +1,8 @@ -#pragma once +#pragma once #include "InfrastProductionTask.h" -namespace asst { +namespace asst +{ class InfrastReceptionTask : public InfrastProductionTask { public: @@ -10,6 +11,7 @@ namespace asst { virtual bool run() override; const static std::string FacilityName; + private: bool harvest_clue(); bool proc_clue(); diff --git a/src/MeoAssistance/InfrastSkillsImageAnalyzer.cpp b/src/MeoAssistance/InfrastSkillsImageAnalyzer.cpp index 4d07867f7b..9a3cc65ef8 100644 --- a/src/MeoAssistance/InfrastSkillsImageAnalyzer.cpp +++ b/src/MeoAssistance/InfrastSkillsImageAnalyzer.cpp @@ -1,10 +1,10 @@ -#include "InfrastSkillsImageAnalyzer.h" +#include "InfrastSkillsImageAnalyzer.h" -#include "Resource.h" -#include "InfrastSmileyImageAnalyzer.h" #include "AsstUtils.hpp" -#include "MatchImageAnalyzer.h" +#include "InfrastSmileyImageAnalyzer.h" #include "Logger.hpp" +#include "MatchImageAnalyzer.h" +#include "Resource.h" bool asst::InfrastSkillsImageAnalyzer::analyze() { @@ -36,15 +36,14 @@ void asst::InfrastSkillsImageAnalyzer::sort_result() LogTraceFunction; // 按位置排个序 std::sort(m_result.begin(), m_result.end(), - [](const auto& lhs, const auto& rhs) -> bool { - if (std::abs(lhs.rect.x - rhs.rect.x) < 5) { // x差距较小则理解为是同一排的,按y排序 - return lhs.rect.y < rhs.rect.y; - } - else { - return lhs.rect.x < rhs.rect.x; - } - } - ); + [](const auto& lhs, const auto& rhs) -> bool { + if (std::abs(lhs.rect.x - rhs.rect.x) < 5) { // x差距较小则理解为是同一排的,按y排序 + return lhs.rect.y < rhs.rect.y; + } + else { + return lhs.rect.x < rhs.rect.x; + } + }); } bool asst::InfrastSkillsImageAnalyzer::skills_detect() @@ -85,8 +84,7 @@ bool asst::InfrastSkillsImageAnalyzer::skills_detect() skills_rect.height = skills_height; // 超过ROI边界了 - if (skills_rect.x + skills_rect.width > roi.x + roi.width - || skills_rect.x < roi.x) { + if (skills_rect.x + skills_rect.width > roi.x + roi.width || skills_rect.x < roi.x) { continue; } #ifdef LOG_TRACE @@ -126,7 +124,7 @@ bool asst::InfrastSkillsImageAnalyzer::skills_split() } cv::Mat image_roi = m_image(utils::make_rect(roi)); - std::vector skills_vec; // 单个干员的所有技能 + std::vector skills_vec; // 单个干员的所有技能 for (int i = 0; i != MaxNumOfSkills; ++i) { int x = i * skill_width + spacing * i; Rect skill_rect(x, 0, skill_width, roi.height); @@ -166,7 +164,7 @@ bool asst::InfrastSkillsImageAnalyzer::skill_analyze() skill_analyzer.set_threshold(task_ptr->templ_threshold); for (const auto& [hash, skills_rect_vec] : m_skills_splited) { - std::unordered_set skills_set; // 单个干员的全部技能 + std::unordered_set skills_set; // 单个干员的全部技能 std::string log_str = "[ "; for (const Rect& skill_rect : skills_rect_vec) { skill_analyzer.set_roi(skill_rect); @@ -198,9 +196,9 @@ bool asst::InfrastSkillsImageAnalyzer::skill_analyze() // 匹配得分最高的id作为基准,排除有识别错误,其他的技能混进来了的情况 // 即排除容器中,除了有同一个技能的不同等级,还有别的技能的情况 auto max_iter = std::max_element(possible_skills.begin(), possible_skills.end(), - [](const auto& lhs, const auto& rhs) -> bool { - return lhs.second.score < rhs.second.score; - }); + [](const auto& lhs, const auto& rhs) -> bool { + return lhs.second.score < rhs.second.score; + }); std::string base_id = max_iter->first.id; size_t level_pos = 0; // 倒着找,第一个不是数字的。前面就是技能基础id名字,后面的数字就是技能等级 @@ -216,8 +214,7 @@ bool asst::InfrastSkillsImageAnalyzer::skill_analyze() if (size_t find_pos = skill.id.find(base_id); find_pos != std::string::npos) { std::string cur_skill_level = skill.id.substr(base_id.size()); - if (max_level.empty() - || cur_skill_level > max_level) { + if (max_level.empty() || cur_skill_level > max_level) { max_level = cur_skill_level; most_confident_skills = skill; } @@ -278,12 +275,11 @@ bool asst::InfrastSkillsImageAnalyzer::selected_analyze(int smiley_x, int smiley for (int i = 0; i != h_channel.rows; ++i) { for (int j = 0; j != h_channel.cols; ++j) { cv::uint8_t value = h_channel.at(i, j); - if (mask_lowb < value - && value < mask_uppb) { + if (mask_lowb < value && value < mask_uppb) { ++count; } } } log.trace("selected_analyze |", count); return count >= selected_task_ptr->templ_threshold; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/InfrastSkillsImageAnalyzer.h b/src/MeoAssistance/InfrastSkillsImageAnalyzer.h index 2bf6de963a..f278e9e071 100644 --- a/src/MeoAssistance/InfrastSkillsImageAnalyzer.h +++ b/src/MeoAssistance/InfrastSkillsImageAnalyzer.h @@ -1,11 +1,12 @@ -#pragma once +#pragma once #include "AbstractImageAnalyzer.h" #include #include "AsstDef.h" -namespace asst { +namespace asst +{ class InfrastSkillsImageAnalyzer final : public AbstractImageAnalyzer { public: @@ -17,27 +18,31 @@ namespace asst { void sort_result(); - const std::vector& get_result() const noexcept { + const std::vector& get_result() const noexcept + { return m_result; } - void set_facility(std::string facility_name) noexcept { + void set_facility(std::string facility_name) noexcept + { m_facility = std::move(facility_name); } - constexpr static int MaxNumOfSkills = 2; // 单个干员最多有几个基建技能 + constexpr static int MaxNumOfSkills = 2; // 单个干员最多有几个基建技能 private: // 该分析器不支持外部设置ROI - virtual void set_roi(const Rect& roi) noexcept override { + virtual void set_roi(const Rect& roi) noexcept override + { AbstractImageAnalyzer::set_roi(roi); } - virtual void set_image(const cv::Mat& image, const Rect& roi) { + virtual void set_image(const cv::Mat& image, const Rect& roi) + { AbstractImageAnalyzer::set_image(image, roi); } - bool skills_detect(); // 检测出所有技能区域 - bool skills_split(); // 拆分成一个一个的区域 - bool skill_analyze(); // 识别每个技能区域是啥 - bool selected_analyze(int smiley_x, int smiley_y); // 识别干员是否被选中 + bool skills_detect(); // 检测出所有技能区域 + bool skills_split(); // 拆分成一个一个的区域 + bool skill_analyze(); // 识别每个技能区域是啥 + bool selected_analyze(int smiley_x, int smiley_y); // 识别干员是否被选中 std::string m_facility; // skills_detect()的结果,key是hash,value是单个干员的全部技能区域 @@ -47,4 +52,4 @@ namespace asst { // skill_analyze()的结果,最终结果 std::vector m_result; }; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/InfrastSmileyImageAnalyzer.cpp b/src/MeoAssistance/InfrastSmileyImageAnalyzer.cpp index 0c9de9bc80..f71817b1d7 100644 --- a/src/MeoAssistance/InfrastSmileyImageAnalyzer.cpp +++ b/src/MeoAssistance/InfrastSmileyImageAnalyzer.cpp @@ -1,16 +1,15 @@ -#include "InfrastSmileyImageAnalyzer.h" +#include "InfrastSmileyImageAnalyzer.h" -#include "Resource.h" -#include "MultiMatchImageAnalyzer.h" #include "AsstUtils.hpp" +#include "MultiMatchImageAnalyzer.h" +#include "Resource.h" bool asst::InfrastSmileyImageAnalyzer::analyze() { - const static std::unordered_map smiley_map = - { - {InfrastSmileyType::Rest, "InfrastSmileyOnRest"}, - {InfrastSmileyType::Work, "InfrastSmileyOnWork"}, - {InfrastSmileyType::Distract, "InfrastSmileyOnDistract"} + const static std::unordered_map smiley_map = { + { InfrastSmileyType::Rest, "InfrastSmileyOnRest" }, + { InfrastSmileyType::Work, "InfrastSmileyOnWork" }, + { InfrastSmileyType::Distract, "InfrastSmileyOnDistract" } }; m_result.clear(); @@ -35,4 +34,4 @@ bool asst::InfrastSmileyImageAnalyzer::analyze() } m_result = std::move(temp_result); return true; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/InfrastSmileyImageAnalyzer.h b/src/MeoAssistance/InfrastSmileyImageAnalyzer.h index f6a3b4e93a..39217c2600 100644 --- a/src/MeoAssistance/InfrastSmileyImageAnalyzer.h +++ b/src/MeoAssistance/InfrastSmileyImageAnalyzer.h @@ -1,9 +1,10 @@ -#pragma once +#pragma once #include "AbstractImageAnalyzer.h" #include "AsstDef.h" -namespace asst { +namespace asst +{ class InfrastSmileyImageAnalyzer : public AbstractImageAnalyzer { public: @@ -12,9 +13,11 @@ namespace asst { virtual bool analyze() override; - const std::vector& get_result() const noexcept { + const std::vector& get_result() const noexcept + { return m_result; } + protected: std::vector m_result; }; diff --git a/src/MeoAssistance/InfrastTradeTask.cpp b/src/MeoAssistance/InfrastTradeTask.cpp index e6d3db3733..11c0d043a3 100644 --- a/src/MeoAssistance/InfrastTradeTask.cpp +++ b/src/MeoAssistance/InfrastTradeTask.cpp @@ -1,12 +1,12 @@ -#include "InfrastTradeTask.h" +#include "InfrastTradeTask.h" const std::string asst::InfrastTradeTask::FacilityName = "Trade"; bool asst::InfrastTradeTask::run() { json::value task_start_json = json::object{ - { "task_type", "InfrastTradeTask" }, - { "task_chain", m_task_chain} + { "task_type", "InfrastTradeTask" }, + { "task_chain", m_task_chain } }; m_callback(AsstMsg::TaskStart, task_start_json, m_callback_arg); @@ -20,4 +20,4 @@ bool asst::InfrastTradeTask::run() shift_facility_list(); return true; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/InfrastTradeTask.h b/src/MeoAssistance/InfrastTradeTask.h index 17f296d876..e47c167645 100644 --- a/src/MeoAssistance/InfrastTradeTask.h +++ b/src/MeoAssistance/InfrastTradeTask.h @@ -1,7 +1,8 @@ -#pragma once +#pragma once #include "InfrastProductionTask.h" -namespace asst { +namespace asst +{ class InfrastTradeTask : public InfrastProductionTask { public: @@ -13,4 +14,4 @@ namespace asst { private: }; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/ItemConfiger.cpp b/src/MeoAssistance/ItemConfiger.cpp index 3176e74385..2a05ceafec 100644 --- a/src/MeoAssistance/ItemConfiger.cpp +++ b/src/MeoAssistance/ItemConfiger.cpp @@ -1,4 +1,4 @@ -#include "ItemConfiger.h" +#include "ItemConfiger.h" #include @@ -9,4 +9,4 @@ bool asst::ItemConfiger::parse(const json::value& json) m_item_name.emplace(id, std::move(name)); } return true; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/ItemConfiger.h b/src/MeoAssistance/ItemConfiger.h index e549f700a6..7dd1c6ec19 100644 --- a/src/MeoAssistance/ItemConfiger.h +++ b/src/MeoAssistance/ItemConfiger.h @@ -1,10 +1,11 @@ -#pragma once +#pragma once #include "AbstractConfiger.h" #include -namespace asst { +namespace asst +{ class ItemConfiger : public AbstractConfiger { public: @@ -21,10 +22,12 @@ namespace asst { return empty; } } - const std::unordered_map& get_drop_count() const noexcept { + const std::unordered_map& get_drop_count() const noexcept + { return m_drop_count; } - std::unordered_map& get_drop_count() noexcept { + std::unordered_map& get_drop_count() noexcept + { return m_drop_count; } int get_drop_count(const std::string& id) const noexcept @@ -41,7 +44,8 @@ namespace asst { { m_drop_count.emplace(std::move(id), count); } - void increase_drop_count(std::string id, int count) { + void increase_drop_count(std::string id, int count) + { m_drop_count[std::move(id)] += count; } void clear_drop_count() noexcept diff --git a/src/MeoAssistance/Logger.hpp b/src/MeoAssistance/Logger.hpp index 68e46271de..a01972ce97 100644 --- a/src/MeoAssistance/Logger.hpp +++ b/src/MeoAssistance/Logger.hpp @@ -1,17 +1,19 @@ -#pragma once +#pragma once -#include -#include -#include -#include -#include #include +#include +#include +#include +#include +#include #include "AsstUtils.hpp" #include "Version.h" -namespace asst { - class Logger { +namespace asst +{ + class Logger + { public: ~Logger() = default; @@ -25,19 +27,19 @@ namespace asst { } template - inline void trace(Args &&... args) + inline void trace(Args&&... args) { constexpr static std::string_view level = "TRC"; log(level, std::forward(args)...); } template - inline void info(Args &&... args) + inline void info(Args&&... args) { constexpr static std::string_view level = "INF"; log(level, std::forward(args)...); } template - inline void error(Args &&... args) + inline void error(Args&&... args) { constexpr static std::string_view level = "ERR"; log(level, std::forward(args)...); @@ -45,6 +47,7 @@ namespace asst { const std::string m_log_filename = asst::utils::get_cur_dir() + "asst.log"; const std::string m_log_bak_filename = asst::utils::get_cur_dir() + "asst.bak.log"; + private: Logger() { @@ -63,8 +66,7 @@ namespace asst { } } } - catch (...) - { + catch (...) { ; } } @@ -80,14 +82,14 @@ namespace asst { } template - void log(const std::string_view& level, Args &&... args) + void log(const std::string_view& level, Args&&... args) { std::unique_lock trace_lock(m_trace_mutex); char buff[128] = { 0 }; sprintf_s(buff, "[%s][%s][Px%x][Tx%x]", - asst::utils::get_format_time().c_str(), - level.data(), _getpid(), ::GetCurrentThreadId()); + asst::utils::get_format_time().c_str(), + level.data(), _getpid(), ::GetCurrentThreadId()); stream_args(std::cout, buff, std::forward(args)...); std::ofstream ofs(m_log_filename, std::ios::out | std::ios::app); @@ -96,7 +98,7 @@ namespace asst { } template - inline void stream_args(std::ostream& os, T&& first, Args && ...rest) + inline void stream_args(std::ostream& os, T&& first, Args&&... rest) { stream()(os, std::forward(first)); stream_args(os, std::forward(rest)...); @@ -127,7 +129,8 @@ namespace asst { std::mutex m_trace_mutex; }; - class LoggerAux { + class LoggerAux + { public: LoggerAux(const std::string& func_name) : m_func_name(func_name), @@ -139,8 +142,9 @@ namespace asst { { auto duration = std::chrono::system_clock::now() - m_start_time; Logger::get_instance().trace(m_func_name, " | leave,", - std::chrono::duration_cast(duration).count(), "ms"); + std::chrono::duration_cast(duration).count(), "ms"); } + private: std::string m_func_name; std::chrono::time_point m_start_time; @@ -148,6 +152,6 @@ namespace asst { static auto& log = Logger::get_instance(); -#define LogTraceFunction LoggerAux _func_aux(__FUNCTION__) -#define LogTraceScope LoggerAux _func_aux -} \ No newline at end of file +#define LogTraceFunction LoggerAux _func_aux(__FUNCTION__) +#define LogTraceScope LoggerAux _func_aux +} diff --git a/src/MeoAssistance/MatchImageAnalyzer.cpp b/src/MeoAssistance/MatchImageAnalyzer.cpp index 7504e78487..567f7521f6 100644 --- a/src/MeoAssistance/MatchImageAnalyzer.cpp +++ b/src/MeoAssistance/MatchImageAnalyzer.cpp @@ -1,8 +1,8 @@ -#include "MatchImageAnalyzer.h" +#include "MatchImageAnalyzer.h" -#include "Resource.h" #include "AsstUtils.hpp" #include "Logger.hpp" +#include "Resource.h" asst::MatchImageAnalyzer::MatchImageAnalyzer(const cv::Mat& image, const Rect& roi, std::string templ_name, double templ_thres, double hist_thres) : AbstractImageAnalyzer(image, roi), @@ -69,7 +69,7 @@ bool asst::MatchImageAnalyzer::match_templ(const cv::Mat& templ) cv::Point min_loc, max_loc; cv::minMaxLoc(matched, &min_val, &max_val, &min_loc, &max_loc); - if (max_val > m_templ_thres * 0.7) { // 得分太低的肯定不对,没必要打印 + if (max_val > m_templ_thres * 0.7) { // 得分太低的肯定不对,没必要打印 log.trace("match_templ |", m_templ_name, "score:", max_val, "point:", max_loc); } @@ -88,7 +88,7 @@ bool asst::MatchImageAnalyzer::comp_hist(const cv::Mat& hist, const cv::Rect roi cv::Mat image_roi = m_image(utils::make_rect(m_roi))(roi); double score = 1.0 - cv::compareHist(to_hist(image_roi), hist, cv::HISTCMP_BHATTACHARYYA); - if (score > 0.7) { // 得分太低的肯定不对,没必要打印 + if (score > 0.7) { // 得分太低的肯定不对,没必要打印 log.trace("comp_hist |", m_templ_name, "score:", score); } @@ -100,4 +100,4 @@ bool asst::MatchImageAnalyzer::comp_hist(const cv::Mat& hist, const cv::Rect roi else { return false; } -} \ No newline at end of file +} diff --git a/src/MeoAssistance/MatchImageAnalyzer.h b/src/MeoAssistance/MatchImageAnalyzer.h index dabee87117..3e8e0d04ee 100644 --- a/src/MeoAssistance/MatchImageAnalyzer.h +++ b/src/MeoAssistance/MatchImageAnalyzer.h @@ -1,7 +1,8 @@ -#pragma once +#pragma once #include "AbstractImageAnalyzer.h" -namespace asst { +namespace asst +{ class MatchImageAnalyzer : public AbstractImageAnalyzer { public: @@ -10,23 +11,29 @@ namespace asst { virtual ~MatchImageAnalyzer() = default; virtual bool analyze() override; - void set_use_cache(bool is_use) noexcept { + void set_use_cache(bool is_use) noexcept + { m_use_cache = is_use; } - void set_mask_range(int lower, int upper) { + void set_mask_range(int lower, int upper) + { m_mask_range = std::make_pair(lower, upper); } - void set_mask_range(std::pair mask_range) { + void set_mask_range(std::pair mask_range) + { m_mask_range = std::move(mask_range); } - void set_templ_name(std::string templ_name) noexcept { + void set_templ_name(std::string templ_name) noexcept + { m_templ_name = std::move(templ_name); } - void set_threshold(double templ_thres, double hist_thres = 0.0) noexcept { + void set_threshold(double templ_thres, double hist_thres = 0.0) noexcept + { m_templ_thres = templ_thres; m_hist_thres = hist_thres; } - void set_task_info(MatchTaskInfo task_info) noexcept { + void set_task_info(MatchTaskInfo task_info) noexcept + { m_use_cache = task_info.cache; m_mask_range = std::move(task_info.mask_range); m_templ_name = std::move(task_info.templ_name); @@ -38,7 +45,8 @@ namespace asst { //const std::vector& get_result() const noexcept { // return m_result; //} - const MatchRect& get_result() const noexcept { + const MatchRect& get_result() const noexcept + { return m_result; } diff --git a/src/MeoAssistance/MultiMatchImageAnalyzer.cpp b/src/MeoAssistance/MultiMatchImageAnalyzer.cpp index 611705fdfb..805301ced8 100644 --- a/src/MeoAssistance/MultiMatchImageAnalyzer.cpp +++ b/src/MeoAssistance/MultiMatchImageAnalyzer.cpp @@ -1,4 +1,4 @@ -#include "MultiMatchImageAnalyzer.h" +#include "MultiMatchImageAnalyzer.h" #include "Logger.hpp" #include "Resource.h" @@ -29,15 +29,14 @@ void asst::MultiMatchImageAnalyzer::sort_result() { // 按位置排个序 std::sort(m_result.begin(), m_result.end(), - [](const MatchRect& lhs, const MatchRect& rhs) -> bool { - if (std::abs(lhs.rect.y - rhs.rect.y) < 5) { // y差距较小则理解为是同一排的,按x排序 - return lhs.rect.x < rhs.rect.x; - } - else { - return lhs.rect.y < rhs.rect.y; - } - } - ); + [](const MatchRect& lhs, const MatchRect& rhs) -> bool { + if (std::abs(lhs.rect.y - rhs.rect.y) < 5) { // y差距较小则理解为是同一排的,按x排序 + return lhs.rect.x < rhs.rect.x; + } + else { + return lhs.rect.y < rhs.rect.y; + } + }); } bool asst::MultiMatchImageAnalyzer::multi_match_templ(const cv::Mat& templ) @@ -65,13 +64,11 @@ bool asst::MultiMatchImageAnalyzer::multi_match_templ(const cv::Mat& templ) // 如果有两个点离得太近,只取里面得分高的那个 // 一般相邻的都是刚刚push进去的,这里倒序快一点 for (auto iter = m_result.rbegin(); iter != m_result.rend(); ++iter) { - if (std::abs(j + m_roi.x - iter->rect.x) < mini_distance - && std::abs(i + m_roi.y - iter->rect.y) < mini_distance) - { + if (std::abs(j + m_roi.x - iter->rect.x) < mini_distance && std::abs(i + m_roi.y - iter->rect.y) < mini_distance) { if (iter->score < value) { iter->rect = rect; iter->score = value; - } // else 这个点就放弃了 + } // else 这个点就放弃了 need_push = false; break; } @@ -94,4 +91,4 @@ bool asst::MultiMatchImageAnalyzer::multi_match_templ(const cv::Mat& templ) } return false; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/MultiMatchImageAnalyzer.h b/src/MeoAssistance/MultiMatchImageAnalyzer.h index 44ef4d28cb..4570360712 100644 --- a/src/MeoAssistance/MultiMatchImageAnalyzer.h +++ b/src/MeoAssistance/MultiMatchImageAnalyzer.h @@ -1,7 +1,8 @@ -#pragma once +#pragma once #include "AbstractImageAnalyzer.h" -namespace asst { +namespace asst +{ class MultiMatchImageAnalyzer : public AbstractImageAnalyzer { public: @@ -12,25 +13,31 @@ namespace asst { virtual bool analyze() override; void sort_result(); // 按位置排序,左上角的排在前面 - void set_mask_range(int lower, int upper) { + void set_mask_range(int lower, int upper) + { m_mask_range = std::make_pair(lower, upper); } - void set_mask_range(std::pair mask_range) { + void set_mask_range(std::pair mask_range) + { m_mask_range = std::move(mask_range); } - void set_templ_name(std::string templ_name) noexcept { + void set_templ_name(std::string templ_name) noexcept + { m_templ_name = std::move(templ_name); } - void set_threshold(double templ_thres) noexcept { + void set_threshold(double templ_thres) noexcept + { m_templ_thres = templ_thres; } - void set_task_info(MatchTaskInfo task_info) noexcept { + void set_task_info(MatchTaskInfo task_info) noexcept + { m_mask_range = std::move(task_info.mask_range); m_templ_name = std::move(task_info.templ_name); m_templ_thres = task_info.templ_threshold; set_roi(task_info.roi); } - const std::vector& get_result() const noexcept { + const std::vector& get_result() const noexcept + { return m_result; } diff --git a/src/MeoAssistance/OcrImageAnalyzer.cpp b/src/MeoAssistance/OcrImageAnalyzer.cpp index 596c07d8a8..6e2e44c2aa 100644 --- a/src/MeoAssistance/OcrImageAnalyzer.cpp +++ b/src/MeoAssistance/OcrImageAnalyzer.cpp @@ -1,8 +1,8 @@ -#include "OcrImageAnalyzer.h" +#include "OcrImageAnalyzer.h" -#include "Resource.h" #include "AsstUtils.hpp" #include "Logger.hpp" +#include "Resource.h" bool asst::OcrImageAnalyzer::analyze() { @@ -56,4 +56,4 @@ bool asst::OcrImageAnalyzer::analyze() else { return false; } -} \ No newline at end of file +} diff --git a/src/MeoAssistance/OcrImageAnalyzer.h b/src/MeoAssistance/OcrImageAnalyzer.h index d928d4ec1f..bd73edc380 100644 --- a/src/MeoAssistance/OcrImageAnalyzer.h +++ b/src/MeoAssistance/OcrImageAnalyzer.h @@ -1,13 +1,14 @@ -#pragma once +#pragma once #include "AbstractImageAnalyzer.h" -#include -#include #include +#include +#include #include "AsstDef.h" -namespace asst { +namespace asst +{ class OcrImageAnalyzer : public AbstractImageAnalyzer { public: @@ -16,24 +17,29 @@ namespace asst { virtual bool analyze() override; - void set_required(std::vector required, bool full_match = false) noexcept { + void set_required(std::vector required, bool full_match = false) noexcept + { m_required = std::move(required); m_full_match = full_match; } - void set_replace(std::unordered_map replace) noexcept { + void set_replace(std::unordered_map replace) noexcept + { m_replace = std::move(replace); } - void set_task_info(OcrTaskInfo task_info) noexcept { + void set_task_info(OcrTaskInfo task_info) noexcept + { m_required = std::move(task_info.text); m_full_match = task_info.need_full_match; m_replace = std::move(task_info.replace_map); set_roi(task_info.roi); } - void set_pred(const TextRectProc& pred) { + void set_pred(const TextRectProc& pred) + { m_pred = pred; } - const std::vector& get_result() const noexcept { + const std::vector& get_result() const noexcept + { return m_ocr_result; } diff --git a/src/MeoAssistance/OcrPack.cpp b/src/MeoAssistance/OcrPack.cpp index ba6e265c5f..65caa1544a 100644 --- a/src/MeoAssistance/OcrPack.cpp +++ b/src/MeoAssistance/OcrPack.cpp @@ -1,15 +1,14 @@ -#include "OcrPack.h" +#include "OcrPack.h" -#include #include +#include #include "AsstUtils.hpp" #include "Logger.hpp" asst::OcrPack::OcrPack() : m_ocr_ptr(std::make_unique()) -{ -} +{} asst::OcrPack::~OcrPack() = default; @@ -45,9 +44,9 @@ std::vector asst::OcrPack::recognize(const cv::Mat & image, cons constexpr bool mostAngle = false; OcrResult ocr_results = m_ocr_ptr->detect(image, - padding, maxSideLen, - boxScoreThresh, boxThresh, - unClipRatio, doAngle, mostAngle); + padding, maxSideLen, + boxScoreThresh, boxThresh, + unClipRatio, doAngle, mostAngle); std::vector result; std::string log_str_raw; @@ -84,4 +83,4 @@ std::vector asst::OcrPack::recognize(const cv::Mat & image, cons return pred(tr); }; return recognize(image(utils::make_rect(roi)), rect_cor); -} \ No newline at end of file +} diff --git a/src/MeoAssistance/OcrPack.h b/src/MeoAssistance/OcrPack.h index 4861d398e2..994156b4fa 100644 --- a/src/MeoAssistance/OcrPack.h +++ b/src/MeoAssistance/OcrPack.h @@ -1,17 +1,19 @@ -#pragma once +#pragma once #include "AbstractResource.h" -#include #include +#include #include "AsstDef.h" class OcrLiteCaller; -namespace cv { +namespace cv +{ class Mat; } -namespace asst { +namespace asst +{ class OcrPack final : public AbstractResource { public: @@ -25,7 +27,6 @@ namespace asst { std::vector recognize(const cv::Mat& image, const Rect& roi, const TextRectProc& pred = nullptr); private: - std::unique_ptr m_ocr_ptr; }; } diff --git a/src/MeoAssistance/PenguinPack.cpp b/src/MeoAssistance/PenguinPack.cpp index dfba956544..59a7a0233c 100644 --- a/src/MeoAssistance/PenguinPack.cpp +++ b/src/MeoAssistance/PenguinPack.cpp @@ -1,10 +1,11 @@ -#include "PenguinPack.h" +#include "PenguinPack.h" #include -#include #include -namespace penguin { +#include +namespace penguin +{ #include } @@ -46,7 +47,7 @@ bool asst::PenguinPack::load_json(const std::string& stage_path, const std::stri json::object cvt_stage_json; try { for (const json::value& stage_info : stage_json.as_array()) { - if (!stage_info.exist("dropInfos")) { // 这种一般是以前的活动关,现在已经关闭了的 + if (!stage_info.exist("dropInfos")) { // 这种一般是以前的活动关,现在已经关闭了的 continue; } std::string key = stage_info.at("code").as_string(); @@ -91,4 +92,4 @@ bool asst::PenguinPack::load_templ(const std::string& item_id, const std::string penguin::load_templ(item_id.c_str(), buf.data(), buf.size()); return true; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/PenguinPack.h b/src/MeoAssistance/PenguinPack.h index 3a32612dd3..aecb424eb8 100644 --- a/src/MeoAssistance/PenguinPack.h +++ b/src/MeoAssistance/PenguinPack.h @@ -1,12 +1,14 @@ -#pragma once +#pragma once #include "AbstractResource.h" -namespace cv { +namespace cv +{ class Mat; } -namespace asst { +namespace asst +{ class PenguinPack final : public AbstractResource { public: @@ -17,6 +19,7 @@ namespace asst { void set_language(const std::string& server); std::string recognize(const cv::Mat& image); + private: bool load_json(const std::string& stage_path, const std::string& hash_path); bool load_templ(const std::string& item_id, const std::string& path); diff --git a/src/MeoAssistance/PenguinUploader.cpp b/src/MeoAssistance/PenguinUploader.cpp index df6ef0b336..d7a8fdb45a 100644 --- a/src/MeoAssistance/PenguinUploader.cpp +++ b/src/MeoAssistance/PenguinUploader.cpp @@ -1,13 +1,13 @@ -#include "PenguinUploader.h" +#include "PenguinUploader.h" #include #include +#include "AsstUtils.hpp" +#include "Logger.hpp" #include "Resource.h" #include "Version.h" -#include "Logger.hpp" -#include "AsstUtils.hpp" bool asst::PenguinUploader::upload(const std::string& rec_res) { @@ -89,4 +89,4 @@ bool asst::PenguinUploader::request_penguin(const std::string& body) ::CloseHandle(pipe_read); ::CloseHandle(pipe_child_write); return true; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/PenguinUploader.h b/src/MeoAssistance/PenguinUploader.h index 556951fb9f..8dd95353ad 100644 --- a/src/MeoAssistance/PenguinUploader.h +++ b/src/MeoAssistance/PenguinUploader.h @@ -1,18 +1,21 @@ -#pragma once +#pragma once #include -namespace json { +namespace json +{ class value; } -namespace asst { +namespace asst +{ class PenguinUploader { public: static bool upload(const std::string& rec_res); + private: static std::string cvt_json(const std::string& rec_res); static bool request_penguin(const std::string& body); }; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/ProcessTask.cpp b/src/MeoAssistance/ProcessTask.cpp index df5814142a..9840f45acd 100644 --- a/src/MeoAssistance/ProcessTask.cpp +++ b/src/MeoAssistance/ProcessTask.cpp @@ -1,4 +1,4 @@ -#include "ProcessTask.h" +#include "ProcessTask.h" #include #include @@ -16,9 +16,9 @@ using namespace asst; bool ProcessTask::run() { json::value task_start_json = json::object{ - { "task_type", "ProcessTask" }, - { "task_chain", m_task_chain}, - { "tasks", json::array(m_cur_tasks_name)} + { "task_type", "ProcessTask" }, + { "task_chain", m_task_chain }, + { "tasks", json::array(m_cur_tasks_name) } }; m_callback(AsstMsg::TaskStart, task_start_json, m_callback_arg); @@ -44,8 +44,8 @@ bool ProcessTask::run() { "type", static_cast(task_info_ptr->action) }, { "exec_times", task_info_ptr->exec_times }, { "max_times", task_info_ptr->max_times }, - { "task_type", "ProcessTask"}, - { "algorithm", static_cast(task_info_ptr->algorithm)} + { "task_type", "ProcessTask" }, + { "algorithm", static_cast(task_info_ptr->algorithm) } }; m_callback(AsstMsg::TaskMatched, callback_json, m_callback_arg); @@ -73,8 +73,7 @@ bool ProcessTask::run() case ProcessTaskAction::ClickSelf: exec_click_task(rect); break; - case ProcessTaskAction::ClickRand: - { + case ProcessTaskAction::ClickRand: { static const Rect full_rect(0, 0, GeneralConfiger::WindowWidthDefault, GeneralConfiger::WindowHeightDefault); exec_click_task(full_rect); } break; @@ -85,11 +84,10 @@ bool ProcessTask::run() case ProcessTaskAction::DoNothing: break; case ProcessTaskAction::Stop: - m_callback(AsstMsg::ProcessTaskStopAction, json::object{ {"task_chain", m_task_chain} }, m_callback_arg); + m_callback(AsstMsg::ProcessTaskStopAction, json::object{ { "task_chain", m_task_chain } }, m_callback_arg); need_stop = true; break; - case ProcessTaskAction::StageDrops: - { + case ProcessTaskAction::StageDrops: { cv::Mat image = ctrler.get_image(true); std::string res = resource.penguin().recognize(image); m_callback(AsstMsg::StageDrops, json::parse(res).value(), m_callback_arg); @@ -102,8 +100,7 @@ bool ProcessTask::run() if (opt.penguin_report) { PenguinUploader::upload(res); } - } - break; + } break; default: break; } @@ -177,15 +174,14 @@ void asst::ProcessTask::exec_swipe_task(ProcessTaskAction action) const static Rect left_rect(width * 0.1, height * 0.4, width * 0.1, height * 0.2); - switch (action) - { + switch (action) { case asst::ProcessTaskAction::SwipeToTheLeft: ctrler.swipe(left_rect, right_rect); break; case asst::ProcessTaskAction::SwipeToTheRight: ctrler.swipe(right_rect, left_rect); break; - default: // 走不到这里,TODO 报个错 + default: // 走不到这里,TODO 报个错 break; } -} \ No newline at end of file +} diff --git a/src/MeoAssistance/ProcessTask.h b/src/MeoAssistance/ProcessTask.h index d901555aac..e268e99fca 100644 --- a/src/MeoAssistance/ProcessTask.h +++ b/src/MeoAssistance/ProcessTask.h @@ -1,9 +1,10 @@ -#pragma once +#pragma once #include "AbstractTask.h" #include "AsstDef.h" -namespace asst { +namespace asst +{ // 流程任务,按照配置文件里的设置的流程运行 class ProcessTask : public AbstractTask { @@ -13,7 +14,8 @@ namespace asst { virtual bool run() override; - virtual void set_tasks(const std::vector& cur_tasks_name) { + virtual void set_tasks(const std::vector& cur_tasks_name) + { m_cur_tasks_name = cur_tasks_name; } @@ -24,4 +26,4 @@ namespace asst { std::vector m_cur_tasks_name; }; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/ProcessTaskImageAnalyzer.cpp b/src/MeoAssistance/ProcessTaskImageAnalyzer.cpp index 4fad9fa415..9bfe647192 100644 --- a/src/MeoAssistance/ProcessTaskImageAnalyzer.cpp +++ b/src/MeoAssistance/ProcessTaskImageAnalyzer.cpp @@ -1,10 +1,10 @@ -#include "ProcessTaskImageAnalyzer.h" +#include "ProcessTaskImageAnalyzer.h" -#include "Resource.h" -#include "MatchImageAnalyzer.h" -#include "OcrImageAnalyzer.h" #include "AsstUtils.hpp" #include "Logger.hpp" +#include "MatchImageAnalyzer.h" +#include "OcrImageAnalyzer.h" +#include "Resource.h" asst::ProcessTaskImageAnalyzer::ProcessTaskImageAnalyzer(const cv::Mat& image, std::vector tasks_name) : AbstractImageAnalyzer(image), @@ -116,8 +116,7 @@ bool asst::ProcessTaskImageAnalyzer::analyze() for (const std::string& task_name : m_tasks_name) { auto task_ptr = resource.task().task_ptr(task_name); - switch (task_ptr->algorithm) - { + switch (task_ptr->algorithm) { case AlgorithmType::JustReturn: m_result = task_ptr; return true; @@ -142,4 +141,4 @@ void asst::ProcessTaskImageAnalyzer::set_image(const cv::Mat & image) { AbstractImageAnalyzer::set_image(image); reset(); -} \ No newline at end of file +} diff --git a/src/MeoAssistance/ProcessTaskImageAnalyzer.h b/src/MeoAssistance/ProcessTaskImageAnalyzer.h index 86887ae99d..778877ce7f 100644 --- a/src/MeoAssistance/ProcessTaskImageAnalyzer.h +++ b/src/MeoAssistance/ProcessTaskImageAnalyzer.h @@ -1,13 +1,14 @@ -#pragma once +#pragma once #include "AbstractImageAnalyzer.h" -#include -#include #include +#include +#include #include "AsstDef.h" -namespace asst { +namespace asst +{ class OcrImageAnalyzer; class MatchImageAnalyzer; @@ -22,21 +23,27 @@ namespace asst { virtual bool analyze() override; virtual void set_image(const cv::Mat& image) override; - void set_tasks(std::vector tasks_name) { + void set_tasks(std::vector tasks_name) + { m_tasks_name = std::move(tasks_name); } - std::shared_ptr get_result() const noexcept { + std::shared_ptr get_result() const noexcept + { return m_result; } - const Rect& get_rect() const noexcept { + const Rect& get_rect() const noexcept + { return m_result_rect; } + private: // 该分析器不支持外部设置ROI - virtual void set_roi(const Rect& roi) noexcept override { + virtual void set_roi(const Rect& roi) noexcept override + { AbstractImageAnalyzer::set_roi(roi); } - virtual void set_image(const cv::Mat& image, const Rect& roi) { + virtual void set_image(const cv::Mat& image, const Rect& roi) + { AbstractImageAnalyzer::set_image(image, roi); } bool match_analyze(std::shared_ptr task_ptr); diff --git a/src/MeoAssistance/RecruitConfiger.cpp b/src/MeoAssistance/RecruitConfiger.cpp index 6e97a06cf7..6a661c66a4 100644 --- a/src/MeoAssistance/RecruitConfiger.cpp +++ b/src/MeoAssistance/RecruitConfiger.cpp @@ -1,4 +1,4 @@ -#include "RecruitConfiger.h" +#include "RecruitConfiger.h" #include @@ -29,12 +29,9 @@ bool asst::RecruitConfiger::parse(const json::value& json) } // 按干员等级排个序 - std::sort(m_all_opers.begin(), m_all_opers.end(), []( - const auto& lhs, - const auto& rhs) - -> bool { - return lhs.level > rhs.level; - }); + std::sort(m_all_opers.begin(), m_all_opers.end(), [](const auto& lhs, const auto& rhs) -> bool { + return lhs.level > rhs.level; + }); return true; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/RecruitConfiger.h b/src/MeoAssistance/RecruitConfiger.h index 241f65881c..3664f8b084 100644 --- a/src/MeoAssistance/RecruitConfiger.h +++ b/src/MeoAssistance/RecruitConfiger.h @@ -1,16 +1,18 @@ -#pragma once +#pragma once #include "AbstractConfiger.h" #include -#include #include +#include #include "AsstDef.h" -namespace asst { +namespace asst +{ // 干员信息,公开招募相关 - struct RecruitOperInfo { + struct RecruitOperInfo + { std::string name; std::string type; int level = 0; @@ -21,7 +23,8 @@ namespace asst { }; // 公开招募的干员组合 - struct RecruitOperCombs { + struct RecruitOperCombs + { std::vector opers; int max_level = 0; int min_level = 0; @@ -51,4 +54,4 @@ namespace asst { std::vector m_all_opers; }; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/RecruitImageAnalyzer.cpp b/src/MeoAssistance/RecruitImageAnalyzer.cpp index 16640d584f..da28ea99f7 100644 --- a/src/MeoAssistance/RecruitImageAnalyzer.cpp +++ b/src/MeoAssistance/RecruitImageAnalyzer.cpp @@ -1,8 +1,8 @@ -#include "RecruitImageAnalyzer.h" +#include "RecruitImageAnalyzer.h" -#include "Resource.h" -#include "OcrImageAnalyzer.h" #include "MatchImageAnalyzer.h" +#include "OcrImageAnalyzer.h" +#include "Resource.h" bool asst::RecruitImageAnalyzer::analyze() { @@ -68,4 +68,4 @@ bool asst::RecruitImageAnalyzer::time_analyze() return true; } return false; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/RecruitImageAnalyzer.h b/src/MeoAssistance/RecruitImageAnalyzer.h index 472da157b2..3056bdaed0 100644 --- a/src/MeoAssistance/RecruitImageAnalyzer.h +++ b/src/MeoAssistance/RecruitImageAnalyzer.h @@ -1,9 +1,10 @@ -#pragma once +#pragma once #include "AbstractImageAnalyzer.h" #include "AsstDef.h" -namespace asst { +namespace asst +{ class RecruitImageAnalyzer final : public AbstractImageAnalyzer { public: @@ -13,18 +14,23 @@ namespace asst { virtual bool analyze() override; - const std::vector& get_tags_result() const noexcept { + const std::vector& get_tags_result() const noexcept + { return m_tags_result; } - const std::vector& get_set_time_rect() const noexcept { + const std::vector& get_set_time_rect() const noexcept + { return m_set_time_rect; } + private: // 该分析器不支持外部设置ROI - virtual void set_roi(const Rect& roi) noexcept override { + virtual void set_roi(const Rect& roi) noexcept override + { AbstractImageAnalyzer::set_roi(roi); } - virtual void set_image(const cv::Mat& image, const Rect& roi) { + virtual void set_image(const cv::Mat& image, const Rect& roi) + { AbstractImageAnalyzer::set_image(image, roi); } bool tags_analyze(); diff --git a/src/MeoAssistance/RecruitTask.cpp b/src/MeoAssistance/RecruitTask.cpp index ad0b137fa9..e18f76e474 100644 --- a/src/MeoAssistance/RecruitTask.cpp +++ b/src/MeoAssistance/RecruitTask.cpp @@ -1,9 +1,9 @@ -#include "RecruitTask.h" +#include "RecruitTask.h" -#include -#include #include #include +#include +#include #include "Controller.h" #include "RecruitImageAnalyzer.h" @@ -14,8 +14,8 @@ using namespace asst; bool RecruitTask::run() { json::value task_start_json = json::object{ - { "task_type", "RecruitTask" }, - { "task_chain", m_task_chain}, + { "task_type", "RecruitTask" }, + { "task_chain", m_task_chain }, }; m_callback(AsstMsg::TaskStart, task_start_json, m_callback_arg); @@ -70,7 +70,7 @@ bool RecruitTask::run() for (int i = 0; i < count; ++i) { std::vector temp; for (int j = 0, mask = 1; j < len; ++j) { - if ((i & mask) != 0) { // What the fuck??? + if ((i & mask) != 0) { // What the fuck??? temp.emplace_back(all_tags.at(j).text); } mask = mask * 2; @@ -113,8 +113,10 @@ bool RecruitTask::run() oper_combs.opers.emplace_back(cur_oper); if (cur_oper.level == 1 || cur_oper.level == 2) { - if (oper_combs.min_level == 0) oper_combs.min_level = cur_oper.level; - if (oper_combs.max_level == 0) oper_combs.max_level = cur_oper.level; + if (oper_combs.min_level == 0) + oper_combs.min_level = cur_oper.level; + if (oper_combs.max_level == 0) + oper_combs.max_level = cur_oper.level; // 一星、二星干员不计入最低等级,因为拉满9小时之后不可能出1、2星 continue; } @@ -137,25 +139,24 @@ bool RecruitTask::run() for (auto&& pair : result_map) { result_vector.emplace_back(std::move(pair)); } - std::sort(result_vector.begin(), result_vector.end(), [](const auto& lhs, const auto& rhs) - ->bool { - // 最小等级大的,排前面 - if (lhs.second.min_level != rhs.second.min_level) { - return lhs.second.min_level > rhs.second.min_level; - } - // 最大等级大的,排前面 - else if (lhs.second.max_level != rhs.second.max_level) { - return lhs.second.max_level > rhs.second.max_level; - } - // 平均等级高的,排前面 - else if (std::fabs(lhs.second.avg_level - rhs.second.avg_level) > DoubleDiff) { - return lhs.second.avg_level > rhs.second.avg_level; - } - // Tag数量少的,排前面 - else { - return lhs.first.size() < rhs.first.size(); - } - }); + std::sort(result_vector.begin(), result_vector.end(), [](const auto& lhs, const auto& rhs) -> bool { + // 最小等级大的,排前面 + if (lhs.second.min_level != rhs.second.min_level) { + return lhs.second.min_level > rhs.second.min_level; + } + // 最大等级大的,排前面 + else if (lhs.second.max_level != rhs.second.max_level) { + return lhs.second.max_level > rhs.second.max_level; + } + // 平均等级高的,排前面 + else if (std::fabs(lhs.second.avg_level - rhs.second.avg_level) > DoubleDiff) { + return lhs.second.avg_level > rhs.second.avg_level; + } + // Tag数量少的,排前面 + else { + return lhs.first.size() < rhs.first.size(); + } + }); /* 整理识别结果 */ std::vector result_json_vector; @@ -185,8 +186,7 @@ bool RecruitTask::run() /* 点击最优解的tags */ if (!m_required_level.empty() && !result_vector.empty()) { - if (std::find(m_required_level.cbegin(), m_required_level.cend(), result_vector[0].second.min_level) - == m_required_level.cend()) { + if (std::find(m_required_level.cbegin(), m_required_level.cend(), result_vector[0].second.min_level) == m_required_level.cend()) { return true; } const std::vector& final_tags_name = result_vector[0].first; @@ -205,4 +205,4 @@ void RecruitTask::set_param(std::vector required_level, bool set_time) { m_required_level = std::move(required_level); m_set_time = set_time; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/RecruitTask.h b/src/MeoAssistance/RecruitTask.h index aa1b1f30ec..2956d4b305 100644 --- a/src/MeoAssistance/RecruitTask.h +++ b/src/MeoAssistance/RecruitTask.h @@ -1,8 +1,9 @@ -#pragma once +#pragma once #include "AbstractTask.h" -namespace asst { +namespace asst +{ class RecruitTask : public AbstractTask { public: @@ -16,4 +17,4 @@ namespace asst { std::vector m_required_level; bool m_set_time = false; }; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/Resource.cpp b/src/MeoAssistance/Resource.cpp index 468be726a5..8947e78ac0 100644 --- a/src/MeoAssistance/Resource.cpp +++ b/src/MeoAssistance/Resource.cpp @@ -1,4 +1,4 @@ -#include "Resource.h" +#include "Resource.h" #include #include @@ -78,4 +78,4 @@ bool asst::Resource::load(const std::string& dir) } return true; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/Resource.h b/src/MeoAssistance/Resource.h index eb4bdcbd64..530fe3ad15 100644 --- a/src/MeoAssistance/Resource.h +++ b/src/MeoAssistance/Resource.h @@ -1,93 +1,114 @@ -#pragma once +#pragma once #include "AbstractResource.h" -#include #include +#include #include -#include "TemplResource.h" #include "GeneralConfiger.h" -#include "TaskData.h" -#include "RecruitConfiger.h" -#include "ItemConfiger.h" #include "InfrastConfiger.h" -#include "UserConfiger.h" +#include "ItemConfiger.h" #include "OcrPack.h" #include "PenguinPack.h" +#include "RecruitConfiger.h" +#include "TaskData.h" +#include "TemplResource.h" +#include "UserConfiger.h" -namespace asst { +namespace asst +{ class Resource : public AbstractResource { public: virtual ~Resource() = default; - static Resource& get_instance() { + static Resource& get_instance() + { static Resource unique_instance; return unique_instance; } virtual bool load(const std::string& dir) override; - TemplResource& templ() noexcept { + TemplResource& templ() noexcept + { return m_templ_resource_unique_ins; } - GeneralConfiger& cfg() noexcept { + GeneralConfiger& cfg() noexcept + { return m_general_cfg_unique_ins; } - TaskData& task() noexcept { + TaskData& task() noexcept + { return m_task_data_unique_ins; } - RecruitConfiger& recruit() noexcept { + RecruitConfiger& recruit() noexcept + { return m_recruit_cfg_unique_ins; } - ItemConfiger& item() noexcept { + ItemConfiger& item() noexcept + { return m_item_cfg_unique_ins; } - InfrastConfiger& infrast() noexcept { + InfrastConfiger& infrast() noexcept + { return m_infrast_cfg_unique_ins; } - UserConfiger& user() noexcept { + UserConfiger& user() noexcept + { return m_user_cfg_unique_ins; } - OcrPack& ocr() noexcept { + OcrPack& ocr() noexcept + { return m_ocr_pack_unique_ins; } - PenguinPack& penguin() noexcept { + PenguinPack& penguin() noexcept + { return m_penguin_pack_unique_ins; } - const TemplResource& templ() const noexcept { + const TemplResource& templ() const noexcept + { return m_templ_resource_unique_ins; } - const GeneralConfiger& cfg() const noexcept { + const GeneralConfiger& cfg() const noexcept + { return m_general_cfg_unique_ins; } - const TaskData& task() const noexcept { + const TaskData& task() const noexcept + { return m_task_data_unique_ins; } - const RecruitConfiger& recruit() const noexcept { + const RecruitConfiger& recruit() const noexcept + { return m_recruit_cfg_unique_ins; } - const ItemConfiger& item() const noexcept { + const ItemConfiger& item() const noexcept + { return m_item_cfg_unique_ins; } - const InfrastConfiger& infrast() const noexcept { + const InfrastConfiger& infrast() const noexcept + { return m_infrast_cfg_unique_ins; } - const UserConfiger& user() const noexcept { + const UserConfiger& user() const noexcept + { return m_user_cfg_unique_ins; } - const OcrPack& ocr() const noexcept { + const OcrPack& ocr() const noexcept + { return m_ocr_pack_unique_ins; } - const PenguinPack& penguin() const noexcept { + const PenguinPack& penguin() const noexcept + { return m_penguin_pack_unique_ins; } Resource& operator=(const Resource&) = delete; Resource& operator=(Resource&&) noexcept = delete; + private: Resource() = default; diff --git a/src/MeoAssistance/RuntimeStatus.h b/src/MeoAssistance/RuntimeStatus.h index 1555fb58c0..fc222c9c63 100644 --- a/src/MeoAssistance/RuntimeStatus.h +++ b/src/MeoAssistance/RuntimeStatus.h @@ -1,9 +1,10 @@ -#pragma once +#pragma once -#include #include +#include -namespace asst { +namespace asst +{ class RuntimeStatus { public: @@ -11,12 +12,14 @@ namespace asst { RuntimeStatus(RuntimeStatus&& rhs) noexcept = delete; ~RuntimeStatus() = default; - static RuntimeStatus& get_instance() { + static RuntimeStatus& get_instance() + { static RuntimeStatus unique_instance; return unique_instance; } - std::any get(const std::string& key) const noexcept { + std::any get(const std::string& key) const noexcept + { if (auto iter = m_data.find(key); iter != m_data.cend()) { return iter->second; @@ -25,12 +28,14 @@ namespace asst { return std::any(); } } - bool exist(const std::string& key) const noexcept { + bool exist(const std::string& key) const noexcept + { return m_data.find(key) != m_data.cend(); } template - inline void set(Args &&... args) { + inline void set(Args&&... args) + { static_assert( std::is_constructible::value_type, Args...>::value, "Parameter can't be used to construct a std::unordered_map::value_type"); @@ -39,6 +44,7 @@ namespace asst { RuntimeStatus& operator=(const RuntimeStatus& rhs) = delete; RuntimeStatus& operator=(RuntimeStatus&& rhs) noexcept = delete; + private: RuntimeStatus() = default; diff --git a/src/MeoAssistance/ScreenCaptureTask.cpp b/src/MeoAssistance/ScreenCaptureTask.cpp index 7845325dd7..6a96524ca1 100644 --- a/src/MeoAssistance/ScreenCaptureTask.cpp +++ b/src/MeoAssistance/ScreenCaptureTask.cpp @@ -1,4 +1,4 @@ -#include "ScreenCaptureTask.h" +#include "ScreenCaptureTask.h" #include "AsstUtils.hpp" @@ -10,4 +10,4 @@ bool asst::ScreenCaptureTask::run() static const std::string dirname = utils::get_cur_dir() + "template\\"; return save_image(image, dirname); -} \ No newline at end of file +} diff --git a/src/MeoAssistance/ScreenCaptureTask.h b/src/MeoAssistance/ScreenCaptureTask.h index c42cae61dd..d3f3700db0 100644 --- a/src/MeoAssistance/ScreenCaptureTask.h +++ b/src/MeoAssistance/ScreenCaptureTask.h @@ -1,7 +1,8 @@ -#pragma once +#pragma once #include "AbstractTask.h" -namespace asst { +namespace asst +{ // 截图任务,主要是调试用的,制作模板匹配的素材啥的 class ScreenCaptureTask : public AbstractTask { @@ -10,6 +11,7 @@ namespace asst { virtual ~ScreenCaptureTask() = default; virtual bool run() override; + private: }; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/TaskData.cpp b/src/MeoAssistance/TaskData.cpp index 9fbde86fa7..6db20ffb02 100644 --- a/src/MeoAssistance/TaskData.cpp +++ b/src/MeoAssistance/TaskData.cpp @@ -1,4 +1,4 @@ -#include "TaskData.h" +#include "TaskData.h" #include @@ -51,37 +51,36 @@ bool asst::TaskData::set_param(const std::string& type, const std::string& param } } return true; -} - +} + const std::shared_ptr asst::TaskData::task_ptr(const std::string& name) const noexcept { if (auto iter = m_all_tasks_info.find(name); - iter != m_all_tasks_info.cend()) - { + iter != m_all_tasks_info.cend()) { return iter->second; } else { return nullptr; } -} - -const std::unordered_set& asst::TaskData::get_templ_required() const noexcept -{ - return m_templ_required; -} - +} + +const std::unordered_set& asst::TaskData::get_templ_required() const noexcept +{ + return m_templ_required; +} + std::shared_ptr asst::TaskData::task_ptr(std::string name) { return m_all_tasks_info[std::move(name)]; } -void asst::TaskData::clear_exec_times() -{ - for (auto&& [key, task] : m_all_tasks_info) { - task->exec_times = 0; - } -} - +void asst::TaskData::clear_exec_times() +{ + for (auto&& [key, task] : m_all_tasks_info) { + task->exec_times = 0; + } +} + bool asst::TaskData::parse(const json::value& json) { for (const auto& [name, task_json] : json.as_object()) { @@ -109,8 +108,7 @@ bool asst::TaskData::parse(const json::value& json) case AlgorithmType::JustReturn: task_info_ptr = std::make_shared(); break; - case AlgorithmType::MatchTemplate: - { + case AlgorithmType::MatchTemplate: { auto match_task_info_ptr = std::make_shared(); match_task_info_ptr->templ_name = task_json.get("template", name + ".png"); m_templ_required.emplace(match_task_info_ptr->templ_name); @@ -129,10 +127,8 @@ bool asst::TaskData::parse(const json::value& json) } task_info_ptr = match_task_info_ptr; - } - break; - case AlgorithmType::OcrDetect: - { + } break; + case AlgorithmType::OcrDetect: { auto ocr_task_info_ptr = std::make_shared(); for (const json::value& text : task_json.at("text").as_array()) { ocr_task_info_ptr->text.emplace_back(text.as_string()); @@ -145,8 +141,7 @@ bool asst::TaskData::parse(const json::value& json) } ocr_task_info_ptr->cache = task_json.get("cache", true); task_info_ptr = ocr_task_info_ptr; - } - break; + } break; } task_info_ptr->algorithm = algorithm; task_info_ptr->name = name; @@ -240,4 +235,4 @@ bool asst::TaskData::parse(const json::value& json) m_all_tasks_info.emplace(name, task_info_ptr); } return true; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/TaskData.h b/src/MeoAssistance/TaskData.h index 29d93eadf0..9ec30f68f2 100644 --- a/src/MeoAssistance/TaskData.h +++ b/src/MeoAssistance/TaskData.h @@ -1,12 +1,13 @@ -#pragma once +#pragma once #include "AbstractConfiger.h" +#include #include #include -#include -namespace asst { +namespace asst +{ struct TaskInfo; class TaskData : public AbstractConfiger @@ -27,4 +28,4 @@ namespace asst { std::unordered_map> m_all_tasks_info; std::unordered_set m_templ_required; }; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/TemplResource.cpp b/src/MeoAssistance/TemplResource.cpp index ba7d9d12cb..e74e7cca3e 100644 --- a/src/MeoAssistance/TemplResource.cpp +++ b/src/MeoAssistance/TemplResource.cpp @@ -1,16 +1,16 @@ -#include "TemplResource.h" +#include "TemplResource.h" -#include #include +#include #include -void asst::TemplResource::append_load_required(std::unordered_set required) noexcept -{ - m_templs_filename.insert( - std::make_move_iterator(required.begin()), - std::make_move_iterator(required.end())); -} - +void asst::TemplResource::append_load_required(std::unordered_set required) noexcept +{ + m_templs_filename.insert( + std::make_move_iterator(required.begin()), + std::make_move_iterator(required.end())); +} + bool asst::TemplResource::load(const std::string& dir) { for (const std::string& filename : m_templs_filename) { @@ -28,11 +28,11 @@ bool asst::TemplResource::load(const std::string& dir) return true; } -bool asst::TemplResource::exist_templ(const std::string& key) const noexcept -{ - return m_templs.find(key) != m_templs.cend(); -} - +bool asst::TemplResource::exist_templ(const std::string& key) const noexcept +{ + return m_templs.find(key) != m_templs.cend(); +} + const cv::Mat& asst::TemplResource::get_templ(const std::string& key) const noexcept { if (auto iter = m_templs.find(key); @@ -65,9 +65,9 @@ void asst::TemplResource::emplace_templ(std::string key, cv::Mat templ) void asst::TemplResource::emplace_hist(std::string key, cv::Mat hist, cv::Rect roi) { m_hists.emplace(std::move(key), std::make_pair(std::move(hist), std::move(roi))); +} + +void asst::TemplResource::clear_hists() noexcept +{ + m_hists.clear(); } - -void asst::TemplResource::clear_hists() noexcept -{ - m_hists.clear(); -} \ No newline at end of file diff --git a/src/MeoAssistance/TemplResource.h b/src/MeoAssistance/TemplResource.h index 14fb42100c..c932b07d37 100644 --- a/src/MeoAssistance/TemplResource.h +++ b/src/MeoAssistance/TemplResource.h @@ -1,13 +1,14 @@ -#pragma once +#pragma once #include "AbstractResource.h" -#include #include +#include #include -namespace asst { +namespace asst +{ class TemplResource : public AbstractResource { public: @@ -26,6 +27,7 @@ namespace asst { void emplace_templ(std::string key, cv::Mat templ); void emplace_hist(std::string key, cv::Mat hist, cv::Rect roi); void clear_hists() noexcept; + private: std::unordered_set m_templs_filename; std::unordered_map m_templs; diff --git a/src/MeoAssistance/UserConfiger.cpp b/src/MeoAssistance/UserConfiger.cpp index 320f120810..3235122e3e 100644 --- a/src/MeoAssistance/UserConfiger.cpp +++ b/src/MeoAssistance/UserConfiger.cpp @@ -1,4 +1,4 @@ -#include "UserConfiger.h" +#include "UserConfiger.h" #include @@ -45,4 +45,4 @@ bool asst::UserConfiger::save() ofs.close(); return true; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/UserConfiger.h b/src/MeoAssistance/UserConfiger.h index dd234bca84..cca11659b3 100644 --- a/src/MeoAssistance/UserConfiger.h +++ b/src/MeoAssistance/UserConfiger.h @@ -1,12 +1,13 @@ -#pragma once +#pragma once #include "AbstractConfiger.h" #include #include -namespace asst { - class UserConfiger :public AbstractConfiger +namespace asst +{ + class UserConfiger : public AbstractConfiger { public: virtual ~UserConfiger() = default; @@ -37,4 +38,4 @@ namespace asst { std::string m_filename; std::unordered_map m_emulators_path; }; -} \ No newline at end of file +} diff --git a/src/MeoAssistance/Version.h b/src/MeoAssistance/Version.h index e95741d0fb..78e6480fb4 100644 --- a/src/MeoAssistance/Version.h +++ b/src/MeoAssistance/Version.h @@ -1,5 +1,6 @@ -#pragma once +#pragma once -namespace asst { +namespace asst +{ constexpr static const char* Version = "v1.3-beta.3"; -} \ No newline at end of file +} diff --git a/src/MeoAsstGui/App.config b/src/MeoAsstGui/App.config index 0f63a7fed9..9681c0bbc8 100644 --- a/src/MeoAsstGui/App.config +++ b/src/MeoAsstGui/App.config @@ -1,18 +1,18 @@ - + - - + + - - + + - + \ No newline at end of file diff --git a/src/MeoAsstGui/Bootstrapper.cs b/src/MeoAsstGui/Bootstrapper.cs index f41890ee8a..f7152c4cb5 100644 --- a/src/MeoAsstGui/Bootstrapper.cs +++ b/src/MeoAsstGui/Bootstrapper.cs @@ -1,7 +1,7 @@ -using Stylet; -using StyletIoC; using System.Windows; using System.Windows.Threading; +using Stylet; +using StyletIoC; namespace MeoAsstGui { @@ -32,4 +32,4 @@ namespace MeoAsstGui // 抛异常了,可以打些日志 } } -} \ No newline at end of file +} diff --git a/src/MeoAsstGui/Helper/AsstProxy.cs b/src/MeoAsstGui/Helper/AsstProxy.cs index 6642098462..8a24840664 100644 --- a/src/MeoAsstGui/Helper/AsstProxy.cs +++ b/src/MeoAsstGui/Helper/AsstProxy.cs @@ -1,11 +1,11 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using Stylet; -using StyletIoC; using System; using System.Runtime.InteropServices; using System.Threading.Tasks; using System.Windows; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Stylet; +using StyletIoC; namespace MeoAsstGui { @@ -15,29 +15,29 @@ namespace MeoAsstGui private delegate void ProcCallbckMsg(AsstMsg msg, JObject detail); - [DllImport("MeoAssistance.dll")] static private extern IntPtr AsstCreate(); + [DllImport("MeoAssistance.dll")] private static extern IntPtr AsstCreate(); - [DllImport("MeoAssistance.dll")] static private extern IntPtr AsstCreateEx(CallbackDelegate callback, IntPtr custom_arg); + [DllImport("MeoAssistance.dll")] private static extern IntPtr AsstCreateEx(CallbackDelegate callback, IntPtr custom_arg); - [DllImport("MeoAssistance.dll")] static private extern void AsstDestory(IntPtr ptr); + [DllImport("MeoAssistance.dll")] private static extern void AsstDestory(IntPtr ptr); - [DllImport("MeoAssistance.dll")] static private extern bool AsstCatchDefault(IntPtr ptr); + [DllImport("MeoAssistance.dll")] private static extern bool AsstCatchDefault(IntPtr ptr); - [DllImport("MeoAssistance.dll")] static private extern bool AsstStartProcessTask(IntPtr ptr, string task); + [DllImport("MeoAssistance.dll")] private static extern bool AsstStartProcessTask(IntPtr ptr, string task); - [DllImport("MeoAssistance.dll")] static private extern bool AsstStartSanity(IntPtr ptr); + [DllImport("MeoAssistance.dll")] private static extern bool AsstStartSanity(IntPtr ptr); - [DllImport("MeoAssistance.dll")] static private extern bool AsstStartVisit(IntPtr ptr, bool with_shopping); + [DllImport("MeoAssistance.dll")] private static extern bool AsstStartVisit(IntPtr ptr, bool with_shopping); - [DllImport("MeoAssistance.dll")] static private extern bool AsstStartRecruiting(IntPtr ptr, int[] required_level, int required_len, bool set_time); + [DllImport("MeoAssistance.dll")] private static extern bool AsstStartRecruiting(IntPtr ptr, int[] required_level, int required_len, bool set_time); - [DllImport("MeoAssistance.dll")] static private extern bool AsstStartInfrastShift(IntPtr ptr, int work_mode, string[] order, int order_len, int uses_of_drones, double dorm_threshold); + [DllImport("MeoAssistance.dll")] private static extern bool AsstStartInfrastShift(IntPtr ptr, int work_mode, string[] order, int order_len, int uses_of_drones, double dorm_threshold); - [DllImport("MeoAssistance.dll")] static private extern bool AsstStartDebugTask(IntPtr ptr); + [DllImport("MeoAssistance.dll")] private static extern bool AsstStartDebugTask(IntPtr ptr); - [DllImport("MeoAssistance.dll")] static private extern void AsstStop(IntPtr ptr); + [DllImport("MeoAssistance.dll")] private static extern void AsstStop(IntPtr ptr); - [DllImport("MeoAssistance.dll")] static private extern bool AsstSetParam(IntPtr p_asst, string type, string param, string value); + [DllImport("MeoAssistance.dll")] private static extern bool AsstSetParam(IntPtr p_asst, string type, string param, string value); private CallbackDelegate _callback; @@ -348,4 +348,4 @@ namespace MeoAsstGui Aggressive, // 激进换班模式:会对每一个设施进行换班,计算单设施内最优解,但不会将其他设施中的干员替换过来;即按工作状态排序,仅选择前面的干员 Extreme // 偏激换班模式:会对每一个设施进行换班,计算全局的单设施内最优解,为追求更高效率,会将其他设施内的干员也替换过来;即按技能排序,计算所有拥有该设施技能的干员效率,无论他在不在其他地方工作 }; -} \ No newline at end of file +} diff --git a/src/MeoAsstGui/Helper/ViewStatusStorage.cs b/src/MeoAsstGui/Helper/ViewStatusStorage.cs index 403f46d5cd..534ef3c53d 100644 --- a/src/MeoAsstGui/Helper/ViewStatusStorage.cs +++ b/src/MeoAsstGui/Helper/ViewStatusStorage.cs @@ -1,7 +1,7 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; using System; using System.IO; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; namespace MeoAsstGui { @@ -67,4 +67,4 @@ namespace MeoAsstGui return true; } } -} \ No newline at end of file +} diff --git a/src/MeoAsstGui/ViewModels/InfrastructureConstructionViewModel.cs b/src/MeoAsstGui/ViewModels/InfrastructureConstructionViewModel.cs index 2a251c940d..325eb8fe1a 100644 --- a/src/MeoAsstGui/ViewModels/InfrastructureConstructionViewModel.cs +++ b/src/MeoAsstGui/ViewModels/InfrastructureConstructionViewModel.cs @@ -1,8 +1,8 @@ -using Stylet; -using StyletIoC; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Threading.Tasks; +using Stylet; +using StyletIoC; namespace MeoAsstGui { @@ -290,4 +290,4 @@ namespace MeoAsstGui } } } -} \ No newline at end of file +} diff --git a/src/MeoAsstGui/ViewModels/MainFunctionViewModel.cs b/src/MeoAsstGui/ViewModels/MainFunctionViewModel.cs index 6f872eade3..d6e0dbf7b2 100644 --- a/src/MeoAsstGui/ViewModels/MainFunctionViewModel.cs +++ b/src/MeoAsstGui/ViewModels/MainFunctionViewModel.cs @@ -1,6 +1,6 @@ -using Stylet; -using StyletIoC; using System.Threading.Tasks; +using Stylet; +using StyletIoC; namespace MeoAsstGui { @@ -316,4 +316,4 @@ namespace MeoAsstGui ExecInfo = ""; } } -} \ No newline at end of file +} diff --git a/src/MeoAsstGui/ViewModels/RecruitViewModel.cs b/src/MeoAsstGui/ViewModels/RecruitViewModel.cs index 852ef806eb..5f8533dd4a 100644 --- a/src/MeoAsstGui/ViewModels/RecruitViewModel.cs +++ b/src/MeoAsstGui/ViewModels/RecruitViewModel.cs @@ -1,8 +1,7 @@ -using Stylet; -using StyletIoC; using System.Collections.Generic; - using System.Threading.Tasks; +using Stylet; +using StyletIoC; namespace MeoAsstGui { @@ -139,4 +138,4 @@ namespace MeoAsstGui asstProxy.AsstStartRecruiting(levelList.ToArray(), levelList.Count, AutoSetTime); } } -} \ No newline at end of file +} diff --git a/src/MeoAsstGui/ViewModels/RootViewModel.cs b/src/MeoAsstGui/ViewModels/RootViewModel.cs index 02a3f2884a..e868c418cd 100644 --- a/src/MeoAsstGui/ViewModels/RootViewModel.cs +++ b/src/MeoAsstGui/ViewModels/RootViewModel.cs @@ -1,6 +1,6 @@ -using Stylet; -using StyletIoC; using System.Threading.Tasks; +using Stylet; +using StyletIoC; namespace MeoAsstGui { @@ -76,4 +76,4 @@ namespace MeoAsstGui } } } -} \ No newline at end of file +} diff --git a/src/MeoAsstGui/ViewModels/VersionUpdateViewModel.cs b/src/MeoAsstGui/ViewModels/VersionUpdateViewModel.cs index 9e86c09dfc..dba61b99ef 100644 --- a/src/MeoAsstGui/ViewModels/VersionUpdateViewModel.cs +++ b/src/MeoAsstGui/ViewModels/VersionUpdateViewModel.cs @@ -1,7 +1,3 @@ -using Microsoft.Toolkit.Uwp.Notifications; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using Stylet; using System; using System.Collections.Generic; using System.IO; @@ -9,6 +5,10 @@ using System.Net; using System.Runtime.InteropServices; using System.Text; using System.Windows; +using Microsoft.Toolkit.Uwp.Notifications; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Stylet; namespace MeoAsstGui { @@ -21,7 +21,7 @@ namespace MeoAsstGui _windowManager = windowManager; } - [DllImport("MeoAssistance.dll")] static private extern IntPtr AsstGetVersion(); + [DllImport("MeoAssistance.dll")] private static extern IntPtr AsstGetVersion(); private string _curVersion = Marshal.PtrToStringAnsi(AsstGetVersion()); private string _latestVersion; @@ -322,4 +322,4 @@ namespace MeoAsstGui UpdateInfo = ""; } } -} \ No newline at end of file +} diff --git a/src/MeoAsstGui/Views/InfrastructureConstructionView.xaml b/src/MeoAsstGui/Views/InfrastructureConstructionView.xaml index 6b404abead..1f80ea0229 100644 --- a/src/MeoAsstGui/Views/InfrastructureConstructionView.xaml +++ b/src/MeoAsstGui/Views/InfrastructureConstructionView.xaml @@ -1,11 +1,11 @@  diff --git a/src/MeoAsstGui/Views/MainFunctionView.xaml b/src/MeoAsstGui/Views/MainFunctionView.xaml index 20ed9c77c1..b0c24e5eab 100644 --- a/src/MeoAsstGui/Views/MainFunctionView.xaml +++ b/src/MeoAsstGui/Views/MainFunctionView.xaml @@ -1,11 +1,11 @@