private void UpdateMethod() { if (selectPanel.SelectIndex < 0) { return; } int targetid = selectPanel.SelectInfo; if (targetid == 0) { return; } foreach (DbMergeData memMergeData in mergeInfos) { if (memMergeData.Target == targetid) { currentInfo = memMergeData; } } EquipConfig equipConfig = ConfigData.GetEquipConfig(targetid); virtualRegion.SetRegionKey(1, equipConfig.Id); itemCounts[0] = UserProfile.InfoEquip.GetEquipCount(equipConfig.Id); int index = 1; foreach (IntPair pair in currentInfo.Methods) { virtualRegion.SetRegionKey(index + 1, pair.Type); itemCounts[index] = UserProfile.InfoBag.GetItemCount(pair.Type); index++; } for (int i = index; i < 6; i++) { virtualRegion.SetRegionKey(i + 1, 0); } Invalidate(); }
public DbMergeData CreateMergeMethod(int mid) { EquipConfig equipConfig = ConfigData.GetEquipConfig(mid); DbMergeData mthds = new DbMergeData(); mthds.Target = mid; { List <IntPair> mthd = new List <IntPair>(); int icount = GetItemCount(equipConfig.Level); int itrare = MathTool.GetRandom(Math.Max(1, equipConfig.Quality * 2 - 1), equipConfig.Quality * 2 + 1);//第一个素材品质和装备品质挂钩 Dictionary <int, bool> existFormula = new Dictionary <int, bool>(); for (int j = 0; j < icount; j++) { IntPair pv = new IntPair(); if (j == 0) { pv.Type = HItemBook.GetRandRareItemId(HItemRandomGroups.Gather, itrare); pv.Value = GetItemCountByEquipLevel(equipConfig.Level, itrare) + 1; } else { int nrare = MathTool.GetRandom(Math.Max(1, itrare - 3), itrare); pv.Type = HItemBook.GetRandRareItemId(HItemRandomGroups.Fight, nrare); pv.Value = Math.Max(1, GetItemCountByEquipLevel(equipConfig.Level, nrare)); } if (existFormula.ContainsKey(pv.Type)) { j--;//相当于做redo } else { existFormula.Add(pv.Type, true); mthd.Add(pv); } } mthds.Set(mthd); } return(mthds); }