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 EndOfDayCountdown; using FacilityMeltdown End of day countdown compatibility.NetcodePatcher; using FacilityMeltdown.MeltdownSequence.Behaviours; using Friskzips.patch; using Friskzips.service; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Mathematics; 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: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("FacilityMeltdown End of day countdown compatibility")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.3.0")] [assembly: AssemblyInformationalVersion("1.0.3-alpha.0.3+4adf066305e6d2ab282b30c8a323ba3675a0a955")] [assembly: AssemblyProduct("FacilityMeltdown End of day countdown compatibility")] [assembly: AssemblyTitle("FacilityMeltdown End of day countdown compatibility")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class { static () { } } 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 YourThunderstoreTeam { public static class MyPluginInfo { public const string PLUGIN_GUID = "FacilityMeltdown End of day countdown compatibility"; public const string PLUGIN_NAME = "FacilityMeltdown End of day countdown compatibility"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace Friskzips { public static class PluginInfo { public const string PLUGIN_GUID = "Friskzips.FM-EODC-C"; public const string PLUGIN_NAME = "FM-EODC-C"; public const string PLUGIN_VERSION = "1.4.0"; } [BepInPlugin("Friskzips.FM-EODC-C", "FM-EODC-C", "1.4.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static readonly ManualLogSource Log = Logger.CreateLogSource("FM-EODC-C"); private readonly Harmony _harmony = new Harmony("Friskzips.FM-EODC-C"); public TemplateService Service; public static Plugin Instance { get; set; } public Plugin() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown Instance = this; } private void Awake() { Service = new TemplateService(); Log.LogInfo((object)"Applying patches..."); ApplyPluginPatch(); Log.LogInfo((object)"Patches applied"); } private void ApplyPluginPatch() { _harmony.PatchAll(typeof(MeltdownCheck)); _harmony.PatchAll(typeof(TenSecondCheck)); } } } namespace Friskzips.service { public class TemplateService { public bool ReturnTrue() { return true; } public bool ReturnFalse() { return false; } } } namespace Friskzips.patch { [HarmonyPatch(typeof(MeltdownHandler))] public class MeltdownCheck { public static bool triggerOnce; internal static float meltdownTime; internal static float startMeltdownTime; internal static float endMeltdownTime; [HarmonyPatch("StartMeltdownClientRpc")] [HarmonyPostfix] public static void Postfix(ref MeltdownHandler __instance) { Plugin.Log.LogInfo((object)"Meltdown detected!"); meltdownTime = __instance.TimeLeftUntilMeltdown; float num = meltdownTime / 0.3333321f * 0.4666672f; startMeltdownTime = TimeOfDay.Instance.currentDayTime; Plugin.Log.LogDebug((object)("Time until meltdown: " + meltdownTime)); triggerOnce = true; endMeltdownTime = meltdownTime + startMeltdownTime; Countdown.UpdateTimeMap((float?)(startMeltdownTime + num)); } } [HarmonyPatch(typeof(TimeOfDay))] public class TenSecondCheck : MonoBehaviour { internal static float newTime = -1f; internal static float time = -1f; internal static float averageTime = -1f; internal static float meltdown_newTime = -1f; internal static float meltdown_time = -1f; internal static float meltdown_averageTime = 1f; [HarmonyPatch("Update")] [HarmonyPostfix] [HarmonyPatch(typeof(MeltdownHandler))] private static void Update(ref MeltdownHandler __instance) { if (time > 0f && newTime < 0f) { newTime = TimeOfDay.Instance.currentDayTime; } if (meltdown_time > 0f && meltdown_newTime < 0f) { meltdown_newTime = __instance.TimeLeftUntilMeltdown; } if (time < 0f) { time = TimeOfDay.Instance.currentDayTime; } if (meltdown_time < 0f) { meltdown_time = __instance.TimeLeftUntilMeltdown; } if (time > 0f && newTime > 0f && averageTime < 0f) { averageTime = newTime - time; Plugin.Log.LogInfo((object)("Time: " + averageTime)); } if (meltdown_time > 0f && meltdown_newTime > 0f && meltdown_averageTime > 0f) { meltdown_averageTime = meltdown_newTime - meltdown_time; Plugin.Log.LogInfo((object)("Meltdown Time: " + math.abs(meltdown_averageTime))); } if (__instance.TimeLeftUntilMeltdown <= 30f && MeltdownCheck.triggerOnce) { MeltdownCheck.triggerOnce = false; } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace FacilityMeltdown End of day countdown compatibility.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }