Decompiled source of GjallMilk v0.0.1

GjallMilk.dll

Decompiled 20 hours ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using Jotunn;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
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("GjallMilk")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GjallMilk")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("22467b2e-4047-4fcf-a963-7c29d20f66fa")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace GjallMilk;

[BepInPlugin("Meiyoki.GjallMilk", "Gjall Milk", "0.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
internal class GjallMilk : BaseUnityPlugin
{
	private const string pluginGUID = "Meiyoki.GjallMilk";

	private const string pluginName = "Gjall Milk";

	private const string pluginVersion = "0.0.1";

	public static CustomLocalization Localization = LocalizationManager.Instance.GetLocalization();

	private void Awake()
	{
		AddLocalizations();
		CreatureManager.OnVanillaCreaturesAvailable += ModifyAndCloneVanillaCreatures;
	}

	private void AddLocalizations()
	{
		CustomLocalization localization = Localization;
		string text = "English";
		localization.AddTranslation(ref text, new Dictionary<string, string>
		{
			{ "item_gjallmilk", "Nutritious Gjall Milk" },
			{ "item_gjallmilk_desc", "It's milk... from a Gjall... of concerning origin but good for the body" }
		});
	}

	private void ModifyAndCloneVanillaCreatures()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Expected O, but got Unknown
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Expected O, but got Unknown
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Expected O, but got Unknown
		ItemConfig val = new ItemConfig();
		val.Name = "$item_gjallmilk";
		val.Description = "$item_gjallmilk_desc";
		val.Enabled = false;
		CustomItem val2 = new CustomItem("GjallMilk", "MeadHealthLingering", val);
		SE_Stats val3 = (SE_Stats)val2.ItemDrop.m_itemData.m_shared.m_consumeStatusEffect;
		((StatusEffect)val3).m_name = "Nutritious Gjall Milk";
		((StatusEffect)val3).m_cooldown = 150f;
		val3.m_healthRegenMultiplier = 2f;
		val3.m_healthUpFront = 50f;
		val3.m_healthOverTime = 300f;
		val3.m_healthOverTimeDuration = 150f;
		ItemManager.Instance.AddItem(val2);
		if ((Object)(object)PrefabManager.Instance.GetPrefab("GjallMilk") == (Object)null)
		{
			Logger.LogError((object)"No Prefab post create");
		}
		if (ItemManager.Instance.GetItem("GjallMilk") == null)
		{
			Logger.LogError((object)"No Item post create");
		}
		GameObject creaturePrefab = CreatureManager.Instance.GetCreaturePrefab("Gjall");
		CharacterDrop component = creaturePrefab.GetComponent<CharacterDrop>();
		Drop val4 = new Drop();
		if ((Object)(object)PrefabManager.Instance.GetPrefab("GjallMilk") == (Object)null)
		{
			Logger.LogError((object)"We lost the milk");
		}
		val4.m_prefab = PrefabManager.Instance.GetPrefab("GjallMilk");
		val4.m_chance = 0.05f;
		component.m_drops.Add(val4);
		CreatureManager.OnVanillaCreaturesAvailable -= ModifyAndCloneVanillaCreatures;
	}
}