From c60913b816a5d3e132ba17b9353df7ad7d1e6e4e Mon Sep 17 00:00:00 2001 From: hch <305670599@qq.com> Date: 星期三, 18 六月 2025 22:20:12 +0800 Subject: [PATCH] 50 【主界面】核心主体 --- Main/System/KnapSack/Logic/ItemLogicUtility.cs | 236 +++++++++++++++++++++++++--------------------------------- 1 files changed, 101 insertions(+), 135 deletions(-) diff --git a/Main/System/KnapSack/Logic/ItemLogicUtility.cs b/Main/System/KnapSack/Logic/ItemLogicUtility.cs index 829d8c5..5d228e6 100644 --- a/Main/System/KnapSack/Logic/ItemLogicUtility.cs +++ b/Main/System/KnapSack/Logic/ItemLogicUtility.cs @@ -213,63 +213,42 @@ } - // public int GetEquipScore(int itemId, Dictionary<int, List<int>> useDataDic = null, bool isPreview = false) - // { - // var config = ItemConfig.Get(itemId); - // if (config == null) return 0; - // if (config.EquipPlace == 0) - // { - // return 0; - // } + public int GetEquipScore(int itemId, Dictionary<int, List<int>> useDataDic = null, bool isPreview = false) + { + var config = ItemConfig.Get(itemId); + if (config == null) return 0; + if (config.EquipPlace == 0) + { + return 0; + } - // var properties = new EquipSorceProperties(); + var properties = new EquipSorceProperties(); - // if (IsCustomItem(itemId)) - // { - // properties.AddBaseProperties(config.EffectValueA1, equipBaseProperties); - // properties.AddCustomProperties(itemId); - // return CalculateEquipScore(config.EffectValueA1, properties); - // } + if (IsCustomItem(itemId)) + { + properties.AddBaseProperties(config.EffectValueA1, equipBaseProperties); + properties.AddCustomProperties(itemId); + return CalculateEquipScore(config.EffectValueA1, properties); + } - // properties.AddBaseProperties(itemId, equipBaseProperties); - // if (isPreview) - // { - // switch ((RoleEquipType)config.EquipPlace) - // { - // case RoleEquipType.Weapon: - // case RoleEquipType.Weapon2: - // case RoleEquipType.Hat: - // case RoleEquipType.Clothes: - // case RoleEquipType.Belt: - // case RoleEquipType.Trousers: - // case RoleEquipType.Shoes: - // case RoleEquipType.Glove: - // case RoleEquipType.Neck: - // case RoleEquipType.FairyCan1: - // case RoleEquipType.FairyCan2: - // case RoleEquipType.Jade: - // properties.AddRange(GetEquipLegendProperties(itemId)); - // break; - // } + properties.AddBaseProperties(itemId, equipBaseProperties); - // return CalculateEquipScore(itemId, properties); - // } - // if (useDataDic != null) - // { - // if (useDataDic.ContainsKey((int)ItemUseDataKey.legendAttrID)) - // { - // properties.AddRange(useDataDic[(int)ItemUseDataKey.legendAttrID], useDataDic[(int)ItemUseDataKey.legendAttrValue]); - // } + if (useDataDic != null) + { + if (useDataDic.ContainsKey((int)ItemUseDataKey.legendAttrID)) + { + properties.AddRange(useDataDic[(int)ItemUseDataKey.legendAttrID], useDataDic[(int)ItemUseDataKey.legendAttrValue]); + } - // if (useDataDic.ContainsKey((int)ItemUseDataKey.outOfPrintAttrID)) - // { - // properties.AddRange(useDataDic[(int)ItemUseDataKey.outOfPrintAttrID], useDataDic[(int)ItemUseDataKey.outOfPrintAttrValue]); - // } - // } + if (useDataDic.ContainsKey((int)ItemUseDataKey.outOfPrintAttrID)) + { + properties.AddRange(useDataDic[(int)ItemUseDataKey.outOfPrintAttrID], useDataDic[(int)ItemUseDataKey.outOfPrintAttrValue]); + } + } - // return CalculateEquipScore(itemId, properties, useDataDic); - // } + return CalculateEquipScore(itemId, properties, useDataDic); + } // private Dictionary<int, int> GetEquipLegendProperties(int itemId) // { @@ -319,103 +298,90 @@ /// <param name="itemId"></param> /// <returns></returns> private Dictionary<PropertyType, float> curEquipAttrDict = new Dictionary<PropertyType, float>(); //瀛樺偍褰撳墠瑁呭灞炴�у搴旂殑鏁板�� key 灞炴�� value 灞炴�у�� - // private int CalculateEquipScore(int itemId, EquipSorceProperties properties, Dictionary<int, List<int>> useDataDic = null) - // { - // var config = ItemConfig.Get(itemId); - // if (config == null || !GeneralDefine.CompareEquipPlaces.Contains(config.EquipPlace)) - // { - // return 0; - // } + private int CalculateEquipScore(int itemId, EquipSorceProperties properties, Dictionary<int, List<int>> useDataDic = null) + { + var config = ItemConfig.Get(itemId); + if (config == null || !GeneralDefine.CompareEquipPlaces.Contains(config.EquipPlace)) + { + return 0; + } - // properties.AddRange(GetEquipShenProperties(itemId)); + //properties.AddRange(GetEquipShenProperties(itemId)); - // var minAttack = properties.ContainsKey((int)PropertyType.MinAtk) ? properties[(int)PropertyType.MinAtk] : 0; - // var maxAttack = properties.ContainsKey((int)PropertyType.MaxAtk) ? properties[(int)PropertyType.MaxAtk] : 0; - // var attack = properties.ContainsKey((int)PropertyType.ATK) ? properties[(int)PropertyType.ATK] : 0; + var minAttack = properties.ContainsKey((int)PropertyType.MinAtk) ? properties[(int)PropertyType.MinAtk] : 0; + var maxAttack = properties.ContainsKey((int)PropertyType.MaxAtk) ? properties[(int)PropertyType.MaxAtk] : 0; + var attack = properties.ContainsKey((int)PropertyType.ATK) ? properties[(int)PropertyType.ATK] : 0; - // properties[(int)PropertyType.MinAtk] = minAttack + attack; - // properties[(int)PropertyType.MaxAtk] = maxAttack + attack; + properties[(int)PropertyType.MinAtk] = minAttack + attack; + properties[(int)PropertyType.MaxAtk] = maxAttack + attack; - // Equation.Instance.Clear(); - // curEquipAttrDict.Clear(); + Equation.Instance.Clear(); + curEquipAttrDict.Clear(); - // var GSProValueDict = EquipGSParamConfig.GetTagGsProValueDict(config.LV, config.ItemColor, config.SuiteiD > 0 ? 1 : 0, config.StarLevel); - // foreach (var key in properties.Keys) - // { - // var attrType = (PropertyType)key; - // switch (attrType) - // { - // case PropertyType.ATKSPEED: - // case PropertyType.OnlyFinalHurt: - // case PropertyType.PVPAtkBackHP: - // case PropertyType.MinAtk: - // case PropertyType.MaxAtk: - // case PropertyType.AddFinalHurt: - // case PropertyType.ReduceFinalHurt: - // curEquipAttrDict.Add(attrType, properties[key]); - // break; - // default: - // if (GSProValueDict != null && GSProValueDict.ContainsKey(attrType)) - // { - // var curProValue = properties[key] * GSProValueDict[attrType]; - // curEquipAttrDict.Add(attrType, curProValue); - // } - // else - // { - // curEquipAttrDict.Add(attrType, properties[key]); - // } - // break; - // } - // } + var GSProValueDict = EquipGSParamConfig.GetTagGsProValueDict(config.LV, config.ItemColor, config.SuiteiD > 0 ? 1 : 0, config.StarLevel); + foreach (var key in properties.Keys) + { + var attrType = (PropertyType)key; + switch (attrType) + { + case PropertyType.ATKSPEED: + case PropertyType.OnlyFinalHurt: + case PropertyType.PVPAtkBackHP: + case PropertyType.MinAtk: + case PropertyType.MaxAtk: + case PropertyType.AddFinalHurt: + case PropertyType.ReduceFinalHurt: + curEquipAttrDict.Add(attrType, properties[key]); + break; + default: + if (GSProValueDict != null && GSProValueDict.ContainsKey(attrType)) + { + var curProValue = properties[key] * GSProValueDict[attrType]; + curEquipAttrDict.Add(attrType, curProValue); + } + else + { + curEquipAttrDict.Add(attrType, properties[key]); + } + break; + } + } - // foreach (var key in curEquipAttrDict.Keys) - // { - // var propertyConfig = PlayerPropertyConfig.Get((int)key); - // if (propertyConfig != null) - // { - // Equation.Instance.AddKeyValue(propertyConfig.Parameter, curEquipAttrDict[key]); - // } - // } + foreach (var key in curEquipAttrDict.Keys) + { + var propertyConfig = PlayerPropertyConfig.Get((int)key); + if (propertyConfig != null) + { + Equation.Instance.AddKeyValue(propertyConfig.Parameter, curEquipAttrDict[key]); + } + } - // var skillScore = 0; - // if (useDataDic != null && useDataDic.ContainsKey((int)ItemUseDataKey.equipSkills)) - // { - // for (int i = 0; i < useDataDic[(int)ItemUseDataKey.equipSkills].Count; i++) - // { - // skillScore += equipSkillScores[useDataDic[(int)ItemUseDataKey.equipSkills][i]]; - // } - // } - // else - // { + var skillScore = 0; + if (useDataDic != null && useDataDic.ContainsKey((int)ItemUseDataKey.equipSkills)) + { + for (int i = 0; i < useDataDic[(int)ItemUseDataKey.equipSkills].Count; i++) + { + skillScore += equipSkillScores[useDataDic[(int)ItemUseDataKey.equipSkills][i]]; + } + } + else + { - // if (config.AddSkill1 != 0 && equipSkillScores.ContainsKey(config.AddSkill1)) - // { - // skillScore += equipSkillScores[config.AddSkill1]; - // } + if (config.AddSkill1 != 0 && equipSkillScores.ContainsKey(config.AddSkill1)) + { + skillScore += equipSkillScores[config.AddSkill1]; + } - // if (config.AddSkill2 != 0 && equipSkillScores.ContainsKey(config.AddSkill2)) - // { - // skillScore += equipSkillScores[config.AddSkill2]; - // } + if (config.AddSkill2 != 0 && equipSkillScores.ContainsKey(config.AddSkill2)) + { + skillScore += equipSkillScores[config.AddSkill2]; + } - // } + } - // var spiritWeaponScore = 0; - // if (SpiritWeaponConfig.Has(itemId)) - // { - // spiritWeaponScore = SpiritWeaponConfig.Get(itemId).AttrScore; - // } - - // if (IsDogzEquip(itemId)) - // { - // return Equation.Instance.Eval<int>(dogzGSFormula); - // } - // else - // { - // return spiritWeaponScore + skillScore + Equation.Instance.Eval<int>(normalGSFormula); - // } - // } + return skillScore + Equation.Instance.Eval<int>(normalGSFormula); + } #endregion -- Gitblit v1.8.0