Decompiled source of PEAK Local Split Screen v1.1.0
plugins/PeakSplitScreen.dll
Decompiled 6 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Peak.Afflictions; 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.Layouts; using UnityEngine.InputSystem.LowLevel; using UnityEngine.InputSystem.Utilities; 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: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("PeakSplitScreen")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PeakSplitScreen")] [assembly: AssemblyTitle("PeakSplitScreen")] [assembly: AssemblyVersion("1.0.0.0")] [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 { public static class Entry { internal static Harmony H; private static readonly Dictionary<int, float> lastSampleLog = new Dictionary<int, float>(); public static void Init() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Expected O, but got Unknown //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Expected O, but got Unknown //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Expected O, but got Unknown //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Expected O, but got Unknown //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Expected O, but got Unknown //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Expected O, but got Unknown if (H != null) { return; } H = new Harmony("peak.splitscreen"); try { H.Patch((MethodBase)AccessTools.Method(typeof(MainMenu), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Menu), "AfterMenuStart", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Net.Patch(H); Extras.Patch(H); PerView.Patch(H); H.Patch((MethodBase)AccessTools.Method(typeof(CharacterSpawner), "SpawnMyPlayerCharacter", (Type[])null, (Type[])null), new HarmonyMethod(typeof(Entry), "LogSpawn", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); if (Runner.AutoTestWanted) { H.Patch((MethodBase)AccessTools.Method(typeof(CharacterInput), "Sample", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Entry), "LogSample", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); H.Patch((MethodBase)AccessTools.Method(typeof(PerlinShake), "AddShake", new Type[3] { typeof(float), typeof(float), typeof(float) }, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Runner), "CountShake", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); H.Patch((MethodBase)AccessTools.Method(typeof(SFX_Player), "PlaySFX", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Runner), "SoundAsked", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodBase[] array = new MethodBase[5] { AccessTools.Method(typeof(BackpackWheel), "Choose", (Type[])null, (Type[])null), AccessTools.Method(typeof(Item), "RequestPickup", (Type[])null, (Type[])null), AccessTools.Method(typeof(Item), "DenyPickupRPC", (Type[])null, (Type[])null), AccessTools.Method(typeof(CharacterItems), "OnPickupAccepted", (Type[])null, (Type[])null), AccessTools.Method(typeof(Item), "PutInBackpackRPC", (Type[])null, (Type[])null) }; foreach (MethodBase methodBase in array) { if (methodBase != null) { H.Patch(methodBase, new HarmonyMethod(typeof(Runner), "LogBackpackStep", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } H.Patch((MethodBase)AccessTools.Method(typeof(Item), "Interact", (Type[])null, (Type[])null), new HarmonyMethod(typeof(Runner), "LogItemInteract", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } H.Patch((MethodBase)AccessTools.Method(typeof(CharacterInput), "Init", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Entry), "AfterInputInit", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); H.Patch((MethodBase)AccessTools.Method(typeof(Player), "AssignUserID", (Type[])null, (Type[])null), new HarmonyMethod(typeof(Entry), "BeforeAssignUserID", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Patches.Apply(H); AreaEffects.Patch(H); } catch (Exception ex) { Debug.LogError((object)("[SplitScreen] could not hook the game: " + ex)); } GameObject val = new GameObject("PeakSplitScreen"); Object.DontDestroyOnLoad((Object)val); val.AddComponent<Runner>(); SceneManager.sceneLoaded += delegate { Owners.Clear(); Split.SceneChanged(); }; Debug.Log((object)"[SplitScreen] loaded"); } private static void LogSample(CharacterInput __instance) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) if (!Split.Active || !Runner.AutoTestWanted) { return; } int instanceID = ((Object)__instance).GetInstanceID(); if (lastSampleLog.TryGetValue(instanceID, out var value) && Time.realtimeSinceStartup - value < 1f) { return; } lastSampleLog[instanceID] = Time.realtimeSinceStartup; InputAction action_move = CharacterInput.action_move; string[] obj = new string[7] { $"[SplitScreen] input {((Object)__instance).name} as player {Ctx.Cur}: move {__instance.movementInput}, ", "asset ", null, null, null, null, null }; object obj2; if (action_move == null) { obj2 = null; } else { InputActionMap actionMap = action_move.actionMap; obj2 = ((actionMap != null) ? actionMap.asset : null); } obj[2] = (((Object)obj2 == (Object)(object)InputSystem.actions) ? "game set" : "own copy"); obj[3] = ", devices "; object obj3; if (action_move == null) { obj3 = null; } else { InputActionMap actionMap2 = action_move.actionMap; if (actionMap2 == null) { obj3 = null; } else { InputActionAsset asset = actionMap2.asset; if (asset == null) { obj3 = null; } else { ReadOnlyArray<InputDevice>? devices = asset.devices; obj3 = (devices.HasValue ? ((IEnumerable<InputDevice>)(object)devices.GetValueOrDefault()).Select((InputDevice d) => ((InputControl)d).name) : null); } } } if (obj3 == null) { obj3 = new string[0]; } obj[4] = string.Join("+", (IEnumerable<string?>)obj3); obj[5] = ", "; obj[6] = $"scheme {InputHandler.GetCurrentUsedInputScheme()}"; Debug.Log((object)string.Concat(obj)); } private static void BeforeAssignUserID(Player __instance, ref ulong userID) { if (Split.Active) { int num = Owners.OfView(((MonoBehaviourPun)__instance).photonView); if (num >= 2) { userID = 900000000uL + (ulong)num; } } } private static void AfterInputInit() { if (Split.Active && Ctx.Cur >= 2) { Split.UseActionsOf(Ctx.Cur); } } private static void LogSpawn(CharacterSpawner __instance, SpawnFlavor spawnFlavor, ref Transform spawnOverride) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 if (Split.Active) { if ((int)spawnFlavor == 3 && (Object)(object)spawnOverride == (Object)null && Ctx.Cur >= 2) { spawnOverride = AirportElevators.SpotFor(Ctx.Cur) ?? spawnOverride; } Traverse val = Traverse.Create((object)__instance); object arg = Ctx.Cur; Player localPlayer = PhotonNetwork.LocalPlayer; Debug.Log((object)(string.Format("[SplitScreen] spawn as player {0}: actor {1}, hasSpawnedPlayer {2}, ", arg, (localPlayer != null) ? new int?(localPlayer.ActorNumber) : ((int?)null), val.Field("hasSpawnedPlayer").GetValue()) + string.Format("canSpawn {0}, localCharacter {1}", val.Property("CanSpawnCharacters", (object[])null).GetValue(), Object.op_Implicit((Object)(object)Character.localCharacter) ? ((Object)Character.localCharacter).name : "none"))); } } } internal static class AirportElevators { private static readonly Transform[] spots = (Transform[])(object)new Transform[5]; internal static Transform SpotFor(int seat) { //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)spots[seat])) { return spots[seat]; } SpawnPoint main = ((IEnumerable<SpawnPoint>)SpawnPoint.allSpawnPoints).FirstOrDefault((Func<SpawnPoint, bool>)((SpawnPoint p) => Object.op_Implicit((Object)(object)p))); if (!Object.op_Implicit((Object)(object)main)) { return null; } List<Transform> list = (from t in (from t in Object.FindObjectsByType<Transform>((FindObjectsSortMode)0) where ((Object)t).name == "ElevatorPing" && Object.op_Implicit((Object)(object)t.parent) select t.parent).Distinct() orderby Vector3.Distance(t.position, ((Component)main).transform.position) select t).ToList(); if (list.Count < 2) { return null; } Vector3 val = ((Component)main).transform.position - list[0].position; Transform val2 = list[(seat - 1) % list.Count]; Transform transform = new GameObject($"SplitScreen spawn (player {seat})").transform; transform.SetParent(val2, true); transform.SetPositionAndRotation(val2.position + val, ((Component)main).transform.rotation); Debug.Log((object)$"[SplitScreen] player {seat} arrives in {((Object)val2).name} at {transform.position}"); return spots[seat] = transform; } } internal static class Menu { private static bool autoTestStarted; internal static void AfterMenuStart(MainMenu __instance) { try { Add(__instance.playSoloButton); } catch (Exception ex) { Debug.LogError((object)("[SplitScreen] menu button: " + ex)); } if (Runner.AutoTestWanted && !autoTestStarted) { autoTestStarted = true; ((MonoBehaviour)Runner.I).StartCoroutine(Environment.GetCommandLineArgs().Contains("-nosplit") ? Runner.I.AutoTestSolo(__instance.playSoloButton) : Runner.I.AutoTest(__instance.playSoloButton)); } } private static void Add(Button solo) { //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)solo) || Object.op_Implicit((Object)(object)((Component)solo).transform.parent.Find("SplitTheScreenButton"))) { return; } GameObject val = Object.Instantiate<GameObject>(((Component)solo).gameObject, ((Component)solo).transform.parent); ((Object)val).name = "SplitTheScreenButton"; val.transform.SetSiblingIndex(((Component)solo).transform.GetSiblingIndex() + 1); MonoBehaviour[] componentsInChildren = val.GetComponentsInChildren<MonoBehaviour>(true); foreach (MonoBehaviour val2 in componentsInChildren) { if (((object)val2).GetType().Name.StartsWith("Locali")) { Object.DestroyImmediate((Object)(object)val2); } } TMP_Text componentInChildren = ((Component)solo).GetComponentInChildren<TMP_Text>(true); string text = ((componentInChildren != null) ? componentInChildren.text : null) ?? ""; string text2 = ((text.Length > 0 && text == text.ToUpperInvariant()) ? "SPLIT THE SCREEN" : "Split the screen"); TMP_Text[] componentsInChildren2 = val.GetComponentsInChildren<TMP_Text>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { componentsInChildren2[i].text = text2; } AddSecondHiker(val); Button component = val.GetComponent<Button>(); component.onClick = new ButtonClickedEvent(); ((UnityEvent)component.onClick).AddListener((UnityAction)delegate { Runner.I.BeginSetup(solo); }); if (!Object.op_Implicit((Object)(object)((Component)((Component)solo).transform.parent).GetComponent<LayoutGroup>())) { MakeRoom(solo, val.transform); } Navigate(solo, component); } private static void AddSecondHiker(GameObject sign) { //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) HorizontalLayoutGroup row = ((IEnumerable<HorizontalLayoutGroup>)sign.GetComponentsInChildren<HorizontalLayoutGroup>(true)).FirstOrDefault((Func<HorizontalLayoutGroup, bool>)((HorizontalLayoutGroup g) => ((Object)g).name == "Icons")); List<Image> list = (Object.op_Implicit((Object)(object)row) ? (from i in ((Component)row).GetComponentsInChildren<Image>(true) where (Object)(object)((Component)i).transform.parent == (Object)(object)((Component)row).transform select i).ToList() : new List<Image>()); if (list.Count < 2) { Debug.LogWarning((object)"[SplitScreen] hiker icons not found on the sign"); return; } for (int num = 0; num < list.Count; num++) { ((Component)list[num]).gameObject.SetActive(num < 2); } ((HorizontalOrVerticalLayoutGroup)row).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)row).childControlWidth = false; ((LayoutGroup)row).childAlignment = (TextAnchor)4; ((HorizontalOrVerticalLayoutGroup)row).spacing = -6f; TMP_Text[] componentsInChildren = sign.GetComponentsInChildren<TMP_Text>(true); for (int num2 = 0; num2 < componentsInChildren.Length; num2++) { RectTransform val = (RectTransform)componentsInChildren[num2].transform; val.sizeDelta -= new Vector2(34f, 0f); val.anchoredPosition -= new Vector2(17f, 0f); } } private static void MakeRoom(Button solo, Transform ours) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_002f: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_015a: Unknown result type (might be due to invalid IL or missing references) Vector3 soloPos = ((Component)solo).transform.position; Rect rect = ((RectTransform)((Component)solo).transform).rect; float soloWidth = ((Rect)(ref rect)).width * ((Component)solo).transform.lossyScale.x; List<Button> source = (from x in Object.FindObjectsByType<Button>((FindObjectsSortMode)0) where (Object)(object)((Component)x).transform != (Object)(object)ours && ((Component)x).gameObject.activeInHierarchy && Mathf.Abs(((Component)x).transform.position.x - soloPos.x) < soloWidth * 1.5f select x).ToList(); List<float> list = (from x in source select ((Component)x).transform.position.y - soloPos.y into dy where dy > 1f select dy).ToList(); float num; if (list.Count <= 0) { rect = ((RectTransform)((Component)solo).transform).rect; num = ((Rect)(ref rect)).height * ((Component)solo).transform.lossyScale.y * 1.1f; } else { num = list.Min(); } float num2 = num; foreach (Button item in source.Where((Button x) => ((Component)x).transform.position.y >= soloPos.y - 1f)) { Transform transform = ((Component)item).transform; transform.position += Vector3.up * num2; } ours.position = soloPos; } private static void Navigate(Button solo, Button b) { //IL_0001: 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_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Invalid comparison between Unknown and I4 //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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) Navigation navigation = ((Selectable)solo).navigation; if ((int)((Navigation)(ref navigation)).mode != 4) { return; } Selectable selectOnDown = ((Navigation)(ref navigation)).selectOnDown; Navigation navigation2 = navigation; ((Navigation)(ref navigation2)).selectOnUp = (Selectable)(object)solo; ((Navigation)(ref navigation2)).selectOnDown = selectOnDown; ((Selectable)b).navigation = navigation2; ((Navigation)(ref navigation)).selectOnDown = (Selectable)(object)b; ((Selectable)solo).navigation = navigation; if (Object.op_Implicit((Object)(object)selectOnDown)) { Navigation navigation3 = selectOnDown.navigation; if ((int)((Navigation)(ref navigation3)).mode == 4) { Navigation navigation4 = selectOnDown.navigation; ((Navigation)(ref navigation4)).selectOnUp = (Selectable)(object)b; selectOnDown.navigation = navigation4; } } } } public class Runner : MonoBehaviour { private enum Step { Idle, Join, Layout } [StructLayout(LayoutKind.Auto)] [CompilerGenerated] private struct <>c__DisplayClass14_9 { public BackpackReference bag; } [StructLayout(LayoutKind.Auto)] [CompilerGenerated] private struct <>c__DisplayClass26_0 { public BackpackReference bag; } internal static Runner I; private Step step; private int beganFrame; private Button solo; private readonly List<Gamepad> joined = new List<Gamepad>(); private bool vertical = true; private GUIStyle text; private BaseInputModule menuInput; internal static readonly bool AutoTestWanted = Environment.GetCommandLineArgs().Any((string a) => a == "-splitscreen-autotest"); internal static bool LogBackpack; internal static readonly List<(SFX_Instance sfx, Vector3 at, bool started, int seat)> Sounds = new List<(SFX_Instance, Vector3, bool, int)>(); internal static bool listening; private static readonly FieldRef<VenusFlyTrap, Character> trapVictimOf = AccessTools.FieldRefAccess<VenusFlyTrap, Character>("_targetPlayer"); internal static readonly Dictionary<PerlinShake, int> ShakeCount = new Dictionary<PerlinShake, int>(); internal static readonly Dictionary<PerlinShake, float> ShakeAmount = new Dictionary<PerlinShake, float>(); private static readonly Dictionary<string, int> shakeFrom = new Dictionary<string, int>(); private static readonly PerlinShake[] seatShake = (PerlinShake[])(object)new PerlinShake[5]; private static readonly Dictionary<InputControl, GamepadButton> buttonOf = new Dictionary<InputControl, GamepadButton>(); private static readonly Vector2[] wantStick = (Vector2[])(object)new Vector2[5]; private static readonly InputControl[][] wantPress = new InputControl[5][]; private static bool pumping; private static Vector2 aim; private static float fpsAvg; private static float fpsWorstMs; private void Awake() { I = this; } internal void BeginSetup(Button soloButton) { solo = soloButton; joined.Clear(); step = Step.Join; beganFrame = Time.frameCount; RealPads.Watch(); menuInput = (Object.op_Implicit((Object)(object)EventSystem.current) ? EventSystem.current.currentInputModule : null); if (Object.op_Implicit((Object)(object)menuInput)) { ((Behaviour)menuInput).enabled = false; } } private void Close() { step = Step.Idle; if (Object.op_Implicit((Object)(object)menuInput)) { ((Behaviour)menuInput).enabled = true; } } private static int ArgInt(string name, int fallback) { string[] commandLineArgs = Environment.GetCommandLineArgs(); int num = Array.IndexOf(commandLineArgs, name); if (num < 0 || num + 1 >= commandLineArgs.Length || !int.TryParse(commandLineArgs[num + 1], out var result)) { return fallback; } return result; } internal IEnumerator AutoTest(Button soloButton) { List<string> report = new List<string>(); string dir = Application.persistentDataPath; Application.runInBackground = true; InputSystem.settings.backgroundBehavior = (BackgroundBehavior)2; RealPads.Watch(); yield return (object)new WaitForSeconds(3f); if (Environment.GetCommandLineArgs().Contains("-menu-shot")) { yield return (object)new WaitForSeconds(9f); ScreenCapture.CaptureScreenshot(Path.Combine(dir, "splitscreen-test-menu.png")); yield return (object)new WaitForSeconds(2f); Application.Quit(); yield break; } bool probe = Environment.GetCommandLineArgs().Contains("-ui-probe"); if (probe) { UiProbe.Menu(); } bool otherChosen; if (Environment.GetCommandLineArgs().Contains("-setup-shot")) { int sn = Mathf.Clamp(ArgInt("-players", 2), 2, 4); List<Gamepad> sp = (from num14 in Enumerable.Range(1, sn) select InputSystem.AddDevice<Gamepad>("SplitTestPad" + num14)).ToList(); yield return (object)new WaitForSeconds(6f); BeginSetup(soloButton); yield return (object)new WaitForSeconds(0.5f); foreach (Gamepad item in sp) { yield return Hold(item, 0.2f, Vector2.zero, (GamepadButton)6); } yield return (object)new WaitForSeconds(0.4f); ScreenCapture.CaptureScreenshot(Path.Combine(dir, "splitscreen-test-setup-join.png")); yield return (object)new WaitForSeconds(1f); if (sn < 4) { yield return Hold(sp[0], 0.2f, Vector2.zero, (GamepadButton)12); } yield return (object)new WaitForSeconds(0.6f); bool asked = step == Step.Layout; bool firstSide = vertical; ScreenCapture.CaptureScreenshot(Path.Combine(dir, "splitscreen-test-setup-layout.png")); yield return (object)new WaitForSeconds(1f); otherChosen = false; if (asked) { yield return Hold(sp[0], 0.2f, Vector2.right); yield return (object)new WaitForSeconds(0.4f); otherChosen = !vertical; ScreenCapture.CaptureScreenshot(Path.Combine(dir, "splitscreen-test-setup-layout-other.png")); yield return (object)new WaitForSeconds(1f); yield return Hold(sp[0], 0.2f, Vector2.zero, (GamepadButton)5); yield return (object)new WaitForSeconds(1f); } bool flag = sn <= 3; File.WriteAllText(Path.Combine(dir, "splitscreen-test.json"), "{\"version\":1,\"steps\":[" + string.Format("{{\"step\":\"setup screen with {0} players asks for the layout\",\"passed\":{1},\"detail\":\"layout step shown {2} (wanted {3}), starts on side by side {4}, stick right picks the other {5}\"}}]}}", sn, (asked == flag && (!asked || (firstSide && otherChosen))) ? "true" : "false", asked, flag, firstSide, otherChosen)); Application.Quit(); yield break; } int n = Mathf.Clamp(ArgInt("-players", 2), 2, 4); List<Gamepad> pads = new List<Gamepad> { null }; for (int num = 1; num <= n; num++) { pads.Add(InputSystem.AddDevice<Gamepad>("SplitTestPad" + num)); } solo = soloButton; Split.Request(pads.Skip(1).ToList(), !Environment.GetCommandLineArgs().Contains("-horizontal")); ((UnityEvent)solo.onClick).Invoke(); float t0 = Time.realtimeSinceStartup; while ((!Split.Active || !Split.AllSpawned || !Split.ViewsReady) && Time.realtimeSinceStartup - t0 < 150f) { yield return null; } Note("spawn", Split.AllSpawned && Split.ViewsReady, $"{n} players: {Split.SpawnReport()}, views ready {Split.ViewsReady}, after {Time.realtimeSinceStartup - t0:0.0} s"); yield return (object)new WaitForSeconds(5f); if (Environment.GetCommandLineArgs().Contains("-hud-test") && Environment.GetCommandLineArgs().Contains("-airport-only")) { Character[] array = (Character[])(object)new Character[n + 1]; for (int num2 = 1; num2 <= n; num2++) { array[num2] = Split.CharOf(num2); } if (Split.AllSpawned) { yield return HudBars(n, Note, dir, array); } File.WriteAllText(Path.Combine(dir, "splitscreen-test.json"), "{\"version\":1,\"steps\":[" + string.Join(",", report) + "]}"); Debug.Log((object)"[SplitScreen] test finished, quitting"); Application.Quit(); yield break; } if (Environment.GetCommandLineArgs().Contains("-hazard-test")) { if (Split.AllSpawned) { yield return HazardTest(pads, n, Note, dir); } File.WriteAllText(Path.Combine(dir, "splitscreen-test.json"), "{\"version\":1,\"steps\":[" + string.Join(",", report) + "]}"); Debug.Log((object)"[SplitScreen] test finished, quitting"); Application.Quit(); yield break; } if (Environment.GetCommandLineArgs().Contains("-climb-test")) { if (Split.AllSpawned) { yield return ClimbTest(pads, n, Note, dir); } File.WriteAllText(Path.Combine(dir, "splitscreen-test.json"), "{\"version\":1,\"steps\":[" + string.Join(",", report) + "]}"); Debug.Log((object)"[SplitScreen] test finished, quitting"); Application.Quit(); yield break; } Scene activeScene; float tf; if (Environment.GetCommandLineArgs().Contains("-fog-shot")) { AirportCheckInKiosk gate = Object.FindAnyObjectByType<AirportCheckInKiosk>(); if (Object.op_Implicit((Object)(object)gate)) { activeScene = SceneManager.GetActiveScene(); string from = ((Scene)(ref activeScene)).name; gate.StartGame(0); tf = Time.realtimeSinceStartup; while (true) { activeScene = SceneManager.GetActiveScene(); if (!(((Scene)(ref activeScene)).name == from) || !(Time.realtimeSinceStartup - tf < 120f)) { break; } yield return null; } tf = Time.realtimeSinceStartup; while ((!Split.Active || !Split.AllSpawned || !Split.ViewsReady) && Time.realtimeSinceStartup - tf < 180f) { yield return null; } tf = Time.realtimeSinceStartup; while (Enumerable.Range(1, n).Any((int j) => Object.op_Implicit((Object)(object)Split.CharOf(j)) && (Split.CharOf(j).data.passedOut || Split.CharOf(j).data.fullyPassedOut)) && Time.realtimeSinceStartup - tf < 40f) { yield return null; } yield return (object)new WaitForSeconds(4f); PerView.DebugFog = n; ScreenCapture.CaptureScreenshot(Path.Combine(dir, "splitscreen-test-fog.png")); yield return (object)new WaitForSeconds(1.5f); } Note("fog check", Object.op_Implicit((Object)(object)gate), Object.op_Implicit((Object)(object)gate) ? "island reached; see the fog check lines in the log" : "no check-in kiosk"); File.WriteAllText(Path.Combine(dir, "splitscreen-test.json"), "{\"version\":1,\"steps\":[" + string.Join(",", report) + "]}"); Application.Quit(); yield break; } if (Environment.GetCommandLineArgs().Contains("-pass-shot")) { BoardingPass pass = GUIManager.instance.boardingPass; AccessTools.Method(typeof(MenuWindow), "Open", (Type[])null, (Type[])null).Invoke(pass, null); yield return (object)new WaitForSeconds(1.5f); Vector3[] array2 = (Vector3[])(object)new Vector3[4]; (((IEnumerable<RectTransform>)((Component)pass).GetComponentsInChildren<RectTransform>(true)).FirstOrDefault((Func<RectTransform, bool>)((RectTransform r) => ((Object)r).name == "BoardingPass")) ?? ((Component)pass).GetComponent<RectTransform>()).GetWorldCorners(array2); float num3 = (array2[0].x + array2[2].x) / 2f; Note("boarding pass centred", Mathf.Abs(num3 - (float)Screen.width / 2f) < (float)Screen.width * 0.02f && array2[0].x >= -1f && array2[2].x <= (float)(Screen.width + 1), $"boarding pass from x {array2[0].x:0} to {array2[2].x:0}, middle {num3:0} (screen middle {Screen.width / 2})"); foreach (RectTransform item2 in from r in ((Component)pass).GetComponentsInChildren<RectTransform>(true) where (Object)(object)((Transform)r).parent == (Object)(object)((Component)pass).transform || (Object.op_Implicit((Object)(object)((Transform)r).parent) && (Object)(object)((Transform)r).parent.parent == (Object)(object)((Component)pass).transform) select r) { item2.GetWorldCorners(array2); Debug.Log((object)string.Format("[SplitScreen] pass part {0}/{1}: anchors {2}-{3} pos {4} size {5} scale {6:0.##} x {7:0}-{8:0} components {9}", ((Object)((Transform)item2).parent).name, ((Object)item2).name, item2.anchorMin, item2.anchorMax, item2.anchoredPosition, item2.sizeDelta, ((Transform)item2).localScale.x, array2[0].x, array2[2].x, string.Join(",", from x in ((Component)item2).GetComponents<Component>() select ((object)x).GetType().Name))); } Debug.Log((object)("[SplitScreen] pass parents: " + string.Join(" / ", from val24 in ((Component)pass).GetComponentsInParent<Transform>(true) select ((Object)val24).name + "(" + string.Join(",", from x in ((Component)val24).GetComponents<Component>() select ((object)x).GetType().Name) + ")"))); ScreenCapture.CaptureScreenshot(Path.Combine(dir, "splitscreen-test-pass.png")); yield return (object)new WaitForSeconds(1.5f); File.WriteAllText(Path.Combine(dir, "splitscreen-test.json"), "{\"version\":1,\"steps\":[" + string.Join(",", report) + "]}"); Application.Quit(); yield break; } Vector2[] dirs = (Vector2[])(object)new Vector2[5] { Vector2.zero, Vector2.up, Vector2.down, Vector2.left, Vector2.right }; if (Split.AllSpawned) { yield return Hold(pads[1], 2.5f, Vector2.up); int k; for (k = 1; k <= n; k++) { float[] got = new float[n + 1]; yield return HoldAndRead(pads[k], 1.5f, dirs[k], n, got); bool ok = got[k] > 0.5f && (from j in Enumerable.Range(1, n) where j != k select j).All((int j) => got[j] < 0.1f); Note($"player {k} controller steers only player {k}", ok, string.Join(", ", from j in Enumerable.Range(1, n) select $"player {j} input {got[j]:0.00}")); } } Note("split cameras", Split.ViewsReady, Split.CameraReport()); if (probe) { UiProbe.Hud(); } ScreenCapture.CaptureScreenshot(Path.Combine(dir, "splitscreen-test.png")); yield return (object)new WaitForSeconds(2f); tf = Time.realtimeSinceStartup + 1.5f; otherChosen = false; while (Time.realtimeSinceStartup < tf) { for (int num4 = 1; num4 <= n; num4++) { InputSystem.QueueStateEvent<GamepadState>((InputDevice)(object)pads[num4], new GamepadState { rightStick = new Vector2(1f, 0f) }, -1.0); } if (!otherChosen && tf - Time.realtimeSinceStartup < 0.7f) { ScreenCapture.CaptureScreenshot(Path.Combine(dir, "splitscreen-test-hud.png")); otherChosen = true; } yield return null; } for (int num5 = 1; num5 <= n; num5++) { InputSystem.QueueStateEvent<GamepadState>((InputDevice)(object)pads[num5], default(GamepadState), -1.0); } yield return (object)new WaitForSeconds(1f); for (int sn = 1; sn <= n; sn++) { if (!Split.AllSpawned) { break; } PointPing[] array3 = Object.FindObjectsByType<PointPing>((FindObjectsSortMode)0); for (int num6 = 0; num6 < array3.Length; num6++) { Object.Destroy((Object)(object)((Component)array3[num6]).gameObject); } yield return (object)new WaitForSeconds(0.3f); yield return Hold(pads[sn], 0.2f, Vector2.zero, (GamepadButton)9); yield return (object)new WaitForSeconds(0.3f); PointPing val = Object.FindObjectsByType<PointPing>((FindObjectsSortMode)0).FirstOrDefault(); Camera val2 = Split.CamOf(sn); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2)) { Note($"player {sn} points at the middle of their view", ok: false, Object.op_Implicit((Object)(object)val) ? "no camera" : "no point appeared (nothing solid in the middle of the view?)"); continue; } Vector3 val3 = val2.WorldToViewportPoint(((Component)val).transform.position); if (sn == 1) { ScreenCapture.CaptureScreenshot(Path.Combine(dir, "splitscreen-test-point.png")); } Note($"player {sn} points at the middle of their view", val3.z > 0f && Mathf.Abs(val3.x - 0.5f) < 0.06f && Mathf.Abs(val3.y - 0.5f) < 0.08f, $"the point is at {val3.x:0.00}, {val3.y:0.00} of player {sn}'s view (middle is 0.50, 0.50)"); yield return (object)new WaitForSeconds(0.7f); } if (Split.Count == 2 && !Environment.GetCommandLineArgs().Contains("-horizontal")) { GUIManager instance = GUIManager.instance; Rect barR = Screen_(((Component)instance.bar).GetComponent<RectTransform>()); Transform parent = ((Component)instance.items[0]).transform.parent; Rect val4 = Screen_((RectTransform)(object)((parent is RectTransform) ? parent : null)); Note("vertical split HUD: stamina bar and item slots apart", !((Rect)(ref barR)).Overlaps(val4), $"bar {((Rect)(ref barR)).xMin:0}-{((Rect)(ref barR)).xMax:0} x {((Rect)(ref barR)).yMin:0}-{((Rect)(ref barR)).yMax:0}, slots {((Rect)(ref val4)).xMin:0}-{((Rect)(ref val4)).xMax:0} x {((Rect)(ref val4)).yMin:0}-{((Rect)(ref val4)).yMax:0} (screen pixels, player 1's half)"); List<TMP_Text> list = (from val24 in ((Component)((Component)instance.items[0]).transform.parent.parent).GetComponentsInChildren<TMP_Text>() where ((Behaviour)val24).isActiveAndEnabled && !string.IsNullOrWhiteSpace(val24.text) select val24).ToList(); List<string> list2 = (from val24 in list.Where(delegate(TMP_Text val25) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Rect val24 = Screen_(val25.rectTransform); return ((Rect)(ref val24)).Overlaps(barR); }) select val24.text).ToList(); Note("vertical split HUD: item names clear of the stamina bar", list2.Count == 0, (list2.Count == 0) ? $"{list.Count} item names checked" : ("under the bar: " + string.Join(", ", list2))); GUIManager val5 = ((IEnumerable<GUIManager>)Object.FindObjectsByType<GUIManager>((FindObjectsSortMode)0)).FirstOrDefault((Func<GUIManager, bool>)((GUIManager x) => Owners.Of((Component)(object)x) == 2)); Rect val6 = (Rect)(Object.op_Implicit((Object)(object)val5) ? Screen_(((Component)val5.bar).GetComponent<RectTransform>()) : default(Rect)); Note("vertical split HUD: both stamina bars level", Object.op_Implicit((Object)(object)val5) && Mathf.Abs(((Rect)(ref val6)).yMin - ((Rect)(ref barR)).yMin) < 2f, Object.op_Implicit((Object)(object)val5) ? $"player 1's bar at y {((Rect)(ref barR)).yMin:0}-{((Rect)(ref barR)).yMax:0}, player 2's at y {((Rect)(ref val6)).yMin:0}-{((Rect)(ref val6)).yMax:0}" : "player 2's HUD not found"); } GUIManager val7 = ((IEnumerable<GUIManager>)Object.FindObjectsByType<GUIManager>((FindObjectsSortMode)0)).FirstOrDefault((Func<GUIManager, bool>)((GUIManager g) => Owners.Of((Component)(object)g) == 2)); if (Object.op_Implicit((Object)(object)val7) && Object.op_Implicit((Object)(object)val7.injurySVFX)) { val7.injurySVFX.Play(1f, false); yield return (object)new WaitForSeconds(0.15f); PerView.DebugCameras = 4; ScreenCapture.CaptureScreenshot(Path.Combine(dir, "splitscreen-test-hurtfx.png")); yield return (object)new WaitForSeconds(1.5f); } if (Split.AllSpawned) { Array.Clear(Extras.SoundsBySeat, 0, Extras.SoundsBySeat.Length); for (int sn = 1; sn <= n; sn++) { Character ck = Split.CharOf(sn); Item val8 = NearestGroundItem(ck); if (!Object.op_Implicit((Object)(object)val8)) { Note($"player {sn} throws", ok: false, "no item found"); continue; } string from = ((Object)val8).name; Ctx.Enter(sn); try { val8.Interact(ck); } finally { Ctx.Enter(1); } yield return (object)new WaitForSeconds(2f); Item currentItem = ck.data.currentItem; if (!Object.op_Implicit((Object)(object)currentItem)) { Note($"player {sn} throws", ok: false, "could not pick up " + from); continue; } string heldName = ((Object)currentItem).name; int before = GroundItems(); tf = 0f; float holdEnd = Time.realtimeSinceStartup + 1.2f; otherChosen = false; ((MonoBehaviour)this).StartCoroutine(Hold(pads[sn], 1.2f, Vector2.zero, (GamepadButton)4)); while (Time.realtimeSinceStartup < holdEnd) { tf = Mathf.Max(tf, ck.refs.items.throwChargeLevel); otherChosen |= ck.input.dropIsPressed; yield return null; } yield return (object)new WaitForSeconds(1.5f); int num7 = GroundItems(); Note($"player {sn} throws", !Object.op_Implicit((Object)(object)ck.data.currentItem) && num7 >= before + 1, string.Format("picked up {0} and threw it: hand {1}, items on the ground {2} -> {3}, Y seen {4}, charge {5:0.00}, wheel open {6}", heldName, Object.op_Implicit((Object)(object)ck.data.currentItem) ? "still full" : "empty", before, num7, otherChosen, tf, ck.data.usingBackpackWheel || ck.data.usingEmoteWheel)); } int[] s = Extras.SoundsBySeat; Note("sounds near every player", Enumerable.Range(1, n).All((int num14) => s[num14] > 0), "sounds played during the item tests: " + string.Join(", ", from num14 in Enumerable.Range(1, n) select $"near player {num14}: {s[num14]}")); ScreenCapture.CaptureScreenshot(Path.Combine(dir, "splitscreen-test-items.png")); yield return (object)new WaitForSeconds(2f); } Character cn = Split.CharOf(n); if (Object.op_Implicit((Object)(object)cn)) { InputSystem.RemoveDevice((InputDevice)(object)pads[n]); yield return (object)new WaitForSeconds(1f); otherChosen = Split.RepairText != null; Gamepad again = (pads[n] = InputSystem.AddDevice<Gamepad>("SplitTestPadAgain")); yield return (object)new WaitForSeconds(0.5f); yield return Hold(again, 0.2f, Vector2.zero, (GamepadButton)6); yield return (object)new WaitForSeconds(1f); Vector3 q = cn.Center; yield return Hold(again, 2.5f, Vector2.left); float num8 = Vector3.Distance(q, cn.Center); Note($"player {n} reconnects", otherChosen && Split.RepairText == null && num8 > 0.5f, $"prompt shown {otherChosen}, prompt gone {Split.RepairText == null}, new controller moved player {n} {num8:0.00} m"); } AirportCheckInKiosk val10 = Object.FindAnyObjectByType<AirportCheckInKiosk>(); if (Object.op_Implicit((Object)(object)val10) && !Environment.GetCommandLineArgs().Contains("-airport-only")) { activeScene = SceneManager.GetActiveScene(); string heldName = ((Scene)(ref activeScene)).name; val10.StartGame(0); float holdEnd = Time.realtimeSinceStartup; while (true) { activeScene = SceneManager.GetActiveScene(); if (!(((Scene)(ref activeScene)).name == heldName) || !(Time.realtimeSinceStartup - holdEnd < 120f)) { break; } yield return null; } activeScene = SceneManager.GetActiveScene(); string from = ((Scene)(ref activeScene)).name; holdEnd = Time.realtimeSinceStartup; while ((!Split.Active || !Split.AllSpawned || !Split.ViewsReady || !Object.op_Implicit((Object)(object)Character.localCharacter)) && Time.realtimeSinceStartup - holdEnd < 180f) { yield return null; } yield return (object)new WaitForSeconds(8f); Note("island spawn", Split.AllSpawned && Split.ViewsReady, "scene " + from + ", " + Split.SpawnReport() + ", " + Split.CameraReport()); ScreenCapture.CaptureScreenshot(Path.Combine(dir, "splitscreen-test-island.png")); yield return (object)new WaitForSeconds(2f); int errors = 0; LogCallback count = (LogCallback)delegate(string msg, string trace, LogType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: Unknown result type (might be due to invalid IL or missing references) if ((int)type == 4 || (int)type == 0) { errors++; } }; Application.logMessageReceived += count; yield return MeasureFps(15f); Note("island frame rate", fpsAvg > 0f, $"{n} players: average {fpsAvg:0.0} fps, slowest frame {fpsWorstMs:0} ms over 15 s"); Split.ExtraCamerasEnabled(on: false); yield return MeasureFps(10f); Split.ExtraCamerasEnabled(on: true); Note("island frame rate with only player 1's camera", fpsAvg > 0f, $"average {fpsAvg:0.0} fps, slowest frame {fpsWorstMs:0} ms over 10 s"); if (Split.AllSpawned) { tf = Time.realtimeSinceStartup; while (Enumerable.Range(1, n).Any((int j) => Object.op_Implicit((Object)(object)Split.CharOf(j)) && (Split.CharOf(j).data.passedOut || Split.CharOf(j).data.fullyPassedOut)) && Time.realtimeSinceStartup - tf < 40f) { yield return null; } Vector3[] start = (from j in Enumerable.Range(1, n) select Split.CharOf(j).Center).ToArray(); for (int num9 = 2; num9 <= n; num9++) { ((MonoBehaviour)this).StartCoroutine(Hold(pads[num9], 4f, Vector2.up)); } yield return Hold(pads[1], 4f, Vector2.up); yield return (object)new WaitForSeconds(0.5f); float[] source = (from j in Enumerable.Range(1, n) select Vector3.Distance(start[j - 1], Split.CharOf(j).Center)).ToArray(); Note("island everyone moves", source.All((float num14) => num14 > 1f), "walking together for 4 s: " + string.Join(", ", source.Select((float num14, int j) => $"player {j + 1} {num14:0.0} m"))); } yield return (object)new WaitForSeconds(3f); Application.logMessageReceived -= count; Note("island errors", errors == 0, $"{errors} errors logged during 25 s of {n}-player play on the island"); if (Split.AllSpawned) { Item backpackPrefab = ((IEnumerable<Item>)SingletonAsset<ItemDatabase>.Instance.itemLookup.Values).FirstOrDefault((Func<Item, bool>)((Item i) => i is Backpack)); <>c__DisplayClass14_9 CS$<>8__locals5 = default(<>c__DisplayClass14_9); for (int before = 2; before <= n; before++) { if (!Object.op_Implicit((Object)(object)backpackPrefab)) { break; } Character ck = Split.CharOf(before); int h = before % n + 1; Character ch = Split.CharOf(h); Vector3 val11 = Vector3.ProjectOnPlane(ck.data.lookDirection, Vector3.up); Vector3 q = ((Vector3)(ref val11)).normalized; GameObject bpGo = PhotonNetwork.InstantiateItemRoom(((Object)backpackPrefab).name, ck.Center + q + Vector3.up * 0.3f, Quaternion.identity, true); yield return (object)new WaitForSeconds(1.5f); Backpack bp = (Object.op_Implicit((Object)(object)bpGo) ? bpGo.GetComponent<Backpack>() : null); if (!Object.op_Implicit((Object)(object)bp)) { Note($"player {before} wears a backpack", ok: false, "could not place a backpack"); continue; } ((MonoBehaviour)this).StartCoroutine(Hold(pads[before], 2f, Vector2.down, (GamepadButton)7)); yield return (object)new WaitForSeconds(0.25f); Ctx.Enter(before); try { ((Item)bp).Interact(ck); } finally { Ctx.Enter(1); } string wheelSeen = ""; for (int w = 0; w < 5; w++) { yield return (object)new WaitForSeconds(0.35f); Ctx.Enter(before); try { BackpackWheel backpackWheel = GUIManager.instance.backpackWheel; wheelSeen += string.Format(" [open {0}, chosen {1}, stick {2}, interact held {3}, pack {4}]", ((Component)backpackWheel).gameObject.activeInHierarchy, (!backpackWheel.chosenSlice.IsSome) ? "none" : (backpackWheel.chosenSlice.Value.isStashSlice ? "stash" : ("slot " + backpackWheel.chosenSlice.Value.slotID)), Split.WheelVector(before), ck.input.interactIsPressed, Object.op_Implicit((Object)(object)bp) ? $"{((Item)bp).itemState} {Vector3.Distance(((Item)bp).transform.position, ck.Center):0.0} m" : "gone"); } catch (Exception ex) { wheelSeen = wheelSeen + " [" + ex.Message + "]"; } finally { Ctx.Enter(1); } } yield return (object)new WaitForSeconds(0.8f); bool flag2 = !((ItemSlot)ck.player.backpackSlot).IsEmpty(); Note($"player {before} wears a backpack (hold X, stick down)", flag2, (flag2 ? ("backpack on player " + before + "'s back") : "no backpack on the back") + (flag2 ? "" : (";" + wheelSeen))); if (!flag2) { continue; } Vector3 spot = ck.Center + Vector3.up * 1.8f; val11 = Vector3.Cross(Vector3.up, q); Vector3 normalized = ((Vector3)(ref val11)).normalized; Vector3[] obj = new Vector3[6] { normalized, -normalized, -q, q, default(Vector3), default(Vector3) }; val11 = normalized - q; obj[4] = ((Vector3)(ref val11)).normalized; val11 = -normalized - q; obj[5] = ((Vector3)(ref val11)).normalized; Vector3[] array4 = (Vector3[])(object)obj; foreach (Vector3 val12 in array4) { Vector3 val13 = ck.Center + val12 * 1.5f; RaycastHit val14 = HelperFunctions.LineCheck(ck.Center, val13, (LayerType)1, 0f, (QueryTriggerInteraction)1); if (!Object.op_Implicit((Object)(object)((RaycastHit)(ref val14)).transform)) { RaycastHit val15 = HelperFunctions.LineCheck(val13 + Vector3.up * 2f, val13 + Vector3.down * 4f, (LayerType)1, 0f, (QueryTriggerInteraction)1); if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val15)).transform) && !(Mathf.Abs(((RaycastHit)(ref val15)).point.y - ck.data.groundPos.y) > 0.6f)) { spot = ((RaycastHit)(ref val15)).point + Vector3.up * 1f; break; } } } Vector3 was = ch.Center; Ctx.Enter(h); try { ((MonoBehaviourPun)ch).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { spot, false }); } finally { Ctx.Enter(1); } yield return (object)new WaitForSeconds(1.5f); Debug.Log((object)$"[SplitScreen] test warp of player {h}: from {was} to {spot}, now {ch.Center}, {Vector3.Distance(ch.Center, ck.Center):0.0} m from player {before}"); Item val16 = ((IEnumerable<Item>)SingletonAsset<ItemDatabase>.Instance.itemLookup.Values).FirstOrDefault((Func<Item, bool>)((Item i) => Object.op_Implicit((Object)(object)i) && !(i is Backpack) && i.UIData != null && i.UIData.canBackpack && i.UIData.hasMainInteract)); Item val17 = null; if (Object.op_Implicit((Object)(object)val16)) { GameObject go = PhotonNetwork.InstantiateItemRoom(((Object)val16).name, ch.Center + Vector3.up * 0.5f, Quaternion.identity, true); yield return (object)new WaitForSeconds(1f); val17 = (Object.op_Implicit((Object)(object)go) ? go.GetComponent<Item>() : null); } if (Object.op_Implicit((Object)(object)val17)) { Ctx.Enter(h); try { val17.Interact(ch); } finally { Ctx.Enter(1); } } yield return (object)new WaitForSeconds(2f); if (!Object.op_Implicit((Object)(object)ch.data.currentItem)) { Note($"player {h} puts an item in player {before}'s backpack", ok: false, "player " + h + " has nothing to put in"); continue; } string thingName = ((Object)ch.data.currentItem).name; CS$<>8__locals5.bag = BackpackReference.GetFromEquippedBackpack(ck); int bagBefore = InBag(); aim = Vector2.zero; ((MonoBehaviour)this).StartCoroutine(HoldAim(pads[h], 2f, (GamepadButton)7)); yield return (object)new WaitForSeconds(0.25f); Ctx.Enter(h); try { aim = OpenWheelAimingAtSlot1(CS$<>8__locals5.bag, ck); } finally { Ctx.Enter(1); } for (int w = 0; w < 4; w++) { yield return (object)new WaitForSeconds(0.4f); Ctx.Enter(h); try { BackpackWheel backpackWheel2 = GUIManager.instance.backpackWheel; Debug.Log((object)(string.Format("[SplitScreen] test wheel of player {0}: open {1}, chosen {2}, ", h, ((Component)backpackWheel2).gameObject.activeInHierarchy, backpackWheel2.chosenSlice.IsSome ? ((backpackWheel2.chosenSlice.Value.isStashSlice ? "stash " : "slot ") + backpackWheel2.chosenSlice.Value.slotID) : "none") + $"aim {aim}, interact held {ch.input.interactIsPressed}, wheel input {Split.WheelVector(h)}, distance to wearer {Vector3.Distance(ch.Center, ck.Center):0.0} m, " + string.Format("bag exists {0}, hand {1}, selected slot {2}", ((BackpackReference)(ref CS$<>8__locals5.bag)).exists, Object.op_Implicit((Object)(object)ch.data.currentItem) ? ((Object)ch.data.currentItem).name : "empty", ch.refs.items.currentSelectedSlot))); } catch (Exception ex2) { Debug.Log((object)("[SplitScreen] test wheel log: " + ex2.Message)); } finally { Ctx.Enter(1); } } yield return (object)new WaitForSeconds(0.9f); int bagAfter = InBag(); Note($"player {h} puts an item in player {before}'s backpack (hold X, aim at slot 1)", !Object.op_Implicit((Object)(object)ch.data.currentItem) && bagAfter == bagBefore + 1, string.Format("{0}: player {1}'s hand {2}, backpack items {3} -> {4}", thingName, h, Object.op_Implicit((Object)(object)ch.data.currentItem) ? "still full" : "empty", bagBefore, bagAfter)); if (bagAfter == bagBefore + 1) { aim = Vector2.zero; ((MonoBehaviour)this).StartCoroutine(HoldAim(pads[h], 2f, (GamepadButton)7)); yield return (object)new WaitForSeconds(0.25f); Ctx.Enter(h); try { aim = OpenWheelAimingAtSlot1(CS$<>8__locals5.bag, ck); } finally { Ctx.Enter(1); } yield return (object)new WaitForSeconds(3f); int num10 = InBag(); Note($"player {h} takes it out of player {before}'s backpack", Object.op_Implicit((Object)(object)ch.data.currentItem) && num10 == bagAfter - 1, string.Format("player {0} holds {1}, backpack items {2} -> {3}", h, Object.op_Implicit((Object)(object)ch.data.currentItem) ? ((Object)ch.data.currentItem).name : "nothing", bagAfter, num10)); CS$<>8__locals5 = default(<>c__DisplayClass14_9); } int InBag() { return ((BackpackReference)(ref CS$<>8__locals5.bag)).GetData().itemSlots.Count((ItemSlot val24) => val24 != null && !val24.IsEmpty()); } } if (!Object.op_Implicit((Object)(object)backpackPrefab)) { Note("backpacks", ok: false, "no backpack in the item list"); } Note("everyone looks different", Outfits.AllDifferent(n, out var detail), detail); List<string> list3 = (from seat2 in Enumerable.Range(2, n - 1) where !((ItemSlot)Split.CharOf(seat2).player.backpackSlot).IsEmpty() select seat2).Select(delegate(int num14) { BackpackOnBackVisuals activeBackpackVisuals = Split.CharOf(num14).refs.backpackHandler.activeBackpackVisuals; return string.Format("player {0}'s {1}", num14, (Object.op_Implicit((Object)(object)activeBackpackVisuals) && activeBackpackVisuals.view.activeInHierarchy) ? "shown" : "hidden"); }).ToList(); Note("backpacks show on players' backs", list3.Count > 0 && list3.All((string x) => x.EndsWith("shown")), (list3.Count == 0) ? "nobody wears a backpack" : string.Join(", ", list3)); for (int num11 = 2; num11 <= n; num11++) { Character val18 = Split.CharOf(num11); Ctx.Enter(num11); try { val18.refs.afflictions.AddStatus((STATUSTYPE)1, 0.2f, false, true, true, false, false); val18.refs.afflictions.AddStatus((STATUSTYPE)3, 0.15f, false, true, true, false, false); if (num11 == 2) { val18.refs.afflictions.AddStatus((STATUSTYPE)0, 0.1f, false, true, true, false, false); } } finally { Ctx.Enter(1); } } yield return (object)new WaitForSeconds(0.15f); PerView.DebugCameras = 8; ScreenCapture.CaptureScreenshot(Path.Combine(dir, "splitscreen-test-status.png")); GUIManager[] array5 = Object.FindObjectsByType<GUIManager>((FindObjectsSortMode)0); foreach (GUIManager val19 in array5) { ScreenVFX injurySVFX = val19.injurySVFX; string obj2 = $"[SplitScreen] test hurt edge of player {Owners.Of((Component)(object)val19)}: "; object obj3; if (!Object.op_Implicit((Object)(object)injurySVFX)) { obj3 = "none"; } else { object[] obj4 = new object[5] { ((Object)injurySVFX).name, ((Component)injurySVFX).gameObject.activeInHierarchy, null, null, null }; object obj5; if (!Object.op_Implicit((Object)(object)injurySVFX.renderer)) { obj5 = "none"; } else { string[] obj6 = new string[7] { ((object)injurySVFX.renderer).GetType().Name, " enabled ", injurySVFX.renderer.enabled.ToString(), " layer ", ((Component)injurySVFX.renderer).gameObject.layer.ToString(), " intensity ", null }; Material sharedMaterial = injurySVFX.renderer.sharedMaterial; obj6[6] = ((sharedMaterial != null) ? new float?(sharedMaterial.GetFloat("_Intensity")) : ((float?)null)).ToString(); obj5 = string.Concat(obj6); } obj4[2] = obj5; obj4[3] = ((Object)((Component)injurySVFX).transform.root).name; obj4[4] = Owners.Of((Component)(object)injurySVFX); obj3 = string.Format("{0} active {1}, renderer {2}, under {3}, seat by place {4}", obj4); } Debug.Log((object)(obj2 + (string?)obj3)); } yield return (object)new WaitForSeconds(1.2f); StaminaBar[] bars = Object.FindObjectsByType<StaminaBar>((FindObjectsSortMode)0); for (int num12 = 2; num12 <= n; num12++) { int seat = num12; Character val20 = Split.CharOf(num12); bool canGetHungry = val20.refs.afflictions.canGetHungry; Note($"player {num12}'s stamina bar shows hunger and poison", Shows((STATUSTYPE)3) && (Shows((STATUSTYPE)1) || !canGetHungry), string.Format("hunger {0:0.00} shown {1}{2}, poison {3:0.00} shown {4}", val20.refs.afflictions.GetCurrentStatus((STATUSTYPE)1), Shows((STATUSTYPE)1), canGetHungry ? "" : " (by a campfire: no hunger there)", val20.refs.afflictions.GetCurrentStatus((STATUSTYPE)3), Shows((STATUSTYPE)3))); bool Shows(STATUSTYPE val24) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return bars.Where((StaminaBar b) => Owners.Of((Component)(object)b) == seat).Any((StaminaBar b) => b.afflictions != null && b.afflictions.Any((BarAffliction a) => a.afflictionType == val24 && ((Component)a).gameObject.activeInHierarchy && a.width > 1f)); } } for (int num13 = 2; num13 <= n; num13++) { Character val21 = Split.CharOf(num13); Ctx.Enter(num13); try { val21.refs.afflictions.SetStatus((STATUSTYPE)1, 0f, true); val21.refs.afflictions.SetStatus((STATUSTYPE)3, 0f, true); val21.refs.afflictions.SetStatus((STATUSTYPE)0, 0f, true); } finally { Ctx.Enter(1); } } Item val22 = ((IEnumerable<Item>)SingletonAsset<ItemDatabase>.Instance.itemLookup.Values).FirstOrDefault((Func<Item, bool>)((Item i) => Object.op_Implicit((Object)(object)i) && Object.op_Implicit((Object)(object)((Component)i).GetComponentInChildren<Action_ShowBinocularOverlay>(true)))); int sn = Enumerable.Range(2, n - 1).FirstOrDefault((int seat2) => !Object.op_Implicit((Object)(object)Split.CharOf(seat2).data.currentItem)); if (!Object.op_Implicit((Object)(object)val22)) { Note("binoculars", ok: false, "no binoculars in the item list"); } else if (sn < 2) { Note("binoculars", ok: false, "every player's hands are full"); } else { Character ch = Split.CharOf(sn); GameObject bpGo = PhotonNetwork.InstantiateItemRoom(((Object)val22).name, ch.Center + Vector3.up * 0.5f, Quaternion.identity, true); yield return (object)new WaitForSeconds(1f); Item val23 = (Object.op_Implicit((Object)(object)bpGo) ? bpGo.GetComponent<Item>() : null); if (Object.op_Implicit((Object)(object)val23)) { Ctx.Enter(sn); try { val23.Interact(ch); } finally { Ctx.Enter(1); } } yield return (object)new WaitForSeconds(2f); Action_ShowBinocularOverlay lookThrough = (Object.op_Implicit((Object)(object)ch.data.currentItem) ? ((Component)ch.data.currentItem).GetComponentInChildren<Action_ShowBinocularOverlay>(true) : null); if (Object.op_Implicit((Object)(object)lookThrough)) { Ctx.Enter(sn); try { ((ItemActionBase)lookThrough).RunAction(); } finally { Ctx.Enter(1); } } yield return (object)new WaitForSeconds(1.5f); ScreenCapture.CaptureScreenshot(Path.Combine(dir, "splitscreen-test-binoculars.png")); string thingName = PerView.FeatureReport(); yield return (object)new WaitForSeconds(0.5f); if (Object.op_Implicit((Object)(object)lookThrough)) { Ctx.Enter(sn); try { ((ItemActionBase)lookThrough).RunAction(); } finally { Ctx.Enter(1); } } yield return (object)new WaitForSeconds(0.5f); string text = PerView.FeatureReport(); Note($"binoculars only for player {sn}", Object.op_Implicit((Object)(object)lookThrough) && thingName.EndsWith($"for player {sn}") && !thingName.Contains(",") && text == "none", Object.op_Implicit((Object)(object)lookThrough) ? ("while looking: " + thingName + "; put down: " + text) : ("player " + sn + " could not hold the binoculars")); } } ScreenCapture.CaptureScreenshot(Path.Combine(dir, "splitscreen-test-island2.png")); yield return (object)new WaitForSeconds(2f); } File.WriteAllText(Path.Combine(dir, "splitscreen-test.json"), "{\"version\":1,\"steps\":[" + string.Join(",", report) + "]}"); Debug.Log((object)"[SplitScreen] test finished, quitting"); Application.Quit(); void Note(string step, bool flag3, string text2) { report.Add("{\"step\":\"" + step + "\",\"passed\":" + (flag3 ? "true" : "false") + ",\"detail\":\"" + text2.Replace("\"", "'") + "\"}"); Debug.Log((object)("[SplitScreen] test " + step + ": " + (flag3 ? "passed" : "FAILED") + " - " + text2)); } static Rect Screen_(RectTransform rt) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) Vector3[] array6 = (Vector3[])(object)new Vector3[4]; rt.GetWorldCorners(array6); return new Rect(array6[0].x, array6[0].y, array6[2].x - array6[0].x, array6[2].y - array6[0].y); } } internal static void LogBackpackStep(MethodBase __originalMethod, object __instance, object[] __args) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_0066: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00d4: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) if (!LogBackpack) { return; } string text = ""; BackpackWheel val = (BackpackWheel)((__instance is BackpackWheel) ? __instance : null); object obj; object obj2; object obj3; if (val != null) { if (!val.chosenSlice.IsSome) { obj = "nothing chosen"; goto IL_0159; } SliceData value; if (!val.chosenSlice.Value.isStashSlice) { if (!val.chosenSlice.Value.isBackpackWear) { value = val.chosenSlice.Value; obj2 = "slot " + value.slotID; } else { obj2 = "wear"; } } else { obj2 = "stash"; } value = val.chosenSlice.Value; if (((BackpackReference)(ref value.backpackReference)).exists) { value = val.chosenSlice.Value; if (Object.op_Implicit((Object)(object)((BackpackReference)(ref value.backpackReference)).GetVisuals())) { value = val.chosenSlice.Value; Item val2 = default(Item); if (((BackpackReference)(ref value.backpackReference)).GetVisuals().TryGetSpawnedItem(val.chosenSlice.Value.slotID, ref val2)) { obj3 = ((Object)val2).name + " " + ((object)val2.itemState/*cast due to .constrained prefix*/).ToString() + " active " + ((Component)val2).gameObject.activeSelf; goto IL_0154; } } } obj3 = "NONE"; goto IL_0154; } goto IL_015a; IL_0159: text = (string)obj; goto IL_015a; IL_0154: obj = "chosen " + (string?)obj2 + ", spawned item there " + (string?)obj3; goto IL_0159; IL_015a: object[] obj4 = new object[7] { __originalMethod.DeclaringType.Name, __originalMethod.Name, null, null, null, null, null }; object obj5 = ((__instance is Component) ? __instance : null); obj4[2] = ((obj5 != null) ? ((Object)obj5).name : null); obj4[3] = Ctx.Cur; obj4[4] = PhotonNetwork.IsMasterClient; obj4[5] = string.Join(", ", __args.Select(delegate(object a) { Component val3 = (Component)((a is Component) ? a : null); object obj6; if (val3 == null) { obj6 = a?.ToString(); if (obj6 == null) { return "null"; } } else { obj6 = ((Object)val3).name; } return (string)obj6; })); obj4[6] = text; Debug.Log((object)string.Format("[SplitScreen] backpack step {0}.{1} on {2} as player {3} (host {4}) args {5} {6}", obj4)); } internal static void LogItemInteract(Item __instance, Character interactor) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (LogBackpack && Object.op_Implicit((Object)(object)interactor)) { Debug.Log((object)$"[SplitScreen] backpack step Item.Interact {((Object)__instance).name} ({__instance.itemState}) by {((Object)interactor).name} as player {Ctx.Cur}: empty slot {interactor.player.HasEmptySlot(__instance.itemID)}, since equip {Time.time - interactor.refs.items.lastEquippedSlotTime:0.00} s, climbing {interactor.data.isClimbing}, view owner {((MonoBehaviourPun)__instance).photonView.OwnerActorNr} mine {((MonoBehaviourPun)__instance).photonView.IsMine}"); } } internal static void SoundAsked(SFX_Instance SFX, Vector3 position, object __result) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (listening) { Sounds.Add((SFX, position, __result != null, Ctx.Cur)); } } private IEnumerator HazardTest(List<Gamepad> pads, int n, Action<string, bool, string> note, string dir) { AirportCheckInKiosk val = Object.FindAnyObjectByType<AirportCheckInKiosk>(); if (!Object.op_Implicit((Object)(object)val)) { note("island", arg2: false, "no check-in kiosk"); yield break; } Scene activeScene = SceneManager.GetActiveScene(); string airport = ((Scene)(ref activeScene)).name; val.StartGame(0); float t1 = Time.realtimeSinceStartup; while (true) { activeScene = SceneManager.GetActiveScene(); if (!(((Scene)(ref activeScene)).name == airport) || !(Time.realtimeSinceStartup - t1 < 300f)) { break; } yield return null; } activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == airport) { note("island", arg2: false, "the island didn't load within 5 minutes"); yield break; } t1 = Time.realtimeSinceStartup; while ((!Split.Active || !Split.AllSpawned || !Split.ViewsReady || !Object.op_Implicit((Object)(object)Character.localCharacter)) && Time.realtimeSinceStartup - t1 < 300f) { yield return null; } Action<string, bool, string> action = note; bool arg = Split.AllSpawned && Split.ViewsReady; activeScene = SceneManager.GetActiveScene(); action("island", arg, "scene " + ((Scene)(ref activeScene)).name + ", " + Split.SpawnReport()); yield return (object)new WaitForSeconds(5f); t1 = Time.realtimeSinceStartup; while (Enumerable.Range(1, n).Any((int j) => Object.op_Implicit((Object)(object)Split.CharOf(j)) && (Split.CharOf(j).data.passedOut || Split.CharOf(j).data.fullyPassedOut)) && Time.realtimeSinceStartup - t1 < 60f) { yield return null; } yield return (object)new WaitForSeconds(2f); Character[] cs = (Character[])(object)new Character[n + 1]; for (int num = 1; num <= n; num++) { cs[num] = Split.CharOf(num); } if (Environment.GetCommandLineArgs().Contains("-hud-test")) { yield return HudBars(n, note, dir, cs); yield break; } if (Environment.GetCommandLineArgs().Contains("-backpack-test")) { yield return BackpackSwap(pads, n, note, cs); yield break; } if (Environment.GetCommandLineArgs().Contains("-fog-probe")) { for (int num2 = 1; num2 <= n; num2++) { cs[num2].data.lookValues = new Vector2(cs[1].data.lookValues.x, 5f); } yield return (object)new WaitForSeconds(1.5f); for (int num3 = 1; num3 <= n; num3++) { Camera val2 = Split.CamOf(num3); try { Debug.Log((object)string.Format("[SplitScreen] fog probe camera {0}: far {1} near {2} rect {3} pixelRect {4} target {5} api {6} uv-starts-top {7}", num3, val2.farClipPlane, val2.nearClipPlane, val2.rect, val2.pixelRect, Object.op_Implicit((Object)(object)val2.targetTexture) ? ((Object)val2.targetTexture).name : "screen", SystemInfo.graphicsDeviceType, SystemInfo.graphicsUVStartsAtTop)); } catch (Exception ex) { Debug.Log((object)("[SplitScreen] fog probe: " + ex.Message)); } } CameraQuad val3 = ((IEnumerable<CameraQuad>)Object.FindObjectsByType<CameraQuad>((FindObjectsSortMode)0)).FirstOrDefault((Func<CameraQuad, bool>)((CameraQuad q) => ((Object)q).name == "Post Fog")); object obj; if (!Object.op_Implicit((Object)(object)val3)) { obj = null; } else { Renderer component = ((Component)val3).GetComponent<Renderer>(); obj = ((component != null) ? component.sharedMaterial : null); } Material mat = (Material)obj; if (Object.op_Implicit((Object)(object)mat)) { Debug.Log((object)("[SplitScreen] fog probe: Post Fog material " + ((Object)mat).name + ", shader " + ((Object)mat.shader).name + ", properties: " + string.Join(", ", from i in Enumerable.Range(0, mat.shader.GetPropertyCount()) select mat.shader.GetPropertyName(i) + "=" + (((int)mat.shader.GetPropertyType(i) == 2 || (int)mat.shader.GetPropertyType(i) == 3) ? mat.GetFloat(mat.shader.GetPropertyName(i)).ToString("0.###") : ((object)mat.shader.GetPropertyType(i)/*cast due to .constrained prefix*/).ToString())) + " ; keywords " + string.Join(" ", mat.shaderKeywords))); } float[] light = new float[n + 1]; yield return Brightness(n, light); Debug.Log((object)("[SplitScreen] fog probe brightness normal: " + string.Join(", ", from num19 in Enumerable.Range(1, n) select $"player {num19} {light[num19]:0}"))); ScreenCapture.CaptureScreenshot(Path.Combine(dir, "splitscreen-test-fogprobe.png")); yield return (object)new WaitForSeconds(1.5f); float[] array = new float[4] { 0f, 90f, 180f, 270f }; foreach (float look in array) { for (int num5 = 1; num5 <= n; num5++) { cs[num5].data.lookValues = new Vector2(look, 3f); } yield return (object)new WaitForSeconds(1f); Color32[] full = null; string line = ""; float[] array2 = new float[6] { 1500f, 1000f, 700f, 500f, 350f, 250f }; foreach (float far in array2) { for (int num7 = 1; num7 <= n; num7++) { Split.CamOf(num7).farClipPlane = far; } yield return (object)new WaitForSeconds(0.4f); yield return (object)new WaitForEndOfFrame(); Texture2D val4 = ScreenCapture.CaptureScreenshotAsTexture(); Color32[] px = val4.GetPixels32(); Object.Destroy((Object)(object)val4); if (full == null) { full = px; continue; } IEnumerable<string> values = Enumerable.Range(1, n).Select(delegate(int num19) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00a9: Unknown result type (might be due to invalid IL or missing references) Rect rect = Split.CamOf(num19).rect; int width = Screen.width; int height = Screen.height; double num20 = 0.0; int num21 = 0; int num22 = 0; for (int i = (int)(((Rect)(ref rect)).y * (float)height); i < (int)(((Rect)(ref rect)).yMax * (float)height); i += 3) { for (int j = (int)(((Rect)(ref rect)).x * (float)width); j < (int)(((Rect)(ref rect)).xMax * (float)width); j += 3) { Color32 val15 = px[i * width + j]; Color32 val16 = full[i * width + j]; int num23 = Math.Abs(val15.r - val16.r) + Math.Abs(val15.g - val16.g) + Math.Abs(val15.b - val16.b); num20 += (double)num23; num21++; if (num23 > 30) { num22++; } } } return $"p{num19} {num20 / (double)num21:0.0}/{100.0 * (double)num22 / (double)num21:0.0}%"; }); line = line + $" | far {far}: " + string.Join(" ", values); } for (int num8 = 1; num8 <= n; num8++) { Split.CamOf(num8).farClipPlane = 1500f; } Debug.Log((object)$"[SplitScreen] fog probe draw distance, looking {look}: (average change per pixel / share of pixels changed a lot){line}"); ScreenCapture.CaptureScreenshot(Path.Combine(dir, $"splitscreen-test-fogprobe-{look}.png")); yield return (object)new WaitForSeconds(1f); } for (int num9 = 1; num9 <= n; num9++) { cs[num9].data.lookValues = new Vector2(0f, 3f); } yield return (object)new WaitForSeconds(1f); array = new float[5] { 1500f, 1000f, 700f, 500f, 1500f }; foreach (float look in array) { for (int num10 = 2; num10 <= n; num10++) { Split.CamOf(num10).farClipPlane = look; } yield return (object)new WaitForSeconds(2f); if (look == 1000f) { ScreenCapture.CaptureScreenshot(Path.Combine(dir, "splitscreen-test-fogprobe-far1000.png")); } yield return MeasureFps(12f); Debug.Log((object)$"[SplitScreen] fog probe fps with players 2-{n} drawing {look} m: average {fpsAvg:0.0} fps, slowest frame {fpsWorstMs:0} ms"); } yield break; } OrbFogHandler fog = Object.FindAnyObjectByType<OrbFogHandler>(); FogSphere sphere = (Object.op_Implicit((Object)(object)fog) ? ((Component)fog).GetComponentInChildren<FogSphere>() : null); if (!Object.op_Implicit((Object)(object)fog) || !Object.op_Implicit((Object)(object)sphere)) { note("closing fog chills everyone in it", arg2: false, "no fog on this map"); } else { float look = fog.currentSize; float far = sphere.ENABLE; bool arrived0 = fog.hasArrived; bool moving0 = fog.isMoving; float[] array3 = new float[n + 1]; bool[] inFog = new bool[n + 1]; for (int num11 = 1; num11 <= n; num11++) { Clear(num11, (STATUSTYPE)2); array3[num11] = 0f; } float dist = Enumerable.Range(1, n).Min((int num19) => Vector3.Distance(sphere.fogPoint, cs[num19].Center)); for (float t2 = 0f; t2 < 6f; t2 += Time.deltaTime) { fog.hasArrived = true; fog.isMoving = false; fog.currentSize = Mathf.Max(1f, dist - 20f); sphere.ENABLE = 1f; for (int num12 = 1; num12 <= n; num12++) { inFog[num12] |= cs[num12].data.isInFog; } if (t2 > 3f && t2 < 3.05f) { ScreenCapture.CaptureScreenshot(Path.Combine(dir, "splitscreen-test-fog.png")); } yield return null; } float[] cold = (from num19 in Enumerable.Range(0, n + 1) select (num19 != 0) ? cs[num19].refs.afflictions.GetCurrentStatus((STATUSTYPE)2) : 0f).ToArray(); fog.currentSize = look; fog.hasArrived = arrived0; fog.isMoving = moving0; sphere.ENABLE = far; yield return null; note("closing fog chills everyone in it", Enumerable.Range(1, n).All((int num19) => cold[num19] > 0.02f), "6 s in the fog: " + string.Join(", ", from num19 in Enumerable.Range(1, n) select string.Format("player {0} cold {1:0.000}{2}", num19, cold[num19], inFog[num19] ? "" : " (not counted as in the fog)"))); for (int num13 = 1; num13 <= n; num13++) { Clear(num13, (STATUSTYPE)2); } } yield return (object)new WaitForSeconds(1f); (STATUSTYPE, string)[] array4 = new(STATUSTYPE, string)[3] { ((STATUSTYPE)3, "poison"), ((STATUSTYPE)0, "injury"), ((STATUSTYPE)2, "cold") }; for (int num4 = 0; num4 < array4.Length; num4++) { (STATUSTYPE, string) tuple = array4[num4]; STATUSTYPE type = tuple.Item1; string line = tuple.Item2; for (int num6 = 1; num6 <= n; num6++) { CharacterAfflictions afflictions = cs[num6].refs.afflictions; SFX_Instance expect = (((int)type == 3) ? afflictions.injuryPoison : (((int)type == 2) ? afflictions.injuryIce : afflictions.injurySmall)); Sounds.Clear(); listening = true; Ctx.Enter(num6); try { afflictions.AddStatus(type, 0.05f, false, true, true, false, false); } finally { Ctx.Enter(1); } yield return (object)new WaitForSeconds(0.25f); listening = false; List<(SFX_Instance, Vector3, bool, int)> list = Sounds.Where(((SFX_Instance sfx, Vector3 at, bool started, int seat) x) => (Object)(object)x.sfx == (Object)(object)expect).ToList(); AudioListener listener = ((IEnumerable<AudioListener>)Object.FindObjectsByType<AudioListener>((FindObjectsSortMode)0)).FirstOrDefault((Func<AudioListener, bool>)((AudioListener l) => ((Behaviour)l).isActiveAndEnabled)); List<AudioSource> list2 = (Object.op_Implicit((Object)(object)expect) ? (from a in Object.FindObjectsByType<AudioSource>((FindObjectsSortMode)0) where a.isPlaying && Object.op_Implicit((Object)(object)a.clip) && expect.clips.Contains(a.clip) select a).ToList() : new List<AudioSource>()); string text = string.Join("; ", list2.Select((AudioSource a) => $"volume {a.volume:0.00} muted {a.mute} 3D {a.spatialBlend:0.0} {Vector3.Distance(((Component)a).transform.position, Object.op_Implicit((Object)(object)listener) ? ((Component)listener).transform.position : Vector3.zero):0.0} m from the ears (range {a.maxDistance:0})")); bool arg2 = list.Any<(SFX_Instance, Vector3, bool, int)>(((SFX_Instance sfx, Vector3 at, bool started, int seat) x) => x.started) && list2.Any((AudioSource a) => !a.mute && a.volume > 0.01f && (a.spatialBlend < 0.01f || Vector3.Distance(((Component)a).transform.position, ((Component)listener).transform.position) < a.maxDistance)); note($"player {num6} hears a {line} hurt sound", arg2, string.Format("{0}: asked {1}x, started {2}x", Object.op_Implicit((Object)(object)expect) ? ((Object)expect).name : "no sound set", list.Count, list.Count<(SFX_Instance, Vector3, bool, int)>(((SFX_Instance sfx, Vector3 at, bool started, int seat) x) => x.started)) + ((list.Count > 0) ? $" (asked while running as player {list[0].Item4}, {Vector3.Distance(list[0].Item2, cs[num6].Center):0.0} m from player {num6})" : "") + "; playing now: " + ((list2.Count == 0) ? "none" : text) + "; all sounds asked: " + string.Join(", ", Sounds.Select(((SFX_Instance sfx, Vector3 at, bool started, int seat) x) => (!Object.op_Implicit((Object)(object)x.sfx)) ? "?" : ((Object)x.sfx).name).Distinct())); Clear(num6, type); yield return (object)new WaitForSeconds(0.4f); } } Item foodPrefab = ((IEnumerable<Item>)SingletonAsset<ItemDatabase>.Instance.itemLookup.Values).FirstOrDefault((Func<Item, bool>)((Item i) => Object.op_Implicit((Object)(object)i) && Object.op_Implicit((Object)(object)((Component)i).GetComponentInChildren<Action_InflictPoison>(true)))); Item cactusPrefab = ((IEnumerable<Item>)SingletonAsset<ItemDatabase>.Instance.itemLookup.Values).FirstOrDefault((Func<Item, bool>)((Item i) => Object.op_Implicit((Object)(object)i) && Object.op_Implicit((Object)(object)((Component)i).GetComponentInChildren<CactusBall>(true)))); for (int num4 = 1; num4 <= n; num4++) { Character ck = cs[num4]; InputControl use = ControlFor(num4, pads[num4], "UsePrimary"); if (Object.op_Implicit((Object)(object)foodPrefab)) { GameObject go = PhotonNetwork.InstantiateItemRoom(((Object)foodPrefab).name, ck.Center + Vector3.up * 0.5f, Quaternion.identity, true); yield return (object)new WaitForSeconds(1f); Item val5 = (Object.op_Implicit((Object)(object)go) ? go.GetComponent<Item>() : null); if (Object.op_Implicit((Object)(object)val5)) { Ctx.Enter(num4); try { val5.Interact(ck); } finally { Ctx.Enter(1); } } yield return (object)new WaitForSeconds(1.5f); Sounds.Clear(); listening = true; float dist = ck.refs.afflictions.GetCurrentStatus((STATUSTYPE)3); bool moving0 = Object.op_Implicit((Object)(object)ck.data.currentItem); float far = Time.realtimeSinceStartup + 4f; while (Time.realtimeSinceStartup < far) { InputSystem.QueueStateEvent<GamepadState>((InputDevice)(object)pads[num4], StateFor(pads[num4], Vector2.zero, (InputControl[])(object)new InputControl[1] { use }), -1.0); yield return null; } InputSystem.QueueStateEvent<GamepadState>((InputDevice)(object)pads[num4], default(GamepadState), -1.0); yield return (object)new WaitForSeconds(6f); listening = false; List<(SFX_Instance, Vector3, bool, int)> source = Sounds.Where(((SFX_Instance sfx, Vector3 at, bool started, int seat) x) => Object.op_Implicit((Object)(object)x.sfx) && Vector3.Distance(x.at, ck.Center) < 3f).ToList(); bool flag = source.Any<(SFX_Instance, Vector3, bool, int)>(((SFX_Instance sfx, Vector3 at, bool started, int seat) x) => x.started && (Object)(object)x.sfx == (Object)(object)ck.refs.afflictions.injuryPoison); note($"player {num4} eats poisonous food and hears it", ck.refs.afflictions.GetCurrentStatus((STATUSTYPE)3) > dist && flag, $"{((Object)foodPrefab).name}: held {moving0}, poison {dist:0.00} -> {ck.refs.afflictions.GetCurrentStatus((STATUSTYPE)3):0.00}; sounds near player {num4}: " + string.Join(", ", from x in source group x by ((Object)x.sfx).name into g select $"{g.Key} {g.Count(((SFX_Instance sfx, Vector3 at, bool started, int seat) x) => x.started)}/{g.Count()} started (as player {g.First().seat})")); Clear(num4, (STATUSTYPE)3); } if (Object.op_Implicit((Object)(object)cactusPrefab)) { Sounds.Clear(); listening = true; float far = ck.refs.afflictions.GetCurrentStatus((STATUSTYPE)9); PhotonNetwork.InstantiateItemRoom(((Object)cactusPrefab).name, ck.Center + Vector3.up * 1.2f, Quaternion.identity, true); yield return (object)new WaitForSeconds(3f); listening = false; List<(SFX_Instance, Vector3, bool, int)> source2 = Sounds.Where(((SFX_Instance sfx, Vector3 at, bool started, int seat) x) => Object.op_Implicit((Object)(object)x.sfx) && Vector3.Distance(x.at, ck.Center) < 3f).ToList(); float currentStatus = ck.refs.afflictions.GetCurrentStatus((STATUSTYPE)9); note($"player {num4} gets stuck by a cactus and hears it", currentStatus > far && source2.Any<(SFX_Instance, Vector3, bool, int)>(((SFX_Instance sfx, Vector3 at, bool started, int seat) x) => x.started && (Object)(object)x.sfx == (Object)(object)ck.refs.afflictions.injuryThorns), $"thorns {far:0.00} -> {currentStatus:0.00}; sounds near player {num4}: " + string.Join(", ", from x in source2 group x by ((Object)x.sfx).name into g select $"{g.Key} {g.Count(((SFX_Instance sfx, Vector3 at, bool started, int seat) x) => x.started)}/{g.Count()} started (as player {g.First().seat})")); } yield return (object)new WaitForSeconds(0.5f); } for (int k = 1; k <= n; k++) { Character ck2 = cs[k]; Vector3 up = Vector3.up; Vector3 val6 = Vector3.ProjectOnPlane(ck2.data.lookDirection, Vector3.up); Vector3 val7 = Vector3.Cross(up, ((Vector3)(ref val6)).normalized); if (val7 == Vector3.zero) { val7 = Vector3.right; } Vector3 val8 = ck2.Center + val7 * 12f; RaycastHit val9 = HelperFunctions.LineCheck(val8 + Vector3.up * 5f, val8 + Vector3.down * 20f, (LayerType)1, 0f, (QueryTriggerInteraction)1); if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val9)).transform)) { val8 = ((RaycastHit)(ref val9)).point + Vector3.up * 1.1f; } ((MonoBehaviourPun)ck2).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val8, false }); yield return (object)new WaitForSeconds(1.5f); float far = (from j in Enumerable.Range(1, n) where j != k select Vector3.Distance(cs[j].Center, ck2.Center)).DefaultIfEmpty(99f).Min(); GameObject go = new GameObject("SplitScreen test poison cloud"); go.transform.position = ck2.Center; StatusEmitter obj2 = go.AddComponent<StatusEmitter>(); obj2.statusType = (STATUSTYPE)3; obj2.amount = 0.15f; obj2.radius = 2.5f; obj2.inZoneWarning = true; obj2.extraWarningTime = 1f; float dist = ck2.refs.afflictions.GetCurrentStatus((STATUSTYPE)3); Sounds.Clear(); listening = true; yield return (object)new WaitForSeconds(5f); listening = false; Object.Destroy((Object)(object)go); float currentStatus2 = ck2.refs.afflictions.GetCurrentStatus((STATUSTYPE)3); List<(SFX_Instance, Vector3, bool, int)> source3 = Sounds.Where(((SFX_Instance sfx, Vector3 at, bool started, int seat) x) => Object.op_Implicit((Object)(object)x.sfx) && Vector3.Distance(x.at, ck2.Center) < 3f).ToList(); note($"player {k} alone in a poison cloud gets poisoned and hears it", currentStatus2 > dist + 0.05f && source3.Any<(SFX_Instance, Vector3, bool, int)>(((SFX_Instance sfx, Vector3 at, bool started, int seat) x) => x.started && (Object)(object)x.sfx == (Object)(object)ck2.refs.afflictions.injuryPoison), $"others {far:0} m away; poison {dist:0.00} -> {currentStatus2:0.00} in 5 s; sounds near player {k}: " + string.Join(", ", from x in source3 group x by ((Object)x.sfx).name into g select $"{g.Key} {g.Count(((SFX_Instance sfx, Vector3 at, bool started, int seat) x) => x.started)}/{g.Count()} started")); Clear(k, (STATUSTYPE)3); yield return (object)new WaitForSeconds(0.5f); } VenusFlyTrap trap = (from val15 in Object.FindObjectsByType<VenusFlyTrap>((FindObjectsSortMode)0) orderby Vector3.Distance(((Component)val15).transform.position, cs[1].Center) select val15).FirstOrDefault(); if (!Object.op_Implicit((Object)(object)trap)) { note("Venus flytrap", arg2: true, "no flytrap loaded on this part of the island (skipped)"); } for (int num4 = 1; num4 <= n; num4++) { if (!Object.op_Implicit((Object)(object)trap)) { break; } Character ck3 = cs[num4]; PhotonView tv = ((Component)trap).GetComponentInParent<PhotonView>() ?? ((Component)trap).GetComponentInChildren<PhotonView>(); float dist = Time.realtimeSinceStartup; while (Object.op_Implicit((Object)(object)trapVictimOf.Invoke(trap)) && Time.realtimeSinceStartup - dist < 10f) { yield return null; } yield return (object)new WaitForSeconds(6f); ((MonoBehaviourPun)ck3).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { ((Component)trap).transform.position + Vector3.up * 1.5f, false }); yield return (object)new WaitForSeconds(1f); float far = ck3.refs.afflictions.GetCurrentStatus((STATUSTYPE)3); Sounds.Clear(); listening = true; Ctx.Enter(num4); try { tv.RPC("RPC_BitePlayer", (RpcTarget)0, new object[1] { ((MonoBehaviourPun)ck3).photonView }); } finally { Ctx.Enter(1); } yield return (object)new WaitForSeconds(4.5f); listening = false; bool moving0 = (Object)(object)trapVictimOf.Invoke(trap) == (Object)(object)ck3; float look = ck3.refs.afflictions.GetCurrentStatus((STATUSTYPE)3); Clear(num4, (STATUSTYPE)14); yield return (object)new WaitForSeconds(1.5f); bool flag2 = (Object)(object)trapVictimOf.Invoke(trap) != (Object)(object)ck3; List<(SFX_Instance, Vector3, bool, int)> source4 = Sounds.Where(((SFX_Instance sfx, Vector3 at, bool started, int seat) x) => Object.op_Implicit((Object)(object)x.sfx) && Vector3.Distance(x.at, ck3.Center) < 4f).ToList(); note($"player {num4} in a flytrap gets poisoned, hears it and is let go", moving0 && look > far && source4.Any<(SFX_Instance, Vector3, bool, int)>(((SFX_Instance sfx, Vector3 at, bool started, int seat) x) => x.started && (Object)(object)x.sfx == (Object)(object)ck3.refs.afflictions.injuryPoison) && flag2, $"held {moving0}, poison {far:0.00} -> {look:0.00} in 4.5 s, let go after breaking free {flag2}; sounds near player {num4}: " + string.Join(", ", from x in source4 group x by ((Object)x.sfx).name into g select $"{g.Key} {g.Count(((SFX_Instance sfx, Vector3 at, bool started, int seat) x) => x.started)}/{g.Count()} started")); Clear(num4, (STATUSTYPE)3); } FieldRef<Bugfix, float> tickCounter = AccessTools.FieldRefAccess<Bugfix, float>("counter"); for (int num4 = 1; num4 <= n; num4++) { Character ck4 = cs[num4]; GameObject go = new GameObject("SplitScreen test tick"); go.SetActive(false); SphereCollider obj3 = go.AddComponent<SphereCollider>(); ((Collider)obj3).isTrigger = true; obj3.radius = 1.5f; go.AddComponent<TickTrigger>().tickChance = 1f; go.transform.position = ck4.Center; go.SetActive(true); float look = Time.realtimeSinceStartup; while (!Object.op_Implicit((Object)(object)TickOn(ck4)) && Time.realtimeSinceStartup - look < 3f) { yield return null; } if (Object.op_Implicit((Object)(object)go)) { Object.Destroy((Object)(object)go); } note($"player {num4} walks into a tick and it latches on", Object.op_Implicit((Object)(object)TickOn(ck4)), Object.op_Implicit((Object)(object)TickOn(ck4)) ? "tick on their leg" : "no tick latched on"); yield return TickBites(num4, "gets poisoned by their tick and hears it"); int num6 = num4 % n + 1; Ctx.Enter(num6); try { PhotonNetwork.Instantiate("BugfixOnYou", Vector3.zero, Quaternion.identity, (byte)0, (object[])null).GetComponent<Bugfix>().AttachBug(((MonoBehaviourPun)ck4).photonView.ViewID); } finally { Ctx.Enter(1); } yield return (object)new WaitForSeconds(1.5f); yield return TickBites(num4, $"gets poisoned by a tick player {num6} put on them"); } for (int num14 = 2; num14 <= n; num14++) { Vector3 val10 = cs[1].Center + Quaternion.Euler(0f, (float)num14 * 90f, 0f) * Vector3.forward * 1.8f; RaycastHit val11 = HelperFunctions.LineCheck(val10 + Vector3.up * 3f, val10 + Vector3.down * 6f, (LayerType)1, 0f, (QueryTriggerInteraction)1); ((MonoBehaviourPun)cs[num14]).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { Object.op_Implicit((Object)(object)((RaycastHit)(ref val11)).transform) ? (((RaycastHit)(ref val11)).point + Vector3.up * 1.1f) : val10, false }); } yield return (object)new WaitForSeconds(2f); Item massPrefab = ((IEnumerable<Item>)SingletonAsset<ItemDatabase>.Instance.itemLookup.Values).FirstOrDefault((Func<Item, bool>)delegate(Item i) { if (Object.op_Implicit((Object)(object)i)) { Action_ApplyMassAffliction componentInChildren = ((Component)i).GetComponentInChildren<Action_ApplyMassAffliction>(true); if (Object.op_Implicit((Object)(object)componentInChildren)) { return ((Action_ApplyAffliction)componentInChildren).affliction != null; } } return false; }); if (!Object.op_Implicit((Object)(object)massPrefab)) { note("mass-affliction item reaches everyone", arg2: false, "no such item in the item list"); } else { GameObject go2 = PhotonNetwork.InstantiateItemRoom(((Object)massPrefab).name, cs[2].Center + Vector3.up * 0.3f, Quaternion.identity, true); yield return (object)new WaitForSeconds(1f); Action_ApplyMassAffliction act = (Object.op_Implicit((Object)(object)go2) ? go2.GetComponentInChildren<Action_ApplyMassAffliction>(true) : null); if (Object.op_Implicit((Object)(object)act)) { AfflictionType type2 = ((Action_ApplyAffliction)act).affliction.GetAfflictionType(); bool[] had = (from num19 in Enumerable.Range(0, n + 1) select num19 > 0 && cs[num19].refs.afflictions.afflictionList.Any((Affliction x) => x.GetAfflictionType() == type2)).ToArray(); Ctx.Enter(2); try { ((ItemActionBase)act).RunAction(); } finally { Ctx.Enter(1); } bool[] got = (from num19 in Enumerable.Range(0, n + 1) select num19 > 0 && cs[num19].refs.afflictions.afflictionList.Any((Affliction x) => x.GetAfflictionType() == type2)).ToArray(); float num15 = (from num19 in Enumerable.Range(1, n) select ((IEnumerable<Affliction>)cs[num19].refs.afflictions.afflictionList).FirstOrDefault((Func<Affliction, bool>)((Affliction x) => x.GetAfflictionType() == type2)) into x where x != null select x.totalTime).DefaultIfEmpty(-1f).Max(); Debug.Log((object)string.Format("[SplitScreen] test mass affliction: {0} lasts {1} s; in lists right after: {2}; longest {3}", ((object)((Action_ApplyAffliction)act).affliction).GetType().Name, ((Action_ApplyAffliction)act).affliction.totalTime, string.Join(",", got.Skip(1)), num15)); yield return (object)new WaitForSeconds(0.5f); note("mass-affliction item reaches everyone", Enumerable.Range(1, n).All((int num19) => got[num19]), $"{((Object)massPrefab).name} ({type2}, radius {act.radius:0} m) used by player 2: " + string.Join(", ", from num19 in Enumerable.Range(1, n) select string.Format("player {0} {1} ({2:0.0} m)", num19, (!got[num19]) ? "NOT" : (had[num19] ? "had it" : "got it"), Vector3.Distance(cs[num19].Center, go2.transform.position)))); foreach (Character item in cs.Skip(1)) { item.refs.afflictions.afflictionList.RemoveAll((Affliction x) => x.GetAfflictionType() == type2); } } else { note("mass-affliction item reaches everyone", arg2: false, "the item didn't appear"); } if (Object.op_Implicit((Object)(object)go2)) { PhotonNetwork.Destroy(go2); } } yield return (object)new WaitForSeconds(1f); foreach (Character item2 in cs.Skip(1)) { item2.refs.afflictions.afflictionList.RemoveAll((Affliction x) => (int)x.GetAfflictionType() == 1); } Ctx.Enter(2); try { cs[2].refs.afflictions.AddAffliction((Affliction)new Affliction_RadiateInfiniteStam { radius = 8f, totalTime = 4f }, false); } finally { Ctx.Enter(1); } yield return (object)new WaitForSeconds(2f); bool[] got2 = (from num19 in Enumerable.Range(0, n + 1) select num19 > 0 && cs[num19].refs.afflictions.afflictionList.Any((Affliction x) => (int)x.GetAfflictionType() == 1)).ToArray(); note("infinite-stamina aura reaches everyone nearby", Enumerable.Range(1, n).All((int num19) => got2[num19]), "player 2 radiating (8 m): " + string.Join(", ", from num19 in Enumerable.Range(1, n) select string.Format("player {0} {1} ({2:0.0} m)", num19, got2[num19] ? "got it" : "NOT", Vector3.Distance(cs[num19].Center, cs[2].Center)))); yield return (object)new WaitForSeconds(3f); OrbThatMakesYouSleepy orb = (from val15 in Object.FindObjectsByType<OrbThatMakesYouSleepy>((FindObjectsSortMode)0) orderby Vector3.Distance(((Component)val15).transform.position, cs[1].Center) select val15).FirstOrDefault(); if (!Object.op_Implicit((Object)(object)orb)) { note("sleepy orb", arg2: true, "no napberry orb loaded on this part of the island (skipped)"); } else { Vector3 o = (Object.op_Implicit((Object)(object)orb.orb) ? orb.orb.position : ((Component)orb).transform.position); for (int num16 = 1; num16 <= n; num16++) { Vector3 val12 = o + Quaternion.Euler(0f, (float)num16 * 360f / (float)n, 0f) * Vector3.forward * 3f; ((MonoBehaviourPun)cs[num16]).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val12, false }); Clear(num16, (STATUSTYPE)6); } yield return (object)new WaitForSeconds(1.5f); bool moving0 = Object.op_Implicit((Object)(object)orb.fakeBerry) && ((Component)orb.fakeBerry).gameObject.activeInHierarchy; for (float look = 0f; look < 3f; look += Time.deltaTime) { for (int num17 = 1; num17 <= n; num17++) { Vector3 val13 = o - cs[num17].Center; cs[num17].data.lookValues = new Vector2(Mathf.Atan2(val13.x, val13.z) * 57.29578f, Mathf.Asin(Mathf.Clamp(((Vector3)(ref val13)).normalized.y, -1f, 1f)) * 57.29578f); } if (Time.frameCount % 10 == 0) { orb.Tick(); } yield return null; } float[] dz = (from num19 in Enumerable.Range(0, n + 1) select (num19 <= 0) ? 0f : cs[num19].refs.afflictions.GetCurrentStatus((STATUSTYPE)6)).ToArray(); note("sleepy orb makes everyone who looks at it drowsy", !moving0 || Enumerable.Range(1, n).All((int num19) => dz[num19] > 0f), (moving0 ? "" : "(the orb's berry is gone, so it's inactive) ") + string.Join(", ", from num19 in Enumerable.Range(1, n) select $"player {num19} drowsy {dz[num19]:0.000}")); for (int num18 = 1; num18 <= n; num18++) { Clear(num18, (STATUSTYPE)6); } } PerView.MeasureGhosts = true; int[] array5 = ((n < 3) ? new int[1] { 2 } : new int[2] { 2, 1 }); int[] array6 = array5; foreach (int v in array6) { ((MonoBehaviourPun)cs[v]).photonView.RPC("RPCA_Die", (RpcTarget)0, Array.Empty<object>()); yield return (object)new WaitForSeconds(4f); Array.Clear(PerView.GhostSeen, 0, PerView.GhostSeen.Length); yield return (object)new WaitForSeconds(1f); PlayerGhost val14 = ((IEnumerable<PlayerGhost>)Object.FindObjectsByType<PlayerGhost>((FindObjectsSortMode)0)).FirstOrDefault((Func<PlayerGhost, bool>)((PlayerGhost g) => (Object)(object)g.m_owner == (Object)(object)cs[v])); List<int> source5 = (from num19 in Enumerable.Range(1, n) where num19 != v && !cs[num19].data.dead select num19).ToList(); bool flag3 = Object.op_Implicit((Object)(object)val14) && source5.All((int num19) => PerView.GhostSeen[v, num19]); note($"player {v}'s ghost shows while they spectate", Object.op_Implicit((Object)(object)val14) && flag3 && !PerView.GhostSeen[v, v], Object.op_Implicit((Object)(object)val14) ? ("ghost watching " + (Object.op_Implicit((Object)(object)val14.m_target) ? ((Object)val14.m_target).name : "nobody") + "; seen by " + string.Join(", ", from num19 in Enumerable.Range(1, n) select string.Format("player {0}'s cam