Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of QuotaCount v1.1.5
QuotaCount.dll
Decompiled a year agousing System; using System.Diagnostics; using System.Linq; 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+76b57e22017b6b2cbc0f518e47802a0e3d3c0bc9")] [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.1.5")] public class QuotaCountBase : BaseUnityPlugin { internal const string PLUGIN_GUID = "frare.QuotaCount"; internal const string PLUGIN_NAME = "Quota Count"; internal const string PLUGIN_VERSION = "1.1.5"; internal static QuotaCountBase Instance; private readonly Harmony harmony = new Harmony("frare.QuotaCount"); internal ManualLogSource logger; public static bool DisplayInProfit { get; private set; } public static bool DisplayInDeadline { get; private set; } public static bool DisplayInGameOver { get; private set; } public static string CurrentQuotaString => $"QUOTA {TimeOfDay.Instance.timesFulfilledQuota + 1}"; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } logger = Logger.CreateLogSource("frare.QuotaCount"); logger.LogInfo((object)"Mod started! :)"); LoadFromConfig(); harmony.PatchAll(); logger.LogInfo((object)"Mod finished loading!"); } private void LoadFromConfig() { DisplayInProfit = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DisplayInProfitQuotaMonitor", true, "Display count in PROFIT QUOTA monitor").Value; DisplayInDeadline = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DisplayInDeadlineMonitor", true, "Display count in DEADLINE monitor").Value; DisplayInGameOver = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DisplayInGameOverScreen", true, "Display total quotas fulfilled in the YOU ARE FIRED screen (game over screen)").Value; } 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(HUDManager))] internal static class HUDManagerPatch { private static TextMeshProUGUI tmp; private static string originalText; [HarmonyPatch("Awake")] [HarmonyPostfix] internal static void AwakePostfix(ref HUDManager __instance) { QuotaCountBase.LogMessage("Patching \"HUDManager Awake\"...", (LogLevel)32); TextMeshProUGUI[] componentsInChildren = ((Component)__instance.playersFiredAnimator).GetComponentsInChildren<TextMeshProUGUI>(); tmp = componentsInChildren.First((TextMeshProUGUI component) => ((TMP_Text)component).text.Contains("quota", StringComparison.OrdinalIgnoreCase)); originalText = ((TMP_Text)tmp).text; QuotaCountBase.LogMessage("Static TMP component reference and original text are ready", (LogLevel)32); if ((Object)(object)tmp == (Object)null) { QuotaCountBase.LogMessage("Could not find the TMP component containing profit quota text", (LogLevel)2); } else { QuotaCountBase.LogMessage("Done!", (LogLevel)32); } } [HarmonyPatch("ShowPlayersFiredScreen")] [HarmonyPostfix] internal static void ShowPlayersFiredScreenPostfix(ref HUDManager __instance, bool show) { if (show) { QuotaCountBase.LogMessage("Patching \"HUDManager ShowPlayersFiredScreen\"...", (LogLevel)32); if (!QuotaCountBase.DisplayInGameOver) { QuotaCountBase.LogMessage("NOT UPDATING GAME OVER SCREEN:Config is set to false", (LogLevel)32); } else if ((Object)(object)tmp != (Object)null) { ((TMP_Text)tmp).text = originalText + "\nTOTAL QUOTAS FULFILLED: " + TimeOfDay.Instance.timesFulfilledQuota; QuotaCountBase.LogMessage("Updated game over screen", (LogLevel)32); QuotaCountBase.LogMessage("Done!", (LogLevel)32); } else { QuotaCountBase.LogMessage("Could not find the static TMP component reference", (LogLevel)2); } } } } [HarmonyPatch(typeof(TimeOfDay))] internal static class TimeOfDayPatch { [HarmonyPatch("UpdateProfitQuotaCurrentTime")] [HarmonyPostfix] internal static void UpdateProfitQuotaCurrentTimePostfix(ref TimeOfDay __instance) { QuotaCountBase.LogMessage("Patching \"TimeOfDay UpdateProfitQuotaCurrentTime\"...", (LogLevel)32); if (QuotaCountBase.DisplayInProfit) { TextMeshProUGUI profitQuotaMonitorText = StartOfRound.Instance.profitQuotaMonitorText; ((TMP_Text)profitQuotaMonitorText).text = $"{QuotaCountBase.CurrentQuotaString} PROFIT:\n${__instance.quotaFulfilled} / ${__instance.profitQuota}"; QuotaCountBase.LogMessage("Updated profit quota monitor", (LogLevel)32); } if (QuotaCountBase.DisplayInDeadline) { TextMeshProUGUI deadlineMonitorText = StartOfRound.Instance.deadlineMonitorText; ((TMP_Text)deadlineMonitorText).text = QuotaCountBase.CurrentQuotaString + " DEADLINE:\n" + ((__instance.daysUntilDeadline <= 0) ? "NOW" : (__instance.daysUntilDeadline + " Days")); QuotaCountBase.LogMessage("Updating deadline monitor", (LogLevel)32); } QuotaCountBase.LogMessage("Done!", (LogLevel)32); } } }