Decompiled source of Collapse Tuning v1.0.0

CollapseTuning.dll

Decompiled 4 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API.Utils;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("CollapseTuning")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CollapseTuning")]
[assembly: AssemblyTitle("CollapseTuning")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CollapseTuning
{
	[BepInPlugin("kft.r2.collapsetuning", "Collapse Tuning", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_TakeDamage <>9__1_0;

			internal void <Awake>b__1_0(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Invalid comparison between Unknown and I4
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Invalid comparison between Unknown and I4
				if ((int)self.body.teamComponent.teamIndex == 1 && (int)damageInfo.dotIndex == 8)
				{
					damageInfo.damage *= collapseDamage.Value;
				}
				orig.Invoke(self, damageInfo);
			}
		}

		private static ConfigEntry<float> collapseDamage;

		private void Awake()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			collapseDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Collapse", "Damage Multiplier", 0.5f, "Affects incoming collapse damage");
			if (Chainloader.PluginInfos.TryGetValue("com.rune580.riskofoptions", out var _))
			{
				ConfigureOptionsMenu();
			}
			object obj = <>c.<>9__1_0;
			if (obj == null)
			{
				hook_TakeDamage val = delegate(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
				{
					//IL_000b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0011: Invalid comparison between Unknown and I4
					//IL_0014: Unknown result type (might be due to invalid IL or missing references)
					//IL_001a: Invalid comparison between Unknown and I4
					if ((int)self.body.teamComponent.teamIndex == 1 && (int)damageInfo.dotIndex == 8)
					{
						damageInfo.damage *= collapseDamage.Value;
					}
					orig.Invoke(self, damageInfo);
				};
				<>c.<>9__1_0 = val;
				obj = (object)val;
			}
			HealthComponent.TakeDamage += (hook_TakeDamage)obj;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded successfully!");
		}

		private void ConfigureOptionsMenu()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(collapseDamage, new StepSliderConfig
			{
				min = 0f,
				max = 2f,
				increment = 0.1f
			}));
		}
	}
}