From 41f2e6da67fb92e18e9d054276de78718c64c5f4 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期一, 04 八月 2025 19:37:13 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts
---
Main/System/KnapSack/Logic/ItemLogicUtility.cs | 2590 +++++++++++++++++++++++++++++-----------------------------
1 files changed, 1,296 insertions(+), 1,294 deletions(-)
diff --git a/Main/System/KnapSack/Logic/ItemLogicUtility.cs b/Main/System/KnapSack/Logic/ItemLogicUtility.cs
index e43d797..40bbc65 100644
--- a/Main/System/KnapSack/Logic/ItemLogicUtility.cs
+++ b/Main/System/KnapSack/Logic/ItemLogicUtility.cs
@@ -5,1361 +5,1363 @@
using UnityEngine;
- public class ItemLogicUtility : Singleton<ItemLogicUtility>
+public class ItemLogicUtility : Singleton<ItemLogicUtility>
+{
+ private string normalGSFormula;
+
+
+ private List<int> equipBaseProperties = new List<int>();
+ Dictionary<int, int> equipSkillScores = new Dictionary<int, int>();
+
+ PackManager packModel { get { return PackManager.Instance; } }
+ // 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()
{
- private string normalGSFormula;
+ var GSFormulaConfig = FuncConfigConfig.Get("EquipGSFormula");
+ normalGSFormula = GSFormulaConfig.Numerical1;
-
- private List<int> equipBaseProperties = new List<int>();
- Dictionary<int, int> equipSkillScores = new Dictionary<int, int>();
-
- PackManager packModel { get { return PackManager.Instance; } }
- // 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 equipSkillScoreJson = JsonMapper.ToObject(GSFormulaConfig.Numerical4);
+ foreach (var key in equipSkillScoreJson.Keys)
{
- var GSFormulaConfig = FuncConfigConfig.Get("EquipGSFormula");
- normalGSFormula = GSFormulaConfig.Numerical1;
-
- var equipSkillScoreJson = JsonMapper.ToObject(GSFormulaConfig.Numerical4);
- foreach (var key in equipSkillScoreJson.Keys)
+ var skillId = 0;
+ int.TryParse(key, out skillId);
+ if (skillId != 0)
{
- var skillId = 0;
- int.TryParse(key, out skillId);
- if (skillId != 0)
- {
- equipSkillScores[skillId] = (int)equipSkillScoreJson[key];
- }
+ 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()));
- }
- }
-
-
-
-
- DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize;
}
- void OnBeforePlayerDataInitialize()
+ var baseAttr = JsonMapper.ToObject(GSFormulaConfig.Numerical2);
+ if (baseAttr.IsArray)
{
- isPackResetOk = true;
- ClearSortedBetterEquip();
+ for (int i = 0; i < baseAttr.Count; i++)
+ {
+ equipBaseProperties.Add(int.Parse(baseAttr[i].ToString()));
+ }
}
- #region 璁$畻瑁呭璇勫垎
- class EquipSorceProperties
+
+
+ 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)
{
- 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))
{
- 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.HasKey(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 == null) return 0;
- if (config.EquipPlace == 0)
- {
- return 0;
- }
-
- var properties = new EquipSorceProperties();
-
- if (IsCustomItem(itemId))
- {
- properties.AddBaseProperties(config.EffectValueA1, equipBaseProperties);
- properties.AddCustomProperties(itemId);
- return CalculateEquipScore(config.EffectValueA1, properties);
- }
-
- properties.AddBaseProperties(itemId, equipBaseProperties);
-
-
- if (useDataDic != null)
- {
- if (useDataDic.ContainsKey((int)ItemUseDataKey.legendAttrID))
- {
- properties.AddRange(useDataDic[(int)ItemUseDataKey.legendAttrID], useDataDic[(int)ItemUseDataKey.legendAttrValue]);
- }
-
- if (useDataDic.ContainsKey((int)ItemUseDataKey.outOfPrintAttrID))
- {
- properties.AddRange(useDataDic[(int)ItemUseDataKey.outOfPrintAttrID], useDataDic[(int)ItemUseDataKey.outOfPrintAttrValue]);
- }
- }
-
- return CalculateEquipScore(itemId, properties, useDataDic);
- }
-
- // private Dictionary<int, int> GetEquipLegendProperties(int itemId)
- // {
- // var legendProperties = LegendPropertyUtility.GetLegendProFromEquipShen(itemId);
- // if (legendProperties == null)
- // 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;
- // }
-
- // private Dictionary<int, int> GetEquipShenProperties(int itemId)
- // {
- // var shenProperties = ShenPropertyUtility.GetEquipShenProperties(itemId);
- // var properties = new Dictionary<int, int>();
- // if (shenProperties != null)
- // {
- // foreach (var item in shenProperties)
- // {
- // properties[item.x] = item.y;
- // }
- // }
-
- // return properties;
- // }
-
- public bool IsCustomItem(int itemId)
- {
- if (!ItemConfig.HasKey(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;
- }
-
- //properties.AddRange(GetEquipShenProperties(itemId));
-
- var minAttack = properties.ContainsKey((int)PropertyType.MinAtk) ? properties[(int)PropertyType.MinAtk] : 0;
- var maxAttack = properties.ContainsKey((int)PropertyType.MaxAtk) ? properties[(int)PropertyType.MaxAtk] : 0;
- var attack = properties.ContainsKey((int)PropertyType.ATK) ? properties[(int)PropertyType.ATK] : 0;
-
- 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:
- case PropertyType.AddFinalHurt:
- case PropertyType.ReduceFinalHurt:
- curEquipAttrDict.Add(attrType, properties[key]);
- break;
- default:
- if (GSProValueDict != null && GSProValueDict.ContainsKey(attrType))
- {
- var curProValue = properties[key] * GSProValueDict[attrType];
- curEquipAttrDict.Add(attrType, curProValue);
- }
- else
- {
- curEquipAttrDict.Add(attrType, properties[key]);
- }
- break;
- }
- }
-
- foreach (var key in curEquipAttrDict.Keys)
- {
- var propertyConfig = PlayerPropertyConfig.Get((int)key);
- if (propertyConfig != null)
- {
- Equation.Instance.AddKeyValue(propertyConfig.Parameter, curEquipAttrDict[key]);
- }
- }
-
- 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]];
- }
+ properties[id] += value;
}
else
{
-
- if (config.AddSkill1 != 0 && equipSkillScores.ContainsKey(config.AddSkill1))
- {
- skillScore += equipSkillScores[config.AddSkill1];
- }
-
- if (config.AddSkill2 != 0 && equipSkillScores.ContainsKey(config.AddSkill2))
- {
- skillScore += equipSkillScores[config.AddSkill2];
- }
-
+ properties[id] = value;
}
-
-
- return skillScore + Equation.Instance.Eval<int>(normalGSFormula);
}
- #endregion
-
-
- private bool CheckIsExtendGrid(int itemId)
+ public void AddRange(List<int> ids, List<int> values)
{
- SinglePack singlePack = packModel.GetSinglePack(PackType.Item);
- if (singlePack == null) return false;
+ if (ids == null || values == null)
+ {
+ return;
+ }
- int startLockIndex = singlePack.unlockedGridCount - PackManager.Instance.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)
+ 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.HasKey(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 == null) return 0;
+ if (config.EquipPlace == 0)
+ {
+ return 0;
+ }
+
+ var properties = new EquipSorceProperties();
+
+ if (IsCustomItem(itemId))
+ {
+ properties.AddBaseProperties(config.EffectValueA1, equipBaseProperties);
+ properties.AddCustomProperties(itemId);
+ return CalculateEquipScore(config.EffectValueA1, properties);
+ }
+
+ properties.AddBaseProperties(itemId, equipBaseProperties);
+
+
+ if (useDataDic != null)
+ {
+ if (useDataDic.ContainsKey((int)ItemUseDataKey.legendAttrID))
+ {
+ properties.AddRange(useDataDic[(int)ItemUseDataKey.legendAttrID], useDataDic[(int)ItemUseDataKey.legendAttrValue]);
+ }
+
+ if (useDataDic.ContainsKey((int)ItemUseDataKey.outOfPrintAttrID))
+ {
+ properties.AddRange(useDataDic[(int)ItemUseDataKey.outOfPrintAttrID], useDataDic[(int)ItemUseDataKey.outOfPrintAttrValue]);
+ }
+ }
+
+ return CalculateEquipScore(itemId, properties, useDataDic);
+ }
+
+ // private Dictionary<int, int> GetEquipLegendProperties(int itemId)
+ // {
+ // var legendProperties = LegendPropertyUtility.GetLegendProFromEquipShen(itemId);
+ // if (legendProperties == null)
+ // 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;
+ // }
+
+ // private Dictionary<int, int> GetEquipShenProperties(int itemId)
+ // {
+ // var shenProperties = ShenPropertyUtility.GetEquipShenProperties(itemId);
+ // var properties = new Dictionary<int, int>();
+ // if (shenProperties != null)
+ // {
+ // foreach (var item in shenProperties)
+ // {
+ // properties[item.x] = item.y;
+ // }
+ // }
+
+ // return properties;
+ // }
+
+ public bool IsCustomItem(int itemId)
+ {
+ if (!ItemConfig.HasKey(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;
+ }
+
+ //properties.AddRange(GetEquipShenProperties(itemId));
+
+ var minAttack = properties.ContainsKey((int)PropertyType.MinAtk) ? properties[(int)PropertyType.MinAtk] : 0;
+ var maxAttack = properties.ContainsKey((int)PropertyType.MaxAtk) ? properties[(int)PropertyType.MaxAtk] : 0;
+ var attack = properties.ContainsKey((int)PropertyType.ATK) ? properties[(int)PropertyType.ATK] : 0;
+
+ 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:
+ case PropertyType.AddFinalHurt:
+ case PropertyType.ReduceFinalHurt:
+ curEquipAttrDict.Add(attrType, properties[key]);
+ break;
+ default:
+ if (GSProValueDict != null && GSProValueDict.ContainsKey(attrType))
+ {
+ var curProValue = properties[key] * GSProValueDict[attrType];
+ curEquipAttrDict.Add(attrType, curProValue);
+ }
+ else
+ {
+ curEquipAttrDict.Add(attrType, properties[key]);
+ }
+ break;
+ }
+ }
+
+ foreach (var key in curEquipAttrDict.Keys)
+ {
+ var propertyConfig = PlayerPropertyConfig.Get((int)key);
+ if (propertyConfig != null)
+ {
+ Equation.Instance.AddKeyValue(propertyConfig.Parameter, curEquipAttrDict[key]);
+ }
+ }
+
+ var skillScore = 0;
+ if (useDataDic != null && useDataDic.ContainsKey((int)ItemUseDataKey.equipSkills))
+ {
+ for (int i = 0; i < useDataDic[(int)ItemUseDataKey.equipSkills].Count; i++)
+ {
+ skillScore += equipSkillScores[useDataDic[(int)ItemUseDataKey.equipSkills][i]];
+ }
+ }
+ else
+ {
+
+ if (config.AddSkill1 != 0 && equipSkillScores.ContainsKey(config.AddSkill1))
+ {
+ skillScore += equipSkillScores[config.AddSkill1];
+ }
+
+ if (config.AddSkill2 != 0 && equipSkillScores.ContainsKey(config.AddSkill2))
+ {
+ skillScore += equipSkillScores[config.AddSkill2];
+ }
+
+ }
+
+
+ return skillScore + Equation.Instance.Eval<int>(normalGSFormula);
+ }
+
+ #endregion
+
+
+ private bool CheckIsExtendGrid(int itemId)
+ {
+ SinglePack singlePack = packModel.GetSinglePack(PackType.Item);
+ if (singlePack == null) return false;
+
+ int startLockIndex = singlePack.unlockedGridCount - PackManager.Instance.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 鐗╁搧鐨勫疄渚婭D
+
+ // 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)
+ // {
+ // var wing = packModel.GetItemByIndex(PackType.Equip, SpiritWeaponModel.WING_EQUIPINDEX);
+ // if (wing == null)
+ // {
+ // if (!SpiritWeaponModel.hasAutoEquipWing)
+ // {
+ // SpiritWeaponModel.hasAutoEquipWing = true;
+ // ItemOperateUtility.Instance.PutOnItem(item.guid);
+ // return;
+ // }
+ // }
+ // }
+
+ // switch ((RoleEquipType)equipPlace)
+ // {
+ // case RoleEquipType.Weapon:
+ // case RoleEquipType.Weapon2:
+ // case RoleEquipType.Hat:
+ // case RoleEquipType.Clothes:
+ // case RoleEquipType.Belt:
+ // case RoleEquipType.Trousers:
+ // case RoleEquipType.Shoes:
+ // case RoleEquipType.Neck:
+ // case RoleEquipType.FairyCan1:
+ // case RoleEquipType.FairyCan2:
+ // case RoleEquipType.Glove:
+ // case RoleEquipType.Jade:
+ // case RoleEquipType.Wing:
+ // case RoleEquipType.Guard:
+ // case RoleEquipType.PeerlessWeapon1:
+ // case RoleEquipType.PeerlessWeapon2:
+ // if (betterEquipExceptDungeonDict.ContainsKey(PlayerDatas.Instance.baseData.MapID))
+ // {
+ // if (betterEquipExceptDungeonDict[PlayerDatas.Instance.baseData.MapID].Contains(item.itemId))
+ // {
+ // return;
+ // }
+ // }
+ // SetGetBetterEquipEvent(item);
+ // break;
+ // }
+ // }
+
+ private void SetGetBetterEquipEvent(ItemModel model)
+ {
+ // // if (model.isAuction)
+ // // {
+ // // return;
+ // // }
+
+ // var itemEffectTime = model.GetUseData((int)ItemUseDataKey.createTime);
+ // if (!itemEffectTime.IsNullOrEmpty() && itemEffectTime.Count > 0)
+ // {
+ // if (itemEffectTime[0] != 0)
+ // {
+ // var cool = KnapsackTimeCDMgr.Instance.GetItemCoolById(model.guid);
+ // double remainTime = 0;
+ // if (cool != null)
+ // {
+ // remainTime = cool.GetRemainTime();
+ // }
+
+ // if (remainTime >= 0 && remainTime < 120 && model.config.ExpireTime > 0)
+ // {
+ // return;
+ // }
+ // }
+ // }
+
+ // if (!equipModel.IsLevelUnLocked(model.config.LV))
+ // {
+ // return;
+ // }
+
+ // int isFightUp = IsFightUp(model.itemId, model.score);
+ // if (isFightUp != 1)
+ // {
+ // return;
+ // }
+
+ // if (GetBetterEquipEvent != null)
+ // {
+ // GetBetterEquipEvent(model.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;
+ // }
+
+ #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)
+ {
+ Debug.Log("鐜板湪鏃堕棿锛�" + TimeUtility.ServerNow + "鑾峰緱鏃堕棿:" + getTime);
+ //TimeUtility.SyncServerTime();
+ TimeSpan t = TimeUtility.ServerNow - getTime;
+ Debug.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>
+ /// 鏁寸悊鍖呰9鐗╁搧
+ /// </summary>
+ /// <param name="type"></param>
+ public bool isPackResetOk { get; set; }
+ public void ResetPack(PackType type)
+ {
+ if (lookLineIndex > -1)
+ {
+ SetLookIndex(null);
+ }
+
+
+ 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;
}
- else
- {
- return false;
- }
}
- public event Action<string> GetBetterEquipEvent; //寰楀埌鏇村ソ鐨勮澶� value 鐗╁搧鐨勫疄渚婭D
+ return true;
+ }
- // public void OnGetEquip(ItemModel item)
+ #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 (item == null)
+ // if (useDataDic.ContainsKey(42) && wingRefineQualityDict != null)
// {
- // return;
- // }
-
- // if (item.packType != PackType.Item)
- // {
- // return;
- // }
-
- // if (!IsJobCompatibleItem(item.itemId))
- // {
- // return;
- // }
-
- // int equipPlace = item.config.EquipPlace;
- // if ((RoleEquipType)equipPlace == RoleEquipType.Wing)
- // {
- // var wing = packModel.GetItemByIndex(PackType.Equip, SpiritWeaponModel.WING_EQUIPINDEX);
- // if (wing == null)
+ // wingsQualitys = wingRefineQualityDict.Keys.ToArray();
+ // wingsRefineExps = wingRefineQualityDict.Values.ToArray();
+ // int i = 0;
+ // for (i = wingsRefineExps.Length - 1; i > -1; i--)
// {
- // if (!SpiritWeaponModel.hasAutoEquipWing)
+ // if (useDataDic[42][0] >= wingsRefineExps[i])
// {
- // SpiritWeaponModel.hasAutoEquipWing = true;
- // ItemOperateUtility.Instance.PutOnItem(item.guid);
- // return;
+ // return wingsQualitys[i];
// }
// }
// }
-
- // switch ((RoleEquipType)equipPlace)
- // {
- // case RoleEquipType.Weapon:
- // case RoleEquipType.Weapon2:
- // case RoleEquipType.Hat:
- // case RoleEquipType.Clothes:
- // case RoleEquipType.Belt:
- // case RoleEquipType.Trousers:
- // case RoleEquipType.Shoes:
- // case RoleEquipType.Neck:
- // case RoleEquipType.FairyCan1:
- // case RoleEquipType.FairyCan2:
- // case RoleEquipType.Glove:
- // case RoleEquipType.Jade:
- // case RoleEquipType.Wing:
- // case RoleEquipType.Guard:
- // case RoleEquipType.PeerlessWeapon1:
- // case RoleEquipType.PeerlessWeapon2:
- // if (betterEquipExceptDungeonDict.ContainsKey(PlayerDatas.Instance.baseData.MapID))
- // {
- // if (betterEquipExceptDungeonDict[PlayerDatas.Instance.baseData.MapID].Contains(item.itemId))
- // {
- // return;
- // }
- // }
- // SetGetBetterEquipEvent(item);
- // break;
- // }
// }
+ return itemConfig.ItemColor;
+ }
+ #endregion
- private void SetGetBetterEquipEvent(ItemModel model)
+ //璁剧疆鐜╁璐у竵鏄剧ず
+ public string OnChangeCoinsUnit(ulong value)
+ {
+ return UIHelper.ReplaceLargeNum(value);
+ }
+
+ /// <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)
{
- // // if (model.isAuction)
- // // {
- // // return;
- // // }
-
- // var itemEffectTime = model.GetUseData((int)ItemUseDataKey.createTime);
- // if (!itemEffectTime.IsNullOrEmpty() && itemEffectTime.Count > 0)
+ // var index = EquipModel.GetItemServerEquipPlace(_itemID);
+ // if (index == -1)
// {
- // if (itemEffectTime[0] != 0)
- // {
- // var cool = KnapsackTimeCDMgr.Instance.GetItemCoolById(model.guid);
- // double remainTime = 0;
- // if (cool != null)
- // {
- // remainTime = cool.GetRemainTime();
- // }
-
- // if (remainTime >= 0 && remainTime < 120 && model.config.ExpireTime > 0)
- // {
- // return;
- // }
- // }
+ // return 0;
// }
- // if (!equipModel.IsLevelUnLocked(model.config.LV))
+ // var item = packModel.GetItemByIndex(PackType.Equip, index);
+ // var equipScore = item != null ? item.score : 0;
+ // if (IsJobCompatibleItem(_itemID))
// {
- // return;
+ // return _score.CompareTo(equipScore);
// }
-
- // int isFightUp = IsFightUp(model.itemId, model.score);
- // if (isFightUp != 1)
+ // else
// {
- // return;
- // }
-
- // if (GetBetterEquipEvent != null)
- // {
- // GetBetterEquipEvent(model.guid);
+ // return 0;
// }
}
+ return 0;
+ }
-
- 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;
- // }
-
- #region 鐗╁搧澶勪簬CD涓殑閫昏緫澶勭悊
-
- private List<string> itemEffectTimelist = new List<string>(); //key 鐗╁搧瀹炰緥ID
- /// <summary>
- /// 鐗╁搧浣跨敤鏃堕棿闄愬埗
- /// </summary>
- public void SetItemEffectCDTime(string guid, int itemID, int getTime, int serverSurplusTime)
+ // 涓嶅寘鍚湭寮�鏀捐澶囩殑姣旇緝 灞炰簬-1
+ public int IsFightUpEx(int _itemID, int _score, int _realm)//-1浣庣骇锛�0涓嶆槸鏈亴涓氾紝1鏇村ソ
+ {
+ var config = ItemConfig.Get(_itemID);
+ if (config != null)
{
- 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)
- {
- Debug.Log("鐜板湪鏃堕棿锛�" + TimeUtility.ServerNow + "鑾峰緱鏃堕棿:" + getTime);
- //TimeUtility.SyncServerTime();
- TimeSpan t = TimeUtility.ServerNow - getTime;
- Debug.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>
- /// 鏁寸悊鍖呰9鐗╁搧
- /// </summary>
- /// <param name="type"></param>
- public bool isPackResetOk { get; set; }
- public void ResetPack(PackType type)
- {
- if (lookLineIndex > -1)
- {
- SetLookIndex(null);
- }
-
-
- 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)
+ // var index = EquipModel.GetItemServerEquipPlace(_itemID);
+ // if (index == -1)
// {
- // 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 0;
// }
- return itemConfig.ItemColor;
- }
- #endregion
- //璁剧疆鐜╁璐у竵鏄剧ず
- public string OnChangeCoinsUnit(ulong value)
- {
- return UIHelper.ReplaceLargeNum(value);
+ // var item = packModel.GetItemByIndex(PackType.Equip, index);
+
+ // var equipScore = item != null ? item.score : 0;
+ // if (IsJobCompatibleItem(_itemID))
+ // {
+ // if (_realm > PlayerDatas.Instance.baseData.realmLevel)
+ // return -1;
+ // return _score.CompareTo(equipScore);
+ // }
+ // else
+ // {
+ // return 0;
+ // }
}
- /// <summary>
- /// 瑁呭鏄惁鍙互鎻愬崌鎴樺姏
- /// </summary>
- /// <param name="_itemID"></param>
- /// <param name="_score"></param>
- /// <returns></returns>
- public int IsFightUp(int _itemID, int _score)//-1浣庣骇锛�0涓嶆槸鏈亴涓氾紝1鏇村ソ
+ return 0;
+ }
+
+
+ #region 鐗╁搧鏄惁杩囨湡
+
+ public bool IsOverdue(string guid)
+ {
+ var item = packModel.GetItemByGuid(guid);
+ if (item == null)
{
- 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;
+ return false;
}
- // 涓嶅寘鍚湭寮�鏀捐澶囩殑姣旇緝 灞炰簬-1
- public int IsFightUpEx(int _itemID, int _score, int _realm)//-1浣庣骇锛�0涓嶆槸鏈亴涓氾紝1鏇村ソ
+ if (item.isAuction)
{
- 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))
- // {
- // if (_realm > PlayerDatas.Instance.baseData.realmLevel)
- // return -1;
- // return _score.CompareTo(equipScore);
- // }
- // else
- // {
- // return 0;
- // }
- }
-
- return 0;
+ return false;//item.auctionSurplusTime < 0;
}
-
-
- #region 鐗╁搧鏄惁杩囨湡
-
- public bool IsOverdue(string guid)
+ else
{
- var item = packModel.GetItemByGuid(guid);
- if (item == null)
+ var isoverdue = false;
+ switch ((ItemTimeType)item.config.EndureReduceType)
{
- return false;
+ case ItemTimeType.EquipedTime:
+ isoverdue = item.GetUseDataFirstValue(44) > 0 && item.overdueSurplusTime < 0;
+ break;
+ case ItemTimeType.RealityTime:
+ isoverdue = item.overdueSurplusTime < 0;
+ break;
}
- if (item.isAuction)
- {
- return false;//item.auctionSurplusTime < 0;
- }
- else
- {
- var isoverdue = false;
- switch ((ItemTimeType)item.config.EndureReduceType)
- {
- case ItemTimeType.EquipedTime:
- isoverdue = item.GetUseDataFirstValue(44) > 0 && item.overdueSurplusTime < 0;
- break;
- 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.HasKey(itemId))
- {
- return false;
- }
-
- var config = ItemConfig.Get(itemId);
- return config.Type >= 101 && config.Type <= 112;
- }
-
- public bool IsWing(int itemId)
- {
- if (!ItemConfig.HasKey(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.HasKey(itemId))
- {
- return false;
- }
-
- var config = ItemConfig.Get(itemId);
- return config.Type >= 119 && config.Type <= 123;
- }
-
- public bool IsSpiritWeapon(int itemId)
- {
- if (!ItemConfig.HasKey(itemId))
- {
- return false;
- }
-
- var config = ItemConfig.Get(itemId);
- return config.Type >= 113 && config.Type <= 117;
- }
-
- public bool IsSuitEquip(int itemId)
- {
- if (!ItemConfig.HasKey(itemId))
- {
- return false;
- }
-
- var config = ItemConfig.Get(itemId);
- return config.SuiteiD > 0 && config.Type >= 101 && config.Type <= 112;
- }
-
- // public bool IsThanksItem(int itemID)
- // {
- // if (AssistThanksGiftConfig.Get(itemID) == null)
- // {
- // return false;
- // }
- // return true;
- // }
-
- // public int GetSpecialSpiritPropertyValue(int itemId)
- // {
- // var config = SpiritWeaponConfig.Get(itemId);
- // if (config == null)
- // {
- // return 0;
- // }
-
- // var propertyId = 0;
- // var propertyValue = 0;
- // for (var i = 0; i < config.AttrIDList.Length; i++)
- // {
- // var id = config.AttrIDList[i];
- // if (id == 79 || id == 80)
- // {
- // propertyId = id;
- // propertyValue = config.AttrValueList[i];
- // break;
- // }
- // }
-
- // if (propertyId == 0)
- // {
- // return 0;
- // }
-
- // Equation.Instance.Clear();
- // Equation.Instance.AddKeyValue("maxOOPValue", propertyValue);
-
- // var maxLevel = 100;
- // if (specialSpiritPropertyMaxLevels.ContainsKey(config.Level))
- // {
- // maxLevel = specialSpiritPropertyMaxLevels[config.Level];
- // }
-
- // 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);
- // if (config == null)
- // {
- // return 0;
- // }
-
- // var maxLevel = 0;
- // if (specialSpiritPropertyMaxLevels.ContainsKey(config.Level))
- // {
- // maxLevel = specialSpiritPropertyMaxLevels[config.Level];
- // }
-
- // return maxLevel;
- // }
-
- //瑁呭瀵规瘮锛岀敤浜庨潪瀹為檯瑁呭绠�鍗曟瘮杈� 鏄惁闇�瑕佹瑁呭
- // public bool IsSatisfyEquipBetterEquip(int itemID)
- // {
- // if (!IsRealmEquip(itemID))
- // {
- // return false;
- // }
-
- // var itemConfig = ItemConfig.Get(itemID);
- // if (itemConfig.JobLimit != 0 && itemConfig.JobLimit != PlayerDatas.Instance.baseData.Job)
- // {
- // return false;
- // }
-
- // var equipSet = equipModel.GetEquipSet(itemConfig.LV);
- // if (!equipSet.IsSlotUnLocked(itemConfig.EquipPlace))
- // {
- // return false;
- // }
-
- // var equipGuid = equipModel.GetEquip(new Int2(itemConfig.LV, itemConfig.EquipPlace));
- // if (string.IsNullOrEmpty(equipGuid))
- // {
- // return true;
- // }
-
- // var itemModel = packModel.GetItemByGuid(equipGuid);
- // if (itemModel == null)
- // {
- // return true;
- // }
-
- // if (itemConfig.ItemColor > itemModel.config.ItemColor)
- // {
- // return true;
- // }
-
- // return itemModel.config.SuiteiD == 0 && itemConfig.SuiteiD != 0;
- // }
-
-
-
- public Action OnGetItem; //CommonGetItemWin鐣岄潰鍏抽棴鏃惰Е鍙�
- public string getItemInfo { get; private set; } //閫氱敤鏄剧ず鑾峰緱鐨勭晫闈俊鎭�
- public string getItemBtnText { get; private set; } //閫氱敤鏄剧ず鑾峰緱鐨勭晫闈㈡寜閽枃瀛� 榛樿纭畾
- public int closeSeconds { get; private set; } // 鍏抽棴鍊掕鏃舵椂闂� 濡傛灉浼�0浠h〃鎵嬪姩鍏抽棴
- public bool isNameShow { get; private set; } // 鏄惁灞曠ず鐗╁搧鍚嶅瓧
-
- // 濡傛灉鍚屾椂鏈夊绉嶅鍔卞皝鍖咃紝鍚屼竴涓簨浠跺綊闆嗭紝涓嶅悓浜嬩欢鐩存帴椤舵帀鏄剧ず鏈�鏂�
- public Dictionary<int, Item> totalShowItems = new Dictionary<int, Item>();
- public event Action OnGetItemShowEvent;
- private string getItemEventName;
-
-
- // 閫氱敤鏄剧ず鑾峰緱鐨勭墿鍝�
- public void ShowGetItem(List<Item> items, string info = "", int seconds = 3, string btnName = "", Action func = null, bool isNameShow = true, string eventName = "default")
- {
- if (getItemEventName != eventName)
- {
- if (UIManager.Instance.IsOpenedInList<CommonGetItemWin>())
- {
- //----------------------璁板緱鏀圭珛鍗冲叧闂�
- UIManager.Instance.CloseWindow<CommonGetItemWin>();
- }
- totalShowItems.Clear();
- getItemEventName = eventName;
- }
-
- //鐩稿悓ID 鍚堝苟鏁伴噺鏄剧ず
- for (int i = 0; i < items.Count; i++)
- {
- var id = items[i].id;
- if (totalShowItems.ContainsKey(id))
- {
- totalShowItems[id] = new Item(id, items[i].countEx + totalShowItems[id].countEx, items[i].bind, items[i].quality);
- }
- else
- {
- totalShowItems.Add(id, items[i]);
- }
- }
-
-
- getItemInfo = info;
- OnGetItem = func;
- if (btnName == "")
- btnName = Language.Get("PopConfirmWin_OK");
- getItemBtnText = btnName;
- closeSeconds = seconds;
- this.isNameShow = isNameShow;
- OnGetItemShowEvent?.Invoke();
- if (!UIManager.Instance.IsOpenedInList<CommonGetItemWin>())
- {
- UIManager.Instance.OpenWindow<CommonGetItemWin>();
- }
- }
-
- //鍙互鎸囧畾鎵撳紑鐨勭獥鍙�
- public void ShowGetItemEx<T>(List<Item> items, string info = "", int seconds = 3, string btnName = "", Action func = null, bool isNameShow = true, string eventName = "default") where T : UIBase
- {
- if (getItemEventName != eventName)
- {
- if (UIManager.Instance.IsOpenedInList<T>())
- {
- //----------------------璁板緱鏀圭珛鍗冲叧闂�
- UIManager.Instance.CloseWindow<T>();
- }
-
- totalShowItems.Clear();
- getItemEventName = eventName;
- }
-
- //鐩稿悓ID 鍚堝苟鏁伴噺鏄剧ず
- for (int i = 0; i < items.Count; i++)
- {
- var id = items[i].id;
- if (totalShowItems.ContainsKey(id))
- {
- totalShowItems[id] = new Item(id, items[i].countEx + totalShowItems[id].countEx, items[i].bind, items[i].quality);
- }
- else
- {
- totalShowItems.Add(id, items[i]);
- }
- }
-
-
- getItemInfo = info;
- OnGetItem = func;
- if (btnName == "")
- btnName = Language.Get("PopConfirmWin_OK");
- getItemBtnText = btnName;
- closeSeconds = seconds;
- this.isNameShow = isNameShow;
- OnGetItemShowEvent?.Invoke();
- if (!UIManager.Instance.IsOpenedInList<T>())
- {
- UIManager.Instance.OpenWindow<T>();
- }
- }
- public void ClearGetItem()
- {
- //涓嶆竻鐞嗙墿鍝侊紝涓嬫鏀跺埌鏁版嵁浼氳嚜鍔ㄦ竻鐞嗭紝鍙敼浜嬩欢鏂逛究鎵撳紑鐣岄潰娴嬭瘯
- getItemEventName = "";
+ 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.HasKey(itemId))
+ {
+ return false;
+ }
+
+ var config = ItemConfig.Get(itemId);
+ return config.Type >= 101 && config.Type <= 112;
+ }
+
+ public bool IsWing(int itemId)
+ {
+ if (!ItemConfig.HasKey(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.HasKey(itemId))
+ {
+ return false;
+ }
+
+ var config = ItemConfig.Get(itemId);
+ return config.Type >= 119 && config.Type <= 123;
+ }
+
+ public bool IsSpiritWeapon(int itemId)
+ {
+ if (!ItemConfig.HasKey(itemId))
+ {
+ return false;
+ }
+
+ var config = ItemConfig.Get(itemId);
+ return config.Type >= 113 && config.Type <= 117;
+ }
+
+ public bool IsSuitEquip(int itemId)
+ {
+ if (!ItemConfig.HasKey(itemId))
+ {
+ return false;
+ }
+
+ var config = ItemConfig.Get(itemId);
+ return config.SuiteiD > 0 && config.Type >= 101 && config.Type <= 112;
+ }
+
+ // public bool IsThanksItem(int itemID)
+ // {
+ // if (AssistThanksGiftConfig.Get(itemID) == null)
+ // {
+ // return false;
+ // }
+ // return true;
+ // }
+
+ // public int GetSpecialSpiritPropertyValue(int itemId)
+ // {
+ // var config = SpiritWeaponConfig.Get(itemId);
+ // if (config == null)
+ // {
+ // return 0;
+ // }
+
+ // var propertyId = 0;
+ // var propertyValue = 0;
+ // for (var i = 0; i < config.AttrIDList.Length; i++)
+ // {
+ // var id = config.AttrIDList[i];
+ // if (id == 79 || id == 80)
+ // {
+ // propertyId = id;
+ // propertyValue = config.AttrValueList[i];
+ // break;
+ // }
+ // }
+
+ // if (propertyId == 0)
+ // {
+ // return 0;
+ // }
+
+ // Equation.Instance.Clear();
+ // Equation.Instance.AddKeyValue("maxOOPValue", propertyValue);
+
+ // var maxLevel = 100;
+ // if (specialSpiritPropertyMaxLevels.ContainsKey(config.Level))
+ // {
+ // maxLevel = specialSpiritPropertyMaxLevels[config.Level];
+ // }
+
+ // 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);
+ // if (config == null)
+ // {
+ // return 0;
+ // }
+
+ // var maxLevel = 0;
+ // if (specialSpiritPropertyMaxLevels.ContainsKey(config.Level))
+ // {
+ // maxLevel = specialSpiritPropertyMaxLevels[config.Level];
+ // }
+
+ // return maxLevel;
+ // }
+
+ //瑁呭瀵规瘮锛岀敤浜庨潪瀹為檯瑁呭绠�鍗曟瘮杈� 鏄惁闇�瑕佹瑁呭
+ // public bool IsSatisfyEquipBetterEquip(int itemID)
+ // {
+ // if (!IsRealmEquip(itemID))
+ // {
+ // return false;
+ // }
+
+ // var itemConfig = ItemConfig.Get(itemID);
+ // if (itemConfig.JobLimit != 0 && itemConfig.JobLimit != PlayerDatas.Instance.baseData.Job)
+ // {
+ // return false;
+ // }
+
+ // var equipSet = equipModel.GetEquipSet(itemConfig.LV);
+ // if (!equipSet.IsSlotUnLocked(itemConfig.EquipPlace))
+ // {
+ // return false;
+ // }
+
+ // var equipGuid = equipModel.GetEquip(new Int2(itemConfig.LV, itemConfig.EquipPlace));
+ // if (string.IsNullOrEmpty(equipGuid))
+ // {
+ // return true;
+ // }
+
+ // var itemModel = packModel.GetItemByGuid(equipGuid);
+ // if (itemModel == null)
+ // {
+ // return true;
+ // }
+
+ // if (itemConfig.ItemColor > itemModel.config.ItemColor)
+ // {
+ // return true;
+ // }
+
+ // return itemModel.config.SuiteiD == 0 && itemConfig.SuiteiD != 0;
+ // }
+
+
+
+ public Action OnGetItem; //CommonGetItemWin鐣岄潰鍏抽棴鏃惰Е鍙�
+ public string getItemInfo { get; private set; } //閫氱敤鏄剧ず鑾峰緱鐨勭晫闈俊鎭�
+ public string getItemBtnText { get; private set; } //閫氱敤鏄剧ず鑾峰緱鐨勭晫闈㈡寜閽枃瀛� 榛樿纭畾
+ public int closeSeconds { get; private set; } // 鍏抽棴鍊掕鏃舵椂闂� 濡傛灉浼�0浠h〃鎵嬪姩鍏抽棴
+ public bool isNameShow { get; private set; } // 鏄惁灞曠ず鐗╁搧鍚嶅瓧
+
+ // 濡傛灉鍚屾椂鏈夊绉嶅鍔卞皝鍖咃紝鍚屼竴涓簨浠跺綊闆嗭紝涓嶅悓浜嬩欢鐩存帴椤舵帀鏄剧ず鏈�鏂�
+ public Dictionary<int, Item> totalShowItems = new Dictionary<int, Item>();
+ public event Action OnGetItemShowEvent;
+ private string getItemEventName;
+
+
+ // 閫氱敤鏄剧ず鑾峰緱鐨勭墿鍝�
+ public void ShowGetItem(List<Item> items, string info = "", int seconds = 3, string btnName = "", Action func = null, bool isNameShow = true, string eventName = "default")
+ {
+ if (getItemEventName != eventName)
+ {
+ if (UIManager.Instance.IsOpenedInList<CommonGetItemWin>())
+ {
+ //----------------------璁板緱鏀圭珛鍗冲叧闂�
+ UIManager.Instance.CloseWindow<CommonGetItemWin>();
+ }
+ totalShowItems.Clear();
+ getItemEventName = eventName;
+ }
+
+ //鐩稿悓ID 鍚堝苟鏁伴噺鏄剧ず
+ for (int i = 0; i < items.Count; i++)
+ {
+ var id = items[i].id;
+ if (totalShowItems.ContainsKey(id))
+ {
+ totalShowItems[id] = new Item(id, items[i].countEx + totalShowItems[id].countEx, items[i].bind, items[i].quality);
+ }
+ else
+ {
+ totalShowItems.Add(id, items[i]);
+ }
+ }
+
+
+ getItemInfo = info;
+ OnGetItem = func;
+ if (btnName == "")
+ btnName = Language.Get("PopConfirmWin_OK");
+ getItemBtnText = btnName;
+ closeSeconds = seconds;
+ this.isNameShow = isNameShow;
+ OnGetItemShowEvent?.Invoke();
+ if (!UIManager.Instance.IsOpenedInList<CommonGetItemWin>())
+ {
+ UIManager.Instance.OpenWindow<CommonGetItemWin>();
+ }
+ }
+
+ //鍙互鎸囧畾鎵撳紑鐨勭獥鍙�
+ public void ShowGetItemEx<T>(List<Item> items, string info = "", int seconds = 3, string btnName = "", Action func = null, bool isNameShow = true, string eventName = "default") where T : UIBase
+ {
+ if (getItemEventName != eventName)
+ {
+ if (UIManager.Instance.IsOpenedInList<T>())
+ {
+ //----------------------璁板緱鏀圭珛鍗冲叧闂�
+ UIManager.Instance.CloseWindow<T>();
+ }
+
+ totalShowItems.Clear();
+ getItemEventName = eventName;
+ }
+
+ //鐩稿悓ID 鍚堝苟鏁伴噺鏄剧ず
+ for (int i = 0; i < items.Count; i++)
+ {
+ var id = items[i].id;
+ if (totalShowItems.ContainsKey(id))
+ {
+ totalShowItems[id] = new Item(id, items[i].countEx + totalShowItems[id].countEx, items[i].bind, items[i].quality);
+ }
+ else
+ {
+ totalShowItems.Add(id, items[i]);
+ }
+ }
+
+
+ getItemInfo = info;
+ OnGetItem = func;
+ if (btnName == "")
+ btnName = Language.Get("PopConfirmWin_OK");
+ getItemBtnText = btnName;
+ closeSeconds = seconds;
+ this.isNameShow = isNameShow;
+ OnGetItemShowEvent?.Invoke();
+ if (!UIManager.Instance.IsOpenedInList<T>())
+ {
+ UIManager.Instance.OpenWindow<T>();
+ }
+ }
+ public void ClearGetItem()
+ {
+ //涓嶆竻鐞嗙墿鍝侊紝涓嬫鏀跺埌鏁版嵁浼氳嚜鍔ㄦ竻鐞嗭紝鍙敼浜嬩欢鏂逛究鎵撳紑鐣岄潰娴嬭瘯
+ getItemEventName = "";
+ }
+
+
+}
--
Gitblit v1.8.0