From d3d0662762f352caae67198e5e2a1e4e5d856b5c Mon Sep 17 00:00:00 2001
From: client_Zxw <826696702@qq.com>
Date: 星期五, 04 一月 2019 17:28:11 +0800
Subject: [PATCH] 5693 【1.4.100】坐骑丹使用跳转选中优化

---
 System/Mount/PlayerMountDatas.cs |   83 +++++++++++++++++++++++++++++++++++++----
 1 files changed, 74 insertions(+), 9 deletions(-)

diff --git a/System/Mount/PlayerMountDatas.cs b/System/Mount/PlayerMountDatas.cs
index a405961..b99f9f5 100644
--- a/System/Mount/PlayerMountDatas.cs
+++ b/System/Mount/PlayerMountDatas.cs
@@ -332,22 +332,23 @@
         }
         int GetMinLV = 100;
         int GetMountID = 0;
-        for (int j = 0; j < SortMount.Count; j++)//閫夊彇鍑哄彲鍗囩骇鍧愰獞绛夌骇鏈�浣庝笖鏈夋湭婵�娲绘妧鑳界殑鍧愰獞
+        List<int> IntListSkill = new List<int>();
+        for (int j = 0; j < SortMount.Count; j++)//閫夊彇鍑哄彲鍗囩骇鍧愰獞绛夌骇鏈�浣庝笖鏈夋湭婵�娲绘妧鑳界殑鍧愰獞鍒囩粡楠屾渶灏�
         {
             int Id = SortMount[j].HorseID;
             int GetHorseMaxLv = GetMountSkillMaxLV(Id);
             if (IntList.Contains(Id) && _DicHorse.ContainsKey(Id))
             {
-                if (_DicHorse[Id].Lv < GetMinLV && _DicHorse[Id].Lv< GetHorseMaxLv)
+                if (_DicHorse[Id].Lv < GetHorseMaxLv)
                 {
-                    GetMinLV = _DicHorse[Id].Lv;
-                    GetMountID = Id;
+                    IntListSkill.Add(Id);
                 }
             }
         }
-        if (GetMountID != 0 && ASingleFeedRedPoint.ContainsKey(GetMountID))
+        int SkillHorseId = GetRedPointMountID(IntListSkill);
+        if (SkillHorseId != 0 && ASingleFeedRedPoint.ContainsKey(SkillHorseId))
         {
-            ASingleFeedRedPoint[GetMountID].state = RedPointState.Simple;
+            ASingleFeedRedPoint[SkillHorseId].state = RedPointState.Simple;
             return;
         }
 
@@ -372,7 +373,7 @@
     }
 
     public int GetMinExpMount()
-    {    
+    {
         foreach (var key in ASingleFeedRedPoint.Keys)//褰撳瓨鍦ㄩ┋鍏荤孩鐐规椂閫変腑褰撴湁绾㈢偣鐨勯偅鍙�
         {
             if (ASingleFeedRedPoint[key].state == RedPointState.Simple)
@@ -382,11 +383,25 @@
         }
         int GetMountID = 0;
         int MountLV = 999;
-        
+        List<int> IntListSkill = new List<int>();
+        foreach (var key in _DicHorse.Keys)
+        {
+            var mountConfig = Config.Instance.Get<HorseConfig>(key);
+            if (_DicHorse[key].Lv < mountConfig.MaxLV)
+            {
+                IntListSkill.Add(key);
+            }
+        }
+        int SkillHorseId = GetRedPointMountID(IntListSkill);
+        if (SkillHorseId != 0)
+        {
+            GetMountID = SkillHorseId;
+            return GetMountID;
+        }
         foreach (var key in _DicHorse.Keys)//鏃犵孩鐐规椂璺宠浆閫変腑鏈�浣庨樁鏁颁笖鏈弧绾�
         {
             var mountConfig = Config.Instance.Get<HorseConfig>(key);
-            if (_DicHorse[key].Lv < MountLV && _DicHorse[key].Lv< mountConfig.MaxLV)
+            if (_DicHorse[key].Lv < MountLV && _DicHorse[key].Lv < mountConfig.MaxLV)
             {
                 GetMountID = key;
                 MountLV = _DicHorse[key].Lv;
@@ -395,6 +410,56 @@
         return GetMountID;
     }
 
+    private int GetRedPointMountID(List<int> MountList)
+    {
+        int GetSkillMinLv = 999;
+        for (int i = 0; i < MountList.Count; i++)
+        {
+            int SkillminLv = GetSkillLvDis(MountList[i]);
+            if (SkillminLv < GetSkillMinLv)
+            {
+                GetSkillMinLv = SkillminLv;
+            }
+        }
+
+        int mountId = 0;
+        int ExpNumber = 999999999;
+        for (int i = 0; i < MountList.Count; i++)
+        {
+            int SkillLv = GetSkillLvDis(MountList[i]);
+            if (SkillLv > GetSkillMinLv)
+            {
+                continue;
+            }
+            var Hor1 = HorseUpConfig.GetHorseIDAndLV(MountList[i], SkillLv);
+            var Hor2 = HorseUpConfig.GetHorseIDAndLV(MountList[i],_DicHorse[(MountList[i])].Lv);
+            int Exp = Hor1.NeedExpTotal - Hor2.NeedExpTotal - _DicHorse[(MountList[i])].Exp;
+            if (Exp < ExpNumber)
+            {
+                ExpNumber = Exp;
+                mountId = MountList[i];
+            }
+        }
+        return mountId;
+    }
+
+    private int GetSkillLvDis(int MountId)//鑾峰彇绂诲崌绾ф渶杩戠殑鎶�鑳界瓑绾�
+    {
+        int SkillLv = 0;
+        foreach (var key in GetMountSkillAndItem.Keys)
+        {
+            if (_DicHorse.ContainsKey(MountId) && GetMountSkillAndItem[key].HorseID == MountId)
+            {
+                if (GetMountSkillAndItem[key].HorseLV > _DicHorse[MountId].Lv)
+                {
+                    SkillLv = GetMountSkillAndItem[key].HorseLV;
+                    return SkillLv;
+                }
+            }
+        }
+        return SkillLv;
+    }
+
     public int GetMountSkillMaxLV(int MountId)//鑾峰彇鍧愰獞鏈�澶ф妧鑳界瓑绾�
     {
         int SkillLv = 0;

--
Gitblit v1.8.0