Hwnd = Plugin.Window.Foreground()
sRect = Plugin.Window.GetClientRect(Hwnd)
Dim MyArray
MyArray=Split(sRect,"|")
Ux=CLng(MyArray(0))
Uy=CLng(MyArray(1))
Call Plugin.Window.Move(Hwnd, 0, 0)
Hwndck = Plugin.Window.Find(0, "梦幻西游 聊天窗口")
Call Plugin.Window.Hide(Hwndck)


Rem 开始
KeyPress "Tab", 1
Delay 200
i = 0
While i=0
FindPic 0,0,1024,768,"Attachment:\地图.bmp",0.2,dituX,dituY
If dituX > 0 And dituY > 0 Then 
Delay 200
    MoveTo dituX+200,dituY+150
    Delay 200
    LeftClick 1
    i=1
Else 
        KeyPress "Tab", 1
    SayString "没找到图"
End If
Wend
KeyPress "Tab", 1
Call 战斗()
Delay 8000
KeyPress "Tab", 1
Delay 200
i = 0
While i=0
FindPic 0,0,1024,768,"Attachment:\地图.bmp",0.2,dituX,dituY
If dituX > 0 And dituY > 0 Then 
Delay 200
    MoveTo dituX+400,dituY+200
    Delay 200
    LeftClick 1
    i=1
    Else 
        KeyPress "Tab", 1
    SayString "没找到图"
End If
Wend
KeyPress "Tab", 1
Call 战斗()
Delay 8000
Goto 开始
Sub 战斗()
    IfColor 310+Ux,37+Uy,"F8FCF8",0 Then
    Rem 战斗
        FindPic Ux,Uy,Ux+640,Uy+480,"Attachment:\法术.bmp",0.9,intX,intY
        If intX > 0 And intY > 0 Then 
            KeyDown 18, 1
            KeyPress 65, 1
            KeyUp 18, 1
            Delay 500
            KeyDown 18, 1
            KeyPress 65, 1
            KeyUp 18, 1
        End If
            Delay 5000
        IfColor 310 + Ux, 37 + Uy, "F8FCF8", 1 Then
            Goto 战斗结束
        End If
        Goto 战斗
    End If
    Rem 战斗结束
    Delay 1000
    Call 加血()
End Sub
Sub 加血()
IfColor 628,36,"1810E8",1 Then
    MoveTo 628, 36
Delay 100
    RightClick 1
End If
Delay 100
IfColor 515,37,"800B8",1 Then
    MoveTo 515, 37
Delay 100
    RightClick 1
End If
End Sub