Decompiled source of CollapseNerf v1.0.2

plugins/CollapseNerf/CollapseNerf.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.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
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("CollapseNerf")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+a7187f56b1d867706d9cfc3a6158cce59b43cb3c")]
[assembly: AssemblyProduct("CollapseNerf")]
[assembly: AssemblyTitle("CollapseNerf")]
[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;
		}
	}
}
namespace CollapseNerf
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInPlugin("com.Hex3.CollapseNerf", "CollapseNerf", "1.0.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class Main : BaseUnityPlugin
	{
		public const string COLLAPSENERF_GUID = "com.Hex3.CollapseNerf";

		public const string COLLAPSENERF_NAME = "CollapseNerf";

		public const string COLLAPSENERF_VER = "1.0.2";

		public static Main Instance;

		public void Awake()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0063: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			Log.Init(((BaseUnityPlugin)this).Logger);
			Log.Info("Init CollapseNerf 1.0.2");
			Instance = this;
			Log.Info("Creating hooks...");
			ConfigEntry<float> Collapse_MaxPercent = ((BaseUnityPlugin)Instance).Config.Bind<float>(new ConfigDefinition("Collapse nerf", "Max damage percentage per stack"), 20f, new ConfigDescription("Max percentage of an ally's health that a single stack of collapse can deal. Must be above 0.", (AcceptableValueBase)null, Array.Empty<object>()));
			DotController.InflictDot_refInflictDotInfo += (hook_InflictDot_refInflictDotInfo)delegate(orig_InflictDot_refInflictDotInfo orig, ref InflictDotInfo self)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Invalid comparison between Unknown and I4
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Invalid comparison between Unknown and I4
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Invalid comparison between Unknown and I4
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Invalid comparison between Unknown and I4
				CharacterBody val = default(CharacterBody);
				CharacterBody val2 = default(CharacterBody);
				if ((int)self.dotIndex == 8 && Object.op_Implicit((Object)(object)self.attackerObject) && self.attackerObject.TryGetComponent<CharacterBody>(ref val) && self.victimObject.TryGetComponent<CharacterBody>(ref val2) && Object.op_Implicit((Object)(object)val2.healthComponent) && Object.op_Implicit((Object)(object)val2.teamComponent) && (int)val2.teamComponent.teamIndex == 1 && Object.op_Implicit((Object)(object)val.teamComponent) && ((int)val.teamComponent.teamIndex == 2 || (int)val.teamComponent.teamIndex == 4) && val.baseDamage > 0f)
				{
					float num = val.damage * 4f;
					float num2 = num / val2.healthComponent.fullCombinedHealth;
					float num3 = Collapse_MaxPercent.Value / 100f;
					float val3 = num3 / num2;
					self.damageMultiplier = Math.Min(1f, val3);
				}
				orig.Invoke(ref self);
			};
			Log.Info("Done");
		}
	}
}