Decompiled source of Spleak v0.2.0
PeakSplitScreen.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Peak; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.InputSystem.LowLevel; using UnityEngine.InputSystem.Utilities; using UnityEngine.LowLevel; using UnityEngine.PlayerLoop; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; using UnityEngine.SceneManagement; using UnityEngine.UI; using Zorro.ControllerSupport; using Zorro.Core; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Universal.Runtime")] [assembly: IgnoresAccessChecksTo("Zorro.ControllerSupport")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PeakSplitScreen")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+cadc3f089c9d2c29e8db775d390483399f6eb301")] [assembly: AssemblyProduct("PeakSplitScreen")] [assembly: AssemblyTitle("PeakSplitScreen")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.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 PeakSplitScreen { internal static class DebugTools { private static Gamepad _virtualPad; private static float _nextShot; private static int _shot; private static float _activeSince = -1f; private static string _phase = ""; private static string _pressLogged; private static bool _dumped; private static Gamepad _p1VirtualPad; private static string _twoPhase = ""; private static bool _keyDown; private static GameObject _zone; private static readonly HashSet<string> _once = new HashSet<string>(); private static float _levelAt = -1f; private static WindChillZone _testZone; private static Vector3 _home1; private static Vector3 _home2; private static Item _testItem; private static float _testDist = 1f; private static float _testUp; private static float _nextProbe; public static Gamepad VirtualPad { get { if (_virtualPad == null || !((InputDevice)_virtualPad).added) { return null; } return _virtualPad; } } public static void Tick() { //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) if (Plugin.DebugMute.Value) { AudioListener.volume = 0f; AudioListener.pause = false; } if (Plugin.DebugFakeGamepad.Value) { FakePad(); } if ((Plugin.DebugScript.Value ?? "").Trim().ToLowerInvariant() == "menushot" && (Object)(object)MenuOption.SplitButton != (Object)null && (Object)(object)EventSystem.current != (Object)null && (Object)(object)EventSystem.current.currentSelectedGameObject != (Object)(object)((Component)MenuOption.SplitButton).gameObject) { ((Selectable)MenuOption.SplitButton).Select(); } if (Plugin.DebugScreenshots.Value && Time.unscaledTime >= _nextShot) { _nextShot = Time.unscaledTime + 4f; string text = Path.Combine(Paths.BepInExRootPath, "splitscreen-shots"); Directory.CreateDirectory(text); Scene activeScene = SceneManager.GetActiveScene(); ScreenCapture.CaptureScreenshot(Path.Combine(text, string.Format(arg1: ((Scene)(ref activeScene)).name, format: "shot{0:00}-{1}.png", arg0: _shot++ % 30))); } } private static void FakePad() { //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0530: Unknown result type (might be due to invalid IL or missing references) //IL_0562: Unknown result type (might be due to invalid IL or missing references) //IL_0569: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_0578: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_0587: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_05bc: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) if (_virtualPad == null || !((InputDevice)_virtualPad).added) { Application.runInBackground = true; InputSystem.settings.backgroundBehavior = (BackgroundBehavior)2; _virtualPad = InputSystem.AddDevice<Gamepad>("SplitScreen Virtual Pad"); Plugin.Log.LogInfo((object)"[debug] Added virtual gamepad."); } if ((Plugin.DebugScript.Value ?? "").Trim().ToLowerInvariant() == "twopads" && (_p1VirtualPad == null || !((InputDevice)_p1VirtualPad).added)) { _p1VirtualPad = InputSystem.AddDevice<Gamepad>("SplitScreen Virtual Pad P1"); Plugin.Log.LogInfo((object)"[debug] Added player 1 virtual gamepad."); } if (!SplitManager.Active) { _activeSince = -1f; _once.Clear(); return; } if (_activeSince < 0f) { _activeSince = Time.unscaledTime; } float num = Time.unscaledTime - _activeSince; if (!_dumped && (Object)(object)GUIManager.instance != (Object)null) { _dumped = true; DumpHud(); } GamepadState state = default(GamepadState); switch ((Plugin.DebugScript.Value ?? "").Trim().ToLowerInvariant()) { case "passport": PassportScript(num, ref state); InputSystem.QueueStateEvent<GamepadState>((InputDevice)(object)_virtualPad, state, -1.0); return; case "run": RunScript(num, ref state); InputSystem.QueueStateEvent<GamepadState>((InputDevice)(object)_virtualPad, state, -1.0); return; case "fog": FogScript(num); InputSystem.QueueStateEvent<GamepadState>((InputDevice)(object)_virtualPad, state, -1.0); return; case "photo": PhotoScript(num); InputSystem.QueueStateEvent<GamepadState>((InputDevice)(object)_virtualPad, state, -1.0); return; case "twopads": TwoPadsScript(num, ref state); InputSystem.QueueStateEvent<GamepadState>((InputDevice)(object)_virtualPad, state, -1.0); return; } string text; if (num < 3f) { text = "idle"; } else if (num < 5f) { text = "turn around"; state.rightStick = new Vector2(1f, 0f); } else if (num < 7f) { text = "spawn test item"; if (_phase != text) { SpawnTestItem(); } } else if (num < 7.8f) { text = "press interact"; Press(ref state, "Interact"); } else if (num < 10f) { text = "holding item"; } else if (num < 12f) { text = "emote wheel open"; Press(ref state, "Emote"); state.leftStick = new Vector2(0f, 1f); state.rightStick = new Vector2(0f, 1f); } else if (num < 13f) { text = "emote wheel still open"; Press(ref state, "Emote"); state.leftStick = new Vector2(0f, 1f); state.rightStick = new Vector2(0f, 1f); } else if (num < 15f) { text = "emote wheel released"; } else if (num < 21f) { text = "eat"; Press(ref state, "UsePrimary"); } else if (num < 22f) { text = "after eating"; } else if (num < 27f) { text = "injury zone on p2"; if (_phase != text) { SpawnZone(); } } else if (num < 28f) { text = "injury zone gone"; if ((Object)(object)_zone != (Object)null) { Object.Destroy((Object)(object)_zone); } } else if (num < 38f) { text = "p2 passed out"; if (_phase != text) { SplitManager.P2Character.PassOutInstantly(); } state.rightStick = new Vector2(0.3f, 0f); } else if (num < 39f) { text = "p2 still passed out"; } else if (num < 48f) { text = "p2 dead"; if (_phase != text && SplitContext.Enter()) { try { Character.Die(); } finally { SplitContext.Exit(); } } } else { text = "done"; } if (text != _phase) { _phase = text; Plugin.Log.LogInfo((object)("[debug] virtual pad: " + text + " | " + ItemInfo() + " | " + SplitManager.Status() + " | " + Health() + " | " + P2Audio.Status())); } if (((num >= 5f && num < 10f) || (num >= 34f && num < 37f)) && Time.unscaledTime >= _nextProbe) { _nextProbe = Time.unscaledTime + 0.5f; Plugin.Log.LogInfo((object)("[debug] probe " + ItemInfo() + Probe())); } if (num >= 5f && num < 8f && (Object)(object)_testItem != (Object)null && (int)_testItem.itemState == 0 && (Object)(object)SplitManager.P2Cam != (Object)null) { Transform transform = ((Component)SplitManager.P2Cam).transform; _testItem.transform.position = transform.position + transform.forward * _testDist + Vector3.up * _testUp; if ((Object)(object)_testItem.rig != (Object)null) { _testItem.rig.position = _testItem.transform.position; } Physics.SyncTransforms(); } InputSystem.QueueStateEvent<GamepadState>((InputDevice)(object)_virtualPad, state, -1.0); } private static void TwoPadsScript(float t, ref GamepadState p2) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) GamepadState val = default(GamepadState); bool flag = false; string text; if (t < 2f) { text = "idle"; } else if (t < 5f) { text = "both pads mirrored (must not claim a p1 pad)"; val.leftStick = (p2.leftStick = new Vector2(0f, 1f)); } else if (t < 7f) { text = "idle 2"; } else if (t < 10f) { text = "p1 pad forward"; val.leftStick = new Vector2(0f, 1f); } else if (t < 12f) { text = "idle 3"; } else if (t < 15f) { text = "p2 pad forward"; p2.leftStick = new Vector2(0f, 1f); } else if (t < 17f) { text = "idle 4"; } else if (t < 20f) { text = "p1 pad turn"; val.rightStick = new Vector2(1f, 0f); } else if (t < 22f) { text = "idle 5"; } else if (t < 25f) { text = "keyboard W"; flag = true; } else if (t < 27f) { text = "idle 6"; } else if (t < 30f) { text = "p1 pad back"; val.leftStick = new Vector2(0f, -1f); } else { text = "done"; } if (_p1VirtualPad != null && ((InputDevice)_p1VirtualPad).added) { InputSystem.QueueStateEvent<GamepadState>((InputDevice)(object)_p1VirtualPad, val, -1.0); } if (flag != _keyDown && Keyboard.current != null) { _keyDown = flag; InputSystem.QueueStateEvent<KeyboardState>((InputDevice)(object)Keyboard.current, flag ? new KeyboardState((Key[])(object)new Key[1] { (Key)37 }) : default(KeyboardState), -1.0); } if (text != _twoPhase) { Character localCharacter = Character.localCharacter; Character p2Character = SplitManager.P2Character; Plugin.Log.LogInfo((object)("[debug] twopads end of '" + _twoPhase + "': p1=" + (((Object)(object)localCharacter != (Object)null) ? ((object)localCharacter.Center/*cast due to .constrained prefix*/).ToString() : "none") + " p1look=" + (((Object)(object)localCharacter != (Object)null) ? ((object)Unsafe.As<Vector2, Vector2>(ref localCharacter.data.lookValues)/*cast due to .constrained prefix*/).ToString() : "none") + " p2=" + (((Object)(object)p2Character != (Object)null) ? ((object)p2Character.Center/*cast due to .constrained prefix*/).ToString() : "none") + " p2look=" + (((Object)(object)p2Character != (Object)null) ? ((object)Unsafe.As<Vector2, Vector2>(ref p2Character.data.lookValues)/*cast due to .constrained prefix*/).ToString() : "none") + string.Format(" p1scheme={0} p1pad={1}", InputHandler.GetCurrentUsedInputScheme(), (SplitManager.P1Pad != null) ? ((InputControl)SplitManager.P1Pad).displayName : "none") + " p2pad=" + ((SplitManager.Pad != null) ? ((InputControl)SplitManager.Pad).displayName : "none"))); _twoPhase = text; } } private static bool Once(float t, float at, string key) { if (t >= at) { return _once.Add(key); } return false; } private static bool Tap(float t, float at) { if (t >= at) { return t < at + 0.15f; } return false; } private static void Say(string what) { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) ManualLogSource log = Plugin.Log; string[] obj = new string[14] { "[debug] ", what, " | ", P2Passport.Status(), " | held=", ((Object)(object)SplitManager.P2Character.data.currentItem != (Object)null) ? ((Object)SplitManager.P2Character.data.currentItem).name : "none", " p1block=", ((Object)(object)GUIManager.instance != (Object)null && GUIManager.instance.windowBlockingInput).ToString(), " p2block=", ((Object)(object)P2Hud.CloneGui != (Object)null && P2Hud.CloneGui.windowBlockingInput).ToString(), " cursor=", ((object)Cursor.lockState/*cast due to .constrained prefix*/).ToString(), " scene=", null }; Scene activeScene = SceneManager.GetActiveScene(); obj[13] = ((Scene)(ref activeScene)).name; log.LogInfo((object)string.Concat(obj)); } private static void PassportScript(float t, ref GamepadState state) { //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) if (Once(t, 6.5f, "pre")) { Say("before opening"); } if (t >= 7f && t < 7.6f) { Press(ref state, "UsePrimary"); } if (Once(t, 8.8f, "opened")) { Say("after use"); } for (int i = 0; i < 8; i++) { float num = 9f + (float)i * 3f; if (Tap(t, num)) { state = ((GamepadState)(ref state)).WithButton((GamepadButton)((i % 2 != 0) ? 1 : 3), true); } if (Tap(t, num + 0.4f)) { state = ((GamepadState)(ref state)).WithButton((GamepadButton)3, true); } if (Once(t, num + 0.75f, "moved" + i)) { Say("tab " + i + " moved"); } if (Tap(t, num + 0.8f)) { state = ((GamepadState)(ref state)).WithButton((GamepadButton)6, true); } if (Tap(t, num + 1.4f)) { state = ((GamepadState)(ref state)).WithButton((GamepadButton)1, true); } if (Tap(t, num + 2f)) { state.leftStick = new Vector2(-1f, 0f); } if (Once(t, num + 2.3f, "tab" + i)) { Say("tab " + i + " picked"); } if (Tap(t, num + 2.4f)) { state = ((GamepadState)(ref state)).WithButton((GamepadButton)11, true); } } if (Tap(t, 33.5f)) { state = ((GamepadState)(ref state)).WithButton((GamepadButton)10, true); } if (Once(t, 34.5f, "end")) { Say("before closing"); } if (Tap(t, 35f)) { state = ((GamepadState)(ref state)).WithButton((GamepadButton)5, true); } if (Once(t, 37f, "closed")) { Say("after closing"); } if (t >= 38f && t < 40f) { state.leftStick = new Vector2(0f, 1f); } if (Once(t, 40f, "walked")) { Say("after walking"); } if (t >= 41f && t < 41.6f) { Press(ref state, "UsePrimary"); } if (Once(t, 43f, "reopened")) { Say("reopened"); } if (Once(t, 43.3f, "hatsash")) { HatSashCheck(); } if (Tap(t, 44f)) { state = ((GamepadState)(ref state)).WithButton((GamepadButton)12, true); } if (Once(t, 46f, "done")) { Say("done (closed with start; pause menu should not be open: paused=" + ((Object)(object)P2Hud.CloneGui != (Object)null && (Object)(object)P2Hud.CloneGui.pauseMenu != (Object)null && P2Hud.CloneGui.pauseMenu.activeSelf) + ")"); } } private static void RunScript(float t, ref GamepadState state) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "Airport") { if (Once(t, 8f, "start")) { AirportCheckInKiosk val = Object.FindAnyObjectByType<AirportCheckInKiosk>(); Plugin.Log.LogInfo((object)("[debug] starting a run, kiosk=" + ((Object)(object)val != (Object)null))); if ((Object)(object)val != (Object)null) { val.StartGame(0); } } return; } float num = t % 20f; if (num < 8f) { state.leftStick = new Vector2(0f, 1f); } else if (num < 10f) { state.leftStick = new Vector2(0f, 1f); Press(ref state, "Jump"); } else if (num < 12f) { state.rightStick = new Vector2(0.6f, 0f); } else if (num < 13f) { Press(ref state, "Interact"); } else if (num < 16f) { state.leftStick = new Vector2(0f, 1f); Press(ref state, "Sprint"); } else if (num < 17f) { Press(ref state, "Drop"); } if (Once(t, Mathf.Floor(t / 10f) * 10f, "s" + (int)(t / 10f))) { Plugin.Log.LogInfo((object)("[debug] run t=" + t.ToString("0") + " " + ItemInfo() + " | " + SplitManager.Status() + " | " + Health() + " | " + P2Audio.Status())); } } private unsafe static void HatSashCheck() { //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Invalid comparison between Unknown and I4 //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Invalid comparison between Unknown and I4 PassportManager instance = PassportManager.instance; Customization instance2 = Singleton<Customization>.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance2 == (Object)null || !((MenuWindow)instance).isOpen || !P2Passport.P2Owns) { Plugin.Log.LogInfo((object)"[debug] hat/sash check skipped: passport not open for player 2"); return; } CharacterCustomizationData val = P2Passport.P2Data(); CustomizationOption val2 = instance2.fits[Mathf.Clamp(val.currentOutfit, 0, instance2.fits.Length - 1)]; Plugin.Log.LogInfo((object)("[debug] hat/sash check: outfit " + val.currentOutfit + " overrides hat=" + val2.overrideHat + " (to " + val2.overrideHatIndex + ")")); Type[] array = (Type[])(object)new Type[2] { (Type)50, (Type)60 }; for (int i = 0; i < array.Length; i++) { Type val3 = array[i]; CustomizationOption[] list = instance2.GetList(val3); int num = 0; string text = ""; for (int j = 0; j < list.Length; j++) { if (!list[j].IsLocked) { num++; text = text + j + " "; } } int num2 = (((int)val3 == 50) ? val.currentHat : val.currentSash); instance.OpenTab(val3); bool flag = false; PassportButton val4 = FindButton(instance, num2, allowLocked: false); if ((Object)(object)val4 == (Object)null) { flag = true; instance.testUnlockAll = true; instance.SetButtons(false); val4 = FindButton(instance, num2, allowLocked: true); } int num3 = (((Object)(object)val4 != (Object)null) ? val4.currentIndex : (-1)); if ((Object)(object)val4 != (Object)null) { ((UnityEvent)val4.button.onClick).Invoke(); } val = P2Passport.P2Data(); int num4 = (((int)val3 == 50) ? val.currentHat : val.currentSash); Plugin.Log.LogInfo((object)("[debug] " + ((object)(*(Type*)(&val3))/*cast due to .constrained prefix*/).ToString() + ": options=" + list.Length + " unlocked=" + num + " [" + text.Trim() + "] before=" + num2 + " clicked=" + num3 + (flag ? " (locked option, unlock forced for the test)" : "") + " after=" + num4 + " -> " + ((num4 == num3 && num3 != num2) ? "CHANGED" : "NOT CHANGED") + " | hat shown=" + HatShown())); if (!flag) { continue; } PassportButton val5 = null; PassportButton[] buttons = instance.buttons; foreach (PassportButton val6 in buttons) { if (((Behaviour)val6).isActiveAndEnabled && val6.currentIndex == num2) { val5 = val6; } } if ((Object)(object)val5 != (Object)null) { ((UnityEvent)val5.button.onClick).Invoke(); } instance.testUnlockAll = false; instance.SetButtons(false); } Say("after hat/sash check"); } private static string HatShown() { Renderer[] playerHats = SplitManager.P2Character.refs.customization.refs.playerHats; if (playerHats == null) { return "?"; } for (int i = 0; i < playerHats.Length; i++) { if ((Object)(object)playerHats[i] != (Object)null && ((Component)playerHats[i]).gameObject.activeSelf) { return i.ToString(); } } return "none"; } private static PassportButton FindButton(PassportManager pm, int current, bool allowLocked) { PassportButton[] buttons = pm.buttons; foreach (PassportButton val in buttons) { if (!((Object)(object)val == (Object)null) && ((Behaviour)val).isActiveAndEnabled && !((Object)(object)val.currentOption == (Object)null) && val.currentIndex != current && (!val.currentOption.IsLocked || allowLocked)) { return val; } } return null; } private static void FogScript(float t) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_0509: Unknown result type (might be due to invalid IL or missing references) //IL_0524: Unknown result type (might be due to invalid IL or missing references) //IL_0529: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "Airport") { _levelAt = -1f; if (Once(t, 8f, "start")) { AirportCheckInKiosk val = Object.FindAnyObjectByType<AirportCheckInKiosk>(); Plugin.Log.LogInfo((object)("[debug] starting a run, kiosk=" + ((Object)(object)val != (Object)null))); if ((Object)(object)val != (Object)null) { val.StartGame(0); } } return; } if (_levelAt < 0f) { _levelAt = t; } float num = t - _levelAt; Character localCharacter = Character.localCharacter; Character p2Character = SplitManager.P2Character; if ((Object)(object)localCharacter == (Object)null || (Object)(object)p2Character == (Object)null) { return; } if (Once(num, 12f, "dump1")) { FogDump("on the beach"); } if (Once(num, 14f, "jump")) { Plugin.Log.LogInfo((object)"[debug] jumping to the tropics"); MapHandler.JumpToSegment((Segment)1); } if (Once(num, 26f, "wind")) { FogDump("in the tropics"); WindChillZone[] array = Object.FindObjectsByType<WindChillZone>((FindObjectsSortMode)0); foreach (WindChillZone val2 in array) { if (((Behaviour)val2).isActiveAndEnabled) { _testZone = val2; } } if ((Object)(object)_testZone != (Object)null && !_testZone.windActive) { _testZone.untilSwitch = -1f; } Plugin.Log.LogInfo((object)("[debug] test zone=" + (((Object)(object)_testZone != (Object)null) ? (((Object)_testZone).name + " bounds=" + ((object)Unsafe.As<Bounds, Bounds>(ref _testZone.windZoneBounds)/*cast due to .constrained prefix*/).ToString()) : "none"))); } if (num < 72f && (Object)(object)_testZone != (Object)null) { _testZone.windActive = true; _testZone.timeUntilNextWind = 200f; _testZone.untilSwitch = 100f; Bounds windZoneBounds = _testZone.windZoneBounds; if (Once(num, 28f, "homes")) { _home1 = localCharacter.Center; _home2 = p2Character.Center; } if (Once(num, 30f, "p2in")) { p2Character.WarpPlayer(GroundIn(windZoneBounds), false); } if (Once(num, 50f, "swap")) { p2Character.WarpPlayer(_home2, false); localCharacter.WarpPlayer(GroundIn(windZoneBounds), false); } if (Once(num, 70f, "p1back")) { localCharacter.WarpPlayer(_home1, false); } if (num >= 26f && Once(num, Mathf.Floor(num / 4f) * 4f, "f" + (int)(num / 4f))) { Plugin.Log.LogInfo((object)("[debug] fog l=" + num.ToString("0") + " zoneActive=" + _testZone.windActive + " intensity=" + _testZone.windIntensity.ToString("0.00") + " p1in=" + ((Bounds)(ref windZoneBounds)).Contains(localCharacter.Center) + " p2in=" + ((Bounds)(ref windZoneBounds)).Contains(p2Character.Center) + " | " + P2Fog.Status())); } return; } if (Once(num, 74f, "caldera")) { Plugin.Log.LogInfo((object)"[debug] jumping to the caldera"); MapHandler.JumpToSegment((Segment)3); } if (Once(num, 88f, "dump3")) { FogDump("in the caldera"); } if (Once(num, 92f, "kiln")) { Plugin.Log.LogInfo((object)"[debug] jumping to the kiln"); MapHandler.JumpToSegment((Segment)4); } if (Once(num, 106f, "dump4")) { FogDump("in the kiln"); } if (Once(num, 110f, "p2out")) { Plugin.Log.LogInfo((object)("[debug] p2 passes out at " + ((object)p2Character.Center/*cast due to .constrained prefix*/).ToString())); p2Character.PassOutInstantly(); } if (Once(num, 118f, "p2dead") && SplitContext.Enter()) { try { Character.Die(); } finally { SplitContext.Exit(); } } if (num >= 72f && num < 130f && Once(num, Mathf.Floor(num / 4f) * 4f, "g" + (int)(num / 4f))) { Plugin.Log.LogInfo((object)("[debug] fog l=" + num.ToString("0") + " p1=" + ((object)localCharacter.Center/*cast due to .constrained prefix*/).ToString() + " p2=" + ((object)p2Character.Center/*cast due to .constrained prefix*/).ToString() + " p2dead=" + p2Character.data.dead + " p2out=" + p2Character.data.passedOut + " | " + P2Fog.Status())); } } private static void PhotoScript(float t) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "Airport") { _levelAt = -1f; if (Once(t, 8f, "start")) { AirportCheckInKiosk val = Object.FindAnyObjectByType<AirportCheckInKiosk>(); if ((Object)(object)val != (Object)null) { val.StartGame(0); } } return; } if (_levelAt < 0f) { _levelAt = t; } float num = t - _levelAt; Character localCharacter = Character.localCharacter; Character p2Character = SplitManager.P2Character; if ((Object)(object)localCharacter == (Object)null || (Object)(object)p2Character == (Object)null) { return; } Segment[] array = (Segment[])(object)new Segment[3] { default(Segment), (Segment)1, (Segment)2 }; int num2 = (int)(num / 24f); if (num2 >= array.Length) { return; } float num3 = num - (float)num2 * 24f; if (num2 > 0 && Once(num, (float)num2 * 24f, "jump" + num2)) { MapHandler.JumpToSegment(array[num2]); } if (Once(num, (float)num2 * 24f + 6f, "place" + num2)) { Vector3 val2 = localCharacter.data.lookDirection_Flat; if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = Vector3.forward; } Vector3 val3 = localCharacter.Center + ((Vector3)(ref val2)).normalized * 3.2f + Vector3.up * 3f; RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val3, Vector3.down, ref val4, 10f, -1, (QueryTriggerInteraction)1)) { val3 = ((RaycastHit)(ref val4)).point + Vector3.up * 1.2f; } p2Character.WarpPlayer(val3, false); } if (num3 >= 8f && num3 < 22f) { Vector3 val5 = p2Character.Center - localCharacter.Center; val5.y = 0f; if (((Vector3)(ref val5)).sqrMagnitude > 0.01f) { Vector3 val6 = HelperFunctions.DirectionToLook(((Vector3)(ref val5)).normalized + Vector3.down * 0.12f); Vector3 val7 = HelperFunctions.DirectionToLook(-((Vector3)(ref val5)).normalized + Vector3.down * 0.12f); localCharacter.data.lookValues = new Vector2(val6.x, val6.y); p2Character.data.lookValues = new Vector2(val7.x, val7.y); } if (Once(num, Mathf.Floor(num / 4f) * 4f, "ph" + (int)(num / 4f))) { Plugin.Log.LogInfo((object)("[debug] photo stop=" + num2 + " s=" + num3.ToString("0") + " p1=" + ((object)localCharacter.Center/*cast due to .constrained prefix*/).ToString() + " p2=" + ((object)p2Character.Center/*cast due to .constrained prefix*/).ToString())); } } } private static Vector3 GroundIn(Bounds b) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); for (int i = 0; i < 40; i++) { float num = Mathf.Lerp(((Bounds)(ref b)).min.x, ((Bounds)(ref b)).max.x, 0.3f + 0.4f * (float)(i * 7 % 10) / 10f); float num2 = Mathf.Lerp(((Bounds)(ref b)).min.z, ((Bounds)(ref b)).max.z, 0.3f + 0.4f * (float)(i * 3 % 10) / 10f); if (Physics.Raycast(new Vector3(num, ((Bounds)(ref b)).max.y - 5f, num2), Vector3.down, ref val, ((Bounds)(ref b)).size.y - 10f, -1, (QueryTriggerInteraction)1) && ((RaycastHit)(ref val)).normal.y > 0.8f && ((Bounds)(ref b)).Contains(((RaycastHit)(ref val)).point + Vector3.up * 3f)) { return ((RaycastHit)(ref val)).point + Vector3.up * 1.5f; } } return ((Bounds)(ref b)).center; } private static void FogDump(string where) { //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) StringBuilder stringBuilder = new StringBuilder("[debug] fog objects " + where + ":"); StormVisual[] array = Object.FindObjectsByType<StormVisual>((FindObjectsInactive)1, (FindObjectsSortMode)0); foreach (StormVisual val in array) { string[] obj = new string[14] { "\n StormVisual ", ((Object)val).name, " active=", ((Behaviour)val).isActiveAndEnabled.ToString(), " type=", ((object)Unsafe.As<StormType, StormType>(ref val.stormType)/*cast due to .constrained prefix*/).ToString(), " parts=", ((val.part != null) ? val.part.Length : 0).ToString(), " quad=", ((Object)(object)val.quadRend != (Object)null).ToString(), " zoneIntensity=", val.useWindChillZoneIntensity.ToString(), " sim=", null }; object obj2; if (val.part == null || val.part.Length == 0 || !((Object)(object)val.part[0] != (Object)null)) { obj2 = "?"; } else { MainModule main = val.part[0].main; obj2 = ((object)((MainModule)(ref main)).simulationSpace/*cast due to .constrained prefix*/).ToString(); } obj[13] = (string)obj2; stringBuilder.Append(string.Concat(obj)); } WindChillZone[] array2 = Object.FindObjectsByType<WindChillZone>((FindObjectsInactive)1, (FindObjectsSortMode)0); foreach (WindChillZone val2 in array2) { stringBuilder.Append("\n WindChillZone " + ((Object)val2).name + " active=" + ((Behaviour)val2).isActiveAndEnabled + " wind=" + val2.windActive + " bounds=" + ((object)Unsafe.As<Bounds, Bounds>(ref val2.windZoneBounds)/*cast due to .constrained prefix*/).ToString()); } Fog val3 = Object.FindAnyObjectByType<Fog>((FindObjectsInactive)1); stringBuilder.Append("\n Fog=" + (((Object)(object)val3 != (Object)null) ? ("yes enabled=" + ((Behaviour)val3).isActiveAndEnabled + " stops=" + (val3.stops != null) + " particles=" + ((Object)(object)val3.fogParticles != (Object)null)) : "no")); FogSphere val4 = Object.FindAnyObjectByType<FogSphere>((FindObjectsInactive)1); stringBuilder.Append("\n FogSphere=" + (((Object)(object)val4 != (Object)null) ? ("yes size=" + val4.currentSize.ToString("0") + " enable=" + val4.ENABLE) : "no")); stringBuilder.Append("\n DispelFogField=" + Object.FindObjectsByType<DispelFogField>((FindObjectsInactive)1, (FindObjectsSortMode)0).Length + " PlayerShaderParams=" + ((Object)(object)Object.FindAnyObjectByType<PlayerShaderParams>() != (Object)null) + " GloomSafeZones=" + GloomSafeZone.ALL_GLOOM_SAFE_ZONES.Count + " p1=" + ((object)Character.localCharacter.Center/*cast due to .constrained prefix*/).ToString() + " p2=" + ((object)SplitManager.P2Character.Center/*cast due to .constrained prefix*/).ToString()); LavaPost val5 = Object.FindAnyObjectByType<LavaPost>((FindObjectsInactive)1); stringBuilder.Append("\n LavaPost=" + (((Object)(object)val5 != (Object)null) ? ("yes enabled=" + ((Behaviour)val5).isActiveAndEnabled + " rend=" + ((Object)(object)val5.rend != (Object)null && ((Renderer)val5.rend).enabled) + " parent=" + (((Object)(object)((Component)val5).transform.parent != (Object)null) ? ((Object)((Component)val5).transform.parent).name : "none") + " onMainCam=" + ((Object)(object)MainCamera.instance != (Object)null && ((Component)val5).transform.IsChildOf(((Component)MainCamera.instance).transform)) + " first=" + val5.firstIsActive) : "no")); FogCutoutHandler val6 = Object.FindAnyObjectByType<FogCutoutHandler>((FindObjectsInactive)1); stringBuilder.Append("\n FogCutoutHandler=" + (((Object)(object)val6 != (Object)null) ? ("yes enabled=" + ((Behaviour)val6).isActiveAndEnabled + " zones=" + ((val6.cutoutZones != null) ? val6.cutoutZones.Length : 0) + " index=" + val6.index + " current=" + (((Object)(object)val6.currentCutoutZone != (Object)null) ? ((Object)val6.currentCutoutZone).name : "none")) : "no")); Plugin.Log.LogInfo((object)stringBuilder.ToString()); } private static void SpawnZone() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) Character p2Character = SplitManager.P2Character; _zone = new GameObject("SplitScreen test injury zone"); _zone.transform.position = p2Character.data.groundPos; _zone.transform.localScale = Vector3.one * 1.6f; _zone.AddComponent<InjurySphere>(); Plugin.Log.LogInfo((object)("[debug] injury zone at " + ((object)Unsafe.As<Vector3, Vector3>(ref p2Character.data.groundPos)/*cast due to .constrained prefix*/).ToString() + ", p1 is " + Vector3.Distance(Character.localCharacter.data.groundPos, p2Character.data.groundPos).ToString("0.0") + " m away")); } private static string One(Character c) { if ((Object)(object)c == (Object)null || (Object)(object)c.data == (Object)null) { return "none"; } CharacterAfflictions afflictions = c.refs.afflictions; if (afflictions.m_inAirport) { afflictions.m_inAirport = false; } return "inj=" + afflictions.GetCurrentStatus((STATUSTYPE)0).ToString("0.000") + " hun=" + afflictions.GetCurrentStatus((STATUSTYPE)1).ToString("0.000") + " out=" + c.data.passedOut + "/" + c.data.fullyPassedOut + " dead=" + c.data.dead; } private static string Health() { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) string[] obj = new string[12] { "P1{", One(Character.localCharacter), "} P2{", One(SplitManager.P2Character), "} chars=", Character.AllCharacters.Count.ToString(), " spec=", ((Object)(object)SplitManager.P2Spec != (Object)null) ? ((Object)SplitManager.P2Spec).name : "none", " p1spec=", ((Object)(object)MainCameraMovement.specCharacter != (Object)null) ? ((Object)MainCameraMovement.specCharacter).name : "none", " scene=", null }; Scene activeScene = SceneManager.GetActiveScene(); obj[11] = ((Scene)(ref activeScene)).name; string text = string.Concat(obj); GUIManager cloneGui = P2Hud.CloneGui; if ((Object)(object)cloneGui != (Object)null && (Object)(object)cloneGui.emoteWheel != (Object)null) { EmoteWheel component = cloneGui.emoteWheel.GetComponent<EmoteWheel>(); text = text + " p2wheel=" + cloneGui.emoteWheel.activeSelf + " chosen=" + (((Object)(object)component != (Object)null && (Object)(object)component.chosenEmoteData != (Object)null) ? component.chosenEmoteData.emoteName : "none"); } if ((Object)(object)GUIManager.instance != (Object)null && (Object)(object)GUIManager.instance.emoteWheel != (Object)null) { text = text + " p1wheel=" + GUIManager.instance.emoteWheel.activeSelf; } return text; } private static string Slots(Player p) { if ((Object)(object)p == (Object)null) { return "none"; } string text = ""; ItemSlot[] itemSlots = p.itemSlots; foreach (ItemSlot val in itemSlots) { text += (val.IsEmpty() ? "[-]" : ("[" + val.GetPrefabName() + "]")); } return text; } private static string ItemInfo() { Character p2Character = SplitManager.P2Character; if ((Object)(object)p2Character == (Object)null || (Object)(object)p2Character.data == (Object)null) { return "no p2"; } Interaction p2Interaction = SplitExtras.P2Interaction; return "held=" + (((Object)(object)p2Character.data.currentItem != (Object)null) ? ((Object)p2Character.data.currentItem).name : "none") + " slots=" + Slots(SplitManager.P2Player) + " p1slots=" + Slots(Player.localPlayer) + " hovered=" + (((Object)(object)p2Interaction != (Object)null) ? p2Interaction.bestInteractableName : "none"); } private unsafe static void SpawnTestItem() { //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) Camera p2Cam = SplitManager.P2Cam; if ((Object)(object)p2Cam == (Object)null) { return; } Item val = null; foreach (Item @object in ((DatabaseAsset<ItemDatabase, Item>)(object)SingletonAsset<ItemDatabase>.Instance).Objects) { if (!((Object)(object)@object == (Object)null)) { if ((Object)(object)val == (Object)null) { val = @object; } if (((Object)@object).name.Contains("Apple") || ((Object)@object).name.Contains("Granola")) { val = @object; break; } } } if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)"[debug] no item prefab found"); return; } float num = 1.1f; Transform val2 = (((Object)(object)SplitManager.P2Character != (Object)null) ? ((Component)SplitManager.P2Character).transform.root : null); RaycastHit[] array = Physics.RaycastAll(((Component)p2Cam).transform.position, ((Component)p2Cam).transform.forward, 2f, -1, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val3 = array[i]; if (!((Object)(object)((Component)((RaycastHit)(ref val3)).collider).transform.root == (Object)(object)val2) && ((RaycastHit)(ref val3)).distance - 0.25f < num) { num = Mathf.Max(0.5f, ((RaycastHit)(ref val3)).distance - 0.25f); } } Vector3 val4 = ((Component)p2Cam).transform.position + ((Component)p2Cam).transform.forward * num; GameObject obj = PhotonNetwork.Instantiate("0_Items/" + ((Object)val).name, val4, Quaternion.identity, (byte)0, (object[])null); _testItem = obj.GetComponent<Item>(); _testItem.SetKinematicNetworked(true, val4, Quaternion.identity); _testDist = num; Collider componentInChildren = obj.GetComponentInChildren<Collider>(); float testUp; if (!((Object)(object)componentInChildren != (Object)null)) { testUp = 0f; } else { float y = val4.y; Bounds bounds = componentInChildren.bounds; testUp = y - ((Bounds)(ref bounds)).center.y; } _testUp = testUp; if ((Object)(object)componentInChildren != (Object)null && (Object)(object)val2 != (Object)null) { Collider[] componentsInChildren = ((Component)val2).GetComponentsInChildren<Collider>(true); foreach (Collider val5 in componentsInChildren) { Physics.IgnoreCollision(componentInChildren, val5, true); } } Plugin.Log.LogInfo((object)("[debug] spawned test item " + ((Object)val).name + " at " + ((object)(*(Vector3*)(&val4))/*cast due to .constrained prefix*/).ToString() + " dist=" + num)); } private static string ColInfo() { //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) string text = ""; Collider[] componentsInChildren = ((Component)_testItem).GetComponentsInChildren<Collider>(true); foreach (Collider val in componentsInChildren) { string[] obj = new string[17] { text, " col:", ((Object)val).name, "/", ((object)val).GetType().Name, " en=", val.enabled.ToString(), " act=", ((Component)val).gameObject.activeInHierarchy.ToString(), " trig=", val.isTrigger.ToString(), " L", ((Component)val).gameObject.layer.ToString(), " c=", null, null, null }; Bounds bounds = val.bounds; obj[14] = ((object)((Bounds)(ref bounds)).center/*cast due to .constrained prefix*/).ToString(); obj[15] = " ext="; bounds = val.bounds; obj[16] = ((Bounds)(ref bounds)).extents.x.ToString("0.00"); text = string.Concat(obj); } return text; } private static string Probe() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) Interaction p2Interaction = SplitExtras.P2Interaction; MainCamera p2MainCamera = SplitManager.P2MainCamera; Character p2Character = SplitManager.P2Character; string text = " best=" + (((Object)(object)p2Interaction != (Object)null) ? p2Interaction.bestInteractableName : "?") + " mcam=" + (((Object)(object)p2MainCamera != (Object)null) ? (((object)((Component)p2MainCamera).transform.position/*cast due to .constrained prefix*/).ToString() + ">" + ((object)((Component)p2MainCamera).transform.forward/*cast due to .constrained prefix*/).ToString()) : "none") + " p2cam=" + (((Object)(object)SplitManager.P2Cam != (Object)null) ? ((object)((Component)SplitManager.P2Cam).transform.position/*cast due to .constrained prefix*/).ToString() : "none"); if ((Object)(object)_testItem != (Object)null) { text = text + " item@" + ((object)_testItem.transform.position/*cast due to .constrained prefix*/).ToString() + " state=" + ((object)_testItem.itemState/*cast due to .constrained prefix*/).ToString() + " block=" + _testItem.blockInteraction + " cols=" + ((Component)_testItem).GetComponentsInChildren<Collider>().Length + " layer=" + ((Component)_testItem).gameObject.layer + ColInfo(); } if ((Object)(object)p2Character != (Object)null) { text = text + " out=" + p2Character.data.passedOut + " sticky=" + ((Object)(object)p2Character.data.currentStickyItem != (Object)null) + " interactPressed=" + p2Character.input.interactIsPressed + " wasPressed=" + p2Character.input.interactWasPressed; } if ((Object)(object)GUIManager.instance != (Object)null) { text = text + " winBlock=" + GUIManager.instance.windowBlockingInput + " wheel=" + GUIManager.instance.wheelActive; } GUIManager cloneGui = P2Hud.CloneGui; if ((Object)(object)cloneGui != (Object)null) { text = text + " p2winBlock=" + cloneGui.windowBlockingInput + " p2wheel=" + cloneGui.wheelActive; } if ((Object)(object)p2MainCamera != (Object)null) { RaycastHit[] array = Physics.RaycastAll(((Component)p2MainCamera).transform.position, ((Component)p2MainCamera).transform.forward, 2f, -1, (QueryTriggerInteraction)2); for (int i = 0; i < array.Length; i++) { RaycastHit val = array[i]; text = text + " hit:" + ((Object)((RaycastHit)(ref val)).collider).name + "/" + ((Object)((Component)((RaycastHit)(ref val)).collider).transform.root).name + "@" + ((RaycastHit)(ref val)).distance.ToString("0.00") + "L" + ((Component)((RaycastHit)(ref val)).collider).gameObject.layer; } } return text; } private static void Press(ref GamepadState state, string actionName) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) InputAction val = (((Object)(object)SplitManager.P2Actions != (Object)null) ? SplitManager.P2Actions.FindAction(actionName, false) : null); if (val == null) { return; } Enumerator<InputControl> enumerator = val.controls.GetEnumerator(); try { while (enumerator.MoveNext()) { InputControl current = enumerator.Current; if ((object)current.device == _virtualPad) { switch (current.name) { case "buttonSouth": state = ((GamepadState)(ref state)).WithButton((GamepadButton)6, true); break; case "buttonWest": state = ((GamepadState)(ref state)).WithButton((GamepadButton)7, true); break; case "buttonNorth": state = ((GamepadState)(ref state)).WithButton((GamepadButton)4, true); break; case "buttonEast": state = ((GamepadState)(ref state)).WithButton((GamepadButton)5, true); break; case "leftShoulder": state = ((GamepadState)(ref state)).WithButton((GamepadButton)10, true); break; case "rightShoulder": state = ((GamepadState)(ref state)).WithButton((GamepadButton)11, true); break; case "leftStickPress": state = ((GamepadState)(ref state)).WithButton((GamepadButton)8, true); break; case "rightStickPress": state = ((GamepadState)(ref state)).WithButton((GamepadButton)9, true); break; case "up": state = ((GamepadState)(ref state)).WithButton((GamepadButton)0, true); break; case "down": state = ((GamepadState)(ref state)).WithButton((GamepadButton)1, true); break; case "left": state = ((GamepadState)(ref state)).WithButton((GamepadButton)2, true); break; case "right": state = ((GamepadState)(ref state)).WithButton((GamepadButton)3, true); break; case "leftTrigger": state.leftTrigger = 1f; break; case "rightTrigger": state.rightTrigger = 1f; break; default: continue; } if (_pressLogged != actionName) { _pressLogged = actionName; Plugin.Log.LogInfo((object)("[debug] " + actionName + " -> " + current.name)); } break; } } } finally { ((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } } private static void DumpHud() { //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) StringBuilder stringBuilder = new StringBuilder(); GUIManager instance = GUIManager.instance; stringBuilder.AppendLine("GUIManager path: " + PathOf(((Component)instance).transform) + " screen=" + Screen.width + "x" + Screen.height); stringBuilder.AppendLine("hudCanvas=" + (((Object)(object)instance.hudCanvas != (Object)null) ? PathOf(((Component)instance.hudCanvas).transform) : "null")); Canvas[] componentsInChildren = ((Component)((Component)instance).transform.root).GetComponentsInChildren<Canvas>(true); foreach (Canvas val in componentsInChildren) { CanvasScaler component = ((Component)val).GetComponent<CanvasScaler>(); stringBuilder.AppendLine(string.Format("CANVAS {0} mode={1} cam={2} order={3} root={4} active={5} enabled={6}", PathOf(((Component)val).transform), val.renderMode, ((Object)(object)val.worldCamera != (Object)null) ? ((Object)val.worldCamera).name : "null", val.sortingOrder, val.isRootCanvas, ((Component)val).gameObject.activeInHierarchy, ((Behaviour)val).enabled) + (((Object)(object)component != (Object)null) ? $" scaler={component.uiScaleMode} ref={component.referenceResolution} match={component.matchWidthOrHeight} screenMatch={component.screenMatchMode}" : "")); } SortedDictionary<string, int> sortedDictionary = new SortedDictionary<string, int>(); MonoBehaviour[] componentsInChildren2 = ((Component)((Component)instance).transform.root).GetComponentsInChildren<MonoBehaviour>(true); foreach (MonoBehaviour val2 in componentsInChildren2) { if (!((Object)(object)val2 == (Object)null)) { string fullName = ((object)val2).GetType().FullName; sortedDictionary.TryGetValue(fullName, out var value); sortedDictionary[fullName] = value + 1; } } foreach (KeyValuePair<string, int> item in sortedDictionary) { stringBuilder.AppendLine($"TYPE {item.Key} x{item.Value}"); } Tree(((Component)instance).transform.root, 0, 3, stringBuilder); stringBuilder.AppendLine("Interaction path: " + (((Object)(object)Interaction.instance != (Object)null) ? PathOf(((Component)Interaction.instance).transform) : "null")); Camera[] allCameras = Camera.allCameras; foreach (Camera val3 in allCameras) { stringBuilder.AppendLine(string.Format("CAMERA {0} depth={1} rect={2} target={3}", PathOf(((Component)val3).transform), val3.depth, val3.rect, ((Object)(object)val3.targetTexture != (Object)null) ? ((Object)val3.targetTexture).name : "screen")); } File.WriteAllText(Path.Combine(Paths.BepInExRootPath, "splitscreen-hud-dump.txt"), stringBuilder.ToString()); Plugin.Log.LogInfo((object)"[debug] HUD tree written."); } private static string PathOf(Transform t) { string text = ((Object)t).name; Transform parent = t.parent; while ((Object)(object)parent != (Object)null) { text = ((Object)parent).name + "/" + text; parent = parent.parent; } return text; } private static void Tree(Transform t, int depth, int max, StringBuilder sb) { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown string text = ""; Component[] components = ((Component)t).GetComponents<Component>(); foreach (Component val in components) { if ((Object)(object)val != (Object)null && !(val is Transform) && !(val is CanvasRenderer)) { text = text + ((object)val).GetType().Name + ","; } } sb.AppendLine(new string(' ', depth * 2) + (((Component)t).gameObject.activeSelf ? "+ " : "- ") + ((Object)t).name + " [" + text + "]"); if (depth >= max) { return; } foreach (Transform item in t) { Tree(item, depth + 1, max, sb); } } } internal static class Hazards { private sealed class Slot { public float time; public bool inZone; public bool priority; } private sealed class Num { public float value; } private sealed class Wind { public bool inside; public float factor; } private const BindingFlags All = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; private static Harmony _h; private static bool _busy; private static readonly ConditionalWeakTable<StatusEmitter, Slot> Emitters = new ConditionalWeakTable<StatusEmitter, Slot>(); private static readonly ConditionalWeakTable<MonoBehaviour, Num> Counters = new ConditionalWeakTable<MonoBehaviour, Num>(); private static readonly ConditionalWeakTable<WindChillZone, Wind> Winds = new ConditionalWeakTable<WindChillZone, Wind>(); public static void Apply(Harmony h) { _h = h; Post(typeof(StatusEmitter), "Update", "EmitterPost"); Post(typeof(Fog), "Update", "FogPost"); Post(typeof(FogSphere), "Update", "FogSpherePost"); Post(typeof(WindChillZone), "Update", "WindUpdatePost"); Post(typeof(WindChillZone), "FixedUpdate", "WindFixedPost"); Post(typeof(Lava), "Update", "LavaUpdatePost"); Post(typeof(Lava), "FixedUpdate", "LavaFixedPost"); Post(typeof(HotSun), "Update", "HotSunPost"); Post(typeof(InjurySphere), "Update", "InjurySpherePost"); Post(typeof(BananaPeel), "Update", "BananaPost"); Wrap(typeof(Campfire), "Update", "CampfirePre", "CampfirePost"); Wrap(typeof(SwingingAxe), "OnCollisionEnter", "CollisionPre", "ContextFinal", finalizer: true); Wrap(typeof(SlipperyJellyfish), "OnTriggerEnter", "TriggerPre", "ContextFinal", finalizer: true); Wrap(typeof(TombTrigger), "OnTriggerEnter", "TriggerPre", "ContextFinal", finalizer: true); Wrap(typeof(BreakableBridge), "OnBridgeCollision", "CharacterPre", "ContextFinal", finalizer: true); FieldInfo field = typeof(StatusEmitter).GetField("overlapPreventedStatusEmitters", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { SplitExtras.RegisterSwap(field, new Dictionary<string, StatusEmitter>()); } } private static void Post(Type t, string method, string postfix) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.DeclaredMethod(t, method, (Type[])null, (Type[])null); if (methodInfo == null) { Plugin.Log.LogWarning((object)("Hazard not found, player 2 is immune to it: " + t.Name + "." + method)); return; } try { _h.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(Hazards).GetMethod(postfix, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Could not patch " + t.Name + "." + method + ": " + ex.Message)); } } private static void Wrap(Type t, string method, string prefix, string post, bool finalizer = false) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.DeclaredMethod(t, method, (Type[])null, (Type[])null); if (methodInfo == null) { Plugin.Log.LogWarning((object)("Hazard not found, player 2 is immune to it: " + t.Name + "." + method)); return; } HarmonyMethod val = new HarmonyMethod(typeof(Hazards).GetMethod(prefix, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)); HarmonyMethod val2 = new HarmonyMethod(typeof(Hazards).GetMethod(post, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)); try { if (finalizer) { _h.Patch((MethodBase)methodInfo, val, (HarmonyMethod)null, (HarmonyMethod)null, val2, (HarmonyMethod)null); } else { _h.Patch((MethodBase)methodInfo, val, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Could not patch " + t.Name + "." + method + ": " + ex.Message)); } } private static bool Begin() { if (_busy || !SplitManager.Active || SplitContext.Active) { return false; } if (!SplitContext.Enter()) { return false; } _busy = true; return true; } private static void End() { _busy = false; SplitContext.Exit(); } private static void Report(string what, Exception e) { Plugin.Log.LogWarning((object)("Hazard for player 2 failed (" + what + "): " + e.Message)); } private static void EmitterPost(StatusEmitter __instance) { //IL_001f: 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) if (!Begin()) { return; } try { if (!Emitters.TryGetValue(__instance, out var value)) { if (Vector3.Distance(Character.localCharacter.Center, __instance.transform.position) >= __instance.radius + __instance.outerFade) { return; } value = new Slot(); Emitters.Add(__instance, value); } float timeSinceLastTick = __instance.timeSinceLastTick; bool inZone = __instance.inZone; bool isOverlapPriority = __instance.isOverlapPriority; __instance.timeSinceLastTick = value.time; __instance.inZone = value.inZone; __instance.isOverlapPriority = value.priority; try { __instance.Update(); } finally { value.time = __instance.timeSinceLastTick; value.inZone = __instance.inZone; value.priority = __instance.isOverlapPriority; __instance.timeSinceLastTick = timeSinceLastTick; __instance.inZone = inZone; __instance.isOverlapPriority = isOverlapPriority; } } catch (Exception e) { Report("status cloud", e); } finally { End(); } } private static void FogPost(Fog __instance) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (__instance.stops == null || !((Behaviour)__instance).enabled || !Begin()) { return; } try { __instance.MakePlayerCold(); if ((Object)(object)__instance.fogParticles != (Object)null) { Character.localCharacter.data.isInFog = Character.localCharacter.Center.y < ((Component)__instance).transform.position.y; } } catch (Exception e) { Report("fog", e); } finally { End(); } } private static void FogSpherePost(FogSphere __instance) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) Character p2Character = SplitManager.P2Character; if ((Object)(object)p2Character == (Object)null || SplitContext.Active || !Application.isPlaying) { return; } try { p2Character.data.isInFog = false; if (Mathf.Approximately(__instance.ENABLE, 1f) && !(Vector3.Distance(__instance.fogPoint, p2Character.Center) <= __instance.currentSize)) { if (p2Character.data.isSkeleton) { p2Character.refs.afflictions.AddStatus((STATUSTYPE)0, 0.0013125f * Time.deltaTime, false, true, true, false, false); } else { p2Character.refs.afflictions.AddStatus((STATUSTYPE)2, 0.0105f * Time.deltaTime, false, true, true, false, false); } p2Character.data.isInFog = true; } } catch (Exception e) { Report("fog sphere", e); } } private static void WindUpdatePost(WindChillZone __instance) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) Character p2Character = SplitManager.P2Character; if ((Object)(object)p2Character == (Object)null || SplitContext.Active) { return; } try { Wind orCreateValue = Winds.GetOrCreateValue(__instance); orCreateValue.inside = ((Bounds)(ref __instance.windZoneBounds)).Contains(p2Character.Center); orCreateValue.factor = 0f; if (orCreateValue.inside && __instance.windActive) { float windPlayerFactor = __instance.windPlayerFactor; __instance.ApplyStatus(p2Character); orCreateValue.factor = __instance.windPlayerFactor; __instance.windPlayerFactor = windPlayerFactor; } } catch (Exception e) { Report("wind", e); } } private static void WindFixedPost(WindChillZone __instance) { Character p2Character = SplitManager.P2Character; if ((Object)(object)p2Character == (Object)null || SplitContext.Active) { return; } try { if (!Winds.TryGetValue(__instance, out var value) || !value.inside || !__instance.windActive || __instance.timeSpentWaiting < __instance.delayBeforeForce) { return; } float windPlayerFactor = __instance.windPlayerFactor; __instance.windPlayerFactor = value.factor; try { __instance.AddWindForceToCharacter(p2Character, __instance.currentForceMult); } finally { __instance.windPlayerFactor = windPlayerFactor; } } catch (Exception e) { Report("wind force", e); } } private static void LavaUpdatePost(Lava __instance) { if (!Begin()) { return; } try { Num orCreateValue = Counters.GetOrCreateValue((MonoBehaviour)(object)__instance); float counter = __instance.counter; __instance.counter = orCreateValue.value; try { __instance.Heat(); } finally { orCreateValue.value = __instance.counter; __instance.counter = counter; } } catch (Exception e) { Report("lava heat", e); } finally { End(); } } private static void LavaFixedPost(Lava __instance) { if (!Begin()) { return; } try { __instance.DoEffects(); } catch (Exception e) { Report("lava", e); } finally { End(); } } private static void HotSunPost(HotSun __instance) { if (!Application.isPlaying || !Begin()) { return; } try { Num orCreateValue = Counters.GetOrCreateValue((MonoBehaviour)(object)__instance); float counter = __instance.counter; __instance.counter = orCreateValue.value; try { __instance.Update(); } finally { orCreateValue.value = __instance.counter; __instance.counter = counter; } } catch (Exception e) { Report("sun", e); } finally { End(); } } private static void InjurySpherePost(InjurySphere __instance) { if (!Begin()) { return; } try { __instance.Update(); } catch (Exception e) { Report("injury zone", e); } finally { End(); } } private static void BananaPost(BananaPeel __instance) { if (!Begin()) { return; } try { __instance.counter -= Time.deltaTime; __instance.Update(); } catch (Exception e) { Report("banana peel", e); } finally { End(); } } private static void CampfirePre(Campfire __instance, out bool __state) { __state = __instance.fireHasStarted; } private static void CampfirePost(Campfire __instance, bool __state) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (!__instance.Lit) { return; } bool flag = !__state && __instance.fireHasStarted; if (!Begin()) { return; } try { Character localCharacter = Character.localCharacter; Num orCreateValue = Counters.GetOrCreateValue((MonoBehaviour)(object)__instance); float timebuffLastApplied = __instance._timebuffLastApplied; __instance._timebuffLastApplied = orCreateValue.value; try { __instance.ApplyCampfireProtection(); } finally { orCreateValue.value = __instance._timebuffLastApplied; __instance._timebuffLastApplied = timebuffLastApplied; } if (flag && Vector3.Distance(((Component)__instance).transform.position, localCharacter.Center) <= __instance.moraleBoostRadius) { localCharacter.refs.afflictions.AdjustStatus((STATUSTYPE)0, -0.2f, false); localCharacter.refs.afflictions.AdjustStatus((STATUSTYPE)13, -0.2f, false); } } catch (Exception e) { Report("campfire", e); } finally { End(); } } private static void CollisionPre(Collision __0, out bool __state) { __state = __0 != null && (Object)(object)__0.collider != (Object)null && Touches(__0.collider) && Begin(); } private static void TriggerPre(Collider __0, out bool __state) { __state = (Object)(object)__0 != (Object)null && Touches(__0) && Begin(); } private static void CharacterPre(Character __0, out bool __state) { __state = (Object)(object)__0 != (Object)null && __0 == SplitManager.P2Character && Begin(); } private static void ContextFinal(bool __state) { if (__state) { End(); } } private static bool Touches(Collider c) { Character p2Character = SplitManager.P2Character; if ((Object)(object)p2Character != (Object)null) { return ((Component)c).transform.root == ((Component)p2Character).transform.root; } return false; } } internal static class MenuOption { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__4_0; internal void <Build>b__4_0() { Plugin.TwoPlayers.Value = false; } } private const string Label = "Play Split-Screen"; public static Button SplitButton; public static void Apply(Harmony h) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown h.Patch((MethodBase)AccessTools.Method(typeof(MainMenu), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(MenuOption).GetMethod("MenuStartPostfix", BindingFlags.Static | BindingFlags.NonPublic)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void MenuStartPostfix(MainMenu __instance) { try { Build(__instance); } catch (Exception ex) { Plugin.Log.LogError((object)("Menu button: " + ex)); } } private static void Build(MainMenu menu) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Expected O, but got Unknown //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Invalid comparison between Unknown and I4 //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Expected O, but got Unknown //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Expected O, but got Unknown //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_05b9: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_04fb: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_0510: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_054c: Unknown result type (might be due to invalid IL or missing references) //IL_0556: Expected O, but got Unknown //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_053b: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.Enabled.Value) { return; } Button playSoloButton = menu.playSoloButton; if ((Object)(object)playSoloButton == (Object)null || (Object)(object)SplitButton != (Object)null) { return; } ButtonClickedEvent onClick = playSoloButton.onClick; object obj = <>c.<>9__4_0; if (obj == null) { UnityAction val = delegate { Plugin.TwoPlayers.Value = false; }; <>c.<>9__4_0 = val; obj = (object)val; } ((UnityEvent)onClick).AddListener((UnityAction)obj); Transform parent = ((Component)playSoloButton).transform.parent; Button val2 = Object.Instantiate<Button>(playSoloButton, parent); ((Object)val2).name = "PlaySplitScreenButton"; ((Component)val2).transform.SetSiblingIndex(((Component)playSoloButton).transform.GetSiblingIndex() + 1); LocalizedText[] componentsInChildren = ((Component)val2).GetComponentsInChildren<LocalizedText>(true); for (int num = 0; num < componentsInChildren.Length; num++) { Object.DestroyImmediate((Object)(object)componentsInChildren[num]); } TMP_Text componentInChildren = ((Component)playSoloButton).GetComponentInChildren<TMP_Text>(true); TMP_Text componentInChildren2 = ((Component)val2).GetComponentInChildren<TMP_Text>(true); if ((Object)(object)componentInChildren2 != (Object)null) { string text = (((Object)(object)componentInChildren != (Object)null) ? componentInChildren.text : ""); bool flag = text.Length > 0 && text == text.ToUpperInvariant(); bool flag2 = text.Length > 0 && text == text.ToLowerInvariant(); componentInChildren2.text = (flag ? "Play Split-Screen".ToUpperInvariant() : (flag2 ? "Play Split-Screen".ToLowerInvariant() : "Play Split-Screen")); } ((UnityEventBase)val2.onClick).RemoveAllListeners(); ((UnityEvent)val2.onClick).AddListener((UnityAction)delegate { Plugin.TwoPlayers.Value = true; menu.PlaySoloClicked(); }); Navigation navigation = ((Selectable)playSoloButton).navigation; if ((int)((Navigation)(ref navigation)).mode == 4) { Selectable selectOnDown = ((Navigation)(ref navigation)).selectOnDown; Navigation navigation2 = navigation; ((Navigation)(ref navigation2)).selectOnUp = (Selectable)(object)playSoloButton; ((Navigation)(ref navigation2)).selectOnDown = selectOnDown; ((Selectable)val2).navigation = navigation2; ((Navigation)(ref navigation)).selectOnDown = (Selectable)(object)val2; ((Selectable)playSoloButton).navigation = navigation; if ((Object)(object)selectOnDown != (Object)null) { Navigation navigation3 = selectOnDown.navigation; if ((Object)(object)((Navigation)(ref navigation3)).selectOnUp == (Object)(object)playSoloButton) { ((Navigation)(ref navigation3)).selectOnUp = (Selectable)(object)val2; selectOnDown.navigation = navigation3; } } } if ((Object)(object)((Component)parent).GetComponent<LayoutGroup>() == (Object)null) { RectTransform val3 = (RectTransform)((Component)playSoloButton).transform; RectTransform val4 = (RectTransform)((Component)val2).transform; float num2 = 0f; int siblingIndex = ((Component)playSoloButton).transform.GetSiblingIndex(); for (int num3 = 0; num3 < parent.childCount; num3++) { if (num3 == siblingIndex || num3 == siblingIndex + 1) { continue; } Transform child = parent.GetChild(num3); RectTransform val5 = (RectTransform)(object)((child is RectTransform) ? child : null); if (!((Object)(object)val5 == (Object)null) && !((Object)(object)((Component)val5).GetComponent<Button>() == (Object)null)) { float num4 = Mathf.Abs(val5.anchoredPosition.y - val3.anchoredPosition.y); if (num4 > 1f && (num2 == 0f || num4 < num2)) { num2 = num4; } } } if (num2 == 0f) { Rect rect = val3.rect; num2 = ((Rect)(ref rect)).height * 1.2f; } float num5 = num2 * 0.4f; float num6 = num2 * 0.55f; float y = val3.anchoredPosition.y; for (int num7 = 0; num7 < parent.childCount; num7++) { Transform child2 = parent.GetChild(num7); RectTransform val6 = (RectTransform)(object)((child2 is RectTransform) ? child2 : null); if (!((Object)(object)val6 == (Object)null) && !((Object)(object)val6 == (Object)(object)val4) && !((Object)(object)((Component)val6).GetComponent<Button>() == (Object)null)) { if (val6.anchoredPosition.y < y - 1f) { val6.anchoredPosition -= new Vector2(0f, num6); } else { val6.anchoredPosition += new Vector2(0f, num5); } } } float num8 = (y + num5 + (y - num2 - num6)) * 0.5f; val4.anchoredPosition = new Vector2(val3.anchoredPosition.x - 12f, num8); ((Transform)val4).localRotation = Quaternion.Euler(0f, 0f, 1.6f); } Transform val7 = ((Component)val2).transform.Find("Hinge/Icons"); if ((Object)(object)val7 != (Object)null && val7.childCount > 0) { int num9 = 0; Transform val8 = null; for (int num10 = 0; num10 < val7.childCount; num10++) { Transform child3 = val7.GetChild(num10); if (((Component)child3).gameObject.activeSelf) { num9++; if ((Object)(object)val8 == (Object)null) { val8 = child3; } } } if ((Object)(object)val8 == (Object)null) { val8 = val7.GetChild(0); } for (int num11 = 0; num11 < val7.childCount; num11++) { if (num9 >= 2) { break; } Transform child4 = val7.GetChild(num11); if (!((Component)child4).gameObject.activeSelf) { ((Component)child4).gameObject.SetActive(true); num9++; } } for (; num9 < 2; num9++) { ((Component)Object.Instantiate<Transform>(val8, val7)).gameObject.SetActive(true); } RectTransform val9 = (RectTransform)((Component)val2).transform; val9.sizeDelta += new Vector2(50f, 0f); if ((Object)(object)componentInChildren2 != (Object)null) { RectTransform rectTransform = componentInChildren2.rectTransform; rectTransform.offsetMax -= new Vector2(42f, 0f); } LayoutRebuilder.ForceRebuildLayoutImmediate((RectTransform)val7); } SplitButton = val2; Plugin.Log.LogInfo((object)("Menu: added split-screen button under '" + ((Object)playSoloButton).name + "' (layout=" + (((Object)(object)((Component)parent).GetComponent<LayoutGroup>() != (Object)null) ? ((object)((Component)parent).GetComponent<LayoutGroup>()).GetType().Name : "none") + ", " + string.Format("nav={0}, label='{1}')", ((Navigation)(ref navigation)).mode, ((Object)(object)componentInChildren2 != (Object)null) ? componentInChildren2.text : "?"))); } } internal static class P2Audio { private sealed class Entry { public AudioSource src; public Transform tf; public AnimationCurve rolloff; public AnimationCurve blendCurve; public bool applied; public float baseVol; public float baseBlend; public float basePan; public float setVol; public float setBlend; public float setPan; public bool seen; } [StructLayout(LayoutKind.Sequential, Size = 1)] private struct RestoreStep { } [StructLayout(LayoutKind.Sequential, Size = 1)] private struct ApplyStep { } [CompilerGenerated] private static class <>O { public static UpdateFunction <0>__Restore; public static UpdateFunction <1>__BeforeMix; } private static readonly List<Entry> _entries = new List<Entry>(); private static readonly Dictionary<int, Entry> _byId = new Dictionary<int, Entry>(); private static float _nextScan; private static Transform _ear1; private static int _lastApplyFrame = -1; private static bool _warned; private static int _adjusted; private static int _playing3d; private static int _overwritten; private static int _custom; private static int _linear; private static int _log; private static int _curved; private static string _loudest = "none"; private static float _bestScore; private static bool On { get { if (Plugin.P2Sound.Value && SplitManager.Active) { return (Object)(object)SplitManager.P2Cam != (Object)null; } return false; } } public static void Apply(Harmony h) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0049: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown h.Patch((MethodBase)AccessTools.Method(typeof(SFX_Player), "PlaySFX", (Type[])null, (Type[])null), new HarmonyMethod(typeof(P2Audio), "PlayPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(P2Audio), "PlayFinalizer", (Type[])null), (HarmonyMethod)null); h.Patch((MethodBase)AccessTools.Method(typeof(EnvironmentLoopHelper), "Update", (Type[])null, (Type[])null), new HarmonyMethod(typeof(P2Audio), "LoopPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Install(); } public static void Watchdog() { if (Time.frameCount - _lastApplyFrame > 10 && Time.frameCount > 10) { Install(); } } private static void Install() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Expected O, but got Unknown try { PlayerLoopSystem currentPlayerLoop = PlayerLoop.GetCurrentPlayerLoop(); if (currentPlayerLoop.subSystemList == null) { return; } bool flag = false; bool flag2 = false; for (int i = 0; i < currentPlayerLoop.subSystemList.Length; i++) { PlayerLoopSystem val = currentPlayerLoop.subSystemList[i]; List<PlayerLoopSystem> list = new List<PlayerLoopSystem>((IEnumerable<PlayerLoopSystem>)(((object)val.subSystemList) ?? ((object)new PlayerLoopSystem[0]))); list.RemoveAll((PlayerLoopSystem s) => s.type == typeof(RestoreStep) || s.type == typeof(ApplyStep)); if (val.type == typeof(EarlyUpdate)) { PlayerLoopSystem item = new PlayerLoopSystem { type = typeof(RestoreStep) }; object obj = <>O.<0>__Restore; if (obj == null) { UpdateFunction val2 = Restore; <>O.<0>__Restore = val2; obj = (object)val2; } item.updateDelegate = (UpdateFunction)obj; list.Insert(0, item); flag = true; } else if (val.type == typeof(PostLateUpdate)) { int num = list.FindIndex((PlayerLoopSystem s) => s.type == typeof(UpdateAudio)); if (num < 0) { num = list.Count; } int index = num; PlayerLoopSystem item = new PlayerLoopSystem { type = typeof(ApplyStep) }; object obj2 = <>O.<1>__BeforeMix; if (obj2 == null) { UpdateFunction val3 = BeforeMix; <>O.<1>__BeforeMix = val3; obj2 = (object)val3; } item.updateDelegate