示例#1
0
        public void UpdateAttr(uint gid, Net.PkgGoodsInfo decorate)
        {
            NetDecorate = decorate;

            if (BasicAttrs == null)
            {
                BasicAttrs = new ActorAttribute();
            }
            else
            {
                BasicAttrs.Clear();
            }

            if (LegendAttrs == null)
            {
                LegendAttrs = new EquipAttributes();
            }
            else
            {
                LegendAttrs.Clear();
            }

            var rec = DBDecorate.Instance.GetData(gid);

            if (rec != null)
            {
                string raw = rec.Attrs;
                raw = raw.Replace(" ", "");

                var matchs = Regex.Matches(raw, @"\{(\d+),(\d+)\}");
                foreach (Match _match in matchs)
                {
                    if (_match.Success)
                    {
                        uint attrId    = (DBTextResource.ParseUI(_match.Groups[1].Value));
                        uint attrValue = DBTextResource.ParseUI(_match.Groups[2].Value);
                        BasicAttrs.Add(attrId, attrValue);
                    }
                }
            }

            if (decorate != null && decorate.decorate != null && decorate.decorate.legend_attrs != null)
            {
                foreach (var attr in decorate.decorate.legend_attrs)
                {
                    LegendAttrs.Add(attr.id, attr.vals);
                }
            }
        }
示例#2
0
        public void UpdateGodEquip(Net.PkgElementEp elementEquip)
        {
            pkgElementEp = elementEquip;

            if (ExtraAttrs == null)
            {
                ExtraAttrs = new EquipAttributes();
            }
            else
            {
                ExtraAttrs.Clear();
            }

            foreach (var attr in elementEquip.legend_attrs)
            {
                ExtraAttrs.Add(attr.id, attr.vals);
            }
        }
示例#3
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);
        }
示例#4
0
        public void UpdateAttr(Net.PkgMagicEquip equip)
        {
            // 基础属性
            if (BasicAttrs == null)
            {
                BasicAttrs = new ActorAttribute();
            }

            else
            {
                BasicAttrs.Clear();
            }

            if (DbData != null)
            {
                foreach (var v in DbData.BaseAttrs)
                {
                    BasicAttrs.Add(v.attr_id, v.attr_num);
                }
            }

            // 附加属性
            if (AppendAttrs == null)
            {
                AppendAttrs = new EquipAttributes();
            }

            else
            {
                AppendAttrs.Clear();
            }

            if (equip == null)
            {
                return;
            }

            foreach (var attr in equip.spec_attrs)
            {
                AppendAttrs.Add(attr.id, attr.vals);
            }
        }
示例#5
0
        public void UpdateGodEquip(Net.PkgGodEquip godEquip)
        {
            PkgGodEquip = godEquip;
            if (PkgGodEquip == null)
            {
                InitBaseAttrsByConfig();
                return;
            }
            Net.PkgKvMin kv;

            if (BasicAttrs == null)
            {
                BasicAttrs = new ActorAttribute();
            }
            else
            {
                BasicAttrs.Clear();
            }

            for (var i = 0; i < godEquip.base_attrs.Count; i++)
            {
                kv = godEquip.base_attrs[i];
                BasicAttrs.Add(kv.k, kv.v);
            }


            if (ExtraAttrs == null)
            {
                ExtraAttrs = new EquipAttributes();
            }
            else
            {
                ExtraAttrs.Clear();
            }

            foreach (var attr in godEquip.spec_attrs)
            {
                ExtraAttrs.Add(attr.id, attr.vals);
            }
        }
示例#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);
        }
示例#7
0
        public void UpdateAttr(uint gid, Net.PkgGoodsInfo equip)
        {
            NetEquip = equip;
            if (LegendAttrs == null)
            {
                LegendAttrs = new EquipAttributes();
            }
            else
            {
                LegendAttrs.Clear();
            }
            if (BasicAttrs == null)
            {
                BasicAttrs = new ActorAttribute();
            }
            else
            {
                BasicAttrs.Clear();
            }

            if (ExtraAttrs == null)
            {
                ExtraAttrs = new ActorAttribute();
            }
            else
            {
                ExtraAttrs.Clear();
            }

            //生成基础属性
            var base_attr = DBEquipBase.Instance.GetAttrInfo(gid);

            if (base_attr != null)
            {
                using (var iter = base_attr.GetEnumerator())
                {
                    while (iter.MoveNext())
                    {
                        var cur = iter.Current;
                        BasicAttrs.Add(cur.Key, cur.Value);
                    }
                }
            }

            if (NetEquip == null)
            {
                return;
            }
            if (equip != null && equip.equip != null && equip.equip.legend_attrs != null)
            {
                foreach (var attr in equip.equip.legend_attrs)
                {
                    LegendAttrs.Add(attr.id, attr.vals);
                }
            }
            if (equip != null && equip.equip != null && equip.equip.extra_attrs != null)
            {
                foreach (var attr in equip.equip.extra_attrs)
                {
                    ExtraAttrs.Add(attr.k, attr.v);
                }
            }
            if (equip != null && equip.equip != null)
            {
                SuitLv = equip.equip.suit_lv;
                foreach (var item in equip.equip.gems)
                {
                    if (Gems.ContainsKey(item.id) == true)
                    {
                        Gems[item.id] = item.gem_id;
                    }
                    else
                    {
                        Gems.Add(item.id, item.gem_id);
                    }
                }

                // 套装精炼等级
                RefineLv = equip.equip.refine_lv;

                // 铸魂等级
                CastSoulLv = equip.equip.cast_soul_lv;

                // 记录扩展属性
                if (equip.equip.extend_propertys != null && equip.equip.extend_propertys.Count > 0)
                {
                    ExtendPropertys = new Dictionary <string, string>();
                    ExtendPropertys.Clear();
                    foreach (Net.PkgStrStr pkgStrStr in equip.equip.extend_propertys)
                    {
                        ExtendPropertys.Add(System.Text.Encoding.UTF8.GetString(pkgStrStr.k), System.Text.Encoding.UTF8.GetString(pkgStrStr.v));
                    }
                }
            }
            if (IsHasIdentifyWing())
            {
                this.color_type = equip.equip.qual; //装备的品质
            }
        }