public static List <Game.NounVerbCase> GetNounVerbCases(Nouns noun, Verbs verb, bool evaluate) { List <Game.NounVerbCase> results = new List <Gk3Main.Game.NounVerbCase>(); List <Game.NounVerbCase> nounNvcs; if (_nounNvcMap.TryGetValue(noun, out nounNvcs)) { foreach (NounVerbCase nvc in nounNvcs) { if (nvc.Verb == verb && (!evaluate || evaluateNvcLogic(noun, nvc.Verb, nvc.Case))) { addUnique(nvc, results, nvc.Case.Equals("ALL", StringComparison.OrdinalIgnoreCase)); } } } // not done yet... there may be aliases/groups List <Nouns> groups = NounUtils.GetNounGroupsFromMember(noun); if (groups != null) { foreach (Nouns n in groups) { if (_nounNvcMap.TryGetValue(n, out nounNvcs)) { foreach (NounVerbCase nvc in nounNvcs) { if (nvc.Verb == verb && (!evaluate || evaluateNvcLogic(n, nvc.Verb, nvc.Case))) { addUnique(nvc, results, nvc.Case.Equals("ALL", StringComparison.OrdinalIgnoreCase)); } } } } } return(results); }
public NvcResource(string name, System.IO.Stream stream) : base(name, stream) { // load the Logic aliases foreach (Resource.InfoSection section in _sections) { if (section.Name.Equals("Logic", StringComparison.OrdinalIgnoreCase)) { foreach (Resource.InfoLine line in section.Lines) { _logic.Add(new KeyValuePair <string, string>(line.Attributes[0].Key, line.Attributes[0].Value.Replace("{", "").Replace("}", ""))); } } } foreach (Resource.InfoLine line in GlobalSection.Lines) { NounVerbCase nvc; nvc.Noun = NounUtils.ConvertStringToNoun(line.Value); nvc.Verb = VerbsUtils.ConvertStringToVerbs(line.Attributes[0].Key); nvc.Case = line.Attributes[1].Key; nvc.CaseType = CaseUtils.ConvertStringToCase(line.Attributes[1].Key); string approach; if (line.TryGetAttribute("approach", out approach)) { if (approach.ToUpper() == "WALKTO") { nvc.Approach = NvcApproachType.WalkTo; } else if (approach.ToUpper() == "TURNTOMODEL") { nvc.Approach = NvcApproachType.TurnToModel; } else { nvc.Approach = NvcApproachType.None; } } else { nvc.Approach = NvcApproachType.None; } line.TryGetAttribute("target", out nvc.Target); line.TryGetAttribute("script", out nvc.Script); // remove any { } around the script // (normally they wouldn't mess anything up, but there are a few // that have no ; at the end, and those will mess up) int firstBracket = nvc.Script.IndexOf("{"); int lastBracket = nvc.Script.LastIndexOf("}"); if (firstBracket >= 0 && lastBracket >= 0) { nvc.Script = nvc.Script.Substring(firstBracket + 1, lastBracket - firstBracket - 1); } else if (firstBracket >= 0) { nvc.Script = nvc.Script.Substring(firstBracket + 1); } else if (lastBracket >= 0) { nvc.Script = nvc.Script.Substring(0, lastBracket); } add(nvc); } }
public static void SetNounVerbCount(string noun, string verb, bool isGabe, int count) { _nounVerbCounts[new NounVerbCombination(NounUtils.ConvertStringToNoun(noun), VerbsUtils.ConvertStringToVerbs(verb), isGabe)] = count; }
public static int GetTopicCount(string noun, string verb) { return(GetTopicCount(NounUtils.ConvertStringToNoun(noun), VerbsUtils.ConvertStringToVerbs(verb))); }
public static int GetNounVerbCount(string noun, Verbs verb) { return(GetNounVerbCount(NounUtils.ConvertStringToNoun(noun), verb, CurrentEgo == Ego.Gabriel)); }