Decompiled source of MurderCooldownAccelerator v0.2.0

m75murdercooldownplugin.dll

Decompiled 9 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.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[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("m75murdercooldownplugin")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A simple mod that speeds up the murder cooldown with a customisable config")]
[assembly: AssemblyFileVersion("0.2.0.0")]
[assembly: AssemblyInformationalVersion("0.2.0")]
[assembly: AssemblyProduct("m75murdercooldownplugin")]
[assembly: AssemblyTitle("m75murdercooldownplugin")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.2.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 m75murdercooldownplugin
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "m75murdercooldownplugin";

		public const string PLUGIN_NAME = "m75murdercooldownplugin";

		public const string PLUGIN_VERSION = "0.2.0";
	}
}
namespace Murdermore
{
	[BepInPlugin("m75murdercooldownplugin", "m75murdercooldownplugin", "0.2.0")]
	public class M75_Murderplugin : BasePlugin
	{
		public static ConfigEntry<float> configMurModifier;

		public static ConfigEntry<bool> configMurIsRand;

		public static ConfigEntry<float> configMurModMin;

		public static ConfigEntry<float> configMurModMax;

		public override void Load()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			ManualLogSource log = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(26, 0, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Murder cooldown mod loaded");
			}
			log.LogInfo(val);
			configMurModifier = ((BasePlugin)this).Config.Bind<float>("General", "MurModifier", 1f, "This number will be added to the murder cooldown timer, higher numbers lowers the cooldown. A value of 1 will double the murder cooldown speed, a value of 0 will leave the default speed.\nNegative numbers slow down the timer, a value of -0.5 will halve the cooldown speed, and a value of -0.8 will slow the cooldown by 5 times. \nDefault murder timer is 12 hours, but may differ based on murder type\nNote that murders take time, so larger maps will take longer regardless.");
			configMurIsRand = ((BasePlugin)this).Config.Bind<bool>("Random", "MurIsRand", false, "If set to true, the modifier will be set randomly between the two below settings, changing every murder.");
			configMurModMin = ((BasePlugin)this).Config.Bind<float>("Random", "MurModMin", -0.5f, "If random mode is on, the minimum range of the randomness.");
			configMurModMax = ((BasePlugin)this).Config.Bind<float>("Random", "MurModMax", 0.5f, "If random mode is on, the maximum range of the randomness.");
			Harmony val2 = new Harmony("m75murdercooldownplugin");
			val2.PatchAll();
		}
	}
	[HarmonyPatch(typeof(MurderController), "Tick")]
	public class M75_MurderController_Patch
	{
		private static float murMult = M75_Murderplugin.configMurModifier.Value;

		private static bool randomMode = M75_Murderplugin.configMurIsRand.Value;

		private static float murRandMin = M75_Murderplugin.configMurModMin.Value;

		private static float murRandMax = M75_Murderplugin.configMurModMax.Value;

		private static string citySeed = CityData.Instance.seed;

		public static void Postfix(float timePassed)
		{
			if (MurderController.Instance.pauseBetweenMurders >= 0f)
			{
				if (!randomMode)
				{
					MurderController instance = MurderController.Instance;
					instance.pauseBetweenMurders -= timePassed * murMult;
				}
				if (randomMode)
				{
					MurderController instance2 = MurderController.Instance;
					instance2.pauseBetweenMurders -= timePassed * GetRandMurModifier();
				}
			}
			static float GetRandMurModifier()
			{
				int num = MurderController.Instance.activeMurders.Count + MurderController.Instance.inactiveMurders.Count;
				return Toolbox.Instance.GetPsuedoRandomNumber(murRandMin, murRandMax, citySeed + num, true);
			}
		}
	}
}