Decompiled source of GoblinJerky v1.0.0

GoblinJerky2026.dll

Decompiled 3 hours ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
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("GoblinJerky2026")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GoblinJerky2026")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8f016164-de7e-4278-8885-55e81a2dab8f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace GoblinJerkyMod;

[BepInPlugin("com.yourname.goblinjerky", "Goblin Jerky", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class GoblinJerkyPlugin : BaseUnityPlugin
{
	private static readonly Color MeshTint = Color32.op_Implicit(new Color32((byte)128, (byte)134, (byte)68, byte.MaxValue));

	private void Awake()
	{
		PrefabManager.OnVanillaPrefabsAvailable += AddJerky;
	}

	private void AddJerky()
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Expected O, but got Unknown
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Expected O, but got Unknown
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Expected O, but got Unknown
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Expected O, but got Unknown
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		PrefabManager.OnVanillaPrefabsAvailable -= AddJerky;
		ItemConfig val = new ItemConfig();
		val.Name = "Goblin Jerky";
		val.Description = "Chopped up into little pieces for a decent meal.";
		val.CraftingStation = CraftingStations.Cauldron;
		val.MinStationLevel = 4;
		val.Amount = 2;
		val.Requirements = (RequirementConfig[])(object)new RequirementConfig[2]
		{
			new RequirementConfig("TrophyGoblin", 1, 0, true),
			new RequirementConfig("Honey", 1, 0, true)
		};
		ItemConfig val2 = val;
		CustomItem val3 = new CustomItem("GoblinJerky", "BoarJerky", val2);
		SharedData shared = Cache.GetPrefab<ItemDrop>("CookedLoxMeat").m_itemData.m_shared;
		SharedData shared2 = val3.ItemDrop.m_itemData.m_shared;
		shared2.m_food = shared.m_food;
		shared2.m_foodStamina = shared.m_foodStamina;
		shared2.m_foodEitr = shared.m_foodEitr;
		shared2.m_foodBurnTime = shared.m_foodBurnTime;
		shared2.m_foodRegen = shared.m_foodRegen;
		Renderer[] componentsInChildren = val3.ItemPrefab.GetComponentsInChildren<Renderer>(true);
		foreach (Renderer val4 in componentsInChildren)
		{
			Material[] materials = val4.materials;
			Material[] array = materials;
			foreach (Material val5 in array)
			{
				val5.color = MeshTint;
			}
			val4.materials = materials;
		}
		string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "GoblinJerky.png");
		if (File.Exists(text))
		{
			shared2.m_icons = (Sprite[])(object)new Sprite[1] { AssetUtils.LoadSpriteFromFile(text) };
		}
		else
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)("GoblinJerky.png not found at " + text + ", using the boar jerky icon."));
		}
		ItemManager.Instance.AddItem(val3);
	}
}