Decompiled source of PeakVs v0.7.2
BepInEx/plugins/PeakVs/PeakVs.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Peak; using Peak.Afflictions; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; using Zorro.Core; using Zorro.Core.Serizalization; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PeakVs")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PeakVs")] [assembly: AssemblyTitle("PeakVs")] [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 PeakVs { internal static class GameMode { private static int _cachedFrame = int.MinValue; private static bool _cachedIsGameplayScene; private static bool _cachedLobbyCompatible; private static bool _cachedIsActive; private static float _nextPresencePublish; internal static bool IsGameplayScene { get { RefreshFrameCache(); return _cachedIsGameplayScene; } } internal static bool AllPlayersCompatible { get { RefreshFrameCache(); return _cachedLobbyCompatible; } } internal static bool IsActive { get { RefreshFrameCache(); return _cachedIsActive; } } internal static void TickPresence() { //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_007b: Expected O, but got Unknown //IL_0082: Expected O, but got Unknown object value; if (!PhotonNetwork.InRoom || PhotonNetwork.LocalPlayer == null) { _nextPresencePublish = 0f; } else if ((!((Dictionary<object, object>)(object)PhotonNetwork.LocalPlayer.CustomProperties).TryGetValue((object)"pvs.v", out value) || !(Convert.ToString(value) == "0.7.2")) && !(Time.unscaledTime < _nextPresencePublish)) { _nextPresencePublish = Time.unscaledTime + 2f; Player localPlayer = PhotonNetwork.LocalPlayer; Hashtable val = new Hashtable(); ((Dictionary<object, object>)val).Add((object)"pvs.v", (object)"0.7.2"); localPlayer.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); _cachedFrame = int.MinValue; } } internal static void ClearPresence() { //IL_0015: 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_0026: Expected O, but got Unknown //IL_002d: Expected O, but got Unknown try { if (PhotonNetwork.InRoom && PhotonNetwork.LocalPlayer != null) { Player localPlayer = PhotonNetwork.LocalPlayer; Hashtable val = new Hashtable(); ((Dictionary<object, object>)val).Add((object)"pvs.v", (object)null); localPlayer.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); _cachedFrame = int.MinValue; } } catch { } } private static void RefreshFrameCache() { int frameCount = Time.frameCount; if (_cachedFrame == frameCount) { return; } _cachedFrame = frameCount; try { _cachedIsGameplayScene = PhotonNetwork.InRoom && (Object)(object)Character.localCharacter != (Object)null && !Character.localCharacter.inAirport && MapHandler.Exists; _cachedLobbyCompatible = HasCompatiblePlayers(); _cachedIsActive = _cachedIsGameplayScene && _cachedLobbyCompatible; } catch { _cachedIsGameplayScene = false; _cachedLobbyCompatible = false; _cachedIsActive = false; } } private static bool HasCompatiblePlayers() { if (!PhotonNetwork.InRoom || PhotonNetwork.CurrentRoom == null) { return false; } int num = 0; foreach (Player value2 in PhotonNetwork.CurrentRoom.Players.Values) { if (value2 != null && !value2.IsInactive) { num++; if (!((Dictionary<object, object>)(object)value2.CustomProperties).TryGetValue((object)"pvs.v", out object value) || Convert.ToString(value) != "0.7.2") { return false; } } } return num > 0; } } internal sealed class PeakVsMenuWindow : MenuWindow { internal Selectable StartingSelection; public override bool openOnStart => false; public override bool selectOnOpen => true; public override Selectable objectToSelectOnOpen => StartingSelection; public override bool closeOnPause => true; public override bool closeOnUICancel => true; public override bool blocksPlayerInput => true; public override bool showCursorWhileOpen => true; public override bool autoHideOnClose => true; } internal static class HostMenu { private sealed class MenuRow { internal GameObject Root; internal Image Background; internal Button Button; internal TextMeshProUGUI Label; internal TextMeshProUGUI Value; } private static readonly MethodInfo OpenMethod = AccessTools.Method(typeof(MenuWindow), "Open", (Type[])null, (Type[])null); private static readonly MethodInfo CloseMethod = AccessTools.Method(typeof(MenuWindow), "Close", (Type[])null, (Type[])null); private static readonly MethodInfo StartClosedMethod = AccessTools.Method(typeof(MenuWindow), "StartClosed", (Type[])null, (Type[])null); private static Canvas _canvas; private static RectTransform _panel; private static PeakVsMenuWindow _window; private static TextMeshProUGUI _title; private static TextMeshProUGUI _subtitle; private static TextMeshProUGUI _hostHeading; private static TextMeshProUGUI _status; private static TextMeshProUGUI _hint; private static MenuRow _showHud; private static MenuRow _hudScale; private static MenuRow _rivalOpacity; private static MenuRow _menuHotkey; private static MenuRow _compactHotkey; private static MenuRow _autoAdvance; private static MenuRow _matchedLoot; private static MenuRow _restartSplit; private static MenuRow _forceCheckpoint; private static MenuRow _close; private static float _nextRefresh; private static int _lastFontRevision = -1; private static ConfigEntry<KeyCode> _captureTarget; private static MenuRow _captureRow; private static int _captureStartFrame; internal static void Initialize() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_04de: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_canvas != (Object)null)) { _canvas = PeakVsUi.CreateCanvas("PeakVs Menu Canvas", 32760, interactive: true); Image obj = PeakVsUi.CreateImage(((Component)_canvas).transform, "PeakVs Menu", new Color(0f, 0f, 0f, 0.48f)); ((Graphic)obj).raycastTarget = true; PeakVsUi.SetRect(((Graphic)obj).rectTransform, Vector2.zero, Vector2.one, new Vector2(0.5f, 0.5f), Vector2.zero, Vector2.zero); _window = ((Component)obj).gameObject.AddComponent<PeakVsMenuWindow>(); Image obj2 = PeakVsUi.CreateImage(((Component)obj).transform, "Panel", PeakVsUi.PanelColor); ((Graphic)obj2).raycastTarget = true; _panel = ((Graphic)obj2).rectTransform; PeakVsUi.SetRect(_panel, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(680f, 814f)); PeakVsUi.SetRect(((Graphic)PeakVsUi.CreateImage((Transform)(object)_panel, "Accent", PeakVsUi.AccentColor)).rectTransform, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), Vector2.zero, new Vector2(0f, 5f)); _title = PeakVsUi.CreateText((Transform)(object)_panel, "Title", 34f, (TextAlignmentOptions)4097, PeakVsUi.TextColor); ((TMP_Text)_title).fontStyle = (FontStyles)1; ((TMP_Text)_title).text = "PEAK VS"; Place(((TMP_Text)_title).rectTransform, -24f, 44f); _subtitle = PeakVsUi.CreateText((Transform)(object)_panel, "Role", 18f, (TextAlignmentOptions)4100, PeakVsUi.MutedColor); Place(((TMP_Text)_subtitle).rectTransform, -30f, 34f); TextMeshProUGUI obj3 = PeakVsUi.CreateText((Transform)(object)_panel, "Display Heading", 17f, (TextAlignmentOptions)4097, PeakVsUi.AccentColor); ((TMP_Text)obj3).text = "LOCAL DISPLAY"; Place(((TMP_Text)obj3).rectTransform, -82f, 28f); _showHud = CreateRow("Show Race HUD", -116f, ToggleHud); _hudScale = CreateRow("HUD Scale", -172f, CycleHudScale); _rivalOpacity = CreateRow("Rival Opacity", -228f, CycleRivalOpacity); _menuHotkey = CreateRow("Menu Hotkey", -284f, delegate { BeginKeyCapture(_menuHotkey, PeakVsPlugin.MenuToggleKey); }); _compactHotkey = CreateRow("Compact HUD Hotkey", -340f, delegate { BeginKeyCapture(_compactHotkey, PeakVsPlugin.CompactHudToggleKey); }); _hostHeading = PeakVsUi.CreateText((Transform)(object)_panel, "Host Heading", 17f, (TextAlignmentOptions)4097, PeakVsUi.WarmColor); ((TMP_Text)_hostHeading).text = "HOST RACE CONTROLS"; Place(((TMP_Text)_hostHeading).rectTransform, -404f, 28f); _autoAdvance = CreateRow("Auto Advance", -438f, ToggleAutoAdvance); _matchedLoot = CreateRow("Matched Luggage Loot", -494f, ToggleMatchedLoot); _restartSplit = CreateRow("Restart Current Split", -550f, RestartSplit, centered: true); _forceCheckpoint = CreateRow("Force Checkpoint", -606f, ForceCheckpoint, centered: true); _status = PeakVsUi.CreateText((Transform)(object)_panel, "Status", 17f, (TextAlignmentOptions)514, PeakVsUi.MutedColor); Place(((TMP_Text)_status).rectTransform, -672f, 30f); _close = CreateRow("CLOSE", -716f, Close, centered: true); ((TMP_Text)_close.Label).alignment = (TextAlignmentOptions)514; ((Graphic)_close.Label).color = PeakVsUi.AccentColor; _hint = PeakVsUi.CreateText((Transform)(object)_panel, "Hint", 14f, (TextAlignmentOptions)514, PeakVsUi.MutedColor); ((TMP_Text)_hint).text = ((object)PeakVsPlugin.MenuToggleKey.Value/*cast due to .constrained prefix*/).ToString().ToUpperInvariant() + " MENU / " + ((object)PeakVsPlugin.CompactHudToggleKey.Value/*cast due to .constrained prefix*/).ToString().ToUpperInvariant() + " COMPACT HUD / ESC CLOSE"; Place(((TMP_Text)_hint).rectTransform, -775f, 24f); _window.StartingSelection = (Selectable)(object)_showHud.Button; StartClosedMethod.Invoke(_window, null); Refresh(forceFont: true); } } internal static void Tick() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_canvas == (Object)null) { Initialize(); } if (((MenuWindow)_window).isOpen && _captureTarget != null) { CaptureHotkey(); return; } if (Input.GetKeyDown(PeakVsPlugin.MenuToggleKey.Value)) { if (((MenuWindow)_window).isOpen) { Close(); } else { Refresh(forceFont: true); OpenMethod.Invoke(_window, null); } } if (((MenuWindow)_window).isOpen && Time.unscaledTime >= _nextRefresh) { _nextRefresh = Time.unscaledTime + 0.5f; Refresh(forceFont: false); } } internal static void Dispose() { if ((Object)(object)_canvas != (Object)null) { Object.Destroy((Object)(object)((Component)_canvas).gameObject); } _canvas = null; _panel = null; _window = null; _lastFontRevision = -1; _captureTarget = null; _captureRow = null; } private static MenuRow CreateRow(string labelText, float y, Action action, bool centered = false) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) Image val = PeakVsUi.CreateImage((Transform)(object)_panel, labelText, PeakVsUi.RowColor); ((Graphic)val).raycastTarget = true; PeakVsUi.SetRect(((Graphic)val).rectTransform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, y), new Vector2(620f, 48f)); Button val2 = ((Component)val).gameObject.AddComponent<Button>(); ((Selectable)val2).targetGraphic = (Graphic)(object)val; ((Selectable)val2).transition = (Transition)1; ColorBlock colors = ((Selectable)val2).colors; ((ColorBlock)(ref colors)).normalColor = Color.white; ((ColorBlock)(ref colors)).highlightedColor = new Color(0.82f, 0.96f, 1f, 1f); ((ColorBlock)(ref colors)).selectedColor = new Color(0.72f, 0.94f, 1f, 1f); ((ColorBlock)(ref colors)).pressedColor = new Color(0.48f, 0.83f, 0.9f, 1f); ((ColorBlock)(ref colors)).disabledColor = new Color(0.34f, 0.38f, 0.4f, 0.65f); ((ColorBlock)(ref colors)).colorMultiplier = 1f; ((Selectable)val2).colors = colors; ((UnityEvent)val2.onClick).AddListener((UnityAction)delegate { action(); Refresh(forceFont: true); }); TextMeshProUGUI val3 = PeakVsUi.CreateText(((Component)val).transform, "Label", 20f, (TextAlignmentOptions)(centered ? 514 : 4097), PeakVsUi.TextColor); PeakVsUi.SetRect(((TMP_Text)val3).rectTransform, (Vector2)(centered ? Vector2.zero : new Vector2(0f, 0.5f)), (Vector2)(centered ? Vector2.one : new Vector2(0f, 0.5f)), centered ? new Vector2(0.5f, 0.5f) : new Vector2(0f, 0.5f), (Vector2)(centered ? Vector2.zero : new Vector2(20f, 0f)), (Vector2)(centered ? Vector2.zero : new Vector2(370f, 42f))); ((TMP_Text)val3).text = labelText; TextMeshProUGUI val4 = PeakVsUi.CreateText(((Component)val).transform, "Value", 20f, (TextAlignmentOptions)4100, PeakVsUi.AccentColor); PeakVsUi.SetRect(((TMP_Text)val4).rectTransform, new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(1f, 0.5f), new Vector2(-20f, 0f), new Vector2(260f, 0f)); ((Component)val4).gameObject.SetActive(!centered); return new MenuRow { Root = ((Component)val).gameObject, Background = val, Button = val2, Label = val3, Value = val4 }; } private static void Place(RectTransform rect, float y, float height) { //IL_000b: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) PeakVsUi.SetRect(rect, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, y), new Vector2(620f, height)); } private static void Refresh(bool forceFont) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0516: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Unknown result type (might be due to invalid IL or missing references) //IL_0539: Unknown result type (might be due to invalid IL or missing references) bool flag = PhotonNetwork.IsConnected && PhotonNetwork.IsMasterClient; ((TMP_Text)_subtitle).text = (flag ? "HOST" : (PhotonNetwork.IsConnected ? "RACER" : "NOT IN A LOBBY")); ((Graphic)_subtitle).color = (flag ? PeakVsUi.WarmColor : PeakVsUi.MutedColor); ((TMP_Text)_showHud.Value).text = (PeakVsPlugin.ShowRaceHud.Value ? "ON" : "OFF"); ((TMP_Text)_hudScale.Value).text = $"{PeakVsPlugin.HudScale.Value:0.0}×"; ((TMP_Text)_rivalOpacity.Value).text = $"{Mathf.RoundToInt(PeakVsPlugin.RemoteScoutOpacity.Value * 100f)}%"; ((TMP_Text)_menuHotkey.Value).text = ((_captureTarget == PeakVsPlugin.MenuToggleKey) ? "PRESS A KEY" : ((object)PeakVsPlugin.MenuToggleKey.Value/*cast due to .constrained prefix*/).ToString().ToUpperInvariant()); ((TMP_Text)_compactHotkey.Value).text = ((_captureTarget == PeakVsPlugin.CompactHudToggleKey) ? "PRESS A KEY" : ((object)PeakVsPlugin.CompactHudToggleKey.Value/*cast due to .constrained prefix*/).ToString().ToUpperInvariant()); ((TMP_Text)_autoAdvance.Value).text = (PeakVsPlugin.AutoLightCheckpoints.Value ? "ON" : "OFF"); ((TMP_Text)_matchedLoot.Value).text = (RaceSession.SameLuggageLoot ? "SAME" : "INDEPENDENT"); SetToggleStyle(_showHud, PeakVsPlugin.ShowRaceHud.Value); SetToggleStyle(_autoAdvance, PeakVsPlugin.AutoLightCheckpoints.Value); SetToggleStyle(_matchedLoot, RaceSession.SameLuggageLoot); ((Graphic)_hudScale.Background).color = new Color(0.12f, 0.18f, 0.22f, 0.96f); ((Graphic)_rivalOpacity.Background).color = new Color(0.12f, 0.18f, 0.22f, 0.96f); ((Graphic)_menuHotkey.Background).color = ((_captureRow == _menuHotkey) ? new Color(0.075f, 0.28f, 0.31f, 0.98f) : new Color(0.12f, 0.18f, 0.22f, 0.96f)); ((Graphic)_compactHotkey.Background).color = ((_captureRow == _compactHotkey) ? new Color(0.075f, 0.28f, 0.31f, 0.98f) : new Color(0.12f, 0.18f, 0.22f, 0.96f)); ((Graphic)_restartSplit.Background).color = new Color(0.18f, 0.13f, 0.08f, 0.96f); ((Graphic)_forceCheckpoint.Background).color = new Color(0.18f, 0.13f, 0.08f, 0.96f); ((Graphic)_close.Background).color = new Color(0.1f, 0.19f, 0.22f, 0.96f); ((Component)_hostHeading).gameObject.SetActive(flag); _autoAdvance.Root.SetActive(flag); _matchedLoot.Root.SetActive(flag); _restartSplit.Root.SetActive(flag); _forceCheckpoint.Root.SetActive(flag); bool isActive = GameMode.IsActive; ((Selectable)_restartSplit.Button).interactable = flag && isActive; ((Selectable)_forceCheckpoint.Button).interactable = flag && isActive && RaceSession.HasPendingCheckpoint(); if (PhotonNetwork.InRoom && !GameMode.AllPlayersCompatible) { ((Graphic)_status).color = PeakVsUi.DangerColor; ((TMP_Text)_status).text = "PEAKVS DISABLED / EVERY PLAYER NEEDS VERSION 0.7.2"; } else if (isActive && PhotonNetwork.CurrentRoom != null) { ((Graphic)_status).color = PeakVsUi.MutedColor; RaceSession.GetLobbyProgress(out var resolved, out var matching, out var total); ((TMP_Text)_status).text = $"CHECKPOINT {RaceSession.Stage} / {resolved} OF {matching} READY / {total} CONNECTED"; } else { ((Graphic)_status).color = PeakVsUi.MutedColor; ((TMP_Text)_status).text = "RACE CONTROLS BECOME AVAILABLE ON THE MOUNTAIN"; } float y = (flag ? (-672f) : (-406f)); float y2 = (flag ? (-716f) : (-450f)); float y3 = (flag ? (-775f) : (-509f)); Place(((TMP_Text)_status).rectTransform, y, 30f); SetRowY(_close, y2); Place(((TMP_Text)_hint).rectTransform, y3, 24f); _panel.sizeDelta = new Vector2(680f, flag ? 814f : 548f); ((TMP_Text)_hint).text = ((_captureTarget != null) ? "PRESS A KEY / ESC CANCEL" : (((object)PeakVsPlugin.MenuToggleKey.Value/*cast due to .constrained prefix*/).ToString().ToUpperInvariant() + " MENU / " + ((object)PeakVsPlugin.CompactHudToggleKey.Value/*cast due to .constrained prefix*/).ToString().ToUpperInvariant() + " COMPACT HUD / ESC CLOSE")); int fontRevision = PeakVsUi.FontRevision; if (forceFont || fontRevision != _lastFontRevision) { _lastFontRevision = fontRevision; ApplyFonts(); } } private static void SetRowY(MenuRow row, float y) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) row.Root.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, y); } private static void SetToggleStyle(MenuRow row, bool enabled) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_004b: Unknown result type (might be due to invalid IL or missing references) ((Graphic)row.Background).color = (enabled ? new Color(0.075f, 0.28f, 0.31f, 0.98f) : new Color(0.14f, 0.15f, 0.17f, 0.98f)); ((Graphic)row.Value).color = (enabled ? PeakVsUi.AccentColor : PeakVsUi.MutedColor); } private static void ApplyFonts() { TextMeshProUGUI[] componentsInChildren = ((Component)_canvas).GetComponentsInChildren<TextMeshProUGUI>(true); for (int i = 0; i < componentsInChildren.Length; i++) { PeakVsUi.ApplyFont((TMP_Text)(object)componentsInChildren[i]); } } private static void ToggleHud() { PeakVsPlugin.ShowRaceHud.Value = !PeakVsPlugin.ShowRaceHud.Value; } private static void CycleHudScale() { float num = Mathf.Round((PeakVsPlugin.HudScale.Value + 0.1f) * 10f) / 10f; PeakVsPlugin.HudScale.Value = ((num > 1.5f) ? 0.7f : num); } private static void CycleRivalOpacity() { float num = Mathf.Round((PeakVsPlugin.RemoteScoutOpacity.Value + 0.1f) * 10f) / 10f; PeakVsPlugin.RemoteScoutOpacity.Value = ((num > 0.9f) ? 0.2f : num); } private static void BeginKeyCapture(MenuRow row, ConfigEntry<KeyCode> target) { _captureRow = row; _captureTarget = target; _captureStartFrame = Time.frameCount; } private unsafe static void CaptureHotkey() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) if (Time.frameCount <= _captureStartFrame || !Input.anyKeyDown) { return; } if (Input.GetKeyDown((KeyCode)27)) { EndKeyCapture(); return; } Array values = Enum.GetValues(typeof(KeyCode)); for (int i = 0; i < values.Length; i++) { KeyCode val = (KeyCode)values.GetValue(i); if ((int)val != 0 && !((object)(*(KeyCode*)(&val))/*cast due to .constrained prefix*/).ToString().StartsWith("Mouse", StringComparison.Ordinal) && Input.GetKeyDown(val)) { ConfigEntry<KeyCode> val2 = ((_captureTarget == PeakVsPlugin.MenuToggleKey) ? PeakVsPlugin.CompactHudToggleKey : PeakVsPlugin.MenuToggleKey); KeyCode value = _captureTarget.Value; _captureTarget.Value = val; if (val2.Value == val) { val2.Value = value; } EndKeyCapture(); break; } } } private static void EndKeyCapture() { _captureTarget = null; _captureRow = null; Refresh(forceFont: true); } private static void ToggleAutoAdvance() { if (PhotonNetwork.IsMasterClient) { PeakVsPlugin.AutoLightCheckpoints.Value = !PeakVsPlugin.AutoLightCheckpoints.Value; } } private static void ToggleMatchedLoot() { if (PhotonNetwork.IsMasterClient) { RaceSession.HostSetMatchedLuggageLoot(!RaceSession.SameLuggageLoot); } } private static void RestartSplit() { RaceSession.HostRestartCurrentSplit(); } private static void ForceCheckpoint() { RaceSession.HostForceCheckpoint(); } private static void Close() { _captureTarget = null; _captureRow = null; if ((Object)(object)_window != (Object)null && ((MenuWindow)_window).isOpen) { CloseMethod.Invoke(_window, null); } } } internal static class PrivateNetworkContext { [ThreadStatic] internal static byte Group; [ThreadStatic] internal static int OwnerActor; internal static byte Resolve(object instance) { return Resolve(instance, 0); } private static byte Resolve(object instance, int depth) { if (instance == null || depth > 2) { return 0; } Component val = (Component)((instance is Component) ? instance : null); if ((Object)(object)val != (Object)null) { PhotonView componentInParent = val.GetComponentInParent<PhotonView>(); if ((Object)(object)componentInParent != (Object)null && PrivateLoot.IsPrivateGroup(componentInParent.Group)) { return componentInParent.Group; } Item componentInParent2 = val.GetComponentInParent<Item>(); if ((Object)(object)componentInParent2 != (Object)null && PrivateLoot.IsPrivate(componentInParent2)) { return ((MonoBehaviourPun)componentInParent2).photonView.Group; } return 0; } FieldInfo[] fields = instance.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); for (int i = 0; i < fields.Length; i++) { Type fieldType = fields[i].FieldType; if (typeof(Component).IsAssignableFrom(fieldType) || fieldType.Name.Contains("<")) { byte b = Resolve(fields[i].GetValue(instance), depth + 1); if (b != 0) { return b; } } } return 0; } internal static int ResolveOwner(object instance) { return ResolveOwner(instance, 0); } private static int ResolveOwner(object instance, int depth) { if (instance == null || depth > 2) { return 0; } Item val = (Item)((instance is Item) ? instance : null); if ((Object)(object)val != (Object)null) { return ResolveItemOwner(val); } Component val2 = (Component)((instance is Component) ? instance : null); if ((Object)(object)val2 != (Object)null) { Item componentInParent = val2.GetComponentInParent<Item>(); if ((Object)(object)componentInParent != (Object)null) { return ResolveItemOwner(componentInParent); } Character componentInParent2 = val2.GetComponentInParent<Character>(); if ((Object)(object)componentInParent2 != (Object)null && (Object)(object)((MonoBehaviourPun)componentInParent2).photonView != (Object)null) { return ((MonoBehaviourPun)componentInParent2).photonView.OwnerActorNr; } if (!PrivateLoot.TryGetRegisteredOwnedVisualActor(val2.GetComponentInParent<PhotonView>(), out var ownerActor)) { return 0; } return ownerActor; } FieldInfo[] fields = instance.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); for (int i = 0; i < fields.Length; i++) { Type fieldType = fields[i].FieldType; if (typeof(Component).IsAssignableFrom(fieldType) || fieldType.Name.Contains("<")) { int num = ResolveOwner(fields[i].GetValue(instance), depth + 1); if (num > 0) { return num; } } } return 0; } private static int ResolveItemOwner(Item item) { if ((Object)(object)item == (Object)null || (Object)(object)((MonoBehaviourPun)item).photonView == (Object)null) { return 0; } if (PrivateLoot.IsPrivate(item)) { Player localPlayer = PhotonNetwork.LocalPlayer; if (localPlayer == null) { return 0; } return localPlayer.ActorNumber; } if (PrivateLoot.TryGetRegisteredOwnedVisualActor(((MonoBehaviourPun)item).photonView, out var ownerActor)) { return ownerActor; } return 0; } } internal static class NetworkContextPatcher { private struct ContextState { internal byte Group; internal int OwnerActor; } private static readonly Dictionary<short, OpCode> OneByteOpCodes; private static readonly Dictionary<short, OpCode> TwoByteOpCodes; private static readonly MethodInfo EnterMethod; private static readonly MethodInfo ExitMethod; static NetworkContextPatcher() { OneByteOpCodes = new Dictionary<short, OpCode>(); TwoByteOpCodes = new Dictionary<short, OpCode>(); EnterMethod = AccessTools.Method(typeof(NetworkContextPatcher), "Enter", (Type[])null, (Type[])null); ExitMethod = AccessTools.Method(typeof(NetworkContextPatcher), "Exit", (Type[])null, (Type[])null); FieldInfo[] fields = typeof(OpCodes).GetFields(BindingFlags.Static | BindingFlags.Public); for (int i = 0; i < fields.Length; i++) { OpCode value = (OpCode)fields[i].GetValue(null); if (value.Size == 1) { OneByteOpCodes[value.Value] = value; } else { TwoByteOpCodes[(short)(value.Value & 0xFF)] = value; } } } internal static void Install(Harmony harmony) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_009a: Expected O, but got Unknown int num = 0; Type[] array; try { array = typeof(Item).Assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { array = Array.FindAll(ex.Types, (Type type) => type != null); } for (int num2 = 0; num2 < array.Length; num2++) { MethodInfo[] methods; try { methods = array[num2].GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } catch { continue; } foreach (MethodInfo methodInfo in methods) { if (!methodInfo.IsAbstract && CallsPhotonInstantiate(methodInfo)) { try { harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(EnterMethod), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(ExitMethod), (HarmonyMethod)null); num++; } catch (Exception ex2) { PeakVsPlugin.Log.LogWarning((object)$"Could not add item network context to {methodInfo}: {ex2.Message}"); } } } } PeakVsPlugin.Log.LogInfo((object)$"Installed private item context on {num} PEAK network-spawn call sites."); } private static void Enter(MethodBase __originalMethod, object __instance, out ContextState __state) { __state = new ContextState { Group = PrivateNetworkContext.Group, OwnerActor = PrivateNetworkContext.OwnerActor }; int num = PrivateNetworkContext.ResolveOwner(__instance); if (num > 0) { PrivateNetworkContext.OwnerActor = num; } if (ShouldBePublicVisual(__originalMethod, __instance)) { PrivateNetworkContext.Group = 0; return; } byte b = PrivateNetworkContext.Resolve(__instance); if (b != 0) { PrivateNetworkContext.Group = b; } } private static Exception Exit(Exception __exception, ContextState __state) { PrivateNetworkContext.Group = __state.Group; PrivateNetworkContext.OwnerActor = __state.OwnerActor; return __exception; } private static bool ShouldBePublicVisual(MethodBase method, object instance) { if (instance is BackpackVisuals) { return true; } if (method.DeclaringType == typeof(CharacterCarrying) && method.Name == "RPCA_StartCarry") { return true; } if (method.DeclaringType != typeof(CharacterItems)) { return false; } if (!(method.Name == "EquipSlot") && !(method.Name == "DropItemRpc") && !(method.Name == "DropItemFromSlotRPC") && !(method.Name == "HammerClimbingSpike")) { return method.Name == "RPC_SpawnItemInHandMaster"; } return true; } private static bool CallsPhotonInstantiate(MethodInfo method) { MethodBody methodBody; try { methodBody = method.GetMethodBody(); } catch { return false; } if (methodBody == null) { return false; } byte[] iLAsByteArray = methodBody.GetILAsByteArray(); int operandSize; for (int i = 0; i < iLAsByteArray.Length; i += operandSize) { byte b = iLAsByteArray[i++]; OpCode value; if (b == 254) { if (i >= iLAsByteArray.Length || !TwoByteOpCodes.TryGetValue(iLAsByteArray[i++], out value)) { return false; } } else if (!OneByteOpCodes.TryGetValue(b, out value)) { return false; } operandSize = GetOperandSize(value.OperandType, iLAsByteArray, i); if ((!(value == OpCodes.Call) && !(value == OpCodes.Callvirt)) || operandSize != 4) { continue; } int metadataToken = BitConverter.ToInt32(iLAsByteArray, i); try { MethodBase methodBase = method.Module.ResolveMethod(metadataToken, method.DeclaringType?.GetGenericArguments(), method.GetGenericArguments()); if (methodBase?.DeclaringType == typeof(PhotonNetwork) && methodBase.Name.StartsWith("Instantiate", StringComparison.Ordinal)) { return true; } } catch { } } return false; } private static int GetOperandSize(OperandType type, byte[] il, int position) { switch (type) { case OperandType.InlineNone: return 0; case OperandType.ShortInlineBrTarget: case OperandType.ShortInlineI: case OperandType.ShortInlineVar: return 1; case OperandType.InlineVar: return 2; case OperandType.InlineI8: case OperandType.InlineR: return 8; case OperandType.InlineSwitch: { int num = BitConverter.ToInt32(il, position); return 4 + num * 4; } default: return 4; } } } [HarmonyPatch] internal static class PhotonInstantiateGroupPatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(PhotonNetwork), "Instantiate", new Type[5] { typeof(string), typeof(Vector3), typeof(Quaternion), typeof(byte), typeof(object[]) }, (Type[])null); } private static void Prefix(ref byte group) { if (GameMode.IsActive && PrivateNetworkContext.Group != 0) { group = PrivateNetworkContext.Group; } } private static void Postfix(GameObject __result) { PrivateLoot.RegisterOwnedVisual(__result, PrivateNetworkContext.OwnerActor); } } [HarmonyPatch] internal static class PhotonRoomInstantiatePatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(PhotonNetwork), "InstantiateRoomObject", new Type[5] { typeof(string), typeof(Vector3), typeof(Quaternion), typeof(byte), typeof(object[]) }, (Type[])null); } private static bool Prefix(string prefabName, Vector3 position, Quaternion rotation, byte group, object[] data, ref GameObject __result) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (!GameMode.IsActive) { return true; } byte b = PrivateNetworkContext.Group; if (b == 0) { return true; } __result = PhotonNetwork.Instantiate(prefabName, position, rotation, b, data); return false; } private static void Postfix(GameObject __result) { PrivateLoot.RegisterOwnedVisual(__result, PrivateNetworkContext.OwnerActor); } } [HarmonyPatch] internal static class PhotonItemRoomInstantiatePatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(PhotonNetwork), "InstantiateItemRoom", new Type[3] { typeof(string), typeof(Vector3), typeof(Quaternion) }, (Type[])null); } private static bool Prefix(string prefabName, Vector3 position, Quaternion rotation, ref GameObject __result) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (!GameMode.IsActive) { return true; } byte b = PrivateNetworkContext.Group; if (b == 0) { return true; } __result = PhotonNetwork.Instantiate("0_Items/" + prefabName, position, rotation, b, (object[])null); return false; } private static void Postfix(GameObject __result) { PrivateLoot.RegisterOwnedVisual(__result, PrivateNetworkContext.OwnerActor); } } [HarmonyPatch(typeof(PhotonNetwork), "get_IsMasterClient")] internal static class PrivateItemAuthorityPatch { private static void Postfix(ref bool __result) { if (GameMode.IsActive && PrivateNetworkContext.Group != 0) { __result = true; } } } [HarmonyPatch(typeof(Luggage), "Interact_CastFinished")] internal static class LuggageInteractPatch { private static bool Prefix(Luggage __instance, Character interactor) { if (!GameMode.IsActive) { return true; } PrivateLoot.OpenLuggage(__instance, interactor); return false; } } [HarmonyPatch(typeof(Luggage), "OpenLuggageRPC")] internal static class LuggageRpcPatch { private static bool Prefix() { return !GameMode.IsActive; } } [HarmonyPatch(typeof(Luggage), "OnCharacterRegistered")] internal static class LuggageJoinSyncPatch { private static bool Prefix() { return !GameMode.IsActive; } } [HarmonyPatch(typeof(Luggage), "OpenImmediatelyNoNotify")] internal static class LuggageImmediateOpenPatch { private static bool Prefix() { return !GameMode.IsActive; } } [HarmonyPatch(typeof(RespawnChest), "SpawnItems")] internal static class RespawnChestSpawnPatch { private static bool Prefix(ref List<PhotonView> __result) { if (!GameMode.IsActive) { return true; } __result = new List<PhotonView>(); return false; } } [HarmonyPatch(typeof(LootData), "IsValidToSpawn")] internal static class MultiplayerLootFilterPatch { private static void Postfix(LootData __instance, ref bool __result) { if (GameMode.IsActive & __result) { __result = !PrivateLoot.IsForbidden(((Component)__instance).GetComponent<Item>()); } } } [HarmonyPatch(typeof(Item), "Awake")] internal static class SharedItemClonePatch { private static void Postfix(Item __instance) { PrivateLoot.QueueSharedItemClone(__instance); } } [HarmonyPatch(typeof(Item), "Start")] internal static class OwnedItemPresentationPatch { private static void Postfix(Item __instance) { RaceSession.ApplyItemIsolation(__instance); } } [HarmonyPatch] internal static class OwnedItemPresentationRefreshPatch { private static IEnumerable<MethodBase> TargetMethods() { yield return AccessTools.Method(typeof(Item), "SetState", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(Item), "SetItemInstanceDataRPC", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(Item), "HoverEnter", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(Item), "HoverExit", (Type[])null, (Type[])null); } private static void Postfix(Item __instance) { RaceSession.ReapplyOwnedItemPresentation(__instance); } } [HarmonyPatch] internal static class PrivateItemPickupPatch { private static IEnumerable<MethodBase> TargetMethods() { Type[] types; try { types = typeof(Item).Assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { types = Array.FindAll(ex.Types, (Type type2) => type2 != null); } foreach (Type type in types) { if (!(type == null) && !type.IsAbstract && typeof(Item).IsAssignableFrom(type)) { MethodInfo method = type.GetMethod("Interact", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(Character) }, null); if (method != null) { yield return method; } } } } private static bool Prefix(MethodBase __originalMethod, Item __instance, Character interactor) { if (!GameMode.IsActive) { return true; } if (PrivateLoot.IsRivalOwned(__instance)) { return false; } if (__originalMethod.DeclaringType != typeof(Item)) { return true; } return !PrivateLoot.RequestPickup(__instance, interactor); } } [HarmonyPatch] internal static class RivalItemInteractiblePatch { private static IEnumerable<MethodBase> TargetMethods() { Type[] types; try { types = typeof(Item).Assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { types = Array.FindAll(ex.Types, (Type type2) => type2 != null); } foreach (Type type in types) { if (!(type == null) && !type.IsAbstract && typeof(Item).IsAssignableFrom(type)) { MethodInfo method = type.GetMethod("IsInteractible", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(Character) }, null); if (method != null) { yield return method; } } } } private static void Postfix(Item __instance, ref bool __result) { if (__result && PrivateLoot.IsRivalOwned(__instance)) { __result = false; } } } [HarmonyPatch] internal static class RivalOwnedInteractibleAvailabilityPatch { private static IEnumerable<MethodBase> TargetMethods() { Type[] types; try { types = typeof(Item).Assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { types = Array.FindAll(ex.Types, (Type type2) => type2 != null); } string[] names = new string[2] { "IsInteractible", "IsConstantlyInteractable" }; foreach (Type type in types) { if (type == null || type.IsAbstract || !typeof(IInteractible).IsAssignableFrom(type)) { continue; } for (int nameIndex = 0; nameIndex < names.Length; nameIndex++) { MethodInfo method = type.GetMethod(names[nameIndex], BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(Character) }, null); if (method != null && method.ReturnType == typeof(bool)) { yield return method; } } } } private static bool Prefix(object __instance, Character interactor, ref bool __result) { if (PrivateLoot.CanUseOwnedVisual((Component)((__instance is Component) ? __instance : null), interactor)) { return true; } __result = false; return false; } } [HarmonyPatch] internal static class RivalOwnedInteractibleUsePatch { private static IEnumerable<MethodBase> TargetMethods() { Type[] types; try { types = typeof(Item).Assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { types = Array.FindAll(ex.Types, (Type type2) => type2 != null); } string[] names = new string[2] { "Interact", "Interact_CastFinished" }; foreach (Type type in types) { if (type == null || type.IsAbstract || !typeof(IInteractible).IsAssignableFrom(type)) { continue; } for (int nameIndex = 0; nameIndex < names.Length; nameIndex++) { MethodInfo method = type.GetMethod(names[nameIndex], BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(Character) }, null); if (method != null && method.ReturnType == typeof(void)) { yield return method; } } } } private static bool Prefix(object __instance, Character interactor) { return PrivateLoot.CanUseOwnedVisual((Component)((__instance is Component) ? __instance : null), interactor); } } [HarmonyPatch(typeof(ClimbHandle), "RPCA_Hang")] internal static class RivalPitonHangPatch { private static bool Prefix(ClimbHandle __instance, PhotonView view) { Character interactor = (((Object)(object)view != (Object)null) ? ((Component)view).GetComponent<Character>() : null); return PrivateLoot.CanUseOwnedVisual((Component)(object)__instance, interactor); } } [HarmonyPatch(typeof(Constructable), "CreatePrefabRPC")] internal static class OwnedConstructedPrefabPatch { private static bool Prefix(Constructable __instance, Vector3 position, Quaternion rotation) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (!GameMode.IsActive || (Object)(object)__instance == (Object)null || (Object)(object)__instance.constructedPrefab == (Object)null) { return true; } GameObject val = Object.Instantiate<GameObject>(__instance.constructedPrefab, position, rotation); PhotonView component = ((Component)__instance).GetComponent<PhotonView>(); if ((Object)(object)val != (Object)null && PrivateLoot.TryGetRegisteredOwnedVisualActor(component, out var ownerActor)) { PeakVsOwnedObject peakVsOwnedObject = val.AddComponent<PeakVsOwnedObject>(); peakVsOwnedObject.OwnerActor = ownerActor; RaceSession.ApplyOwnedObject((Component)(object)peakVsOwnedObject, ownerActor); } return false; } } [HarmonyPatch(typeof(BackpackOnBackVisuals), "IsInteractible")] internal static class RivalWornBackpackInteractiblePatch { private static bool Prefix(BackpackOnBackVisuals __instance, Character interactor, ref bool __result) { if (PrivateLoot.CanAccessBackpack(__instance.character, interactor)) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(BackpackOnBackVisuals), "IsConstantlyInteractable")] internal static class RivalWornBackpackHoldPatch { private static bool Prefix(BackpackOnBackVisuals __instance, Character interactor, ref bool __result) { if (PrivateLoot.CanAccessBackpack(__instance.character, interactor)) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(BackpackOnBackVisuals), "Interact_CastFinished")] internal static class RivalWornBackpackOpenPatch { private static bool Prefix(BackpackOnBackVisuals __instance, Character interactor) { return PrivateLoot.CanAccessBackpack(__instance.character, interactor); } } [HarmonyPatch(typeof(BackpackWheel), "Choose")] internal static class RivalBackpackWheelGuardPatch { private static bool Prefix(BackpackWheel __instance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return PrivateLoot.CanAccessBackpack(__instance.backpack, Character.localCharacter); } } [HarmonyPatch(typeof(BackpackWheel), "InitWheel")] internal static class RivalBackpackWheelOpenGuardPatch { private static bool Prefix(BackpackReference bp) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return PrivateLoot.CanAccessBackpack(bp, Character.localCharacter); } } [HarmonyPatch(typeof(GUIManager), "OpenBackpackWheel")] internal static class RivalBackpackGuiOpenGuardPatch { private static bool Prefix(BackpackReference backpackReference) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return PrivateLoot.CanAccessBackpack(backpackReference, Character.localCharacter); } } [HarmonyPatch(typeof(CharacterBackpackHandler), "StashInBackpack")] internal static class RivalBackpackStashGuardPatch { private static bool Prefix(CharacterBackpackHandler __instance, Character interactor) { return PrivateLoot.CanAccessBackpack(((Component)__instance).GetComponent<Character>(), interactor); } } [HarmonyPatch(typeof(CharacterBackpackHandler), "AddFuelToJetpack")] internal static class RivalBackpackFuelGuardPatch { private static bool Prefix(CharacterBackpackHandler __instance, Character interactor) { return PrivateLoot.CanAccessBackpack(((Component)__instance).GetComponent<Character>(), interactor); } } [HarmonyPatch(typeof(CharacterBackpackHandler), "RPCAddItemToCharacterBackpack")] internal static class EquippedBackpackAuthoritySyncPatch { private static bool Prefix(CharacterBackpackHandler __instance, PhotonView playerView) { if (!GameMode.IsActive) { return true; } Character component = ((Component)__instance).GetComponent<Character>(); object obj; if (!((Object)(object)playerView != (Object)null)) { obj = null; } else { Player component2 = ((Component)playerView).GetComponent<Player>(); obj = ((component2 != null) ? component2.character : null); } Character interactor = (Character)obj; return PrivateLoot.CanAccessBackpack(component, interactor); } private static void Postfix(CharacterBackpackHandler __instance, PhotonView playerView) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) if (!GameMode.IsActive || !PhotonNetwork.IsMasterClient || (Object)(object)playerView == (Object)null) { return; } Character component = ((Component)__instance).GetComponent<Character>(); Player component2 = ((Component)playerView).GetComponent<Player>(); Character interactor = ((component2 != null) ? component2.character : null); if (PrivateLoot.CanAccessBackpack(component, interactor)) { Player val = (((Object)(object)component != (Object)null) ? component.player : null); if (!((Object)(object)val == (Object)null)) { InventorySyncData val2 = default(InventorySyncData); ((InventorySyncData)(ref val2))..ctor(val.itemSlots, val.backpackSlot, val.tempFullSlot); ((MonoBehaviourPun)val).photonView.RPC("SyncInventoryRPC", (RpcTarget)1, new object[2] { IBinarySerializable.ToManagedArray<InventorySyncData>(val2), true }); } } } } [HarmonyPatch(typeof(Backpack), "RPCAddItemToBackpack")] internal static class BackpackItemAuthoritySyncPatch { private static void Postfix(Backpack __instance) { if (GameMode.IsActive && PhotonNetwork.IsMasterClient && (Object)(object)__instance != (Object)null && (Object)(object)((MonoBehaviourPun)__instance).photonView != (Object)null && ((Item)__instance).data != null) { ((MonoBehaviourPun)__instance).photonView.RPC("SetItemInstanceDataRPC", (RpcTarget)1, new object[1] { ((Item)__instance).data }); } } } [HarmonyPatch(typeof(BackpackVisuals), "RemoveVisuals")] internal static class BackpackVisualCleanupPatch { private static void Prefix(BackpackVisuals __instance) { if (!GameMode.IsActive || PhotonNetwork.IsMasterClient) { return; } foreach (Item value in __instance.spawnedVisualItems.Values) { if ((Object)(object)value != (Object)null) { ((Component)value).gameObject.SetActive(false); } } } private static void Postfix(BackpackVisuals __instance) { if (GameMode.IsActive) { __instance.spawnedVisualItems.Clear(); } } } [HarmonyPatch(typeof(ScoutmasterSpawner), "SpawnScoutmaster")] internal static class ScoutmasterSpawnerPatch { private static bool Prefix() { return !GameMode.IsActive; } } [HarmonyPatch(typeof(Scoutmaster), "SetCurrentTarget")] internal static class ScoutmasterTargetPatch { private static bool Prefix() { return !GameMode.IsActive; } } [HarmonyPatch(typeof(RunSettings), "GetValue", new Type[] { typeof(SETTINGTYPE), typeof(bool) })] internal static class ScoutmasterSettingPatch { private static void Postfix(SETTINGTYPE setting, ref int __result) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 if (GameMode.IsActive && (int)setting == 2700) { __result = 0; } } } [HarmonyPatch(typeof(Character), "CheckEndGame")] internal static class RaceDeathGameOverPatch { private static bool Prefix() { return !GameMode.IsActive; } } [HarmonyPatch(typeof(Character), "RPCA_Die")] internal static class RaceForfeitPatch { private static void Postfix(Character __instance) { if (GameMode.IsActive && __instance.IsLocal) { RaceSession.ReportForfeit(); } } } [HarmonyPatch(typeof(Campfire), "Light_Rpc")] internal static class RaceCheckpointPatch { private static void Postfix(Campfire __instance, bool updateSegment) { RaceSession.OnCampfireLit(__instance, updateSegment); } } [HarmonyPatch] internal static class RacerInteractionPatch { private static IEnumerable<MethodBase> TargetMethods() { yield return AccessTools.Method(typeof(CharacterInteractible), "IsInteractible", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(CharacterInteractible), "IsPrimaryInteractible", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(CharacterInteractible), "IsSecondaryInteractible", (Type[])null, (Type[])null); } private static bool Prefix(CharacterInteractible __instance, Character interactor, ref bool __result) { if (!GameMode.IsActive) { return true; } Character val = __instance.character ?? ((Component)__instance).GetComponent<Character>(); if ((Object)(object)interactor != (Object)null && interactor.IsLocal && (Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)interactor && !val.isBot) { __result = false; return false; } return true; } } [HarmonyPatch(typeof(CharacterGrabbing), "TargetCanBeHelped", new Type[] { typeof(Character), typeof(Character) })] internal static class RacerHelpingPatch { private static bool Prefix(Character target, Character helper, ref bool __result) { if (GameMode.IsActive && (Object)(object)target != (Object)null && (Object)(object)helper != (Object)null && (Object)(object)target != (Object)(object)helper && !target.isBot && !helper.isBot) { __result = false; return false; } return true; } } [HarmonyPatch(typeof(Character), "AddForceAtPosition")] internal static class RacerForceIsolationPatch { private static bool Prefix(Character __instance) { if (GameMode.IsActive && !__instance.IsLocal) { return __instance.isBot; } return true; } } [HarmonyPatch(typeof(Character), "Fall")] internal static class RacerFallIsolationPatch { private static bool Prefix(Character __instance) { if (GameMode.IsActive && !__instance.IsLocal) { return __instance.isBot; } return true; } } [HarmonyPatch(typeof(CharacterCarrying), "StartCarry")] internal static class RacerCarryIsolationPatch { private static bool Prefix(Character target) { if (GameMode.IsActive && !((Object)(object)target == (Object)null)) { return target.isBot; } return true; } } [HarmonyPatch(typeof(ScoutCannon), "FixedUpdate")] internal static class OwnedScoutCannonFieldPatch { private static bool Prefix(ScoutCannon __instance, PhotonView ___view, Transform ___tube, Transform ___entry, Character ___target) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Invalid comparison between Unknown and I4 //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Invalid comparison between Unknown and I4 //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Invalid comparison between Unknown and I4 //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Invalid comparison between Unknown and I4 //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Invalid comparison between Unknown and I4 //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Invalid comparison between Unknown and I4 //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) if (!GameMode.IsActive) { return true; } if (!PhotonNetwork.IsMasterClient || (Object)(object)___view == (Object)null || (Object)(object)___tube == (Object)null || (Object)(object)___entry == (Object)null || !PrivateLoot.TryGetRegisteredOwnedVisualActor(___view, out var ownerActor)) { return false; } Character val = null; List<Character> allPlayerCharacters = PlayerHandler.GetAllPlayerCharacters(); for (int i = 0; i < allPlayerCharacters.Count; i++) { Character val2 = allPlayerCharacters[i]; if ((Object)(object)val2 != (Object)null && (Object)(object)((MonoBehaviourPun)val2).photonView != (Object)null && ((MonoBehaviourPun)val2).photonView.OwnerActorNr == ownerActor) { val = val2; break; } } Character val3 = null; if ((Object)(object)val != (Object)null && Vector3.Distance(val.Center, ___entry.position) < 1f) { val3 = val; RaycastHit val7; if ((Object)(object)val == (Object)(object)___target) { if (val.data.sinceJump >= 0.5f) { List<Bodypart> partList = val.refs.ragdoll.partList; for (int j = 0; j < partList.Count; j++) { Bodypart val4 = partList[j]; BodypartType partType = val4.partType; if ((int)partType == 7 || (int)partType == 10 || (int)partType == 6 || (int)partType == 9 || (int)partType == 5 || (int)partType == 8) { continue; } Vector3 val5 = Vector3.Project(val4.transform.position - ___tube.position, ___tube.forward); Vector3 val6 = Vector3.ClampMagnitude(___tube.position + val5 - val4.transform.position, 1f); val4.Rig.AddForce(val6 * __instance.pullForce, (ForceMode)5); if (___entry.InverseTransformPoint(val4.transform.position).z < 0f) { val7 = HelperFunctions.LineCheck(___entry.position, val4.transform.position, (LayerType)3, 0f, (QueryTriggerInteraction)1); if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val7)).transform)) { val4.Rig.AddForce(___entry.forward * __instance.pullForce, (ForceMode)5); } } } } } else { val7 = HelperFunctions.LineCheck(___tube.position, val.Center, (LayerType)3, 0f, (QueryTriggerInteraction)1); if ((Object)(object)((RaycastHit)(ref val7)).transform == (Object)null) { Vector3 val8 = ___tube.position - val.Center; Vector3 val9 = -((Vector3)(ref val8)).normalized * __instance.pushForce; List<Bodypart> partList2 = val.refs.ragdoll.partList; for (int k = 0; k < partList2.Count; k++) { partList2[k].Rig.AddForce(val9, (ForceMode)5); } } } } if ((Object)(object)___target != (Object)(object)val3) { ___view.RPC("RPCA_SetTarget", (RpcTarget)0, new object[1] { ((Object)(object)val3 != (Object)null) ? val3.refs.view.ViewID : (-1) }); } return false; } } [HarmonyPatch(typeof(ScoutCannon), "RPCA_LaunchTarget")] internal static class OwnedScoutCannonLaunchPatch { private static bool Prefix(ScoutCannon __instance, int targetID) { if (!GameMode.IsActive) { return true; } PhotonView component = ((Component)__instance).GetComponent<PhotonView>(); PhotonView photonView = PhotonNetwork.GetPhotonView(targetID); if ((Object)(object)component != (Object)null && (Object)(object)photonView != (Object)null && PrivateLoot.TryGetRegisteredOwnedVisualActor(component, out var ownerActor)) { return photonView.OwnerActorNr == ownerActor; } return false; } } [HarmonyPatch(typeof(ScoutCannon), "RPCA_LaunchItem")] internal static class OwnedScoutCannonItemLaunchPatch { private static bool Prefix(ScoutCannon __instance, int targetID) { if (!GameMode.IsActive) { return true; } PhotonView component = ((Component)__instance).GetComponent<PhotonView>(); PhotonView photonView = PhotonNetwork.GetPhotonView(targetID); Item val = (((Object)(object)photonView != (Object)null) ? ((Component)photonView).GetComponent<Item>() : null); if ((Object)(object)component == (Object)null || (Object)(object)val == (Object)null || !PrivateLoot.TryGetRegisteredOwnedVisualActor(component, out var ownerActor)) { return false; } if (PrivateLoot.TryGetRegisteredOwnedVisualActor(photonView, out var ownerActor2)) { return ownerActor2 == ownerActor; } Player localPlayer = PhotonNetwork.LocalPlayer; int num = ((localPlayer != null) ? localPlayer.ActorNumber : 0); if (ownerActor == num) { return PrivateLoot.IsOwnedByLocal(val); } return false; } } [HarmonyPatch(typeof(UIPlayerNames), "CanCannibalize")] internal static class RivalChickenTargetPatch { private static bool Prefix(ref bool __result) { if (!GameMode.IsActive) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(CharacterCustomization), "BecomeChicken")] internal static class RivalChickenVisualPatch { private static bool Prefix() { return !GameMode.IsActive; } } [HarmonyPatch(typeof(RopeSegment), "Interact")] internal static class PrivateRopeGrabPatch { private static bool Prefix(RopeSegment __instance, Character interactor) { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) Rope rope = __instance.rope; if (!GameMode.IsActive || (Object)(object)rope == (Object)null || (Object)(object)((MonoBehaviourPun)rope).photonView == (Object)null) { return true; } Player localPlayer = PhotonNetwork.LocalPlayer; int num = ((localPlayer != null) ? localPlayer.ActorNumber : 0); if (!PrivateLoot.IsPrivateGroup(((MonoBehaviourPun)rope).photonView.Group)) { if (!PrivateLoot.TryGetRegisteredOwnedVisualActor(((MonoBehaviourPun)rope).photonView, out var ownerActor)) { return true; } int num2 = (((Object)(object)interactor != (Object)null && (Object)(object)((MonoBehaviourPun)interactor).photonView != (Object)null) ? ((MonoBehaviourPun)interactor).photonView.OwnerActorNr : num); if (num2 > 0) { return ownerActor == num2; } return true; } if ((Object)(object)interactor != (Object)null && interactor.IsLocal && interactor.refs.ropeHandling.canInteractWithRope) { interactor.refs.items.EquipSlot(Optionable<byte>.None); int num3 = ((Component)__instance).transform.GetSiblingIndex() - 2; interactor.refs.ropeHandling.GrabRopeRpc(((MonoBehaviourPun)rope).photonView, num3); } return false; } } [HarmonyPatch(typeof(RopeSegment), "IsInteractible")] internal static class RivalRopePromptPatch { private static bool Prefix(RopeSegment __instance, ref bool __result) { Rope rope = __instance.rope; if (!GameMode.IsActive || (Object)(object)rope == (Object)null || (Object)(object)((MonoBehaviourPun)rope).photonView == (Object)null) { return true; } if (!PrivateLoot.TryGetRegisteredOwnedVisualActor(((MonoBehaviourPun)rope).photonView, out var ownerActor)) { return true; } Player localPlayer = PhotonNetwork.LocalPlayer; int num = ((localPlayer != null) ? localPlayer.ActorNumber : 0); if (ownerActor <= 0 || ownerActor == num) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(CharacterRopeHandling), "GrabRopeRpc")] internal static class MissingPrivateRopeGuardPatch { private static bool Prefix(PhotonView ropeView) { if (GameMode.IsActive) { return (Object)(object)ropeView != (Object)null; } return true; } } [HarmonyPatch(typeof(Item), "CanUseSecondary")] internal static class FriendItemUsePatch { private static void Postfix(Item __instance, ref bool __result) { if (GameMode.IsActive && __instance.canUseOnFriend && __instance.mustUseOnFriend) { __result = false; } } } [HarmonyPatch(typeof(Action_ApplyMassAffliction), "RunAction")] internal static class MassItemIsolationPatch { private static bool Prefix(Action_ApplyMassAffliction __instance) { Item component = ((Component)__instance).GetComponent<Item>(); if (!GameMode.IsActive) { return true; } if (!PrivateLoot.IsOwnedByLocal(component)) { return false; } __instance.TryAddAfflictionToLocalCharacter(true); return false; } } [HarmonyPatch(typeof(RespawnRandomScout), "Start")] internal static class MultiplayerReviveItemPatch { private static bool Prefix() { return !GameMode.IsActive; } } [HarmonyPatch(typeof(RescueHook), "RPCA_RescueCharacter")] internal static class RivalRescueClawPatch { private static bool Prefix(RescueHook __instance, PhotonView characterView) { if (!GameMode.IsActive || (Object)(object)characterView == (Object)null) { return true; } int logicalOwnerActor = PrivateLoot.GetLogicalOwnerActor(((Component)__instance).GetComponent<Item>()); if (logicalOwnerActor > 0) { return characterView.OwnerActorNr == logicalOwnerActor; } return true; } } [HarmonyPatch(typeof(GloomSafeZone), "set_isLit")] internal static class RivalLanternSafeZonePatch { private static void Prefix(GloomSafeZone __instance, ref bool value) { if (value && GameMode.IsActive && PrivateLoot.IsRivalOwned(((Component)__instance).GetComponentInParent<Item>())) { value = false; } } } [HarmonyPatch(typeof(Mandrake), "Update")] internal static class RivalMandrakeEffectPatch { private static void Postfix(Mandrake __instance) { if (GameMode.IsActive && PrivateLoot.IsRivalOwned(__instance.item) && (Object)(object)__instance.timeEvent != (Object)null) { ((Behaviour)__instance.timeEvent).enabled = false; } } } [HarmonyPatch(typeof(RitualDaggerFeedBehavior), "RPC_RitualDaggerBuff")] internal static class RivalRitualDaggerBuffPatch { private static bool Prefix(RitualDaggerFeedBehavior __instance) { if (!GameMode.IsActive) { return true; } int logicalOwnerActor = PrivateLoot.GetLogicalOwnerActor(((Component)__instance).GetComponent<Item>()); Player localPlayer = PhotonNetwork.LocalPlayer; int num = ((localPlayer != null) ? localPlayer.ActorNumber : 0); if (logicalOwnerActor > 0) { return logicalOwnerActor == num; } return true; } } [HarmonyPatch(typeof(ScoutEffigy), "FinishConstruction")] internal static class RaceScoutEffigyUsePatch { private static bool Prefix(ref GameObject __result) { if (!GameMode.IsActive) { return true; } __result = null; return false; } } [HarmonyPatch(typeof(Dynamite), "TestLightWick")] internal static class RivalDynamiteIgnitionPatch { private static bool Prefix(Dynamite __instance) { //IL_005b: 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) if (!GameMode.IsActive || !PhotonNetwork.IsMasterClient) { return !GameMode.IsActive; } int logicalOwnerActor = PrivateLoot.GetLogicalOwnerActor(((Component)__instance).GetComponent<Item>()); List<Character> allPlayerCharacters = PlayerHandler.GetAllPlayerCharacters(); for (int i = 0; i < allPlayerCharacters.Count; i++) { Character val = allPlayerCharacters[i]; if ((Object)(object)val != (Object)null && (Object)(object)((MonoBehaviourPun)val).photonView != (Object)null && ((MonoBehaviourPun)val).photonView.OwnerActorNr == logicalOwnerActor && Vector3.Distance(val.Center, ((Component)__instance).transform.position) < __instance.lightFuseRadius) { __instance.LightFlare(); break; } } return false; } } internal sealed class PeakVsOwnedEffect : MonoBehaviour { internal int OwnerActor; } [HarmonyPatch(typeof(Dynamite), "RPC_Explode")] internal static class DynamiteEffectOwnershipPatch { private static void Prefix(out HashSet<int> __state) { if (!GameMode.IsActive) { __state = null; return; } __state = new HashSet<int>(); AOE[] array = Object.FindObjectsByType<AOE>((FindObjectsInactive)1, (FindObjectsSortMode)0); for (int i = 0; i < array.Length; i++) { __state.Add(((Object)array[i]).GetInstanceID()); } } private static void Postfix(Dynamite __instance, HashSet<int> __state) { if (!GameMode.IsActive) { return; } int logicalOwnerActor = PrivateLoot.GetLogicalOwnerActor(((Component)__instance).GetComponent<Item>()); AOE[] array = Object.FindObjectsByType<AOE>((FindObjectsInactive)1, (FindObjectsSortMode)0); for (int i = 0; i < array.Length; i++) { if (!__state.Contains(((Object)array[i]).GetInstanceID())) { ((Component)array[i]).gameObject.AddComponent<PeakVsOwnedEffect>().OwnerActor = logicalOwnerActor; } } } } [HarmonyPatch(typeof(AOE), "Explode")] internal static class OwnedAreaEffectPatch { private static bool Prefix(AOE __instance, out List<Collider> __state) { __state = null; if (!GameMode.IsActive) { return true; } PeakVsOwnedEffect component = ((Component)__instance).GetComponent<PeakVsOwnedEffect>(); if ((Object)(object)component == (Object)null || component.OwnerActor <= 0) { return true; } Player localPlayer = PhotonNetwork.LocalPlayer; int num = ((localPlayer != null) ? localPlayer.ActorNumber : 0); if (component.OwnerActor != num) { return false; } __state = new List<Collider>(); List<Character> allPlayerCharacters = PlayerHandler.GetAllPlayerCharacters(); for (int i = 0; i < allPlayerCharacters.Count; i++) { Character val = allPlayerCharacters[i]; if ((Object)(object)val == (Object)null || (Object)(object)((MonoBehaviourPun)val).photonView == (Object)null || ((MonoBehaviourPun)val).photonView.OwnerActorNr == component.OwnerActor) { continue; } Collider[] componentsInChildren = ((Component)val).GetComponentsInChildren<Collider>(true); for (int j = 0; j < componentsInChildren.Length; j++) { if ((Object)(object)componentsInChildren[j] != (Object)null && componentsInChildren[j].enabled) { componentsInChildren[j].enabled = false; __state.Add(componentsInChildren[j]); } } } return true; } private static Exception Finalizer(Exception __exception, List<Collider> __state) { if (__state != null) { for (int i = 0; i < __state.Count; i++) { if ((Object)(object)__state[i] != (Object)null) { __state[i].enabled = true; } } } return __exception; } } [BepInPlugin("dev.peakvs.racemode", "PeakVs", "0.7.2")] [BepInProcess("PEAK.exe")] public sealed class PeakVsPlugin : BaseUnityPlugin, IOnEventCallback { public const string PluginGuid = "dev.peakvs.racemode"; public const string PluginName = "PeakVs"; public const string PluginVersion = "0.7.2"; private Harmony _harmony; internal static PeakVsPlugin Instance { get; private set; } internal static ManualLogSource Log { get; private set; } internal static ConfigEntry<float> RemoteScoutOpacity { get; private set; } internal static ConfigEntry<bool> ShowRaceHud { get; private set; } internal static ConfigEntry<float> HudScale { get; private set; } internal static ConfigEntry<KeyCode> MenuToggleKey { get; private set; } internal static ConfigEntry<KeyCode> CompactHudToggleKey { get; private set; } internal static ConfigEntry<bool> CompactRaceHud { get; private set; } internal static ConfigEntry<bool> AutoLightCheckpoints { get; private set; } internal static ConfigEntry<bool> MatchedLuggageLoot { get; private set; } private void Awake() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; RemoteScoutOpacity = ((BaseUnityPlugin)this).Config.Bind<float>("Visuals", "RemoteScoutOpacity", 0.45f, "Opacity used for the other racers (0.15 to 0.9)."); ShowRaceHud = ((BaseUnityPlugin)this).Config.Bind<bool>("HUD", "ShowRaceHud", true, "Show the synchronized biome timer and racer results."); HudScale = ((BaseUnityPlugin)this).Config.Bind<float>("HUD", "HudScale", 1f, new ConfigDescription("Scale of the race timer and standings.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.7f, 1.5f), Array.Empty<object>())); MenuToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("HUD", "MenuToggleKey", (KeyCode)287, "Key used to open the PeakVs menu."); CompactHudToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("HUD", "CompactHudToggleKey", (KeyCode)288, "Key used to toggle between full standings and the compact personal split timer."); CompactRaceHud = ((BaseUnityPlugin)this).Config.Bind<bool>("HUD", "CompactRaceHud", false, "Show only your own live or completed split time."); AutoLightCheckpoints = ((BaseUnityPlugin)this).Config.Bind<bool>("Race", "AutoLightCheckpoints", true, "Automatically light a campfire when every racer has finished or forfeited the biome."); MatchedLuggageLoot = ((BaseUnityPlugin)this).Config.Bind<bool>("Race", "MatchedLuggageLoot", true, "Host setting: give every racer the same deterministic item roll from each luggage container."); RaceSession.Initialize(); _harmony = new Harmony("dev.peakvs.racemode"); _harmony.PatchAll(typeof(PeakVsPlugin).Assembly); NetworkContextPatcher.Install(_harmony); RaceHud.Initialize(); HostMenu.Initialize(); PhotonNetwork.AddCallbackTarget((object)this); SceneManager.sceneLoaded += OnSceneLoaded; Log.LogInfo((object)("PeakVs 0.7.2 loaded for PEAK " + Application.version + ".")); } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoaded; PhotonNetwork.RemoveCallbackTarget((object)this); GameMode.ClearPresence(); HostMenu.Dispose(); RaceHud.Dispose(); Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private static void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) RaceSession.ResetForScene(SceneHandle.op_Implicit(((Scene)(ref scene)).handle)); PrivateLoot.ResetForScene(); PeakVsUi.OnSceneLoaded(); } private void Update() { GameMode.TickPresence(); RaceSession.Tick(); PrivateLoot.Tick(); RaceHud.Tick(); HostMenu.Tick(); } public void OnEvent(EventData photonEvent) { PrivateLoot.OnPhotonEvent(photonEvent); } } internal static class PeakVsUi { internal static readonly Color PanelColor = new Color(0.025f, 0.045f, 0.065f, 0.94f); internal static readonly Color RowColor = new Color(0.075f, 0.11f, 0.14f, 0.86f); internal static readonly Color TextColor = new Color(0.92f, 0.96f, 0.98f, 1f); internal static readonly Color MutedColor = new Color(0.58f, 0.68f, 0.72f, 1f); internal static readonly Color AccentColor = new Color(0.16f, 0.85f, 0.94f, 1f); internal static readonly Color WarmColor = new Color(1f, 0.57f, 0.16f, 1f); internal static readonly Color DangerColor = new Color(1f, 0.35f, 0.28f, 1f); private static TMP_FontAsset _gameFont; private static TMP_FontAsset _fallbackFont; private static float _nextFontSearch; private static float _nextResourceFontSearch; private static int _fontRevision; internal static int FontRevision { get { GetFont(); return _fontRevision; } } internal static Canvas CreateCanvas(string name, int sortingOrder, bool interactive) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); int num = LayerMask.NameToLayer("UI"); if (num >= 0) { val.layer = num; } Canvas obj = val.AddComponent<Canvas>(); obj.renderMode = (RenderMode)0; obj.sortingOrder = sortingOrder; CanvasScaler obj2 = val.AddComponent<CanvasScaler>(); obj2.uiScaleMode = (ScaleMode)1; obj2.referenceResolution = new Vector2(1920f, 1080f); obj2.screenMatchMode = (ScreenMatchMode)0; obj2.matchWidthOrHeight = 0.5f; if (interactive) { val.AddComponent<GraphicRaycaster>(); } Object.DontDestroyOnLoad((Object)(object)val); return obj; } internal static Image CreateImage(Transform parent, string name, Color color) { //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_002c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); Image obj = val.AddComponent<Image>(); ((Graphic)obj).color = color; ((Graphic)obj).raycastTarget = false; return obj; } internal static TextMeshProUGUI CreateText(Transform parent, string name, float size, TextAlignmentOptions alignment, Color color) { //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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); TextMeshProUGUI obj = val.AddComponent<TextMeshProUGUI>(); ((TMP_Text)obj).font = GetFont(); ((TMP_Text)obj).fontSize = size; ((TMP_Text)obj).alignment = alignment; ((Graphic)obj).color = color; ((Graphic)obj).raycastTarget = false; ((TMP_Text)obj).richText = false; ((TMP_Text)obj).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)obj).overflowMode = (TextOverflowModes)1; return obj; } internal static void ApplyFont(TMP_Text text) { TMP_FontAsset font = GetFont(); if ((Object)(object)text != (Object)null && (Object)(object)font != (Object)null && (Object)(object)text.font != (Object)(object)font) { text.font = font; } } internal static void SetRect(RectTransform rect, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, Vector2 position, Vector2 size) { //IL_0001: 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) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) rect.anchorMin = anchorMin; rect.anchorMax = anchorMax; rect.pivot = pivot; rect.anchoredPosition = position; rect.sizeDelta = size; } internal static void OnSceneLoaded() { _nextFontSearch = 0f; } private static TMP_FontAsset GetFont() { if ((Object)(object)_gameFont != (Object)null) { return _gameFont; } if (Time.unscaledTime >= _nextFontSearch) { _nextFontSearch = Time.unscaledTime + 3f; TryFindGameFont(); } if ((Object)(object)_gameFont != (Object)null) { return _gameFont; } if ((Object)(object)_fallbackFont == (Object)null) { try { _fallbackFont = Resources.Load<TMP_FontAsset>("Fonts & Materials/LiberationSans SDF"); } catch { } } return _fallbackFont; } private static void TryFindGameFont() { try { if ((Object)(object)GUIManager.instance != (Object)null && (Object)(object)GUIManager.instance.heroText != (Object)null && (Object)(object)((TMP_Text)GUIManager.instance.heroText).font != (Object)null) { _gameFont = ((TMP_Text)GUIManager.instance.heroText).font; _fontRevision++; return; } } catch { } if (Time.unscaledTime < _nextResourceFontSearch) { return; } _nextResourceFontSearch = Time.unscaledTime + 15f; TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>(); foreach (TMP_FontAsset val in array) { if ((Object)(object)val != (Object)null && ((Object)val).name.IndexOf("Daruma", StringComparison.OrdinalIgnoreCase) >= 0) { _gameFont = val; _fontRevision++; break; } } } } internal static class PrivateLoot { private sealed class PendingPickup { internal Item Item; internal float StartedAt; } private sealed class PendingSharedClone { internal Item Item; internal int InstanceId; internal float QueuedAt; } private const byte PickupRequestEvent = 176; private const byte PickupResponseEvent = 177; private const byte OwnedVisualEvent = 178; private const int PrivateGroupBase = 128; private static readonly Dictionary<int, PendingPickup> PendingPickups = new Dictionary<int, PendingPickup>(); private static readonly List<int> ScratchIds = new List<int>(); private static readonly HashSet<int> QueuedSharedItems = new HashSet<int>(); private static readonly Queue<PendingSharedClone> PendingSharedClones = new Queue<PendingSharedClone>(); private static readonly Dictionary<int, int> OwnedVisualActors = new Dictionary<int, int>(); private static readonly Dictionary<int, float> PendingOwnedVisualViews = new Dictionary<int, float>(); private static readonly HashSet<int> DynamicOwnedVisualViews = new HashSet<int>(); private static readonly HashSet<int> AnnouncedOwnedViews = new HashSet<int>(); private static readonly FieldInfo LuggageStateField = AccessTools.Field(typeof(Luggage), "state"); private static readonly MethodInfo GetSpawnSpotsMethod = AccessTools.Method(typeof(Spawner), "GetSpawnSpots", (Type[])null, (Type[])null); private static readonly MethodInfo GetObjectsToSpawnMethod = AccessTools.Method(typeof(Spawner), "GetObjectsToSpawn", (Type[])null, (Type[])null); private static readonly MethodInfo OffsetSpawnMethod = AccessTools.Method(typeof(Spawner), "OffsetSpawn", (Type[])null, (Type[])null); private static readonly MethodInfo ForceSyncMethod = AccessTools.Method(typeof(Item), "ForceSyncForFrames", (Type[])null, (Type[])null); private static readonly FieldInfo UtilRandomField = AccessTools.Field(typeof(Util), "r"); private static int _groupActorNumber = -1; private static float _nextSharedCloneTick; private static float _nextOwnedVisualTick; private static float _nextDynamicVisualTick; internal static byte LocalGroup { get { Player localPlayer = PhotonNetwork.LocalPlayer; int num = ((localPlayer == null) ? 1 : localPlayer.ActorNumber); if (num > 127) { num = (num - 1) % 127 + 1; } return (byte)(128 + num); } } internal static bool IsPrivateGroup(byte group) { return group > 128; } internal static bool IsPrivate(Item item) { if ((Object)(object)item != (Object)null && (Object)(object)((MonoBehaviourPun)item).photonView != (Object)null) { return IsPrivateGroup(((MonoBehaviourPun)item).photonView.Group); } return false; } internal static int GetLogicalOwnerActor(Item item) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)item == (Object)null || (Object)(object)((MonoBehaviourPun)item).photonView == (Object)null) { return 0; } try { if ((int)item.itemState == 2 && item.backpackReference.IsSome) { BackpackReference item2 = item.backpackReference.Value.Item2; if ((Object)(object)item2.view != (Object)null) { return GetLogicalOwnerActor(item2.view); } } } catch { } return GetLogicalOwnerActor(((MonoBehaviourPun)item).photonView); } internal static int GetLogicalOwnerActor(PhotonView view) { if ((Object)(object)view == (Object)null) { return 0; } if (OwnedVisualActors.TryGetValue(view.ViewID, out var value)) { return value; } return view.OwnerActorNr; } internal static bool TryGetRegisteredOwnedVisualActor(PhotonView view, out int ownerActor) { ownerActor = 0; if ((Object)(object)view != (Object)null && view.ViewID > 0 && OwnedVisualActors.TryGetValue(view.ViewID, out ownerActor)) { return ownerActor > 0; } return false; } internal static void RegisterOwnedVisual(GameObject spawnedObject, int ownerActor) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00be: Expected O, but got Unknown if (!GameMode.IsActive || (Object)(object)spawnedObject == (Object)null || ownerActor <= 0) { return; } PhotonView component = spawnedObject.GetComponent<PhotonView>(); if (!((Object)(object)component == (Object)null) && component.ViewID > 0 && component.Group == 0) { OwnedVisualActors[component.ViewID] = ownerActor; PendingOwnedVisualViews.Remove(component.ViewID); TrackDynamicOwnedVisual(component); RaceSession.ApplyOwnedVisual(component); if (PhotonNetwork.InRoom && AnnouncedOwnedViews.Add(component.ViewID)) { PhotonNetwork.RaiseEvent((byte)178, (object)new object[2] { component.ViewID, ownerActor }, new RaiseEventOptions { Receivers = (ReceiverGroup)1, CachingOption = (EventCaching)4 }, SendOptions.SendReliable); } } } internal static void UnregisterOwnedVisual(int viewId, int ownerActor) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown if (viewId > 0) { if (OwnedVisualActors.TryGetValue(viewId, out var value) && value == ownerActor) { OwnedVisualActors.Remove(viewId); } PendingOwnedVisualViews.Remove(viewId); DynamicOwnedVisualViews.Remove(viewId); if (AnnouncedOwnedViews.Remove(viewId) && PhotonNetwork.InRoom) { PhotonNetwork.RaiseEvent((byte)178, (object)new object[2] { viewId, ownerActor }, new RaiseEventOptions { CachingOption = (EventCaching)6 }, SendOptions.SendReliable); } } } internal static bool IsOwnedByLocal(Item item) { if ((Object)(object)item == (Object)null || PhotonNetwork.LocalPlayer == null) { return false; } if (IsPrivate(item)) { return ((MonoBehaviourPun)item).photonView.Group == LocalGroup; } if (TryGetRegisteredOwnedVisualActor(((MonoBehaviourPun)item).photonView, out var ownerActor)) { return ownerActor == PhotonNetwork.LocalPlayer.ActorNumber; } return false; } internal static bool IsRivalOwned(Item item) { if (GameMode.IsActive && (Object)(object)item != (Object)null && !IsPrivate(item) && PhotonNetwork.LocalPlayer != null && TryGetRegisteredOwnedVisualActor(((MonoBehaviourPun)item).photonView, out var ownerActor)) { return ownerActor != PhotonNetwork.LocalPlayer.ActorNumber; } return false; } internal static bool CanUseOwnedVisual(Component component, Character interactor) { if (!GameMode.IsActive || (Object)(object)component == (Object)null) { return true; } int ownerActor = 0; if (!TryGetRegisteredOwnedVisualActor(component.GetComponentInParent<PhotonView>(), out ownerActor)) { PeakVsOwnedObject componentInParent = component.GetComponentInParent<PeakVsOwnedObject>(); if ((Object)(object)componentInParent != (Object)null && componentInParent.OwnerActor > 0) { ownerActor = componentInParent.OwnerActor; } else { BackpackOnBackVisuals componentInParent2 = component.GetComponentInParent<BackpackOnBackVisuals>(); Character val = (((Object)(object)componentInParent2 != (Object)null) ? componentInParent2.character : null); if ((Object)(object)val == (Object)null || (Object)(object)((MonoBehaviourPun)val).photonView == (Object)null) { return true; } ownerActor = ((MonoBehaviourPun)val).photonView.OwnerActorNr; } } int num; if (!((Object)(object)interactor != (Object)null) || !((Object)(object)((MonoBehaviourPun)interactor).photonView != (Object)null)) { Player localPlayer = PhotonNetwork.LocalPlayer; num = ((localPlayer != null) ? localPlayer.ActorNumber : 0); } else { num = ((MonoBehaviourPun)interactor).photonView.OwnerActorNr; } int num2 = num; if (num2 > 0) { return ownerActor == num2; } return true; } internal static bool CanAccessBackpack(Character backpackOwner, Character interactor) { if (!GameMode.IsActive) { return true; } if ((Object)(object)backpackOwner != (Object)null && (Object)(object)interactor != (Object)null) { if (!((Object)(object)backpackOwner == (Object)(object)interactor)) { return backpackOwner.isBot; } return true; } return false; } internal static bool CanAccessBackpack(BackpackReference backpack, Character interactor) { //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) //IL_000e: Invalid comparison between Unknown and I4 //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (!GameMode.IsActive || (int)backpack.type != 1) { return true; } return CanAccessBackpack(((Object)(object)backpack.view != (Object)null) ? ((Component)backpack.view).GetComponent<Character>() : null, interactor); } internal static void ResetForScene() { QueuedSharedItems.Clear(); PendingSharedClones.Clear(); PendingPickups.Clear(); OwnedVisualActors.Clear(); PendingOwnedVisualViews.Clear(); DynamicOwnedVisualViews.Clear(); AnnouncedOwnedViews.Clear(); ScratchIds.Clear(); _nextSharedCloneTick = 0f; _nextOwnedVisualTick = 0f; _nextDynamicVisualTick = 0f; } internal static void EnsurePrivateGroup() { if (!PhotonNetwork.InRoom || PhotonNetwork.LocalPlayer == null) { _groupActorNumber = -1; return; } int actorNumber = PhotonNetwork.LocalPlayer.ActorNumber; if (_groupActorNumber != actorNumber) { _groupActorNumber = actorNumber; PhotonNetwork.SetInterestGroups(LocalGroup, true); PeakVsPlugin.Log.LogInfo((object)$"Enabled private Photon group {LocalGroup} for actor {actorNumber}."); if (actorNumber > 127) { PeakVsPlugin.Log.LogWarning((object)"Actor number exceeds PeakVs' unique private-group range; item isolation may collide."); } } } internal static void Tick() { TickPendingPickups(); TickSharedItemClones(); TickOwnedVisuals(); } private static void TickPendingPickups() { if (PendingPickups.Count == 0) { return; } ScratchIds.Clear(); foreach (KeyValuePair<int, PendingPickup> pendingPickup in PendingPickups) { if (!(Time.unscaledTime - pendingPickup.Value.StartedAt <= 6f)) { ScratchIds.Add(pendingPickup.Key); RestorePendingItem(pendingPickup.Value.Item); } } if (ScratchIds.Count != 0) { for (int i = 0; i < ScratchIds.Count; i++) { PendingPickups.Remove(ScratchIds[i]); } PeakVsPlugin.Log.LogWarning((object)"A private pickup request timed out; the item was restored."); } } internal static bool OpenLuggage(Luggage luggage, Character interactor) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (!GameMode.IsActive || (Object)(object)luggage == (Object)null ||