예제 #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 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);
            }
        }
예제 #3
0
        private void InitBaseAttrsByConfig()
        {
            if (DBData == null)
            {
                return;
            }

            if (BasicAttrs == null)
            {
                BasicAttrs = new ActorAttribute();
            }
            else
            {
                BasicAttrs.Clear();
            }
            foreach (var kv in DBData.BasicAttrs)
            {
                BasicAttrs.Add(kv.Key, (long)kv.Value);
            }
        }
예제 #4
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);
            }
        }
예제 #5
0
        public GoodsMountEquip(uint typeId, Net.PkgGoodsInfo goodsInfo)
        {
            _netInfo = goodsInfo;
            CreateGoodsByTypeId(typeId);
            if (BasicAttrs == null)
            {
                BasicAttrs = new ActorAttribute();
            }
            else
            {
                BasicAttrs.Clear();
            }

            if (DBData != null)
            {
                List <DBTextResource.DBAttrItem> list = DBData.attrs;
                for (int i = 0; i < list.Count; i++)
                {
                    BasicAttrs.Add(list[i].attr_id, list[i].attr_num);
                }
            }
        }
예제 #6
0
        public void UpdateSoul()
        {
            if (BasicAttrs == null)
            {
                BasicAttrs = new ActorAttribute();
            }
            BasicAttrs.Clear();


            CurLvHaveVal = 0;
            if (Lv >= 2)
            {
                for (int i = 1; i < Lv; i++)
                {
                    string csv_id = string.Format("{0}_{1}", type_idx, i);
                    var    info   = DBSoulLv.Instance.GetData(csv_id);
                    if (info != null)
                    {
                        CurLvHaveVal += info.cream;
                    }
                }
            }



            string key = string.Format("{0}_{1}", type_idx, Lv);

            SetAttribute(key, BasicAttrs, true);



            if (MaxBasicAttrs == null)
            {
                MaxBasicAttrs = new ActorAttribute();
            }
            MaxBasicAttrs.Clear();
            var data_soul_list = DBManager.Instance.QuerySqliteLikeKeyRow <string>(GlobalConfig.DBFile, "data_soul", "gid", type_idx.ToString());

            if (data_soul_list.Count <= 0)
            {
                GameDebug.LogError("不存在该武魂id" + type_idx.ToString());
                return;
            }

            var data_soul = data_soul_list[0];

            MaxLv = DBTextResource.ParseUI(data_soul["max_lv"]);
            Tips  = data_soul["tips"];


            mSoulType = DBTextResource.ParseUI(data_soul["type"]);

            if (data_soul["s_type"].Contains("["))
            {
                mTypeList = DBTextResource.ParseArrayUint(data_soul["s_type"], ",");
            }
            else
            {
                mTypeList = new List <uint>();
                uint value = DBTextResource.ParseUI(data_soul["s_type"]);
                mTypeList.Add(value);
            }


            key = string.Format("{0}_{1}", type_idx, MaxLv);
            SetAttribute(key, MaxBasicAttrs, false);


            IsMaxLv = MaxLv == Lv;


            string oriDes = GoodsHelper.GetGoodsDescriptionByTypeId(type_idx);

            if (isShowAttr)
            {
                base.description = GetShowDetailText();
            }
            else
            {
                base.description = oriDes;
            }
        }
예제 #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; //装备的品质
            }
        }