Decompiled source of IncreasedDeadlines v1.0.0

increasedDeadlines.dll

Decompiled a year 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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using increasedDeadlines;

[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("increasedDeadlines")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("increasedDeadlines")]
[assembly: AssemblyTitle("increasedDeadlines")]
[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 IncreasedDeadlines.NewQuotaPatch
{
	[HarmonyPatch(typeof(TimeOfDay))]
	public class QuotaPatch
	{
		[HarmonyPatch("SetNewProfitQuota")]
		[HarmonyPostfix]
		private static void NewQuota(TimeOfDay __instance)
		{
			bool isHost = ((NetworkBehaviour)RoundManager.Instance).IsHost;
			int num = __instance.profitQuota / IncreasedDeadlinesMod.quotaCheck;
			if (num > 0)
			{
				if (isHost)
				{
					__instance.timeUntilDeadline = (float)(__instance.quotaVariables.deadlineDaysAmount + num) * __instance.totalTime;
					IncreasedDeadlinesMod.logSrc.LogInfo((object)$"Quota check is {num}, timeUntilDeadline is {__instance.timeUntilDeadline}");
					TimeOfDay.Instance.SyncTimeClientRpc(__instance.globalTime, (int)__instance.timeUntilDeadline);
				}
				else
				{
					IncreasedDeadlinesMod.logSrc.LogInfo((object)"Not host, not sending Rpc. Host will handle.");
				}
			}
		}
	}
}
namespace IncreasedDeadlines.HostDebug
{
	[HarmonyPatch(typeof(TimeOfDay), "Update")]
	public class Debug
	{
		private static KeyControl debugKey = Keyboard.current.numpad5Key;

		[HarmonyPostfix]
		public static void DebugQuotaFulfilled(TimeOfDay __instance)
		{
			bool isHost = ((NetworkBehaviour)RoundManager.Instance).IsHost;
			if (((ButtonControl)debugKey).wasPressedThisFrame && IncreasedDeadlinesMod.configDebug.Value && isHost)
			{
				IncreasedDeadlinesMod.logSrc.LogInfo((object)"Host pressed num5, increasing quota fulfilled by 100");
				IncreasedDeadlinesMod.logSrc.LogInfo((object)$"Is host: {isHost}");
				__instance.quotaFulfilled += 100;
				((TMP_Text)StartOfRound.Instance.profitQuotaMonitorText).text = $"PROFIT QUOTA:\n${__instance.quotaFulfilled} / ${__instance.profitQuota}";
			}
			else if (((ButtonControl)debugKey).wasPressedThisFrame && !IncreasedDeadlinesMod.configDebug.Value && isHost)
			{
				IncreasedDeadlinesMod.logSrc.LogWarning((object)"Host pressed num5, but debug mode is disabled");
			}
			else if (((ButtonControl)debugKey).wasPressedThisFrame && !isHost)
			{
				IncreasedDeadlinesMod.logSrc.LogWarning((object)"Not host, wont do anything.");
			}
		}
	}
}
namespace increasedDeadlines
{
	[BepInPlugin("Rocksnotch.IncreasedDeadlines", "Increased Deadlines", "1.0.0")]
	[BepInProcess("Lethal Company.exe")]
	public class IncreasedDeadlinesMod : BaseUnityPlugin
	{
		private ConfigEntry<string> configGreeting;

		public static ConfigEntry<int> configQuota;

		public static ConfigEntry<bool> configDebug;

		internal static IncreasedDeadlinesMod Instance;

		public static int quotaCheck = 0;

		public Harmony harmony = new Harmony("Rocksnotch.IncreasedDeadlines");

		public static ManualLogSource logSrc = Logger.CreateLogSource("loggingSource");

		private const string modName = "Increased Deadlines";

		private const string modVersion = "1.0.0";

		private const string modGUID = "Rocksnotch.IncreasedDeadlines";

		public IncreasedDeadlinesMod()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			configGreeting = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Plugin Startup Message", "Plugin Rocksnotch.IncreasedDeadlines is loaded!", "Message that is displayed when the plugin loads");
			configQuota = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Quota Goal", 900, "Days until quota updates by when you reach past this goal (Ex: 900 = 1 day, 1800 = 2 days, etc.)");
			configDebug = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "Host Debug Mode", false, "Enable this to allow debug commands to be used by the host (MAY BREAK GAME!)");
		}

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			if (configQuota.Value > 0)
			{
				quotaCheck = configQuota.Value;
				((BaseUnityPlugin)this).Logger.LogInfo((object)$"Quota check set to {quotaCheck}");
			}
			if (configGreeting.Value != null)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)configGreeting.Value);
			}
			harmony.PatchAll();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "increasedDeadlines";

		public const string PLUGIN_NAME = "increasedDeadlines";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}