From e2a2418edfb468885389fad741ca311c4dc95a47 Mon Sep 17 00:00:00 2001 From: Kyryh Date: Sun, 14 Apr 2024 21:08:14 +0200 Subject: [PATCH 1/4] Add shimmer transmutations to recipe browser It registers fake recipes with a condition that you can never actually fulfill, that way it doesn't change the gameplay in any way --- Localization/TranslationsNeeded.txt | 18 ++++---- Localization/de-DE.hjson | 2 + Localization/en-US.hjson | 2 + Localization/es-ES.hjson | 2 + Localization/fr-FR.hjson | 2 + Localization/it-IT.hjson | 2 + Localization/pl-PL.hjson | 2 + Localization/pt-BR.hjson | 2 + Localization/ru-RU.hjson | 2 + Localization/zh-Hans.hjson | 2 + UISystem.cs | 71 ++++++++++++++++++++++++++++- 11 files changed, 97 insertions(+), 10 deletions(-) diff --git a/Localization/TranslationsNeeded.txt b/Localization/TranslationsNeeded.txt index 7f99096..eda8448 100644 --- a/Localization/TranslationsNeeded.txt +++ b/Localization/TranslationsNeeded.txt @@ -1,9 +1,9 @@ -en-US, 95/95, 100%, missing 0 -de-DE, 28/95, 29%, missing 67 -it-IT, 28/95, 29%, missing 67 -fr-FR, 28/95, 29%, missing 67 -es-ES, 49/95, 52%, missing 46 -ru-RU, 80/95, 84%, missing 15 -zh-Hans, 95/95, 100%, missing 0 -pt-BR, 95/95, 100%, missing 0 -pl-PL, 80/95, 84%, missing 15 +en-US, 96/96, 100%, missing 0 +de-DE, 28/96, 29%, missing 68 +it-IT, 28/96, 29%, missing 68 +fr-FR, 28/96, 29%, missing 68 +es-ES, 49/96, 51%, missing 47 +ru-RU, 80/96, 83%, missing 16 +zh-Hans, 95/96, 99%, missing 1 +pt-BR, 95/96, 99%, missing 1 +pl-PL, 80/96, 83%, missing 16 diff --git a/Localization/de-DE.hjson b/Localization/de-DE.hjson index d7e9d08..10542cf 100644 --- a/Localization/de-DE.hjson +++ b/Localization/de-DE.hjson @@ -207,5 +207,7 @@ Mods: { } } } + + // Conditions.ShimmerTransmutation: Shimmer Transmutation } } diff --git a/Localization/en-US.hjson b/Localization/en-US.hjson index db78705..d014528 100644 --- a/Localization/en-US.hjson +++ b/Localization/en-US.hjson @@ -211,5 +211,7 @@ Mods: { } } } + + Conditions.ShimmerTransmutation: Shimmer Transmutation } } diff --git a/Localization/es-ES.hjson b/Localization/es-ES.hjson index 3489c0e..192c46f 100644 --- a/Localization/es-ES.hjson +++ b/Localization/es-ES.hjson @@ -207,5 +207,7 @@ Mods: { } } } + + // Conditions.ShimmerTransmutation: Shimmer Transmutation } } diff --git a/Localization/fr-FR.hjson b/Localization/fr-FR.hjson index 529e433..a6e3338 100644 --- a/Localization/fr-FR.hjson +++ b/Localization/fr-FR.hjson @@ -207,5 +207,7 @@ Mods: { } } } + + // Conditions.ShimmerTransmutation: Shimmer Transmutation } } diff --git a/Localization/it-IT.hjson b/Localization/it-IT.hjson index 1f1c0ed..3a398d1 100644 --- a/Localization/it-IT.hjson +++ b/Localization/it-IT.hjson @@ -207,5 +207,7 @@ Mods: { } } } + + // Conditions.ShimmerTransmutation: Shimmer Transmutation } } diff --git a/Localization/pl-PL.hjson b/Localization/pl-PL.hjson index 89d232c..d836e50 100644 --- a/Localization/pl-PL.hjson +++ b/Localization/pl-PL.hjson @@ -207,5 +207,7 @@ Mods: { } } } + + // Conditions.ShimmerTransmutation: Shimmer Transmutation } } diff --git a/Localization/pt-BR.hjson b/Localization/pt-BR.hjson index 772307e..aaa1cce 100644 --- a/Localization/pt-BR.hjson +++ b/Localization/pt-BR.hjson @@ -207,5 +207,7 @@ Mods: { } } } + + // Conditions.ShimmerTransmutation: Shimmer Transmutation } } diff --git a/Localization/ru-RU.hjson b/Localization/ru-RU.hjson index 97fc1ef..fa1b92f 100644 --- a/Localization/ru-RU.hjson +++ b/Localization/ru-RU.hjson @@ -207,5 +207,7 @@ Mods: { } } } + + // Conditions.ShimmerTransmutation: Shimmer Transmutation } } diff --git a/Localization/zh-Hans.hjson b/Localization/zh-Hans.hjson index 6ebe178..522a639 100644 --- a/Localization/zh-Hans.hjson +++ b/Localization/zh-Hans.hjson @@ -211,5 +211,7 @@ Mods: { } } } + + // Conditions.ShimmerTransmutation: Shimmer Transmutation } } diff --git a/UISystem.cs b/UISystem.cs index 8bf1a1e..55f6257 100644 --- a/UISystem.cs +++ b/UISystem.cs @@ -21,7 +21,76 @@ public class UISystem : ModSystem public override void PreSaveAndQuit() => RecipeBrowser.instance.PreSaveAndQuit(); - public override void PostAddRecipes() + public override void AddRecipes() { + Condition shimmerTransmutationCondition = new("Mods.RecipeBrowser.Conditions.ShimmerTransmutation", () => false); + for (int i = 0; i < ItemID.Sets.ShimmerTransformToItem.Length; i++) { + // For some reason this is set initially but gets overriden later on + // So I'll skip it + if (i == ItemID.LihzahrdBrickWall) + continue; + int shimmerTransmutation = ItemID.Sets.ShimmerTransformToItem[i]; + Console.WriteLine($"{i}: {shimmerTransmutation}"); + if (shimmerTransmutation > 0) { + Recipe.Create(shimmerTransmutation) + .AddIngredient(i) + .AddCondition(shimmerTransmutationCondition) + .Register(); + } + } + + // Fix for vanilla hardcoded transmutations + Recipe.Create(ItemID.RodOfHarmony) + .AddIngredient(ItemID.RodofDiscord) + .AddCondition(shimmerTransmutationCondition) + .AddCondition(Condition.DownedMoonLord) + .Register(); + + Recipe.Create(ItemID.Clentaminator2) + .AddIngredient(ItemID.Clentaminator) + .AddCondition(shimmerTransmutationCondition) + .AddCondition(Condition.DownedMoonLord) + .Register(); + + Recipe.Create(ItemID.BottomlessBucket) + .AddIngredient(ItemID.BottomlessShimmerBucket) + .AddCondition(shimmerTransmutationCondition) + .AddCondition(Condition.DownedMoonLord) + .Register(); + + Recipe.Create(ItemID.BottomlessShimmerBucket) + .AddIngredient(ItemID.BottomlessBucket) + .AddCondition(shimmerTransmutationCondition) + .AddCondition(Condition.DownedMoonLord) + .Register(); + + Recipe.Create(ItemID.LihzahrdWallUnsafe) + .AddIngredient(ItemID.LihzahrdBrickWall) + .AddCondition(shimmerTransmutationCondition) + .AddCondition(Condition.DownedGolem) + .Register(); + + List> luminiteBrickTransmutations = new() { + new KeyValuePair(ItemID.HeavenforgeBrick, Condition.MoonPhaseFull), + new KeyValuePair(ItemID.LunarRustBrick, Condition.MoonPhaseWaningGibbous), + new KeyValuePair(ItemID.AstraBrick, Condition.MoonPhaseThirdQuarter), + new KeyValuePair(ItemID.DarkCelestialBrick, Condition.MoonPhaseWaningCrescent), + new KeyValuePair(ItemID.MercuryBrick, Condition.MoonPhaseNew), + new KeyValuePair(ItemID.StarRoyaleBrick, Condition.MoonPhaseWaxingCrescent), + new KeyValuePair(ItemID.CryocoreBrick, Condition.MoonPhaseFirstQuarter), + new KeyValuePair(ItemID.CosmicEmberBrick, Condition.MoonPhaseWaxingGibbous) + }; + + foreach (var item in luminiteBrickTransmutations) + { + Recipe.Create(item.Key) + .AddIngredient(ItemID.LunarBrick) + .AddCondition(shimmerTransmutationCondition) + .AddCondition(item.Value) + .Register(); + } + } + + public override void PostAddRecipes() { if (!Main.dedServ) { LootCacheManager.Setup(RecipeBrowser.instance); From dba027c9611b101bf24788daa4f7d14b0da180b0 Mon Sep 17 00:00:00 2001 From: Kyryh Date: Sun, 14 Apr 2024 21:09:32 +0200 Subject: [PATCH 2/4] Updated selected mod recipe detection Now it doesn't add the "Recipe added by mod" tooltip if the mod in question is Recipe Browser Useful only now with fake shimmer recipes --- RecipeBrowserGlobalItem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecipeBrowserGlobalItem.cs b/RecipeBrowserGlobalItem.cs index 680c218..a719f40 100644 --- a/RecipeBrowserGlobalItem.cs +++ b/RecipeBrowserGlobalItem.cs @@ -106,7 +106,7 @@ public override void ModifyTooltips(Item item, List tooltips) { if (RecipeCatalogueUI.instance.hoveredIndex < 0) return; var selectedModRecipe = Main.recipe[RecipeCatalogueUI.instance.hoveredIndex]; - if (selectedModRecipe.Mod != null && ModContent.GetInstance().ShowRecipeModSource && item.type == selectedModRecipe.createItem.type) + if (selectedModRecipe.Mod != null && selectedModRecipe.Mod != Mod && ModContent.GetInstance().ShowRecipeModSource && item.type == selectedModRecipe.createItem.type) { var line = new TooltipLine(Mod, "RecipeBrowser:RecipeOriginHint", "Recipe added by " + selectedModRecipe.Mod.DisplayName) { From f2e39347a2105a4ac173e3f8ef91f6d6b0bd74a0 Mon Sep 17 00:00:00 2001 From: Kyryh Date: Sun, 14 Apr 2024 21:11:35 +0200 Subject: [PATCH 3/4] Updated recipe info drawing Now it adds "None" to the required objects only if the recipe has no required tiles and no conditions --- UIElements/UIRecipeInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UIElements/UIRecipeInfo.cs b/UIElements/UIRecipeInfo.cs index 74cb064..e6ec5fd 100644 --- a/UIElements/UIRecipeInfo.cs +++ b/UIElements/UIRecipeInfo.cs @@ -70,7 +70,7 @@ protected override void DrawSelf(SpriteBatch spriteBatch) int row = 0; int tileIndex = 0; bool comma = false; - if(selectedRecipe.requiredTile.Count == 0) { + if(selectedRecipe.requiredTile.Count == 0 && selectedRecipe.Conditions.Count == 0) { sb.Append($"{(comma ? ", " : "")}[c/{Utilities.textColor.Hex3()}:{Language.GetTextValue("LegacyInterface.23")}]"); sbTiles.Append($"{(comma ? ", " : "")}[c/{Utilities.textColor.Hex3()}:{Language.GetTextValue("LegacyInterface.23")}]"); comma = true; From cd942f9b996b531a64290fba6d894bf344a0a8db Mon Sep 17 00:00:00 2001 From: Kyryh Date: Sun, 14 Apr 2024 21:13:26 +0200 Subject: [PATCH 4/4] Removed debug print whoopsies --- UISystem.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/UISystem.cs b/UISystem.cs index 55f6257..ff56021 100644 --- a/UISystem.cs +++ b/UISystem.cs @@ -29,7 +29,6 @@ public override void AddRecipes() { if (i == ItemID.LihzahrdBrickWall) continue; int shimmerTransmutation = ItemID.Sets.ShimmerTransformToItem[i]; - Console.WriteLine($"{i}: {shimmerTransmutation}"); if (shimmerTransmutation > 0) { Recipe.Create(shimmerTransmutation) .AddIngredient(i)