Sub 等待放入物品
// MessageBox("等待放入物品")
For i=1 to 16
// MessageBox("进入循环体")
Call FindPic(60,160,110,210,"C:DNF图片\物品栏空.bmp",0.6,intx,inty)
// MessageBox("查看交易栏")
If intx >0 Then
// MessageBox("交易栏无物品")
Delay 500
Else
// MessageBox("交易栏有物品")
Exit For
End If
Next
// MessageBox(i)
If i=17
Delay 1000
KeyPress "esc",1
Delay 100
Goto s
Else
Call 检查交易是否提前结束
End If
End Sub
Sub 找图并传递图片(物品,单价,图片位置)
Dim intx,inty
Call FindPic(72,174,307,259,图片位置,0.6,intx,inty)
If intx>0
// MessageBox("找到"&物品)
// MessageBox("单价"&单价)
Call 识别数字并计算(物品,单价,intx,inty)
Else
// MessageBox("未找到"&物品)
End If
End Sub
Sub 识别数字并计算(物品,单价,x,y)
Dim bx,by,数量
数量=""
bx=x+21
by=y+1
For 4
co=""
y=by
For 7
x=bx
For 4
IfColor x,y,"FFFFFF",0 Then
i="1"
Else
i="0"
End If
co=co&i
x=x+1
Endfor
y=y+1
Endfor
If co=num0
num="0"
ElseIf co=num1
num="1"
ElseIf co=num2
num="2"
ElseIf co=num3
num="3"
ElseIf co=num4
num="4"
ElseIf co=num5
num="5"
ElseIf co=num6
num="6"
ElseIf co=num7
num="7"
ElseIf co=num8
num="8"
ElseIf co=num9
num="9"
Else
num="0"
End If
数量=num&数量
If num="1"
bx=bx-4
Else
bx=bx-6
End If
endfor
If 数量=0
数量=1
End If
// MessageBox("数量"&数量)
If flag=1
a.write(数量&"个"&物品&" ")
End If
sum=sum+单价*数量
// s=Plugin.GetSysInfo.GetDateTime()