public void CollectChores(ChoreConsumerState consumer_state, List <Chore.Precondition.Context> succeeded, List <Chore.Precondition.Context> failed_contexts) { ChoreType transport = Db.Get().ChoreTypes.Transport; int personalPriority = consumer_state.consumer.GetPersonalPriority(transport); int priority = (!Game.Instance.advancedPersonalPriorities) ? transport.priority : transport.explicitPriority; CollectSortedClearables(consumer_state.navigator, markedClearables, sortedClearables); bool flag = false; foreach (SortedClearable sortedClearable in sortedClearables) { SortedClearable current = sortedClearable; Pickupable pickupable = current.pickupable; PrioritySetting masterPriority = current.masterPriority; Chore.Precondition.Context item = default(Chore.Precondition.Context); item.personalPriority = personalPriority; KPrefabID kPrefabID = pickupable.KPrefabID; kPrefabID.UpdateTagBits(); foreach (GlobalChoreProvider.Fetch fetch in GlobalChoreProvider.Instance.fetches) { GlobalChoreProvider.Fetch current2 = fetch; if (kPrefabID.HasAnyTags_AssumeLaundered(ref current2.chore.tagBits)) { item.Set(current2.chore, consumer_state, false, pickupable); item.choreTypeForPermission = transport; item.RunPreconditions(); if (item.IsSuccess()) { item.masterPriority = masterPriority; item.priority = priority; item.interruptPriority = transport.interruptPriority; succeeded.Add(item); flag = true; break; } } } if (flag) { break; } } }
private bool ChooseChore(ref Chore.Precondition.Context out_context, List <Chore.Precondition.Context> succeeded_contexts) { if (succeeded_contexts.Count == 0) { return(false); } Chore currentChore = choreDriver.GetCurrentChore(); if (currentChore == null) { for (int num = succeeded_contexts.Count - 1; num >= 0; num--) { Chore.Precondition.Context context = succeeded_contexts[num]; if (context.IsSuccess()) { out_context = context; return(true); } } } else { int interruptPriority = Db.Get().ChoreTypes.TopPriority.interruptPriority; int num2 = (currentChore.masterPriority.priority_class != PriorityScreen.PriorityClass.topPriority) ? currentChore.choreType.interruptPriority : interruptPriority; for (int num3 = succeeded_contexts.Count - 1; num3 >= 0; num3--) { Chore.Precondition.Context context2 = succeeded_contexts[num3]; if (context2.IsSuccess()) { int num4 = (context2.masterPriority.priority_class != PriorityScreen.PriorityClass.topPriority) ? context2.interruptPriority : interruptPriority; if (num4 > num2 && !currentChore.choreType.interruptExclusion.Overlaps(context2.chore.choreType.tags)) { out_context = context2; return(true); } } } } return(false); }
public void ShowHoverTextOnHoveredItem(Chore.Precondition.Context context, KSelectable hover_obj, HoverTextDrawer drawer, SelectToolHoverTextCard hover_text_card) { if (!context.chore.target.isNull && !((UnityEngine.Object)context.chore.target.gameObject != (UnityEngine.Object)hover_obj.gameObject)) { drawer.NewLine(26); drawer.AddIndent(36); drawer.DrawText(context.chore.choreType.Name, hover_text_card.Styles_BodyText.Standard); if (!context.IsSuccess()) { Chore.PreconditionInstance preconditionInstance = context.chore.GetPreconditions()[context.failedPreconditionId]; string text = preconditionInstance.description; if (string.IsNullOrEmpty(text)) { text = preconditionInstance.id; } if ((UnityEngine.Object)context.chore.driver != (UnityEngine.Object)null) { text = text.Replace("{Assignee}", context.chore.driver.GetProperName()); } text = text.Replace("{Selected}", this.GetProperName()); drawer.DrawText(" (" + text + ")", hover_text_card.Styles_BodyText.Standard); } } }