using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; 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 MuckTimeStop.Networking; using MuckTimeStop.Patches; using PacketHelper; using UnityEngine; using UnityEngine.Networking; using UnityEngine.Rendering.PostProcessing; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 MuckTimeStop { public static class AmbientParticleFreeze { private static readonly List FrozenSystems = new List(); public static void Apply(bool frozen) { if (frozen) { FrozenSystems.Clear(); ParticleSystem[] array = Object.FindObjectsOfType(); ParticleSystem[] array2 = array; foreach (ParticleSystem val in array2) { if (!((Object)(object)val == (Object)null) && val.isPlaying) { val.Pause(true); FrozenSystems.Add(val); } } return; } foreach (ParticleSystem frozenSystem in FrozenSystems) { if (!((Object)(object)frozenSystem == (Object)null)) { frozenSystem.Play(true); } } FrozenSystems.Clear(); } } public static class HostPermissions { private static readonly HashSet AllowedClientIds = new HashSet(); public static bool IsAllowed(int clientId) { if (LocalClient.serverOwner && clientId == LocalClient.instance.myId) { return true; } return AllowedClientIds.Contains(clientId); } public static void Allow(int clientId) { AllowedClientIds.Add(clientId); } public static void Deny(int clientId) { AllowedClientIds.Remove(clientId); } } public static class MobFreeze { public static void Apply(bool frozen) { if ((Object)(object)MobManager.Instance == (Object)null || MobManager.Instance.mobs == null) { return; } foreach (Mob value in MobManager.Instance.mobs.Values) { if ((Object)(object)value == (Object)null) { continue; } if ((Object)(object)value.agent != (Object)null && value.agent.isOnNavMesh) { value.agent.isStopped = frozen; value.agent.updateRotation = !frozen; } if ((Object)(object)value.animator != (Object)null) { value.animator.speed = (frozen ? 0f : 1f); } AudioSource[] componentsInChildren = ((Component)value).GetComponentsInChildren(); AudioSource[] array = componentsInChildren; foreach (AudioSource val in array) { if (frozen) { val.Pause(); } else { val.UnPause(); } } } } } public static class ModTick { public static void Tick() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(Plugin.PauseKey.Value)) { PauseController.LocalKeyPressed(); } if (LocalClient.serverOwner && PauseState.IsPaused && Time.realtimeSinceStartup >= PauseState.PauseEndsAtRealtime) { PauseController.ResumeFromHost(); } if (PauseState.IsPaused) { MobFreeze.Apply(frozen: true); } PauseEffects.Tick(); PinkBubble.Tick(); PauseAudio.Tick(); } } public static class PauseAudio { private class PendingLoad { public UnityWebRequest Request; public UnityWebRequestAsyncOperation Operation; public string Name; public Action OnLoaded; } private static readonly List Pending = new List(); private static AudioClip _pauseClip; private static AudioClip _resumeClip; private static bool _pausePlayRequested; private static bool _resumePlayRequested; private static bool _loadStarted; private static AudioSource _audioSource; public static void LoadClips() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown if (_loadStarted) { return; } _loadStarted = true; GameObject val = new GameObject("MuckTimeStopAudio"); Object.DontDestroyOnLoad((Object)(object)val); _audioSource = val.AddComponent(); _audioSource.spatialBlend = 0f; _audioSource.playOnAwake = false; StartLoad("pause", "MuckTimeStop.Resources.pause_sfx.mp3", delegate(AudioClip clip) { _pauseClip = clip; if (_pausePlayRequested) { _pausePlayRequested = false; PlayOneShot(clip); } }); StartLoad("resume", "MuckTimeStop.Resources.resume_sfx.mp3", delegate(AudioClip clip) { _resumeClip = clip; if (_resumePlayRequested) { _resumePlayRequested = false; PlayOneShot(clip); } }); } public static void Tick() { if (Pending.Count == 0) { return; } for (int num = Pending.Count - 1; num >= 0; num--) { PendingLoad pendingLoad = Pending[num]; if (((AsyncOperation)pendingLoad.Operation).isDone) { if (!pendingLoad.Request.isNetworkError && !pendingLoad.Request.isHttpError) { Plugin.Log.LogInfo((object)("[PauseAudio] Loaded " + pendingLoad.Name + " clip successfully.")); pendingLoad.OnLoaded(DownloadHandlerAudioClip.GetContent(pendingLoad.Request)); } else { Plugin.Log.LogWarning((object)("[PauseAudio] Failed to load " + pendingLoad.Name + " clip: " + pendingLoad.Request.error)); } pendingLoad.Request.Dispose(); Pending.RemoveAt(num); } } } public static void PlayPause() { if ((Object)(object)_pauseClip != (Object)null) { PlayOneShot(_pauseClip); } else { _pausePlayRequested = true; } } public static void PlayResume() { if ((Object)(object)_resumeClip != (Object)null) { PlayOneShot(_resumeClip); } else { _resumePlayRequested = true; } } private static void PlayOneShot(AudioClip clip) { if (!((Object)(object)clip == (Object)null) && !((Object)(object)_audioSource == (Object)null)) { _audioSource.PlayOneShot(clip); } } private static void StartLoad(string name, string resourceName, Action onLoaded) { Assembly executingAssembly = Assembly.GetExecutingAssembly(); using Stream stream = executingAssembly.GetManifestResourceStream(resourceName); if (stream == null) { Plugin.Log.LogWarning((object)("[PauseAudio] Embedded resource not found: " + resourceName)); return; } string text = Path.Combine(Path.GetTempPath(), Path.GetFileName(resourceName)); using (FileStream destination = File.Create(text)) { stream.CopyTo(destination); } UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip("file://" + text, (AudioType)13); UnityWebRequestAsyncOperation operation = audioClip.SendWebRequest(); Pending.Add(new PendingLoad { Request = audioClip, Operation = operation, Name = name, OnLoaded = onLoaded }); } } public static class PauseController { public static void LocalKeyPressed() { if (!((Object)(object)LocalClient.instance == (Object)null)) { int myId = LocalClient.instance.myId; if (LocalClient.serverOwner) { HostHandleToggleRequest(myId); } else { PauseNetworking.SendToggleRequest(); } } } public static void HostHandleToggleRequest(int senderClientId) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) PlayerManager value; if (PauseState.IsPaused) { if (senderClientId == PauseState.CasterClientId) { ResumeFromHost(); } } else if (HostPermissions.IsAllowed(senderClientId) && !PauseState.IsOnCooldown(senderClientId) && GameManager.players.TryGetValue(senderClientId, out value) && !((Object)(object)value == (Object)null)) { int timeLimitSeconds = Mathf.CeilToInt(Plugin.PauseTimeLimitSeconds.Value); Vector3 position = ((Component)value).transform.position; ApplyStateChange(isPaused: true, senderClientId, position, timeLimitSeconds); PauseNetworking.BroadcastStateChanged(isPaused: true, senderClientId, position, timeLimitSeconds); } } public static void ResumeFromHost() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) int casterClientId = PauseState.CasterClientId; Vector3 casterPosition = PauseState.CasterPosition; PauseState.StartCooldown(casterClientId, Plugin.PauseCooldownSeconds.Value); ApplyStateChange(isPaused: false, casterClientId, casterPosition, 0); PauseNetworking.BroadcastStateChanged(isPaused: false, casterClientId, casterPosition, 0); } public static void ApplyStateChange(bool isPaused, int casterClientId, Vector3 casterPos, int timeLimitSeconds) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) PauseState.IsPaused = isPaused; PauseState.CasterClientId = casterClientId; PauseState.CasterPosition = casterPos; if (isPaused) { PauseState.PauseEndsAtRealtime = Time.realtimeSinceStartup + (float)timeLimitSeconds; } PlayerFreeze.Apply(); MobFreeze.Apply(isPaused); AmbientParticleFreeze.Apply(isPaused); if (isPaused) { PauseEffects.BeginPause(); PinkBubble.Spawn(casterPos); PauseAudio.PlayPause(); } else { PauseEffects.EndPause(); MobDamageQueue.ReplayAndClear(); PlayerDamageQueue.ReplayAndClear(); PauseAudio.PlayResume(); } } } public static class PauseEffects { private static ColorGrading _colorGrading; private static ChromaticAberration _chromaticAberration; private static bool _initialized; private static float _lerpT; private static bool _fadingIn; private const float FadeDuration = 0.4f; private static void EnsureInit() { if (_initialized || (Object)(object)PPController.Instance == (Object)null) { return; } PostProcessVolume component = ((Component)PPController.Instance).GetComponent(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.profile == (Object)null)) { PostProcessProfile profile = component.profile; _colorGrading = profile.GetSetting(); if ((Object)(object)_colorGrading == (Object)null) { _colorGrading = profile.AddSettings(); } ((PostProcessEffectSettings)_colorGrading).active = true; ((ParameterOverride)(object)((PostProcessEffectSettings)_colorGrading).enabled).value = true; ((ParameterOverride)((PostProcessEffectSettings)_colorGrading).enabled).overrideState = true; ((ParameterOverride)_colorGrading.saturation).overrideState = true; ((ParameterOverride)(object)_colorGrading.saturation).value = 0f; ((ParameterOverride)_colorGrading.gradingMode).overrideState = false; _chromaticAberration = profile.GetSetting(); if ((Object)(object)_chromaticAberration == (Object)null) { _chromaticAberration = profile.AddSettings(); } ((PostProcessEffectSettings)_chromaticAberration).active = true; ((ParameterOverride)_chromaticAberration.intensity).overrideState = true; ((ParameterOverride)((PostProcessEffectSettings)_chromaticAberration).enabled).overrideState = true; ((ParameterOverride)(object)_chromaticAberration.intensity).value = 0f; _initialized = true; } } public static void BeginPause() { EnsureInit(); _fadingIn = true; } public static void EndPause() { EnsureInit(); _fadingIn = false; } public static void Tick() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) EnsureInit(); if (!((Object)(object)_colorGrading == (Object)null) && !((Object)(object)_chromaticAberration == (Object)null)) { float num = (_fadingIn ? 1f : 0f); _lerpT = Mathf.MoveTowards(_lerpT, num, Time.unscaledDeltaTime / 0.4f); if (_lerpT > 0f) { ((ParameterOverride)_colorGrading.gradingMode).overrideState = true; ((ParameterOverride)(object)_colorGrading.gradingMode).value = (GradingMode)0; } else { ((ParameterOverride)_colorGrading.gradingMode).overrideState = false; } ((ParameterOverride)(object)_colorGrading.saturation).value = Mathf.Lerp(0f, -100f, _lerpT); ((ParameterOverride)(object)((PostProcessEffectSettings)_chromaticAberration).enabled).value = _lerpT > 0f; ((ParameterOverride)(object)_chromaticAberration.intensity).value = Mathf.Lerp(0f, 1f, _lerpT); } } } public static class PauseState { public static bool IsPaused; public static int CasterClientId = -1; public static Vector3 CasterPosition; public static float PauseEndsAtRealtime; private static readonly Dictionary CooldownEndsAtRealtime = new Dictionary(); public static bool IsOnCooldown(int clientId) { float value; return CooldownEndsAtRealtime.TryGetValue(clientId, out value) && Time.realtimeSinceStartup < value; } public static void StartCooldown(int clientId, float seconds) { CooldownEndsAtRealtime[clientId] = Time.realtimeSinceStartup + seconds; } } public static class PinkBubble { private static GameObject _bubble; private static Material _material; private static float _elapsed; private const float ExpandDuration = 0.4f; private const float MaxScale = 12f; public static void Spawn(Vector3 position) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_bubble != (Object)null) { Object.Destroy((Object)(object)_bubble); } _bubble = GameObject.CreatePrimitive((PrimitiveType)0); Object.Destroy((Object)(object)_bubble.GetComponent()); _bubble.transform.position = position; _bubble.transform.localScale = Vector3.zero; Renderer component = _bubble.GetComponent(); _material = CreateBubbleMaterial(); component.material = _material; _elapsed = 0f; } public static void Tick() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_bubble == (Object)null)) { _elapsed += Time.unscaledDeltaTime; float num = Mathf.Clamp01(_elapsed / 0.4f); _bubble.transform.localScale = Vector3.one * Mathf.Lerp(0f, 12f, num); if ((Object)(object)_material != (Object)null && _material.HasProperty("_Color")) { Color color = _material.color; color.a = Mathf.Lerp(0.6f, 0f, num); _material.color = color; } if (num >= 1f) { Object.Destroy((Object)(object)_bubble); _bubble = null; _material = null; } } } private static Material CreateBubbleMaterial() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) string[] array = new string[3] { "UI/Default", "Sprites/Default", "Legacy Shaders/Transparent/Diffuse" }; string[] array2 = array; foreach (string text in array2) { Shader val = Shader.Find(text); if (!((Object)(object)val == (Object)null)) { Material val2 = new Material(val); if (val2.HasProperty("_Color")) { val2.color = new Color(1f, 0.2f, 0.8f, 0.6f); } Plugin.Log.LogInfo((object)("[PinkBubble] Using shader: " + text)); return val2; } } Plugin.Log.LogWarning((object)"[PinkBubble] None of the candidate transparent shaders were found in the build - falling back to the primitive's default (opaque) material."); Material material = _bubble.GetComponent().material; if (material.HasProperty("_Color")) { material.color = new Color(1f, 0.2f, 0.8f, 1f); } return material; } } public static class PlayerFreeze { public static void Apply() { if (!((Object)(object)PlayerInput.Instance == (Object)null)) { bool flag = (Object)(object)LocalClient.instance != (Object)null && LocalClient.instance.myId == PauseState.CasterClientId; PlayerInput.Instance.active = !PauseState.IsPaused || flag; } } } [BepInPlugin("com.paul.MuckTimeStop", "Muck Time Stop", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public static ConfigEntry PauseKey; public static ConfigEntry PauseTimeLimitSeconds; public static ConfigEntry PauseCooldownSeconds; private Harmony _harmony; public static ManualLogSource Log { get; private set; } private void Awake() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; PauseKey = ((BaseUnityPlugin)this).Config.Bind("General", "PauseKey", (KeyCode)106, "Key used to toggle time stop."); PauseTimeLimitSeconds = ((BaseUnityPlugin)this).Config.Bind("General", "PauseTimeLimitSeconds", 30f, "Maximum seconds a time-stop lasts before auto-resuming."); PauseCooldownSeconds = ((BaseUnityPlugin)this).Config.Bind("General", "PauseCooldownSeconds", 5f, "Per-player cooldown in seconds after resuming before that player can cast again."); _harmony = new Harmony("com.paul.MuckTimeStop"); _harmony.PatchAll(); PauseAudio.LoadClips(); Log.LogInfo((object)"Muck Time Stop loaded."); } } } namespace MuckTimeStop.Patches { [HarmonyPatch(typeof(CauldronSync), "Update")] public static class CauldronFreezePatch { [HarmonyPrefix] private static bool Prefix() { return !PauseState.IsPaused; } } [HarmonyPatch(typeof(FurnaceSync), "Update")] public static class FurnaceFreezePatch { [HarmonyPrefix] private static bool Prefix() { return !PauseState.IsPaused; } } [HarmonyPatch(typeof(ChatBox), "SendMessage", new Type[] { typeof(string) })] public static class ChatCommandPatch { [HarmonyPostfix] private static void Postfix(ChatBox __instance, string message) { if (string.IsNullOrEmpty(message) || message[0] != '/' || !LocalClient.serverOwner) { return; } string[] array = message.Substring(1).Split(new char[1] { ' ' }); if (array.Length < 2) { return; } string text = array[0].ToLower(); if (text != "allow" && text != "deny") { return; } string b = array[1]; foreach (KeyValuePair player in GameManager.players) { if ((Object)(object)player.Value == (Object)null || !string.Equals(player.Value.username, b, StringComparison.OrdinalIgnoreCase)) { continue; } if (text == "allow") { HostPermissions.Allow(player.Key); __instance.AppendMessage(-1, "Allowed " + player.Value.username + " to use time stop.", ""); } else { HostPermissions.Deny(player.Key); __instance.AppendMessage(-1, "Denied " + player.Value.username + " from using time stop.", ""); } break; } } } [HarmonyPatch(typeof(DayCycle), "Update")] public static class DayCyclePatch { [HarmonyPrefix] private static bool Prefix() { return !PauseState.IsPaused; } } [HarmonyPatch(typeof(Grass), "Awake")] public static class GrassDiagnosticPatch { private static bool _logged; [HarmonyPostfix] private static void Postfix(Grass __instance) { if (_logged) { return; } _logged = true; Renderer val = (((Object)(object)__instance.grass != (Object)null) ? __instance.grass.GetComponentInChildren() : null); if ((Object)(object)val == (Object)null || (Object)(object)val.sharedMaterial == (Object)null) { Plugin.Log.LogInfo((object)"[GrassDiagnostic] No renderer/material found on Grass.grass prefab."); return; } Material sharedMaterial = val.sharedMaterial; Shader shader = sharedMaterial.shader; Plugin.Log.LogInfo((object)("[GrassDiagnostic] Grass shader: " + ((Object)shader).name)); string[] array = new string[12] { "_WindSpeed", "_WindStrength", "_WindIntensity", "_Wind", "_WindDirection", "_WindFrequency", "_SwaySpeed", "_SwayStrength", "_BendSpeed", "_BendStrength", "_ShiverSpeed", "_ShiverStrength" }; bool flag = false; string[] array2 = array; foreach (string text in array2) { if (sharedMaterial.HasProperty(text)) { flag = true; Plugin.Log.LogInfo((object)$"[GrassDiagnostic] found property {text} = {sharedMaterial.GetFloat(text)}"); } } if (!flag) { Plugin.Log.LogInfo((object)"[GrassDiagnostic] No common wind property name matched - sway is likely driven by a global (e.g. _Time) read in the shader with no per-material override."); } } } public static class MobDamageQueue { private class QueuedHit { public HitableMob Target; public int Damage; public float Sharpness; public int HitEffect; public Vector3 HitPos; public int HitWeaponType; } private static readonly List Queue = new List(); public static void Enqueue(HitableMob target, int damage, float sharpness, int hitEffect, Vector3 hitPos, int hitWeaponType) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) Queue.Add(new QueuedHit { Target = target, Damage = damage, Sharpness = sharpness, HitEffect = hitEffect, HitPos = hitPos, HitWeaponType = hitWeaponType }); } public static void ReplayAndClear() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) List list = new List(Queue); Queue.Clear(); foreach (QueuedHit item in list) { if (!((Object)(object)item.Target == (Object)null)) { ((Hitable)item.Target).Hit(item.Damage, item.Sharpness, item.HitEffect, item.HitPos, item.HitWeaponType); } } } } [HarmonyPatch(typeof(HitableMob), "Hit")] public static class MobDamagePatch { [HarmonyPrefix] private static bool Prefix(HitableMob __instance, int damage, float sharpness, int hitEffect, Vector3 hitPos, int hitWeaponType) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!PauseState.IsPaused) { return true; } MobDamageQueue.Enqueue(__instance, damage, sharpness, hitEffect, hitPos, hitWeaponType); return false; } } [HarmonyPatch(typeof(Mob), "Update")] public static class MobUpdatePatch { [HarmonyPrefix] private static bool Prefix() { return !PauseState.IsPaused; } } [HarmonyPatch(typeof(Mob), "LateUpdate")] public static class MobLateUpdatePatch { [HarmonyPrefix] private static bool Prefix() { return !PauseState.IsPaused; } } [HarmonyPatch(typeof(MobServer), "Update")] public static class MobServerUpdatePatch { [HarmonyPrefix] private static bool Prefix() { return !PauseState.IsPaused; } } [HarmonyPatch(typeof(MobServer), "SyncFindNextPosition")] public static class MobServerSyncFindNextPositionPatch { [HarmonyPrefix] private static bool Prefix() { return !PauseState.IsPaused; } } [HarmonyPatch(typeof(Mob), "SetDestination")] public static class MobSetDestinationPatch { [HarmonyPrefix] private static bool Prefix() { return !PauseState.IsPaused; } } [HarmonyPatch] public static class MobServerBehaviourPatch { private static IEnumerable TargetMethods() { Type[] types = typeof(MobServer).Assembly.GetTypes(); foreach (Type type in types) { if (typeof(MobServer).IsAssignableFrom(type) && !(type == typeof(MobServer))) { MethodInfo method = type.GetMethod("Behaviour", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { yield return method; } } } } [HarmonyPrefix] private static bool Prefix() { return !PauseState.IsPaused; } } public static class PlayerDamageQueue { private class QueuedHit { public HitableActor Target; public int Damage; public float Sharpness; public int HitEffect; public Vector3 Pos; public int HitWeaponType; } private static readonly List Queue = new List(); public static void Enqueue(HitableActor target, int damage, float sharpness, int hitEffect, Vector3 pos, int hitWeaponType) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) Queue.Add(new QueuedHit { Target = target, Damage = damage, Sharpness = sharpness, HitEffect = hitEffect, Pos = pos, HitWeaponType = hitWeaponType }); } public static void ReplayAndClear() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) List list = new List(Queue); Queue.Clear(); foreach (QueuedHit item in list) { if (!((Object)(object)item.Target == (Object)null)) { ((Hitable)item.Target).Hit(item.Damage, item.Sharpness, item.HitEffect, item.Pos, item.HitWeaponType); } } } } [HarmonyPatch(typeof(HitableActor), "Hit")] public static class PlayerDamagePatch { [HarmonyPrefix] private static bool Prefix(HitableActor __instance, int damage, float sharpness, int hitEffect, Vector3 pos, int hitWeaponType) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!PauseState.IsPaused) { return true; } PlayerDamageQueue.Enqueue(__instance, damage, sharpness, hitEffect, pos, hitWeaponType); return false; } } [HarmonyPatch(typeof(PlayerInput), "Update")] public static class PlayerTickPatch { [HarmonyPostfix] private static void Postfix() { ModTick.Tick(); } } } namespace MuckTimeStop.Networking { public static class PauseNetworking { private const string GuidSeed = "com.paul.MuckTimeStop"; private const string ToggleRequestName = "MTS_ToggleRequest"; private const string StateChangedName = "MTS_StateChanged"; private static Session _serverSession; private static Session _clientSession; public static void RegisterServerPackets() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown _serverSession = new Session("com.paul.MuckTimeStop"); _serverSession.CreateNewServerPacket("MTS_ToggleRequest", (Action)HandleToggleRequestOnServer); } public static void RegisterClientPackets() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown _clientSession = new Session("com.paul.MuckTimeStop"); _clientSession.CreateNewClientPacket("MTS_StateChanged", (Action)HandleStateChangedOnClient); } public static void SendToggleRequest() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown Session clientSession = _clientSession; if (clientSession != null) { clientSession.SendPacketToServer("MTS_ToggleRequest", new Data()); } } public static void BroadcastStateChanged(bool isPaused, int casterClientId, Vector3 casterPos, int timeLimitSeconds) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) Data val = new Data(); val.ints = new int[2] { casterClientId, timeLimitSeconds }; val.bools = new bool[1] { isPaused }; val.vector3s = (Vector3[])(object)new Vector3[1] { casterPos }; Data val2 = val; Session serverSession = _serverSession; if (serverSession != null) { serverSession.SendPacketToAllClients("MTS_StateChanged", val2); } } private static void HandleToggleRequestOnServer(int senderClientId, Packet packet) { PauseController.HostHandleToggleRequest(senderClientId); } private static void HandleStateChangedOnClient(Packet packet) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) int casterClientId = packet.ReadInt(true); int timeLimitSeconds = packet.ReadInt(true); bool isPaused = packet.ReadBool(true); Vector3 casterPos = packet.ReadVector3(true); PauseController.ApplyStateChange(isPaused, casterClientId, casterPos, timeLimitSeconds); } } [HarmonyPatch(typeof(Server), "InitializeServerPackets")] public static class ServerPacketReregisterPatch { [HarmonyPostfix] private static void Postfix() { PauseNetworking.RegisterServerPackets(); } } [HarmonyPatch(typeof(LocalClient), "InitializeClientData")] public static class ClientPacketReregisterPatch { [HarmonyPostfix] private static void Postfix() { PauseNetworking.RegisterClientPackets(); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }