From d10a4feacf660138d4abae8a4474e71434c72495 Mon Sep 17 00:00:00 2001 From: Squydy Date: Mon, 15 Jun 2026 20:25:34 -0700 Subject: [PATCH] added a researched items for journey mode --- RecipeCatalogueUI.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/RecipeCatalogueUI.cs b/RecipeCatalogueUI.cs index 37147c0..16d60fe 100644 --- a/RecipeCatalogueUI.cs +++ b/RecipeCatalogueUI.cs @@ -66,6 +66,7 @@ internal int Tile { internal UIRecipeInfo recipeInfo; internal UIRadioButton NearbyIngredientsRadioBitton; + internal UIRadioButton ResearchedIngredientsRadioButton; internal UIRadioButton ItemChecklistRadioButton; internal UIRadioButtonGroup RadioButtonGroup; internal UIJourneyDuplicateButton duplicationButton; @@ -137,14 +138,21 @@ internal UIElement CreateRecipeCataloguePanel() { RadioButtonGroup.Width.Set(180, 0f); UIRadioButton AllRecipesRadioButton = new UIRadioButton(RBText("AllRecipes"), ""); NearbyIngredientsRadioBitton = new UIRadioButton(RBText("NearbyChests"), RBText("ClickToRefresh")); + ResearchedIngredientsRadioButton = new UIRadioButton(RBText("ResearchedMaterials"), RBText("OnlyShowRecipesWithResearchedMaterials")); ItemChecklistRadioButton = new UIRadioButton(RBText("ItemChecklistOnly"), "???"); RadioButtonGroup.Add(AllRecipesRadioButton); RadioButtonGroup.Add(NearbyIngredientsRadioBitton); + RadioButtonGroup.Add(ResearchedIngredientsRadioButton); RadioButtonGroup.Add(ItemChecklistRadioButton); mainPanel.Append(RadioButtonGroup); AllRecipesRadioButton.Selected = true; NearbyIngredientsRadioBitton.OnSelectedChanged += NearbyIngredientsRadioBitton_OnSelectedChanged; + ResearchedIngredientsRadioButton.OnSelectedChanged += (s, e) => updateNeeded = true; + if (!Main.GameModeInfo.IsJourneyMode) { + ResearchedIngredientsRadioButton.SetDisabled(); + ResearchedIngredientsRadioButton.SetHoverText(RBText("JourneyModeOnly", "Common")); + } if (RecipeBrowser.itemChecklistInstance != null) { ItemChecklistRadioButton.OnSelectedChanged += ItemChecklistFilter_SelectedChanged; @@ -563,6 +571,12 @@ private bool PassRecipeFilters(UIRecipeSlot recipeSlot, Recipe recipe, List } } + if (ResearchedIngredientsRadioButton.Selected) { + if (!PassResearchedIngredientsFilter(recipe)) { + return false; + } + } + // Item Checklist integration if (ItemChecklistRadioButton.Selected) { if (RecipeBrowserUI.instance.foundItems != null) { @@ -696,6 +710,16 @@ private string GetTooltipsAsString(ItemTooltip toolTip) { return sb.ToString().ToLower(); } + private bool PassResearchedIngredientsFilter(Recipe recipe) { + var sacrificeCatalog = Terraria.GameContent.Creative.CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId; + foreach (Item item in recipe.requiredItem) { + if (sacrificeCatalog.ContainsKey(item.type) && !RecipePath.ItemFullyResearched(item.type)) { + return false; + } + } + return true; + } + // TODO, checkbox for check stack? // TODO, # missing allowed slider? private bool PassNearbyChestFilter(Recipe recipe) {