Goto [开始工作]
        EndIf 
    EndIf 
    If Saled =0 and (Mtype=3 and Boss>1 Or Full=1 and Stype =2)
        Gosub [出售物品]
    EndIf 
    MoveTo 524 162
    Delay 100
    LeftClick 1
    Delay 200
    stime = now()
    Rem [购买物品界面]
    IfColor 495 30 6b8ead 1
        If DateDiff("s",stime,now()) < 5
            Delay 100
            Goto [购买物品界面]
        Else 
            Goto [买卖界面]
        EndIf 
    EndIf 
    MoveTo 801 169
    Delay 400
    I = 0
    PageN = 1
    For BuyItemCount
        If Ptype = 2
            If BuyItem_Page(I) <> PageN
                If BuyItem_Page(I) > PageN
                    MoveTo 637 144
                ElseIf BuyItem_Page(I) < PageN
                    MoveTo 637 72
                EndIf 
                Delay 200
                N = Abs(BuyItem_Page(I)-PageN)
                If N <> 0
                    For N
                        LeftClick 1
                        Delay 150
                        PageN = PageN + 1
                    EndFor 
                EndIf 
                Delay 120
            EndIf 
        EndIf 
        stime = now()
        Rem [点击物品]
        MoveTo BuyItem_PosX(I) BuyItem_PosY(I)
        Delay 100
        LeftClick 1
        Delay 200
        IfColor 569 253 cee3de 1
            IfColor 570 253 cee3de 1
                If DateDiff("s",stime,now()) < 2
                    Goto [点击物品]
                Else 
                    Goto [买卖界面]
                EndIf 
            EndIf 
        EndIf 
        MoveTo 469 289
        Delay 200
        For BuyItem_Amount(I)
            IfColor 277 79 6b869c 1
                LeftClick 1
                Delay 100
            Else 
                Rem [买满]
                MoveTo 500 110
                Delay 100
                LeftClick 1
                Delay 200
                IfColor 277 79 6b869c 1
                    Full =1
                    Saled = 0
                    Goto [买够退出]
                Else 
                    Goto [买满]
                EndIf 
            EndIf 
        EndFor 
        Delay 200
        I = I +1
    EndFor 
    Delay 200
    Rem [买够退出]
    If Ptype = 2
        Gosub [购买取消]
    EndIf 
    Delay 100
    KeyPress 27 3
    Delay 300
    Gosub [制作物品]
    Delay 200
    If Mtype =3
        Gosub [拣物]
    EndIf 
    Goto [开始工作]
Return [工作]
Sub [数据预处理]
    StoreList = "" : ItemList = "" :ScriptList =""