Decompiled source of UnlimitedFoundations v1.0.3

UnlimitedFoundations.dll

Decompiled 5 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace UnlimitedFoundations;

[BepInPlugin("com.aekoch.mods.dsp.UnlimitedFoundations", "UnlimitedFoundations", "1.0.3")]
public class Plugin : BaseUnityPlugin
{
	public const string NAME = "UnlimitedFoundations";

	public const string GUID = "com.aekoch.mods.dsp.UnlimitedFoundations";

	public const string VERSION = "1.0.3";

	private static Harmony harmony;

	public static ManualLogSource logger;

	private void Awake()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Expected O, but got Unknown
		logger = ((BaseUnityPlugin)this).Logger;
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin com.aekoch.mods.dsp.UnlimitedFoundations is loaded!");
		harmony = new Harmony("com.aekoch.mods.dsp.UnlimitedFoundations");
		Patch();
		LoadYourResources();
	}

	private void OnDestroy()
	{
		Unpatch();
		UnloadYourResources();
	}

	private void Patch()
	{
		try
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Patching GetItemCount");
			harmony.PatchAll(typeof(PatchGetItemCount));
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Failed patching GetItemCount. Details: " + ex.ToString()));
		}
		try
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Patching GetSandCount");
			harmony.PatchAll(typeof(PatchGetSandCount));
		}
		catch (Exception ex2)
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Failed patching GetSandCount. Details: " + ex2.ToString()));
		}
	}

	private void Unpatch()
	{
		Harmony obj = harmony;
		if (obj != null)
		{
			obj.UnpatchSelf();
		}
	}

	private void LoadYourResources()
	{
	}

	private void UnloadYourResources()
	{
	}
}
[HarmonyPatch(typeof(StorageComponent), "GetItemCount", new Type[] { typeof(int) })]
internal class PatchGetItemCount
{
	private const int FOUNDATION_ITEM_ID = 1131;

	private static void Postfix(int itemId, ref int __result)
	{
		if (itemId == 1131)
		{
			__result = 1000;
		}
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal class PatchGetSandCount
{
	private static void Postfix(ref long __result)
	{
		__result = 1000000L;
	}
}