📄 autologin.ser
字号:
Login=true
end function
//---------------------------------------------------
#鼠标按键
function MyMousePress(KeyName)
MyMousePress=false
SendWindowMessage(WinID, &h001c, 1, 0)
SetInputMode(1)
for i=1 to 8
if CStr(i)=KeyName then
MouseLeftClick(Button1X+(i-1)*ButtonSize, Button1Y)
MyMousePress=true
exit function
end if
if "F"&CStr(i)=KeyName then
MouseLeftClick(ButtonF1X, ButtonF1Y+(i-1)*ButtonSize)
MyMousePress=true
exit function
end if
next
end function
#支持最小化的模拟按键函数
function myKeyDown(KeyCode)
SendWindowMessage(WinID, &h001c, 1, 0)
if not GetKeyState(KeyCode) then
SetInputMode(0)
KeyDown(KeyCode)
end if
SetInputMode(1)
KeyDown(KeyCode)
end function
#支持最小化的模拟按键函数
function myKeyPress(KeyCode)
if MouseInput=1 then
if MyMousePress(KeyCode) then
exit function
end if
else
SendWindowMessage(WinID, &h001c, 1, 0)
end if
if not GetKeyState(KeyCode) then
SetInputMode(0)
KeyDown(KeyCode)
SetInputMode(1)
GetActiveWindowID(id)
if id<>WinID then
KeyPress(KeyCode)
else
KeyUp(KeyCode)
end if
else
SetInputMode(1)
KeyPress(KeyCode)
end if
end function
#支持最小化的模拟按键函数
function myKeyUp(KeyCode)
SendWindowMessage(WinID, &h001c, 1, 0)
SetInputMode(1)
KeyUp(KeyCode)
end function
#判断两个颜色是否相近
function NearColor(pixel1, pixel2, err)
NearColor=(abs(GetR(pixel1)-GetR(pixel2))<=err and abs(GetG(pixel1)-GetG(pixel2))<=err and abs(GetB(pixel1)-GetB(pixel2))<=err)
end function
#在背包栏内找到红和蓝,拖到工具条的5和6
function DragRedBlue
DragRedBlue=false
LogPrint("在背包中寻找指定的红蓝。。。")
#打开背包栏
myKeyPress("B")
if not WaitForImg(img_BagTitle, WinX, WinY, WinX+800, WinY+600, xBagTitle, yBagTitle, 5000) then
LogPrint("找不到背包栏")
exit function
end if
RedIndex=-1
BlueIndex=-1
BagCount1=BagCount
if BagCount1>48 then
BagCount1=48
end if
for index=BagCount1-1 to 0 step -1
GetBagItemInfo(index, ID, number)
if ID=RedID then
RedIndex=index
end if
if ID=BlueID then
BlueIndex=index
end if
next
if RedIndex<0 then
LogPrint("背包里已没有指定的红,脚本结束")
exit function
end if
LogPrint("找到红,位置 "&(RedIndex+1))
if BlueIndex<0 then
LogPrint("背包里已没有指定的蓝,脚本结束")
exit function
end if
LogPrint("找到蓝,位置 "&(BlueIndex+1))
SetInputMode(0)
#拖红到快捷栏5
x=xBagTitle-58+((RedIndex) mod 6)*29
y=yBagTitle+68+((RedIndex)\6)*29
MouseMove(x,y)
MouseLeftDown(x,y)
Wait(200)
MouseMove(WinX+398, WinY+583)
Wait(200)
MouseLeftUp()
Wait(200)
#拖蓝到快捷栏6
x=xBagTitle-58+((BlueIndex) mod 6)*29
y=yBagTitle+68+((BlueIndex)\6)*29
MouseMove(x,y)
MouseLeftDown(x,y)
Wait(200)
MouseMove(WinX+427, WinY+583)
Wait(200)
MouseLeftUp()
Wait(200)
#关闭背包栏
myKeyPress("B")
Wait(200)
DragRedBlue=true
end function
#检查状态
function CheckStatus
if key_status1<>"-" and GetTime()-F1Time>(F1Timeout-0.5)*60000 then
LogPrint("加状态1")
MyKeyPress(key_status1)
Wait(F1Delay)
F1Time=GetTime()
end if
if key_status2<>"-" and GetTime()-F2Time>(F2Timeout-0.5)*60000 then
LogPrint("加状态2")
MyKeyPress(key_status2)
Wait(F2Delay)
F2Time=GetTime()
end if
if key_status3<>"-" and GetTime()-F3Time>(F3Timeout-0.5)*60000 then
LogPrint("加状态3")
MyKeyPress(key_status3)
Wait(F3Delay)
F3Time=GetTime()
end if
if key_status4<>"-" and GetTime()-F4Time>(F4Timeout-0.5)*60000 then
LogPrint("加状态4")
MyKeyPress(key_status4)
Wait(F4Delay)
F4Time=GetTime()
end if
if key_status5<>"-" and GetTime()-F5Time>(F5Timeout-0.5)*60000 then
LogPrint("加状态5")
MyKeyPress(key_status5)
Wait(F5Delay)
F5Time=GetTime()
end if
end function
#初始化全局数据
function initData
LogPrint("数据初始化开始...")
pi = 4 * Atn(1)
GetActiveWindowID(WinID)
LastStarTime=0
AutoLogin=GetConfigNumber("小星星处理模式")
Button1X=280
Button1Y=580
ButtonF1X=783
ButtonF1Y=200
ButtonSize=29
FightCount=0
RadarCX=728
RadarCY=82
StarWarned=false
GetActiveWindowXY(WinX,WinY)
MouseInput=GetConfigNumber("用鼠标输入")
MonsterRadius=GetconfigNumber("打怪半径范围")
MonsterMinDist=GetConfigNumber("只打远的怪")
MonsterMaxDist=GetConfigNumber("只打近的怪")
WantDetectOffline=GetConfigNumber("检测服务器断线")
fightSeq=GetConfigString("打怪按键顺序")
key_pick=GetConfigString("按键-捡物品")
key_cure=GetConfigString("按键-疗伤")
key_red=GetConfigString("按键-红药")
key_blue=GetConfigString("按键-蓝药")
key_sit=GetConfigString("按键-打坐")
key_status1=GetConfigString("状态1按键")
F1Delay=GetConfigNumber("状态1施法时间")
F1Timeout=GetConfigNumber("状态1持续时间")
key_status2=GetConfigString("状态2按键")
F2Delay=GetConfigNumber("状态2施法时间")
F2Timeout=GetConfigNumber("状态2持续时间")
key_status3=GetConfigString("状态3按键")
F3Delay=GetConfigNumber("状态3施法时间")
F3Timeout=GetConfigNumber("状态3持续时间")
key_status4=GetConfigString("状态4按键")
F4Delay=GetConfigNumber("状态4施法时间")
F4Timeout=GetConfigNumber("状态4持续时间")
key_status5=GetConfigString("状态5按键")
F5Delay=GetConfigNumber("状态5施法时间")
F5Timeout=GetConfigNumber("状态5持续时间")
PickTime=GetConfigNumber("打死怪后捡宝次数")
PickOnFight=GetConfigNumber("打怪途中捡宝")
WantDragRedBlue=GetConfigNumber("自动登录后重放红蓝")
StarWarnSound=GetConfigString("小星星声音报警")
RedExitCount=GetConfigNumber("红少于多少时退出")
PickFilter=GetConfigString("拣宝过滤")
TargetNameFilter=GetConfigString("怪物名关键字")
OnlyExitOnIdle=GetConfigNumber("仅在没有怪攻击时强退")
#读取图像
LoadImage("BagTitle.sel",img_BagTitle)
#设置喝血打坐百分比
bloodCure=GetConfigNumber("疗伤百分比")
LogPrint("剩"&bloodCure&"%血疗伤")
cureCooldown=GetConfigNumber("疗伤技能冷却时间")
lastCureTime=0
bloodNeedSit=GetConfigNumber("喝红百分比")
LogPrint("剩"&bloodNeedSit&"%喝红")
dazuobloodNeedSit=GetConfigNumber("多少血打坐")
LogPrint("剩"&dazuobloodNeedSit&"%血打坐")
MPNeedSit=GetConfigNumber("喝蓝百分比")
LogPrint("剩"&MPNeedSit&"%喝蓝")
dazuoMPNeedSit=GetConfigNumber("多少蓝打坐")
LogPrint("剩"&dazuoMPNeedSit&"%蓝打坐")
minRedInterval=GetConfigNumber("喝红最短间隔")
minBlueInterval=GetConfigNumber("喝蓝最短间隔")
lastRedTime=0
lastBlueTime=0
bloodQuit=GetConfigNumber("退出前吃红比例")
#内存地址计算
addStar=CNum(GetConfigString("小星星地址"))
addOnline=CNum(GetConfigString("是否在线地址"))
addFirst=CNum(GetConfigString("基地址"))
#备用间接基地址,要使用将下面两行的注释符去掉
#ReadMemory(&h916B3C,2,add0)
#ReadMemory(add0+&h1c,2,addFirst)
ReadMemory(addFirst, 2, Number1)
addSecond=Number1+40
ReadMemory(addSecond, 2, Number3)
addNowBlood=Number3+596
addAllBlood=addNowBlood+&h18
addNowMP=addNowBlood+&h4
addAllMP=addNowBlood+&h1c
addTarget=Number3+&h7c0
addnowx=Number3+&H3d8
addnowy=Number3+&H3e0
ReadMemory(Number3+&h960, 2, TargetBase)
addTargetX=TargetBase+&h200
addTargetY=TargetBase+&h208
ReadMemory(Number3+&H87C,2,addBagBase)
ReadMemory(addBagBase+&H10,1,BagCount)
ReadMemory(addBagBase+&HC,2,addBagFirst)
LogPrint("背包数量:"&BagCount&"格")
ReadMemory(Number1+&H8, 2, addSecond)
ReadMemory(addSecond+&H24, 2, add3)
addGroundCount=add3+&h14
ReadMemory(add3+&H18, 2, addGroundBase)
ReadMemory(Number1+&H8, 2, Number2)
ReadMemory(Number2+&H20, 2, BugbearBase)
F1Time=-1000000000
F2Time=-1000000000
F3Time=-1000000000
F4Time=-1000000000
F5Time=-1000000000
CheckStatus()
initData=true
LogPrint("初始化数据成功")
end function
#检测断线
function DetectOffline
DetectOffline=false
if WantDetectOffline=0 then
exit function
end if
ReadMemory(addOnline, 2, online)
if online=0 then
//if FindImageEx(img_BtOffline, Color(30,30,30), WinX, WinY, WinX+800, WinX+600, true, x, y) then
LogPrint("检测到游戏断线")
if WantDetectOffline=1 then
LogPrint("重新登录游戏...")
myKeyPress("RETURN")
Wait(500)
myKeyPress("RETURN")
Wait(5000)
myKeyPress("ESC")
Wait(500)
myKeyPress("ESC")
Wait(500)
myKeyPress("ESC")
Wait(500)
do
Wait(100)
loop while not Login()
LogPrint("登录完成,继续游戏")
initData()
if WantDragRedBlue=1 then
if not DragRedBlue() then
exit script
end if
end if
end if
if WantDetectOffline=2 then
Shutdown()
exit script
end if
DetectOffline=true
exit function
end if
end function
#检测验证框
function DetectStar
DetectStar=false
if AutoLogin=2 then
exit function
end if
ReadMemory(addStar, 1, num)
if num=1 then
#如果需要报警 AutoLogin=0
if AutoLogin=0 then
#如果没有报警
if not StarWarned then
#小星星报警
SetInputMode(0)
KeyDown("WIN")
KeyPress("M")
KeyUp("WIN")
MsgBox("检测到小星星",0)
if not StarWarnSound="-" then
RunApp(StarWarnSound)
end if
StarWarned=true
SetInputMode(1)
end if
#如果需要重新登录
else
#如果报警了 自动退出计时器启动
if LastStarTime=0 then
LogPrint("重登录倒计时启动...")
LastStarTime=GetTime()
end if
end if
#如果需要重登录 AutoLogin=1
if AutoLogin=1 and LastStarTime>0 then
#否则 如果时间大于4分半 退出重新登录
ReadMemory(addTarget, 2, TargetID)
if GetTime()-LastStarTime>=1000*60*4.5 and (OnlyExitOnIdle=0 or TargetID<2000000000) then
Logout()
LogPrint("重登录...")
st=GetTime()
do
Wait(100)
loop while not Login()
LogPrint("登录成功。用时"&(GetTime()-st)/1000&"秒")
initData()
if WantDragRedBlue=1 then
if not DragRedBlue() then
exit script
end if
end if
DetectStar=true
end if
end if
else
if LastStarTime>0 and GetTime()-LastStarTime<1000*60*4.5 then
LastStarTime=0
LogPrint("关闭重新登录倒计时器")
StarWarned=false
exit function
end if
StarWarned=false
end if
end function
#取得当前角色的坐标
function GetPlayerXY(byref x, byref y)
ReadMemory(addnowx, 3, x)
ReadMemory(addnowy, 3, y)
end function
#取得选中怪物的信息
function GetTargetInfo(byref x, byref y, byref dist, byref level, byref blood, byref maxBlood, byref name)
GetTargetInfo=false
ReadMemory(addTarget, 2, id)
ReadMemory(BugbearBase+&h24, 2, maxTarget)
offset=(id mod maxTarget)*4
if id>&h7FFFFFFF then
offset=(id mod maxTarget)*4+(&h7FFFFFFF mod maxTarget)*8+8
end if
ReadMemory(BugbearBase+&h18, 2, addList)
ReadMemory(addList+offset, 2, addTargetList)
ReadMemory(addTargetList+&H4, 2, addInfo)
ReadMemory(addInfo+&H3c, 3, x)
ReadMemory(addInfo+&H44, 3, y)
ReadMemory(addInfo+&H22c, 3, dist)
ReadMemory(addInfo+&H130, 2, blood)
ReadMemory(addInfo+&H148, 2, maxBlood)
ReadMemory(addInfo+&H128, 2, level)
ReadMemory(addInfo+&H208, 2, addName)
ReadMemory(addName, 5, 40, uname)
name=UnicodeToGB(uname)
GetTargetInfo=true
end function
#判断一个怪物名称是否被过滤
function IsBadTargetName(name)
IsBadTargetName=false
if TargetNameFilter="-" then
exit function
end if
filter=TargetNameFilter
do
index=InStr(filter,",")
if index>0 then
sub=Trim(Mid(filter, 1, index-1))
filter=Mid(filter,index+1)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -