Exemplo n.º 1
0
        /// <summary> 获取更新后战斗步骤 </summary>
        /// <param name="session"></param>
        /// <param name="s1"></param>
        /// <returns></returns>
        private string GetNewFightString(TGGSession session, string[] s1)
        {
            var userid = session.Player.User.id;
            var level  = session.Player.Role.Kind.role_level;
            var hp     = session.Player.Role.Kind.att_life;

            //var taskInfo = Common.GetInstance().GetWorkInfo(userid);
            //taskInfo.RoleHp = hp;

            var taskInfo = Variable.WorkInfo.FirstOrDefault(q => q.userid == userid);

            if (taskInfo == null)
            {
                taskInfo = new Variable.UserTaskInfo()
                {
                    RoleHp = hp, userid = userid
                };
                Variable.WorkInfo.Add(taskInfo);
            }
            else
            {
                if (taskInfo.RoleHp == -99999)
                {
                    taskInfo.RoleHp = hp;
                }
            }

            var npc = Variable.BASE_NPCARMY.Where(m => m.type == (int)TaskFightType.CONTINUE_FIGHT && m.level <= level)
                      .OrderByDescending(m => m.level).FirstOrDefault();

            if (npc == null)
            {
                return("");
            }

            var life   = taskInfo.RoleHp;
            var result = NpcChallenge(userid, npc.id, ref life);

            if (result < 0)
            {
                return("");
            }
            if (result == (int)FightResultType.LOSE)
            {
                taskInfo.RoleHp = 0;
                s1[2]           = (Convert.ToInt32(s1[2]) + 1).ToString();
                return("false" + GetString(s1, true));
            }
            taskInfo.RoleHp = life;
            s1[2]           = (Convert.ToInt32(s1[2]) + 1).ToString();
            s1[3]           = s1[2];
            return(GetString(s1, true));
        }
Exemplo n.º 2
0
        /// <summary>初始化全局变量谣言失败次数</summary>
        private void UpdateFailCount(int type, Variable.UserTaskInfo taskinfo)
        {
            switch (type)
            {
            case (int)TaskStepType.RUMOR: taskinfo.RumorFailCount = 0; break;

            case (int)TaskStepType.FIRE: taskinfo.FireFailCount = 0; break;

            case (int)TaskStepType.BREAK: taskinfo.BreakFailCount = 0; break;

            case (int)TaskStepType.SEll_WINE: taskinfo.SellFailCount = 0; break;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取玩家工作信息,如果没有该玩家数据,默认插入一条数据
        /// </summary>
        /// <param name="userid">用户id</param>
        /// <returns></returns>
        public Variable.UserTaskInfo GetWorkInfo(Int64 userid)
        {
            var info = Variable.WorkInfo.FirstOrDefault(q => q.userid == userid);

            if (info != null)
            {
                return(info);
            }
            var newone = new Variable.UserTaskInfo(userid);

            Variable.WorkInfo.Add(newone);
            return(newone);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取玩家工作信息,如果没有该玩家数据,默认插入一条数据
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public void GetWorkInfo(object a)
        {
            var userid = Convert.ToInt64(a);
            var info   = Variable.WorkInfo.FirstOrDefault(q => q.userid == userid);

            if (info != null)
            {
                return;
            }
            var newone = new Variable.UserTaskInfo(userid);

            Variable.WorkInfo.Add(newone);
        }
Exemplo n.º 5
0
        /// <summary>创建全局谣言任务</summary>
        private Variable.UserTaskInfo CreatRumorTask(tg_task task)
        {
            var rumor = new Variable.UserTaskInfo
            {
                userid = task.user_id,
            };

            switch (task.task_step_type)
            {
            case (int)TaskStepType.RUMOR: rumor.RumorFailCount = 1; break;

            case (int)TaskStepType.FIRE: rumor.FireFailCount = 1; break;

            case (int)TaskStepType.BREAK: rumor.BreakFailCount = 1; break;

            case (int)TaskStepType.SEll_WINE: rumor.SellFailCount = 1; break;
            }
            return(rumor);
        }
Exemplo n.º 6
0
        /// <summary>更新失败次数并验证入狱</summary>
        private void UpdateAndPush(tg_task task, Variable.UserTaskInfo taskinfo, Int64 userid, string name, Int64 senceid)
        {
            switch (task.task_step_type)
            {
            case (int)TaskStepType.RUMOR: taskinfo.RumorFailCount += 1;
                CheckIsInPrison(taskinfo.RumorFailCount, userid, name, senceid, task.task_step_type);
                break;

            case (int)TaskStepType.FIRE: taskinfo.FireFailCount += 1;
                CheckIsInPrison(taskinfo.FireFailCount, userid, name, senceid, task.task_step_type);
                break;

            case (int)TaskStepType.BREAK: taskinfo.BreakFailCount += 1;
                CheckIsInPrison(taskinfo.BreakFailCount, userid, name, senceid, task.task_step_type);
                break;

            case (int)TaskStepType.SEll_WINE: taskinfo.SellFailCount += 1;
                CheckIsInPrison(taskinfo.SellFailCount, userid, name, senceid, task.task_step_type);
                break;
            }
        }