public static void Postfix(IList <Ingredient> ingredients, ref List <TooltipIcon> icons) { if (ingredients == null) { return; } var ingredientCount = ingredients.Count; for (var i = 0; i < ingredientCount; i++) { var techType = ingredients[i].techType; if (!KnownTech.Contains(techType) && PDAScanner.ContainsCompleteEntry(techType)) { KnownTech.Add(techType); } if (KnownTech.Contains(techType) || !GameModeUtils.RequiresBlueprints()) { continue; } var icon = icons.Find((TooltipIcon) => TooltipIcon.sprite == SpriteManager.Get(techType) && TooltipIcon.text.Contains(Language.main.GetOrFallback(TooltipFactory.techTypeIngredientStrings.Get(techType), techType))); if (!icons.Contains(icon)) { continue; } icons.Remove(icon); var tooltipIcon = new TooltipIcon() { sprite = SpriteManager.Get(TechType.None), text = Main.Config.UnKnownTitle }; icons.Add(tooltipIcon); } }
public static void Postfix(ITechData data, ref List <TooltipIcon> icons) { if (data == null) { return; } var ingredientCount = data.ingredientCount; for (var i = 0; i < ingredientCount; i++) { var ingredient = data.GetIngredient(i); var techType = ingredient.techType; if (!KnownTech.Contains(techType) && PDAScanner.ContainsCompleteEntry(techType)) { KnownTech.Add(techType); continue; } if (!CrafterLogic.IsCraftRecipeUnlocked(techType)) { var icon = icons.Find((TooltipIcon) => TooltipIcon.sprite == SpriteManager.Get(techType) && TooltipIcon.text.Contains(Language.main.GetOrFallback(TooltipFactory.techTypeIngredientStrings.Get(techType), techType))); if (icons.Contains(icon)) { icons.Remove(icon); var tooltipIcon = new TooltipIcon() { sprite = SpriteManager.Get(TechType.None), text = Main.Config.UnKnownTitle }; icons.Add(tooltipIcon); } } } }
public static bool Prefix(TechType techType, bool verbose) { if (Main.Config.Hardcore) { var entryData = PDAScanner.GetEntryData(techType); return(!verbose || entryData == null || (entryData != null && PDAScanner.ContainsCompleteEntry(techType))); } return(true); }
public static void Postfix(ref StringBuilder sb, TechType techType) { PDAScanner.EntryData entryData = PDAScanner.GetEntryData(techType); if (entryData == null || PDAScanner.ContainsCompleteEntry(techType) || CrafterLogic.IsCraftRecipeUnlocked(techType)) { return; } sb.Clear(); TooltipFactory.WriteTitle(sb, Main.config.UnKnownTitle); TooltipFactory.WriteDescription(sb, Main.config.UnKnownDescription); }
public static void Postfix() { if (PDAScanner.ContainsCompleteEntry(techType) || KnownTech.Contains(techType)) { if (techType == TechType.ScrapMetal && !KnownTech.Contains(TechType.Titanium)) { PDAScanner.AddByUnlockable(TechType.Titanium, 1); KnownTech.Add(TechType.Titanium); } if (!KnownTech.Contains(techType)) { KnownTech.Add(techType); } var entryData = PDAScanner.GetEntryData(techType); if (entryData != null && entryData.locked) { PDAScanner.Unlock(entryData, true, true); if (!KnownTech.Contains(entryData.blueprint)) { KnownTech.Add(entryData.blueprint); } } #if SN1 var techType2 = CraftData.GetHarvestOutputData(techType); #elif BZ var techType2 = TechData.GetHarvestOutput(techType); #endif if (techType2 != TechType.None) { if (!KnownTech.Contains(techType2)) { KnownTech.Add(techType2); } var entryData2 = PDAScanner.GetEntryData(techType2); if (entryData2 != null && entryData2.locked) { PDAScanner.Unlock(entryData, true, true); if (!KnownTech.Contains(entryData2.blueprint)) { KnownTech.Add(entryData2.blueprint); } } } } }
// After 2 seconds without scanning, a packet will be sent with the latest progress static IEnumerator ThrottleLastProgress(ThrottledEntry throttledEntry) { do { yield return(new WaitForSeconds(LAST_PACKET_SEND_DELAY / 1000)); }while (DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() < throttledEntry.LatestProgressTime.ToUnixTimeMilliseconds() + LAST_PACKET_SEND_DELAY); throttledEntry.GetEntry(); if (!throttledEntry.Unlocked && !PDAScanner.ContainsCompleteEntry(throttledEntry.EntryTechType)) { PDAManagerEntry.Progress(throttledEntry.Entry, throttledEntry.Id); } // No need to keep this in memory ThrottlingEntries.Remove(throttledEntry.Id); }
public static void Postfix(ScannerTool __instance) { PDAScanner.ScanTarget scanTarget = PDAScanner.scanTarget; #if SN1 PDAScanner.Result result = PDAScanner.CanScan(); #elif BZ PDAScanner.Result result = PDAScanner.CanScan(scanTarget); #endif PDAScanner.EntryData entryData = PDAScanner.GetEntryData(PDAScanner.scanTarget.techType); if ((entryData != null && (CrafterLogic.IsCraftRecipeUnlocked(entryData.blueprint) || CrafterLogic.IsCraftRecipeUnlocked(entryData.key))) || PDAScanner.ContainsCompleteEntry(scanTarget.techType) || __instance.energyMixin.charge <= 0f || !scanTarget.isValid || result != PDAScanner.Result.Scan || !GameModeUtils.RequiresBlueprints()) { return; } #if SN1 HandReticle.main.SetInteractText(Main.config.UnKnownLabel, false, HandReticle.Hand.None); #elif BZ HandReticle.main.SetText(HandReticle.TextType.Hand, Main.config.UnKnownLabel, true, GameInput.Button.None); #endif }