Decompiled source of ShrinkerCart v0.1.0

ShrinkerCart.dll

Decompiled a day 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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("ShrinkerCart")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Bigger the item better the shrink!")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("ShrinkerCart")]
[assembly: AssemblyTitle("ShrinkerCart")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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;
		}
	}
}
namespace ShrinkerCart
{
	[BepInPlugin("Oksamies.ShrinkerCart", "ShrinkerCart", "0.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(PhysGrabCart), "ObjectsInCart")]
		public class AwakePatch
		{
			public static void Postfix(PhysGrabCart __instance)
			{
				//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0120: Unknown result type (might be due to invalid IL or missing references)
				//IL_0134: Unknown result type (might be due to invalid IL or missing references)
				//IL_0139: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)__instance))
				{
					return;
				}
				PhysGrabCart component = ((Component)__instance).GetComponent<PhysGrabCart>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					return;
				}
				foreach (PhysGrabObject item in ((Component)__instance).GetComponent<PhysGrabCart>().itemsInCart)
				{
					float num = 0.81f;
					if (item.massOriginal > 1f)
					{
						num = 0.66f;
					}
					if ((double)item.massOriginal > 1.5)
					{
						num = 0.56f;
					}
					if (item.massOriginal > 2f)
					{
						num = 0.41f;
					}
					if ((double)item.massOriginal > 2.5)
					{
						num = 0.31f;
					}
					if (item.massOriginal > 3f)
					{
						num = 0.11f;
					}
					if (((Component)item.rb).transform.localScale.y > num)
					{
						((Component)item.rb).transform.localScale = ((Component)item.rb).transform.localScale - new Vector3(0.01f, 0.01f, 0.01f);
					}
				}
			}
		}

		public const string modGUID = "Oksamies.ShrinkerCart";

		public const string modName = "ShrinkerCart";

		public const string modVersion = "0.1.0";

		private readonly Harmony harmony = new Harmony("Oksamies.ShrinkerCart");

		public static ManualLogSource mls;

		private void Awake()
		{
			mls = Logger.CreateLogSource("Oksamies.ShrinkerCart");
			mls.LogInfo((object)"Oksamies.ShrinkerCart is now awake!");
			harmony.PatchAll();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ShrinkerCart";

		public const string PLUGIN_NAME = "ShrinkerCart";

		public const string PLUGIN_VERSION = "0.1.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}