예제 #1
0
 public GoodsLightWeaponSoul(Net.PkgGoodsInfo pkgGoodsInfo) : this(pkgGoodsInfo.gid)
 {
     this.id       = pkgGoodsInfo.oid;
     this.num      = pkgGoodsInfo.num;
     this.bind     = pkgGoodsInfo.bind;
     this.bag_type = GameConst.BAG_TYPE_LIGHT_SOUL;
 }
예제 #2
0
        static int __CreateInstance(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

            try {
                if (LuaAPI.lua_gettop(L) == 1)
                {
                    xc.GoodsEquip __cl_gen_ret = new xc.GoodsEquip();
                    translator.Push(L, __cl_gen_ret);
                    return(1);
                }
                if (LuaAPI.lua_gettop(L) == 3 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && translator.Assignable <Net.PkgGoodsInfo>(L, 3))
                {
                    uint             typeId = LuaAPI.xlua_touint(L, 2);
                    Net.PkgGoodsInfo equip  = (Net.PkgGoodsInfo)translator.GetObject(L, 3, typeof(Net.PkgGoodsInfo));

                    xc.GoodsEquip __cl_gen_ret = new xc.GoodsEquip(typeId, equip);
                    translator.Push(L, __cl_gen_ret);
                    return(1);
                }
            }
            catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
            return(LuaAPI.luaL_error(L, "invalid arguments to xc.GoodsEquip constructor!"));
        }
        static int __CreateInstance(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

            try {
                if (LuaAPI.lua_gettop(L) == 2 && translator.Assignable <Net.PkgGoodsInfo>(L, 2))
                {
                    Net.PkgGoodsInfo pkgGoodsInfo = (Net.PkgGoodsInfo)translator.GetObject(L, 2, typeof(Net.PkgGoodsInfo));

                    xc.GoodsLightWeaponSoul __cl_gen_ret = new xc.GoodsLightWeaponSoul(pkgGoodsInfo);
                    translator.Push(L, __cl_gen_ret);
                    return(1);
                }
                if (LuaAPI.lua_gettop(L) == 2 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2))
                {
                    uint GID = LuaAPI.xlua_touint(L, 2);

                    xc.GoodsLightWeaponSoul __cl_gen_ret = new xc.GoodsLightWeaponSoul(GID);
                    translator.Push(L, __cl_gen_ret);
                    return(1);
                }
            }
            catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
            return(LuaAPI.luaL_error(L, "invalid arguments to xc.GoodsLightWeaponSoul constructor!"));
        }
예제 #4
0
        public GoodsElementEquip(uint typeId, Net.PkgGoodsInfo elementEquip)
        {
            CreateGoodsByTypeId(typeId);

            if (elementEquip != null)
            {
                UpdateGodEquip(elementEquip.element_ep);
            }
        }
예제 #5
0
        public GoodsMagicEquip(uint typeId, Net.PkgGoodsInfo goods)
        {
            if (goods != null)
            {
                NetMagicEquip = goods.magic_equip;
            }

            CreateGoodsByTypeId(typeId);
        }
예제 #6
0
 public GoodsEquip(uint typeId, Net.PkgGoodsInfo equip)
 {
     NetEquip = equip;
     CreateGoodsByTypeId(typeId);
     if (equip != null)
     {
         id              = equip.oid;
         bind            = equip.bind;
         IsSourceCompose = equip.source_compose;
     }
 }
예제 #7
0
 public GoodsItem(Net.PkgGoodsInfo pkgGoodsInfo) : this(pkgGoodsInfo.gid)
 {
     if (pkgGoodsInfo != null)
     {
         id                = pkgGoodsInfo.oid;
         num               = pkgGoodsInfo.num;
         bind              = pkgGoodsInfo.bind;
         expire_time       = pkgGoodsInfo.expire_time;
         this.pkgGoodsInfo = pkgGoodsInfo;
     }
 }
예제 #8
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);
                }
            }
        }
예제 #9
0
        public GoodsSoul(uint typeId, Net.PkgGoodsInfo info)
        {
            CreateGoodsByTypeId(typeId);
            var data_soul = DBManager.Instance.QuerySqliteLikeKeyRow <string>(GlobalConfig.DBFile, "data_soul", "gid", type_idx.ToString());

            if (data_soul.Count > 0)
            {
                var table = data_soul[0];
                ResolveGetVal = DBTextResource.ParseUI(table["resolve"]);
            }

            if (info != null)
            {
                UpdateSoul(info.soul);
            }
        }
예제 #10
0
        public GoodsGodEquip(uint typeId, Net.PkgGoodsInfo godEquip)
        {
            CreateGoodsByTypeId(typeId);

            if (DBData == null)
            {
                GameDebug.LogError(string.Format("神兵器灵表没有id[{0}]", typeId));
                return;
            }
            _PosId = DBData.Pos;

            if (godEquip != null && godEquip.god_equip != null)
            {
                UpdateGodEquip(godEquip.god_equip);
            }
            else
            {
                UpdateGodEquip(null);
            }
        }
예제 #11
0
        static int _m_UpdateGem(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            xc.GoodsEquip __cl_gen_to_be_invoked = (xc.GoodsEquip)translator.FastGetCSObj(L, 1);


            try {
                {
                    Net.PkgGoodsInfo equip = (Net.PkgGoodsInfo)translator.GetObject(L, 2, typeof(Net.PkgGoodsInfo));

                    __cl_gen_to_be_invoked.UpdateGem(equip);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
예제 #12
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);
                }
            }
        }
예제 #13
0
 public void UpdateGem(Net.PkgGoodsInfo equip)
 {
     NetEquip = equip;
     Gems.Clear();
     if (NetEquip == null)
     {
         return;
     }
     if (NetEquip.equip != null && NetEquip.equip.gems != null)
     {
         foreach (var item in NetEquip.equip.gems)
         {
             if (Gems.ContainsKey(item.id) == true)
             {
                 Gems[item.id] = item.gem_id;
             }
             else
             {
                 Gems.Add(item.id, item.gem_id);
             }
         }
     }
 }
예제 #14
0
        static int _m_UpdateAttr(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            xc.GoodsDecorate __cl_gen_to_be_invoked = (xc.GoodsDecorate)translator.FastGetCSObj(L, 1);


            try {
                {
                    uint             gid      = LuaAPI.xlua_touint(L, 2);
                    Net.PkgGoodsInfo decorate = (Net.PkgGoodsInfo)translator.GetObject(L, 3, typeof(Net.PkgGoodsInfo));

                    __cl_gen_to_be_invoked.UpdateAttr(gid, decorate);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
예제 #15
0
파일: Goods.cs 프로젝트: wuhuolong/MaxBooks
 public static void Update(Net.PkgGoodsInfo info, Goods goods)
 {
     if (info == null || goods == null)
     {
         return;
     }
     if (goods.type_idx != info.gid)
     {//更换了模型ID
         goods.type_idx = info.gid;
         var goods_info = GoodsHelper.GetGoodsInfo(info.gid);
         if (goods_info != null)
         {
             goods.main_type = goods_info.type;
             if (goods is GoodsItem)
             {
                 (goods as GoodsItem).SetIdFindData(info.gid);
             }
         }
     }
     goods.num         = info.num;
     goods.bind        = info.bind;
     goods.expire_time = info.expire_time;
     goods.create_time = info.create_time;
     if (info.equip != null) //代表它为装备
     {
         GoodsEquip equip = goods as GoodsEquip;
         if (equip != null)
         {
             equip.UpdateAttr(info.gid, info);
             equip.UpdateGem(info);
         }
     }
     else if (info.soul != null)
     {
         GoodsSoul soul = goods as GoodsSoul;
         if (soul != null)
         {
             soul.UpdateSoul(info.soul);
         }
     }
     else if (info.decorate != null)
     {
         GoodsDecorate decorate = goods as GoodsDecorate;
         if (decorate != null)
         {
             decorate.UpdateAttr(info.gid, info);
         }
     }
     else if (info.god_equip != null)
     {
         GoodsGodEquip godEquip = goods as GoodsGodEquip;
         if (godEquip != null)
         {
             godEquip.UpdateGodEquip(info.god_equip);
         }
     }
     else if (info.ride_equip != null)
     {
         //GoodsMountEquip mountEquip = goods as GoodsMountEquip;
         //if (mountEquip != null)
         //    mountEquip.UpdateMountEquip(info.ride_equip);
     }
     else if (info.magic_equip != null)
     {
         GoodsMagicEquip magicEquip = goods as GoodsMagicEquip;
         if (magicEquip != null)
         {
             magicEquip.UpdateMagicEquip(info.magic_equip);
         }
     }
 }
예제 #16
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; //装备的品质
                }
            }
        }
예제 #17
0
파일: Goods.cs 프로젝트: wuhuolong/MaxBooks
        public static Goods Create(uint mainType, uint typeId, Net.PkgGoodsInfo info)
        {
            Goods goods = null;

            switch (mainType)
            {
            case GameConst.GIVE_TYPE_EQUIP:
            {
                goods = new GoodsEquip(typeId, info);
                break;
            }

            case GameConst.GIVE_TYPE_SOUL:
            {
                goods = new GoodsSoul(typeId, info);
                break;
            }

            case GameConst.GIVE_TYPE_DECORATE:
            {
                goods = new GoodsDecorate(typeId, info);
                break;
            }

            case GameConst.GIVE_TYPE_GOD_EQUIP:
            {
                goods = new GoodsGodEquip(typeId, info);
                break;
            }

            case GameConst.GIVE_TYPE_RIDE_EQUIP:
            {
                goods = new GoodsMountEquip(typeId, info);
                break;
            }

            case GameConst.GIVE_TYPE_LIGHT_SOUL:
            {
                if (info != null)
                {
                    goods = new GoodsLightWeaponSoul(info);
                    break;
                }
                goods = new GoodsLightWeaponSoul(typeId);
                break;
            }

            case GameConst.GIVE_TYPE_MAGIC_EQUIP:
            {
                goods = new GoodsMagicEquip(typeId, info);
                break;
            }

            case GameConst.GIVE_TYPE_ARCHIVE:
            {
                if (info != null)
                {
                    goods = new GoodsItem(info)
                    {
                        bag_type = GameConst.BAG_TYPE_ARCHIVE
                    };
                }
                else
                {
                    goods = new GoodsItem(typeId)
                    {
                        bag_type = GameConst.BAG_TYPE_ARCHIVE
                    };
                }
                break;
            }

            default:
            {
                var goods_info = GoodsHelper.GetGoodsInfo(typeId);
                if (goods_info != null)
                {
                    string luaScript = GoodsHelper.GetGoodsLuaScriptByGoodsId(typeId);
                    if (!string.IsNullOrEmpty(luaScript))
                    {
                        if (LuaScriptMgr.Instance == null)
                        {
                            goods = new GoodsItem(typeId);
                        }
                        if (LuaScriptMgr.Instance.IsLuaScriptExist(luaScript))
                        {
                            goods = new GoodsLuaEx(typeId, luaScript);
                        }
                        else
                        {
                            Debug.LogWarning(string.Format("{0}未找到名字为的组件", luaScript));
                            goods = null;
                        }
                    }
                    else
                    {
                        if (info != null)
                        {
                            goods = new GoodsItem(info);
                            break;
                        }
                        goods = new GoodsItem(typeId);
                    }
                }
                break;
            }
            }
            if (goods == null)
            {//无法正常创建物品
                goods = GetDefaultGoods(typeId);
            }
            return(goods);
        }
예제 #18
0
 public GoodsDecorate(uint typeId, Net.PkgGoodsInfo decorate)
 {
     NetDecorate = decorate;
     CreateGoodsByTypeId(typeId);
 }
예제 #19
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; //装备的品质
            }
        }
예제 #20
0
파일: Goods.cs 프로젝트: wuhuolong/MaxBooks
        public static Goods Create(uint typeId, Net.PkgGoodsInfo info)
        {
            uint mainType = GoodsHelper.GetGoodsType(typeId);

            return(Create(mainType, typeId, info));
        }