public void EnableRedAlert() { ChoreDriver component = GetComponent <ChoreDriver>(); if ((Object)component != (Object)null) { Chore currentChore = component.GetCurrentChore(); if (currentChore != null) { bool flag = false; for (int i = 0; i < currentChore.GetPreconditions().Count; i++) { Chore.PreconditionInstance preconditionInstance = currentChore.GetPreconditions()[i]; if (preconditionInstance.id == ChorePreconditions.instance.IsNotRedAlert.id) { flag = true; } } if (flag) { component.StopChore(); } } } }
private static string TooltipForDupe(Chore.Precondition.Context context, ChoreConsumer choreConsumer, int rank) { bool flag = context.IsPotentialSuccess(); string text = (!flag) ? UI.DETAILTABS.BUILDING_CHORES.DUPE_TOOLTIP_FAILED : UI.DETAILTABS.BUILDING_CHORES.DUPE_TOOLTIP_SUCCEEDED; float num = 0f; int personalPriority = choreConsumer.GetPersonalPriority(context.chore.choreType); num += (float)(personalPriority * 10); int priority_value = context.chore.masterPriority.priority_value; num += (float)priority_value; float num2 = (float)context.priority / 10000f; num += num2; text = text.Replace("{Description}", (!((Object)context.chore.driver == (Object)choreConsumer.choreDriver)) ? UI.DETAILTABS.BUILDING_CHORES.DUPE_TOOLTIP_DESC_INACTIVE : UI.DETAILTABS.BUILDING_CHORES.DUPE_TOOLTIP_DESC_ACTIVE); string newValue = GameUtil.ChoreGroupsForChoreType(context.chore.choreType); string newValue2 = UI.UISIDESCREENS.MINIONTODOSIDESCREEN.TOOLTIP_NA.text; if (flag && context.chore.choreType.groups.Length > 0) { ChoreGroup choreGroup = context.chore.choreType.groups[0]; for (int i = 1; i < context.chore.choreType.groups.Length; i++) { if (choreConsumer.GetPersonalPriority(choreGroup) < choreConsumer.GetPersonalPriority(context.chore.choreType.groups[i])) { choreGroup = context.chore.choreType.groups[i]; } } newValue2 = choreGroup.Name; } text = text.Replace("{Name}", choreConsumer.name); text = text.Replace("{Errand}", GameUtil.GetChoreName(context.chore, context.data)); if (flag) { text = text.Replace("{Rank}", rank.ToString()); text = text.Replace("{Groups}", newValue); text = text.Replace("{BestGroup}", newValue2); string text2 = text; JobsTableScreen.PriorityInfo priorityInfo = JobsTableScreen.priorityInfo[personalPriority]; text = text2.Replace("{PersonalPriority}", priorityInfo.name.text); text = text.Replace("{PersonalPriorityValue}", (personalPriority * 10).ToString()); text = text.Replace("{Building}", context.chore.gameObject.GetProperName()); text = text.Replace("{BuildingPriority}", priority_value.ToString()); text = text.Replace("{TypePriority}", num2.ToString()); return(text.Replace("{TotalPriority}", num.ToString())); } string text3 = text; Chore.PreconditionInstance preconditionInstance = context.chore.GetPreconditions()[context.failedPreconditionId]; return(text3.Replace("{FailedPrecondition}", preconditionInstance.description)); }
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); } } }
private void OnSolidChanged(object data) { if (!((UnityEngine.Object) this == (UnityEngine.Object)null) && !((UnityEngine.Object)base.gameObject == (UnityEngine.Object)null)) { GameScenePartitioner.Instance.Free(ref unstableEntry); int num = Grid.PosToCell(this); int num2 = -1; UpdateColor(isReachable); if (Grid.Element[num].hardness >= 200) { bool flag = false; foreach (Chore.PreconditionInstance precondition in chore.GetPreconditions()) { Chore.PreconditionInstance current = precondition; if (current.id == ChorePreconditions.instance.HasSkillPerk.id) { flag = true; break; } } if (!flag) { chore.AddPrecondition(ChorePreconditions.instance.HasSkillPerk, Db.Get().SkillPerks.CanDigSupersuperhard); } requiredSkillPerk = Db.Get().SkillPerks.CanDigSupersuperhard.Id; materialDisplay.sharedMaterial = materials[3]; } else if (Grid.Element[num].hardness >= 150) { bool flag2 = false; foreach (Chore.PreconditionInstance precondition2 in chore.GetPreconditions()) { Chore.PreconditionInstance current2 = precondition2; if (current2.id == ChorePreconditions.instance.HasSkillPerk.id) { flag2 = true; break; } } if (!flag2) { chore.AddPrecondition(ChorePreconditions.instance.HasSkillPerk, Db.Get().SkillPerks.CanDigNearlyImpenetrable); } requiredSkillPerk = Db.Get().SkillPerks.CanDigNearlyImpenetrable.Id; materialDisplay.sharedMaterial = materials[2]; } else if (Grid.Element[num].hardness >= 50) { bool flag3 = false; foreach (Chore.PreconditionInstance precondition3 in chore.GetPreconditions()) { Chore.PreconditionInstance current3 = precondition3; if (current3.id == ChorePreconditions.instance.HasSkillPerk.id) { flag3 = true; break; } } if (!flag3) { chore.AddPrecondition(ChorePreconditions.instance.HasSkillPerk, Db.Get().SkillPerks.CanDigVeryFirm); } requiredSkillPerk = Db.Get().SkillPerks.CanDigVeryFirm.Id; materialDisplay.sharedMaterial = materials[1]; } else { requiredSkillPerk = null; chore.GetPreconditions().Remove(chore.GetPreconditions().Find((Chore.PreconditionInstance o) => o.id == ChorePreconditions.instance.HasSkillPerk.id)); } UpdateStatusItem(null); bool flag4 = false; if (!Grid.Solid[num]) { num2 = GetUnstableCellAbove(num); if (num2 == -1) { flag4 = true; } else { StartCoroutine("PeriodicUnstableFallingRecheck"); } } else if (Grid.Foundation[num]) { flag4 = true; } if (flag4) { isDigComplete = true; if (chore == null || !chore.InProgress()) { Util.KDestroyGameObject(base.gameObject); } else { GetComponentInChildren <MeshRenderer>().enabled = false; } } else if (num2 != -1) { Extents extents = default(Extents); Grid.CellToXY(num, out extents.x, out extents.y); extents.width = 1; extents.height = (num2 - num + Grid.WidthInCells - 1) / Grid.WidthInCells + 1; unstableEntry = GameScenePartitioner.Instance.Add("Diggable.OnSolidChanged", base.gameObject, extents, GameScenePartitioner.Instance.solidChangedLayer, OnSolidChanged); } } }