Decompiled source of CollectiveEliteTweak v1.0.1

plugins/CollectiveEliteTweak/CollectiveEliteTweak.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 BepInEx.Logging;
using HG.Reflection;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CollectiveEliteTweak")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+e1c80ae76ad7bb185ce716db61831fe9ac35c3ae")]
[assembly: AssemblyProduct("CollectiveEliteTweak")]
[assembly: AssemblyTitle("CollectiveEliteTweak")]
[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 CollectiveEliteTweak
{
	internal static class Log
	{
		internal static ManualLogSource _logSource;

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

		private static string getLogPrefix(string callerPath, string callerMemberName, int callerLineNumber)
		{
			int num = callerPath.LastIndexOf("CollectiveEliteTweak");
			if (num >= 0)
			{
				callerPath = callerPath.Substring(num + "CollectiveEliteTweak".Length + 1);
			}
			return $"{callerPath}:{callerLineNumber} ({callerMemberName}) ";
		}

		internal static void Error(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogError((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

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

		internal static void Fatal(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogFatal((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

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

		internal static void Info(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogInfo((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

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

		internal static void Message(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogMessage((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

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

		internal static void Warning(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogWarning((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Warning_NoCallerPrefix(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInPlugin("Nuxlar.CollectiveEliteTweak", "CollectiveEliteTweak", "1.0.1")]
	public class Main : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_Awake <>9__12_0;

			internal void <Awake>b__12_0(orig_Awake orig, AffixCollectiveAttachmentBehaviour self)
			{
				orig.Invoke(self);
				((Component)self).gameObject.AddComponent<NuxNoShieldinator>();
			}
		}

		public const string PluginGUID = "Nuxlar.CollectiveEliteTweak";

		public const string PluginAuthor = "Nuxlar";

		public const string PluginName = "CollectiveEliteTweak";

		public const string PluginVersion = "1.0.1";

		internal static Main Instance { get; private set; }

		public static string PluginDirectory { get; private set; }

		public void Awake()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			Instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			object obj = <>c.<>9__12_0;
			if (obj == null)
			{
				hook_Awake val = delegate(orig_Awake orig, AffixCollectiveAttachmentBehaviour self)
				{
					orig.Invoke(self);
					((Component)self).gameObject.AddComponent<NuxNoShieldinator>();
				};
				<>c.<>9__12_0 = val;
				obj = (object)val;
			}
			AffixCollectiveAttachmentBehaviour.Awake += (hook_Awake)obj;
		}
	}
	public class NuxNoShieldinator : MonoBehaviour
	{
		private float stopwatch;

		private float uptime = 10f;

		private float downtime = 5f;

		private bool shieldActive = true;

		private AffixCollectiveAttachmentBehaviour affixBehavior;

		private void Start()
		{
			affixBehavior = ((Component)this).GetComponent<AffixCollectiveAttachmentBehaviour>();
			if ((Object)(object)affixBehavior == (Object)null)
			{
				Log.Error("AffixCollectiveAttachmentBehaviour not found!", "C:\\Users\\romym\\OneDrive\\Desktop\\RoR2Mods\\CollectiveEliteTweak\\CollectiveEliteTweak\\NuxNoShieldinator.cs", "Start", 19);
				Object.Destroy((Object)(object)this);
			}
		}

		private void FixedUpdate()
		{
			stopwatch += Time.fixedDeltaTime;
			if (!Object.op_Implicit((Object)(object)affixBehavior))
			{
				Object.Destroy((Object)(object)this);
			}
			if (shieldActive && stopwatch >= uptime)
			{
				affixBehavior.radius = 0f;
				affixBehavior.visualsRoot.SetActive(false);
				shieldActive = false;
				stopwatch = 0f;
			}
			else if (!shieldActive && stopwatch >= downtime)
			{
				affixBehavior.radius = 30f;
				affixBehavior.visualsRoot.SetActive(true);
				shieldActive = true;
				stopwatch = 0f;
			}
		}
	}
}