⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 autologin.ser

📁 诛仙挂机脚本 完美无封号危险 Seraph应用无限可能
💻 SER
📖 第 1 页 / 共 3 页
字号:
else
	sub=Trim(filter)
end if
if not sub="" then
	if InStr(name, sub)>0 then
		IsBadTargetName=false
		exit function
	end if
end if
loop while index>0
IsBadTargetName=true
end function

#根据移动的XY差值计算当前的方向角度(按顺利针从0到2pi)
function GetAngle(fromX, fromY, toX, toY)
dim angle
if toX-fromX=0 then
	if toY-fromY>0 then
		GetAngle=0
	else
		GetAngle=pi		
	end if
	exit function
else
	angle=Atn(-(toY-fromY)/(toX-fromX))
end if
if toX-fromX <0 then
	angle=angle+pi
end if
GetAngle=angle+0.5*pi
end function

#通过移动一小步来计算当前的方向角度
function GetCurrentAngle(forward, byref angle)
GetCurrentAngle=false
LogPrint("开始计算当前面向的角度")
GetPlayerXY(lastX, lastY)
if forward then
	myKeyDown("W")
else
	myKeyDown("S")
end if
do
wait(50)
GetPlayerXY(curX, curY)
dist=sqr((curX-lastX)*(curX-lastX)+(curY-lastY)*(curY-lastY))
loop until dist>0.01
if forward then
	myKeyUp("W")
else
	myKeyUp("S")
end if
if forward then
	angle=GetAngle(lastX, lastY, curX, curY)
else
	angle=GetAngle(curX, curY, lastX, lastY)
end if
GetCurrentAngle=true
end function

#走到指定的坐标(点小地图方式)
function GotoXY(toX, toY)
error=0.5
st=GetTime()
do
GetPlayerXY(x,y)
dist=sqr((x-toX)*(x-toX)+(y-toY)*(y-toY))
if dist<error then
	MouseLeftClick(RadarCX, RadarCY)
	exit function
end if
angle=GetAngle(x,y,toX,toY)
dx=Round(5*sin(angle))
dy=Round(5*cos(angle))
MouseLeftClick(RadarCX+dx, RadarCY-dy)
Wait(200)
loop while GetTime()-st<30000
end function

#走向标记坐标点
function GotoMarkPoint
LogPrint("开始走向第一个标记位置")
SetInputMode(1)
MouseLeftClick(683,130)
Wait(800)
MouseRightClick(609,47)
Wait(500)
MouseLeftClick(648,8)

GetPlayerXY(x, y)
do
lastX=x
lastY=y
Wait(1000)
if GetBloodPercent()<bloodNeedSit then
	MyKeyPress(key_red)
	LogPrint("走路途中喝了一个红")
end if
GetPlayerXY(x, y)
loop until abs(x-lastX)<0.0001 and abs(y-lastY)<0.0001
LogPrint("到达目标地点")
end function

#检查血和MP,不足则打坐
function CheckBloodMP(canSit)
CheckBloodMP=false
#最小化挂机牺牲提示
ReadMemory(addNowBlood, 2, NowBlood)
if NowBlood=0 then
	LogPrint("恭喜你!又牺牲了!")
	dead=GetConfigNumber("挂了之后怎么办")
	if dead=1 then
		LogPrint("死了!关机睡觉!")
		Shutdown()
		exit script
	elseif dead=0 then
		SetInputMode(0)
		KeyDown("WIN")
		KeyPress("M")
		KeyUp("WIN")
		MsgBox("不幸牺牲了",0)
		exit script
	elseif dead=2 then
		#点击对话框回城
		MouseLeftClick(397,305)
		Wait(10000)
		#走回挂机点
		GotoMarkPoint()
		#加状态
		F1Time=-1000000000
		F2Time=-1000000000
		F3Time=-1000000000
		F4Time=-1000000000
		F5Time=-1000000000
		CheckStatus()
		startTime=GetTime()
	end if
	exit function
end if

BloodPercent=GetBloodPercent()
MPPercent=GetMPPercent()

#疗伤按键4
if (GetBloodPercent()<bloodCure) then
	if GetTime()-lastCureTime>=cureCooldown*1000+200 then
		MyKeyPress(key_cure)
		LogPrint("得疗伤了!")
		lastCureTime=GetTime()
		Wait(1500)
		if (GetBloodPercent()>bloodCure) then
			LogPrint("终于加上血来了!")
			CheckBloodMP=true
		exit function
		end if
	end if
end if

#喝红药 按键5
if (GetBloodPercent()<=bloodNeedSit) and GetTime()-lastRedTime>minRedInterval then
	MyKeyPress(key_red)
	lastRedTime=GetTime()
	LogPrint("没办法,不喝就挂了!")
end if

#判断红的数量,不足时退出
if RedExitCount>0 then
GetBagItemCount(RedID, count)
if count<RedExitCount then
	LogPrint("背包第一页里红的数量只有"&count&"个了,退出游戏")
	Logout()
	exit script
end if
end if

#喝蓝药 按键6
if (GetMPPercent()<=MPNeedSit) and (GetMPPercent()>dazuoMPNeedSit) and GetTime()-lastBlueTime>minBlueInterval then
	MyKeyPress(key_blue)
	lastBlueTime=GetTime()
	LogPrint("喝个蓝!")
end if

#打坐
if (GetBloodPercent()<=dazuobloodNeedSit) or (GetMPPercent()<=dazuoMPNeedSit) then
	if canSit then
		MyKeyPress(key_sit)
		LogPrint("打打坐练练功!")
		StartTime1=GetTime()
		do
			Wait(200)
			if DetectStar() then
				exit function
			end if
			if DetectOffline() then
				exit function
			end if
			ReadMemory(addTarget,2,TargetID)
			if TargetID>2000000000 then
				LogPrint("我靠!打坐也来咬我!")
				CheckBloodMP=true
			exit function
			end if
		loop until (GetBloodPercent()>=99 and GetMPPercent()>=99) or GetTime()-StartTime1>65000
		MyKeyPress(key_sit)
	end if
end if
CheckBloodMP=true
end function

#判断一个物品名称是否需要删除
function IsBadItem(name)
filter=PickFilter
do
index=InStr(filter,",")
if index>0 then
	sub=Trim(Mid(filter, 1, index-1))
	filter=Mid(filter,index+1)
else
	sub=Trim(filter)
end if
if not sub="" then
	if InStr(name, sub)>0 then
		IsBadItem=true
		exit function
	end if
end if
loop while index>0
IsBadItem=false
end function

#删除地面不需要的物品
function ClearGround
if PickFilter="-" then
	exit function
end if
ReadMemory(addGroundCount, 2, itemCount)
//Print("地面物品数:"&itemCount)
count=0
clearCount=0
for i=1 to 768
	ReadMemory(addGroundBase+4*i, 2, addName)
	if addName>0 then
		ReadMemory(addName+&H4, 2, addName1)
		ReadMemory(addName1+&H164, 2, addName2)
		ReadMemory(addName2,5,40,name)
		GBName=UnicodeToGB(name)
		if IsBadItem(GBName) then
			WriteMemory(addGroundBase+4*i, 2, 0)
			clearCount=clearCount+1
			LogPrint("从地面清除物品:"&GBName)
		end if
		count=count+1
		if count>=itemCount then
			exit for
		end if
	end if
next
if itemCount<>count-clearCount then
	WriteMemory(addGroundCount, 2, count-clearCount)
end if
end function

#按照设定的按键顺序打怪
function DoFight
DoFight=false
cur=1
do
	#此时检测一次怪是否已死,提高效率
	ReadMemory(addTarget, 2, TargetID)
	if TargetID<2000000000 then
		exit do
	end if
	
	if not CheckBloodMP(false) then
		exit function
	end if

	p=InStr(cur,fightSeq,":")
	if p=0 then
		exit do
	end if
	key=Mid(fightSeq, cur, p-cur)
	cur=p+1
	p=InStr(cur,fightSeq,",")
	if p=0 then
		p=Len(fightSeq)+1
	end if
	delay=CNum(Mid(fightSeq, cur, p-cur))
	cur=p+1
	MyKeyPress(key)
	st=GetTime()
	do
		wait(50)
		ReadMemory(addTarget, 2, TargetID)
		if TargetID<2000000000 then
			exit do
		end if
	loop while GetTime()-st<delay
loop while true
DoFight=true
end function

#打一轮怪
function Fight
Fight=false
	#LogPrint("开始找怪打怪")
	#如果人物走出了范围,走回起始点
	GetPlayerXY(myX, myY)
	dist=sqr((myX-myStartX)*(myX-myStartX)+(myY-myStartY)*(myY-myStartY))
	if (MonsterRadius<>0 and dist>MonsterRadius) then
		LogPrint("人物已出范围,回起始点")
		GotoXY(myStartX, myStartY)
		exit function
	end if
	ReadMemory(addTarget, 2, TargetID)
	#如果有怪在打你就不选怪了,直接还击
	if (TargetID<2000000000) then
		#LogPrint("按TAB选怪")
		count=0
		do
			#3次选不到合适的怪,走回原点,重新选怪
			if count>=3 then
				LogPrint("找不到符合条件的怪,退出")
				MyKeyPress("ESC")
				Wait(500)
				MyKeyPress("ESC")
				GotoXY(myStartX, myStartY)
				exit function
			end if
			count=count+1
			#按TAB找怪
			MyKeyPress("TAB")
			st=GetTime()
			do
			Wait(500)
			#怪物取目标
			ReadMemory(addTarget, 2, TargetID)
			loop until TargetID>2000000000 or GetTime()-st>3000
			#超时没找到怪则此次Fight调用失败
			if TargetID<=2000000000 then
				LogPrint("超时没有选到怪,退出")
				exit function
			end if
			if MonsterMinDist=0 and MonsterMaxDist=0 and TargetNameFilter="-" then
				exit do
			end if
			GetTargetInfo(targetX, targetY, myDist, level, blood, maxBlood, name)
		loop while (MonsterMinDist>0 and myDist<MonsterMinDist) or (MonsterMaxDist>0 and myDist>MonsterMaxDist) or IsBadTargetName(name)
	end if

#打怪直到打死,一段时间打不死,可能卡住
FightCount=FightCount+1
LogPrint("你是第"&FightCount&"个!")
st=GetTime()
LastTargetID=TargetID
do
#捡宝
ClearGround()
if PickOnFight>0 then
MyKeyPress(key_pick)
Wait(300)
end if

if not DoFight() then
	exit function
end if

if DetectStar() then
	Fight=true
	exit function
end if
if DetectOffline() then
	Fight=true
	exit function
end if

ReadMemory(addTarget, 2, TargetID)
if (TargetID<>LastTargetID) then
	st=GetTime()
	LastTargetID=TargetID
end if
loop until TargetID<2000000000 or GetTime()-st>60000
#如果卡住,移动几步
if TargetID>2000000000 then
	LogPrint("卡了!55555")
	MouseLeftClick(RadarCX+3, RadarCY+3)
	Wait(2000)
	exit function
end if
#拣宝
for i=1 to PickTime
ClearGround()
MyKeyPress(key_pick)
Wait(300)
next
#检查状态
CheckStatus()
end function

function main
GetActiveWindowSize(width, height)
if width<>800 or height<>600 then
	LogPrint("请先将游戏窗口大小设置为800×600")
	exit function
end if
if not initData() then
	exit function
end if

GetPlayerXY(myStartX,myStartY)

if not Login_Init() then
	exit function
end if

if WantDragRedBlue=1 then
RedBagIndex=GetConfigNumber("红的背包位置")
BlueBagIndex=GetConfigNumber("蓝的背包位置")
LogPrint("读取第"&RedBagIndex&"个背包位置为红药。。。")
GetBagItemInfo(RedBagIndex-1, RedID, num)
LogPrint("记录下红药ID:"&RedID)
LogPrint("读取第"&BlueBagIndex&"个背包位置为蓝药。。。")
GetBagItemInfo(BlueBagIndex-1, BlueID, num)
LogPrint("记录下蓝药ID:"&BlueID)
end if

while true
DetectStar()
DetectOffline()
if CheckBloodMP(true) then
	Fight()
end if
wend

end function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -