Decompiled source of AKV 10x Exponential Mod v1.0.0

A.K.V. 10x exponential mod.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RoR2;
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: AssemblyCompany("A.K.V. 10x exponential mod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("A.K.V. 10x exponential mod")]
[assembly: AssemblyTitle("A.K.V. 10x exponential mod")]
[assembly: AssemblyVersion("1.0.0.0")]
[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;
		}
	}
}
namespace ExponentialItemStacks
{
	[BepInPlugin("com.yourname.exponentialitemstacks", "Exponential Item Stacks", "1.0.0")]
	public class ExponentialItemStacksPlugin : BaseUnityPlugin
	{
		public static ManualLogSource logger;

		public void Awake()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			logger = ((BaseUnityPlugin)this).Logger;
			logger.LogInfo((object)"Exponential Item Stacks is loading!");
			CharacterBody.OnInventoryChanged += new hook_OnInventoryChanged(OnInventoryChanged);
			logger.LogInfo((object)"Exponential Item Stacks has loaded successfully!");
		}

		private void OnInventoryChanged(orig_OnInventoryChanged orig, CharacterBody self)
		{
			orig.Invoke(self);
		}

		public void Start()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			logger.LogInfo((object)"Hooking into pickup system...");
			GenericPickupController.OnTriggerStay += new hook_OnTriggerStay(OnPickupTrigger);
		}

		private void OnPickupTrigger(orig_OnTriggerStay orig, GenericPickupController self, Collider collider)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Invalid comparison between Unknown and I4
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody component = ((Component)collider).GetComponent<CharacterBody>();
			if ((Object)(object)component != (Object)null && (Object)(object)component.inventory != (Object)null)
			{
				PickupIndex pickupIndex = self.pickupIndex;
				PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex);
				if (pickupDef != null && (int)pickupDef.itemIndex != -1)
				{
					int itemCountPermanent = component.inventory.GetItemCountPermanent(pickupDef.itemIndex);
					if (itemCountPermanent > 0)
					{
						long num = (long)itemCountPermanent * 10L;
						int num2 = (int)((num > int.MaxValue) ? int.MaxValue : num);
						int num3 = num2 - itemCountPermanent;
						component.inventory.GiveItemPermanent(pickupDef.itemIndex, num3);
						logger.LogInfo((object)$"Decupled item {pickupDef.itemIndex}: {itemCountPermanent} -> {num2}");
						Object.Destroy((Object)(object)((Component)self).gameObject);
						return;
					}
				}
			}
			orig.Invoke(self, collider);
		}
	}
}