/// <summary> /// 返回饰品星级 /// <returns></returns> public static uint GetDecorateStar(GoodsDecorate decorate) { uint ret = 0; if (decorate == null || decorate.LegendAttrs == null) { return(0); } if (decorate.ServerStar != 0xffffff) { return(decorate.ServerStar); } bool has_attrs = false; foreach (var kv in decorate.LegendAttrs) { var attrData = EquipHelper.GetEquipAttrData(kv.Id); if (attrData != null) { EquipSubAttrData data = null; if (DBManager.GetInstance().GetDB <DBEquipSubAttr>().EquipSubAttrDescs.TryGetValue(attrData.SubAttrId, out data)) { has_attrs = true; List <string> des_value = new List <string>(); for (int i = 0; i < data.DesType.Count; i++) { if (attrData.ColorType.Count > 4) { var valuerange = attrData.ColorType[3]; if (kv.Values[i] >= valuerange.Min) { ret++;//对应就是0~4品质 } } } } } } if (has_attrs == false) { if (decorate.DbData != null) { ret = decorate.DbData.DefaultStar; } } return(ret); }
public static IEquipAttribute CreateEquipAttr(uint equip_attr_id, List <uint> attr_args) { var equip_attr_data = EquipHelper.GetEquipAttrData(equip_attr_id); if (equip_attr_data == null) { GameDebug.LogError(string.Format("装备属性id({0})不存在!", equip_attr_id)); } return(new DefaultAttribute(equip_attr_id, attr_args)); // switch (equip_attr_data.Type) // { // case EEquipAttrType.NormalAttr: // case EEquipAttrType.NoDiamond: // case EEquipAttrType.God: // case EEquipAttrType.CutUseLv: // // case EEquipAttrType.NormalAttrEx: // { // return new DefaultAttribute(equip_attr_id, attr_args , (uint)equip_attr_data.Type); // // if (attr_args.Count == 1) // // return new EquipAttr.OneBasicAttr(equip_attr_id, attr_args); // // else if (attr_args.Count == 2) // // return new EquipAttr.TwoBasicAttr(equip_attr_id, attr_args); // // else // // TODO 添加多属性的情况 // // // // break; // } // case EEquipAttrType.Listener: // { // return new DefaultAttribute(equip_attr_id, attr_args , (uint)equip_attr_data.Type); // } // default: // { // GameDebug.LogWarning("[EquipAttrFactory]暂时还没支持的类型:" + equip_attr_data.Type); // return new DefaultAttribute(equip_attr_id, attr_args , (uint)equip_attr_data.Type); // } // } // return null; }
/// <summary> /// 获取玩家穿戴饰品总属性描述 /// </summary> public static List <DBDecorate.LegendAttrDescItem> GetPlayerDecorateSumAttrsDesc() { ActorAttribute baseAtrrs = new ActorAttribute(); EquipAttributes legendAttrs = new EquipAttributes(); foreach (var kv in ItemManager.Instance.WearingDecorate) { var decorate = kv.Value; if (!decorate.IsWeared) { continue; } // 基础属性 foreach (var baseKv in decorate.BasicAttrs) { baseAtrrs.Add(baseKv.Value.Id, baseKv.Value.Value); } // 强化属性 var strengthenAttr = GetStrengthAttr(decorate.StrengthLv, decorate); foreach (var strengthenKv in strengthenAttr) { baseAtrrs.Add(strengthenKv.Value.Id, strengthenKv.Value.Value); } // 附魔属性 var appendAttr = GetAppendAttr(decorate); foreach (var appendKv in appendAttr) { baseAtrrs.Add(appendKv.Value.Id, appendKv.Value.Value); } // 传奇属性 foreach (var baseKv in decorate.LegendAttrs) { var attrId = baseKv.Id; List <uint> values = new List <uint>(); foreach (var e in baseKv.Values) { values.Add(e); } legendAttrs.AddValue(attrId, values, true); } } // 套装属性 var suitAttrList = GetDecorateSuitAttrList(); foreach (var e in suitAttrList) { if (e.Count >= 2) { uint attrId = e[0]; uint value = e[1]; if (attrId == GameConst.AR_ATTACK_BASE) // 基础攻击 { // 最小攻击 var minAtk = baseAtrrs.GetAttr(GameConst.AR_MIN_ATTACK_BASE); if (null != minAtk) { baseAtrrs.Add(GameConst.AR_MIN_ATTACK_BASE, value); } // 最大攻击 var maxAtk = baseAtrrs.GetAttr(GameConst.AR_MAX_ATTACK_BASE); if (null != maxAtk) { baseAtrrs.Add(GameConst.AR_MAX_ATTACK_BASE, value); } ; if (null == minAtk && null == maxAtk) { baseAtrrs.Add(attrId, value); } } else { baseAtrrs.Add(attrId, value); } } } var ret = new List <DBDecorate.LegendAttrDescItem>(); var baseDescArray = EquipHelper.GetEquipBaseDesItemArray(baseAtrrs, true); foreach (var item in baseDescArray) { var descItem = new DBDecorate.LegendAttrDescItem(); descItem.Name = item.PropName; descItem.ValueStr = item.ValueStr; ret.Add(descItem); } foreach (var kv in legendAttrs) { var equipAttrData = EquipHelper.GetEquipAttrData(kv.Id); var attrList = GetSubAttrDescEx(equipAttrData, kv.Values.ToArray()); if (attrList.Count >= 2) { var descItem = new DBDecorate.LegendAttrDescItem(); descItem.Name = attrList[0]; descItem.ValueStr = attrList[1]; ret.Add(descItem); } } return(ret); }