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 TudoLiberado v1.0.0
TudoLiberado.dll
Decompiled a day agousing System; using System.Collections.Generic; 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 TudoLiberado; [BepInPlugin("yuri.TudoLiberado", "Tudo Liberado", "1.0.0")] public class Plugin : BaseUnityPlugin { [HarmonyPatch(typeof(Player), "UpdateKnownRecipesList")] private static class AoConhecer { private static void Prefix(Player __instance, HashSet<string> ___m_knownRecipes, Dictionary<string, int> ___m_knownStations, HashSet<string> ___m_knownMaterial, PieceTable ___m_buildPieces) { if (Ativo(__instance)) { Preparar(___m_knownRecipes, ___m_knownStations, ___m_knownMaterial, ___m_buildPieces); } } } [HarmonyPatch(typeof(Player), "HaveRequirements", new Type[] { typeof(Piece), typeof(RequirementMode) })] private static class PecaConhecida { private static void Postfix(Player __instance, RequirementMode mode, ref bool __result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 if ((int)mode == 1 && Ativo(__instance)) { __result = true; } } } [HarmonyPatch(typeof(Player), "RequiredCraftingStation")] private static class MesaAlcanca { private static void Postfix(Player __instance, Recipe recipe, int qualityLevel, ref bool __result) { if (__result || (Object)(object)recipe == (Object)null || !Ativo(__instance)) { return; } CraftingStation requiredStation = recipe.GetRequiredStation(qualityLevel); if ((Object)(object)requiredStation == (Object)null) { __result = true; return; } CraftingStation currentCraftingStation = __instance.GetCurrentCraftingStation(); if ((Object)(object)currentCraftingStation != (Object)null && currentCraftingStation.m_name == requiredStation.m_name) { __result = true; } } } [HarmonyPatch(typeof(Player), "GetAvailableRecipes")] private static class Cardapio { private static void Postfix(Player __instance, List<Recipe> available) { if (available == null || !Ativo(__instance)) { return; } ObjectDB instance = ObjectDB.instance; if ((Object)(object)instance == (Object)null || instance.m_recipes == null) { return; } for (int i = 0; i < instance.m_recipes.Count; i++) { Recipe val = instance.m_recipes[i]; if (!(NomeReceita(val) == "") && !available.Contains(val) && __instance.RequiredCraftingStation(val, 1, true)) { available.Add(val); } } } } public static Plugin Inst; private ConfigEntry<bool> Ligado; private static List<string> receitas; private static List<string> pecas; private static List<string> estacoes; private static List<string> materiais; private void Awake() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) Inst = this; Ligado = ((BaseUnityPlugin)this).Config.Bind<bool>("Geral", "Ligado", true, "Libera receita, peça e estação de uma vez. So no seu jogo."); new Harmony("yuri.TudoLiberado").PatchAll(typeof(Plugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Tudo Liberado 1.0.0"); } public static bool Ativo(Player jogador) { if ((Object)(object)Inst == (Object)null || !Inst.Ligado.Value) { return false; } return (Object)(object)jogador != (Object)null && (Object)(object)jogador == (Object)(object)Player.m_localPlayer; } public static void Preparar(HashSet<string> conhecidas, Dictionary<string, int> estacoesConhecidas, HashSet<string> materiaisConhecidos, PieceTable martelo) { if (conhecidas == null || !ListaPronta()) { return; } for (int i = 0; i < receitas.Count; i++) { conhecidas.Add(receitas[i]); } for (int i = 0; i < pecas.Count; i++) { conhecidas.Add(pecas[i]); } if ((Object)(object)martelo != (Object)null) { GuardarPecas(martelo, pecas); } for (int i = 0; i < pecas.Count; i++) { conhecidas.Add(pecas[i]); } if (materiaisConhecidos != null) { for (int i = 0; i < materiais.Count; i++) { materiaisConhecidos.Add(materiais[i]); } } if (estacoesConhecidas != null) { for (int i = 0; i < estacoes.Count; i++) { estacoesConhecidas[estacoes[i]] = 100; } } } private static bool ListaPronta() { if (receitas != null) { return true; } ObjectDB instance = ObjectDB.instance; ZNetScene instance2 = ZNetScene.instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance2 == (Object)null || instance.m_recipes == null || instance2.m_prefabs == null) { return false; } receitas = new List<string>(); pecas = new List<string>(); estacoes = new List<string>(); materiais = new List<string>(); for (int i = 0; i < instance.m_recipes.Count; i++) { Recipe receita = instance.m_recipes[i]; string text = NomeReceita(receita); if (text != "") { receitas.Add(text); } } if (instance.m_items != null) { for (int i = 0; i < instance.m_items.Count; i++) { OlharObjeto(instance.m_items[i]); } } for (int i = 0; i < instance2.m_prefabs.Count; i++) { OlharObjeto(instance2.m_prefabs[i]); } return true; } private static void OlharObjeto(GameObject go) { if ((Object)(object)go == (Object)null) { return; } ItemDrop component = go.GetComponent<ItemDrop>(); if ((Object)(object)component != (Object)null && component.m_itemData != null && component.m_itemData.m_shared != null) { string name = component.m_itemData.m_shared.m_name; if (name != null && name != "" && DlcOk(component.m_itemData.m_shared.m_dlc)) { materiais.Add(name); } } CraftingStation val = go.GetComponent<CraftingStation>(); if ((Object)(object)val == (Object)null) { val = go.GetComponentInChildren<CraftingStation>(); } if ((Object)(object)val != (Object)null && val.m_name != null && val.m_name != "" && !estacoes.Contains(val.m_name)) { estacoes.Add(val.m_name); } PieceTable val2 = go.GetComponent<PieceTable>(); if ((Object)(object)val2 == (Object)null) { val2 = go.GetComponentInChildren<PieceTable>(); } GuardarPecas(val2, pecas); } private static void GuardarPecas(PieceTable tabela, List<string> destino) { if ((Object)(object)tabela == (Object)null || tabela.m_pieces == null || destino == null) { return; } for (int i = 0; i < tabela.m_pieces.Count; i++) { GameObject val = tabela.m_pieces[i]; if (!((Object)(object)val == (Object)null)) { Piece component = val.GetComponent<Piece>(); if (!((Object)(object)component == (Object)null) && component.m_name != null && !(component.m_name == "") && component.m_enabled && DlcOk(component.m_dlc) && !destino.Contains(component.m_name)) { destino.Add(component.m_name); } } } } public static string NomeReceita(Recipe receita) { if ((Object)(object)receita == (Object)null || (Object)(object)receita.m_item == (Object)null || receita.m_item.m_itemData == null || receita.m_item.m_itemData.m_shared == null) { return ""; } if (!DlcOk(receita.m_item.m_itemData.m_shared.m_dlc)) { return ""; } string name = receita.m_item.m_itemData.m_shared.m_name; if (name == null) { return ""; } return name; } public static bool DlcOk(string dlc) { if (dlc == null || dlc == "") { return true; } if ((Object)(object)DLCMan.instance == (Object)null) { return true; } return DLCMan.instance.IsDLCInstalled(dlc); } }