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 RedLight GreenLight v1.0.0
RedLightGreenLight.dll
Decompiled 7 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; 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.Bootstrap; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using UnityEngine; using UnityEngine.Networking; [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("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RedLightGreenLight")] [assembly: AssemblyTitle("RedLightGreenLight")] [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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 Empress.CursedLights { [BepInPlugin("Empress.CursedLights", "Cursed Lights (Red Light, Green Light)", "1.5.0")] public class CursedLightsPlugin : BaseUnityPlugin { private Harmony _harmony; private GameObject _runnerGO; internal static CursedLightsPlugin Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; private void Awake() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown Instance = this; _runnerGO = new GameObject("[CursedLightsRunner]"); ((Object)_runnerGO).hideFlags = (HideFlags)53; Object.DontDestroyOnLoad((Object)(object)_runnerGO); _runnerGO.AddComponent<CursedRunner>(); _harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); _harmony.PatchAll(); } private void OnDestroy() { try { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } catch { } if (Object.op_Implicit((Object)(object)_runnerGO)) { Object.Destroy((Object)(object)_runnerGO); } } } internal static class LocalKillUtil { public static void TryKillLocal() { try { ChatManager val = ChatManager.instance ?? Object.FindObjectOfType<ChatManager>(true); if ((Object)(object)val != (Object)null) { val.PossessSelfDestruction(); } } catch (Exception arg) { CursedLightsPlugin.Logger.LogWarning((object)$"CursedLights: local kill failed: {arg}"); } } } internal class CursedRunner : MonoBehaviour { private enum NetPhase : byte { Green, Red } private enum Phase { Idle, WaitingForLevel, Green, Red } [CompilerGenerated] private sealed class <>c__DisplayClass35_0 { public string stem; public CursedRunner <>4__this; internal void <PreloadSfx>b__0(AudioClip clip) { if ((Object)(object)clip != (Object)null) { <>4__this._clips[stem] = clip; } } } [CompilerGenerated] private sealed class <>c__DisplayClass37_0 { public string stem; internal IEnumerable<string> <TryLoadClipByStem>b__0(string r) { <>c__DisplayClass37_1 CS$<>8__locals0 = new <>c__DisplayClass37_1 { r = r }; return new string[2] { stem + ".ogg", stem + ".wav" }.Select((string candidate) => Path.Combine(CS$<>8__locals0.r, candidate)); } } [CompilerGenerated] private sealed class <>c__DisplayClass37_1 { public string r; internal string <TryLoadClipByStem>b__1(string candidate) { return Path.Combine(r, candidate); } } [CompilerGenerated] private sealed class <LoadClip>d__38 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string path; public Action<AudioClip> onReady; public CursedRunner <>4__this; private string <ext>5__1; private AudioType <type>5__2; private UnityWebRequest <req>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadClip>d__38(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <ext>5__1 = null; <req>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Invalid comparison between Unknown and I4 //IL_00ab: Unknown result type (might be due to invalid IL or missing references) bool result; try { switch (<>1__state) { default: result = false; break; case 0: <>1__state = -1; <ext>5__1 = Path.GetExtension(path).ToLowerInvariant(); <type>5__2 = (AudioType)((<ext>5__1 == ".ogg") ? 14 : ((<ext>5__1 == ".wav") ? 20 : 0)); if ((int)<type>5__2 == 0) { onReady?.Invoke(null); result = false; break; } <req>5__3 = UnityWebRequestMultimedia.GetAudioClip("file://" + path, <type>5__2); <>1__state = -3; <>2__current = <req>5__3.SendWebRequest(); <>1__state = 1; result = true; break; case 1: <>1__state = -3; if (<req>5__3.isNetworkError || <req>5__3.isHttpError) { onReady?.Invoke(null); result = false; <>m__Finally1(); } else { onReady?.Invoke(DownloadHandlerAudioClip.GetContent(<req>5__3)); <>m__Finally1(); <req>5__3 = null; result = false; } break; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<req>5__3 != null) { ((IDisposable)<req>5__3).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <MasterConductor>d__26 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CursedRunner <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <MasterConductor>d__26(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; goto IL_0033; case 1: <>1__state = -1; if (!<>4__this.LevelReady() || !PhotonNetwork.IsConnectedAndReady || !PhotonNetwork.InRoom) { return false; } <>4__this.BroadcastPhase(NetPhase.Red); <>2__current = <>4__this.WaitSeconds(Random.Range(<>4__this._redMin, <>4__this._redMax), () => !<>4__this.LevelReady() || !PhotonNetwork.IsConnectedAndReady || !PhotonNetwork.InRoom); <>1__state = 2; return true; case 2: { <>1__state = -1; if (!<>4__this.LevelReady() || !PhotonNetwork.IsConnectedAndReady || !PhotonNetwork.InRoom) { break; } <>4__this.BroadcastPhase(NetPhase.Green); goto IL_0033; } IL_0033: <>2__current = <>4__this.WaitSeconds(Random.Range(<>4__this._greenMin, <>4__this._greenMax), () => !<>4__this.LevelReady() || !PhotonNetwork.IsConnectedAndReady || !PhotonNetwork.InRoom); <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <PreloadSfx>d__35 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CursedRunner <>4__this; private string[] <>s__1; private int <>s__2; private <>c__DisplayClass35_0 <>8__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PreloadSfx>d__35(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>s__1 = null; <>8__3 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>s__1 = new string[2] { "Red", "Green" }; <>s__2 = 0; break; case 1: <>1__state = -1; <>8__3 = null; <>s__2++; break; } if (<>s__2 < <>s__1.Length) { <>8__3 = new <>c__DisplayClass35_0(); <>8__3.<>4__this = <>4__this; <>8__3.stem = <>s__1[<>s__2]; <>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.TryLoadClipByStem(<>8__3.stem, delegate(AudioClip clip) { if ((Object)(object)clip != (Object)null) { <>8__3.<>4__this._clips[<>8__3.stem] = clip; } })); <>1__state = 1; return true; } <>s__1 = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <StateMachine>d__25 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CursedRunner <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <StateMachine>d__25(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; case 2: <>1__state = -1; break; } if (PhotonNetwork.IsConnectedAndReady && PhotonNetwork.InRoom) { <>4__this.EnsurePhotonHook(); } else { <>4__this.EnsurePhotonUnhook(); } if (!<>4__this.LevelReady()) { if (<>4__this._isRunning) { <>4__this._isRunning = false; } <>4__this._phase = Phase.WaitingForLevel; <>2__current = null; <>1__state = 1; return true; } if (!<>4__this._isRunning) { <>4__this._isRunning = true; <>4__this.EnsureSfxSource(); if (PhotonNetwork.IsMasterClient) { <>4__this.SetPhaseLocal(Phase.Green); <>4__this.BroadcastPhase(NetPhase.Green); ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.MasterConductor()); } else if (<>4__this._haveNetPhase) { <>4__this.SetPhaseLocal((<>4__this._netPhase == NetPhase.Red) ? Phase.Red : Phase.Green); } else { <>4__this.TrySnapFromRoomProperty(); } } if (<>4__this._haveNetPhase && ((<>4__this._netPhase == NetPhase.Red && <>4__this._phase != Phase.Red) || (<>4__this._netPhase == NetPhase.Green && <>4__this._phase != Phase.Green))) { <>4__this.SetPhaseLocal((<>4__this._netPhase == NetPhase.Red) ? Phase.Red : Phase.Green); } <>4__this._reassertTimer -= Time.deltaTime; if (<>4__this._reassertTimer <= 0f) { <>4__this._reassertTimer = 0.5f; if (<>4__this._phase == Phase.Green) { <>4__this.ForceAllLights(Color.green, 1f); } else if (<>4__this._phase == Phase.Red) { <>4__this.ForceAllLights(Color.red, 1f); } } if (<>4__this._phase == Phase.Red) { <>4__this.CheckForbiddenMovementAndExecute(); } <>2__current = null; <>1__state = 2; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <TryLoadClipByStem>d__37 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string stem; public Action<AudioClip> onReady; public CursedRunner <>4__this; private <>c__DisplayClass37_0 <>8__1; private string[] <roots>5__2; private string <path>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <TryLoadClipByStem>d__37(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <roots>5__2 = null; <path>5__3 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass37_0(); <>8__1.stem = stem; <roots>5__2 = <>4__this.GetSearchRoots(); <path>5__3 = <roots>5__2.SelectMany(delegate(string r) { <>c__DisplayClass37_1 CS$<>8__locals0 = new <>c__DisplayClass37_1 { r = r }; return new string[2] { <>8__1.stem + ".ogg", <>8__1.stem + ".wav" }.Select((string candidate) => Path.Combine(CS$<>8__locals0.r, candidate)); }).FirstOrDefault(File.Exists); if (string.IsNullOrEmpty(<path>5__3)) { onReady?.Invoke(null); return false; } <>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.LoadClip(<path>5__3, onReady)); <>1__state = 1; return true; case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <WaitSeconds>d__33 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float t; public Func<bool> breakIf; public CursedRunner <>4__this; private float <timer>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitSeconds>d__33(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <timer>5__1 = t; break; case 1: <>1__state = -1; break; } if (<timer>5__1 > 0f) { if (breakIf != null && breakIf()) { return false; } <timer>5__1 -= Time.deltaTime; <>2__current = null; <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private readonly float _greenMin = 20f; private readonly float _greenMax = 60f; private readonly float _redMin = 10f; private readonly float _redMax = 20f; private readonly float _redGraceSeconds = 0.75f; private readonly float _moveHoldThreshold = 0.08f; private const byte EVT_PHASE = 99; private const string ROOM_KEY_PHASE = "CLP"; private Phase _phase = Phase.Idle; private NetPhase _netPhase = NetPhase.Green; private bool _haveNetPhase; private bool _isRunning; private bool _firedKillThisRed; private bool _photonHooked; private float _reassertTimer; private float _redEnteredAt; private float _moveHoldAccum; private AudioSource _sfx; private readonly Dictionary<string, AudioClip> _clips = new Dictionary<string, AudioClip>(StringComparer.OrdinalIgnoreCase); private void Start() { ((MonoBehaviour)this).StartCoroutine(StateMachine()); ((MonoBehaviour)this).StartCoroutine(PreloadSfx()); } private void EnsurePhotonHook() { if (!_photonHooked && PhotonNetwork.IsConnectedAndReady && PhotonNetwork.InRoom) { PhotonNetwork.NetworkingClient.EventReceived += OnPhotonEvent; _photonHooked = true; TrySnapFromRoomProperty(); } } private void EnsurePhotonUnhook() { if (_photonHooked) { PhotonNetwork.NetworkingClient.EventReceived -= OnPhotonEvent; _photonHooked = false; } } private void TrySnapFromRoomProperty() { Room currentRoom = PhotonNetwork.CurrentRoom; if (currentRoom == null || ((RoomInfo)currentRoom).CustomProperties == null || !((Dictionary<object, object>)(object)((RoomInfo)currentRoom).CustomProperties).TryGetValue((object)"CLP", out object value) || !(value is byte)) { return; } byte netPhase = (byte)value; if (true) { _netPhase = (NetPhase)netPhase; _haveNetPhase = true; if (LevelReady()) { SetPhaseLocal((_netPhase == NetPhase.Red) ? Phase.Red : Phase.Green); } } } [IteratorStateMachine(typeof(<StateMachine>d__25))] private IEnumerator StateMachine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <StateMachine>d__25(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<MasterConductor>d__26))] private IEnumerator MasterConductor() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <MasterConductor>d__26(0) { <>4__this = this }; } private void OnPhotonEvent(EventData e) { if (e.Code != 99 || !(e.CustomData is object[] array) || array.Length < 1) { return; } object obj = array[0]; byte netPhase = default(byte); int num; if (obj is byte) { netPhase = (byte)obj; num = 1; } else { num = 0; } if (num != 0) { _netPhase = (NetPhase)netPhase; _haveNetPhase = true; if (LevelReady()) { SetPhaseLocal((_netPhase == NetPhase.Red) ? Phase.Red : Phase.Green); } } } private void BroadcastPhase(NetPhase phase) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_0070: Expected O, but got Unknown try { if (PhotonNetwork.IsConnectedAndReady && PhotonNetwork.InRoom) { SetPhaseLocal((phase == NetPhase.Red) ? Phase.Red : Phase.Green); object[] array = new object[1] { (byte)phase }; RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)1 }; PhotonNetwork.RaiseEvent((byte)99, (object)array, val, SendOptions.SendReliable); Hashtable val2 = new Hashtable(); ((Dictionary<object, object>)val2).Add((object)"CLP", (object)(byte)phase); Hashtable val3 = val2; PhotonNetwork.CurrentRoom.SetCustomProperties(val3, (Hashtable)null, (WebFlags)null); } } catch (Exception arg) { CursedLightsPlugin.Logger.LogWarning((object)$"CursedLights: BroadcastPhase failed: {arg}"); } } private void SetPhaseLocal(Phase p) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) _phase = p; _reassertTimer = 0f; switch (p) { case Phase.Green: _firedKillThisRed = false; _moveHoldAccum = 0f; ForceAllLights(Color.green, 1f); PlaySfx("Green"); break; case Phase.Red: _firedKillThisRed = false; _moveHoldAccum = 0f; _redEnteredAt = Time.time; ForceAllLights(Color.red, 1f); PlaySfx("Red"); break; } } private bool LevelReady() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Invalid comparison between Unknown and I4 try { if (!SemiFunc.RunIsLevel()) { return false; } if (!PhotonNetwork.IsConnectedAndReady || !PhotonNetwork.InRoom) { return false; } if ((Object)(object)LevelGenerator.Instance == (Object)null || !LevelGenerator.Instance.Generated) { return false; } if ((Object)(object)GameDirector.instance == (Object)null) { return false; } if ((int)GameDirector.instance.currentState != 2) { return false; } PlayerController instance = PlayerController.instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.playerAvatarScript == (Object)null || !instance.playerAvatarScript.isLocal) { return false; } return true; } catch { return false; } } private void CheckForbiddenMovementAndExecute() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) try { if (Time.time - _redEnteredAt < _redGraceSeconds) { return; } PlayerController instance = PlayerController.instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.playerAvatarScript == (Object)null || !instance.playerAvatarScript.isLocal) { return; } Vector2 val = (((Object)(object)InputManager.instance != (Object)null) ? InputManager.instance.GetMovement() : Vector2.zero); if (_phase != Phase.Red || _firedKillThisRed) { return; } if (((Vector2)(ref val)).sqrMagnitude > 0.0001f) { _moveHoldAccum += Time.deltaTime; if (_moveHoldAccum >= _moveHoldThreshold) { _firedKillThisRed = true; LocalKillUtil.TryKillLocal(); } } else { _moveHoldAccum = 0f; } } catch (Exception arg) { CursedLightsPlugin.Logger.LogWarning((object)$"CursedLights: movement check failed: {arg}"); } } private void ForceAllLights(Color color, float emissionIntensity) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) try { GameObject[] array = GameObject.FindGameObjectsWithTag("Prop Lights"); foreach (GameObject val in array) { if (Object.op_Implicit((Object)(object)val)) { Light val2 = val.GetComponent<Light>() ?? val.GetComponentInChildren<Light>(); if (Object.op_Implicit((Object)(object)val2)) { val2.color = color; } } } GameObject[] array2 = GameObject.FindGameObjectsWithTag("Prop Emission"); foreach (GameObject val3 in array2) { if (!Object.op_Implicit((Object)(object)val3)) { continue; } Renderer component = val3.GetComponent<Renderer>(); if (Object.op_Implicit((Object)(object)component)) { Material material = component.material; if (!((Object)(object)material == (Object)null)) { material.EnableKeyword("_EMISSION"); material.SetColor("_EmissionColor", new Color(color.r, color.g, color.b) * emissionIntensity); } } } } catch (Exception arg) { CursedLightsPlugin.Logger.LogWarning((object)$"CursedLights: ForceAllLights failed: {arg}"); } } [IteratorStateMachine(typeof(<WaitSeconds>d__33))] private IEnumerator WaitSeconds(float t, Func<bool> breakIf) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitSeconds>d__33(0) { <>4__this = this, t = t, breakIf = breakIf }; } private void EnsureSfxSource() { if (!((Object)(object)_sfx != (Object)null)) { _sfx = ((Component)this).gameObject.AddComponent<AudioSource>(); _sfx.playOnAwake = false; _sfx.loop = false; _sfx.spatialBlend = 0f; _sfx.volume = 0.3f; } } [IteratorStateMachine(typeof(<PreloadSfx>d__35))] private IEnumerator PreloadSfx() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PreloadSfx>d__35(0) { <>4__this = this }; } private void PlaySfx(string stem) { try { EnsureSfxSource(); if (_clips.TryGetValue(stem, out AudioClip value) && (Object)(object)value != (Object)null) { _sfx.volume = 0.3f; _sfx.PlayOneShot(value, 1f); } } catch (Exception arg) { CursedLightsPlugin.Logger.LogWarning((object)$"CursedLights: PlaySfx('{stem}') failed: {arg}"); } } [IteratorStateMachine(typeof(<TryLoadClipByStem>d__37))] private IEnumerator TryLoadClipByStem(string stem, Action<AudioClip> onReady) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <TryLoadClipByStem>d__37(0) { <>4__this = this, stem = stem, onReady = onReady }; } [IteratorStateMachine(typeof(<LoadClip>d__38))] private IEnumerator LoadClip(string path, Action<AudioClip> onReady) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadClip>d__38(0) { <>4__this = this, path = path, onReady = onReady }; } private string[] GetSearchRoots() { string text = Path.GetDirectoryName(Paths.PluginPath) ?? Paths.PluginPath; string directoryName = Path.GetDirectoryName(Chainloader.PluginInfos["Empress.CursedLights"].Instance.Info.Location); return new string[2] { directoryName, text }; } } } namespace RedLightGreenLight { [BepInPlugin("Omniscye.RedLightGreenLight", "RedLightGreenLight", "1.0")] public class RedLightGreenLight : BaseUnityPlugin { internal static RedLightGreenLight Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { } } }