Decompiled source of FalseSonFairLaser v1.0.0

FalseSonFairLaser.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.Logging;
using EntityStates;
using EntityStates.FalseSonBoss;
using EntityStates.PrimeMeridian;
using Microsoft.CodeAnalysis;
using On.EntityStates.FalseSonBoss;
using On.EntityStates.PrimeMeridian;
using On.RoR2;
using R2API;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("FalseSonFairLaser")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+13c01a9cea7b6132f8b17e3ea6580d9b3ad0d58b")]
[assembly: AssemblyProduct("FalseSonFairLaser")]
[assembly: AssemblyTitle("FalseSonFairLaser")]
[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 FalseSonFairLaser
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Jeffdev.FalseSonFairLaser", "FalseSonFairLaser", "1.0.0")]
	public class FalseSonFairLaser : BaseUnityPlugin
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_OnEnter <0>__LunarGazeHoldLeap_OnEnter;

			public static hook_OnEnter <1>__LunarGazeLaserEnd_OnEnter;
		}

		public const string PluginGUID = "Jeffdev.FalseSonFairLaser";

		public const string PluginAuthor = "Jeffdev";

		public const string PluginName = "FalseSonFairLaser";

		public const string PluginVersion = "1.0.0";

		public static BuffDef WaitForLaser = ScriptableObject.CreateInstance<BuffDef>();

		public void Awake()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Expected O, but got Unknown
			//IL_00b1: 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)
			//IL_00bc: Expected O, but got Unknown
			Log.Init(((BaseUnityPlugin)this).Logger);
			((Object)WaitForLaser).name = "dtWaitForLaser";
			WaitForLaser.buffColor = Color.black;
			WaitForLaser.canStack = false;
			WaitForLaser.isDebuff = true;
			WaitForLaser.isCooldown = false;
			WaitForLaser.isHidden = true;
			WaitForLaser.iconSprite = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/Common/bdSlow50.asset").WaitForCompletion().iconSprite;
			ContentAddition.AddBuffDef(WaitForLaser);
			object obj = <>O.<0>__LunarGazeHoldLeap_OnEnter;
			if (obj == null)
			{
				hook_OnEnter val = LunarGazeHoldLeap_OnEnter;
				<>O.<0>__LunarGazeHoldLeap_OnEnter = val;
				obj = (object)val;
			}
			LunarGazeHoldLeap.OnEnter += (hook_OnEnter)obj;
			object obj2 = <>O.<1>__LunarGazeLaserEnd_OnEnter;
			if (obj2 == null)
			{
				hook_OnEnter val2 = LunarGazeLaserEnd_OnEnter;
				<>O.<1>__LunarGazeLaserEnd_OnEnter = val2;
				obj2 = (object)val2;
			}
			LunarGazeLaserEnd.OnEnter += (hook_OnEnter)obj2;
			CharacterBody.RecalculateStats += new hook_RecalculateStats(CharacterBody_RecalculateStats);
		}

		private void CharacterBody_RecalculateStats(orig_RecalculateStats orig, CharacterBody self)
		{
			if (self.HasBuff(WaitForLaser))
			{
				self.moveSpeed = 0f;
				self.armor = 2000f;
			}
			orig.Invoke(self);
			if (self.HasBuff(WaitForLaser))
			{
				self.moveSpeed = 0f;
				self.armor = 2000f;
			}
		}

		private static void LunarGazeHoldLeap_OnEnter(orig_OnEnter orig, LunarGazeHoldLeap self)
		{
			orig.Invoke(self);
			Log.Debug("Added Debuff to False Son!");
			((EntityState)self).characterBody.AddBuff(WaitForLaser);
		}

		private static void LunarGazeLaserEnd_OnEnter(orig_OnEnter orig, LunarGazeLaserEnd self)
		{
			orig.Invoke(self);
			foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList)
			{
				if (Object.op_Implicit((Object)(object)readOnlyInstances) && ((Object)readOnlyInstances).name.Contains("FalseSonBoss") && readOnlyInstances.HasBuff(WaitForLaser))
				{
					readOnlyInstances.RemoveBuff(WaitForLaser);
					Debug.Log((object)"Removed Debuff from False Son!");
				}
			}
		}
	}
	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);
		}
	}
}