protected override ManagerStory.Story PrintFormattedStory(StoryProgressionObject manager, string text, string summaryKey, object[] parameters, string[] extended, ManagerStory.StoryLogging logging) { if (mInheritance.Count <= 5) { return(null); } if (manager == null) { manager = Deaths; } text = manager.Localize(GetTitlePrefix(PrefixType.Summary) + "Summary", Sim.IsFemale, new object[] { Sim }); List <object> paramList = new List <object>(); foreach (KeyValuePair <SimDescription, int> child in mInheritance) { text += manager.Localize(GetTitlePrefix(PrefixType.Summary) + "Element", child.Key.IsFemale, new object[] { child.Key, child.Value }); paramList.Add(child.Key); } return(base.PrintFormattedStory(manager, text, summaryKey, paramList.ToArray(), extended, logging)); }
protected void AddSummary(StoryProgressionObject spObject, string name, string msg, string[] extended, bool notify, StoryLogging logging) { if (string.IsNullOrEmpty(name)) { return; } Manager manager = null; if (spObject is SimPersonality) { manager = Personalities; } else { manager = spObject as Manager; } if (manager != null) { manager.IncStat("Summary: " + msg); } string translated = msg; if (spObject != null) { ulong key = ParserFunctions.ParseUlong(msg, 0); if (key != 0) { translated = Localization.LocalizeString(key); } else { translated = spObject.Localize(msg); } if (string.IsNullOrEmpty(translated)) { translated = "(D) " + spObject.UnlocalizedName + "." + msg; } } if ((notify) && ((logging & StoryLogging.Summary) == StoryLogging.Summary) && (GetValue <ShowSummaryOption, int>() > 0)) { mSummary.Add(translated + ": " + name); } if (((logging & StoryLogging.Log) == StoryLogging.Log) && ((notify) || (GetValue <FullStoryLogOption, bool>()))) { AddSummaryToLog(translated + ": " + name, extended); } }
protected Story PrintInternalStory(StoryProgressionObject manager, string storyKey, string summaryKey, object[] oldParameters, string[] extended, PerformFormat format, bool notify, SummaryPerSim summaryPerSim, StoryLogging logging) { bool matchesAlert = notify, foundSim = false, foundLot = false; Story.Element element1 = null; Story.Element element2 = null; CASAgeGenderFlags firstGender = CASAgeGenderFlags.None; CASAgeGenderFlags secondGender = CASAgeGenderFlags.None; List <object> newParameters = new List <object>(); if (!matchesAlert) { if (oldParameters.Length == 0) { matchesAlert = true; } else if (manager != null) { foreach (object obj in oldParameters) { SimDescription sim = null; if (obj is Sim) { sim = (obj as Sim).SimDescription; } else { sim = obj as SimDescription; } if (sim != null) { if (manager.MatchesAlertLevel(sim)) { matchesAlert = true; break; } } else { Lot lot = obj as Lot; if ((lot != null) && (lot.Household != null)) { if (manager.MatchesAlertLevel(lot.Household.AllSimDescriptions)) { matchesAlert = true; break; } } } } } } foreach (object obj in oldParameters) { SimDescription sim = null; if (obj is Sim) { sim = (obj as Sim).SimDescription; } else { sim = obj as SimDescription; } if (sim != null) { newParameters.Add(obj); if ((summaryPerSim == SummaryPerSim.Yes) || (!foundSim)) { AddSummary(manager, sim, summaryKey, extended, logging); } AddGenderNouns(sim, newParameters); foundSim = true; if (element1 == null) { firstGender = sim.Gender; element1 = new Story.Element(sim); } else if (element2 == null) { secondGender = sim.Gender; element2 = new Story.Element(sim); } } else { Lot lot = obj as Lot; if (lot != null) { string name = lot.Name.Trim(); if (string.IsNullOrEmpty(name)) { name = Localize("SomeHome"); } newParameters.Add(name); name = lot.Address.Trim(); if (string.IsNullOrEmpty(name)) { name = Localize("SomeAddress"); } newParameters.Add(name); foundLot = true; if (!string.IsNullOrEmpty(lot.Name)) { AddSummary(manager, lot.Name, summaryKey, null, matchesAlert, logging); } AddSummary(manager, lot.Address, summaryKey, extended, matchesAlert, logging); if (element1 == null) { element1 = new Story.Element(lot.ObjectId); } else if (element2 == null) { element2 = new Story.Element(lot.ObjectId); } } else { newParameters.Add(obj); string str = obj as string; if (str != null) { if ((!foundSim) && (foundLot)) { AddSummary(manager, str, summaryKey, extended, matchesAlert, logging); } } } } } if (((logging & StoryLogging.Notice) == StoryLogging.Notice) && ((!foundSim) || (matchesAlert))) { string text = storyKey; if (format == PerformFormat.Yes) { object[] parameters = newParameters.ToArray(); string uniqueKey = manager.UnlocalizedName + storyKey; List <AvailableStory> stories; if (!mValidStories.TryGetValue(uniqueKey, out stories)) { stories = new List <AvailableStory>(); mValidStories.Add(uniqueKey, stories); for (int i = 0; i <= 9; i++) { AvailableStory story = new AvailableStory(manager, storyKey + i.ToString(), parameters); if (!story.IsValid) { continue; } stories.Add(story); } } if (stories.Count > 0) { AvailableStory set = RandomUtil.GetRandomObjectFromList(stories); text = set.Localize(manager, firstGender, secondGender, parameters); IncStat("Story: " + uniqueKey); } else { text = manager.Localize(storyKey + "0", false, parameters); IncStat("Missing: " + text, Common.DebugLevel.High); } } if (!string.IsNullOrEmpty(text)) { return(NewStory(new Story(manager, text, element1, element2))); } } return(new Story(manager, null, null)); }