コード例 #1
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);
            }
        }
コード例 #2
0
ファイル: GoodsGodEquip.cs プロジェクト: wuhuolong/MaxBooks
        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);
            }
        }
コード例 #3
0
ファイル: GoodsEquip.cs プロジェクト: wuhuolong/MaxBooks
        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; //装备的品质
                }
            }
        }
コード例 #4
0
ファイル: GoodsEquip.cs プロジェクト: wuhuolong/MaxBooks
        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; //装备的品质
            }
        }