Decompiled source of QuotaCount v1.0.0

QuotaCount.dll

Decompiled 5 hours 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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
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("QuotaCount")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("My first plugin")]
[assembly: AssemblyTitle("QuotaCount")]
[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 QuotaCount
{
	[BepInPlugin("frare.QuotaCount", "Quota Count", "1.0.0")]
	public class QuotaCountBase : BaseUnityPlugin
	{
		internal const string PLUGIN_GUID = "frare.QuotaCount";

		internal const string PLUGIN_NAME = "Quota Count";

		internal const string PLUGIN_VERSION = "1.0.0";

		internal static QuotaCountBase Instance;

		private readonly Harmony harmony = new Harmony("frare.QuotaCount");

		internal ManualLogSource logger;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			logger = Logger.CreateLogSource("frare.QuotaCount");
			logger.LogInfo((object)"Mod started! :)");
			harmony.PatchAll();
			logger.LogInfo((object)"Mod finished loading!");
		}

		public static void LogMessage(string message, LogLevel logLevel = 32)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Instance.logger.Log(logLevel, (object)message);
		}
	}
}
namespace QuotaCount.Patches
{
	[HarmonyPatch(typeof(TimeOfDay))]
	internal static class TimeOfDayPatch
	{
		[HarmonyPatch("UpdateProfitQuotaCurrentTime")]
		[HarmonyPostfix]
		internal static void UpdateProfitQuotaCurrentTimePostfix(ref TimeOfDay __instance)
		{
			QuotaCountBase.LogMessage("Patching \"TimeOfDay UpdateProfitQuotaCurrentTime\"...", (LogLevel)32);
			((TMP_Text)StartOfRound.Instance.profitQuotaMonitorText).text = $"QUOTA {__instance.timesFulfilledQuota + 1} PROFIT:\n${__instance.quotaFulfilled} / ${__instance.profitQuota}";
			if (__instance.timeUntilDeadline <= 0f)
			{
				((TMP_Text)StartOfRound.Instance.deadlineMonitorText).text = $"QUOTA {__instance.timesFulfilledQuota + 1} DEADLINE:\nNOW";
			}
			else
			{
				((TMP_Text)StartOfRound.Instance.deadlineMonitorText).text = $"QUOTA {__instance.timesFulfilledQuota + 1} DEADLINE:\n{__instance.daysUntilDeadline} Days";
			}
			QuotaCountBase.LogMessage("Done!", (LogLevel)32);
		}
	}
}