public virtual void RefreshFromAllQuests() { InitializeStates(); var allQuests = QuestMachine.GetAllQuestInstances(); foreach (var kvp in allQuests) { var quests = kvp.Value; if (quests == null) { continue; } for (int i = 0; i < quests.Count; i++) { var quest = quests[i]; if (quest == null) { continue; } var questState = quest.GetState(); if (questState == QuestState.Active && quest.indicatorStates != null && quest.indicatorStates.ContainsKey(myID)) { // If the quest specifies an indicator for me, record it: var state = quest.indicatorStates[myID]; states[(int)state].Add(StringField.GetStringValue(quest.id)); } else if (questState == QuestState.WaitingToStart && StringField.Equals(quest.questGiverID, myID) && string.IsNullOrEmpty(quest.questerID)) { // Otherwise if it's offerable by me, record it: var state = quest.canOffer ? hasQuestToOfferState : hasQuestButCannotOfferState; states[(int)state].Add(StringField.GetStringValue(quest.id)); } } } ShowHighestPriorityIndicator(); }