当前仓库属于关闭状态,部分功能使用受限,详情请查阅 仓库状态说明
4 Star 24 Fork 9

按键精灵 / 百炼英雄
关闭

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
刷新小程序版本(新手用)_随机数版本.txt 5.82 KB
一键复制 编辑 原始数据 按行查看 历史
// ----------------常量定义----------------
// 游戏名称
GameName = "百炼英雄"
// 游戏次数
GameCount = 9999
// 隐藏小程序
HideGame = 0
// 屏幕中尺寸(PC微信小程序分辨率)
WindowCenter = array(414 / 2, 780 / 2)
// 坐标偏移量(圆半径)
PosOffset = 50
// 操作等待
OptionWait = 200
// 传送等待
TransmitWait = 5800
// 重启小程序
RestartGamePos = array(275, 20, 180, 270)
RestartGameWait = 6500
// 城内空白位置
CityBlankPos = array(10, 760)
// 城内传送点
CityTransmitPos = array(240, 290)
// 野外回城
CityBackPos = array(370, 670)
// 野外回城传送点
CityBackTransmitPos = array(240, 340)
// 回城等待
CityBackWait = 6800
// 传送菜单 左侧第一个项中心点
TransmitMenuItem = array(100, 180)
// 小树精等待时间
KillBossWait_2_1 = 1800
// 大树精等待时间
KillBossWait_3_3 = 4500
// 火焰石魔等待时间
KillBossWait_3_1_1 = 1300
// 牛头等待时间
KillBossWait_3_1_2 = 1300
// ----------------基础方法封装----------------
// 获取游戏后台窗口
Sub GetWindow()
Hwnd = Plugin.Window.Find(0, GameName)
Wait OptionWait
// 强制修改游戏窗口大小
Call Plugin.Window.Size(Hwnd, WindowCenter(0) * 2, WindowCenter(1) * 2)
End Sub
// 封装等待方法
Sub Wait(time)
Delay time + RandomNum
End Sub
// 封装点击方法
Sub Click(x, y)
Call Plugin.Bkgnd.LeftClick(Hwnd, x + RandomNum, y + RandomNum)
Wait OptionWait
End Sub
// 随机数
Function RandomNum()
Dim num
// 随机偏移 [-5, 5]
num = Int((-5 - 5 + 1) * Rnd + 5)
// 返回
RandomNum = num
End Function
// 往指定方向移动x时长
Sub Move(dir, time)
// 随机偏移
centerX = WindowCenter(0) + RandomNum
centerY = WindowCenter(1) + RandomNum
// 鼠标移动到中心点
Call Plugin.Bkgnd.MoveTo(Hwnd, centerX, centerY)
Wait OptionWait
// 按下左键
Call Plugin.Bkgnd.LeftDown(Hwnd, centerX, centerY)
Wait 1
// 指定方向的坐标
newPos = GetPos(centerX, centerY, dir)
// 移动到下新经纬度
Call Plugin.Bkgnd.MoveTo(Hwnd, newPos(0), newPos(1))
// 移动时长
Wait time
// 松开左键
Call Plugin.Bkgnd.LeftUp(Hwnd, newPos(0), newPos(1))
Wait 1
End Sub
// 根据方向获取经纬度-基于中心点
Function GetPos(centerX, centerY, dir)
// 新坐标
Dim newPos(2)
// 角度转弧度
radian = dir * 3.1415926535897932 / 180
// 计算新坐标
newPos(0) = Int(centerX + PosOffset * Cos(radian))
newPos(1) = Int(centerY - PosOffset * Sin(radian))
// 返回
GetPos = newPos
End Function
Sub PrintTime()
s = Plugin.Sys.GetDateTime()
TracePrint "您的操作系统日期和时间:" & s
End Sub
// ----------------常用功能封装----------------
// 重启程序
Sub RestartGame()
// 小程序 ...
Click RestartGamePos(0), RestartGamePos(1)
Wait OptionWait
// 重新打开小程序
Click RestartGamePos(2), RestartGamePos(3)
Wait 1
// 重新获取窗口
GetWindow
If HideGame = 1
// 隐藏窗口
Call Plugin.Window.Hide(Hwnd)
End If
// 等待加载完成
Wait RestartGameWait
End Sub
// ----------------游戏操作封装----------------
// 城内打开传送阵
Sub OpenCityTransmit()
// 位置 空白位置
Click CityBlankPos(0), CityBlankPos(1)
// 位置 城内传送
Click CityTransmitPos(0), CityTransmitPos(1)
End Sub
// 城外回城
Sub CityBack()
// 城外回城
Click CityBackPos(0), CityBackPos(1)
// 等待传送阵加载
Wait CityBackWait
// 城内打开传送阵
Click CityBackTransmitPos(0), CityBackTransmitPos(1)
End Sub
// 点击传送 左侧菜单递进50, 右侧菜单递进80, 左右相差180
Sub TransmitMenu(firstItem, secondItem)
firstItemPos = array(TransmitMenuItem(0), TransmitMenuItem(1) + 25 + 50 * (firstItem - 1))
secondItemPos = array(TransmitMenuItem(0) + 180, TransmitMenuItem(1) + 40 + 80 * (secondItem - 1))
Click firstItemPos(0), firstItemPos(1)
Click secondItemPos(0), secondItemPos(1)
End Sub
// 小树精BOSS
Sub Transmit_2_1()
// 传送菜单-荒芜之地-贫瘠营地
TransmitMenu 2, 1
// 等待传送阵加载
Wait TransmitWait
// 移动到树精
Move 10, 1500
// 等待kill boss
Wait KillBossWait_2_1
// 回到传送阵
Move 180 + 10, 1000
// 打开传送阵
Click 170, 350
End Sub
// 大树精BOSS
Sub Transmit_3_3()
// 位置 传送菜单-污染之林-寒风营地
TransmitMenu 3, 3
// 等待传送阵加载
Wait TransmitWait
// 移动到树精
Move 20, 3000
// 等待kill boss
Wait KillBossWait_3_3
// 回到传送阵
Move 180 + 20, 2500
// 打开传送阵
Click 170, 370
End Sub
// 火焰石魔、牛头
Sub Transmit_3_1()
// 位置 传送菜单-污染之林-污染哨站
TransmitMenu 3, 1
// 等待传送阵加载
Wait TransmitWait
// 移动到焰石魔
Move 0, 1800
Move 270, 1000
Move 235, 3500
// 等待kill boss
Wait KillBossWait_3_1_1
Move 275, 6000
// 等待kill boss
Wait KillBossWait_3_1_2
End Sub
// 刷新Boss
Sub Transmit_5_1()
// 位置 传送菜单-冰冠堡垒-王座大厅
TransmitMenu 5, 1
// 等待传送阵加载
Wait TransmitWait
// 等待传送阵加载
Wait 8800
// 位置 打开传送阵
Click 240,340
End Sub
// ----------------按键精灵操作流程----------------
// 获取窗口
GetWindow
// 无限循环
While GameCount > 0
PrintTime
// 重启小程序
RestartGame
// 城内打开传送阵
OpenCityTransmit
// 大树精BOSS
Transmit_3_3
// 小树精BOSS
Transmit_2_1
// 火焰石魔、牛头
Transmit_3_1
// 回城
// TransmitBack
// 刷新BOSS
// Transmit_5_1
PrintTime
Wend
Lua
1
https://gitee.com/quick-macro/blyx.git
git@gitee.com:quick-macro/blyx.git
quick-macro
blyx
百炼英雄
master

搜索帮助