少年修仙传客户端代码仓库
client_Wu Xijin
2019-06-26 f7fef42a795a17cf96432d122e9edd3b47a92d44
7569 神兽装备传奇属性显示
6个文件已修改
405 ■■■■■ 已修改文件
Core/GameEngine/Model/Config/LegendPropertyValueConfig.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/Config/LegendPropertyValueConfig.cs.meta 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/TelPartialConfig/PartialLegendPropertyValueConfig.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Lua/Gen/LegendPropertyValueConfigWrap.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/ItemTip/ItemTipUtility.cs 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/KnapSack/Logic/LegendPropertyUtility.cs 328 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/Config/LegendPropertyValueConfig.cs
@@ -1,6 +1,6 @@
//--------------------------------------------------------
//    [Author]:           Fish
//    [  Date ]:           Wednesday, May 15, 2019
//    [  Date ]:           Wednesday, June 26, 2019
//--------------------------------------------------------
using System.Collections.Generic;
@@ -18,6 +18,7 @@
    public readonly int ItemClassLV;
    public readonly int ItemColor;
    public readonly int IsSuit;
    public readonly int ItemStarLevel;
    public readonly Int2[] previewValue;
    public readonly int propertyCount;
@@ -41,14 +42,16 @@
            int.TryParse(tables[4],out IsSuit); 
            string[] previewValueStringArray = tables[5].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
            int.TryParse(tables[5],out ItemStarLevel);
            string[] previewValueStringArray = tables[6].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
            previewValue = new Int2[previewValueStringArray.Length];
            for (int i=0;i<previewValueStringArray.Length;i++)
            {
                 Int2.TryParse(previewValueStringArray[i],out previewValue[i]);
            }
            int.TryParse(tables[6],out propertyCount);
            int.TryParse(tables[7],out propertyCount);
        }
        catch (Exception ex)
        {
Core/GameEngine/Model/Config/LegendPropertyValueConfig.cs.meta
@@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: 9b41155b3cd3cfe45aae5364966bac57
timeCreated: 1557892717
timeCreated: 1561527907
licenseType: Pro
MonoImporter:
  serializedVersion: 2
Core/GameEngine/Model/TelPartialConfig/PartialLegendPropertyValueConfig.cs
@@ -9,13 +9,13 @@
    public void OnConfigParseCompleted()
    {
        var key = ItemType * 1000000 + ItemClassLV * 10000 + ItemColor * 100 + IsSuit;
        var key = ItemType * 1000000 + ItemClassLV * 10000 + ItemColor * 100 + IsSuit * 10 + ItemStarLevel;
        previewConfigs[key] = this;
    }
    public static LegendPropertyValueConfig Get(int itemType, int level, int quality, bool suit)
    public static LegendPropertyValueConfig Get(int itemType, int level, int quality, bool suit, int starLevel)
    {
        var key = itemType * 1000000 + level * 10000 + quality * 100 + (suit ? 1 : 0);
        var key = itemType * 1000000 + level * 10000 + quality * 100 + (suit ? 10 : 0) + starLevel;
        return previewConfigs.ContainsKey(key) ? previewConfigs[key] : null;
    }
Lua/Gen/LegendPropertyValueConfigWrap.cs
@@ -118,15 +118,6 @@
                }
                if(gen_param_count == 4&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 1)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3)&& LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 4)) 
                {
                    int _itemType = LuaAPI.xlua_tointeger(L, 1);
                    int _level = LuaAPI.xlua_tointeger(L, 2);
                    int _quality = LuaAPI.xlua_tointeger(L, 3);
                    bool _suit = LuaAPI.lua_toboolean(L, 4);
                        LegendPropertyValueConfig gen_ret = LegendPropertyValueConfig.Get( _itemType, _level, _quality, _suit );
                        translator.Push(L, gen_ret);
                    
                    return 1;
                }
System/ItemTip/ItemTipUtility.cs
@@ -1097,42 +1097,23 @@
            var data = new LegendProperty();
            data.isPreview = true;
            var config = ItemConfig.Get(itemId);
            switch (config.Type)
            {
                case 119:
                case 120:
                case 121:
                case 122:
                case 123:
                    data.trueCount = LegendPropertyUtility.GetDogzPropertyCount(config.ItemColor, config.StarLevel, LegendAttrType.Normal);
                    data.properties = new List<Int2>();
                    var keys = LegendPropertyUtility.GetDogzPlaceProperties(config.EquipPlace);
                    foreach (var key in keys)
                    {
                        var value = LegendPropertyUtility.GetDogzQualityPropertyValue(key, config.ItemColor);
                        data.properties.Add(new Int2(key, value));
                    }
                    break;
                default:
                    if (config.Effect1 == 220)
                    {
                        data.isPreview = false;
                        var appConfig = AppointItemConfig.Get(itemId);
                        data.trueCount = 0;
            var config = ItemConfig.Get(itemId);
            if (config.Effect1 == 220)
            {
                data.isPreview = false;
                var appConfig = AppointItemConfig.Get(itemId);
                data.trueCount = 0;
                        data.properties = new List<Int2>();
                        for (var i = 0; i < appConfig.LegendAttrID.Length; i++)
                        {
                            data.properties.Add(new Int2(appConfig.LegendAttrID[i], appConfig.LegendAttrValue[i]));
                        }
                    }
                    else
                    {
                        data.trueCount = LegendPropertyUtility.GetEquipPropertyCount(itemId);
                        data.properties = LegendPropertyUtility.GetEquipProperties(itemId);
                    }
                    break;
                data.properties = new List<Int2>();
                for (var i = 0; i < appConfig.LegendAttrID.Length; i++)
                {
                    data.properties.Add(new Int2(appConfig.LegendAttrID[i], appConfig.LegendAttrValue[i]));
                }
            }
            else
            {
                data.trueCount = LegendPropertyUtility.GetEquipPropertyCount(itemId);
                data.properties = LegendPropertyUtility.GetEquipProperties(itemId);
            }
            return data;
System/KnapSack/Logic/LegendPropertyUtility.cs
@@ -5,18 +5,9 @@
public class LegendPropertyUtility
{
    static PropertyColor propertyColor;
    static PropertyMap dogzPropertyMap;
    static PropertyCount dogzPropertyCount;
    static QualityPropertyValue dogzQualityPropertyValue;
    public static void Init()
    {
        propertyColor = new PropertyColor("LegendAttrColor");
        dogzPropertyMap = new PropertyMap(FuncConfigConfig.Get("DogzLegendAttrColor").Numerical1,
            FuncConfigConfig.Get("DogzLegendAttrRulePreview").Numerical1);
        dogzPropertyCount = new PropertyCount(FuncConfigConfig.Get("DogzLegendAttrCountPreview").Numerical1);
        dogzQualityPropertyValue = new QualityPropertyValue(FuncConfigConfig.Get("DogzLegendAttrValueByColorPreview").Numerical1);
    }
    public static List<Int2> GetEquipProperties(int itemId)
@@ -27,7 +18,7 @@
            return null;
        }
        var legendPropertyConfig = LegendPropertyValueConfig.Get(config.Type, config.LV, config.ItemColor, config.SuiteiD != 0);
        var legendPropertyConfig = LegendPropertyValueConfig.Get(config.Type, config.LV, config.ItemColor, config.SuiteiD != 0, config.StarLevel);
        if (legendPropertyConfig == null)
        {
            return null;
@@ -44,328 +35,13 @@
            return 0;
        }
        var legendPropertyConfig = LegendPropertyValueConfig.Get(config.Type, config.LV, config.ItemColor, config.SuiteiD != 0);
        var legendPropertyConfig = LegendPropertyValueConfig.Get(config.Type, config.LV, config.ItemColor, config.SuiteiD != 0, config.StarLevel);
        if (legendPropertyConfig == null)
        {
            return 0;
        }
        return legendPropertyConfig.propertyCount;
    }
    public static LegendAttrType GetDogzPropertyType(int propertyId)
    {
        return dogzPropertyMap.GetPropertyType(propertyId);
    }
    public static bool HasDogzPlace(int place)
    {
        return dogzPropertyMap.HasPlace(place);
    }
    public static List<int> GetDogzPlaceProperties(int place)
    {
        return dogzPropertyMap.GetProperties(place);
    }
    public static int GetDogzPropertyCount(int quality, int star, LegendAttrType type)
    {
        return dogzPropertyCount.GetCount(quality, star, type);
    }
    public static int GetDogzQualityPropertyValue(int property, int quality)
    {
        return dogzQualityPropertyValue.GetValue(property, quality);
    }
    public class PropertyColor
    {
        Dictionary<int, Dictionary<int, string>> wingLegendPropertyColors = new Dictionary<int, Dictionary<int, string>>();
        public PropertyColor(string configId)
        {
            var config = FuncConfigConfig.Get(configId);
            var wingColorJsonData = JsonMapper.ToObject(config.Numerical2);
            foreach (var key in wingColorJsonData.Keys)
            {
                var propertyId = int.Parse(key);
                if (!wingLegendPropertyColors.ContainsKey(propertyId))
                {
                    wingLegendPropertyColors[propertyId] = new Dictionary<int, string>();
                }
                var subJson = wingColorJsonData[key];
                var colors = wingLegendPropertyColors[propertyId];
                foreach (var key2 in subJson.Keys)
                {
                    var limit = int.Parse(key2);
                    colors[limit] = subJson[key2][0].ToString();
                }
            }
        }
        public string GetWingPropertyColor(int propertyId, int value)
        {
            if (!wingLegendPropertyColors.ContainsKey(propertyId))
            {
                return "ffffff";
            }
            var colors = wingLegendPropertyColors[propertyId];
            var ienumerator = colors.GetEnumerator();
            ienumerator.MoveNext();
            var color = ienumerator.Current.Value;
            while (ienumerator.MoveNext())
            {
                if (value < ienumerator.Current.Key)
                {
                    color = ienumerator.Current.Value;
                }
                else
                {
                    break;
                }
            }
            return color;
        }
    }
    public class PropertyMap
    {
        Dictionary<int, LegendAttrType> propertyTypes = new Dictionary<int, LegendAttrType>();
        // key 装备位 value 属性ID
        Dictionary<int, List<int>> placeToProperties = new Dictionary<int, List<int>>();
        public PropertyMap(string typeConfig, string placeConfig)
        {
            var json = JsonMapper.ToObject(typeConfig);
            foreach (var item in json.Keys)
            {
                var type = (LegendAttrType)(int.Parse(item) - 1);
                var propertyId = 0;
                int.TryParse(json[item].ToString(), out propertyId);
                propertyTypes[propertyId] = type;
            }
            json = JsonMapper.ToObject(placeConfig);
            foreach (var key in json.Keys)
            {
                var equipPlace = int.Parse(key);
                var properties = new List<int>();
                placeToProperties.Add(equipPlace, properties);
                if (json[key].IsArray)
                {
                    var subJson = json[key];
                    for (var i = 0; i < subJson.Count; i++)
                    {
                        if (subJson[i].IsArray)
                        {
                            for (var j = 0; j < subJson[i].Count; j++)
                            {
                                var propertyId = (int)subJson[i][j];
                                properties.Add(propertyId);
                            }
                        }
                    }
                }
            }
        }
        public bool HasProperty(int propertyId)
        {
            return propertyTypes.ContainsKey(propertyId);
        }
        public LegendAttrType GetPropertyType(int propertyId)
        {
            if (HasProperty(propertyId))
            {
                return propertyTypes[propertyId];
            }
            else
            {
                return LegendAttrType.Normal;
            }
        }
        public bool HasPlace(int place)
        {
            return placeToProperties.ContainsKey(place);
        }
        public List<int> GetProperties(int place)
        {
            if (HasPlace(place))
            {
                return placeToProperties[place];
            }
            else
            {
                return null;
            }
        }
        public List<int> GetProperties(int place, LegendAttrType type)
        {
            if (!HasPlace(place))
            {
                return null;
            }
            var allProperties = placeToProperties[place];
            var properties = new List<int>();
            for (var i = 0; i < allProperties.Count; i++)
            {
                var propertyId = allProperties[i];
                if (propertyTypes[propertyId] == type)
                {
                    properties.Add(propertyId);
                }
            }
            return properties;
        }
    }
    public class PropertyCount
    {
        Dictionary<int, StarPropertyCount> qualityToStarLegendPropertyCounts = new Dictionary<int, StarPropertyCount>();
        public PropertyCount(string config)
        {
            var json = JsonMapper.ToObject(config);
            foreach (var key in json.Keys)
            {
                var quality = int.Parse(key);
                qualityToStarLegendPropertyCounts[quality] = new StarPropertyCount(json[key]);
            }
        }
        public bool Has(int quality)
        {
            return qualityToStarLegendPropertyCounts.ContainsKey(quality);
        }
        public bool Has(int quality, int star)
        {
            if (!qualityToStarLegendPropertyCounts.ContainsKey(quality))
            {
                return false;
            }
            return qualityToStarLegendPropertyCounts[quality].Has(star);
        }
        public int GetCount(int quality, int star, LegendAttrType type)
        {
            if (!Has(quality, star))
            {
                return 0;
            }
            return qualityToStarLegendPropertyCounts[quality].GetCount(star, type);
        }
        class StarPropertyCount
        {
            Dictionary<int, Dictionary<LegendAttrType, int>> counts = new Dictionary<int, Dictionary<LegendAttrType, int>>();
            public StarPropertyCount(JsonData json)
            {
                foreach (var key in json.Keys)
                {
                    var star = int.Parse(key);
                    var typeCounts = counts[star] = new Dictionary<LegendAttrType, int>();
                    var subJson = json[key];
                    if (subJson.IsArray)
                    {
                        for (int i = 0; i < subJson.Count; i++)
                        {
                            var type = (LegendAttrType)(i);
                            typeCounts[type] = (int)subJson[i];
                        }
                    }
                }
            }
            public bool Has(int star)
            {
                return counts.ContainsKey(star);
            }
            public int GetCount(int star, LegendAttrType type)
            {
                if (!counts.ContainsKey(star))
                {
                    return 0;
                }
                if (!counts[star].ContainsKey(type))
                {
                    return 0;
                }
                return counts[star][type];
            }
        }
    }
    public class QualityPropertyValue
    {
        // key 属性ID value 装备品质,属性数值
        Dictionary<int, Dictionary<int, int>> qualityValues = new Dictionary<int, Dictionary<int, int>>();
        public QualityPropertyValue(string config)
        {
            var json = JsonMapper.ToObject(config);
            foreach (var key in json.Keys)
            {
                var propertyId = int.Parse(key);
                var qualityToValue = new Dictionary<int, int>();
                qualityValues.Add(propertyId, qualityToValue);
                var subJson = json[key];
                for (var i = 0; i < subJson.Count; i++)
                {
                    qualityToValue[(int)subJson[i][0]] = (int)subJson[i][1];
                }
            }
        }
        public bool Has(int property)
        {
            return qualityValues.ContainsKey(property);
        }
        public bool Has(int property, int quality)
        {
            if (!qualityValues.ContainsKey(property))
            {
                return false;
            }
            return qualityValues[property].ContainsKey(property);
        }
        public int GetValue(int property, int quality)
        {
            if (Has(property, quality))
            {
                return qualityValues[property][quality];
            }
            else
            {
                return 0;
            }
        }
    }
}