public static void AppendInspectStringsFromQuestParts(Action <string, Quest> func, ISelectable target, out int count) { count = 0; List <Quest> questsListForReading = Find.QuestManager.QuestsListForReading; for (int i = 0; i < questsListForReading.Count; i++) { if (questsListForReading[i].State != QuestState.Ongoing) { continue; } _ = questsListForReading[i].State; tmpQuestParts.Clear(); tmpQuestParts.AddRange(questsListForReading[i].PartsListForReading); tmpQuestParts.SortBy((QuestPart x) => (x is QuestPartActivable) ? ((QuestPartActivable)x).EnableTick : 0); for (int j = 0; j < tmpQuestParts.Count; j++) { QuestPartActivable questPartActivable = tmpQuestParts[j] as QuestPartActivable; if (questPartActivable != null && questPartActivable.State == QuestPartState.Enabled) { string str = questPartActivable.ExtraInspectString(target); if (!str.NullOrEmpty()) { func(str.Formatted(target.Named("TARGET")), questsListForReading[i]); count++; } } } tmpQuestParts.Clear(); } }
public void QuestTick() { if (Historical) { if (!cleanedUp) { CleanupQuestParts(); } if (TicksSinceCleanup >= 1800000) { parts.Clear(); } return; } if (ticksUntilAcceptanceExpiry > 0 && State == QuestState.NotYetAccepted) { ticksUntilAcceptanceExpiry--; if (ticksUntilAcceptanceExpiry == 0 && !cleanedUp) { CleanupQuestParts(); } } if (Historical) { return; } for (int i = 0; i < parts.Count; i++) { QuestPartActivable questPartActivable = parts[i] as QuestPartActivable; if (questPartActivable != null && questPartActivable.State == QuestPartState.Enabled) { try { questPartActivable.QuestPartTick(); } catch (Exception arg) { Log.Error("Exception ticking QuestPart: " + arg); } if (Historical) { break; } } } }
public void AlertsReadoutUpdate() { if (Mathf.Max(Find.TickManager.TicksGame, Find.TutorialState.endTick) < 600) { return; } if (Find.Storyteller.def.disableAlerts) { activeAlerts.Clear(); return; } curAlertIndex++; if (curAlertIndex >= 24) { curAlertIndex = 0; } for (int i = curAlertIndex; i < AllAlerts.Count; i += 24) { CheckAddOrRemoveAlert(AllAlerts[i]); } if (Time.frameCount % 20 == 0) { List <Quest> questsListForReading = Find.QuestManager.QuestsListForReading; for (int j = 0; j < questsListForReading.Count; j++) { List <QuestPart> partsListForReading = questsListForReading[j].PartsListForReading; for (int k = 0; k < partsListForReading.Count; k++) { QuestPartActivable questPartActivable = partsListForReading[k] as QuestPartActivable; if (questPartActivable == null) { continue; } Alert cachedAlert = questPartActivable.CachedAlert; if (cachedAlert != null) { bool flag = questsListForReading[j].State != QuestState.Ongoing || questPartActivable.State != QuestPartState.Enabled; bool alertDirty = questPartActivable.AlertDirty; CheckAddOrRemoveAlert(cachedAlert, flag | alertDirty); if (alertDirty) { questPartActivable.ClearCachedAlert(); } } } } } for (int num = activeAlerts.Count - 1; num >= 0; num--) { Alert alert = activeAlerts[num]; try { activeAlerts[num].AlertActiveUpdate(); } catch (Exception ex) { Log.ErrorOnce("Exception updating alert " + alert.ToString() + ": " + ex.ToString(), 743575); activeAlerts.RemoveAt(num); } } if (mouseoverAlertIndex >= 0 && mouseoverAlertIndex < activeAlerts.Count) { IEnumerable <GlobalTargetInfo> allCulprits = activeAlerts[mouseoverAlertIndex].GetReport().AllCulprits; if (allCulprits != null) { foreach (GlobalTargetInfo item in allCulprits) { TargetHighlighter.Highlight(item); } } } mouseoverAlertIndex = -1; }