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 ShowPlantProgress v1.5.3
ShowPlantProgress.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("ShowPlantProgress")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright © 2025 KompjoeFriek")] [assembly: AssemblyFileVersion("1.5.3.0")] [assembly: AssemblyInformationalVersion("1.5.3+d75eb0d4345556ef5af3e3aafff5ea8d7ec000d3")] [assembly: AssemblyProduct("Show Plant Progress")] [assembly: AssemblyTitle("ShowPlantProgress")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/kompjoefriek/ShowPlantProgress")] [assembly: AssemblyVersion("1.5.3.0")] [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 ShowPlantProgress { [BepInPlugin("kompjoefriek.showplantprogress", "Show Plant Progress", "1.5.3")] [HarmonyPatch] public class ShowPlantProgressPlugin : BaseUnityPlugin { internal const string _modVersion = "1.5.3"; internal const string _modDescription = "Show Plant Progress"; internal const string _modUid = "kompjoefriek.showplantprogress"; internal static ManualLogSource Logger; private Harmony _harmony; private static ConfigEntry<bool> _configEnableMod; private static ConfigEntry<bool> _configEnableLogging; private static ConfigEntry<bool> _configShowPercentage; private static ConfigEntry<bool> _configShowColorPercentage; private static ConfigEntry<bool> _configShowTime; private static ConfigEntry<int> _configAmountOfDecimals; private static readonly List<string> _bushList = new List<string>(3) { "RaspberryBush(Clone)", "BlueberryBush(Clone)", "CloudberryBush(Clone)" }; private static object _logObject; private static DateTime _lastLogTime; private void Awake() { //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; _configEnableMod = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - Global", "Enable Mod", true, "Enable or disable this mod"); _configEnableLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - Global", "Enable Mod Logging", false, "Enable or disable logging for this mod"); _configShowPercentage = ((BaseUnityPlugin)this).Config.Bind<bool>("2 - Progress", "Show Percentage", true, "Shows the plant or pickable progress as a percentage when you hover over the plant or pickable"); _configShowColorPercentage = ((BaseUnityPlugin)this).Config.Bind<bool>("2 - Progress", "Show Percentage Color", true, "Makes it so the percentage changes color depending on the progress"); _configAmountOfDecimals = ((BaseUnityPlugin)this).Config.Bind<int>("2 - Progress", "Show Percentage Decimal Places", 2, "The amount of decimal places to show for the percentage"); _configShowTime = ((BaseUnityPlugin)this).Config.Bind<bool>("2 - Progress", "Show Time", false, "Show the time when done"); Dictionary<ConfigDefinition, string> entries = Traverse.Create((object)((BaseUnityPlugin)this).Config).Property("OrphanedEntries", (object[])null).GetValue<Dictionary<ConfigDefinition, string>>(); if (entries != null) { ConfigDefinition val = new ConfigDefinition("2 - General", "Amount of Decimal Places"); ConfigDefinition val2 = new ConfigDefinition("2 - General", "Show Time"); string value; bool num = entries.TryGetValue(val, out value); string value2; bool flag = entries.TryGetValue(val2, out value2); bool flag2 = false; if (num) { ((ConfigEntryBase)_configAmountOfDecimals).SetSerializedValue(value); flag2 |= RemoveDeprecatedConfigDefinition(ref entries, val); } if (flag) { ((ConfigEntryBase)_configAmountOfDecimals).SetSerializedValue(value2); flag2 |= RemoveDeprecatedConfigDefinition(ref entries, val2); } if (_configEnableLogging.Value) { foreach (KeyValuePair<ConfigDefinition, string> item in entries) { Logger.LogWarning((object)("Orphaned config: " + ((object)item.Key).ToString())); } } if (flag2) { ((BaseUnityPlugin)this).Config.Save(); } } _lastLogTime = DateTime.Now; if (_configEnableMod.Value) { _harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); } } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private static bool RemoveDeprecatedConfigDefinition(ref Dictionary<ConfigDefinition, string> entries, ConfigDefinition definition) { if (!entries.Remove(definition)) { Logger.LogWarning((object)("Failed to remove deprecated config: " + ((object)definition).ToString())); return false; } return true; } private static string GetColorStringFromPercentage(double percentage) { if (!_configShowColorPercentage.Value) { return "white"; } if (percentage >= 75.0) { return "green"; } if (percentage >= 50.0) { return "yellow"; } if (percentage >= 25.0) { return "orange"; } return "red"; } private static string GetValueAsColoredString(string color, double value) { return $"<color={color}>{value}%</color>"; } private static string FormatSecondsAsString(double seconds) { int num = (int)(seconds / 3600.0); double num2 = seconds - (double)num * 3600.0; int num3 = (int)(num2 / 60.0); int num4 = (int)(num2 - (double)num3 * 60.0); if (num >= 1) { return $"{num:D2}:{num3:D2}:{num4:D2}"; } return $"{num3:D2}:{num4:D2}"; } private static void LogInfoThrottled(object obj, string message) { if (!_configEnableLogging.Value) { return; } if (object.Equals(_logObject, obj)) { if ((DateTime.Now - _lastLogTime).TotalSeconds >= 1.0) { _logObject = obj; _lastLogTime = DateTime.Now; Logger.LogInfo((object)message); } } else { _logObject = obj; _lastLogTime = DateTime.Now; Logger.LogInfo((object)message); } } [HarmonyPostfix] [HarmonyPatch(typeof(Plant), "GetHoverText")] public static string PlantGetHoverText_Patch(string __result, Plant __instance) { if ((Object)(object)__instance == (Object)null) { return __result; } if (_configShowPercentage.Value) { double value = Traverse.Create((object)__instance).Method("TimeSincePlanted", Array.Empty<object>()).GetValue<double>(); float value2 = Traverse.Create((object)__instance).Method("GetGrowTime", Array.Empty<object>()).GetValue<float>(); if (value >= (double)value2) { return __result; } double num = value / (double)value2 * 100.0; string text = GetValueAsColoredString(GetColorStringFromPercentage(num), Math.Round(num, _configAmountOfDecimals.Value, MidpointRounding.AwayFromZero)); string text2 = "Plant percentage: " + num + ", time planted: " + value + ", grow time: " + value2; if (_configShowTime.Value) { double seconds = (double)value2 - value; string text3 = FormatSecondsAsString(seconds); text = text + ", " + text3; text2 = text2 + "\nPlant timeRemaining: " + seconds + " (seconds), formatted: " + text3; } LogInfoThrottled(__instance, text2); string text4 = __result.Replace(" )", ", " + text + " )"); if (_configShowTime.Value) { return text4.Replace(" (", "\n("); } return text4; } if (_configShowTime.Value) { double value3 = Traverse.Create((object)__instance).Method("TimeSincePlanted", Array.Empty<object>()).GetValue<double>(); float value4 = Traverse.Create((object)__instance).Method("GetGrowTime", Array.Empty<object>()).GetValue<float>(); if (value3 >= (double)value4) { return __result; } double seconds2 = (double)value4 - value3; string text5 = FormatSecondsAsString(seconds2); LogInfoThrottled(__instance, "Plant timeRemaining: " + seconds2 + " (seconds), formatted: " + text5); return __result.Replace(" )", ", " + text5 + " )"); } return __result; } [HarmonyPostfix] [HarmonyPatch(typeof(Pickable), "GetHoverText")] public static string BerryBushPickable_Patch(string __result, Pickable __instance, ZNetView ___m_nview) { if ((Object)(object)__instance == (Object)null) { return __result; } if (!_bushList.Contains(((Object)__instance).name)) { return __result; } if (_configShowPercentage.Value) { DateTime dateTime = new DateTime(___m_nview.GetZDO().GetLong(ZDOVars.s_pickedTime, 0L)); double totalSeconds = (ZNet.instance.GetTime() - dateTime).TotalSeconds; double num = (double)__instance.m_respawnTimeMinutes * 60.0; if (totalSeconds >= num) { return __result; } double num2 = totalSeconds / num * 100.0; string text = GetValueAsColoredString(GetColorStringFromPercentage(num2), Math.Round(num2, _configAmountOfDecimals.Value, MidpointRounding.AwayFromZero)); string text2 = "BerryBushPickable percentage: " + num2 + ", time since start: " + totalSeconds + ", respawn time: " + num; if (_configShowTime.Value) { double seconds = num - totalSeconds; string text3 = FormatSecondsAsString(seconds); text = text + ", " + text3; text2 = text2 + "\nBerryBushPickable timeRemaining: " + seconds + " (seconds), formatted: " + text3; } LogInfoThrottled(__instance, text2); string text4 = Localization.instance.Localize(__instance.GetHoverName()); return __result + text4 + " ( " + text + " )"; } if (_configShowTime.Value) { DateTime dateTime2 = new DateTime(___m_nview.GetZDO().GetLong(ZDOVars.s_pickedTime, 0L)); double totalSeconds2 = (ZNet.instance.GetTime() - dateTime2).TotalSeconds; double num3 = (double)__instance.m_respawnTimeMinutes * 60.0; if (totalSeconds2 >= num3) { return __result; } double seconds2 = num3 - totalSeconds2; string text5 = FormatSecondsAsString(seconds2); LogInfoThrottled(__instance, "BerryBushPickable timeRemaining: " + seconds2 + " (seconds), formatted: " + text5); string text6 = Localization.instance.Localize(__instance.GetHoverName()); return __result + text6 + " ( " + text5 + " )"; } return __result; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "ShowPlantProgress"; public const string PLUGIN_NAME = "Show Plant Progress"; public const string PLUGIN_VERSION = "1.5.3"; } }