From ddaa4e2f9ba1c56485e305c335408e072cafc53c Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期四, 08 十一月 2018 14:09:19 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts

---
 System/Compose/New/ComposeWinModel.cs |   61 ++++++++++++++++++++++++++++++
 1 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/System/Compose/New/ComposeWinModel.cs b/System/Compose/New/ComposeWinModel.cs
index b06c50e..6077023 100644
--- a/System/Compose/New/ComposeWinModel.cs
+++ b/System/Compose/New/ComposeWinModel.cs
@@ -186,6 +186,7 @@
     {
         public int thirdType;
         public ItemCompoundConfig itemCompound = null;
+
     }
     #endregion
 
@@ -298,6 +299,66 @@
         indexlist = singlePack.ItemIndexlist(increases[0], increases[1]);
         return true;
     }
+
+    public bool TryGetCountById(NeedMatType matType,ItemCompoundConfig itemCompound,int itemId,out int itemCount)
+    {
+        itemCount = 0;
+        if (itemCompound == null || itemId == 0) return false;
+
+        switch (matType)
+        {
+            case NeedMatType.IncreaseItem:
+                int[] increases = itemCompound.successRateIncrease;
+                if (increases != null && increases.Length >= 3)
+                {
+                    itemCount = increases[1];
+                    return true;
+                }
+                break;
+            case NeedMatType.fixedItem:
+                int[] fixedIds = itemCompound.itemID;
+                int[] fixedCounts = itemCompound.itemCount;
+                int[] fixedDisplays = itemCompound.itemDisplay;
+                if (fixedIds != null)
+                {
+                    for (int i = 0; i < fixedIds.Length; i++)
+                    {
+                        if (fixedIds[i] == itemId)
+                        {
+                            itemCount = fixedCounts[i];
+                            return true;
+                        }
+                    }
+                }
+                break;
+        }
+        return false;
+    }
+
+    public bool TryGetIdByDisplay(NeedMatType matType, ItemCompoundConfig itemCompound, int display, out int itemId)
+    {
+        itemId = 0;
+        if (itemCompound == null || display == 0) return false;
+        switch (matType)
+        {
+            case NeedMatType.fixedItem:
+                int[] fixedIds = itemCompound.itemID;
+                int[] fixedDisplays = itemCompound.itemDisplay;
+                if (fixedDisplays != null)
+                {
+                    for (int i = 0; i < fixedDisplays.Length; i++)
+                    {
+                        if (fixedDisplays[i] == display)
+                        {
+                            itemId = fixedIds[i];
+                            return true;
+                        }
+                    }
+                }
+                break;
+        }
+        return false;
+    }
     #endregion
 
     public bool IsComposeJobLimit(int composeId)

--
Gitblit v1.8.0