| | |
| | | void OnBeforePlayerDataInitialize()
|
| | | {
|
| | | isPackResetOk = true;
|
| | | ClearSortedBetterEquip();
|
| | | }
|
| | |
|
| | | #region 计算装备评分
|
| | |
| | |
|
| | | }
|
| | |
|
| | | 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();
|
| | |
|
| | | if (IsCustomItem(itemId))
|
| | | {
|
| | | properties.AddBaseProperties(config.EffectValueA1, equipBaseProperties);
|
| | | properties.AddCustomProperties(itemId);
|
| | | return CalculateEquipScore(config.EffectValueA1, properties);
|
| | | }
|
| | |
|
| | | properties.AddBaseProperties(itemId, equipBaseProperties);
|
| | |
|
| | |
|
| | | 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]);
|
| | | }
|
| | | }
|
| | |
|
| | | return CalculateEquipScore(itemId, properties, useDataDic);
|
| | | }
|
| | | |
| | |
|
| | | // private Dictionary<int, int> GetEquipLegendProperties(int itemId)
|
| | | // {
|
| | |
| | | /// <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)
|
| | | private void CalculateEquipAttr(int itemId, EquipSorceProperties properties)
|
| | | {
|
| | | var config = ItemConfig.Get(itemId);
|
| | | if (config == null || !GeneralDefine.CompareEquipPlaces.Contains(config.EquipPlace))
|
| | | {
|
| | | return 0;
|
| | | }
|
| | |
|
| | | //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;
|
| | |
| | | properties[(int)PropertyType.MinAtk] = minAttack + attack;
|
| | | properties[(int)PropertyType.MaxAtk] = maxAttack + attack;
|
| | |
|
| | | 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;
|
| | |
| | | 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]);
|
| | | }
|
| | | 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]);
|
| | | }
|
| | | }
|
| | |
|
| | | 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.AddSkill2 != 0 && equipSkillScores.ContainsKey(config.AddSkill2))
|
| | | {
|
| | | skillScore += equipSkillScores[config.AddSkill2];
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | return skillScore + Equation.Instance.Eval<int>(normalGSFormula);
|
| | | |
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | // }
|
| | | #endregion
|
| | |
|
| | | #region 背包整理后好的同类型最好的装备
|
| | | Dictionary<int, Dictionary<int, ItemModel>> itemModelDict = new Dictionary<int, Dictionary<int, ItemModel>>(); // key1 装备位置索引 key2 背包位置索引
|
| | |
|
| | | public void ClearSortedBetterEquip()
|
| | | {
|
| | | itemModelDict.Clear();
|
| | | }
|
| | |
|
| | | public void SetBagSortBetterEquipList(ItemModel itemModel)
|
| | | {
|
| | | if (itemModel == null || itemModel.packType != PackType.Item) return;
|
| | |
|
| | | if (!IsCanPutOn(itemModel)) return;
|
| | |
|
| | | int equipPlace = itemModel.config.EquipPlace;
|
| | | if (!itemModelDict.ContainsKey(equipPlace))
|
| | | {
|
| | | var dict = new Dictionary<int, ItemModel>();
|
| | | if (IsFightUp(itemModel.itemId, itemModel.score) == 1)
|
| | | {
|
| | | dict.Add(itemModel.gridIndex, itemModel);
|
| | | itemModelDict.Add(equipPlace, dict);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | if (IsFightUp(itemModel.itemId, itemModel.score) == 1)
|
| | | {
|
| | | itemModelDict[equipPlace].Add(itemModel.gridIndex, itemModel);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | public ItemModel GetBagSortBetterEquip(int equipPlace, int index)
|
| | | {
|
| | | ItemModel itemModel = null;
|
| | | if (itemModelDict.ContainsKey(equipPlace))
|
| | | {
|
| | | itemModelDict[equipPlace].TryGetValue(index, out itemModel);
|
| | | }
|
| | | return itemModel;
|
| | | }
|
| | | |
| | |
|
| | | bool IsCanPutOn(ItemModel item)
|
| | | {
|
| | |
| | | return true;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region 得到物品的品质颜色
|
| | | private Dictionary<int, int> wingRefineQualityDict;
|