示例#1
0
        /// <summary>获取装备信息</summary>
        /// <param name="id">装备基表Id</param>
        /// <param name="count">数量</param>
        private bool UpdateEquip(int id, int count)
        {
            var player = Session.Player;

            if (player.Bag.BagIsFull)
            {
                return(false);
            }
            var bequip = Variable.BASE_EQUIP.FirstOrDefault(m => m.id == (decimal)id);

            if (bequip == null)
            {
                return(false);
            }

            count = player.Bag.Surplus > count ? count : player.Bag.Surplus;
            for (var i = 0; i < count; i++)
            {
                tg_bag equip = CommonHelper.EquipReset(player.User.id, bequip.id);
                equip.user_id = player.User.id;
                (new Bag()).BuildReward(equip.user_id, new List <tg_bag>()
                {
                    equip
                });                                                                   //入包整理并推送
#if DEBUG
                XTrace.WriteLine("{0} 数量:{1}", bequip.id, i);
#endif
            }
            return(true);
        }
示例#2
0
        private void Update(tg_bag equip, tg_bag newequip)
        {
            equip.attribute1_spirit_level = 0;
            equip.attribute1_spirit_lock  = (int)SpiritLockType.UNLOCK;//解锁
            equip.attribute1_spirit_value = 0;
            equip.attribute1_type         = newequip.attribute1_type;
            equip.attribute1_value        = newequip.attribute1_value;
            equip.attribute1_value_spirit = 0;

            equip.attribute2_spirit_level = 0;
            equip.attribute2_spirit_lock  = (int)SpiritLockType.UNLOCK;//解锁
            equip.attribute2_spirit_value = 0;
            equip.attribute2_type         = newequip.attribute2_type;
            equip.attribute2_value        = newequip.attribute2_value;
            equip.attribute2_value_spirit = 0;

            equip.attribute3_spirit_level = 0;
            equip.attribute3_spirit_lock  = (int)SpiritLockType.UNLOCK;//解锁
            equip.attribute3_spirit_value = 0;
            equip.attribute3_type         = newequip.attribute3_type;
            equip.attribute3_value        = newequip.attribute3_value;
            equip.attribute3_value_spirit = 0;

            equip.baptize_count++;
            equip.Update();
        }
示例#3
0
        /// <summary>背包使用</summary>
        /// <param name="session">session</param>
        /// <param name="res">资源字符串</param>
        /// <param name="count">数量</param>
        /// <param name="prop">使用后的道具</param>
        /// <returns>结果类型</returns>
        public ResultType BagToUse(TGGSession session, string res, int count, tg_bag prop)
        {
            var userid   = session.Player.User.id;
            var list_res = PretreatmentResourcesList(session.Player.User.player_vocation, res, count).ToList();

            if (!list_res.Any())
            {
                return(ResultType.BAG_RESOURCES_ERROR);
            }
            var b = BagIsEnough(list_res, session.Player.Bag.Surplus);

            if (!b)
            {
                return(ResultType.BAG_ISFULL_ERROR);
            }
            //资源发放
            var list_notin = ResourcesNotInBag(list_res).ToList();

            if (list_notin.Any())
            {
                UpdatePlayer(session, list_notin);
            }
            var list_in = ResourcesInBag(list_res).ToList();
            var inbag   = new List <tg_bag>();

            if (list_in.Any())
            {
                inbag = InBag(userid, list_in);
            }
            inbag.Add(prop);
            (new Bag()).BuildReward(userid, inbag);
            return(ResultType.SUCCESS);
        }
示例#4
0
        /// <summary> 获取装备的属性值 </summary>
        /// <param name="equip">要获取的装备</param>
        private List <CommonHelper.EquipItem> GetAttribute(tg_bag equip)
        {
            var list = new List <CommonHelper.EquipItem>();

            if (equip.attribute1_type != 0)
            {
                var value = equip.attribute1_value + equip.attribute1_value_spirit;
                list.Add(new CommonHelper.EquipItem()
                {
                    type = equip.attribute1_type, value = value
                });
            }
            if (equip.attribute2_type != 0)
            {
                var value = equip.attribute2_value + equip.attribute2_value_spirit;
                list.Add(new CommonHelper.EquipItem()
                {
                    type = equip.attribute2_type, value = value
                });
            }
            if (equip.attribute3_type != 0)
            {
                var value = equip.attribute3_value + equip.attribute3_value_spirit;
                list.Add(new CommonHelper.EquipItem()
                {
                    type = equip.attribute3_type, value = value
                });
            }
            return(list);
        }
示例#5
0
        private ASObject UpdateEquip(int id, int count, TGGSession session)
        {
            if (session.Player.Bag.BagIsFull)
            {
                return(BuildData((int)ResultType.BAG_ISFULL_ERROR));
            }
            var base_equip = Variable.BASE_EQUIP.FirstOrDefault(m => m.id == (decimal)id);

            if (base_equip == null)
            {
                return(BuildData((int)ResultType.FRONT_DATA_ERROR));
            }
            dynamic obje = CommonHelper.ReflectionMethods("TGG.Module.Equip", "Common");

            //dynamic ob = CommonHelper.ReflectionMethods("TGG.Module.Props", "Common");
            count = session.Player.Bag.Surplus > count ? count : session.Player.Bag.Surplus;
            for (var i = 0; i < count; i++)
            {
                tg_bag equip = obje.GetEquip(base_equip);
                equip.user_id = session.Player.User.id;
                (new Bag()).BuildReward(equip.user_id, new List <tg_bag>()
                {
                    equip
                });                                                                   //入包整理并推送
#if DEBUG
                XTrace.WriteLine("{0} 数量:{1}", base_equip.id, i);
#endif
            }
            return(BuildData((int)ResultType.SUCCESS));
        }
示例#6
0
 /// <summary> tg_bag  组装 EquipVo </summary>
 /// <param name="equip">装备实体</param>
 /// <returns> 前端EquipVo </returns>
 public static EquipVo ToEquipVo(tg_bag equip)
 {
     return(new EquipVo()
     {
         id = equip.id,
         baseId = equip.base_id,
         bind = equip.bind,
         state = equip.state,
         att1 = equip.attribute1_type,
         value1 = equip.attribute1_value + equip.attribute1_value_spirit,
         att2 = equip.attribute2_type,
         value2 = equip.attribute2_value + equip.attribute2_value_spirit,
         att3 = equip.attribute3_type,
         value3 = equip.attribute3_value + equip.attribute3_value_spirit,
         lv1 = equip.attribute1_spirit_level,
         spirit1 = equip.attribute1_spirit_value,
         lv2 = equip.attribute2_spirit_level,
         spirit2 = equip.attribute2_spirit_value,
         lv3 = equip.attribute3_spirit_level,
         spirit3 = equip.attribute3_spirit_value,
         isLock1 = equip.attribute1_spirit_lock,
         isLock2 = equip.attribute2_spirit_lock,
         isLock3 = equip.attribute3_spirit_lock,
         sopCount = 5 - equip.baptize_count
     });
 }
示例#7
0
 /// <summary> 获取物品更变Vo 并修改数据库 </summary>
 /// <returns></returns>
 private List <RewardVo> GetRewardVos(TGGSession session, tg_bag prop)
 {
     if (prop.count == 0)
     {
         prop.Delete();
         session.Player.Bag.Surplus  += 1;
         session.Player.Bag.BagIsFull = false;
         return(new List <RewardVo> {
             new RewardVo {
                 goodsType = (int)GoodsType.TYPE_PROP, deleteArray = new List <double> {
                     prop.id
                 }
             }
         });
     }
     prop.Save();
     return(new List <RewardVo>
     {
         new RewardVo
         {
             goodsType = (int)GoodsType.TYPE_PROP,
             decreases = (new Bag()).ConvertListASObject(new List <tg_bag> {
                 prop
             }, "Props")
         }
     });
 }
示例#8
0
        /// <summary> 获取道具 </summary>
        /// <param name="baseWarCopy">合战副本基表</param>
        /// <param name="userid">用户Id</param>
        private static tg_bag GetProp(BaseWarCopy baseWarCopy, Int64 userid)
        {
            var array = baseWarCopy.dropCount.Split('_');
            var arr   = baseWarCopy.zhuChengLing.Split('|');

            if (array.Length > 2 || arr.Length == 0)
            {
                return(null);
            }
            var rd       = new Random();
            var number   = rd.Next(Convert.ToInt32(array[0]), Convert.ToInt32(array[1]) + 1);
            var c        = rd.Next(0, arr.Length);
            var propid   = Convert.ToInt32(arr[c]);
            var baseProp = Variable.BASE_PROP.FirstOrDefault(m => m.id == propid);

            if (baseProp == null)
            {
                return(null);
            }
            var temp = new tg_bag
            {
                base_id = propid,
                bind    = baseProp.bind,
                count   = number,
                type    = baseProp.type,
                user_id = userid,
            };

            return(temp);
        }
示例#9
0
 /// <summary>
 /// tg_bag实体装换为PropVo
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public static PropVo ToPropVo(tg_bag model)
 {
     return(new PropVo()
     {
         id = model.id,
         baseId = model.base_id,
         bind = model.bind,
         count = model.count,
     });
 }
示例#10
0
        /// <summary> 验证道具是否可以删除 </summary>
        /// <param name="prop">道具</param>
        private ResultType IsDeleteProp(tg_bag prop)
        {
            var base_prop = Common.GetInstance().GetBaseProp(prop.base_id); //查询道具的基表数据

            if (base_prop == null)
            {
                return(ResultType.BASE_TABLE_ERROR);
            }
            return(base_prop.destroy == 0 ? ResultType.EQUIP_NO_DISCARD : ResultType.SUCCESS);
        }
示例#11
0
        /// <summary> 验证装备是否可以删除 </summary>
        /// <param name="prop">装备</param>
        private ResultType IsDeleteEquip(tg_bag prop)
        {
            if (prop.state == (int)LoadStateType.LOAD)
            {
                return(ResultType.EQUIP_NOSELL);                                       //验证装备状态
            }
            var base_equip = Common.GetInstance().GetBaseEquip(prop.base_id);          //查询装备基表信息

            return(base_equip == null ? ResultType.BASE_TABLE_ERROR : ResultType.SUCCESS);
        }
示例#12
0
        public Dictionary <String, Object> BuildData(int result, tg_bag equip, Int64 rid)
        {
            var dic = new Dictionary <string, object>
            {
                { "result", result },
                { "equip", equip != null?EntityToVo.ToEquipVo(equip) : null },
                { "role", rid == 0 ? null : RoleInfo(rid) }
            };

            return(dic);
        }
示例#13
0
 /// <summary>背包日志</summary>
 public void BagLog(tg_bag prop, LogType type, int mn, int cn, string mnname, string cnname, int getcoin, int count)
 {
     try
     {
         log.BagInsertLog(prop, mn, cn, getcoin);                 //记录日志
         var    data = string.Format("{0}_{1}", "Prop", prop.id); //日志记录
         string s    = GetString(prop);
         WriteLog(prop.user_id, (int)type, mn, cn, mnname, cnname, s, (int)GoodsType.TYPE_PROP, count, prop.count - count, data);
     }
     catch (Exception ex) { XTrace.WriteException(ex); }
 }
示例#14
0
        public ASObject ARENA_DEKARON1(TGG.SocketServer.TGGSession session, ASObject data)
        {
            var model = new tg_bag();

            model.user_id = session.Player.User.id;
            model.base_id = 4000013;
            model.type    = 6;
            model.count   = 20;
            //TGG.Module.Props.Service.Common.GetInstance().InBagFinishing(session, model);
            return(new ASObject());
        }
示例#15
0
文件: Bag.cs 项目: Lantnr/MyTest
        /// <summary>组装获得装备属性</summary>
        public tg_bag BuildEquipAtt(BaseEquip equip)
        {
            var newequip = new tg_bag();

            #region
            if (equip.captain != 0)
            {
                newequip = EquipAtt(newequip, (int)RoleAttributeType.ROLE_CAPTAIN, equip.captain);
            }
            if (equip.force != 0)
            {
                newequip = EquipAtt(newequip, (int)RoleAttributeType.ROLE_FORCE, equip.force);
            }
            if (equip.brains != 0)
            {
                newequip = EquipAtt(newequip, (int)RoleAttributeType.ROLE_BRAINS, equip.brains);
            }
            if (equip.govern != 0)
            {
                newequip = EquipAtt(newequip, (int)RoleAttributeType.ROLE_GOVERN, equip.govern);
            }
            if (equip.charm != 0)
            {
                newequip = EquipAtt(newequip, (int)RoleAttributeType.ROLE_CHARM, equip.charm);
            }
            if (equip.attack != 0)
            {
                newequip = EquipAtt(newequip, (int)RoleAttributeType.ROLE_ATTACK, equip.attack);
            }
            if (equip.hurtIncrease != 0)
            {
                newequip = EquipAtt(newequip, (int)RoleAttributeType.ROLE_HURTINCREASE, Convert.ToDouble(equip.hurtIncrease));
            }
            if (equip.defense != 0)
            {
                newequip = EquipAtt(newequip, (int)RoleAttributeType.ROLE_DEFENSE, equip.defense);
            }
            if (equip.hurtReduce != 0)
            {
                newequip = EquipAtt(newequip, (int)RoleAttributeType.ROLE_HURTREDUCE, Convert.ToDouble(equip.hurtReduce));
            }
            if (equip.life != 0)
            {
                newequip = EquipAtt(newequip, (int)RoleAttributeType.ROLE_LIFE, equip.life);
            }
            #endregion
            newequip.base_id    = equip.id;
            newequip.type       = (int)GoodsType.TYPE_EQUIP;
            newequip.equip_type = equip.typeSub;
            newequip.state      = 0;
            newequip.count      = 1;
            return(newequip);
        }
示例#16
0
文件: Equip.cs 项目: Lantnr/MyTest
        /// <summary>
        /// 判断装备是否存在前端传递过来的装备属性
        /// </summary>
        /// <param name="type">装备属性</param>
        /// <param name="equip">装备信息</param>
        public bool IsContainAttritute(int type, tg_bag equip)
        {
            if (type == 0)
            {
                return(false);
            }
            var list_att = new List <int> {
                equip.attribute1_type, equip.attribute2_type, equip.attribute3_type
            };

            return(list_att.Contains(type));
        }
示例#17
0
        /// <summary>背包日志</summary>
        public void BagLog(tg_bag prop, LogType type, int mn, int cn, string cnname, int count, int getcoin = 0)
        {
            try
            {
                var temp_prop = prop.CloneEntity();

                log.BagInsertLog(temp_prop, mn, cn, getcoin); //记录日志
                string s   = GetString(temp_prop);
                var    obj = new DataObject(temp_prop.type, temp_prop.count, temp_prop.count - count, count, s);
                WriteLog(temp_prop.user_id, (int)type, mn, cn, cnname, obj);
            }
            catch (Exception ex) { XTrace.WriteException(ex); }
        }
示例#18
0
        /// <summary>组装奖励信息</summary>
        private List <RewardVo> BuildReward(tg_bag equip)
        {
            var aso    = new List <ASObject>(); { aso.Add(AMFConvert.ToASObject(EntityToVo.ToEquipVo(equip))); }
            var reward = new List <RewardVo>();
            var vo     = new RewardVo()
            {
                goodsType = (int)GoodsType.TYPE_EQUIP,
                increases = aso,
            };

            reward.Add(vo);
            return(reward);
        }
示例#19
0
        /// <summary>获取品质装备</summary>
        /// <param name="user_id">玩家id</param>
        /// <param name="base_equip">基表装备实体</param>
        /// <returns></returns>
        private static tg_bag GradeEquip(Int64 user_id, BaseEquip base_equip)
        {
            //根据概率随机属性个数
            var number = RandomAttributeNumber();
            var list   = GetAttribute(base_equip);

            if (list.Any())
            {
                var entity = new tg_bag();
                entity.user_id    = user_id;
                entity.base_id    = (int)base_equip.id;
                entity.type       = (int)GoodsType.TYPE_EQUIP;
                entity.equip_type = base_equip.typeSub;
                entity.state      = (int)LoadStateType.UNLOAD;
                entity.count      = 1;
                //number = 3;
                var list_att = RandomAttribute(number, base_equip.typeSub, list);
                var i        = 0;
                foreach (var item in list_att)
                {
                    switch (i)
                    {
                        #region 属性赋值
                    case 0:
                    {
                        entity.attribute1_type  = item.type;
                        entity.attribute1_value = item.value;
                        break;
                    }

                    case 1:
                    {
                        entity.attribute2_type  = item.type;
                        entity.attribute2_value = item.value;
                        break;
                    }

                    case 2:
                    {
                        entity.attribute3_type  = item.type;
                        entity.attribute3_value = item.value;
                        break;
                    }
                        #endregion
                    }
                    i++;
                }
                return(entity);
            }
            return(null);
        }
示例#20
0
        /// <summary>道具出售</summary>
        private ASObject PropSell(tg_bag prop, int count, TGGSession session)
        {
            var user      = session.Player.User.CloneEntity();
            var m         = Convert.ToString(user.coin);
            var base_prop = Common.GetInstance().GetBaseProp(prop.base_id); //查询道具的基表数据

            if (base_prop == null)
            {
                return(new ASObject(Common.GetInstance().BuildData((int)ResultType.FRONT_DATA_ERROR)));
            }
            if (base_prop.sell != 1)
            {
                return(new ASObject(Common.GetInstance().BuildData((int)ResultType.PROP_UNBUY)));                    //判断道具是否能出售
            }
            if (prop.count < count)
            {
                return(new ASObject(Common.GetInstance().BuildData((int)ResultType.PROP_LACK)));
            }

            var money = base_prop.price * count;

            user.coin = tg_user.IsCoinMax(user.coin, money);  //处理用户的数据
            if (user.Update() <= 0)
            {
                return(new ASObject(Common.GetInstance().BuildData((int)ResultType.DATABASE_ERROR)));
            }
            session.Player.User = user;

            log.BagInsertLog(prop, (int)ModuleNumber.BAG, (int)PropCommand.PROP_SELL, base_prop.price * count); //记录日志
            var model = string.Format("{0}", "出售道具:" + prop.id);                                                //日志记录

            (new Log()).WriteLog(prop.user_id, (int)LogType.Delete, (int)ModuleNumber.BAG, (int)PropCommand.PROP_SELL, model);
            var temp = string.Format("{0}_{1}_{2}", "原:" + m, "获:" + money, "现:" + user.coin);

            (new Log()).WriteLog(prop.user_id, (int)LogType.Get, (int)ModuleNumber.BAG, (int)PropCommand.PROP_SELL, temp);

            prop.count -= count;
            var rewards = new List <RewardVo> {
                new RewardVo {
                    goodsType = (int)GoodsType.TYPE_COIN, value = user.coin
                }
            };

            (new Bag()).BuildReward(user.id, new List <tg_bag> {
                prop
            }, rewards);

            return(prop.count == 0 ? new ASObject(Common.GetInstance().BuildData((int)ResultType.SUCCESS))
                : new ASObject(Common.GetInstance().BuildData((int)ResultType.SUCCESS, prop)));
        }
示例#21
0
        public ASObject Execute(Int64 userid, ASObject data)
        {
            try
            {
# if DEBUG
                XTrace.WriteLine("{0}:{1}", "EQUIP_BUY", "装备买");
#endif
                var session = Variable.OnlinePlayer[userid] as TGGSession;
                if (session == null)
                {
                    return(CommonHelper.ErrorResult((int)ResultType.FAIL));
                }
                var baseid = Convert.ToInt32(data.FirstOrDefault(q => q.Key == "id").Value);
                var count  = Convert.ToInt32(data.FirstOrDefault(q => q.Key == "count").Value);

                if (count <= 0 || baseid == 0)
                {
                    return(ResultData((int)ResultType.FRONT_DATA_ERROR));                          //前端数据不对
                }
                var baseinfo = Variable.BASE_EQUIP.FirstOrDefault(q => q.id == baseid);
                if (baseinfo == null || baseinfo.grade != 1)
                {
                    return(ResultData((int)ResultType.BASE_TABLE_ERROR));//该装备不能购买
                }
                var user  = session.Player.User.CloneEntity();
                var price = baseinfo.buyPrice;
                if (!CheckMoney(session, price * count)) //金钱验证
                {
                    return(ResultData((int)ResultType.BASE_PLAYER_COIN_ERROR));
                }
                if (!CheckBox(session, count)) //格子数验证
                {
                    return(ResultData((int)ResultType.EQUIP_BAG_FULL));
                }
                var equiplist = new List <tg_bag>();
                var newequip  = new tg_bag();
                GetEntity(baseinfo, session.Player.User.id, newequip); //基本属性设置
                AddAtt(newequip, baseinfo);                            //根据装备类型设置属性
                for (var i = 0; i < count; i++)
                {
                    equiplist.Add(newequip.CloneEntity());
                }

                CreateLog(user.id, user.coin, baseid, count, price * count);

                var list = tg_bag.GetSaveList(equiplist); //批量插入
                SendReward(list, session);
                return(ResultData((int)ResultType.SUCCESS));
            }
示例#22
0
文件: Equip.cs 项目: Lantnr/MyTest
        /// <summary>获取装备属性等级</summary>
        /// <param name="location"></param>
        /// <param name="equip"></param>
        /// <returns></returns>
        public int GetEquipLevel(int location, tg_bag equip)
        {
            switch (location)
            {
            case (int)EquipPositionType.ATT1_LOCATION:
                return(equip.attribute1_spirit_level);

            case (int)EquipPositionType.ATT2_LOCATION:
                return(equip.attribute2_spirit_level);

            case (int)EquipPositionType.ATT3_LOCATION:
                return(equip.attribute3_spirit_level);
            }
            return(0);
        }
示例#23
0
        /// <summary>偷窃获得装备</summary>
        private void AcquireEquip(TGGSession session, tg_bag equip)
        {
            var bag = session.Player.Bag;

            bag.Surplus = bag.Surplus - 1;
            if (bag.Surplus == 0)
            {
                bag.BagIsFull = true;
            }
            if (equip.Insert() <= 0)
            {
                return;
            }
            (new Share.User()).REWARDS_API(session.Player.User.id, BuildReward(equip));
        }
示例#24
0
文件: Role.cs 项目: Lantnr/MyTest
 /// <summary>武将加成信息判断</summary>
 public tg_role RoleInfoCheck(tg_role role, tg_bag equip, int type)
 {
     if (equip.attribute1_type != 0)
     {
         role = RoleInfoUpdate(role, equip.attribute1_type, equip.attribute1_value, type, equip.attribute1_value_spirit);
     }
     if (equip.attribute2_type != 0)
     {
         role = RoleInfoUpdate(role, equip.attribute2_type, equip.attribute2_value, type, equip.attribute2_value_spirit);
     }
     if (equip.attribute3_type != 0)
     {
         role = RoleInfoUpdate(role, equip.attribute3_type, equip.attribute3_value, type, equip.attribute3_value_spirit);
     }
     return(role);
 }
示例#25
0
        /// <summary>更新装备信息</summary>
        private void EquipUpdate(tg_role role, tg_bag nequip, Int64 id)
        {
            var s = Variable.OnlinePlayer.ContainsKey(role.user_id);

            if (!s)
            {
                return;
            }
            var session = Variable.OnlinePlayer[role.user_id] as TGGSession;

            if (session == null)
            {
                return;
            }

            if (id == 0)   //未穿戴同类型装备
            {
                var player = session.Player.CloneEntity();
                player.Bag.Surplus += 1;                            //剩余格子数+1
                if (player.Bag.BagIsFull)
                {
                    player.Bag.BagIsFull = false;
                }
                session.Player = player;
            }
            else
            {
                var equip = tg_bag.GetEntityByEquipId(id);
                if (equip == null)
                {
                    return;
                }
                equip.state = (int)LoadStateType.UNLOAD;
                equip.Update();
                Common.GetInstance().RoleInfoCheck(role, equip, (int)RoleDatatype.ROLEDATA_LOSE); //武将属性削减
                _equipvo = EntityToVo.ToEquipVo(equip);
            }

            var logdata = string.Format("{0}_{1}_{2}_{3}", "EquipLoad", role.id, id, nequip.id);     //记录武将穿戴装备信息

            (new Share.Log()).WriteLog(role.user_id, (int)LogType.Use, (int)ModuleNumber.ROLE, (int)RoleCommand.ROLE_EQUIP_LOAD, logdata);

            nequip.state = (int)LoadStateType.LOAD;                                           //新装备
            nequip.Update();
            Common.GetInstance().RoleInfoCheck(role, nequip, (int)RoleDatatype.ROLEDATA_ADD); //武将属性加成
            RoleUpdate(role, nequip);
        }
示例#26
0
        /// <summary>获取道具</summary>
        /// <param name="id">基表Id</param>
        /// <param name="count">数量</param>
        /// <returns></returns>
        private bool GetProp(int id, int count)
        {
            if (Session.Player.Bag.BagIsFull)
            {
                return(false);
            }
            var base_prop = Variable.BASE_PROP.FirstOrDefault(m => m.id == id);

            if (base_prop == null)
            {
                return(false);
            }
            dynamic obje = CommonHelper.ReflectionMethods("TGG.Module.Props", "Common");

            while (count > 0)
            {
                var temp = 0;
                if (count > 99)
                {
                    temp  = 99;
                    count = count - 99;
                }
                else
                {
                    temp  = count;
                    count = 0;
                }
                var entity = new tg_bag
                {
                    base_id = base_prop.id,
                    count   = temp,
                    type    = (int)GoodsType.TYPE_PROP,
                    bind    = base_prop.bind,
                    user_id = Session.Player.User.id,
                };
                (new Bag()).BuildReward(entity.user_id, new List <tg_bag>()
                {
                    entity
                });                                                                     //入包整理并推送
#if DEBUG
                XTrace.WriteLine("{0} 数量:{1}", base_prop.id, temp);
#endif
            }
            return(false);
        }
示例#27
0
        /// <summary> 组装并推送 </summary>
        /// <param name="propid">合成目标的道具基表Id</param>
        /// <param name="userid">玩家id</param>
        private tg_bag BuildProp(decimal propid, Int64 userid)
        {
            var target = Variable.BASE_PROP.FirstOrDefault(m => m.id == propid);

            if (target == null)
            {
                return(null);
            }
            var prop = new tg_bag()
            {
                base_id = target.id,
                type    = (int)GoodsType.TYPE_PROP,
                count   = 1,
                bind    = target.bind,
                user_id = userid,
            };

            return(prop);
        }
示例#28
0
文件: Bag.cs 项目: Lantnr/MyTest
 /// <summary>装备的基础属性</summary>
 /// <param name="equip">装备tg_bag</param>
 /// <param name="type">属性类型</param>
 /// <param name="value">加成属性值</param>
 /// <returns>装备tg_bag</returns>
 public tg_bag EquipAtt(tg_bag equip, int type, double value)
 {
     if (equip.attribute1_type == 0)
     {
         equip.attribute1_type  = type;
         equip.attribute1_value = value;
     }
     else if (equip.attribute2_type == 0)
     {
         equip.attribute2_type  = type;
         equip.attribute2_value = value;
     }
     else if (equip.attribute3_type == 0)
     {
         equip.attribute3_type  = type;
         equip.attribute3_value = value;
     }
     return(equip);
 }
示例#29
0
        /// <summary>获取熔炼道具</summary>
        /// <param name="id">基表Id</param>
        /// <param name="count">数量</param>
        /// <returns></returns>
        private bool GetFusion(int id, int count)
        {
            if (Session.Player.Bag.BagIsFull)
            {
                return(false);
            }
            var bfusion = Variable.BASE_FUSION.FirstOrDefault(m => m.id == id);

            if (bfusion == null)
            {
                return(false);
            }
            while (count > 0)
            {
                int temp;
                if (count > 99)
                {
                    temp  = 99;
                    count = count - 99;
                }
                else
                {
                    temp  = count;
                    count = 0;
                }
                var entity = new tg_bag
                {
                    base_id = bfusion.id,
                    count   = temp,
                    type    = (int)GoodsType.TYPE_FUSION,
                    user_id = Session.Player.User.id,
                };
                (new Bag()).BuildReward(entity.user_id, new List <tg_bag> {
                    entity
                });                                                                     //入包整理并推送
#if DEBUG
                XTrace.WriteLine("{0} 数量:{1}", bfusion.id, temp);
#endif
            }
            return(false);
        }
示例#30
0
        /// <summary>根据装备类型判断</summary>
        private void RoleEquipCheck(tg_role role, tg_bag equip)
        {
            switch (equip.equip_type)
            {
            case (int)EquipType.WEAPON: EquipUpdate(role, equip, role.equip_weapon); break;    //武器

            case (int)EquipType.ARMOR: EquipUpdate(role, equip, role.equip_armor); break;      //铠甲

            case (int)EquipType.MOUNTS: EquipUpdate(role, equip, role.equip_mounts); break;    //坐骑

            case (int)EquipType.TEA: EquipUpdate(role, equip, role.equip_tea); break;          //茶器

            case (int)EquipType.BOOK: EquipUpdate(role, equip, role.equip_book); break;        //书籍

            case (int)EquipType.NANBAN: EquipUpdate(role, equip, role.equip_barbarian); break; //南蛮物

            case (int)EquipType.ARTWORK: EquipUpdate(role, equip, role.equip_craft); break;    //艺术品

            case (int)EquipType.JEWELRY: EquipUpdate(role, equip, role.equip_gem); break;      //珠宝
            }
        }