#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
;M:\网络游戏\天之翼\TZY.exe 99c6bcfe8f8deb515a6f27ddf4aa8aaa8f8deb515a6f27dd
HotKeySet("{F9}","StartLabClick")
HotKeySet("{F10}","StopLabClick")
#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Administrator\桌面\Form1.kxf
$Form1 = GUICreate("天之翼", 516, 563, 242, 97)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$MapShow = GUICtrlCreatePic("", 0, 48, 513, 513)
GUICtrlSetOnEvent(-1, "MapShowClick")
$MapChose = GUICtrlCreateCombo("选择地图", 0, 8, 161, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "夜色镇(新手村)|风元素区(5-12级)|火元素区(12-19级)|沙塔尔之森(19-26级)")
GUICtrlSetFont(-1, 11, 400, 0, "宋体")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetOnEvent(-1, "MapChoseChange")
$StartLab = GUICtrlCreateLabel("开始挂机", 200, 8, 64, 19)
GUICtrlSetFont(-1, 11, 400, 4, "宋体")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetOnEvent(-1, "StartLabClick")
$StopLab = GUICtrlCreateLabel("停止挂机", 312, 8, 64, 19)
GUICtrlSetFont(-1, 11, 400, 4, "宋体")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetOnEvent(-1, "StopLabClick")
$AutoFightCheckBox = GUICtrlCreateCheckbox("自动战斗", 392, 8, 89, 17)
GUICtrlSetFont(-1, 11, 400, 0, "宋体")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetOnEvent(-1, "AutoFightCheckBoxClick")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $ChosedMap
Global $Start=False
Global $AutoSelect=True
While 1
;~ ;检查游戏是否运行
;~ If ProcessExists("TZY.EXE") And $MoveFlg=True Then
;~ $TzyPos=WinGetPos("天之翼Online V1.1.3")
;~ WinMove("天之翼Online V1.1.3","",0,0)
;~ WinMove("天之翼Online V1.1.3","",$TzyPos[0],$TzyPos[1])
;~ $MoveFlg=False
;~ EndIf
If $AutoSelect=True Then
CheckAutoFight()
EndIf
If $Start=True Then
CheckAutoFight()
Select
Case $ChosedMap="夜色镇(新手村)"
MsgBox(16,"错误!","新手村无法挂机!")
$Start=False
Case $ChosedMap="风元素区(5-12级)"
AutoFight()
Case $ChosedMap="火元素区(12-19级)"
AutoFight()
Case $ChosedMap="沙塔尔之森(19-26级)"
AutoFight()
EndSelect
EndIf
Sleep(100)
WEnd
Func Form1Close()
Exit
EndFunc
Func MapChoseChange()
$ChosedMap=GUICtrlRead($MapChose)
Select
Case $ChosedMap="夜色镇(新手村)"
GUICtrlSetImage($MapShow,"ysz.jpg")
Case $ChosedMap="风元素区(5-12级)"
GUICtrlSetImage($MapShow,"fys.jpg")
Case $ChosedMap="火元素区(12-19级)"
GUICtrlSetImage($MapShow,"hys.jpg")
Case $ChosedMap="沙塔尔之森(19-26级)"
GUICtrlSetImage($MapShow,"ste.jpg")
EndSelect
EndFunc
Func MapShowClick()
$PicPos=ControlGetPos($Form1,"",$MapShow)
$NowMousePos=MouseGetPos()
WinActivate("天之翼Online V1.1.3")
Sleep(400)
;245--679 为游戏地图的0-0坐标
EndFunc
Func StartLabClick()
$Start=True
EndFunc
Func StopLabClick()
$Start=False
EndFunc
Func AutoFightCheckBoxClick()
If GUICtrlRead($AutoFightCheckBox)=$GUI_CHECKED Then
$AutoSelect=True
Else
$AutoSelect=False
EndIf
EndFunc
Func AutoFight()
;如果在战斗中,则不自动搜怪。
If PixelGetColor(864,612)=0x6eceff Then
WinActivate("天之翼Online V1.1.3")
Else
WinActivate("天之翼Online V1.1.3")
MouseClick("left","600","495",2,1)
Sleep(500)
MouseClick("left","400","495",2,1)
Sleep(500)
EndIf
EndFunc
Func CheckAutoFight()
;如果没有自动战斗,则点自动战斗
If WinActive("天之翼Online V1.1.3") Then
If PixelGetColor(739,140)<>0x6bcfff And PixelGetColor(864,612)=0x6eceff Then
MouseClick("left",750,255,2,1)
Sleep(200)
MouseClick("left",752,584,2,1)
EndIf
EndIf
EndFunc
;~ Func CheckHP()
;~ MsgBox(0,"",PixelGetColor(275,120))
;~ MsgBox(0,"",PixelGetColor(275,140))
;~ EndFunc
源码和用到的图片压缩包在附件中。你可以下载测试。