Decompiled source of SimulacrumConfig v1.0.0

SimulacrumConfig.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SimulacrumConfig")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SimulacrumConfig")]
[assembly: AssemblyTitle("SimulacrumConfig")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RemoveMonsterLevelCap
{
	[BepInPlugin("idolfan.SimulacrumConfig", "SimulacrumConfig", "1.0.0")]
	internal class DifficultyExample : BaseUnityPlugin
	{
		public const string PluginGUID = "idolfan.SimulacrumConfig";

		public const string PluginAuthor = "idolfan";

		public const string PluginName = "SimulacrumConfig";

		public const string PluginVersion = "1.0.0";

		public static FogDamageController fogDamageController;

		public static ConfigEntry<float> healthFractionPerSecond { get; set; }

		public static ConfigEntry<float> dangerBuffDuration { get; set; }

		public static ConfigEntry<float> healthFractionRampCoefficientPerSecond { get; set; }

		public static ConfigEntry<float> tickPeriodSeconds { get; set; }

		public static ConfigEntry<bool> incrementExponentially { get; set; }

		public static ConfigEntry<float> extraVoidFieldsDamageMultiplier { get; set; }

		public static ConfigEntry<float> healthFractionRampIncreaseCooldown { get; set; }

		public static ConfigEntry<bool> debug { get; set; }

		public static bool rooInstalled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");

		private void Awake()
		{
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Expected O, but got Unknown
			healthFractionPerSecond = ((BaseUnityPlugin)this).Config.Bind<float>("Void Fog", "Health Fraction per Second", 0.1f, "The base percentage of health lost per second.");
			dangerBuffDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Void Fog", "Debuff duration", 0.4f, "How long the fog-debuff will lasts.");
			healthFractionRampCoefficientPerSecond = ((BaseUnityPlugin)this).Config.Bind<float>("Void Fog", "Ramp Coefficient", 1.25f, "The coefficient to increase the damage for each tick inside the void fog.");
			tickPeriodSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Void Fog", "Tick Period", 0.2f, "The time (in seconds) between each tick");
			incrementExponentially = ((BaseUnityPlugin)this).Config.Bind<bool>("Void Fog", "Exponential damage", false, "Whether exponential damage increase is enabled. \n false -> ramp_coefficient * stacks \n true -> ramp_coefficient ** stacks ");
			extraVoidFieldsDamageMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Void Fog", "Void Fields extra Damage", 0f, "How often the damage is exponentially increased by 25% inside the Void Fields");
			healthFractionRampIncreaseCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Void Fog", "Cooldown between stacks", 5f, "The cooldown in seconds between gaining another Fog-Debuff Stack ( -> to increase damage ).");
			debug = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "Logs", false, "Enables debug logs. For development.");
			if (rooInstalled)
			{
				initRiskOfOptions();
			}
			InfiniteTowerRun.OnPrePopulateSceneServer += new hook_OnPrePopulateSceneServer(InfiniteTowerRun_OnPrePopulateSceneServer);
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private void initRiskOfOptions()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_005b: 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_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Expected O, but got Unknown
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: 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_0106: Expected O, but got Unknown
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Expected O, but got Unknown
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Expected O, but got Unknown
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Expected O, but got Unknown
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Expected O, but got Unknown
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Expected O, but got Unknown
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Expected O, but got Unknown
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Expected O, but got Unknown
			ModSettingsManager.SetModDescription("Change the workings of the SimulacrumConfig mod", "idolfan.SimulacrumConfig", "SimulacrumConfig");
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(healthFractionPerSecond, new StepSliderConfig
			{
				increment = 0.01f,
				min = 0.01f,
				max = 1f
			}), "idolfan.SimulacrumConfig", "SimulacrumConfig");
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(dangerBuffDuration, new StepSliderConfig
			{
				increment = 0.05f,
				min = 0.1f,
				max = 2f
			}), "idolfan.SimulacrumConfig", "SimulacrumConfig");
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(healthFractionRampCoefficientPerSecond, new StepSliderConfig
			{
				increment = 0.05f,
				min = 0.1f,
				max = 10f
			}), "idolfan.SimulacrumConfig", "SimulacrumConfig");
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(tickPeriodSeconds, new StepSliderConfig
			{
				increment = 0.05f,
				min = 0.05f,
				max = 1f
			}), "idolfan.SimulacrumConfig", "SimulacrumConfig");
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(incrementExponentially), "idolfan.SimulacrumConfig", "SimulacrumConfig");
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(extraVoidFieldsDamageMultiplier, new StepSliderConfig
			{
				increment = 1f,
				min = 0f,
				max = 10f
			}), "idolfan.SimulacrumConfig", "SimulacrumConfig");
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(healthFractionRampIncreaseCooldown, new StepSliderConfig
			{
				increment = 1f,
				min = 1f,
				max = 30f
			}), "idolfan.SimulacrumConfig", "SimulacrumConfig");
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(debug), "idolfan.SimulacrumConfig", "SimulacrumConfig");
			healthFractionPerSecond.SettingChanged += delegate
			{
				EditFogDamageController();
			};
			dangerBuffDuration.SettingChanged += delegate
			{
				EditFogDamageController();
			};
			healthFractionRampCoefficientPerSecond.SettingChanged += delegate
			{
				EditFogDamageController();
			};
			tickPeriodSeconds.SettingChanged += delegate
			{
				EditFogDamageController();
			};
			incrementExponentially.SettingChanged += delegate
			{
				EditFogDamageController();
			};
			extraVoidFieldsDamageMultiplier.SettingChanged += delegate
			{
				EditFogDamageController();
			};
			healthFractionRampIncreaseCooldown.SettingChanged += delegate
			{
				EditFogDamageController();
			};
		}

		private void InfiniteTowerRun_OnPrePopulateSceneServer(orig_OnPrePopulateSceneServer orig, InfiniteTowerRun self, SceneDirector sceneDirector)
		{
			orig.Invoke(self, sceneDirector);
			Run instance = Run.instance;
			InfiniteTowerRun val = (InfiniteTowerRun)(object)((instance is InfiniteTowerRun) ? instance : null);
			fogDamageController = val.fogDamageController;
			Debug.Log((object)("SimulacrumConfig, FogDamageController: " + (object)fogDamageController));
			EditFogDamageController();
		}

		private void EditFogDamageController()
		{
			if (!Object.op_Implicit((Object)(object)fogDamageController))
			{
				if (debug.Value)
				{
					Debug.Log((object)"SimulacrumConfig, FogDamageController is null, cannot edit fields.");
				}
				return;
			}
			FogDamageController val = fogDamageController;
			if (debug.Value)
			{
				Debug.Log((object)("SimulacrumConfig, Fields before edit: " + val.healthFractionPerSecond + ", " + val.dangerBuffDuration + ", " + val.healthFractionRampCoefficientPerSecond + ", " + val.tickPeriodSeconds + ", " + val.incrementExponentially + ", " + val.extraVoidFieldsDamageMultiplier + ", " + val.healthFractionRampIncreaseCooldown));
			}
			val.healthFractionPerSecond = healthFractionPerSecond.Value;
			val.dangerBuffDuration = dangerBuffDuration.Value;
			val.healthFractionRampCoefficientPerSecond = healthFractionRampCoefficientPerSecond.Value;
			val.tickPeriodSeconds = tickPeriodSeconds.Value;
			val.incrementExponentially = incrementExponentially.Value;
			val.extraVoidFieldsDamageMultiplier = (int)extraVoidFieldsDamageMultiplier.Value;
			val.healthFractionRampIncreaseCooldown = healthFractionRampIncreaseCooldown.Value;
			if (debug.Value)
			{
				Debug.Log((object)("SimulacrumConfig, Fields after edit: " + val.healthFractionPerSecond + ", " + val.dangerBuffDuration + ", " + val.healthFractionRampCoefficientPerSecond + ", " + val.tickPeriodSeconds + ", " + val.incrementExponentially + ", " + val.extraVoidFieldsDamageMultiplier + ", " + val.healthFractionRampIncreaseCooldown));
			}
		}
	}
}
namespace ExamplePlugin
{
	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);
		}
	}
}