Esempio n. 1
0
        private void AttackThread()
        {
            try
            {
                f = new Func();
                f.SetDMPath(PicPath);
                Thread.Sleep(500);
                int pid = 0, handle = 0;
                if (this.txtPID.Text.Trim() != "")
                {
                    pid = int.Parse(txtPID.Text.Trim());
                }
                if (this.txtHandle.Text.Trim() != "")
                {
                    handle = int.Parse(txtHandle.Text.Trim());
                }
                f.BindDM(ClassName, pid, handle);

                Attack();
            }
            catch (Exception ex)
            {
                this.Invoke(delegateShowMsg, new object[] { ex.Message });
            }
        }
Esempio n. 2
0
 private void Fishing()
 {
     try
     {
         f = new Func();
         f.SetDMPath(PicPath);
         Thread.Sleep(500);
         int pid = 0, handle = 0;
         if (this.txtPID.Text.Trim() != "")
         {
             pid = int.Parse(txtPID.Text.Trim());
         }
         if (this.txtHandle.Text.Trim() != "")
         {
             handle = int.Parse(txtHandle.Text.Trim());
         }
         f.BindDM(ClassName, pid, handle);
         for (int i = 0; i < 500; i++)
         {
             Thread.Sleep(1000);
             f.dm.MoveTo(399, 260);
             Thread.Sleep(1000);
             f.dm.LeftClick();
             Thread.Sleep(13000);
             f.dm.KeyDown(18);
             Thread.Sleep(1000);
             f.dm.KeyPress(32);
             Thread.Sleep(1000);
             f.dm.KeyUp(18);
         }
     }
     catch (Exception ex)
     {
         this.Invoke(delegateShowMsg, new object[] { ex.Message });
     }
 }
Esempio n. 3
0
 public void RunThread()
 {
     try
     {
         f = new Func();
         f.SetDMPath(PicPath);
         Thread.Sleep(500);
         int pid = 0, handle = 0;
         if (this.txtPID.Text.Trim() != "")
         {
             pid = int.Parse(txtPID.Text.Trim());
         }
         if (this.txtHandle.Text.Trim() != "")
         {
             handle = int.Parse(txtHandle.Text.Trim());
         }
         f.BindDM(ClassName, pid, handle);
         string currentDT = f.GetCurrentDT();
         if (currentDT == "")
         {
             throw new Exception("获取当前地图失败");
         }
         string dtTo = this.Invoke(new GetControlText(delegate(Control c) { return c.Text; }), new object[] { this.cbxDT }).ToString().Trim();
         string npc = this.Invoke(new GetControlText(delegate(Control c) { return c.Text; }), new object[] { this.cbxNPC }).ToString().Trim();
         string strIndex = this.Invoke(new GetControlText(delegate(Control c) { return c.Text; }), new object[] { this.cbxSDIndex }).ToString();
         if (currentDT != dtTo)
         {
             f.WayfindingEx(currentDT, dtTo, 0.9);
         }
         Thread.Sleep(500);
         f.CloseSubWindows();
         if (npc != "")
         {
             Thread.Sleep(500);
             string xl = npc.Replace(PicPath, "").Replace(dtTo,"自动寻路").Replace("NPC", dtTo);
             f.Wayfinding(xl, npc, 0.9, 2);
             if (strIndex != "")
             {
                 int sdIndex = int.Parse(strIndex);
                 int x = 0, y = 0;
                 f.GetPicCenter(npc, 0.9, 2, 0, out x, out y);
                 y = y + 81 + 22 * (sdIndex - 1);//NPC名字坐标和第一个帮会列表距离88像素
                 Thread.Sleep(500);
                 f.dm.MoveTo(x, y);
                 Thread.Sleep(1000);
                 f.dm.LeftClick();
                 Thread.Sleep(10000);
                 f.UnBindDM();
                 this.Invoke(DelegateSetControl, new object[] { gbSetting, true });
                 this.Invoke(DelegateSetControl, new object[] { gbStart, true });
             }
         }
     }
     catch (Exception ex)
     {
         this.Invoke(delegateShowMsg, new object[] { ex.Message });
         if (f != null)
         {
             f.UnBindDM();
             this.Invoke(DelegateSetControl, new object[] { gbSetting, true });
             this.Invoke(DelegateSetControl, new object[] { gbStart, true });
         }
     }
 }
Esempio n. 4
0
        public void TestThread()
        {
            try
            {
                f = new Func();
                f.SetDMPath(PicPath);
                Thread.Sleep(500);
                int pid = 0, handle = 0;
                if (this.txtPID.Text.Trim() != "")
                {
                    pid = int.Parse(txtPID.Text.Trim());
                }
                if (this.txtHandle.Text.Trim() != "")
                {
                    handle = int.Parse(txtHandle.Text.Trim());
                }
                f.BindDM(ClassName, pid, handle);
                f.Test();
                f.UnBindDM();
                this.Invoke(DelegateSetControl, new object[] { gbSetting, true });
                this.Invoke(DelegateSetControl, new object[] { gbStart, true });

            }
            catch (Exception ex)
            {
                this.Invoke(delegateShowMsg, new object[] { ex.Message });
                if (f != null)
                {
                    f.UnBindDM();
                    this.Invoke(DelegateSetControl, new object[] { gbSetting, true });
                    this.Invoke(DelegateSetControl, new object[] { gbStart, true });
                }
            }
        }
Esempio n. 5
0
        public void KJThread()
        {
            try
            {
                f = new Func();
                f.SetDMPath(PicPath);
                Thread.Sleep(500);
                int pid = 0, handle = 0;
                if (this.txtPID.Text.Trim() != "")
                {
                    pid = int.Parse(txtPID.Text.Trim());
                }
                if (this.txtHandle.Text.Trim() != "")
                {
                    handle = int.Parse(txtHandle.Text.Trim());
                }
                f.BindDM(ClassName, pid, handle);
                string currentDT = f.GetCurrentDT();
                if (currentDT != "京师")
                {
                    throw new Exception("当前不在京师");
                }

                f.KJ();
                f.UnBindDM();
                this.Invoke(DelegateSetControl, new object[] { gbSetting, true });
                this.Invoke(DelegateSetControl, new object[] { gbStart, true });
                return;

            }
            catch (Exception ex)
            {
                this.Invoke(delegateShowMsg, new object[] { ex.Message });
                if (f != null)
                {
                    f.UnBindDM();
                    this.Invoke(DelegateSetControl, new object[] { gbSetting, true });
                    this.Invoke(DelegateSetControl, new object[] { gbStart, true });
                }
            }
        }
Esempio n. 6
0
        public void DoWork(object obj)
        {
            try
            {
                ThreadParam p = (ThreadParam)obj;

                string toPath = p.toPath;
                string xlPath = p.xlPath;
                string xlNpcPath = p.xlNpcPath;
                int sdIndex = p.sdIndex;
                f = new Func();
                f.FuncEventHandler += new EventHandler(f_FuncEventHandler);
                f.SetDMPath(PicPath);
                Thread.Sleep(500);
                int pid = 0, handle = 0;
                if (this.txtPID.Text.Trim() != "")
                {
                    pid = int.Parse(txtPID.Text.Trim());
                }
                if (this.txtHandle.Text.Trim() != "")
                {
                    handle = int.Parse(txtHandle.Text.Trim());
                }
                f.BindDM(ClassName, pid, handle);
                Thread.Sleep(1000);
                this.Invoke(DelegateSetControl, new object[] { gbSetting, false });
                this.Invoke(DelegateSetControl, new object[] { gbStart, false });
                if (cbZLDW.Checked == false)
                {
                    for (int i = 0; i < 30; i++)
                    {

                        f.DoZhuanliMission(toPath, xlPath, xlNpcPath, sdIndex);
                        //f.ZhuanliMission();
                        Thread.Sleep(10000);

                    }
                }
                else
                {
                    for (int i = 0; i < 20; i++)
                    {
                        f.DoZhuanliMissionEx();
                        Thread.Sleep(2000);
                    }
                }
            }
            catch (Exception ex)
            {
                this.Invoke(delegateShowMsg, new object[] { ex.Message });
            }
        }
Esempio n. 7
0
        void XYThread()
        {
            try
            {
                f = new Func();
                f.SetDMPath(PicPath);
                Thread.Sleep(500);
                int pid = 0, handle = 0;
                // int plantIndex=this.Invoke(delegate(){return int.Parse(this.cbxPlantIndex.Text.Trim());});
                int xyIndex = int.Parse(this.Invoke(new GetControlText(delegate(Control c) { return c.Text; }), new object[] { this.cbxXYIndex }).ToString());

                if (this.txtPID.Text.Trim() != "")
                {
                    pid = int.Parse(txtPID.Text.Trim());
                }
                if (this.txtHandle.Text.Trim() != "")
                {
                    handle = int.Parse(txtHandle.Text.Trim());
                }
                f.BindDM(ClassName, pid, handle);
                Thread.Sleep(3000);
                string xlPath, npcPath;
                f.ReadyToXY(out xlPath,out npcPath);
                while (true)
                {
                    f.XY(xyIndex, xlPath,npcPath);
                }
            }
            catch (Exception ex)
            {
                this.Invoke(delegateShowMsg, new object[] { ex.Message });
            }
        }
Esempio n. 8
0
        private void PSThread(object obj)
        {
            try
            {
                ThreadParam p = obj as ThreadParam;

                string toPath = p.toPath;
                string xlPath = p.xlPath;
                string xlNpcPath = p.xlNpcPath;
                int sdIndex = p.sdIndex;
                f = new Func();
                f.SetDMPath(PicPath);
                Thread.Sleep(500);
                int pid = 0, handle = 0;
                if (this.txtPID.Text.Trim() != "")
                {
                    pid = int.Parse(txtPID.Text.Trim());
                }
                if (this.txtHandle.Text.Trim() != "")
                {
                    handle = int.Parse(txtHandle.Text.Trim());
                }
                f.BindDM(ClassName, pid, handle);
                for (int i = 0; i < 9; i++)
                {
                    f.DoBusiness(txtDtStr.Text.Trim(), toPath,xlPath,xlNpcPath,sdIndex);
                }
                f.UnBindDM();
                this.Invoke(DelegateSetControl, new object[] { gbSetting, false });
                this.Invoke(DelegateSetControl, new object[] { gbStart, false });
                return;
            }
            catch (Exception ex)
            {
                this.Invoke(delegateShowMsg, new object[] { ex.Message });
            }
        }
Esempio n. 9
0
        private void PlantTreeThread()
        {
            try
            {
                f = new Func();
                f.SetDMPath(PicPath);
                Thread.Sleep(500);
                int pid = 0, handle = 0;
                // int plantIndex=this.Invoke(delegate(){return int.Parse(this.cbxPlantIndex.Text.Trim());});
                int plantIndex = int.Parse(this.Invoke(new GetControlText(delegate(Control c) { return c.Text; }), new object[] { this.cbxPlantIndex }).ToString());

                if (this.txtPID.Text.Trim() != "")
                {
                    pid = int.Parse(txtPID.Text.Trim());
                }
                if (this.txtHandle.Text.Trim() != "")
                {
                    handle = int.Parse(txtHandle.Text.Trim());
                }
                f.BindDM(ClassName, pid, handle);
                Thread.Sleep(3000);
                int x = 0, y = 0;
                f.ReadyToPlantTree(ref x, ref y);//调整稻草人窗口到,x,y
                while (true)
                {
                    f.PlantTree(plantIndex, x, y);
                }
            }
            catch (Exception ex)
            {
                this.Invoke(delegateShowMsg, new object[] { ex.Message });
            }
        }