From f47ea60f59e0b2b8601583351e269151237c6708 Mon Sep 17 00:00:00 2001
From: client_Zxw <826696702@qq.com>
Date: 星期一, 28 一月 2019 11:20:28 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master' into SpringFestival

---
 System/KnapSack/Logic/ItemTipsModel.cs |  741 +++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 515 insertions(+), 226 deletions(-)

diff --git a/System/KnapSack/Logic/ItemTipsModel.cs b/System/KnapSack/Logic/ItemTipsModel.cs
index 75af654..f2cb901 100644
--- a/System/KnapSack/Logic/ItemTipsModel.cs
+++ b/System/KnapSack/Logic/ItemTipsModel.cs
@@ -57,7 +57,7 @@
 
         public int[] randomRuneIds { get; private set; }
         public int[] PeerlessEquipIds { get; private set; } //缁濅笘瑁呭鍒楄〃
-
+    
         PlayerPackModel _playerPack;
         PlayerPackModel playerPack
         {
@@ -447,6 +447,7 @@
             }
 
             ParseFuncConfig();
+            ParseJadeDynastyEquipLegendAttr();
         }
 
         public void OnBeforePlayerDataInitialize()
@@ -498,6 +499,209 @@
             }
             return false;
         }
+
+        #region 瑙f瀽璇涗粰瑁呭浼犲灞炴��
+        public Dictionary<string, List<int>> jadeDynastyLegendCountDict { get; private set; } //key 闃舵暟 +鏄熺骇  闅忔満鏉℃暟
+        public Dictionary<int, List<int>> jadeDynastyLegendGroupDict { get; private set; } //key 鐗╁搧绫诲瀷 缇ょ粍鍒楄〃
+        public Dictionary<int, List<int>> jadeDynastyLegendIdDict { get; private set; } //key 缇ょ粍id 灞炴�d鍒楄〃
+        public Dictionary<int, Dictionary<int, int>> jadeDynastyLegendColorDict { get; private set; } //key s灞炴�d 灞炴�alue鑼冨洿 棰滆壊鍊�
+        public Dictionary<int, string> jadeDynastyColorDict { get; private set; } //key 鑹插�肩被鍨�
+        public Dictionary<int, int> jadeDynastyLegendValueDict { get; private set; } //key 灞炴�d 鏈�澶у睘鎬alue
+
+        private void ParseJadeDynastyEquipLegendAttr()
+        {
+            jadeDynastyColorDict = new Dictionary<int, string>();
+            jadeDynastyLegendCountDict = new Dictionary<string, List<int>>();
+            jadeDynastyLegendGroupDict = new Dictionary<int, List<int>>();
+            jadeDynastyLegendColorDict = new Dictionary<int, Dictionary<int, int>>();
+            jadeDynastyLegendIdDict = new Dictionary<int, List<int>>();
+            jadeDynastyLegendValueDict = new Dictionary<int, int>();
+            var legendAttrColor = Config.Instance.Get<FuncConfigConfig>("LegendAttrColor");
+            JsonData colorData = JsonMapper.ToObject(legendAttrColor.Numerical4);
+            foreach(var key in colorData.Keys)
+            {
+                int colorType = int.Parse(key);
+                string color = colorData[key].ToString();
+                jadeDynastyColorDict.Add(colorType,color);
+            }
+
+            JsonData legendColorData = JsonMapper.ToObject(legendAttrColor.Numerical3);
+            foreach(var key in legendColorData.Keys)
+            {
+                int attrId = int.Parse(key);
+                var colorDict = new Dictionary<int, int>();
+                jadeDynastyLegendColorDict.Add(attrId,colorDict);
+                var attrValueData = legendColorData[key];
+                foreach(var value in attrValueData.Keys)
+                {
+                    int attrValue = int.Parse(value);
+                    int colorType = int.Parse(attrValueData[value].ToString());
+                    colorDict.Add(attrValue,colorType);
+                }
+            }
+
+            var legendAttrRandRule = Config.Instance.Get<FuncConfigConfig>("LegendAttrRandRule");
+            JsonData legendCountData = JsonMapper.ToObject(legendAttrRandRule.Numerical3);
+            foreach(var key in legendCountData.Keys)
+            {
+                var rangeData = legendCountData[key];
+                int equipLv = int.Parse(key);
+                foreach(var star in rangeData.Keys)
+                {
+                    var countData = rangeData[star];
+                    int equipStar = int.Parse(star);
+                    string guid = StringUtility.Contact(equipLv,equipStar);
+                    List<int> list = new List<int>();
+                    jadeDynastyLegendCountDict.Add(guid,list);
+                    if(countData.IsArray)
+                    {
+                        for(int i = 0; i < countData.Count; i++)
+                        {
+                            int count = int.Parse(countData[i].ToString());
+                            list.Add(count);
+                        }
+                    }
+                }
+            }
+
+            JsonData legendGroupData = JsonMapper.ToObject(legendAttrRandRule.Numerical2);
+            foreach(var type in legendGroupData.Keys)
+            {
+                var groupData = legendGroupData[type];
+                int itemType = int.Parse(type);
+                List<int> list = new List<int>();
+                jadeDynastyLegendGroupDict.Add(itemType,list);
+                if(groupData.IsArray)
+                {
+                    for(int i = 0; i < groupData.Count; i++)
+                    {
+                        int groupType = int.Parse(groupData[i].ToString());
+                        list.Add(groupType);
+                    }
+                }
+            }
+
+            JsonData legendIdData = JsonMapper.ToObject(legendAttrRandRule.Numerical1);
+            foreach(var key in legendIdData.Keys)
+            {
+                var attrIdData = legendIdData[key];
+                int groupId = int.Parse(key);
+                List<int> list = new List<int>();
+                jadeDynastyLegendIdDict.Add(groupId, list);
+                if (attrIdData.IsArray)
+                {
+                    for (int i = 0; i < attrIdData.Count; i++)
+                    {
+                        int attrId = int.Parse(attrIdData[i].ToString());
+                        list.Add(attrId);
+                    }
+                }
+            }
+
+            JsonData legendValueData = JsonMapper.ToObject(legendAttrRandRule.Numerical4);
+            foreach(var key in legendValueData.Keys)
+            {
+                int attrId = int.Parse(key);
+                var valueData = legendValueData[key];
+                if(valueData.IsArray && valueData.Count > 0)
+                {
+                    int attrValue = int.Parse(valueData[0].ToString());
+                    jadeDynastyLegendValueDict.Add(attrId,attrValue);
+                }
+            }
+        }
+
+        public bool TryGetJadeDynastyLegendCount(int itemId,out int minCount,out int maxCount)
+        {
+            minCount = 0;
+            maxCount = 0;
+            var config = Config.Instance.Get<ItemConfig>(itemId);
+            if (config == null) return false;
+
+            int equipLv = config.LV;
+            int equipStar = config.StarLevel;
+            string guid = StringUtility.Contact(equipLv,equipStar);
+            if(jadeDynastyLegendCountDict.ContainsKey(guid))
+            {
+                var list = jadeDynastyLegendCountDict[guid];
+                if(list.Count > 1)
+                {
+                    minCount = list[0];
+                    maxCount = list[1];
+                    return true;
+                }
+                else if(list.Count > 0)
+                {
+                    maxCount = list[0];
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        public bool TryGetJadeDynastyLegendAttr(int itemId,out Dictionary<int,int> attrDict)
+        {
+            attrDict = new Dictionary<int, int>();
+            var config = Config.Instance.Get<ItemConfig>(itemId);
+            if (config == null) return false;
+
+            if(jadeDynastyLegendGroupDict.ContainsKey(config.Type))
+            {
+                var grouplist = jadeDynastyLegendGroupDict[config.Type];
+                foreach(var groupId in grouplist)
+                {
+                    if(jadeDynastyLegendIdDict.ContainsKey(groupId))
+                    {
+                        var attrIds = jadeDynastyLegendIdDict[groupId];
+                        foreach(var attrId in attrIds)
+                        {
+                            int attrValue = 0;
+                            if(jadeDynastyLegendValueDict.ContainsKey(attrId))
+                            {
+                                attrValue = jadeDynastyLegendValueDict[attrId];
+                            }
+                            attrDict.Add(attrId,attrValue);
+                        }
+                        return true;
+                    }
+                }
+               
+            }
+            return false;
+        }
+
+        public bool TryGetJadeDyanastyLegendColorType(int attrId,int attrValue,out int colorType)
+        {
+            colorType = 0;
+            if(jadeDynastyLegendColorDict.ContainsKey(attrId))
+            {
+                var colorRanges = jadeDynastyLegendColorDict[attrId];
+                foreach(var key in colorRanges.Keys)
+                {
+                    if (attrValue <= key)
+                    {
+                        colorType = colorRanges[key];
+                        return true;
+                    }
+                }
+            }
+            return false;
+        }
+
+        public bool TryGetJadeDyanastyLegendColor(int colorType,out string color)
+        {
+            color = string.Empty;
+            return jadeDynastyColorDict.TryGetValue(colorType,out color);
+        }
+
+        public int GetJadeDynastyLegendValue(int attrId)
+        {
+            int attrValue = 0;
+            jadeDynastyLegendValueDict.TryGetValue(attrId,out attrValue);
+            return attrValue;
+        }
+        #endregion
+
         #endregion
 
         /// <summary>
@@ -1085,17 +1289,18 @@
             {
                 attrData.SetTipsFuncBtn(ItemWinBtnType.sell, (ItemWinBtnType, ItemAttrData) => { PackSendQuestMgr.Instance.SendSellQuest(ItemWinBtnType.sell, attrData); });
             }
-            List<int> dismantleReturnlist = attrData.GetUseDataModel((int)ItemUseDataKey.Def_IudetItemDecompound);
-            if (dismantleReturnlist != null && dismantleReturnlist.Count > 0)
-            {
-                attrData.SetTipsFuncBtn(ItemWinBtnType.dismantle, (ItemWinBtnType, ItemAttrData) => { PackSendQuestMgr.Instance.SendDismantleQuest(ItemWinBtnType.dismantle, attrData); });
-            }
+            //List<int> dismantleReturnlist = attrData.GetUseDataModel((int)ItemUseDataKey.Def_IudetItemDecompound);
+            //if (dismantleReturnlist != null && dismantleReturnlist.Count > 0)
+            //{
+            //    attrData.SetTipsFuncBtn(ItemWinBtnType.dismantle, (ItemWinBtnType, ItemAttrData) => { PackSendQuestMgr.Instance.SendDismantleQuest(ItemWinBtnType.dismantle, attrData); });
+            //}
 
             if (!isOverdue)
             {
                 if (attrData.itemConfig.JumpComposeCondi != null && attrData.itemConfig.JumpComposeCondi.Length > 0)
                 {
-                    attrData.SetTipsFuncBtn(ItemWinBtnType.compose, (ItemWinBtnType, ItemAttrData) => {
+                    attrData.SetTipsFuncBtn(ItemWinBtnType.compose, (ItemWinBtnType, ItemAttrData) =>
+                    {
                         int jumpId = 0;
                         bool isUnlock = ModelCenter.Instance.GetModel<ComposeWinModel>().CheckComposeItemById(attrData.itemId, out jumpId);
                         if (isUnlock)
@@ -1105,57 +1310,58 @@
                     });
                 }
 
-                if (attrData.itemConfig.Type == 25 && attrData.itemConfig.Effect1 == 225)
-                {
-                    attrData.SetTipsFuncBtn(ItemWinBtnType.inlay, (ItemWinBtnType, ItemAttrData) => { PackSendQuestMgr.Instance.ClickInlayBtn(ItemWinBtnType.inlay, attrData.guid); });
-                }
+                //    if (attrData.itemConfig.Type == 25 && attrData.itemConfig.Effect1 == 225)
+                //    {
+                //        attrData.SetTipsFuncBtn(ItemWinBtnType.inlay, (ItemWinBtnType, ItemAttrData) => { PackSendQuestMgr.Instance.ClickInlayBtn(ItemWinBtnType.inlay, attrData.guid); });
+                //    }
 
-                if (attrData.itemConfig.CanTrade == 1 && attrData.isBind == 0)
-                {
-                    attrData.SetTipsFuncBtn(ItemWinBtnType.putAway, (ItemWinBtnType, ItemAttrData) => { PackSendQuestMgr.Instance.SendPutAwayQuest(ItemWinBtnType.putAway, attrData.guid); });
-                }
-            }
+                //    if (attrData.itemConfig.CanTrade == 1 && attrData.isBind == 0)
+                //    {
+                //        attrData.SetTipsFuncBtn(ItemWinBtnType.putAway, (ItemWinBtnType, ItemAttrData) => { PackSendQuestMgr.Instance.SendPutAwayQuest(ItemWinBtnType.putAway, attrData.guid); });
+                //    }
+                //}
 
-            if (attrData.count > 1)
-            {
-                attrData.SetTipsFuncBtn(ItemWinBtnType.split, (ItemWinBtnType, ItemAttrData) => { PackSendQuestMgr.Instance.OnClickSplitBtn(ItemWinBtnType.split, attrData.guid); });
-            }
+                //if (attrData.count > 1)
+                //{
+                //    attrData.SetTipsFuncBtn(ItemWinBtnType.split, (ItemWinBtnType, ItemAttrData) => { PackSendQuestMgr.Instance.OnClickSplitBtn(ItemWinBtnType.split, attrData.guid); });
+                //}
 
-            if (!isOverdue)
-            {
-                switch (attrData.winType)
+                if (!isOverdue)
                 {
-                    case ItemWinType.equipWin:
-                        attrData.SetTipsFuncBtn(ItemWinBtnType.putOn, (ItemWinBtnType, ItemAttrData) => { PackSendQuestMgr.Instance.SendPutOnQuest(ItemWinBtnType.putOn, attrData.guid); });
-                        break;
-                }
-
-                if (attrData.itemConfig.UseTag == 1)
-                {
-                    attrData.SetTipsFuncBtn(ItemWinBtnType.makeUse, (ItemWinBtnType, ItemAttrData) => { PackSendQuestMgr.Instance.SendUseItemQuest(ItemWinBtnType.makeUse, attrData.index); });
-                }
-            }
-
-            for (int i = 0; i < ItemRenewalIds.Length; i++)
-            {
-                if (ItemRenewalIds[i] == attrData.itemId)
-                {
-                    if (isOverdue)
+                    switch (attrData.winType)
                     {
-                        attrData.SetTipsFuncBtn(ItemWinBtnType.renewal, (ItemWinBtnType, ItemAttrData) => { PackSendQuestMgr.Instance.SendRenewalQuest(ItemWinBtnType.renewal, attrData.guid); });
+                        case ItemWinType.equipWin:
+                            attrData.SetTipsFuncBtn(ItemWinBtnType.putOn, (ItemWinBtnType, ItemAttrData) => { PackSendQuestMgr.Instance.SendPutOnQuest(ItemWinBtnType.putOn, attrData.guid); });
+                            break;
                     }
-                }
-            }
 
-            for (int i = 0; i < tryPutOnEquipIds.Length; i++)
-            {
-                if (tryPutOnEquipIds[i] == attrData.itemId)
-                {
-                    if (PlayerDatas.Instance.baseData.coinPointTotal <= 0)
-                    {
-                        attrData.SetTipsFuncBtn(ItemWinBtnType.renewal, (ItemWinBtnType, ItemAttrData) => { WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.FirstRecharge); });
-                    }
+                    //if (attrData.itemConfig.UseTag == 1)
+                    //{
+                    //    attrData.SetTipsFuncBtn(ItemWinBtnType.makeUse, (ItemWinBtnType, ItemAttrData) => { PackSendQuestMgr.Instance.SendUseItemQuest(ItemWinBtnType.makeUse, attrData.index); });
+                    //}
                 }
+
+                //for (int i = 0; i < ItemRenewalIds.Length; i++)
+                //{
+                //    if (ItemRenewalIds[i] == attrData.itemId)
+                //    {
+                //        if (isOverdue)
+                //        {
+                //            attrData.SetTipsFuncBtn(ItemWinBtnType.renewal, (ItemWinBtnType, ItemAttrData) => { PackSendQuestMgr.Instance.SendRenewalQuest(ItemWinBtnType.renewal, attrData.guid); });
+                //        }
+                //    }
+                //}
+
+                //for (int i = 0; i < tryPutOnEquipIds.Length; i++)
+                //{
+                //    if (tryPutOnEquipIds[i] == attrData.itemId)
+                //    {
+                //        if (PlayerDatas.Instance.baseData.coinPointTotal <= 0)
+                //        {
+                //            attrData.SetTipsFuncBtn(ItemWinBtnType.renewal, (ItemWinBtnType, ItemAttrData) => { WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.FirstRecharge); });
+                //        }
+                //    }
+                //}
             }
         }
 
@@ -1464,6 +1670,16 @@
             return s;
         }
 
+        public string GetJadeDynastyAttrCntPreview(ItemAttrData attrData)
+        {
+            int minCount = 0;
+            int maxCount = 0;
+            TryGetJadeDynastyLegendCount(attrData.itemId,out minCount,out maxCount);
+            string countSB = StringUtility.Contact(minCount,"-",maxCount);
+            string s = Language.Get("LegendAttPreview_MightTitle", countSB);
+            return s;
+        }
+
         public string GetDogzLegendAttrCntPreview(ItemAttrData attrData)
         {
             string s = "";
@@ -1553,10 +1769,11 @@
             attrDict.Clear();
             int i = 0;
             attrSB.Length = 0;
-
             for (i = 0; i < idlist.Count; i++)
             {
-                attrDict.Add(idlist[i], valuelist[i]);
+                int attrId = idlist[i];
+                int attrValue = valuelist[i];
+                attrDict.Add(attrId,attrValue);
             }
 
             switch (itemConfig.EquipPlace)
@@ -1574,6 +1791,8 @@
                 case 9:
                 case 10:
                 case 12:
+                    idlist.Sort(CompareLegendAttrType);
+                    break;
                 case 121:
                 case 122:
                 case 123:
@@ -1586,7 +1805,7 @@
                 case 130:
                 case 131:
                 case 132:
-                    idlist.Sort(CompareLegendAttrType);
+                    idlist.Sort(CompareJadeDynastyLegendColorType);
                     break;
                 case 101:
                 case 102:
@@ -1599,182 +1818,215 @@
 
             for (i = 0; i < idlist.Count; i++)
             {
-                playerProModel = Config.Instance.Get<PlayerPropertyConfig>(idlist[i]);
-                if (playerProModel != null)
+                var attrId = idlist[i];
+                var packType = GeneralDefine.GetPackTypeByItemType(itemConfig.Type);
+                switch(packType)
                 {
-                    string s = "";
-                    if (playerProModel.Name.Contains("%s"))
-                    {
-                        if(!isPreview)
-                        {
-                            s = playerProModel.Name.Replace("%s", GetProValueTypeStr(playerProModel, attrDict[idlist[i]]));
-                        }
-                        else
-                        {
-                            if(itemConfig.EquipPlace != (int)RoleEquipType.retWing)
-                            {
-                                if (isCustom || itemConfig.StarLevel >= 3)
-                                {
-                                    s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name.Replace("%s", GetProValueTypeStr(playerProModel, attrDict[idlist[i]])));
-                                }
-                                else
-                                {
-                                    s = StringUtility.Contact(Language.Get("LegendAttPreview_Might"), playerProModel.Name.Replace("%s", GetProValueTypeStr(playerProModel, attrDict[idlist[i]])));
-                                }
-                            }
-                            else
-                            {
-                                if(isCustom)
-                                {
-                                    s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name.Replace("%s", GetProValueTypeStr(playerProModel, attrDict[idlist[i]])));
-                                }
-                                else if(wingsLegendAttrCntPreviewDict.ContainsKey(itemConfig.LV))
-                                {
-                                    int minValue = 0;
-                                    int maxValue = 0;
-                                    if(wingsLegendAttrValuePreviewDict.ContainsKey(itemConfig.LV))
-                                    {
-                                        if(wingsLegendAttrValuePreviewDict[itemConfig.LV].ContainsKey(idlist[i]))
-                                        {
-                                            List<int> attrValuelist = wingsLegendAttrValuePreviewDict[itemConfig.LV][idlist[i]];
-                                            minValue = attrValuelist[0];
-                                            maxValue = attrValuelist[attrValuelist.Count - 1];
-                                        }
-                                    }
-                                    if(wingsLegendAttrCntPreviewDict[itemConfig.LV] > 1)
-                                    {
-                                        s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name.Replace("%s",StringUtility.Contact("[",GetProValueTypeStr(playerProModel,minValue),"~", StringUtility.Contact(GetProValueTypeStr(playerProModel,maxValue)), "]")));
-                                    }
-                                    else
-                                    {
-                                        s = StringUtility.Contact(Language.Get("LegendAttPreview_Might"), playerProModel.Name.Replace("%s", StringUtility.Contact("[",GetProValueTypeStr(playerProModel, minValue), "~", StringUtility.Contact(GetProValueTypeStr(playerProModel, maxValue)),"]")));
-                                    }
-                                }
-
-                            }
-                          
-                        }
-                       
-                    }
-                    else
-                    {
-                        if(!isPreview)
-                        {
-                            s = playerProModel.Name + "+" + GetProValueTypeStr(playerProModel, attrDict[idlist[i]]);
-                        }
-                        else
-                        {
-                            if (itemConfig.EquipPlace != (int)RoleEquipType.retWing)
-                            {
-                                if (isCustom || itemConfig.StarLevel >= 3)
-                                {
-                                    s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name, "+", GetProValueTypeStr(playerProModel, attrDict[idlist[i]]));
-                                }
-                                else
-                                {
-                                    s = StringUtility.Contact(Language.Get("LegendAttPreview_Might"), playerProModel.Name, "+", GetProValueTypeStr(playerProModel, attrDict[idlist[i]]));
-                                }
-                            }
-                            else
-                            {
-                                if (isCustom)
-                                {
-                                    s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name,"+", GetProValueTypeStr(playerProModel, attrDict[idlist[i]]));
-                                }
-                                else if (wingsLegendAttrCntPreviewDict.ContainsKey(itemConfig.LV))
-                                {
-                                    int minValue = 0;
-                                    int maxValue = 0;
-                                    if (wingsLegendAttrValuePreviewDict.ContainsKey(itemConfig.LV))
-                                    {
-                                        if (wingsLegendAttrValuePreviewDict[itemConfig.LV].ContainsKey(idlist[i]))
-                                        {
-                                            List<int> attrValuelist = wingsLegendAttrValuePreviewDict[itemConfig.LV][idlist[i]];
-                                            minValue = attrValuelist[0];
-                                            maxValue = attrValuelist[attrValuelist.Count - 1];
-                                        }
-                                    }
-                                    if (wingsLegendAttrCntPreviewDict[itemConfig.LV] > 1)
-                                    {
-                                        s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name,"[+", StringUtility.Contact(GetProValueTypeStr(playerProModel, minValue), "~", StringUtility.Contact(GetProValueTypeStr(playerProModel, maxValue)),"]"));
-                                    }
-                                    else
-                                    {
-                                        s = StringUtility.Contact(Language.Get("LegendAttPreview_Might"), playerProModel.Name,"[+",StringUtility.Contact(GetProValueTypeStr(playerProModel, minValue), "~", StringUtility.Contact(GetProValueTypeStr(playerProModel, maxValue)),"]"));
-                                    }
-                                }
-
-                            }
-
-                        }
-                     
-                    }
-
-                    switch (itemConfig.EquipPlace)
-                    {
-                        case 11:
-                            foreach (var key in wingsLegendAttrColorDict.Keys)
-                            {
-                                if (key == idlist[i])
-                                {
-                                    foreach (var key2 in wingsLegendAttrColorDict[key].Keys)
-                                    {
-                                        if (attrDict[idlist[i]] < key2)
-                                        {
-                                            s = string.Format("<color=#{0}>{1}</color>", wingsLegendAttrColorDict[key][key2], s);
-                                            break;
-                                        }
-                                    }
-                                    break;
-                                }
-                            }
-                            break;
-                        case 1:
-                        case 2:
-                        case 3:
-                        case 4:
-                        case 5:
-                        case 6:
-                        case 7:
-                        case 8:
-                        case 9:
-                        case 10:
-                        case 12:
-                        case 121:
-                        case 122:
-                        case 123:
-                        case 124:
-                        case 125:
-                        case 126:
-                        case 127:
-                        case 128:
-                        case 129:
-                        case 130:
-                        case 131:
-                        case 132:
-                            s = GetTextColorByLegendType(GetLegendType(idlist[i]), s);
-                            break;
-                        case 101:
-                        case 102:
-                        case 103:
-                        case 104:
-                        case 105:
-                            s = GetTextColorByLegendType(GetDogzLegendType(idlist[i]), s);
-                            break;
-                    }
-
-                    if (attrSB.Length <= 0)
-                    {
-                        attrSB.Append(s);
-                    }
-                    else
-                    {
-                        attrSB.Append("\n" + s);
-                    }
-
+                    case PackType.rptJadeDynastyItem:
+                        SetJadeDynastyLengend(itemConfig,attrId);
+                        break;
+                    default:
+                        SetNormalPackLengend(itemConfig,attrId,isCustom,isPreview);
+                        break;
                 }
             }
             return attrSB.ToString();
+        }
+
+        private void SetNormalPackLengend(ItemConfig itemConfig, int attrId, bool isCustom,bool isPreview)
+        {
+            playerProModel = Config.Instance.Get<PlayerPropertyConfig>(attrId);
+            if (playerProModel != null)
+            {
+                string s = "";
+                if (playerProModel.Name.Contains("%s"))
+                {
+                    if (!isPreview)
+                    {
+                        s = playerProModel.Name.Replace("%s", GetProValueTypeStr(playerProModel, attrDict[attrId]));
+                    }
+                    else
+                    {
+                        if (itemConfig.EquipPlace != (int)RoleEquipType.retWing)
+                        {
+                            if (isCustom || itemConfig.StarLevel >= 3)
+                            {
+                                s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name.Replace("%s", GetProValueTypeStr(playerProModel, attrDict[attrId])));
+                            }
+                            else
+                            {
+                                s = StringUtility.Contact(Language.Get("LegendAttPreview_Might"), playerProModel.Name.Replace("%s", GetProValueTypeStr(playerProModel, attrDict[attrId])));
+                            }
+                        }
+                        else
+                        {
+                            if (isCustom)
+                            {
+                                s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name.Replace("%s", GetProValueTypeStr(playerProModel, attrDict[attrId])));
+                            }
+                            else if (wingsLegendAttrCntPreviewDict.ContainsKey(itemConfig.LV))
+                            {
+                                int minValue = 0;
+                                int maxValue = 0;
+                                if (wingsLegendAttrValuePreviewDict.ContainsKey(itemConfig.LV))
+                                {
+                                    if (wingsLegendAttrValuePreviewDict[itemConfig.LV].ContainsKey(attrId))
+                                    {
+                                        List<int> attrValuelist = wingsLegendAttrValuePreviewDict[itemConfig.LV][attrId];
+                                        minValue = attrValuelist[0];
+                                        maxValue = attrValuelist[attrValuelist.Count - 1];
+                                    }
+                                }
+                                if (wingsLegendAttrCntPreviewDict[itemConfig.LV] > 1)
+                                {
+                                    s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name.Replace("%s", StringUtility.Contact("[", GetProValueTypeStr(playerProModel, minValue), "~", StringUtility.Contact(GetProValueTypeStr(playerProModel, maxValue)), "]")));
+                                }
+                                else
+                                {
+                                    s = StringUtility.Contact(Language.Get("LegendAttPreview_Might"), playerProModel.Name.Replace("%s", StringUtility.Contact("[", GetProValueTypeStr(playerProModel, minValue), "~", StringUtility.Contact(GetProValueTypeStr(playerProModel, maxValue)), "]")));
+                                }
+                            }
+
+                        }
+
+                    }
+
+                }
+                else
+                {
+                    if (!isPreview)
+                    {
+                        s = playerProModel.Name + "+" + GetProValueTypeStr(playerProModel, attrDict[attrId]);
+                    }
+                    else
+                    {
+                        if (itemConfig.EquipPlace != (int)RoleEquipType.retWing)
+                        {
+                            if (isCustom || itemConfig.StarLevel >= 3)
+                            {
+                                s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name, "+", GetProValueTypeStr(playerProModel, attrDict[attrId]));
+                            }
+                            else
+                            {
+                                s = StringUtility.Contact(Language.Get("LegendAttPreview_Might"), playerProModel.Name, "+", GetProValueTypeStr(playerProModel, attrDict[attrId]));
+                            }
+                        }
+                        else
+                        {
+                            if (isCustom)
+                            {
+                                s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name, "+", GetProValueTypeStr(playerProModel, attrDict[attrId]));
+                            }
+                            else if (wingsLegendAttrCntPreviewDict.ContainsKey(itemConfig.LV))
+                            {
+                                int minValue = 0;
+                                int maxValue = 0;
+                                if (wingsLegendAttrValuePreviewDict.ContainsKey(itemConfig.LV))
+                                {
+                                    if (wingsLegendAttrValuePreviewDict[itemConfig.LV].ContainsKey(attrId))
+                                    {
+                                        List<int> attrValuelist = wingsLegendAttrValuePreviewDict[itemConfig.LV][attrId];
+                                        minValue = attrValuelist[0];
+                                        maxValue = attrValuelist[attrValuelist.Count - 1];
+                                    }
+                                }
+                                if (wingsLegendAttrCntPreviewDict[itemConfig.LV] > 1)
+                                {
+                                    s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name, "[+", StringUtility.Contact(GetProValueTypeStr(playerProModel, minValue), "~", StringUtility.Contact(GetProValueTypeStr(playerProModel, maxValue)), "]"));
+                                }
+                                else
+                                {
+                                    s = StringUtility.Contact(Language.Get("LegendAttPreview_Might"), playerProModel.Name, "[+", StringUtility.Contact(GetProValueTypeStr(playerProModel, minValue), "~", StringUtility.Contact(GetProValueTypeStr(playerProModel, maxValue)), "]"));
+                                }
+                            }
+
+                        }
+
+                    }
+
+                }
+
+                switch (itemConfig.EquipPlace)
+                {
+                    case 11:
+                        foreach (var key in wingsLegendAttrColorDict.Keys)
+                        {
+                            if (key == attrId)
+                            {
+                                foreach (var key2 in wingsLegendAttrColorDict[key].Keys)
+                                {
+                                    if (attrDict[attrId] < key2)
+                                    {
+                                        s = string.Format("<color=#{0}>{1}</color>", wingsLegendAttrColorDict[key][key2], s);
+                                        break;
+                                    }
+                                }
+                                break;
+                            }
+                        }
+                        break;
+                    case 1:
+                    case 2:
+                    case 3:
+                    case 4:
+                    case 5:
+                    case 6:
+                    case 7:
+                    case 8:
+                    case 9:
+                    case 10:
+                    case 12:
+                        s = GetTextColorByLegendType(GetLegendType(attrId), s);
+                        break;
+                    case 101:
+                    case 102:
+                    case 103:
+                    case 104:
+                    case 105:
+                        s = GetTextColorByLegendType(GetDogzLegendType(attrId), s);
+                        break;
+                }
+
+                if (attrSB.Length <= 0)
+                {
+                    attrSB.Append(s);
+                }
+                else
+                {
+                    attrSB.Append("\n" + s);
+                }
+
+            }
+        }
+
+        private void SetJadeDynastyLengend(ItemConfig itemConfig, int attrId)
+        {
+            playerProModel = Config.Instance.Get<PlayerPropertyConfig>(attrId);
+            if (playerProModel != null)
+            {
+                string s = "";
+                if (playerProModel.Name.Contains("%s"))
+                {
+                    s = playerProModel.Name.Replace("%s", GetProValueTypeStr(playerProModel, attrDict[attrId]));
+                }
+                else
+                {
+                    s = playerProModel.Name + "+" + GetProValueTypeStr(playerProModel, attrDict[attrId]);
+                }
+                int colorType = 0;
+                TryGetJadeDyanastyLegendColorType(attrId, attrDict[attrId],out colorType);
+                s = GetTextColorByColorType(colorType,s);
+
+                if (attrSB.Length <= 0)
+                {
+                    attrSB.Append(s);
+                }
+                else
+                {
+                    attrSB.Append("\n" + s);
+                }
+
+            }
         }
 
         private int CompareLegendAttrType(int start, int end)
@@ -1786,11 +2038,24 @@
             return 0;
         }
 
+        private int CompareJadeDynastyLegendColorType(int start,int end)
+        {
+            int value1 = attrDict[start];
+            int value2 = attrDict[end];
+            int colorType1 = 0;
+            int colorType2 = 0;
+            TryGetJadeDyanastyLegendColorType(start,value1,out colorType1);
+            TryGetJadeDyanastyLegendColorType(end,value2,out colorType2);
+            if (colorType1.CompareTo(colorType2) != 0) return -colorType1.CompareTo(colorType2);
+
+            return 0;
+        }
+
         private int CompareDogzLegendAttrType(int start, int end)
         {
             int type1 = GetDogzLegendType(start);
             int type2 = GetDogzLegendType(end);
-            if (type1.CompareTo(type2) != 0) return type1.CompareTo(type2);
+            if (type1.CompareTo(type2) != 0) return -type1.CompareTo(type2);
 
             return 0;
         }
@@ -1832,6 +2097,14 @@
 
             }
             return msg;
+        }
+
+        private string GetTextColorByColorType(int colorType, string msg)
+        {
+            string colorSB = string.Empty;
+            TryGetJadeDyanastyLegendColor(colorType,out colorSB);
+            string s = StringUtility.Contact("<color=#",colorSB,">",msg, "</color>");
+            return s;
         }
         #endregion
 
@@ -2602,6 +2875,15 @@
                             SetDogzEquipLegendAttrPreview(out legendIdlist, out legendValuelist);
                             break;
                     }
+
+                    var packType = GeneralDefine.GetPackTypeByItemType(itemConfig.Type);
+                    switch(packType)
+                    {
+                        case PackType.rptJadeDynastyItem:
+                            SetJadeDynastyEquipLegendAttrPreview(out legendIdlist,out legendValuelist);
+                            break;
+                    }
+
                     if(legendIdlist != null && legendValuelist != null)
                     {
                         if (legendIdlist.Count == legendValuelist.Count)
@@ -2787,6 +3069,13 @@
             }
         }
 
+        private void SetJadeDynastyEquipLegendAttrPreview(out List<int> legendIdlist, out List<int> legendValuelist)
+        {
+            Dictionary<int, int> attrDict = null;
+            itemTipsModel.TryGetJadeDynastyLegendAttr(itemId,out attrDict);
+            legendIdlist = attrDict.Keys.ToList();
+            legendValuelist = attrDict.Values.ToList();
+        }
 
         private StringBuilder _extraInfoBuider = new StringBuilder();
         private StringBuilder _allInfoDesBuider = new StringBuilder();

--
Gitblit v1.8.0