#NoEnv
#InstallKeybdHook
#InstallMouseHook
#Persistent
#KeyHistory 0
#MaxThreads, 20
#SingleInstance FORCE
#HotkeyInterval 99000000
#MaxHotkeysPerInterval 99000000
ListLines Off
Process, Priority, , A
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
SetWinDelay, -1
SetControlDelay, -1
CoordMode, ToolTip
CoordMode, Pixel
CoordMode, Mouse
F2::
MsgBox, 先使用 HS_剑灵.读取("国服") 读取文件
HS_剑灵.读取("国服")
MsgBox, 使用 HS_剑灵.显示() 显示读取到的坐标是否正确
HS_剑灵.显示()
MsgBox, 使用 HS_剑灵.显示("off") 关闭显示
HS_剑灵.显示("off")
MsgBox, 使用 _Q:=HS_剑灵.坐标("Q",10,10) 获取以Q技能红框左上角坐标偏移的X Y 值`n可取技能有 R,T,F,1,2,3,4,5,6,7,8,Z,X,C,V,G,B,Q,E,XI,SS,TAB,BUFF
_Q:=HS_剑灵.坐标("Q",10,10)
MsgBox, % "返回值为数组对象 _Q.X=" _Q.X ", _Q.Y=" _Q.Y
MsgBox, 使用 HS_剑灵.显示(_Q) 显示获取坐标的位置
HS_剑灵.显示(_Q)
MsgBox, 基本用法已经结束
HS_剑灵.显示("off")
Return
Class HS_剑灵{
; by 布谷布谷
static BNS_XML:=0
读取(客户端:="国服")
{
static 最新修改时间:=1
static 最后修改时间:=1
NC:=(客户端="台服"?"NCTAIWAN":"TENCENT")
FileGetTime, 最新修改时间, %A_MyDocuments%\Bns\%NC%\ClientConfiguration.xml
if (最后修改时间!=最新修改时间)
{
FileRead, XML, %A_MyDocuments%\Bns\%NC%\ClientConfiguration.xml
if (ErrorLevel != 0)
return 0
最后修改时间:=最新修改时间
This.BNS_XML:=XML
return 1
} else if (最后修改时间=最新修改时间)
return 2
return 0
}
坐标(Number, MoveX:="0", MoveY:="0")
{
if !This.BNS_XML
return
UI:=[],GUI:=[],Screen:=[]
switch, Number
{
Case,"XI" : GUI.UI:="108" , GUI.W:=80 , GUI.H:=80, UI.Left:=-29, UI.Top:=-34, UI.Right:=UI.Left+55, UI.Bottom:=UI.Top+55
Case,"BUFF": GUI.UI:="94" , GUI.W:=79 , GUI.H:=70, UI.Left:=-40, UI.Top:=-35, UI.Right:=UI.Left+78, UI.Bottom:=UI.Top+69
Case,"R" : GUI.UI:="1" , GUI.W:=50 , GUI.H:=63, UI.Left:=-23, UI.Top:=-32, UI.Right:=UI.Left+45, UI.Bottom:=UI.Top+45
Case,"T" : GUI.UI:="2" , GUI.W:=50 , GUI.H:=63, UI.Left:=-23, UI.Top:=-32, UI.Right:=UI.Left+45, UI.Bottom:=UI.Top+45
Case,"F" : GUI.UI:="3" , GUI.W:=50 , GUI.H:=63, UI.Left:=-23, UI.Top:=-32, UI.Right:=UI.Left+45, UI.Bottom:=UI.Top+45
Case,"G" : GUI.UI:="86-1", GUI.W:=50 , GUI.H:=63, UI.Left:=-23, UI.Top:=-32, UI.Right:=UI.Left+45, UI.Bottom:=UI.Top+45
Case,"B" : GUI.UI:="87-1", GUI.W:=50 , GUI.H:=63, UI.Left:=-23, UI.Top:=-32, UI.Right:=UI.Left+45, UI.Bottom:=UI.Top+45
Case,"Q" : GUI.UI:="91-1", GUI.W:=50 , GUI.H:=63, UI.Left:=-23, UI.Top:=-32, UI.Right:=UI.Left+45, UI.Bottom:=UI.Top+45
Case,"E" : GUI.UI:="92-1", GUI.W:=50 , GUI.H:=63, UI.Left:=-23, UI.Top:=-32, UI.Right:=UI.Left+45, UI.Bottom:=UI.Top+45
Case,"SS" : GUI.UI:="90-1", GUI.W:=50 , GUI.H:=63, UI.Left:=-23, UI.Top:=-32, UI.Right:=UI.Left+45, UI.Bottom:=UI.Top+45
Case,"TAB" : GUI.UI:="24" , GUI.W:=50 , GUI.H:=63, UI.Left:=-23, UI.Top:=-32, UI.Right:=UI.Left+45, UI.Bottom:=UI.Top+45
Case,"1" : GUI.UI:="5" , GUI.W:=205, GUI.H:=63, UI.Left:=-96, UI.Top:=-32, UI.Right:=UI.Left+45, UI.Bottom:=UI.Top+45
Case,"2" : GUI.UI:="5" , GUI.W:=205, GUI.H:=63, UI.Left:=-45, UI.Top:=-32, UI.Right:=UI.Left+45, UI.Bottom:=UI.Top+45
Case,"3" : GUI.UI:="5" , GUI.W:=205, GUI.H:=63, UI.Left:= 6 , UI.Top:=-32, UI.Right:=UI.Left+45, UI.Bottom:=UI.Top+45
Case,"4" : GUI.UI:="5" , GUI.W:=205, GUI.H:=63, UI.Left:= 57, UI.Top:=-32, UI.Right:=UI.Left+45, UI.Bottom:=UI.Top+45
Case,"Z" : GUI.UI:="23" , GUI.W:=205, GUI.H:=63, UI.Left:=-96, UI.Top:=-32, UI.Right:=UI.Left+45, UI.Bottom:=UI.Top+45
Case,"X" : GUI.UI:="23" , GUI.W:=205, GUI.H:=63, UI.Left:=-45, UI.Top:=-32, UI.Right:=UI.Left+45, UI.Bottom:=UI.Top+45
Case,"C" : GUI.UI:="23" , GUI.W:=205, GUI.H:=63, UI.Left:= 6 , UI.Top:=-32, UI.Right:=UI.Left+45, UI.Bottom:=UI.Top+45
Case,"V" : GUI.UI:="23" , GUI.W:=205, GUI.H:=63, UI.Left:= 57, UI.Top:=-32, UI.Right:=UI.Left+45, UI.Bottom:=UI.Top+45
Case,"5" : GUI.UI:="10" , GUI.W:=195, GUI.H:=42, UI.Left:=-96, UI.Top:=-18, UI.Right:=UI.Left+37, UI.Bottom:=UI.Top+37
Case,"6" : GUI.UI:="10" , GUI.W:=195, GUI.H:=42, UI.Left:=-57, UI.Top:=-18, UI.Right:=UI.Left+37, UI.Bottom:=UI.Top+37
Case,"7" : GUI.UI:="10" , GUI.W:=195, GUI.H:=42, UI.Left:=-18, UI.Top:=-18, UI.Right:=UI.Left+37, UI.Bottom:=UI.Top+37
Case,"8" : GUI.UI:="10" , GUI.W:=195, GUI.H:=42, UI.Left:= 21, UI.Top:=-18, UI.Right:=UI.Left+37, UI.Bottom:=UI.Top+37
}
loop, Parse, % This.BNS_XML,`n,`r
{
GUI.String:=A_LoopField
if InStr(GUI.String, "'ui-scale'")
GUI.Scale:=This.提取(GUI.String)
if InStr(GUI.String, "'ignore-ui-scale'")
GUI.ignore:=This.提取(GUI.String)
if InStr(GUI.String, "'windowed'")
GUI.Windowed:=This.提取(GUI.String)
if InStr(GUI.String, "'ShowSBN'")
GUI.ShowSBN:=This.提取(GUI.String)
if InStr(GUI.String, "'ShowBuffGragh'")
GUI.ShowBuff:=This.提取(GUI.String)
if InStr(GUI.String, "'hc-" GUI.UI "-x'")
GUI.XML_X:=This.提取(GUI.String)
if InStr(GUI.String, "'hc-" GUI.UI "-y'")
GUI.XML_Y:=This.提取(GUI.String)
if InStr(GUI.String, "'hc-" GUI.UI "-a-h'")
GUI.XML_H:=This.提取(GUI.String)
if InStr(GUI.String, "'hc-" GUI.UI "-a-v'")
GUI.XML_V:=This.提取(GUI.String)
if InStr(GUI.String, "'buffgraph-size'")
GUI.XML_S:=This.提取(GUI.String)
}
if (Number="BUFF")
{
增益图标:=0
图标排序:=[]
loop, Parse, % This.BNS_XML,`n,`r
{
GUI.String:=A_LoopField
For K,V in StrSplit("魂,武器,手镯,星,灵,守护石攻,守护石防,戒指,耳环,项链,手套,腰带",",")
{
if InStr(GUI.String, "'buffgraph-type-" A_Index "-visible'")
{
if (This.提取(GUI.String)="y")
{
图标排序[V]:= 增益图标++
}
}
}
}
if 增益图标
{
if (GUI.XML_S=2)
GUI.W:=GUI.W+增益图标*51-3, GUI.H:=70, UI.Left:=UI.Left-增益图标*26+3, UI.Top:=-35, UI.Right:=UI.Right+增益图标*25, UI.Bottom:=UI.Top+69
Else if (GUI.XML_S=1)
GUI.W:=GUI.W+增益图标*45-3, GUI.H:=70, UI.Left:=UI.Left-增益图标*23+3, UI.Top:=-35, UI.Right:=UI.Right+增益图标*22, UI.Bottom:=UI.Top+69
Else
GUI.W:=GUI.W+增益图标*38-3, GUI.H:=70, UI.Left:=UI.Left-增益图标*19+2, UI.Top:=-35, UI.Right:=UI.Right+增益图标*19-1, UI.Bottom:=UI.Top+69
}
}
if (A_ScreenHeight!=1080)
{
PL:=A_ScreenHeight/1080
GUI.W*=PL, GUI.H*=PL, UI.Left*=PL, UI.Top*=PL, UI.Right*=PL, UI.Bottom*=PL, MoveX*=PL, MoveY*=PL
}
if GUI.Windowed{
WinGetPos,ScreenX,ScreenY,ScreenW,ScreenH,ahk_Class UnrealWindow
SysGet, TitleHeight, 4
SysGet, BorderWidth, 32
Screen.W:=ScreenW-BorderWidth*2
Screen.H:=ScreenH-BorderWidth*2-TitleHeight
}
else
Screen.W:=A_ScreenWidth, Screen.H:=A_ScreenHeight
if (GUI.ignore=1)
UI.Scale:=1
else
UI.Scale:=GUI.Scale/100*Screen.H/A_ScreenHeight
GUI.W:=GUI.W*UI.Scale
GUI.H:=GUI.H*UI.Scale
GUI.X:=GUI.XML_X*Screen.W
GUI.Y:=GUI.XML_Y*Screen.H
switch, Number
{
Case,"Scale" : return GUI.Scale ;缩放大小
Case,"ignore" : return GUI.ignore ;无视分辨率
Case,"Windowed": return GUI.Windowed ;窗口模式
Case,"Q","SS","G","B","5","6","7","8":
if (GUI.XML_H!="3" and GUI.XML_V!="3")
GUI.X:=GUI.X+GUI.W/2
Case,"XI","F":
if (GUI.XML_H!="3" and GUI.XML_V!="3")
GUI.Y:=GUI.Y-GUI.H/2
Case,"BUFF":
if (GUI.XML_H!="3" and GUI.XML_V!="3")
GUI.Y:=GUI.Y+GUI.H/2
}
GUI.X<Screen.W/5*1?GUI.X+=GUI.W/2:""
GUI.X>Screen.W/5*4?GUI.X-=GUI.W/2:""
GUI.Y<Screen.H/5*1?GUI.Y+=GUI.H/2:""
GUI.Y>Screen.H/5*4?GUI.Y-=GUI.H/2:""
_X_:=Round(GUI.X)
_Y_:=Round(GUI.Y)
_X:=Round(GUI.X+(UI.Left+MoveX)*UI.Scale)
_Y:=Round(GUI.Y+(UI.Top+MoveY)*UI.Scale)
_W:=Round((UI.Right-UI.Left)*UI.Scale)
_H:=Round((UI.Bottom-UI.Top)*UI.Scale)
if GUI.Windowed
{
A:=This.ClientToScreen(_X,_Y,"ahk_Class UnrealWindow")
B:=This.ClientToScreen(_X_,_Y_,"ahk_Class UnrealWindow")
_X:= A.X,_Y:= A.Y
_X_:= B.X,_Y_:= B.Y
}
return {_X: _X_, _Y: _Y_, X: _X, Y: _Y, W: _W, H: _H}
}
提取(String)
{
RegExMatch(String, "(?<=value=').*(?='/>)", NameString)
return NameString
}
取色(Number, MoveX:="0", MoveY:="0")
{
N:=This.坐标(Number,MoveX,MoveY)
PixelGetColor, RGB, N.X, N.Y, RGB
return N.X . "," N.Y . "," . RGB
}
显示(Params1:="0", Params2:="0", Params3:="0")
{
if (Params1="OFF"){
Gui, BNSLX: Destroy
return
}else if !(This.BNS_XML)
return
pToken:=This.Gdip_Startup()
Gui, BNSLX : -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
Gui, BNSLX : Show, NA
hwnd1:=WinExist()
hbm:=This.CreateDIBSection(Width:=A_ScreenWidth, Height:=A_ScreenHeight)
hdc:=This.CreateCompatibleDC()
obm:=This.SelectObject(hdc, hbm)
G:=This.Gdip_GraphicsFromHDC(hdc)
pBrush0:=This.Gdip_CreatePen(0xFFFFFFFF, 1) ;白色
pBrush1:=This.Gdip_CreatePen(0xFFFF0000, 1) ;红色
pBrush2:=This.Gdip_CreatePen(0xFFFFFF00, 1) ;黄色
pBrush3:=This.Gdip_CreatePen(0xFF00FFFF, 1) ;青色
For K,V in StrSplit("R,T,F,1,2,3,4,5,6,7,8,Z,X,C,V,G,B,Q,E,XI,SS,TAB,BUFF",",")
{
N:=This.坐标(V)
This.Gdip_DrawRectangle(G, pBrush1, N.X, N.Y, N.W,N.H) ;红色框
This.Gdip_DrawLine(G, pBrush0, N.X, N.Y, N.X+1, N.Y) ;白色线
This.Gdip_DrawLine(G, pBrush1, N.X+1, N.Y, N.X+2, N.Y) ;红色线
if (V!="BUFF") ;画中心线
{
This.Gdip_DrawLine(G, pBrush1, N.X+N.W/2, N.Y, N.X+N.W/2, N.Y+10) ;红色线
This.Gdip_DrawLine(G, pBrush1, N.X+N.W/2+1, N.Y, N.X+N.W/2+1, N.Y+10) ;红色线
}
if Params3
{
This.Gdip_DrawLine(G, pBrush2, N._X-5, N._Y, N._X+5, N._Y) ;黄色线;原始坐标
This.Gdip_DrawLine(G, pBrush2, N._X, N._Y-5, N._X, N._Y+5) ;黄色线;原始坐标
}
}
if Params1
{
X:="", Y:="", 坐标数据:=""
For K, V in Params1
{
X:=Params1.X
Y:=Params1.Y
if (Y = "")
{
N:=StrSplit(V,",")
X:=N[1]
Y:=N[2]
坐标数据.="`n" K ":" ((V="ERROR" || V="")?"缺少取色数据":V)
}
if !(V="ERROR" || V="")
{
This.Gdip_DrawLine(G, pBrush3, X-5, Y, X+5, Y) ;青色线
This.Gdip_DrawLine(G, pBrush3, X, Y-5, X, Y+5) ;青色线
}
}
}
if Params2
This.Gdip_DrawRectangle(G, pBrush3, Params2.X-5, Params2.Y-5, Params2.W+10, Params2.H+10)
This.Gdip_DeleteBrush(pBrush0)
This.Gdip_DeleteBrush(pBrush1)
This.Gdip_DeleteBrush(pBrush2)
This.Gdip_DeleteBrush(pBrush3)
This.UpdateLayeredWindow(hwnd1, hdc, 0, 0, Width, Height)
This.SelectObject(hdc, obm)
This.DeleteObject(hbm)
This.DeleteDC(hdc)
This.Gdip_DeleteGraphics(G)
This.Gdip_Shutdown(pToken)
return
}
ClientToScreen(X,Y,CK){
VarSetCapacity(ZB, 8)
NumPut(X,ZB,0,"int")
NumPut(Y,ZB,4,"int")
DllCall("ClientToScreen", "Uint", WinExist(CK), "Uint", &ZB)
return {X : NumGet(ZB, 0, "Int"), Y : NumGet(ZB, 4, "Int")}
}
CreateDIBSection(w, h, hdc:="", bpp:=32, ByRef ppvBits:=0, Usage:=0, hSection:=0, Offset:=0){
Static Ptr := "UPtr"
hdc2 := hdc ? hdc : DllCall("GetDC","UPtr",0)
VarSetCapacity(bi, 40, 0)
NumPut(40, bi, 0, "uint")
NumPut(w, bi, 4, "uint")
NumPut(h, bi, 8, "uint")
NumPut(1, bi, 12, "ushort")
NumPut(bpp, bi, 14, "ushort")
NumPut(0, bi, 16, "uInt")
hbm := DllCall("CreateDIBSection", Ptr, hdc2, Ptr, &bi, "uint", Usage, "UPtr*", ppvBits, Ptr, hSection, "uint", OffSet, Ptr)
if !hdc
DllCall("ReleaseDC", "UPtr", 0, "UPtr", hdc2)
return hbm
}
CreateCompatibleDC(hdc:=0){
return DllCall("CreateCompatibleDC", "UPtr", hdc)
}
DeleteDC(hdc){
return DllCall("DeleteDC", "UPtr", hdc)
}
DeleteObject(hObject){
return DllCall("DeleteObject", "UPtr", hObject)
}
SelectObject(hdc, hgdiobj){
Static Ptr := "UPtr"
return DllCall("SelectObject", Ptr, hdc, Ptr, hgdiobj)
}
UpdateLayeredWindow(hwnd, hdc, x:="", y:="", w:="", h:="", Alpha:=255){
Static Ptr := "UPtr"
if ((x != "") && (y != ""))
VarSetCapacity(pt, 8), NumPut(x, pt, 0, "UInt"), NumPut(y, pt, 4, "UInt")
if (w = "") || (h = "")
This.GetWindowRect(hwnd, W, H)
return DllCall("UpdateLayeredWindow", Ptr, hwnd, Ptr, 0, Ptr, ((x = "") && (y = "")) ? 0 : &pt, "int64*", w|h<<32, Ptr, hdc, "int64*", 0, "uint", 0, "UInt*", Alpha<<16|1<<24, "uint", 2)
}
Gdip_Shutdown(pToken){
Static Ptr := "UPtr"
DllCall("gdiplus\GdiplusShutdown", Ptr, pToken)
hModule := DllCall("GetModuleHandle", "str", "gdiplus", Ptr)
if hModule
DllCall("FreeLibrary", Ptr, hModule)
return 0
}
Gdip_DeleteGraphics(pGraphics){
If pGraphics
return DllCall("gdiplus\GdipDeleteGraphics", "UPtr", pGraphics)
}
Gdip_DeleteBrush(pBrush){
If pBrush
return DllCall("gdiplus\GdipDeleteBrush", "UPtr", pBrush)
}
Gdip_CreatePen(ARGB, w, Unit:=2){
pPen := 0
gdipLastError := DllCall("gdiplus\GdipCreatePen1", "UInt", ARGB, "float", w, "int", Unit, "UPtr*", pPen)
return pPen
}
Gdip_FillRectangle(pGraphics, pBrush, x, y, w, h){
If (!pGraphics || !pBrush || !w || !h)
Return 2
Return DllCall("gdiplus\GdipFillRectangle", "UPtr", pGraphic, "UPtr", pBrush, "float", x, "float", y, "float", w, "float", h)
}
Gdip_DrawRectangle(pGraphics, pPen, x, y, w, h){
If (!pGraphics || !pPen || !w || !h)
Return 2
Return DllCall("gdiplus\GdipDrawRectangle", "UPtr", pGraphics, "UPtr", pPen, "float", x, "float", y, "float", w, "float", h)
}
Gdip_DrawLine(pGraphics, pPen, x1, y1, x2, y2){
If (!pGraphics || !pPen)
Return 2
Return DllCall("gdiplus\GdipDrawLine", "UPtr", pGraphics, "UPtr", pPen, "float", x1, "float", y1, "float", x2, "float", y2)
}
Gdip_Startup(multipleInstances:=0){
Static Ptr := "UPtr"
pToken := 0
If (multipleInstances=0){
if !DllCall("GetModuleHandle", "str", "gdiplus", Ptr)
DllCall("LoadLibrary", "str", "gdiplus")
} Else DllCall("LoadLibrary", "str", "gdiplus")
VarSetCapacity(si, A_PtrSize = 8 ? 24 : 16, 0), si := Chr(1)
DllCall("gdiplus\GdiplusStartup", "UPtr*", pToken, Ptr, &si, Ptr, 0)
return pToken
}
Gdip_GraphicsFromHDC(hDC, hDevice:="", InterpolationMode:="", SmoothingMode:="", PageUnit:="", CompositingQuality:=""){
pGraphics := 0
If hDevice
gdipLastError := DllCall("Gdiplus\GdipCreateFromHDC2", "UPtr", hDC, "UPtr", hDevice, "UPtr*", pGraphics)
Else
gdipLastError := DllCall("gdiplus\GdipCreateFromHDC", "UPtr", hdc, "UPtr*", pGraphics)
If (gdipLastError=1 && A_LastError=8)
gdipLastError := 3
If (pGraphics && !gdipLastError)
{
If (InterpolationMode!="")
This.Gdip_SetInterpolationMode(pGraphics, InterpolationMode)
If (SmoothingMode!="")
This.Gdip_SetSmoothingMode(pGraphics, SmoothingMode)
If (PageUnit!="")
This.Gdip_SetPageUnit(pGraphics, PageUnit)
If (CompositingQuality!="")
This.Gdip_SetCompositingQuality(pGraphics, CompositingQuality)
}
return pGraphics
}
Gdip_SetInterpolationMode(pGraphics, InterpolationMode){
If !pGraphics
Return 2
Return DllCall("gdiplus\GdipSetInterpolationMode", "UPtr", pGraphics, "int", InterpolationMode)
}
Gdip_SetSmoothingMode(pGraphics, SmoothingMode){
If !pGraphics
Return 2
Return DllCall("gdiplus\GdipSetSmoothingMode", "UPtr", pGraphics, "int", SmoothingMode)
}
Gdip_SetPageUnit(pGraphics, Unit){
If !pGraphics
Return 2
Return DllCall("gdiplus\GdipSetPageUnit", "UPtr", pGraphics, "int", Unit)
}
Gdip_SetCompositingQuality(pGraphics, CompositionQuality){
If !pGraphics
Return 2
Return DllCall("gdiplus\GdipSetCompositingQuality", "UPtr", pGraphics, "int", CompositionQuality)
}
GetWindowRect(hwnd, ByRef W, ByRef H){
If !hwnd
Return
size := VarSetCapacity(rect, 16, 0)
if DllCall("dwmapi\DwmGetWindowAttribute", "UPtr", hWnd, "UInt", 9, "UPtr", &rect, "UInt", size, "UInt")
DllCall("GetWindowRect", "UPtr", hwnd, "UPtr", &rect, "UInt")
r := []
r.x1 := NumGet(rect, 0, "Int"), r.y1 := NumGet(rect, 4, "Int")
r.x2 := NumGet(rect, 8, "Int"), r.y2 := NumGet(rect, 12, "Int")
r.w := Abs(max(r.x1, r.x2) - min(r.x1, r.x2))
r.h := Abs(max(r.y1, r.y2) - min(r.y1, r.y2))
W := r.w
H := r.h
Return r
}
}
厉害厉害
大佬牛逼 可惜弃坑了
厉害的啊,大佬。不过UE4直接弃坑了。?