Skip to content

Commit

Permalink
适配1.1更新 使用数字按键代替部分点击事件 优化框架提高可扩展性 调整鼠标移动速度 调整搜索点击逻辑 调整等待时长参数
Browse files Browse the repository at this point in the history
  • Loading branch information
UCPr251 committed Aug 14, 2024
1 parent 04784b6 commit fd77848
Show file tree
Hide file tree
Showing 16 changed files with 242 additions and 121 deletions.
19 changes: 9 additions & 10 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,18 @@ body:
validations:
required: true

- type: input
attributes:
label: 录屏链接
description: 请输入该问题出现前后全过程的录屏链接。如果问题无法复现,在前面描述清楚忽略此项即可
placeholder: https://lanzou.com
validations:
required: true

- type: input
attributes:
label: 使用的版本?
description: 所使用的脚本的版本
placeholder: v1.3.1
description: 所使用的脚本的版本,如v1.4.0
value: v1.
validations:
required: true
Expand Down Expand Up @@ -67,11 +74,3 @@ body:
attributes:
label: 其他说明
description: 如果有任何补充说明,请在此补充

- type: input
attributes:
label: 录屏链接
description: 请输入该问题出现前后全过程的录屏链接
placeholder: https://lanzou.com
validations:
required: true
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@
- 基于 [**AutoHotKey v2**](https://www.autohotkey.com) 实现的 **零号业绩****零号空洞银行存款** 快速刷取
> 3\~4分钟一把,20业绩+存款到手,3小时不到就能刷满一周900业绩上限
> <br>关闭存银行后约2.5分钟一把,2小时就能刷满
- 简单轻量易用,~~对于不同 **分辨率、帧率、HDR、游戏内字体粗细等** 具有良好的适应性~~(等1.1版本大更后再适配新的走格子)
- 简单轻量易用,对于不同 **分辨率、帧率、缩放、HDR、游戏内字体粗细等** 具有良好的适应性

## 使用前提

**以下四个要求缺一不可!**
**以下要求缺一不可**

- 1. **全屏** 运行游戏
- 2. 默认战斗角色 **至少3位**
- 2. 默认 **3位** 战斗角色
- 3. **以管理员身份运行** 脚本
- 4. 已激活作战攻略的 **开局炸弹补给**
- 5. 设置要求(系统默认即可):
- 快捷手册快捷键:F2(用于进入零号空洞)
- 棋盘邦布插件快捷使用:长按(用于使用炸弹)

## 下载、打开方法

Expand All @@ -40,17 +43,17 @@

## 注意事项

1. 本脚本基于固定坐标和像素点颜色查找实现,设计分辨率1920\*1080,按照等比缩放处理其他分辨率,因此如果在不修改设置的情况下脚本无法正常运行,建议 **显示器和游戏** 的画面分辨率设置为 **长宽比16:9****关闭HDR** 后重新运行脚本
> 已测试可用分辨率:1920\*1080、2560\*1440、2880\*1800(对应游戏分辨率2304\*1440)、3840\*2160
1. 本脚本基于固定坐标和像素点颜色查找实现,设计分辨率比例:16:9、16:10,其他比例待适配
<br>如果在不修改分辨率的情况下脚本无法正常运行,建议 **显示器和游戏** 的画面分辨率设置为 **长宽比16:9****关闭HDR** 后重新运行脚本

2. 由于实现原理较简易,此脚本无法保证在所有情况下都能稳定运行。
<br>若出现失效、意外报错,请尝试重启脚本后于主界面重新运行。
<br>若仍无法正常运行,请提出[issue](https://gitee.com/UCPr251/zzzAuto/issues/new?template=bug.yml)并按照[issue](https://gitee.com/UCPr251/zzzAuto/issues/new?template=bug.yml)模板描述提供所需信息

3. 由于电脑配置的差异,实际动画加载时长可能比预设的更久进而导致错误,可自行修改源码的[休眠系数](零号业绩.ahk#L36)延长全局的等待时长
3. 由于电脑配置的差异,实际动画加载时长可能比预设的更久进而导致错误,可自行修改源码的[休眠系数](零号业绩.ahk#L37)延长全局的等待时长

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

Expand Down
22 changes: 7 additions & 15 deletions components/charOperation.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,18 @@ charOperation() {
activateZZZ()
RandomSleep()
; 进入快捷手册
Press('Escape')
RandomSleep(1300, 1500)
pixelSearchAndClick(699, 949, 734, 996, 730, 970, 0xffffff)
Press('F2')
RandomSleep(1000, 1200)
; 点击挑战
if (PixelSearchPre(&X, &Y, 1490, 160, 1535, 200, 0xbbbbbb)) {
if (PixelSearchPre(&X, &Y, c.快捷手册.挑战_灰色*)) {
SimulateClick(X, Y)
} else {
pixelSearchAndClick(1490, 160, 1535, 200, 1513, 185, 0x000000)
pixelSearchAndClick(c.快捷手册.挑战_黑色*)
}
RandomSleep()
; 点击零号空洞
pixelSearchAndClick(275, 463, 380, 490, 330, 475, 0xaaaaaa)
RandomSleep()
; 点击前往
pixelSearchAndClick(1424, 353, 1476, 390, 1450, 370, 0xffffff)
RandomSleep()
; 点击确定(传送)
pixelSearchAndClick(1000, 600, 1100, 640, 1125, 620, 0x00cc0d)
pixelSearchAndClick(c.快捷手册.零号空洞*)
pixelSearchAndClick(c.快捷手册.前往*)
pixelSearchAndClick(c.快捷手册.传送*)
RandomSleep(3000, 4000)
; 验证是否成功进入零号空洞选择界面
mode := recogLocation()
if (mode != 2) {
return false
Expand Down
21 changes: 10 additions & 11 deletions components/choose.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ choose() {
Press("Space", 16)
rgbs := [
[0xb2eb47, () => 1], ; 恢复身体
[0x10cbf4, () => pixelSearchAndClick(930, 700, 1000, 760, 960, 730, 0xffffff)], ; 降压准备
[0xff802c, () => pixelSearchAndClick(930, 700, 1000, 760, 960, 730, 0xffffff)], ; 邦布插件
[0x10cbf4, () => pixelSearchAndClick(c.空洞.2.降压准备*)], ; 降压准备
[0xc01c00, 1], ; 侵蚀物资
[0xaa7cff, 2], ; 垃圾物资或催化
]
clickFnc := 0
loop (10) {
for (rgb in rgbs) {
PixelSearchPre(&FoundX, &FoundY, 1360, 490, 1390, 763, rgb[1])
clone := c.空洞.选项框.Clone()
clone.Push(rgb[1])
PixelSearchPre(&FoundX, &FoundY, clone*)
if (FoundX && FoundY) {
SimulateClick(FoundX, FoundY)
clickFnc := rgb[2]
Expand All @@ -37,25 +38,23 @@ choose() {
; 未找到对应选项
if (clickFnc = 0) {
return false
; 侵蚀物资
} else if (clickFnc = 1) {
} else if (clickFnc = 1) { ; 侵蚀物资
; 领取铭徽
MingHui()
; 加载侵蚀动画
RandomSleep(4800, 5200)
RandomSleep(1800, 2000)
loop (10) {
; 确认侵蚀 或 集齐四个同类铭徽触发的赠送铭徽确定(特殊)
if (PixelSearchPre(&X, &Y, 840, 620, 1000, 810, 0x00cc0d)) {
if (PixelSearchPre(&X, &Y, c.空洞.侵蚀*) || PixelSearchPre(&X, &Y, c.空洞.集齐铭徽*)) {
SimulateClick(X, Y)
RandomSleep(4800, 5200)
RandomSleep(1800, 2000)
}
Sleep(100)
}
; 垃圾物资或催化
} else if (clickFnc = 2) {
} else if (clickFnc = 2) { ; 垃圾物资或催化
loop (10) {
; 点击确定
if (PixelSearchPre(&X, &Y, 930, 750, 985, 810, 0xffffff)) {
if (PixelSearchPre(&X, &Y, c.空洞.确定*)) {
SimulateClick(X, Y)
RandomSleep(4000, 4200)
}
Expand Down
25 changes: 17 additions & 8 deletions components/common.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RandomSleep(ms1 := 50, ms2 := 100) => Sleep(Random(Round(ms1 * sleepCoefficient)
MingHui(isTry := false) {
X := 0, Y := 0
loop (10) {
if (PixelSearchPre(&X, &Y, 930, 760, 1000, 810, 0xffffff, variation // 2)) {
if (PixelSearchPre(&X, &Y, c.空洞.铭徽*)) {
break
}
Sleep(100)
Expand All @@ -32,7 +32,7 @@ MingHui(isTry := false) {
return false
}
MsgBox("未找到铭徽选择框,将使用默认位置", "警告", "Icon! T1")
X := 960, Y := 790
X := c.空洞.铭徽[5], Y := c.空洞.铭徽[6]
preprocess(&X, &Y) ; 缩放处理默认坐标
}
SimulateClick(X, Y)
Expand Down Expand Up @@ -69,8 +69,9 @@ RandomMouseMove(TargetX, TargetY) {
MouseGetPos(&StartX, &StartY)
Distance := Sqrt((TargetX - StartX) ** 2 + (TargetY - StartY) ** 2)
MinSpeed := 25
MaxSpeed := 35
Speed := MinSpeed + Random() * (MaxSpeed - MinSpeed)
MaxSpeed := 30
; 鼠标移动速度,适当缩放确保效果
Speed := (MinSpeed + Random() * (MaxSpeed - MinSpeed)) * (A_ScreenWidth / 1920)
; 生成随机控制点用于贝塞尔曲线
ControlPoint1X := StartX + Random() * (TargetX - StartX) / 2
ControlPoint1Y := StartY + Random() * (TargetY - StartY) / 2
Expand Down Expand Up @@ -101,7 +102,15 @@ SimulateClick(x?, y?, clickCount := 1) {
}
/** 对坐标进行缩放预处理的像素搜索,取真实坐标 */
PixelSearchPre(&X, &Y, X1, Y1, X2, Y2, Color, Tolerance := variation) {
PixelSearchPre(&X, &Y, X1, Y1, X2, Y2, Color, Tolerance := variation, transColor?, transTolerance?) {
if (IsSet(transColor)) {
Color := transColor
if (IsSet(transTolerance)) {
Tolerance := transTolerance
} else {
Tolerance := variation
}
}
preprocess(&X1, &Y1)
preprocess(&X2, &Y2)
return PixelSearch(&X, &Y, X1, Y1, X2, Y2, Color, Tolerance)
Expand All @@ -119,19 +128,19 @@ PixelSearchPre(&X, &Y, X1, Y1, X2, Y2, Color, Tolerance := variation) {
*/
pixelSearchAndClick(X1, Y1, X2, Y2, defaultX, defaultY, Color) {
X := 0, Y := 0
loop (10) {
loop (25) {
if (PixelSearchPre(&X, &Y, X1, Y1, X2, Y2, Color)) {
break
}
Sleep(100)
}
if (!X || !Y) {
MsgBox("未找到像素点" Color ",将使用默认位置", "警告", "Icon! T1")
MsgBox(Format("未找到像素点{1:#x},使用默认位置" defaultX " " defaultY, Color), "警告", "Icon! T1")
X := defaultX, Y := defaultY
preprocess(&X, &Y) ; 缩放处理默认坐标
}
RandomSleep()
SimulateClick(X, Y)
RandomSleep()
return [X, Y]
}

Expand Down
125 changes: 125 additions & 0 deletions components/coordsData.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
setRatio() {
coordsData := {
16x9: {
角色操作: {
M: [1170, 880, 1800, 920, 0xffffff],
Q: [1770, 1020, 1790, 1050, 0xffffff],
Tab: [1800, 100, 1850, 130, 0xffffff]
},
零号选择: {
资质考核: [240, 700, 260, 750, 0x78cc00],
旧都列车: [580, 780, 600, 850, 660, 770, 0x78cc00],
施工废墟: [680, 410, 700, 450, 0x78cc00]
},
旧都列车: {
前线: [1600, 349, 1800, 420, 1706, 374, 0xbff700],
下一步: [1660, 960, 1740, 1040, 1707, 1028, 0xffffff],
出战: [1660, 960, 1740, 1040, 1707, 1028, 0xffffff]
},
快捷手册: {
挑战_灰色: [1490, 160, 1535, 200, 0xbbbbbb],
挑战_黑色: [1490, 160, 1535, 200, 1513, 185, 0x000000],
零号空洞: [275, 463, 380, 490, 330, 475, 0xaaaaaa],
前往: [1424, 353, 1476, 390, 1450, 370, 0xffffff],
传送: [1000, 600, 1100, 640, 1125, 620, 0x00cc0d]
},
空洞: {
铭徽: [930, 760, 1000, 810, 960, 790, 0xffffff],
侵蚀: [840, 620, 1000, 810, 0x00cc0d],
确定: [930, 750, 985, 810, 0xffffff],
选项框: [1360, 490, 1390, 763],
集齐铭徽: [840, 620, 1000, 810, 0x00cc0d],
1: {
右上终点: [1300, 220, 1380, 270, 0xf63d49],
右下终点: [1300, 840, 1400, 900, 0xeb2a2c],
战斗: {
计时: [1230, 430, 1370, 610, 0xffc300],
确定键: [1130, 840, 1190, 1020, 0xffffff],
确定绿勾: [1000, 840, 1040, 1020, 0x00cc0d]
}
},
2: {
降压准备: [930, 700, 1000, 760, 960, 730, 0xffffff],
银行: {
礼包: [1340, 540, 1380, 600, 0xaa7cff],
不要礼包: [1400, 660, 1460, 690, 1653, 678, 0xffffff]
}
},
退出副本: {
放弃: [1580, 960, 1600, 1050, 1712, 1026, 0xcb0000],
确定: [1000, 600, 1100, 640, 1125, 620, 0x00cc0d]
},
结算: {
零号业绩: [1320, 600, 1440, 666, 0xffb500],
完成: [1670, 970, 1730, 1040, 1700, 1027, 0xffffff]
}
}
},
16x10: {
角色操作: {
M: [1170, 880, 1800, 920, 0xffffff],
Q: [1770, 1020, 1790, 1050, 0xffffff],
Tab: [1800, 100, 1850, 130, 0xffffff]
},
零号选择: {
资质考核: [240, 700, 260, 750, 0x78cc00],
旧都列车: [580, 780, 600, 850, 660, 770, 0x78cc00],
施工废墟: [680, 410, 700, 450, 0x78cc00]
},
旧都列车: {
前线: [1600, 349, 1800, 420, 1706, 374, 0xbff700],
下一步: [1660, 960, 1740, 1040, 1707, 1028, 0xffffff],
出战: [1660, 960, 1740, 1040, 1707, 1028, 0xffffff]
},
快捷手册: {
挑战_灰色: [1490, 160, 1535, 200, 0xbbbbbb],
挑战_黑色: [1490, 160, 1535, 200, 1513, 185, 0x000000],
零号空洞: [275, 463, 380, 490, 330, 475, 0xaaaaaa],
前往: [1424, 353, 1476, 390, 1450, 370, 0xffffff],
传送: [1000, 600, 1100, 640, 1125, 620, 0x00cc0d]
},
空洞: {
铭徽: [930, 760, 1000, 810, 960, 790, 0xffffff],
侵蚀: [840, 620, 1000, 810, 0x00cc0d],
确定: [930, 750, 985, 810, 0xffffff],
选项框: [1360, 490, 1390, 763],
集齐铭徽: [840, 620, 1000, 810, 0x00cc0d],
1: {
右上终点: [1300, 220, 1380, 270, 0xf63d49],
右下终点: [1300, 840, 1400, 900, 0xeb2a2c],
战斗: {
计时: [1230, 430, 1370, 610, 0xffc300],
确定键: [1130, 840, 1190, 1020, 0xffffff],
确定绿勾: [1000, 840, 1040, 1020, 0x00cc0d]
}
},
2: {
降压准备: [930, 700, 1000, 760, 960, 730, 0xffffff],
银行: {
礼包: [1340, 540, 1380, 600, 0xaa7cff],
不要礼包: [1400, 660, 1460, 690, 1653, 678, 0xffffff]
}
},
退出副本: {
放弃: [1580, 960, 1600, 1050, 1712, 1026, 0xcb0000],
确定: [1000, 600, 1100, 640, 1125, 620, 0x00cc0d]
},
结算: {
零号业绩: [1320, 600, 1440, 666, 0xffb500],
完成: [1670, 970, 1730, 1040, 1700, 1027, 0xffffff]
}
}
},
}
ratio := A_ScreenWidth / A_ScreenHeight
for (key, value in coordsData.OwnProps()) {
sp := StrSplit(key, "x")
designRatio := sp[1] / sp[2]
if (designRatio = ratio) {
global c := value
return
}
}
MsgBox("当前显示器分辨率" A_ScreenWidth "x" A_ScreenHeight "无内置数据,将使用16:9的分辨率比例数据进行缩放处理`n若此脚本无法正常运行,请尝试更改显示器分辨率比例为16:9", "警告", "Icon! 0x40000")
global c := coordsData.16x9
}
18 changes: 4 additions & 14 deletions components/enterFuben.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,9 @@ enterFuben() {
activateZZZ()
debugLog("【step1】进入副本")
RandomSleep()

; 进入旧都列车
pixelSearchAndClick(610, 750, 750, 820, 665, 792, 0xffffff)
; 加载动画
RandomSleep(1000, 1200)
; 进入旧都列车·前线
pixelSearchAndClick(1600, 349, 1800, 420, 1706, 374, 0xbff700)
; 下一步
pixelSearchAndClick(1660, 960, 1740, 1040, 1707, 1028, 0xffffff)
; 加载动画
RandomSleep(1000, 1200)
; 出战
pixelSearchAndClick(1660, 960, 1740, 1040, 1707, 1028, 0xffffff)
; 加载动画
pixelSearchAndClick(c.零号选择.旧都列车*)
pixelSearchAndClick(c.旧都列车.前线*)
pixelSearchAndClick(c.旧都列车.下一步*)
pixelSearchAndClick(c.旧都列车.出战*)
RandomSleep(17000, 18000)
}
Loading

0 comments on commit fd77848

Please sign in to comment.