Please disclose if your mod was created primarily 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 FrancesinhaMod v1.0.0
FrancesinhaMod.dll
Decompiled a year agousing System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("FrancesinhaMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("FrancesinhaMod")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3cd36911-399d-4b50-8b86-e38289ab914c")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("com.zaraaraz.francesinhamod", "Francesinha Mod", "1.0.0")] public class FrancesinhaMod : BaseUnityPlugin { private void Awake() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"Francesinha Mod carregado!"); Harmony val = new Harmony("com.zaraaraz.francesinhamod"); val.PatchAll(); ((MonoBehaviour)this).InvokeRepeating("TryAddFrancesinha", 0f, 2f); } private void TryAddFrancesinha() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { AddFrancesinha(localPlayer); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Player não encontrado, tentando novamente..."); } } private Sprite LoadSprite(string filePath, bool isBump = false) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) if (!File.Exists(filePath)) { ((BaseUnityPlugin)this).Logger.LogError((object)("Imagem não encontrada: " + filePath)); return null; } byte[] array = File.ReadAllBytes(filePath); Texture2D val = new Texture2D(2, 2, (TextureFormat)5, true, isBump); if (ImageConversion.LoadImage(val, array)) { ((Texture)val).filterMode = (FilterMode)1; return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } ((BaseUnityPlugin)this).Logger.LogError((object)"Falha ao carregar a textura."); return null; } private void AddFrancesinha(Player player) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("CookedMeat"); if ((Object)(object)itemPrefab == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"CookedMeat prefab não encontrado!"); return; } GameObject val = Object.Instantiate<GameObject>(itemPrefab); ((Object)val).name = "Francesinha"; ItemDrop component = val.GetComponent<ItemDrop>(); if ((Object)(object)component == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"ItemDrop não encontrado!"); return; } ItemData itemData = component.m_itemData; itemData.m_shared.m_name = "$francesinha"; itemData.m_shared.m_description = "Uma deliciosa Francesinha, come que ate te babas."; itemData.m_shared.m_food = 500f; itemData.m_shared.m_foodStamina = 999f; itemData.m_shared.m_foodRegen = 500f; itemData.m_shared.m_foodBurnTime = 3600f; itemData.m_shared.m_value = 1; itemData.m_shared.m_weight = 0f; string filePath = Path.Combine(Paths.PluginPath, "francesinha.png"); Sprite val2 = LoadSprite(filePath); if ((Object)(object)val2 != (Object)null) { itemData.m_shared.m_icons = (Sprite[])(object)new Sprite[1] { val2 }; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Ícone da Francesinha carregado com sucesso!"); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Usando ícone padrão."); } ((Humanoid)player).GetInventory().AddItem(val, 100); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Francesinha adicionada ao inventário do jogador!"); ((MonoBehaviour)this).CancelInvoke("TryAddFrancesinha"); } }