Example #1
0
        public override void RefreshEquipUp()
        {
            is_equipUp   = false;
            is_equipDown = false;
            if (LocalPlayerManager.Instance.LocalActorAttribute.Vocation != this.use_job && this.use_job != 0)
            {
                return;
            }
            if (this.IsInEnableTime() == false)
            {//物品过期
                is_equipUp   = false;
                is_equipDown = false;
                return;
            }
            GoodsEquip equip = EquipHelper.GetInstallEquipByPos(this.EquipPos);

            if (equip == null)
            {
                is_equipUp   = true;
                is_equipDown = false;
                return;
            }
            int this_equipRank = this.EquipRank;
            int equip_rank     = equip.EquipRank;

            if (this_equipRank > equip_rank)
            {
                is_equipUp = true;
            }
            else if (this_equipRank < equip_rank)
            {
                is_equipDown = true;
            }
        }
Example #2
0
        /// <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);
        }
Example #3
0
        /// <summary>
        /// 饰品传奇属性描述
        /// </summary>
        /// <param name="equip"></param>
        /// <returns></returns>
        public static string GetDecorateLegendAttrStr(GoodsDecorate decorate)
        {
            if (decorate == null && decorate.LegendAttrs == null)
            {
                return(string.Empty);
            }

            List <KeyValuePair <string, uint> > strColorPairs = new List <KeyValuePair <string, uint> >();

            strColorPairs.Clear();
            foreach (var kv in decorate.LegendAttrs)
            {
                uint   color = 0;
                string des   = EquipHelper.GetSubAttrDes(kv.Id, kv.Values, " +", out color);
                KeyValuePair <string, uint> strColorPair = new KeyValuePair <string, uint>(des, color);
                strColorPairs.Add(strColorPair);
            }

            string str = string.Empty;

            strColorPairs.Sort((a, b) =>
            {
                if (a.Value > b.Value)
                {
                    return(-1);
                }
                else if (a.Value < b.Value)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            });

            foreach (KeyValuePair <string, uint> strColorPair in strColorPairs)
            {
                str += strColorPair.Key + "\n";
            }

            if (str.Length > 0)
            {
                str = str.Substring(0, str.Length - 1);
            }

            return(str);
        }
Example #4
0
        /// <summary>
        /// 获取EquipAttributers结构属性描述字符串
        /// </summary>
        public static string GetEquipAttributesString(EquipAttributes attrs)
        {
            List <KeyValuePair <string, uint> > strColorPairs = new List <KeyValuePair <string, uint> >();

            strColorPairs.Clear();

            foreach (var kv in attrs)
            {
                uint   color = 0;
                string des   = EquipHelper.GetSubAttrDes(kv.Id, kv.Values, " +", out color);
                KeyValuePair <string, uint> strColorPair = new KeyValuePair <string, uint>(des, color);
                strColorPairs.Add(strColorPair);
            }

            string str = string.Empty;

            strColorPairs.Sort((a, b) =>
            {
                if (a.Value > b.Value)
                {
                    return(-1);
                }
                else if (a.Value < b.Value)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            });

            foreach (KeyValuePair <string, uint> strColorPair in strColorPairs)
            {
                str += strColorPair.Key + "\n";
            }

            if (str.Length > 0)
            {
                str = str.Substring(0, str.Length - 1);
            }

            return(str);
        }
Example #5
0
        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;
        }
Example #6
0
        /// <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);
        }
Example #7
0
 public void UpdateAttr(uint lv, uint num)
 {
     _lv       = lv;
     _num      = num;
     ActiveNum = EquipHelper.GetActiveSuitNum(Id, Lv, RealNum);
 }