From 4dba76710a47cb8c83c5cf7f7b96702c702c5039 Mon Sep 17 00:00:00 2001
From: client_Zxw <826696702@qq.com>
Date: 星期二, 25 九月 2018 20:20:54 +0800
Subject: [PATCH] 3833 【前端】坐骑、灵宠红点优化

---
 System/Pet/PlayerPetDatas.cs     |   41 +++++++++++++-------
 System/Mount/PlayerMountDatas.cs |   29 ++++++++++----
 2 files changed, 48 insertions(+), 22 deletions(-)

diff --git a/System/Mount/PlayerMountDatas.cs b/System/Mount/PlayerMountDatas.cs
index f56a921..c84a6d1 100644
--- a/System/Mount/PlayerMountDatas.cs
+++ b/System/Mount/PlayerMountDatas.cs
@@ -51,7 +51,7 @@
     public int MountStoneItemId = 0;
     public bool IsOk = false;
     public bool IsRedPointSingleFeed = true;
-    public  List<int> ListEffectSkill = new List<int>();
+    public List<int> ListEffectSkill = new List<int>();
     PlayerPackModel _playerPack;
     PlayerPackModel playerPack
     {
@@ -61,9 +61,10 @@
     public bool Wait = true;//绛夊緟鍥炲寘(浣跨敤鍧愰獞涓�)
     public static Action<int, bool> MultipleEvent;
     public static event Action PlayerLoginOKData;
+    private Dictionary<int, int> DicDefaultMount = new Dictionary<int, int>();
     public override void Init()
-    {     
-        ToAddSorting();     
+    {
+        ToAddSorting();
         playerPack.RefreshItemCountAct += OnItemRefreshEvent;
         MountWin.RedPointMountDan += RedPointMountDan;
         MountSkillAndItem();
@@ -75,6 +76,8 @@
         {
             ListEffectSkill.Add(listeffect[i]);
         }
+        string MountRedDotstr = Config.Instance.Get<FuncConfigConfig>("MountPetRedDot").Numerical1;
+        DicDefaultMount = ConfigParse.GetDic<int, int>(MountRedDotstr);
     }
 
     public override void UnInit()
@@ -106,7 +109,7 @@
         foreach (var index in singPack.GetPackModelIndexDict().Keys)
         {
             OnItemRefreshEvent(singPack.packType, index, singPack.GetPackModelIndexDict()[index].itemId);
-        }       
+        }
         if (PlayerLoginOKData != null)
         {
             PlayerLoginOKData();
@@ -278,6 +281,7 @@
 
         int GetMountID = 0;
         int GetMountLv = 0;
+
         for (int i = 0; i < SortMount.Count; i++)
         {
             int horseID = SortMount[i].HorseID;
@@ -300,6 +304,16 @@
         ItemConfig _tagchine = Config.Instance.Get<ItemConfig>(int.Parse(_tagfun.Numerical1));
         HorseConfig horsecon = Config.Instance.Get<HorseConfig>(GetMountID);
         int number = playerPack.GetItemCountByID(PackType.rptItem, _tagchine.ID);
+        foreach (var key in _DicHorse.Keys)//鍥犱负鏈夋垚灏变换鍔¢檺鍒舵墍鏈� 绗竴鍙潗楠戠孩鐐归�昏緫鐗规畩鍐�
+        {
+            if (DicDefaultMount.ContainsKey(key) && DicDefaultMount[key] > _DicHorse[key].Lv
+                && number > 0 && ASingleFeedRedPoint.ContainsKey(key))
+            {
+                ASingleFeedRedPoint[key].state = RedPointState.Simple;
+                return;
+            }
+
+        }
         if (ASingleFeedRedPoint.ContainsKey(GetMountID) && number > 0 && GetMountLv < horsecon.MaxLV)
         {
             if (PlayerDatas.Instance.baseData.LV >= 1500)
@@ -315,7 +329,6 @@
                 ASingleFeedRedPoint[GetMountID].state = RedPointState.Simple;
                 return;
             }
-
         }
     }
 
@@ -349,7 +362,7 @@
         int SkillLv = 0;
         foreach (var key in GetMountSkillAndItem.Keys)
         {
-            if (GetMountSkillAndItem[key].HorseID == MountId) 
+            if (GetMountSkillAndItem[key].HorseID == MountId)
             {
                 if (GetMountSkillAndItem[key].HorseLV > SkillLv)
                 {
@@ -584,7 +597,7 @@
                 Type = 2;
                 return Type;
             }
-        }       
+        }
         if (MainRedDot.Instance.redPointMountFunc.state == RedPointState.Simple)
         {
             Type = 1;
@@ -603,7 +616,7 @@
 
         int maxRank = horseConfig.MaxLV;
         HorseUpConfig cost = HorseUpConfig.GetHorseIDAndLV(mountCode, maxRank);
-        if(cost != null)
+        if (cost != null)
         {
             int[] attrIds = ConfigParse.GetMultipleStr<int>(cost.AttrType);
             int[] attrValues = ConfigParse.GetMultipleStr<int>(cost.AttrValue);
diff --git a/System/Pet/PlayerPetDatas.cs b/System/Pet/PlayerPetDatas.cs
index 8310f78..ef0090d 100644
--- a/System/Pet/PlayerPetDatas.cs
+++ b/System/Pet/PlayerPetDatas.cs
@@ -66,6 +66,7 @@
     public int petUpgradeToolId { get; set; }
 
     public event Action PlayerLoginOkData;
+    private Dictionary<int, int> DicDefaultPet = new Dictionary<int, int>();
 
     public override void Init()
     {
@@ -95,6 +96,8 @@
         {
             ListEffectSkill.Add(listeffect[i]);
         }
+        string PetRedDotstr = Config.Instance.Get<FuncConfigConfig>("MountPetRedDot").Numerical2;
+        DicDefaultPet = ConfigParse.GetDic<int, int>(PetRedDotstr);
     }
 
     public override void UnInit()
@@ -104,7 +107,7 @@
         PetAttributeWin.IsRedPointCultivate -= IsRedPointCultivate;
     }
 
- 
+
 
     public void OnBeforePlayerDataInitialize()
     {
@@ -141,7 +144,7 @@
         if (!Wait)
         {
             TimeSpan timeS = DateTime.Now - dateTimeA;
-            if (timeS.Seconds>= 2f)
+            if (timeS.Seconds >= 2f)
             {
                 Wait = true;
             }
@@ -172,7 +175,7 @@
         }
     }
 
-    public void SendPetTrainQuest(int petIndex,int number)
+    public void SendPetTrainQuest(int petIndex, int number)
     {
         CA704_tagCMPetClassUP _tagCA704 = new CA704_tagCMPetClassUP();
         _tagCA704.PetItemIndex = (byte)petIndex;
@@ -353,10 +356,20 @@
             }
         }
         int itemCount = playerPack.GetItemCountByID(PackType.rptItem, 4151);
+        foreach (var key in _DicPetBack.Keys)//鍥犱负鏈夋垚灏变换鍔¢檺鍒舵墍鏈� 绗竴鍙潗楠戠孩鐐归�昏緫鐗规畩鍐�
+        {
+            if (DicDefaultPet.ContainsKey(key) && DicDefaultPet[key] > _DicPetBack[key].PetClass
+                && itemCount > 0 && CultivateRedPoint.ContainsKey(key))
+            {
+                CultivateRedPoint[key].state = RedPointState.Simple;
+                CanEssence = true;
+                return;
+            }
+        }
         PetInfoConfig petinfo = Config.Instance.Get<PetInfoConfig>(GetPetId);
         if (PlayerDatas.Instance.baseData.LV >= 1500)
         {
-            if (CultivateRedPoint.ContainsKey(GetPetId) && itemCount > 0 && RedPointMaxLv && petinfo.MaxRank> petLv)
+            if (CultivateRedPoint.ContainsKey(GetPetId) && itemCount > 0 && RedPointMaxLv && petinfo.MaxRank > petLv)
             {
                 CultivateRedPoint[GetPetId].state = RedPointState.Simple;
                 CanEssence = true;
@@ -369,7 +382,7 @@
                 CultivateRedPoint[GetPetId].state = RedPointState.Simple;
                 CanEssence = true;
             }
-        }   
+        }
     }
 
     public int GetMinPetLv()
@@ -404,8 +417,8 @@
         PetInfoConfig petInfo = Config.Instance.Get<PetInfoConfig>(PetID);
         if (petInfo != null)
         {
-            curPetUnlocks= ConfigParse.GetMultipleStr<int>(petInfo.SkillUnLock);
-            maxskillLV = curPetUnlocks[(curPetUnlocks.Length)-1];
+            curPetUnlocks = ConfigParse.GetMultipleStr<int>(petInfo.SkillUnLock);
+            maxskillLV = curPetUnlocks[(curPetUnlocks.Length) - 1];
         }
         return maxskillLV;
     }
@@ -519,7 +532,7 @@
                     {
                         Event_H0704Add();
                     }
-                       
+
                 }
                 else
                 {
@@ -658,7 +671,7 @@
         }
     }
 
-    public int  IsPetPanelRedPointState()//鐢ㄤ簬鍒ゆ柇褰撳墠鐏靛疇椤电鏄惁鏈夌孩鐐逛寒璧�
+    public int IsPetPanelRedPointState()//鐢ㄤ簬鍒ゆ柇褰撳墠鐏靛疇椤电鏄惁鏈夌孩鐐逛寒璧�
     {
         int Type = 0;
         foreach (var value in DeblockingRedPoint.Values)
@@ -668,7 +681,7 @@
                 Type = 2;
                 return Type;
             }
-        }      
+        }
         if (MainRedDot.Instance.redPonintPetFunc2.state == RedPointState.Simple)
         {
             Type = 1;
@@ -680,20 +693,20 @@
 
     #region 棰勮瀹犵墿纰庣墖灞炴��
     Dictionary<int, int> petAttrDict = new Dictionary<int, int>();
-    public Dictionary<int,int> GetPetAttrAddDict(int petCode)
+    public Dictionary<int, int> GetPetAttrAddDict(int petCode)
     {
         PetInfoConfig infoConfig = Config.Instance.Get<PetInfoConfig>(petCode);
         petAttrDict.Clear();
         if (infoConfig == null) return petAttrDict;
 
         int maxRank = infoConfig.MaxRank;
-        PetClassCostConfig cost = PetClassCostConfig.GetPetIdAndRank(petCode,maxRank);
+        PetClassCostConfig cost = PetClassCostConfig.GetPetIdAndRank(petCode, maxRank);
         int allAtkAdd = 0;
-        if(cost != null)
+        if (cost != null)
         {
             allAtkAdd = cost.AtkAdd;
         }
-        petAttrDict.Add(7,allAtkAdd);
+        petAttrDict.Add(7, allAtkAdd);
         return petAttrDict;
     }
     #endregion

--
Gitblit v1.8.0