Skip to content

Commit

Permalink
新增异常重试,提高容错 新增休眠系数 修复已知问题
Browse files Browse the repository at this point in the history
  • Loading branch information
UCPr251 committed Jul 27, 2024
1 parent 4d47a41 commit 94ecdde
Show file tree
Hide file tree
Showing 11 changed files with 176 additions and 97 deletions.
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
- 3. **以管理员身份运行** 脚本
- 4. 已激活作战攻略的 **开局炸弹补给**

## 下载、打开方法

- 方法一:
下载[release](https://gitee.com/UCPr251/zzzAuto/releases)最新版本的exe可执行文件(或自行下载源码编译), **右键** 该exe文件选择 **以管理员方式运行**

- 方法二:
直接克隆源码使用(需已安装好[autohotkey](https://www.autohotkey.com) v2版解释器), **右键** 零号业绩.ahk文件选择 **以管理员方式运行**

## 使用方法

- Alt+Z :启动脚本(自动循环刷取,默认情况下会一直刷取直至零号业绩达到周上限)
Expand All @@ -26,26 +34,20 @@
- Alt+Q :退出脚本
- Alt+B :银行模式(开启此模式并启动脚本后,不论零号业绩是否达到周上限,都会无限循环刷取,用于刷取银行存款)

## 下载、打开方法

- 方法一:
下载[release](https://gitee.com/UCPr251/zzzAuto/releases)最新版本的exe可执行文件(或自行下载源码编译), **右键** 该exe文件选择 **以管理员方式运行**

- 方法二:
直接克隆源码使用(需已安装好[autohotkey](https://www.autohotkey.com) v2版解释器), **右键** 零号业绩.ahk文件选择 **以管理员方式运行**

## 注意事项

1. 若此脚本在你的电脑上无法正常运行,可尝试切换 **显示器和游戏** 的画面分辨率为1920\*1080全屏。本脚本设计分辨率1920\*1080,其他分辨率按照等比缩放进行操作,因此建议按照 **16:9****长宽比** 运行脚本
1. 如此脚本在你的电脑上无法正常运行,可尝试切换 **显示器和游戏** 的画面分辨率为1920\*1080全屏。本脚本设计分辨率1920\*1080,其他分辨率按照等比缩放进行操作,因此建议按照 **16:9****长宽比** 运行脚本
> 已测试可用分辨率:1920\*1080、2560\*1440、2880\*1800(对应游戏分辨率2304\*1440)、3840\*2160
2. 由于实现原理较简易,此脚本无法保证在所有情况下都能稳定运行,若出现失效、意外报错,请尝试重启脚本后于主界面重新运行。若仍存在问题,请提issue截图描述
2. 由于电脑配置的差异,实际动画加载时长可能比预设的更久进而导致错误,可自行修改源码的[休眠系数](零号业绩.ahk#L36)延长全局的等待时长

3. 由于实现原理较简易,此脚本无法保证在所有情况下都能稳定运行,若出现失效、意外报错,请尝试重启脚本后于主界面重新运行。若仍存在问题,请提issue截图描述

3. 战斗按照鲨鱼妹设计,其他角色只要哪怕一直a都能S评价即可,因此第一位建议带主C
4. 战斗按照鲨鱼妹设计,其他角色只要哪怕一直a都能S评价即可,因此第一位建议带主C
> 战斗时长一般在20~50s以内,超过50s建议换个角色试试
4. 为避免消息弹窗等的影响,建议在脚本运行期间开启 **免打扰模式**
5. 为避免消息弹窗等的影响,建议在脚本运行期间开启 **免打扰模式**

5. 请勿在脚本运行期间操作键鼠,若需操作请先暂停脚本: **Alt+P**
6. 请勿在脚本运行期间操作键鼠,若需操作请先暂停脚本: **Alt+P**

6. 本脚本完全免费公开, **严禁用于任何商业用途** ,仅供学习交流使用
7. 本脚本完全免费公开, **严禁用于任何商业用途** ,仅供学习交流使用
9 changes: 7 additions & 2 deletions components/charOperation.ahk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* - step 0
* - 角色操作界面
* - 角色操作界面进入零号空洞选择界面
*/
charOperation() {
activateZZZ()
Expand All @@ -9,7 +9,7 @@ charOperation() {
Press('Escape')
RandomSleep(1300, 1500)
pixelSearchAndClick(699, 949, 734, 996, 712, 972, 0xffffff)
Sleep(1000)
RandomSleep(1000, 1200)
; 点击挑战
if (PixelSearchPre(&X, &Y, 1490, 160, 1535, 200, 0xbbbbbb)) {
SimulateClick(X, Y)
Expand All @@ -26,4 +26,9 @@ charOperation() {
; 点击确定(传送)
pixelSearchAndClick(1000, 600, 1100, 640, 1125, 620, 0x00cc0d)
RandomSleep(3000, 4000)
mode := recogLocation()
if (mode != 2) {
return false
}
return true
}
6 changes: 3 additions & 3 deletions components/choose.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ choose() {
; 领取铭徽
MingHui()
; 加载侵蚀动画
Sleep(5000)
RandomSleep(4800, 5200)
loop (10) {
; 确认侵蚀 或 集齐四个同类铭徽触发的赠送铭徽确定(特殊)
if (PixelSearchPre(&X, &Y, 840, 620, 1000, 810, 0x00cc0d)) {
SimulateClick(X, Y)
Sleep(5000)
RandomSleep(4800, 5200)
}
Sleep(100)
}
Expand All @@ -57,7 +57,7 @@ choose() {
; 点击确定
if (PixelSearchPre(&X, &Y, 930, 750, 985, 810, 0xffffff)) {
SimulateClick(X, Y)
Sleep(4000)
RandomSleep(4000, 4200)
}
Sleep(100)
}
Expand Down
2 changes: 1 addition & 1 deletion components/common.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ debugLog(str) {
}
/** 随机休眠,默认50~100ms */
RandomSleep(ms1 := 50, ms2 := 100) => Sleep(Random(ms1, ms2))
RandomSleep(ms1 := 50, ms2 := 100) => Sleep(Random(Round(ms1 * sleepCoefficient), Round(ms2 * sleepCoefficient)))
/** 选择铭徽 */
MingHui(isTry := false) {
Expand Down
36 changes: 21 additions & 15 deletions components/fight.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,25 @@ fight() {
/** 判断战斗是否结束 */
fightIsOver() {
; 周上限提示确定
if (PixelSearchPre(&X, &Y, 950, 610, 1000, 640, 0xffffff, variation // 2)) {
SimulateClick(X, Y)
Sleep(1000)
}
loop (10) {
for (index, pattern in patterns) {
if (!PixelSearchPre(&FoundX, &FoundY, pattern*)) {
return false
judge() {
loop (10) {
for (index, pattern in patterns) {
if (!PixelSearchPre(&FoundX, &FoundY, pattern*)) {
return false
}
}
Sleep(10)
}
Sleep(10)
return true
}
FoundX := 0, FoundY := 0
if (!judge()) {
; 周上限提示确定
if (PixelSearchPre(&X, &Y, 950, 610, 1000, 640, 0xffffff, variation // 2)) {
SimulateClick(X, Y)
RandomSleep(800, 1000)
}
return false
}
debugLog("【战斗】战斗结束")
RandomSleep()
Expand All @@ -50,15 +57,14 @@ fight() {
; 选择铭徽
MingHui()
; 加载动画
Sleep(7000)
RandomSleep(7500, 8000)
return true
}
; 加载动画
Sleep(16000)
; 战斗循环
loop (60) {
RandomSleep(16000, 16200)
; 战斗循环,约8s一循环
loop (12) {
if (A_Index != 1) {
Press("Shift") ; 闪避
}
Expand Down
2 changes: 1 addition & 1 deletion components/getMoney.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ getMoney() {
Press('w')
; 加载动画
RandomSleep(2600, 2800)
X := 1800, Y := 1000
X := 1800, Y := 900
preprocess(&X, &Y)
; 点击确定(如果有)
SimulateClick(X, Y, 2)
Expand Down
2 changes: 1 addition & 1 deletion components/isLimited.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
isLimited() {
activateZZZ()
; MsgBox("【step9】判断是否上限", , "T1")
; debugLog("【step9】判断是否上限")
; 结算界面判断是否达到周上限
loop (20) {
if (PixelSearchPre(&FoundX, &FoundY, 1320, 600, 1440, 666, 0xffb500)) {
Expand Down
4 changes: 2 additions & 2 deletions components/reachEnd.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ reachEnd() {
bomb()
; 向右移动
Press("d")
RandomSleep(1800, 2000)
RandomSleep(2400, 2600)
; 选择铭徽
MingHui()
RandomSleep(1200, 1500)
Expand Down Expand Up @@ -83,6 +83,6 @@ reachEnd() {
below()
}
; 加载动画
Sleep(2000)
RandomSleep(2000, 2200)
return true
}
35 changes: 35 additions & 0 deletions components/recogLocation.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/** 识别所处界面 1:角色操作界面,2:关卡选择界面 */
recogLocation() {
/** 通过三个特殊定位点判断所处界面 */
patterns1 := [
[1170, 880, 1800, 920, 0xffffff], ; M
[1770, 1020, 1790, 1050, 0xffffff], ; Q
[1800, 100, 1850, 130, 0xffffff] ; Tab
]
patterns2 := [
[240, 700, 260, 750, 0x78cc00], ; 资质考核
[580, 780, 600, 850, 0x78cc00], ; 旧都列车
[680, 410, 700, 450, 0x78cc00] ; 施工废墟
]
judge(patterns) {
for (pattern in patterns) {
if (!PixelSearchPre(&FoundX, &FoundY, pattern*)) {
return false
}
}
return true
}
mode := 0
loop (10) {
if (judge(patterns1)) {
mode := 1
break
}
if (judge(patterns2)) {
mode := 2
break
}
Sleep(100)
}
return mode
}
2 changes: 1 addition & 1 deletion components/refuse.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ refuse() {
; 对话
Press("Space", 10)
; 加载动画
Sleep(5000)
RandomSleep(5000, 5200)
}
Loading

0 comments on commit 94ecdde

Please sign in to comment.