Decompiled source of SpookScope v1.0.1
plugins/SpookScope.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.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using SpookScope.Config; using SpookScope.Core; using SpookScope.UI; using Unity.Mathematics; using UnityEngine; using UnityEngine.Rendering; using Zorro.Core; using Zorro.Settings; [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("KestrelWorks")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Client-side, vanilla-compatible SpookTube viewfinder, live tape views & quota telemetry, subject saturation scanner, live comments ticker, smooth zoom/night-shot, and lost camera rescue beacon for Content Warning.")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("SpookScope")] [assembly: AssemblyTitle("SpookScope")] [assembly: AssemblyVersion("1.0.1.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [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 SpookScope { public static class PluginInfo { public const string PLUGIN_GUID = "com.kestrelworks.contentwarning.spookscope"; public const string PLUGIN_NAME = "SpookScope"; public const string PLUGIN_VERSION = "1.0.1"; public const string PLUGIN_AUTHOR = "KestrelWorks"; } internal static class SpookScopeLog { internal static ManualLogSource? BepLogger; public static void Info(string message) { if (BepLogger != null) { BepLogger.LogInfo((object)message); } else { Debug.Log((object)("[SpookScope] " + message)); } } public static void Warn(string message) { if (BepLogger != null) { BepLogger.LogWarning((object)message); } else { Debug.LogWarning((object)("[SpookScope] " + message)); } } public static void Error(string message) { if (BepLogger != null) { BepLogger.LogError((object)message); } else { Debug.LogError((object)("[SpookScope] " + message)); } } } [ContentWarningPlugin("com.kestrelworks.contentwarning.spookscope", "1.0.1", true)] [BepInPlugin("com.kestrelworks.contentwarning.spookscope", "SpookScope", "1.0.1")] public sealed class SpookScopePlugin : BaseUnityPlugin { static SpookScopePlugin() { SpookScopeRuntime.Bootstrap(applyHarmonyManually: false); } private void Awake() { SpookScopeLog.BepLogger = ((BaseUnityPlugin)this).Logger; ModSettings.BindBepInExConfig(((BaseUnityPlugin)this).Config); SpookScopeRuntime.Bootstrap(applyHarmonyManually: true); } } internal static class SpookScopeRuntime { private static readonly FieldInfo? CameraContentBufferField = AccessTools.Field(typeof(VideoCamera), "contentBuffer"); private static bool _bootstrapped; private static bool _harmonyPatched; private static Harmony? _harmony; private static GameObject? _runnerObject; private static VideoCamera? _activeCamera; public static bool IsHoldingCameraLocal { get; private set; } public static TapeTelemetrySnapshot LatestTelemetry { get; } = new TapeTelemetrySnapshot(); public static void Bootstrap(bool applyHarmonyManually) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown try { if (applyHarmonyManually && !_harmonyPatched) { _harmony = new Harmony("com.kestrelworks.contentwarning.spookscope"); _harmony.PatchAll(typeof(SpookScopeRuntime).Assembly); _harmonyPatched = true; } if (!_bootstrapped) { _bootstrapped = true; CinematographyController.InitializeHooks(); EnsureRunnerExists(); if ((Object)(object)GameHandler.Instance != (Object)null) { ModSettings.EnsureRegisteredInGameSettings(GameHandler.Instance.SettingsHandler); } SpookScopeLog.Info("SpookScope v1.0.1 initialized (VanillaCompatible=true)."); } } catch (Exception arg) { SpookScopeLog.Error($"Bootstrap failure: {arg}"); } } public static void EnsureRunnerExists() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown if ((Object)(object)_runnerObject != (Object)null) { return; } try { _runnerObject = new GameObject("SpookScope_HudRunner"); Object.DontDestroyOnLoad((Object)(object)_runnerObject); ((Object)_runnerObject).hideFlags = (HideFlags)61; _runnerObject.AddComponent<SpookScopeRunnerBehaviour>(); } catch { } } public static bool IsRelevantBuffer(ContentBuffer buffer) { if (buffer == null || (Object)(object)_activeCamera == (Object)null) { return false; } object? obj = CameraContentBufferField?.GetValue(_activeCamera); ContentBuffer val = (ContentBuffer)((obj is ContentBuffer) ? obj : null); return buffer == val; } internal static void TickFrame() { HandleHotkeys(); _activeCamera = CameraBeaconTracker.FindBestActiveCamera(out var isHeldLocal); IsHoldingCameraLocal = isHeldLocal; if (!isHeldLocal && ModSettings.IsNightShotActive) { ModSettings.IsNightShotActive = false; } CinematographyController.UpdateNightShotState(isHeldLocal); if (Time.frameCount % 6 == 0 || (Object)(object)_activeCamera == (Object)null) { TapeEvaluator.EvaluateLiveCamera(_activeCamera, LatestTelemetry); } if (isHeldLocal && ModSettings.ShowSubjectScanner) { SubjectScanner.UpdateTargets(_activeCamera, LatestTelemetry); } CameraBeaconTracker.UpdateDroppedBeacons(LatestTelemetry.CurrentDay); CommentFeed.PruneExpired(Time.unscaledTime); } private static void HandleHotkeys() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Player.localPlayer != (Object)null) || GlobalInputHandler.CanTakeInput()) { if ((int)ModSettings.ToggleHudKey != 0 && Input.GetKeyDown(ModSettings.ToggleHudKey)) { ModSettings.ToggleHidden(); } if ((int)ModSettings.CyclePresetKey != 0 && Input.GetKeyDown(ModSettings.CyclePresetKey)) { ModSettings.CyclePreset(); } if (ModSettings.AllowNightShotViewfinder && IsHoldingCameraLocal && (int)ModSettings.NightShotKey != 0 && Input.GetKeyDown(ModSettings.NightShotKey)) { ModSettings.IsNightShotActive = !ModSettings.IsNightShotActive; ModSettings.NotifyToast(ModSettings.IsNightShotActive ? "NIGHT-SHOT: ON" : "NIGHT-SHOT: OFF"); } } } } internal sealed class SpookScopeRunnerBehaviour : MonoBehaviour { private void Update() { try { SpookScopeRuntime.TickFrame(); } catch (Exception ex) { SpookScopeLog.Warn("Frame update warning: " + ex.Message); } } private void OnGUI() { try { SpookScopeHud.Draw(SpookScopeRuntime.LatestTelemetry); } catch { } } } } namespace SpookScope.UI { public static class SpookScopeHud { private static Texture2D? _whiteTex; private static GUIStyle? _headerStyle; private static GUIStyle? _bigMetricStyle; private static GUIStyle? _subMetricStyle; private static GUIStyle? _badgeStyle; private static GUIStyle? _subjectStyle; private static GUIStyle? _commentHandleStyle; private static GUIStyle? _commentBodyStyle; private static GUIStyle? _beaconStyle; private static int _cachedScaleKey = -1; private static readonly Color BgPanelDark = new Color(0.04f, 0.055f, 0.07f, 0.8f); private static readonly Color BgCardDark = new Color(0.05f, 0.07f, 0.09f, 0.74f); private static readonly Color BorderSubtle = new Color(0.75f, 0.86f, 0.92f, 0.22f); private static readonly Color RecRed = new Color(1f, 0.24f, 0.24f, 0.96f); private static readonly Color StandbyAmber = new Color(1f, 0.76f, 0.22f, 0.94f); private static readonly Color QuotaGreen = new Color(0.24f, 0.95f, 0.58f, 0.96f); private static readonly Color PaceCyan = new Color(0.32f, 0.88f, 0.98f, 0.95f); private static readonly Color SaturatedRed = new Color(1f, 0.36f, 0.32f, 0.92f); private static readonly Color NightShotEmerald = new Color(0.32f, 0.98f, 0.62f, 0.92f); private static readonly Color HairlineGrid = new Color(0.88f, 0.95f, 0.98f, 0.13f); private static readonly Color CornerBracketColor = new Color(0.92f, 0.97f, 1f, 0.42f); public static void Draw(TapeTelemetrySnapshot telemetry) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 if ((int)Event.current.type != 7 || !ShouldRenderGameplayHud()) { return; } EnsureStyles(); float scale = Mathf.Clamp(ModSettings.HudScale, 0.7f, 1.5f); DrawActiveToast(scale); if (ModSettings.CurrentPreset == HudPresetMode.Hidden) { return; } if (ModSettings.ShowCameraRescueBeacon && CameraBeaconTracker.Pings.Count > 0) { DrawDroppedCameraBeacons(CameraBeaconTracker.Pings, scale); } if (!telemetry.HasActiveCamera) { return; } HudPresetMode currentPreset = ModSettings.CurrentPreset; if (telemetry.IsHeldByLocalPlayer) { if (ModSettings.ShowViewfinderGrid && (currentPreset == HudPresetMode.FullStudio || currentPreset == HudPresetMode.ViewfinderOnly)) { DrawViewfinderFrameGuides(telemetry, scale); } if (ModSettings.ShowSubjectScanner && currentPreset != HudPresetMode.CompactBar) { DrawSubjectBrackets(SubjectScanner.CurrentTargets, scale); } } if (ModSettings.ShowLiveQuotaTelemetry && currentPreset != HudPresetMode.ViewfinderOnly) { bool compact = currentPreset == HudPresetMode.CompactBar || !telemetry.IsHeldByLocalPlayer; DrawTelemetryCard(telemetry, scale, compact); } if (ModSettings.ShowLiveComments && currentPreset == HudPresetMode.FullStudio && CommentFeed.Comments.Count > 0) { DrawLiveCommentsFeed(CommentFeed.Comments, scale); } } private static bool ShouldRenderGameplayHud() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.localPlayer == (Object)null) { return false; } if (Cursor.visible && (int)Cursor.lockState == 0) { return false; } return true; } private static void DrawActiveToast(float scale) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(ModSettings.LastToastMessage)) { float num = Time.unscaledTime - ModSettings.LastToastTime; if (!(num < 0f) && !(num > 2.1f)) { float num2 = Mathf.Clamp01((2.1f - num) / 0.55f); float num3 = 230f * scale; float num4 = 26f * scale; Rect val = new Rect(((float)Screen.width - num3) * 0.5f, (float)Screen.height - 76f * scale, num3, num4); Color bgPanelDark = BgPanelDark; bgPanelDark.a *= num2; FillRect(val, bgPanelDark); Color paceCyan = PaceCyan; paceCyan.a *= num2 * 0.75f; DrawOutline(val, 1f, paceCyan); Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, num2); GUI.Label(val, ModSettings.LastToastMessage, _badgeStyle); GUI.color = color; } } } private static void DrawViewfinderFrameGuides(TapeTelemetrySnapshot telemetry, float scale) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) float num = Screen.width; float num2 = Screen.height; float num3 = num * 0.085f; float num4 = num2 * 0.095f; float num5 = num - num3 * 2f; float num6 = num2 - num4 * 2f; Color col = ((ModSettings.IsNightShotActive && ModSettings.AllowNightShotViewfinder) ? NightShotEmerald : CornerBracketColor); float arm = Mathf.Round(26f * scale); float thick = Mathf.Max(1f, Mathf.Round(2f * scale)); DrawCornerL(num3, num4, arm, thick, 1f, 1f, col); DrawCornerL(num3 + num5, num4, arm, thick, -1f, 1f, col); DrawCornerL(num3, num4 + num6, arm, thick, 1f, -1f, col); DrawCornerL(num3 + num5, num4 + num6, arm, thick, -1f, -1f, col); float num7 = Mathf.Round(10f * scale); for (int i = 1; i <= 2; i++) { for (int j = 1; j <= 2; j++) { float num8 = num3 + num5 * ((float)i / 3f); float num9 = num4 + num6 * ((float)j / 3f); FillRect(new Rect(num8 - num7, num9, num7 * 2f + 1f, 1f), HairlineGrid); FillRect(new Rect(num8, num9 - num7, 1f, num7 * 2f + 1f), HairlineGrid); } } float num10 = num * 0.5f; float num11 = num2 * 0.5f; float num12 = Mathf.Round(6f * scale); FillRect(new Rect(num10 - num12, num11, num12 * 2f + 1f, 1f), col); FillRect(new Rect(num10, num11 - num12, 1f, num12 * 2f + 1f), col); float num13 = num4 + num6 + 6f * scale; string text = (1f + CinematographyController.CurrentZoomRatio * 2.5f).ToString("0.0", CultureInfo.InvariantCulture); string text2 = (telemetry.IsSelfieFlipped ? "SELFIE LENS" : "MAIN LENS"); string text3 = ((!ModSettings.AllowNightShotViewfinder) ? string.Empty : (ModSettings.IsNightShotActive ? $" • [NVG ON ({ModSettings.NightShotKey})]" : $" • NVG ({ModSettings.NightShotKey})")); string text4 = "OPTICAL " + text + "x • " + text2 + text3; GUI.Label(new Rect(num3, num13, 520f * scale, 22f * scale), text4, _subMetricStyle); } private static void DrawTelemetryCard(TapeTelemetrySnapshot t, float scale, bool compact) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Unknown result type (might be due to invalid IL or missing references) float num = (compact ? 256f : 292f) * scale; float num2 = (compact ? 74f : 124f) * scale; float num3 = (float)Screen.width - num - 22f * scale; float num4 = 20f * scale; Rect r = new Rect(num3, num4, num, num2); FillRect(r, BgPanelDark); DrawOutline(r, 1f, BorderSubtle); Color col = (t.QuotaMetWithTape ? QuotaGreen : (t.IsRecording ? RecRed : StandbyAmber)); FillRect(new Rect(num3, num4, num, Mathf.Max(2f, 3f * scale)), col); float num5 = 11f * scale; float num6 = num3 + num5; float num7 = num - num5 * 2f; float num8 = num4 + 8f * scale; bool flag = !t.IsRecording || Mathf.FloorToInt(Time.unscaledTime * 2.6f) % 2 == 0; Color col2 = (Color)((!t.IsRecording) ? StandbyAmber : (flag ? RecRed : new Color(1f, 0.24f, 0.24f, 0.25f))); float num9 = Mathf.Round(8f * scale); FillRect(new Rect(num6, num8 + 4f * scale, num9, num9), col2); string text = ((!t.IsRecording) ? (t.HasActiveCamera ? "STBY • TAPE READY" : "NO SIGNAL") : (t.IsHeldByLocalPlayer ? "REC • LIVE TAPE" : "REC • CREW CAM")); GUI.Label(new Rect(num6 + num9 + 6f * scale, num8, num7 * 0.72f, 18f * scale), text, _headerStyle); string text2 = "GRADE " + t.EfficiencyGrade; Rect val = new Rect(num3 + num - num5 - 68f * scale, num8, 68f * scale, 17f * scale); FillRect(val, new Color(1f, 1f, 1f, 0.08f)); GUI.Label(val, text2, _badgeStyle); num8 += 20f * scale; string text3 = TapeEvaluator.FormatViewsCompact(t.ProjectedViews); string text4 = "+$" + t.ProjectedMoney.ToString("N0", CultureInfo.InvariantCulture); string text5 = text3 + " VIEWS <color=#7EF7B8>" + text4 + "</color>"; GUI.Label(new Rect(num6, num8, num7, 26f * scale), text5, _bigMetricStyle); num8 += 26f * scale; float num10 = Mathf.Max(6f, 8f * scale); FillRect(new Rect(num6, num8, num7, num10), new Color(1f, 1f, 1f, 0.11f)); if (t.RequiredQuotaViews > 0) { float num11 = Mathf.Clamp01((float)t.CurrentQuotaViews / (float)t.RequiredQuotaViews); float num12 = Mathf.Clamp01(t.QuotaProgressRatio); if (num11 > 0f) { FillRect(new Rect(num6, num8, num7 * num11, num10), new Color(0.45f, 0.72f, 0.95f, 0.65f)); } if (num12 > num11) { Color col3 = (t.QuotaMetWithTape ? QuotaGreen : PaceCyan); FillRect(new Rect(num6 + num7 * num11, num8, num7 * (num12 - num11), num10), col3); } } num8 += num10 + 6f * scale; if (!compact) { string text6 = ((t.RequiredQuotaViews > 0) ? $"QUOTA: {TapeEvaluator.FormatViewsCompact(t.CombinedViewsWithTape)} / {TapeEvaluator.FormatViewsCompact(t.RequiredQuotaViews)} ({Mathf.RoundToInt(t.QuotaProgressRatio * 100f)}%)" : $"TOTAL CLIPS: {t.TotalClipsAccepted}"); if (t.QuotaMetWithTape) { text6 += " <color=#48F596>[MET!]</color>"; } GUI.Label(new Rect(num6, num8, num7, 18f * scale), text6, _subMetricStyle); num8 += 17f * scale; int num13 = Mathf.CeilToInt(t.FilmSecondsRemaining); string text7 = ((t.ViewsPerSecond >= 1f) ? ("+" + TapeEvaluator.FormatViewsCompact(Mathf.RoundToInt(t.ViewsPerSecond)) + "/s") : "0/s"); string text8 = $"FILM: {num13}s ({Mathf.RoundToInt(t.FilmPercentRemaining * 100f)}%) • PACE: {text7} • DAY {t.CurrentDay}"; GUI.Label(new Rect(num6, num8, num7, 18f * scale), text8, _subMetricStyle); } } private static void DrawSubjectBrackets(IReadOnlyList<TrackedSubjectTarget> targets, float scale) { //IL_0046: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_0117: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) Rect val2 = default(Rect); for (int i = 0; i < targets.Count; i++) { TrackedSubjectTarget trackedSubjectTarget = targets[i]; float num = Mathf.Clamp(115f / Mathf.Max(1.6f, trackedSubjectTarget.DistanceMeters * 0.28f), 42f, 96f) * scale; float num2 = num * 0.5f; float x = trackedSubjectTarget.ScreenPositionGui.x; float y = trackedSubjectTarget.ScreenPositionGui.y; Color val = (trackedSubjectTarget.IsSaturated ? SaturatedRed : (trackedSubjectTarget.IsActivelyScoring ? QuotaGreen : PaceCyan)); float arm = Mathf.Max(8f, num * 0.26f); float thick = Mathf.Max(1.5f, 2f * scale); DrawCornerL(x - num2, y - num2, arm, thick, 1f, 1f, val); DrawCornerL(x + num2, y - num2, arm, thick, -1f, 1f, val); DrawCornerL(x - num2, y + num2, arm, thick, 1f, -1f, val); DrawCornerL(x + num2, y + num2, arm, thick, -1f, -1f, val); string arg = (trackedSubjectTarget.IsSaturated ? $"MAXED {trackedSubjectTarget.AcceptedClips}/{trackedSubjectTarget.MaxClips} • PAN AWAY" : ((trackedSubjectTarget.AcceptedClips > 0) ? string.Format("CLIPS {0}/{1} • {2}", trackedSubjectTarget.AcceptedClips, trackedSubjectTarget.MaxClips, trackedSubjectTarget.IsActivelyScoring ? "RECORDING" : "IN FRAME") : "FRESH SUBJECT!")); string text = $"{trackedSubjectTarget.DisplayName} [{trackedSubjectTarget.DistanceMeters:0}m]\n{arg}"; float num3 = 210f * scale; float num4 = 32f * scale; ((Rect)(ref val2))..ctor(x - num3 * 0.5f, y + num2 + 5f * scale, num3, num4); FillRect(val2, new Color(0.03f, 0.04f, 0.06f, 0.72f)); Color color = GUI.color; GUI.color = val; GUI.Label(val2, text, _subjectStyle); GUI.color = color; } } private static void DrawLiveCommentsFeed(IReadOnlyList<LiveSpookComment> comments, float scale) { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: 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) float num = 282f * scale; float num2 = (float)Screen.width - num - 22f * scale; float num3 = 154f * scale; float unscaledTime = Time.unscaledTime; for (int num4 = comments.Count - 1; num4 >= 0; num4--) { LiveSpookComment liveSpookComment = comments[num4]; float num5 = unscaledTime - liveSpookComment.CreatedUnscaledTime; if (!(num5 > 9.5f)) { float num6 = Mathf.Clamp01(num5 / 0.22f); float num7 = Mathf.Clamp01((9.5f - num5) / 1.25f); float num8 = num6 * num7; if (!(num8 <= 0.02f)) { float num9 = 48f * scale; Rect r = new Rect(num2, num3, num, num9); Color bgCardDark = BgCardDark; bgCardDark.a *= num8; FillRect(r, bgCardDark); Color col = (liveSpookComment.IsHighValueHighlight ? QuotaGreen : PaceCyan); col.a *= num8; FillRect(new Rect(num2, num3, Mathf.Max(2f, 3f * scale), num9), col); Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, num8); int num10 = Mathf.FloorToInt(liveSpookComment.ClipTimestamp / 60f); int num11 = Mathf.FloorToInt(liveSpookComment.ClipTimestamp % 60f); string text = $"{liveSpookComment.Emoticon} @{liveSpookComment.ViewerHandle} • {num10:00}:{num11:00} • ♥ {liveSpookComment.Likes}"; GUI.Label(new Rect(num2 + 9f * scale, num3 + 4f * scale, num - 14f * scale, 16f * scale), text, _commentHandleStyle); GUI.Label(new Rect(num2 + 9f * scale, num3 + 21f * scale, num - 14f * scale, 24f * scale), liveSpookComment.Text, _commentBodyStyle); GUI.color = color; num3 += num9 + 6f * scale; } } } } private static void DrawDroppedCameraBeacons(IReadOnlyList<DroppedCameraPing> pings, float scale) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) Color col = default(Color); for (int i = 0; i < pings.Count; i++) { DroppedCameraPing droppedCameraPing = pings[i]; float num = 0.72f + 0.28f * Mathf.Sin(Time.unscaledTime * 5f); ((Color)(ref col))..ctor(1f, 0.68f, 0.18f, num); float num2 = Mathf.Round(12f * scale); float x = droppedCameraPing.ScreenPositionGui.x; float y = droppedCameraPing.ScreenPositionGui.y; DrawOutline(new Rect(x - num2 * 0.5f, y - num2 * 0.5f, num2, num2), Mathf.Max(1.5f, 2f * scale), col); FillRect(new Rect(x - 2f, y - 2f, 4f, 4f), col); string arg = ((droppedCameraPing.EstimatedViewsOnDisc > 0) ? (" • " + TapeEvaluator.FormatViewsCompact(droppedCameraPing.EstimatedViewsOnDisc) + " VIEWS") : string.Empty); string text = $"CAM DROPPED • {droppedCameraPing.DistanceMeters:0}m{arg}"; float num3 = 215f * scale; float num4 = 22f * scale; float num5 = Mathf.Clamp(x - num3 * 0.5f, 12f, (float)Screen.width - num3 - 12f); float num6 = Mathf.Clamp(y + num2 * 0.5f + 4f * scale, 12f, (float)Screen.height - num4 - 12f); Rect val = new Rect(num5, num6, num3, num4); FillRect(val, new Color(0.06f, 0.04f, 0.02f, 0.82f)); DrawOutline(val, 1f, col); GUI.Label(val, text, _beaconStyle); } } private static void DrawCornerL(float x, float y, float arm, float thick, float dirX, float dirY, Color col) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) float num = ((dirX > 0f) ? x : (x - arm)); float num2 = ((dirY > 0f) ? y : (y - thick)); FillRect(new Rect(num, num2, arm, thick), col); float num3 = ((dirX > 0f) ? x : (x - thick)); float num4 = ((dirY > 0f) ? y : (y - arm)); FillRect(new Rect(num3, num4, thick, arm), col); } private static void DrawOutline(Rect r, float thick, Color col) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) FillRect(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, thick), col); FillRect(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - thick, ((Rect)(ref r)).width, thick), col); FillRect(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, thick, ((Rect)(ref r)).height), col); FillRect(new Rect(((Rect)(ref r)).xMax - thick, ((Rect)(ref r)).y, thick, ((Rect)(ref r)).height), col); } private static void FillRect(Rect r, Color col) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_whiteTex == (Object)null) { _whiteTex = new Texture2D(1, 1, (TextureFormat)4, false); _whiteTex.SetPixel(0, 0, Color.white); _whiteTex.Apply(); } Color color = GUI.color; GUI.color = col; GUI.DrawTexture(r, (Texture)(object)_whiteTex); GUI.color = color; } private static void EnsureStyles() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0143: 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_0156: Expected O, but got Unknown //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0188: 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_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Expected O, but got Unknown //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Expected O, but got Unknown //IL_0232: 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_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026a: 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_027d: Expected O, but got Unknown //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Expected O, but got Unknown //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Expected O, but got Unknown //IL_036e: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.RoundToInt(Mathf.Clamp(ModSettings.HudScale, 0.7f, 1.5f) * 100f); if (_headerStyle == null || _cachedScaleKey != num) { _cachedScaleKey = num; float num2 = (float)num / 100f; _headerStyle = new GUIStyle(GUI.skin.label) { fontSize = Mathf.Max(9, Mathf.RoundToInt(11f * num2)), fontStyle = (FontStyle)1, alignment = (TextAnchor)3, richText = true, wordWrap = false }; _headerStyle.normal.textColor = new Color(0.9f, 0.95f, 0.98f, 0.95f); _bigMetricStyle = new GUIStyle(GUI.skin.label) { fontSize = Mathf.Max(13, Mathf.RoundToInt(17f * num2)), fontStyle = (FontStyle)1, alignment = (TextAnchor)3, richText = true, wordWrap = false }; _bigMetricStyle.normal.textColor = Color.white; _subMetricStyle = new GUIStyle(GUI.skin.label) { fontSize = Mathf.Max(9, Mathf.RoundToInt(11f * num2)), fontStyle = (FontStyle)0, alignment = (TextAnchor)3, richText = true, wordWrap = false }; _subMetricStyle.normal.textColor = new Color(0.78f, 0.86f, 0.92f, 0.92f); _badgeStyle = new GUIStyle(GUI.skin.label) { fontSize = Mathf.Max(8, Mathf.RoundToInt(10f * num2)), fontStyle = (FontStyle)1, alignment = (TextAnchor)4, richText = false }; _badgeStyle.normal.textColor = new Color(0.98f, 0.88f, 0.42f, 0.98f); _subjectStyle = new GUIStyle(GUI.skin.label) { fontSize = Mathf.Max(8, Mathf.RoundToInt(10f * num2)), fontStyle = (FontStyle)1, alignment = (TextAnchor)4, richText = false }; _subjectStyle.normal.textColor = Color.white; _commentHandleStyle = new GUIStyle(GUI.skin.label) { fontSize = Mathf.Max(8, Mathf.RoundToInt(10f * num2)), fontStyle = (FontStyle)1, alignment = (TextAnchor)3, wordWrap = false }; _commentHandleStyle.normal.textColor = new Color(0.62f, 0.88f, 0.98f, 0.96f); _commentBodyStyle = new GUIStyle(GUI.skin.label) { fontSize = Mathf.Max(9, Mathf.RoundToInt(11f * num2)), fontStyle = (FontStyle)0, alignment = (TextAnchor)0, wordWrap = true }; _commentBodyStyle.normal.textColor = new Color(0.95f, 0.97f, 0.99f, 0.96f); _beaconStyle = new GUIStyle(GUI.skin.label) { fontSize = Mathf.Max(8, Mathf.RoundToInt(10f * num2)), fontStyle = (FontStyle)1, alignment = (TextAnchor)4, wordWrap = false }; _beaconStyle.normal.textColor = new Color(1f, 0.82f, 0.36f, 0.98f); } } } } namespace SpookScope.Patches { [HarmonyPatch] internal static class CameraPatches { [HarmonyPatch(typeof(VideoCamera), "Start")] [HarmonyPostfix] private static void VideoCamera_Start_Postfix(VideoCamera __instance) { try { CameraBeaconTracker.RegisterCamera(__instance); SpookScopeRuntime.EnsureRunnerExists(); } catch (Exception arg) { SpookScopeLog.Error($"VideoCamera.Start postfix error: {arg}"); } } [HarmonyPatch(typeof(VideoCamera), "OnDestroy")] [HarmonyPostfix] private static void VideoCamera_OnDestroy_Postfix(VideoCamera __instance) { try { CameraBeaconTracker.UnregisterCamera(__instance); } catch { } } [HarmonyPatch(typeof(VideoCamera), "Update")] [HarmonyPostfix] private static void VideoCamera_Update_Postfix(VideoCamera __instance) { try { CameraBeaconTracker.RegisterCamera(__instance); CinematographyController.OnVideoCameraUpdated(__instance); } catch (Exception ex) { SpookScopeLog.Warn("VideoCamera.Update postfix issue: " + ex.Message); } } [HarmonyPatch(typeof(ContentBuffer), "PushFrame")] [HarmonyPostfix] private static void ContentBuffer_PushFrame_Postfix(ContentBuffer __instance, List<ContentEventFrame> frames) { try { if (ModSettings.ShowLiveComments && frames != null && frames.Count != 0 && SpookScopeRuntime.IsRelevantBuffer(__instance)) { CommentFeed.OnFramesCaptured(frames, Time.unscaledTime, SpookScopeRuntime.LatestTelemetry.CurrentDay); } } catch (Exception ex) { SpookScopeLog.Warn("ContentBuffer.PushFrame postfix issue: " + ex.Message); } } [HarmonyPatch(typeof(GameHandler), "Initialize")] [HarmonyPostfix] private static void GameHandler_Initialize_Postfix(GameHandler __instance) { try { ModSettings.EnsureRegisteredInGameSettings(__instance.SettingsHandler); SpookScopeRuntime.EnsureRunnerExists(); } catch (Exception ex) { SpookScopeLog.Warn("GameHandler.Initialize postfix issue: " + ex.Message); } } } } namespace SpookScope.Core { public struct DroppedCameraPing { public Vector3 WorldPosition; public Vector2 ScreenPositionGui; public bool IsOnScreen; public float DistanceMeters; public float FilmPercent; public int EstimatedViewsOnDisc; } public static class CameraBeaconTracker { private static class CachedDroppedViews { private static readonly Dictionary<VideoCamera, int> Cache = new Dictionary<VideoCamera, int>(); public static int GetOrUpdate(VideoCamera cam, int day, bool forceRefresh) { if (!forceRefresh && Cache.TryGetValue(cam, out var value)) { return value; } int num = TapeEvaluator.EstimateQuickCameraViews(cam, day); Cache[cam] = num; return num; } } private static readonly FieldInfo? RecorderInfoField = AccessTools.Field(typeof(VideoCamera), "m_recorderInfoEntry"); private static readonly HashSet<VideoCamera> TrackedCameras = new HashSet<VideoCamera>(); private static readonly List<DroppedCameraPing> ActivePings = new List<DroppedCameraPing>(4); private static float _lastRefreshTime; private static float _lastFallbackFindTime; public static IReadOnlyList<DroppedCameraPing> Pings => ActivePings; public static void RegisterCamera(VideoCamera? cam) { if ((Object)(object)cam != (Object)null) { TrackedCameras.Add(cam); } } public static void UnregisterCamera(VideoCamera? cam) { if ((Object)(object)cam != (Object)null) { TrackedCameras.Remove(cam); } } public static VideoCamera? FindBestActiveCamera(out bool isHeldLocal) { //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) isHeldLocal = false; PruneDestroyed(); if (TrackedCameras.Count == 0 && Time.unscaledTime - _lastFallbackFindTime > 2f) { _lastFallbackFindTime = Time.unscaledTime; VideoCamera[] array = Object.FindObjectsByType<VideoCamera>((FindObjectsSortMode)0); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)null) { TrackedCameras.Add(array[i]); } } } foreach (VideoCamera trackedCamera in TrackedCameras) { if ((Object)(object)trackedCamera != (Object)null && ((Behaviour)trackedCamera).isActiveAndEnabled && ((ItemInstanceBehaviour)trackedCamera).isHeldByMe) { isHeldLocal = true; return trackedCamera; } } if (ModSettings.ShowCrewTelemetryWhenNearby && (Object)(object)MainCamera.instance != (Object)null && (Object)(object)MainCamera.instance.Cam != (Object)null) { Vector3 position = ((Component)MainCamera.instance.Cam).transform.position; VideoCamera val = null; float num = 324f; foreach (VideoCamera trackedCamera2 in TrackedCameras) { if (!((Object)(object)trackedCamera2 == (Object)null) && ((Behaviour)trackedCamera2).isActiveAndEnabled && (((ItemInstanceBehaviour)trackedCamera2).isHeld || trackedCamera2.recording)) { Vector3 val2 = ((Component)trackedCamera2).transform.position - position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; val = trackedCamera2; } } } if ((Object)(object)val != (Object)null) { return val; } } return null; } public static void UpdateDroppedBeacons(int currentDay) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_015e: 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_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0210: 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_017c: 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_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) ActivePings.Clear(); if (!ModSettings.ShowCameraRescueBeacon || ((Object)(object)PhotonGameLobbyHandler.Instance != (Object)null && PhotonGameLobbyHandler.IsSurface) || (Object)(object)MainCamera.instance == (Object)null || (Object)(object)MainCamera.instance.Cam == (Object)null) { return; } Camera cam = MainCamera.instance.Cam; Vector3 position = ((Component)cam).transform.position; bool flag = Time.unscaledTime - _lastRefreshTime > 0.75f; if (flag) { _lastRefreshTime = Time.unscaledTime; } PruneDestroyed(); Vector2 screenPositionGui = default(Vector2); Vector2 val4 = default(Vector2); Vector2 val5 = default(Vector2); foreach (VideoCamera trackedCamera in TrackedCameras) { if ((Object)(object)trackedCamera == (Object)null || !((Component)trackedCamera).gameObject.activeInHierarchy || ((ItemInstanceBehaviour)trackedCamera).isHeld || ((ItemInstanceBehaviour)trackedCamera).isHeldByMe) { continue; } Vector3 val = ((Component)trackedCamera).transform.position + Vector3.up * 0.22f; float num = Vector3.Distance(position, val); if (num < 3.2f || num > 160f) { continue; } float filmPercent = 0f; object? obj = RecorderInfoField?.GetValue(trackedCamera); VideoInfoEntry val2 = (VideoInfoEntry)((obj is VideoInfoEntry) ? obj : null); if (val2 != null) { filmPercent = Mathf.Clamp01(val2.GetPercentage()); } int orUpdate = CachedDroppedViews.GetOrUpdate(trackedCamera, currentDay, flag); Vector3 val3 = cam.WorldToScreenPoint(val); bool flag2 = val3.z > 0.05f; bool isOnScreen = false; float num2 = 42f; if (flag2 && val3.x >= num2 && val3.x <= (float)Screen.width - num2 && val3.y >= num2 && val3.y <= (float)Screen.height - num2) { ((Vector2)(ref screenPositionGui))..ctor(val3.x, (float)Screen.height - val3.y); isOnScreen = true; } else { ((Vector2)(ref val4))..ctor((float)Screen.width * 0.5f, (float)Screen.height * 0.5f); ((Vector2)(ref val5))..ctor(val3.x - val4.x, (float)Screen.height - val3.y - val4.y); if (!flag2) { val5 = -val5; } if (((Vector2)(ref val5)).sqrMagnitude < 0.001f) { val5 = Vector2.up; } ((Vector2)(ref val5)).Normalize(); float num3 = (float)Screen.width * 0.5f - num2; float num4 = (float)Screen.height * 0.5f - num2; float num5 = ((Mathf.Abs(val5.x) > 0.001f) ? (num3 / Mathf.Abs(val5.x)) : float.MaxValue); float num6 = ((Mathf.Abs(val5.y) > 0.001f) ? (num4 / Mathf.Abs(val5.y)) : float.MaxValue); float num7 = Mathf.Min(num5, num6); screenPositionGui = val4 + val5 * num7; } ActivePings.Add(new DroppedCameraPing { WorldPosition = val, ScreenPositionGui = screenPositionGui, IsOnScreen = isOnScreen, DistanceMeters = num, FilmPercent = filmPercent, EstimatedViewsOnDisc = orUpdate }); } } private static void PruneDestroyed() { TrackedCameras.RemoveWhere((VideoCamera c) => (Object)(object)c == (Object)null); } } public static class CinematographyController { [CompilerGenerated] private static class <>O { public static Action<ScriptableRenderContext, Camera> <0>__OnBeginCameraRendering; public static Action<ScriptableRenderContext, Camera> <1>__OnEndCameraRendering; public static CameraCallback <2>__OnCameraPreCull; public static CameraCallback <3>__OnCameraPostRender; } private static readonly FieldInfo? ZoomLevelField = AccessTools.Field(typeof(VideoCamera), "m_zoomLevel"); private static readonly FieldInfo? CameraRefField = AccessTools.Field(typeof(VideoCamera), "m_camera"); private static readonly FieldInfo? BaseFovField = AccessTools.Field(typeof(VideoCamera), "m_cameraFov"); private static GameObject? _nightShotLightObj; private static Light? _nightShotLight; private static bool _hooksInstalled; private static VideoCamera? _trackedZoomCam; private static float _smoothedZoomLevel; private static float _zoomVelocity; public static float CurrentZoomRatio { get; private set; } public static void InitializeHooks() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //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_009d: Expected O, but got Unknown if (!_hooksInstalled) { _hooksInstalled = true; RenderPipelineManager.beginCameraRendering += OnBeginCameraRendering; RenderPipelineManager.endCameraRendering += OnEndCameraRendering; CameraCallback onPreCull = Camera.onPreCull; object obj = <>O.<2>__OnCameraPreCull; if (obj == null) { CameraCallback val = OnCameraPreCull; <>O.<2>__OnCameraPreCull = val; obj = (object)val; } Camera.onPreCull = (CameraCallback)Delegate.Combine((Delegate?)(object)onPreCull, (Delegate?)obj); CameraCallback onPostRender = Camera.onPostRender; object obj2 = <>O.<3>__OnCameraPostRender; if (obj2 == null) { CameraCallback val2 = OnCameraPostRender; <>O.<3>__OnCameraPostRender = val2; obj2 = (object)val2; } Camera.onPostRender = (CameraCallback)Delegate.Combine((Delegate?)(object)onPostRender, (Delegate?)obj2); } } public static void ShutdownHooks() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //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_009d: Expected O, but got Unknown if (_hooksInstalled) { _hooksInstalled = false; RenderPipelineManager.beginCameraRendering -= OnBeginCameraRendering; RenderPipelineManager.endCameraRendering -= OnEndCameraRendering; CameraCallback onPreCull = Camera.onPreCull; object obj = <>O.<2>__OnCameraPreCull; if (obj == null) { CameraCallback val = OnCameraPreCull; <>O.<2>__OnCameraPreCull = val; obj = (object)val; } Camera.onPreCull = (CameraCallback)Delegate.Remove((Delegate?)(object)onPreCull, (Delegate?)obj); CameraCallback onPostRender = Camera.onPostRender; object obj2 = <>O.<3>__OnCameraPostRender; if (obj2 == null) { CameraCallback val2 = OnCameraPostRender; <>O.<3>__OnCameraPostRender = val2; obj2 = (object)val2; } Camera.onPostRender = (CameraCallback)Delegate.Remove((Delegate?)(object)onPostRender, (Delegate?)obj2); if ((Object)(object)_nightShotLightObj != (Object)null) { Object.Destroy((Object)(object)_nightShotLightObj); _nightShotLightObj = null; _nightShotLight = null; } } } public static void OnVideoCameraUpdated(VideoCamera camera) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)camera == (Object)null || !((ItemInstanceBehaviour)camera).isHeldByMe || ZoomLevelField == null) { return; } float num = (float)ZoomLevelField.GetValue(camera); if ((Object)(object)_trackedZoomCam != (Object)(object)camera) { _trackedZoomCam = camera; _smoothedZoomLevel = num; _zoomVelocity = 0f; } if (ModSettings.EnableCinematographyStabilizer) { float y = Input.mouseScrollDelta.y; if (Mathf.Abs(y) > 0.01f && GlobalInputHandler.CanTakeInput()) { float num2 = y * 0.065f * (ModSettings.SmoothZoomMultiplier - 1f); num = Mathf.Clamp01(num + num2); ZoomLevelField.SetValue(camera, num); } float num3 = Mathf.Lerp(0.01f, 0.16f, ModSettings.StabilizerSmoothing); _smoothedZoomLevel = Mathf.SmoothDamp(_smoothedZoomLevel, num, ref _zoomVelocity, num3, float.PositiveInfinity, Time.unscaledDeltaTime); object? obj = CameraRefField?.GetValue(camera); Camera val = (Camera)((obj is Camera) ? obj : null); if ((Object)(object)val != (Object)null && BaseFovField != null) { float num4 = (float)BaseFovField.GetValue(camera); if (num4 > 5f) { val.fieldOfView = Mathf.Lerp(num4, 20f, Mathf.Clamp01(_smoothedZoomLevel)); } } CurrentZoomRatio = Mathf.Clamp01(_smoothedZoomLevel); } else { _smoothedZoomLevel = num; CurrentZoomRatio = Mathf.Clamp01(num); } } public static void UpdateNightShotState(bool holdingVideoCamera) { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) if (!ModSettings.AllowNightShotViewfinder || !holdingVideoCamera) { if ((Object)(object)_nightShotLight != (Object)null) { ((Behaviour)_nightShotLight).enabled = false; } return; } if (!ModSettings.IsNightShotActive) { if ((Object)(object)_nightShotLight != (Object)null) { ((Behaviour)_nightShotLight).enabled = false; } return; } EnsureNightShotLight(); if ((Object)(object)_nightShotLight != (Object)null && (Object)(object)MainCamera.instance != (Object)null && (Object)(object)MainCamera.instance.Cam != (Object)null) { Transform transform = ((Component)MainCamera.instance.Cam).transform; ((Component)_nightShotLight).transform.SetPositionAndRotation(transform.position, transform.rotation); _nightShotLight.intensity = Mathf.Clamp(ModSettings.NightShotIntensity, 0.4f, 2.5f) * 1.35f; _nightShotLight.range = 24f; _nightShotLight.spotAngle = 98f; _nightShotLight.innerSpotAngle = 58f; ((Behaviour)_nightShotLight).enabled = false; } } private static void EnsureNightShotLight() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_nightShotLight != (Object)null)) { _nightShotLightObj = new GameObject("SpookScope_ViewfinderNightShot"); Object.DontDestroyOnLoad((Object)(object)_nightShotLightObj); _nightShotLight = _nightShotLightObj.AddComponent<Light>(); _nightShotLight.type = (LightType)0; _nightShotLight.color = new Color(0.68f, 0.96f, 0.78f, 1f); _nightShotLight.shadows = (LightShadows)0; _nightShotLight.renderMode = (LightRenderMode)2; ((Behaviour)_nightShotLight).enabled = false; } } private static bool ShouldEnableForCamera(Camera cam) { if (!ModSettings.AllowNightShotViewfinder || !ModSettings.IsNightShotActive) { return false; } if ((Object)(object)_nightShotLight == (Object)null || (Object)(object)MainCamera.instance == (Object)null) { return false; } if ((Object)(object)cam == (Object)(object)MainCamera.instance.Cam) { return SpookScopeRuntime.IsHoldingCameraLocal; } return false; } private static void OnBeginCameraRendering(ScriptableRenderContext context, Camera cam) { if ((Object)(object)_nightShotLight != (Object)null) { ((Behaviour)_nightShotLight).enabled = ShouldEnableForCamera(cam); } } private static void OnEndCameraRendering(ScriptableRenderContext context, Camera cam) { if ((Object)(object)_nightShotLight != (Object)null) { ((Behaviour)_nightShotLight).enabled = false; } } private static void OnCameraPreCull(Camera cam) { if ((Object)(object)_nightShotLight != (Object)null) { ((Behaviour)_nightShotLight).enabled = ShouldEnableForCamera(cam); } } private static void OnCameraPostRender(Camera cam) { if ((Object)(object)_nightShotLight != (Object)null) { ((Behaviour)_nightShotLight).enabled = false; } } } public sealed class LiveSpookComment { public string ViewerHandle = string.Empty; public string Emoticon = ":O"; public string Text = string.Empty; public int Likes; public float ClipTimestamp; public float CreatedUnscaledTime; public bool IsHighValueHighlight; } public static class CommentFeed { private static readonly string[] ViewerHandles = new string[20] { "spook_enjoyer99", "oldworld_watcher", "bell_diver_404", "vhs_fiend", "cryptid_tea", "nightshift_dan", "static_moth", "quota_chaser", "deep_kelp", "analog_ghost", "void_snack", "tape_worm_fan", "flashlight_rip", "oxy_zero", "divebell_vip", "pixel_phantom", "cursed_reel", "basement_crt", "lurker_77", "spooktube_mod" }; private static readonly string[] Emoticons = new string[9] { ":O", "D:", ":)", ">:)", "o_o", "O_O", "x_x", ":/", ":D" }; private static readonly List<LiveSpookComment> ActiveComments = new List<LiveSpookComment>(8); private static readonly Dictionary<(ushort, int), float> SubjectCooldowns = new Dictionary<(ushort, int), float>(); private static float _lastAnyCommentTime = -10f; private static int _DeterministicCounter; public const float CommentLifetimeSeconds = 9.5f; public const int MaxVisibleComments = 5; public static IReadOnlyList<LiveSpookComment> Comments => ActiveComments; public static void Clear() { ActiveComments.Clear(); SubjectCooldowns.Clear(); } public static void PruneExpired(float currentUnscaledTime) { for (int num = ActiveComments.Count - 1; num >= 0; num--) { if (currentUnscaledTime - ActiveComments[num].CreatedUnscaledTime > 9.5f) { ActiveComments.RemoveAt(num); } } } public static void OnFramesCaptured(IReadOnlyList<ContentEventFrame>? frames, float currentUnscaledTime, int currentDay) { //IL_00f5: 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_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_0054: 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_0082: 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) if (frames == null || frames.Count == 0 || currentUnscaledTime - _lastAnyCommentTime < 2.2f) { return; } ContentEventFrame val = default(ContentEventFrame); float num = -1f; for (int i = 0; i < frames.Count; i++) { ContentEventFrame val2 = frames[i]; if (val2.contentEvent != null) { float score = ((ContentEventFrame)(ref val2)).GetScore(); if (score > num) { num = score; val = val2; } } } if (val.contentEvent == null || num <= 0.05f) { return; } ushort iD = val.contentEvent.GetID(); int uniqueID = val.contentEvent.GetUniqueID(); (ushort, int) key = (iD, uniqueID); if (SubjectCooldowns.TryGetValue(key, out var value) && currentUnscaledTime - value < 14f) { return; } string text = string.Empty; try { Comment val3 = val.contentEvent.GenerateComment(); if (val3 != null && !string.IsNullOrWhiteSpace(val3.Text)) { text = val3.Text.Trim(); } } catch { } if (string.IsNullOrWhiteSpace(text)) { string text2 = SubjectScanner.CleanSubjectName(((object)val.contentEvent).GetType().Name); text = "DID YOU JUST SEE THAT " + text2 + "?!"; } SubjectCooldowns[key] = currentUnscaledTime; _lastAnyCommentTime = currentUnscaledTime; int num2 = _DeterministicCounter++ * 7919 + iD * 31 + uniqueID; int num3 = Math.Abs(num2) % ViewerHandles.Length; int num4 = Math.Abs(num2 / 7) % Emoticons.Length; int likes = 12 + Math.Abs(num2 % 45); if ((Object)(object)SingletonAsset<BigNumbers>.Instance != (Object)null) { likes = Mathf.Clamp(BigNumbers.GetScoreToViews(num * 3f, Math.Max(1, currentDay)) / 18 + Math.Abs(num2 % 25), 8, 9999); } PushComment(new LiveSpookComment { ViewerHandle = ViewerHandles[num3], Emoticon = Emoticons[num4], Text = text, Likes = likes, ClipTimestamp = Mathf.Max(0f, val.time), CreatedUnscaledTime = currentUnscaledTime, IsHighValueHighlight = (num >= 15f) }); } public static void PushComment(LiveSpookComment comment) { if (comment == null || string.IsNullOrWhiteSpace(comment.Text)) { return; } if (ActiveComments.Count > 0 && string.Equals(ActiveComments[ActiveComments.Count - 1].Text, comment.Text, StringComparison.OrdinalIgnoreCase)) { ActiveComments[ActiveComments.Count - 1].Likes += Math.Max(3, comment.Likes / 4); return; } ActiveComments.Add(comment); while (ActiveComments.Count > 5) { ActiveComments.RemoveAt(0); } } } public struct TrackedSubjectTarget { public string DisplayName; public ushort ContentId; public int InstanceId; public Vector3 WorldPosition; public Vector2 ScreenPositionGui; public float DistanceMeters; public int AcceptedClips; public int MaxClips; public bool IsActivelyScoring; public bool IsSaturated; public float SingleFrameRawValue; } public static class SubjectScanner { private static readonly Dictionary<string, string> FriendlyNames = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { ["BarnacleBallContentEvent"] = "BARNACLE BALL", ["BigSlapAgroContentEvent"] = "BIG SLAP [AGGRO]", ["BigSlapPeacefulContentEvent"] = "BIG SLAP", ["BlackHoleBotContentEvent"] = "BLACK HOLE DRONE", ["BombContentEvent"] = "TIMEBOMB", ["BombsContentEvent"] = "BOMB CLUSTER", ["CamCreepContentEvent"] = "CAM CREEP", ["DogContentEvent"] = "GUN DOG", ["EarContentEvent"] = "LISTENER EAR", ["EyeGuyContentEvent"] = "EYE GUY", ["FireMonsterContentEvent"] = "FLAMETHROWER", ["FlickerContentEvent"] = "FLICKER", ["GoodCatchContentEvent"] = "CLUTCH CATCH", ["HarpoonerContentEvent"] = "HARPOONER", ["InterviewEvent"] = "CREW INTERVIEW", ["JelloContentEvent"] = "JELLO SLIME", ["KnifoContentEvent"] = "KNIFO", ["LarvaContentEvent"] = "CENTIPEDE LARVA", ["MimeContentEvent"] = "MIME", ["MouthContentEvent"] = "SCREAMER MOUTH", ["PlayerContentEvent"] = "CREWMATE", ["PlayerDeadContentEvent"] = "FALLEN DIVER", ["PlayerEmoteContentEvent"] = "CREW EMOTE", ["PlayerFallingContentEvent"] = "DIVER FALLING", ["PlayerHoldingMicContentEvent"] = "REPORTER MIC", ["PlayerRagdollContentEvent"] = "DIVER RAGDOLL", ["PlayerShroomContentEvent"] = "INFECTED DIVER", ["PlayerTookDamageContentEvent"] = "DIVER INJURED", ["PlayerWearingHatContentEvent"] = "STYLISH HAT", ["PropContentEvent"] = "OLD WORLD PROP", ["PuffoContentEvent"] = "PUFFO", ["RobotButtonContentEvent"] = "LANDMINE BOT", ["SlurperContentEvent"] = "CEILING SLURPER", ["SnailSpawnerContentEvent"] = "SNAIL SPAWNER", ["SnatchoContentEvent"] = "SNATCHO", ["SpiderContentEvent"] = "WEB SPIDER", ["StreamerContentEvent"] = "ROGUE STREAMER", ["ToolkitWhiskContentEvent"] = "IRON WHISK", ["WalloContentEvent"] = "WALLO", ["WeepingContentEvent"] = "IRON MAIDEN", ["WeepingContentEventCaptured"] = "MAIDEN CAPTURE", ["WeepingContentEventFail"] = "CAPTCHA FAILED", ["WeepingContentEventSuccess"] = "CAPTCHA SOLVED", ["WormContentEvent"] = "LINK WORM", ["ZombieContentEvent"] = "SNAIL ZOMBIE", ["ArtifactContentEvent"] = "RARE ARTIFACT" }; private static readonly List<TrackedSubjectTarget> ActiveTargets = new List<TrackedSubjectTarget>(8); private static readonly List<ContentEventFrame> TempProviderFrames = new List<ContentEventFrame>(8); private static float _lastScanTime; public static IReadOnlyList<TrackedSubjectTarget> CurrentTargets => ActiveTargets; public static string CleanSubjectName(string? rawName) { if (string.IsNullOrWhiteSpace(rawName)) { return "UNKNOWN ENTITY"; } string text = rawName.Trim(); if (FriendlyNames.TryGetValue(text, out string value)) { return value.ToUpperInvariant(); } string text2 = text.Replace("ContentEventProvider", string.Empty).Replace("MonsterContentProvider", string.Empty).Replace("ContentProvider", string.Empty) .Replace("ContentEvent", string.Empty) .Replace("(Clone)", string.Empty) .Replace("Bot_", string.Empty) .Trim('_', ' ', '-'); if (string.IsNullOrEmpty(text2)) { return "ANOMALY"; } StringBuilder stringBuilder = new StringBuilder(text2.Length + 6); for (int i = 0; i < text2.Length; i++) { char c = text2[i]; if (c == '_') { if (stringBuilder.Length > 0 && stringBuilder[stringBuilder.Length - 1] != ' ') { stringBuilder.Append(' '); } continue; } if (i > 0 && char.IsUpper(c) && (char.IsLower(text2[i - 1]) || (i + 1 < text2.Length && char.IsLower(text2[i + 1]))) && stringBuilder.Length > 0 && stringBuilder[stringBuilder.Length - 1] != ' ') { stringBuilder.Append(' '); } stringBuilder.Append(char.ToUpperInvariant(c)); } return stringBuilder.ToString(); } public unsafe static void UpdateTargets(VideoCamera? heldCamera, TapeTelemetrySnapshot telemetry) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0190: 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_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: 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_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)heldCamera == (Object)null || !((ItemInstanceBehaviour)heldCamera).isHeldByMe || (Object)(object)MainCamera.instance == (Object)null || (Object)(object)MainCamera.instance.Cam == (Object)null) { ActiveTargets.Clear(); return; } float unscaledTime = Time.unscaledTime; if (unscaledTime - _lastScanTime < 0.12f) { RefreshScreenPositions(MainCamera.instance.Cam); return; } _lastScanTime = unscaledTime; ActiveTargets.Clear(); Camera cam = MainCamera.instance.Cam; Vector3 position = ((Component)cam).transform.position; Vector3 forward = ((Component)cam).transform.forward; int num = (((Object)(object)SingletonAsset<BigNumbers>.Instance != (Object)null && SingletonAsset<BigNumbers>.Instance.MaxSameEventType > 0) ? SingletonAsset<BigNumbers>.Instance.MaxSameEventType : 5); HashSet<ContentProvider> hashSet = new HashSet<ContentProvider>(); ReadOnlySpan<Vector2> readOnlySpan = (Span<Vector2>)stackalloc Vector2[9] { new Vector2(0.5f, 0.5f), new Vector2(0.38f, 0.5f), new Vector2(0.62f, 0.5f), new Vector2(0.5f, 0.38f), new Vector2(0.5f, 0.62f), new Vector2(0.35f, 0.36f), new Vector2(0.65f, 0.36f), new Vector2(0.35f, 0.64f), new Vector2(0.65f, 0.64f) }; RaycastHit val = default(RaycastHit); for (int i = 0; i < readOnlySpan.Length; i++) { if (ActiveTargets.Count >= 4) { break; } if (!Physics.Raycast(cam.ViewportPointToRay(new Vector3(readOnlySpan[i].x, readOnlySpan[i].y, 0f)), ref val, 32f, -1, (QueryTriggerInteraction)1) || (Object)(object)((RaycastHit)(ref val)).collider == (Object)null) { continue; } ContentProvider componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<ContentProvider>(); if ((Object)(object)componentInParent == (Object)null || !hashSet.Add(componentInParent) || (!telemetry.IsSelfieFlipped && (Object)(object)Player.localPlayer != (Object)null && ((Component)componentInParent).transform.IsChildOf(((Component)Player.localPlayer).transform))) { continue; } Bounds bounds = ((RaycastHit)(ref val)).collider.bounds; Vector3 center = ((Bounds)(ref bounds)).center; float distanceMeters = Vector3.Distance(position, center); Vector3 val2 = center - position; if (Vector3.Dot(forward, ((Vector3)(ref val2)).normalized) < 0.25f) { continue; } TempProviderFrames.Clear(); ContentEvent val3 = null; try { componentInParent.GetContent(TempProviderFrames, 1f, cam, 0f); for (int j = 0; j < TempProviderFrames.Count; j++) { ContentEvent contentEvent = TempProviderFrames[j].contentEvent; if (contentEvent != null && (val3 == null || contentEvent.GetContentValue() > val3.GetContentValue())) { val3 = contentEvent; } } } catch { } ushort num2 = (ushort)((val3 != null) ? val3.GetID() : 0); int num3 = ((val3 != null) ? val3.GetUniqueID() : ((Object)componentInParent).GetInstanceID()); float num4 = ((val3 != null) ? val3.GetContentValue() : 0f); string rawName = ((val3 == null) ? ((object)componentInParent).GetType().Name : ((!string.IsNullOrWhiteSpace(val3.GetName())) ? val3.GetName() : ((object)val3).GetType().Name)); if (!(val3 is PlayerContentEvent) || ActiveTargets.Count <= 0 || !(num4 < 5f)) { telemetry.SubjectMap.TryGetValue((num2, num3), out var value); int acceptedClipCount = value.AcceptedClipCount; bool flag = value.HasActiveStreak && telemetry.IsRecording; bool isSaturated = acceptedClipCount >= num && !flag; Vector3 val4 = cam.WorldToScreenPoint(center); if (!(val4.z <= 0.1f)) { ActiveTargets.Add(new TrackedSubjectTarget { DisplayName = CleanSubjectName(rawName), ContentId = num2, InstanceId = num3, WorldPosition = center, ScreenPositionGui = new Vector2(val4.x, (float)Screen.height - val4.y), DistanceMeters = distanceMeters, AcceptedClips = acceptedClipCount, MaxClips = num, IsActivelyScoring = flag, IsSaturated = isSaturated, SingleFrameRawValue = num4 }); } } } } private static void RefreshScreenPositions(Camera viewCam) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) for (int num = ActiveTargets.Count - 1; num >= 0; num--) { TrackedSubjectTarget value = ActiveTargets[num]; Vector3 val = viewCam.WorldToScreenPoint(value.WorldPosition); if (val.z <= 0.1f) { ActiveTargets.RemoveAt(num); } else { value.ScreenPositionGui = new Vector2(val.x, (float)Screen.height - val.y); ActiveTargets[num] = value; } } } } public readonly struct ScoredSubjectClip : IComparable<ScoredSubjectClip> { public readonly ushort ContentId; public readonly int InstanceId; public readonly float FinalScore; public readonly bool IsActiveStreak; public readonly int StreakFrameCount; public ScoredSubjectClip(ushort contentId, int instanceId, float finalScore, bool isActiveStreak = false, int streakFrameCount = 1) { ContentId = contentId; InstanceId = instanceId; FinalScore = finalScore; IsActiveStreak = isActiveStreak; StreakFrameCount = streakFrameCount; } public int CompareTo(ScoredSubjectClip other) { return other.FinalScore.CompareTo(FinalScore); } } public struct SubjectSaturationInfo { public ushort ContentId; public int InstanceId; public int AcceptedClipCount; public int MaxAllowedClips; public bool HasActiveStreak; public int ActiveStreakFrames; public float TotalScoreContributed; public float SaturationRatio { get { if (MaxAllowedClips > 0) { return Mathf.Clamp01((float)AcceptedClipCount / (float)MaxAllowedClips); } return 1f; } } public bool IsDepleted { get { if (MaxAllowedClips > 0 && AcceptedClipCount >= MaxAllowedClips) { return !HasActiveStreak; } return false; } } } public sealed class TapeTelemetrySnapshot { public bool HasActiveCamera; public bool IsHeldByLocalPlayer; public bool IsRecording; public bool IsSelfieFlipped; public float FilmSecondsRemaining; public float FilmSecondsMax = 90f; public float FilmPercentRemaining = 1f; public float RawCompositeScore; public int ProjectedViews; public int ProjectedMoney; public int CurrentQuotaViews; public int RequiredQuotaViews; public int CurrentDay = 1; public int DaysLeftInQuota = 3; public float ViewsPerSecond; public int TotalClipsAccepted; public string EfficiencyGrade = "—"; public readonly Dictionary<(ushort contentId, int instanceId), SubjectSaturationInfo> SubjectMap = new Dictionary<(ushort, int), SubjectSaturationInfo>(); public int CombinedViewsWithTape => CurrentQuotaViews + ProjectedViews; public float QuotaProgressRatio { get { if (RequiredQuotaViews > 0) { return (float)CombinedViewsWithTape / (float)RequiredQuotaViews; } return 0f; } } public bool QuotaMetWithTape { get { if (RequiredQuotaViews > 0) { return CombinedViewsWithTape >= RequiredQuotaViews; } return false; } } } public static class TapeEvaluator { private static readonly FieldInfo? CurrentStreaksField = AccessTools.Field(typeof(ContentBuffer), "currentStreaks"); private static readonly FieldInfo? StreakContentField = AccessTools.Field(typeof(Streak), "content"); private static readonly FieldInfo? ClipContentBufferField = AccessTools.Field(typeof(Clip), "m_contentBuffer"); private static readonly FieldInfo? CameraRecorderEntryField = AccessTools.Field(typeof(VideoCamera), "m_recorderInfoEntry"); private static readonly FieldInfo? CameraContentBufferField = AccessTools.Field(typeof(VideoCamera), "contentBuffer"); private static readonly List<ScoredSubjectClip> ScratchCandidates = new List<ScoredSubjectClip>(128); private static readonly HashSet<ContentBuffer> VisitedBuffers = new HashSet<ContentBuffer>(); private static float _lastSnapshotTime; private static int _lastViewsSample; private static float _smoothedViewsPerSec; public static float ComputeCappedTapeScore(IReadOnlyList<ScoredSubjectClip> rawClips, int maxSameEventType, Dictionary<(ushort contentId, int instanceId), SubjectSaturationInfo>? saturationOut, out int acceptedCount) { saturationOut?.Clear(); acceptedCount = 0; if (rawClips == null || rawClips.Count == 0 || maxSameEventType <= 0) { return 0f; } List<ScoredSubjectClip> list = new List<ScoredSubjectClip>(rawClips.Count); for (int i = 0; i < rawClips.Count; i++) { if (rawClips[i].FinalScore > 0f) { list.Add(rawClips[i]); } } list.Sort(); Dictionary<(ushort, int), int> dictionary = new Dictionary<(ushort, int), int>(); float num = 0f; for (int j = 0; j < list.Count; j++) { ScoredSubjectClip scoredSubjectClip = list[j]; (ushort, int) key = (scoredSubjectClip.ContentId, scoredSubjectClip.InstanceId); dictionary.TryGetValue(key, out var value); SubjectSaturationInfo value3; if (value < maxSameEventType) { value = (dictionary[key] = value + 1); num += scoredSubjectClip.FinalScore; acceptedCount++; if (saturationOut != null) { saturationOut.TryGetValue(key, out var value2); value2.ContentId = scoredSubjectClip.ContentId; value2.InstanceId = scoredSubjectClip.InstanceId; value2.MaxAllowedClips = maxSameEventType; value2.AcceptedClipCount = value; value2.TotalScoreContributed += scoredSubjectClip.FinalScore; if (scoredSubjectClip.IsActiveStreak) { value2.HasActiveStreak = true; value2.ActiveStreakFrames = Math.Max(value2.ActiveStreakFrames, scoredSubjectClip.StreakFrameCount); } saturationOut[key] = value2; } } else if (saturationOut != null && scoredSubjectClip.IsActiveStreak && saturationOut.TryGetValue(key, out value3)) { value3.HasActiveStreak = true; value3.ActiveStreakFrames = Math.Max(value3.ActiveStreakFrames, scoredSubjectClip.StreakFrameCount); saturationOut[key] = value3; } } return num; } public static string ComputeEfficiencyGrade(int projectedViews, int requiredQuota, float filmUsedSeconds) { if (filmUsedSeconds < 1.5f && projectedViews <= 0) { return "—"; } float num = Math.Max(1000f, requiredQuota); float num2 = (float)projectedViews / Math.Max(5f, filmUsedSeconds) * 60f / num; if (num2 >= 1.35f) { return "S+"; } if (num2 >= 1f) { return "S"; } if (num2 >= 0.72f) { return "A"; } if (num2 >= 0.45f) { return "B"; } if (num2 >= 0.22f) { return "C"; } return "D"; } public static string FormatViewsCompact(int views) { int num = Math.Abs(views); string text = ((views < 0) ? "-" : string.Empty); if (num >= 1000000) { return text + ((float)num / 1000000f).ToString("0.00", CultureInfo.InvariantCulture) + "M"; } if (num >= 10000) { return text + ((float)num / 1000f).ToString("0.0", CultureInfo.InvariantCulture) + "K"; } if (num >= 1000) { return text + ((float)num / 1000f).ToString("0.00", CultureInfo.InvariantCulture) + "K"; } return text + num.ToString(CultureInfo.InvariantCulture); } public static void EvaluateLiveCamera(VideoCamera? camera, TapeTelemetrySnapshot targetSnapshot) { //IL_0137: Unknown result type (might be due to invalid IL or missing references) PopulateRoomQuotaContext(targetSnapshot); if ((Object)(object)camera == (Object)null) { targetSnapshot.HasActiveCamera = false; targetSnapshot.IsHeldByLocalPlayer = false; targetSnapshot.IsRecording = false; targetSnapshot.ViewsPerSecond = 0f; _smoothedViewsPerSec = 0f; return; } targetSnapshot.HasActiveCamera = true; targetSnapshot.IsHeldByLocalPlayer = ((ItemInstanceBehaviour)camera).isHeldByMe; targetSnapshot.IsRecording = camera.recording; object? obj = CameraRecorderEntryField?.GetValue(camera); VideoInfoEntry val = (VideoInfoEntry)((obj is VideoInfoEntry) ? obj : null); if (val != null) { targetSnapshot.IsSelfieFlipped = val.isFlipped; targetSnapshot.FilmSecondsMax = ((val.maxTime > 0f) ? val.maxTime : 90f); targetSnapshot.FilmSecondsRemaining = Mathf.Clamp(val.timeLeft, 0f, targetSnapshot.FilmSecondsMax); targetSnapshot.FilmPercentRemaining = Mathf.Clamp01(val.GetPercentage()); } ScratchCandidates.Clear(); VisitedBuffers.Clear(); BigNumbers instance = SingletonAsset<BigNumbers>.Instance; AnimationCurve streakCurve = (((Object)(object)instance != (Object)null) ? instance.streakCurve : null); int maxSameEventType = (((Object)(object)instance != (Object)null && instance.MaxSameEventType > 0) ? instance.MaxSameEventType : 5); if (val != null && val.videoID.id != Guid.Empty) { try { CameraRecording val2 = default(CameraRecording); if (RecordingsHandler.TryGetRecording(val.videoID, ref val2) && (Object)(object)val2 != (Object)null) { List<Clip> allClips = val2.GetAllClips(); if (allClips != null) { for (int i = 0; i < allClips.Count; i++) { Clip val3 = allClips[i]; if (val3 != null) { object? obj2 = ClipContentBufferField?.GetValue(val3); ContentBuffer val4 = (ContentBuffer)((obj2 is ContentBuffer) ? obj2 : null); if (val4 != null && VisitedBuffers.Add(val4)) { CollectFromBuffer(val4, streakCurve, ScratchCandidates); } } } } } } catch { } } object? obj4 = CameraContentBufferField?.GetValue(camera); ContentBuffer val5 = (ContentBuffer)((obj4 is ContentBuffer) ? obj4 : null); if (val5 != null && VisitedBuffers.Add(val5)) { CollectFromBuffer(val5, streakCurve, ScratchCandidates); } int acceptedCount; float num = (targetSnapshot.RawCompositeScore = ComputeCappedTapeScore(ScratchCandidates, maxSameEventType, targetSnapshot.SubjectMap, out acceptedCount)); targetSnapshot.TotalClipsAccepted = acceptedCount; if ((Object)(object)instance != (Object)null && num > 0.001f) { int num2 = Math.Max(1, targetSnapshot.CurrentDay); targetSnapshot.ProjectedViews = Math.Max(0, BigNumbers.GetScoreToViews(num, num2)); targetSnapshot.ProjectedMoney = Math.Max(0, BigNumbers.GetMoneyFromScore(num, num2)); } else { targetSnapshot.ProjectedViews = 0; targetSnapshot.ProjectedMoney = 0; } float unscaledTime = Time.unscaledTime; float num3 = unscaledTime - _lastSnapshotTime; if (num3 >= 0.25f) { if (_lastSnapshotTime > 0f && num3 < 3f && targetSnapshot.IsRecording) { float num4 = Math.Max(0f, (float)(targetSnapshot.ProjectedViews - _lastViewsSample) / num3); _smoothedViewsPerSec = Mathf.Lerp(_smoothedViewsPerSec, num4, 0.45f); } else if (!targetSnapshot.IsRecording) { _smoothedViewsPerSec = Mathf.Lerp(_smoothedViewsPerSec, 0f, 0.5f); } _lastViewsSample = targetSnapshot.ProjectedViews; _lastSnapshotTime = unscaledTime; } targetSnapshot.ViewsPerSecond = _smoothedViewsPerSec; float filmUsedSeconds = Mathf.Max(0f, targetSnapshot.FilmSecondsMax - targetSnapshot.FilmSecondsRemaining); targetSnapshot.EfficiencyGrade = ComputeEfficiencyGrade(targetSnapshot.ProjectedViews, targetSnapshot.RequiredQuotaViews, filmUsedSeconds); } public static int EstimateQuickCameraViews(VideoCamera? camera, int currentDay) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)camera == (Object)null) { return 0; } BigNumbers instance = SingletonAsset<BigNumbers>.Instance; if ((Object)(object)instance == (Object)null) { return 0; } List<ScoredSubjectClip> list = new List<ScoredSubjectClip>(32); HashSet<ContentBuffer> hashSet = new HashSet<ContentBuffer>(); AnimationCurve streakCurve = instance.streakCurve; object? obj = CameraRecorderEntryField?.GetValue(camera); VideoInfoEntry val = (VideoInfoEntry)((obj is VideoInfoEntry) ? obj : null); if (val != null && val.videoID.id != Guid.Empty) { try { CameraRecording val2 = default(CameraRecording); if (RecordingsHandler.TryGetRecording(val.videoID, ref val2) && (Object)(object)val2 != (Object)null) { List<Clip> allClips = val2.GetAllClips(); if (allClips != null) { for (int i = 0; i < allClips.Count; i++) { if (allClips[i] != null) { object? obj2 = ClipContentBufferField?.GetValue(allClips[i]); ContentBuffer val3 = (ContentBuffer)((obj2 is ContentBuffer) ? obj2 : null); if (val3 != null && hashSet.Add(val3)) { CollectFromBuffer(val3, streakCurve, list); } } } } } } catch { } } object? obj4 = CameraContentBufferField?.GetValue(camera); ContentBuffer val4 = (ContentBuffer)((obj4 is ContentBuffer) ? obj4 : null); if (val4 != null && hashSet.Add(val4)) { CollectFromBuffer(val4, streakCurve, list); } int maxSameEventType = ((instance.MaxSameEventType > 0) ? instance.MaxSameEventType : 5); int acceptedCount; float num = ComputeCappedTapeScore(list, maxSameEventType, null, out acceptedCount); if (!(num > 0.001f)) { return 0; } return Math.Max(0, BigNumbers.GetScoreToViews(num, Math.Max(1, currentDay))); } private static void CollectFromBuffer(ContentBuffer contentBuffer, AnimationCurve? streakCurve, List<ScoredSubjectClip> dest) { //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) if (contentBuffer.buffer != null) { for (int i = 0; i < contentBuffer.buffer.Count; i++) { BufferedContent val = contentBuffer.buffer[i]; if (val?.frame.contentEvent != null) { ushort iD = val.frame.contentEvent.GetID(); int uniqueID = val.frame.contentEvent.GetUniqueID(); dest.Add(new ScoredSubjectClip(iD, uniqueID, val.score)); } } } if (!(CurrentStreaksField?.GetValue(contentBuffer) is Dictionary<UniqueContent, Streak> dictionary)) { return; } foreach (KeyValuePair<UniqueContent, Streak> item in dictionary) { Streak value = item.Value; if (value == null || !(StreakContentField?.GetValue(value) is List<BufferedContent> { Count: not 0 } list)) { continue; } float num = ((streakCurve != null) ? streakCurve.Evaluate((float)list.Count) : 1f); float num2 = float.MinValue; for (int j = 0; j < list.Count; j++) { BufferedContent val2 = list[j]; if (val2 != null) { float num3 = val2.score * num; if (num3 > num2) { num2 = num3; } } } if (num2 > 0f) { dest.Add(new ScoredSubjectClip(item.Key.contentID, item.Key.instanceID, num2, isActiveStreak: true, list.Count)); } } } private static void PopulateRoomQuotaContext(TapeTelemetrySnapshot snapshot) { try { RoomStatsHolder roomStats = SurfaceNetworkHandler.RoomStats; if (roomStats != null) { snapshot.CurrentQuotaViews = Math.Max(0, roomStats.CurrentQuota); snapshot.RequiredQuotaViews = Math.Max(0, roomStats.QuotaToReach); snapshot.CurrentDay = Math.Max(1, roomStats.CurrentDay); snapshot.DaysLeftInQuota = Math.Max(0, roomStats.GetDaysLeft()); return; } } catch { } try { snapshot.CurrentDay = Math.Max(1, GameAPI.CurrentDay); if (snapshot.RequiredQuotaViews <= 0 && (Object)(object)SingletonAsset<BigNumbers>.Instance != (Object)null) { int num = Math.Max(0, (snapshot.CurrentDay - 1) / 3); snapshot.RequiredQuotaViews = BigNumbers.GetQuota(num); } } catch { snapshot.CurrentDay = 1; if (snapshot.RequiredQuotaViews <= 0) { snapshot.RequiredQuotaViews = 3000; } } } } } namespace SpookScope.Config { public enum HudPresetMode { FullStudio, CompactBar, ViewfinderOnly, Hidden } public static class ModSettings { private static ConfigEntry<HudPresetMode>? _cfgPreset; private static ConfigEntry<float>? _cfgScale; private static ConfigEntry<bool>? _cfgQuota; private static ConfigEntry<bool>? _cfgCrewNearby; private static ConfigEntry<bool>? _cfgScanner; private static ConfigEntry<bool>? _cfgComments; private static ConfigEntry<bool>? _cfgBeacon; private static ConfigEntry<bool>? _cfgGrid; private static ConfigEntry<bool>? _cfgStabilizer; private static ConfigEntry<float>? _cfgStabilizerSmoothing; private static ConfigEntry<float>? _cfgZoomSpeed; private static ConfigEntry<bool>? _cfgAllowNightShot; private static ConfigEntry<float>? _cfgNightShotIntensity; private static ConfigEntry<KeyCode>? _cfgToggleHudKey; private static ConfigEntry<KeyCode>? _cfgCyclePresetKey; private static ConfigEntry<KeyCode>? _cfgNightShotKey; private static HudPresetMode _lastNonHiddenPreset = HudPresetMode.FullStudio; public static HudPresetMode CurrentPreset { get; set; } = HudPresetMode.FullStudio; public static float HudScale { get; set; } = 1f; public static bool ShowLiveQuotaTelemetry { get; set; } = true; public static bool ShowCrewTelemetryWhenNearby { get; set; } = true; public static bool ShowSubjectScanner { get; set; } = true; public static bool ShowLiveComments { get; set; } = true; public static bool ShowCameraRescueBeacon { get; set; } = true; public static bool ShowViewfinderGrid { get; set; } = true; public static bool EnableCinematographyStabilizer { get; set; } = true; public static float StabilizerSmoothing { get; set; } = 0.35f; public static float SmoothZoomMultiplier { get; set; } = 1.25f; public static bool AllowNightShotViewfinder { get; set; } = true; public static float NightShotIntensity { get; set; } = 1.15f; public static KeyCode ToggleHudKey { get; set; } = (KeyCode)287; public static KeyCode CyclePresetKey { get; set; } = (KeyCode)288; public static KeyCode NightShotKey { get; set; } = (KeyCode)110; public static bool IsNightShotActive { get; set; } public static string LastToastMessage { get; private set; } = string.Empty; public static float LastToastTime { get; private set; } = -10f; public static void NotifyToast(string message) { LastToastMessage = message; LastToastTime = Time.unscaledTime; } public static void BindBepInExConfig(ConfigFile config) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown _cfgPreset = config.Bind<HudPresetMode>("1. HUD Layout", "DefaultPreset", HudPresetMode.FullStudio, "Initial SpookScope overlay mode: FullStudio, CompactBar, ViewfinderOnly, or Hidden."); _cfgScale = config.Bind<float>("1. HUD Layout", "HudScale", 1f, new ConfigDescription("Overall UI scale factor for SpookScope overlays.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.7f, 1.5f), Array.Empty<object>())); _cfgViewfinderBind(config); SyncFromBepInEx(); config.SettingChanged += delegate { SyncFromBepInEx(); }; } private static void _cfgViewfinderBind(ConfigFile config) { //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_01