/// <summary> /// Applied before Success runs. /// </summary> internal static bool Prefix(ref bool __result, TuneUpGenerator __instance) { var inst = AchievementPatches.Instance; bool cont = inst == null || inst.IsFirstTime(nameof(TuneUpGenerator)); if (!cont) { // ___choresCompleted is now initialized int tuneUps = Mathf.RoundToInt(__instance.choresCompleted), last = inst. tuneUps; if (last > tuneUps) { tuneUps = last; } // Take the highest inst.tuneUps = tuneUps; __instance.choresCompleted = tuneUps; __result = tuneUps >= __instance.numChoreseToComplete; } return(cont); }
//It may be "FinelyTunedMachine" now, but it will always be "TuneUpForWhat in my heart. public static List <string> TuneUpForWhatFormatter(ColonyAchievementStatus cas) { List <string> outStrings = new List <string>(); TuneUpGenerator __instance = (TuneUpGenerator)cas.Requirements.Find(s => s is TuneUpGenerator); var priv = Traverse.Create(__instance); //Sic. This *is* the name of the field. If they fix the typo, it'll need to be fixed here as well. float numChores = (float)priv.Field("numChoreseToComplete").GetValue(); float num = 0.0f; ReportManager.ReportEntry entry = ReportManager.Instance.TodaysReport.GetEntry(ReportManager.ReportType.ChoreStatus); for (int index = 0; index < entry.contextEntries.Count; ++index) { ReportManager.ReportEntry contextEntry = entry.contextEntries[index]; if (contextEntry.context == Db.Get().ChoreTypes.PowerTinker.Name) { num += contextEntry.Negative; } } for (int index1 = 0; index1 < ReportManager.Instance.reports.Count; ++index1) { for (int index2 = 0; index2 < ReportManager.Instance.reports[index1].GetEntry(ReportManager.ReportType.ChoreStatus).contextEntries.Count; ++index2) { ReportManager.ReportEntry contextEntry = ReportManager.Instance.reports[index1].GetEntry(ReportManager.ReportType.ChoreStatus).contextEntries[index2]; if (contextEntry.context == Db.Get().ChoreTypes.PowerTinker.Name) { num += contextEntry.Negative; } } } string output = string.Format("Tune Ups: {0} / {1}", (double)Math.Abs(num), (double)numChores); outStrings.Add(output); return(outStrings); }