Decompiled source of EquiBoomModFIXED v2.0.0

EQUIBOOMCOMPILE.dll

Decompiled 3 months 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 Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using R2API.Utils;
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("Equiboom")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Equiboom")]
[assembly: AssemblyTitle("Equiboom")]
[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;
		}
	}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.yourname.equiboommod", "EquiBoom Mod", "1.0.0")]
[R2APISubmoduleDependency(new string[] { "ItemAPI", "LanguageAPI" })]
public class EQUIBOOMMod : BaseUnityPlugin
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_Update <>9__3_0;

		internal void <AddEQUIBOOMItemHooks>b__3_0(orig_Update orig, EquipmentSlot self)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (!Object.op_Implicit((Object)(object)self.characterBody) || !Object.op_Implicit((Object)(object)self.characterBody.inventory))
			{
				return;
			}
			int itemCount = self.characterBody.inventory.GetItemCount(EQUIBOOMItem);
			if (itemCount > 0 && Random.value <= 0.05f + 0.01f * (float)itemCount)
			{
				EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(self.equipmentIndex);
				if ((Object)(object)equipmentDef != (Object)null)
				{
					equipmentDef.cooldown = 0f;
					self.PerformEquipmentAction(equipmentDef);
				}
			}
		}
	}

	public static ItemDef EQUIBOOMItem;

	public void Awake()
	{
		CreateEQUIBOOMItem();
		AddEQUIBOOMItemHooks();
	}

	private void CreateEQUIBOOMItem()
	{
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Expected O, but got Unknown
		EQUIBOOMItem = ScriptableObject.CreateInstance<ItemDef>();
		((Object)EQUIBOOMItem).name = "EQUIBOOM";
		EQUIBOOMItem.nameToken = "EQUIBOOM_NAME";
		EQUIBOOMItem.pickupToken = "EQUIBOOM_PICKUP";
		EQUIBOOMItem.descriptionToken = "EQUIBOOM_DESCRIPTION";
		EQUIBOOMItem.loreToken = "EQUIBOOM_LORE";
		EQUIBOOMItem.deprecatedTier = (ItemTier)0;
		EQUIBOOMItem.tags = (ItemTag[])(object)new ItemTag[2]
		{
			(ItemTag)3,
			(ItemTag)10
		};
		ItemAPI.Add(new CustomItem(EQUIBOOMItem, (ItemDisplayRule[])(object)new ItemDisplayRule[0]));
		LanguageAPI.Add("EQUIBOOM_NAME", "EquiBoom");
		LanguageAPI.Add("EQUIBOOM_PICKUP", "5% chance to activate your equipment (+1% per stack).");
		LanguageAPI.Add("EQUIBOOM_DESCRIPTION", "Grants a 5% chance to activate the effect of your equipped equipment (+1% for each stack).");
		LanguageAPI.Add("EQUIBOOM_LORE", "A rare artifact of unknown origin. Equilibrium energy flows through it.");
	}

	private void AddEQUIBOOMItemHooks()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		object obj = <>c.<>9__3_0;
		if (obj == null)
		{
			hook_Update val = delegate(orig_Update orig, EquipmentSlot self)
			{
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				if (Object.op_Implicit((Object)(object)self.characterBody) && Object.op_Implicit((Object)(object)self.characterBody.inventory))
				{
					int itemCount = self.characterBody.inventory.GetItemCount(EQUIBOOMItem);
					if (itemCount > 0 && Random.value <= 0.05f + 0.01f * (float)itemCount)
					{
						EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(self.equipmentIndex);
						if ((Object)(object)equipmentDef != (Object)null)
						{
							equipmentDef.cooldown = 0f;
							self.PerformEquipmentAction(equipmentDef);
						}
					}
				}
			};
			<>c.<>9__3_0 = val;
			obj = (object)val;
		}
		EquipmentSlot.Update += (hook_Update)obj;
	}
}