using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using On.RoR2.UI; using Rewired; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.UI; using RoR2.UI.SkinControllers; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PhotoModePlus")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PhotoModePlus")] [assembly: AssemblyTitle("PhotoModePlus")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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; } } } public static class QuaternionExtension { public static Quaternion WithEulerAngles(this Quaternion quaternion, float? x = null, float? y = null, float? z = null) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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) Vector3 eulerAngles = ((Quaternion)(ref quaternion)).eulerAngles; ((Vector3)(ref eulerAngles)).Set(x ?? eulerAngles.x, y ?? eulerAngles.y, z ?? eulerAngles.z); return Quaternion.Euler(eulerAngles); } } namespace PhotoModePlus { public class Assets { public static AssetBundle assetBundle; public static void Init() { GetAssetBundle(); } private static void GetAssetBundle() { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("PhotoModePlus.mwmwphotomodeplusbundle"); if (stream != null) { assetBundle = AssetBundle.LoadFromStream(stream); } else { Log.Error("Failed to load assetbundle!"); } } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } public class Options { private static bool? _rooEnabled; public static BindingFlags allFlags = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; public static ConfigEntry disableIndicators; public static ConfigEntry buttonPlacement; public static bool rooEnabled { get { if (!_rooEnabled.HasValue) { _rooEnabled = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); } return _rooEnabled.Value; } } public static void Init() { disableIndicators = PhotoModePlus.config.Bind("Misc", "Disable Ping Indicators", true, "Hide pings while photo mode is active."); buttonPlacement = PhotoModePlus.config.Bind("Misc", "Photo Mode Button Index", 1, "The index position of the photo mode button in the pause menu."); if (rooEnabled) { RoOInit(); } } private static void RoOInit() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_0033: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(disableIndicators, new CheckBoxConfig())); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(buttonPlacement, new IntSliderConfig { min = 0, max = 6 })); ModSettingsManager.SetModDescription("Config options for PhotoModePlus."); ModSettingsManager.SetModIcon(Assets.assetBundle.LoadAsset("icon")); } } internal class PhotoModeController : MonoBehaviour, ICameraStateProvider { internal struct PhotoModeCameraState { internal float pitch; internal float yaw; internal float roll; internal Vector3 position; internal float fov; internal Quaternion Rotation { get { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) return Quaternion.Euler(pitch, yaw, roll); } set { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) Vector3 eulerAngles = ((Quaternion)(ref value)).eulerAngles; pitch = eulerAngles.x; yaw = eulerAngles.y; roll = eulerAngles.z; } } } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static EmptyDelegate <>9__20_0; public static EmptyDelegate <>9__20_1; internal void b__20_0() { SettingsConVars.enableDamageNumbers.SetBool(true); } internal void b__20_1() { SettingsConVars.cvExpAndMoneyEffects.SetBool(true); } } private static float cameraSpeed = 10f; private static float cameraSprintMultiplier = 5f; private static float cameraSlowMultiplier = 0.3f; public CameraRigController cameraRigController; private PhotoModeCameraState cameraState; private float currentTimescale; private float prevTimescale; private List pingIndicators; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] private EmptyDelegate m_OnExit; private Camera camera => cameraRigController.sceneCam; public InputSource currentInputSource { get; private set; } private bool gamepad => (int)currentInputSource == 1; private event EmptyDelegate OnExit { [CompilerGenerated] add { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown EmptyDelegate val = this.m_OnExit; EmptyDelegate val2; do { val2 = val; EmptyDelegate value2 = (EmptyDelegate)Delegate.Combine((Delegate?)(object)val2, (Delegate?)(object)value); val = Interlocked.CompareExchange(ref this.m_OnExit, value2, val2); } while (val != val2); } [CompilerGenerated] remove { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown EmptyDelegate val = this.m_OnExit; EmptyDelegate val2; do { val2 = val; EmptyDelegate value2 = (EmptyDelegate)Delegate.Remove((Delegate?)(object)val2, (Delegate?)(object)value); val = Interlocked.CompareExchange(ref this.m_OnExit, value2, val2); } while (val != val2); } } internal void EnterPhotoMode(CameraRigController cameraRigController) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Expected O, but got Unknown //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Expected O, but got Unknown //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Expected O, but got Unknown //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Expected O, but got Unknown //IL_016c: 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_0177: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)cameraRigController)) { Log.Error("Camera rig controller is null! Cancelling photo mode..."); Object.Destroy((Object)(object)((Component)this).gameObject); } this.cameraRigController = cameraRigController; if (Object.op_Implicit((Object)(object)this.cameraRigController)) { this.cameraRigController.SetOverrideCam((ICameraStateProvider)(object)this, 0f); this.cameraRigController.enableFading = false; } cameraState = default(PhotoModeCameraState); cameraState.position = ((Component)camera).transform.position; cameraState.Rotation = Quaternion.LookRotation(((Component)camera).transform.rotation * Vector3.forward, Vector3.up); cameraState.fov = camera.fieldOfView; if (cameraState.pitch > 90f) { cameraState.pitch -= 360f; } if (SettingsConVars.enableDamageNumbers.value) { SettingsConVars.enableDamageNumbers.SetBool(false); object obj = <>c.<>9__20_0; if (obj == null) { EmptyDelegate val = delegate { SettingsConVars.enableDamageNumbers.SetBool(true); }; <>c.<>9__20_0 = val; obj = (object)val; } OnExit += (EmptyDelegate)obj; } if (SettingsConVars.cvExpAndMoneyEffects.value) { SettingsConVars.cvExpAndMoneyEffects.SetBool(false); object obj2 = <>c.<>9__20_1; if (obj2 == null) { EmptyDelegate val2 = delegate { SettingsConVars.cvExpAndMoneyEffects.SetBool(true); }; <>c.<>9__20_1 = val2; obj2 = (object)val2; } OnExit += (EmptyDelegate)obj2; } ((Behaviour)this.cameraRigController.hud.mainContainer.GetComponent()).enabled = false; OnExit += (EmptyDelegate)delegate { ((Behaviour)this.cameraRigController.hud.mainContainer.GetComponent()).enabled = true; }; if (Options.disableIndicators.Value) { SetIndicatorsVisible(visible: false); OnExit += (EmptyDelegate)delegate { SetIndicatorsVisible(visible: true); }; } Player inputPlayer = this.cameraRigController.localUserViewer.inputPlayer; inputPlayer.controllers.AddLastActiveControllerChangedDelegate(new PlayerActiveControllerChangedDelegate(OnLastActiveControllerChanged)); OnLastActiveControllerChanged(inputPlayer, inputPlayer.controllers.GetLastActiveController()); if (Object.op_Implicit((Object)(object)PauseStopController.instance)) { prevTimescale = PauseStopController.instance._oldTimeScale; return; } Log.Warning("PauseStopController instance is null! Recording previous timescale as 1."); prevTimescale = 1f; } private void OnDisable() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)cameraRigController)) { Player inputPlayer = cameraRigController.localUserViewer.inputPlayer; inputPlayer.controllers.RemoveLastActiveControllerChangedDelegate(new PlayerActiveControllerChangedDelegate(OnLastActiveControllerChanged)); } } private void OnDestroy() { ExitPhotoMode(); } private void OnLastActiveControllerChanged(Player player, Controller controller) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected I4, but got Unknown if (controller != null) { ControllerType type = controller.type; ControllerType val = type; switch ((int)val) { case 0: currentInputSource = (InputSource)0; break; case 1: currentInputSource = (InputSource)0; break; case 2: currentInputSource = (InputSource)1; break; } } } private void ExitPhotoMode() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) EmptyDelegate onExit = this.OnExit; if (onExit != null) { onExit.Invoke(); } if (Object.op_Implicit((Object)(object)cameraRigController)) { cameraRigController.enableFading = true; cameraRigController.SetOverrideCam((ICameraStateProvider)null, 1f); ((Component)camera).transform.localPosition = Vector3.zero; ((Component)camera).transform.localRotation = Quaternion.identity; } for (int i = 0; i < PauseScreenController.instancesList.Count; i++) { PauseScreenController.instancesList[i].DestroyPauseScreen(true); } Time.timeScale = prevTimescale; Object.Destroy((Object)(object)((Component)this).gameObject); } private void SetIndicatorsVisible(bool visible) { if (!visible) { DamageNumberManager.instance.ps.Clear(true); cameraRigController.sprintingParticleSystem.Clear(true); pingIndicators = new List(PingIndicator.instancesList); } for (int i = 0; i < pingIndicators.Count; i++) { PingIndicator obj = pingIndicators[i]; if ((Object)(object)((obj != null) ? ((Component)obj).gameObject : null) != (Object)null) { ((Component)pingIndicators[i]).gameObject.SetActive(visible); } } ((Behaviour)cameraRigController.hud.combatHealthBarViewer).enabled = visible; } private void Update() { //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: 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_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_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_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034e: 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_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) UserProfile userProfile = cameraRigController.localUserViewer.userProfile; Player inputPlayer = cameraRigController.localUserViewer.inputPlayer; if (inputPlayer.GetButton(25)) { ExitPhotoMode(); return; } Time.timeScale = currentTimescale; float mouseLookSensitivity = userProfile.mouseLookSensitivity; float mouseLookScaleX = userProfile.mouseLookScaleX; float mouseLookScaleY = userProfile.mouseLookScaleY; float axis = inputPlayer.GetAxis(23); float axis2 = inputPlayer.GetAxis(24); float num = 1f; if (gamepad) { num = 10f; } if ((gamepad && inputPlayer.GetButton(9)) || Input.GetMouseButton(1)) { cameraState.fov = Mathf.Clamp(camera.fieldOfView + mouseLookSensitivity * Time.unscaledDeltaTime * axis2 * num, 4f, 120f); } if ((gamepad && inputPlayer.GetButton(10)) || Input.GetMouseButton(2)) { cameraState.roll += (0f - mouseLookScaleX) * mouseLookSensitivity * Time.unscaledDeltaTime * axis * num; } else { float value = mouseLookScaleX * mouseLookSensitivity * Time.unscaledDeltaTime * axis * num; float value2 = mouseLookScaleY * mouseLookSensitivity * Time.unscaledDeltaTime * axis2 * num; ConditionalNegate(ref value, userProfile.mouseLookInvertX); ConditionalNegate(ref value2, userProfile.mouseLookInvertY); float num2 = cameraState.roll * (MathF.PI / 180f); cameraState.yaw += cameraState.fov * (value * Mathf.Cos(num2) - value2 * Mathf.Sin(num2)); cameraState.pitch += cameraState.fov * ((0f - value2) * Mathf.Cos(num2) - value * Mathf.Sin(num2)); cameraState.pitch = Mathf.Clamp(cameraState.pitch, -90f, 90f); } Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(inputPlayer.GetAxis(0) * num, 0f, inputPlayer.GetAxis(1) * num); if ((gamepad && inputPlayer.GetButton(7)) || Input.GetKey((KeyCode)113)) { val.y -= 1f; } if ((gamepad && inputPlayer.GetButton(8)) || Input.GetKey((KeyCode)101)) { val.y += 1f; } ((Vector3)(ref val)).Normalize(); if (inputPlayer.GetButton("Sprint")) { val *= cameraSprintMultiplier; } if (Input.GetKey((KeyCode)306)) { val *= cameraSlowMultiplier; } ref Vector3 position = ref cameraState.position; position += cameraState.Rotation * val * Time.unscaledDeltaTime * cameraSpeed; ((Component)camera).transform.position = cameraState.position; Quaternion val2 = cameraState.Rotation; if ((double)Mathf.Abs(((Quaternion)(ref val2)).eulerAngles.z) < 2.0) { val2 = val2.WithEulerAngles(null, null, 0f); } ((Component)camera).transform.rotation = val2; camera.fieldOfView = cameraState.fov; } public void GetCameraState(CameraRigController cameraRigController, ref CameraState cameraState) { } private void ConditionalNegate(ref float value, bool condition) { value = (condition ? (0f - value) : value); } public bool IsHudAllowed(CameraRigController cameraRigController) { return false; } public bool IsUserControlAllowed(CameraRigController cameraRigController) { return false; } public bool IsUserLookAllowed(CameraRigController cameraRigController) { return false; } } [BepInPlugin("mwmw.PhotoModePlus", "PhotoModePlus", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class PhotoModePlus : BaseUnityPlugin { public const string PluginGUID = "mwmw.PhotoModePlus"; public const string PluginAuthor = "mwmw"; public const string PluginName = "PhotoModePlus"; public const string PluginVersion = "1.0.0"; public static ConfigFile config; public void Awake() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); config = ((BaseUnityPlugin)this).Config; Assets.Init(); Options.Init(); PauseScreenController.Awake += (hook_Awake)delegate(orig_Awake orig, PauseScreenController self) { orig.Invoke(self); SetupPhotoModeButton(self); }; } private void SetupPhotoModeButton(PauseScreenController pauseScreenController) { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown GameObject gameObject = ((Component)((Component)pauseScreenController).GetComponentInChildren()).gameObject; GameObject val = Object.Instantiate(gameObject, gameObject.transform.parent); ((Object)val).name = "GenericMenuButton (Photo Mode)"; val.SetActive(true); ButtonSkinController component = val.GetComponent(); ((Component)component).GetComponent().token = "Photo Mode"; HGButton component2 = val.GetComponent(); object obj; if (CameraRigController.instancesList.Count <= 0) { obj = null; } else { List instancesList = CameraRigController.instancesList; obj = instancesList[instancesList.Count - 1]; } CameraRigController cameraRigInstance = (CameraRigController)obj; ((Selectable)component2).interactable = Object.op_Implicit((Object)(object)cameraRigInstance) && cameraRigInstance.localUserViewer != null; ((UnityEvent)((Button)component2).onClick).AddListener((UnityAction)delegate { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val2 = new GameObject("PhotoModeController"); PhotoModeController photoModeController = val2.AddComponent(); photoModeController.EnterPhotoMode(cameraRigInstance); }); val.transform.SetSiblingIndex(Options.buttonPlacement.Value + 1); } } }