DNF自动收货脚本源代码选自网络.docx
《DNF自动收货脚本源代码选自网络.docx》由会员分享,可在线阅读,更多相关《DNF自动收货脚本源代码选自网络.docx(25页珍藏版)》请在冰豆网上搜索。
DNF自动收货脚本源代码选自网络
//================================================================================
//MessageBox"正在初始话请稍等"
CallPlugin.Msg.Tips("正在加载方案…")
DqTime=lib.网络.获取网络时间()
//获取网络时间,得到的时间格式为:
2000-1-112:
00:
00
zzsj="2011-11-123:
59:
59"
//zzsj=终止时间为脚本使用限定的最后时间!
IfCDate(DqTime)CallPlugin.Msg.Tips("加载成功!
(*^__^*)")
//MessageBox"加载成功!
(*^__^*)"
//Msgbox"验证成功!
继续使用!
"
Else
CallPlugin.Msg.Tips("加载失败,可能是没有权限!
⊙﹏⊙‖∣")
RunApp("http:
EndScript
EndIf
//================================================================================
'wlsj=Lib.网络.获取网络时间()
'Delay2000
'Ifwlsj>cdate("2012-10-24")
'Delay100
'MsgBox"使用期限已到,请从任务管理器关闭程序"
'EndScript
'endif
//使用期限检测脚本
DimEnvshuliang,time1,time2,time3,time4,ktjc,feyjy
Dimhwnd,hwnd1,hwnd2
DimEnvkaiguan
kaiguan=0
hwnd=Plugin.Window.MousePoint
x=Plugin.Window.Move(hwnd,0,0)
'Delay1000
time1=plugin.sys.GetTime//获取脚本运行时系统初始时间
'ktjc=1
'setws=createobject("wscript.shell")
'ws.run"c:
\testfile.txt",5,ture
'Delay500
'hwnd2=Plugin.Window.Foreground
'y=Plugin.Window.Move(hwnd2,0,480)
gosub站街自动喊话
Remkaitou
Sub站街自动喊话//站街喊话脚本
//下面这句在屏幕区域范围内查找16进制颜色("00FF")的数量
UserVarfdys=15"防掉线设置"
MoveTo603,439
gosub检查是否有交易
time3=plugin.sys.GetTime
Ifint(time3-time1)>fdys*60*1000then//15分钟后开启防掉线,只支持站街的时候gosub防掉线
EndIf
KeyPressS"Enter",1
Delay200
NUM=plugin.Color.CountColor(60,398,92,407,"AADDEE",1)//查找喊话窗口是否存在IfNUM>0Then
Goto喊话
Rem喊话
EndIf
UserVarszhhjs=5"设置喊话句数(最多五句)"
Ifszhhjs=1Then
KeyPressS"B",1
Delay20
KeyPressS"A",1
Delay20
KeyPressS"1",1
Delay20
KeyPressS"Enter",1
Delay1200
ElseIfszhhjs=2Then
KeyPressS"B",1
Delay20
KeyPressS"A",1
Delay20
KeyPressS"1",1
Delay20
KeyPressS"Enter",1
Delay3200
KeyPressS"B",2
Delay20
KeyPressS"1",1
Delay20
KeyPressS"Enter",1
Delay1200
ElseIfszhhjs=3Then
KeyPressS"B",1
Delay20
KeyPressS"A",1
Delay20
KeyPressS"1",1
Delay20
KeyPressS"Enter",1
Delay3200
KeyPressS"B",2
Delay20
KeyPressS"1",1
Delay20
KeyPressS"Enter",1
Delay3200
KeyPressS"B",1
Delay20
KeyPressS"C",1
Delay20
KeyPressS"Enter",1
Delay1200
ElseIfszhhjs=4Then
KeyPressS"B",1
Delay20
KeyPressS"A",1
Delay20
KeyPressS"1",1
Delay20
KeyPressS"Enter",1
Delay3200
KeyPressS"B",2
Delay20
KeyPressS"1",1
Delay20
KeyPressS"Enter",1
Delay3200
KeyPressS"B",1
Delay20
KeyPressS"C",1
Delay20
KeyPressS"Enter",1
Delay3200
KeyPressS"B",1
Delay20
KeyPressS"D",1
Delay20
KeyPressS"Enter",1
Delay1200
ElseIfszhhjs=5Then
KeyPressS"B",1
Delay20
KeyPressS"A",1
Delay20
KeyPressS"1",1
Delay20
KeyPressS"Enter",1
Delay3200
KeyPressS"B",2
Delay20
KeyPressS"1",1
Delay20
KeyPressS"Enter",1
Delay3200
KeyPressS"B",1
Delay20
KeyPressS"C",1
Delay20
KeyPressS"Enter",1
Delay3200
KeyPressS"B",1
Delay20
KeyPressS"D",1
Delay20
KeyPressS"Enter",1
Delay3200
KeyPressS"B",1
Delay20
KeyPressS"E",1
Delay20
KeyPressS"Enter",1
Delay1200
Endif
feyjy=0
gosub等待交易//跳到等待交易
EndSub
Sub等待交易
//找图
x=Plugin.Window.Active(hwnd)
FindPic455,305,636,419,"Attachment:
\公告按钮.bmp",
0.9,intX,intY//扫描交易框
IfintX>0AndintY>0Then
MoveTo523,403
LeftClick2
Delay300
FindPic0,0,1024,768,"Attachment:
\11.bmp",
0.9,intX,intY
IfintX>0AndintY>0Then
gosub等待放入物品
Else
gosub站街自动喊话
EndIf
Else
gosub站街自动喊话
EndIf
EndSub
//================================================================================
//MessageBox"正在初始话请稍等"
CallPlugin.Msg.Tips("正在加载方案…")
DqTime=lib.网络.获取网络时间()
//获取网络时间,得到的时间格式为:
2000-1-112:
00:
00
zzsj="2011-11-123:
59:
59"
//zzsj=终止时间为脚本使用限定的最后时间!
IfCDate(DqTime)CallPlugin.Msg.Tips("加载成功!
(*^__^*)")
//MessageBox"加载成功!
(*^__^*)"
//Msgbox"验证成功!
继续使用!
"
Else
CallPlugin.Msg.Tips("加载失败,可能是没有权限!
⊙﹏⊙‖∣")
RunApp("http:
EndScript
EndIf
//================================================================================
Sub等待放入物品
Dimi
i=0
UserVarddfw=100"等待放入物品延迟时间(单位:
毫秒)注:
1000毫秒=1秒"Delayddfw
DoUntili<8
FindPic71,173,306,198,"Attachment:
\交易栏无物品图.bmp",
0.9,intX,intY
IfintX>0AndintY>0Then
i=i+1
Else
gosub检查并交易
EndIf
Loop
Ifi>0
KeyPress"esc",1
Delay100
gosub站街自动喊话
EndIf
EndSub
Sub输入金钱
Dimqian,x,cishu
Remjiaqian
qian=jiage
(100)
Ifqian<>0then
'MsgBox"总价钱为:
"&qian
MoveTo197,301
Delay250
LeftClick1
Delay250
KeyPress"BackSpace",15//金钱输入清零
Delay50
x=1
Dimshu
cishu=len(qian)
Forcishu
shu=left(qian,1)//取qian的左起第一个数字
qian=right(qian,cishu-x)//取qian的右起第I个数字
KeyPressshu,1
i=0
Delay250
x=x+1
Next
Else
i=i+1
Ifi<30//30秒内金钱为0则跳转喊话
Gotojiaqian
Delay1000
Else
KeyPress"esc",1
Delay100
gosub站街自动喊话
EndIf
Endif
Delay100
LeftClick1
Delay200
gosub检查并交易
EndSub
Sub检查并交易
Remjiancha
gosub检查交易是否提前结束
//检查己方输入的金钱
Dimno
(9)//数字特征码
no
(0)="10"
no
(1)=""//自取特征码,DNF己方金钱框专用no
(2)="1"
no
(3)="10"
no
(4)="1000"
no
(5)="001110"
no
(6)="10"
no
(7)=""
no
(8)=""
no
(9)="10"
Dimcolo
(3)//颜色十六进制值10月7日版
colo
(1)="008CFF"
colo
(0)="0050FF"
colo
(2)="00FF"
MoveTo603,439
rightx=296//初始x坐标
righty=299//初始Y坐标
rx=rightx
ry=righty
jici=0
jine=""
y=0
For3//千万位数字扫描
rightx=296-21*y
for3//百位数字扫描
i=0
For8//单个数字扫描
rx=rightx-jici*6//后退6个像素点
For5
ifcolorrx,ry,colo(y),0
nob="1"
Else
nob="0"
EndIf
rx=rx-1
number=number&nob
Next
ry=ry+1
Next
For10
Ifnumber=no(i)
jine=i&jine
ExitFor
EndIf
i=i+1
Next
jici=jici+1
number=""
ry=righty//循环一次结束后初始化ry坐标
Next//修改初始化值
jici=0
y=y+1
Next
'MsgBoxjine
Delay100
feyjy=feyjy+1
Iffeyjy>120Then//若一段时间内没有成功交易则取消交易,慎重!
!
!
KeyPress"Esc",1
Delay100
gosub站街自动喊话
EndIf
Ifint(jine)=jiage
(1000)Then
'MsgBox"价格正确可以进行下一步交易"
ifcolor167,269,"44EEFF",0//检查对方是否先点击了交易
MoveTo161,426//交易逐步点击
Delay400
LeftClick2
Delay400
LeftClick2
Delay150
Else
Gotojiancha
EndIf
Else
'MsgBox"价格不符合"
gosub输入金钱
Delay500
Gosub检查并交易
EndIf
EndSub
Sub检查交易是否提前结束
i=0
Remstar
FindPic0,0,1024,768,"Attachment:
\11.bmp",
0.9,intX,intY
IfintX>0AndintY>0Then
Delay500//2分钟内未交易完成则关闭交易框
Else
gosub站街自动喊话
Gotojiewei
EndIf
remjiewei
EndSub
Sub检查是否有交易
Remstar
FindPic0,0,1024,768,"Attachment:
\11.bmp",
0.9,intX,intY
IfintX>0AndintY>0Then
gosub检查并交易
Delay100
Else
'Gotojiewei
EndIf
'remjiewei
EndSub
Sub防掉线
kaiguan=0
For2
MoveTo33,439
Delay600
KeyPress"w",1
Delay100
KeyPress"q",1
Delay100
MoveTo89,202
Delay100
LeftClick1
Delay1000
IfColor143,437,"6DA2B9",1then
//接受任务
Delay1000
MoveTo143,437
Delay100
LeftClick1
Delay100
KeyPress"Esc",1
Delay100
MoveTo419,405
Delay600
LeftClick2
Else
Delay1000
//放弃任务
MoveTo419,402
Delay100
LeftClick1
Delay100
MoveTo336,407
Delay100
LeftClick1
Delay100
EndIf
KeyPress"Esc",1
Next
EndScript
EndSub
Sub输出信息
CallPlugin.Bkgnd.SendString(Hwnd2,"内容")
Plugin.Window.Activehwnd2
KeyPress"enter",1
EndSub
Functionxiejiage(geshu,jq,wupin)
Setfso=CreateObject("Scripting.FileSystemObject")
b=Plugin.File.ExistFile("c:
\testfile.txt")
Ifb=0Then
Setc=fso.CreateTextFile("c:
\testfile.txt")
seta=fso.opentextfile("c:
\testfile.txt",8)
Else
seta=fso.opentextfile("c:
\testfile.txt",8)
EndIf
a.writeline(now&"————"&"第"&geshu&"格单价:
"&wupin&"价钱"&jq)
a.close
EndFunction
Functionjiage(yanshi)
Delayyanshi
Dimss
(100)
ss
(0)="31CE"//强韧
ss
(1)="52423A"//威严
ss
(2)="84C6"//狂乱
ss
(3)="6B63"//灵魂
ss
(4)="528429"//灾难
ss
(5)="4A5B"//眼睛
ss
(6)="D69473"//小篮
ss
(7)="8484"//无色
ss
(8)="AD73D6"//碳175,191
ss
(9)="BDB5C6"//xx
ss
(10)="73194A"//小黑
ss
(11)="7BEF"//xx
ss
(12)="B5B5"//xx
//这里使用查找颜色来获取物品不知道在别的电脑上是否能使用反正在我自己的电脑上是可以用的请教一下
uservarsss0=23000"强韧恶魔的邀请函"
uservarsss1=23000"威严"
uservarsss2=23000"狂乱"
uservarsss3=3800"灵魂"
uservarsss4=3200"灾难"
uservarsss5=25000"眼睛"
uservarsss6=100"小篮"
uservarsss7=50"无色"
uservarsss8=50"碳"
uservarsss9=9000"蓝冰"
uservarsss11=250"小红"
uservarsss12=80"小白"
uservarsss10=120"小黑"
Dimn,m,i,j,qian
qian=0
n=0
geshu=1
Dimkx
kx=85//第一格物品x取色点
ux=kx
Dimky
ky=191//第一个物品y取色点
//扫描第一行物品,共8个物品格
for8
//单格物品扫描
For13
IfColorux,ky,ss(n),0
sss=0
Ifn=0
sss=sss0
ElseIfn=1
sss=sss1
ElseIfn=2
sss=sss2
ElseIfn=3
sss=sss3
ElseIfn=4
sss=sss4
ElseIfn=5
sss=sss5
ElseIfn=6
sss=sss6
ElseIfn=7
sss=sss7
ElseIfn=8
sss=sss8
ElseIfn=9
sss=sss9
ElseIfn=10
sss=sss10
ElseIfn=11
sss=sss11
ElseIfn=12
sss=sss12
EndIf
jiag=wupin(geshu,sss)//获取物品价钱
'Callxiejiage(geshu,jiag,sss)
'BeginThread输出信息
ExitFor
EndIf
n=n+1
Next
qian=qian+jiag//计算总价格
jiag=0//价格清零
ux=ux+30//x坐标加30,扫描下一个框内物品
geshu=geshu+1//个数循环
n=0
Next
jiage=qian//参数传递
EndFunction
Functionwupin(GS,JQ)//计算物品总价格LX查找类型
//代码太他妈有才了
//此代码论坛中有,个人觉得很好。
dima
(100)
dimb
(100)
dimq
(100)
number0="Attachment:
\0.bmp"
number1="Attachment:
\1.bmp"
number2="Attachment:
\2.bmp"
number3="Attachment:
\3.bmp"
number4="Attachment:
\4.bmp"
number5="Attachment:
\5.bmp"
number6="Attachment:
\6.bmp"
number7="Attachment:
\7.bmp"
number8="Attachment:
\8.bmp"
number9="Attachment:
\9.bmp"
cishu=1
leftx=72+(GS-1)*30//132
upy=174//155
rightx=99+(GS-1)*30//162
downy=185//235
Similar=1
lx=leftx
Dimn,m,p,i,j
n=0
m=1
p=1
Whilen<>m
m=n
FindPicleftx,upy,rightx,downy,number0,Similar,fx,fy
Iffx>=0andfy>=0
n=n+1
leftx=fx+1
a(n)=fx
b(n)=0
EndIf
wend
leftx=lx
m=m-1
Whilen<>m
m=n
FindPicleftx,upy,rightx,downy,number1,Similar,fx,fy
Iffx>=0andfy>=0
n=n+1
leftx=fx+1
a(n)=fx
b(n)=1
EndIf
wend
leftx=lx
m=m-1
Whilen<>m
m=n
FindPicleftx,upy,rightx,downy,number2,Similar,fx,fy
Iffx>=0andfy>=0
n=n+1
leftx=fx+1
a(n)=fx
b(n)=2
EndIf
wend
leftx=lx
m=m-1
Whilen<>m
m=n
FindP