Decompiled source of RiskyFixes v1.3.5

RiskyFixes.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.Bandit2;
using EntityStates.BrotherMonster;
using EntityStates.Chef;
using EntityStates.ClayBoss;
using EntityStates.Croco;
using EntityStates.Halcyonite;
using EntityStates.Huntress.HuntressWeapon;
using EntityStates.Merc;
using EntityStates.Missions.BrotherEncounter;
using EntityStates.Railgunner.Weapon;
using EntityStates.Toolbot;
using IL.EntityStates.Bandit2;
using IL.EntityStates.Bandit2.Weapon;
using IL.EntityStates.Chef;
using IL.EntityStates.ClayBoss;
using IL.EntityStates.Commando.CommandoWeapon;
using IL.EntityStates.Merc;
using IL.EntityStates.Railgunner.Weapon;
using IL.EntityStates.Toolbot;
using IL.EntityStates.Treebot.Weapon;
using IL.RoR2;
using IL.RoR2.CharacterAI;
using Local.Difficulty.Multitudes;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using Multitudes;
using On.EntityStates.BrotherMonster;
using On.EntityStates.Croco;
using On.EntityStates.Halcyonite;
using On.EntityStates.Huntress.HuntressWeapon;
using On.EntityStates.Missions.BrotherEncounter;
using On.EntityStates.Toolbot;
using On.RoR2;
using On.RoR2.Artifacts;
using On.RoR2.UI;
using R2API.Utils;
using RiskyFixes.Fixes;
using RiskyFixes.Fixes.SharedHooks;
using RoR2;
using RoR2.Artifacts;
using RoR2.CharacterAI;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using TPDespair.ZetArtifacts;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[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("RiskyFixes")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+24ba1da5523c2b0fdd36850c04816a5e024e8eb9")]
[assembly: AssemblyProduct("RiskyFixes")]
[assembly: AssemblyTitle("RiskyFixes")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace RiskyFixes
{
	internal static class ModCompat
	{
		public static class RiskOfOptionsCompat
		{
			public static bool pluginLoaded;
		}

		public static class EnigmaBlacklistCompat
		{
			public static bool pluginLoaded;
		}

		public static class MultitudesCompat
		{
			public static bool pluginLoaded;

			public static int GetMultiplier()
			{
				if (!pluginLoaded)
				{
					return 1;
				}
				return GetMultiplierInternal();
			}

			[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
			private static int GetMultiplierInternal()
			{
				return Multitudes.Multiplier;
			}
		}

		public static class ZetArtifactsCompat
		{
			public static class Multifact
			{
				public static int GetMultiplier()
				{
					if (!pluginLoaded)
					{
						return 1;
					}
					return GetMultiplierInternal();
				}

				[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
				private static int GetMultiplierInternal()
				{
					if (ZetMultifact.Enabled && RunArtifactManager.instance.IsArtifactEnabled(Artifacts.ZetMultifact))
					{
						return Mathf.Max(2, ZetArtifactsPlugin.MultifactMultiplier.Value);
					}
					return 1;
				}
			}

			public static bool pluginLoaded;
		}

		public static class MultitudesDifficultyCompat
		{
			public static bool pluginLoaded;

			public static int GetAdditional()
			{
				if (!pluginLoaded)
				{
					return 0;
				}
				return GetAdditionalInternal();
			}

			[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
			private static int GetAdditionalInternal()
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				if (!Setup.forceEnable)
				{
					Run instance = Run.instance;
					if (((instance != null) ? new DifficultyIndex?(instance.selectedDifficulty) : null) != (DifficultyIndex?)Setup.index)
					{
						return 0;
					}
				}
				return (int)Session.additionalPlayers;
			}
		}

		public static class AIBlacklist
		{
			public static bool pluginLoaded;
		}

		internal static void Init()
		{
			RiskOfOptionsCompat.pluginLoaded = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");
			EnigmaBlacklistCompat.pluginLoaded = Chainloader.PluginInfos.ContainsKey("com.Moffein.EnigmaBlacklist");
			MultitudesCompat.pluginLoaded = Chainloader.PluginInfos.ContainsKey("dev.wildbook.multitudes");
			ZetArtifactsCompat.pluginLoaded = Chainloader.PluginInfos.ContainsKey("com.TPDespair.ZetArtifacts");
			AIBlacklist.pluginLoaded = Chainloader.PluginInfos.ContainsKey("com.Moffein.AI_Blacklist");
			MultitudesDifficultyCompat.pluginLoaded = Chainloader.PluginInfos.ContainsKey("local.difficulty.multitudes");
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.Moffein.RiskyFixes", "RiskyFixes", "1.3.5")]
	public class RiskyFixesPlugin : BaseUnityPlugin
	{
		private void Awake()
		{
			ModCompat.Init();
			AddToAssembly();
		}

		private void AddToAssembly()
		{
			IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(FixBase))
				select type;
			foreach (Type item in enumerable)
			{
				FixBase fixBase = (FixBase)Activator.CreateInstance(item);
				fixBase.Init(((BaseUnityPlugin)this).Config);
			}
		}
	}
	public static class SneedUtils
	{
		public static void DumpEntityStateConfig(EntityStateConfiguration esc)
		{
			for (int i = 0; i < esc.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (Object.op_Implicit(esc.serializedFieldsCollection.serializedFields[i].fieldValue.objectValue))
				{
					Debug.Log((object)(esc.serializedFieldsCollection.serializedFields[i].fieldName + " - " + (object)esc.serializedFieldsCollection.serializedFields[i].fieldValue.objectValue));
				}
				else
				{
					Debug.Log((object)(esc.serializedFieldsCollection.serializedFields[i].fieldName + " - " + esc.serializedFieldsCollection.serializedFields[i].fieldValue.stringValue));
				}
			}
		}

		public static void DumpEntityStateConfig(string entityStateName)
		{
			EntityStateConfiguration esc = LegacyResourcesAPI.Load<EntityStateConfiguration>("entitystateconfigurations/" + entityStateName);
			DumpEntityStateConfig(esc);
		}

		public static void DumpAddressableEntityStateConfig(string addressablePath)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			EntityStateConfiguration esc = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)addressablePath).WaitForCompletion();
			DumpEntityStateConfig(esc);
		}

		public static bool SetAddressableEntityStateField(string fullEntityStatePath, string fieldName, string value)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			EntityStateConfiguration val = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)fullEntityStatePath).WaitForCompletion();
			for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName)
				{
					val.serializedFieldsCollection.serializedFields[i].fieldValue.stringValue = value;
					return true;
				}
			}
			return false;
		}

		public static bool SetAddressableEntityStateField(string fullEntityStatePath, string fieldName, Object newObject)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			EntityStateConfiguration val = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)fullEntityStatePath).WaitForCompletion();
			for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName)
				{
					val.serializedFieldsCollection.serializedFields[i].fieldValue.objectValue = newObject;
					return true;
				}
			}
			return false;
		}
	}
}
namespace RiskyFixes.Fixes
{
	public abstract class FixBase<T> : FixBase where T : FixBase<T>
	{
		public static T Instance { get; private set; }

		public FixBase()
		{
			if (Instance != null)
			{
				throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting FixBase was instantiated twice");
			}
			Instance = this as T;
		}
	}
	public abstract class FixBase
	{
		public abstract string ConfigCategoryString { get; }

		public abstract string ConfigOptionName { get; }

		public abstract string ConfigDescriptionString { get; }

		public ConfigEntry<bool> Enabled { get; private set; }

		public virtual bool StopLoadOnConfigDisable => true;

		protected virtual void ReadConfig(ConfigFile config)
		{
			Enabled = config.Bind<bool>(ConfigCategoryString, ConfigOptionName, true, ConfigDescriptionString);
		}

		internal void Init(ConfigFile config)
		{
			ReadConfig(config);
			if (!StopLoadOnConfigDisable || Enabled.Value)
			{
				ApplyChanges();
			}
		}

		protected virtual void ApplyChanges()
		{
		}
	}
}
namespace RiskyFixes.Fixes.Survivors
{
	public class KnifeHitboxCancel : FixBase<KnifeHitboxCancel>
	{
		public override string ConfigCategoryString => "Survivors - Bandit";

		public override string ConfigOptionName => "(Client-Side) Knife Hitbox Cancel Fix";

		public override string ConfigDescriptionString => "Knife hitbox no longer gets cancelled by other animations.";

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			ThrowSmokebomb.OnEnter += new Manipulator(ThrowSmokebomb_OnEnter);
			Bandit2FirePrimaryBase.OnEnter += new Manipulator(Bandit2FirePrimaryBase_OnEnter);
			Reload.OnEnter += new Manipulator(Reload_OnEnter);
			EnterReload.OnEnter += new Manipulator(EnterReload_OnEnter);
		}

		private void ThrowSmokebomb_OnEnter(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Gesture, Additive")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<string, ThrowSmokebomb, string>>((Func<string, ThrowSmokebomb, string>)delegate(string animLayer, ThrowSmokebomb self)
				{
					//IL_002d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0032: Unknown result type (might be due to invalid IL or missing references)
					Animator modelAnimator = ((EntityState)self).GetModelAnimator();
					if (Object.op_Implicit((Object)(object)modelAnimator))
					{
						int layerIndex = modelAnimator.GetLayerIndex("Gesture, Additive");
						if (layerIndex >= 0)
						{
							AnimatorStateInfo currentAnimatorStateInfo = modelAnimator.GetCurrentAnimatorStateInfo(layerIndex);
							if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("SlashBlade"))
							{
								return "BanditTweaksInvalidLayer";
							}
						}
					}
					return animLayer;
				});
			}
			else
			{
				Debug.LogError((object)"RiskyFixes: Bandit KnifeHitboxCancel ThrowSmokebomb IL Hook failed.");
			}
		}

		private void Bandit2FirePrimaryBase_OnEnter(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Gesture, Additive")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<string, ThrowSmokebomb, string>>((Func<string, ThrowSmokebomb, string>)delegate(string animLayer, ThrowSmokebomb self)
				{
					//IL_002d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0032: Unknown result type (might be due to invalid IL or missing references)
					Animator modelAnimator = ((EntityState)self).GetModelAnimator();
					if (Object.op_Implicit((Object)(object)modelAnimator))
					{
						int layerIndex = modelAnimator.GetLayerIndex("Gesture, Additive");
						if (layerIndex >= 0)
						{
							AnimatorStateInfo currentAnimatorStateInfo = modelAnimator.GetCurrentAnimatorStateInfo(layerIndex);
							if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("SlashBlade"))
							{
								return "BanditTweaksInvalidLayer";
							}
						}
					}
					return animLayer;
				});
			}
			else
			{
				Debug.LogError((object)"RiskyFixes: Bandit KnifeHitboxCancel Bandit2FirePrimaryBase IL Hook failed.");
			}
		}

		private void Reload_OnEnter(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Gesture, Additive")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<string, ThrowSmokebomb, string>>((Func<string, ThrowSmokebomb, string>)delegate(string animLayer, ThrowSmokebomb self)
				{
					//IL_002d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0032: Unknown result type (might be due to invalid IL or missing references)
					Animator modelAnimator = ((EntityState)self).GetModelAnimator();
					if (Object.op_Implicit((Object)(object)modelAnimator))
					{
						int layerIndex = modelAnimator.GetLayerIndex("Gesture, Additive");
						if (layerIndex >= 0)
						{
							AnimatorStateInfo currentAnimatorStateInfo = modelAnimator.GetCurrentAnimatorStateInfo(layerIndex);
							if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("SlashBlade"))
							{
								return "BanditTweaksInvalidLayer";
							}
						}
					}
					return animLayer;
				});
			}
			else
			{
				Debug.LogError((object)"RiskyFixes: Bandit KnifeHitboxCancel Reload IL Hook failed.");
			}
		}

		private void EnterReload_OnEnter(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Gesture, Additive")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<string, ThrowSmokebomb, string>>((Func<string, ThrowSmokebomb, string>)delegate(string animLayer, ThrowSmokebomb self)
				{
					//IL_002d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0032: Unknown result type (might be due to invalid IL or missing references)
					Animator modelAnimator = ((EntityState)self).GetModelAnimator();
					if (Object.op_Implicit((Object)(object)modelAnimator))
					{
						int layerIndex = modelAnimator.GetLayerIndex("Gesture, Additive");
						if (layerIndex >= 0)
						{
							AnimatorStateInfo currentAnimatorStateInfo = modelAnimator.GetCurrentAnimatorStateInfo(layerIndex);
							if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("SlashBlade"))
							{
								return "BanditTweaksInvalidLayer";
							}
						}
					}
					return animLayer;
				});
			}
			else
			{
				Debug.LogError((object)"RiskyFixes: Bandit KnifeHitboxCancel EnterReload IL Hook failed.");
			}
		}
	}
}
namespace RiskyFixes.Fixes.Survivors.Treebot
{
	public class UtilityCrash : FixBase<UtilityCrash>
	{
		public override string ConfigCategoryString => "Survivors - REX";

		public override string ConfigOptionName => "Utility Crash Fix";

		public override string ConfigDescriptionString => "(Server-Side) Fixes error spam and crashes related to the Utility skill.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			FireSonicBoom.OnEnter += new Manipulator(FireSonicBoom_OnEnter);
		}

		private void FireSonicBoom_OnEnter(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			bool flag = true;
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall(x, typeof(Vector3), "get_magnitude")
			}))
			{
				val.EmitDelegate<Func<float, float>>((Func<float, float>)((float magnitude) => (magnitude <= 0f) ? 1f : magnitude));
				if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(CharacterMotor), "mass")
				}))
				{
					val.EmitDelegate<Func<float, float>>((Func<float, float>)((float mass) => (mass <= 0f) ? 1f : mass));
					if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, typeof(Rigidbody), "get_mass")
					}))
					{
						val.EmitDelegate<Func<float, float>>((Func<float, float>)((float mass) => (mass <= 0f) ? 1f : mass));
						if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
						{
							(Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, typeof(CharacterBody), "get_acceleration")
						}))
						{
							val.EmitDelegate<Func<float, float>>((Func<float, float>)((float accel) => (accel <= 0f) ? 1f : accel));
							flag = false;
						}
					}
				}
			}
			if (flag)
			{
				Debug.LogError((object)"RiskyFixes: Treebot UtilityCrash IL Hook failed.");
			}
		}
	}
}
namespace RiskyFixes.Fixes.Survivors.Toolbot
{
	public class FixNailgunBurst : FixBase<FixNailgunBurst>
	{
		public override string ConfigCategoryString => "Survivors - MUL-T";

		public override string ConfigOptionName => "(Client-Side) Nailgun Burst Always Triggers";

		public override string ConfigDescriptionString => "Nailgun ending shotgun burst always triggers when ending the skill.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			FireNailgun.OnExit += new hook_OnExit(FireNailgun_OnExit);
		}

		private void FireNailgun_OnExit(orig_OnExit orig, FireNailgun self)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (((BaseSkillState)self).IsKeyDownAuthority() && (!Object.op_Implicit((Object)(object)((EntityState)self).characterBody) || !((EntityState)self).characterBody.isSprinting))
			{
				if (Object.op_Implicit((Object)(object)((EntityState)self).characterBody))
				{
					((EntityState)self).characterBody.SetSpreadBloom(1f, false);
				}
				Ray aimRay = ((BaseState)self).GetAimRay();
				((BaseNailgunState)self).FireBullet(((BaseState)self).GetAimRay(), NailgunFinalBurst.finalBurstBulletCount, BaseNailgunState.spreadPitchScale, BaseNailgunState.spreadYawScale);
				Util.PlaySound(NailgunFinalBurst.burstSound, ((EntityState)self).gameObject);
				if (((EntityState)self).isAuthority)
				{
					float num = NailgunFinalBurst.selfForce * (((EntityState)self).characterMotor.isGrounded ? 0.5f : 1f) * ((EntityState)self).characterMotor.mass;
					((EntityState)self).characterMotor.ApplyForce(((Ray)(ref aimRay)).direction * (0f - num), false, false);
				}
				Util.PlaySound(BaseNailgunState.fireSoundString, ((EntityState)self).gameObject);
				Util.PlaySound(BaseNailgunState.fireSoundString, ((EntityState)self).gameObject);
				Util.PlaySound(BaseNailgunState.fireSoundString, ((EntityState)self).gameObject);
			}
		}
	}
	public class NailgunShotRadius : FixBase<NailgunShotRadius>
	{
		public override string ConfigCategoryString => "Survivors - MUL-T";

		public override string ConfigOptionName => "(Client-Side) Nailgun Shot Radius";

		public override string ConfigDescriptionString => "Gives Nailgun shots a small radius like most other bullet attacks in the game.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			BaseNailgunState.FireBullet += new Manipulator(BaseNailgunState_FireBullet);
		}

		private void BaseNailgunState_FireBullet(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<BulletAttack>(x, "Fire")
			}))
			{
				val.EmitDelegate<Func<BulletAttack, BulletAttack>>((Func<BulletAttack, BulletAttack>)delegate(BulletAttack bulletAttack)
				{
					bulletAttack.radius = 0.2f;
					bulletAttack.smartCollision = true;
					return bulletAttack;
				});
			}
			else
			{
				Debug.LogError((object)"RiskyFixes: Toolbot NailgunShotRadius IL Hook failed");
			}
		}
	}
}
namespace RiskyFixes.Fixes.Survivors.Railgunner
{
	public class FixBungus : FixBase<FixBungus>
	{
		public override string ConfigCategoryString => "Survivors - Railgunner";

		public override string ConfigOptionName => "(Client-Side) Fix Bungus";

		public override string ConfigDescriptionString => "Disables self-knockback while standing still.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			BaseFireSnipe.OnFireBulletAuthority += new Manipulator(BaseFireSnipe_OnFireBulletAuthority);
			FirePistol.FireBullet += new Manipulator(FirePistol_FireBullet);
		}

		private void FirePistol_FireBullet(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(FirePistol), "selfKnockbackForce")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<float, FirePistol, float>>((Func<float, FirePistol, float>)((float force, FirePistol self) => (Object.op_Implicit((Object)(object)((EntityState)self).characterMotor) && ((EntityState)self).characterMotor.isGrounded) ? 0f : force));
			}
			else
			{
				Debug.LogError((object)"RiskyFixes: Railgunner FixBungus FirePistol IL Hook failed");
			}
		}

		private void BaseFireSnipe_OnFireBulletAuthority(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(BaseFireSnipe), "selfKnockbackForce")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<float, BaseFireSnipe, float>>((Func<float, BaseFireSnipe, float>)((float force, BaseFireSnipe self) => (Object.op_Implicit((Object)(object)((EntityState)self).characterMotor) && ((EntityState)self).characterMotor.velocity == Vector3.zero) ? 0f : force));
			}
			else
			{
				Debug.LogError((object)"RiskyFixes: Railgunner FixBungus Snipe IL Hook failed");
			}
		}
	}
}
namespace RiskyFixes.Fixes.Survivors.Merc
{
	public class EviscerateFix : FixBase<EviscerateFix>
	{
		public override string ConfigCategoryString => "Survivors - Mercenary";

		public override string ConfigOptionName => "(Client-Side) Eviscerate Targeting";

		public override string ConfigDescriptionString => "Fixes Eviscerate from getting caught on allies.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			EvisDash.FixedUpdate += new Manipulator(EvisDash_FixedUpdate);
		}

		private void EvisDash_FixedUpdate(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(HurtBox), "healthComponent")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<HealthComponent, EvisDash, HealthComponent>>((Func<HealthComponent, EvisDash, HealthComponent>)((HealthComponent healthComponent, EvisDash self) => (HealthComponent)(((int)FriendlyFireManager.friendlyFireMode == 0 && (Object)(object)healthComponent != (Object)(object)((EntityState)self).healthComponent && Object.op_Implicit((Object)(object)healthComponent) && Object.op_Implicit((Object)(object)healthComponent.body) && Object.op_Implicit((Object)(object)healthComponent.body.teamComponent) && !FriendlyFireManager.ShouldDirectHitProceed(healthComponent, ((BaseState)self).GetTeam())) ? ((object)((EntityState)self).healthComponent) : ((object)healthComponent))));
			}
			else
			{
				Debug.LogError((object)"RiskyFixes: Merc EviscerateFix EvisDash IL Hook failed");
			}
		}
	}
}
namespace RiskyFixes.Fixes.Survivors.Mage
{
	public class PrimaryRange : FixBase<PrimaryRange>
	{
		public override string ConfigCategoryString => "Survivors - Artificer";

		public override string ConfigOptionName => "(Server-Side) Primary Range";

		public override string ConfigDescriptionString => "Fix projectiles disappearing at midrange.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			GameObject projectile = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mage/MageFireboltBasic.prefab").WaitForCompletion();
			IncreaseProjectileLifetime(projectile);
			GameObject projectile2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mage/MageLightningboltBasic.prefab").WaitForCompletion();
			IncreaseProjectileLifetime(projectile2);
		}

		private void IncreaseProjectileLifetime(GameObject projectile)
		{
			ProjectileSimple component = projectile.GetComponent<ProjectileSimple>();
			component.lifetime = 10f;
			ProjectileImpactExplosion component2 = projectile.GetComponent<ProjectileImpactExplosion>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				component2.lifetime = 10f;
			}
		}
	}
}
namespace RiskyFixes.Fixes.Survivors.Huntress
{
	public class FixFlurry : FixBase<FixFlurry>
	{
		public override string ConfigCategoryString => "Survivors - Huntress";

		public override string ConfigOptionName => "(Server-Side) Flurry Attack Speed Fix";

		public override string ConfigDescriptionString => "Fixes Flurry losing arrows at high attack speeds.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			FireSeekingArrow.OnExit += new hook_OnExit(FireSeekingArrow_OnExit);
		}

		private void FireSeekingArrow_OnExit(orig_OnExit orig, FireSeekingArrow self)
		{
			orig.Invoke(self);
			if (NetworkServer.active)
			{
				int num = self.maxArrowCount - self.firedArrowCount;
				for (int i = 0; i < num; i++)
				{
					self.arrowReloadTimer = 0f;
					self.FireOrbArrow();
				}
			}
		}
	}
}
namespace RiskyFixes.Fixes.Survivors.Croco
{
	public class ExtendSpawnInvuln : FixBase<ExtendSpawnInvuln>
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_OnEnter <>9__8_0;

			public static hook_OnExit <>9__8_1;

			public static hook_OnEnter <>9__8_2;

			public static hook_OnExit <>9__8_3;

			internal void <ApplyChanges>b__8_0(orig_OnEnter orig, Spawn self)
			{
				orig.Invoke(self);
				if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)self).characterBody))
				{
					((EntityState)self).characterBody.AddBuff(Buffs.HiddenInvincibility);
				}
			}

			internal void <ApplyChanges>b__8_1(orig_OnExit orig, Spawn self)
			{
				if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)self).characterBody) && ((EntityState)self).characterBody.HasBuff(Buffs.HiddenInvincibility))
				{
					((EntityState)self).characterBody.RemoveBuff(Buffs.HiddenInvincibility);
				}
				orig.Invoke(self);
			}

			internal void <ApplyChanges>b__8_2(orig_OnEnter orig, WakeUp self)
			{
				orig.Invoke(self);
				if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)self).characterBody))
				{
					((EntityState)self).characterBody.AddBuff(Buffs.HiddenInvincibility);
				}
			}

			internal void <ApplyChanges>b__8_3(orig_OnExit orig, WakeUp self)
			{
				if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)self).characterBody) && ((EntityState)self).characterBody.HasBuff(Buffs.HiddenInvincibility))
				{
					((EntityState)self).characterBody.RemoveBuff(Buffs.HiddenInvincibility);
				}
				orig.Invoke(self);
			}
		}

		public override string ConfigCategoryString => "Survivors - Acrid";

		public override string ConfigOptionName => "(Server-Side) Spawn Protection";

		public override string ConfigDescriptionString => "Spawn protection lasts until after waking up.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//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
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//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_006a: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			object obj = <>c.<>9__8_0;
			if (obj == null)
			{
				hook_OnEnter val = delegate(orig_OnEnter orig, Spawn self)
				{
					orig.Invoke(self);
					if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)self).characterBody))
					{
						((EntityState)self).characterBody.AddBuff(Buffs.HiddenInvincibility);
					}
				};
				<>c.<>9__8_0 = val;
				obj = (object)val;
			}
			Spawn.OnEnter += (hook_OnEnter)obj;
			object obj2 = <>c.<>9__8_1;
			if (obj2 == null)
			{
				hook_OnExit val2 = delegate(orig_OnExit orig, Spawn self)
				{
					if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)self).characterBody) && ((EntityState)self).characterBody.HasBuff(Buffs.HiddenInvincibility))
					{
						((EntityState)self).characterBody.RemoveBuff(Buffs.HiddenInvincibility);
					}
					orig.Invoke(self);
				};
				<>c.<>9__8_1 = val2;
				obj2 = (object)val2;
			}
			Spawn.OnExit += (hook_OnExit)obj2;
			object obj3 = <>c.<>9__8_2;
			if (obj3 == null)
			{
				hook_OnEnter val3 = delegate(orig_OnEnter orig, WakeUp self)
				{
					orig.Invoke(self);
					if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)self).characterBody))
					{
						((EntityState)self).characterBody.AddBuff(Buffs.HiddenInvincibility);
					}
				};
				<>c.<>9__8_2 = val3;
				obj3 = (object)val3;
			}
			WakeUp.OnEnter += (hook_OnEnter)obj3;
			object obj4 = <>c.<>9__8_3;
			if (obj4 == null)
			{
				hook_OnExit val4 = delegate(orig_OnExit orig, WakeUp self)
				{
					if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)self).characterBody) && ((EntityState)self).characterBody.HasBuff(Buffs.HiddenInvincibility))
					{
						((EntityState)self).characterBody.RemoveBuff(Buffs.HiddenInvincibility);
					}
					orig.Invoke(self);
				};
				<>c.<>9__8_3 = val4;
				obj4 = (object)val4;
			}
			WakeUp.OnExit += (hook_OnExit)obj4;
		}
	}
}
namespace RiskyFixes.Fixes.Survivors.Commando
{
	public class PrimaryFireRate : FixBase<PrimaryFireRate>
	{
		public override string ConfigCategoryString => "Survivors - Commando";

		public override string ConfigOptionName => "(Client-Side) Double Tap Fire Rate";

		public override string ConfigDescriptionString => "Fixes Double Tap having a hidden reload state that lowers its fire rate at high attack speeds.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			FirePistol2.FixedUpdate += new Manipulator(FirePistol2_FixedUpdate);
		}

		private void FirePistol2_FixedUpdate(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0)
			}))
			{
				int index = val.Index;
				val.Index = index + 1;
				val.EmitDelegate<Func<int, int>>((Func<int, int>)((int zero) => -1000000000));
			}
			else
			{
				Debug.LogError((object)"RiskyFixes: Commando PrimaryFireRate IL Hook failed");
			}
		}
	}
}
namespace RiskyFixes.Fixes.Survivors.Chef
{
	public class MechanicalBodyflag : FixBase<MechanicalBodyflag>
	{
		public override string ConfigCategoryString => "Survivors - CHEF";

		public override string ConfigOptionName => "(Server-Side) Mechanical Bodyflag";

		public override string ConfigDescriptionString => "Fix CHEF not being marked with the Mechanical bodyflag.";

		protected override void ApplyChanges()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Chef/ChefBody.prefab").WaitForCompletion();
			CharacterBody component = val.GetComponent<CharacterBody>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.bodyFlags = (BodyFlags)(component.bodyFlags | 2);
			}
		}
	}
	public class SearVerticalAim : FixBase<SearVerticalAim>
	{
		public override string ConfigCategoryString => "Survivors - CHEF";

		public override string ConfigOptionName => "(Client-Side) Sear - Vertical Aiming";

		public override string ConfigDescriptionString => "Allow Sear to be aimed vertically and fixes aim being tied to your model direction.";

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			Sear.FirePrimaryAttack += new Manipulator(Sear_FirePrimaryAttack);
		}

		private void Sear_FirePrimaryAttack(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, typeof(BulletAttack), "Fire")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<BulletAttack, Sear, BulletAttack>>((Func<BulletAttack, Sear, BulletAttack>)delegate(BulletAttack bulletAttack, Sear self)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					//IL_000b: Unknown result type (might be due to invalid IL or missing references)
					Ray aimRay = ((BaseState)self).GetAimRay();
					bulletAttack.aimVector = ((Ray)(ref aimRay)).direction;
					return bulletAttack;
				});
			}
			else
			{
				Debug.LogError((object)"RiskyFixes: SearVerticalAim IL hook failed.");
			}
		}
	}
}
namespace RiskyFixes.Fixes.Survivors.Captain
{
	internal class OrbitalHiddenRealms : FixBase<OrbitalHiddenRealms>
	{
		public override string ConfigCategoryString => "Survivors - Captain";

		public override string ConfigOptionName => "(Client-Side) Orbital Skills in Hidden Realms";

		public override string ConfigDescriptionString => "Allows Orbital Skills to be used in Hidden Realms.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			Hook val = new Hook((MethodBase)Reflection.GetMethodCached(typeof(CaptainOrbitalSkillDef), "get_isAvailable"), Reflection.GetMethodCached(typeof(OrbitalHiddenRealms), "IsAvailable"));
		}

		private static bool IsAvailable(CaptainOrbitalSkillDef self)
		{
			return true;
		}
	}
}
namespace RiskyFixes.Fixes.Survivors.Bandit2
{
	public class PrimaryShotRadius : FixBase<PrimaryShotRadius>
	{
		public override string ConfigCategoryString => "Survivors - Bandit";

		public override string ConfigOptionName => "(Client-Side) Primary Shot Radius";

		public override string ConfigDescriptionString => "Gives Bandit primary bullets a small radius like most other bullet attacks in the game.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			SneedUtils.SetAddressableEntityStateField("RoR2/Base/Bandit2/EntityStates.Bandit2.Weapon.Bandit2FireRifle.asset", "radius", "0.3");
			SneedUtils.SetAddressableEntityStateField("RoR2/Base/Bandit2/EntityStates.Bandit2.Weapon.FireShotgun2.asset", "radius", "0.5");
		}
	}
}
namespace RiskyFixes.Fixes.Stages.Moon
{
	public class KillVoidTeam : FixBase<KillVoidTeam>
	{
		public override string ConfigCategoryString => "Stages - Commencement";

		public override string ConfigOptionName => "(Server-Side) Kill Void Team";

		public override string ConfigDescriptionString => "Kills Void team enemies when the bossfight starts.";

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			BrotherEncounterBaseState.KillAllMonsters += new hook_KillAllMonsters(BrotherEncounterBaseState_KillAllMonsters);
		}

		private void BrotherEncounterBaseState_KillAllMonsters(orig_KillAllMonsters orig, BrotherEncounterBaseState self)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (!NetworkServer.active)
			{
				return;
			}
			foreach (TeamComponent item in new List<TeamComponent>(TeamComponent.GetTeamMembers((TeamIndex)4)))
			{
				if (Object.op_Implicit((Object)(object)item))
				{
					HealthComponent component = ((Component)item).GetComponent<HealthComponent>();
					if (Object.op_Implicit((Object)(object)component))
					{
						component.Suicide((GameObject)null, (GameObject)null, DamageTypeCombo.op_Implicit((DamageType)0));
					}
				}
			}
		}
	}
}
namespace RiskyFixes.Fixes.SharedHooks
{
	internal class ModifyFinalDamage
	{
		public delegate void ModifyFinalDamageDelegate(DamageMult damageMult, DamageInfo damageInfo, HealthComponent victim, CharacterBody victimBody);

		internal class DamageMult
		{
			public float value = 1f;
		}

		public static ModifyFinalDamageDelegate ModifyFinalDamageActions;

		internal static void ModfyFinalDamageHook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 7)
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Ldarg_1);
				val.EmitDelegate<Func<float, HealthComponent, DamageInfo, float>>((Func<float, HealthComponent, DamageInfo, float>)delegate(float origDamage, HealthComponent victimHealth, DamageInfo damageInfo)
				{
					float num = origDamage;
					CharacterBody body = victimHealth.body;
					if (Object.op_Implicit((Object)(object)body))
					{
						DamageMult damageMult = new DamageMult();
						ModifyFinalDamageActions?.Invoke(damageMult, damageInfo, victimHealth, body);
						num *= damageMult.value;
					}
					return num;
				});
			}
			else
			{
				Debug.LogError((object)"RiskyFixes: ModifyFinalDamage IL Hook failed. This will break a lot of things.");
			}
		}
	}
}
namespace RiskyFixes.Fixes.Minions
{
	public class DontRetaliate : FixBase<DontRetaliate>
	{
		public override string ConfigCategoryString => "Minions";

		public override string ConfigOptionName => "(Server-Side) Dont Retaliate";

		public override string ConfigDescriptionString => "Fixes minions attempting to retaliate against their owner.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			ModifyAI(LoadMasterObject("EngiTurretMaster"));
			ModifyAI(LoadMasterObject("EngiWalkerTurretMaster"));
			ModifyAI(LoadMasterObject("EngiBeamTurretMaster"));
			ModifyAI(LoadMasterObject("Turret1Master"));
			ModifyAI(LoadMasterObject("Drone1Master"));
			ModifyAI(LoadMasterObject("MegaDroneMaster"));
			ModifyAI(LoadMasterObject("DroneMissileMaster"));
			ModifyAI(LoadMasterObject("FlameDroneMaster"));
			ModifyAI(LoadMasterObject("DroneBackupMaster"));
			ModifyAI(LoadMasterObject("SquidTurretMaster"));
			ModifyAI(LoadMasterObject("RoboBallGreenBuddyMaster"));
			ModifyAI(LoadMasterObject("RoboBallRedBuddyMaster"));
			ModifyAI(LoadMasterObject("BeetleGuardAllyMaster"));
			ModifyAI(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Nullifier/NullifierAllyMaster.prefab").WaitForCompletion());
			ModifyAI(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/VoidBarnacle/VoidBarnacleAllyMaster.prefab").WaitForCompletion());
			ModifyAI(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/VoidJailer/VoidJailerAllyMaster.prefab").WaitForCompletion());
			ModifyAI(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/VoidMegaCrab/VoidMegaCrabAllyMaster.prefab").WaitForCompletion());
		}

		private void ModifyAI(GameObject masterObject)
		{
			AimAtEnemy(masterObject.GetComponents<AISkillDriver>());
			SetDontRetaliate(masterObject.GetComponents<BaseAI>());
		}

		private void AimAtEnemy(AISkillDriver[] skillDrivers)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			foreach (AISkillDriver val in skillDrivers)
			{
				val.aimType = (AimType)2;
			}
		}

		private void SetDontRetaliate(BaseAI[] baseAIs)
		{
			foreach (BaseAI val in baseAIs)
			{
				val.neverRetaliateFriendlies = true;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private GameObject LoadMasterObject(string mastername)
		{
			return LegacyResourcesAPI.Load<GameObject>("prefabs/charactermasters/" + mastername);
		}
	}
}
namespace RiskyFixes.Fixes.Items
{
	public class ChargedPerfCrit : FixBase<ChargedPerfCrit>
	{
		public override string ConfigCategoryString => "Items";

		public override string ConfigOptionName => "(Server-Side) Charged Perforator Crit Fix";

		public override string ConfigDescriptionString => "Charged Perforator inherits crit instead of rerolling.";

		protected override void ApplyChanges()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			if (Chainloader.PluginInfos.ContainsKey("Gorakh.CherfInheritCrit"))
			{
				Debug.LogWarning((object)"RiskyFixes: Skipping ChargedPerfCrit because standalone plugin is loaded.");
			}
			else
			{
				GlobalEventManager.ProcessHitEnemy += new Manipulator(FixChargedPerforator);
			}
		}

		private void FixChargedPerforator(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "LightningStrikeOnHit")
			}) && val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStfld(x, typeof(GenericDamageOrb), "isCrit")
			}))
			{
				val.Emit(OpCodes.Ldarg_1);
				val.EmitDelegate<Func<bool, DamageInfo, bool>>((Func<bool, DamageInfo, bool>)((bool isCrit, DamageInfo damageInfo) => damageInfo.crit));
			}
			else
			{
				Debug.LogError((object)"RiskyFixes: ChargedPerfCrit IL Hook failed");
			}
		}
	}
	public class FinReproc : FixBase<FinReproc>
	{
		public override string ConfigCategoryString => "Items";

		public override string ConfigOptionName => "(Server-Side) Breaching Fin - Fix Re-Proc";

		public override string ConfigDescriptionString => "Fixes Fin being able to boost damage multiple times in the same proc chain.";

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			KnockbackFinUtil.ModifyDamageInfo += new hook_ModifyDamageInfo(KnockbackFinUtil_ModifyDamageInfo);
			ModifyFinalDamage.ModifyFinalDamageActions = (ModifyFinalDamage.ModifyFinalDamageDelegate)Delegate.Combine(ModifyFinalDamage.ModifyFinalDamageActions, new ModifyFinalDamage.ModifyFinalDamageDelegate(ModifyDamage));
		}

		private void KnockbackFinUtil_ModifyDamageInfo(orig_ModifyDamageInfo orig, ref DamageInfo damageInfo, CharacterBody attacker, CharacterBody victim)
		{
		}

		private void ModifyDamage(ModifyFinalDamage.DamageMult damageMult, DamageInfo damageInfo, HealthComponent victim, CharacterBody victimBody)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			int buffCount = victimBody.GetBuffCount(Buffs.KnockUpHitEnemiesJuggleCount);
			if (buffCount > 0)
			{
				float num = Mathf.Max(1f, (float)buffCount) * 0.2f;
				damageMult.value += num;
				if (!damageInfo.crit)
				{
					damageInfo.damageColorIndex = (DamageColorIndex)14;
				}
			}
		}
	}
	public class FocusCrystalSelfDamage : FixBase<FocusCrystalSelfDamage>
	{
		public override string ConfigCategoryString => "Items";

		public override string ConfigOptionName => "(Server-Side) Focus Crystal Self Damage";

		public override string ConfigDescriptionString => "Prevents Focus Crystal from applying to self damage.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess);
		}

		private void HealthComponent_TakeDamageProcess(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "NearbyDamageBonus")
			}))
			{
				val.Index += 1;
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Ldarg_1);
				val.EmitDelegate<Func<int, HealthComponent, DamageInfo, int>>((Func<int, HealthComponent, DamageInfo, int>)delegate(int itemCount, HealthComponent self, DamageInfo damageInfo)
				{
					if (itemCount > 0 && Object.op_Implicit((Object)(object)self.body) && Object.op_Implicit((Object)(object)damageInfo.attacker) && (Object)(object)((Component)self.body).gameObject == (Object)(object)damageInfo.attacker)
					{
						itemCount = 0;
					}
					return itemCount;
				});
			}
			else
			{
				Debug.LogError((object)"RiskyFixes: Items FixFocusCrystalSelfDamage IL Hook failed");
			}
		}
	}
	internal class LongstandingSolitudeNullref : FixBase<LongstandingSolitudeNullref>
	{
		public override string ConfigCategoryString => "Items";

		public override string ConfigOptionName => "(Client-Side) Longstanding Solitude Nullref Fix";

		public override string ConfigDescriptionString => "Fixes a nullref related to this item.";

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			TeamManager.LongstandingSolitudesInParty += new hook_LongstandingSolitudesInParty(TeamManager_LongstandingSolitudesInParty);
		}

		private int TeamManager_LongstandingSolitudesInParty(orig_LongstandingSolitudesInParty orig)
		{
			int num = 0;
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				if (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)instance.master))
				{
					CharacterBody body = instance.master.GetBody();
					if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.inventory) && body.inventory.GetItemCount(Items.OnLevelUpFreeUnlock) > 0)
					{
						num += body.inventory.GetItemCount(Items.OnLevelUpFreeUnlock);
					}
				}
			}
			return num;
		}
	}
	public class SaferSpacesCooldown : FixBase<SaferSpacesCooldown>
	{
		public override string ConfigCategoryString => "Items";

		public override string ConfigOptionName => "(Server-Side) Safer Spaces Cooldown";

		public override string ConfigDescriptionString => "Fixes Safer Spaces starting with +1 stacks.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess);
		}

		private void HealthComponent_TakeDamageProcess(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "BearVoid")
			}))
			{
				int index = val.Index;
				val.Index = index + 1;
				val.EmitDelegate<Func<int, int>>((Func<int, int>)((int itemCount) => itemCount - 1));
			}
			else
			{
				Debug.LogError((object)"RiskyFixes: SaferSpacesCoodlown IL Hook failed.");
			}
		}
	}
	public class SaferSpacesInvulnProc : FixBase<SaferSpacesInvulnProc>
	{
		public override string ConfigCategoryString => "Items";

		public override string ConfigOptionName => "(Server-Side) Safer Spaces Invuln Fix";

		public override string ConfigDescriptionString => "Fixes Safer Spaces being wasted when hit while invincible.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess);
		}

		private void HealthComponent_TakeDamageProcess(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "BearVoidReady")
			}))
			{
				int index = val.Index;
				val.Index = index + 1;
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Ldarg_1);
				val.EmitDelegate<Func<bool, HealthComponent, DamageInfo, bool>>((Func<bool, HealthComponent, DamageInfo, bool>)delegate(bool hasBuff, HealthComponent self, DamageInfo damageInfo)
				{
					//IL_007a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0098: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
					if (!hasBuff)
					{
						return false;
					}
					bool flag = !damageInfo.rejected && !self.godMode;
					if (Object.op_Implicit((Object)(object)self.body))
					{
						bool flag2 = self.body.HasBuff(Buffs.Immune) && !self.body.HasBuff(Buffs.GoldEmpowered);
						bool flag3 = self.body.HasBuff(Buffs.HiddenInvincibility) && !((Enum)damageInfo.damageType.damageType).HasFlag((Enum)(object)(DamageType)2);
						bool flag4 = (DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageTypeExtended)134217728)) == 0) & self.body.HasBuff(Buffs.SojournVehicle);
						flag = flag && !flag3 && !flag2 && !flag4;
					}
					return flag;
				});
			}
			else
			{
				Debug.LogError((object)"RiskyFixes: SaferSpacesInvulnProc IL Hook failed.");
			}
		}
	}
	public class ScorpionSelfProc : FixBase<ScorpionSelfProc>
	{
		public override string ConfigCategoryString => "Items";

		public override string ConfigOptionName => "(Server-Side) Symbiotic Scorpion Self Proc";

		public override string ConfigDescriptionString => "Fixes cases where Symbiotic Scorpion can proc on self damage.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess);
		}

		private void HealthComponent_TakeDamageProcess(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "PermanentDebuffOnHit")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Ldarg_1);
				val.EmitDelegate<Func<BuffDef, HealthComponent, DamageInfo, BuffDef>>((Func<BuffDef, HealthComponent, DamageInfo, BuffDef>)((BuffDef buff, HealthComponent self, DamageInfo damageInfo) => ((Object)(object)((Component)self).gameObject != (Object)(object)damageInfo.attacker) ? buff : null));
			}
			else
			{
				Debug.LogError((object)"RiskyFixes: ScorpionSelfProc IL Hook failed");
			}
		}
	}
	public class VoidsentNewtProc : FixBase<VoidsentNewtProc>
	{
		private BodyIndex newtIndex;

		public override string ConfigCategoryString => "Items";

		public override string ConfigOptionName => "(Server-Side) Voidsent Flame disabled in Bazaar";

		public override string ConfigDescriptionString => "Prevents Voidsent Flame from proccing against the Newt due to the risk of crashing.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(OnLoad));
			HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess);
		}

		private void HealthComponent_TakeDamageProcess(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "ExplodeOnDeathVoid")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<ItemDef, HealthComponent, ItemDef>>((Func<ItemDef, HealthComponent, ItemDef>)((ItemDef item, HealthComponent self) => (self.body.bodyIndex == newtIndex) ? null : item));
			}
			else
			{
				Debug.LogError((object)"RiskyFixes: VoidsentNewtProc IL Hook Failed.");
			}
		}

		private void OnLoad()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			newtIndex = BodyCatalog.FindBodyIndex("ShopkeeperBody");
		}
	}
	public class WarBondsPersist : FixBase<WarBondsPersist>
	{
		public override string ConfigCategoryString => "Items";

		public override string ConfigOptionName => "(Server-Side) War Bonds - Reset Between Stages";

		public override string ConfigDescriptionString => "Fixes War Bonds persisting between stages.";

		protected override void ApplyChanges()
		{
			Stage.onStageStartGlobal += Stage_onStageStartGlobal;
		}

		private void Stage_onStageStartGlobal(Stage obj)
		{
			foreach (CharacterMaster instances in CharacterMaster.instancesList)
			{
				instances.trackedMissileCount = 0;
			}
		}
	}
}
namespace RiskyFixes.Fixes.General
{
	public class BulletFix : FixBase<BulletFix>
	{
		public override string ConfigCategoryString => "General";

		public override string ConfigOptionName => "(Client-Side) Bullet Self-Hit Fix";

		public override string ConfigDescriptionString => "Fixes bulletattacks sometimes being able to hit yourself.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			BulletAttack.ProcessHitList += new hook_ProcessHitList(BulletAttack_ProcessHitList);
		}

		private GameObject BulletAttack_ProcessHitList(orig_ProcessHitList orig, BulletAttack self, List<BulletHit> hits, ref Vector3 endPosition, List<GameObject> ignoreList)
		{
			if (Object.op_Implicit((Object)(object)self.owner))
			{
				ignoreList.Add(self.owner);
			}
			return orig.Invoke(self, hits, ref endPosition, ignoreList);
		}
	}
	public class HiddenNames : FixBase<HiddenNames>
	{
		public override string ConfigCategoryString => "General";

		public override string ConfigOptionName => "(Client-Side) Hidden Names Fix";

		public override string ConfigDescriptionString => "Fixes people sometimes having hidden names by refreshing the list on stage start.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			Stage.onStageStartGlobal += Stage_onStageStartGlobal;
		}

		private void Stage_onStageStartGlobal(Stage obj)
		{
			foreach (NetworkUser instances in NetworkUser.instancesList)
			{
				instances.UpdateUserName();
			}
		}
	}
	public class ModdedPrismaticTrials : FixBase<ModdedPrismaticTrials>
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_ClientSubmitLeaderboardScore <>9__8_0;

			public static hook_OnEnable <>9__8_1;

			internal void <ApplyChanges>b__8_0(orig_ClientSubmitLeaderboardScore orig, WeeklyRun self, RunReport runReport)
			{
			}

			internal void <ApplyChanges>b__8_1(orig_OnEnable orig, DisableIfGameModded self)
			{
			}
		}

		public override string ConfigCategoryString => "General";

		public override string ConfigOptionName => "Prismatic Trials";

		public override string ConfigDescriptionString => "Enables Prismatic Trials while modded. Runs will not count towards the Leaderboard.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//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
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			object obj = <>c.<>9__8_0;
			if (obj == null)
			{
				hook_ClientSubmitLeaderboardScore val = delegate
				{
				};
				<>c.<>9__8_0 = val;
				obj = (object)val;
			}
			WeeklyRun.ClientSubmitLeaderboardScore += (hook_ClientSubmitLeaderboardScore)obj;
			object obj2 = <>c.<>9__8_1;
			if (obj2 == null)
			{
				hook_OnEnable val2 = delegate
				{
				};
				<>c.<>9__8_1 = val2;
				obj2 = (object)val2;
			}
			DisableIfGameModded.OnEnable += (hook_OnEnable)obj2;
		}
	}
	public class MultipleGoldShrine : FixBase<MultipleGoldShrine>
	{
		public override string ConfigCategoryString => "General";

		public override string ConfigOptionName => "(Server-Side) Shrine of Gold Spawnlimit";

		public override string ConfigDescriptionString => "Limits Shrine of Gold to 1 per stage.";

		protected override void ApplyChanges()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			InteractableSpawnCard val = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/ShrineGoldshoresAccess/iscShrineGoldshoresAccess.asset").WaitForCompletion();
			val.maxSpawnsPerStage = 1;
		}
	}
	public class Playercount : FixBase<Playercount>
	{
		private static int maxPlayersOnStage;

		public override string ConfigCategoryString => "General";

		public override string ConfigOptionName => "(Server-Side) Playercount Fix";

		public override string ConfigDescriptionString => "Fixes disconnected players counting towards the playercount.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			Stage.Start += new hook_Start(Stage_Start);
			Hook val = new Hook((MethodBase)Reflection.GetMethodCached(typeof(Run), "get_participatingPlayerCount"), Reflection.GetMethodCached(typeof(Playercount), "GetParticipatingPlayerCountHook"));
		}

		private IEnumerator Stage_Start(orig_Start orig, Stage self)
		{
			maxPlayersOnStage = 0;
			return orig.Invoke(self);
		}

		private static int GetParticipatingPlayerCountHook(Run self)
		{
			return GetConnectedPlayers();
		}

		public static int GetConnectedPlayers()
		{
			int num = 0;
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				if (instance.isConnected)
				{
					num++;
				}
			}
			if (num > maxPlayersOnStage)
			{
				maxPlayersOnStage = num;
			}
			else
			{
				num = maxPlayersOnStage;
			}
			num *= ModCompat.MultitudesCompat.GetMultiplier();
			num *= ModCompat.ZetArtifactsCompat.Multifact.GetMultiplier();
			if (num != 0)
			{
				num += ModCompat.MultitudesDifficultyCompat.GetAdditional();
			}
			return num;
		}
	}
	public class RemoveMenuAdvertisement : FixBase<RemoveMenuAdvertisement>
	{
		public override string ConfigCategoryString => "General";

		public override string ConfigOptionName => "(Client-Side) Remove Main Menu Advertisement";

		public override string ConfigDescriptionString => "Removes the DLC advertisement from the main menu.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			MPButton.Awake += new hook_Awake(MPButton_Awake);
		}

		private void MPButton_Awake(orig_Awake orig, MPButton self)
		{
			if (((Object)self).name == "PlatformStoreButton")
			{
				Object.Destroy((Object)(object)((Component)self).gameObject);
			}
			else
			{
				orig.Invoke(self);
			}
		}
	}
	public class Slayer : FixBase<Slayer>
	{
		public override string ConfigCategoryString => "General";

		public override string ConfigOptionName => "(Server-Side) Slayer Procs";

		public override string ConfigDescriptionString => "Fixes Slayer damagetype (bonus damage to low health) not affecting procs.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			HealthComponent.TakeDamageProcess += new hook_TakeDamageProcess(HealthComponent_TakeDamageProcess);
		}

		private void HealthComponent_TakeDamageProcess(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo damageInfo)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Invalid comparison between Unknown and I4
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			if ((int)DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)524288)) == 524288)
			{
				damageInfo.damageType &= DamageTypeCombo.op_Implicit((DamageType)(-524289));
				damageInfo.damage *= Mathf.Lerp(3f, 1f, self.combinedHealthFraction);
			}
			orig.Invoke(self, damageInfo);
		}
	}
	public class SmallHoldoutCharging : FixBase<SmallHoldoutCharging>
	{
		public override string ConfigCategoryString => "General";

		public override string ConfigOptionName => "(Server-Side) Small Holdout Charging";

		public override string ConfigDescriptionString => "Small holdouts charge at full speed as long as 1 player is in the radius.";

		protected override void ApplyChanges()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			string[] array = new string[7] { "RoR2/Base/moon2/MoonBatteryBlood.prefab", "RoR2/Base/moon2/MoonBatteryDesign.prefab", "RoR2/Base/moon2/MoonBatteryMass.prefab", "RoR2/Base/moon2/MoonBatterySoul.prefab", "RoR2/DLC1/DeepVoidPortalBattery/DeepVoidPortalBattery.prefab", "RoR2/Base/NullSafeWard/NullSafeWard.prefab", "RoR2/Base/moon2/Moon2DropshipZone.prefab" };
			string[] array2 = array;
			foreach (string text in array2)
			{
				FixHoldout(Addressables.LoadAssetAsync<GameObject>((object)text).WaitForCompletion());
			}
		}

		public static void FixHoldout(GameObject gameObject)
		{
			if (Object.op_Implicit((Object)(object)gameObject))
			{
				HoldoutZoneController componentInChildren = gameObject.GetComponentInChildren<HoldoutZoneController>();
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					componentInChildren.playerCountScaling = 0f;
				}
			}
		}
	}
}
namespace RiskyFixes.Fixes.Enemies
{
	public class DetectionFix : FixBase<DetectionFix>
	{
		public override string ConfigCategoryString => "Enemies";

		public override string ConfigOptionName => "(Server-Side) Close Range Detection";

		public override string ConfigDescriptionString => "Fixes enemy AI breaking due to negative detection range.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			BaseAI.GameObjectPassesSkillDriverFilters += new Manipulator(BaseAI_GameObjectPassesSkillDriverFilters);
		}

		private void BaseAI_GameObjectPassesSkillDriverFilters(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<AISkillDriver>(x, "get_minDistanceSqr")
			}))
			{
				return;
			}
			val.EmitDelegate<Func<float, float>>((Func<float, float>)delegate(float orig)
			{
				if (orig <= 0f)
				{
					orig = float.NegativeInfinity;
				}
				return orig;
			});
		}
	}
}
namespace RiskyFixes.Fixes.Enemies.Vagrant
{
	public class FixTrackingBomb : FixBase<FixTrackingBomb>
	{
		public override string ConfigCategoryString => "Enemies - Wandering Vagrant";

		public override string ConfigOptionName => "Fix Tracking Bomb";

		public override string ConfigDescriptionString => "Fixes Tracking Bomb being invincible.";

		protected override void ApplyChanges()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if (Chainloader.PluginInfos.ContainsKey("Gorakh.VagrantOrbFix"))
			{
				Debug.LogWarning((object)"RiskyFixes: Skipping FixTrackingBomb because standalone plugin is loaded.");
				return;
			}
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Scorchling/ScorchlingBombProjectile.prefab").WaitForCompletion();
			Transform modelTransform = val.transform.Find("Model");
			ModelLocator component = val.GetComponent<ModelLocator>();
			component._modelTransform = modelTransform;
		}
	}
}
namespace RiskyFixes.Fixes.Enemies.MagmaWorm
{
	public class FixFallDeath : FixBase<FixFallDeath>
	{
		private BodyIndex magmaWormIndex;

		private BodyIndex overloadingWormIndex;

		public override string ConfigCategoryString => "Enemies - Magma Worm";

		public override string ConfigOptionName => "(Server-Side) Prevent Fall Death";

		public override string ConfigDescriptionString => "Prevents Magma Worms from dying to fall triggers.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(RoR2Application_OnLoad));
			CharacterBody.Start += new hook_Start(CharacterBody_Start);
		}

		private void CharacterBody_Start(orig_Start orig, CharacterBody self)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)self.inventory) && (self.bodyIndex == magmaWormIndex || self.bodyIndex == overloadingWormIndex))
			{
				self.inventory.GiveItem(Items.TeleportWhenOob, 1);
			}
		}

		private void RoR2Application_OnLoad()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			magmaWormIndex = BodyCatalog.FindBodyIndex("MagmaWormBody");
			overloadingWormIndex = BodyCatalog.FindBodyIndex("ElectricWormBody");
		}
	}
}
namespace RiskyFixes.Fixes.Enemies.Halcyonite
{
	public class FixSpinHitbox : FixBase<FixSpinHitbox>
	{
		public class HalcyoniteProjectileTracker : MonoBehaviour
		{
			private List<GameObject> activeProjectiles;

			private void Awake()
			{
				activeProjectiles = new List<GameObject>();
			}

			public void AddProjectileServer(GameObject projectile)
			{
				if (NetworkServer.active)
				{
					activeProjectiles = activeProjectiles.Where((GameObject go) => (Object)(object)go != (Object)null).ToList();
					activeProjectiles.Add(projectile);
				}
			}

			public void DestroyAllProjectilesServer()
			{
				if (!NetworkServer.active)
				{
					return;
				}
				foreach (GameObject activeProjectile in activeProjectiles)
				{
					Object.Destroy((Object)(object)activeProjectile);
				}
				activeProjectiles = activeProjectiles.Where((GameObject go) => (Object)(object)go != (Object)null).ToList();
			}
		}

		public class RegisterHalcyoniteProjectile : MonoBehaviour
		{
			private void Start()
			{
				if (NetworkServer.active)
				{
					ProjectileController component = ((Component)this).GetComponent<ProjectileController>();
					if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.owner))
					{
						HalcyoniteProjectileTracker component2 = component.owner.GetComponent<HalcyoniteProjectileTracker>();
						if (Object.op_Implicit((Object)(object)component2))
						{
							component2.AddProjectileServer(((Component)this).gameObject);
						}
					}
				}
				Object.Destroy((Object)(object)this);
			}
		}

		public override string ConfigCategoryString => "Enemies - Halcyonite";

		public override string ConfigOptionName => "(Server-Side) Fix Whirlwind";

		public override string ConfigDescriptionString => "Fixes Whirlwind Hitbox persisting when it shouldn't, along with the skill ignoring Stuns.";

		protected override void ApplyChanges()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Halcyonite/WhirlWindHalcyoniteProjectile.prefab").WaitForCompletion();
			ProjectileController component = val.GetComponent<ProjectileController>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.cannotBeDeleted = true;
				val.AddComponent<RegisterHalcyoniteProjectile>();
			}
			GameObject val2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Halcyonite/HalcyoniteBody.prefab").WaitForCompletion();
			val2.AddComponent<HalcyoniteProjectileTracker>();
			WhirlwindRush.OnExit += new hook_OnExit(WhirlwindRush_OnExit);
			EntityStateMachine[] components = val2.GetComponents<EntityStateMachine>();
			SetStateOnHurt ssoh = val2.GetComponent<SetStateOnHurt>();
			ssoh.idleStateMachine = components.Where((EntityStateMachine esm) => (Object)(object)esm != (Object)(object)ssoh.targetStateMachine).ToArray();
		}

		private void WhirlwindRush_OnExit(orig_OnExit orig, WhirlwindRush self)
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)self).characterBody.baseMoveSpeed = self.originalMoveSpeed;
			((EntityState)self).characterBody.baseAcceleration = self.originalAccSpeed;
			if (Object.op_Implicit((Object)(object)((EntityState)self).characterMotor))
			{
				((EntityState)self).characterMotor.walkSpeedPenaltyCoefficient = 1f;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)self).characterBody))
			{
				((EntityState)self).characterBody.isSprinting = false;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)self).characterDirection))
			{
				((EntityState)self).characterDirection.moveVector = ((EntityState)self).characterDirection.forward;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)self).rigidbodyMotor))
			{
				((EntityState)self).rigidbodyMotor.moveVector = Vector3.zero;
			}
			Util.PlaySound("Stop_halcyonite_skill3_loop", ((EntityState)self).gameObject);
			if (NetworkServer.active)
			{
				HalcyoniteProjectileTracker component = ((EntityState)self).GetComponent<HalcyoniteProjectileTracker>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.DestroyAllProjectilesServer();
				}
			}
			orig.Invoke(self);
		}
	}
}
namespace RiskyFixes.Fixes.Enemies.Grandparent
{
	internal class GhostFriendlyFire : FixBase<GhostFriendlyFire>
	{
		public override string ConfigCategoryString => "Enemies - Grandparent";

		public override string ConfigOptionName => "(Server-Side) Disable Ghost Friendly Fire.";

		public override string ConfigDescriptionString => "Prevents ghosts from teamkilling you.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			GrandParentSunController.ServerFixedUpdate += new Manipulator(GrandParentSunController_ServerFixedUpdate);
			GrandParentSunController.FixedUpdate += new Manipulator(GrandParentSunController_FixedUpdate);
		}

		private void GrandParentSunController_FixedUpdate(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<HealthComponent>(x, "body")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<CharacterBody, GrandParentSunController, CharacterBody>>((Func<CharacterBody, GrandParentSunController, CharacterBody>)delegate(CharacterBody victimBody, GrandParentSunController self)
				{
					//IL_0028: Unknown result type (might be due to invalid IL or missing references)
					//IL_002e: Invalid comparison between Unknown and I4
					//IL_004b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0051: Invalid comparison between Unknown and I4
					GameObject ownerObject = self.ownership.ownerObject;
					if (Object.op_Implicit((Object)(object)ownerObject))
					{
						TeamComponent component = ownerObject.GetComponent<TeamComponent>();
						if (Object.op_Implicit((Object)(object)component) && (int)component.teamIndex == 1 && Object.op_Implicit((Object)(object)victimBody) && Object.op_Implicit((Object)(object)victimBody.teamComponent) && (int)victimBody.teamComponent.teamIndex == 1)
						{
							return null;
						}
					}
					return victimBody;
				});
			}
			else
			{
				Debug.LogError((object)"RiskyFixes: Grandparent GhostFriendlyFire FixedUpdate IL Hook failed");
			}
		}

		private void GrandParentSunController_ServerFixedUpdate(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<HurtBox>(x, "healthComponent")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<HealthComponent, GrandParentSunController, HealthComponent>>((Func<HealthComponent, GrandParentSunController, HealthComponent>)delegate(HealthComponent victimHealth, GrandParentSunController self)
				{
					//IL_0028: Unknown result type (might be due to invalid IL or missing references)
					//IL_002e: Invalid comparison between Unknown and I4
					//IL_0055: Unknown result type (might be due to invalid IL or missing references)
					//IL_005b: Invalid comparison between Unknown and I4
					GameObject ownerObject = self.ownership.ownerObject;
					if (Object.op_Implicit((Object)(object)ownerObject))
					{
						TeamComponent component = ownerObject.GetComponent<TeamComponent>();
						if (Object.op_Implicit((Object)(object)component) && (int)component.teamIndex == 1 && Object.op_Implicit((Object)(object)victimHealth) && Object.op_Implicit((Object)(object)victimHealth.body.teamComponent) && (int)victimHealth.body.teamComponent.teamIndex == 1)
						{
							return null;
						}
					}
					return victimHealth;
				});
			}
			else
			{
				Debug.LogError((object)"RiskyFixes: Grandparent GhostFriendlyFire ServerFixedUpdate IL Hook failed");
			}
		}
	}
}
namespace RiskyFixes.Fixes.Enemies.ClayBoss
{
	public class GhostFriendlyFire : FixBase<GhostFriendlyFire>
	{
		public override string ConfigCategoryString => "Enemies - Clay Dunestrider";

		public override string ConfigOptionName => "(Server-Side) Disable Ghost Friendly Fire";

		public override string ConfigDescriptionString => "Prevents ghosts from teamkilling you.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			Recover.FireTethers += new Manipulator(Recover_FireTethers);
		}

		private void Recover_FireTethers(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<BullseyeSearch>(x, "RefreshCandidates")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<BullseyeSearch, Recover, BullseyeSearch>>((Func<BullseyeSearch, Recover, BullseyeSearch>)delegate(BullseyeSearch search, Recover self)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Invalid comparison between Unknown and I4
					if ((int)((BaseState)self).GetTeam() == 1)
					{
						((TeamMask)(ref search.teamMaskFilter)).RemoveTeam((TeamIndex)1);
					}
					return search;
				});
			}
			else
			{
				Debug.LogError((object)"RiskyFixes: ClayBoss Recover_FireTethers IL Hook failed");
			}
		}
	}
}
namespace RiskyFixes.Fixes.Enemies.BrotherHurt
{
	public class NoPhase4Skip : FixBase<NoPhase4Skip>
	{
		private BodyIndex brotherHurtIndex;

		public override string ConfigCategoryString => "Enemies - Mithrix (Phase 4)";

		public override string ConfigOptionName => "(Server-Side) Prevent Phase Skip";

		public override string ConfigDescriptionString => "Fixes the bug where Mithrix is instakilled if he takes damage at the start of the phase.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Brother/BrotherHurtBody.prefab").WaitForCompletion();
			val.AddComponent<Phase4ImmuneComponent>();
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(OnLoad));
			HealthComponent.TakeDamageProcess += new hook_TakeDamageProcess(HealthComponent_TakeDamageProcess);
			SpellBaseState.OnExit += new hook_OnExit(SpellBaseState_OnExit);
		}

		private void SpellBaseState_OnExit(orig_OnExit orig, SpellBaseState self)
		{
			Phase4ImmuneComponent component = ((EntityState)self).GetComponent<Phase4ImmuneComponent>();
			if (Object.op_Implicit((Object)(object)component) && component.spawnImmuneDuration > 0.1f)
			{
				component.spawnImmuneDuration = 0.1f;
			}
			orig.Invoke(self);
		}

		private void HealthComponent_TakeDamageProcess(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo damageInfo)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && self.body.bodyIndex == brotherHurtIndex && Object.op_Implicit((Object)(object)((Component)self).GetComponent<Phase4ImmuneComponent>()))
			{
				damageInfo.rejected = true;
			}
			orig.Invoke(self, damageInfo);
		}

		private void OnLoad()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			brotherHurtIndex = BodyCatalog.FindBodyIndex("BrotherHurtBody");
		}
	}
	public class Phase4ImmuneComponent : MonoBehaviour
	{
		public float spawnImmuneDuration = 10f;

		private void Awake()
		{
			if (!NetworkServer.active)
			{
				Object.Destroy((Object)(object)this);
			}
		}

		private void FixedUpdate()
		{
			spawnImmuneDuration -= Time.fixedDeltaTime;
			if (spawnImmuneDuration <= 0f)
			{
				Object.Destroy((Object)(object)this);
			}
		}
	}
}
namespace RiskyFixes.Fixes.Enemies.ArtifactReliquary
{
	public class PreventArtifactHeal : FixBase<PreventArtifactHeal>
	{
		private BodyIndex bodyIndex;

		public override string ConfigCategoryString => "Enemies - Artifact Reliquary";

		public override string ConfigOptionName => "(Server-Side) Prevent Heal";

		public override string ConfigDescriptionString => "Prevents Artifact Reliquary from healing and softlocking runs.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(OnLoad));
			HealthComponent.Heal += new hook_Heal(HealthComponent_Heal);
		}

		private void OnLoad()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			bodyIndex = BodyCatalog.FindBodyIndex("ArtifactShellBody");
		}

		private float HealthComponent_Heal(orig_Heal orig, HealthComponent self, float amount, ProcChainMask procChainMask, bool nonRegen)
		{
			//IL_0014: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)self.body) && self.body.bodyIndex == bodyIndex)
			{
				return 0f;
			}
			return orig.Invoke(self, amount, procChainMask, nonRegen);
		}
	}
}
namespace RiskyFixes.Fixes.Artifacts
{
	public class EnigmaBlacklistCheck : FixBase<EnigmaBlacklistCheck>
	{
		public override string ConfigCategoryString => "Artifacts";

		public override string ConfigOptionName => "(Server-Side) Enigma Blacklist Fix";

		public override string ConfigDescriptionString => "Fixes blacklisted equipment being able to spawn during Enigma runs.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			EnigmaArtifactManager.OnRunStartGlobal += new hook_OnRunStartGlobal(EnigmaArtifactManager_OnRunStartGlobal);
		}

		private void EnigmaArtifactManager_OnRunStartGlobal(orig_OnRunStartGlobal orig, Run run)
		{
			//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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(run);
			List<EquipmentIndex> list = new List<EquipmentIndex>();
			foreach (EquipmentIndex item in EnigmaArtifactManager.validEquipment)
			{
				if (!Run.instance.availableEquipment.Contains(item))
				{
					list.Add(item);
				}
			}
			foreach (EquipmentIndex item2 in list)
			{
				EnigmaArtifactManager.validEquipment.Remove(item2);
			}
		}
	}
	public class VengeanceLevel : FixBase<VengeanceLevel>
	{
		public override string ConfigCategoryString => "Artifacts";

		public override string ConfigOptionName => "(Server-Side) Vengeance Umbra Level";

		public override string ConfigDescriptionString => "Vengeance Umbras copy player levels.";

		public override bool StopLoadOnConfigDisable => true;

		protected override void ApplyChanges()
		{
			if (ModCompat.AIBlacklist.pluginLoaded)
			{
				Debug.LogWarning((object)"RiskyFixes: Disabling VengeanceLevel due to AI Blacklist being loaded.");
			}
			else
			{
				CharacterMaster.onStartGlobal += RunVengeanceChanges;
			}
		}

		private void RunVengeanceChanges(CharacterMaster self)
		{
			if (NetworkServer.active && Object.op_Implicit((Object)(object)self.inventory) && self.inventory.GetItemCount(Items.InvadingDoppelganger) > 0)
			{
				int itemCount = self.inventory.GetItemCount(Items.UseAmbientLevel);
				if (itemCount > 0)
				{
					self.inventory.RemoveItem(Items.UseAmbientLevel, itemCount);
				}
				int itemCount2 = self.inventory.GetItemCount(Items.LevelBonus);
				if (itemCount2 > 0)
				{
					self.inventory.RemoveItem(Items.LevelBonus, itemCount2);
				}
				self.inventory.GiveItem(Items.LevelBonus, (int)(TeamManager.instance.GetTeamLevel((TeamIndex)1) - 1));
			}
		}
	}
}