예제 #1
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);
        }
예제 #2
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);
        }
예제 #3
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));
                    }
                }
            }
        }
예제 #4
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);
        }
예제 #5
0
        private void GetSelectedGeneralEquipment(int x1, int y1, int x2, int y2, int a, int b)
        {
            Role role = (Role)Role;

            if (Dm.GetColorNum(x1, y1, x2, y2, "DDDDDD-222222", 0.9, false) > 100)
            {
                //GetEquipmentProperty(465, 177, 0);//枪
                //GetEquipmentProperty(467, 250, 1);//甲
                //GetEquipmentProperty(468, 319, 2);//帅印
                //GetEquipmentProperty(535, 179, 3);//马
                //GetEquipmentProperty(536, 251, 4); //披风
                //GetEquipmentProperty(538, 322, 5);//旗子\
                Dm.MoveToClick(a, b);
                Dm.Delay(1000);
                Dm.MoveToClick(465, 177);
                Dm.Delay(1000);

                try
                {
                    var              obj           = role.GameHelper.GetData(Const.GENERAL_GET_WEAREQUIP);
                    JArray           wel           = obj.action.data.equips;
                    List <WearEquip> wearEquipList = new List <WearEquip>();

                    if (wel != null)
                    {
                        wearEquipList = JsonHelper.FromJson <List <WearEquip> >(wel.ToString());
                        foreach (var wearEquip in wearEquipList)
                        {
                            if (wearEquip.itemName.Contains("套装"))
                            {
                                Dm.DebugPrint("该武将穿套装:" + wearEquip.itemName);
                                if (!taozhuangList.Contains(wearEquip.itemName))
                                {
                                    taozhuangList.Add(wearEquip.itemName);
                                }
                            }
                        }
                    }
                    else
                    {
                        if (Dm.GetColorNum(574, 341, 702, 389, "c96be7-303030", 0.9) > 260)
                        {
                            Dm.DebugPrint("该武将穿套装,但获取失败!");
                        }
                    }
                }catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }
            }
        }
예제 #6
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);
        }
예제 #7
0
 private void ClosePopup(int x, int y)
 {
     Delegater.WaitTrue(() =>
     {
         if (Dm.IsExistPic(379, 213, 475, 255, @"\bmp\隐藏技能.bmp", 0.8, false))
         {
             Dm.MoveToClick(x, y); //点确定取消
                                   // Dm.DebugPrint("点击坐标:" + x + " " + y);
             Dm.Delay(3000);
             if (!Dm.IsExistPic(379, 213, 475, 255, @"\bmp\隐藏技能.bmp", 0.8, false))
             {
                 return(true);
             }
         }
         return(false);
     });
     Dm.Delay(1000);
 }
예제 #8
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));
        }
예제 #9
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);
        }
예제 #10
0
        private TaskResult RunStep5(TaskContext context)
        {
            Role role = (Role)context.Role;
            //Delegater.WaitTrue(() =>role.OpenMenu("武将"),()=>role.IsExistWindowMenu("将领"),()=>Dm.Delay(1000));
            //role.OpenWindowMenu("将领");
            //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);

            //string tt = "";
            //int cc = 0;
            //foreach (var item in taozhuangList)
            //{
            //    tt = tt + item + " ";
            //    if (item.Contains("极"))
            //    {
            //        role.CloseWindow();
            //        return TaskResult.Finished;
            //    }
            //    if (item.Contains("真"))
            //    {
            //        var a = (EquipSuitEnum)Enum.Parse(typeof(EquipSuitEnum), item);
            //        equipSuit = equipSuit | a;
            //        cc = cc + 2;
            //        continue;
            //    }
            //    if (item.Contains("套装"))
            //    {
            //        var a = (EquipSuitEnum)Enum.Parse(typeof(EquipSuitEnum), item);
            //        equipSuit = equipSuit | a;
            //        cc = cc + 1;
            //    }
            //}
            //role.CloseWindow();

            //if (((int)equipSuit)==1791)
            //{
            //    Dm.DebugPrint("套装已经洗完!");
            //    return TaskResult.Finished;
            //}
            //else
            //{
            //    Dm.DebugPrint(((int)equipSuit).ToString());
            //}
            //Dm.DebugPrint("套装未洗完,初始化...");
            //role.TaozhuangList.ForEach(x =>
            //{
            //    x.套装名称.IsHave = false;
            //    x.麒麟双枪.IsHave = false;
            //    x.麒麟.IsHave = false;
            //    x.三昧纯阳铠.IsHave = false;
            //    x.蝶凤舞阳.IsHave = false;
            //    x.伏龙帅印.IsHave = false;
            //    x.蟠龙华盖.IsHave = false;
            //});
            //Dm.DebugPrint("套装初始化成功!");

            List <套装> tempTaozhuangList = role.TaozhuangList;
            //if (EquipSuitEnum.青龙套装 == (equipSuit & EquipSuitEnum.青龙套装))
            //    SetValue(tempTaozhuangList, 0);
            //if (EquipSuitEnum.白虎套装 == (equipSuit & EquipSuitEnum.白虎套装))
            //    SetValue(tempTaozhuangList, 1);
            //if (EquipSuitEnum.朱雀套装 == (equipSuit & EquipSuitEnum.朱雀套装))
            //    SetValue(tempTaozhuangList, 2);
            //if (EquipSuitEnum.鲮鲤套装 == (equipSuit & EquipSuitEnum.鲮鲤套装))
            //    SetValue(tempTaozhuangList, 3);
            //if (EquipSuitEnum.玄武套装 == (equipSuit & EquipSuitEnum.玄武套装))
            //    SetValue(tempTaozhuangList, 4);
            //if (EquipSuitEnum.霸下套装 == (equipSuit & EquipSuitEnum.霸下套装))
            //    SetValue(tempTaozhuangList, 5);
            //if (EquipSuitEnum.驱虎套装 == (equipSuit & EquipSuitEnum.驱虎套装))
            //    SetValue(tempTaozhuangList, 6);
            //if (EquipSuitEnum.烛龙套装 == (equipSuit & EquipSuitEnum.烛龙套装))
            //    SetValue(tempTaozhuangList, 7);
            //if (EquipSuitEnum.凤凰套装 == (equipSuit & EquipSuitEnum.凤凰套装))
            //    SetValue(tempTaozhuangList, 8);
            //if (EquipSuitEnum.灵龟套装 == (equipSuit & EquipSuitEnum.灵龟套装))
            //    SetValue(tempTaozhuangList, 9);
            //Dm.DebugPrint("已有套装:" + equipSuit.ToString());
            //Dm.DebugPrint("检查未洗练装备:");
            //Delegater.WaitTrue(() => role.OpenMenu("装备"), () => role.IsExistWindowMenu("洗练"), () => Dm.Delay(1000));
            //role.OpenWindowMenu("洗练");
            //Dm.Delay(2000);
            //Dm.DebugPrint("获取装备数据...");
            //List<Equips> equipsList = new List<Equips>();
            ////初始化装备数据

            //var rootObj = role.GameHelper.GetData(Const.GET_EQUIPS_LIST);
            //if (rootObj != null)
            //{
            //    JArray equips = rootObj.action.data.equips;
            //    if (equips != null)
            //    {
            //        equipsList = JsonHelper.FromJson<List<Equips>>(equips.ToString());
            //    }
            //    else
            //    {
            //        Dm.DebugPrint("获取装备数据失败!");
            //        role.CloseWindow();
            //        return TaskResult.Finished;
            //    }
            //    if (equipsList.FirstOrDefault(x => x.refreshAttribute.Count() == 3 && x.quality == "6") == null)
            //    {
            //        Dm.DebugPrint("已经没有紫装备可以洗!");
            //        role.CloseWindow();
            //        return TaskResult.Finished;
            //    }
            //    foreach (var equip in equipsList)
            //    {
            //        套装 taozhuang = tempTaozhuangList.FirstOrDefault(x => equip.refreshAttribute.Count == 4 && ((Equipment)x.GetType().GetProperty(equip.name).GetValue(x)).类型.ToString() == equip.refreshAttribute[0].attrName && ((Equipment)x.GetType().GetProperty(equip.name).GetValue(x)).IsHave == false);
            //        if (taozhuang != null)
            //        {
            //            ((Equipment)taozhuang.GetType().GetProperty(equip.name).GetValue(taozhuang)).IsHave = true;
            //            equip.IsBelong = true;
            //        }
            //    }
            //}
            //else
            //{
            //    Dm.DebugPrint("获取装备数据失败!");
            //    role.CloseWindow();
            //    return TaskResult.Finished;
            //}

            Dictionary <string, List <string> > dictCount = new Dictionary <string, List <string> >();

            dictCount.Add("麒麟双枪", new List <string>());
            dictCount.Add("麒麟", new List <string>());
            dictCount.Add("三昧纯阳铠", new List <string>());
            dictCount.Add("蝶凤舞阳", new List <string>());
            dictCount.Add("伏龙帅印", new List <string>());
            dictCount.Add("蟠龙华盖", new List <string>());
            //统计每样装备剩下的类型件数
            foreach (var item in tempTaozhuangList)
            {
                if (item.麒麟双枪.IsHave == false)
                {
                    dictCount["麒麟双枪"].Add(item.麒麟双枪.类型.ToString());
                }
                if (item.麒麟.IsHave == false)
                {
                    dictCount["麒麟"].Add(item.麒麟.类型.ToString());
                }
                if (item.昧纯阳铠.IsHave == false)
                {
                    dictCount["三昧纯阳铠"].Add(item.昧纯阳铠.类型.ToString());
                }
                if (item.蝶凤舞阳.IsHave == false)
                {
                    dictCount["蝶凤舞阳"].Add(item.蝶凤舞阳.类型.ToString());
                }
                if (item.伏龙帅印.IsHave == false)
                {
                    dictCount["伏龙帅印"].Add(item.伏龙帅印.类型.ToString());
                }
                if (item.蟠龙华盖.IsHave == false)
                {
                    dictCount["蟠龙华盖"].Add(item.蟠龙华盖.类型.ToString());
                }
            }
            //int cccc = 0;
            Delegater.WaitTrue(() =>
            {
                string points = Dm.FindPicEx(98, 120, 556, 513, @"\bmp\星星3.bmp", "303030", 0.8, 0);
                // Debug.WriteLine(points);
                if (points == "")
                {
                    return(true);
                }
                string[] t = points.Split('|');
                foreach (var item in t)
                {
                    string[] p = item.Split(',');
                    Dm.Delay(1000);
                    Dm.MoveToClick(int.Parse(p[1]), int.Parse(p[2]));
                    // cccc = 0;
                    //  Dm.DebugPrint("点击坐标:" + int.Parse(p[1]) + " " + int.Parse(p[2]));
                    Dm.Delay(1000);
                    if (Dm.IsExistPic(707, 382, 734, 404, @"\bmp\星星1.bmp", 0.8, false))
                    {
                        // Dm.DebugPrint("该装备为紫装!");
                        if (Dm.IsExistPic(792, 380, 821, 401, @"\bmp\星星1.bmp", 0.8, false))
                        {
                            //  Dm.DebugPrint("该装备已经4星!");
                            continue;
                        }
                        var etype = GetEquipmentType();
                        Dm.DebugPrint("当前装备类型为:" + etype.ToString());
                        if (etype == EquipmentType.未知类型)
                        {
                            continue;
                        }
                        else
                        {
                            int count = tempTaozhuangList.Count(x => ((Equipment)x.GetType().GetProperty(etype.ToString()).GetValue(x)).IsHave == true);
                            if (count == 10)
                            {
                                Dm.DebugPrint(etype.ToString() + "都已洗完!");
                                continue;
                            }
                            else
                            {
                                Dm.DebugPrint(etype.ToString() + "剩下【" + (10 - count) + "】件未洗.");
                            }
                            var hs = new HashSet <string>(dictCount[etype.ToString()]);
                            if (hs.Count == 1 && role.IsSkipIfOne)
                            {
                                Dm.DebugPrint(etype.ToString() + "剩下一个属性未洗,跳过!");
                                continue;
                            }
                        }
                        Delegater.WaitTrue(() =>
                        {
                            Dm.MoveToClick(631, 448);
                            Dm.Delay(500);
                            if (Dm.IsExistPic(379, 213, 475, 255, @"\bmp\隐藏技能.bmp", 0.8, false))
                            {
                                EquipmentAttrType atttype = EquipmentAttrType.未知类型;
                                Delegater.WaitTrue(() =>
                                {
                                    atttype = GetEquipmentType(781, 315, 861, 402);
                                    if (atttype != EquipmentAttrType.未知类型)
                                    {
                                        return(true);
                                    }
                                    return(false);
                                });
                                var eqtype = GetEquipmentType();
                                Dm.DebugPrint("装备【" + eqtype.ToString() + "】洗出属性【" + atttype + "】");
                                if (eqtype == EquipmentType.未知类型)
                                {
                                    ClosePopup(550, 361);    //点击点取消
                                }
                                else
                                {
                                    int count    = tempTaozhuangList.Count(x => ((Equipment)x.GetType().GetProperty(eqtype.ToString()).GetValue(x)).IsHave == true);
                                    套装 taozhuang = tempTaozhuangList.FirstOrDefault(x => ((Equipment)x.GetType().GetProperty(eqtype.ToString()).GetValue(x)).类型 == atttype && ((Equipment)x.GetType().GetProperty(etype.ToString()).GetValue(x)).IsHave == false);
                                    if (taozhuang != null)
                                    {
                                        ((Equipment)taozhuang.GetType().GetProperty(eqtype.ToString()).GetValue(taozhuang)).IsHave = true;

                                        string temp = "", temp2 = "";
                                        foreach (var it in tempTaozhuangList)
                                        {
                                            var a = (Equipment)it.GetType().GetProperty(eqtype.ToString()).GetValue(it);
                                            if (a.IsHave == false)
                                            {
                                                temp = temp + a.类型.ToString() + " ";
                                            }
                                            if (a.IsHave == true)
                                            {
                                                temp2 = temp2 + a.类型.ToString() + " ";
                                            }
                                        }
                                        dictCount[etype.ToString()].Remove(atttype.ToString());
                                        Dm.DebugPrint("属性【" + atttype.ToString() + "】是装备【" + etype.ToString() + "】需要的属性.  " + eqtype.ToString() + "已有属性:" + temp2 + ",还剩下属性未洗:" + temp + "  剩下件数未洗:" + (10 - count - 1));
                                        ClosePopup(550, 361);    //点击点取消
                                        return(true);
                                    }
                                    else
                                    {
                                        if (count == 10)
                                        {
                                            Dm.DebugPrint(eqtype.ToString() + "都已洗完!");
                                            return(true);
                                        }
                                        else
                                        {
                                            string temp = "", temp2 = "";
                                            foreach (var it in tempTaozhuangList)
                                            {
                                                var a = (Equipment)it.GetType().GetProperty(eqtype.ToString()).GetValue(it);
                                                if (a.IsHave == false)
                                                {
                                                    temp = temp + a.类型.ToString() + " ";
                                                }
                                                if (a.IsHave == true)
                                                {
                                                    temp2 = temp2 + a.类型.ToString() + " ";
                                                }
                                            }
                                            Dm.DebugPrint("属性【" + atttype.ToString() + "】不是装备【" + etype.ToString() + "】需要的属性.需要属性:【" + temp + "】");
                                        }
                                    }
                                    ClosePopup(409, 362);    //点击确定
                                }
                            }
                            return(false);
                        });
                    }
                    Dm.Delay(1000);
                }
                Dm.Swipe(515, 438, 515, 320, 50);
                Dm.Delay(1000);
                //List<Equips> aaaa = new List<Equips>();
                ////初始化装备数据

                //rootObj = role.GameHelper.GetData(Const.GET_EQUIPS_LIST);
                //if (rootObj != null)
                //{
                //    JArray equips = rootObj.action.data.equips;
                //    if (equips != null)
                //    {
                //        aaaa = JsonHelper.FromJson<List<Equips>>(equips.ToString());
                //    }
                //    else
                //    {
                //        Dm.DebugPrint("获取装备数据失败!");
                //        return true;
                //    }
                //    var aaaw = aaaa.FirstOrDefault(x => x.refreshAttribute.Count == 3);
                //    if (aaaw == null)
                //        return true;
                //    else
                //    {
                //        Dm.DebugPrint("装备还未洗完");
                //        return false;
                //    }


                //}
                //else
                //{
                //    return true;
                //}



                return(false);
            });
            role.CloseWindow();
            return(TaskResult.Finished);
        }
예제 #11
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);
        }
예제 #12
0
        private TaskResult RunStep1(TaskContext context)
        {
            Role role = (Role)context.Role;

            role.OutMessage("打开兵器界面");

            role.OpenMenu("兵器");
            Dm.Delay(2000);
            List <Tuple <int, int> > pointList = new List <Tuple <int, int> >();

            pointList.Add(new Tuple <int, int>(409, 181));
            pointList.Add(new Tuple <int, int>(408, 326));
            pointList.Add(new Tuple <int, int>(408, 471));
            pointList.Add(new Tuple <int, int>(790, 182));
            pointList.Add(new Tuple <int, int>(787, 326));
            pointList.Add(new Tuple <int, int>(785, 470));

            WeaponInfo info = role.GetWeaponInfo();

            if (info != null)
            {
                for (int i = 0; i < info.weapons.Count; i++)
                {
                    if (bool.Parse(info.weapons[i].open) == false)
                    {
                        continue;
                    }
                    while (true)
                    {
                        if (role.Level != 0)
                        {
                            if (!bool.Parse(info.infiniteLv))
                            {
                                if (role.Level == int.Parse(info.weapons[i].lv))
                                {
                                    break;
                                }
                            }
                        }
                        else
                        {
                            Dm.DebugPrint("Err:未能识别等级!");
                            return(TaskResult.Finished);
                        }
                        if (bool.Parse(info.fullLv))
                        {
                            Dm.DebugPrint("Err:已经全部满级!");
                            role.CloseWindow();
                            return(TaskResult.Finished);
                        }
                        //是否最大值
                        if (bool.Parse(info.weapons[i].isMax))
                        {
                            Dm.DebugPrint("位置" + i + "等级已经达到上限");
                            break;
                        }
                        if (info.weapons[i].hasReformBtn != null)
                        {
                            if (bool.Parse(info.weapons[i].hasReformBtn))
                            {
                                Dm.MoveToClick(493, 452);
                                Dm.Delay(1000);
                                Dm.MoveToClick(493, 452);
                            }
                        }

                        //当前镔铁数量比升级所需数量大,保留80万镔铁
                        if (int.Parse(info.nowIron) > 800000 && int.Parse(info.nowIron) > int.Parse(info.weapons[i].upgradeCost))
                        {
                            Dm.MoveToClick(pointList[i].Item1, pointList[i].Item2);
                            Dm.Delay(200);
                        }
                        else
                        {
                            Dm.DebugPrint("Err:镔铁不足!");
                            role.CloseWindow();
                            return(TaskResult.Finished);
                        }
                        info = role.GetWeaponInfo();
                    }
                }
            }
            role.CloseWindow();

            return(TaskResult.Finished);
        }