void HandleGrooming(LogEntry line) { //[11:34:44] You have now tended to Aged fat Lightningzoe and she seems pleased. if (line.Content.StartsWith("You have now tended", StringComparison.Ordinal)) { Match match = Regex.Match(line.Content, @"You have now tended to (.+) and \w+ seems pleased"); if (match.Success) { grangerDebug.Log("LIVETRACKER: applying groomed flag due to: " + line); string prefixedName = match.Groups[1].Value; string fixedName = GrangerHelpers.RemoveAllPrefixes(prefixedName); CreatureEntity[] creatureEntities = GetCreatureToUpdate(fixedName, playerManager.CurrentServer); if (SearchEntireDb && creatureEntities.Length > 1) { ScheduleTrayPopup( String.Format( "There are multiple creatures named {0} in database, marking them all as groomed!", fixedName), "GROOMING ISSUE DETECTED", 6000); } foreach (var creature in creatureEntities) { creature.GroomedOn = DateTime.Now; context.SubmitChanges(); } } } }
void HandleBreeding(LogEntry line) { //[04:23:27] The Aged fat Dancedog and the Aged fat Cliffdog get intimate. if (line.Content.Contains("get intimate")) { Match match = Regex.Match(line.Content, @"The (.+) and the (.+) get intimate."); if (match.Success) { grangerDebug.Log("LIVETRACKER: attempting to cache last bred pair data due to: " + line); lastBreedingFemale = null; lastBreedingMale = null; lastBreedingOn = DateTime.Now; string name1 = match.Groups[1].Value; string name2 = match.Groups[2].Value; string fixedName1 = GrangerHelpers.RemoveAllPrefixes(name1); string fixedName2 = GrangerHelpers.RemoveAllPrefixes(name2); CreatureEntity[] creatures1 = GetCreatureToUpdate(fixedName1, playerManager.CurrentServer); CreatureEntity[] creatures2 = GetCreatureToUpdate(fixedName2, playerManager.CurrentServer); ExtractBreedingPairCreature(fixedName1, creatures1); ExtractBreedingPairCreature(fixedName2, creatures2); } } //The Old fat Ebonycloud will probably give birth in a while! //[04:23:47] The Aged fat Dancedog will probably give birth in a while! if (line.Content.Contains("will probably give birth")) { if (lastBreedingOn > DateTime.Now - TimeSpan.FromMinutes(3)) { grangerDebug.Log("LIVETRACKER: applying breeding update due to: " + line); Match match = Regex.Match(line.Content, @"The (.+) will probably give birth in a while"); if (match.Success) { string prefixedName = match.Groups[1].Value; string fixedName = GrangerHelpers.RemoveAllPrefixes(prefixedName); if (lastBreedingFemale != null) { if (lastBreedingFemale.Name == fixedName) //sanity check? maybe pointless { lastBreedingFemale.PregnantUntil = DateTime.Now + GrangerHelpers.LongestPregnancyPossible; ScheduleTrayPopup( String.Format( "({0}) is now marked as pregnant. Be sure to smilexamine to get more accurate pregnancy duration!", lastBreedingFemale.Name), "BREED UPDATE", 6000, forceShow: true); context.SubmitChanges(); } else { ScheduleTrayPopup( String.Format("Female name ({0}) does not match the cached name ({1})!", lastBreedingFemale.Name, fixedName), "BREED UPDATE PROBLEM", 6000, forceShow: true); } } if (lastBreedingMale != null) { lastBreedingMale.NotInMood = DateTime.Now + GrangerHelpers.BreedingNotInMoodDuration; ScheduleTrayPopup( String.Format( "({0}) is now marked as Not In Mood. You can't breed this creature for next 45 minutes.", lastBreedingMale.Name), "BREED UPDATE", 6000, forceShow: true); context.SubmitChanges(); } } } } //[06:18:19] The Aged fat Umasad shys away and interrupts the action. if (line.Content.Contains("shys away and interrupts")) { if (lastBreedingOn > DateTime.Now - TimeSpan.FromMinutes(1)) { grangerDebug.Log("LIVETRACKER: processing failed breeding update due to: " + line); Match match = Regex.Match(line.Content, @"The (.+) shys away and interrupts the action"); if (match.Success) { string prefixedName = match.Groups[1].Value; string fixedName = GrangerHelpers.RemoveAllPrefixes(prefixedName); if (lastBreedingMale != null) { lastBreedingMale.NotInMood = DateTime.Now + GrangerHelpers.BreedingNotInMoodDuration; } if (lastBreedingFemale != null) { lastBreedingFemale.NotInMood = DateTime.Now + GrangerHelpers.BreedingNotInMoodDuration; } ScheduleTrayPopup( String.Format( "Breeding appears to have failed, {0} and {1} will be Not In Mood for next 45 minutes.", lastBreedingMale == null ? "Some creature" : lastBreedingMale.Name, lastBreedingFemale == null ? "Some creature" : lastBreedingFemale.Name), "BREED UPDATE", 6000, forceShow: true); } } } }