Exemplo n.º 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);
                }
            }
        }
Exemplo n.º 2
0
        public override void ParseClientGoodsStr_inner(Dictionary <string, string> param_dict)
        {
            base.ParseClientGoodsStr_inner(param_dict);
            if (NetEquip == null)
            {
                NetEquip = new Net.PkgGoodsInfo();
            }
            if (NetEquip.equip == null)
            {
                NetEquip.equip = new Net.PkgEquip();
            }
            if (NetEquip.equip.legend_attrs != null)
            {
                NetEquip.equip.legend_attrs.Clear();
            }
            if (NetEquip.equip.extra_attrs != null)
            {
                NetEquip.equip.extra_attrs.Clear();
            }
            LegendAttrs.Clear();
            if (param_dict.ContainsKey("LegendAttrs"))
            {//传奇属性
                string legend_str = param_dict["LegendAttrs"];
                var    matches    = Regex.Matches(legend_str, @"(\d+),\[([\d|,]+)\]");
                foreach (System.Text.RegularExpressions.Match _match in matches)
                {
                    if (_match.Success)
                    {
                        uint attr_id = 0;
                        if (uint.TryParse(_match.Groups[1].Value, out attr_id) == false)
                        {
                            continue;
                        }
                        List <uint> attr_uint_list = DBTextResource.ParseArrayUint(_match.Groups[2].Value, ",", false);
                        if (attr_uint_list == null || attr_uint_list.Count == 0)
                        {
                            continue;
                        }
                        LegendAttrs.Add(attr_id, attr_uint_list);
                    }
                }
            }
            ExtraAttrs.Clear();
            if (param_dict.ContainsKey("ExtraAttrs"))
            {//额外属性
                string legend_str = param_dict["ExtraAttrs"];
                var    matches    = Regex.Matches(legend_str, @"(\d+),(\d+)");
                foreach (System.Text.RegularExpressions.Match _match in matches)
                {
                    if (_match.Success)
                    {
                        uint attr_id = 0;
                        if (uint.TryParse(_match.Groups[1].Value, out attr_id) == false)
                        {
                            continue;
                        }
                        uint attr_num = 0;
                        if (uint.TryParse(_match.Groups[2].Value, out attr_num) == false)
                        {
                            continue;
                        }
                        ExtraAttrs.Add(attr_id, attr_num);
                    }
                }
            }

            if (IsHasIdentifyWing() && param_dict.ContainsKey("color_type"))
            {
                uint var_color_type = 0;
                if (uint.TryParse(param_dict["color_type"], out var_color_type))
                {
                    this.color_type = var_color_type; //装备的品质
                }
            }
        }
Exemplo n.º 3
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; //装备的品质
            }
        }