Decompiled source of MO Manager v1.0.0

MOManager.dll

Decompiled a month 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 Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
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: AssemblyDescription("Displays the types of leads you'll receive in the 'Details' tab of job listings before accepting a side job.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+273527c11e4a6c2eb13227ff012cbdb9e73aa003")]
[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_016e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0193: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
				Enumerator<MurderPreset> enumerator = Toolbox.Instance.allMurderPresets.GetEnumerator();
				while (enumerator.MoveNext())
				{
					MurderPreset current = enumerator.Current;
					if (((SoCustomComparison)current).presetName != null && ((SoCustomComparison)current).presetName.Length != 0 && !(((SoCustomComparison)current).presetName == "Hitman"))
					{
						int value = ConfigFile.Bind<int>("MurderPreset", "Frequency " + ((SoCustomComparison)current).presetName.Trim() + ".", current.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 {current.frequency}, -1 to disable outright.").Value;
						if (value <= 0)
						{
							current.disabled = true;
						}
						else
						{
							current.frequency = value;
						}
					}
				}
				Enumerator<MurderMO> enumerator2 = Toolbox.Instance.allMurderMOs.GetEnumerator();
				while (enumerator2.MoveNext())
				{
					MurderMO current2 = enumerator2.Current;
					if (((SoCustomComparison)current2).presetName != null && ((SoCustomComparison)current2).presetName.Length != 0 && !(((SoCustomComparison)current2).presetName == "Hitman"))
					{
						float value2 = ConfigFile.Bind<float>("MurderMO", "Maximum base score for " + ((SoCustomComparison)current2).presetName.Trim() + ".", current2.pickRandomScoreRange.y, $"The maximum base score for this MO. The higher, the more likely this MO is to be picked. Default is {current2.pickRandomScoreRange.y}, -1 to disable outright.").Value;
						if (value2 <= 0f)
						{
							current2.disabled = true;
						}
						else
						{
							current2.pickRandomScoreRange = new Vector2(current2.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";
	}
}