Example #1
0
        protected override void Process()
        {
            var screenX          = Screen.PrimaryScreen.WorkingArea.Width;
            var screenY          = Screen.PrimaryScreen.WorkingArea.Height;
            var fishRodShowDelay = 2000;
            var throwFishRodKey  = Keys.OemMinus;
            var addBaitKey       = Keys.Oemplus;
            var waterKey         = Keys.OemQuestion;
            var installRod       = Keys.OemBackslash;
            var waterHits        = 10;
            var itemKeyList      = new List <Keys> {
                Keys.OemCloseBrackets, Keys.OemOpenBrackets, Keys.OemSemicolon, Keys.Oemcomma, Keys.OemQuotes, Keys.OemPeriod
            };

            var pickupDelay = 1000;

            var fishRodSimulity       = 0.8;
            var fishRodColorInfoHList = new List <double> {
                10, 20, 30, 40
            };
            var fishRodColorInfoSList = new List <double> {
                65, 75, 85, 95
            };
            var fishRodColorInfoVList = new List <double> {
                16, 22, 28, 34
            };

            var leafColorInfoList = GetLeafColorInfoList(fishRodColorInfoHList, fishRodColorInfoSList, fishRodColorInfoVList);

            var baitBounds = new List <int> {
                screenX / 5, screenY / 5, screenX / 5 * 4, screenY / 4 * 3
            };
            var isBaitOffset = new List <int> {
                120, 30, 0, 60
            };
            var timeOut         = 20000;
            var isBaitColorInfo = new List <string> {
                "FFFBFF", "0.9", "5"
            };

            var fishRodlen = leafColorInfoList.Count;


            var lastTime = DateTime.Now;


            //进入魔兽世界
            //_dmSoft.Delay(5000);
            //_dmSoft.KeyPress((int)Keys.Enter);
            //_dmSoft.Delay(20000);
            //_dmSoft.KeyPress((int)Keys.Escape);
            //_dmSoft.Delay(1000);


            //WheelUp(40);
            AddRod(installRod);
            while (true)
            {
                if (lastTime.AddMinutes(5) <= DateTime.Now)
                {
                    UserWater(waterKey, waterHits);
                    DeleteItem(itemKeyList);
                    lastTime = DateTime.Now;
                }
                AddBait(addBaitKey);
                while (true)
                {
                    //抛竿
                    ThrowFishRod(throwFishRodKey);
                    //抛竿一段时间才能完全显示位置
                    _dmSoft.Delay(fishRodShowDelay);
                    var tmpBaitPosition = new Point();
                    var stack           = new Stack <Point>();
                    for (int fishRodIndex = 0; fishRodIndex < fishRodlen; fishRodIndex++)
                    {
                        var tmpBaitColor = leafColorInfoList[fishRodIndex];
                        tmpBaitPosition = FindBaitPosition(tmpBaitColor, fishRodSimulity, baitBounds);
                        if (tmpBaitPosition.X >= 0 && tmpBaitPosition.Y >= 0)
                        {
                            //移动到鱼饵处
                            _dmSoft.MoveTo(tmpBaitPosition.X, tmpBaitPosition.Y);
                            stack.Push(tmpBaitPosition);
                            if (_dmSoft.GetCursorShape() == "61922884")
                            {
                                break;
                            }
                        }
                    }
                    if (stack.Count > 1)
                    {
                        stack.Pop();
                        tmpBaitPosition = stack.Pop();
                        _dmSoft.MoveTo(tmpBaitPosition.X, tmpBaitPosition.Y);
                    }

                    if (IsBait(isBaitColorInfo, tmpBaitPosition, isBaitOffset, timeOut))
                    {
                        //拉竿
                        PullFishRod();
                        _dmSoft.Delay(pickupDelay);
                        //取鱼
                        PickupFish();
                    }
                }
            }
        }