dim sum=1,hp,hp1,hp2,mp,mp1,mp2,xp,pet,pet1,pet2,pmp2,IDname,can1,can2,winx0,winy0,winid,cons
dim RunNO1=0,Scope,MyPosX,MyPosY,PosXNo1,PosYNo1,ID,find //加入(全局變量)
function main
IF RunNO1=0 then ////初始化,自動紀錄範圍掛機位置
GetActiveWindowID(ID)
Print("Pid: "& ID)
check()
PosXNo1=MyPosX //自動紀錄PosXNo1=目前人物所在X座標;或是手動更改MyPosX指定掛機位置,ex:PosXNo1=200
PosYNo1=MyPosY//同上,Y座標
Scope=4 ///////////////掛機範圍(自行設定)///////////////
print("人物座標: "& PosXNo1 & "," & PosYNo1)
RunNO1=1
SetInputMode(4)
GetActiveWindowXY(WinX0, WinY0)
SetTimer("skill1", 301000, true) //施放技能1,每10分鐘
SetTimer("skill2", 23000, true) //揓技技能2,每30分鐘
while true
GO()
wend
end if
end function
function GO
KSP_ReadMemory(&H0C30A4C,2,find)
if find=0 then
ReturnScope() //超出掛機範圍,回掛機點
//找尋寶箱
MouseMove(521, 356)
MouseRightClick(219)
MouseMove(499, 439)
MouseRightClick(281)
MouseMove(526, 270)
MouseRightClick(219)
MouseMove(394, 353)
MouseRightClick(172)
MouseMove(606, 369)
MouseRightClick(140)
MouseMove(607, 298)
MouseRightClick(188)
MouseMove(417, 409)
MouseRightClick(156)
MouseMove(443, 296)
MouseRightClick(172)
MouseMove(574, 417)
MouseRightClick(250)
MouseMove(570, 309)
MouseRightClick(406)
MouseMove(422, 320)
MouseRightClick(234)
Wait(10)
//找尋怪物
KeyPress("`")
//full(10) //只打怪血量100%以上的怪,例:full(80)就是只打怪血量80%以上的怪
//會有新的問題出現,就是放xp時,你無法秒怪…這些怪就會一直貼著你,因為你只打100%血的怪,要不然就是xp滿不要放。自己選擇吧
else
while find>0
KeyPress("1")
wait(500)
check() //邊打邊檢查hp、mp、寵hp、寵mp
KSP_ReadMemory(&H0C30A4C,2,find)
wend
check() //打完再檢查一下hp、mp、寵hp、寵mp
print("第" & sum &"隻怪")
print("HP:" & hp2 & "%|MP:" & mp2 & "%|XP:" & xp & "|寵HP:" & pet2 & "%" & "|寵MP:" & pmp2 & "%")
sum=sum+1
end if
end function
function need_hit
need=Array(10)
need[1]="食人花"
need[2]="Null"
need[3]="Null"
need[4]="Null"
need[5]="Null"
need[6]="Null"
need[7]="Null"
need[8]="Null"
need[9]="Null"
need[10]="Null"
ResetMemBuffer()
KSP_ReadMemory(&H1C13EEC,5,20,need1)
for i=1 to 10
Pos = Instr(need1, need)
if pos>0 then
exit for
end if
next
if pos=0 then
KeyPress("`")
else
can2=0
end if
end function
function Check //檢查hp、mp、xp、寵hp,寵mp
KSP_ReadMemory(&H00A46AD8,2,hp)
KSP_ReadMemory(&H00A46AF4,2,hp1)
KSP_ReadMemory(&H00A46ADC,2,mp)
KSP_ReadMemory(&H00A46AF8,2,mp1)
KSP_ReadMemory(&H00A46AE0,2,xp)
KSP_ReadMemory(&H00A61F5C,2,pet)
KSP_ReadMemory(&H00A61F60,2,pet1)
KSP_ReadMemory(&H00A6227C,2,pmp)
KSP_ReadMemory(&H00A62280,2,pmp1)
KSP_ReadMemory(&H0A194D4,3,MyPosX)
KSP_ReadMemory(&H0A194D8,3,MyPosY)
MyPosX=int(MyPosX)
MyPosY=int(MyPosY)
hp2=int(hp/hp1*100)
mp2=int(mp/mp1*100)
pet2=int(pet/pet1*100)
pmp2=int(pmp/pmp1*100)
if hp2<50 then //hp低於80%,按補血鍵
KeyPress("7")
end if
if mp2<20 then //mp低於50%,按補mp鍵
KeyPress("8")
end if
if pet2<40 then //寵的血低於80%,按吃藥鍵
KeyPress("9")
end if
if pmp2<80 then
KeyPress("9")//寵的魔低於80%,按吃藥鍵
end if
if xp=1000 then //xp滿,自動放
KeyPress("0")
end if
end function
function ReturnScope
if PosXNo1-MyPosX>Scope Or PosXNo1-MyPosX<-Scope Or PosYNo1-MyPosY>Scope Or PosYNo1-MyPosY<-Scope then
Print("掛機範圍:"& Scope & " 已超出範圍:" & PosXNo1-MyPosX & "," & PosYNo1-MyPosY)
if find>0 then //如果有目標,可能是打怪中,取消選取)
KeyPress("Esc")
Wait(1000)
end if
Check_Tab(1)
MouseLeftClick(MaptoPosX(PosXNo1), MaptoPosY(PosYNo1))
Wait(5000) //回掛機點的走路時間(自己設,看你的範圍設多大,秒數自己加...)
Check_Tab(0)
end if
end function
# Tab地圖開和關
function Check_Tab(value)
//調用方式Check_Tab(value) value=0 關閉 value=1 開啟
KSP_ReadMemory(&H00C4EFD0,2,chktab)
while chktab<>value
Keypress("Tab")
Wait(400)
KSP_ReadMemory(&H00C4EFD0,2,chktab)
wend
end function
# Tab地圖開和關
# 地圖座標轉視窗座標
//調用方式 MouseLeftClick(MaptoPosX(地圖座標X), MaptoPosY(地圖座標Y))
function MaptoPosX(MapX)
MaptoPosX=int(167+(MapX*1.56))
end function
function MaptoPosY(MapY)
MaptoPosY=int(97+(MapY*1.56))
end function
# 地圖座標轉視窗座標
function skill1 //技能1按鍵
KeyPress("2")
end function
function skill2 //技能2按鍵
KeyPress("3")
end function |