Example #1
0
 void SetupSkillGains()
 {
     matcher.WhenLogEntry().OfLogType(LogType.Skills)
     .Matches(".+")
     .HandleWith((match, entry) =>
     {
         var parsed = skillEntryParser.TryParseSkillInfoFromLogLine(entry);
         if (parsed != null)
         {
             if (parsed.IsSkillName("fighting"))
             {
                 if (lastKill != null &&
                     lastKill.Timestamp > entry.Timestamp - TimeSpan.FromSeconds(5))
                 {
                     UsingStatsFor(CharacterName, lastKill.Value)
                     .GetActorByName(CharacterName)
                     .FightingSkillGained += parsed.Gain ?? 0f;
                     lastKill              = null;
                 }
                 else
                 {
                     lastSkillGain = new StampedValue <float>()
                     {
                         Value     = parsed.Gain ?? 0f,
                         Timestamp = entry.Timestamp
                     };
                 }
             }
         }
     });
 }
Example #2
0
        void SetupKillCounts()
        {
            // Aged hell hound is dead. R.I.P.
            matcher.WhenLogEntry().OfLogType(LogType.Event)
            .Matches(@"(.+) is dead\. R\.I\.P\.")
            .HandleWith((match, entry) =>
            {
                combatStatus.KillStatistics.IncrementForName(match.Groups[1].Value);
                if (match.Groups[1].Value == currentTargetName)
                {
                    UsingStatsFor(CharacterName, match.Groups[1].Value)
                    .GetActorByName(match.Groups[1].Value).SlainCount += 1;

                    if (lastSkillGain != null &&
                        lastSkillGain.Timestamp > entry.Timestamp - TimeSpan.FromSeconds(5))
                    {
                        UsingStatsFor(CharacterName, match.Groups[1].Value)
                        .GetActorByName(CharacterName)
                        .FightingSkillGained += lastSkillGain.Value;
                        lastSkillGain         = null;
                    }
                    else
                    {
                        lastKill = new StampedValue <string>()
                        {
                            Value     = match.Groups[1].Value,
                            Timestamp = entry.Timestamp
                        };
                    }

                    currentTargetName = null;
                }
            });
        }