Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of FreePotions v1.0.2
FreePotions.dll
Decompiled a day agousing System; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace FreePotions; [BepInPlugin("yuri.FreePotions", "Free Potions", "1.0.2")] public class Plugin : BaseUnityPlugin { public static Plugin Inst; public static bool pularCusto; public static FieldInfo CampoReceita; public static FieldInfo CampoUpgrade; private ConfigEntry<bool> Ligado; private void Awake() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown Inst = this; Ligado = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Known mead bases and barley wine bases craft without using ingredients. Only your own game needs this mod."); CampoReceita = typeof(InventoryGui).GetField("m_craftRecipe", BindingFlags.Instance | BindingFlags.NonPublic); CampoUpgrade = typeof(InventoryGui).GetField("m_craftUpgradeItem", BindingFlags.Instance | BindingFlags.NonPublic); Harmony val = new Harmony("yuri.FreePotions"); val.PatchAll(typeof(Plugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Free Potions 1.0.2"); } public static bool Ativo() { if ((Object)(object)Inst != (Object)null) { return Inst.Ligado.Value; } return false; } public void Avisar(string nome) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Potion base without ingredients: " + nome)); } public static bool BaseConhecida(Player jogador, Recipe receita) { if ((Object)(object)jogador == (Object)null || (Object)(object)receita == (Object)null || (Object)(object)receita.m_item == (Object)null) { return false; } if (receita.m_item.m_itemData == null || receita.m_item.m_itemData.m_shared == null) { return false; } string name = receita.m_item.m_itemData.m_shared.m_name; string nome = (((Object)(object)((Component)receita.m_item).gameObject != (Object)null) ? ((Object)((Component)receita.m_item).gameObject).name : ((Object)receita.m_item).name); if (!EhBase(nome) && !EhBase(name) && !NoCaldeirao(receita)) { return false; } if (jogador.IsRecipeKnown(name)) { return true; } return MateriaisConhecidos(jogador, receita); } private static bool EhBase(string nome) { if (string.IsNullOrEmpty(nome)) { return false; } if (nome.IndexOf("meadbase", StringComparison.OrdinalIgnoreCase) < 0) { return nome.IndexOf("barleywine", StringComparison.OrdinalIgnoreCase) >= 0; } return true; } private static bool NoCaldeirao(Recipe receita) { if ((Object)(object)receita.m_craftingStation == (Object)null) { return false; } string text = ""; if ((Object)(object)((Component)receita.m_craftingStation).gameObject != (Object)null) { text = ((Object)((Component)receita.m_craftingStation).gameObject).name; } if (text != null && text.IndexOf("meadcauldron", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } string name = receita.m_craftingStation.m_name; if (name != null) { return name.IndexOf("meadcauldron", StringComparison.OrdinalIgnoreCase) >= 0; } return false; } private static bool MateriaisConhecidos(Player jogador, Recipe receita) { if (receita.m_resources == null || receita.m_resources.Length == 0) { return true; } bool flag = false; for (int i = 0; i < receita.m_resources.Length; i++) { Requirement val = receita.m_resources[i]; if (val == null || (Object)(object)val.m_resItem == (Object)null || val.m_resItem.m_itemData == null || val.m_resItem.m_itemData.m_shared == null) { continue; } flag = true; bool flag2 = jogador.IsKnownMaterial(val.m_resItem.m_itemData.m_shared.m_name); if (receita.m_requireOnlyOneIngredient) { if (flag2) { return true; } } else if (!flag2) { return false; } } if (flag) { return !receita.m_requireOnlyOneIngredient; } return false; } } [HarmonyPatch(typeof(Player), "HaveRequirementItems")] public static class ItensDaBase { private static bool Prefix(Player __instance, Recipe piece, bool discover, int qualityLevel, ref bool __result) { if (!Plugin.Ativo() || qualityLevel > 1) { return true; } if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer) { return true; } if (!Plugin.BaseConhecida(__instance, piece)) { return true; } __result = true; return false; } } [HarmonyPatch(typeof(InventoryGui), "DoCrafting")] public static class CraftDaBase { private static void Prefix(InventoryGui __instance, Player player) { Plugin.pularCusto = false; if (Plugin.Ativo() && !((Object)(object)player != (Object)(object)Player.m_localPlayer) && !(Plugin.CampoUpgrade == null) && !(Plugin.CampoReceita == null) && Plugin.CampoUpgrade.GetValue(__instance) == null) { object? value = Plugin.CampoReceita.GetValue(__instance); Recipe val = (Recipe)((value is Recipe) ? value : null); if (Plugin.BaseConhecida(player, val)) { Plugin.pularCusto = true; Plugin.Inst.Avisar(val.m_item.m_itemData.m_shared.m_name); } } } private static void Postfix() { Plugin.pularCusto = false; } } [HarmonyPatch(typeof(Player), "ConsumeResources")] public static class NaoGastaBase { private static bool Prefix() { return !Plugin.pularCusto; } }