From bd00a167463567c700a2da2c489805d4c26aaa7f Mon Sep 17 00:00:00 2001
From: Client_PangDeRong <593317293@qq.com>
Date: 星期二, 04 十二月 2018 16:28:39 +0800
Subject: [PATCH] 5217 【前端】【1.3】开服全民冲榜赠送魂增加战力显示
---
Utility/EnumHelper.cs | 3
System/KnapSack/Logic/ItemTipsModel.cs | 226 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 229 insertions(+), 0 deletions(-)
diff --git a/System/KnapSack/Logic/ItemTipsModel.cs b/System/KnapSack/Logic/ItemTipsModel.cs
index f308cce..8e8f0f4 100644
--- a/System/KnapSack/Logic/ItemTipsModel.cs
+++ b/System/KnapSack/Logic/ItemTipsModel.cs
@@ -1692,6 +1692,8 @@
public Dictionary<int, int> SetItemEffectDict(ItemConfig config)
{
Dictionary<int, int> itemEffectDict = new Dictionary<int, int>();
+ if (config == null) return itemEffectDict;
+
try
{
if (config.Effect1 != 0)
@@ -1879,6 +1881,230 @@
#region 璁剧疆鐗╁搧浣跨敤鐨勯檺鍒舵潯浠�
#endregion
+ #region 鐗╁搧澧炲姞鎴樻枟鍔�
+ PlayerMountDatas mountDatas { get { return ModelCenter.Instance.GetModel<PlayerMountDatas>(); } }
+ public PlayerStrengthengDatas strengthengmodel
+ {
+ get
+ {
+ return ModelCenter.Instance.GetModel<PlayerStrengthengDatas>();
+ }
+ }
+
+ public bool TryGetFightPowerByItemId(int itemId,out int fightPower)
+ {
+ fightPower = 0;
+ ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(itemId);
+ if (itemConfig == null) return false;
+
+ var attrIdlist = Config.Instance.GetAllKeys<PlayerPropertyConfig>();
+ Dictionary<int, int> attrDict = new Dictionary<int, int>();
+ Dictionary<int, int> itemEffectDict = SetItemEffectDict(itemConfig);
+ int atk = 0;
+ int hp = 0;
+ int def = 0;
+ foreach(var attrId in itemEffectDict.Keys)
+ {
+ var attrValue = itemEffectDict[attrId];
+ switch ((AttrEnum)attrId)
+ {
+ case AttrEnum.ATK:
+ atk += attrValue;
+ break;
+ case AttrEnum.HP:
+ hp += attrValue;
+ break;
+ case AttrEnum.DEF:
+ def += attrValue;
+ break;
+ case AttrEnum.HorseAtkPer:
+ float mountAtk = mountDatas.GetAllMountAttack();
+ atk += Mathf.RoundToInt(mountAtk * ((float)attrValue / 10000));
+ break;
+ case AttrEnum.StoneBasePer:
+ var stoneDict = GetStoneAttrDict();
+ foreach (var key in stoneDict.Keys)
+ {
+ var stoneValue = stoneDict[key];
+ switch ((AttrEnum)key)
+ {
+ case AttrEnum.ATK:
+ atk += Mathf.RoundToInt(stoneValue *((float)attrValue / 10000));
+ break;
+ case AttrEnum.HP:
+ hp += Mathf.RoundToInt(stoneValue * ((float)attrValue / 10000));
+ break;
+ case AttrEnum.DEF:
+ def += Mathf.RoundToInt(stoneValue * ((float)attrValue / 10000));
+ break;
+ }
+ }
+ break;
+ case AttrEnum.RealmBasePer:
+ var realmDict = GetRealmAttrDict();
+ foreach (var key in realmDict.Keys)
+ {
+ var realmValue = realmDict[key];
+ switch ((AttrEnum)key)
+ {
+ case AttrEnum.ATK:
+ atk += Mathf.RoundToInt(realmValue * ((float)attrValue / 10000));
+ break;
+ case AttrEnum.HP:
+ hp += Mathf.RoundToInt(realmValue * ((float)attrValue / 10000));
+ break;
+ case AttrEnum.DEF:
+ def += Mathf.RoundToInt(realmValue * ((float)attrValue / 10000));
+ break;
+ }
+ }
+ break;
+ case AttrEnum.PetSkillAtkRate:
+ break;
+ case AttrEnum.PlusBaseAtkPer:
+ var strengthDict = GetStrengthAttrDict();
+ if(strengthDict.ContainsKey((int)AttrEnum.ATK))
+ {
+ var strengthValue = strengthDict[(int)AttrEnum.ATK];
+ atk += Mathf.RoundToInt(strengthValue * ((float)attrValue / 10000));
+ }
+ break;
+ default:
+ if(attrIdlist.Contains(attrId.ToString()))
+ {
+ attrDict.Add(attrId,attrValue);
+ }
+ break;
+ }
+ }
+
+ if(atk > 0)
+ {
+ attrDict.Add((int)AttrEnum.ATK,atk);
+ }
+
+ if(def > 0)
+ {
+ attrDict.Add((int)AttrEnum.DEF,def);
+ }
+
+ if(hp > 0)
+ {
+ attrDict.Add((int)AttrEnum.HP,hp);
+ }
+
+ fightPower = UIHelper.GetFightPower(attrDict);
+ return fightPower > 0;
+ }
+
+ private Dictionary<int,int> GetStoneAttrDict()
+ {
+ Dictionary<int, int> attrDict = new Dictionary<int, int>();
+ var stoneDict = PlayerStoneData.Instance.GetAllStone();
+ foreach(var key in stoneDict.Keys)
+ {
+ var stoneIds = stoneDict[key];
+ var itemModel = playerPack.GetItemModelByIndex(PackType.rptEquip,key);
+ if (itemModel != null && stoneIds != null)
+ {
+ for(int i = 0; i < stoneIds.Length; i++)
+ {
+ int stoneId = (int)stoneIds[i];
+ ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(stoneId);
+ if(itemConfig != null)
+ {
+ var itemEffectDict = SetItemEffectDict(itemConfig);
+ foreach (var attrId in itemEffectDict.Keys)
+ {
+ var attrValue = itemEffectDict[attrId];
+ if (!attrDict.ContainsKey(attrId))
+ {
+ attrDict.Add(attrId, attrValue);
+ }
+ else
+ {
+ attrDict[attrId] += attrValue;
+ }
+ }
+ }
+ }
+ }
+ }
+ return attrDict;
+ }
+
+ private Dictionary<int,int> GetRealmAttrDict()
+ {
+ Dictionary<int, int> attrDict = new Dictionary<int, int>();
+ int realmLv = PlayerDatas.Instance.baseData.realmLevel;
+ var realmConfig = Config.Instance.Get<RealmConfig>(realmLv);
+ if(realmConfig != null)
+ {
+ var attrIds = realmConfig.AddAttrType;
+ var attrValues = realmConfig.AddAttrNum;
+ if(attrIds != null && attrValues != null
+ && attrIds.Length == attrValues.Length)
+ {
+ for (int i = 0; i < attrIds.Length; i++)
+ {
+ var attrId = attrIds[i];
+ var attrValue = attrValues[i];
+ if(attrValue > 0)
+ {
+ if (!attrDict.ContainsKey(attrId))
+ {
+ attrDict.Add(attrId, attrValue);
+ }
+ else
+ {
+ attrDict[attrId] += attrValue;
+ }
+ }
+ }
+ }
+ }
+ return attrDict;
+ }
+
+ private Dictionary<int,int> GetStrengthAttrDict()
+ {
+ Dictionary<int, int> attrDict = new Dictionary<int, int>();
+ var strengthDict = strengthengmodel._EqInfo;
+ foreach(var index in strengthDict.Keys)
+ {
+ var itemModel = playerPack.GetItemModelByIndex(PackType.rptEquip, index);
+ if(itemModel != null)
+ {
+ int lv = strengthengmodel.StrengthenTheCeiling(index);
+ int type = strengthengmodel.GameDefineIndex(index);
+ var itemPlus = ItemPlusConfig.GetItemPlusData(type, lv);
+ if (itemPlus != null)
+ {
+ int[] attrIDs = itemPlus.attrIds;
+ int[] attrValues = itemPlus.attrValues;
+ for (int i = 0; i < attrIDs.Length; i++)
+ {
+ var attrId = attrIDs[i];
+ var attrValue = attrValues[i];
+ if (attrValue > 0)
+ {
+ if (!attrDict.ContainsKey(attrId))
+ {
+ attrDict.Add(attrId, attrValue);
+ }
+ else
+ {
+ attrDict[attrId] += attrValue;
+ }
+ }
+ }
+ }
+ }
+ }
+ return attrDict;
+ }
+ #endregion
+
}
public class ItemAttrData
diff --git a/Utility/EnumHelper.cs b/Utility/EnumHelper.cs
index ea40a17..0e326b4 100644
--- a/Utility/EnumHelper.cs
+++ b/Utility/EnumHelper.cs
@@ -963,6 +963,9 @@
StoneBasePer = 83, //瀹濈煶鍩虹灞炴��
RealmBasePer = 84, //澧冪晫鍩虹灞炴��
PetSkillAtkRate = 85, //瀹犵墿鎶�鑳戒激瀹�
+ WingHPPer = 86, //缈呰唨鐢熷懡
+ SuiteBasePer = 87, //濂楄鍩虹灞炴��
+ PlusBaseAtkPer = 88, //寮哄寲鏀诲嚮
NpcHurtAddPer = 89,//瀵规�墿浼ゅ鍔犳垚
}
//UI鍥炬爣绫诲瀷
--
Gitblit v1.8.0