Decompiled source of Abundance v1.1.1

plugins/abundance-aeruta.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppSystem;
using Microsoft.CodeAnalysis;
using UnityEngine;
using abundance_aeruta;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Ryocery")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Abundance mod for Aeruta")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.1+589e6a9732705b80f323e29fbfd1537343b20b73")]
[assembly: AssemblyProduct("abundance-aeruta")]
[assembly: AssemblyTitle("abundance-aeruta")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[HarmonyPatch(typeof(Inventory), "AddItem")]
public class InventoryPatch
{
	private static void Prefix(ItemStack newItem, bool dontShowNotice)
	{
		//IL_0240: Unknown result type (might be due to invalid IL or missing references)
		//IL_0247: Expected O, but got Unknown
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Invalid comparison between Unknown and I4
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Expected O, but got Unknown
		//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bf: Expected O, but got Unknown
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Expected O, but got Unknown
		//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_015e: Expected O, but got Unknown
		if ((Object)(object)newItem.Base == (Object)null)
		{
			return;
		}
		bool flag = default(bool);
		try
		{
			uint id = newItem.Base.Id;
			eItemType itemType = newItem.Base.ItemType;
			int amount = newItem.Amount;
			uint num = id;
			BepInExInfoLogInterpolatedStringHandler val;
			if (num != 0)
			{
				if (num != 3 || !Abundance.EnableWoodMultiplier.Value)
				{
					goto IL_0124;
				}
				newItem.Amount = (int)((float)amount * Abundance.WoodMultiplier.Value);
				ManualLogSource log = Abundance.Log;
				val = new BepInExInfoLogInterpolatedStringHandler(21, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Wood multiplied: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(amount);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" -> ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(newItem.Amount);
				}
				log.LogInfo(val);
			}
			else
			{
				if (!Abundance.EnableMoneyMultiplier.Value)
				{
					goto IL_0124;
				}
				newItem.Amount = (int)((float)amount * Abundance.MoneyMultiplier.Value);
				ManualLogSource log2 = Abundance.Log;
				val = new BepInExInfoLogInterpolatedStringHandler(22, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Money multiplied: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(amount);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" -> ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(newItem.Amount);
				}
				log2.LogInfo(val);
			}
			goto IL_01ac;
			IL_01ac:
			ManualLogSource log3 = Abundance.Log;
			val = new BepInExInfoLogInterpolatedStringHandler(38, 4, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Adding item ID=");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(id);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", Type=");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<eItemType>(itemType);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", Amount=");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(newItem.Amount);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", Name=");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)newItem.Base.Name).ToString());
			}
			log3.LogInfo(val);
			return;
			IL_0124:
			if ((int)itemType == 1 && Abundance.EnableMaterialMultiplier.Value)
			{
				newItem.Amount = (int)((float)amount * Abundance.MaterialMultiplier.Value);
				ManualLogSource log4 = Abundance.Log;
				val = new BepInExInfoLogInterpolatedStringHandler(31, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Material multiplied (ID=");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(id);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("): ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(amount);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" -> ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(newItem.Amount);
				}
				log4.LogInfo(val);
			}
			goto IL_01ac;
		}
		catch (Exception ex)
		{
			ManualLogSource log5 = Abundance.Log;
			BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(16, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Error in patch: ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
			}
			log5.LogError(val2);
		}
	}
}
namespace abundance_aeruta
{
	[BepInPlugin("com.ryocery.abundance_aeruta", "Abundance", "1.1.1")]
	public class Abundance : BasePlugin
	{
		private const string Guid = "com.ryocery.abundance_aeruta";

		private const string Name = "Abundance";

		private const string Version = "1.1.1";

		private static Harmony _harmony;

		public const uint MoneyItemID = 0u;

		public const uint WoodItemID = 3u;

		internal static ManualLogSource Log { get; private set; }

		internal static ConfigEntry<bool> EnableMoneyMultiplier { get; private set; }

		internal static ConfigEntry<float> MoneyMultiplier { get; private set; }

		internal static ConfigEntry<bool> EnableMaterialMultiplier { get; private set; }

		internal static ConfigEntry<float> MaterialMultiplier { get; private set; }

		internal static ConfigEntry<bool> EnableWoodMultiplier { get; private set; }

		internal static ConfigEntry<float> WoodMultiplier { get; private set; }

		public override void Load()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Expected O, but got Unknown
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Expected O, but got Unknown
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Expected O, but got Unknown
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Expected O, but got Unknown
			Log = ((BasePlugin)this).Log;
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(21, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("com.ryocery.abundance_aeruta");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loading...");
			}
			log.LogInfo(val);
			EnableMoneyMultiplier = ((BasePlugin)this).Config.Bind<bool>("Money Settings", "EnableMoneyMultiplier", true, "Enable money multiplier");
			MoneyMultiplier = ((BasePlugin)this).Config.Bind<float>("Money Settings", "MoneyMultiplier", 2f, "Money multiplier amount (e.g., 2.0 = double money)");
			EnableWoodMultiplier = ((BasePlugin)this).Config.Bind<bool>("Wood Settings", "EnableWoodMultiplier", true, "Enable wood multiplier");
			WoodMultiplier = ((BasePlugin)this).Config.Bind<float>("Wood Settings", "WoodMultiplier", 2f, "Wood multiplier amount (e.g., 2.0 = double wood)");
			EnableMaterialMultiplier = ((BasePlugin)this).Config.Bind<bool>("Material Settings", "EnableMaterialMultiplier", true, "Enable material multiplier for monster drops");
			MaterialMultiplier = ((BasePlugin)this).Config.Bind<float>("Material Settings", "MaterialMultiplier", 2f, "Material multiplier amount (e.g., 2.0 = double materials)");
			_harmony = new Harmony("com.ryocery.abundance_aeruta");
			_harmony.PatchAll();
			ManualLogSource log2 = Log;
			val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Money multiplier: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(EnableMoneyMultiplier.Value ? $"{MoneyMultiplier.Value}x" : "Disabled");
			}
			log2.LogInfo(val);
			ManualLogSource log3 = Log;
			val = new BepInExInfoLogInterpolatedStringHandler(21, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Material multiplier: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(EnableMaterialMultiplier.Value ? $"{MaterialMultiplier.Value}x" : "Disabled");
			}
			log3.LogInfo(val);
			ManualLogSource log4 = Log;
			val = new BepInExInfoLogInterpolatedStringHandler(17, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Wood multiplier: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(EnableWoodMultiplier.Value ? $"{WoodMultiplier.Value}x" : "Disabled");
			}
			log4.LogInfo(val);
		}
	}
}