少年修仙传客户端代码仓库
leonard Wu
2018-08-03 c2d2d5d3a840bf50968b3f95e304929bc62a7b70
System/Strengthening/EquipSuit/PlayerSuitModel.cs
@@ -900,14 +900,18 @@
                return false;
            bool isAdapt = true;
            DesignDebug.Log("groupType:" + groupType + "NowSuitCnt:" + nowSuitCnt + "willSuitCnt:" + willSuitCnt);
            if (nowSuitCnt == attrConfig.count1 || nowSuitCnt == attrConfig.count2 || nowSuitCnt == attrConfig.count3)
            if (willSuitCnt != attrConfig.count1 && willSuitCnt != attrConfig.count2 && willSuitCnt != attrConfig.count3)
            {
                if (willSuitCnt != attrConfig.count1 && willSuitCnt != attrConfig.count2 && willSuitCnt != attrConfig.count3)
                {
                    isAdapt = false;
                }
                isAdapt = false;
            }
            //DesignDebug.Log("groupType:" + groupType + "NowSuitCnt:" + nowSuitCnt + "willSuitCnt:" + willSuitCnt);
            //if (nowSuitCnt == attrConfig.count1 || nowSuitCnt == attrConfig.count2 || nowSuitCnt == attrConfig.count3)
            //{
            //    if (willSuitCnt != attrConfig.count1 && willSuitCnt != attrConfig.count2 && willSuitCnt != attrConfig.count3)
            //    {
            //        isAdapt = false;
            //    }
            //}
            return isAdapt;
        }
@@ -919,7 +923,7 @@
            Dictionary<int, Dictionary<int, int>> needMatCntDict = new Dictionary<int, Dictionary<int, int>>(); //群组 id 数量
            Dictionary<int, int> minActiveSuitCntDic = new Dictionary<int, int>();
            Dictionary<int, List<int>> activeEquipPlaceDict = new Dictionary<int, List<int>>();
            Dictionary<int, List<int>> upgradEquipPlaceDict = new Dictionary<int, List<int>>();
            for (int i = 0; i < partlist.Count; i++)
            {
                int groupType = GetGroupType(partlist[i]);
@@ -940,60 +944,60 @@
                            if (!needMatCntDict.ContainsKey(groupType))
                            {
                                Dictionary<int, int> matCntDict = new Dictionary<int, int>();
                                needMatCntDict.Add(groupType,matCntDict);
                                minActiveSuitCntDic.Add(groupType,1);
                                needMatCntDict.Add(groupType, matCntDict);
                                //minActiveSuitCntDic.Add(groupType, 1);
                                List<int> equipPlacelist = new List<int>();
                                activeEquipPlaceDict.Add(groupType, equipPlacelist);
                                upgradEquipPlaceDict.Add(groupType, equipPlacelist);
                            }
                            if (minActiveSuitCntDic[groupType] <= attrConfig.count1)
                            int[] matIds = matConfig.CostItemID;
                            int[] matCnts = matConfig.CostItemCnt;
                            for (int j = 0; j < matIds.Length; j++)
                            {
                                int[] matIds = matConfig.CostItemID;
                                int[] matCnts = matConfig.CostItemCnt;
                                for (int j = 0; j < matIds.Length; j++)
                                if (!needMatCntDict[groupType].ContainsKey(matIds[j]))
                                {
                                    if (!needMatCntDict[groupType].ContainsKey(matIds[j]))
                                    {
                                        needMatCntDict[groupType].Add(matIds[j], matCnts[j]);
                                    }
                                    else
                                    {
                                        needMatCntDict[groupType][matIds[j]] += matCnts[j];
                                    }
                                    needMatCntDict[groupType].Add(matIds[j], matCnts[j]);
                                }
                                activeEquipPlaceDict[groupType].Add(partlist[i]);
                                minActiveSuitCntDic[groupType] += 1;
                                else
                                {
                                    needMatCntDict[groupType][matIds[j]] += matCnts[j];
                                }
                            }
                            else
                            bool isReach = true;
                            foreach(var id in needMatCntDict[groupType].Keys)
                            {
                                break;
                                int haveCnt = playerPack.GetItemCountByID(PackType.rptItem, id);
                                if(haveCnt < needMatCntDict[groupType][id])
                                {
                                    isReach = false;
                                    break;
                                }
                            }
                            if(isReach)
                            {
                                upgradEquipPlaceDict[groupType].Add(partlist[i]);
                            }
                        }
                    }
                }
            }
            foreach (var type in needMatCntDict.Keys)
            foreach(var type in upgradEquipPlaceDict.Keys)
            {
                bool isReach = true;
                foreach (var id in needMatCntDict[type].Keys)
                if(upgradEquipPlaceDict[type].Count > 0)
                {
                    int haveCnt = playerPack.GetItemCountByID(PackType.rptItem, id);
                    if (haveCnt < needMatCntDict[type][id])
                    ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.rptEquip, upgradEquipPlaceDict[type][0]);
                    EquipSuitAttrConfig attrConfig = EquipSuitAttrConfig.GetSuitAttrConfig(type
                        , (int)suitType, 1, GetEquipJob(itemModel.itemId));
                    if (upgradEquipPlaceDict[type].Count >= attrConfig.count1)
                    {
                        isReach = false;
                        break;
                        equipPlace = upgradEquipPlaceDict[type][0];
                        return true;
                    }
                }
                if (isReach)
                {
                    equipPlace = activeEquipPlaceDict[type][0];
                    return true;
                }
            }
            return false;
        }
        #endregion