Decompiled source of HaulerNoLimit v1.0.0

ScoutUnlimitedStorage.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("ScoutUnlimitedStorage")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ScoutUnlimitedStorage")]
[assembly: AssemblyTitle("ScoutUnlimitedStorage")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[BepInPlugin("repo.hauler.unlimited", "Hauler Unlimited Storage", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Expected O, but got Unknown
		Harmony val = new Harmony("repo.hauler.unlimited");
		MethodInfo methodInfo = AccessTools.Method(Assembly.Load("Assembly-CSharp").GetType("ItemValuableBox"), "OnObjectsFound", (Type[])null, (Type[])null);
		val.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(Plugin).GetMethod("Prefix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Unlimited Hauler Loaded");
	}

	public static bool Prefix(object __instance, List<object> foundObjects)
	{
		Type type = __instance.GetType();
		object value = AccessTools.Field(type, "validObjectsInBox").GetValue(__instance);
		object value2 = AccessTools.Field(type, "tooBigOffenders").GetValue(__instance);
		object value3 = AccessTools.Field(type, "tooFullOffenders").GetValue(__instance);
		value2.GetType().GetMethod("Clear").Invoke(value2, null);
		value3.GetType().GetMethod("Clear").Invoke(value3, null);
		value.GetType().GetMethod("Clear").Invoke(value, null);
		MethodInfo method = value.GetType().GetMethod("Add");
		foreach (object foundObject in foundObjects)
		{
			method.Invoke(value, new object[1] { foundObject });
		}
		AccessTools.Field(type, "valueLimit").SetValue(__instance, 1E+09f);
		return false;
	}
}