Color_shang = Plugin.Bkgnd.GetPixelColor(Hwnd, 942, 110)
    If Color_shang = "17E442" Then
        //进入跑商界面
        Call Plugin.Bkgnd.LeftClick(Hwnd, 942, 110)
        Delay 2000
        //判断在哪交易,然后继续跑商
        color_a = Plugin.Bkgnd.GetPixelColor(Hwnd,shanga_x+1,shanga_y+13)
        If color_a = "13ADFD" Then 
            Call 商队交易(shanga_x+1,shanga_y+13,Buy_a)
            Delay 200
            Call Plugin.Bkgnd.LeftClick(Hwnd,shangb_x,shangb_y)
            Delay 500
            Call Plugin.Bkgnd.LeftClick(Hwnd, 503, 410)
            Delay 500
        Else 
            color_b = Plugin.Bkgnd.GetPixelColor(Hwnd, shangb_x + 1, shangb_y + 13)
            If color_b = "13ADFD" Then 
                Call 商队交易(shangb_x + 1, shangb_y + 13,Buy_b)
                Delay 200
                Call Plugin.Bkgnd.LeftClick(Hwnd,shanga_x,shanga_y)
                Delay 500
                Call Plugin.Bkgnd.LeftClick(Hwnd, 503, 410)
                Delay 500
            End If
        End If
        //为最后一次跑商计算起始时间,并设定间隔时间,间隔时间根据各自情况设定
        h = Hour(Time)
        m = Minute(time)
        TimeA = h * 60 + m
        delaytime = 25

    End If
End Sub
Sub 竞技场()
    If jccount > 0 Then 
    	Delay 500
        Call Plugin.Bkgnd.LeftClick(Hwnd,890,38)
        Delay 1000
        Call Plugin.Bkgnd.LeftClick(Hwnd,465,173)
        Delay 500
        //随机指定一个位子
        post = Int(10 * Rnd )
        postx = 798
        posty = 234 + 27 * post
        //攻击
        Call Plugin.Bkgnd.LeftClick(Hwnd,postx,posty)
        Delay 2000
        //进入后,点 结果
        Call Plugin.Bkgnd.LeftClick(Hwnd,967,39)
        Delay 500
        //关闭
        Call Plugin.Bkgnd.LeftClick(Hwnd,691,429)
        Delay 1000
        //如果没有次数了,则按回车,补充一下关闭
        Call Plugin.Bkgnd.KeyPress(Hwnd,13)
        Delay 500
        jccount = jcount - 1
	
    End If
End Sub
Sub 进入城池()
    Delay 200
    Call Plugin.Bkgnd.LeftClick(Hwnd,902,62)
    Delay 2000
End Sub
Sub 开始训练()
    If xlms=1 Then
        Call Plugin.Bkgnd.LeftClick(Hwnd,640,317)
        Delay 500
    End If
    If xlms=2 Then
        Call Plugin.Bkgnd.LeftClick(Hwnd,640,337)
        Delay 500
    End If
    If xlms=3 Then
        Call Plugin.Bkgnd.LeftClick(Hwnd,640,357)
        Delay 500
    End If
    Call Plugin.Bkgnd.LeftClick(Hwnd,853,421)
    Delay 500
End Sub
Sub 商队A()
    Select Case shangA
    Case "1"
        //晋阳
        shanga_x=511
        shanga_y=317
        
    Case "2"
        //灵寿
        shanga_x=591
        shanga_y=259
    Case "3"
        //新郑
        shanga_x=420
        shanga_y=469
    Case "4"
        //商丘
        shanga_x=505
        shanga_y=442