From c9add585a6990f1beecb94a946eaa3f5d27dcbd1 Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期四, 14 三月 2019 14:02:03 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts

---
 System/KnapSack/Logic/LegendPropertyUtility.cs |  162 +++++++++++------------------------------------------
 1 files changed, 34 insertions(+), 128 deletions(-)

diff --git a/System/KnapSack/Logic/LegendPropertyUtility.cs b/System/KnapSack/Logic/LegendPropertyUtility.cs
index a7abc84..2ea6ebd 100644
--- a/System/KnapSack/Logic/LegendPropertyUtility.cs
+++ b/System/KnapSack/Logic/LegendPropertyUtility.cs
@@ -6,71 +6,61 @@
 public class LegendPropertyUtility
 {
     static PropertyColor propertyColor;
-    static PropertyMap equipPropertyMap;
     static PropertyMap dogzPropertyMap;
-    static PropertyCount equipPropertyCount;
     static PropertyCount dogzPropertyCount;
-    static QualityPropertyValue equipQualityPropertyValue;
     static QualityPropertyValue dogzQualityPropertyValue;
-    static LevelPropertyValue equipLevelPropertyValue;
     static WingPropertyCount wingPropertyCount;
     static WingPropertyValue wingPropertyValue;
 
     public static void Init()
     {
         propertyColor = new PropertyColor("LegendAttrColor");
-
-        equipPropertyMap = new PropertyMap(FuncConfigConfig.Get("LegendAttrColor").Numerical1,
-            FuncConfigConfig.Get("LegendAttrRulePreview").Numerical1);
-
         dogzPropertyMap = new PropertyMap(FuncConfigConfig.Get("DogzLegendAttrColor").Numerical1,
             FuncConfigConfig.Get("DogzLegendAttrRulePreview").Numerical1);
-
-        equipPropertyCount = new PropertyCount(FuncConfigConfig.Get("LegendAttrCountPreview").Numerical1);
         dogzPropertyCount = new PropertyCount(FuncConfigConfig.Get("DogzLegendAttrCountPreview").Numerical1);
-
-        equipQualityPropertyValue = new QualityPropertyValue(FuncConfigConfig.Get("LegendAttrValueByColorPreview").Numerical1);
         dogzQualityPropertyValue = new QualityPropertyValue(FuncConfigConfig.Get("DogzLegendAttrValueByColorPreview").Numerical1);
-
-        equipLevelPropertyValue = new LevelPropertyValue(FuncConfigConfig.Get("LegendAttrValueByClassLVPreview").Numerical1);
 
         wingPropertyCount = new WingPropertyCount();
         wingPropertyValue = new WingPropertyValue();
     }
 
+    public static List<Int2> GetEquipProperties(int itemId)
+    {
+        var config = ItemConfig.Get(itemId);
+        if (config == null)
+        {
+            return null;
+        }
+
+        var legendPropertyConfig = LegendPropertyValueConfig.Get(config.Type, config.LV, config.ItemColor, config.SuiteiD != 0);
+        if (legendPropertyConfig == null)
+        {
+            return null;
+        }
+
+        return new List<Int2>(legendPropertyConfig.previewValue);
+    }
+
+    public static int GetEquipPropertyCount(int itemId)
+    {
+        var config = ItemConfig.Get(itemId);
+        if (config == null)
+        {
+            return 0;
+        }
+
+        var legendPropertyConfig = LegendPropertyValueConfig.Get(config.Type, config.LV, config.ItemColor, config.SuiteiD != 0);
+        if (legendPropertyConfig == null)
+        {
+            return 0;
+        }
+
+        return legendPropertyConfig.propertyCount;
+    }
+
     public static string GetWingPropertyColor(int propertyId, int value)
     {
         return propertyColor.GetWingPropertyColor(propertyId, value);
-    }
-
-    public static LegendAttrType GetEquipPropertyType(int propertyId)
-    {
-        return equipPropertyMap.GetPropertyType(propertyId);
-    }
-
-    public static bool HasEquipPlace(int place)
-    {
-        return equipPropertyMap.HasPlace(place);
-    }
-
-    public static bool HasEquipProperty(int place, int propertyId)
-    {
-        if (!HasEquipPlace(place))
-        {
-            return false;
-        }
-
-        return equipPropertyMap.GetProperties(place).Contains(propertyId);
-    }
-
-    public static List<int> GetEquipPlaceProperties(int place)
-    {
-        return equipPropertyMap.GetProperties(place);
-    }
-
-    public static List<int> GetEquipPlaceProperties(int place, LegendAttrType type)
-    {
-        return equipPropertyMap.GetProperties(place);
     }
 
     public static LegendAttrType GetDogzPropertyType(int propertyId)
@@ -83,31 +73,9 @@
         return dogzPropertyMap.HasPlace(place);
     }
 
-    public static bool HasDogzProperty(int place, int propertyId)
-    {
-        if (!HasEquipPlace(place))
-        {
-            return false;
-        }
-
-        return dogzPropertyMap.GetProperties(place).Contains(propertyId);
-    }
-
     public static List<int> GetDogzPlaceProperties(int place)
     {
         return dogzPropertyMap.GetProperties(place);
-    }
-
-    public static int GetEquipPropertyCount(int quality, int star, LegendAttrType type)
-    {
-        return equipPropertyCount.GetCount(quality, star, type);
-    }
-
-    public static int GetEquipPropertyCount(int quality, int star)
-    {
-        return equipPropertyCount.GetCount(quality, star, LegendAttrType.Normal)
-            + equipPropertyCount.GetCount(quality, star, LegendAttrType.Fixed)
-            + equipPropertyCount.GetCount(quality, star, LegendAttrType.Fixed);
     }
 
     public static int GetDogzPropertyCount(int quality, int star, LegendAttrType type)
@@ -115,19 +83,9 @@
         return dogzPropertyCount.GetCount(quality, star, type);
     }
 
-    public static int GetEquipQualityPropertyValue(int property, int quality)
-    {
-        return equipQualityPropertyValue.GetValue(property, quality);
-    }
-
     public static int GetDogzQualityPropertyValue(int property, int quality)
     {
         return dogzQualityPropertyValue.GetValue(property, quality);
-    }
-
-    public static int GetEquipLevelPropertyValue(int property, int level)
-    {
-        return equipLevelPropertyValue.GetValue(property, level);
     }
 
     public static int GetWingPropertyCount(int level)
@@ -448,58 +406,6 @@
                 return 0;
             }
         }
-    }
-
-    public class LevelPropertyValue
-    {
-        // key 灞炴�D value 瑁呭闃剁骇锛屽睘鎬ф暟鍊�
-        Dictionary<int, Dictionary<int, int>> levelValues = new Dictionary<int, Dictionary<int, int>>();
-
-        public LevelPropertyValue(string config)
-        {
-            var json = JsonMapper.ToObject(config);
-            levelValues = new Dictionary<int, Dictionary<int, int>>();
-            foreach (var key in json.Keys)
-            {
-                var propertyId = int.Parse(key);
-                var levelToValue = new Dictionary<int, int>();
-                levelValues.Add(int.Parse(key), levelToValue);
-
-                var subJson = json[key];
-                for (var i = 0; i < subJson.Count; i++)
-                {
-                    levelToValue[(int)subJson[i][0]] = (int)subJson[i][1];
-                }
-            }
-        }
-
-        public bool Has(int property)
-        {
-            return levelValues.ContainsKey(property);
-        }
-
-        public bool Has(int property, int level)
-        {
-            if (!levelValues.ContainsKey(property))
-            {
-                return false;
-            }
-
-            return levelValues[property].ContainsKey(property);
-        }
-
-        public int GetValue(int property, int level)
-        {
-            if (Has(property, level))
-            {
-                return levelValues[property][level];
-            }
-            else
-            {
-                return 0;
-            }
-        }
-
     }
 
     public class WingPropertyCount

--
Gitblit v1.8.0