bool MaybeCreatureAgeLine(string line) { if (GrangerHelpers.HasAgeInName(line, true)) { return(true); } else { return(false); } }
void AttemptToStartProcessing(string line) { debugLogger.Log("attempting to start processing creature due to line: " + line); // Apply previous processing, if still active. VerifyAndApplyProcessing(); try { debugLogger.Log("extracting object name"); // [20:48:42] You smile at the Adolescent diseased Mountainheart. // This regex preserves condition from before WO Rift update, where determiner was not present. // This is kept, because WU servers cannot be guaranteed to have been updated by their administrators. Match match = Regex.Match(line, @"You smile at (a|an|the) (?<g>.+)\.|You smile at (?<g>.+)\.", RegexOptions.IgnoreCase | RegexOptions.Compiled); string objectNameWithPrefixes = string.Empty; if (match.Success) { objectNameWithPrefixes = match.Groups["g"].Value; } if (GrangerHelpers.HasAgeInName(objectNameWithPrefixes, ignoreCase: true)) { debugLogger.Log("object assumed to be a creature"); var server = playerMan.CurrentServer; var skill = playerMan.CurrentServerAhSkill; if (grangerSettings.RequireServerAndSkillToBeKnownForSmilexamine && (server == null || skill == null)) { trayPopups.Schedule( "Server or AH skill level unknown for " + playerMan.PlayerName + ". If WA was just started, give it a few seconds. (This check can be disabled in Granger options)", "CAN'T PROCESS CREATURE", 5000); debugLogger.Log(string.Format( "processing creature cancelled, AH skill or server group unknown for player {0} (skill: {1} ; server: {2}", playerMan.PlayerName, skill, server)); } else { debugLogger.Log("building new creature object and moving to processor"); isProcessing = true; startedProcessingOn = DateTime.Now; verifyList = new ValidationList(); creatureBuffer = new CreatureBuffer { Name = GrangerHelpers.ExtractCreatureName(objectNameWithPrefixes), Age = GrangerHelpers.ExtractCreatureAge(objectNameWithPrefixes), Server = server, InspectSkill = skill ?? 0, }; var fat = GrangerHelpers.TryParseCreatureNameIfLineContainsFat(objectNameWithPrefixes); if (fat != null) { creatureBuffer.SecondaryInfo = CreatureEntity.SecondaryInfoTag.Fat; } var starving = GrangerHelpers.TryParseCreatureNameIfLineContainsStarving(objectNameWithPrefixes); if (starving != null) { creatureBuffer.SecondaryInfo = CreatureEntity.SecondaryInfoTag.Starving; } var diseased = GrangerHelpers.TryParseCreatureNameIfLineContainsDiseased(objectNameWithPrefixes); if (diseased != null) { creatureBuffer.SecondaryInfo = CreatureEntity.SecondaryInfoTag.Diseased; } verifyList.Name = true; debugLogger.Log("finished building"); } } else { debugLogger.Log(objectNameWithPrefixes + " was not recognized as a named creature."); } } catch (Exception exception) { debugLogger.Log("! Granger: error while BeginProcessing, event: " + line, true, exception); } }