示例#1
0
        void UpdateDateOfNextQuestionAttempt(LogEntry line, PathSwitchKind switchKind)
        {
            if (line == null)
            {
                throw new ArgumentNullException("line");
            }

            int cdInHrs        = 0;
            int nextMeditLevel = 0;

            if (switchKind == PathSwitchKind.PathBegin)
            {
                nextMeditLevel = 1;
            }
            else if (switchKind == PathSwitchKind.PathReset)
            {
                nextMeditLevel = 0;
                // there is a 24h cooldown before new path can be learned
                NextQuestionAttemptOverridenUntil = line.Timestamp + TimeSpan.FromHours(24);
            }
            else
            {
                // PathAdvance
                nextMeditLevel = MeditationPaths.FindLevel(line.Content) + 1;
            }

            cdInHrs = MeditationPaths.GetCooldownHoursForLevel(nextMeditLevel, MeditationSkill)
                      .ConstrainToRange(0, int.MaxValue);

            DateOfNextQuestionAttempt = line.Timestamp + TimeSpan.FromHours(cdInHrs);
        }
示例#2
0
        bool ProcessQuestionLogSearch(List <LogEntry> lines)
        {
            bool result = false;

            PathSwitchKind switchKind = PathSwitchKind.PathAdvance;

            LogEntry lastPathModifyLine = null;
            LogEntry lastPathFailLine   = null;

            foreach (LogEntry line in lines)
            {
                if (line.Content.Contains("You decide to start pursuing the insights of the path of"))
                {
                    lastPathModifyLine = line;
                    lastPathFailLine   = null;
                    switchKind         = PathSwitchKind.PathBegin;
                }

                //[00:35:09] Congratulations! You have now reached the level of Rock of the path of love!
                if (line.Content.Contains("Congratulations! You have now reached the level"))
                {
                    lastPathModifyLine = line;
                    lastPathFailLine   = null;
                    switchKind         = PathSwitchKind.PathAdvance;
                }

                // [05:49:11] You decide to stop pursuing the insights of the path of knowledge.
                if (line.Content.StartsWith("You decide to stop pursuing the insights of the path of "))
                {
                    lastPathModifyLine = line;
                    lastPathFailLine   = null;
                    switchKind         = PathSwitchKind.PathReset;
                }
                //if (line.Contains("[fail message]")
                //    lastPathFailLine = line;
            }
            if (lastPathModifyLine != null)
            {
                UpdateDateOfNextQuestionAttempt(lastPathModifyLine, switchKind);
                result = true;
            }
            if (lastPathFailLine != null)
            {
                //NYI
            }
            return(result);
        }