private Tuple <bool, EquipmentAttrType> IsSameEequipmentType() { EquipmentAttrType type1 = EquipmentAttrType.未知类型, type2 = EquipmentAttrType.未知类型, type3 = EquipmentAttrType.未知类型; Delegater.WaitTrue(() => { type1 = GetEquipmentType(566, 318, 637, 393); type2 = GetEquipmentType(634, 315, 703, 400); type3 = GetEquipmentType(701, 315, 776, 408); if (type1 != EquipmentAttrType.未知类型 && type2 != EquipmentAttrType.未知类型 && type3 != EquipmentAttrType.未知类型) { Dm.DebugPrint("属性:" + type1.ToString() + " " + type2.ToString() + " " + type3.ToString()); return(true); } return(false); }); if (type1 == type2 && type2 == type3) { Dm.DebugPrint("所有类型相同!" + type1.ToString()); return(new Tuple <bool, EquipmentAttrType>(true, type1)); } return(new Tuple <bool, EquipmentAttrType>(false, type1)); }
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); }