From e71baafc19d2819a14bb930cf17c12cab7157e38 Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期五, 04 一月 2019 14:59:18 +0800
Subject: [PATCH] 5685 【前端】【1.4.100】聚魂一键分解功能红点提醒与逻辑优化

---
 System/GatheringSoul/GatherSoulEquipListWin.cs |   10 +++++++++-
 System/GatheringSoul/GatheringSoulModel.cs     |   28 ++++++++++++++++++++++------
 2 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/System/GatheringSoul/GatherSoulEquipListWin.cs b/System/GatheringSoul/GatherSoulEquipListWin.cs
index 54bff7c..dc835d0 100644
--- a/System/GatheringSoul/GatherSoulEquipListWin.cs
+++ b/System/GatheringSoul/GatherSoulEquipListWin.cs
@@ -136,7 +136,15 @@
             if (cell.index < equipList.Count)
             {
                 var item = equipList[cell.index];
-                model.ExecuteEquipSoul(item, selectHole);
+                GatherSoulItem holeItem;
+                if(model.TryGetItem(selectHole,out holeItem))
+                {
+                    model.TryExecuteReplaceSoul(selectHole, item);
+                }
+                else
+                {
+                    model.ExecuteEquipSoul(item, selectHole);
+                }
                 CloseImmediately();
             }
         }
diff --git a/System/GatheringSoul/GatheringSoulModel.cs b/System/GatheringSoul/GatheringSoulModel.cs
index af7b659..d22a7ed 100644
--- a/System/GatheringSoul/GatheringSoulModel.cs
+++ b/System/GatheringSoul/GatheringSoulModel.cs
@@ -604,11 +604,22 @@
 
         public bool SatisfyReplace(int hole, GatherSoulItem item)
         {
+            if (item.itemType == GATHERSOUL_ESSENCE_TYPE)
+            {
+                return false;
+            }
             GatherSoulItem holeItem;
             if (TryGetItem(hole, out holeItem))
             {
+                var sameHole = IsSamePropertyCompareHoles(hole, item);
+                var multiProperty = false;
+                if (item.ExistSameProperty(holeItem.id))
+                {
+                    multiProperty = gatherSoulPropertys[item.id].Count
+                        > gatherSoulPropertys[holeItem.id].Count;
+                }
                 if (item.itemType == holeItem.itemType
-                    && IsSamePropertyCompareHoles(hole, item) == -1)
+                    && (sameHole == -1 || multiProperty))
                 {
                     return true;
                 }
@@ -899,21 +910,26 @@
                     break;
                 }
             }
-            if (tryEquipHole != -1)
+            TryExecuteReplaceSoul(tryEquipHole, item);
+        }
+
+        public void TryExecuteReplaceSoul(int hole, GatherSoulItem item)
+        {
+            if (hole != -1)
             {
                 GatherSoulItem holeItem;
-                if (TryGetItem(tryEquipHole, out holeItem))
+                if (TryGetItem(hole, out holeItem))
                 {
                     var sameHole = -1;
                     if (gatherSoulPropertys[item.id].Count > gatherSoulPropertys[holeItem.id].Count)
                     {
-                        sameHole = IsSamePropertyCompareHoles(tryEquipHole, item);
+                        sameHole = IsSamePropertyCompareHoles(hole, item);
                     }
                     if (sameHole != -1)
                     {
                         SendEquipPack((int)PackType.rptInterimPack, sameHole, (int)PackType.rptGatherSoul, 0);
                     }
-                    SendEquipPack((int)PackType.rptGatherSoul, item.index, (int)PackType.rptInterimPack, tryEquipHole);
+                    SendEquipPack((int)PackType.rptGatherSoul, item.index, (int)PackType.rptInterimPack, hole);
                 }
             }
             else if (item.itemType == GATHERSOUL_CORE_TYPE)
@@ -930,7 +946,7 @@
                     {
                         SendEquipPack((int)PackType.rptInterimPack, sameHole, (int)PackType.rptGatherSoul, 0);
                     }
-                    SendEquipPack((int)PackType.rptGatherSoul, item.index, (int)PackType.rptInterimPack, tryEquipHole);
+                    SendEquipPack((int)PackType.rptGatherSoul, item.index, (int)PackType.rptInterimPack, hole);
                 }
             }
         }

--
Gitblit v1.8.0