| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using LitJson; |
| | | using UnityEngine; |
| | | using LitJson; |
| | | |
| | | namespace Snxxz.UI |
| | | { |
| | | [XLua.LuaCallCSharp] |
| | | public class ItemLogicUtility : Singleton<ItemLogicUtility> |
| | | { |
| | | private string dogzGSFormula; |
| | | private string normalGSFormula; |
| | | private Dictionary<int, string> specialSpiritPropertyFormula = new Dictionary<int, string>(); |
| | | Dictionary<int, int> specialSpiritPropertyMaxLevels; |
| | | |
| | | private int[] preciousItemTypes; |
| | | private int[] drugIDs; |
| | | private int[] onekeySellTypes; |
| | | private int[] pushItemIds; |
| | | |
| | | private List<int> equipBaseProperties = new List<int>(); |
| | | private Dictionary<int, int> promptUseLimitDict; |
| | | private Dictionary<int, List<int>> betterEquipExceptDungeonDict; |
| | | Dictionary<int, int> equipSkillScores = new Dictionary<int, int>(); |
| | | |
| | | PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } } |
| | | BuffModel buffDatas { get { return ModelCenter.Instance.GetModel<BuffModel>(); } } |
| | | MountModel mountDatas { get { return ModelCenter.Instance.GetModel<MountModel>(); } } |
| | | PetModel petDatas { get { return ModelCenter.Instance.GetModel<PetModel>(); } } |
| | | StrengthenModel strengthDatas { get { return ModelCenter.Instance.GetModel<StrengthenModel>(); } } |
| | | MagicianModel magicianModel { get { return ModelCenter.Instance.GetModel<MagicianModel>(); } } |
| | | ComposeWinModel composeModel { get { return ModelCenter.Instance.GetModel<ComposeWinModel>(); } } |
| | | EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } } |
| | | AlchemyModel alchemyModel { get { return ModelCenter.Instance.GetModel<AlchemyModel>(); } } |
| | | |
| | | public void Init() |
| | | { |
| | | var GSFormulaConfig = FuncConfigConfig.Get("EquipGSFormula"); |
| | | dogzGSFormula = GSFormulaConfig.Numerical3; |
| | | normalGSFormula = GSFormulaConfig.Numerical1; |
| | | |
| | | var json = JsonMapper.ToObject(FuncConfigConfig.Get("OutOfPrintValue").Numerical2); |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Linq;
|
| | | using LitJson;
|
| | | using UnityEngine;
|
| | | using LitJson;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | [XLua.LuaCallCSharp]
|
| | | public class ItemLogicUtility : Singleton<ItemLogicUtility>
|
| | | {
|
| | | private string dogzGSFormula;
|
| | | private string normalGSFormula;
|
| | | private Dictionary<int, string> specialSpiritPropertyFormula = new Dictionary<int, string>();
|
| | | Dictionary<int, int> specialSpiritPropertyMaxLevels;
|
| | |
|
| | | private int[] preciousItemTypes;
|
| | | private int[] drugIDs;
|
| | | private int[] onekeySellTypes;
|
| | | private int[] pushItemIds;
|
| | |
|
| | | private List<int> equipBaseProperties = new List<int>();
|
| | | private Dictionary<int, int> promptUseLimitDict;
|
| | | private Dictionary<int, List<int>> betterEquipExceptDungeonDict;
|
| | | Dictionary<int, int> equipSkillScores = new Dictionary<int, int>();
|
| | |
|
| | | PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
|
| | | BuffModel buffDatas { get { return ModelCenter.Instance.GetModel<BuffModel>(); } }
|
| | | MountModel mountDatas { get { return ModelCenter.Instance.GetModel<MountModel>(); } }
|
| | | PetModel petDatas { get { return ModelCenter.Instance.GetModel<PetModel>(); } }
|
| | | StrengthenModel strengthDatas { get { return ModelCenter.Instance.GetModel<StrengthenModel>(); } }
|
| | | MagicianModel magicianModel { get { return ModelCenter.Instance.GetModel<MagicianModel>(); } }
|
| | | ComposeWinModel composeModel { get { return ModelCenter.Instance.GetModel<ComposeWinModel>(); } }
|
| | | EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
|
| | | AlchemyModel alchemyModel { get { return ModelCenter.Instance.GetModel<AlchemyModel>(); } }
|
| | |
|
| | | public void Init()
|
| | | {
|
| | | var GSFormulaConfig = FuncConfigConfig.Get("EquipGSFormula");
|
| | | dogzGSFormula = GSFormulaConfig.Numerical3;
|
| | | normalGSFormula = GSFormulaConfig.Numerical1;
|
| | |
|
| | | var json = JsonMapper.ToObject(FuncConfigConfig.Get("OutOfPrintValue").Numerical2);
|
| | | foreach (var key in json.Keys)
|
| | | {
|
| | | specialSpiritPropertyFormula[int.Parse(key)] = json[key].ToString();
|
| | | } |
| | | specialSpiritPropertyMaxLevels = ConfigParse.GetDic<int, int>(FuncConfigConfig.Get("OutOfPrintValueDes").Numerical1); |
| | | var equipSkillScoreJson = JsonMapper.ToObject(GSFormulaConfig.Numerical4); |
| | | foreach (var key in equipSkillScoreJson.Keys) |
| | | { |
| | | var skillId = 0; |
| | | int.TryParse(key, out skillId); |
| | | if (skillId != 0) |
| | | { |
| | | equipSkillScores[skillId] = (int)equipSkillScoreJson[key]; |
| | | } |
| | | } |
| | | |
| | | var baseAttr = JsonMapper.ToObject(GSFormulaConfig.Numerical2); |
| | | if (baseAttr.IsArray) |
| | | { |
| | | for (int i = 0; i < baseAttr.Count; i++) |
| | | { |
| | | equipBaseProperties.Add(int.Parse(baseAttr[i].ToString())); |
| | | } |
| | | } |
| | | |
| | | preciousItemTypes = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("ItemPush").Numerical1); |
| | | promptUseLimitDict = ConfigParse.GetDic<int, int>(FuncConfigConfig.Get("NoPromptUsetItem").Numerical1); |
| | | |
| | | drugIDs = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("LifePotionlist").Numerical1); |
| | | onekeySellTypes = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("OneKeySellItemType").Numerical1); |
| | | |
| | | pushItemIds = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("IntroductionItem").Numerical1); |
| | | |
| | | betterEquipExceptDungeonDict = new Dictionary<int, List<int>>(); |
| | | var excEquipData = JsonMapper.ToObject(FuncConfigConfig.Get("GoodItemDungeon").Numerical1); |
| | | foreach (var dungeonId in excEquipData.Keys) |
| | | { |
| | | var itemIds = new List<int>(); |
| | | betterEquipExceptDungeonDict.Add(int.Parse(dungeonId), itemIds); |
| | | for (var i = 0; i < excEquipData[dungeonId].Count; i++) |
| | | { |
| | | var itemId = int.Parse(excEquipData[dungeonId][i].ToString()); |
| | | itemIds.Add(itemId); |
| | | } |
| | | } |
| | | |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize; |
| | | } |
| | | |
| | | void OnBeforePlayerDataInitialize() |
| | | { |
| | | isPackResetOk = true; |
| | | ClearSortedBetterEquip(); |
| | | } |
| | | |
| | | #region 计算装备评分 |
| | | |
| | | class EquipSorceProperties |
| | | { |
| | | Dictionary<int, int> properties = new Dictionary<int, int>(); |
| | | |
| | | public int this[int id] { get { return properties[id]; } set { properties[id] = value; } } |
| | | |
| | | public List<int> Keys { get { return new List<int>(properties.Keys); } } |
| | | |
| | | void Add(int id, int value) |
| | | { |
| | | if (properties.ContainsKey(id)) |
| | | { |
| | | properties[id] += value; |
| | | } |
| | | else |
| | | { |
| | | properties[id] = value; |
| | | } |
| | | } |
| | | |
| | | 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 AddRange(Dictionary<int, int> keyValues) |
| | | { |
| | | if (keyValues == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | foreach (var item in keyValues) |
| | | { |
| | | Add(item.Key, item.Value); |
| | | } |
| | | } |
| | | |
| | | public void AddBaseProperties(int itemId, List<int> reference) |
| | | { |
| | | var config = ItemConfig.Get(itemId); |
| | | if (config == null) |
| | | { |
| | | return; |
| | | } |
| | | 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); |
| | | } |
| | | |
| | | public bool ContainsKey(int id) |
| | | { |
| | | return properties.ContainsKey(id); |
| | | } |
| | | |
| | | } |
| | | |
| | | public int GetEquipScore(int itemId, Dictionary<int, List<int>> useDataDic = null, bool isPreview = false) |
| | | { |
| | | var config = ItemConfig.Get(itemId); |
| | | }
|
| | | specialSpiritPropertyMaxLevels = ConfigParse.GetDic<int, int>(FuncConfigConfig.Get("OutOfPrintValueDes").Numerical1);
|
| | | var equipSkillScoreJson = JsonMapper.ToObject(GSFormulaConfig.Numerical4);
|
| | | foreach (var key in equipSkillScoreJson.Keys)
|
| | | {
|
| | | var skillId = 0;
|
| | | int.TryParse(key, out skillId);
|
| | | if (skillId != 0)
|
| | | {
|
| | | equipSkillScores[skillId] = (int)equipSkillScoreJson[key];
|
| | | }
|
| | | }
|
| | |
|
| | | var baseAttr = JsonMapper.ToObject(GSFormulaConfig.Numerical2);
|
| | | if (baseAttr.IsArray)
|
| | | {
|
| | | for (int i = 0; i < baseAttr.Count; i++)
|
| | | {
|
| | | equipBaseProperties.Add(int.Parse(baseAttr[i].ToString()));
|
| | | }
|
| | | }
|
| | |
|
| | | preciousItemTypes = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("ItemPush").Numerical1);
|
| | | promptUseLimitDict = ConfigParse.GetDic<int, int>(FuncConfigConfig.Get("NoPromptUsetItem").Numerical1);
|
| | |
|
| | | drugIDs = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("LifePotionlist").Numerical1);
|
| | | onekeySellTypes = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("OneKeySellItemType").Numerical1);
|
| | |
|
| | | pushItemIds = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("IntroductionItem").Numerical1);
|
| | |
|
| | | betterEquipExceptDungeonDict = new Dictionary<int, List<int>>();
|
| | | var excEquipData = JsonMapper.ToObject(FuncConfigConfig.Get("GoodItemDungeon").Numerical1);
|
| | | foreach (var dungeonId in excEquipData.Keys)
|
| | | {
|
| | | var itemIds = new List<int>();
|
| | | betterEquipExceptDungeonDict.Add(int.Parse(dungeonId), itemIds);
|
| | | for (var i = 0; i < excEquipData[dungeonId].Count; i++)
|
| | | {
|
| | | var itemId = int.Parse(excEquipData[dungeonId][i].ToString());
|
| | | itemIds.Add(itemId);
|
| | | }
|
| | | }
|
| | |
|
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize;
|
| | | }
|
| | |
|
| | | void OnBeforePlayerDataInitialize()
|
| | | {
|
| | | isPackResetOk = true;
|
| | | ClearSortedBetterEquip();
|
| | | }
|
| | |
|
| | | #region 计算装备评分
|
| | |
|
| | | class EquipSorceProperties
|
| | | {
|
| | | Dictionary<int, int> properties = new Dictionary<int, int>();
|
| | |
|
| | | public int this[int id] { get { return properties[id]; } set { properties[id] = value; } }
|
| | |
|
| | | public List<int> Keys { get { return new List<int>(properties.Keys); } }
|
| | |
|
| | | void Add(int id, int value)
|
| | | {
|
| | | if (properties.ContainsKey(id))
|
| | | {
|
| | | properties[id] += value;
|
| | | }
|
| | | else
|
| | | {
|
| | | properties[id] = value;
|
| | | }
|
| | | }
|
| | |
|
| | | 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 AddRange(Dictionary<int, int> keyValues)
|
| | | {
|
| | | if (keyValues == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | foreach (var item in keyValues)
|
| | | {
|
| | | Add(item.Key, item.Value);
|
| | | }
|
| | | }
|
| | |
|
| | | public void AddBaseProperties(int itemId, List<int> reference)
|
| | | {
|
| | | var config = ItemConfig.Get(itemId);
|
| | | if (config == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | 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);
|
| | | }
|
| | |
|
| | | public bool ContainsKey(int id)
|
| | | {
|
| | | return properties.ContainsKey(id);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | public int GetEquipScore(int itemId, Dictionary<int, List<int>> useDataDic = null, bool isPreview = false)
|
| | | {
|
| | | var config = ItemConfig.Get(itemId);
|
| | | 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 (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; |
| | | } |
| | | |
| | | 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.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) |
| | | { |
| | | var legendProperties = LegendPropertyUtility.GetEquipProperties(itemId); |
| | | var properties = new Dictionary<int, int>(); |
| | | if (legendProperties != null) |
| | | { |
| | | foreach (var item in legendProperties) |
| | | { |
| | | properties[item.x] = item.y; |
| | | } |
| | | } |
| | | |
| | | return properties; |
| | | } |
| | | |
| | | public bool IsCustomItem(int itemId) |
| | | { |
| | | if (!ItemConfig.Has(itemId)) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | return ItemConfig.Get(itemId).Effect1 == 220; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 得到装备的评分 |
| | | /// </summary> |
| | | /// <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; |
| | | } |
| | | |
| | | 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; |
| | | |
| | | 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: |
| | | 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]); |
| | | } |
| | | } |
| | | |
| | | var skillScore = 0; |
| | | if (useDataDic != null && useDataDic.ContainsKey((int)ItemUseDataKey.equipSkills)) |
| | | }
|
| | |
|
| | | var properties = new EquipSorceProperties();
|
| | |
|
| | | if (IsCustomItem(itemId))
|
| | | {
|
| | | for (int i = 0; i < useDataDic[(int)ItemUseDataKey.equipSkills].Count; i++) |
| | | { |
| | | 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;
|
| | | }
|
| | |
|
| | | 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.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)
|
| | | {
|
| | | var legendProperties = LegendPropertyUtility.GetEquipProperties(itemId);
|
| | | var properties = new Dictionary<int, int>();
|
| | | if (legendProperties != null)
|
| | | {
|
| | | foreach (var item in legendProperties)
|
| | | {
|
| | | properties[item.x] = item.y;
|
| | | }
|
| | | }
|
| | |
|
| | | return properties;
|
| | | }
|
| | |
|
| | | public bool IsCustomItem(int itemId)
|
| | | {
|
| | | if (!ItemConfig.Has(itemId))
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | return ItemConfig.Get(itemId).Effect1 == 220;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 得到装备的评分
|
| | | /// </summary>
|
| | | /// <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;
|
| | | }
|
| | |
|
| | | 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;
|
| | |
|
| | | 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:
|
| | | 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]);
|
| | | }
|
| | | }
|
| | |
|
| | | 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
|
| | | {
|
| | |
|
| | |
| | | {
|
| | | skillScore += equipSkillScores[config.AddSkill2];
|
| | | }
|
| | | |
| | | } |
| | | |
| | | |
| | | var spiritWeaponScore = 0; |
| | |
|
| | | }
|
| | |
|
| | |
|
| | | 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);
|
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 主界面物品弹框展示 |
| | | public event Action<PackType, string> GetPreciousItemEvent; //得到珍品 value 物品的实例ID |
| | | |
| | | public void RecommendItem(ItemModel item) |
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region 主界面物品弹框展示
|
| | | public event Action<PackType, string> GetPreciousItemEvent; //得到珍品 value 物品的实例ID
|
| | |
|
| | | public void RecommendItem(ItemModel item)
|
| | | {
|
| | | if (!preciousItemTypes.Contains(item.config.Type)) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | if (item.packType != PackType.Item) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | //if (item.isAuction) |
| | | //{ |
| | | // return; |
| | | //} |
| | | |
| | | if (item.config.UseLV > PlayerDatas.Instance.baseData.LV) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | if (IsOverdue(item.guid)) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | if (!IsAbleToUse(item)) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | if (!preciousItemTypes.Contains(item.config.Type))
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | if (item.packType != PackType.Item)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | //if (item.isAuction)
|
| | | //{
|
| | | // return;
|
| | | //}
|
| | |
|
| | | if (item.config.UseLV > PlayerDatas.Instance.baseData.LV)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | if (IsOverdue(item.guid))
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | if (!IsAbleToUse(item))
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | if (IsSpiritWeapon(item.itemId))
|
| | | {
|
| | | if (IsFightUp(item.itemId, item.score) != 1)
|
| | | {
|
| | | return;
|
| | | }
|
| | | } |
| | | |
| | | if (GetPreciousItemEvent != null) |
| | | { |
| | | GetPreciousItemEvent(item.packType, item.guid); |
| | | } |
| | | } |
| | | |
| | | bool IsAbleToUse(ItemModel item) |
| | | { |
| | | var windowSearch = WindowSearchConfig.Get(item.config.Jump); |
| | | if (windowSearch != null) |
| | | { |
| | | if (!FuncOpen.Instance.IsFuncOpen(windowSearch.Lv) && windowSearch.Lv != 0) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | if (pushItemIds.Contains(item.itemId)) |
| | | { |
| | | var itemCnt = packModel.GetItemCountByID(PackType.Item, item.itemId) - item.count; |
| | | if (itemCnt > 0) |
| | | { |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | if (item.preItemCount > 0) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (promptUseLimitDict.ContainsKey(item.itemId)) |
| | | { |
| | | var playerLv = PlayerDatas.Instance.baseData.LV; |
| | | if (playerLv < promptUseLimitDict[item.itemId]) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | ulong canUseCnt = 0; |
| | | if (packModel.IsReachUseLimit(item.guid, out canUseCnt)) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | bool isBox = false; |
| | | bool isCanOpen = ModelCenter.Instance.GetModel<BoxGetItemModel>().CheckOpenBoxCondition(item.itemId, out isBox); |
| | | if (isBox) |
| | | { |
| | | if (!isCanOpen) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //if (trialModel.trialTokens.Contains(item.itemId)) |
| | | //{ |
| | | // if (!trialModel.IsAnySatisfyExchangeBetter(item.itemId)) |
| | | // { |
| | | // return false; |
| | | // } |
| | | //} |
| | | |
| | | if (packModel.CheckIsDrugById(item.itemId)) |
| | | { |
| | | if (item.config.RealmLimit > PlayerDatas.Instance.baseData.realmLevel) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | var fruitConfig = AttrFruitConfig.Get(item.itemId); |
| | | }
|
| | |
|
| | | if (GetPreciousItemEvent != null)
|
| | | {
|
| | | GetPreciousItemEvent(item.packType, item.guid);
|
| | | }
|
| | | }
|
| | |
|
| | | bool IsAbleToUse(ItemModel item)
|
| | | {
|
| | | var windowSearch = WindowSearchConfig.Get(item.config.Jump);
|
| | | if (windowSearch != null)
|
| | | {
|
| | | if (!FuncOpen.Instance.IsFuncOpen(windowSearch.Lv) && windowSearch.Lv != 0)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | if (pushItemIds.Contains(item.itemId))
|
| | | {
|
| | | var itemCnt = packModel.GetItemCountByID(PackType.Item, item.itemId) - item.count;
|
| | | if (itemCnt > 0)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | else
|
| | | {
|
| | | if (item.preItemCount > 0)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | if (promptUseLimitDict.ContainsKey(item.itemId))
|
| | | {
|
| | | var playerLv = PlayerDatas.Instance.baseData.LV;
|
| | | if (playerLv < promptUseLimitDict[item.itemId])
|
| | | {
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | ulong canUseCnt = 0;
|
| | | if (packModel.IsReachUseLimit(item.guid, out canUseCnt))
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | bool isBox = false;
|
| | | bool isCanOpen = ModelCenter.Instance.GetModel<BoxGetItemModel>().CheckOpenBoxCondition(item.itemId, out isBox);
|
| | | if (isBox)
|
| | | {
|
| | | if (!isCanOpen)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | //if (trialModel.trialTokens.Contains(item.itemId))
|
| | | //{
|
| | | // if (!trialModel.IsAnySatisfyExchangeBetter(item.itemId))
|
| | | // {
|
| | | // return false;
|
| | | // }
|
| | | //}
|
| | |
|
| | | if (packModel.CheckIsDrugById(item.itemId))
|
| | | {
|
| | | if (item.config.RealmLimit > PlayerDatas.Instance.baseData.realmLevel)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | var fruitConfig = AttrFruitConfig.Get(item.itemId);
|
| | | if (fruitConfig != null && fruitConfig.FuncID == 2)
|
| | | {
|
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.BlastFurnace))
|
| | | {
|
| | | return false;
|
| | | }
|
| | | } |
| | | |
| | | switch (item.config.Type) |
| | | { |
| | | case 8: |
| | | if (buffDatas.BastBuff(item.itemId)) |
| | | { |
| | | return false; |
| | | } |
| | | break; |
| | | case 20: |
| | | if (magicianModel.IsGodWeaponMaxLevelByItem(item.itemId)) |
| | | { |
| | | return false; |
| | | } |
| | | break; |
| | | case 21: |
| | | if (!mountDatas.IsHint(HorseEnum.HorseDan, item.itemId)) |
| | | { |
| | | return false; |
| | | } |
| | | break; |
| | | case 22: |
| | | if (!mountDatas.IsHint(HorseEnum.HorseStone, item.itemId)) |
| | | { |
| | | return false; |
| | | } |
| | | break; |
| | | case 41: |
| | | if (!mountDatas.IsHint(HorseEnum.HorseDebris, item.itemId)) |
| | | { |
| | | return false; |
| | | } |
| | | break; |
| | | case 26: |
| | | if (!petDatas.IsHint(PetEnum.PetDebris, item.itemId)) |
| | | { |
| | | return false; |
| | | } |
| | | break; |
| | | case 27: |
| | | if (!petDatas.IsHint(PetEnum.PetDan, item.itemId)) |
| | | { |
| | | return false; |
| | | } |
| | | break; |
| | | case 28: |
| | | if (!petDatas.IsHint(PetEnum.PetStone, item.itemId)) |
| | | { |
| | | return false; |
| | | } |
| | | break; |
| | | case 25: |
| | | if (!ModelCenter.Instance.GetModel<EquipGemModel>().IsBetterGem(item.itemId)) |
| | | { |
| | | return false; |
| | | } |
| | | break; |
| | | case 39: |
| | | if (!IsBetterWings(item)) |
| | | { |
| | | return false; |
| | | } |
| | | break; |
| | | case 52: |
| | | if (!strengthDatas.IsHint(item.itemId)) |
| | | { |
| | | return false; |
| | | } |
| | | }
|
| | |
|
| | | switch (item.config.Type)
|
| | | {
|
| | | case 8:
|
| | | if (buffDatas.BastBuff(item.itemId))
|
| | | {
|
| | | return false;
|
| | | }
|
| | | break;
|
| | | case 55: |
| | | case 20:
|
| | | if (magicianModel.IsGodWeaponMaxLevelByItem(item.itemId))
|
| | | {
|
| | | return false;
|
| | | }
|
| | | break;
|
| | | case 21:
|
| | | if (!mountDatas.IsHint(HorseEnum.HorseDan, item.itemId))
|
| | | {
|
| | | return false;
|
| | | }
|
| | | break;
|
| | | case 22:
|
| | | if (!mountDatas.IsHint(HorseEnum.HorseStone, item.itemId))
|
| | | {
|
| | | return false;
|
| | | }
|
| | | break;
|
| | | case 41:
|
| | | if (!mountDatas.IsHint(HorseEnum.HorseDebris, item.itemId))
|
| | | {
|
| | | return false;
|
| | | }
|
| | | break;
|
| | | case 26:
|
| | | if (!petDatas.IsHint(PetEnum.PetDebris, item.itemId))
|
| | | {
|
| | | return false;
|
| | | }
|
| | | break;
|
| | | case 27:
|
| | | if (!petDatas.IsHint(PetEnum.PetDan, item.itemId))
|
| | | {
|
| | | return false;
|
| | | }
|
| | | break;
|
| | | case 28:
|
| | | if (!petDatas.IsHint(PetEnum.PetStone, item.itemId))
|
| | | {
|
| | | return false;
|
| | | }
|
| | | break;
|
| | | case 25:
|
| | | if (!ModelCenter.Instance.GetModel<EquipGemModel>().IsBetterGem(item.itemId))
|
| | | {
|
| | | return false;
|
| | | }
|
| | | break;
|
| | | case 39:
|
| | | if (!IsBetterWings(item))
|
| | | {
|
| | | return false;
|
| | | }
|
| | | break;
|
| | | case 52:
|
| | | if (!strengthDatas.IsHint(item.itemId))
|
| | | {
|
| | | return false;
|
| | | }
|
| | | break;
|
| | | case 55:
|
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.BlastFurnace))
|
| | | {
|
| | | return false;
|
| | | } |
| | | var alchemyId = 0; |
| | | }
|
| | | var alchemyId = 0;
|
| | | if (alchemyModel.TryGetAlchemyByStudyMaterial(item.itemId, out alchemyId))
|
| | | {
|
| | | var alchemyConfig = AlchemyConfig.Get(alchemyId);
|
| | |
| | | {
|
| | | return false;
|
| | | }
|
| | | } |
| | | break; |
| | | case 127: |
| | | var error = 0; |
| | | bool isHaveMakeNum = ItemOperateUtility.Instance.CanUseItem(item.guid, 1, out error); |
| | | int remainNum = CrossServerOneVsOnePlayerInfo.Instance.GetDayRemainNum(); |
| | | if (!CrossServerOneVsOnePKSeason.Instance.isSatisfyMatch |
| | | || remainNum > 0 |
| | | || !isHaveMakeNum) |
| | | { |
| | | return false; |
| | | } |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | switch (item.itemId) |
| | | { |
| | | case 951: |
| | | if (!CheckIsExtendGrid(item.itemId)) |
| | | { |
| | | return false; |
| | | } |
| | | break; |
| | | case 952: |
| | | int willTime = HangUpSetModel.Instance.offlinePluginTime + item.config.EffectValueA1; |
| | | if (HangUpSetModel.Instance.offlinePluginTime >= HangUpSetModel.Instance.maxOfflinePluginTime) |
| | | { |
| | | return false; |
| | | } |
| | | break; |
| | | |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | private bool IsBetterWings(ItemModel item) |
| | | { |
| | | if (item == null) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | var putModel = packModel.GetItemByIndex(PackType.Equip, SpiritWeaponModel.WING_EQUIPINDEX); |
| | | var singlePack = packModel.GetSinglePack(PackType.Item); |
| | | if (singlePack == null) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | int[] composeTypes = item.config.JumpComposeCondi; |
| | | bool isOpenCompose = false; |
| | | if (composeTypes != null && composeTypes.Length >= 3) |
| | | { |
| | | int first = composeTypes[0]; |
| | | int second = composeTypes[1]; |
| | | int third = composeTypes[2]; |
| | | ComposeWinModel.ComposeThirdTypeData thirdTypeData = null; |
| | | composeModel.TryGetThirdTypeData(first, second, third, out thirdTypeData); |
| | | if (thirdTypeData != null) |
| | | { |
| | | var itemCompound = thirdTypeData.itemCompound; |
| | | if (itemCompound.levelNeed <= PlayerDatas.Instance.baseData.LV) |
| | | { |
| | | isOpenCompose = true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!isOpenCompose) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | if (putModel != null && putModel.config.LV >= item.config.LV) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | var itemModels = packModel.GetItems(PackType.Item, new SinglePack.FilterParams() |
| | | { |
| | | itemTypes = new List<int>() { (int)ItemType.Equip_Wing } |
| | | }); |
| | | |
| | | if (itemModels != null) |
| | | { |
| | | for (int i = 0; i < itemModels.Count; i++) |
| | | { |
| | | if (IsJobCompatibleItem(itemModels[i].itemId)) |
| | | { |
| | | if (itemModels[i].config.LV >= item.config.LV) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | private bool CheckIsExtendGrid(int itemId) |
| | | { |
| | | SinglePack singlePack = packModel.GetSinglePack(PackType.Item); |
| | | if (singlePack == null) return false; |
| | | |
| | | int startLockIndex = singlePack.unlockedGridCount - GeneralDefine.initBagGridCount; |
| | | FuncConfigConfig _tagFuncModel = FuncConfigConfig.Get("OpenBagItem"); |
| | | int haveCount = packModel.GetItemCountByID(PackType.Item, itemId); |
| | | Equation.Instance.Clear(); |
| | | Equation.Instance.AddKeyValue("index", startLockIndex + 1); |
| | | int needTool = Equation.Instance.Eval<int>(_tagFuncModel.Numerical2); |
| | | if (haveCount >= needTool) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | public event Action<string> GetBetterEquipEvent; //得到更好的装备 value 物品的实例ID |
| | | |
| | | public void OnGetEquip(ItemModel item) |
| | | { |
| | | if (item == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | if (item.packType != PackType.Item) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | if (!IsJobCompatibleItem(item.itemId)) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | }
|
| | | break;
|
| | | case 127:
|
| | | var error = 0;
|
| | | bool isHaveMakeNum = ItemOperateUtility.Instance.CanUseItem(item.guid, 1, out error);
|
| | | int remainNum = CrossServerOneVsOnePlayerInfo.Instance.GetDayRemainNum();
|
| | | if (!CrossServerOneVsOnePKSeason.Instance.isSatisfyMatch
|
| | | || remainNum > 0
|
| | | || !isHaveMakeNum)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | break;
|
| | | default:
|
| | | break;
|
| | | }
|
| | |
|
| | | switch (item.itemId)
|
| | | {
|
| | | case 951:
|
| | | if (!CheckIsExtendGrid(item.itemId))
|
| | | {
|
| | | return false;
|
| | | }
|
| | | break;
|
| | | case 952:
|
| | | int willTime = HangUpSetModel.Instance.offlinePluginTime + item.config.EffectValueA1;
|
| | | if (HangUpSetModel.Instance.offlinePluginTime >= HangUpSetModel.Instance.maxOfflinePluginTime)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | break;
|
| | |
|
| | | }
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | private bool IsBetterWings(ItemModel item)
|
| | | {
|
| | | if (item == null)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | var putModel = packModel.GetItemByIndex(PackType.Equip, SpiritWeaponModel.WING_EQUIPINDEX);
|
| | | var singlePack = packModel.GetSinglePack(PackType.Item);
|
| | | if (singlePack == null)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | int[] composeTypes = item.config.JumpComposeCondi;
|
| | | bool isOpenCompose = false;
|
| | | if (composeTypes != null && composeTypes.Length >= 3)
|
| | | {
|
| | | int first = composeTypes[0];
|
| | | int second = composeTypes[1];
|
| | | int third = composeTypes[2];
|
| | | ComposeWinModel.ComposeThirdTypeData thirdTypeData = null;
|
| | | composeModel.TryGetThirdTypeData(first, second, third, out thirdTypeData);
|
| | | if (thirdTypeData != null)
|
| | | {
|
| | | var itemCompound = thirdTypeData.itemCompound;
|
| | | if (itemCompound.levelNeed <= PlayerDatas.Instance.baseData.LV)
|
| | | {
|
| | | isOpenCompose = true;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | if (!isOpenCompose)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | if (putModel != null && putModel.config.LV >= item.config.LV)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | var itemModels = packModel.GetItems(PackType.Item, new SinglePack.FilterParams()
|
| | | {
|
| | | itemTypes = new List<int>() { (int)ItemType.Equip_Wing }
|
| | | });
|
| | |
|
| | | if (itemModels != null)
|
| | | {
|
| | | for (int i = 0; i < itemModels.Count; i++)
|
| | | {
|
| | | if (IsJobCompatibleItem(itemModels[i].itemId))
|
| | | {
|
| | | if (itemModels[i].config.LV >= item.config.LV)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | private bool CheckIsExtendGrid(int itemId)
|
| | | {
|
| | | SinglePack singlePack = packModel.GetSinglePack(PackType.Item);
|
| | | if (singlePack == null) return false;
|
| | |
|
| | | int startLockIndex = singlePack.unlockedGridCount - GeneralDefine.initBagGridCount;
|
| | | FuncConfigConfig _tagFuncModel = FuncConfigConfig.Get("OpenBagItem");
|
| | | int haveCount = packModel.GetItemCountByID(PackType.Item, itemId);
|
| | | Equation.Instance.Clear();
|
| | | Equation.Instance.AddKeyValue("index", startLockIndex + 1);
|
| | | int needTool = Equation.Instance.Eval<int>(_tagFuncModel.Numerical2);
|
| | | if (haveCount >= needTool)
|
| | | {
|
| | | return true;
|
| | | }
|
| | | else
|
| | | {
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | public event Action<string> GetBetterEquipEvent; //得到更好的装备 value 物品的实例ID
|
| | |
|
| | | public void OnGetEquip(ItemModel item)
|
| | | {
|
| | | if (item == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | if (item.packType != PackType.Item)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | if (!IsJobCompatibleItem(item.itemId))
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | int equipPlace = item.config.EquipPlace;
|
| | | if ((RoleEquipType)equipPlace == RoleEquipType.Wing)
|
| | | {
|
| | |
| | | {
|
| | | GetBetterEquipEvent(model.guid);
|
| | | }
|
| | | } |
| | | |
| | | public event Action<PackType, string> PickItemEvent; //捡起的物品 |
| | | |
| | | public void RefreshPickItem(PackType type, string guid) |
| | | { |
| | | if (type != PackType.Item) return; |
| | | |
| | | if (PickItemEvent != null) |
| | | { |
| | | PickItemEvent(type, guid); |
| | | } |
| | | } |
| | | |
| | | Dictionary<int, ItemModel> RealmBetterDict = new Dictionary<int, ItemModel>(); |
| | | public Dictionary<int, ItemModel> CheckBetterEquipByRealm() |
| | | { |
| | | RealmBetterDict.Clear(); |
| | | SinglePack singlePack = packModel.GetSinglePack(PackType.Item); |
| | | if (singlePack == null) return RealmBetterDict; |
| | | |
| | | int realmLv = PlayerDatas.Instance.baseData.realmLevel; |
| | | Dictionary<int, ItemModel> pairs = singlePack.GetAllItems(); |
| | | foreach (var model in pairs.Values) |
| | | { |
| | | }
|
| | |
|
| | | public event Action<PackType, string> PickItemEvent; //捡起的物品
|
| | |
|
| | | public void RefreshPickItem(PackType type, string guid)
|
| | | {
|
| | | if (type != PackType.Item) return;
|
| | |
|
| | | if (PickItemEvent != null)
|
| | | {
|
| | | PickItemEvent(type, guid);
|
| | | }
|
| | | }
|
| | |
|
| | | Dictionary<int, ItemModel> RealmBetterDict = new Dictionary<int, ItemModel>();
|
| | | public Dictionary<int, ItemModel> CheckBetterEquipByRealm()
|
| | | {
|
| | | RealmBetterDict.Clear();
|
| | | SinglePack singlePack = packModel.GetSinglePack(PackType.Item);
|
| | | if (singlePack == null) return RealmBetterDict;
|
| | |
|
| | | int realmLv = PlayerDatas.Instance.baseData.realmLevel;
|
| | | Dictionary<int, ItemModel> pairs = singlePack.GetAllItems();
|
| | | foreach (var model in pairs.Values)
|
| | | {
|
| | | var equipServerIndex = EquipSet.ClientPlaceToServerPlace(new Int2(model.config.LV, model.config.EquipPlace));
|
| | | if (model.config.EquipPlace > 0 |
| | | && model.config.EquipPlace != (int)RoleEquipType.Guard |
| | | && model.config.RealmLimit <= realmLv |
| | | && !IsOverdue(model.guid) |
| | | && IsFightUp(model.itemId, model.score) == 1) |
| | | { |
| | | if (!RealmBetterDict.ContainsKey(equipServerIndex)) |
| | | { |
| | | RealmBetterDict.Add(equipServerIndex, model); |
| | | } |
| | | else |
| | | { |
| | | if (model.score > RealmBetterDict[equipServerIndex].score) |
| | | { |
| | | RealmBetterDict[equipServerIndex] = model; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return RealmBetterDict; |
| | | } |
| | | |
| | | List<ItemModel> RealmDruglist = new List<ItemModel>(); |
| | | public List<ItemModel> GetDruglistByRealm() |
| | | { |
| | | RealmDruglist.Clear(); |
| | | SinglePack singlePack = packModel.GetSinglePack(PackType.Item); |
| | | if (singlePack == null) return RealmDruglist; |
| | | |
| | | int realmLv = PlayerDatas.Instance.baseData.realmLevel; |
| | | Dictionary<int, ItemModel> pairs = singlePack.GetAllItems(); |
| | | foreach (var model in pairs.Values) |
| | | { |
| | | if (packModel.CheckIsDrugById(model.itemId)) |
| | | { |
| | | AttrFruitConfig fruitConfig = AttrFruitConfig.Get(model.itemId); |
| | | if (!packModel.IsReachMaxUseDrug(fruitConfig) |
| | | && model.config.RealmLimit <= realmLv) |
| | | { |
| | | RealmDruglist.Add(model); |
| | | } |
| | | } |
| | | } |
| | | return RealmDruglist; |
| | | } |
| | | #endregion |
| | | |
| | | #region 物品处于CD中的逻辑处理 |
| | | |
| | | private List<string> itemEffectTimelist = new List<string>(); //key 物品实例ID |
| | | /// <summary> |
| | | /// 物品使用时间限制 |
| | | /// </summary> |
| | | public void SetItemEffectCDTime(string guid, int itemID, int getTime, int serverSurplusTime) |
| | | { |
| | | double time = GetTimeOffest(TimeUtility.GetTime((uint)getTime)); |
| | | if (time < 0) |
| | | { |
| | | time = 0; |
| | | } |
| | | |
| | | ItemConfig itemConfig = ItemConfig.Get(itemID); |
| | | if (time >= itemConfig.ExpireTime) |
| | | { |
| | | KnapsackTimeCDMgr.Instance.UnRegister(guid); |
| | | return; |
| | | } |
| | | double remainTime = (serverSurplusTime > 0 ? serverSurplusTime : itemConfig.ExpireTime) - time; |
| | | KnapsackTimeCDMgr.Instance.Register(guid, itemID, remainTime); |
| | | } |
| | | |
| | | public double GetTimeOffest(DateTime getTime) |
| | | { |
| | | DebugEx.Log("现在时间:" + TimeUtility.ServerNow + "获得时间:" + getTime); |
| | | //TimeUtility.SyncServerTime(); |
| | | TimeSpan t = TimeUtility.ServerNow - getTime; |
| | | DebugEx.Log("时间差:" + t.TotalSeconds); |
| | | return t.TotalSeconds; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 设置可以一键出售的物品数据 |
| | | |
| | | private int playerLv; |
| | | private Dictionary<int, List<ItemModel>> _lifePotionDict = new Dictionary<int, List<ItemModel>>(); //key 药水等级 |
| | | private List<int> _sellItemScorelist = new List<int>(); |
| | | if (model.config.EquipPlace > 0
|
| | | && model.config.EquipPlace != (int)RoleEquipType.Guard
|
| | | && model.config.RealmLimit <= realmLv
|
| | | && !IsOverdue(model.guid)
|
| | | && IsFightUp(model.itemId, model.score) == 1)
|
| | | {
|
| | | if (!RealmBetterDict.ContainsKey(equipServerIndex))
|
| | | {
|
| | | RealmBetterDict.Add(equipServerIndex, model);
|
| | | }
|
| | | else
|
| | | {
|
| | | if (model.score > RealmBetterDict[equipServerIndex].score)
|
| | | {
|
| | | RealmBetterDict[equipServerIndex] = model;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | return RealmBetterDict;
|
| | | }
|
| | |
|
| | | List<ItemModel> RealmDruglist = new List<ItemModel>();
|
| | | public List<ItemModel> GetDruglistByRealm()
|
| | | {
|
| | | RealmDruglist.Clear();
|
| | | SinglePack singlePack = packModel.GetSinglePack(PackType.Item);
|
| | | if (singlePack == null) return RealmDruglist;
|
| | |
|
| | | int realmLv = PlayerDatas.Instance.baseData.realmLevel;
|
| | | Dictionary<int, ItemModel> pairs = singlePack.GetAllItems();
|
| | | foreach (var model in pairs.Values)
|
| | | {
|
| | | if (packModel.CheckIsDrugById(model.itemId))
|
| | | {
|
| | | AttrFruitConfig fruitConfig = AttrFruitConfig.Get(model.itemId);
|
| | | if (!packModel.IsReachMaxUseDrug(fruitConfig)
|
| | | && model.config.RealmLimit <= realmLv)
|
| | | {
|
| | | RealmDruglist.Add(model);
|
| | | }
|
| | | }
|
| | | }
|
| | | return RealmDruglist;
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 物品处于CD中的逻辑处理
|
| | |
|
| | | private List<string> itemEffectTimelist = new List<string>(); //key 物品实例ID
|
| | | /// <summary>
|
| | | /// 物品使用时间限制
|
| | | /// </summary>
|
| | | public void SetItemEffectCDTime(string guid, int itemID, int getTime, int serverSurplusTime)
|
| | | {
|
| | | double time = GetTimeOffest(TimeUtility.GetTime((uint)getTime));
|
| | | if (time < 0)
|
| | | {
|
| | | time = 0;
|
| | | }
|
| | |
|
| | | ItemConfig itemConfig = ItemConfig.Get(itemID);
|
| | | if (time >= itemConfig.ExpireTime)
|
| | | {
|
| | | KnapsackTimeCDMgr.Instance.UnRegister(guid);
|
| | | return;
|
| | | }
|
| | | double remainTime = (serverSurplusTime > 0 ? serverSurplusTime : itemConfig.ExpireTime) - time;
|
| | | KnapsackTimeCDMgr.Instance.Register(guid, itemID, remainTime);
|
| | | }
|
| | |
|
| | | public double GetTimeOffest(DateTime getTime)
|
| | | {
|
| | | DebugEx.Log("现在时间:" + TimeUtility.ServerNow + "获得时间:" + getTime);
|
| | | //TimeUtility.SyncServerTime();
|
| | | TimeSpan t = TimeUtility.ServerNow - getTime;
|
| | | DebugEx.Log("时间差:" + t.TotalSeconds);
|
| | | return t.TotalSeconds;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region 设置可以一键出售的物品数据
|
| | |
|
| | | private int playerLv;
|
| | | private Dictionary<int, List<ItemModel>> _lifePotionDict = new Dictionary<int, List<ItemModel>>(); //key 药水等级
|
| | | private List<int> _sellItemScorelist = new List<int>();
|
| | | private Dictionary<int, Dictionary<int, List<ItemModel>>> _sameIndexEquipDict = new Dictionary<int, Dictionary<int, List<ItemModel>>>(); //存储相同装备位的装备
|
| | | // private _sameEquipScoreDict = new Dictionary<int, List<ItemModel>>(); //存储相同ID中相同装备评分的装备
|
| | | private Dictionary<int, ItemModel> _packModelDict; |
| | | private List<ItemModel> _sellItemlist = new List<ItemModel>(); |
| | | |
| | | public List<ItemModel> GetSellItemList() |
| | | { |
| | | GetOneKeySellModel(); |
| | | _sellItemlist.Sort(SetSellItemOrder); |
| | | return _sellItemlist; |
| | | } |
| | | |
| | | public int SetSellItemOrder(ItemModel startModel, ItemModel endModel) |
| | | { |
| | | bool startIsEquip = IsRealmEquip(startModel.itemId); |
| | | bool endIsEquip = IsRealmEquip(endModel.itemId); |
| | | if (startIsEquip.CompareTo(endIsEquip) != 0) return -startIsEquip.CompareTo(endIsEquip); |
| | | int order1 = startModel.config.Type; |
| | | int order2 = endModel.config.Type; |
| | | if (order1.CompareTo(order2) != 0) return order1.CompareTo(order2); |
| | | int color1 = startModel.config.ItemColor; |
| | | int color2 = endModel.config.ItemColor; |
| | | if (color1.CompareTo(color2) != 0) return -color1.CompareTo(color2); |
| | | int code1 = startModel.itemId; |
| | | int code2 = endModel.itemId; |
| | | if (code1.CompareTo(code2) != 0) return -code1.CompareTo(code2); |
| | | return 0; |
| | | } |
| | | |
| | | public void GetOneKeySellModel() |
| | | { |
| | | SinglePack singlePack = packModel.GetSinglePack(PackType.Item); |
| | | if (singlePack == null) |
| | | return; |
| | | |
| | | _sellItemlist.Clear(); |
| | | _lifePotionDict.Clear(); |
| | | _sameIndexEquipDict.Clear(); |
| | | _sellItemScorelist.Clear(); |
| | | playerLv = PlayerDatas.Instance.baseData.LV; |
| | | _packModelDict = singlePack.GetAllItems(); |
| | | foreach (var key in _packModelDict.Keys) |
| | | { |
| | | GetCanSellEquipList(_packModelDict[key]); |
| | | ItemModel itemModel = _packModelDict[key]; |
| | | if (drugIDs.Contains(itemModel.itemId)) |
| | | { |
| | | if (!_lifePotionDict.ContainsKey(itemModel.config.LV)) |
| | | { |
| | | List<ItemModel> modellist = new List<ItemModel>(); |
| | | modellist.Add(itemModel); |
| | | _lifePotionDict.Add(itemModel.config.LV, modellist); |
| | | } |
| | | else |
| | | { |
| | | _lifePotionDict[itemModel.config.LV].Add(itemModel); |
| | | } |
| | | } |
| | | } |
| | | |
| | | #region 得到可以出售的装备 |
| | | foreach (var key in _sameIndexEquipDict.Keys) |
| | | { |
| | | _sellItemScorelist = _sameIndexEquipDict[key].Keys.ToList(); |
| | | _sellItemScorelist.Sort(); |
| | | if (_sellItemScorelist.Count > 0) |
| | | { |
| | | int score = 0; |
| | | for (score = _sellItemScorelist.Count - 1; score > -1; score--) |
| | | { |
| | | SinglePack equipPack = packModel.GetSinglePack(PackType.Equip); |
| | | ItemModel model = null; |
| | | if (equipPack != null) |
| | | { |
| | | model = equipPack.GetItemByIndex(key); |
| | | } |
| | | |
| | | var modellist = _sameIndexEquipDict[key][_sellItemScorelist[score]]; |
| | | bool remainBetter = true; |
| | | for (var i = 0; i < modellist.Count; i++) |
| | | { |
| | | if (model != null) |
| | | { |
| | | if (remainBetter) |
| | | { |
| | | if (model.score < _sellItemScorelist[score] && IsJobCompatibleItem(model.itemId)) |
| | | { |
| | | _sameIndexEquipDict[key].Remove(_sellItemScorelist[score]); |
| | | remainBetter = false; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | if (IsJobCompatibleItem(model.itemId)) |
| | | { |
| | | if (remainBetter) |
| | | { |
| | | _sameIndexEquipDict[key].Remove(_sellItemScorelist[score]); |
| | | remainBetter = false; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!remainBetter) |
| | | { |
| | | break; |
| | | } |
| | | |
| | | } |
| | | |
| | | for (var j = 0; j < _sellItemScorelist.Count; j++) |
| | | { |
| | | |
| | | if (_sameIndexEquipDict[key].ContainsKey(_sellItemScorelist[j])) |
| | | { |
| | | var sellModlelist = _sameIndexEquipDict[key][_sellItemScorelist[j]]; |
| | | for (var k = 0; k < sellModlelist.Count; k++) |
| | | { |
| | | _sellItemlist.Add(sellModlelist[k]); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | List<int> drugLvlist = new List<int>(); |
| | | drugLvlist.AddRange(_lifePotionDict.Keys.ToList()); |
| | | drugLvlist.Sort(); |
| | | for (int i = drugLvlist.Count - 1; i > -1; i--) |
| | | { |
| | | if (drugLvlist[i] > playerLv) |
| | | { |
| | | _lifePotionDict.Remove(drugLvlist[i]); |
| | | } |
| | | else |
| | | { |
| | | _lifePotionDict.Remove(drugLvlist[i]); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | foreach (var list in _lifePotionDict.Values) |
| | | { |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | _sellItemlist.Add(list[i]); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | //得到满足出售条件的装备列表 |
| | | public void GetCanSellEquipList(ItemModel model) |
| | | { |
| | | |
| | | if (model.config.EquipPlace == 0 || !onekeySellTypes.Contains(model.config.Type)) |
| | | return; |
| | | |
| | | Dictionary<int, List<ItemModel>> sameScoreDict; |
| | | List<ItemModel> sameScorelist; |
| | | |
| | | if (model.config.ItemColor < 3) |
| | | { |
| | | if (!_sameIndexEquipDict.ContainsKey(model.config.EquipPlace)) |
| | | { |
| | | sameScoreDict = new Dictionary<int, List<ItemModel>>(); |
| | | sameScorelist = new List<ItemModel>(); |
| | | sameScorelist.Add(model); |
| | | sameScoreDict.Add(model.score, sameScorelist); |
| | | _sameIndexEquipDict.Add(model.config.EquipPlace, sameScoreDict); |
| | | |
| | | } |
| | | else |
| | | { |
| | | if (_sameIndexEquipDict[model.config.EquipPlace].ContainsKey(model.score)) |
| | | { |
| | | _sameIndexEquipDict[model.config.EquipPlace][model.score].Add(model); |
| | | } |
| | | else |
| | | { |
| | | sameScorelist = new List<ItemModel>(); |
| | | sameScorelist.Add(model); |
| | | _sameIndexEquipDict[model.config.EquipPlace].Add(model.score, sameScorelist); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 发送请求 |
| | | /// <summary> |
| | | /// 一键出售物品的请求 |
| | | /// </summary> |
| | | /// <param name="_oneKeySelllist"></param> |
| | | public void OneKeySell(List<ItemModel> _oneKeySelllist) |
| | | { |
| | | if (!isPackResetOk || SettingEffectMgr.Instance.isStartOneKeySell) return; |
| | | |
| | | SettingEffectMgr.Instance.isStartOneKeySell = true; |
| | | byte[] itemIndexs = new byte[_oneKeySelllist.Count]; |
| | | int i = 0; |
| | | for (i = 0; i < _oneKeySelllist.Count; i++) |
| | | { |
| | | itemIndexs[i] = (byte)_oneKeySelllist[i].gridIndex; |
| | | } |
| | | CA311_tagCMSellItem sellItem = new CA311_tagCMSellItem(); |
| | | sellItem.PackType = (int)PackType.Item; |
| | | sellItem.Count = (byte)_oneKeySelllist.Count; |
| | | sellItem.ItemIndex = itemIndexs; |
| | | GameNetSystem.Instance.SendInfo(sellItem); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 整理包裹物品 |
| | | /// </summary> |
| | | /// <param name="type"></param> |
| | | public bool isPackResetOk { get; set; } |
| | | public void ResetPack(PackType type) |
| | | { |
| | | if (lookLineIndex > -1) |
| | | { |
| | | SetLookIndex(null); |
| | | } |
| | | |
| | | if (KnapSackWin.titleType == KnapsackFuncTitle.bag) |
| | | { |
| | | packModel.isPlayBetterEquipEffect = true; |
| | | } |
| | | |
| | | SinglePack singlePack = packModel.GetSinglePack(type); |
| | | if (singlePack != null) |
| | | { |
| | | var packReset = new C070F_tagCItemPackReset(); |
| | | packReset.Type = (byte)type; |
| | | packReset.ItemBeginIndex = 0; |
| | | packReset.ItemEndIndex = (ushort)(singlePack.unlockedGridCount - 1); |
| | | GameNetSystem.Instance.SendInfo(packReset); //整理物品 |
| | | if (type == PackType.Item) |
| | | { |
| | | isPackResetOk = false; |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 查看某个位置的物品 |
| | | public event Action lookEquipEvent; |
| | | private int _lookLineIndex = -1; |
| | | public int lookLineIndex { get { return _lookLineIndex; } private set { _lookLineIndex = value; } } |
| | | |
| | | public string lookItemGUID { get; private set; } |
| | | |
| | | public void SetLookIndex(string guid, int singleRowCount = 5) |
| | | { |
| | | |
| | | if (string.IsNullOrEmpty(guid) || guid == "") |
| | | { |
| | | lookLineIndex = -1; |
| | | } |
| | | else |
| | | { |
| | | int index = packModel.GetItemByGuid(guid).gridIndex; |
| | | lookLineIndex = index / singleRowCount; |
| | | lookItemGUID = guid; |
| | | } |
| | | |
| | | if (lookEquipEvent != null) |
| | | { |
| | | lookEquipEvent(); |
| | | } |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | #region 判断是否有更好的装备替换 |
| | | |
| | | /// <summary> |
| | | /// 获取装备评分最高可提升战力的装备 |
| | | /// </summary> |
| | | /// <param name="_places"></param> |
| | | /// <returns></returns> |
| | | public string GetHighestScoreEquipByPlace(int equipPlace) |
| | | { |
| | | var itemPackage = packModel.GetSinglePack(PackType.Item); |
| | | var allItems = itemPackage.GetAllItems(); |
| | | var putModel = packModel.GetItemByIndex(PackType.Equip, equipPlace); |
| | | var guid = string.Empty; |
| | | var score = putModel == null ? 0 : putModel.score; |
| | | foreach (var item in allItems.Values) |
| | | { |
| | | if (item.config.EquipPlace == equipPlace) |
| | | { |
| | | if (!IsOverdue(item.guid) |
| | | && (IsJobCompatibleItem(item.itemId)) && item.score > score) |
| | | { |
| | | guid = item.guid; |
| | | score = item.score; |
| | | } |
| | | } |
| | | } |
| | | |
| | | return guid; |
| | | } |
| | | #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) |
| | | { |
| | | if (IsJobCompatibleItem(item.itemId)) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | int equipPlace = item.config.EquipPlace; |
| | | if (equipPlace == 0 || equipPlace > 17) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | var putOnlimitList = item.GetUseData((int)ItemUseDataKey.cancelUseLimit); |
| | | if (!putOnlimitList.IsNullOrEmpty()) |
| | | { |
| | | if (putOnlimitList[0] == 1) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | return PlayerDatas.Instance.baseData.realmLevel >= item.config.RealmLimit; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 得到物品的品质颜色 |
| | | private Dictionary<int, int> wingRefineQualityDict; |
| | | private int[] wingsQualitys; |
| | | private int[] wingsRefineExps; |
| | | public int GetItemQuality(int itemId, Dictionary<int, List<int>> useDataDic = null) |
| | | { |
| | | wingsQualitys = null; |
| | | wingsRefineExps = null; |
| | | ItemConfig itemConfig = ItemConfig.Get(itemId); |
| | | wingRefineQualityDict = WingRefineAttrConfig.GetWingsQualityModel(itemConfig.LV); |
| | | if (useDataDic != null) |
| | | { |
| | | if (useDataDic.ContainsKey(42) && wingRefineQualityDict != null) |
| | | { |
| | | wingsQualitys = wingRefineQualityDict.Keys.ToArray(); |
| | | wingsRefineExps = wingRefineQualityDict.Values.ToArray(); |
| | | int i = 0; |
| | | for (i = wingsRefineExps.Length - 1; i > -1; i--) |
| | | { |
| | | if (useDataDic[42][0] >= wingsRefineExps[i]) |
| | | { |
| | | return wingsQualitys[i]; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return itemConfig.ItemColor; |
| | | } |
| | | #endregion |
| | | |
| | | //设置玩家货币显示 |
| | | public string OnChangeCoinsUnit(ulong value) |
| | | { |
| | | string strCoins = value.ToString(); |
| | | if (strCoins.Length > 4 && strCoins.Length < 9) |
| | | { |
| | | private Dictionary<int, ItemModel> _packModelDict;
|
| | | private List<ItemModel> _sellItemlist = new List<ItemModel>();
|
| | |
|
| | | public List<ItemModel> GetSellItemList()
|
| | | {
|
| | | GetOneKeySellModel();
|
| | | _sellItemlist.Sort(SetSellItemOrder);
|
| | | return _sellItemlist;
|
| | | }
|
| | |
|
| | | public int SetSellItemOrder(ItemModel startModel, ItemModel endModel)
|
| | | {
|
| | | bool startIsEquip = IsRealmEquip(startModel.itemId);
|
| | | bool endIsEquip = IsRealmEquip(endModel.itemId);
|
| | | if (startIsEquip.CompareTo(endIsEquip) != 0) return -startIsEquip.CompareTo(endIsEquip);
|
| | | int order1 = startModel.config.Type;
|
| | | int order2 = endModel.config.Type;
|
| | | if (order1.CompareTo(order2) != 0) return order1.CompareTo(order2);
|
| | | int color1 = startModel.config.ItemColor;
|
| | | int color2 = endModel.config.ItemColor;
|
| | | if (color1.CompareTo(color2) != 0) return -color1.CompareTo(color2);
|
| | | int code1 = startModel.itemId;
|
| | | int code2 = endModel.itemId;
|
| | | if (code1.CompareTo(code2) != 0) return -code1.CompareTo(code2);
|
| | | return 0;
|
| | | }
|
| | |
|
| | | public void GetOneKeySellModel()
|
| | | {
|
| | | SinglePack singlePack = packModel.GetSinglePack(PackType.Item);
|
| | | if (singlePack == null)
|
| | | return;
|
| | |
|
| | | _sellItemlist.Clear();
|
| | | _lifePotionDict.Clear();
|
| | | _sameIndexEquipDict.Clear();
|
| | | _sellItemScorelist.Clear();
|
| | | playerLv = PlayerDatas.Instance.baseData.LV;
|
| | | _packModelDict = singlePack.GetAllItems();
|
| | | foreach (var key in _packModelDict.Keys)
|
| | | {
|
| | | GetCanSellEquipList(_packModelDict[key]);
|
| | | ItemModel itemModel = _packModelDict[key];
|
| | | if (drugIDs.Contains(itemModel.itemId))
|
| | | {
|
| | | if (!_lifePotionDict.ContainsKey(itemModel.config.LV))
|
| | | {
|
| | | List<ItemModel> modellist = new List<ItemModel>();
|
| | | modellist.Add(itemModel);
|
| | | _lifePotionDict.Add(itemModel.config.LV, modellist);
|
| | | }
|
| | | else
|
| | | {
|
| | | _lifePotionDict[itemModel.config.LV].Add(itemModel);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | #region 得到可以出售的装备
|
| | | foreach (var key in _sameIndexEquipDict.Keys)
|
| | | {
|
| | | _sellItemScorelist = _sameIndexEquipDict[key].Keys.ToList();
|
| | | _sellItemScorelist.Sort();
|
| | | if (_sellItemScorelist.Count > 0)
|
| | | {
|
| | | int score = 0;
|
| | | for (score = _sellItemScorelist.Count - 1; score > -1; score--)
|
| | | {
|
| | | SinglePack equipPack = packModel.GetSinglePack(PackType.Equip);
|
| | | ItemModel model = null;
|
| | | if (equipPack != null)
|
| | | {
|
| | | model = equipPack.GetItemByIndex(key);
|
| | | }
|
| | |
|
| | | var modellist = _sameIndexEquipDict[key][_sellItemScorelist[score]];
|
| | | bool remainBetter = true;
|
| | | for (var i = 0; i < modellist.Count; i++)
|
| | | {
|
| | | if (model != null)
|
| | | {
|
| | | if (remainBetter)
|
| | | {
|
| | | if (model.score < _sellItemScorelist[score] && IsJobCompatibleItem(model.itemId))
|
| | | {
|
| | | _sameIndexEquipDict[key].Remove(_sellItemScorelist[score]);
|
| | | remainBetter = false;
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | else
|
| | | {
|
| | | if (IsJobCompatibleItem(model.itemId))
|
| | | {
|
| | | if (remainBetter)
|
| | | {
|
| | | _sameIndexEquipDict[key].Remove(_sellItemScorelist[score]);
|
| | | remainBetter = false;
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | if (!remainBetter)
|
| | | {
|
| | | break;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | for (var j = 0; j < _sellItemScorelist.Count; j++)
|
| | | {
|
| | |
|
| | | if (_sameIndexEquipDict[key].ContainsKey(_sellItemScorelist[j]))
|
| | | {
|
| | | var sellModlelist = _sameIndexEquipDict[key][_sellItemScorelist[j]];
|
| | | for (var k = 0; k < sellModlelist.Count; k++)
|
| | | {
|
| | | _sellItemlist.Add(sellModlelist[k]);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | | #endregion
|
| | |
|
| | | List<int> drugLvlist = new List<int>();
|
| | | drugLvlist.AddRange(_lifePotionDict.Keys.ToList());
|
| | | drugLvlist.Sort();
|
| | | for (int i = drugLvlist.Count - 1; i > -1; i--)
|
| | | {
|
| | | if (drugLvlist[i] > playerLv)
|
| | | {
|
| | | _lifePotionDict.Remove(drugLvlist[i]);
|
| | | }
|
| | | else
|
| | | {
|
| | | _lifePotionDict.Remove(drugLvlist[i]);
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | foreach (var list in _lifePotionDict.Values)
|
| | | {
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | {
|
| | | _sellItemlist.Add(list[i]);
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | //得到满足出售条件的装备列表
|
| | | public void GetCanSellEquipList(ItemModel model)
|
| | | {
|
| | |
|
| | | if (model.config.EquipPlace == 0 || !onekeySellTypes.Contains(model.config.Type))
|
| | | return;
|
| | |
|
| | | Dictionary<int, List<ItemModel>> sameScoreDict;
|
| | | List<ItemModel> sameScorelist;
|
| | |
|
| | | if (model.config.ItemColor < 3)
|
| | | {
|
| | | if (!_sameIndexEquipDict.ContainsKey(model.config.EquipPlace))
|
| | | {
|
| | | sameScoreDict = new Dictionary<int, List<ItemModel>>();
|
| | | sameScorelist = new List<ItemModel>();
|
| | | sameScorelist.Add(model);
|
| | | sameScoreDict.Add(model.score, sameScorelist);
|
| | | _sameIndexEquipDict.Add(model.config.EquipPlace, sameScoreDict);
|
| | |
|
| | | }
|
| | | else
|
| | | {
|
| | | if (_sameIndexEquipDict[model.config.EquipPlace].ContainsKey(model.score))
|
| | | {
|
| | | _sameIndexEquipDict[model.config.EquipPlace][model.score].Add(model);
|
| | | }
|
| | | else
|
| | | {
|
| | | sameScorelist = new List<ItemModel>();
|
| | | sameScorelist.Add(model);
|
| | | _sameIndexEquipDict[model.config.EquipPlace].Add(model.score, sameScorelist);
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region 发送请求
|
| | | /// <summary>
|
| | | /// 一键出售物品的请求
|
| | | /// </summary>
|
| | | /// <param name="_oneKeySelllist"></param>
|
| | | public void OneKeySell(List<ItemModel> _oneKeySelllist)
|
| | | {
|
| | | if (!isPackResetOk || SettingEffectMgr.Instance.isStartOneKeySell) return;
|
| | |
|
| | | SettingEffectMgr.Instance.isStartOneKeySell = true;
|
| | | byte[] itemIndexs = new byte[_oneKeySelllist.Count];
|
| | | int i = 0;
|
| | | for (i = 0; i < _oneKeySelllist.Count; i++)
|
| | | {
|
| | | itemIndexs[i] = (byte)_oneKeySelllist[i].gridIndex;
|
| | | }
|
| | | CA311_tagCMSellItem sellItem = new CA311_tagCMSellItem();
|
| | | sellItem.PackType = (int)PackType.Item;
|
| | | sellItem.Count = (byte)_oneKeySelllist.Count;
|
| | | sellItem.ItemIndex = itemIndexs;
|
| | | GameNetSystem.Instance.SendInfo(sellItem);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 整理包裹物品
|
| | | /// </summary>
|
| | | /// <param name="type"></param>
|
| | | public bool isPackResetOk { get; set; }
|
| | | public void ResetPack(PackType type)
|
| | | {
|
| | | if (lookLineIndex > -1)
|
| | | {
|
| | | SetLookIndex(null);
|
| | | }
|
| | |
|
| | | if (KnapSackWin.titleType == KnapsackFuncTitle.bag)
|
| | | {
|
| | | packModel.isPlayBetterEquipEffect = true;
|
| | | }
|
| | |
|
| | | SinglePack singlePack = packModel.GetSinglePack(type);
|
| | | if (singlePack != null)
|
| | | {
|
| | | var packReset = new C070F_tagCItemPackReset();
|
| | | packReset.Type = (byte)type;
|
| | | packReset.ItemBeginIndex = 0;
|
| | | packReset.ItemEndIndex = (ushort)(singlePack.unlockedGridCount - 1);
|
| | | GameNetSystem.Instance.SendInfo(packReset); //整理物品
|
| | | if (type == PackType.Item)
|
| | | {
|
| | | isPackResetOk = false;
|
| | | }
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 查看某个位置的物品
|
| | | public event Action lookEquipEvent;
|
| | | private int _lookLineIndex = -1;
|
| | | public int lookLineIndex { get { return _lookLineIndex; } private set { _lookLineIndex = value; } }
|
| | |
|
| | | public string lookItemGUID { get; private set; }
|
| | |
|
| | | public void SetLookIndex(string guid, int singleRowCount = 5)
|
| | | {
|
| | |
|
| | | if (string.IsNullOrEmpty(guid) || guid == "")
|
| | | {
|
| | | lookLineIndex = -1;
|
| | | }
|
| | | else
|
| | | {
|
| | | int index = packModel.GetItemByGuid(guid).gridIndex;
|
| | | lookLineIndex = index / singleRowCount;
|
| | | lookItemGUID = guid;
|
| | | }
|
| | |
|
| | | if (lookEquipEvent != null)
|
| | | {
|
| | | lookEquipEvent();
|
| | | }
|
| | |
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 判断是否有更好的装备替换
|
| | |
|
| | | /// <summary>
|
| | | /// 获取装备评分最高可提升战力的装备
|
| | | /// </summary>
|
| | | /// <param name="_places"></param>
|
| | | /// <returns></returns>
|
| | | public string GetHighestScoreEquipByPlace(int equipPlace)
|
| | | {
|
| | | var itemPackage = packModel.GetSinglePack(PackType.Item);
|
| | | var allItems = itemPackage.GetAllItems();
|
| | | var putModel = packModel.GetItemByIndex(PackType.Equip, equipPlace);
|
| | | var guid = string.Empty;
|
| | | var score = putModel == null ? 0 : putModel.score;
|
| | | foreach (var item in allItems.Values)
|
| | | {
|
| | | if (item.config.EquipPlace == equipPlace)
|
| | | {
|
| | | if (!IsOverdue(item.guid)
|
| | | && (IsJobCompatibleItem(item.itemId)) && item.score > score)
|
| | | {
|
| | | guid = item.guid;
|
| | | score = item.score;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | return guid;
|
| | | }
|
| | | #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)
|
| | | {
|
| | | if (IsJobCompatibleItem(item.itemId))
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | int equipPlace = item.config.EquipPlace;
|
| | | if (equipPlace == 0 || equipPlace > 17)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | var putOnlimitList = item.GetUseData((int)ItemUseDataKey.cancelUseLimit);
|
| | | if (!putOnlimitList.IsNullOrEmpty())
|
| | | {
|
| | | if (putOnlimitList[0] == 1)
|
| | | {
|
| | | return true;
|
| | | }
|
| | | }
|
| | |
|
| | | return PlayerDatas.Instance.baseData.realmLevel >= item.config.RealmLimit;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region 得到物品的品质颜色
|
| | | private Dictionary<int, int> wingRefineQualityDict;
|
| | | private int[] wingsQualitys;
|
| | | private int[] wingsRefineExps;
|
| | | public int GetItemQuality(int itemId, Dictionary<int, List<int>> useDataDic = null)
|
| | | {
|
| | | wingsQualitys = null;
|
| | | wingsRefineExps = null;
|
| | | ItemConfig itemConfig = ItemConfig.Get(itemId);
|
| | | wingRefineQualityDict = WingRefineAttrConfig.GetWingsQualityModel(itemConfig.LV);
|
| | | if (useDataDic != null)
|
| | | {
|
| | | if (useDataDic.ContainsKey(42) && wingRefineQualityDict != null)
|
| | | {
|
| | | wingsQualitys = wingRefineQualityDict.Keys.ToArray();
|
| | | wingsRefineExps = wingRefineQualityDict.Values.ToArray();
|
| | | int i = 0;
|
| | | for (i = wingsRefineExps.Length - 1; i > -1; i--)
|
| | | {
|
| | | if (useDataDic[42][0] >= wingsRefineExps[i])
|
| | | {
|
| | | return wingsQualitys[i];
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | return itemConfig.ItemColor;
|
| | | }
|
| | | #endregion
|
| | |
|
| | | //设置玩家货币显示
|
| | | public string OnChangeCoinsUnit(ulong value)
|
| | | {
|
| | | string strCoins = value.ToString();
|
| | | if (strCoins.Length > 4 && strCoins.Length < 9)
|
| | | {
|
| | |
|
| | | if (strCoins.Length < 7)
|
| | | {
|
| | | double coins = (double)value / 10000;
|
| | | strCoins = coins.ToString("0.00").Replace(".00", "") + Language.Get("KnapS114"); |
| | | } |
| | | strCoins = coins.ToString("0.00").Replace(".00", "") + Language.Get("KnapS114");
|
| | | }
|
| | | else
|
| | | {
|
| | | double coins = Math.Floor((double)value / 10000); |
| | | double coins = Math.Floor((double)value / 10000);
|
| | | strCoins = coins + Language.Get("KnapS114");
|
| | | } |
| | | } |
| | | else if (strCoins.Length >= 9 && strCoins.Length < 13) |
| | | { |
| | | }
|
| | | }
|
| | | else if (strCoins.Length >= 9 && strCoins.Length < 13)
|
| | | {
|
| | | if (strCoins.Length < 11)
|
| | | {
|
| | | double coins = (double)value / 100000000; |
| | | strCoins = coins.ToString("0.00").Replace(".00", "") + Language.Get("KnapS115"); |
| | | } |
| | | double coins = (double)value / 100000000;
|
| | | strCoins = coins.ToString("0.00").Replace(".00", "") + Language.Get("KnapS115");
|
| | | }
|
| | | else
|
| | | {
|
| | | double coins = Math.Floor((double)value / 100000000); |
| | | double coins = Math.Floor((double)value / 100000000);
|
| | | strCoins = coins + Language.Get("KnapS115");
|
| | | } |
| | | } |
| | | else if (strCoins.Length >= 13 && strCoins.Length < 19) |
| | | { |
| | | double coins = (double)value / 1000000000000; |
| | | strCoins = coins.ToString("0.00").Replace(".00", "") + Language.Get("KnapS126"); |
| | | } |
| | | else if (strCoins.Length >= 19) |
| | | { |
| | | ServerTipDetails.DisplayNormalTip(Language.Get("KnapS127")); |
| | | } |
| | | return strCoins; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 装备是否可以提升战力 |
| | | /// </summary> |
| | | /// <param name="_itemID"></param> |
| | | /// <param name="_score"></param> |
| | | /// <returns></returns> |
| | | public int IsFightUp(int _itemID, int _score)//-1低级,0不是本职业,1更好 |
| | | { |
| | | var config = ItemConfig.Get(_itemID); |
| | | if (config != null) |
| | | { |
| | | var index = EquipModel.GetItemServerEquipPlace(_itemID); |
| | | if (index == -1) |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | var item = packModel.GetItemByIndex(PackType.Equip, index); |
| | | var equipScore = item != null ? item.score : 0; |
| | | if (IsJobCompatibleItem(_itemID)) |
| | | { |
| | | return _score.CompareTo(equipScore); |
| | | } |
| | | else |
| | | { |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | #region 物品是否过期 |
| | | |
| | | public bool IsOverdue(string guid) |
| | | { |
| | | var item = packModel.GetItemByGuid(guid); |
| | | if (item == null) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | if (item.isAuction) |
| | | { |
| | | return item.auctionSurplusTime < 0; |
| | | } |
| | | else |
| | | { |
| | | var isoverdue = false; |
| | | }
|
| | | }
|
| | | else if (strCoins.Length >= 13 && strCoins.Length < 19)
|
| | | {
|
| | | double coins = (double)value / 1000000000000;
|
| | | strCoins = coins.ToString("0.00").Replace(".00", "") + Language.Get("KnapS126");
|
| | | }
|
| | | else if (strCoins.Length >= 19)
|
| | | {
|
| | | ServerTipDetails.DisplayNormalTip(Language.Get("KnapS127"));
|
| | | }
|
| | | return strCoins;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 装备是否可以提升战力
|
| | | /// </summary>
|
| | | /// <param name="_itemID"></param>
|
| | | /// <param name="_score"></param>
|
| | | /// <returns></returns>
|
| | | public int IsFightUp(int _itemID, int _score)//-1低级,0不是本职业,1更好
|
| | | {
|
| | | var config = ItemConfig.Get(_itemID);
|
| | | if (config != null)
|
| | | {
|
| | | var index = EquipModel.GetItemServerEquipPlace(_itemID);
|
| | | if (index == -1)
|
| | | {
|
| | | return 0;
|
| | | }
|
| | |
|
| | | var item = packModel.GetItemByIndex(PackType.Equip, index);
|
| | | var equipScore = item != null ? item.score : 0;
|
| | | if (IsJobCompatibleItem(_itemID))
|
| | | {
|
| | | return _score.CompareTo(equipScore);
|
| | | }
|
| | | else
|
| | | {
|
| | | return 0;
|
| | | }
|
| | | }
|
| | |
|
| | | return 0;
|
| | | }
|
| | |
|
| | | #region 物品是否过期
|
| | |
|
| | | public bool IsOverdue(string guid)
|
| | | {
|
| | | var item = packModel.GetItemByGuid(guid);
|
| | | if (item == null)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | if (item.isAuction)
|
| | | {
|
| | | return item.auctionSurplusTime < 0;
|
| | | }
|
| | | else
|
| | | {
|
| | | var isoverdue = false;
|
| | | switch ((ItemTimeType)item.config.EndureReduceType)
|
| | | {
|
| | | case ItemTimeType.EquipedTime:
|
| | |
| | | case ItemTimeType.RealityTime:
|
| | | isoverdue = item.overdueSurplusTime < 0;
|
| | | break;
|
| | | } |
| | | |
| | | return isoverdue; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | public bool IsJobCompatibleItem(int itemId) |
| | | { |
| | | var config = ItemConfig.Get(itemId); |
| | | return config != null && (config.JobLimit == 0 || config.JobLimit == PlayerDatas.Instance.baseData.Job); |
| | | } |
| | | |
| | | public bool IsRealmEquip(int itemId) |
| | | { |
| | | if (!ItemConfig.Has(itemId)) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | var config = ItemConfig.Get(itemId); |
| | | return config.Type >= 101 && config.Type <= 112; |
| | | } |
| | | |
| | | public bool IsWing(int itemId) |
| | | { |
| | | if (!ItemConfig.Has(itemId)) |
| | | { |
| | | return false; |
| | | } |
| | | var config = ItemConfig.Get(itemId); |
| | | return config.Type == 113 || config.Type == 39 || config.Type == 52; |
| | | } |
| | | |
| | | public bool IsDogzEquip(int itemId) |
| | | { |
| | | if (!ItemConfig.Has(itemId)) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | var config = ItemConfig.Get(itemId); |
| | | return config.Type >= 119 && config.Type <= 123; |
| | | } |
| | | |
| | | public bool IsSpiritWeapon(int itemId) |
| | | { |
| | | if (!ItemConfig.Has(itemId)) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | var config = ItemConfig.Get(itemId); |
| | | return config.Type >= 113 && config.Type <= 117; |
| | | } |
| | | |
| | | public bool IsSuitEquip(int itemId) |
| | | { |
| | | if (!ItemConfig.Has(itemId)) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | var config = ItemConfig.Get(itemId); |
| | | return config.SuiteiD > 0 && config.Type >= 101 && config.Type <= 112; |
| | | } |
| | | |
| | | }
|
| | |
|
| | | return isoverdue;
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | public bool IsJobCompatibleItem(int itemId)
|
| | | {
|
| | | var config = ItemConfig.Get(itemId);
|
| | | return config != null && (config.JobLimit == 0 || config.JobLimit == PlayerDatas.Instance.baseData.Job);
|
| | | }
|
| | |
|
| | | public bool IsRealmEquip(int itemId)
|
| | | {
|
| | | if (!ItemConfig.Has(itemId))
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | var config = ItemConfig.Get(itemId);
|
| | | return config.Type >= 101 && config.Type <= 112;
|
| | | }
|
| | |
|
| | | public bool IsWing(int itemId)
|
| | | {
|
| | | if (!ItemConfig.Has(itemId))
|
| | | {
|
| | | return false;
|
| | | }
|
| | | var config = ItemConfig.Get(itemId);
|
| | | return config.Type == 113 || config.Type == 39 || config.Type == 52;
|
| | | }
|
| | |
|
| | | public bool IsDogzEquip(int itemId)
|
| | | {
|
| | | if (!ItemConfig.Has(itemId))
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | var config = ItemConfig.Get(itemId);
|
| | | return config.Type >= 119 && config.Type <= 123;
|
| | | }
|
| | |
|
| | | public bool IsSpiritWeapon(int itemId)
|
| | | {
|
| | | if (!ItemConfig.Has(itemId))
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | var config = ItemConfig.Get(itemId);
|
| | | return config.Type >= 113 && config.Type <= 117;
|
| | | }
|
| | |
|
| | | public bool IsSuitEquip(int itemId)
|
| | | {
|
| | | if (!ItemConfig.Has(itemId))
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | var config = ItemConfig.Get(itemId);
|
| | | return config.SuiteiD > 0 && config.Type >= 101 && config.Type <= 112;
|
| | | }
|
| | |
|
| | | public int GetSpecialSpiritPropertyValue(int itemId)
|
| | | {
|
| | | var config = SpiritWeaponConfig.Get(itemId);
|
| | |
| | |
|
| | | Equation.Instance.AddKeyValue("lv", Mathf.Min(maxLevel, PlayerDatas.Instance.baseData.LV));
|
| | | return Equation.Instance.Eval<int>(specialSpiritPropertyFormula[propertyId]);
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | public int GetSpecialSpiritPropertyMaxLevel(int itemId)
|
| | | {
|
| | | var config = SpiritWeaponConfig.Get(itemId);
|
| | |
| | | }
|
| | |
|
| | | return maxLevel;
|
| | | } |
| | | |
| | | } |
| | | } |
| | | }
|
| | |
|
| | | }
|
| | | }
|