Пример #1
0
        private TaskResult RunStep5(TaskContext arg)
        {
            Role role = (Role)Role;

            Delegater.WaitTrue(() => role.OpenTeshushijian(),
                               () => Dm.IsExistPic(370, 81, 595, 139, @"\bmp\特殊事件3.bmp"),
                               () => Dm.Delay(1000));
            if (Dm.FindPicAndClick(114, 142, 827, 489, @"\bmp\恭贺奖励.bmp", 30, 0))
            {
                Dm.Delay(1000);
                int count = 20;
                while (true)
                {
                    while (Dm.IsExistPic(339, 76, 577, 146, @"\bmp\恭贺.bmp") && count != 0)
                    {
                        Dm.MoveToClick(478, 477);
                        Dm.Delay(300);
                        count--;
                    }
                    Dm.Delay(1000);
                    if (!Dm.IsExistPic(339, 76, 577, 146, @"\bmp\恭贺.bmp"))
                    {
                        break;
                    }
                    if (count == 0)
                    {
                        break;
                    }
                }
            }
            role.CloseWindow();
            return(TaskResult.Success);
        }
Пример #2
0
        private TaskResult RunStep6(TaskContext arg)
        {
            Role role = (Role)Role;

            if (Dm.GetColorNum(523, 379, 602, 450, "dc3146-303030", 0.9) > 50)
            {
                Delegater.WaitTrue(() => Dm.MoveToClick(30, 32),
                                   () => role.IsExistWindowMenu("设置"),
                                   () => Dm.Delay(1000));
                Delegater.WaitTrue(() => role.OpenWindowMenu("设置"),
                                   () => Dm.IsExistPic(507, 99, 583, 163, @"\bmp\礼包.bmp"),
                                   () => Dm.Delay(1000));
                Delegater.WaitTrue(() =>
                {
                    Dm.FindPicAndClick(507, 99, 583, 163, @"\bmp\礼包.bmp");
                    Dm.Delay(1000);
                    if (Dm.FindPicAndClick(678, 241, 811, 344, @"\bmp\宝箱.bmp"))
                    {
                        Dm.Delay(2000);
                    }
                    else
                    {
                        return(true);
                    }
                    return(false);
                }, () => Dm.Delay(1000), 10);
            }

            role.CloseWindow();
            return(TaskResult.Success);
        }
Пример #3
0
        private TaskResult RunStep7(TaskContext arg)
        {
            Role role = (Role)Role;

            role.GoToMap("副本");
            int count = 0;

            while (true)
            {
                if (Dm.FindPicAndClick(116, 72, 936, 351, @"\bmp\战斗.bmp") ||
                    Dm.FindMultiColorAndClick(122, 58, 318, 196, "ffb40b", "19|-17|ffb814,35|0|ffb40b-202020,34|-34|fff303-202020,25|-25|ffdd12,26|-4|ff8804,8|-7|ff9907,28|-29|ffe009", 17, 59))
                {
                    count = 0;
                    if (role.GoToFighting() == false)
                    {
                        Dm.DebugPrint("装备不够好或等级不够,提升实力再来!");
                        break;
                    }
                }
                else
                {
                    count++;
                    if (count > 5)
                    {
                        break;
                    }
                    Dm.Swipe(670, 427, 93, 427); //向右划
                    Dm.Delay(1000);
                }
                Dm.Delay(2000);
            }
            role.CloseWindow();
            return(TaskResult.Success);
        }
Пример #4
0
        private TaskResult RunStep4(TaskContext context)
        {
            Role role = (Role)context.Role;

            Delegater.WaitTrue(() => Dm.FindPicAndClick(856, 448, 958, 536, @"\bmp\菜单未打开.bmp"),
                               () => Dm.IsExistPic(856, 448, 958, 536, @"\bmp\菜单打开.bmp"), () => Dm.Delay(1000));
            Delegater.WaitTrue(() => role.OpenMenu("装备"),
                               () => role.OpenWindowMenu("商店"), () => Dm.Delay(1000));
            Delegater.WaitTrue(() =>
            {
                Dm.FindStrAndClick(718, 448, 857, 502, "刷新", "86.17.70-5.5.25");
                if (Dm.IsExistPic(283, 192, 668, 411, @"\bmp\金币秒CD.bmp"))
                {
                    Dm.FindPicAndClick(283, 192, 668, 411, @"\bmp\商店取消.bmp");
                    return(true);
                }
                if (Dm.IsExistPic(283, 192, 668, 411, @"\bmp\适合您的装备.bmp"))
                {
                    Dm.FindPicAndClick(283, 192, 668, 411, @"\bmp\商店确定.bmp");
                }
                if (Dm.IsExistPic(283, 192, 668, 411, @"\bmp\稀有物品.bmp"))
                {
                    Dm.FindPicAndClick(283, 192, 668, 411, @"\bmp\商店确定.bmp");
                }
                return(Dm.IsExistStr(718, 448, 857, 502, "清除", "86.17.70-5.5.25"));
            }, () => Dm.Delay(500));
            role.CloseWindow();
            return(TaskResult.Finished);
        }
Пример #5
0
        int[] needs = new int[] { 0, 0, 0, 0, 0, 0 };//枪甲符马袍旗

        private void GetEquipmentProperty(int x, int y, int i)
        {
            Dm.Delay(1000);
            Dm.MoveToClick(x, y);
            Dm.Delay(1000);
            int count = Dm.GetColorNum(205, 448, 264, 499, "201a19-202020", 0.9);

            if (Dm.GetColorNum(584, 76, 633, 114, "edd1a9 -202020|a49074-202020", 0.9) > 100)
            {
                if (count > 2000)
                {
                    needs[i] += 1;
                    return;
                }
                else
                {
                    Dm.MoveToClick(234, 469);
                    Dm.Delay(1000);
                    Dm.MoveToClick(x, y);
                    Dm.Delay(1000);
                }
            }

            if (IsOptimalColor() == false)
            {
                if (count > 2000)
                {
                    needs[i] += 1;
                }
                else
                {
                    Dm.MoveToClick(234, 469);
                    Dm.Delay(1000);
                    if (IsOptimalColor() == false)
                    {
                        needs[i] += 1;
                    }
                    else
                    {
                        Delegater.WaitTrue(() =>
                        {
                            if (Dm.FindPicAndClick(658, 437, 782, 491, @"\bmp\穿上装备.bmp", 0, 0, 0.7))
                            {
                                Dm.Delay(1000);
                                if (Dm.IsExistPic(537, 194, 669, 277, @"\bmp\兵力损失.bmp"))
                                {
                                    Dm.MoveToClick(415, 359);
                                }
                                return(true);
                            }
                            return(false);
                        }, () => Dm.Delay(1000));
                    }
                }
            }
        }
Пример #6
0
 public bool ClickXiaoQian()
 {
     return(Delegater.WaitTrue(() => {
         if (!Dm.FindPicAndClick(56, 240, 276, 469, @"\bmp\小倩.bmp"))
         {
             return true;
         }
         Dm.Delay(1000);
         return false;
     }, () => Dm.Delay(1000)));
 }
Пример #7
0
        private TaskResult RunStep4(TaskContext arg)
        {
            Role role = (Role)Role;

            role.OpenMenu("资源");
            Delegater.WaitTrue(() => role.OpenWindowMenu("祭祀"),
                               () => role.IsExistWindowMenu("祭祀"),
                               () => Dm.Delay(1000));

            Dm.FindPicAndClick(699, 63, 868, 118, @"\bmp\祭祀十次.bmp");
            Dm.Delay(1000);
            Delegater.WaitTrue(() =>
            {
                if (Dm.GetColorNum(738, 500, 761, 522, "79a03b-303030", 1.0) > 20)
                {
                    Dm.MoveToClick(783, 512);
                    Dm.Delay(1000);
                    return(false);
                }
                return(true);
            }, () => Dm.Delay(50), 10);
            Dm.UseDict(1);

            Delegater.WaitTrue(() =>
            {
                if (Dm.IsExistPic(197, 59, 288, 102, @"\bmp\祭祀0.bmp", 0.7))
                {
                    if (Dm.GetColorNum(204, 61, 278, 96, "C59E00-3A2E00", 0.9) < 75)
                    {
                        return(true);
                    }
                }
                bool result = Dm.IsChangeColorNumEx(204, 61, 278, 96, "C59E00-3A2E00", () =>
                {
                    Dm.MoveToClick(322, 451); //祭祀木材
                    //Dm.MoveToClick(162, 454);//祭祀银子
                    Dm.Delay(500);
                });
                if (!result)
                {
                    Dm.DebugPrint("操作完颜色结果不变,可能已经完成!~");
                    if (Dm.FindPicAndClick(475, 315, 628, 415, @"\bmp\取消.bmp"))
                    {
                        Dm.Delay(1000);
                    }
                    return(true);
                }
                return(false);
            }, () => Dm.Delay(50), 40);
            Dm.UseDict(0);
            role.CloseWindow();
            return(TaskResult.Success);
        }
Пример #8
0
        private TaskResult RunStep3(TaskContext arg)
        {
            Role role = (Role)Role;

            role.OpenRemind();
            if (Dm.FindPicAndClick(102, 132, 836, 494, @"\bmp\领取俸禄.bmp"))
            {
                Dm.Delay(1000);
                Dm.MoveToClick(657, 476);
                Dm.Delay(2000);
            }
            role.CloseWindow();
            return(TaskResult.Success);
        }
Пример #9
0
        private TaskResult RunStep1(TaskContext context)
        {
            Role     role = (Role)context.Role;
            DmPlugin dm   = role.Window.Dm;

            role.GoToMap("世界");
            role.CloseWindow();
            dm.Delay(1000);
            if (Dm.IsExistPic(862, 454, 961, 537, @"\bmp\菜单打开.bmp"))
            {
                Delegater.WaitTrue(() => Dm.FindPicAndClick(862, 454, 961, 537, @"\bmp\菜单打开.bmp"),
                                   () => Dm.IsExistPic(862, 454, 961, 537, @"\bmp\菜单未打开.bmp"),
                                   () => Dm.Delay(1000), 2000);
            }
            role.OpenMap();

            int intX, intY;

            while (true)
            {
                dm.FindStr(75, 246, 227, 296, "军资奖励", "44.34.64-10.10.25", 0.9, out intX, out intY);
                if (intX > 0 && intY > 0)
                {
                    role.OutSubMessage("领取军资...");
                    dm.MoveToClick(156, 420);
                    dm.Delay(50);
                    if (dm.GetColorNum(157, 242, 227, 293, "f60000-101010", 0.9) > 5)
                    {
                        role.OutSubMessage("军资已经领取完成,正在冷却!");
                        break;
                    }
                    dm.Delay(300);
                }
                else
                {
                    role.OutSubMessage("找不到军资奖励");
                    break;
                }
            }

            role.CloseMap();

            return(TaskResult.Success);
        }
Пример #10
0
        private TaskResult RunStep2(TaskContext arg)
        {
            Role role = (Role)Role;

            role.OpenRemind();
            if (Dm.FindPicAndClick(98, 133, 868, 516, @"\bmp\每日登陆.bmp"))
            {
                Dm.Delay(1000);
                Dm.MoveToClick(513, 402);
                Dm.Delay(1000);
            }
            else
            {
                role.CloseWindow();
                return(TaskResult.Success);
            }
            role.CloseWindow();
            return(RunStep2(arg));
        }
Пример #11
0
        private TaskResult RunStep7(TaskContext arg)
        {
            Role role = (Role)Role;

            Dm.UseDict(0);
            Delegater.WaitTrue(() => role.OpenMenu("资源"), () => role.IsExistWindowMenu("集市"), () => Dm.Delay(1000));
            Delegater.WaitTrue(() => role.OpenWindowMenu("集市"),
                               () => Dm.Delay(1000));

            Dm.UseDict(1);
            Dm.Delay(1000);
            Delegater.WaitTrue(() =>
            {
                bool result = Dm.IsChangeColorNumEx(170, 72, 237, 107, "49A031-152F0F", () =>
                {
                    Dm.StartWatch();
                    var rt1 = GetResourceType(160, 129, 346, 377);
                    var rc1 = GetColor(176, 119, 328, 178);
                    Dm.DebugPrint("第一个资源:" + rt1.ToString() + ",颜色:" + rc1.ToString());

                    var rt2 = GetResourceType(395, 132, 573, 373);
                    var rc2 = GetColor(409, 129, 566, 175);
                    Dm.DebugPrint("第二个资源:" + rt2.ToString() + ",颜色:" + rc2.ToString());

                    var rt3 = GetResourceType(630, 131, 810, 377);
                    var rc3 = GetColor(633, 124, 804, 180);
                    Dm.DebugPrint("第三个资源:" + rt3.ToString() + ",颜色:" + rc3.ToString());
                    Dm.StopWatch();
                    Dm.StartWatch();
                    List <Resource> list = new List <Resource>()
                    {
                        new Resource()
                        {
                            Pos = 1, Type = rt1, Color = rc1, Buypos = new Tuple <int, int>(253, 353)
                        },
                        new Resource()
                        {
                            Pos = 2, Type = rt2, Color = rc2, Buypos = new Tuple <int, int>(495, 353)
                        },
                        new Resource()
                        {
                            Pos = 3, Type = rt3, Color = rc3, Buypos = new Tuple <int, int>(727, 353)
                        }
                    };
                    var rlist = list.OrderByDescending(q => q.Type).ThenByDescending(x => x.Color).ToList();
                    Dm.DebugPrint(string.Format("购买位置:{0},资源类型:{1},资源颜色:{2}", rlist.First().Pos, rlist.First().Type.ToString(), rlist.First().Color.ToString()));
                    Dm.MoveToClick(rlist.First().Buypos.Item1, rlist.First().Buypos.Item2);
                    Dm.StopWatch();
                    Dm.Delay(1000);
                });
                if (!result)
                {
                    Dm.DebugPrint("操作完颜色结果不变,可能已经完成!~");
                    if (Dm.IsExistPic(171, 71, 247, 105, @"\bmp\集市0.bmp"))
                    {
                        return(true);
                    }
                }
                if (Dm.FindPicAndClick(475, 315, 628, 415, @"\bmp\取消.bmp"))
                {
                    Dm.Delay(1000);
                }
                return(false);
            }, () => Dm.Delay(50), 40);
            Dm.UseDict(0);
            role.CloseWindow();
            return(TaskResult.Success);
        }
Пример #12
0
        private TaskResult RunStep6(TaskContext arg)
        {
            Role role = (Role)Role;

            taozhuangList.Clear();
            role.CloseWindow();
            #region 数字识别等级
            //Dm.UseDict(1);
            // int level = Dm.GetOcrNumber(101, 31, 159, 59, "40.30.88-20.30.30");
            //  Dm.UseDict(0);
            int level = role.Level;
            Dm.DebugPrint("人物等级:" + level);
            if (level >= 16 && level < 28) //蓝
            {
                MaxColor = Color.蓝;
            }
            else if (level >= 28 && level < 36) //绿
            {
                MaxColor = Color.绿;
            }
            else if (level >= 36 && level < 53)//黄
            {
                MaxColor = Color.黄;
            }
            else if (level >= 53 && level < 70)//红
            {
                MaxColor = Color.红;
            }
            else if (level >= 70)//紫
            {
                MaxColor = Color.紫;
            }
            else
            {
                Dm.DebugPrint("人物等级无法识别!" + level);
                MaxColor = Color.无法识别;
                role.CloseWindow();
                return(TaskResult.Finished);
            }
            #endregion
            for (int i = 0; i < 6; i++)
            {
                needs[i] = 0;
            }
            int count = 0;
            //获取所需装备件数
            if (MaxColor == Color.紫)
            {
                Delegater.WaitTrue(() => role.OpenMenu("武将"), () => role.IsExistWindowMenu("将领"), () => Dm.Delay(1000));
                Delegater.WaitTrue(() => role.OpenWindowMenu("将领"),
                                   () => Dm.Delay(1000));
                GetSelectedGeneralEquipment(86, 68, 177, 149, 152, 107);
                GetSelectedGeneralEquipment(86, 156, 173, 241, 154, 194);
                GetSelectedGeneralEquipment(84, 244, 176, 326, 153, 286);
                GetSelectedGeneralEquipment(83, 332, 174, 417, 153, 375);

                GetSelectedGeneralEquipment(86, 68, 177, 149, 152, 107);
                GetSelectedGeneralEquipment(86, 156, 173, 241, 154, 194);
                GetSelectedGeneralEquipment(84, 244, 176, 326, 153, 286);
                GetSelectedGeneralEquipment(83, 332, 174, 417, 153, 375);
                Dm.DebugPrint("需要装备:" + needs[0] + " " + needs[1] + " " + needs[2] + " " + needs[3] + " " + needs[4] + " " + needs[5]);
                string temp = "";

                foreach (var item in taozhuangList)
                {
                    temp = temp + item + " ";
                    if (item.Contains("极"))
                    {
                        role.CloseWindow();
                        return(TaskResult.Finished);
                    }
                    if (item.Contains("真"))
                    {
                        count = count + 2;
                        continue;
                    }
                    if (item.Contains("套装"))
                    {
                        count = count + 1;
                    }
                }
                if (count >= 10)
                {
                    role.CloseWindow();
                    return(TaskResult.Finished);
                }
                Debug.WriteLine("已经拥有套装:" + temp);
                role.CloseWindow();
            }
            Delegater.WaitTrue(() => role.OpenMenu("装备"), () => role.IsExistWindowMenu("商店"), () => Dm.Delay(1000));
            Delegater.WaitTrue(() => role.OpenWindowMenu("商店"),
                               () => Dm.Delay(1000));

            Dictionary <int, int[]> dict = new Dictionary <int, int[]>();
            dict.Add(1, new int[] { 115, 134, 217, 174, 104, 272, 212, 312, 165, 369, 0, 0 });
            dict.Add(2, new int[] { 235, 135, 350, 173, 233, 271, 344, 311, 296, 369, 0, 0 });
            dict.Add(3, new int[] { 365, 135, 475, 174, 361, 273, 464, 313, 418, 369, 0, 0 });
            dict.Add(4, new int[] { 488, 133, 604, 176, 486, 276, 581, 311, 551, 374, 0, 0 });
            dict.Add(5, new int[] { 614, 131, 732, 175, 614, 270, 721, 314, 675, 369, 0, 0 });
            dict.Add(6, new int[] { 740, 129, 857, 178, 744, 272, 843, 312, 802, 372, 0, 0 });
            Delegater.WaitTrue(() =>
            {
                Dm.FindStrAndClick(718, 448, 857, 502, "刷新", "86.17.70-5.5.25");
                if (Dm.IsExistPic(283, 192, 668, 411, @"\bmp\金币秒CD.bmp", 0.8, false))
                {
                    Dm.FindPicAndClick(283, 192, 668, 411, @"\bmp\商店取消.bmp");
                    return(true);
                }
                //出现适合装备
                if (Dm.IsExistPic(283, 192, 668, 411, @"\bmp\适合您的装备.bmp", 0.8, false))
                {
                    Dm.FindPicAndClick(283, 192, 668, 411, @"\bmp\商店取消.bmp");
                    List <Goods> list = new List <Goods>();
                    // Dm.StartWatch();
                    for (int i = 1; i <= 6; i++)
                    {
                        var color     = GetColor(dict[i][0], dict[i][1], dict[i][2], dict[i][3]);
                        var starLevel = Dm.GetPicCount(dict[i][4], dict[i][5], dict[i][6], dict[i][7], @"\bmp\星星1.bmp");
                        list.Add(new Goods()
                        {
                            Pos = i, StarLevel = starLevel, Color = color, Buypos = new Tuple <int, int>(dict[i][8], dict[i][9])
                        });
                        //Dm.DebugPrint(string.Format("位置{0}:星级【{1}】,颜色【{2}】", i, starLevel, color));
                    }
                    // Dm.StopWatch();
                    List <Goods> buyList = null;
                    if (list.Max(x => x.Color) != MaxColor)
                    {
                        Dm.DebugPrint("最大颜色错误,应是:" + list.Max(x => x.Color) + ",等级识别的maxcolor:" + MaxColor.ToString());
                        MaxColor = list.Max(x => x.Color);

                        if (MaxColor == Color.紫)
                        {
                            role.CloseWindow();
                            Delegater.WaitTrue(() => role.OpenMenu("武将"), () => role.IsExistWindowMenu("将领"), () => Dm.Delay(1000));
                            Delegater.WaitTrue(() => role.OpenWindowMenu("将领"),
                                               () => Dm.Delay(1000));
                            GetSelectedGeneralEquipment(86, 68, 177, 149, 152, 107);
                            GetSelectedGeneralEquipment(86, 156, 173, 241, 154, 194);
                            GetSelectedGeneralEquipment(84, 244, 176, 326, 153, 286);
                            GetSelectedGeneralEquipment(83, 332, 174, 417, 153, 375);

                            role.CloseWindow();
                            Delegater.WaitTrue(() => role.OpenMenu("装备"), () => role.IsExistWindowMenu("商店"), () => Dm.Delay(1000));
                            Delegater.WaitTrue(() => role.OpenWindowMenu("商店"),
                                               () => Dm.Delay(1000));
                        }
                    }
                    if (MaxColor == Color.白 || MaxColor == Color.蓝 || MaxColor == Color.绿)
                    {
                        buyList = list.Where(x => x.Color == MaxColor).ToList();
                    }
                    else if (MaxColor == Color.黄)//黄
                    {
                        buyList = list.Where(x => x.Color == Color.黄 && x.StarLevel == 1).ToList();
                    }
                    else if (MaxColor == Color.红)//红
                    {
                        buyList = list.Where(x => x.Color == Color.红 && x.StarLevel == 2).ToList();
                    }
                    else if (MaxColor == Color.紫)//紫
                    {
                        buyList = list.Where(x => x.Color == Color.紫 && x.StarLevel == 3).ToList();
                    }
                    else
                    {
                        Dm.DebugPrint("人物等级无法识别!" + level);
                        return(true);
                    }
                    if (buyList != null)
                    {
                        Dm.Delay(500);
                        foreach (var goods in buyList)
                        {
                            try
                            {
                                StoreItem items = role.GameHelper.GetStoreItem();
                                if (items == null)
                                {
                                    Dm.DebugPrint("Error:获取商店数据错误。");
                                    role.CloseWindow();
                                    return(true);
                                }
                                if (int.Parse(items.nowItemNum) >= int.Parse(items.maxItemNum))
                                {
                                    Dm.DebugPrint("Error:仓库数量达到上限。");
                                    role.CloseWindow();
                                    return(true);
                                }
                                if (items.items[goods.Pos - 1].curItemNum == null)
                                {
                                    Dm.DebugPrint("获取的商品跟识别不一致。");

                                    Dm.Delay(500);
                                    continue;
                                }


                                if (MaxColor >= Color.紫)
                                {
                                    if (int.Parse(items.items[goods.Pos - 1].curItemNum) < (10 - count))
                                    {
                                        Dm.MoveToClick(goods.Buypos.Item1, goods.Buypos.Item2);
                                        Dm.Delay(1000);
                                    }
                                }
                                else
                                {
                                    Dm.MoveToClick(goods.Buypos.Item1, goods.Buypos.Item2);
                                    Dm.Delay(1000);
                                }
                            }
                            catch (Exception ex)
                            { Debug.WriteLine(ex.Message); }
                        }
                    }
                    Dm.FindStrAndClick(718, 448, 857, 502, "刷新", "86.17.70-5.5.25");
                    Dm.Delay(1000);
                    if (Dm.IsExistPic(283, 192, 668, 411, @"\bmp\适合您的装备.bmp"))
                    {
                        Dm.FindPicAndClick(283, 192, 668, 411, @"\bmp\商店确定.bmp");
                    }
                }
                //出现稀有物品
                if (Dm.IsExistPic(283, 192, 668, 411, @"\bmp\稀有物品.bmp", 0.8, false))
                {
                    Dm.FindPicAndClick(283, 192, 668, 411, @"\bmp\商店取消.bmp");
                    Dm.Delay(500);
                    Dm.MoveToClick(168, 370);
                }
                return(Dm.IsExistStr(718, 448, 857, 502, "清除", "86.17.70-5.5.25"));
            }, () => Dm.Delay(200));
            // Dm.DebugPrint("需要装备:" + needs[0] + " " + needs[1] + " " + needs[2] + " " + needs[3] + " " + needs[4] + " " + needs[5]);
            role.CloseWindow();
            return(TaskResult.Finished);
        }