From 2c767de525a0fab07af6c13acb55e547ba2e0812 Mon Sep 17 00:00:00 2001 From: Mike Zimmermann Date: Mon, 11 Apr 2022 12:43:06 -0500 Subject: [PATCH 1/2] Fixing updated method reference --- .../UI/InventoryGuiPatches.cs | 4 ++-- .../UI/StationRecyclingTabHolder.cs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ABearCodes.Valheim.SimpleRecycling/UI/InventoryGuiPatches.cs b/ABearCodes.Valheim.SimpleRecycling/UI/InventoryGuiPatches.cs index 8dad199..84ea39a 100644 --- a/ABearCodes.Valheim.SimpleRecycling/UI/InventoryGuiPatches.cs +++ b/ABearCodes.Valheim.SimpleRecycling/UI/InventoryGuiPatches.cs @@ -19,7 +19,7 @@ static void OnTabCraftPressedAlsoEnableRecycling1(InventoryGui __instance) { Plugin.RecyclingTabButtonHolder.SetInteractable(true); // temporary fix for compatibility with EpicLoot - InventoryGui.instance.UpdateCraftingPanel(false); + __instance.UpdateCraftingPanel(false); } [HarmonyPrefix] @@ -90,7 +90,7 @@ public static void SetRecipe(this InventoryGui __instance, int index, bool cente [HarmonyReversePatch] [HarmonyPatch(typeof(InventoryGui), "GetSelectedRecipeIndex")] - public static int GetSelectedRecipeIndex(this InventoryGui __instance) + public static int GetSelectedRecipeIndex(this InventoryGui __instance, bool acceptOneLevelHigher = false) { throw new NotImplementedException("stub"); } diff --git a/ABearCodes.Valheim.SimpleRecycling/UI/StationRecyclingTabHolder.cs b/ABearCodes.Valheim.SimpleRecycling/UI/StationRecyclingTabHolder.cs index b78fd9f..0cbaf0d 100644 --- a/ABearCodes.Valheim.SimpleRecycling/UI/StationRecyclingTabHolder.cs +++ b/ABearCodes.Valheim.SimpleRecycling/UI/StationRecyclingTabHolder.cs @@ -83,7 +83,7 @@ public void UpdateCraftingPanel() if (igui.get_m_availableRecipes().Count > 0) { if (igui.get_m_selectedRecipe().Key != null) - igui.SetRecipe(igui.GetSelectedRecipeIndex(), true); + igui.SetRecipe(igui.GetSelectedRecipeIndex(false), true); else igui.SetRecipe(0, true); } @@ -185,8 +185,8 @@ public void UpdateRecipe(Player player, float dt) //todo: optimize reflection calls var igui = InventoryGui.instance; - var selectedRecipeIndex = igui.GetSelectedRecipeIndex(); - if (selectedRecipeIndex != -1 && selectedRecipeIndex < _recyclingAnalysisContexts.Count) + var selectedRecipeIndex = igui.GetSelectedRecipeIndex(false); + if (selectedRecipeIndex > -1 && _recyclingAnalysisContexts.Count > 0 && selectedRecipeIndex < _recyclingAnalysisContexts.Count) { var context = _recyclingAnalysisContexts[selectedRecipeIndex]; var newContext = new RecyclingAnalysisContext(context.Item); @@ -211,7 +211,7 @@ public void UpdateRecipe(Player player, float dt) } if (igui.get_m_selectedRecipe().Key) { - var analysisContext = _recyclingAnalysisContexts[igui.GetSelectedRecipeIndex()]; + var analysisContext = _recyclingAnalysisContexts[igui.GetSelectedRecipeIndex(false)]; igui.m_recipeIcon.enabled = true; igui.m_recipeName.enabled = true; igui.m_recipeDecription.enabled = true; From 666f756050729c0a1fa5099b3002d78b4fcf07c4 Mon Sep 17 00:00:00 2001 From: Mike Zimmermann Date: Mon, 11 Apr 2022 23:49:29 -0500 Subject: [PATCH 2/2] Fixing IL error --- ABearCodes.Valheim.SimpleRecycling/Properties/AssemblyInfo.cs | 4 ++-- ABearCodes.Valheim.SimpleRecycling/UI/InventoryGuiPatches.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ABearCodes.Valheim.SimpleRecycling/Properties/AssemblyInfo.cs b/ABearCodes.Valheim.SimpleRecycling/Properties/AssemblyInfo.cs index 8fa028f..e1922da 100644 --- a/ABearCodes.Valheim.SimpleRecycling/Properties/AssemblyInfo.cs +++ b/ABearCodes.Valheim.SimpleRecycling/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.0.13")] -[assembly: AssemblyFileVersion("0.0.13")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.15")] +[assembly: AssemblyFileVersion("0.0.15")] \ No newline at end of file diff --git a/ABearCodes.Valheim.SimpleRecycling/UI/InventoryGuiPatches.cs b/ABearCodes.Valheim.SimpleRecycling/UI/InventoryGuiPatches.cs index 84ea39a..99af302 100644 --- a/ABearCodes.Valheim.SimpleRecycling/UI/InventoryGuiPatches.cs +++ b/ABearCodes.Valheim.SimpleRecycling/UI/InventoryGuiPatches.cs @@ -90,7 +90,7 @@ public static void SetRecipe(this InventoryGui __instance, int index, bool cente [HarmonyReversePatch] [HarmonyPatch(typeof(InventoryGui), "GetSelectedRecipeIndex")] - public static int GetSelectedRecipeIndex(this InventoryGui __instance, bool acceptOneLevelHigher = false) + public static int GetSelectedRecipeIndex(this InventoryGui __instance, bool acceptOneLevelHigher) { throw new NotImplementedException("stub"); }