| | |
| | | using Snxxz.UI;
|
| | | using System;
|
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Linq;
|
| | |
|
| | | using LitJson;
|
| | | using UnityEngine;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | [XLua.LuaCallCSharp]
|
| | | public class PackModelInterface : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
|
| | | public class PackModelInterface : Model, IBeforePlayerDataInitialize
|
| | | {
|
| | | private ItemConfig tagChinModel;
|
| | | private FuncConfigConfig _equipGSFormula;
|
| | | private FuncConfigConfig _itemPush;
|
| | | private FuncConfigConfig _drugIDFunc;
|
| | | private FuncConfigConfig _oneKeySellFunc;
|
| | | private string jadeDynastyGSFormula;
|
| | | private string dogzGSFormula;
|
| | | private string normalGSFormula;
|
| | |
|
| | | public int[] preciousItemType { get; private set; }
|
| | | private int[] preciousItemType;
|
| | | private int[] drugIDs;
|
| | | public Dictionary<int, List<int>> betterEquipExceptDungeonDict { get; private set; }
|
| | |
|
| | | private int[] onekeySellTypes;
|
| | | PlayerPackModel _playerPack;
|
| | | PlayerPackModel playerPack {
|
| | | get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); }
|
| | | }
|
| | | private int[] pushItemIds;
|
| | | private int[] pushBuffTypeIds;
|
| | |
|
| | | ItemTipsModel _itemTipsModel;
|
| | | ItemTipsModel itemTipsModel {
|
| | | get {
|
| | | return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>());
|
| | | }
|
| | | }
|
| | | private List<int> equipBaseProperties = new List<int>();
|
| | | private Dictionary<int, int> promptUseLimitDict;
|
| | | private Dictionary<int, List<int>> betterEquipExceptDungeonDict;
|
| | |
|
| | | PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } }
|
| | | ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
|
| | | PlayerBuffDatas buffDatas { get { return ModelCenter.Instance.GetModel<PlayerBuffDatas>(); } }
|
| | | PlayerMountDatas mountDatas { get { return ModelCenter.Instance.GetModel<PlayerMountDatas>(); } }
|
| | | PlayerPetDatas petDatas { get { return ModelCenter.Instance.GetModel<PlayerPetDatas>(); } }
|
| | |
| | | TrialDungeonModel trialModel { get { return ModelCenter.Instance.GetModel<TrialDungeonModel>(); } }
|
| | | ComposeWinModel composeModel { get { return ModelCenter.Instance.GetModel<ComposeWinModel>(); } }
|
| | |
|
| | | private int[] pushItemIds;
|
| | | public int[] pushBuffTypeIds;
|
| | | private List<int> equipBaseAttrlist = new List<int>();
|
| | | public Dictionary<int, int> promptUseLimitDict { get; private set; }
|
| | |
|
| | | public override void Init()
|
| | | {
|
| | | _equipGSFormula = FuncConfigConfig.Get("EquipGSFormula");
|
| | | equipBaseAttrlist.Clear();
|
| | | JsonData baseAttr = JsonMapper.ToObject(_equipGSFormula.Numerical2);
|
| | | var GSFormulaConfig = FuncConfigConfig.Get("EquipGSFormula");
|
| | | jadeDynastyGSFormula = GSFormulaConfig.Numerical4;
|
| | | dogzGSFormula = GSFormulaConfig.Numerical3;
|
| | | normalGSFormula = GSFormulaConfig.Numerical1;
|
| | |
|
| | | var baseAttr = JsonMapper.ToObject(GSFormulaConfig.Numerical2);
|
| | | if (baseAttr.IsArray)
|
| | | {
|
| | | for (int i = 0; i < baseAttr.Count; i++)
|
| | | {
|
| | | equipBaseAttrlist.Add(int.Parse(baseAttr[i].ToString()));
|
| | | equipBaseProperties.Add(int.Parse(baseAttr[i].ToString()));
|
| | | }
|
| | | }
|
| | |
|
| | | _itemPush = FuncConfigConfig.Get("ItemPush");
|
| | | preciousItemType = ConfigParse.GetMultipleStr<int>(_itemPush.Numerical1);
|
| | | preciousItemType = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("ItemPush").Numerical1);
|
| | | promptUseLimitDict = ConfigParse.GetDic<int, int>(FuncConfigConfig.Get("NoPromptUsetItem").Numerical1);
|
| | |
|
| | | FuncConfigConfig noPromptUsetItem = FuncConfigConfig.Get("NoPromptUsetItem");
|
| | | promptUseLimitDict = ConfigParse.GetDic<int, int>(noPromptUsetItem.Numerical1);
|
| | | drugIDs = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("LifePotionlist").Numerical1);
|
| | | onekeySellTypes = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("OneKeySellItemType").Numerical1);
|
| | |
|
| | | _drugIDFunc = FuncConfigConfig.Get("LifePotionlist");
|
| | | drugIDs = ConfigParse.GetMultipleStr<int>(_drugIDFunc.Numerical1);
|
| | | _oneKeySellFunc = FuncConfigConfig.Get("OneKeySellItemType");
|
| | | onekeySellTypes = ConfigParse.GetMultipleStr<int>(_oneKeySellFunc.Numerical1);
|
| | | FuncConfigConfig funcConfig = FuncConfigConfig.Get("IntroductionItem");
|
| | | pushItemIds = ConfigParse.GetMultipleStr<int>(funcConfig.Numerical1);
|
| | | pushBuffTypeIds = ConfigParse.GetMultipleStr<int>(funcConfig.Numerical2);
|
| | | FuncConfigConfig betterEquipExcConfig = FuncConfigConfig.Get("GoodItemDungeon");
|
| | | pushItemIds = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("IntroductionItem").Numerical1);
|
| | | pushBuffTypeIds = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("IntroductionItem").Numerical2);
|
| | |
|
| | | betterEquipExceptDungeonDict = new Dictionary<int, List<int>>();
|
| | | JsonData excEquipData = JsonMapper.ToObject(betterEquipExcConfig.Numerical1);
|
| | | var excEquipData = JsonMapper.ToObject(FuncConfigConfig.Get("GoodItemDungeon").Numerical1);
|
| | | foreach (var dungeonId in excEquipData.Keys)
|
| | | {
|
| | | List<int> idlist = new List<int>();
|
| | | betterEquipExceptDungeonDict.Add(int.Parse(dungeonId), idlist);
|
| | | for (int i = 0; i < excEquipData[dungeonId].Count; i++)
|
| | | var itemIds = new List<int>();
|
| | | betterEquipExceptDungeonDict.Add(int.Parse(dungeonId), itemIds);
|
| | | for (var i = 0; i < excEquipData[dungeonId].Count; i++)
|
| | | {
|
| | | int itemId = int.Parse(excEquipData[dungeonId][i].ToString());
|
| | | idlist.Add(itemId);
|
| | | var itemId = int.Parse(excEquipData[dungeonId][i].ToString());
|
| | | itemIds.Add(itemId);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | public void OnBeforePlayerDataInitialize()
|
| | |
| | | itemEffectCDDict.Clear();
|
| | | itemEffectTimelist.Clear();
|
| | | }
|
| | |
|
| | | public void OnPlayerLoginOk()
|
| | | {
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | public override void UnInit()
|
| | | {
|
| | |
| | | /// 得到特殊属性的字典
|
| | | /// </summary>
|
| | | private Dictionary<AttrEnum, int> specAttrDic = new Dictionary<AttrEnum, int>();
|
| | | public int SetEquipScore(PackType type, int itemId, Dictionary<int, List<int>> useDataDic = null, bool isPreview = false)
|
| | |
|
| | | class EquipSorceProperties
|
| | | {
|
| | | specAttrDic.Clear();
|
| | | int id = itemId;
|
| | | ItemConfig itemConfig = ItemConfig.Get(itemId);
|
| | | if (CheckIsCustomItem(itemConfig))
|
| | | Dictionary<int, int> properties = new Dictionary<int, int>();
|
| | |
|
| | | public int this[int id] { get { return properties[id]; } }
|
| | |
|
| | | public List<int> Keys { get { return new List<int>(properties.Keys); } }
|
| | |
|
| | | public void Add(int id, int value)
|
| | | {
|
| | | AppointItemConfig appointItemConfig = AppointItemConfig.Get(itemId);
|
| | | SetCustomAttrData(appointItemConfig);
|
| | | id = itemConfig.EffectValueA1;
|
| | | }
|
| | | else
|
| | | {
|
| | | if (isPreview)
|
| | | if (properties.ContainsKey(id))
|
| | | {
|
| | | List<int> legendIdlist = new List<int>();
|
| | | List<int> legendValuelist = new List<int>();
|
| | | switch (itemConfig.EquipPlace)
|
| | | {
|
| | | case 11:
|
| | | CalculateWingsLegendAttr(itemConfig, out legendIdlist, out legendValuelist);
|
| | | break;
|
| | | case 1:
|
| | | case 2:
|
| | | case 3:
|
| | | case 4:
|
| | | case 5:
|
| | | case 6:
|
| | | case 7:
|
| | | case 8:
|
| | | case 9:
|
| | | case 10:
|
| | | case 12:
|
| | | CalculateEquipLegendAttr(itemConfig, out legendIdlist, out legendValuelist);
|
| | | break;
|
| | | }
|
| | |
|
| | | var packType = GeneralDefine.GetPackTypeByItemType(itemConfig.Type);
|
| | | switch (packType)
|
| | | {
|
| | | case PackType.JadeDynastyItem:
|
| | | CalculateJadeDynastyLegendAttr(itemConfig, out legendIdlist, out legendValuelist);
|
| | | break;
|
| | | }
|
| | |
|
| | | if (legendIdlist.Count == legendValuelist.Count)
|
| | | {
|
| | | SetLegendData(legendIdlist, legendValuelist);
|
| | | }
|
| | | properties[id] += value;
|
| | | }
|
| | | else
|
| | | {
|
| | | if (useDataDic != null)
|
| | | {
|
| | | if (useDataDic.ContainsKey((int)ItemUseDataKey.legendAttrID))
|
| | | {
|
| | | SetLegendData(useDataDic[(int)ItemUseDataKey.legendAttrID], useDataDic[(int)ItemUseDataKey.legendAttrValue]);
|
| | | }
|
| | |
|
| | | if (useDataDic.ContainsKey((int)ItemUseDataKey.outOfPrintAttrID))
|
| | | {
|
| | | SetExhaustedData(useDataDic[(int)ItemUseDataKey.outOfPrintAttrID], useDataDic[(int)ItemUseDataKey.outOfPrintAttrValue]);
|
| | | }
|
| | |
|
| | | }
|
| | | properties[id] = value;
|
| | | }
|
| | | }
|
| | | return GetEquipScore(type, id, specAttrDic);
|
| | |
|
| | | public void AddRange(List<int> ids, List<int> values)
|
| | | {
|
| | | if (ids == null || values == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | var count = Mathf.Min(ids.Count, values.Count);
|
| | | for (int i = 0; i < count; i++)
|
| | | {
|
| | | Add(ids[i], values[i]);
|
| | | }
|
| | | }
|
| | |
|
| | | public void AddRange(int[] ids, int[] values)
|
| | | {
|
| | | if (ids == null || values == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | var length = Mathf.Min(ids.Length, values.Length);
|
| | | for (int i = 0; i < length; i++)
|
| | | {
|
| | | Add(ids[i], values[i]);
|
| | | }
|
| | | }
|
| | |
|
| | | public void AddBaseProperties(int itemId, List<int> reference)
|
| | | {
|
| | | var config = ItemConfig.Get(itemId);
|
| | | if (config.Effect1 != 0 && reference.Contains(config.Effect1))
|
| | | {
|
| | | properties.Add(config.Effect1, config.EffectValueA1);
|
| | | }
|
| | |
|
| | | if (config.Effect2 != 0 && reference.Contains(config.Effect2))
|
| | | {
|
| | | properties.Add(config.Effect2, config.EffectValueA2);
|
| | | }
|
| | |
|
| | | if (config.Effect3 != 0 && reference.Contains(config.Effect3))
|
| | | {
|
| | | properties.Add(config.Effect3, config.EffectValueA3);
|
| | | }
|
| | |
|
| | | if (config.Effect4 != 0 && reference.Contains(config.Effect4))
|
| | | {
|
| | | properties.Add(config.Effect4, config.EffectValueA4);
|
| | | }
|
| | |
|
| | | if (config.Effect5 != 0 && reference.Contains(config.Effect5))
|
| | | {
|
| | | properties.Add(config.Effect5, config.EffectValueA5);
|
| | | }
|
| | | }
|
| | |
|
| | | public void AddCustomProperties(int itemId)
|
| | | {
|
| | | if (AppointItemConfig.Has(itemId))
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | var config = AppointItemConfig.Get(itemId);
|
| | | AddRange(config.LegendAttrID, config.LegendAttrValue);
|
| | | AddRange(config.OutOfPrintAttr, config.OutOfPrintAttrValue);
|
| | | }
|
| | | }
|
| | |
|
| | | private void CalculateEquipLegendAttr(ItemConfig itemConfig, out List<int> legendIdlist, out List<int> legendValuelist)
|
| | | public int GetEquipScore(PackType type, int itemId, Dictionary<int, List<int>> useDataDic = null, bool isPreview = false)
|
| | | {
|
| | | specAttrDic.Clear();
|
| | | var config = ItemConfig.Get(itemId);
|
| | | var properties = new EquipSorceProperties();
|
| | |
|
| | | if (IsCustomItem(itemId))
|
| | | {
|
| | | properties.AddBaseProperties(config.EffectValueA1, equipBaseProperties);
|
| | | properties.AddCustomProperties(itemId);
|
| | | return CalculateEquipScore(type, config.EffectValueA1, properties);
|
| | | }
|
| | |
|
| | | properties.AddBaseProperties(itemId, equipBaseProperties);
|
| | | if (isPreview)
|
| | | {
|
| | | List<int> legendIdlist = new List<int>();
|
| | | List<int> legendValuelist = new List<int>();
|
| | | switch (config.EquipPlace)
|
| | | {
|
| | | case 11:
|
| | | CalculateWingsLegendAttr(itemId, out legendIdlist, out legendValuelist);
|
| | | break;
|
| | | case 1:
|
| | | case 2:
|
| | | case 3:
|
| | | case 4:
|
| | | case 5:
|
| | | case 6:
|
| | | case 7:
|
| | | case 8:
|
| | | case 9:
|
| | | case 10:
|
| | | case 12:
|
| | | CalculateEquipLegendAttr(itemId, out legendIdlist, out legendValuelist);
|
| | | break;
|
| | | }
|
| | |
|
| | | var packType = GeneralDefine.GetPackTypeByItemType(config.Type);
|
| | | switch (packType)
|
| | | {
|
| | | case PackType.JadeDynastyItem:
|
| | | CalculateJadeDynastyLegendAttr(config, out legendIdlist, out legendValuelist);
|
| | | break;
|
| | | }
|
| | |
|
| | | properties.AddRange(legendIdlist, legendValuelist);
|
| | | return CalculateEquipScore(type, itemId, properties);
|
| | | }
|
| | |
|
| | | 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(type, itemId, properties);
|
| | | }
|
| | |
|
| | | private void CalculateEquipLegendAttr(int itemId, out List<int> legendIdlist, out List<int> legendValuelist)
|
| | | {
|
| | | var config = ItemConfig.Get(itemId);
|
| | | legendIdlist = new List<int>();
|
| | | legendValuelist = new List<int>();
|
| | | string attrCntKey = StringUtility.Contact(itemConfig.ItemColor, itemConfig.StarLevel);
|
| | | string attrCntKey = StringUtility.Contact(config.ItemColor, config.StarLevel);
|
| | | var attrIDDict = itemTipsModel.legendAttrIDPreviewDict;
|
| | | var attrCntDict = itemTipsModel.legendAttrCntPreviewDict;
|
| | | if (attrIDDict.ContainsKey(itemConfig.EquipPlace))
|
| | | if (attrIDDict.ContainsKey(config.EquipPlace))
|
| | | {
|
| | | var attrTypeDict = itemTipsModel.legendAttrIDPreviewDict[itemConfig.EquipPlace];
|
| | | var attrTypeDict = itemTipsModel.legendAttrIDPreviewDict[config.EquipPlace];
|
| | |
|
| | | foreach (var attrType in attrTypeDict.Keys)
|
| | | {
|
| | |
| | | {
|
| | | if (itemTipsModel.legendAttrColorValuePreviewDict.ContainsKey(legendIdlist[i]))
|
| | | {
|
| | | if (itemTipsModel.legendAttrColorValuePreviewDict[legendIdlist[i]].ContainsKey(itemConfig.ItemColor))
|
| | | if (itemTipsModel.legendAttrColorValuePreviewDict[legendIdlist[i]].ContainsKey(config.ItemColor))
|
| | | {
|
| | | legendValuelist.Add(itemTipsModel.legendAttrColorValuePreviewDict[legendIdlist[i]][itemConfig.ItemColor]);
|
| | | legendValuelist.Add(itemTipsModel.legendAttrColorValuePreviewDict[legendIdlist[i]][config.ItemColor]);
|
| | | }
|
| | | }
|
| | | else if (itemTipsModel.legendAttrLvValuePreviewDict.ContainsKey(legendIdlist[i]))
|
| | | {
|
| | | if (itemTipsModel.legendAttrLvValuePreviewDict[legendIdlist[i]].ContainsKey(itemConfig.LV))
|
| | | if (itemTipsModel.legendAttrLvValuePreviewDict[legendIdlist[i]].ContainsKey(config.LV))
|
| | | {
|
| | | legendValuelist.Add(itemTipsModel.legendAttrLvValuePreviewDict[legendIdlist[i]][itemConfig.LV]);
|
| | | legendValuelist.Add(itemTipsModel.legendAttrLvValuePreviewDict[legendIdlist[i]][config.LV]);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void CalculateWingsLegendAttr(ItemConfig itemConfig, out List<int> legendIdlist, out List<int> legendValuelist)
|
| | | private void CalculateWingsLegendAttr(int itemId, out List<int> legendIdlist, out List<int> legendValuelist)
|
| | | {
|
| | | var config = ItemConfig.Get(itemId);
|
| | | legendIdlist = new List<int>();
|
| | | legendValuelist = new List<int>();
|
| | | var attrCntDict = itemTipsModel.wingsLegendAttrCntPreviewDict;
|
| | | var attrValueDict = itemTipsModel.wingsLegendAttrValuePreviewDict;
|
| | | int attrCnt = 0;
|
| | | if (attrCntDict.ContainsKey(itemConfig.LV))
|
| | |
|
| | | if (attrCntDict.ContainsKey(config.LV))
|
| | | {
|
| | | attrCnt = attrCntDict[itemConfig.LV];
|
| | | attrCnt = attrCntDict[config.LV];
|
| | | }
|
| | | if (attrValueDict.ContainsKey(itemConfig.LV))
|
| | |
|
| | | if (attrValueDict.ContainsKey(config.LV))
|
| | | {
|
| | | var attrIdDict = attrValueDict[itemConfig.LV];
|
| | | var attrIdDict = attrValueDict[config.LV];
|
| | | foreach (var attrId in attrIdDict.Keys)
|
| | | {
|
| | | if (legendIdlist.Count < attrCnt)
|
| | |
| | | legendValuelist.Add(attrIdDict[attrId][0]);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | private void CalculateJadeDynastyLegendAttr(ItemConfig itemConfig, out List<int> legendIdlist, out List<int> legendValuelist)
|
| | |
| | | legendValuelist = attrDict.Values.ToList();
|
| | | }
|
| | |
|
| | | #region 预览定制属性逻辑处理
|
| | | public bool CheckIsCustomItem(ItemConfig itemConfig)
|
| | | bool IsCustomItem(int itemId)
|
| | | {
|
| | | if (itemConfig == null) return false;
|
| | |
|
| | | if (itemConfig.Effect1 == 220)
|
| | | if (!ItemConfig.Has(itemId))
|
| | | {
|
| | | return true;
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 设置定制属性的数据
|
| | | /// </summary> |
| | | private void SetCustomAttrData(AppointItemConfig appointItemConfig)
|
| | | {
|
| | | if (appointItemConfig == null)
|
| | | return;
|
| | |
|
| | | List<int> legendIdlist = null;
|
| | | List<int> legendValuelist = null;
|
| | | List<int> exhaustedIdlist = null;
|
| | | List<int> exhaustedValuelist = null;
|
| | | int i = 0;
|
| | | if (appointItemConfig.LegendAttrID.Length > 0)
|
| | | {
|
| | | legendIdlist = new List<int>();
|
| | | legendValuelist = new List<int>();
|
| | | for (i = 0; i < appointItemConfig.LegendAttrID.Length; i++)
|
| | | {
|
| | | legendIdlist.Add(appointItemConfig.LegendAttrID[i]);
|
| | | legendValuelist.Add(appointItemConfig.LegendAttrValue[i]);
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | if (appointItemConfig.OutOfPrintAttr.Length > 0)
|
| | | {
|
| | | exhaustedIdlist = new List<int>();
|
| | | exhaustedValuelist = new List<int>();
|
| | | for (i = 0; i < appointItemConfig.OutOfPrintAttr.Length; i++)
|
| | | {
|
| | | exhaustedIdlist.Add(appointItemConfig.OutOfPrintAttr[i]);
|
| | | exhaustedValuelist.Add(appointItemConfig.OutOfPrintAttrValue[i]);
|
| | | }
|
| | | }
|
| | | SetLegendData(legendIdlist, legendValuelist);
|
| | | SetExhaustedData(exhaustedIdlist, exhaustedValuelist);
|
| | | }
|
| | | #endregion
|
| | | /// <summary>
|
| | | /// 设置传奇属性数据
|
| | | /// </summary>
|
| | | /// <param name="ids"></param>
|
| | | /// <param name="values"></param>
|
| | | private void SetLegendData(List<int> ids, List<int> values)
|
| | | {
|
| | | if (ids == null || ids.Count < 1) return;
|
| | | int i = 0;
|
| | | for (i = 0; i < ids.Count; i++)
|
| | | {
|
| | | SetSpecAttrlist(ids[i], values[i]);
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 设置绝版属性数据
|
| | | /// </summary>
|
| | | /// <param name="ids"></param>
|
| | | /// <param name="values"></param>
|
| | | private void SetExhaustedData(List<int> ids, List<int> values)
|
| | | {
|
| | | if (ids == null || ids.Count < 1) return;
|
| | | int i = 0;
|
| | | for (i = 0; i < ids.Count; i++)
|
| | | {
|
| | | SetSpecAttrlist(ids[i], values[i]);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | private void SetSpecAttrlist(int attrId, int attrValue)
|
| | | {
|
| | | AttrEnum attrEnum = (AttrEnum)attrId;
|
| | | if (!specAttrDic.ContainsKey(attrEnum))
|
| | | {
|
| | | specAttrDic.Add(attrEnum, attrValue);
|
| | | }
|
| | | else
|
| | | {
|
| | | specAttrDic[attrEnum] = attrValue;
|
| | | }
|
| | | return ItemConfig.Get(itemId).Effect1 == 220;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | /// </summary>
|
| | | /// <param name="itemId"></param>
|
| | | /// <returns></returns>
|
| | | private Dictionary<int, int> itemEffectDict = new Dictionary<int, int>();
|
| | | private Dictionary<AttrEnum, float> curEquipAttrDict = new Dictionary<AttrEnum, float>(); //存储当前装备属性对应的数值 key 属性 value 属性值
|
| | | private Dictionary<AttrEnum, int> _tagGsProValueDict;
|
| | | private Dictionary<string, string> _equipGSFormulaDict = new Dictionary<string, string>(); //key 公式参数 value 参数数值
|
| | | private float curProValue = 0;
|
| | | private int GetEquipScore(PackType type, int itemId, Dictionary<AttrEnum, int> specAttrDict)
|
| | | private int CalculateEquipScore(PackType type, int itemId, EquipSorceProperties properties)
|
| | | {
|
| | | tagChinModel = ItemConfig.Get(itemId);
|
| | | if (tagChinModel == null || !GeneralDefine.CompareEquipPlaces.Contains(tagChinModel.EquipPlace)) return 0;
|
| | | var config = ItemConfig.Get(itemId);
|
| | | if (config == null || !GeneralDefine.CompareEquipPlaces.Contains(config.EquipPlace))
|
| | | {
|
| | | return 0;
|
| | | }
|
| | |
|
| | | Equation.Instance.Clear();
|
| | | _tagGsProValueDict = EquipGSParamConfig.GetTagGsProValueDict(tagChinModel.LV, tagChinModel.ItemColor, tagChinModel.StarLevel);
|
| | | curEquipAttrDict.Clear();
|
| | | itemEffectDict.Clear();
|
| | | _equipGSFormulaDict.Clear();
|
| | | try
|
| | |
|
| | | var GSProValueDict = EquipGSParamConfig.GetTagGsProValueDict(config.LV, config.ItemColor, config.StarLevel);
|
| | | foreach (var key in properties.Keys)
|
| | | {
|
| | | if (tagChinModel.Effect1 != 0)
|
| | | {
|
| | | ConvertAttrId(tagChinModel.Effect1, tagChinModel.EffectValueA1, itemEffectDict);
|
| | | }
|
| | | if (tagChinModel.Effect2 != 0)
|
| | | {
|
| | | ConvertAttrId(tagChinModel.Effect2, tagChinModel.EffectValueA2, itemEffectDict);
|
| | | }
|
| | |
|
| | | if (tagChinModel.Effect3 != 0)
|
| | | {
|
| | | ConvertAttrId(tagChinModel.Effect3, tagChinModel.EffectValueA3, itemEffectDict);
|
| | | }
|
| | |
|
| | | if (tagChinModel.Effect4 != 0)
|
| | | {
|
| | | ConvertAttrId(tagChinModel.Effect4, tagChinModel.EffectValueA4, itemEffectDict);
|
| | | }
|
| | |
|
| | | if (tagChinModel.Effect5 != 0)
|
| | | {
|
| | | ConvertAttrId(tagChinModel.Effect5, tagChinModel.EffectValueA5, itemEffectDict);
|
| | | }
|
| | |
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | DebugEx.Log(ex.ToString());
|
| | | }
|
| | |
|
| | |
|
| | | foreach (var key in itemEffectDict.Keys)
|
| | | {
|
| | | if (equipBaseAttrlist.Contains(key))
|
| | | {
|
| | | switch ((AttrEnum)key)
|
| | | {
|
| | | case AttrEnum.ATKSPEED:
|
| | | case AttrEnum.OnlyFinalHurt:
|
| | | case AttrEnum.PVPAtkBackHP:
|
| | | curEquipAttrDict.Add((AttrEnum)key, itemEffectDict[key]);
|
| | | break;
|
| | | default:
|
| | | if (_tagGsProValueDict != null && _tagGsProValueDict.ContainsKey((AttrEnum)key))
|
| | | {
|
| | | curProValue = itemEffectDict[key] * _tagGsProValueDict[(AttrEnum)key];
|
| | | curEquipAttrDict.Add((AttrEnum)key, curProValue);
|
| | | }
|
| | | else
|
| | | {
|
| | | curEquipAttrDict.Add((AttrEnum)key, itemEffectDict[key]);
|
| | | }
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | foreach (AttrEnum attrType in specAttrDict.Keys)
|
| | | {
|
| | | var attrType = (AttrEnum)key;
|
| | | switch (attrType)
|
| | | {
|
| | | case AttrEnum.ATKSPEED:
|
| | | case AttrEnum.OnlyFinalHurt:
|
| | | case AttrEnum.PVPAtkBackHP:
|
| | | curEquipAttrDict.Add(attrType, specAttrDict[attrType]);
|
| | | curEquipAttrDict.Add(attrType, properties[key]);
|
| | | break;
|
| | | default:
|
| | | if (_tagGsProValueDict != null && _tagGsProValueDict.ContainsKey(attrType))
|
| | | if (GSProValueDict != null && GSProValueDict.ContainsKey(attrType))
|
| | | {
|
| | | curProValue = specAttrDict[attrType] * _tagGsProValueDict[attrType];
|
| | | var curProValue = properties[key] * GSProValueDict[attrType];
|
| | | curEquipAttrDict.Add(attrType, curProValue);
|
| | | }
|
| | | else
|
| | | {
|
| | | curEquipAttrDict.Add(attrType, specAttrDict[attrType]);
|
| | | curEquipAttrDict.Add(attrType, properties[key]);
|
| | | }
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | if (_equipGSFormula != null)
|
| | | foreach (var key in curEquipAttrDict.Keys)
|
| | | {
|
| | | foreach (var key in curEquipAttrDict.Keys)
|
| | | var propertyConfig = PlayerPropertyConfig.Get((int)key);
|
| | | if (propertyConfig != null)
|
| | | {
|
| | | PlayerPropertyConfig propertyConfig = PlayerPropertyConfig.Get((int)key);
|
| | | if (propertyConfig != null)
|
| | | {
|
| | | Equation.Instance.AddKeyValue(propertyConfig.Parameter, curEquipAttrDict[key]);
|
| | | }
|
| | | }
|
| | |
|
| | | EquipGSParamConfig gSParamModel = EquipGSParamConfig.GetTagGSModel(tagChinModel.LV, tagChinModel.ItemColor, tagChinModel.StarLevel);
|
| | | if (gSParamModel != null)
|
| | | {
|
| | | Equation.Instance.AddKeyValue("AtkSpeedC", gSParamModel.AtkSpeedC);
|
| | | }
|
| | | else
|
| | | {
|
| | | Equation.Instance.AddKeyValue("AtkSpeedC", 0);
|
| | | }
|
| | | DebugEx.Log("评分:" + Equation.Instance.Eval<double>(_equipGSFormula.Numerical1));
|
| | |
|
| | | if (type == PackType.Deleted)
|
| | | {
|
| | | type = GeneralDefine.GetPackTypeByItemType(tagChinModel.Type);
|
| | | }
|
| | | switch (type)
|
| | | {
|
| | | case PackType.DogzEquip:
|
| | | case PackType.DogzItem:
|
| | | return Equation.Instance.Eval<int>(_equipGSFormula.Numerical3);
|
| | | case PackType.JadeDynastyItem:
|
| | | case PackType.JadeDynastyEquip:
|
| | | return Equation.Instance.Eval<int>(_equipGSFormula.Numerical4);
|
| | | default:
|
| | | return Equation.Instance.Eval<int>(_equipGSFormula.Numerical1);
|
| | | Equation.Instance.AddKeyValue(propertyConfig.Parameter, curEquipAttrDict[key]);
|
| | | }
|
| | | }
|
| | | return 0;
|
| | |
|
| | | var gSParamModel = EquipGSParamConfig.GetGSModel(config.LV, config.ItemColor, config.StarLevel);
|
| | | if (gSParamModel != null)
|
| | | {
|
| | | Equation.Instance.AddKeyValue("AtkSpeedC", gSParamModel.AtkSpeedC);
|
| | | }
|
| | | else
|
| | | {
|
| | | Equation.Instance.AddKeyValue("AtkSpeedC", 0);
|
| | | }
|
| | |
|
| | | if (type == PackType.Deleted)
|
| | | {
|
| | | type = GeneralDefine.GetPackTypeByItemType(config.Type);
|
| | | }
|
| | |
|
| | | switch (type)
|
| | | {
|
| | | case PackType.DogzEquip:
|
| | | case PackType.DogzItem:
|
| | | return Equation.Instance.Eval<int>(dogzGSFormula);
|
| | | case PackType.JadeDynastyItem:
|
| | | case PackType.JadeDynastyEquip:
|
| | | return Equation.Instance.Eval<int>(jadeDynastyGSFormula);
|
| | | default:
|
| | | return Equation.Instance.Eval<int>(normalGSFormula);
|
| | | }
|
| | | }
|
| | |
|
| | | private void ConvertAttrId(int attrId, int attrValue, Dictionary<int, int> keyValues)
|
| | |
| | | SinglePack singlePack = playerPack.GetSinglePack(PackType.Item);
|
| | | if (singlePack == null) return false;
|
| | |
|
| | | int startLockIndex = singlePack.unlockedGridCount - playerPack.InitBagGridCnt;
|
| | | int startLockIndex = singlePack.unlockedGridCount - GeneralDefine.initBagGridCount;
|
| | | FuncConfigConfig _tagFuncModel = FuncConfigConfig.Get("OpenBagItem");
|
| | | int haveCount = playerPack.GetItemCountByID(PackType.Item, itemId);
|
| | | Equation.Instance.Clear();
|
| | |
| | | switch (type)
|
| | | {
|
| | | case PackType.Item:
|
| | | index = chooseGridCount - playerPack.InitBagGridCnt;
|
| | | index = chooseGridCount - GeneralDefine.initBagGridCount;
|
| | | break;
|
| | | case PackType.Warehouse:
|
| | | index = chooseGridCount - playerPack.InitDepotGridCnt;
|
| | | index = chooseGridCount - GeneralDefine.initDepotGridCount;
|
| | | break;
|
| | | }
|
| | | itemTipsModel.SetExtendGirdModel(openCount, index, type);
|