Decompiled source of MO Manager v1.0.1

MOManager.dll

Decompiled a week 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.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using SOD.Common.Extensions;
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(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("MOManager")]
[assembly: AssemblyConfiguration("IL2CPP")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+76a95e773e77b6acae3af1ab552837269b8c473d")]
[assembly: AssemblyProduct("MOManager")]
[assembly: AssemblyTitle("MOManager")]
[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 MOManager
{
	[BepInPlugin("MOManager", "MOManager", "1.0.0")]
	public class MOManagerPlugin : BasePlugin
	{
		[HarmonyPatch(typeof(Toolbox), "Start")]
		public class Toolbox_Start
		{
			public static void Postfix()
			{
				//IL_016a: Unknown result type (might be due to invalid IL or missing references)
				//IL_018f: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
				foreach (MurderPreset item in GameExtensions.GetFromResourceCache<MurderPreset>(Toolbox.Instance))
				{
					if (!string.IsNullOrEmpty(((SoCustomComparison)item).presetName) && !(((SoCustomComparison)item).presetName == "Hitman"))
					{
						int value = ConfigFile.Bind<int>("MurderPreset", "Frequency " + ((SoCustomComparison)item).presetName.Trim() + ".", item.frequency, $"The frequency for this Preset. This preset is added to the pool this many times, and then a preset is selected from the pool at random. Default is {item.frequency}, -1 to disable outright.").Value;
						if (value <= 0)
						{
							item.disabled = true;
						}
						else
						{
							item.frequency = value;
						}
					}
				}
				foreach (MurderMO item2 in GameExtensions.GetFromResourceCache<MurderMO>(Toolbox.Instance))
				{
					if (!string.IsNullOrEmpty(((SoCustomComparison)item2).presetName) && !(((SoCustomComparison)item2).presetName == "Hitman"))
					{
						float value2 = ConfigFile.Bind<float>("MurderMO", "Maximum base score for " + ((SoCustomComparison)item2).presetName.Trim() + ".", item2.pickRandomScoreRange.y, $"The maximum base score for this MO. The higher, the more likely this MO is to be picked. Default is {item2.pickRandomScoreRange.y}, -1 to disable outright.").Value;
						if (value2 <= 0f)
						{
							item2.disabled = true;
						}
						else
						{
							item2.pickRandomScoreRange = new Vector2(item2.pickRandomScoreRange.x, value2);
						}
					}
				}
			}
		}

		public static ConfigEntry<bool> Enabled;

		public static ManualLogSource PluginLogger;

		public static ConfigFile ConfigFile;

		public override void Load()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			PluginLogger = ((BasePlugin)this).Log;
			Enabled = ((BasePlugin)this).Config.Bind<bool>("General", "Enabled", true, "Is the mod enabled at all? (Game restart required after changing any settings at all)");
			if (Enabled.Value)
			{
				ManualLogSource pluginLogger = PluginLogger;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("MOManager");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
				}
				pluginLogger.LogInfo(val);
				Harmony val2 = new Harmony("MOManager");
				val2.PatchAll();
				ManualLogSource pluginLogger2 = PluginLogger;
				val = new BepInExInfoLogInterpolatedStringHandler(19, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("MOManager");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is patched!");
				}
				pluginLogger2.LogInfo(val);
				ConfigFile = ((BasePlugin)this).Config;
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "MOManager";

		public const string PLUGIN_NAME = "MOManager";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}