using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SpectateFreecam { [BepInPlugin("benjamin.spectatefreecam", "SpectateFreecam", "1.0.0")] [BepInProcess("REPO.exe")] public class Plugin : BaseUnityPlugin { public const string Guid = "benjamin.spectatefreecam"; public const string Name = "SpectateFreecam"; public const string Version = "1.0.0"; internal static ManualLogSource Log; private Harmony _harmony; internal static ConfigEntry Enabled; internal static ConfigEntry ZoomInKey; internal static ConfigEntry ZoomOutKey; internal static ConfigEntry MinFov; internal static ConfigEntry MaxFov; internal static ConfigEntry ZoomStep; private void Awake() { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Enabled = ((BaseUnityPlugin)this).Config.Bind("General", "Enabled", true, "Master switch."); ZoomInKey = ((BaseUnityPlugin)this).Config.Bind("Zoom", "ZoomInKey", (KeyCode)61, "Narrow the spectate camera's field of view (zoom in)."); ZoomOutKey = ((BaseUnityPlugin)this).Config.Bind("Zoom", "ZoomOutKey", (KeyCode)45, "Widen the spectate camera's field of view (zoom out)."); MinFov = ((BaseUnityPlugin)this).Config.Bind("Zoom", "MinFov", 20f, new ConfigDescription("Tightest zoom.", (AcceptableValueBase)(object)new AcceptableValueRange(5f, 60f), Array.Empty())); MaxFov = ((BaseUnityPlugin)this).Config.Bind("Zoom", "MaxFov", 90f, new ConfigDescription("Widest zoom.", (AcceptableValueBase)(object)new AcceptableValueRange(60f, 120f), Array.Empty())); ZoomStep = ((BaseUnityPlugin)this).Config.Bind("Zoom", "ZoomStep", 5f, new ConfigDescription("Degrees per keypress.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 20f), Array.Empty())); _harmony = new Harmony("benjamin.spectatefreecam"); _harmony.PatchAll(typeof(SpectateZoomPatch)); Log.LogInfo((object)"SpectateFreecam v1.0.0 loaded."); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } [HarmonyPatch(typeof(SpectateCamera))] internal static class SpectateZoomPatch { [HarmonyPrefix] [HarmonyPatch("LateUpdate")] private static void BeforeLateUpdate(SpectateCamera __instance) { //IL_0012: 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) if (Plugin.Enabled.Value) { if (Input.GetKeyDown(Plugin.ZoomInKey.Value)) { __instance.cameraFieldOfView = Mathf.Max(Plugin.MinFov.Value, __instance.cameraFieldOfView - Plugin.ZoomStep.Value); } if (Input.GetKeyDown(Plugin.ZoomOutKey.Value)) { __instance.cameraFieldOfView = Mathf.Min(Plugin.MaxFov.Value, __instance.cameraFieldOfView + Plugin.ZoomStep.Value); } } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "SpectateFreecam"; public const string PLUGIN_NAME = "SpectateFreecam"; public const string PLUGIN_VERSION = "1.0.0"; } }