From 72e523a3bde7c345d4a7dbd24d3571328c18d184 Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期三, 15 五月 2019 10:56:36 +0800
Subject: [PATCH] 3335 任务反馈修改

---
 System/MainInterfacePanel/TaskFeedbackModel.cs |   47 ++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/System/MainInterfacePanel/TaskFeedbackModel.cs b/System/MainInterfacePanel/TaskFeedbackModel.cs
index e74cdbf..18796bc 100644
--- a/System/MainInterfacePanel/TaskFeedbackModel.cs
+++ b/System/MainInterfacePanel/TaskFeedbackModel.cs
@@ -79,6 +79,24 @@
                             }
                         }
                         break;
+                    case TaskFeedbackType.ItemCount:
+                        {
+                            var array = LitJson.JsonMapper.ToObject<int[][]>(config.condition);
+                            if (array != null)
+                            {
+                                List<Item> items = new List<Item>();
+                                for (int i = 0; i < array.Length; i++)
+                                {
+                                    items.Add(new Item()
+                                    {
+                                        id = array[i][0],
+                                        count = array[i][1],
+                                    });
+                                }
+                                feedback.items = items;
+                            }
+                        }
+                        break;
                 }
 
                 m_TaskFeedbacks.Add(config.taskId, feedback);
@@ -103,6 +121,7 @@
                     case TaskFeedbackType.ReikiPoint:
                     case TaskFeedbackType.Guide:
                     case TaskFeedbackType.Equip:
+                    case TaskFeedbackType.ItemCount:
                         {
                             int condition = 0;
                             if (IsSatisfyCondition(feedback, out condition))
@@ -211,18 +230,34 @@
                 case TaskFeedbackType.ReikiPoint:
                     return reikiRootModel.GetReikiRootTotalPoint() >= feedback.condition;
                 case TaskFeedbackType.Equip:
-                    var items = packModel.GetItems(PackType.Item, new SinglePack.FilterParams()
                     {
-                        levels = new List<int>() { feedback.equipCondition[0] },
-                        qualitys = new List<int>() { feedback.equipCondition[1] },
-                    });
-                    return items != null && items.Count > 0;
+                        var items = packModel.GetItems(PackType.Item, new SinglePack.FilterParams()
+                        {
+                            levels = new List<int>() { feedback.equipCondition[0] },
+                            qualitys = new List<int>() { feedback.equipCondition[1] },
+                        });
+                        return items != null && items.Count > 0;
+                    }
                 case TaskFeedbackType.Copper:
                     return PlayerDatas.Instance.baseData.allCopper >= (ulong)feedback.condition;
                 case TaskFeedbackType.Guide:
                     return true;
                 case TaskFeedbackType.FightPowerSideTask:
                     return PlayerDatas.Instance.baseData.FightPoint >= feedback.condition;
+                case TaskFeedbackType.ItemCount:
+                    {
+                        if (feedback.items != null)
+                        {
+                            foreach (var item in feedback.items)
+                            {
+                                if (packModel.GetItemCountByID(PackType.Item, item.id) < item.count)
+                                {
+                                    return false;
+                                }
+                            }
+                        }
+                        return true;
+                    }
             }
             return false;
         }
@@ -253,6 +288,7 @@
         public int condition;
         public List<int[]> sideTasks;
         public int[] equipCondition;
+        public List<Item> items;
     }
 
     public enum TaskFeedbackType
@@ -264,6 +300,7 @@
         Copper = 5,
         Guide = 6,
         FightPowerSideTask = 7,
+        ItemCount = 8,
     }
 }
 

--
Gitblit v1.8.0