Esempio n. 1
0
        /// <summary>统计每日完成度</summary>
        private void CheckReward(tg_user_extend ex)
        {
            var finish = Variable.BASE_RULE.FirstOrDefault(m => m.id == "30004");

            if (finish == null)
            {
                return;
            }
            var total = Convert.ToInt32(finish.value);

            if (ex.game_finish_count >= total || ex.game_receive != (int)GameRewardType.TYPE_UNREWARD)
            {
                ex.Update(); return;
            }

            ex.game_finish_count++;

            if (ex.game_finish_count < total)   //未达到领奖条件
            {
                ex.Update(); return;
            }

            ex.game_receive = (int)GameRewardType.TYPE_CANREWARD;
            ex.Update();
        }
Esempio n. 2
0
        /// <summary>偷窃逻辑处理</summary>
        private ASObject StealNpc(TGGSession session, tg_user_extend extend, BaseNpcMonster basenpc, tg_train_home npc)
        {
            var userid = session.Player.User.id;
            var nprob  = GetProbability(session.Player.Role.LifeSkill.sub_ninjitsu, session.Player.Role.LifeSkill.sub_ninjitsu_level); //忍术加成概率
            var bprob  = GetBrainProb(session.Player.Role);                                                                            //智谋加成概率
            var equip  = Common.GetInstance().RandomEquip(userid, basenpc, nprob, bprob);

            if (equip != null)   //偷窃成功
            {
                npc.is_steal = (int)TrainHomeStealType.STEAL_YES;
                if (!tg_train_home.UpdateNpc(npc))
                {
                    return(Error((int)ResultType.DATABASE_ERROR));
                }
                AcquireEquip(session, equip);                                                                        //获得装备信息处理

                var logdata = string.Format("{0}_{1}", "EquipSteal", equip.base_id);                                 //记录偷窃获得装备信息
                (new Share.Log()).WriteLog(userid, (int)LogType.Get, (int)ModuleNumber.ROLETRAIN, (int)RoleTrainCommand.TRAIN_HOME_NPC_STEAL, logdata);
                log.BagInsertLog(equip, (int)ModuleNumber.ROLETRAIN, (int)RoleTrainCommand.TRAIN_HOME_NPC_STEAL, 0); //记录日志
            }
            else
            {
                extend.steal_fail_count++;
                extend.Update();
                session.Player.UserExtend = extend;
                if (IsEnterPrison(extend.steal_fail_count))
                {
                    new Share.Prison().PutInPrison(userid);
                }                                                                                        //推送进入监狱
            }
            (new Share.DaMing()).CheckDaMing(userid, (int)DaMingType.武将宅偷窃);
            return(new ASObject(Common.GetInstance().NpcStealData((int)ResultType.SUCCESS, npc.is_steal)));
        }
Esempio n. 3
0
        /// <summary>
        /// 用户刷新次数更新
        /// </summary>
        /// <param name="type">刷新类型</param>
        /// <param name="userextend">用户扩展信息</param>
        /// <param name="session"></param>
        private void GetReflashUpdate(int type, tg_user_extend userextend, TGGSession session)
        {
            switch (type)
            {
            case 1:
                userextend.task_vocation_refresh++;
                break;

            case 2:
                userextend.task_vocation_refresh = 0;
                userextend.task_vocation_isgo    = 0;
                break;
            }
            userextend.Update();//更新用户和用户扩展
            session.Player.UserExtend = userextend;
        }