「河许人」Autohotkey

AutoHotKey阴阳师刷玉魂脚本

2018-06-26  本文已影响14人  arthub
  1. 安装AutoHotKey,下载地址:https://www.autohotkey.com/download/
  2. 新建文本文档,粘贴下面的挂机脚本,修改文件名为yysgj.ahk
; Create by Gxy

global _width = 1152
global _height = 678

; 程序入口
Gui, New
Gui, Add, Text,, 刷玉魂次数:
Gui, Add, Edit, yp xp+110 w60 Number vCtrl_Count, 20
Gui, Add, Text, xm, 刷玉魂间隔(秒):
Gui, Add, Edit, yp xp+110 w60 Number vCtrl_Interval, 40
Gui, Add, Radio, xm Checked Group vRadio_YuHunLevel1, 壹层
Gui, Add, Radio, yp xp+55 vRadio_YuHunLevel2, 贰层
Gui, Add, Radio, yp xp+55 vRadio_YuHunLevel3, 叁层
Gui, Add, Radio, yp xp+55 vRadio_YuHunLevel4, 肆层
Gui, Add, Radio, yp xp+55 vRadio_YuHunLevel5, 伍层
Gui, Add, Radio, xm vRadio_YuHunLevel6, 陆层
Gui, Add, Radio, yp xp+55 vRadio_YuHunLevel7, 柒层
Gui, Add, Radio, yp xp+55 vRadio_YuHunLevel8, 捌层
Gui, Add, Radio, yp xp+55 vRadio_YuHunLevel9, 玖层
Gui, Add, Radio, yp xp+55 vRadio_YuHunLevel10, 拾层
Gui, Add, Button, xm h26 w268 Default, 刷玉魂
Gui, Show,,阴阳师挂机
return

; 通用方法 - 在坐标范围内随机
GetRandomPos(x1, y1, x2, y2)
{
    ; 获取窗口系数比
    WinGetPos, winX, winY, winW, winH, 阴阳师-网易游戏
    coe := winW / _width

    Random, rx, 1, (x2 - x1) * coe
    Random, ry, 1, (y2 - y1) * coe

    return {x: (x1 + rx) * coe, y: (y1 + ry) * coe}
}

; 在游戏内随机移动鼠标
RandomMoveMouse()
{
    ; 获取窗口系数比
    WinGetPos, winX, winY, winW, winH, 阴阳师-网易游戏
    coe := winW / _width

    Random, moveSpeed, 10, 30
    movePos := GetRandomPos(20 * coe, 20 * coe, (_width - 20) * coe, (_height - 20) * coe)
    MouseMove, movePos.x, movePos.y, moveSpeed
}

ClickAtPoint(x1, y1, x2, y2, speed:=5)
{
    pos := GetRandomPos(x1, y1, x2, y2)
    MouseMove, pos.x, pos.y, speed
    Click pos.x, pos.y
}

Drag(x1, y1, x2, y2, speed:=5)
{
    tx1 := x1
    ty1 := y1   
    Point(tx1, ty1)
    tx2 := x2
    ty2 := y2
    Point(tx2, ty2)

    MouseClickDrag, Left, tx1, ty1, tx2, ty2, speed 
}

; 按窗口的缩放系数,获得指定点
Point(ByRef x, ByRef y)
{
    ; 获取窗口系数比
    WinGetPos, winX, winY, winW, winH, 阴阳师-网易游戏
    coe := winW / _width

    x := x * coe
    y := y * coe
}

; 激活游戏窗口
ActivateGame()
{
    IfWinExist, 阴阳师-网易游戏
    {
        WinActivate
        Sleep 500
        return true
    }
    Else
    {
        MsgBox 0, 提示, 请先登录游戏
        return false
    }
}
 
; 从主界面进到探索界面
GoTanSuo()
{
    ; 拖动界面,以确定探索按钮位置
    Drag(1100, 375, 60, 350)
    Drag(1100, 375, 60, 350)

    ; 点击探索按钮
    ClickAtPoint(431, 134, 481, 205)

    Sleep 2000
}

; 从探索界面到玉魂挑战界面
GoYuHunTiaoZhan()
{
    ; 探索界面的玉魂按钮
    ClickAtPoint(142, 588, 221, 667)

    ; 点击玉魂后出现的选择界面
    ClickAtPoint(164, 160, 552, 477)
}

; 选择具体那一层玉魂挑战
SelectYuHunLevel()
{
    ; 先滚动到顶部
    Drag(355, 180, 360, 376)
    Sleep 1000

    GuiControlGet, Radio_YuHunLevel1
    GuiControlGet, Radio_YuHunLevel2
    GuiControlGet, Radio_YuHunLevel3
    GuiControlGet, Radio_YuHunLevel4
    GuiControlGet, Radio_YuHunLevel5
    GuiControlGet, Radio_YuHunLevel6
    GuiControlGet, Radio_YuHunLevel7
    GuiControlGet, Radio_YuHunLevel8
    GuiControlGet, Radio_YuHunLevel9
    GuiControlGet, Radio_YuHunLevel10

    if Radio_YuHunLevel10
    {
        Drag(360, 376, 360, 376 - 33 * 6, 40)
        ClickAtPoint(236, 364, 489, 392)
    }
    else if Radio_YuHunLevel9
    {
        Drag(360, 376, 360, 376 - 33 * 5, 40)
        ClickAtPoint(236, 364, 489, 392)
    }
    else if Radio_YuHunLevel8
    {
        Drag(360, 376, 360, 376 - 33 * 4, 40)
        ClickAtPoint(236, 364, 489, 392)
    }
    else if Radio_YuHunLevel7
    {
        Drag(360, 376, 360, 376 - 33 * 3, 40)
        ClickAtPoint(236, 364, 489, 392)
    }
    else if Radio_YuHunLevel6
    {
        Drag(360, 376, 360, 376 - 33 * 2, 40)
        ClickAtPoint(236, 364, 489, 392)
    }
    else if Radio_YuHunLevel5
    {
        Drag(360, 376, 360, 376 - 33 * 1, 40)
        ClickAtPoint(236, 364, 489, 392)
    }
    else if Radio_YuHunLevel4
    {
        ClickAtPoint(236, 364, 489, 392)
    }
    else if Radio_YuHunLevel3
    {
        ClickAtPoint(236, 364 - 66 * 1, 489, 392 - 66 * 1)
    }
    else if Radio_YuHunLevel2
    {
        ClickAtPoint(236, 364 - 66 * 2, 489, 392 - 66 * 2)
    }
    else 
    {
        ClickAtPoint(236, 364 - 66 * 3, 489, 392 - 66 * 3)
    }
}

; 单刷玉魂循环
YuHunSimpleLoop() 
{
    GuiControlGet, Ctrl_Count
    GuiControlGet, Ctrl_Interval

    Loop, %Ctrl_Count%
    {
        ; 随机移动鼠标
        RandomMoveMouse()

        ; 点击挑战按钮
        ClickAtPoint(792, 456, 905, 507)

        ; 点击准备按钮
        Sleep 5000
        ClickAtPoint(960, 450, 1130, 546)

        ; 等待战斗结束
        Random, randInvertal, 0, 3000
        Sleep randInvertal + Ctrl_Interval

        ; 战斗结束的点击
        Click

        ; 界面加载时间
        Sleep 2000
    }
}

; 启动刷玉魂脚本
Button刷玉魂:
If !ActivateGame()
    return
GoTanSuo()
GoYuHunTiaoZhan()
SelectYuHunLevel()
YuHunSimpleLoop()
return


GuiClose:
ExitApp
return


^+q::ExitApp
return
  1. 打开阴阳师桌面版,并登陆到庭院场景,将庭院皮肤切换成默认皮肤
  2. 使用AutoHotKey打开刚刚保存的脚本,点击刷玉魂,脚本将模拟玩家的鼠标操作
  3. 使用Ctrl+Shift+Q可退出挂机脚本
  4. 该脚本仅供参考学习
挂机脚本效果图
上一篇下一篇

猜你喜欢

热点阅读