using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; 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; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("com.github.megalon.peakcinema")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.5.0.0")] [assembly: AssemblyInformationalVersion("0.5.0+14f71ecb5ce9bfa899ad6dafc13581fcb4c91bb9")] [assembly: AssemblyProduct("com.github.megalon.peakcinema")] [assembly: AssemblyTitle("PeakCinema")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.5.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [CompilerGenerated] internal sealed class <>z__ReadOnlyArray : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { int ICollection.Count => _items.Length; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection.Count => _items.Length; T IReadOnlyList.this[int index] => _items[index]; int ICollection.Count => _items.Length; bool ICollection.IsReadOnly => true; T IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return ((ICollection)_items).Contains(item); } void ICollection.CopyTo(T[] array, int arrayIndex) { ((ICollection)_items).CopyTo(array, arrayIndex); } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { return ((IList)_items).IndexOf(item); } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } } 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 BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace PeakCinema { [BepInPlugin("com.github.megalon.peakcinema", "PeakCinema", "0.5.0")] public class Plugin : BaseUnityPlugin { public class PluginModConfig { public readonly ConfigEntry toggleCinemaCamControlKey; public readonly ConfigEntry resetCinemaCamKey; public readonly ConfigEntry initHoldTimer; public readonly ConfigEntry exitCinemaCamKey; public readonly ConfigEntry keyTogglePlayer; public readonly ConfigEntry keyMoveForward; public readonly ConfigEntry keyMoveBackward; public readonly ConfigEntry keyMoveLeft; public readonly ConfigEntry keyMoveRight; public readonly ConfigEntry keyMoveUp; public readonly ConfigEntry keyMoveDown; public readonly ConfigEntry keyMoveFaster; public readonly ConfigEntry keySmoothToggle; public readonly ConfigEntry velLerpValue; public readonly ConfigEntry rotLerpValue; public readonly ConfigEntry normalSpeed; public readonly ConfigEntry fastSpeed; public readonly ConfigEntry rotationSensitivity; public readonly ConfigEntry keyFOVReset; public readonly ConfigEntry defaultFOV; public readonly ConfigEntry fovSensitivity; public PluginModConfig(ConfigFile config) { toggleCinemaCamControlKey = config.Bind("General", "Toggle Cinema Cam Control", (KeyCode)284, "Press to enable cinema cam. Press again to flip between camera control and player control"); resetCinemaCamKey = config.Bind("General", "Reset Cinema Cam Position", (KeyCode)284, "Hold to reset camera position to the player position."); initHoldTimer = config.Bind("General", "Reset Hold Time", 1.5f, "Time in seconds to hold the camera reset key before it resets. Can be set to 0."); exitCinemaCamKey = config.Bind("General", "Exit Cinema Cam", (KeyCode)27, "Exits the cinema camera and re-enables player input."); keyTogglePlayer = config.Bind("General", "Toggle Player Visibility", (KeyCode)285, "Toggles your character model (body/head/cosmetics) on/off."); keyMoveFaster = config.Bind("Movement", "Move Faster", (KeyCode)304, "Hold to move at the fast speed setting."); keyMoveUp = config.Bind("Movement", "Move Up", (KeyCode)32, "Camera movement up key."); keyMoveDown = config.Bind("Movement", "Move Down", (KeyCode)306, "Camera movement down key."); keyMoveForward = config.Bind("Movement", "Move Forward", (KeyCode)119, "Camera movement forward key."); keyMoveLeft = config.Bind("Movement", "Move Left", (KeyCode)97, "Camera movement left key."); keyMoveBackward = config.Bind("Movement", "Move Backward", (KeyCode)115, "Camera movement backward key."); keyMoveRight = config.Bind("Movement", "Move Right", (KeyCode)100, "Camera movement right key."); keySmoothToggle = config.Bind("Camera", "Toggle Camera Smoothing", (KeyCode)301, "Toggles velocity damping and movement smoothing."); normalSpeed = config.Bind("Camera", "Normal Speed", 2f, "The default movement speed of the camera."); fastSpeed = config.Bind("Camera", "Fast Speed", 6f, "The movement speed when holding the 'Move Faster' key."); rotationSensitivity = config.Bind("Camera", "Rotation Sensitivity", 1.5f, "Mouse sensitivity for looking around."); velLerpValue = config.Bind("Camera", "Smoothing Velocity", 2f, "Control how quickly the camera stops moving."); rotLerpValue = config.Bind("Camera", "Smoothing Rotation", 3f, "Control how quickly the camera stops rotating."); keyFOVReset = config.Bind("FOV", "Reset FOV", (KeyCode)325, "Key to reset the Field of View to the default value."); defaultFOV = config.Bind("FOV", "Default FOV", 60f, "The default Field of View value (used for reset)."); fovSensitivity = config.Bind("FOV", "FOV Scroll Sensitivity", 15f, "Multiplier for how fast the FOV changes when scrolling the mouse wheel."); } } internal static GameObject HUD = null; internal static float InitialFOV = 60f; internal static List VoiceFilters = new List(); public const string Id = "com.github.megalon.peakcinema"; internal static ManualLogSource Log { get; private set; } = null; internal static PluginModConfig ModConfig { get; private set; } = null; internal static bool CinemaCamActive { get; private set; } internal static Transform? CamTransform { get; private set; } internal static Camera? CinemaCamComponent { get; private set; } internal static bool CameraWasSpawned { get; private set; } internal static bool Smoothing { get; private set; } = true; internal static float HoldTimer { get; private set; } internal static Vector3 DeathLocation { get; private set; } internal static bool PlayerVisibilityToggled { get; private set; } = false; internal static bool InstanceOnLastUpdate { get; private set; } = false; internal static bool GhostHidden { get; private set; } = false; public static string Name => "PeakCinema"; public static string Version => "0.5.0"; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)("Plugin " + Name + " is loaded!")); Harmony.CreateAndPatchAll(typeof(Plugin), (string)null); ModConfig = new PluginModConfig(((BaseUnityPlugin)this).Config); HoldTimer = ModConfig.initHoldTimer.Value; } [HarmonyPatch(typeof(VoiceObscuranceFilter), "Start")] [HarmonyPostfix] private static void VoiceObscuranceFilter_Start(VoiceObscuranceFilter __instance) { if (CinemaCamActive) { SetVoiceFilterToCinemaCam(__instance); } VoiceFilters.Add(__instance); } [HarmonyPatch(typeof(CinemaCamera), "Start")] [HarmonyPostfix] private static void CinemaCamera_Start(CinemaCamera __instance) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) CamTransform = __instance.cam; CinemaCamComponent = ((Component)__instance.cam).GetComponent(); if ((Object)(object)CinemaCamComponent != (Object)null) { InitialFOV = ModConfig.defaultFOV.Value; CinemaCamComponent.fieldOfView = ModConfig.defaultFOV.Value; } CameraWasSpawned = false; HoldTimer = ModConfig.initHoldTimer.Value; DeathLocation = Vector3.zero; if ((Object)(object)HUD == (Object)null) { HUD = GameObject.Find("Canvas_HUD"); } } [HarmonyPatch(typeof(CinemaCamera), "Update")] [HarmonyPrefix] private static bool CinemaCameraFix(CinemaCamera __instance) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Unknown result type (might be due to invalid IL or missing references) //IL_055b: Unknown result type (might be due to invalid IL or missing references) //IL_0596: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_060b: Unknown result type (might be due to invalid IL or missing references) //IL_0645: Unknown result type (might be due to invalid IL or missing references) //IL_0681: Unknown result type (might be due to invalid IL or missing references) //IL_0691: Unknown result type (might be due to invalid IL or missing references) //IL_06ad: Unknown result type (might be due to invalid IL or missing references) //IL_06c3: Unknown result type (might be due to invalid IL or missing references) //IL_06d8: Unknown result type (might be due to invalid IL or missing references) //IL_06e8: Unknown result type (might be due to invalid IL or missing references) //IL_06fe: Unknown result type (might be due to invalid IL or missing references) //IL_070e: Unknown result type (might be due to invalid IL or missing references) //IL_0724: Unknown result type (might be due to invalid IL or missing references) //IL_0734: Unknown result type (might be due to invalid IL or missing references) InstanceOnLastUpdate = __instance.on; HandlePlayerVisibilityInput(); if (Input.GetKeyDown(ModConfig.exitCinemaCamKey.Value)) { CinemaCamActive = false; __instance.on = false; GameObject hUD = HUD; if (hUD != null) { hUD.SetActive(true); } ((Component)__instance.cam).gameObject.SetActive(false); if ((Object)(object)__instance.fog != (Object)null) { ((Component)__instance.fog).gameObject.SetActive(true); } if ((Object)(object)__instance.oldCam != (Object)null) { ((Component)__instance.oldCam).gameObject.SetActive(true); } foreach (VoiceObscuranceFilter voiceFilter in VoiceFilters) { if (!((Object)(object)voiceFilter == (Object)null)) { voiceFilter.head = ((Component)MainCamera.instance).transform; } } ApplyPlayerVisibility(cameraActive: false); } if (ModConfig.initHoldTimer.Value > 0f) { if (Input.GetKey(ModConfig.resetCinemaCamKey.Value)) { HoldTimer -= Time.deltaTime; if (HoldTimer <= 0f) { MoveCameraToPlayerPosition(__instance); if (!__instance.on) { __instance.on = true; } HoldTimer = -1f; } } } else if (Input.GetKeyUp(ModConfig.resetCinemaCamKey.Value)) { MoveCameraToPlayerPosition(__instance); if (!__instance.on) { __instance.on = true; } } if (Input.GetKeyUp(ModConfig.toggleCinemaCamControlKey.Value)) { if (!CinemaCamActive) { CinemaCamActive = true; HandleVoiceFilters(); } if (HoldTimer > -1f) { __instance.on = !__instance.on; } HoldTimer = ModConfig.initHoldTimer.Value; } if (__instance.on) { InputSystem.actions.Disable(); GameObject hUD2 = HUD; if (hUD2 != null) { hUD2.SetActive(false); } ApplyPlayerVisibility(cameraActive: true); if (!InstanceOnLastUpdate) { if (!CameraWasSpawned) { MoveCameraToPlayerPosition(__instance); } ((Component)__instance.cam).gameObject.SetActive(true); __instance.ambience.parent = ((Component)__instance).transform; if (Object.op_Implicit((Object)(object)__instance.fog)) { ((Component)__instance.fog).gameObject.SetActive(false); } if (Object.op_Implicit((Object)(object)__instance.oldCam)) { ((Component)__instance.oldCam).gameObject.SetActive(false); } ((Component)__instance).transform.parent = null; __instance.cam.parent = null; } if ((Object)(object)CinemaCamComponent != (Object)null) { float axis = Input.GetAxis("Mouse ScrollWheel"); if (axis != 0f) { Camera? cinemaCamComponent = CinemaCamComponent; cinemaCamComponent.fieldOfView -= axis * ModConfig.fovSensitivity.Value; CinemaCamComponent.fieldOfView = Mathf.Clamp(CinemaCamComponent.fieldOfView, 5f, 120f); } if (Input.GetKeyDown(ModConfig.keyFOVReset.Value)) { CinemaCamComponent.fieldOfView = ModConfig.defaultFOV.Value; } } if (Input.GetKeyDown(ModConfig.keySmoothToggle.Value)) { Smoothing = !Smoothing; } float num = 0f; float value = ModConfig.normalSpeed.Value; float value2 = ModConfig.fastSpeed.Value; float value3 = ModConfig.rotationSensitivity.Value; float num2 = (((Object)(object)CinemaCamComponent != (Object)null) ? CinemaCamComponent.fieldOfView : 60f); float num3 = Mathf.Pow(60f / Mathf.Clamp(num2, 5f, 180f), 0.1f); float num4 = value3 * num3; if (Smoothing) { __instance.vel = Vector3.Lerp(__instance.vel, Vector3.zero, ModConfig.velLerpValue.Value * Time.deltaTime); __instance.rot = Vector3.Lerp(__instance.rot, Vector3.zero, ModConfig.rotLerpValue.Value * Time.deltaTime); num = (Input.GetKey(ModConfig.keyMoveFaster.Value) ? (value2 / 10f) : (value / 10f)); __instance.rot.y += Input.GetAxis("Mouse X") * num * num4 * 0.05f; __instance.rot.x += Input.GetAxis("Mouse Y") * num * num4 * 0.05f; } else { __instance.vel = Vector3.zero; __instance.rot = Vector3.zero; num = (Input.GetKey(ModConfig.keyMoveFaster.Value) ? value2 : value); __instance.rot.y += Input.GetAxis("Mouse X") * num4 * 0.1f; __instance.rot.x += Input.GetAxis("Mouse Y") * num4 * 0.1f; } float num5 = num * Time.deltaTime; if (Input.GetKey(ModConfig.keyMoveRight.Value)) { __instance.vel.x = (Smoothing ? (__instance.vel.x + num5) : num5); } if (Input.GetKey(ModConfig.keyMoveLeft.Value)) { __instance.vel.x = (Smoothing ? (__instance.vel.x - num5) : (0f - num5)); } if (Input.GetKey(ModConfig.keyMoveForward.Value)) { __instance.vel.z = (Smoothing ? (__instance.vel.z + num5) : num5); } if (Input.GetKey(ModConfig.keyMoveBackward.Value)) { __instance.vel.z = (Smoothing ? (__instance.vel.z - num5) : (0f - num5)); } if (Input.GetKey(ModConfig.keyMoveUp.Value)) { __instance.vel.y = (Smoothing ? (__instance.vel.y + num5) : num5); } if (Input.GetKey(ModConfig.keyMoveDown.Value)) { __instance.vel.y = (Smoothing ? (__instance.vel.y - num5) : (0f - num5)); } ((Component)__instance.cam).transform.Rotate(Vector3.up * __instance.rot.y, (Space)0); ((Component)__instance.cam).transform.Rotate(((Component)__instance).transform.right * (0f - __instance.rot.x)); ((Component)__instance.cam).transform.Translate(Vector3.right * __instance.vel.x, (Space)1); ((Component)__instance.cam).transform.Translate(Vector3.forward * __instance.vel.z, (Space)1); ((Component)__instance.cam).transform.Translate(Vector3.up * __instance.vel.y, (Space)0); __instance.t = true; CameraWasSpawned = true; } else if (InstanceOnLastUpdate && !__instance.on) { InputSystem.actions.Enable(); ApplyPlayerVisibility(cameraActive: false); } return false; } private static void HandlePlayerVisibilityInput() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(ModConfig.keyTogglePlayer.Value)) { PlayerVisibilityToggled = !PlayerVisibilityToggled; Log.LogInfo((object)$"Player visibility set to {PlayerVisibilityToggled}"); } } private static void ApplyPlayerVisibility(bool cameraActive) { Character val = ((IEnumerable)Character.AllCharacters).FirstOrDefault((Func)((Character c) => c.IsLocal)); CharacterCustomization customization = val.refs.customization; if ((Object)(object)customization == (Object)null) { return; } if (val.IsGhost) { if (cameraActive && PlayerVisibilityToggled) { GhostHidden = true; Renderer[] playerRenderers = val.Ghost.PlayerRenderers; foreach (Renderer val2 in playerRenderers) { val2.enabled = false; } Renderer[] eyeRenderers = val.Ghost.EyeRenderers; foreach (Renderer val3 in eyeRenderers) { val3.enabled = false; } val.Ghost.mouthRenderer.enabled = false; val.Ghost.accessoryRenderer.enabled = false; val.Ghost.thirdEye.gameObject.SetActive(false); } else { if (!GhostHidden) { return; } GhostHidden = false; Renderer[] playerRenderers2 = val.Ghost.PlayerRenderers; foreach (Renderer val4 in playerRenderers2) { if (((Object)((Component)val4).gameObject).name.Contains("Accesory Card") && customization.refs.thirdEye.activeSelf) { val4.enabled = false; } else { val4.enabled = true; } } Renderer[] eyeRenderers2 = val.Ghost.EyeRenderers; foreach (Renderer val5 in eyeRenderers2) { val5.enabled = true; } val.Ghost.mouthRenderer.enabled = true; val.Ghost.accessoryRenderer.enabled = true; val.Ghost.thirdEye.gameObject.SetActive(true); } } else if (cameraActive && PlayerVisibilityToggled) { if (!customization._allRenderersHidden) { customization.HideAllRenderers(); ((Renderer)customization.refs.mainRendererShadow).enabled = false; customization.refs.skirtShadow.enabled = false; customization.refs.shortsShadow.enabled = false; customization.refs.headShadow.enabled = false; customization.refs.sashRenderer.enabled = false; customization.refs.medalRenderer.enabled = false; customization.refs.thirdEye.GetComponent().enabled = false; } } else { if (!customization._allRenderersHidden) { return; } customization._allRenderersHidden = false; Renderer[] allRenderers = customization.refs.AllRenderers; foreach (Renderer val6 in allRenderers) { if (((Object)((Component)val6).gameObject).name.Contains("Accesory Card") && customization.refs.thirdEye.activeSelf) { val6.enabled = false; } else { val6.enabled = true; } } ((Component)customization.refs.hatTransform).gameObject.SetActive(true); ((Renderer)customization.refs.mainRendererShadow).enabled = true; customization.refs.skirtShadow.enabled = true; customization.refs.shortsShadow.enabled = true; customization.refs.headShadow.enabled = true; customization.refs.sashRenderer.enabled = true; customization.refs.medalRenderer.enabled = true; customization.refs.thirdEye.GetComponent().enabled = true; } } private static void MoveCameraToPlayerPosition(CinemaCamera __instance) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_009c: Unknown result type (might be due to invalid IL or missing references) Character val = ((IEnumerable)Character.AllCharacters).FirstOrDefault((Func)((Character c) => c.IsLocal)); if ((Object)(object)val != (Object)null) { if (val.data.dead) { ((Component)__instance.cam).transform.position = DeathLocation; } else { ((Component)__instance.cam).transform.position = val.refs.animationPositionTransform.position; } Transform transform = ((Component)__instance.cam).transform; transform.position += new Vector3(0f, 1.5f, -2f); } } private static void HandleVoiceFilters() { for (int num = VoiceFilters.Count - 1; num >= 0; num--) { VoiceObscuranceFilter val = VoiceFilters[num]; if ((Object)(object)val == (Object)null) { VoiceFilters.RemoveAt(num); } } foreach (VoiceObscuranceFilter voiceFilter in VoiceFilters) { if (!((Object)(object)voiceFilter == (Object)null)) { SetVoiceFilterToCinemaCam(voiceFilter); } } Log.LogInfo((object)$"Adjusted {VoiceFilters.Count} voice filters!"); } private static void SetVoiceFilterToCinemaCam(VoiceObscuranceFilter filter) { if (!((Object)(object)CamTransform == (Object)null) && !((Object)(object)filter == (Object)null)) { filter.head = CamTransform; } } [HarmonyPatch(typeof(AmbienceAudio), "Update")] private static IEnumerable Transpiler(IEnumerable instructions) { //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown List list = new List(instructions); bool flag = false; FieldInfo fieldInfo = AccessTools.Field(typeof(AmbienceAudio), "character"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(Character), "data"); FieldInfo fieldInfo3 = AccessTools.Field(typeof(Character), "localCharacter"); FieldInfo fieldInfo4 = AccessTools.Field(typeof(Character), "data"); for (int i = 0; i < list.Count - 2; i++) { if (list[i].opcode == OpCodes.Ldarg_0 && list[i + 1].opcode == OpCodes.Ldfld && list[i + 1].operand as FieldInfo == fieldInfo && list[i + 2].opcode == OpCodes.Ldfld && list[i + 2].operand as FieldInfo == fieldInfo2) { Log.LogInfo((object)"Patching AmbienceAudio.Update..."); list.RemoveRange(i, 3); list.InsertRange(i, new <>z__ReadOnlyArray((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldsfld, (object)fieldInfo3), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo4) })); Log.LogInfo((object)"Successfully patched AmbienceAudio.Update!"); flag = true; break; } } if (!flag) { Log.LogFatal((object)"Failed to patch AmbienceAudio.Update."); } return list; } [HarmonyPatch(typeof(Character), "RPCA_Die")] [HarmonyPrefix] private static bool Character_RPCA_Die(Character __instance) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!__instance.IsLocal) { return true; } DeathLocation = __instance.refs.animationPositionTransform.position; return true; } [HarmonyPatch(typeof(Mirror), "LateUpdate")] [HarmonyPrefix] private static bool MirrorFix(Mirror __instance) { if (__instance.isInitialized && (Object)(object)CinemaCamComponent != (Object)null) { __instance.mainCam = (Camera)(CinemaCamActive ? ((object)CinemaCamComponent) : ((object)Camera.main)); } return true; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }