From 1fe0e04da8cfaafac55c0785a3a9e901f2527831 Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期三, 19 九月 2018 14:46:05 +0800
Subject: [PATCH] 3058【前端】我要变强取消变强模块的条件,优化战力状态显示

---
 System/RolePromote/RolePromoteModel.cs |  280 ++++---------------------------------------------------
 1 files changed, 21 insertions(+), 259 deletions(-)

diff --git a/System/RolePromote/RolePromoteModel.cs b/System/RolePromote/RolePromoteModel.cs
index e2e8bfc..d968c67 100644
--- a/System/RolePromote/RolePromoteModel.cs
+++ b/System/RolePromote/RolePromoteModel.cs
@@ -137,6 +137,7 @@
         #region 閰嶇疆
         public Dictionary<int, int> wingLv2GenerDict = new Dictionary<int, int>();
         public Dictionary<int, List<RoleStrongerConfig>> roleStrongerDic = new Dictionary<int, List<RoleStrongerConfig>>();
+        List<int> promotePercents = new List<int>();
         void ParseConfig()
         {
             var dict = Config.Instance.GetAllValues<RoleStrongerConfig>();
@@ -151,290 +152,51 @@
                 }
                 list.Add(cfg);
             }
-            var _funcCfg = Config.Instance.Get<FuncConfigConfig>("WingLV");
-            LitJson.JsonData _json = LitJson.JsonMapper.ToObject(_funcCfg.Numerical1);
+            var funcConfig = Config.Instance.Get<FuncConfigConfig>("WingLV");
+            LitJson.JsonData _json = LitJson.JsonMapper.ToObject(funcConfig.Numerical1);
             foreach (var _wingLv in _json.Keys)
             {
                 wingLv2GenerDict.Add(int.Parse(_wingLv), int.Parse(_json[_wingLv].ToString()));
             }
+            funcConfig = Config.Instance.Get<FuncConfigConfig>("FightpowerUp");
+            promotePercents.AddRange(ConfigParse.GetMultipleStr<int>(funcConfig.Numerical1));
         }
-        public List<RoleStrongerConfig> GetRoleStrongerList(int funcType)
+
+        public List<RoleStrongerConfig> GetStrongerConfigs(int funcType)
         {
             List<RoleStrongerConfig> list = null;
             roleStrongerDic.TryGetValue(funcType, out list);
             return list;
         }
-        public bool IsHighestStage(int funcType, int id)
+
+        public int GetPromoteState(int percent)
         {
-            List<RoleStrongerConfig> list = GetRoleStrongerList(funcType);
-            if (list != null && list.Count > 0)
+            for (int i = 0; i < promotePercents.Count; i++)
             {
-                if (id == list[list.Count - 1].id)
+                if (percent <= promotePercents[i])
                 {
-                    return true;
+                    return i;
                 }
             }
-            return false;
+            return promotePercents.Count - 1;
         }
         #endregion
 
-        public RoleStrongerConfig GetPresentRoleStronger(int funcType, out int presentValue, out bool reached)
+        public RoleStrongerConfig GetPresentRoleStronger(int funcType)
         {
-            presentValue = 0;
-            List<RoleStrongerConfig> list = GetRoleStrongerList(funcType);
-            reached = false;
+            List<RoleStrongerConfig> list = GetStrongerConfigs(funcType);
             int i = 0;
             int presentLevel = PlayerDatas.Instance.baseData.LV;
             if (list != null && list.Count > 0)
             {
-                switch ((FuncPowerType)list[0].funcType)
+                for (i = 0; i < list.Count; i++)
                 {
-                    case FuncPowerType.Equip:
-                        {
-                            for (i = 0; i < list.Count; i++)
-                            {
-                                presentValue = GetEquipCnt(list[i].conditions[0]
-                                    , list[i].conditions.Length > 1 ? list[i].conditions[1] : 0
-                                    , list[i].conditions.Length > 2 ? list[i].conditions[2] : 0);
-                                if (presentLevel < list[i].LV)
-                                {
-                                    break;
-                                }
-                                if (presentValue < list[i].targetValue)
-                                {
-                                    return list[i];
-                                }
-                            }
-                        }
-                        break;
-                    case FuncPowerType.Plus:
-                        {
-                            var packTypeModel = playerPack.GetSinglePackModel(PackType.rptEquip);
-                            if (packTypeModel == null || packTypeModel.GetPackModelIndexDict() == null || packTypeModel.GetPackModelIndexDict().Count == 0)
-                            {
-                                return list[0];
-                            }
-                            foreach (var itemPlace in packTypeModel.GetPackModelIndexDict().Keys)
-                            {
-                                presentValue += strengthengmodel.StrengthenTheCeiling(itemPlace);
-                            }
-                            for (i = 0; i < list.Count; i++)
-                            {
-                                if (presentLevel < list[i].LV)
-                                {
-                                    break;
-                                }
-                                if (presentValue < list[i].targetValue)
-                                {
-                                    return list[i];
-                                }
-                            }
-                        }
-                        break;
-                    case FuncPowerType.Rune:
-                        {
-                            for (i = 0; i < list.Count; i++)
-                            {
-                                bool _satisfy = GetRuneCnt(list[i].conditions[0], out presentValue);
-                                if (presentLevel < list[i].LV)
-                                {
-                                    break;
-                                }
-                                if (!_satisfy || presentValue < list[i].targetValue)
-                                {
-                                    return list[i];
-                                }
-                            }
-                        }
-                        break;
-                    case FuncPowerType.GodWeapon:
-                        {
-                            for (i = 0; i < list.Count; i++)
-                            {
-                                var magicianData = magicianModel.GetMagicianData(list[i].conditions[0]);
-                                if (magicianData == null)
-                                {
-                                    return list[i];
-                                }
-                                presentValue = magicianData.level;
-                                if (presentLevel < list[i].LV)
-                                {
-                                    break;
-                                }
-                                if (presentValue < list[i].targetValue)
-                                {
-                                    return list[i];
-                                }
-                            }
-                        }
-                        break;
-                    case FuncPowerType.Horse:
-                        {
-                            for (i = 0; i < list.Count; i++)
-                            {
-                                int _itemColor = list[i].conditions.Length > 1 ? list[i].conditions[1] : 0;
-                                int _lv = list[i].conditions.Length > 0 ? list[i].conditions[0] : 0;
-                                presentValue = GetMountCnt(_itemColor, _lv);
-                                if (presentLevel < list[i].LV)
-                                {
-                                    break;
-                                }
-                                if (presentValue < list[i].targetValue)
-                                {
-                                    return list[i];
-                                }
-                            }
-                        }
-                        break;
-                    case FuncPowerType.Wing:
-                        {
-                            var itemModel = playerPack.GetItemModelByIndex(PackType.rptEquip, (int)RoleEquipType.retWing);
-                            if (itemModel == null)
-                            {
-                                presentValue = 0;
-                                break;
-                            }
-                            ItemConfig _tagChinItemModel = Config.Instance.Get<ItemConfig>((int)itemModel.itemInfo.ItemID);
-                            presentValue = wingLv2GenerDict[_tagChinItemModel.LV];
-                            for (i = 0; i < list.Count; i++)
-                            {
-                                if (presentLevel < list[i].LV)
-                                {
-                                    break;
-                                }
-                                if (presentValue < list[i].conditions[0])
-                                {
-                                    presentValue = 0;
-                                    return list[i];
-                                }
-                            }
-                        }
-                        break;
-                    case FuncPowerType.Stone:
-                        {
-                            presentValue = allStoneLv;
-                            for (i = 0; i < list.Count; i++)
-                            {
-                                if (presentLevel < list[i].LV)
-                                {
-                                    break;
-                                }
-                                if (presentValue < list[i].targetValue)
-                                {
-                                    return list[i];
-                                }
-                            }
-                        }
-                        break;
-                    case FuncPowerType.Suit:
-                        {
-                            for (i = 0; i < list.Count; i++)
-                            {
-                                presentValue = SuitModel.GetSameSuitCntByType((SuitType)list[i].conditions[0]);
-                                if (presentLevel < list[i].LV)
-                                {
-                                    break;
-                                }
-                                if (presentValue < list[i].targetValue)
-                                {
-                                    return list[i];
-                                }
-                            }
-                        }
-                        break;
-                    case FuncPowerType.Wash:
-                        {
-                            for (i = 0; i < list.Count; i++)
-                            {
-                                presentValue = GetWashCnt(list[i].conditions[0]);
-                                if (presentLevel < list[i].LV)
-                                {
-                                    break;
-                                }
-                                if (presentValue < list[i].targetValue)
-                                {
-                                    return list[i];
-                                }
-                            }
-                        }
-                        break;
-                    case FuncPowerType.Prestige:
-                        {
-                            for (i = 0; i < list.Count; i++)
-                            {
-                                presentValue = PlayerDatas.Instance.baseData.realmLevel;
-                                if (presentLevel < list[i].LV)
-                                {
-                                    break;
-                                }
-                                if (presentValue < list[i].targetValue)
-                                {
-                                    return list[i];
-                                }
-                            }
-                        }
-                        break;
-                    case FuncPowerType.Pet:
-                        {
-                            for (i = 0; i < list.Count; i++)
-                            {
-                                presentValue = GetPetCnt(list[i].conditions.Length > 1 ? list[i].conditions[1] : list[i].conditions[0]);
-                                if (presentLevel < list[i].LV)
-                                {
-                                    break;
-                                }
-                                if (presentValue < list[i].targetValue)
-                                {
-                                    return list[i];
-                                }
-                            }
-                        }
-                        break;
-                    case FuncPowerType.Demon:
-                    case FuncPowerType.Fairy:
-                    case FuncPowerType.Human:
-                        {
-                            for (i = 0; i < list.Count; i++)
-                            {
-                                if (presentLevel < list[i].LV)
-                                {
-                                    break;
-                                }
-                                Treasure treasure = null;
-                                presentValue = 0;
-                                if (treasureModel.TryGetTreasure(list[i].targetValue, out treasure))
-                                {
-                                    if (treasure.state == TreasureState.Collected)
-                                    {
-                                        presentValue = 1;
-                                        continue;
-                                    }
-                                }
-                                return list[i];
-                            }
-                        }
-                        break;
-                    case FuncPowerType.BlastFurnace:
-                        {
-                            for (i = 0; i < list.Count; i++)
-                            {
-                                presentValue = GetBlastFurnaceDragUseCount(list[i].conditions.Length > 0 ? list[i].conditions[0] : 1);
-                                if (presentLevel < list[i].LV)
-                                {
-                                    break;
-                                }
-                                if (presentValue < list[i].targetValue)
-                                {
-                                    return list[i];
-                                }
-                            }
-                        }
-                        break;
+                    if (presentLevel < list[i].LV)
+                    {
+                        return list[i];
+                    }
                 }
-                reached = true;
-                i = Mathf.Max(0, i - 1);
-                i = Mathf.Min(list.Count - 1, i);
-                return list[i];
+                return list[list.Count - 1];
             }
             return null;
         }

--
Gitblit v1.8.0