Decompiled source of ConfigurablePerPlayerScaling v1.1.0

plugins/ConfigurablePerPlayerScaling.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using ConfigurablePerPlayerScaling.RiskyModStuff;
using HarmonyLib;
using Mdh.RoR2.Run;
using Microsoft.CodeAnalysis;
using MiscFixes.Modules;
using Mono.Cecil.Cil;
using MonoDetour;
using MonoDetour.Cil;
using MonoDetour.DetourTypes;
using MonoDetour.HookGen;
using MonoMod.Cil;
using RiskyMod.Tweaks.RunScaling;
using RoR2;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("RiskyMod")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Lordryn.ConfigurablePerPlayerScaling")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+f648f41a359360d8c17e7a3b44d5588ae05de139")]
[assembly: AssemblyProduct("Lordryn.ConfigurablePerPlayerScaling")]
[assembly: AssemblyTitle("ConfigurablePerPlayerScaling")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[CompilerGenerated]
internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	int ICollection.Count => _items.Length;

	bool ICollection.IsSynchronized => false;

	object ICollection.SyncRoot => this;

	object IList.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	bool IList.IsFixedSize => true;

	bool IList.IsReadOnly => true;

	int IReadOnlyCollection<T>.Count => _items.Length;

	T IReadOnlyList<T>.this[int index] => _items[index];

	int ICollection<T>.Count => _items.Length;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlyArray(T[] items)
	{
		_items = items;
	}

	IEnumerator IEnumerable.GetEnumerator()
	{
		return ((IEnumerable)_items).GetEnumerator();
	}

	void ICollection.CopyTo(Array array, int index)
	{
		((ICollection)_items).CopyTo(array, index);
	}

	int IList.Add(object value)
	{
		throw new NotSupportedException();
	}

	void IList.Clear()
	{
		throw new NotSupportedException();
	}

	bool IList.Contains(object value)
	{
		return ((IList)_items).Contains(value);
	}

	int IList.IndexOf(object value)
	{
		return ((IList)_items).IndexOf(value);
	}

	void IList.Insert(int index, object value)
	{
		throw new NotSupportedException();
	}

	void IList.Remove(object value)
	{
		throw new NotSupportedException();
	}

	void IList.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}

	IEnumerator<T> IEnumerable<T>.GetEnumerator()
	{
		return ((IEnumerable<T>)_items).GetEnumerator();
	}

	void ICollection<T>.Add(T item)
	{
		throw new NotSupportedException();
	}

	void ICollection<T>.Clear()
	{
		throw new NotSupportedException();
	}

	bool ICollection<T>.Contains(T item)
	{
		return ((ICollection<T>)_items).Contains(item);
	}

	void ICollection<T>.CopyTo(T[] array, int arrayIndex)
	{
		((ICollection<T>)_items).CopyTo(array, arrayIndex);
	}

	bool ICollection<T>.Remove(T item)
	{
		throw new NotSupportedException();
	}

	int IList<T>.IndexOf(T item)
	{
		return ((IList<T>)_items).IndexOf(item);
	}

	void IList<T>.Insert(int index, T item)
	{
		throw new NotSupportedException();
	}

	void IList<T>.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Mdh.RoR2.Run
{
	internal static class RecalculateDifficultyCoefficentInternal
	{
		public delegate void PrefixSignature(Run self);

		public delegate void PostfixSignature(Run self);

		public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			Type typeFromHandle = typeof(Run);
			MethodInfo method = typeFromHandle.GetMethod("RecalculateDifficultyCoefficentInternal", (BindingFlags)(-1), null, Array.Empty<Type>(), null);
			if ((object)method == null)
			{
				throw new MissingMethodException("RoR2.Run", "RecalculateDifficultyCoefficentInternal");
			}
			return method;
		}
	}
	internal static class get_instance
	{
	}
	internal static class set_instance
	{
	}
	internal static class OnEnable
	{
	}
	internal static class OnDisable
	{
	}
	internal static class Awake
	{
	}
	internal static class OnStageStartGlobal
	{
	}
	internal static class OnBeginExit
	{
	}
	internal static class get_ruleBook
	{
	}
	internal static class SetRuleBook
	{
	}
	internal static class OnRuleBookUpdated
	{
	}
	internal static class add_onServerRunSetRuleBookGlobal
	{
	}
	internal static class remove_onServerRunSetRuleBookGlobal
	{
	}
	internal static class add_onRunSetRuleBookGlobal
	{
	}
	internal static class remove_onRunSetRuleBookGlobal
	{
	}
	internal static class GetUniqueId
	{
	}
	internal static class AllowRemoteOperation
	{
	}
	internal static class IsRemoteOperationAllowed
	{
	}
	internal static class GetStartTimeUtc
	{
	}
	internal static class SetRunStopwatchPaused
	{
	}
	internal static class GetRunStopwatch
	{
	}
	internal static class SetRunStopwatch
	{
	}
	internal static class get_isRunStopwatchPaused
	{
	}
	internal static class get_loopClearCount
	{
	}
	internal static class get_stageClearCountInCurrentLoop
	{
	}
	internal static class add_onLoopBeginServer
	{
	}
	internal static class remove_onLoopBeginServer
	{
	}
	internal static class OnLoopBeginServer
	{
	}
	internal static class ShouldBeginLoop
	{
	}
	internal static class get_spawnWithPod
	{
	}
	internal static class get_autoGenerateSpawnPoints
	{
	}
	internal static class get_canFamilyEventTrigger
	{
	}
	internal static class get_uiInstances
	{
	}
	internal static class set_uiInstances
	{
	}
	internal static class InstantiateUi
	{
	}
	internal static class UnregisterUi
	{
	}
	internal static class get_seed
	{
	}
	internal static class set_seed
	{
	}
	internal static class GenerateStageRNG
	{
	}
	internal static class GenerateLoopRNG
	{
	}
	internal static class get_selectedDifficulty
	{
	}
	internal static class set_selectedDifficulty
	{
	}
	internal static class get_livingPlayerCount
	{
	}
	internal static class get_participatingPlayerCount
	{
	}
	internal static class get_ambientLevel
	{
	}
	internal static class set_ambientLevel
	{
	}
	internal static class get_ambientLevelFloor
	{
	}
	internal static class set_ambientLevelFloor
	{
	}
	internal static class add_onRunAmbientLevelUp
	{
	}
	internal static class remove_onRunAmbientLevelUp
	{
	}
	internal static class OnAmbientLevelUp
	{
	}
	internal static class get_teamlessDamageCoefficient
	{
	}
	internal static class FixedUpdate
	{
	}
	internal static class RecalculateDifficultyCoefficent
	{
	}
	internal static class InitializeTimeStamps
	{
	}
	internal static class OnFixedUpdate
	{
	}
	internal static class GetLowerPricedChestsTimer
	{
	}
	internal static class Update
	{
	}
	internal static class SetForcePauseRunStopwatch
	{
	}
	internal static class ShouldUpdateRunStopwatch
	{
	}
	internal static class CanUnlockableBeGrantedThisRun_System_String
	{
	}
	internal static class CanUnlockableBeGrantedThisRun_RoR2_UnlockableDef
	{
	}
	internal static class GrantUnlockToAllParticipatingPlayers_System_String
	{
	}
	internal static class GrantUnlockToAllParticipatingPlayers_RoR2_UnlockableDef
	{
	}
	internal static class GrantUnlockToSinglePlayer_System_String_RoR2_CharacterBody
	{
	}
	internal static class GrantUnlockToSinglePlayer_RoR2_UnlockableDef_RoR2_CharacterBody
	{
	}
	internal static class IsUnlockableUnlocked_System_String
	{
	}
	internal static class IsUnlockableUnlocked_RoR2_UnlockableDef
	{
	}
	internal static class DoesEveryoneHaveThisUnlockableUnlocked_System_String
	{
	}
	internal static class DoesEveryoneHaveThisUnlockableUnlocked_RoR2_UnlockableDef
	{
	}
	internal static class ForceUnlockImmediate_System_String
	{
	}
	internal static class ForceUnlockImmediate_RoR2_UnlockableDef
	{
	}
	internal static class PickNextStageSceneFromCurrentSceneDestinations
	{
	}
	internal static class CanPickStage
	{
	}
	internal static class PickNextStageScene
	{
	}
	internal static class GenerateSeedForNewRun
	{
	}
	internal static class RefreshUnlockAvailability
	{
	}
	internal static class BuildUnlockAvailability
	{
	}
	internal static class Start
	{
	}
	internal static class OnDestroy
	{
	}
	internal static class ServerGiveRebirthItems
	{
	}
	internal static class HandlePostRunDestination
	{
	}
	internal static class OnApplicationQuit
	{
	}
	internal static class GetUserMaster
	{
	}
	internal static class OnServerSceneChanged
	{
	}
	internal static class BeginStage
	{
	}
	internal static class EndStage
	{
	}
	internal static class OnUserAdded
	{
	}
	internal static class OnUserRemoved
	{
	}
	internal static class ShouldAllowNewParticipant
	{
	}
	internal static class SetupUserCharacterMaster
	{
	}
	internal static class add_onPlayerFirstCreatedServer
	{
	}
	internal static class remove_onPlayerFirstCreatedServer
	{
	}
	internal static class HandlePlayerFirstEntryAnimation
	{
	}
	internal static class OnServerBossAdded
	{
	}
	internal static class OnServerBossDefeated
	{
	}
	internal static class OnServerCharacterBodySpawned
	{
	}
	internal static class OnServerTeleporterPlaced
	{
	}
	internal static class OnPlayerSpawnPointsPlaced
	{
	}
	internal static class GetTeleportEffectPrefab
	{
	}
	internal static class GetDifficultyScaledCost_System_Int32_System_Single
	{
	}
	internal static class GetDifficultyScaledCost_System_Int32
	{
	}
	internal static class BuildDropTable
	{
	}
	internal static class IsItemAvailable
	{
	}
	internal static class IsEquipmentAvailable
	{
	}
	internal static class IsDroneAvailable
	{
	}
	internal static class IsItemExpansionLocked
	{
	}
	internal static class IsEquipmentExpansionLocked
	{
	}
	internal static class IsDroneExpansionLocked
	{
	}
	internal static class IsPickupAvailable
	{
	}
	internal static class IsPowerShape
	{
	}
	internal static class DisablePickupDrop
	{
	}
	internal static class DisableItemDrop
	{
	}
	internal static class DisableEquipmentDrop
	{
	}
	internal static class EnablePickupDrop
	{
	}
	internal static class EnableItemDrop
	{
	}
	internal static class EnableEquipmentDrop
	{
	}
	internal static class RefreshLunarCombinedDropList
	{
	}
	internal static class CCRunEnd
	{
	}
	internal static class CCRunPrintUnlockables
	{
	}
	internal static class CCRunPrintSeed
	{
	}
	internal static class CCRunSetStagesCleared
	{
	}
	internal static class CCRunPreventGameOver
	{
	}
	internal static class AdvanceStage
	{
	}
	internal static class get_preventGameOver
	{
	}
	internal static class set_preventGameOver
	{
	}
	internal static class ResetEventFlagsOnNewLoop
	{
	}
	internal static class get_isGameOverServer
	{
	}
	internal static class set_isGameOverServer
	{
	}
	internal static class add_onServerGameOver
	{
	}
	internal static class remove_onServerGameOver
	{
	}
	internal static class BeginGameOver
	{
	}
	internal static class OnClientGameOver
	{
	}
	internal static class add_onClientGameOverGlobal
	{
	}
	internal static class remove_onClientGameOverGlobal
	{
	}
	internal static class OverrideRuleChoices
	{
	}
	internal static class ForceChoice_RoR2_RuleChoiceMask_RoR2_RuleChoiceMask_RoR2_RuleChoiceDef
	{
	}
	internal static class ForceChoice_RoR2_RuleChoiceMask_RoR2_RuleChoiceMask_System_String
	{
	}
	internal static class FindSafeTeleportPosition_RoR2_CharacterBody_UnityEngine_Transform
	{
	}
	internal static class FindSafeTeleportPosition_RoR2_CharacterBody_UnityEngine_Transform_System_Single_System_Single
	{
	}
	internal static class FindSafeTeleportPositionSimplified
	{
	}
	internal static class add_onRunStartGlobal
	{
	}
	internal static class remove_onRunStartGlobal
	{
	}
	internal static class add_onRunDestroyGlobal
	{
	}
	internal static class remove_onRunDestroyGlobal
	{
	}
	internal static class add_onAvailablePickupsModified
	{
	}
	internal static class remove_onAvailablePickupsModified
	{
	}
	internal static class SetEventFlag
	{
	}
	internal static class GetEventFlag
	{
	}
	internal static class ResetEventFlag
	{
	}
	internal static class ShouldAllowNonChampionBossSpawn
	{
	}
	internal static class IsExpansionEnabled
	{
	}
	internal static class OnSeedSet
	{
	}
	internal static class _ctor
	{
	}
	internal static class _cctor
	{
	}
	internal static class _PickNextStageScene_g__IsValidNextStage_157_0
	{
	}
	internal static class UNetVersion
	{
	}
	internal static class get_NetworkinSceneTransition
	{
	}
	internal static class set_NetworkinSceneTransition
	{
	}
	internal static class get_Network_uniqueId
	{
	}
	internal static class set_Network_uniqueId
	{
	}
	internal static class get_NetworkisRemoteOperationAllowed
	{
	}
	internal static class set_NetworkisRemoteOperationAllowed
	{
	}
	internal static class get_NetworkstartTimeUtc
	{
	}
	internal static class set_NetworkstartTimeUtc
	{
	}
	internal static class get_NetworkfixedTime
	{
	}
	internal static class set_NetworkfixedTime
	{
	}
	internal static class get_NetworkrunStopwatch
	{
	}
	internal static class set_NetworkrunStopwatch
	{
	}
	internal static class get_NetworkisRunStopwatchForcePaused
	{
	}
	internal static class set_NetworkisRunStopwatchForcePaused
	{
	}
	internal static class get_NetworkstageClearCount
	{
	}
	internal static class set_NetworkstageClearCount
	{
	}
	internal static class get_Network_loopClearCount
	{
	}
	internal static class set_Network_loopClearCount
	{
	}
	internal static class get_NetworkstageClearCountAtLoopStart
	{
	}
	internal static class set_NetworkstageClearCountAtLoopStart
	{
	}
	internal static class get_NetworkselectedDifficultyInternal
	{
	}
	internal static class set_NetworkselectedDifficultyInternal
	{
	}
	internal static class OnSerialize
	{
	}
	internal static class OnDeserialize
	{
	}
	internal static class PreStartClient
	{
	}
	internal static class RunStopwatch
	{
		internal static class _ctor
		{
		}

		internal static class Equals_RoR2_Run_RunStopwatch
		{
		}

		internal static class Equals_System_Object
		{
		}

		internal new static class GetHashCode
		{
		}
	}
	internal static class LoopBeginArgs
	{
		internal static class _ctor
		{
		}
	}
	internal static class TimeStamp
	{
		internal static class _ctor
		{
		}

		internal static class get_timeUntil
		{
		}

		internal static class get_timeSince
		{
		}

		internal static class get_timeUntilClamped
		{
		}

		internal static class get_timeSinceClamped
		{
		}

		internal static class get_hasPassed
		{
		}

		internal new static class GetHashCode
		{
		}

		internal static class get_isInfinity
		{
		}

		internal static class get_isPositiveInfinity
		{
		}

		internal static class get_isNegativeInfinity
		{
		}

		internal static class Update
		{
		}

		internal static class get_now
		{
		}

		internal static class _ctor_System_Single
		{
		}

		internal static class Equals_RoR2_Run_TimeStamp
		{
		}

		internal static class Equals_System_Object
		{
		}

		internal static class CompareTo
		{
		}

		internal static class op_Addition
		{
		}

		internal static class op_Subtraction_RoR2_Run_TimeStamp_System_Single
		{
		}

		internal static class op_Subtraction_RoR2_Run_TimeStamp_RoR2_Run_TimeStamp
		{
		}

		internal static class op_LessThan
		{
		}

		internal static class op_GreaterThan
		{
		}

		internal static class op_LessThanOrEqual
		{
		}

		internal static class op_GreaterThanOrEqual
		{
		}

		internal static class op_Equality
		{
		}

		internal static class op_Inequality
		{
		}

		internal static class op_Subtraction_RoR2_Run_TimeStamp_RoR2_Run_FixedTimeStamp
		{
		}

		internal static class Deserialize
		{
		}

		internal static class Serialize
		{
		}

		internal static class ToXml
		{
		}

		internal static class FromXml
		{
		}

		internal static class Min
		{
		}

		internal static class Max
		{
		}

		internal static class InverseLerp
		{
		}

		internal static class _cctor
		{
		}
	}
	internal static class FixedTimeStamp
	{
		internal static class _ctor
		{
		}

		internal static class get_timeUntil
		{
		}

		internal static class get_timeSince
		{
		}

		internal static class get_timeUntilClamped
		{
		}

		internal static class get_timeSinceClamped
		{
		}

		internal static class get_hasPassed
		{
		}

		internal new static class GetHashCode
		{
		}

		internal static class get_isInfinity
		{
		}

		internal static class get_isPositiveInfinity
		{
		}

		internal static class get_isNegativeInfinity
		{
		}

		internal static class Update
		{
		}

		internal static class get_now
		{
		}

		internal static class _ctor_System_Single
		{
		}

		internal static class Equals_RoR2_Run_FixedTimeStamp
		{
		}

		internal static class Equals_System_Object
		{
		}

		internal static class CompareTo
		{
		}

		internal static class op_Addition
		{
		}

		internal static class op_Subtraction_RoR2_Run_FixedTimeStamp_System_Single
		{
		}

		internal static class op_Subtraction_RoR2_Run_FixedTimeStamp_RoR2_Run_FixedTimeStamp
		{
		}

		internal static class op_LessThan
		{
		}

		internal static class op_GreaterThan
		{
		}

		internal static class op_LessThanOrEqual
		{
		}

		internal static class op_GreaterThanOrEqual
		{
		}

		internal static class op_Equality
		{
		}

		internal static class op_Inequality
		{
		}

		internal static class Deserialize
		{
		}

		internal static class Serialize
		{
		}

		internal static class ToXml
		{
		}

		internal static class FromXml
		{
		}

		internal static class Min
		{
		}

		internal static class Max
		{
		}

		internal static class InverseLerp
		{
		}

		internal static class _cctor
		{
		}
	}
}
namespace MonoDetour.HookGen
{
	internal static class DefaultMonoDetourManager
	{
		internal static MonoDetourManager Instance { get; } = New();

		internal static MonoDetourManager New()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			return new MonoDetourManager(typeof(DefaultMonoDetourManager).Assembly.GetName().Name);
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
	internal class MonoDetourTargetsAttribute(Type? targetType = null) : Attribute(), IMonoDetourTargets
	{
		public Type? TargetType { get; } = targetType;

		public bool IncludeNestedTypes { get; set; } = true;

		public string[]? Members { get; set; }

		public string[]? MemberNamePrefixes { get; set; }

		public string[]? MemberNameSuffixes { get; set; }

		public bool GenerateControlFlowVariants { get; set; }
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	[Embedded]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	[Embedded]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace Microsoft.CodeAnalysis
{
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace ConfigurablePerPlayerScaling
{
	public static class ConfigOptions
	{
		public static class VanillaScaling
		{
			private const string _sectionName = "Vanilla Scaling";

			public static ConfigEntry<float> DifficultyValuePerPlayer;

			public static ConfigEntry<int> MinimumPlayerCountForChangedDifficulty;

			internal static void BindConfigOptions(ConfigFile config)
			{
				DifficultyValuePerPlayer = Extensions.BindOptionSlider<float>(config, "Vanilla Scaling", "Difficulty Value Per Player", "The value that each player contributes to the difficulty scaling over time. This also applies in singleplayer. Vanilla is 0.2", 0.2f, (ConfigFlags)0);
				MinimumPlayerCountForChangedDifficulty = Extensions.BindOptionSlider<int>(config, "Vanilla Scaling", "Minimum Player Count Needed", "The player count needed for the difficulty value change to take effect. Set to 1 to always have the difficulty value change active.", 1, (ConfigFlags)0);
			}
		}

		public static class LinearScaling
		{
			private const string _sectionName = "Linear Scaling (RiskyMod)";

			public static ConfigEntry<float> PlayerFactor;

			public static ConfigEntry<float> PlayerMult;

			public static ConfigEntry<int> MinimumPlayerCountForChangedDifficulty;

			internal static void BindConfigOptions(ConfigFile config)
			{
				PlayerFactor = Extensions.BindOptionSlider<float>(config, "Linear Scaling (RiskyMod)", "Player Factor", "The multiplier used for the playerFactor value. RiskyMod's default is 0.3", 0.3f, (ConfigFlags)0);
				PlayerMult = Extensions.BindOptionSlider<float>(config, "Linear Scaling (RiskyMod)", "Player Multiplier", "The multiplier used for the playerMult value. This is used as an exponent to the player count. RiskyMod's default is 0.15", 0.15f, (ConfigFlags)0);
				MinimumPlayerCountForChangedDifficulty = Extensions.BindOptionSlider<int>(config, "Linear Scaling (RiskyMod)", "Minimum Player Count Needed", "The player count needed for the difficulty value change to take effect. Set to 1 to always have the difficulty value change active.", 1, (ConfigFlags)0);
			}
		}

		internal static void BindConfigOptions(ConfigFile config)
		{
			VanillaScaling.BindConfigOptions(config);
			LinearScaling.BindConfigOptions(config);
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

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

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

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

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

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

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

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Lordryn.ConfigurablePerPlayerScaling", "ConfigurablePerPlayerScaling", "1.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string Id = "Lordryn.ConfigurablePerPlayerScaling";

		public static string Name => "ConfigurablePerPlayerScaling";

		public static string Version => "1.1.0";

		public void Awake()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			Log.Init(((BaseUnityPlugin)this).Logger);
			ConfigOptions.BindConfigOptions(((BaseUnityPlugin)this).Config);
			MonoDetourManager.InvokeHookInitializers(typeof(Plugin).Assembly);
			if (RiskyModSupport.ModIsRunning)
			{
				Harmony val = new Harmony("Lordryn.ConfigurablePerPlayerScaling");
				val.CreateClassProcessor(typeof(RiskyModHooks.HarmonyStuff)).Patch();
			}
		}
	}
	[MonoDetourTargets(typeof(Run))]
	internal static class PerPlayerDifficultyChange
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Manipulator <0>__DoILHook;

			public static Func<float, Run, float> <1>__ChangePerPlayerDifficultyValue;
		}

		private const float defaultRiskyModModdedScaling = 0.15f;

		private const float defaultRoR2Scaling = 0.2f;

		[MonoDetourHookInitialize]
		private static void DoChange()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			if (!RiskyModSupport.ModIsRunning || !RiskyModSupport.LinearScalingEnabled())
			{
				object obj = <>O.<0>__DoILHook;
				if (obj == null)
				{
					Manipulator val = DoILHook;
					<>O.<0>__DoILHook = val;
					obj = (object)val;
				}
				RecalculateDifficultyCoefficentInternal.ILHook((Manipulator)obj);
			}
		}

		private static void DoILHook(ILManipulationInfo info)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			ILWeaver w = new ILWeaver(info);
			if (RiskyModSupport.ModIsRunning && RiskyModSupport.ModdedScalingEnabled())
			{
				Log.Info("Hooking with a different value since RiskyMod's modded scaling is enabled");
				w.MatchRelaxed(new Predicate<Instruction>[4]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_participatingPlayerCount"),
					(Instruction x) => ILPatternMatchingExt.MatchConvR4(x),
					(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.15f) && w.SetCurrentTo(x)
				}).ThrowIfFailure().InsertAfterCurrent((IEnumerable<Instruction>)new <>z__ReadOnlyArray<Instruction>((Instruction[])(object)new Instruction[2]
				{
					w.Create(OpCodes.Ldarg_0),
					w.CreateCall((Delegate)new Func<float, Run, float>(ChangePerPlayerDifficultyValue))
				}));
			}
			else
			{
				w.MatchRelaxed(new Predicate<Instruction>[4]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_participatingPlayerCount"),
					(Instruction x) => ILPatternMatchingExt.MatchConvR4(x),
					(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.2f) && w.SetCurrentTo(x)
				}).ThrowIfFailure().InsertAfterCurrent((IEnumerable<Instruction>)new <>z__ReadOnlyArray<Instruction>((Instruction[])(object)new Instruction[2]
				{
					w.Create(OpCodes.Ldarg_0),
					w.CreateCall((Delegate)new Func<float, Run, float>(ChangePerPlayerDifficultyValue))
				}));
			}
		}

		private static float ChangePerPlayerDifficultyValue(float perPlayerDifficulty, Run run)
		{
			if (run.participatingPlayerCount >= ConfigOptions.VanillaScaling.MinimumPlayerCountForChangedDifficulty.Value)
			{
				perPlayerDifficulty = ConfigOptions.VanillaScaling.DifficultyValuePerPlayer.Value;
			}
			return perPlayerDifficulty;
		}
	}
}
namespace ConfigurablePerPlayerScaling.RiskyModStuff
{
	internal static class RiskyModHooks
	{
		[HarmonyPatch]
		internal static class HarmonyStuff
		{
			private const float defaultPlayerFactor = 0.3f;

			private const float defaultPlayerMult = 0.15f;

			internal static MethodBase TargetMethod()
			{
				return AccessTools.DeclaredMethod(typeof(LinearScaling).GetNestedType("<>c", AccessTools.all), "<.ctor>b__2_0", (Type[])null, (Type[])null);
			}

			[HarmonyILManipulator]
			internal static void DoTheIL(ILContext il)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				ILCursor val = new ILCursor(il);
				if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchConvR4(x),
					(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.3f)
				}))
				{
					val.EmitDelegate<Func<float, float>>((Func<float, float>)((float value) => (Run.instance.participatingPlayerCount >= ConfigOptions.VanillaScaling.MinimumPlayerCountForChangedDifficulty.Value) ? ConfigOptions.LinearScaling.PlayerFactor.Value : value));
				}
				if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchConvR4(x),
					(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.15f)
				}))
				{
					val.EmitDelegate<Func<float, float>>((Func<float, float>)((float value) => (Run.instance.participatingPlayerCount >= ConfigOptions.VanillaScaling.MinimumPlayerCountForChangedDifficulty.Value) ? ConfigOptions.LinearScaling.PlayerMult.Value : value));
				}
			}
		}
	}
	internal static class RiskyModSupport
	{
		internal const string RiskyModGUID = "com.RiskyLives.RiskyMod";

		private static bool? _enabled;

		internal static bool ModIsRunning
		{
			get
			{
				bool valueOrDefault = _enabled == true;
				if (!_enabled.HasValue)
				{
					valueOrDefault = Chainloader.PluginInfos.ContainsKey("com.RiskyLives.RiskyMod");
					_enabled = valueOrDefault;
				}
				return _enabled.Value;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		internal static bool LinearScalingEnabled()
		{
			if (ModIsRunning)
			{
				return LinearScaling.enabled;
			}
			return false;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		internal static bool ModdedScalingEnabled()
		{
			if (ModIsRunning)
			{
				return ModdedScaling.enabled;
			}
			return false;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}