HX云顶之奕自动挂机选牌脚本

HX云顶之奕自动挂机选牌脚本

开源免费脚本,永久有效

交流群:966134742

链接:https://pan.baidu.com/s/1MDFoz5S8W3XKaxqrkaCyoQ
提取码:4boo

#include %A_ScriptDir%/lib/inilib.ahk
#NoEnv
#KeyHistory 0
#MaxThreads 255
#MaxMem 4095
#MaxThreadsBuffer On
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#SingleInstance Force

sendmode,Input
CoordMode, ToolTip , Screen
CoordMode, Mouse, Screen  ; 把 ToolTips 放置在相对于屏幕坐标的位置.
ListLines Off
Process, Priority, , H
SetTitleMatchMode fast
SetBatchLines, -1
SetKeyDelay, -1, -1, -1
SetMouseDelay, -1
SetWinDelay, -1
SetControlDelay, -1
SetDefaultMouseSpeed, 0
SetWorkingDir %A_ScriptDir%
global MulDivProc :=  DllCall("GetProcAddress", "Ptr", DllCall("LoadLibrary", "Str", "opencv_dll_creat.dll", "Ptr"), "AStr", "opencv_ImageSearch", "Ptr")
OnExit("ExitFunc")
global BackgroundColor := 0X101008
global gherolist:=["卡萨丁","刀妹","锤石","诺克","石头人","蔚","机器人","大虫子","艾克","小鱼人","小丑","卡莎","螳螂","龙王","霞","亚索","剑圣","剑姬","慎","天使","金克斯","奥巴马","ez","男枪","女枪","卡牌","安妮","拉克丝","佐伊","狐狸","辛德拉","大眼","寒冰","女警","烬","日女","猴子","铁男","杰斯","波比","炸弹人","兰博","船长","洛","赵信","皇子","尼寇","璐璐","琴女","卡尔玛","奶妈"]
global heroName:={}
global gpicPath := ""
global canbuy:=1
global isBuy:=0
global gx1
global gy1
global gx2
global gy2
global guajiFlag := 0
loadpicpath:= A_ScriptDir . "\config\picture\云顶之奕.png"
loadConfig()

Menu Tray, Icon, shell32.dll, 3
Menu Menu, Add, 设置查找图片范围, modifyRange
Menu Menu, Add, 加载配置ini, ButtonLoadFolder
Menu Menu, Add, 保存阵容, SaveConfiguration
Menu Menu, Add, help, help
Menu Menu, Add, 重启, reload
Menu MenuBar, Add, &选项, :Menu
Gui,1: Menu, MenuBar

Menu Tray, Icon, shell32.dll, 3
; 创建状态栏, 显示文件夹数及其总大小的信息:
Gui, Add, StatusBar
SB_SetParts(1000, 85)  ; 在状态栏中创建三个部分(第三部分占用所有剩余宽度).

Gui Add, Picture, x1 y-5 w1077 h672,% loadpicpath

Gui Font, s8
Gui Add, CheckBox, v霞 gguiCheckHero x338 y302 w16 h20, 霞
Gui Font
Gui Font, s8
Gui Add, CheckBox, v卡萨丁 gguiCheckHero x341 y136 w16 h20, 卡萨丁
Gui Font
Gui Font, s8
Gui Add, CheckBox, v刀妹 gguiCheckHero x518 y140 w16 h20, 刀妹
Gui Font
Gui Font, s8
Gui Add, CheckBox, v锤石 gguiCheckHero x603 y139 w16 h20, 锤石
Gui Font
Gui Font, s8
Gui Add, CheckBox, v诺克 gguiCheckHero x835 y143 w16 h20, 诺克
Gui Font
Gui Font, s8
Gui Add, CheckBox, v石头人 gguiCheckHero x427 y181 w16 h20, 石头人
Gui Font
Gui Font, s8
Gui Add, CheckBox, v蔚 gguiCheckHero x522 y182 w16 h20, 蔚
Gui Font
Gui Font, s8
Gui Add, CheckBox, v机器人 gguiCheckHero x606 y179 w16 h20, 机器人
Gui Font
Gui Font, s8
Gui Add, CheckBox, v大虫子 gguiCheckHero x1051 y181 w16 h20, 大虫子
Gui Font
Gui Font, s8
Gui Add, CheckBox, v艾克 gguiCheckHero x519 y223 w16 h20, 艾克
Gui Font
Gui Font, s8
Gui Add, CheckBox, v小鱼人 gguiCheckHero x686 y218 w16 h20, 小鱼人
Gui Font
Gui Font, s8
Gui Add, CheckBox, v小丑 gguiCheckHero x761 y218 w16 h20, 小丑
Gui Font
Gui Font, s8
Gui Add, CheckBox, v卡莎 gguiCheckHero x989 y223 w16 h20, 卡莎
Gui Font
Gui Font, s8
Gui Add, CheckBox, v螳螂 gguiCheckHero x1054 y224 w16 h20, 螳螂
Gui Font
Gui Font, s8
Gui Add, CheckBox, v龙王 gguiCheckHero x429 y264 w16 h20, 龙王
Gui Font
Gui Font, s8
Gui Add, CheckBox, v亚索 gguiCheckHero x377 y305 w16 h20, 亚索
Gui Font
Gui Font, s8
Gui Add, CheckBox, v剑圣 gguiCheckHero x429 y306 w16 h20, 剑圣
Gui Font
Gui Font, s8
Gui Add, CheckBox, v剑姬 gguiCheckHero x466 y308 w16 h20, 剑姬
Gui Font
Gui Font, s8
Gui Add, CheckBox, v慎 gguiCheckHero x584 y307 w16 h20, 慎
Gui Font
Gui Font, s8
Gui Add, CheckBox, v天使 gguiCheckHero x968 y304 w16 h20, 天使
Gui Font
Gui Font, s8
Gui Add, CheckBox, v金克斯 gguiCheckHero x429 y348 w16 h20, 金克斯
Gui Font
Gui Font, s8
Gui Add, CheckBox, v奥巴马 gguiCheckHero x497 y348 w16 h20, 奥巴马
Gui Font
Gui Font, s8
Gui Add, CheckBox, vez gguiCheckHero x591 y346 w16 h20, ez
Gui Font
Gui Font, s8
Gui Add, CheckBox, v男枪 gguiCheckHero x819 y349 w16 h20, 男枪
Gui Font
Gui Font, s8
Gui Add, CheckBox, v女枪 gguiCheckHero x966 y349 w16 h20, 女枪
Gui Font
Gui Font, s8
Gui Add, CheckBox, v卡牌 gguiCheckHero x582 y390 w16 h20, 卡牌
Gui Font
Gui Font, s8
Gui Add, CheckBox, v安妮 gguiCheckHero x661 y386 w16 h20, 安妮
Gui Font
Gui Font, s8
Gui Add, CheckBox, v拉克丝 gguiCheckHero x744 y389 w16 h20, 拉克丝
Gui Font
Gui Font, s8
Gui Add, CheckBox, v佐伊 gguiCheckHero x855 y398 w16 h20, 佐伊
Gui Font
Gui Font, s8
Gui Add, CheckBox, v狐狸 gguiCheckHero x888 y399 w16 h20, 狐狸
Gui Font
Gui Font, s8
Gui Add, CheckBox, v辛德拉 gguiCheckHero x917 y398 w16 h20, 辛德拉
Gui Font
Gui Font, s8
Gui Add, CheckBox, v大眼 gguiCheckHero x1045 y401 w16 h20, 大眼
Gui Font
Gui Font, s8
Gui Add, CheckBox, v寒冰 gguiCheckHero x316 y440 w16 h20, 寒冰
Gui Font
Gui Font, s8
Gui Add, CheckBox, v女警 gguiCheckHero x595 y438 w16 h20, 女警
Gui Font
Gui Font, s8
Gui Add, CheckBox, v烬 gguiCheckHero x744 y437 w16 h20, 烬
Gui Font
Gui Font, s8
Gui Add, CheckBox, v日女 gguiCheckHero x486 y482 w16 h20, 日女
Gui Font
Gui Font, s8
Gui Add, CheckBox, v猴子 gguiCheckHero x592 y481 w16 h20, 猴子
Gui Font
Gui Font, s8
Gui Add, CheckBox, v铁男 gguiCheckHero x738 y479 w16 h20, 铁男
Gui Font
Gui Font, s8
Gui Add, CheckBox, v杰斯 gguiCheckHero x817 y480 w16 h20, 杰斯
Gui Font
Gui Font, s8
Gui Add, CheckBox, v波比 gguiCheckHero x895 y476 w16 h20, 波比
Gui Font
Gui Font, s8
Gui Add, CheckBox, v炸弹人 gguiCheckHero x398 y517 w16 h20, 炸弹人
Gui Font
Gui Font, s8
Gui Add, CheckBox, v兰博 gguiCheckHero x664 y522 w16 h20, 兰博
Gui Font
Gui Font, s8
Gui Add, CheckBox, v船长 gguiCheckHero x823 y524 w16 h20, 船长
Gui Font
Gui Font, s8
Gui Add, CheckBox, v洛 gguiCheckHero x293 y564 w16 h20, 洛
Gui Font
Gui Font, s8
Gui Add, CheckBox, v赵信 gguiCheckHero x332 y564 w16 h20, 赵信
Gui Font
Gui Font, s8
Gui Add, CheckBox, v皇子 gguiCheckHero x742 y560 w16 h20, 皇子
Gui Font
Gui Font, s8
Gui Add, CheckBox, v尼寇 gguiCheckHero x903 y563 w16 h20, 尼寇
Gui Font
Gui Font, s8
Gui Add, CheckBox, v璐璐 gguiCheckHero x336 y606 w16 h20, 璐璐
Gui Font
Gui Font, s8
Gui Add, CheckBox, v琴女 gguiCheckHero x425 y608 w16 h20, 琴女
Gui Font
Gui Font, s8
Gui Add, CheckBox, v卡尔玛 gguiCheckHero x738 y606 w16 h20, 卡尔玛
Gui Font
Gui Font, s8
Gui Add, CheckBox, v奶妈 gguiCheckHero x894 y610 w16 h20, 奶妈
Gui Font


gui,1: +AlwaysOnTop  +hWndhMainWnd
Gui,Show ,AutoSize Center
Return

guiCheckHero(CtrlHwnd := "", GuiEvent := "", EventInfo := "", ErrLevel := "") {
    global
    gui,Submit, NoHide
    gpicPath := ""
    heroSimpleName := ""   ;英雄字符串
    heroName := {}   ;英雄列表
    heroNumber := 0  ;英雄数目
    For index, value in gherolist
    {
        if(%value% && FileExist(A_ScriptDir .  "\config\picture\" . value ".bmp"))
        {
            gpicPath := A_ScriptDir .  "\config\picture\" . value ".bmp" . "*" . gpicPath
            heroSimpleName := heroSimpleName . value . "|"
            heroName[value] := ""
            heroNumber += 1
        }
    }
    StringTrimRight, gpicPath, gpicPath, 1
    SB_SetText(heroSimpleName . heroNumber, 1)
    ;MsgBox,% gpicPath
}

modifyRange:
MsgBox, 4096,, % GetRange(x,y,w,h) "范围:" x "," y "," w "," h
IniWrite,% x,% A_ScriptDir . "\config\color.ini", 通用,X1
IniWrite,% y,% A_ScriptDir . "\config\color.ini", 通用,Y1
IniWrite,% x+w,% A_ScriptDir . "\config\color.ini", 通用,X2
IniWrite,% y+h,% A_ScriptDir . "\config\color.ini", 通用,Y2
gx1 := x
gy1 := y 
gx2 := x + w
gy2 := y + h
return


choosehero:
~$Numpad0::
if(A_ThisLabel == "~$Numpad0" && guajiFlag == 1)
{
	msgbox, 先结束挂机
	return
}
canbuy :=1

loop
{	
	if((ok:=mOpencvPicSearch(gpicPath,gx1,gy1,gx2,gy2,100)) != 0)
	{
		StartTime := A_TickCount
		loop
		{
			CoordMode, Mouse
			x:=ok[2]
			y:=ok[3]
			SendInput,{Click  %x%, %y%,0}
			sendinput,{LButton down}
			sleep,100
			sendinput,{LButton up}
			PixelGetColor, color, x+50, Y+10
			ElapsedTime := A_TickCount - StartTime
			ToolTip(ElapsedTime)
			if((color == BackgroundColor) || (ElapsedTime>=1000))
			{
				if(ElapsedTime>=1000)
				{
					canbuy := 0
				}
				break
			}
			isBuy := 1
		}
		SendInput,{Click  930, 650,0}
		if(canbuy == 0)
		{
			tooltip("买不了")
			break
		}
	}
	else
	{
		ToolTip("没有找到")
		break
	}
}
if(isBuy==1)
{
	isBuy:=0
}
return

mOpencvPicSearch(gpicPath,x1,y1,x2,y2,thresh)
{
	local
	global MulDivProc
	str1 := ""
	rtn := ""
	VarSetCapacity(str,0)
	VarSetCapacity(str,2000)

    result := DllCall(MulDivProc,"AStr",gpicPath,"Int", x1,"Int", y1,"Int", x2,"Int", y2,"Int",thresh,"Str", str,"Cdecl Int")
	if(ErrorLevel != 0)
    {
        MsgBox, dll调用错误 %ErrorLevel%
        return 0
    }
    if(result != 0)
    {
        MsgBox, 参数错误 %result%
        return 0
    }
	rtn := StrGet(&str,2000,"CP0")
	InStr(rtn, "0_0_0", true)
	if(rtn == "")
	{
		msgbox,发生错误,请确定图库中是否有配置英雄,载入配置并请重启
		return 0
	}

	arr2 := mStringSplit(rtn)
	for key,value in arr2
	{
		if(arr2[key][1] > 0.9 )
		{
			value[2] := value[2] + x1
			value[3] := value[3] + y1
			return value
		}
	}
	return 0
}

f5::
ExitApp
return
*f7::
if(WinActive("ahk_id" . hMainWnd))
{
	Gui,1: Hide
}
else
{
	Gui,1: Restore        
}
return

~Numpad5::  ;花光模式
canbuy :=1
InputBox, password, 输入次数, (your input will be hidden),
Gosub,Hangup
loop
{
	Gosub,choosehero	
	if(canbuy == 0)
	{
		tooltip("买不了")
		break
	}
	else if(A_Index>=password)
	{
		tooltip("花完了")
		break
	}
	else
	{
		SendInput,{d}
		sleep,500
	}
}
return

~$Numpad8::
tooltip,挂机模式开启
guajiFlag:=1
Loop
{
	Critical
	gosub,choosehero
	Critical, off
	RunWait, empty.exe AutoHotkey.exe,,Hide
	sleep,50
}Until (guajiFlag == 0)
return

Hangup:
~$Numpad9:: ;挂机模式
Critical ;防止其他先线程中断
mark_music:=1
guajiFlag:=0
tooltip("挂机模式关闭")
return

help:
try
{	
	helpFile=
(
必须管理员身份运行
确保config/pic文件夹下面有对应分辨率的英雄名字截图.bmp
快捷键:
	f5:退出
	f7:界面开关
	Numpad0:单选一次
	Numpad5:花10元
	Numpad8:挂机模式
	Numpad9:结束挂机模式
	右键:添加删除列表
	双击:修改英雄名字和说明
有问题联系qq3261404579
交流群:966134742
)
	MsgBox,% helpFile
}
return

reload()
{
	reload
}

loadConfig()
{
	colorini:=class_EasyIni(A_ScriptDir . "\config\color.ini")
	coordinate:=colorini.通用
	gx1:=coordinate["X1"]
	gy1:=coordinate["Y1"]
	gx2:=coordinate["X2"]
	gy2:=coordinate["Y2"]
}

ButtonLoadFolder:
For index, value in gherolist
{
    	GuiControl,,% value ,0
}

Thread, NoTimers
Gui, +OwnDialogs  ; 强制用户解除此对话框后才可以操作主窗口.
FileSelectFile, SelectedFile, , , Open a file, Text Documents (*.ini)
Thread, NoTimers, false
if SelectedFile =
	MsgBox, The user didn't select anything.
else
	MsgBox, The user selected the following:`n%SelectedFile%
; 获取所选择文件夹中的文件名列表并添加到 ListView:

myini:=class_EasyIni(SelectedFile)
iwant:=myini.通用
For key, value in iwant
{
	GuiControl,,% key ,1
}
guiCheckHero()
return


SaveConfiguration:
Thread, NoTimers
Gui,1: +OwnDialogs  ; 强制用户解除此对话框后才可以操作主窗口.
FileSelectFile, SelectedFile, , , Open a file, Text Documents (*.ini)
Thread, NoTimers, false
if SelectedFile =
	MsgBox, The user didn't select anything.
else
	MsgBox, The user selected the following:`n%SelectedFile%
RowNumber := 0  ; 这样使得首次循环从列表的顶部开始搜索.
IniDelete,% SelectedFile, 通用
for key,value in heroName
{
	IniWrite,% value,% SelectedFile, 通用,% key
}
Return


;============ 脚本结束 =================
ToolTip(label){
	
	ToolTip, %label%, 0,0
	
	SetTimer, RemoveToolTip, 1000
	return
	RemoveToolTip:
	SetTimer, RemoveToolTip, Off
	ToolTip
	Return
}


;================= The End =================
/*
------------------------------------------
  左键拖动选择屏幕范围 v1.5  By FeiYue

  说明:
      按热键“F1”开始左键拖动选择范围,
      然后点击范围确定,点其他位置取消
------------------------------------------
*/

GetRange(ByRef x="",ByRef y="",ByRef w="",ByRef h="")
{
  Hotkey, *LButton, LButton_Return, On
  CoordMode, Mouse
  Ptr:=A_PtrSize ? "UPtr":"UInt", int:="int"
  nW:=A_ScreenWidth, nH:=A_ScreenHeight

  ;-- 生成画布窗口和选框窗口
  Gui, Canvas:New, +AlWaysOnTop +ToolWindow -Caption
  Gui, Canvas:Add, Picture, x0 y0 w%nW% h%nH% +0xE HwndpicID
  Gui, Range:+LastFound +AlWaysOnTop -Caption +OwnerCanvas
  WinSet, Transparent, 50
  Gui, Range:Color, Yellow
  range_create("Red","Canvas")

  ;-- 截屏到内存图像并关联到画布窗口的图片控件
  hDC:=DllCall("GetDC", Ptr,0, Ptr)
  mDC:=DllCall("CreateCompatibleDC", Ptr,hDC, Ptr)
  hBM:=DllCall("CreateCompatibleBitmap", Ptr,hDC, int,nW, int,nH, Ptr)
  oBM:=DllCall("SelectObject", Ptr,mDC, Ptr,hBM, Ptr)
  DllCall("BitBlt", Ptr,mDC, int,0, int,0, int,nW, int,nH
    , Ptr,hDC, int,0, int,0, int,0x00CC0020|0x40000000)
  SendMessage, 0x172, 0, hBM,, ahk_id %picID%
  if ( E:=ErrorLevel )
    DllCall("DeleteObject", Ptr,E)
  DllCall("SelectObject", Ptr,mDC, Ptr,oBM)
  DllCall("DeleteDC", Ptr,mDC)
  DllCall("ReleaseDC", Ptr,0, Ptr,hDC)

  ;-- 显示画布窗口,开始等待选择范围
  Gui, Canvas:Show, NA x0 y0 w%nW% h%nH%
  ok:=w:=h:=0
  ListLines, Off
  Loop {
    Sleep, 100
    MouseGetPos, x2, y2
    if GetkeyState("LButton","P")!=ok
    {
      ToolTip
      ok:=!ok, x1:=x2, y1:=y2
      if (ok and x2>x and y2>y and x2<x+w-1 and y2<y+h-1)
        Break
    }
    if (ok=0)
    {
      ToolTip, % w+h>5 ? "点击范围确定,点其他位置取消"
        : "请按下鼠标左键并拖动选择范围"
      Continue
    }
    w:=Abs(x1-x2), h:=Abs(y1-y2)
    x:=(x1+x2-w)//2, y:=(y1+y2-h)//2
    if (w+h>5)
    {
      Gui, Range:Show, NA x%x% y%y% w%w% h%h%
      range_show(x,y,w,h)
    }
    else
    {
      Gui, Range:Hide
      range_hide()
    }
  }
  ListLines, On
  range_delete()
  Gui, Range:Destroy
  Gui, Canvas:Destroy

  ;-- 不需要了才清除内存图像
  DllCall("DeleteObject", Ptr,hBM)

  KeyWait, LButton
  Hotkey, *LButton, LButton_Return, Off
  LButton_Return:
  Return
}

range_create(color="Red", Owner="") {
  j:=Owner ? "+Owner" Owner : "+ToolWindow"
  Loop 4 {
    i:=A_Index
    Gui,range_%i%:+AlWaysOnTop -Caption %j% +E0x08000000
    Gui,range_%i%:Color, %color%
  }
}

range_show(x,y,w,h,r=2) {
  Loop 4 {
    i:=A_Index
    , x1:=i=3 ? x+w : x-r
    , y1:=i=4 ? y+h : y-r
    , w1:=i=1 or i=3 ? r : w+r+r
    , h1:=i=2 or i=4 ? r : h+r+r
    Gui, range_%i%:Show, NA x%x1% y%y1% w%w1% h%h1%
  }
}

range_hide() {
  Loop 4
    Gui, range_%A_Index%:Hide
}

range_delete() {
  Loop 4
    Gui, range_%A_Index%:Destroy
}

SoundPlay(sound)
{
    if(mark_music==1)
    {
        SoundPlay, %A_ScriptDir%\config\music\%sound%.mp3   
    }  
}

mStringSplit(string)
{
  local
  inside_array := []
  this_color := []
  word_array := StrSplit(string, "|")
  Loop % word_array.MaxIndex()-1
  {
      this_color := word_array[a_index]
      inside_array[a_index]:= StrSplit(this_color, "_")
  }
  return inside_array
}

ExitFunc(ExitReason, ExitCode)
{
    DllCall("FreeLibrary", "Ptr", hModule)  ;
    ; 不要用 ExitApp -- 那会阻止其他 OnExit 函数被调用.
}

showLog(l_text)
{
    GuiControlGet, EditText  ; 获取编辑控件的内容.
    EditText := EditText . l_text
    GuiControl,, EditText, %EditText%  ; 在控件中显示文本.
}

 

给TA捐赠
共{{data.count}}人
人已捐赠
应用

剑灵恬静卡刀宏全职业可用,设置简单快捷卡刀频率快

2020-4-3 15:49:43

其他案例

自定义按键,将方向键功能 映射到 alt加上jkl键盘

2020-5-8 20:22:13

10 条回复 A文章作者 M管理员
  1. 極楽

    大哥更新个新版的吧

  2. Любоў

    怎么用?

  3. jiahao

    ?

  4. 半永退

    看上去很不错呢

  5. Tre

    真大佬。

  6. 阿森

    牛逼 大佬点赞

  7. Xander

    牛啊牛啊

个人中心
购物车
优惠劵
有新私信 私信列表
搜索