| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 | 
							- using System.Collections.Generic;
 
- namespace GFGGame
 
- {
 
-     public class ItemData
 
-     {
 
-         public int id;
 
-         public long num;
 
-         public bool isOnceBonus;
 
-         public int itemType;
 
-         public int subType;
 
-         public int rarity;
 
-         public int[][] syntheticMateriarsArr;
 
-         public int[] param2Arr;
 
-         private Dictionary<int, int> AttributesDic = new Dictionary<int, int>();
 
-         public void Reset()
 
-         {
 
-             id = 0;
 
-             num = 0;
 
-             isOnceBonus = false;
 
-             AttributesDic.Clear();
 
-         }
 
-         public void SetAttributes(List<int> keys, List<int> values)
 
-         {
 
-             for (var i = 0; i < keys.Count; ++i)
 
-             {
 
-                 SetAttribute(keys[i], values[i], false);
 
-             }
 
-         }
 
-         public void SetAttribute(int key, int value, bool dispatch = true)
 
-         {
 
-             AttributesDic[key] = value;
 
-             if (dispatch)
 
-             {
 
-                 EventAgent.DispatchEvent(ConstMessage.ITEM_ATTRIBUTE_CHANGED, id);
 
-             }
 
-         }
 
-         public int MainScore
 
-         {
 
-             get
 
-             {
 
-                 var cfg = ItemCfgArray.Instance.GetCfg(id);
 
-                 return GetScore(cfg.mainScore > 0 ? cfg.mainScore : 1);
 
-             }
 
-         }
 
-         public int GetScore(int scoreType)
 
-         {
 
-             int valueBase = 0;
 
-             var cfg = ItemCfgArray.Instance.GetCfg(id);
 
-             if (cfg.itemType == ConstItemType.CARD)
 
-             {
 
-                 CardData cardData = CardDataManager.GetCardDataById(id);
 
-                 if (cardData == null || !cardData.scores.ContainsKey(scoreType)) return 0;
 
-                 return CardDataManager.GetCardDataById(id).scores[scoreType];
 
-             }
 
-             switch (scoreType)
 
-             {
 
-                 case (int)ConstItemAttributeType.FENG:
 
-                     valueBase = cfg.score1;
 
-                     break;
 
-                 case (int)ConstItemAttributeType.HUA:
 
-                     valueBase = cfg.score2;
 
-                     break;
 
-                 case (int)ConstItemAttributeType.XUE:
 
-                     valueBase = cfg.score3;
 
-                     break;
 
-                 case (int)ConstItemAttributeType.YUE:
 
-                     valueBase = cfg.score4;
 
-                     break;
 
-             }
 
-             AttributesDic.TryGetValue(CalculateHelper.GetItemScoreKey(scoreType, (int)ConstItemAttributeActionType.ADD_VALUE), out var valueAdd);
 
-             AttributesDic.TryGetValue(CalculateHelper.GetItemScoreKey(scoreType, (int)ConstItemAttributeActionType.ADD_PERCENT), out var percentAdd);
 
-             return CalculateHelper.GetItemAttribute(valueBase, percentAdd, valueAdd);
 
-         }
 
-     }
 
- }
 
 
  |