using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using Concentus; using Concentus.Enums; using Concentus.Oggfile; using HarmonyLib; using Il2Cpp; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppPhoton.Pun; using Il2CppPhoton.Realtime; using Il2CppPhoton.Voice; using Il2CppPhoton.Voice.PUN; using Il2CppPhoton.Voice.Unity; using Il2CppRUMBLE.Audio; using Il2CppRUMBLE.Combat.ShiftStones; using Il2CppRUMBLE.Environment; using Il2CppRUMBLE.Environment.MatchFlow; using Il2CppRUMBLE.Input; using Il2CppRUMBLE.Interactions.InteractionBase; using Il2CppRUMBLE.Managers; using Il2CppRUMBLE.MoveSystem; using Il2CppRUMBLE.Networking; using Il2CppRUMBLE.Networking.MatchFlow; using Il2CppRUMBLE.Players; using Il2CppRUMBLE.Players.Scaling; using Il2CppRUMBLE.Players.Subsystems; using Il2CppRUMBLE.Pools; using Il2CppRUMBLE.Poses; using Il2CppRUMBLE.Recording.LCK; using Il2CppRUMBLE.Slabs.Forms; using Il2CppRUMBLE.Social; using Il2CppRUMBLE.Social.Phone; using Il2CppRUMBLE.Utilities; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppSystem.IO; using Il2CppTMPro; using MelonLoader; using MelonLoader.Preferences; using MelonLoader.Utils; using Newtonsoft.Json; using ReplayMod.Core; using ReplayMod.Replay; using ReplayMod.Replay.Files; using ReplayMod.Replay.Serialization; using ReplayMod.Replay.UI; using RumbleModdingAPI.RMAPI; using UIFramework; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem.XR; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; using UnityEngine.VFX; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(Main), "ReplayMod", "1.2.0", "ERROR", null)] [assembly: MelonGame("Buckethead Entertainment", "RUMBLE")] [assembly: MelonColor(255, 255, 0, 0)] [assembly: MelonAuthorColor(255, 255, 0, 0)] [assembly: MelonAdditionalDependencies(new string[] { "RumbleModdingAPI", "UIFramework" })] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("ReplayMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ReplayMod")] [assembly: AssemblyTitle("ReplayMod")] [assembly: AssemblyVersion("1.0.0.0")] namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.All)] public sealed class NullableAttribute : Attribute { public NullableAttribute(byte flag) { } public NullableAttribute(byte[] flags) { } } [AttributeUsage(AttributeTargets.All)] public sealed class NullableContextAttribute : Attribute { public NullableContextAttribute(byte flag) { } } } namespace ReplayMod { public static class BinaryExtensions { public static void Write(this BinaryWriter bw, Vector3 v) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) bw.Write(v.x); bw.Write(v.y); bw.Write(v.z); } public static void Write(this BinaryWriter bw, Quaternion q) { int num = 0; float num2 = Mathf.Abs(((Quaternion)(ref q))[0]); for (int i = 1; i < 4; i++) { float num3 = Mathf.Abs(((Quaternion)(ref q))[i]); if (num3 > num2) { num = i; num2 = num3; } } float num4 = ((((Quaternion)(ref q))[num] < 0f) ? (-1f) : 1f); for (int j = 0; j < 4; j++) { if (j != num) { ushort value = (ushort)(Mathf.Clamp01(((Quaternion)(ref q))[j] * num4 * 0.5f + 0.5f) * 65535f); bw.Write(value); } } bw.Write((byte)num); } public static Vector3 ReadVector3(this BinaryReader br) { //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 new Vector3(br.ReadSingle(), br.ReadSingle(), br.ReadSingle()); } public static Quaternion ReadQuaternion(this BinaryReader br) { //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) float[] array = new float[4]; ushort num = br.ReadUInt16(); ushort num2 = br.ReadUInt16(); ushort num3 = br.ReadUInt16(); byte b = br.ReadByte(); float[] array2 = new float[3] { ((float)(int)num / 65535f - 0.5f) * 2f, ((float)(int)num2 / 65535f - 0.5f) * 2f, ((float)(int)num3 / 65535f - 0.5f) * 2f }; int num4 = 0; for (int i = 0; i < 4; i++) { if (i != b) { array[i] = array2[num4++]; } } float num5 = 0f; for (int j = 0; j < 4; j++) { if (j != b) { num5 += array[j] * array[j]; } } array[b] = Mathf.Sqrt(1f - num5); return new Quaternion(array[0], array[1], array[2], array[3]); } public static void Write(this BinaryWriter bw, TField field, Vector3 v) where TField : Enum { //IL_001d: Unknown result type (might be due to invalid IL or missing references) bw.Write(Convert.ToByte(field)); bw.Write((ushort)12); bw.Write(v); } public static void Write(this BinaryWriter bw, TField field, Quaternion q) where TField : Enum { //IL_001c: Unknown result type (might be due to invalid IL or missing references) bw.Write(Convert.ToByte(field)); bw.Write((ushort)7); bw.Write(q); } public static void Write(this BinaryWriter bw, TField field, short v) where TField : Enum { bw.Write(Convert.ToByte(field)); bw.Write((ushort)2); bw.Write(v); } public static void Write(this BinaryWriter bw, TField field, bool v) where TField : Enum { bw.Write(Convert.ToByte(field)); bw.Write((ushort)1); bw.Write(v); } public static void Write(this BinaryWriter bw, TField field, float f) where TField : Enum { bw.Write(Convert.ToByte(field)); bw.Write((ushort)4); bw.Write(f); } public static void Write(this BinaryWriter bw, TField field, string s) where TField : Enum { byte[] bytes = Encoding.UTF8.GetBytes(s); bw.Write(Convert.ToByte(field)); bw.Write((ushort)bytes.Length); bw.Write(bytes); } public static void Write(this BinaryWriter bw, TField field, int v) where TField : Enum { bw.Write(Convert.ToByte(field)); bw.Write((ushort)4); bw.Write(v); } public static void Write(this BinaryWriter bw, TField field, byte v) where TField : Enum { bw.Write(Convert.ToByte(field)); bw.Write((ushort)1); bw.Write(v); } public static void Write(this BinaryWriter bw, TField field, long v) where TField : Enum { bw.Write(Convert.ToByte(field)); bw.Write((ushort)8); bw.Write(v); } public static void Write(this BinaryWriter bw, TField field, double v) where TField : Enum { bw.Write(Convert.ToByte(field)); bw.Write((ushort)8); bw.Write(v); } public static void Write(this BinaryWriter bw, TField field, Vector2 v) where TField : Enum { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) bw.Write(Convert.ToByte(field)); bw.Write((ushort)8); bw.Write(v.x); bw.Write(v.y); } public static void Write(this BinaryWriter bw, TField field, Color32 c) where TField : Enum { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) bw.Write(Convert.ToByte(field)); bw.Write((ushort)4); bw.Write(c.r); bw.Write(c.g); bw.Write(c.b); bw.Write(c.a); } public static void Write(this BinaryWriter bw, TField field, TEnum value) where TField : Enum where TEnum : Enum { bw.Write(Convert.ToByte(field)); bw.Write((ushort)4); bw.Write(Convert.ToInt32(value)); } } public class ReplayCodec { public static byte[] Compress(byte[] data) { using MemoryStream memoryStream = new MemoryStream(); using (BrotliStream brotliStream = new BrotliStream(memoryStream, CompressionLevel.Optimal, leaveOpen: true)) { brotliStream.Write(data, 0, data.Length); } return memoryStream.ToArray(); } public static byte[] Decompress(byte[] compressed) { using MemoryStream stream = new MemoryStream(compressed); using BrotliStream brotliStream = new BrotliStream(stream, CompressionMode.Decompress); using MemoryStream memoryStream = new MemoryStream(); brotliStream.CopyTo(memoryStream); return memoryStream.ToArray(); } } } namespace ReplayMod.Replay { public static class ReplayAPI { public sealed class FrameExtensionWriter { private readonly BinaryWriter _entriesWriter; private readonly int _extensionId; private readonly Action _incrementEntryCount; internal FrameExtensionWriter(BinaryWriter entriesWriter, int extensionId, Action incrementEntryCount) { _entriesWriter = entriesWriter; _extensionId = extensionId; _incrementEntryCount = incrementEntryCount; } public void WriteChunk(int subIndex, Action write) { using MemoryStream memoryStream = new MemoryStream(); using BinaryWriter obj = new BinaryWriter(memoryStream); write(obj); if (memoryStream.Length != 0) { _entriesWriter.Write((byte)250); _entriesWriter.Write(_extensionId); _entriesWriter.Write(subIndex); _entriesWriter.Write((int)memoryStream.Length); _entriesWriter.Write(memoryStream.ToArray()); _incrementEntryCount?.Invoke(); } } } public sealed class ArchiveBuilder { private readonly ZipArchive _zip; private readonly string _modId; internal ArchiveBuilder(ZipArchive zip, string modId) { _zip = zip; _modId = modId; } public void AddFile(string path, byte[] data, CompressionLevel level = CompressionLevel.Optimal) { ZipArchiveEntry zipArchiveEntry = _zip.CreateEntry("extensions/" + _modId + "/" + path, level); using Stream stream = zipArchiveEntry.Open(); stream.Write(data, 0, data.Length); } } public sealed class ArchiveReader { private readonly ZipArchive _zip; private readonly string _modId; internal ArchiveReader(ZipArchive zip, string modId) { _zip = zip; _modId = modId; } private string GetFullPath(string relativePath) { return "extensions/" + _modId + "/" + relativePath; } public bool TryGetFile(string relativePath, out byte[] data) { ZipArchiveEntry entry = _zip.GetEntry(GetFullPath(relativePath)); if (entry == null) { data = null; return false; } using Stream stream = entry.Open(); using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); data = memoryStream.ToArray(); return true; } public bool FileExists(string relativePath) { return _zip.GetEntry(GetFullPath(relativePath)) != null; } } private static readonly List _extensions = new List(); private static readonly Dictionary> _frameReaders = new Dictionary>(); private static readonly Dictionary> _frameWriters = new Dictionary>(); public static bool IsRecording => Main.Recording.isRecording; public static bool IsBuffering => Main.Recording.isBuffering; public static bool IsPlaying => Main.Playback.isPlaying; public static bool IsPaused => Main.Playback.isPaused; public static float CurrentTime => Main.Playback.elapsedPlaybackTime; public static float Duration => (Main.Playback.currentReplay?.Header?.Duration).GetValueOrDefault(); public static Version FormatVersion => new Version("1.1.0"); public static string RootFolder => ReplayFiles.explorer.RootPath; public static string CurrentFolder => ReplayFiles.explorer.CurrentFolderPath; public static IReadOnlyList Entries => ReplayFiles.explorer.currentReplayEntries; public static ReplayExplorer.Entry SelectedEntry => ReplayFiles.explorer.currentlySelectedEntry; public static int ExplorerCurrentPage { get { return ReplayFiles.explorer.currentPage; } set { ReplayFiles.explorer.currentPage = value; } } public static int PageCount => ReplayFiles.explorer.pageCount; public static IReadOnlyList Players => Main.Playback.PlaybackPlayers; public static IReadOnlyList PlayerPool => Main.Playback.playerPool; public static IReadOnlyList Structures => Main.Playback.PlaybackStructures; public static ReplayInfo CurrentReplay => Main.Playback.currentReplay; internal static IEnumerable Extensions => _extensions; public static event Action onReplaySelected; public static event Action onExplorerFolderChanged; public static event Action onExplorerRefreshed; public static event Action onReplayStarted; public static event Action onReplayEnded; public static event Action onRecordingStarted; public static event Action onRecordingStopped; public static event Action onReplayTimeChanged; public static event Action onReplayPauseChanged; public static event Action OnPlaybackFrame; public static event Action OnRecordFrame; public static event Action onReplaySaved; public static event Action onReplayDeleted; public static event Action onReplayRenamed; internal static void ReplaySelectedInternal(ReplayExplorer.Entry entry, string path) { ReplayAPI.onReplaySelected?.Invoke(entry, path); } internal static void ExplorerFolderChangedInternal(string path) { ReplayAPI.onExplorerFolderChanged?.Invoke(path); } internal static void ExplorerRefreshedInternal() { ReplayAPI.onExplorerRefreshed?.Invoke(); } internal static void ReplayStartedInternal(ReplayInfo info) { ReplayAPI.onReplayStarted?.Invoke(info); } internal static void ReplayEndedInternal(ReplayInfo info) { ReplayAPI.onReplayEnded?.Invoke(info); } internal static void RecordingStartedInternal() { ReplayAPI.onRecordingStarted?.Invoke(); } internal static void RecordingStoppedInternal() { ReplayAPI.onRecordingStopped?.Invoke(); } internal static void ReplayTimeChangedInternal(float time) { ReplayAPI.onReplayTimeChanged?.Invoke(time); } internal static void ReplayPauseChangedInternal(bool paused) { ReplayAPI.onReplayPauseChanged?.Invoke(paused); } internal static void OnPlaybackFrameInternal(Frame frame, Frame nextFrame) { ReplayAPI.OnPlaybackFrame?.Invoke(frame, nextFrame); } internal static void OnRecordFrameInternal(Frame frame, bool isBuffer) { ReplayAPI.OnRecordFrame?.Invoke(frame, isBuffer); } internal static void ReplaySavedInternal(ReplayInfo info, bool isBuffer, string path) { ReplayAPI.onReplaySaved?.Invoke(info, isBuffer, path); } internal static void ReplayDeletedInternal(string path) { ReplayAPI.onReplayDeleted?.Invoke(path); } internal static void ReplayRenamedInternal(ReplaySerializer.ReplayHeader header, string newPath) { ReplayAPI.onReplayRenamed?.Invoke(header, newPath); } public static bool SelectEntry(int index) { return ReplayFiles.explorer.Select(index); } public static void Enter(string path) { ReplayFiles.explorer.Enter(path); } public static void GoUp() { ReplayFiles.explorer.GoUp(); } public static void Refresh() { ReplayFiles.explorer.Refresh(); ReplayFiles.RefreshUI(); } public static IReadOnlyList GetPage() { return ReplayFiles.explorer.GetPage(); } public static string GetMetadataFormat(string sceneName) { return ReplayFiles.GetMetadataFormat(sceneName); } public static string FormatReplayTemplate(string template, ReplaySerializer.ReplayHeader replayInfo) { return ReplayFormatting.FormatReplayString(template, replayInfo); } public static string GetReplayDisplayName(string replayPath, ReplaySerializer.ReplayHeader replayInfo, string alternativeName = null, bool displayTitle = true) { return ReplayFormatting.GetReplayDisplayName(replayPath, replayInfo, alternativeName, displayTitle); } public static void Play(string path) { Main.Playback.LoadReplay(path); } public static void LoadSelectedReplay() { Main.instance.LoadSelectedReplay(); } public static void Stop() { Main.Playback.StopReplay(); } public static void StartRecording() { Main.Recording.StartRecording(); } public static void StopRecording() { Main.Recording.StopRecording(); } public static void StartBuffering() { Main.Recording.StartBuffering(); } public static void SaveBuffer() { Main.Recording.SaveReplayBuffer(); } public static void TogglePlayback(bool playing) { Main.Playback.TogglePlayback(playing); } public static void Seek(float time) { Main.Playback.SetPlaybackTime(time); } public static void Seek(int frame) { Main.Playback.SetPlaybackFrame(frame); } public static void SetSpeed(float speed) { Main.Playback.SetPlaybackSpeed(speed); } public static int ComputeStableId(string input) { int num = -2128831035; foreach (char c in input) { num ^= c; num *= 16777619; } return num; } public static ReplayExtension RegisterExtension(ReplayExtension extension) { if (_extensions.Any((ReplayExtension e) => e.Id == extension.Id)) { ((MelonBase)Main.instance).LoggerInstance.Error("Extension with an ID `" + extension.Id + "` already registered"); return null; } _extensions.Add(extension); ((MelonBase)Main.instance).LoggerInstance.Msg("Extension '" + extension.Id + "' created"); return extension; } internal static void InvokeArchiveBuild(ZipArchive zip) { foreach (ReplayExtension extension in Extensions) { ArchiveBuilder builder = new ArchiveBuilder(zip, extension.Id); extension.OnBuild(builder); } } internal static void InvokeArchiveRead(ZipArchive zip) { foreach (ReplayExtension extension in Extensions) { ArchiveReader reader = new ArchiveReader(zip, extension.Id); extension.OnRead(reader); } } } public abstract class ReplayExtension { public abstract string Id { get; } public MelonPreferences_Category Settings { get; internal set; } public MelonPreferences_Entry Enabled { get; internal set; } public bool IsEnabled => Enabled.Value; public int FrameExtensionId => ReplayAPI.ComputeStableId(Id); public virtual void OnBuild(ReplayAPI.ArchiveBuilder builder) { } public virtual void OnRead(ReplayAPI.ArchiveReader reader) { } public virtual void OnRecordFrame(Frame frame, bool isBuffer) { } public virtual void OnWriteFrame(ReplayAPI.FrameExtensionWriter writer, Frame frame) { } public virtual void OnReadFrame(BinaryReader reader, Frame frame, int index) { } public virtual void OnPlaybackFrame(Frame frame, Frame nextFrame) { } } public static class ReplayCache { public static Dictionary NameToStackType = new Dictionary(StringComparer.OrdinalIgnoreCase) { { "RockSlide", StackType.Dash }, { "Jump", StackType.Jump }, { "Flick", StackType.Flick }, { "Parry", StackType.Parry }, { "HoldLeft", StackType.HoldLeft }, { "HoldRight", StackType.HoldRight }, { "Stomp", StackType.Ground }, { "Straight", StackType.Straight }, { "Uppercut", StackType.Uppercut }, { "Kick", StackType.Kick }, { "Explode", StackType.Explode } }; public static readonly Dictionary AudioCallToFX = new Dictionary { { "Call_Structure_Impact_Light", FXOneShotType.ImpactLight }, { "Call_Structure_Impact_Medium", FXOneShotType.ImpactMedium }, { "Call_Structure_Impact_Heavy", FXOneShotType.ImpactHeavy }, { "Call_Structure_Impact_Massive", FXOneShotType.ImpactMassive }, { "Call_Structure_Ground", FXOneShotType.GroundedSFX }, { "Call_RockCam_Spawn", FXOneShotType.RockCamSpawn }, { "Call_RockCam_Despawn", FXOneShotType.RockCamDespawn }, { "Call_RockCam_Stick", FXOneShotType.RockCamStick }, { "Call_Bodyhit_Hard", FXOneShotType.Fistbump }, { "Call_FistBumpBonus", FXOneShotType.FistbumpGoin } }; public static readonly Dictionary VFXNameToFX = new Dictionary { { "StructureCollision_VFX", FXOneShotType.StructureCollision }, { "Ricochet_VFX", FXOneShotType.Ricochet }, { "VFX_Dust_Modifier_Ground", FXOneShotType.Grounded }, { "VFX_Dust_Modifier_Unground", FXOneShotType.Ungrounded }, { "VFX_Dust_Structure_Impact", FXOneShotType.DustImpact }, { "VFX_Dust_Structure_Spawn", FXOneShotType.Spawn }, { "VFX_Dust_Structure_Break", FXOneShotType.Break }, { "RockCamSpawn_VFX", FXOneShotType.RockCamSpawn }, { "RockCamDespawn_VFX", FXOneShotType.RockCamDespawn }, { "PlayerBoxInteractionVFX", FXOneShotType.Fistbump }, { "FistbumpCoin", FXOneShotType.FistbumpGoin }, { "Hitmarker", FXOneShotType.Hitmarker } }; public static readonly Dictionary FXToVFXName = new Dictionary { { FXOneShotType.StructureCollision, "StructureCollision_VFX" }, { FXOneShotType.Ricochet, "Ricochet_VFX" }, { FXOneShotType.Grounded, "Ground_VFX" }, { FXOneShotType.Ungrounded, "Unground_VFX" }, { FXOneShotType.DustImpact, "DustImpact_VFX" }, { FXOneShotType.Spawn, "DustSpawn_VFX" }, { FXOneShotType.Break, "DustBreak_VFX" }, { FXOneShotType.RockCamSpawn, "RockCamSpawn_VFX" }, { FXOneShotType.RockCamDespawn, "RockCamDespawn_VFX" }, { FXOneShotType.Fistbump, "PlayerBoxInteractionVFX" }, { FXOneShotType.FistbumpGoin, "PlayerFistBumpBonusVFX" }, { FXOneShotType.Jump, "Jump_VFX" }, { FXOneShotType.Dash, "Dash_VFX" } }; public static readonly Dictionary FXToSFXName = new Dictionary { { FXOneShotType.ImpactLight, "Call_Structure_Impact_Light" }, { FXOneShotType.ImpactMedium, "Call_Structure_Impact_Medium" }, { FXOneShotType.ImpactHeavy, "Call_Structure_Impact_Heavy" }, { FXOneShotType.ImpactMassive, "Call_Structure_Impact_Massive" }, { FXOneShotType.GroundedSFX, "Call_Structure_Ground" }, { FXOneShotType.RockCamSpawn, "Call_RockCam_Spawn" }, { FXOneShotType.RockCamDespawn, "Call_RockCam_Despawn" }, { FXOneShotType.RockCamStick, "Call_RockCam_Stick" }, { FXOneShotType.Fistbump, "Call_Bodyhit_Hard" }, { FXOneShotType.FistbumpGoin, "Call_FistBumpBonus" } }; public static Dictionary> structurePools; public static Dictionary SFX; public static void BuildCacheTables() { structurePools = new Dictionary>(); SFX = new Dictionary(); foreach (Pool item in (Il2CppArrayBase>)(object)Singleton.instance.availablePools) { string resourceName = item.poolItem.resourceName; if (resourceName.Contains("RockCube")) { structurePools[StructureType.Cube] = item; } else if (resourceName.Contains("PrisonedPillar")) { structurePools[StructureType.PrisonedPillar] = item; } else if (resourceName.Contains("WrappedWall")) { structurePools[StructureType.WrappedWall] = item; } else if (resourceName.Contains("DockedDisk")) { structurePools[StructureType.DockedDisk] = item; } else if (resourceName.Contains("CageCube")) { structurePools[StructureType.CageCube] = item; } else if (resourceName.Contains("Pillar")) { structurePools[StructureType.Pillar] = item; } else if (resourceName.Contains("Disc")) { structurePools[StructureType.Disc] = item; } else if (resourceName.Contains("Wall")) { structurePools[StructureType.Wall] = item; } else if (resourceName == "Ball") { structurePools[StructureType.Ball] = item; } else if (resourceName.Contains("LargeRock")) { structurePools[StructureType.LargeRock] = item; } else if (resourceName.Contains("SmallRock")) { structurePools[StructureType.SmallRock] = item; } else if (resourceName.Contains("BoulderBall")) { structurePools[StructureType.CagedBall] = item; structurePools[StructureType.TetheredCagedBall] = item; } else if (resourceName.Contains("StructureTarget")) { structurePools[StructureType.Target] = item; } } AudioCall[] array = Il2CppArrayBase.op_Implicit(Resources.FindObjectsOfTypeAll()); AudioCall[] array2 = array; foreach (AudioCall val in array2) { if (!((Object)(object)val == (Object)null) && !string.IsNullOrEmpty(((Object)val).name)) { SFX[((Object)val).name] = val; } } } } public static class ReplayVoices { public class VoiceStreamWriter : IDisposable { public readonly int VoiceId; public readonly string Path; private readonly FileStream _fileStream; private readonly IOpusEncoder _encoder; private readonly OpusOggWriteStream _wav; public bool HasFrames { get; private set; } public float LastWriteTimestamp { get; private set; } public int SampleRate { get; private set; } public int Channels { get; private set; } public VoiceStreamWriter(int voiceId, int sampleRate, int channels, string path, int bitrate = 30000, int complexity = 8, float initalTimeStamp = 0f) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown LastWriteTimestamp = Time.time; VoiceId = voiceId; Path = path; SampleRate = sampleRate; Channels = channels; _fileStream = File.Create(path); _encoder = OpusCodecFactory.CreateEncoder(sampleRate, channels, (OpusApplication)2048, (TextWriter)null); _encoder.Bitrate = bitrate; _encoder.Complexity = complexity; _encoder.SignalType = (OpusSignal)3001; OpusTags val = new OpusTags(); val.Fields.Add("Type", "Rumble ReplayMod Captured Voice"); val.Fields.Add("Origin", "https://github.com/xLoadingx/ReplayMod"); val.Fields.Add("Encoder", "https://github.com/lostromb/concentus"); _wav = new OpusOggWriteStream(_encoder, (Stream)_fileStream, val, 0, 5, false); } public void Write(float[] samples) { if (samples != null && samples.Length != 0) { HasFrames = true; int num = (int)((Time.time - LastWriteTimestamp) * (float)SampleRate); if (num >= SampleRate / 8) { Main.DebugLog($"Voice {VoiceId} silent for {Time.time - LastWriteTimestamp} seconds or {num} samples"); _wav.WriteSamples(new float[num], 0, num); } _wav.WriteSamples(samples, 0, samples.Length); LastWriteTimestamp = Time.time; } } public void Dispose() { _wav.Finish(); _fileStream?.Dispose(); } } private static PunVoiceClient voice; private static readonly Dictionary<(int actorId, int voiceId), VoiceStreamWriter> writers = new Dictionary<(int, int), VoiceStreamWriter>(); public static string VoiceCacheDir = Path.Combine(MelonEnvironment.UserDataDirectory, "ReplayMod", "VoiceCache"); public static List VoiceTrackInfos = new List(); public static bool isRecording; private static bool subscribed; public static bool HasActiveWriters => writers.Count > 0; public static void StartRecording() { if (!Main.instance.VoiceRecording.Value) { return; } isRecording = true; VoiceTrackInfos.Clear(); if (Directory.Exists(VoiceCacheDir)) { string[] files = Directory.GetFiles(VoiceCacheDir); foreach (string path in files) { File.Delete(path); } } else { Directory.CreateDirectory(VoiceCacheDir); } PunVoiceClient instance = PunVoiceClient.instance; if (instance != null) { if (!subscribed) { ((VoiceConnection)instance).RemoteVoiceAdded = ((VoiceConnection)instance).RemoteVoiceAdded + Action.op_Implicit((Action)OnRemoteVoiceLinkAdded); subscribed = true; } if (((Il2CppArrayBase)(object)((Il2CppObjectBase)((VoiceConnection)instance).VoiceClient.LocalVoices).Cast>()).Length == 0) { Main.DebugLog("Local voices is empty"); } Enumerator enumerator = ((VoiceConnection)instance).cachedRemoteVoices.GetEnumerator(); while (enumerator.MoveNext()) { RemoteVoiceLink current = enumerator.Current; OnRemoteVoiceLinkAdded(current); } Directory.CreateDirectory(VoiceCacheDir); } } public static void StopRecording() { isRecording = false; foreach (var item in writers.Keys.ToList()) { stopWriter(item.actorId, item.voiceId); } } public static AudioClip LoadVoiceClipFromFile(string path) { byte[] data = File.ReadAllBytes(path); int sampleRate; int channels; float[] array = DecodeOpus(data, out sampleRate, out channels); AudioClip val = AudioClip.Create(Path.GetFileNameWithoutExtension(path), array.Length / channels, channels, sampleRate, false); ((Object)val).hideFlags = (HideFlags)32; val.SetData(Il2CppStructArray.op_Implicit(array), 0); return val; } public static float[] DecodeOpus(byte[] data, out int sampleRate, out int channels) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown using MemoryStream memoryStream = new MemoryStream(data); IOpusDecoder val = OpusCodecFactory.CreateDecoder(48000, 1, (TextWriter)null); OpusOggReadStream val2 = new OpusOggReadStream(val, (Stream)memoryStream); sampleRate = 48000; channels = 1; List list = new List(); while (val2.HasNextPacket) { short[] array = val2.DecodeNextPacket(); if (array != null) { for (int i = 0; i < array.Length; i++) { list.Add((float)array[i] / 32768f); } } } return list.ToArray(); } public static void Cleanup() { VoiceTrackInfos.Clear(); if (Directory.Exists(VoiceCacheDir)) { Directory.Delete(VoiceCacheDir, recursive: true); } } private static void stopWriter(int actorId, int voiceId) { if (writers.Remove((actorId, voiceId), out var value)) { value.Dispose(); if (!value.HasFrames && File.Exists(value.Path)) { File.Delete(value.Path); } } } public static void OnRemoteVoiceLinkAdded(RemoteVoiceLink link) { if (!isRecording) { return; } int playerId = link.PlayerId; int voiceId = link.VoiceId; float startTime = Time.time - Main.Recording.recordingStartTime; Main.DebugLog($"VoiceAdded actor={playerId} voice={voiceId}"); Player val = ((IEnumerable)Singleton.instance.AllPlayers.ToArray()).FirstOrDefault((Func)((Player p) => p.Data.GeneralData.ActorNo == playerId)); string name = ((val != null) ? val.Data.GeneralData.PublicUsername : null) ?? "Unknown"; string masterId = ((val != null) ? val.Data.GeneralData.PlayFabMasterId : null); name = Utilities.CleanName(name); RemoteVoiceLink obj = link; obj.FloatFrameDecoded += Action>.op_Implicit((Action>)delegate(FrameOut frame) { if (isRecording) { if (!writers.TryGetValue((playerId, voiceId), out var value)) { string text = $"p{name}_{masterId}_v{voiceId}_{Time.frameCount}.ogg"; string path = Path.Combine(VoiceCacheDir, text); value = new VoiceStreamWriter(voiceId, link.VoiceInfo.SamplingRate, link.VoiceInfo.Channels, path, Mathf.Clamp(Main.instance.voiceBitrate.Value, 8, 128), 8, startTime); writers.Add((playerId, voiceId), value); VoiceTrackInfos.Add(new VoiceTrackInfo(masterId, playerId, voiceId, text, startTime)); } value.Write(Il2CppArrayBase.op_Implicit(frame.Buf)); } }); RemoteVoiceLink obj2 = link; obj2.RemoteVoiceRemoved += Action.op_Implicit((Action)delegate { stopWriter(playerId, voiceId); }); } } public static class Utilities { private static GameObject customMultiplayerMaps; public static string GetFriendlySceneName(string scene) { if (1 == 0) { } string result = ((scene == "Map0") ? "Ring" : ((!(scene == "Map1")) ? scene : "Pit")); if (1 == 0) { } return result; } public static string GetActiveCustomMapName() { if (customMultiplayerMaps == null) { customMultiplayerMaps = GameObject.Find("CustomMultiplayerMaps"); } if ((Object)(object)customMultiplayerMaps == (Object)null) { return null; } for (int i = 0; i < customMultiplayerMaps.transform.childCount; i++) { Transform child = customMultiplayerMaps.transform.GetChild(i); if (((Component)child).gameObject.activeInHierarchy) { return ((Object)child).name; } } return null; } public static string[] RebuildCustomMapFromScene() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_00bb: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("CustomMapParent"); if ((Object)(object)val == (Object)null) { return null; } List list = new List(); list.Add("1"); list.Add(val.transform.childCount.ToString()); for (int i = 0; i < val.transform.childCount; i++) { Transform child = val.transform.GetChild(i); string name = ((Object)child).name; Color val2 = Color.white; Renderer component = ((Component)child).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.material != (Object)null && component.material.HasProperty("_Color")) { val2 = component.material.color; } Vector3 position = child.position; Quaternion rotation = child.rotation; Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles; Vector3 localScale = child.localScale; list.Add(name); list.Add(val2.r.ToString(CultureInfo.InvariantCulture)); list.Add(val2.g.ToString(CultureInfo.InvariantCulture)); list.Add(val2.b.ToString(CultureInfo.InvariantCulture)); list.Add(position.x.ToString(CultureInfo.InvariantCulture)); list.Add(position.y.ToString(CultureInfo.InvariantCulture)); list.Add(position.z.ToString(CultureInfo.InvariantCulture)); list.Add(eulerAngles.x.ToString(CultureInfo.InvariantCulture)); list.Add(eulerAngles.y.ToString(CultureInfo.InvariantCulture)); list.Add(eulerAngles.z.ToString(CultureInfo.InvariantCulture)); list.Add(localScale.x.ToString(CultureInfo.InvariantCulture)); list.Add(localScale.y.ToString(CultureInfo.InvariantCulture)); list.Add(localScale.z.ToString(CultureInfo.InvariantCulture)); } return list.ToArray(); } public static GameObject GetCustomMap(string mapName) { //IL_002e: 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_007c: 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) if (customMultiplayerMaps == null) { customMultiplayerMaps = GameObject.Find("CustomMultiplayerMaps"); } if ((Object)(object)customMultiplayerMaps == (Object)null) { Main.ReplayError("Selected replay uses a custom map, but custom maps are not installed."); return null; } Transform obj = customMultiplayerMaps.transform.Find(mapName); GameObject val = ((obj != null) ? ((Component)obj).gameObject : null); if ((Object)(object)val == (Object)null) { Main.ReplayError("Could not find the custom map '" + mapName + "."); return null; } return val; } public static string CleanName(string name) { if (string.IsNullOrWhiteSpace(name)) { return "Unknown"; } string text = Regex.Replace(name, "<.*?>", string.Empty); StringBuilder stringBuilder = new StringBuilder(text.Length); string text2 = text; foreach (char c in text2) { if (!char.IsSurrogate(c)) { stringBuilder.Append(c); } } text = stringBuilder.ToString(); char[] invalidFileNameChars = Path.GetInvalidFileNameChars(); foreach (char c2 in invalidFileNameChars) { text = text.Replace(c2.ToString(), ""); } text = Regex.Replace(text, "\\s+", " ").Trim(); text = text.Replace("\\", "_").Replace("/", "_"); return string.IsNullOrEmpty(text) ? "Unknown" : text; } public static bool IsReplayClone(PlayerController controller) { if ((Object)(object)controller == (Object)null || Main.Playback.PlaybackPlayers == null) { return false; } return Object.op_Implicit((Object)(object)((Component)controller).GetComponent()); } public static IEnumerable EnumerateMatchPedestals() { return from p in ((IEnumerable)Object.FindObjectsOfType(true)).Where(delegate(Pedestal p) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Scene scene = ((Component)p).gameObject.scene; return ((Scene)(ref scene)).buildIndex != -1; }) select ((Component)p).gameObject; } public static IEnumerator LoadMap(int index, float fadeDuration = 2f, Action onLoaded = null, float onLoadedDelay = 0.01f) { SceneSingleton.instance.CleanStructureList(); foreach (Structure structure in SceneSingleton.instance.structures.ToArray()) { if (!((Object)(object)structure == (Object)null)) { try { structure.Kill(Vector3.zero, false, false, true); } catch { } } } Singleton.instance.LoadSceneAsync(index, false, false, fadeDuration, (LoadSceneMode)0, (AudioCall)null); while (Singleton.instance.IsLoadingScene) { yield return null; } yield return (object)new WaitForSeconds(onLoadedDelay); onLoaded?.Invoke(); } public static bool HasVFXType(string type, Transform obj) { Il2CppArrayBase componentsInChildren = ((Component)obj).GetComponentsInChildren(); foreach (ReplayPlayback.ReplayTag item in componentsInChildren) { if (item.Type == type) { return true; } } return false; } public static Vector3 GetPositionOverMesh(float a, float b, MeshRenderer renderer) { //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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_004c: 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) float num = Mathf.Clamp01(a / b); Bounds localBounds = ((Renderer)renderer).localBounds; float x = Mathf.Lerp(((Bounds)(ref localBounds)).min.x, ((Bounds)(ref localBounds)).max.x, num); Vector3 center = ((Bounds)(ref localBounds)).center; center.x = x; return ((Component)renderer).transform.TransformPoint(center); } public static float GetProgressFromMeshPosition(Vector3 worldPos, MeshRenderer renderer) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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) Vector3 val = ((Component)renderer).transform.InverseTransformPoint(worldPos); Bounds localBounds = ((Renderer)renderer).localBounds; float x = ((Bounds)(ref localBounds)).min.x; float x2 = ((Bounds)(ref localBounds)).max.x; if (Mathf.Approximately(x2, x)) { return 0f; } float num = Mathf.InverseLerp(x, x2, val.x); return Mathf.Clamp01(num); } public static Marker[] AddMarkers(ReplaySerializer.ReplayHeader header, MeshRenderer timelineRenderer, bool hideMarkers = true) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_0112: Unknown result type (might be due to invalid IL or missing references) foreach (ReplayPlayback.ReplayTag componentsInChild in ((Component)((Component)timelineRenderer).transform).GetComponentsInChildren()) { Object.Destroy((Object)(object)((Component)componentsInChild).gameObject); } if (header.Markers == null) { return null; } Marker[] markers = header.Markers; Marker[] array = markers; Color val2 = default(Color); foreach (Marker marker in array) { Vector3 positionOverMesh = GetPositionOverMesh(marker.time, header.Duration, timelineRenderer); GameObject val = Object.Instantiate(ReplayPlaybackControls.markerPrefab, ((Component)timelineRenderer).transform); if (!hideMarkers) { val.layer = LayerMask.NameToLayer("Default"); } val.transform.localScale = new Vector3(0.0062f, 1.0836f, 0.0128f); val.transform.position = positionOverMesh; ((Color)(ref val2))..ctor(marker.r, marker.g, marker.b, 1f); ((Renderer)val.GetComponent()).material.SetColor("_Overlay", val2); val.AddComponent(); val.SetActive(true); } return markers; } public static string FormatBytes(long bytes) { if (!((double)bytes >= 1048576.0)) { if (!((double)bytes >= 1024.0)) { return $"{bytes} B"; } return $"{(double)bytes / 1024.0:0.##} KB"; } return $"{(double)bytes / 1048576.0:0.##} MB"; } public static float EaseInOut(float t) { return (t < 0.5f) ? (2f * t * t) : (1f - Mathf.Pow(-2f * t + 2f, 2f) / 2f); } public static float EaseOut(float t) { return 1f - Mathf.Pow(1f - t, 4f); } public static float EaseIn(float t) { return Mathf.Pow(t, 3f); } public static IEnumerator LerpValue(Func getter, Action setter, Func lerpFunc, T targetValue, float duration, Func easing = null, Action done = null, float delay = 0f, Func isValid = null) { yield return (object)new WaitForSeconds(delay); T startValue = getter(); float t = 0f; while (t < 1f) { if (isValid != null && !isValid()) { yield break; } t += Time.deltaTime / duration; float easedT = easing?.Invoke(Mathf.Clamp01(t)) ?? t; setter(lerpFunc(startValue, targetValue, easedT)); yield return null; } setter(targetValue); done?.Invoke(); } public static Color32 RandomColor() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_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_003a: Unknown result type (might be due to invalid IL or missing references) float value = Random.value; float num = Random.Range(0.6f, 0.9f); float num2 = Random.Range(0.7f, 1f); Color val = Color.HSVToRGB(value, num, num2); return Color32.op_Implicit(val); } public static T[] NewArray(int count, T[] copyFrom = null) where T : new() { T[] array = new T[count]; for (int i = 0; i < count; i++) { array[i] = ((copyFrom != null && i < copyFrom.Length) ? copyFrom[i] : new T()); } return array; } public static int GetPageCount(int itemCount, int pageSize) { return (itemCount + pageSize - 1) / pageSize; } public static string FormatPage(int currentPage, int pageCount) { return (pageCount == 0) ? "0 / 0" : $"{currentPage + 1} / {pageCount}"; } } [RegisterTypeInIl2Cpp] public class LookAtPlayer : MonoBehaviour { public bool lockX; public bool lockY; public bool lockZ; private void Update() { //IL_0016: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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) ((Component)this).transform.rotation = Quaternion.Euler(0f, 270f, 0f); Camera main = Camera.main; if (!Object.op_Implicit((Object)(object)main)) { return; } Vector3 val = ((Component)main).transform.position - ((Component)this).transform.position; if (!(((Vector3)(ref val)).sqrMagnitude < 0.0001f)) { Quaternion val2 = Quaternion.LookRotation(val, Vector3.up) * Quaternion.Euler(0f, 180f, 0f); Vector3 eulerAngles = ((Quaternion)(ref val2)).eulerAngles; Quaternion rotation = ((Component)this).transform.rotation; Vector3 eulerAngles2 = ((Quaternion)(ref rotation)).eulerAngles; if (lockX) { eulerAngles.x = eulerAngles2.x; } if (lockY) { eulerAngles.y = eulerAngles2.y; } if (lockZ) { eulerAngles.z = eulerAngles2.z; } ((Component)this).transform.rotation = Quaternion.Euler(eulerAngles); } } } [RegisterTypeInIl2Cpp] public class DeleteAfterSeconds : MonoBehaviour { public float destroyTime = 10f; private float spawnTime; public void Awake() { spawnTime = Main.Playback.elapsedPlaybackTime; } public void Update() { if (Mathf.Abs(Main.Playback.elapsedPlaybackTime - spawnTime) >= destroyTime) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } } namespace ReplayMod.Replay.UI { public static class ReplayCrystals { [RegisterTypeInIl2Cpp] public class Crystal : MonoBehaviour { public string ReplayPath; public string Title; public TextMeshPro titleText; public Color32 BaseColor; private Renderer rend; private MaterialPropertyBlock mpb; public bool isGrabbed; public bool isAnimation; public bool hasLeftTable; private Vector3 basePosition; private Vector3 velocity; private Vector3 lastPosition; private Vector3 angularVelocity; private Quaternion lastRotation; private bool hasSavedAfterRelease; private object scaleRoutine; private object positionRoutine; private bool isTextVisible; private void Awake() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) basePosition = ((Component)this).transform.position; lastPosition = ((Component)this).transform.position; } public CrystalState CaptureState() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) CrystalState result = default(CrystalState); result.ReplayPath = ReplayPath; result.Title = Title; result.x = ((Component)this).transform.position.x; result.y = ((Component)this).transform.position.y; result.z = ((Component)this).transform.position.z; result.BaseColor = BaseColor; return result; } public void RestoreState(CrystalState state) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) ReplayPath = state.ReplayPath; BaseColor = state.BaseColor; basePosition = new Vector3(state.x, state.y, state.z); ((Component)this).transform.position = basePosition; Title = state.Title; ((TMP_Text)titleText).text = state.Title; ((TMP_Text)titleText).ForceMeshUpdate(false, false); ApplyVisuals(); } public void ApplyVisuals() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) Color baseColor = Color32.op_Implicit(BaseColor); if ((Object)(object)rend == (Object)null) { rend = ((Component)this).GetComponent(); } if (mpb == null) { mpb = new MaterialPropertyBlock(); } ApplyBlockToRenderer(rend, baseColor); foreach (Renderer componentsInChild in ((Component)this).GetComponentsInChildren(true)) { if (!((Object)(object)componentsInChild == (Object)(object)rend)) { ApplyBlockToRenderer(componentsInChild, baseColor); } } } private void ApplyBlockToRenderer(Renderer r, Color baseColor) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)r == (Object)null)) { mpb.Clear(); mpb.SetColor("_Base_Color", baseColor); mpb.SetColor("_Edge_Color", DeriveEdge(baseColor)); mpb.SetColor("_Shadow_Color", DeriveShadow(baseColor)); r.SetPropertyBlock(mpb); } } public void ShowText() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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) Animate(Vector3.one * 0.02f, new Vector3(0f, 0f, 0.0049f)); isTextVisible = true; } public void HideText() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) Animate(Vector3.zero, Vector3.zero); isTextVisible = false; } private void Animate(Vector3 scale, Vector3 position) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) if (scaleRoutine != null) { MelonCoroutines.Stop(scaleRoutine); } scaleRoutine = MelonCoroutines.Start(Utilities.LerpValue((Func)(() => titleText.transform.localScale), (Action)delegate(Vector3 v) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) titleText.transform.localScale = v; }, (Func)Vector3.Lerp, scale, 0.5f, (Func)Utilities.EaseInOut, (Action)null, 0f, (Func)(() => (Object)(object)titleText.transform != (Object)null))); if (positionRoutine != null) { MelonCoroutines.Stop(positionRoutine); } positionRoutine = MelonCoroutines.Start(Utilities.LerpValue((Func)(() => titleText.transform.localPosition), (Action)delegate(Vector3 v) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) titleText.transform.localPosition = v; }, (Func)Vector3.Lerp, position, 0.5f, (Func)Utilities.EaseInOut, (Action)null, 0f, (Func)(() => (Object)(object)titleText.transform != (Object)null))); } public void Grab() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (!isGrabbed && !isAnimation) { isGrabbed = true; hasLeftTable = true; hasSavedAfterRelease = false; velocity = Vector3.zero; HideText(); } } public void Release() { if (isGrabbed) { isGrabbed = false; } } private void Update() { //IL_003c: 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_004d: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_00e2: Unknown result type (might be due to invalid IL or missing references) if (!isAnimation) { if (!isGrabbed) { ApplyThrowVelocity(); HandleProximity(); } else { basePosition = ((Component)this).transform.position; velocity = (((Component)this).transform.position - lastPosition) / Time.deltaTime; Quaternion rotation = ((Component)this).transform.rotation; Quaternion val = rotation * Quaternion.Inverse(lastRotation); float num = default(float); Vector3 val2 = default(Vector3); ((Quaternion)(ref val)).ToAngleAxis(ref num, ref val2); if (num > 180f) { num -= 360f; } angularVelocity = val2 * (num * Mathf.Deg2Rad) / Time.deltaTime; lastRotation = rotation; } lastPosition = ((Component)this).transform.position; } else { HideText(); } } private void HandleProximity() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) Transform head = Main.instance.head; if (!((Object)(object)head == (Object)null)) { float num = Vector3.Distance(head.position, ((Component)this).transform.position); if (!isTextVisible && num < 2f) { isTextVisible = true; ShowText(); } else if (isTextVisible && num > 2.2f) { isTextVisible = false; HideText(); } } } private void ApplyThrowVelocity() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_004b: 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_0142: 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_0168: 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_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) if (((Vector3)(ref velocity)).sqrMagnitude < 0.001f && ((Vector3)(ref angularVelocity)).sqrMagnitude < 0.001f) { if (!hasSavedAfterRelease) { SaveCrystals(); hasSavedAfterRelease = true; } velocity = Vector3.zero; return; } basePosition += velocity * Time.deltaTime; velocity = Vector3.Lerp(velocity, Vector3.zero, 8f * Time.deltaTime); ((Component)this).transform.position = basePosition; float num = ((Vector3)(ref angularVelocity)).magnitude * Time.deltaTime; if (num > 0f) { ((Component)this).transform.rotation = Quaternion.AngleAxis(num * Mathf.Rad2Deg, ((Vector3)(ref angularVelocity)).normalized) * ((Component)this).transform.rotation; } angularVelocity = Vector3.Lerp(angularVelocity, Vector3.zero, 8f * Time.deltaTime); if (((Vector3)(ref angularVelocity)).sqrMagnitude < 0.0005f) { float num2 = Quaternion.Angle(((Component)this).transform.rotation, Quaternion.Euler(-90f, 0f, 0f)); float num3 = Quaternion.Angle(((Component)this).transform.rotation, Quaternion.Euler(90f, 0f, 0f)); if (num2 < 5f || num3 < 5f) { Quaternion val = ((num2 < num3) ? Quaternion.Euler(-90f, 0f, 0f) : Quaternion.Euler(90f, 0f, 0f)); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val, 8f * Time.deltaTime); } } } private static Color DeriveEdge(Color baseColor) { //IL_0001: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(baseColor, ref num, ref num2, ref num3); return Color.HSVToRGB(num, Mathf.Clamp01(num2 + 0.05f), Mathf.Clamp01(num3 + 0.35f)); } private static Color DeriveShadow(Color baseColor) { //IL_0001: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(baseColor, ref num, ref num2, ref num3); return Color.HSVToRGB(num, Mathf.Clamp01(num2 - 0.25f), Mathf.Clamp01(num3 - 0.4f)); } } [Serializable] public struct CrystalState { public string ReplayPath; public string Title; public float x; public float y; public float z; public Color32 BaseColor; } public static GameObject crystalPrefab; public static GameObject crystalParent; public static List Crystals = new List(); public static Crystal heldCrystal; public static bool isHeldByRight; public static VisualEffect crystalizeVFX; public static (string path, Color32 color) lastReplayColor = default((string, Color32)); public static void HandleCrystals() { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)heldCrystal != (Object)null && ((isHeldByRight && RightController.GetGrip() < 0.5f) || (!isHeldByRight && LeftController.GetGrip() < 0.5f))) { heldCrystal.Release(); ((Component)heldCrystal).transform.SetParent(crystalParent.transform, true); heldCrystal = null; } else { if (!((Object)(object)heldCrystal == (Object)null) || !Main.isSceneReady) { return; } if (RightController.GetGrip() > 0.5f) { Crystal crystal = FindClosestCrystal(Main.instance.rightHand.position, 0.1f); if ((Object)(object)crystal != (Object)null) { heldCrystal = crystal; isHeldByRight = true; crystal.Grab(); ((Component)crystal).transform.SetParent(((Component)Main.instance.rightHand).transform, true); } } else if (LeftController.GetGrip() > 0.5f) { Crystal crystal2 = FindClosestCrystal(Main.instance.leftHand.position, 0.1f); if ((Object)(object)crystal2 != (Object)null) { heldCrystal = crystal2; isHeldByRight = false; crystal2.Grab(); ((Component)crystal2).transform.SetParent(((Component)Main.instance.leftHand).transform, true); } } } } public static void LoadCrystals(string scene = null) { if (string.IsNullOrEmpty(scene)) { scene = Main.currentScene; } string path = Path.Combine(MelonEnvironment.UserDataDirectory, "ReplayMod", "Settings", "replayCrystals.json"); if (!File.Exists(path)) { return; } string text = File.ReadAllText(path); Dictionary dictionary = JsonConvert.DeserializeObject>(text); if (dictionary != null && dictionary.TryGetValue(scene, out var value)) { Crystals = new List(); CrystalState[] array = value; foreach (CrystalState state in array) { CreateCrystal().RestoreState(state); } } } public static void SaveCrystals(string scene = null) { if (string.IsNullOrEmpty(scene)) { scene = Main.currentScene; } string path = Path.Combine(MelonEnvironment.UserDataDirectory, "ReplayMod", "Settings", "replayCrystals.json"); Dictionary dictionary = new Dictionary(); if (File.Exists(path)) { string text = File.ReadAllText(path); dictionary = JsonConvert.DeserializeObject>(text) ?? new Dictionary(); } if (Crystals == null) { return; } List list = new List(); foreach (Crystal crystal in Crystals) { if ((Object)(object)crystal != (Object)null) { list.Add(crystal.CaptureState()); } } dictionary[scene] = list.ToArray(); string contents = JsonConvert.SerializeObject((object)dictionary, (Formatting)1); File.WriteAllText(path, contents); } public static Crystal FindClosestCrystal(Vector3 handPos, float maxDistance) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) Crystal result = null; float num = maxDistance * maxDistance; foreach (Crystal crystal in Crystals) { if (!((Object)(object)((crystal != null) ? ((Component)crystal).transform : null) == (Object)null)) { Vector3 val = ((Component)crystal).transform.position - handPos; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = crystal; } } } return result; } public static Crystal CreateCrystal(Vector3 position, ReplaySerializer.ReplayHeader header, string path, bool useAnimation = false, bool applyRandomColor = false) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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_01a3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)crystalParent == (Object)null) { crystalParent = new GameObject("Crystals"); } Crystal crystal = Object.Instantiate(crystalPrefab, crystalParent.transform).AddComponent(); string text = (Path.GetFileNameWithoutExtension(path).StartsWith("Replay") ? header.Title : Path.GetFileNameWithoutExtension(path)); ((Object)crystal).name = $"Crystal ({text}, {header.Date})"; ((Component)crystal).transform.position = position; crystal.Title = text; GameObject val = Create.NewText(text, 1f, Color.white, Vector3.zero, Quaternion.identity); ((Object)val).name = "Replay Title"; val.transform.SetParent(((Component)crystal).transform, false); val.transform.localScale = Vector3.zero; val.transform.localRotation = Quaternion.Euler(0f, 270f, 270f); crystal.titleText = val.GetComponent(); ((Component)crystal.titleText).GetComponent().SetSizeWithCurrentAnchors((Axis)0, 2f); ((TMP_Text)crystal.titleText).horizontalAlignment = (HorizontalAlignmentOptions)2; ((TMP_Text)crystal.titleText).ForceMeshUpdate(false, false); LookAtPlayer lookAtPlayer = val.AddComponent(); lookAtPlayer.lockX = true; lookAtPlayer.lockZ = true; crystal.ReplayPath = ReplayFiles.explorer.CurrentReplayPath; if (applyRandomColor) { crystal.BaseColor = Utilities.RandomColor(); crystal.ApplyVisuals(); } ((Component)crystal).gameObject.SetActive(true); Crystals.Add(crystal); if (useAnimation) { MelonCoroutines.Start(CrystalSpawnAnimation(crystal)); } return crystal; } public static Crystal CreateCrystal() { //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) //IL_0061: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown if ((Object)(object)crystalParent == (Object)null) { crystalParent = new GameObject("Crystals"); } Crystal crystal = Object.Instantiate(crystalPrefab, crystalParent.transform).AddComponent(); crystal.hasLeftTable = true; ((Component)crystal).gameObject.SetActive(true); GameObject val = Create.NewText("", 1f, Color.white, Vector3.zero, Quaternion.identity); ((Object)val).name = "Replay Title"; val.transform.SetParent(((Component)crystal).transform, false); val.transform.localScale = Vector3.zero; val.transform.localRotation = Quaternion.Euler(0f, 270f, 270f); crystal.titleText = val.GetComponent(); ((Component)crystal.titleText).GetComponent().SetSizeWithCurrentAnchors((Axis)0, 2f); ((TMP_Text)crystal.titleText).horizontalAlignment = (HorizontalAlignmentOptions)2; ((TMP_Text)crystal.titleText).ForceMeshUpdate(false, false); LookAtPlayer lookAtPlayer = val.AddComponent(); lookAtPlayer.lockX = true; lookAtPlayer.lockZ = true; Crystals.Add(crystal); return crystal; } public static IEnumerator ReadCrystal(Crystal crystal) { crystal.isAnimation = true; lastReplayColor = (crystal.ReplayPath, crystal.BaseColor); Singleton.instance.Play(ReplayCache.SFX["Call_GearMarket_ButtonUnpress"], ((Component)crystal).transform.position, false); yield return Utilities.LerpValue((Func)(() => ((Component)crystal).transform.position), (Action)delegate(Vector3 v) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) ((Component)crystal).transform.position = v; }, (Func)Vector3.Lerp, ((Component)Main.instance.replayTable).transform.position + new Vector3(0f, 0.3045f, 0f), 1f, (Func)Utilities.EaseInOut, (Action)null, 0f, (Func)null); yield return (object)new WaitForSeconds(1f); Singleton.instance.Play(ReplayCache.SFX["Call_Phone_ScreenDown"], ((Component)crystal).transform.position, false); yield return Utilities.LerpValue((Func)(() => crystal.BaseColor), (Action)delegate(Color32 v) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) crystal.BaseColor = v; crystal.ApplyVisuals(); }, (Func)Color32.Lerp, new Color32((byte)50, (byte)50, (byte)50, byte.MaxValue), 1f, (Func)Utilities.EaseInOut, (Action)null, 0f, (Func)null); yield return (object)new WaitForSeconds(0.5f); Singleton.instance.Play(ReplayCache.SFX["Call_ToolTip_Close"], ((Component)crystal).transform.position, false); MelonCoroutines.Start(Utilities.LerpValue((Func)(() => ((Component)crystal).transform.position), (Action)delegate(Vector3 v) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) ((Component)crystal).transform.position = v; }, (Func)Vector3.Lerp, ((Component)Main.instance.replayTable).transform.position, 0.5f, (Func)Utilities.EaseInOut, (Action)null, 0f, (Func)null)); yield return Utilities.LerpValue((Func)(() => ((Component)crystal).transform.localScale), (Action)delegate(Vector3 v) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) ((Component)crystal).transform.localScale = v; }, (Func)Vector3.Lerp, Vector3.zero, 0.5f, (Func)Utilities.EaseInOut, (Action)delegate { //IL_0063: Unknown result type (might be due to invalid IL or missing references) int num = ReplayFiles.explorer.currentReplayEntries.FindIndex((ReplayExplorer.Entry e) => e.FullPath == crystal.ReplayPath); if (num != -1) { ReplayFiles.SelectReplay(num); } else { Singleton.instance.Play(ReplayCache.SFX["Call_Measurement_Failure"], ((Component)crystal).transform.position, false); } Crystals.Remove(crystal); Object.Destroy((Object)(object)((Component)crystal).gameObject); SaveCrystals(); }, 0f, (Func)null); } public static IEnumerator CrystalBreakAnimation(string replayPath, Crystal crystal = null, float dist = 0.005f) { Singleton.instance.Play(ReplayCache.SFX["Call_GearMarket_ButtonUnpress"], ((Component)Main.instance.replayTable).transform.position, false); ((Component)crystalizeVFX).transform.localPosition = new Vector3(0f, 0f, 0.3903f); bool isNewCrystal = false; if ((Object)(object)crystal == (Object)null) { isNewCrystal = true; crystal = CreateCrystal(); ((Component)crystal).transform.position = ((Component)Main.instance.replayTable).transform.position; ((Component)crystal).transform.localScale = Vector3.zero; ((Component)crystal).transform.localRotation = Quaternion.Euler(-90f, 0f, 0f); crystal.BaseColor = Utilities.RandomColor(); crystal.ApplyVisuals(); MelonCoroutines.Start(Utilities.LerpValue((Func)(() => ((Component)crystal).transform.localScale), (Action)delegate(Vector3 v) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) ((Component)crystal).transform.localScale = v; }, (Func)Vector3.Lerp, Vector3.one * 50f, 1f, (Func)Utilities.EaseInOut, (Action)null, 0f, (Func)null)); } crystal.isAnimation = true; if (isNewCrystal) { MelonCoroutines.Start(Utilities.LerpValue((Func)(() => ((Component)crystal).transform.position), (Action)delegate(Vector3 v) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) ((Component)crystal).transform.position = v; }, (Func)Vector3.Lerp, ((Component)Main.instance.replayTable).transform.position + new Vector3(0f, 0.4045f, 0f), 1.5f, (Func)Utilities.EaseInOut, (Action)null, 0f, (Func)null)); } else { yield return Utilities.LerpValue((Func)(() => ((Component)crystal).transform.position), (Action)delegate(Vector3 v) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) ((Component)crystal).transform.position = v; }, (Func)Vector3.Lerp, ((Component)Main.instance.replayTable).transform.position + new Vector3(0f, 0.4045f, 0f), 1.5f, (Func)Utilities.EaseInOut, (Action)null, 0f, (Func)null); } yield return (object)new WaitForSeconds(0.2f); MelonCoroutines.Start(SpinEaseInOut(((Component)crystal).transform, 360f, 2.4f, Vector3.forward)); yield return (object)new WaitForSeconds(1f); Singleton.instance.Play(ReplayCache.SFX["Call_FistBumpBonus"], ((Component)crystal).transform.position, false); Singleton.instance.Play(ReplayCache.SFX["Call_Slab_Dismiss"], ((Component)crystal).transform.position, false); Singleton.instance.Play(ReplayCache.SFX["Call_Shiftstone_Use"], ((Component)crystal).transform.position, false); ((Component)((Component)Main.instance.replayTable).transform.GetChild(7)).GetComponent().Play(); Renderer mainRenderer = default(Renderer); if (((Component)crystal).TryGetComponent(ref mainRenderer)) { mainRenderer.enabled = false; } foreach (Transform shard2 in ((Component)crystal).GetComponentsInChildren(true)) { if (!((Object)(object)shard2 == (Object)(object)((Component)crystal).transform)) { ((Component)shard2).gameObject.SetActive(true); Vector3 localPosition = shard2.localPosition; MelonCoroutines.Start(Utilities.LerpValue(targetValue: ((Vector3)(ref localPosition)).normalized * dist, getter: (Func)(() => shard2.localPosition), setter: (Action)delegate(Vector3 v) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) shard2.localPosition = v; }, lerpFunc: (Func)Vector3.Lerp, duration: 1f, easing: (Func)Utilities.EaseOut, done: (Action)null, delay: 0f, isValid: (Func)null)); } } yield return (object)new WaitForSeconds(0.948f); foreach (Transform shard in ((Component)crystal).GetComponentsInChildren(true)) { if (!((Object)(object)shard == (Object)(object)((Component)crystal).transform)) { MelonCoroutines.Start(Utilities.LerpValue((Func)(() => shard.localScale), (Action)delegate(Vector3 v) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) shard.localScale = v; }, (Func)Vector3.Lerp, Vector3.zero, 0.5f, (Func)Utilities.EaseIn, (Action)delegate { //IL_001f: Unknown result type (might be due to invalid IL or missing references) Singleton.instance.Play(ReplayCache.SFX["Call_DressingRoom_PartPanelTick_BackwardLocked"], ((Component)shard).transform.position, false); }, Random.value, (Func)(() => (Object)(object)shard != (Object)null))); } } yield return (object)new WaitForSeconds(1f); Crystals.Remove(crystal); Object.Destroy((Object)(object)crystal); SaveCrystals(); File.Delete(replayPath); ReplayAPI.ReplayDeletedInternal(replayPath); ReplayFiles.ReloadReplays(); Main.instance.crystalBreakCoroutine = null; } public static IEnumerator SpinEaseInOut(Transform target, float maxSpeed, float duration, Vector3 axis) { //IL_001c: 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) float elapsed = 0f; while (elapsed < duration) { float t = elapsed / duration; float eased = 6f * t * (1f - t); float spinSpeed = maxSpeed * eased; target.Rotate(axis, spinSpeed * Time.deltaTime, (Space)1); elapsed += Time.deltaTime; yield return null; } } public static IEnumerator CrystalSpawnAnimation(Crystal crystal) { crystal.isAnimation = true; ((Component)crystal).transform.localScale = Vector3.zero; ((Component)crystal).transform.position = ((Component)Main.instance.replayTable).transform.position; ((Component)crystalizeVFX).transform.localPosition = new Vector3(0f, 0f, 0.3045f); crystal.BaseColor = new Color32((byte)50, (byte)50, (byte)50, byte.MaxValue); crystal.ApplyVisuals(); Singleton.instance.Play(ReplayCache.SFX["Call_MoveSelector_Unlock"], ((Component)crystal).transform.position, false); MelonCoroutines.Start(Utilities.LerpValue((Func)(() => ((Component)crystal).transform.position), (Action)delegate(Vector3 v) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) ((Component)crystal).transform.position = v; }, (Func)Vector3.Lerp, ((Component)Main.instance.replayTable).transform.position + new Vector3(0f, 0.3045f, 0f), 1.5f, (Func)Utilities.EaseInOut, (Action)null, 0f, (Func)null)); yield return Utilities.LerpValue((Func)(() => ((Component)crystal).transform.localScale), (Action)delegate(Vector3 v) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) ((Component)crystal).transform.localScale = v; }, (Func)Vector3.Lerp, Vector3.one * 50f, 1.5f, (Func)Utilities.EaseInOut, (Action)null, 0f, (Func)null); yield return (object)new WaitForSeconds(1f); Singleton.instance.Play(ReplayCache.SFX["Call_Shiftstone_Use"], ((Component)crystal).transform.position, false); crystalizeVFX.Play(); MelonCoroutines.Start(Utilities.LerpValue((Func)(() => crystal.BaseColor), (Action)delegate(Color32 v) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) crystal.BaseColor = v; crystal.ApplyVisuals(); }, (Func)Color32.Lerp, (!string.IsNullOrEmpty(lastReplayColor.path) && crystal.ReplayPath == lastReplayColor.path) ? lastReplayColor.color : Utilities.RandomColor(), 0.05f, (Func)Utilities.EaseInOut, (Action)null, 0f, (Func)null)); yield return Utilities.LerpValue((Func)(() => ((Component)crystal).transform.localRotation), (Action)delegate(Quaternion v) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) ((Component)crystal).transform.localRotation = v; }, (Func)Quaternion.Slerp, Quaternion.Euler(290f, 0f, 0f), 0.05f, (Func)null, (Action)null, 0f, (Func)null); yield return Utilities.LerpValue((Func)(() => ((Component)crystal).transform.localRotation), (Action)delegate(Quaternion v) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) ((Component)crystal).transform.localRotation = v; }, (Func)Quaternion.Slerp, Quaternion.Euler(270f, 0f, 0f), 0.7f, (Func)Utilities.EaseInOut, (Action)null, 0f, (Func)null); crystal.isAnimation = false; } } public class ReplayFormatting { public static string GetReplayName(ReplayInfo replayInfo, bool isClip = false) { string friendlySceneName = Utilities.GetFriendlySceneName(replayInfo.Header.Scene); string customMap = replayInfo.Header.CustomMap; Player localPlayer = Singleton.instance.localPlayer; string value = Utilities.CleanName(localPlayer.Data.GeneralData.PublicUsername); string text = replayInfo.Header.Players.FirstOrDefault((PlayerInfo p) => p.MasterId != localPlayer.Data.GeneralData.PlayFabMasterId)?.Name; string value2 = ((!string.IsNullOrEmpty(text)) ? Utilities.CleanName(text) : "Unknown"); string value3 = (isClip ? "Clip_" : ""); DateTime.TryParse(replayInfo.Header.Date, out var result); string value4 = result.ToString("yyyy-MM-dd_hh-mm-ss"); string text2 = $"Replay_{value3}{value}-vs-{value2}_on_{friendlySceneName}_{value4}.replay"; if (!string.IsNullOrEmpty(customMap)) { return $"Replay_{value3}{value}-vs-{value2}_on_{customMap}_{value4}.replay"; } if (1 == 0) { } string result2; switch (friendlySceneName) { case "Ring": case "Pit": result2 = text2; break; case "Park": result2 = $"Replay_{value3}{friendlySceneName}_{replayInfo.Header.Players.Length}P_{value}_{value4}.replay"; break; default: result2 = $"Replay_{value3}{friendlySceneName}_{value}_{value4}.replay"; break; } if (1 == 0) { } return result2; } public static string GetReplayDisplayName(string path, ReplaySerializer.ReplayHeader header, string alternativeName = null, bool showTitle = true) { string text = alternativeName ?? Path.GetFileNameWithoutExtension(path); if (header == null) { return text; } string pattern = ((text.StartsWith("Replay", StringComparison.OrdinalIgnoreCase) && showTitle) ? header.Title : text); return FormatReplayString(pattern, header); } public static string FormatReplayString(string pattern, ReplaySerializer.ReplayHeader header) { string mapName = GetMapName(null, header); DateTime dateTime = (string.IsNullOrEmpty(header.Date) ? DateTime.MinValue : DateTime.Parse(header.Date, CultureInfo.InvariantCulture)); TimeSpan timeSpan = TimeSpan.FromSeconds(header.Duration); string text = ((timeSpan.TotalHours >= 1.0) ? $"{(int)timeSpan.TotalHours}:{timeSpan.Minutes:D2}:{timeSpan.Seconds:D2}" : $"{(int)timeSpan.TotalMinutes}:{timeSpan.Seconds:D2}"); Dictionary obj = new Dictionary(StringComparer.OrdinalIgnoreCase) { ["Host"] = "<#FFF>" + (header.Players?.FirstOrDefault((PlayerInfo p) => p?.WasHost ?? false)?.Name ?? "Unknown") + "<#FFF>", ["Client"] = "<#FFF>" + (header.Players?.FirstOrDefault((PlayerInfo p) => p != null && !p.WasHost)?.Name ?? "Unknown") + "<#FFF>" }; PlayerInfo[] players = header.Players; obj["LocalPlayer"] = "<#FFF>" + (((players == null) ? null : players[0]?.Name) ?? "Unknown") + "<#FFF>"; obj["Scene"] = mapName; obj["Map"] = mapName; obj["DateTime"] = ((dateTime == DateTime.MinValue) ? "Unknown Date" : ((object)dateTime)); DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(7, 2); PlayerInfo[] players2 = header.Players; defaultInterpolatedStringHandler.AppendFormatted((players2 != null) ? players2.Length : 0); defaultInterpolatedStringHandler.AppendLiteral(" Player"); PlayerInfo[] players3 = header.Players; defaultInterpolatedStringHandler.AppendFormatted((((players3 != null) ? players3.Length : 0) == 1) ? "" : "s"); obj["PlayerCount"] = defaultInterpolatedStringHandler.ToStringAndClear(); obj["Version"] = header.Version ?? "Unknown Version"; string obj2 = header.Structures?.Length.ToString() ?? "0"; StructureInfo[] structures = header.Structures; obj["StructureCount"] = obj2 + " Structure" + ((((structures != null) ? structures.Length : 0) == 1) ? "" : "s"); obj["MarkerCount"] = header.MarkerCount; obj["AveragePing"] = header.AvgPing; obj["MinimumPing"] = header.MinPing; obj["MaximumPing"] = header.MaxPing; obj["Title"] = ((!string.IsNullOrEmpty(header.Title)) ? header.Title : "Unknown Title"); obj["Duration"] = ((header.Duration > 0f) ? text : "Unknown"); obj["FPS"] = header.TargetFPS; Dictionary values = obj; int num = 0; while (true) { int num2 = num; PlayerInfo[] players4 = header.Players; if (num2 >= ((players4 != null) ? players4.Length : 0)) { break; } values[$"Player{num + 1}"] = GetPlayer(num); num++; } Regex regex = new Regex("\\{(\\w+)(?::([^}]+))?\\}"); return regex.Replace(pattern, delegate(Match match) { string value = match.Groups[1].Value; string text2 = (match.Groups[2].Success ? match.Groups[2].Value : null); if (value.Equals("PlayerList", StringComparison.OrdinalIgnoreCase)) { int maxNames = 3; if (!string.IsNullOrEmpty(text2) && int.TryParse(text2, out var result)) { maxNames = result; } if (header.Players != null) { return ReplayFiles.BuildPlayerLine(header.Players, maxNames); } } object value2; return values.TryGetValue(value, out value2) ? ((value2 is DateTime dateTime2 && text2 != null) ? dateTime2.ToString(text2) : value2.ToString()) : match.Value; }); string GetPlayer(int index) { return (header?.Players != null && index >= 0 && index < header.Players.Length && header.Players[index] != null) ? ("<#FFF>" + header.Players[index].Name + "<#FFF>") : ""; } } public static string GetMapName(string path = null, ReplaySerializer.ReplayHeader header = null) { if (string.IsNullOrEmpty(path) && header == null) { return null; } if (header == null) { header = ReplayArchive.GetManifest(path); } if (!string.IsNullOrEmpty(header.CustomMap)) { if (header.CustomMap.StartsWith("1|")) { return "Unknown Custom Map"; } if (header.Scene == "FlatLandSingle") { return "FlatLand"; } return header.CustomMap; } return Utilities.GetFriendlySceneName(header.Scene); } } public static class ReplayPlaybackControls { public static bool playbackControlsOpen; public static GameObject playbackControls; public static GameObject timeline; public static TextMeshPro totalDuration; public static TextMeshPro currentDuration; public static TextMeshPro playbackTitle; public static TextMeshPro playbackSpeedText; public static MeshRenderer playButtonSprite; public static Texture2D pauseSprite; public static Texture2D playSprite; public static DestroyOnPunch destroyOnPunch; public static GameObject markerPrefab; public static float smoothing = 7f; public static void Update() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) Transform head = Main.instance.head; if (!((Object)(object)head == (Object)null) && !((Object)(object)playbackControls == (Object)null) && Main.instance.PlaybackControlsFollow.Value) { float armSpan = Main.LocalPlayer.Data.PlayerMeasurement.ArmSpan; float num = Vector3.Distance(playbackControls.transform.position, head.position); if (!(num < armSpan)) { (Vector3 position, Quaternion rotation) targetSlabTransform = GetTargetSlabTransform(head); Vector3 item = targetSlabTransform.position; Quaternion item2 = targetSlabTransform.rotation; float num2 = Mathf.InverseLerp(armSpan, armSpan * 1.5f, num); float num3 = (1f - Mathf.Exp((0f - smoothing) * Time.deltaTime)) * num2; playbackControls.transform.position = Vector3.Lerp(playbackControls.transform.position, item, num3); playbackControls.transform.rotation = Quaternion.Slerp(playbackControls.transform.rotation, item2, num3); } } } public static (Vector3 position, Quaternion rotation) GetTargetSlabTransform(Transform head) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 forward = head.forward; forward.y = 0f; Vector3 val = head.position + forward * 0.6f + Vector3.down * 0.1f; Vector3 val2 = head.position - val; val2.y = 0f; Quaternion item = Quaternion.LookRotation(val2); return (val, item); } public static void Open() { //IL_0045: 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_004b: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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) if (!((Object)(object)Main.instance.head == (Object)null)) { if (playbackControlsOpen) { playbackControls.SetActive(false); } playbackControlsOpen = true; var (position, rotation) = GetTargetSlabTransform(Main.instance.head); if (Main.LocalPlayer.Controller.GetSubsystem().IsGrounded()) { playbackControls.transform.position = position; playbackControls.transform.rotation = rotation; playbackControls.SetActive(true); ((Component)playbackControls.transform.GetChild(0)).gameObject.SetActive(true); ((Component)playbackControls.transform.GetChild(1)).gameObject.SetActive(true); Singleton.instance.Play(ReplayCache.SFX["Call_Slab_Construct"], Main.instance.head.position, false); } } } public static void Close() { //IL_007a: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) if (playbackControlsOpen) { playbackControlsOpen = false; playbackControls.SetActive(false); ((Component)playbackControls.transform.GetChild(0)).gameObject.SetActive(false); ((Component)playbackControls.transform.GetChild(1)).gameObject.SetActive(false); Singleton.instance.Play(ReplayCache.SFX["Call_Slab_Dismiss"], Main.instance.head.position, false); ((Component)Singleton.instance.GetPool("DustBreak_VFX").FetchFromPool(playbackControls.transform.position, playbackControls.transform.rotation)).transform.localScale = Vector3.one * 0.4f; } } } [RegisterTypeInIl2Cpp] public class DestroyOnPunch : MonoBehaviour { public InteractionHand leftHand; public InteractionHand rightHand; public Action onDestroy; public float punchThreshold = 3f; public void OnTriggerEnter(Collider other) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0057: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.zero; bool flag = true; if (((Object)other).name.Contains("Bone_Pointer_C_L")) { val = ((Component)leftHand).GetComponent().velocity; } else if (((Object)other).name.Contains("Bone_Pointer_C_R")) { val = ((Component)rightHand).GetComponent().velocity; flag = false; } if (((Vector3)(ref val)).magnitude > punchThreshold) { onDestroy?.Invoke(); if (Main.instance.EnableHaptics.Value) { Main.LocalPlayer.Controller.GetSubsystem().PlayControllerHaptics(flag ? 1f : 0f, flag ? 0.2f : 0f, (!flag) ? 1f : 0f, (!flag) ? 0.2f : 0f); } } } } [RegisterTypeInIl2Cpp] public class ReplaySettings : MonoBehaviour { [RegisterTypeInIl2Cpp] public class TimelineScrubber : MonoBehaviour { public ReplaySerializer.ReplayHeader header; private void OnTriggerEnter(Collider other) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (IsFinger(((Component)other).gameObject, out var isLeft)) { Singleton.instance.Play(ReplayCache.SFX["Call_GearMarket_GenericButton_Press"], ((Component)this).transform.position, false); if (Main.instance.EnableHaptics.Value) { Main.LocalPlayer.Controller.GetSubsystem().PlayControllerHaptics(0.6f, isLeft ? 0.15f : 0f, 0.6f, (!isLeft) ? 0.15f : 0f); } } } private void OnTriggerStay(Collider other) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (IsFinger(((Component)other).gameObject, out var _)) { Vector3 worldPos = other.ClosestPointOnBounds(((Component)this).transform.position); float progressFromMeshPosition = Utilities.GetProgressFromMeshPosition(worldPos, ((Component)this).GetComponentInParent()); float num = progressFromMeshPosition * header.Duration; Material material = ((Renderer)((Component)this).GetComponentInParent()).material; if (material != null) { material.SetFloat("_BP_Current", num * 1000f); } if (Main.Playback.isPlaying) { Main.Playback.SetPlaybackTime(num); } } } private void OnTriggerExit(Collider other) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (IsFinger(((Component)other).gameObject, out var isLeft)) { Singleton.instance.Play(ReplayCache.SFX["Call_Interactionbase_ButtonRelease"], ((Component)this).transform.position, false); if (Main.instance.EnableHaptics.Value) { Main.LocalPlayer.Controller.GetSubsystem().PlayControllerHaptics(0.3f, isLeft ? 0.15f : 0f, 0.3f, (!isLeft) ? 0.15f : 0f); } } } private bool IsFinger(GameObject obj, out bool isLeft) { isLeft = ((Object)obj).name.EndsWith("L"); return ((Object)obj).name.Contains("Bone_Pointer_C"); } } private string currentPath; private ReplaySerializer.ReplayHeader currentHeader; public static GameObject replaySettingsGO; public static GameObject replayExplorerGO; public static TextMeshPro replayName; public static TextMeshPro dateText; public static TextMeshPro renameInstructions; public static TextMeshPro durationComp; public static GameObject favoritedIcon; public static InteractionButton renameButton; public static InteractionButton deleteButton; public static InteractionButton copyPathButton; public static GameObject povButton; public static GameObject hideLocalPlayerToggle; public static GameObject openControlsButton; public static bool hideLocalPlayer = true; public static TextMeshPro pageNumberText; public static bool selectionInProgress; public static Player selectedPlayer; public static Dictionary> playerList = new Dictionary>(); public static List playerTags = new List(); public static int currentPlayerPage = 0; public static GameObject slideOutPanel; public static GameObject timeline; private bool isRenaming = false; private StringBuilder renameBuffer = new StringBuilder(); private string rawReplayName; public void Show(string path) { //IL_0108: Unknown result type (might be due to invalid IL or missing references) replaySettingsGO.SetActive(true); replayExplorerGO.SetActive(false); povButton.SetActive(Main.Playback.isPlaying); hideLocalPlayerToggle.SetActive(Main.Playback.isPlaying); openControlsButton.SetActive(Main.Playback.isPlaying); currentPath = path; currentHeader = ReplayArchive.GetManifest(path); rawReplayName = Path.GetFileNameWithoutExtension(path); ((TMP_Text)replayName).text = ReplayFormatting.GetReplayDisplayName(path, currentHeader); ((TMP_Text)replayName).ForceMeshUpdate(false, false); renameBuffer.Clear(); renameBuffer.Append(rawReplayName); ((TMP_Text)dateText).text = ReplayFormatting.FormatReplayString("{DateTime:yyyy/MM/dd hh:mm tt}", currentHeader); ((TMP_Text)dateText).ForceMeshUpdate(false, false); slideOutPanel.SetActive(false); slideOutPanel.transform.localPosition = new Vector3(0.1709f, 0.5273f, 0.16f); favoritedIcon.SetActive(currentHeader.isFavorited); ((Component)timeline.transform.GetChild(0)).GetComponent().header = currentHeader; ((Renderer)timeline.GetComponent()).material.SetFloat("_BP_Target", currentHeader.Duration * 1000f); Utilities.AddMarkers(currentHeader, timeline.GetComponent(), hideMarkers: false); renameButton.SetButtonToggleStatus(false, false, true); ((Component)renameInstructions).gameObject.SetActive(false); isRenaming = false; TimeSpan timeSpan = TimeSpan.FromSeconds(currentHeader.Duration); ((TMP_Text)durationComp).text = ((timeSpan.TotalHours >= 1.0) ? $"{(int)timeSpan.TotalHours}:{timeSpan.Minutes:D2}:{timeSpan.Seconds:D2}" : $"{(int)timeSpan.TotalMinutes}:{timeSpan.Seconds:D2}"); ((TMP_Text)durationComp).enableWordWrapping = false; ((TMP_Text)durationComp).ForceMeshUpdate(false, false); isRenaming = false; } private void Update() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0272: 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_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) Bounds textBounds = ((TMP_Text)replayName).textBounds; float y = ((Bounds)(ref textBounds)).min.y; Vector3 localPosition = replayName.transform.localPosition; localPosition.y += y - 0.04f; dateText.transform.localPosition = localPosition; if (!isRenaming) { return; } if (Input.GetKeyDown((KeyCode)13)) { TryRename(renameBuffer.ToString()); isRenaming = false; ((Component)renameInstructions).gameObject.SetActive(false); renameButton.SetButtonToggleStatus(false, true, false); return; } if (Input.GetKeyDown((KeyCode)27)) { ((TMP_Text)replayName).text = ReplayFormatting.GetReplayDisplayName(currentPath, currentHeader); ((TMP_Text)replayName).ForceMeshUpdate(false, false); renameButton.SetButtonToggleStatus(false, true, false); ((Component)renameInstructions).gameObject.SetActive(false); isRenaming = false; return; } string inputString = Input.inputString; for (int i = 0; i < inputString.Length; i++) { char c = inputString[i]; if (c == '\b') { if (renameBuffer.Length > 0) { renameBuffer.Remove(renameBuffer.Length - 1, 1); Singleton.instance.Play(ReplayCache.SFX["Call_DressingRoom_PartPanelTick_BackwardLocked"], ((Component)this).transform.position, false); } } else if (IsAllowedChar(c)) { string directoryName = Path.GetDirectoryName(currentPath); string path = renameBuffer.ToString() + c + ".replay"; string text = Path.Combine(directoryName, path); if (text.Length < 260) { renameBuffer.Append(c); Singleton.instance.Play(ReplayCache.SFX["Call_DressingRoom_PartPanelTick_BackwardUnlocked"], ((Component)this).transform.position, false); } else { Main.ReplayError($"Replay name too long. Max path length is 260 chars while the provided path contains {text.Length}", ((Component)this).transform.position); } } else { Main.ReplayError(); } } ((TMP_Text)replayName).text = ReplayFormatting.GetReplayDisplayName(currentPath, currentHeader, renameBuffer.ToString(), showTitle: false); ((TMP_Text)replayName).ForceMeshUpdate(false, false); } public void OnRenamePressed(bool toggleState) { if (toggleState) { ((TMP_Text)replayName).text = ReplayFormatting.GetReplayDisplayName(currentPath, currentHeader); ((TMP_Text)replayName).ForceMeshUpdate(false, false); isRenaming = false; ((Component)renameInstructions).gameObject.SetActive(false); } else { isRenaming = true; renameBuffer.Clear(); renameBuffer.Append(rawReplayName); ((Component)renameInstructions).gameObject.SetActive(true); } } private bool IsAllowedChar(char c) { char[] invalidFileNameChars = Path.GetInvalidFileNameChars(); return !invalidFileNameChars.Contains(c); } private void TryRename(string newName) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) newName = newName.Trim(); if (string.IsNullOrEmpty(newName)) { Main.ReplayError("Invalid replay name (" + newName + ")", ((Component)this).transform.position); return; } string directoryName = Path.GetDirectoryName(currentPath); string text = Path.Combine(directoryName, newName + ".replay"); if (File.Exists(text)) { Main.ReplayError("Name already exists (" + text + ")", ((Component)this).transform.position); return; } File.Move(currentPath, text); currentPath = text; Show(currentPath); ReplayFiles.ReloadReplays(); ReplayAPI.ReplayRenamedInternal(currentHeader, text); Singleton.instance.Play(ReplayCache.SFX["Call_PoseGhost_MovePerformed"], ((Component)this).transform.position, false); } public static Dictionary> PaginateReplay(ReplaySerializer.ReplayHeader header, ReplayPlayback.Clone[] PlaybackPlayers, bool includeLocalPlayer = true) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown List<(UserData, Player)> list = new List<(UserData, Player)>(); if (includeLocalPlayer) { Player localPlayer = Main.LocalPlayer; list.Add((new UserData(localPlayer.Data.GeneralData.PlayFabMasterId, Guid.NewGuid().ToString(), "You (" + localPlayer.Data.GeneralData.PublicUsername + ")", localPlayer.Data.GeneralData.BattlePoints), localPlayer)); } PlayerInfo[] players = header.Players; for (int i = 0; i < players.Length; i++) { if (header.Players[i] != null) { list.Add((new UserData(players[i].MasterId + "_" + Guid.NewGuid(), Guid.NewGuid().ToString(), players[i].Name, players[i].BattlePoints), PlaybackPlayers[i].Controller.assignedPlayer)); } } Dictionary> dictionary = new Dictionary>(); int num = Mathf.CeilToInt((float)list.Count / 4f); for (int j = 0; j < num; j++) { List<(UserData, Player)> list2 = new List<(UserData, Player)>(); for (int k = 0; k < 4; k++) { int num2 = j * 4 + k; if (num2 >= list.Count) { break; } list2.Add(list[num2]); } dictionary[j] = list2; } return dictionary; } public static IEnumerator SelectPlayer(Action callback, float afterSelectionDelay) { if (!selectionInProgress) { selectionInProgress = true; selectedPlayer = null; TogglePlayerSelection(active: true); while (selectedPlayer == null && selectionInProgress) { yield return null; } yield return (object)new WaitForSeconds(afterSelectionDelay); TogglePlayerSelection(active: false); callback?.Invoke(selectedPlayer); selectionInProgress = false; } } public static void TogglePlayerSelection(bool active) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) slideOutPanel.SetActive(true); if (active) { SelectPlayerPage(0); } if (!active) { selectionInProgress = false; } Singleton.instance.Play(ReplayCache.SFX[active ? "Call_Phone_ScreenUp" : "Call_Phone_ScreenDown"], slideOutPanel.transform.localPosition, false); Vector3 localPosition = ((!active) ? new Vector3(-0.65686f, 0.3898f, 0.0134f) : new Vector3(-0.0778f, 0.3898f, 0.0134f)); slideOutPanel.transform.localPosition = localPosition; Vector3 targetValue = (active ? new Vector3(-0.65686f, 0.3898f, 0.0134f) : new Vector3(-0.0778f, 0.3898f, 0.0134f)); MelonCoroutines.Start(Utilities.LerpValue((Func)(() => slideOutPanel.transform.localPosition), (Action)delegate(Vector3 v) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) slideOutPanel.transform.localPosition = v; }, (Func)Vector3.Lerp, targetValue, 0.8f, (Func)Utilities.EaseIn, (Action)delegate { if (!active) { slideOutPanel.SetActive(false); } }, 0f, (Func)null)); } public static (UserData data, Player player) PlayerAtIndex(int index) { List<(UserData, Player)> value; return (!playerList.TryGetValue(currentPlayerPage, out value)) ? (null, null) : ((index >= 0 && index < value.Count) ? value[index] : (null, null)); } public static void SelectPlayerPage(int page) { ((TMP_Text)pageNumberText).text = Utilities.FormatPage(page, Utilities.GetPageCount(playerList.Count, 4)); ((TMP_Text)pageNumberText).ForceMeshUpdate(false, false); List<(UserData, Player)> value; List<(UserData, Player)> list = (playerList.TryGetValue(currentPlayerPage, out value) ? value : new List<(UserData, Player)>()); for (int i = 0; i < playerTags.Count; i++) { if (i < list.Count) { ((Component)playerTags[i]).gameObject.SetActive(true); playerTags[i].Initialize(list[i].Item1, false); } else { ((Component)playerTags[i]).gameObject.SetActive(false); } } } } } namespace ReplayMod.Replay.Serialization { public class ReplayArchive { public static IEnumerator BuildReplayPackageSafe(string outputPath, ReplayInfo replay, Action done) { while (!Main.isSceneReady) { yield return null; } yield return null; yield return null; Task task = BuildReplayPackage(outputPath, replay); while (!task.IsCompleted) { yield return null; } done?.Invoke(); } public static async Task BuildReplayPackage(string outputPath, ReplayInfo replay) { try { byte[] rawReplay = ReplaySerializer.SerializeReplayFile(replay); ((MelonBase)Main.instance).LoggerInstance.Msg("Replay data serialized (" + Utilities.FormatBytes(rawReplay.Length) + ")"); byte[] compressedReplay = await Task.Run(() => ReplayCodec.Compress(rawReplay)); ((MelonBase)Main.instance).LoggerInstance.Msg($"Compression complete ({Utilities.FormatBytes(rawReplay.Length)} -> {Utilities.FormatBytes(compressedReplay.Length)}, {100.0 - (double)compressedReplay.Length * 100.0 / (double)rawReplay.Length:0.#}% reduction)."); MelonCoroutines.Start(FinishOnMainThread(outputPath, replay, compressedReplay)); } catch (Exception ex2) { Exception ex = ex2; Main.ReplayError($"Saving replay to disk failed: {ex}"); throw; } } private static IEnumerator FinishOnMainThread(string outputPath, ReplayInfo replay, byte[] compressedReplay) { string manifestJson = JsonConvert.SerializeObject((object)replay.Header, (Formatting)1, new JsonSerializerSettings { NullValueHandling = (NullValueHandling)1 }); using (FileStream fs = new FileStream(outputPath, FileMode.Create)) { using ZipArchive zip = new ZipArchive(fs, ZipArchiveMode.Create); ZipArchiveEntry manifestEntry = zip.CreateEntry("manifest.json", CompressionLevel.Optimal); using (StreamWriter writer = new StreamWriter(manifestEntry.Open())) { writer.Write(manifestJson); } ZipArchiveEntry replayEntry = zip.CreateEntry("replay", CompressionLevel.NoCompression); using (Stream stream = replayEntry.Open()) { stream.Write(compressedReplay, 0, compressedReplay.Length); } while (ReplayVoices.HasActiveWriters) { yield return null; } WriteVoices(zip); ReplayAPI.InvokeArchiveBuild(zip); } ReplayVoices.Cleanup(); } private static void WriteVoices(ZipArchive zip) { if (!Directory.Exists(ReplayVoices.VoiceCacheDir)) { return; } string[] files = Directory.GetFiles(ReplayVoices.VoiceCacheDir); foreach (string path in files) { string fileName = Path.GetFileName(path); ZipArchiveEntry zipArchiveEntry = zip.CreateEntry("voices/" + fileName, CompressionLevel.Optimal); using Stream destination = zipArchiveEntry.Open(); using FileStream fileStream = File.OpenRead(path); fileStream.CopyTo(destination); } string value = JsonConvert.SerializeObject((object)new VoiceArchiveData { Tracks = ReplayVoices.VoiceTrackInfos }); ZipArchiveEntry zipArchiveEntry2 = zip.CreateEntry("voices.json", CompressionLevel.Optimal); using Stream stream = zipArchiveEntry2.Open(); using StreamWriter streamWriter = new StreamWriter(stream); streamWriter.Write(value); } public static ReplaySerializer.ReplayHeader GetManifest(string path) { using FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read); using ZipArchive zipArchive = new ZipArchive(stream, ZipArchiveMode.Read); ZipArchiveEntry entry = zipArchive.GetEntry("manifest.json"); if (entry == null) { throw new Exception("Replay does not have valid manifest.json"); } using Stream stream2 = entry.Open(); using StreamReader streamReader = new StreamReader(stream2); ReplayAPI.InvokeArchiveRead(zipArchive); string text = streamReader.ReadToEnd(); return JsonConvert.DeserializeObject(text); } public static void WriteManifest(string replayPath, ReplaySerializer.ReplayHeader header) { ReplayFiles.suppressWatcher = true; try { using FileStream stream = new FileStream(replayPath, FileMode.Open, FileAccess.ReadWrite); using ZipArchive zipArchive = new ZipArchive(stream, ZipArchiveMode.Update); zipArchive.GetEntry("manifest.json")?.Delete(); ZipArchiveEntry zipArchiveEntry = zipArchive.CreateEntry("manifest.json", CompressionLevel.Optimal); using StreamWriter streamWriter = new StreamWriter(zipArchiveEntry.Open()); streamWriter.Write(JsonConvert.SerializeObject((object)header, (Formatting)1)); } finally { ReplayFiles.suppressWatcher = false; } } } public class ReplaySerializer { [Serializable] public class ReplayHeader { public string Title; public string CustomMap; public string Version; public string Scene; public string Date; public float Duration; public int FrameCount; public int PedestalCount; public int ScenePropCount; public int MarkerCount; public int AvgPing; public int MaxPing; public int MinPing; public int TargetFPS; public bool isFavorited; public PlayerInfo[] Players; public StructureInfo[] Structures; public ScenePropInfo[] SceneProps; public Marker[] Markers; [JsonIgnore] public string VoiceFolder; [JsonIgnore] public List VoiceTrackInfos; public string Guid; } private const float EPS = 5E-05f; private const float ROT_EPS_ANGLE = 0.05f; public static string FileName { get; set; } private static bool PosChanged(Vector3 a, Vector3 b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //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) Vector3 val = a - b; return ((Vector3)(ref val)).sqrMagnitude > 2.4999998E-09f; } private static bool RotChanged(Quaternion a, Quaternion b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) return Quaternion.Angle(a, b) > 0.05f; } private static bool FloatChanged(float a, float b) { return Mathf.Abs(a - b) > 5E-05f; } private static bool WriteIf(bool condition, Action write) { if (!condition) { return false; } write(); return true; } private static int WriteStructureDiff(BinaryWriter w, StructureState prev, StructureState curr) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0122: Unknown result type (might be due to invalid IL or missing references) long position = w.BaseStream.Position; WriteIf(PosChanged(prev.position, curr.position), delegate { //IL_000d: Unknown result type (might be due to invalid IL or missing references) w.Write(StructureField.position, curr.position); }); WriteIf(RotChanged(prev.rotation, curr.rotation), delegate { //IL_000d: Unknown result type (might be due to invalid IL or missing references) w.Write(StructureField.rotation, curr.rotation); }); WriteIf(prev.active != curr.active, delegate { w.Write(StructureField.active, curr.active); }); WriteIf(prev.isLeftHeld != curr.isLeftHeld, delegate { w.Write(StructureField.isLeftHeld, curr.isLeftHeld); }); WriteIf(prev.isRightHeld != curr.isRightHeld, delegate { w.Write(StructureField.isRightHeld, curr.isRightHeld); }); WriteIf(prev.isFlicked != curr.isFlicked, delegate { w.Write(StructureField.isFlicked, curr.isFlicked); }); WriteIf(prev.currentState != curr.currentState, delegate { //IL_000d: Unknown result type (might be due to invalid IL or missing references) w.Write(StructureField.currentState, (byte)curr.currentState); }); WriteIf(prev.isTargetDisk != curr.isTargetDisk, delegate { w.Write(StructureField.isTargetDisk, curr.isTargetDisk); }); return (int)(w.BaseStream.Position - position); } private static int WritePlayerDiff(BinaryWriter w, PlayerState prev, PlayerState curr) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0082: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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_036f: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) long position = w.BaseStream.Position; WriteIf(PosChanged(prev.VRRigPos, curr.VRRigPos), delegate { //IL_000d: Unknown result type (might be due to invalid IL or missing references) w.Write(PlayerField.VRRigPos, curr.VRRigPos); }); WriteIf(RotChanged(prev.VRRigRot, curr.VRRigRot), delegate { //IL_000d: Unknown result type (might be due to invalid IL or missing references) w.Write(PlayerField.VRRigRot, curr.VRRigRot); }); WriteIf(PosChanged(prev.LHandPos, curr.LHandPos), delegate { //IL_000d: Unknown result type (might be due to invalid IL or missing references) w.Write(PlayerField.LHandPos, curr.LHandPos); }); WriteIf(RotChanged(prev.LHandRot, curr.LHandRot), delegate { //IL_000d: Unknown result type (might be due to invalid IL or missing references) w.Write(PlayerField.LHandRot, curr.LHandRot); }); WriteIf(PosChanged(prev.RHandPos, curr.RHandPos), delegate { //IL_000d: Unknown result type (might be due to invalid IL or missing references) w.Write(PlayerField.RHandPos, curr.RHandPos); }); WriteIf(RotChanged(prev.RHandRot, curr.RHandRot), delegate { //IL_000d: Unknown result type (might be due to invalid IL or missing references) w.Write(PlayerField.RHandRot, curr.RHandRot); }); WriteIf(PosChanged(prev.HeadPos, curr.HeadPos), delegate { //IL_000d: Unknown result type (might be due to invalid IL or missing references) w.Write(PlayerField.HeadPos, curr.HeadPos); }); WriteIf(RotChanged(prev.HeadRot, curr.HeadRot), delegate { //IL_000d: Unknown result type (might be due to invalid IL or missing references) w.Write(PlayerField.HeadRot, curr.HeadRot); }); WriteIf(prev.currentStack != curr.currentStack, delegate { w.Write(PlayerField.currentStack, curr.currentStack); }); WriteIf(prev.Health != curr.Health, delegate { w.Write(PlayerField.Health, curr.Health); }); WriteIf(prev.active != curr.active, delegate { w.Write(PlayerField.active, curr.active); }); WriteIf(prev.activeShiftstoneVFX != curr.activeShiftstoneVFX, delegate { w.Write(PlayerField.activeShiftstoneVFX, (byte)curr.activeShiftstoneVFX); }); WriteIf(prev.leftShiftstone != curr.leftShiftstone, delegate { w.Write(PlayerField.leftShiftstone, (byte)curr.leftShiftstone); }); WriteIf(prev.rightShiftstone != curr.rightShiftstone, delegate { w.Write(PlayerField.rightShiftstone, (byte)curr.rightShiftstone); }); WriteIf(FloatChanged(prev.lgripInput, curr.lgripInput), delegate { w.Write(PlayerField.lgripInput, curr.lgripInput); }); WriteIf(FloatChanged(prev.lthumbInput, curr.lthumbInput), delegate { w.Write(PlayerField.lthumbInput, curr.lthumbInput); }); WriteIf(FloatChanged(prev.lindexInput, curr.lindexInput), delegate { w.Write(PlayerField.lindexInput, curr.lindexInput); }); WriteIf(FloatChanged(prev.rgripInput, curr.rgripInput), delegate { w.Write(PlayerField.rgripInput, curr.rgripInput); }); WriteIf(FloatChanged(prev.rthumbInput, curr.rthumbInput), delegate { w.Write(PlayerField.rthumbInput, curr.rthumbInput); }); WriteIf(FloatChanged(prev.rindexInput, curr.rindexInput), delegate { w.Write(PlayerField.rindexInput, curr.rindexInput); }); WriteIf(prev.rockCamActive != curr.rockCamActive, delegate { w.Write(PlayerField.rockCamActive, curr.rockCamActive); }); WriteIf(PosChanged(prev.rockCamPos, curr.rockCamPos), delegate { //IL_000e: Unknown result type (might be due to invalid IL or missing references) w.Write(PlayerField.rockCamPos, curr.rockCamPos); }); WriteIf(RotChanged(prev.rockCamRot, curr.rockCamRot), delegate { //IL_000e: Unknown result type (might be due to invalid IL or missing references) w.Write(PlayerField.rockCamRot, curr.rockCamRot); }); WriteIf(FloatChanged(prev.ArmSpan, curr.ArmSpan), delegate { w.Write(PlayerField.armSpan, curr.ArmSpan); }); WriteIf(FloatChanged(prev.Length, curr.Length), delegate { w.Write(PlayerField.length, curr.Length); }); WriteIf(!string.IsNullOrEmpty(curr.visualData) && !string.Equals(prev.visualData, curr.visualData), delegate { w.Write(PlayerField.visualData, curr.visualData); }); return (int)(w.BaseStream.Position - position); } private static int WritePedestalDiff(BinaryWriter w, PedestalState prev, PedestalState curr) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) long position = w.BaseStream.Position; WriteIf(PosChanged(prev.position, curr.position), delegate { //IL_000d: Unknown result type (might be due to invalid IL or missing references) w.Write(PedestalField.position, curr.position); }); WriteIf(prev.active != curr.active, delegate { w.Write(PedestalField.active, curr.active); }); return (int)(w.BaseStream.Position - position); } private static int WriteScenePropDiff(BinaryWriter w, ScenePropState prev, ScenePropState curr) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) long position = w.BaseStream.Position; WriteIf(PosChanged(prev.position, curr.position), delegate { //IL_000d: Unknown result type (might be due to invalid IL or missing references) w.Write(ScenePropField.position, curr.position); }); WriteIf(RotChanged(prev.rotation, curr.rotation), delegate { //IL_000d: Unknown result type (might be due to invalid IL or missing references) w.Write(ScenePropField.rotation, curr.rotation); }); return (int)(w.BaseStream.Position - position); } private static int WriteEvent(BinaryWriter w, EventChunk e) { //IL_003f: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) long position = w.BaseStream.Position; WriteIf(condition: true, delegate { w.Write(EventField.type, (byte)e.type); }); WriteIf(e.position != default(Vector3), delegate { //IL_000d: Unknown result type (might be due to invalid IL or missing references) w.Write(EventField.position, e.position); }); WriteIf(e.rotation != default(Quaternion), delegate { //IL_000d: Unknown result type (might be due to invalid IL or missing references) w.Write(EventField.rotation, e.rotation); }); WriteIf(!string.IsNullOrEmpty(e.masterId), delegate { w.Write(EventField.masterId, e.masterId); }); WriteIf(e.playerIndex > -1, delegate { w.Write(EventField.playerIndex, e.playerIndex); }); WriteIf(e.damage != 0, delegate { w.Write(EventField.damage, e.damage); }); WriteIf(e.fxType != FXOneShotType.None, delegate { w.Write(EventField.fxType, (byte)e.fxType); }); WriteIf(e.structureId != -1, delegate { w.Write(EventField.structureId, e.structureId); }); return (int)(w.BaseStream.Position - position); } public static byte[] SerializeReplayFile(ReplayInfo replay) { using MemoryStream memoryStream = new MemoryStream(); using BinaryWriter binaryWriter = new BinaryWriter(memoryStream); binaryWriter.Write(Encoding.ASCII.GetBytes("RPLY")); StructureState[] array = null; PlayerState[] array2 = null; PedestalState[] array3 = null; ScenePropState[] array4 = null; int num = replay.Frames.Length; int num2 = -1; for (int i = 0; i < num; i++) { Frame frame = replay.Frames[i]; using MemoryStream memoryStream2 = new MemoryStream(); using BinaryWriter binaryWriter2 = new BinaryWriter(memoryStream2); binaryWriter2.Write(frame.Time); using MemoryStream memoryStream3 = new MemoryStream(); using BinaryWriter binaryWriter3 = new BinaryWriter(memoryStream3); int entryCount = 0; int num3 = replay.Header.Structures.Length; int num4 = replay.Header.Players.Length; int pedestalCount = replay.Header.PedestalCount; int scenePropCount = replay.Header.ScenePropCount; if (array == null) { array = Utilities.NewArray(num3); } if (array2 == null) { array2 = Utilities.NewArray(num4); } if (array3 == null) { array3 = Utilities.NewArray(pedestalCount); } if (array4 == null) { array4 = Utilities.NewArray(scenePropCount); } for (int j = 0; j < num3; j++) { if (j < frame.Structures.Length && j < array.Length) { StructureState structureState = frame.Structures[j]; StructureState prev = array[j]; long position = binaryWriter3.BaseStream.Position; binaryWriter3.Write((byte)1); binaryWriter3.Write(j); long position2 = binaryWriter3.BaseStream.Position; binaryWriter3.Write(0); int num5 = WriteStructureDiff(binaryWriter3, prev, structureState); if (num5 > 0) { long position3 = binaryWriter3.BaseStream.Position; binaryWriter3.BaseStream.Position = position2; binaryWriter3.Write(num5); binaryWriter3.BaseStream.Position = position3; entryCount++; } else { binaryWriter3.BaseStream.Position = position; } array[j] = structureState; } } for (int k = 0; k < num4; k++) { if (k < frame.Players.Length && k < array2.Length) { PlayerState playerState = frame.Players[k]; PlayerState prev2 = array2[k]; long position4 = binaryWriter3.BaseStream.Position; binaryWriter3.Write((byte)0); binaryWriter3.Write(k); long position5 = binaryWriter3.BaseStream.Position; binaryWriter3.Write(0); int num6 = WritePlayerDiff(binaryWriter3, prev2, playerState); if (num6 > 0) { long position6 = binaryWriter3.BaseStream.Position; binaryWriter3.BaseStream.Position = position5; binaryWriter3.Write(num6); binaryWriter3.BaseStream.Position = position6; entryCount++; } else { binaryWriter3.BaseStream.Position = position4; } array2[k] = playerState; } } for (int l = 0; l < pedestalCount; l++) { if (l < frame.Pedestals.Length && l < array3.Length) { PedestalState pedestalState = frame.Pedestals[l]; PedestalState prev3 = array3[l]; long position7 = binaryWriter3.BaseStream.Position; binaryWriter3.Write((byte)2); binaryWriter3.Write(l); long position8 = binaryWriter3.BaseStream.Position; binaryWriter3.Write(0); int num7 = WritePedestalDiff(binaryWriter3, prev3, pedestalState); if (num7 > 0) { long position9 = binaryWriter3.BaseStream.Position; binaryWriter3.BaseStream.Position = position8; binaryWriter3.Write(num7); binaryWriter3.BaseStream.Position = position9; entryCount++; } else { binaryWriter3.BaseStream.Position = position7; } array3[l] = pedestalState; } } for (int m = 0; m < scenePropCount; m++) { if (m < frame.SceneProps.Length && m < array4.Length) { ScenePropState scenePropState = frame.SceneProps[m]; ScenePropState prev4 = array4[m]; long position10 = binaryWriter3.BaseStream.Position; binaryWriter3.Write((byte)4); binaryWriter3.Write(m); long position11 = binaryWriter3.BaseStream.Position; binaryWriter3.Write(0); int num8 = WriteScenePropDiff(binaryWriter3, prev4, scenePropState); if (num8 > 0) { long position12 = binaryWriter3.BaseStream.Position; binaryWriter3.BaseStream.Position = position11; binaryWriter3.Write(num8); binaryWriter3.BaseStream.Position = position12; entryCount++; } else { binaryWriter3.BaseStream.Position = position10; } array4[m] = scenePropState; } } for (int n = 0; n < frame.Events.Length; n++) { long position13 = binaryWriter3.BaseStream.Position; binaryWriter3.Write((byte)3); binaryWriter3.Write(n); long position14 = binaryWriter3.BaseStream.Position; binaryWriter3.Write(0); int num9 = WriteEvent(binaryWriter3, frame.Events[n]); if (num9 > 0) { long position15 = binaryWriter3.BaseStream.Position; binaryWriter3.BaseStream.Position = position14; binaryWriter3.Write(num9); binaryWriter3.BaseStream.Position = position15; entryCount++; } else { binaryWriter3.BaseStream.Position = position13; } } foreach (ReplayExtension extension in ReplayAPI.Extensions) { if (extension.Enabled.Value) { ReplayAPI.FrameExtensionWriter writer = new ReplayAPI.FrameExtensionWriter(binaryWriter3, extension.FrameExtensionId, delegate { entryCount++; }); extension.OnWriteFrame(writer, frame); } } binaryWriter2.Write(entryCount); binaryWriter2.Write(memoryStream3.ToArray()); byte[] array5 = memoryStream2.ToArray(); binaryWriter.Write(array5.Length); binaryWriter.Write(array5); int num10 = (int)((double)(i + 1) * 100.0 / (double)num); if (num10 % 10 == 0 && num > 1000 && num10 != num2) { num2 = num10; ((MelonBase)Main.instance).LoggerInstance.Msg($"Serializing replay... {num10}%"); } } return memoryStream.ToArray(); } public static ReplayInfo LoadReplay(string path) { using FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read); using ZipArchive zipArchive = new ZipArchive(stream, ZipArchiveMode.Read); ZipArchiveEntry entry = zipArchive.GetEntry("manifest.json"); if (entry == null) { ((MelonBase)Main.instance).LoggerInstance.Error("Missing manifest.json"); return new ReplayInfo(); } using StreamReader streamReader = new StreamReader(entry.Open()); string text = streamReader.ReadToEnd(); ReplayHeader replayHeader = JsonConvert.DeserializeObject(text); ZipArchiveEntry entry2 = zipArchive.GetEntry("replay"); if (entry2 == null) { ((MelonBase)Main.instance).LoggerInstance.Error("Missing replay"); return new ReplayInfo(); } ExtractVoices(zipArchive, replayHeader); using MemoryStream memoryStream = new MemoryStream(); using Stream stream2 = entry2.Open(); stream2.CopyTo(memoryStream); byte[] compressed = memoryStream.ToArray(); byte[] buffer = ReplayCodec.Decompress(compressed); using MemoryStream input = new MemoryStream(buffer); using BinaryReader binaryReader = new BinaryReader(input); byte[] bytes = binaryReader.ReadBytes(4); string @string = Encoding.ASCII.GetString(bytes); if (@string != "RPLY") { ((MelonBase)Main.instance).LoggerInstance.Error("Invalid replay file (magic=" + @string); return new ReplayInfo(); } ReplayInfo replayInfo = new ReplayInfo(); replayInfo.Header = replayHeader; replayInfo.Frames = ReadFrames(binaryReader, replayInfo, replayHeader.FrameCount, replayHeader.Structures.Length, replayHeader.Players.Length, replayHeader.PedestalCount, replayHeader.ScenePropCount); return replayInfo; } public static void ExtractVoices(ZipArchive zip, ReplayHeader header) { ZipArchiveEntry entry = zip.GetEntry("voices.json"); if (entry == null) { return; } using (StreamReader streamReader = new StreamReader(entry.Open())) { string text = streamReader.ReadToEnd(); header.VoiceTrackInfos = JsonConvert.DeserializeObject(text)?.Tracks ?? new List(); } string path = Path.Combine(MelonEnvironment.UserDataDirectory, "ReplayMod", "TempReplayVoices"); string text2 = Path.Combine(path, header.Guid); if (Directory.Exists(text2)) { Directory.Delete(text2, recursive: true); } Directory.CreateDirectory(text2); foreach (ZipArchiveEntry entry2 in zip.Entries) { if (!entry2.FullName.StartsWith("voices/")) { continue; } string fileName = Path.GetFileName(entry2.FullName); string path2 = Path.Combine(text2, fileName); using Stream stream = entry2.Open(); using FileStream destination = File.Create(path2); stream.CopyTo(destination); } header.VoiceFolder = text2; } private static Frame[] ReadFrames(BinaryReader br, ReplayInfo info, int frameCount, int structureCount, int playerCount, int pedestalCount, int scenePropCount) { Frame[] array = new Frame[frameCount]; StructureState[] array2 = Utilities.NewArray(structureCount); PlayerState[] array3 = Utilities.NewArray(playerCount); PedestalState[] array4 = Utilities.NewArray(pedestalCount); ScenePropState[] array5 = Utilities.NewArray(scenePropCount); for (int i = 0; i < frameCount; i++) { int num = br.ReadInt32(); long position = br.BaseStream.Position + num; Frame frame = new Frame(); frame.Time = br.ReadSingle(); frame.Structures = Utilities.NewArray(structureCount, array2); frame.Players = Utilities.NewArray(playerCount, array3); frame.Pedestals = Utilities.NewArray(pedestalCount, array4); frame.SceneProps = Utilities.NewArray(scenePropCount, array5); List list = new List(); int num2 = br.ReadInt32(); for (int j = 0; j < num2; j++) { ChunkType chunkType = (ChunkType)br.ReadByte(); int num3 = br.ReadInt32(); switch (chunkType) { case ChunkType.StructureState: { StructureState structureState = ReadStructureChunk(br, array2[num3].Clone()); frame.Structures[num3] = structureState; array2[num3] = structureState; break; } case ChunkType.PlayerState: { PlayerState playerState = ReadPlayerChunk(br, array3[num3].Clone()); frame.Players[num3] = playerState; array3[num3] = playerState; break; } case ChunkType.PedestalState: { PedestalState pedestalState = ReadPedestalChunk(br, array4[num3].Clone()); frame.Pedestals[num3] = pedestalState; array4[num3] = pedestalState; break; } case ChunkType.Event: { EventChunk item = ReadEventChunk(br); list.Add(item); break; } case ChunkType.ScenePropState: { ScenePropState scenePropState = ReadScenePropChunk(br, array5[num3].Clone()); frame.SceneProps[num3] = scenePropState; array5[num3] = scenePropState; break; } case ChunkType.Extension: { int extensionId = num3; int index = br.ReadInt32(); int num5 = br.ReadInt32(); long position2 = br.BaseStream.Position + num5; ReplayExtension replayExtension = ReplayAPI.Extensions.FirstOrDefault((ReplayExtension ex) => ex.FrameExtensionId == extensionId); if (replayExtension != null && replayExtension.Enabled.Value) { replayExtension.OnReadFrame(br, frame, index); } br.BaseStream.Position = position2; break; } default: { int num4 = br.ReadInt32(); br.BaseStream.Position += num4; break; } } } frame.Events = list.ToArray(); br.BaseStream.Position = position; array[i] = frame; } return array; } public static T ReadChunk(BinaryReader br, Func ctor, Action readField) where TField : Enum { int num = br.ReadInt32(); long num2 = br.BaseStream.Position + num; T val = ctor(); while (br.BaseStream.Position < num2) { byte value = br.ReadByte(); TField val2 = (TField)Enum.ToObject(typeof(TField), value); ushort num3 = br.ReadUInt16(); long position = br.BaseStream.Position + num3; if (!Enum.IsDefined(typeof(TField), val2)) { br.BaseStream.Position = position; continue; } readField(val, val2, num3, br); br.BaseStream.Position = position; } return val; } private static PlayerState ReadPlayerChunk(BinaryReader br, PlayerState baseState) { return ReadChunk(br, () => baseState, delegate(PlayerState p, PlayerField id, ushort size, BinaryReader r) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00c3: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: 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_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) switch (id) { case PlayerField.VRRigPos: p.VRRigPos = r.ReadVector3(); break; case PlayerField.VRRigRot: p.VRRigRot = r.ReadQuaternion(); break; case PlayerField.LHandPos: p.LHandPos = r.ReadVector3(); break; case PlayerField.LHandRot: p.LHandRot = r.ReadQuaternion(); break; case PlayerField.RHandPos: p.RHandPos = r.ReadVector3(); break; case PlayerField.RHandRot: p.RHandRot = r.ReadQuaternion(); break; case PlayerField.HeadPos: p.HeadPos = r.ReadVector3(); break; case PlayerField.HeadRot: p.HeadRot = r.ReadQuaternion(); break; case PlayerField.currentStack: p.currentStack = r.ReadInt16(); break; case PlayerField.Health: p.Health = r.ReadInt16(); break; case PlayerField.active: p.active = r.ReadBoolean(); break; case PlayerField.activeShiftstoneVFX: p.activeShiftstoneVFX = (PlayerShiftstoneVFX)r.ReadByte(); break; case PlayerField.leftShiftstone: p.leftShiftstone = r.ReadByte(); break; case PlayerField.rightShiftstone: p.rightShiftstone = r.ReadByte(); break; case PlayerField.lgripInput: p.lgripInput = r.ReadSingle(); break; case PlayerField.lthumbInput: p.lthumbInput = r.ReadSingle(); break; case PlayerField.lindexInput: p.lindexInput = r.ReadSingle(); break; case PlayerField.rindexInput: p.rindexInput = r.ReadSingle(); break; case PlayerField.rthumbInput: p.rthumbInput = r.ReadSingle(); break; case PlayerField.rgripInput: p.rgripInput = r.ReadSingle(); break; case PlayerField.rockCamActive: p.rockCamActive = r.ReadBoolean(); break; case PlayerField.rockCamPos: p.rockCamPos = r.ReadVector3(); break; case PlayerField.rockCamRot: p.rockCamRot = r.ReadQuaternion(); break; case PlayerField.armSpan: p.ArmSpan = r.ReadSingle(); break; case PlayerField.length: p.Length = r.ReadSingle(); break; case PlayerField.visualData: { byte[] bytes = r.ReadBytes(size); p.visualData = Encoding.UTF8.GetString(bytes); break; } } }); } private static StructureState ReadStructureChunk(BinaryReader br, StructureState baseState) { return ReadChunk(br, () => baseState, delegate(StructureState s, StructureField id, ushort size, BinaryReader r) { //IL_0034: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) switch (id) { case StructureField.position: s.position = r.ReadVector3(); break; case StructureField.rotation: s.rotation = r.ReadQuaternion(); break; case StructureField.active: s.active = r.ReadBoolean(); break; case StructureField.isFlicked: s.isFlicked = r.ReadBoolean(); break; case StructureField.isLeftHeld: s.isLeftHeld = r.ReadBoolean(); break; case StructureField.isRightHeld: s.isRightHeld = r.ReadBoolean(); break; case StructureField.currentState: s.currentState = (PhysicsState)r.ReadByte(); break; case StructureField.isTargetDisk: s.isTargetDisk = r.ReadBoolean(); break; case StructureField.grounded: break; } }); } private static PedestalState ReadPedestalChunk(BinaryReader br, PedestalState baseState) { return ReadChunk(br, () => baseState, delegate(PedestalState p, PedestalField id, ushort size, BinaryReader r) { //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) switch (id) { case PedestalField.position: p.position = r.ReadVector3(); break; case PedestalField.active: p.active = r.ReadBoolean(); break; } }); } private static EventChunk ReadEventChunk(BinaryReader br) { return ReadChunk(br, () => new EventChunk(), delegate(EventChunk e, EventField id, ushort size, BinaryReader r) { //IL_004b: 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_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) switch (id) { case EventField.type: e.type = (EventType)r.ReadByte(); break; case EventField.position: e.position = r.ReadVector3(); break; case EventField.rotation: e.rotation = r.ReadQuaternion(); break; case EventField.masterId: e.masterId = r.ReadString(); break; case EventField.playerIndex: e.playerIndex = r.ReadInt32(); break; case EventField.damage: e.damage = r.ReadByte(); break; case EventField.fxType: e.fxType = (FXOneShotType)r.ReadByte(); break; case EventField.structureId: e.structureId = r.ReadInt32(); break; case (EventField)4: case (EventField)5: case (EventField)6: break; } }); } private static ScenePropState ReadScenePropChunk(BinaryReader br, ScenePropState baseState) { return ReadChunk(br, () => baseState, delegate(ScenePropState s, ScenePropField id, ushort size, BinaryReader r) { //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_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) switch (id) { case ScenePropField.position: s.position = r.ReadVector3(); break; case ScenePropField.rotation: s.rotation = r.ReadQuaternion(); break; } }); } } [Serializable] public class ReplayInfo { public ReplaySerializer.ReplayHeader Header; public Frame[] Frames; } [Serializable] public class Frame { public float Time; public StructureState[] Structures; public PlayerState[] Players; public PedestalState[] Pedestals; public EventChunk[] Events; public ScenePropState[] SceneProps; private Dictionary ExtensionData = new Dictionary(); public Frame Clone() { Frame frame = new Frame(); frame.Time = Time; frame.Structures = Utilities.NewArray(Structures.Length, Structures); frame.Players = Utilities.NewArray(Players.Length, Players); frame.Pedestals = Utilities.NewArray(Pedestals.Length, Pedestals); frame.Events = Utilities.NewArray(Events.Length, Events); frame.SceneProps = Utilities.NewArray(SceneProps.Length, SceneProps); return frame; } public void SetExtensionData(ReplayExtension extension, object data) { ExtensionData[extension.FrameExtensionId] = data; } public bool TryGetExtensionData(ReplayExtension extension, out T value) { if (ExtensionData.TryGetValue(extension.FrameExtensionId, out var value2) && value2 is T val) { value = val; return true; } value = default(T); return false; } } [Serializable] public class StructureState { public Vector3 position; public Quaternion rotation; public bool active; public bool isLeftHeld; public bool isRightHeld; public bool isFlicked; public PhysicsState currentState; public bool isTargetDisk; public StructureState Clone() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_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) return new StructureState { position = position, rotation = rotation, active = active, isLeftHeld = isLeftHeld, isRightHeld = isRightHeld, isFlicked = isFlicked, currentState = currentState, isTargetDisk = isTargetDisk }; } } [Serializable] public class StructureInfo { public StructureType Type; public int structureId; public int? targetDamage; } public enum StructureField : byte { position, rotation, active, grounded, isLeftHeld, isRightHeld, isFlicked, currentState, isTargetDisk } public enum StructureType : byte { Cube, Pillar, Wall, Disc, Ball, CagedBall, LargeRock, SmallRock, TetheredCagedBall, WrappedWall, PrisonedPillar, DockedDisk, CageCube, Target } [Serializable] public class PlayerState { public Vector3 VRRigPos; public Quaternion VRRigRot; public Vector3 LHandPos; public Quaternion LHandRot; public Vector3 RHandPos; public Quaternion RHandRot; public Vector3 HeadPos; public Quaternion HeadRot; public short currentStack; public short Health; public bool active; public PlayerShiftstoneVFX activeShiftstoneVFX; public int leftShiftstone; public int rightShiftstone; public float lgripInput; public float lindexInput; public float lthumbInput; public float rgripInput; public float rindexInput; public float rthumbInput; public bool rockCamActive; public Vector3 rockCamPos; public Quaternion rockCamRot; public float ArmSpan; public float Length; public string visualData; public PlayerState Clone() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_003d: 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_0049: 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) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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) return new PlayerState { VRRigPos = VRRigPos, VRRigRot = VRRigRot, LHandPos = LHandPos, LHandRot = LHandRot, RHandPos = RHandPos, RHandRot = RHandRot, HeadPos = HeadPos, HeadRot = HeadRot, currentStack = currentStack, Health = Health, active = active, activeShiftstoneVFX = activeShiftstoneVFX, leftShiftstone = leftShiftstone, rightShiftstone = rightShiftstone, lgripInput = lgripInput, lthumbInput = lthumbInput, lindexInput = lindexInput, rgripInput = rgripInput, rindexInput = rindexInput, rthumbInput = rthumbInput, rockCamActive = rockCamActive, rockCamPos = rockCamPos, rockCamRot = rockCamRot, ArmSpan = ArmSpan, Length = Length, visualData = visualData }; } } [Serializable] public class PlayerInfo { public byte ActorId; public string MasterId; public string Name; public int BattlePoints; public short[] EquippedShiftStones; public PlayerMeasurement Measurement; public bool WasHost; public bool IsLocal; public PlayerInfo(Player copyPlayer) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) PlayerData data = copyPlayer.Data; ActorId = (byte)data.GeneralData.ActorNo; MasterId = data.GeneralData.PlayFabMasterId; Name = data.GeneralData.PublicUsername; BattlePoints = data.GeneralData.BattlePoints; EquippedShiftStones = ((IEnumerable)data.EquipedShiftStones).ToArray(); Measurement = data.PlayerMeasurement; short actorNo = data.GeneralData.ActorNo; Player masterClient = PhotonNetwork.MasterClient; WasHost = actorNo == ((masterClient != null) ? new int?(masterClient.ActorNumber) : null); IsLocal = data.GeneralData.PlayFabMasterId == Main.LocalPlayer.Data.GeneralData.PlayFabMasterId; } [JsonConstructor] public PlayerInfo() { } } public enum PlayerField : byte { VRRigPos, VRRigRot, LHandPos, LHandRot, RHandPos, RHandRot, HeadPos, HeadRot, currentStack, Health, active, activeShiftstoneVFX, leftShiftstone, rightShiftstone, lgripInput, lindexInput, lthumbInput, rgripInput, rindexInput, rthumbInput, rockCamActive, rockCamPos, rockCamRot, armSpan, length, visualData } [Flags] public enum PlayerShiftstoneVFX : byte { None = 0, Charge = 1, Adamant = 2, Vigor = 4, Surge = 8 } [Serializable] public class VoiceTrackInfo { public string MasterId; public int ActorId; public int VoiceId; public string FileName; public float StartTime; public VoiceTrackInfo(string MasterId, int ActorId, int VoiceId, string FileName, float StartTime) { this.MasterId = MasterId; this.ActorId = ActorId; this.VoiceId = VoiceId; this.FileName = FileName; this.StartTime = StartTime; } } [Serializable] public class VoiceArchiveData { public List Tracks; } public enum StackType : byte { None, Dash, Jump, Flick, Parry, HoldLeft, HoldRight, Ground, Straight, Uppercut, Kick, Explode } [Serializable] public class PedestalState { public Vector3 position; public bool active; public PedestalState Clone() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) return new PedestalState { position = position, active = active }; } } public enum PedestalField : byte { position, active } [Serializable] public class EventChunk { public EventType type; public Vector3 position; public Quaternion rotation = Quaternion.identity; public string masterId; public int playerIndex; public int structureId = -1; public byte damage; public FXOneShotType fxType; } public enum EventType : byte { OneShotFX = 1 } public enum EventField : byte { type = 0, position = 1, rotation = 2, masterId = 3, playerIndex = 7, damage = 8, fxType = 9, structureId = 10 } [Serializable] public class Marker { public float r; public float g; public float b; public string name { get; set; } public float time { get; set; } public Vector3? position { get; set; } public int? PlayerIndex { get; set; } public Marker(string name, float time, Color color) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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) this.name = name; this.time = time; r = color.r; g = color.g; b = color.b; } } [Serializable] public enum FXOneShotType : byte { None, StructureCollision, Ricochet, Grounded, GroundedSFX, Ungrounded, DustImpact, ImpactLight, ImpactMedium, ImpactHeavy, ImpactMassive, Spawn, Break, BreakDisc, RockCamSpawn, RockCamDespawn, RockCamStick, Fistbump, FistbumpGoin, Jump, Dash, Hitmarker } [Serializable] public class ScenePropState { public Vector3 position; public Quaternion rotation; public ScenePropState Clone() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) return new ScenePropState { position = position, rotation = rotation }; } } public enum ScenePropField : byte { position, rotation } [Serializable] public class ScenePropInfo { public ScenePropType type; } public enum ScenePropType : byte { Fruit } public enum ChunkType : byte { PlayerState = 0, StructureState = 1, PedestalState = 2, Event = 3, ScenePropState = 4, Extension = 250 } } namespace ReplayMod.Replay.Files { public class ReplayExplorer { public enum SortingType { Name, Date, Duration, Map, [Display(Name = "Player Count")] PlayerCount, [Display(Name = "Opponent BP")] OpponentBP, [Display(Name = "Marker Density")] MarkerDensity } public class Entry { public string Name; public string FullPath; public ReplaySerializer.ReplayHeader header; public bool IsFolder; } public List currentReplayEntries = new List(); public int currentIndex = -1; public const int pageSize = 6; public int currentPage = 0; public string RootPath { get; } public string CurrentFolderPath { get; private set; } public int pageCount => Utilities.GetPageCount(currentReplayEntries.Count, 6); public string CurrentReplayPath => (currentIndex >= 0 && currentIndex < currentReplayEntries.Count) ? currentReplayEntries[currentIndex].FullPath : null; public Entry currentlySelectedEntry => (currentIndex >= 0 && currentIndex < currentReplayEntries.Count) ? currentReplayEntries[currentIndex] : null; public ReplayExplorer(string root) { RootPath = root; CurrentFolderPath = root; Refresh(); } public void Refresh() { if (Main.instance.ExplorerSorting != null) { currentReplayEntries = GetEntries(Main.instance.ExplorerSorting.Value); currentIndex = Mathf.Clamp(currentIndex, -1, currentReplayEntries.Count - 1); ReplayAPI.ExplorerRefreshedInternal(); } } public List GetEntries(SortingType sorting = SortingType.Date) { List collection = (from dir in Directory.GetDirectories(CurrentFolderPath) select new Entry { Name = Path.GetFileName(dir), FullPath = dir, IsFolder = true } into e orderby e.Name select e).ToList(); List files = Directory.GetFiles(CurrentFolderPath, "*.replay").Select(delegate(string file) { ReplaySerializer.ReplayHeader manifest; try { manifest = ReplayArchive.GetManifest(file); } catch { return null; } return new Entry { Name = Path.GetFileNameWithoutExtension(file), FullPath = file, header = manifest, IsFolder = false }; }).ToList(); files = SortFiles(files, sorting); List list = new List(); if (CurrentFolderPath != RootPath) { list.Add(new Entry { Name = "..", FullPath = Directory.GetParent(CurrentFolderPath)?.FullName, IsFolder = true }); } list.AddRange(collection); list.AddRange(files); return list; } private List SortFiles(List files, SortingType sorting) { files = files.Where((Entry f) => f != null).ToList(); IOrderedEnumerable orderedEnumerable = (Main.instance.FavoritesFirst.Value ? files.OrderByDescending((Entry f) => f.header?.isFavorited ?? false) : files.OrderBy((Entry _) => 0)); if (1 == 0) { } IOrderedEnumerable orderedEnumerable2 = sorting switch { SortingType.Name => orderedEnumerable.ThenBy((Entry f) => f.Name), SortingType.Date => orderedEnumerable.ThenByDescending((Entry f) => File.GetLastWriteTimeUtc(f.FullPath)), SortingType.Duration => orderedEnumerable.ThenByDescending((Entry f) => f.header?.Duration ?? 0f), SortingType.Map => orderedEnumerable.ThenBy((Entry f) => ReplayFormatting.GetMapName(null, f.header), StringComparer.OrdinalIgnoreCase), SortingType.PlayerCount => orderedEnumerable.ThenByDescending((Entry f) => (f.header?.Players?.Length).GetValueOrDefault()), SortingType.OpponentBP => orderedEnumerable.ThenByDescending((Entry f) => (f.header?.Players != null) ? (from p in f.header.Players where p != null && !p.IsLocal select p.BattlePoints).DefaultIfEmpty(0).Max() : 0), SortingType.MarkerDensity => orderedEnumerable.OrderByDescending(delegate(Entry f) { int valueOrDefault = (f.header?.Markers?.Length).GetValueOrDefault(); float num = f.header?.Duration ?? 0f; return (float)valueOrDefault / num * Mathf.Log((float)(valueOrDefault + 1)); }), _ => orderedEnumerable, }; if (1 == 0) { } orderedEnumerable = orderedEnumerable2; List list = orderedEnumerable.ToList(); if (Main.instance.SortingDirection.Value) { list.Reverse(); } return list; } public List GetPage() { return currentReplayEntries.Skip(currentPage * 6).Take(6).ToList(); } public void Enter(string path) { if (Directory.Exists(path) && path.StartsWith(RootPath, StringComparison.OrdinalIgnoreCase)) { CurrentFolderPath = path; currentIndex = -1; Refresh(); ReplayAPI.ExplorerFolderChangedInternal(CurrentFolderPath); ReplayAPI.ReplaySelectedInternal(null, CurrentFolderPath); } } public void GoUp() { if (!(CurrentFolderPath == RootPath)) { DirectoryInfo parent = Directory.GetParent(CurrentFolderPath); if (parent != null) { CurrentFolderPath = parent.FullName; currentIndex = -1; Refresh(); ReplayAPI.ExplorerFolderChangedInternal(CurrentFolderPath); ReplayAPI.ReplaySelectedInternal(null, CurrentFolderPath); } } } public void Next() { if (currentReplayEntries.Count == 0 || currentReplayEntries.All((Entry e) => e.IsFolder)) { return; } do { currentIndex++; if (currentIndex > currentReplayEntries.Count - 1) { currentIndex = -1; } } while (currentIndex != -1 && currentReplayEntries[currentIndex].IsFolder); } public void Previous() { if (currentReplayEntries.Count == 0 || currentReplayEntries.All((Entry e) => e.IsFolder)) { return; } do { currentIndex--; if (currentIndex < -1) { currentIndex = currentReplayEntries.Count - 1; } } while (currentIndex != -1 && currentReplayEntries[currentIndex].IsFolder); } public bool Select(int index) { if (index < 0 || index >= currentReplayEntries.Count) { return false; } Entry entry = currentReplayEntries[index]; if (entry.IsFolder) { Enter(entry.FullPath); return false; } currentIndex = index; return true; } } public static class ReplayFiles { public static string replayFolder = MelonEnvironment.UserDataDirectory + "\\ReplayMod"; public static ReplayTable table; public static bool metadataHidden = false; private static object metadataHeightRoutine; private static object metadataScaleRoutine; public static FileSystemWatcher replayWatcher; public static FileSystemWatcher metadataFormatWatcher; public static bool reloadQueued; public static bool suppressWatcher; public static ReplayExplorer explorer; public static Texture2D folderIcon; public static Texture2D replayIcon; public static ReplaySerializer.ReplayHeader currentHeader = null; public static void Init() { Directory.CreateDirectory(Path.Combine(replayFolder, "Replays")); EnsureDefaultFormats(); StartWatchingReplays(); explorer = new ReplayExplorer(Path.Combine(replayFolder, "Replays")); } public static void EnsureDefaultFormats() { string path = Path.Combine(replayFolder, "Settings", "MetadataFormats"); Directory.CreateDirectory(path); string path2 = Path.Combine(replayFolder, "Settings", "AutoNameFormats"); Directory.CreateDirectory(path2); WriteIfNotExists("MetadataFormats/metadata_gym.txt", "Available tags:\n{Host}\n{Client} - first non-host player\n{LocalPlayer} - the person who recorded the replay\n{Player#}\n{Scene}\n{Map} - same as {Scene}\n{DateTime}\n{PlayerCount} - e.g. '1 player', '3 players'\n{PlayerList} - Can specify how many player names are shown\n{AveragePing}\n{MinimumPing} - The lowest ping in the recording\n{MaximumPing} - The highest ping in the recording\n{Version}\n{StructureCount}\n{MarkerCount}\n{Duration}\n{FPS} - Target FPS of the recording\n\nYou can pass parameters to tags using ':'.\nExample: {PlayerList:3}, {DateTime:yyyyMMdd}\n\n###\n{Title}\n{DateTime:yyyy-MM-dd HH:mm:ss}\nVersion {Version}\nDuration: {Duration}"); WriteIfNotExists("MetadataFormats/metadata_park.txt", "Available tags:\n{Host}\n{Client} - first non-host player\n{LocalPlayer} - the person who recorded the replay\n{Player#}\n{Scene}\n{Map} - same as {Scene}\n{DateTime}\n{PlayerCount} - e.g. '1 player', '3 players'\n{PlayerList} - Can specify how many player names are shown\n{AveragePing}\n{MinimumPing} - The lowest ping in the recording\n{MaximumPing} - The highest ping in the recording\n{Version}\n{StructureCount}\n{MarkerCount}\n{Duration}\n{FPS} - Target FPS of the recording\n\nYou can pass parameters to tags using ':'.\nExample: {PlayerList:3}, {DateTime:yyyyMMdd}\n\n###\n{Title}\n{DateTime:yyyy-MM-dd HH:mm:ss}\nVersion {Version}\n\n{Scene}\n-----------\nHost: {Host}\nPing: {AveragePing} ms ({MinimumPing}-{MaximumPing})\n\n{PlayerList:3}\nDuration: {Duration}"); WriteIfNotExists("MetadataFormats/metadata_match.txt", "Available tags:\n{Host}\n{Client} - first non-host player\n{LocalPlayer} - the person who recorded the replay\n{Player#}\n{Scene}\n{Map} - same as {Scene}\n{DateTime}\n{PlayerCount} - e.g. '1 player', '3 players'\n{PlayerList} - Can specify how many player names are shown\n{AveragePing}\n{MinimumPing} - The lowest ping in the recording\n{MaximumPing} - The highest ping in the recording\n{Version}\n{StructureCount}\n{MarkerCount}\n{Duration}\n{FPS} - Target FPS of the recording\n\nYou can pass parameters to tags using ':'.\nExample: {PlayerList:3}, {DateTime:yyyyMMdd}\n\n###\n{Title}\n{DateTime:yyyy-MM-dd HH:mm:ss}\nVersion {Version}\n\n{Scene}\n-----------\nHost: {Host}\nPing: {AveragePing} ms ({MinimumPing}-{MaximumPing})\nDuration: {Duration}"); WriteIfNotExists("AutoNameFormats/gym.txt", "Available tags:\n{Host}\n{Client} - first non-host player\n{LocalPlayer} - the person who recorded the replay\n{Player#}\n{Scene}\n{Map} - same as {Scene}\n{DateTime}\n{PlayerCount} - e.g. '1 player', '3 players'\n{PlayerList} - Can specify how many player names are shown\n{AveragePing}\n{MinimumPing} - The lowest ping in the recording\n{MaximumPing} - The highest ping in the recording\n{Version}\n{StructureCount}\n{MarkerCount}\n{Duration}\n{FPS} - Target FPS of the recording\n\nYou can pass parameters to tags using ':'.\nExample: {PlayerList:3}, {DateTime:yyyyMMdd}\n\n###\n{LocalPlayer} - {Scene}"); WriteIfNotExists("AutoNameFormats/park.txt", "Available tags:\n{Host}\n{Client} - first non-host player\n{LocalPlayer} - the person who recorded the replay\n{Player#}\n{Scene}\n{Map} - same as {Scene}\n{DateTime}\n{PlayerCount} - e.g. '1 player', '3 players'\n{PlayerList} - Can specify how many player names are shown\n{AveragePing}\n{MinimumPing} - The lowest ping in the recording\n{MaximumPing} - The highest ping in the recording\n{Version}\n{StructureCount}\n{MarkerCount}\n{Duration}\n{FPS} - Target FPS of the recording\n\nYou can pass parameters to tags using ':'.\nExample: {PlayerList:3}, {DateTime:yyyyMMdd}\n\n###\n{Host} - {Scene}\n"); WriteIfNotExists("AutoNameFormats/match.txt", "Available tags:\n{Host}\n{Client} - first non-host player\n{LocalPlayer} - the person who recorded the replay\n{Player#}\n{Scene}\n{Map} - same as {Scene}\n{DateTime}\n{PlayerCount} - e.g. '1 player', '3 players'\n{PlayerList} - Can specify how many player names are shown\n{AveragePing}\n{MinimumPing} - The lowest ping in the recording\n{MaximumPing} - The highest ping in the recording\n{Version}\n{StructureCount}\n{MarkerCount}\n{Duration}\n{FPS} - Target FPS of the recording\n\nYou can pass parameters to tags using ':'.\nExample: {PlayerList:3}, {DateTime:yyyyMMdd}\n\n###\n{Host} vs {Client} - {Scene}"); static void WriteIfNotExists(string filePath, string contents) { string path3 = Path.Combine(replayFolder, "Settings", filePath); if (!File.Exists(path3)) { File.WriteAllText(path3, contents); } } } public static string LoadFormatFile(string path) { string path2 = Path.Combine(replayFolder, "Settings", path + ".txt"); if (!File.Exists(path2)) { return null; } string[] array = File.ReadAllLines(path2); int num = Array.FindIndex(array, (string line) => line.Trim() == "###"); if (num == -1 || num + 1 >= array.Length) { return null; } IEnumerable values = array.Skip(num + 1); return string.Join("\n", values); } public static string GetMetadataFormat(string scene) { if (1 == 0) { } string result; switch (scene) { case "Gym": result = LoadFormatFile("MetadataFormats/metadata_gym"); break; case "Park": result = LoadFormatFile("MetadataFormats/metadata_park"); break; case "Map0": case "Map1": result = LoadFormatFile("MetadataFormats/metadata_match"); break; default: result = "{Title}\n{DateTime:yyyy-MM-dd HH:mm:ss}\nVersion {Version}\nDuration: {Duration}\n\n{StructureCount}"; break; } if (1 == 0) { } return result; } private static void StartWatchingReplays() { replayWatcher = new FileSystemWatcher(Path.Combine(replayFolder, "Replays")); replayWatcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.LastWrite | NotifyFilters.CreationTime; replayWatcher.Created += OnReplayFolderChanged; replayWatcher.Deleted += OnReplayFolderChanged; replayWatcher.Renamed += OnReplayFolderChanged; replayWatcher.EnableRaisingEvents = true; replayWatcher.IncludeSubdirectories = true; metadataFormatWatcher = new FileSystemWatcher(Path.Combine(replayFolder, "Settings", "MetadataFormats"), "*.txt"); metadataFormatWatcher.NotifyFilter = NotifyFilters.LastWrite; metadataFormatWatcher.Changed += OnFormatChanged; metadataFormatWatcher.EnableRaisingEvents = true; } private static void OnReplayFolderChanged(object sender, FileSystemEventArgs e) { if (!reloadQueued && !suppressWatcher) { reloadQueued = true; MelonCoroutines.Start(Reload()); } static IEnumerator Reload() { yield return (object)new WaitForSeconds(0.25f); ReloadReplays(); reloadQueued = false; } } private static void OnFormatChanged(object sender, FileSystemEventArgs e) { if (!string.IsNullOrEmpty(explorer.CurrentReplayPath) && currentHeader != null) { string metadataFormat = GetMetadataFormat(currentHeader.Scene); ((TMP_Text)table.metadataText).text = ReplayFormatting.FormatReplayString(metadataFormat, currentHeader); ((TMP_Text)table.metadataText).ForceMeshUpdate(false, false); } } public static void HideMetadata() { //IL_0118: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)table.metadataText == (Object)null) && !metadataHidden) { metadataHidden = true; if (metadataHeightRoutine != null) { MelonCoroutines.Stop(metadataHeightRoutine); } if (metadataScaleRoutine != null) { MelonCoroutines.Stop(metadataScaleRoutine); } metadataHeightRoutine = MelonCoroutines.Start(Utilities.LerpValue((Func)(() => table.desiredMetadataTextHeight), (Action)delegate(float v) { table.desiredMetadataTextHeight = v; }, (Func)Mathf.Lerp, 1.5229f, 1f, (Func)Utilities.EaseInOut, (Action)null, 0f, (Func)null)); metadataScaleRoutine = MelonCoroutines.Start(Utilities.LerpValue((Func)(() => table.metadataText.transform.localScale), (Action)delegate(Vector3 v) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) table.metadataText.transform.localScale = v; }, (Func)Vector3.Lerp, Vector3.zero, 1.3f, (Func)Utilities.EaseInOut, (Action)null, 0f, (Func)null)); } } public static void ShowMetadata() { //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)table.metadataText == (Object)null) && metadataHidden) { metadataHidden = false; if (metadataHeightRoutine != null) { MelonCoroutines.Stop(metadataHeightRoutine); } if (metadataScaleRoutine != null) { MelonCoroutines.Stop(metadataScaleRoutine); } MelonCoroutines.Start(Utilities.LerpValue((Func)(() => table.desiredMetadataTextHeight), (Action)delegate(float v) { table.desiredMetadataTextHeight = v; }, (Func)Mathf.Lerp, 1.9514f, 1.3f, (Func)Utilities.EaseInOut, (Action)null, 0f, (Func)null)); MelonCoroutines.Start(Utilities.LerpValue((Func)(() => table.metadataText.transform.localScale), (Action)delegate(Vector3 v) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) table.metadataText.transform.localScale = v; }, (Func)Vector3.Lerp, Vector3.one * 0.25f, 1.3f, (Func)Utilities.EaseInOut, (Action)null, 0f, (Func)null)); } } public static string BuildPlayerLine(PlayerInfo[] players, int maxNames) { if (players == null || players.Length == 0) { return string.Empty; } int num = players.Length; int num2 = Math.Min(num, maxNames); List list = new List(num2); for (int i = 0; i < num2; i++) { if (players[i] != null) { list.Add(players[i].Name + "<#FFF>"); } } string text = string.Join(", ", list); if (num > maxNames) { text += $" +{num - maxNames} others"; } return $"{num} player{((num == 1) ? "" : "s")}\n{text}\n"; } public static void SelectReplayFromExplorer() { //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)table.replayNameText == (Object)null) { return; } string currentReplayPath = explorer.CurrentReplayPath; int value = explorer.currentReplayEntries.Count((ReplayExplorer.Entry e) => !e.IsFolder); int currentIndex = explorer.currentIndex; int value2 = ((currentIndex >= 0) ? explorer.currentReplayEntries.Take(currentIndex + 1).Count((ReplayExplorer.Entry e) => !e.IsFolder) : 0); ReplayExplorer.Entry currentlySelectedEntry = explorer.currentlySelectedEntry; if (Directory.GetFiles(Path.Combine(replayFolder, "Replays"), "*.replay", SearchOption.AllDirectories).Length == 0) { currentHeader = null; ((TMP_Text)table.replayNameText).text = "No Replays Yet\nPlay a match to record one!\nOther recording options in ModUI"; HideMetadata(); ReplaySettings.replayExplorerGO.SetActive(false); ReplaySettings.replaySettingsGO.SetActive(false); ((Component)ReplaySettings.replayExplorerGO.transform.parent.parent).gameObject.SetActive(false); } else if (string.IsNullOrEmpty(currentReplayPath) || currentlySelectedEntry == null || currentlySelectedEntry.IsFolder) { currentHeader = null; ((TMP_Text)table.replayNameText).text = "No Replay Selected"; HideMetadata(); ReplaySettings.replayExplorerGO.SetActive(true); ReplaySettings.replaySettingsGO.SetActive(false); ((Component)ReplaySettings.replayExplorerGO.transform.parent.parent).gameObject.SetActive(true); explorer.Refresh(); RefreshUI(); } else { try { ReplaySerializer.ReplayHeader replayHeader = (currentHeader = explorer.currentlySelectedEntry.header); ((TMP_Text)table.replayNameText).text = ReplayFormatting.GetReplayDisplayName(currentReplayPath, replayHeader); Main.instance.replaySettings.Show(currentReplayPath); string metadataFormat = GetMetadataFormat(replayHeader.Scene); ((TMP_Text)table.metadataText).text = ReplayFormatting.FormatReplayString(metadataFormat, replayHeader); ShowMetadata(); ReplayAPI.ReplaySelectedInternal(explorer.currentlySelectedEntry, currentReplayPath); } catch (Exception value3) { Main.ReplayError($"Failed to load replay `{currentReplayPath}`: {value3}"); explorer.Select(-1); currentHeader = null; ((TMP_Text)table.replayNameText).text = "Invalid Replay"; HideMetadata(); ReplaySettings.replayExplorerGO.SetActive(true); ReplaySettings.replaySettingsGO.SetActive(false); ((Component)ReplaySettings.replayExplorerGO.transform.parent.parent).gameObject.SetActive(true); explorer.Refresh(); RefreshUI(); } } ((TMP_Text)table.indexText).text = $"{value2} / {value}"; ((TMP_Text)table.replayNameText).ForceMeshUpdate(false, false); ((TMP_Text)table.indexText).ForceMeshUpdate(false, false); ((TMP_Text)table.metadataText).ForceMeshUpdate(false, false); ApplyTMPSettings(table.indexText, 5f, 0.51f, apply: false); ApplyTMPSettings(table.metadataText, 15f, 2f, apply: true); ((Component)table.replayNameText).GetComponent().sizeDelta = new Vector2(3f, 0.7f); ((Component)ReplaySettings.replayExplorerGO.transform.GetChild(6).GetChild(1)).GetComponent().sizeDelta = new Vector2(0.51f, 0.11f); ((TMP_Text)table.metadataText).enableAutoSizing = true; } public static void ReloadReplays() { if ((Object)(object)ReplaySettings.replayExplorerGO == (Object)null) { return; } string previousGuid = currentHeader?.Guid; explorer.currentPage = 0; explorer.Refresh(); if (explorer.pageCount == 0) { explorer.Select(-1); ReplaySettings.replayExplorerGO.SetActive(true); ReplaySettings.replaySettingsGO.SetActive(false); ((Component)ReplaySettings.replayExplorerGO.transform.parent.parent).gameObject.SetActive(false); return; } ((Component)ReplaySettings.replayExplorerGO.transform.parent.parent).gameObject.SetActive(true); if (!string.IsNullOrEmpty(previousGuid)) { int index = explorer.currentReplayEntries.Select((ReplayExplorer.Entry entry, int i) => new { entry, i }).FirstOrDefault(x => x.entry.header?.Guid == previousGuid)?.i ?? (-1); explorer.Select(index); } else { explorer.Select(-1); ReplaySettings.replayExplorerGO.SetActive(true); ReplaySettings.replaySettingsGO.SetActive(false); } RefreshUI(); SelectReplayFromExplorer(); } public static void RefreshUI() { //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ReplaySettings.replayExplorerGO == (Object)null) { return; } List page = explorer.GetPage(); Il2CppArrayBase componentsInChildren = ReplaySettings.replayExplorerGO.GetComponentsInChildren(true); ((TMP_Text)((Component)ReplaySettings.replayExplorerGO.transform.GetChild(7).GetChild(0)).GetComponent()).text = Utilities.FormatPage(explorer.currentPage, explorer.pageCount); ((TMP_Text)((Component)ReplaySettings.replayExplorerGO.transform.GetChild(6).GetChild(1)).GetComponent()).text = Path.GetRelativePath(replayFolder, explorer.CurrentFolderPath); MelonCoroutines.Start(ApplySizeDelta()); ((TMP_Text)table.indexText).text = $"0 / {explorer.currentReplayEntries.Count((ReplayExplorer.Entry e) => !e.IsFolder)}"; ((TMP_Text)table.indexText).ForceMeshUpdate(false, false); for (int i = 0; i < componentsInChildren.Length; i++) { int num = i; PlayerTag val = componentsInChildren[num]; InteractionButton component = ((Component)((Component)val).transform.GetChild(0)).GetComponent(); if (num >= page.Count) { ((Component)val).gameObject.SetActive(false); continue; } ((Component)val).gameObject.SetActive(true); ReplayExplorer.Entry entry = page[num]; int globalIndex = explorer.currentReplayEntries.IndexOf(entry); val.username.text = ReplayFormatting.GetReplayDisplayName(entry.FullPath, entry.header, entry.Name); val.username.ForceMeshUpdate(false, false); ((UnityEventBase)component.OnPressed).RemoveAllListeners(); component.OnPressed.AddListener(UnityAction.op_Implicit((Action)delegate { SelectReplay(globalIndex); })); MeshRenderer component2 = ((Component)((Component)component).transform.GetChild(1).GetChild(3)).GetComponent(); ((Renderer)component2).material.SetTexture("_Texture", (Texture)(object)(entry.IsFolder ? folderIcon : replayIcon)); ((Component)component2).transform.localScale = (Vector3)(entry.IsFolder ? (Vector3.one * 0.0522f) : new Vector3(0.0422f, 0.0402f, 0.0422f)); ((Component)((Component)component).transform.GetChild(1).GetChild(7)).gameObject.SetActive(!entry.IsFolder && entry.header.isFavorited); } static IEnumerator ApplySizeDelta() { yield return null; ((Component)ReplaySettings.replayExplorerGO.transform.GetChild(6).GetChild(1)).GetComponent().sizeDelta = new Vector2(0.51f, 0.11f); } } public static void SelectReplay(int index) { if (explorer.Select(index)) { SelectReplayFromExplorer(); } else { RefreshUI(); } } public static void NextReplay() { explorer.Next(); SelectReplayFromExplorer(); } public static void PreviousReplay() { explorer.Previous(); SelectReplayFromExplorer(); } public static void LoadReplays() { explorer.Refresh(); SelectReplayFromExplorer(); } private static void ApplyTMPSettings(TextMeshPro text, float horizontal, float vertical, bool apply) { if (!((Object)(object)text == (Object)null)) { ((TMP_Text)text).horizontalAlignment = (HorizontalAlignmentOptions)2; RectTransform component = ((Component)text).GetComponent(); component.SetSizeWithCurrentAnchors((Axis)0, horizontal); component.SetSizeWithCurrentAnchors((Axis)1, vertical); if (apply) { ((TMP_Text)text).fontSizeMin = 0.1f; ((TMP_Text)text).fontSizeMax = 7f; ((TMP_Text)text).enableWordWrapping = true; ((TMP_Text)text).overflowMode = (TextOverflowModes)0; ((TMP_Text)text).enableAutoSizing = true; ((TMP_Text)text).enableWordWrapping = false; } } } } } namespace ReplayMod.Core { public static class BuildInfo { public const string Name = "ReplayMod"; public const string Author = "ERROR"; public const string Version = "1.2.0"; public const string FormatVersion = "1.1.0"; } public class Main : MelonMod { public enum ControllerAction { None, [Display(Name = "Toggle Recording")] ToggleRecording, [Display(Name = "Save Replay Buffer")] SaveReplayBuffer, [Display(Name = "Add Marker")] AddMarker } public static Main instance; public static bool isSceneReady; public static ReplayPlayback Playback; public static ReplayRecording Recording; public Transform leftHand; public Transform rightHand; public Transform head; public string leftShiftstonePool; public string rightShiftstonePool; public GameObject clapperboardVFX; public bool hasPlayed; public float heldTime; public float soundTimer = 0f; public float lastTriggerTime = 0f; public bool UIInitialized = false; public ReplayTable replayTable; public GameObject flatLandRoot; public bool? lastFlatLandActive; public ReplaySettings replaySettings; public object crystalBreakCoroutine; public const float errorsArmspan = 1.2744f; private const string USER_DATA = "UserData/ReplayMod/Settings/"; private const string CONFIG_FILE = "config.cfg"; public MelonPreferences_Entry TargetRecordingFPS = new MelonPreferences_Entry(); public MelonPreferences_Entry AutoRecordMatches = new MelonPreferences_Entry(); public MelonPreferences_Entry AutoRecordParks = new MelonPreferences_Entry(); public MelonPreferences_Entry HandFingerRecording = new MelonPreferences_Entry(); public MelonPreferences_Entry CloseHandsOnPose = new MelonPreferences_Entry(); public MelonPreferences_Entry VoiceRecording = new MelonPreferences_Entry(); public MelonPreferences_Entry voiceBitrate = new MelonPreferences_Entry(); public MelonPreferences_Entry EnableMatchEndMarker = new MelonPreferences_Entry(); public MelonPreferences_Entry EnableRoundEndMarker = new MelonPreferences_Entry(); public MelonPreferences_Entry EnableLargeDamageMarker; public MelonPreferences_Entry DamageThreshold; public MelonPreferences_Entry DamageWindow; public MelonPreferences_Entry StopReplayWhenDone; public MelonPreferences_Entry PlaybackControlsFollow; public MelonPreferences_Entry DestroyControlsOnPunch; public MelonPreferences_Entry ToggleUI; public MelonPreferences_Entry ToggleNameplate; public MelonPreferences_Entry ToggleHealthBar; public MelonPreferences_Entry ToggleDust; public MelonPreferences_Entry ToggleHitmarkers; public MelonPreferences_Entry ToggleRockCam; public MelonPreferences_Entry ToggleVoices; public MelonPreferences_Entry ExplorerSorting; public MelonPreferences_Entry SortingDirection; public MelonPreferences_Entry FavoritesFirst; public MelonPreferences_Entry ReplayBufferEnabled; public MelonPreferences_Entry ReplayBufferDuration; public MelonPreferences_Entry LeftHandControls; public MelonPreferences_Entry RightHandControls; public MelonPreferences_Entry EnableHaptics; public MelonPreferences_Entry tableOffset; public MelonPreferences_Entry enableDebug; public static string currentScene => Scene.GetSceneName(); public static Player LocalPlayer => Singleton.instance.localPlayer; public Main() { instance = this; } public static void ReplayError(string message = null, Vector3 position = default(Vector3)) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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) try { if (position == default(Vector3) && (Object)(object)instance.head != (Object)null) { position = instance.head.position; } Singleton.instance.Play(ReplayCache.SFX["Call_Measurement_Failure"], position, false); } catch { } if (!string.IsNullOrEmpty(message)) { ((MelonBase)instance).LoggerInstance.Error(message); } } public static void DebugLog(string message) { MelonPreferences_Entry obj = instance.enableDebug; if (obj != null && obj.Value && !string.IsNullOrEmpty(message)) { ((MelonBase)instance).LoggerInstance.Warning(message); } } public override void OnInitializeMelon() { if (!Directory.Exists("UserData/ReplayMod/Settings/")) { Directory.CreateDirectory("UserData/ReplayMod/Settings/"); } string filePath = Path.Combine("UserData/ReplayMod/Settings/", "config.cfg"); MelonPreferences_Category val = MelonPreferences.CreateCategory("Recording"); val.SetFilePath(filePath); TargetRecordingFPS = val.CreateEntry("Recording_FPS", 50, "Recording FPS", "The target frame rate used when recording replays.\nThis is limited by the game's actual frame rate.", false, false, (ValueValidator)null, (string)null); AutoRecordMatches = val.CreateEntry("Automatically_Record_Matches", true, "Automatically Record Matches", "Automatically start recording when you join a match", false, false, (ValueValidator)null, (string)null); AutoRecordParks = val.CreateEntry("Automatically_Record_Parks", false, "Automatically Record Parks", "Automatically start recording when you join a park", false, false, (ValueValidator)null, (string)null); HandFingerRecording = val.CreateEntry("Finger_Animation_Recording", true, "Finger Animation Recording", "Controls whether finger input values are recorded into the replay.", false, false, (ValueValidator)null, (string)null); CloseHandsOnPose = val.CreateEntry("Close_Hands_On_Pose", true, "Close Hands On Pose", "Closes the hands of a clone when they do a pose.", false, false, (ValueValidator)null, (string)null); MelonPreferences_Category val2 = MelonPreferences.CreateCategory("Voices"); VoiceRecording = val2.CreateEntry("Voice_Recording", false, "Record In-Game Voices", "Toggles whether in-game voices are recorded into replays.", false, false, (ValueValidator)null, (string)null); voiceBitrate = val2.CreateEntry("Voice_Bitrate", 30, "Voice Bitrate (kbps)", "Determines what bitrate voices are recorded in.\nDefault: 30", false, false, (ValueValidator)null, (string)null); MelonPreferences_Category val3 = MelonPreferences.CreateCategory("Automatic_Markers", "Automatic Markers"); val3.SetFilePath(filePath); EnableMatchEndMarker = val3.CreateEntry("Match_End_Marker", true, "Match End Marker", "Automatically adds a marker at the end of a match.", false, false, (ValueValidator)null, (string)null); EnableRoundEndMarker = val3.CreateEntry("Round_End_Marker", true, "Round End Marker", "Automatically adds a marker at the end of a round.", false, false, (ValueValidator)null, (string)null); EnableLargeDamageMarker = val3.CreateEntry("Large_Damage_Marker", false, "Large Damage Marker", "Automatically adds a marker when a player takes a large amount of damage in a short amount of time.", false, false, (ValueValidator)null, (string)null); DamageThreshold = val3.CreateEntry("Damage_Threshold", 12, "Damage Threshold", "The minimum total damage required to create a marker.", false, false, (ValueValidator)null, (string)null); DamageWindow = val3.CreateEntry("Damage_Window", 1f, "Damage Window (Seconds)", "The time window (in seconds) during which damage is summed to determine whether a marker should be created.", false, false, (ValueValidator)null, (string)null); MelonPreferences_Category val4 = MelonPreferences.CreateCategory("Playback"); val4.SetFilePath(filePath); StopReplayWhenDone = val4.CreateEntry("Stop_Replay_On_Finished", false, "Stop Replay On Finished", "Stops a replay when it reaches the end or beginning of its duration.", false, false, (ValueValidator)null, (string)null); PlaybackControlsFollow = val4.CreateEntry("Playback_Controls_Follow_Player", false, "Playback Controls Follow Player", "Makes the playback controls menu follow you when opened.", false, false, (ValueValidator)null, (string)null); DestroyControlsOnPunch = val4.CreateEntry("Destroy_Controls_On_Punch", true, "Destroy Controls On Punch", "Destroys the playback controls when you punch the slab hard enough.", false, false, (ValueValidator)null, (string)null); MelonPreferences_Category val5 = MelonPreferences.CreateCategory("Visual Toggles"); val5.SetFilePath(filePath); ToggleUI = val5.CreateEntry("Toggle_UI", true, "Toggle UI", "Toggles whether the UI for selecting replays is visible.", false, false, (ValueValidator)null, (string)null); ToggleNameplate = val5.CreateEntry("Toggle_Player_Nameplates", false, "Toggle Player Nameplates", "Toggles whether the nameplate on replay clones are visible", false, false, (ValueValidator)null, (string)null); ToggleHealthBar = val5.CreateEntry("Toggle_Player_Healthbars", true, "Toggle Player Healthbars", "Toggles whether the healthbar on replay clones are visible.", false, false, (ValueValidator)null, (string)null); ToggleDust = val5.CreateEntry("Toggle_Dust", true, "Toggle Dust", "Toggles whether dust from replay structures are visible.", false, false, (ValueValidator)null, (string)null); ToggleHitmarkers = val5.CreateEntry("Toggle_Hitmarkers", true, "Toggle Hitmarkers", "Toggles whether hitmarkers (on remote player damage) are visible.", false, false, (ValueValidator)null, (string)null); ToggleRockCam = val5.CreateEntry("Toggle_Rock_Cam", true, "Toggle Rock Cam", "Toggles whether replay clones Rock Cams are visible.", false, false, (ValueValidator)null, (string)null); ToggleVoices = val5.CreateEntry("Toggle_Voices", true, "Toggle Voice Playback", "Toggles whether replay clones playback the recorded speech.", false, false, (ValueValidator)null, (string)null); MelonPreferences_Category val6 = MelonPreferences.CreateCategory("Replay_Explorer", "Replay Explorer"); val6.SetFilePath(filePath); ExplorerSorting = val6.CreateEntry("Sorting_Option", ReplayExplorer.SortingType.Date, "Sorting Option", "The sorting option for the list of replays.", false, false, (ValueValidator)null, (string)null); SortingDirection = val6.CreateEntry("Reverse_Sorting", false, "Reverse Sorting", "If enabled, reverses the sort order.", false, false, (ValueValidator)null, (string)null); FavoritesFirst = val6.CreateEntry("Favorites_First", true, "Put Favorites First", "Toggles whether favorited replays should always come first in the list.", false, false, (ValueValidator)null, (string)null); MelonPreferences_Category val7 = MelonPreferences.CreateCategory("Buffer"); val7.SetFilePath(filePath); ReplayBufferEnabled = val7.CreateEntry("Enable_Replay_Buffer", false, "Enable Replay Buffer", "Keeps a rolling buffer of recent gameplay that can be saved as a replay.", false, false, (ValueValidator)null, (string)null); ReplayBufferDuration = val7.CreateEntry("Replay_Buffer_Duration", 30, "Replay Buffer Duration (seconds)", "How much gameplay time (in seconds) is kept in the replay buffer.", false, false, (ValueValidator)null, (string)null); MelonPreferences_Category val8 = MelonPreferences.CreateCategory("Controls"); val8.SetFilePath(filePath); LeftHandControls = val8.CreateEntry("Left_Controller_Binding", ControllerAction.None, "Left Controller Binding", "Selects the action performed when both buttons on the left controller are pressed at the same time.", false, false, (ValueValidator)null, (string)null); RightHandControls = val8.CreateEntry("Right_Controller_Binding", ControllerAction.None, "Right Controller Binding", "Selects the action performed when both buttons on the right controller are pressed at the same time.", false, false, (ValueValidator)null, (string)null); EnableHaptics = val8.CreateEntry("Enable_Haptics", true, "Enable Haptics", "Plays controller haptics when actions such as saving a replay or adding a marker are performed.", false, false, (ValueValidator)null, (string)null); if (ReplayAPI.Extensions.Any()) { foreach (ReplayExtension extension in ReplayAPI.Extensions) { MelonPreferences_Category val9 = MelonPreferences.CreateCategory("Extension_" + extension.Id, extension.Id ?? ""); val9.SetFilePath(filePath); MelonPreferences_Entry enabled = val9.CreateEntry("Enabled", true, "Toggle " + extension.Id, "Toggles the extension on/off", false, false, (ValueValidator)null, (string)null); extension.Enabled = enabled; } } MelonPreferences_Category val10 = MelonPreferences.CreateCategory("Other"); val10.SetFilePath(filePath); tableOffset = val10.CreateEntry("Replay_Table_Height_Offset", 0f, "Replay Table Height Offset", "Adjusts the vertical offset of the replay table in meters.\nUseful if the table feels too high or too low.", false, false, (ValueValidator)null, (string)null); enableDebug = val10.CreateEntry("Enable_Debug", false, "Enable Debug", "Enables debug logs.\nIf something breaks, turn this on and wait for it to happen again.\nInclude your log when reporting bugs to ERROR.", false, false, (ValueValidator)null, (string)null); ((MelonEventBase>)(object)ReplayBufferEnabled.OnEntryValueChanged).Subscribe((LemonAction)delegate(bool _, bool value) { if (value && !Recording.isBuffering) { Recording.StartBuffering(); } Recording.isBuffering = value; }, 0, false); ((MelonEventBase>)(object)ExplorerSorting.OnEntryValueChanged).Subscribe((LemonAction)delegate { ReplayFiles.ReloadReplays(); }, 0, false); ((MelonEventBase>)(object)SortingDirection.OnEntryValueChanged).Subscribe((LemonAction)delegate { ReplayFiles.ReloadReplays(); }, 0, false); ((MelonEventBase>)(object)FavoritesFirst.OnEntryValueChanged).Subscribe((LemonAction)delegate { ReplayFiles.ReloadReplays(); }, 0, false); ((MelonEventBase>)(object)ToggleNameplate.OnEntryValueChanged).Subscribe((LemonAction)delegate(bool _, bool value) { ReplayPlayback playback3 = Playback; if (playback3 != null && playback3.isPlaying) { ReplayPlayback.Clone[] playbackPlayers4 = Playback.PlaybackPlayers; foreach (ReplayPlayback.Clone clone4 in playbackPlayers4) { ((Component)clone4.Controller.PlayerNameTag).gameObject.SetActive(value); } } }, 0, false); ((MelonEventBase>)(object)ToggleHealthBar.OnEntryValueChanged).Subscribe((LemonAction)delegate(bool _, bool value) { ReplayPlayback playback2 = Playback; if (playback2 != null && playback2.isPlaying) { ReplayPlayback.Clone[] playbackPlayers3 = Playback.PlaybackPlayers; foreach (ReplayPlayback.Clone clone3 in playbackPlayers3) { ((Component)((Component)clone3.Controller.PlayerHealth).transform.GetChild(1)).gameObject.SetActive(value); } } }, 0, false); ((MelonEventBase>)(object)ToggleRockCam.OnEntryValueChanged).Subscribe((LemonAction)delegate(bool _, bool value) { ReplayPlayback playback = Playback; if (playback != null && playback.isPlaying) { ReplayPlayback.Clone[] playbackPlayers2 = Playback.PlaybackPlayers; foreach (ReplayPlayback.Clone clone2 in playbackPlayers2) { ((Component)clone2.Controller.PlayerLIV.LckTablet).gameObject.SetActive(value); } } }, 0, false); ((MelonEventBase>)(object)ToggleUI.OnEntryValueChanged).Subscribe((LemonAction)delegate(bool _, bool value) { ReplayTable obj = replayTable; if (obj != null) { ((Component)obj).gameObject.SetActive(value); } ReplayTable obj2 = replayTable; if (obj2 != null) { TextMeshPro metadataText = obj2.metadataText; if (metadataText != null) { ((Component)metadataText).gameObject.SetActive(value); } } }, 0, false); ((MelonEventBase>)(object)VoiceRecording.OnEntryValueChanged).Subscribe((LemonAction)delegate(bool _, bool value) { if (value && !ReplayVoices.isRecording) { ReplayVoices.StartRecording(); } else if (!value && ReplayVoices.isRecording) { ReplayVoices.StopRecording(); } }, 0, false); ((MelonEventBase>)(object)ToggleVoices.OnEntryValueChanged).Subscribe((LemonAction)delegate(bool _, bool value) { if (Playback.isPlaying && !value) { ReplayPlayback.Clone[] playbackPlayers = Playback.PlaybackPlayers; foreach (ReplayPlayback.Clone clone in playbackPlayers) { clone.VoiceSource.Stop(); } } }, 0, false); UI.Register((MelonMod)(object)this, (MelonPreferences_Category[])(object)new MelonPreferences_Category[8] { val, val3, val4, val5, val6, val7, val8, val10 }); UIInitialized = true; } public override void OnLateInitializeMelon() { if (!UIInitialized) { return; } Actions.onMapInitialized += delegate { OnMapInitialized(); }; Actions.onRoundEnded += delegate { //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (EnableRoundEndMarker.Value) { Recording.AddMarker("core.roundEnded", new Color(0.7f, 0.6f, 0.85f)); } }; Actions.onMatchEnded += delegate { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (EnableMatchEndMarker.Value) { Recording.AddMarker("core.matchEnded", Color.black); } }; ReplayFiles.Init(); Recording = new ReplayRecording(); Playback = new ReplayPlayback(Recording); } private IEnumerator ListenForFlatLand() { yield return (object)new WaitForSeconds(1f); flatLandRoot = GameObject.Find("FlatLand"); } public override void OnApplicationQuit() { if (Recording.isRecording) { Recording.StopRecording(); } string path = Path.Combine(MelonEnvironment.UserDataDirectory, "ReplayMod", "TempReplayVoices"); if (Directory.Exists(path)) { Directory.Delete(path, recursive: true); } } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { isSceneReady = false; if (!(currentScene == "Loader") && UIInitialized) { DebugLog("Scene loaded: " + sceneName); DebugLog($"Recording active before scene load: {Recording.isRecording}"); DebugLog($"Playback active before scene load: {Playback.isPlaying}"); if (Recording.isRecording) { Recording.StopRecording(); } if (Playback.isPlaying) { Playback.StopReplay(); } if (sceneName == "Gym") { MelonCoroutines.Start(ListenForFlatLand()); } if (currentScene == "Gym") { ReplayPlayback.isReplayScene = false; } Recording.Reset(); } } public void OnMapInitialized() { //IL_0067: 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) //IL_00bc: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Expected O, but got Unknown //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: 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_0335: 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_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_0560: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_0619: Unknown result type (might be due to invalid IL or missing references) //IL_061e: Unknown result type (might be due to invalid IL or missing references) //IL_063d: Unknown result type (might be due to invalid IL or missing references) //IL_0642: Unknown result type (might be due to invalid IL or missing references) //IL_0666: Unknown result type (might be due to invalid IL or missing references) //IL_0690: Unknown result type (might be due to invalid IL or missing references) //IL_06c5: Unknown result type (might be due to invalid IL or missing references) //IL_08a3: Unknown result type (might be due to invalid IL or missing references) //IL_08aa: Expected O, but got Unknown if (!UIInitialized) { return; } TextMeshPro component = Create.NewText().GetComponent(); component.transform.SetParent(((Component)LocalPlayer.Controller.GetSubsystem()).transform.GetChild(0)); ((Object)component).name = "Replay Recording Icon"; ((Graphic)component).color = new Color(0f, 1f, 0f, 0f); ((TMP_Text)component).text = "●"; ((TMP_Text)component).ForceMeshUpdate(false, false); component.transform.localPosition = new Vector3(0.2313f, 0.0233f, 0.9604f); component.transform.localRotation = Quaternion.Euler(20.2549f, 18.8002f, 0f); component.transform.localScale = Vector3.one * 0.4f; ReplayRecording.RecordingIcon recordingIcon = ((Component)component).gameObject.AddComponent(); recordingIcon.tmp = component; recordingIcon.recording = Recording; ReplayRecording.recordingIcon = recordingIcon; recordingIcon.SyncToState(); string text = currentScene; if ((((text == "Map0" || text == "Map1") && AutoRecordMatches.Value && Singleton.instance.AllPlayers.Count > 1) || (currentScene == "Park" && AutoRecordParks.Value)) && !ReplayPlayback.isReplayScene) { Recording.StartRecording(); } if ((ReplayCache.SFX == null || ReplayCache.structurePools == null) && currentScene != "Loader") { ReplayCache.BuildCacheTables(); } if ((Object)(object)replayTable == (Object)null && (Object)(object)clapperboardVFX == (Object)null) { LoadReplayObjects(); } if ((Object)(object)ReplayCrystals.crystalParent == (Object)null) { ReplayCrystals.crystalParent = new GameObject("Crystals"); } if (currentScene == "Gym") { replayTable.TableRoot.SetActive(true); ((Component)replayTable.metadataText).gameObject.SetActive(true); if ((Object)(object)replayTable.tableFloat != (Object)null) { replayTable.tableFloat.startPos = new Vector3(5.9506f, 1.3564f, 4.1906f); } if ((Object)(object)replayTable.metadataTextFloat != (Object)null) { replayTable.metadataTextFloat.startPos = new Vector3(5.9575f, 1.8514f, 4.2102f); } ((Component)replaySettings).gameObject.transform.localPosition = new Vector3(0.3782f, 0.88f, 0.1564f); ((Component)replaySettings).gameObject.transform.localRotation = Quaternion.Euler(23.4376f, 90f, 90f); replayTable.tableOffset = 0f; ((Component)replayTable).transform.localRotation = Quaternion.Euler(270f, 121.5819f, 0f); } else if (currentScene == "Park") { replayTable.TableRoot.SetActive(true); ((Component)replayTable.metadataText).gameObject.SetActive(true); replayTable.tableFloat.startPos = new Vector3(-28.9436f, -1.5689f, -6.9218f); replayTable.metadataTextFloat.startPos = new Vector3(-28.9499f, -2.0639f, -6.9414f); ((Component)replaySettings).gameObject.transform.localPosition = new Vector3(0.5855f, -0.9382f, 0.1346f); ((Component)replaySettings).gameObject.transform.localRotation = Quaternion.Euler(325.5624f, 90f, 90f); replayTable.tableOffset = -3.06f; ((Component)replayTable).transform.localRotation = Quaternion.Euler(270f, 0f, 0f); if (ReplayPlayback.isReplayScene) { MelonCoroutines.Start(DelayedParkLoad()); } } else if (currentScene == "Map0" && Singleton.instance.AllPlayers.Count == 1) { replayTable.TableRoot.SetActive(true); ((Component)replayTable.metadataText).gameObject.SetActive(true); replayTable.tableFloat.startPos = new Vector3(15.671f, -4.4577f, -8.5671f); replayTable.metadataTextFloat.startPos = new Vector3(15.671f, -4.4577f, -8.5671f); ((Component)replaySettings).gameObject.transform.localPosition = new Vector3(0.5855f, -0.9382f, 0.1346f); ((Component)replaySettings).gameObject.transform.localRotation = Quaternion.Euler(325.5624f, 90f, 90f); replayTable.tableOffset = -5.8f; ((Component)replayTable).transform.localRotation = Quaternion.Euler(270f, 215.5305f, 0f); } else if (currentScene == "Map1" && Singleton.instance.AllPlayers.Count == 1) { replayTable.TableRoot.SetActive(true); ((Component)replayTable.metadataText).gameObject.SetActive(true); replayTable.tableFloat.startPos = new Vector3(-13.8339f, 1.1872f, -0.3379f); replayTable.metadataTextFloat.startPos = new Vector3(-13.8339f, 1.1872f, -0.3379f); ((Component)replaySettings).gameObject.transform.localPosition = new Vector3(0.5855f, -0.9382f, 0.1346f); ((Component)replaySettings).gameObject.transform.localRotation = Quaternion.Euler(325.5624f, 90f, 90f); replayTable.tableOffset = -0.35f; ((Component)replayTable).transform.localRotation = Quaternion.Euler(270f, 352.1489f, 0f); } else { replayTable.TableRoot.SetActive(false); ((Component)replayTable.metadataText).gameObject.SetActive(false); } if (ReplayPlayback.isReplayScene) { string text2 = currentScene; if (1 == 0) { } MatchHandler val = ((text2 == "Map1") ? MatchHandler.GetGameObject().GetComponent() : ((!(text2 == "Map0")) ? null : MatchHandler.GetGameObject().GetComponent())); if (1 == 0) { } MatchHandler val2 = val; if ((Object)(object)val2 != (Object)null) { val2.CurrentMatchPhase = (MatchPhase)2; val2.FadeIn(); } } string[] array = new string[4] { "Heisenhouser", "Heisenhowser", "Heisenhouwser", "Heisenhouwer" }; ((TMP_Text)replayTable.heisenhouserText).text = array[Random.Range(0, array.Length)]; ((TMP_Text)replayTable.heisenhouserText).ForceMeshUpdate(false, false); ReplayPlaybackControls.destroyOnPunch.leftHand = LocalPlayer.Controller.GetSubsystem().leftInteractionHand; ReplayPlaybackControls.destroyOnPunch.rightHand = LocalPlayer.Controller.GetSubsystem().rightInteractionHand; ReplayCrystals.LoadCrystals(currentScene); ReplayFiles.LoadReplays(); ReplayFiles.RefreshUI(); ReplayPlaybackControls.Close(); if (currentScene != "Loader" && ReplayBufferEnabled.Value) { Recording.StartBuffering(); } if (Recording.isRecording || Recording.isBuffering) { Recording.SetupRecordingData(); } if ((Object)(object)Playback.playerPoolRoot == (Object)null) { GameObject val3 = new GameObject("[ReplayMod] Player Pool Root"); Object.DontDestroyOnLoad((Object)(object)val3); Playback.playerPoolRoot = val3; } Transform child = ((Component)LocalPlayer.Controller).transform.GetChild(2); ((Component)replayTable.metadataText).GetComponent().lockX = true; ((Component)replayTable.metadataText).GetComponent().lockZ = true; leftHand = child.GetChild(1); rightHand = child.GetChild(2); head = child.GetChild(0).GetChild(0); MelonCoroutines.Start(ShiftstoneApplyDelay()); Playback.SetPlaybackSpeed(1f); ReplayPlayback.isReplayScene = false; isSceneReady = true; IEnumerator ShiftstoneApplyDelay() { yield return (object)new WaitForSeconds(0.5f); if (Singleton.instance.AllPlayers.Count == 1) { if (!string.IsNullOrEmpty(leftShiftstonePool)) { LocalPlayer.Controller.PlayerShiftstones.AttachShiftStone(((Component)Singleton.instance.GetPool(leftShiftstonePool).FetchFromPool()).GetComponent(), 0, true, true); } if (!string.IsNullOrEmpty(rightShiftstonePool)) { LocalPlayer.Controller.PlayerShiftstones.AttachShiftStone(((Component)Singleton.instance.GetPool(rightShiftstonePool).FetchFromPool()).GetComponent(), 1, true, true); } leftShiftstonePool = null; rightShiftstonePool = null; } } } private IEnumerator DelayedParkLoad() { if (EnableHaptics.Value) { LocalPlayer.Controller.GetSubsystem().PlayControllerHaptics(1f, 0.1f, 1f, 0.1f); } yield return (object)new WaitForSeconds(2f); if (currentScene == "Park") { if (PhotonNetwork.CurrentRoom != null) { ((RoomInfo)PhotonNetwork.CurrentRoom).isVisible = false; } ParkInstance.GetGameObject().SetActive(false); PhotonNetwork.LeaveRoom(true); yield return (object)new WaitForSeconds(1f); } Playback.LoadReplay(ReplayFiles.explorer.CurrentReplayPath); SimpleScreenFadeInstance.Progress = 0f; } private IEnumerator DelayedFlatLandLoad() { if (!((Object)(object)flatLandRoot == (Object)null)) { while (flatLandRoot.activeSelf) { yield return null; } yield return (object)new WaitForSeconds(1f); Playback.LoadReplay(ReplayFiles.explorer.CurrentReplayPath); SimpleScreenFadeInstance.Progress = 0f; } } public void LoadReplayObjects() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_002e: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_0104: Expected O, but got Unknown //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0293: 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_0363: 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_0426: Unknown result type (might be due to invalid IL or missing references) //IL_042b: 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_0463: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_0524: Unknown result type (might be due to invalid IL or missing references) //IL_0529: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_0561: Unknown result type (might be due to invalid IL or missing references) //IL_056b: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Unknown result type (might be due to invalid IL or missing references) //IL_05c7: Unknown result type (might be due to invalid IL or missing references) //IL_05cc: Unknown result type (might be due to invalid IL or missing references) //IL_05fb: Unknown result type (might be due to invalid IL or missing references) //IL_060d: Unknown result type (might be due to invalid IL or missing references) //IL_0617: 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_06e4: Unknown result type (might be due to invalid IL or missing references) //IL_0705: Unknown result type (might be due to invalid IL or missing references) //IL_0731: Unknown result type (might be due to invalid IL or missing references) //IL_0854: Unknown result type (might be due to invalid IL or missing references) //IL_085e: Unknown result type (might be due to invalid IL or missing references) //IL_086b: Unknown result type (might be due to invalid IL or missing references) //IL_0872: Expected O, but got Unknown //IL_0903: Unknown result type (might be due to invalid IL or missing references) //IL_090d: Unknown result type (might be due to invalid IL or missing references) //IL_092e: Unknown result type (might be due to invalid IL or missing references) //IL_099d: Unknown result type (might be due to invalid IL or missing references) //IL_09b3: Unknown result type (might be due to invalid IL or missing references) //IL_09bd: Unknown result type (might be due to invalid IL or missing references) //IL_09e2: Unknown result type (might be due to invalid IL or missing references) //IL_0a03: Unknown result type (might be due to invalid IL or missing references) //IL_0a0d: Unknown result type (might be due to invalid IL or missing references) //IL_0a7b: Unknown result type (might be due to invalid IL or missing references) //IL_0a85: Unknown result type (might be due to invalid IL or missing references) //IL_0b17: Unknown result type (might be due to invalid IL or missing references) //IL_0b2e: Unknown result type (might be due to invalid IL or missing references) //IL_0b35: Expected O, but got Unknown //IL_0b69: Unknown result type (might be due to invalid IL or missing references) //IL_0b8a: Unknown result type (might be due to invalid IL or missing references) //IL_0b9c: Unknown result type (might be due to invalid IL or missing references) //IL_0ba6: Unknown result type (might be due to invalid IL or missing references) //IL_0be6: Unknown result type (might be due to invalid IL or missing references) //IL_0bf5: Unknown result type (might be due to invalid IL or missing references) //IL_0c0f: Unknown result type (might be due to invalid IL or missing references) //IL_0c16: Expected O, but got Unknown //IL_0c3f: Unknown result type (might be due to invalid IL or missing references) //IL_0c60: Unknown result type (might be due to invalid IL or missing references) //IL_0c72: Unknown result type (might be due to invalid IL or missing references) //IL_0c7c: Unknown result type (might be due to invalid IL or missing references) //IL_0cbc: Unknown result type (might be due to invalid IL or missing references) //IL_0ccb: Unknown result type (might be due to invalid IL or missing references) //IL_0cd0: Unknown result type (might be due to invalid IL or missing references) //IL_0cef: Unknown result type (might be due to invalid IL or missing references) //IL_0cf4: Unknown result type (might be due to invalid IL or missing references) //IL_0cf9: Unknown result type (might be due to invalid IL or missing references) //IL_0d3b: Unknown result type (might be due to invalid IL or missing references) //IL_0d4d: Unknown result type (might be due to invalid IL or missing references) //IL_0d57: Unknown result type (might be due to invalid IL or missing references) //IL_0d78: Unknown result type (might be due to invalid IL or missing references) //IL_0dd1: Unknown result type (might be due to invalid IL or missing references) //IL_0ddb: Expected O, but got Unknown //IL_0dfe: Unknown result type (might be due to invalid IL or missing references) //IL_0e05: Expected O, but got Unknown //IL_0e2f: Unknown result type (might be due to invalid IL or missing references) //IL_0e50: Unknown result type (might be due to invalid IL or missing references) //IL_0e71: Unknown result type (might be due to invalid IL or missing references) //IL_0ef4: Unknown result type (might be due to invalid IL or missing references) //IL_0f20: Unknown result type (might be due to invalid IL or missing references) //IL_0f3d: Unknown result type (might be due to invalid IL or missing references) //IL_0f47: Unknown result type (might be due to invalid IL or missing references) //IL_0f73: Unknown result type (might be due to invalid IL or missing references) //IL_0f90: Unknown result type (might be due to invalid IL or missing references) //IL_0f97: Expected O, but got Unknown //IL_1010: Unknown result type (might be due to invalid IL or missing references) //IL_1015: Unknown result type (might be due to invalid IL or missing references) //IL_1019: Unknown result type (might be due to invalid IL or missing references) //IL_1028: Unknown result type (might be due to invalid IL or missing references) //IL_102d: Unknown result type (might be due to invalid IL or missing references) //IL_1031: Unknown result type (might be due to invalid IL or missing references) //IL_1108: Unknown result type (might be due to invalid IL or missing references) //IL_1129: Unknown result type (might be due to invalid IL or missing references) //IL_113b: Unknown result type (might be due to invalid IL or missing references) //IL_1154: Unknown result type (might be due to invalid IL or missing references) //IL_115b: Expected O, but got Unknown //IL_1194: Unknown result type (might be due to invalid IL or missing references) //IL_1199: Unknown result type (might be due to invalid IL or missing references) //IL_119d: Unknown result type (might be due to invalid IL or missing references) //IL_11b1: Unknown result type (might be due to invalid IL or missing references) //IL_11b6: Unknown result type (might be due to invalid IL or missing references) //IL_11ba: Unknown result type (might be due to invalid IL or missing references) //IL_11d7: Unknown result type (might be due to invalid IL or missing references) //IL_11dc: Unknown result type (might be due to invalid IL or missing references) //IL_11e1: Unknown result type (might be due to invalid IL or missing references) //IL_11fc: Unknown result type (might be due to invalid IL or missing references) //IL_1201: Unknown result type (might be due to invalid IL or missing references) //IL_1206: Unknown result type (might be due to invalid IL or missing references) //IL_1221: Unknown result type (might be due to invalid IL or missing references) //IL_1226: Unknown result type (might be due to invalid IL or missing references) //IL_122b: Unknown result type (might be due to invalid IL or missing references) //IL_1246: Unknown result type (might be due to invalid IL or missing references) //IL_124b: Unknown result type (might be due to invalid IL or missing references) //IL_1250: Unknown result type (might be due to invalid IL or missing references) //IL_128f: Unknown result type (might be due to invalid IL or missing references) //IL_1299: Unknown result type (might be due to invalid IL or missing references) //IL_12ba: Unknown result type (might be due to invalid IL or missing references) //IL_12cc: Unknown result type (might be due to invalid IL or missing references) //IL_130e: Unknown result type (might be due to invalid IL or missing references) //IL_1318: Unknown result type (might be due to invalid IL or missing references) //IL_1339: Unknown result type (might be due to invalid IL or missing references) //IL_134b: Unknown result type (might be due to invalid IL or missing references) //IL_138d: Unknown result type (might be due to invalid IL or missing references) //IL_1397: Unknown result type (might be due to invalid IL or missing references) //IL_13b8: Unknown result type (might be due to invalid IL or missing references) //IL_13ca: Unknown result type (might be due to invalid IL or missing references) //IL_1412: Unknown result type (might be due to invalid IL or missing references) //IL_1461: Unknown result type (might be due to invalid IL or missing references) //IL_146b: Unknown result type (might be due to invalid IL or missing references) //IL_148c: Unknown result type (might be due to invalid IL or missing references) //IL_149e: Unknown result type (might be due to invalid IL or missing references) //IL_14c3: Unknown result type (might be due to invalid IL or missing references) //IL_1641: Unknown result type (might be due to invalid IL or missing references) //IL_164b: Unknown result type (might be due to invalid IL or missing references) //IL_166c: Unknown result type (might be due to invalid IL or missing references) //IL_168d: Unknown result type (might be due to invalid IL or missing references) //IL_172b: Unknown result type (might be due to invalid IL or missing references) //IL_1735: Unknown result type (might be due to invalid IL or missing references) //IL_1756: Unknown result type (might be due to invalid IL or missing references) //IL_1777: Unknown result type (might be due to invalid IL or missing references) //IL_17f1: Unknown result type (might be due to invalid IL or missing references) //IL_17fb: Unknown result type (might be due to invalid IL or missing references) //IL_181c: Unknown result type (might be due to invalid IL or missing references) //IL_183d: Unknown result type (might be due to invalid IL or missing references) //IL_18b7: Unknown result type (might be due to invalid IL or missing references) //IL_18c1: Unknown result type (might be due to invalid IL or missing references) //IL_18e2: Unknown result type (might be due to invalid IL or missing references) //IL_1903: Unknown result type (might be due to invalid IL or missing references) //IL_1994: Unknown result type (might be due to invalid IL or missing references) //IL_199e: Unknown result type (might be due to invalid IL or missing references) //IL_19bf: Unknown result type (might be due to invalid IL or missing references) //IL_19e0: Unknown result type (might be due to invalid IL or missing references) //IL_1a39: Unknown result type (might be due to invalid IL or missing references) //IL_1a43: Unknown result type (might be due to invalid IL or missing references) //IL_1aa0: Unknown result type (might be due to invalid IL or missing references) //IL_1ab2: Unknown result type (might be due to invalid IL or missing references) //IL_1abc: Unknown result type (might be due to invalid IL or missing references) //IL_1ace: Unknown result type (might be due to invalid IL or missing references) //IL_1b66: Unknown result type (might be due to invalid IL or missing references) //IL_1bac: Unknown result type (might be due to invalid IL or missing references) //IL_1bbe: Unknown result type (might be due to invalid IL or missing references) //IL_1bc8: Unknown result type (might be due to invalid IL or missing references) //IL_1bda: Unknown result type (might be due to invalid IL or missing references) //IL_1c72: Unknown result type (might be due to invalid IL or missing references) //IL_1cc8: Unknown result type (might be due to invalid IL or missing references) //IL_1cd2: Expected O, but got Unknown //IL_1d4f: Unknown result type (might be due to invalid IL or missing references) //IL_1d94: Unknown result type (might be due to invalid IL or missing references) //IL_1d9b: Expected O, but got Unknown //IL_1de0: Unknown result type (might be due to invalid IL or missing references) //IL_1e12: Unknown result type (might be due to invalid IL or missing references) //IL_1e79: Unknown result type (might be due to invalid IL or missing references) //IL_1e9a: Unknown result type (might be due to invalid IL or missing references) //IL_1edb: Unknown result type (might be due to invalid IL or missing references) //IL_1eed: Unknown result type (might be due to invalid IL or missing references) //IL_1eff: Unknown result type (might be due to invalid IL or missing references) //IL_1f09: Unknown result type (might be due to invalid IL or missing references) //IL_1fc5: Unknown result type (might be due to invalid IL or missing references) //IL_1fd7: Unknown result type (might be due to invalid IL or missing references) //IL_1fe9: Unknown result type (might be due to invalid IL or missing references) //IL_1ff3: Unknown result type (might be due to invalid IL or missing references) //IL_2032: Unknown result type (might be due to invalid IL or missing references) //IL_203c: Unknown result type (might be due to invalid IL or missing references) //IL_20e8: Unknown result type (might be due to invalid IL or missing references) //IL_20ef: Expected O, but got Unknown //IL_211f: Unknown result type (might be due to invalid IL or missing references) //IL_2140: Unknown result type (might be due to invalid IL or missing references) //IL_2152: Unknown result type (might be due to invalid IL or missing references) //IL_215c: Unknown result type (might be due to invalid IL or missing references) //IL_2198: Unknown result type (might be due to invalid IL or missing references) //IL_21a7: Unknown result type (might be due to invalid IL or missing references) //IL_21ac: Unknown result type (might be due to invalid IL or missing references) //IL_21f7: Unknown result type (might be due to invalid IL or missing references) //IL_2218: Unknown result type (might be due to invalid IL or missing references) //IL_222a: Unknown result type (might be due to invalid IL or missing references) //IL_2234: Unknown result type (might be due to invalid IL or missing references) //IL_22e6: Unknown result type (might be due to invalid IL or missing references) //IL_2307: Unknown result type (might be due to invalid IL or missing references) //IL_2319: Unknown result type (might be due to invalid IL or missing references) //IL_2323: Unknown result type (might be due to invalid IL or missing references) //IL_233d: Unknown result type (might be due to invalid IL or missing references) //IL_2396: Unknown result type (might be due to invalid IL or missing references) //IL_23a0: Unknown result type (might be due to invalid IL or missing references) //IL_23c1: Unknown result type (might be due to invalid IL or missing references) //IL_2413: Unknown result type (might be due to invalid IL or missing references) //IL_2425: Unknown result type (might be due to invalid IL or missing references) //IL_2437: Unknown result type (might be due to invalid IL or missing references) //IL_2441: Unknown result type (might be due to invalid IL or missing references) //IL_2473: Unknown result type (might be due to invalid IL or missing references) //IL_251e: Unknown result type (might be due to invalid IL or missing references) //IL_2528: Unknown result type (might be due to invalid IL or missing references) //IL_2558: Unknown result type (might be due to invalid IL or missing references) //IL_256a: Unknown result type (might be due to invalid IL or missing references) //IL_263e: Unknown result type (might be due to invalid IL or missing references) //IL_265f: Unknown result type (might be due to invalid IL or missing references) //IL_2671: Unknown result type (might be due to invalid IL or missing references) //IL_267b: Unknown result type (might be due to invalid IL or missing references) //IL_2741: Unknown result type (might be due to invalid IL or missing references) //IL_2762: Unknown result type (might be due to invalid IL or missing references) //IL_2774: Unknown result type (might be due to invalid IL or missing references) //IL_277e: Unknown result type (might be due to invalid IL or missing references) //IL_2842: Unknown result type (might be due to invalid IL or missing references) //IL_2854: Unknown result type (might be due to invalid IL or missing references) //IL_2866: Unknown result type (might be due to invalid IL or missing references) //IL_2870: Unknown result type (might be due to invalid IL or missing references) //IL_28a0: Unknown result type (might be due to invalid IL or missing references) //IL_28cc: Unknown result type (might be due to invalid IL or missing references) //IL_28d3: Expected O, but got Unknown //IL_296c: Unknown result type (might be due to invalid IL or missing references) //IL_298d: Unknown result type (might be due to invalid IL or missing references) //IL_299f: Unknown result type (might be due to invalid IL or missing references) //IL_29f4: Unknown result type (might be due to invalid IL or missing references) //IL_2a06: Unknown result type (might be due to invalid IL or missing references) //IL_2a10: Unknown result type (might be due to invalid IL or missing references) //IL_2a63: Unknown result type (might be due to invalid IL or missing references) //IL_2a75: Unknown result type (might be due to invalid IL or missing references) //IL_2a7f: Unknown result type (might be due to invalid IL or missing references) //IL_2aef: Unknown result type (might be due to invalid IL or missing references) //IL_2b32: Unknown result type (might be due to invalid IL or missing references) //IL_2b44: Unknown result type (might be due to invalid IL or missing references) //IL_2b4e: Unknown result type (might be due to invalid IL or missing references) //IL_2bbd: Unknown result type (might be due to invalid IL or missing references) //IL_2bcf: Unknown result type (might be due to invalid IL or missing references) //IL_2be1: Unknown result type (might be due to invalid IL or missing references) //IL_2beb: Unknown result type (might be due to invalid IL or missing references) //IL_2c97: Unknown result type (might be due to invalid IL or missing references) //IL_2ca6: Unknown result type (might be due to invalid IL or missing references) //IL_2cab: Unknown result type (might be due to invalid IL or missing references) //IL_2cd6: Unknown result type (might be due to invalid IL or missing references) //IL_2cf7: Unknown result type (might be due to invalid IL or missing references) //IL_2d09: Unknown result type (might be due to invalid IL or missing references) //IL_2d13: Unknown result type (might be due to invalid IL or missing references) //IL_2db6: Unknown result type (might be due to invalid IL or missing references) //IL_2dc8: Unknown result type (might be due to invalid IL or missing references) //IL_2dd2: Unknown result type (might be due to invalid IL or missing references) //IL_2e38: Unknown result type (might be due to invalid IL or missing references) //IL_2e53: Unknown result type (might be due to invalid IL or missing references) //IL_2e5d: Unknown result type (might be due to invalid IL or missing references) //IL_2ec4: Unknown result type (might be due to invalid IL or missing references) //IL_2ed6: Unknown result type (might be due to invalid IL or missing references) //IL_2f34: Unknown result type (might be due to invalid IL or missing references) //IL_2f85: Unknown result type (might be due to invalid IL or missing references) //IL_2f94: Unknown result type (might be due to invalid IL or missing references) //IL_2f99: Unknown result type (might be due to invalid IL or missing references) //IL_2fb0: Unknown result type (might be due to invalid IL or missing references) //IL_2fd1: Unknown result type (might be due to invalid IL or missing references) //IL_2fe3: Unknown result type (might be due to invalid IL or missing references) //IL_2fed: Unknown result type (might be due to invalid IL or missing references) //IL_30a0: Unknown result type (might be due to invalid IL or missing references) //IL_30b2: Unknown result type (might be due to invalid IL or missing references) //IL_318f: Unknown result type (might be due to invalid IL or missing references) //IL_31e0: Unknown result type (might be due to invalid IL or missing references) //IL_31ef: Unknown result type (might be due to invalid IL or missing references) //IL_31f4: Unknown result type (might be due to invalid IL or missing references) //IL_320b: Unknown result type (might be due to invalid IL or missing references) //IL_322c: Unknown result type (might be due to invalid IL or missing references) //IL_323e: Unknown result type (might be due to invalid IL or missing references) //IL_3248: Unknown result type (might be due to invalid IL or missing references) //IL_3296: Unknown result type (might be due to invalid IL or missing references) //IL_32b7: Unknown result type (might be due to invalid IL or missing references) //IL_32c9: Unknown result type (might be due to invalid IL or missing references) //IL_32d3: Unknown result type (might be due to invalid IL or missing references) //IL_335d: Unknown result type (might be due to invalid IL or missing references) //IL_3367: Unknown result type (might be due to invalid IL or missing references) //IL_33a5: Unknown result type (might be due to invalid IL or missing references) //IL_33c6: Unknown result type (might be due to invalid IL or missing references) //IL_33d8: Unknown result type (might be due to invalid IL or missing references) //IL_33e2: Unknown result type (might be due to invalid IL or missing references) //IL_34a4: Unknown result type (might be due to invalid IL or missing references) //IL_34ab: Expected O, but got Unknown //IL_3575: Unknown result type (might be due to invalid IL or missing references) //IL_38e0: Unknown result type (might be due to invalid IL or missing references) //IL_38e7: Expected O, but got Unknown //IL_393c: Unknown result type (might be due to invalid IL or missing references) //IL_395d: Unknown result type (might be due to invalid IL or missing references) //IL_397e: Unknown result type (might be due to invalid IL or missing references) //IL_39a0: Unknown result type (might be due to invalid IL or missing references) //IL_39a5: Unknown result type (might be due to invalid IL or missing references) //IL_39aa: Unknown result type (might be due to invalid IL or missing references) //IL_39de: Unknown result type (might be due to invalid IL or missing references) //IL_39ff: Unknown result type (might be due to invalid IL or missing references) //IL_3a11: Unknown result type (might be due to invalid IL or missing references) //IL_3a1b: Unknown result type (might be due to invalid IL or missing references) //IL_3a86: Unknown result type (might be due to invalid IL or missing references) //IL_3ac4: Unknown result type (might be due to invalid IL or missing references) //IL_3ad6: Unknown result type (might be due to invalid IL or missing references) //IL_3ae0: Unknown result type (might be due to invalid IL or missing references) //IL_3656: Unknown result type (might be due to invalid IL or missing references) //IL_3678: Unknown result type (might be due to invalid IL or missing references) //IL_369a: Unknown result type (might be due to invalid IL or missing references) //IL_36bc: Unknown result type (might be due to invalid IL or missing references) //IL_36de: Unknown result type (might be due to invalid IL or missing references) //IL_3713: Unknown result type (might be due to invalid IL or missing references) //IL_3762: Unknown result type (might be due to invalid IL or missing references) //IL_3784: Unknown result type (might be due to invalid IL or missing references) //IL_3797: Unknown result type (might be due to invalid IL or missing references) //IL_37a1: Unknown result type (might be due to invalid IL or missing references) //IL_383e: Unknown result type (might be due to invalid IL or missing references) //IL_3843: Unknown result type (might be due to invalid IL or missing references) //IL_3847: Unknown result type (might be due to invalid IL or missing references) //IL_384c: Unknown result type (might be due to invalid IL or missing references) //IL_385b: Unknown result type (might be due to invalid IL or missing references) //IL_3860: Unknown result type (might be due to invalid IL or missing references) //IL_3864: Unknown result type (might be due to invalid IL or missing references) //IL_3893: Unknown result type (might be due to invalid IL or missing references) //IL_38a5: Unknown result type (might be due to invalid IL or missing references) //IL_38af: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Replay Table"); val.transform.localPosition = new Vector3(5.9506f, 1.3564f, 4.1906f); val.transform.localRotation = Quaternion.Euler(270f, 121.5819f, 0f); using Stream stream = typeof(Main).Assembly.GetManifestResourceStream("ReplayMod.src.Core.replayobjects"); byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); AssetBundle val2 = AssetBundle.LoadFromMemory(Il2CppStructArray.op_Implicit(array)); GameObject val3 = Object.Instantiate(val2.LoadAsset("Table"), val.transform); ((Object)val3).name = "Table"; Transform transform = val3.transform; transform.localScale *= 0.5f; val3.transform.localRotation = Quaternion.identity; Material val4 = new Material(Stallframe.GetGameObject().GetComponent().material); val4.SetTexture("_Albedo", (Texture)(object)val2.LoadAsset("Texture")); val4.SetTexture("_Lighting_data", (Texture)null); val3.GetComponent().material = val4; TableFloat tableFloat = val.AddComponent(); tableFloat.speed = 2f * Mathf.PI / 10f; tableFloat.amplitude = 0.01f; val3.layer = LayerMask.NameToLayer("LeanableEnvironment"); val3.AddComponent(); if (Mods.findOwnMod("Rumble Dark Mode", "Bleh", false)) { val3.GetComponent().lightProbeUsage = (LightProbeUsage)0; } GameObject val5 = Object.Instantiate(StandHere.GetGameObject(), val.transform); ((Object)val5).name = "LevitateVFX"; val5.transform.localPosition = new Vector3(0f, 0f, -0.2764f); val5.transform.localRotation = Quaternion.Euler(270f, 0f, 0f); val5.transform.localScale = Vector3.one * 0.8f; GameObject val6 = Object.Instantiate(ScrollUpButton.GetGameObject(), val.transform); ((Object)val6).name = "Next Replay"; val6.transform.localPosition = new Vector3(0.2978f, -0.248f, -0.181f); val6.transform.localRotation = Quaternion.Euler(345.219f, 340.1203f, 234.8708f); val6.transform.localScale = Vector3.one * 1.8f; InteractionButton component = ((Component)val6.transform.GetChild(0)).GetComponent(); ((Behaviour)component).enabled = true; component.onPressedAudioCall = ReplayCache.SFX["Call_DressingRoom_PartPanelTick_ForwardUnlocked"]; ((UnityEventBase)component.OnPressed).RemoveAllListeners(); component.OnPressed.AddListener(UnityAction.op_Implicit((Action)delegate { ReplayFiles.NextReplay(); })); GameObject val7 = Object.Instantiate(val6, val.transform); ((Object)val7).name = "Previous Replay"; val7.transform.localPosition = new Vector3(0.3204f, 0.2192f, -0.1844f); val7.transform.localRotation = Quaternion.Euler(10.6506f, 337.4582f, 296.0434f); val7.transform.GetChild(0).GetChild(3).localRotation = Quaternion.Euler(90f, 180f, 0f); InteractionButton component2 = ((Component)val7.transform.GetChild(0)).GetComponent(); ((Behaviour)component2).enabled = true; component2.onPressedAudioCall = ReplayCache.SFX["Call_DressingRoom_PartPanelTick_BackwardUnlocked"]; ((UnityEventBase)component2.OnPressed).RemoveAllListeners(); component2.OnPressed.AddListener(UnityAction.op_Implicit((Action)delegate { ReplayFiles.PreviousReplay(); })); GameObject val8 = Create.NewText("No Replay Selected", 5f, new Color(0.102f, 0.051f, 0.0275f), Vector3.zero, Quaternion.identity); val8.transform.SetParent(val.transform); ((Object)val8).name = "Replay Name"; val8.transform.localScale = Vector3.one * 0.1f; val8.transform.localPosition = new Vector3(0.446f, -0.0204f, -0.1297f); val8.transform.localRotation = Quaternion.Euler(0f, 249.3179f, 270f); TextMeshPro component3 = val8.GetComponent(); ((TMP_Text)component3).fontSizeMin = 2f; ((TMP_Text)component3).fontSizeMax = 2.55f; ((TMP_Text)component3).enableAutoSizing = true; ((TMP_Text)component3).enableWordWrapping = true; ((Component)component3).GetComponent().sizeDelta = new Vector2(3f, 0.7f); GameObject val9 = Create.NewText("(0 / 0)", 5f, new Color(0.102f, 0.051f, 0.0275f), Vector3.zero, Quaternion.identity); val9.transform.SetParent(val.transform); ((Object)val9).name = "Replay Index"; val9.transform.localScale = Vector3.one * 0.04f; val9.transform.localPosition = new Vector3(0.4604f, -0.0204f, -0.1697f); val9.transform.localRotation = Quaternion.Euler(0f, 249.3179f, 270f); GameObject val10 = Create.NewText("", 5f, Color.white, Vector3.zero, Quaternion.identity); ((Object)val10).name = "Metadata Text"; val10.transform.position = new Vector3(5.9575f, 1.8514f, 4.2102f); val10.transform.localScale = Vector3.one * 0.25f; TableFloat tableFloat2 = val10.AddComponent(); tableFloat2.speed = 2.5f * Mathf.PI / 10f; tableFloat2.amplitude = 0.01f; tableFloat2.stopRadius = 0f; TextMeshPro component4 = val10.GetComponent(); ((TMP_Text)component4).m_HorizontalAlignment = (HorizontalAlignmentOptions)2; LookAtPlayer lookAtPlayer = val10.AddComponent(); lookAtPlayer.lockX = true; lookAtPlayer.lockZ = true; Object.DontDestroyOnLoad((Object)(object)val10); GameObject val11 = Object.Instantiate(ResetFighterButton.GetGameObject(), val.transform); ((Object)val11).name = "Load Replay"; val11.transform.localPosition = new Vector3(0.5267f, -0.0131f, -0.1956f); val11.transform.localRotation = Quaternion.Euler(0f, 198.4543f, 0f); val11.transform.localScale = new Vector3(0.5129f, 1.1866f, 0.78f); ((Component)val11.transform.GetChild(1)).transform.localScale = new Vector3(0.23f, 0.1f, 0.1f); InteractionButton component5 = ((Component)val11.transform.GetChild(0)).GetComponent(); ((Behaviour)component5).enabled = true; component5.longPressTime = 0.25f; ((UnityEventBase)component5.OnPressed).RemoveAllListeners(); component5.onPressedAudioCall = component5.longPressAudioCall; replayTable = val.AddComponent(); replayTable.TableRoot = val; replayTable.nextButton = component; replayTable.previousButton = component2; replayTable.loadButton = component5; replayTable.replayNameText = val8.GetComponent(); replayTable.indexText = val9.GetComponent(); replayTable.metadataText = component4; component5.OnPressed.AddListener(UnityAction.op_Implicit((Action)delegate { LoadSelectedReplay(); })); ReplayFiles.table = replayTable; ReplayFiles.HideMetadata(); clapperboardVFX = Object.Instantiate(val2.LoadAsset("Clapper")); ((Object)clapperboardVFX).name = "ClapperboardVFX"; clapperboardVFX.transform.localScale = Vector3.one * 5f; Material val12 = new Material(val4); val12.SetTexture("_Albedo", (Texture)(object)val2.LoadAsset("ClapperTexture")); clapperboardVFX.GetComponent().material = val12; ((Component)clapperboardVFX.transform.GetChild(0)).GetComponent().material = val12; clapperboardVFX.SetActive(false); GameObject val13 = Object.Instantiate(((Component)Singleton.instance.GetPool("Stubbornstone_VFX").poolItem).gameObject, val.transform); ((Object)val13).name = "Crystalize VFX"; val13.transform.localScale = Vector3.one * 0.2f; val13.transform.localPosition = new Vector3(0f, 0f, 0.3903f); val13.SetActive(true); VisualEffect component6 = val13.GetComponent(); component6.playRate = 0.6f; ReplayCrystals.crystalizeVFX = component6; GameObject crystalizeButton = Object.Instantiate(val11, val.transform); ((Object)crystalizeButton).name = "CrystalizeReplay"; crystalizeButton.transform.localPosition = new Vector3(0.21f, -0.4484f, -0.1325f); crystalizeButton.transform.localScale = Vector3.one * 1.1f; crystalizeButton.transform.localRotation = Quaternion.Euler(303.8364f, 249f, 108.4483f); ((Component)crystalizeButton.transform.GetChild(1)).transform.localScale = Vector3.one * 0.1f; InteractionButton component7 = ((Component)crystalizeButton.transform.GetChild(0)).GetComponent(); ((Behaviour)component7).enabled = true; component7.longPressTime = 0.2f; ((UnityEventBase)component7.OnPressed).RemoveAllListeners(); replayTable.crystalizeButton = component7; GameObject val14 = Object.Instantiate(val2.LoadAsset("Crystal")); Transform transform2 = val14.transform; transform2.localScale *= 0.5f; Material material = ((Component)((Component)Singleton.instance.GetPool("FlowStone").PoolItem).transform.GetChild(0)).GetComponent().material; foreach (Renderer componentsInChild in val14.GetComponentsInChildren(true)) { componentsInChild.material = material; } val14.SetActive(false); val14.transform.localRotation = Quaternion.Euler(-90f, 0f, 0f); ReplayCrystals.crystalPrefab = val14; GameObject val15 = new GameObject("CrystalizeIcon"); val15.transform.SetParent(crystalizeButton.transform.GetChild(0)); val15.transform.localPosition = new Vector3(0f, 0.012f, 0f); val15.transform.localRotation = Quaternion.Euler(270f, 0f, 0f); val15.transform.localScale = Vector3.one * 0.07f; SpriteRenderer val16 = val15.AddComponent(); Texture2D val17 = val2.LoadAsset("CrystalSprite"); val16.sprite = Sprite.Create(val17, new Rect(0f, 0f, (float)((Texture)val17).width, (float)((Texture)val17).height), new Vector2(0.5f, 0.5f), 100f); GameObject val18 = new GameObject("HeisenhouwserIcon"); val18.transform.SetParent(val.transform); val18.transform.localPosition = new Vector3(-0.2847f, 0.3901f, -0.1354f); val18.transform.localRotation = Quaternion.Euler(51.2548f, 110.7607f, 107.2314f); val18.transform.localScale = Vector3.one * 0.02f; SpriteRenderer val19 = val18.AddComponent(); Texture2D val20 = val2.LoadAsset("HeisenhowerSprite"); val19.sprite = Sprite.Create(val20, new Rect(0f, 0f, (float)((Texture)val20).width, (float)((Texture)val20).height), Vector2.op_Implicit(new Vector3(0.5f, 0.5f)), 100f); GameObject val21 = Create.NewText("Heisenhouwser", 1f, Color.white, Vector3.zero, Quaternion.identity); val21.transform.SetParent(val.transform); ((Object)val21).name = "HeisenhouswerLogoText"; val21.transform.localPosition = new Vector3(-0.2891f, 0.3969f, -0.1684f); val21.transform.localScale = Vector3.one * 0.0035f; val21.transform.localRotation = Quaternion.Euler(51.2551f, 110.4334f, 107.2313f); replayTable.heisenhouserText = val21.GetComponent(); ((TMP_Text)replayTable.heisenhouserText).fontSizeMin = 1f; ((TMP_Text)replayTable.heisenhouserText).enableAutoSizing = true; component7.onPressedAudioCall = component5.onPressedAudioCall; ReplayCrystals.crystalParent = new GameObject("Crystals"); component7.OnPressed.AddListener(UnityAction.op_Implicit((Action)delegate { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (!ReplayCrystals.Crystals.Any((ReplayCrystals.Crystal c) => (Object)(object)c != (Object)null && c.ReplayPath == ReplayFiles.explorer.CurrentReplayPath) && ReplayFiles.currentHeader != null && ReplayFiles.explorer.currentIndex != -1) { Singleton.instance.Play(ReplayCache.SFX["Call_DressingRoom_Bake_Part"], crystalizeButton.transform.position, false); ReplaySerializer.ReplayHeader currentHeader = ReplayFiles.currentHeader; ReplayCrystals.CreateCrystal(((Component)replayTable).transform.position + new Vector3(0f, 0.3f, 0f), currentHeader, ReplayFiles.explorer.CurrentReplayPath, useAnimation: true); } else { ReplayError(); } })); GameObject val22 = new GameObject("LoadReplaySprite"); val22.transform.SetParent(((Component)component5).transform); val22.transform.localPosition = new Vector3(0f, 0.012f, 0f); val22.transform.localRotation = Quaternion.Euler(270f, 90f, 0f); val22.transform.localScale = new Vector3(0.025f, 0.05f, 0.05f); MeshRenderer component8 = ((Component)((Component)component).transform.GetChild(3)).GetComponent(); MeshFilter component9 = ((Component)((Component)component).transform.GetChild(3)).GetComponent(); MeshFilter val23 = val22.AddComponent(); MeshRenderer val24 = val22.AddComponent(); val23.sharedMesh = component9.sharedMesh; ((Renderer)val24).material = ((Renderer)component8).material; GameObject val25 = Object.Instantiate(InfoForm.GetGameObject()); ((Object)val25).name = "Playback Controls"; val25.transform.localScale = Vector3.one; ((Component)val25.transform.GetChild(1)).transform.localRotation = Quaternion.Euler(0f, 180f, 0f); ((Component)val25.transform.GetChild(1)).transform.localScale = Vector3.one * 0.7f; ((Component)val25.transform.GetChild(1)).transform.localPosition = new Vector3(0.0385f, 0.0913f, 0f); Object.Destroy((Object)(object)val25.GetComponent()); GameObject val26 = new GameObject("DestroyOnPunch"); val26.layer = LayerMask.NameToLayer("InteractionBase"); val26.transform.SetParent(val25.transform); DestroyOnPunch destroyOnPunch = val26.AddComponent(); destroyOnPunch.onDestroy = (Action)Delegate.Combine(destroyOnPunch.onDestroy, new Action(ReplayPlaybackControls.Close)); BoxCollider val27 = val26.AddComponent(); MeshRenderer component10 = ((Component)val25.transform.GetChild(0).GetChild(0)).GetComponent(); Bounds val28 = ((Renderer)component10).localBounds; val27.center = ((Bounds)(ref val28)).center; val28 = ((Renderer)component10).localBounds; val27.size = ((Bounds)(ref val28)).size; Object.Destroy((Object)(object)((Component)val25.transform.GetChild(2)).gameObject); for (int i = 0; i < val25.transform.GetChild(1).childCount; i++) { Object.Destroy((Object)(object)((Component)val25.transform.GetChild(1).GetChild(i)).gameObject); } GameObject val29 = Object.Instantiate(StatusBar.GetGameObject(), val25.transform.GetChild(1)); Material material2 = ((Renderer)val29.GetComponent()).material; material2.SetFloat("_Has_BP_Requirement", 1f); material2.SetFloat("_Has_RC_Requirement", 0f); ((Object)val29).name = "Timeline"; val29.transform.localPosition = new Vector3(0f, -0.2044f, -0.0109f); val29.transform.localScale = new Vector3(0.806f, 0.0434f, 1f); val29.transform.localRotation = Quaternion.identity; val29.SetActive(true); GameObject val30 = new GameObject("TimelineCollider"); val30.transform.SetParent(val29.transform, false); val30.layer = LayerMask.NameToLayer("InteractionBase"); BoxCollider val31 = val30.AddComponent(); val28 = ((Renderer)val29.GetComponent()).localBounds; val31.center = ((Bounds)(ref val28)).center; val28 = ((Renderer)val29.GetComponent()).localBounds; val31.size = ((Bounds)(ref val28)).size; val30.AddComponent(); TextMeshPro component11 = Create.NewText(":3", 1f, Color.white, Vector3.zero, Quaternion.identity).GetComponent(); TextMeshPro component12 = Create.NewText(":3", 1f, Color.white, Vector3.zero, Quaternion.identity).GetComponent(); TextMeshPro component13 = Create.NewText("Colon Three", 1f, Color.white, Vector3.zero, Quaternion.identity).GetComponent(); TextMeshPro component14 = Create.NewText("Vewy Fast!", 1f, Color.white, Vector3.zero, Quaternion.identity).GetComponent(); component11.transform.SetParent(val25.transform.GetChild(1)); ((Object)component11).name = "Current Duration"; component11.transform.localScale = Vector3.one * 0.7f; component11.transform.localPosition = new Vector3(-0.3608f, -0.1456f, -0.0062f); component11.transform.localRotation = Quaternion.identity; ((TMP_Text)component11).enableWordWrapping = false; component12.transform.SetParent(val25.transform.GetChild(1)); ((Object)component12).name = "Total Duration"; component12.transform.localScale = Vector3.one * 0.7f; component12.transform.localPosition = new Vector3(0.3728f, -0.1456f, -0.0062f); component12.transform.localRotation = Quaternion.identity; ((TMP_Text)component12).enableWordWrapping = false; component13.transform.SetParent(val25.transform.GetChild(1)); ((Object)component13).name = "Playback Title"; component13.transform.localScale = Vector3.one * 0.5f; component13.transform.localPosition = new Vector3(0f, 0.3459f, -0.0073f); component13.transform.localRotation = Quaternion.identity; ((TMP_Text)component13).enableWordWrapping = true; ((TMP_Text)component13).enableAutoSizing = true; ((TMP_Text)component13).fontSizeMax = 2f; ((TMP_Text)component13).fontSizeMin = 0.6f; ((Component)component13).GetComponent().sizeDelta = new Vector2(1.2f, 0.1577f); ((TMP_Text)component13).alignment = (TextAlignmentOptions)258; ((TMP_Text)component13).horizontalAlignment = (HorizontalAlignmentOptions)2; component14.transform.SetParent(val25.transform.GetChild(1)); ((Object)component14).name = "Playback Speed"; component14.transform.localScale = Vector3.one * 0.8f; component14.transform.localPosition = new Vector3(0f, -0.1278f, -0.0127f); component14.transform.localRotation = Quaternion.identity; ((TMP_Text)component14).horizontalAlignment = (HorizontalAlignmentOptions)2; ((Component)component14).GetComponent().sizeDelta = new Vector2(1.2f, 0.1577f); ((TMP_Text)component14).fontSize = 1f; GameObject gameObject = FriendScrollBar.GetGameObject(); GameObject val32 = Object.Instantiate(((Component)gameObject.transform.GetChild(0)).gameObject, val25.transform.GetChild(1)); GameObject val33 = Object.Instantiate(((Component)gameObject.transform.GetChild(1)).gameObject, val25.transform.GetChild(1)); GameObject val34 = Object.Instantiate(((Component)gameObject.transform.GetChild(2)).gameObject, val25.transform.GetChild(1)); GameObject val35 = Object.Instantiate(((Component)gameObject.transform.GetChild(3)).gameObject, val25.transform.GetChild(1)); GameObject val36 = Object.Instantiate(((Component)gameObject.transform.GetChild(0)).gameObject, val25.transform.GetChild(1)); Texture2D val37 = val2.LoadAsset("SpeedUp"); InteractionButton component15 = ((Component)val32.transform.GetChild(0)).GetComponent(); ((Behaviour)component15).enabled = true; ((UnityEventBase)component15.onPressed).RemoveAllListeners(); component15.onPressed.AddListener(UnityAction.op_Implicit((Action)delegate { Playback.AddPlaybackSpeed(0.1f); })); ((Renderer)((Component)((Component)component15).transform.GetChild(3)).GetComponent()).material.SetTexture("_Texture", (Texture)(object)val37); ((Object)val32).name = "+0.1 Speed"; val32.transform.localScale = Vector3.one * 1.8f; val32.transform.localPosition = new Vector3(0.1598f, -0.3469f, 0.096f); val32.transform.localRotation = Quaternion.Euler(270f, 0f, 0f); InteractionButton component16 = ((Component)val33.transform.GetChild(0)).GetComponent(); ((Behaviour)component16).enabled = true; ((UnityEventBase)component16.onPressed).RemoveAllListeners(); component16.onPressed.AddListener(UnityAction.op_Implicit((Action)delegate { Playback.AddPlaybackSpeed(-0.1f); })); ((Renderer)((Component)((Component)component16).transform.GetChild(3)).GetComponent()).material.SetTexture("_Texture", (Texture)(object)val37); ((Object)val33).name = "-0.1 Speed"; val33.transform.localScale = Vector3.one * 1.8f; val33.transform.localPosition = new Vector3(-0.1598f, -0.3469f, 0.096f); val33.transform.localRotation = Quaternion.Euler(270f, 0f, 0f); InteractionButton component17 = ((Component)val34.transform.GetChild(0)).GetComponent(); ((Behaviour)component17).enabled = true; ((UnityEventBase)component17.onPressed).RemoveAllListeners(); component17.onPressed.AddListener(UnityAction.op_Implicit((Action)delegate { Playback.AddPlaybackSpeed(1f); })); ((Object)val34).name = "+1 Speed"; val34.transform.localScale = Vector3.one * 1.8f; val34.transform.localPosition = new Vector3(0.31f, -0.3469f, 0.096f); val34.transform.localRotation = Quaternion.Euler(270f, 0f, 0f); InteractionButton component18 = ((Component)val35.transform.GetChild(0)).GetComponent(); ((Behaviour)component18).enabled = true; ((UnityEventBase)component18.onPressed).RemoveAllListeners(); component18.onPressed.AddListener(UnityAction.op_Implicit((Action)delegate { Playback.AddPlaybackSpeed(-1f); })); ((Object)val35).name = "-1 Speed"; val35.transform.localScale = Vector3.one * 1.8f; val35.transform.localPosition = new Vector3(-0.31f, -0.3469f, 0.096f); val35.transform.localRotation = Quaternion.Euler(270f, 0f, 0f); InteractionButton component19 = ((Component)val36.transform.GetChild(0)).GetComponent(); ((Behaviour)component19).enabled = true; ((UnityEventBase)component19.onPressed).RemoveAllListeners(); ReplayPlaybackControls.playButtonSprite = ((Component)((Component)component19).transform.GetChild(3)).GetComponent(); component19.onPressed.AddListener(UnityAction.op_Implicit((Action)delegate { Playback.TogglePlayback(Playback.isPaused); })); ((Object)val36).name = "Play Button"; val36.transform.localScale = Vector3.one * 2f; val36.transform.localPosition = new Vector3(0f, -0.3469f, 0.1156f); val36.transform.localRotation = Quaternion.Euler(270f, 0f, 0f); Texture2D pauseSprite = val2.LoadAsset("Pause"); ReplayPlaybackControls.pauseSprite = pauseSprite; Texture2D playSprite = val2.LoadAsset("Play"); ReplayPlaybackControls.playSprite = playSprite; ((Renderer)ReplayPlaybackControls.playButtonSprite).material.SetTexture("_Texture", (Texture)(object)ReplayPlaybackControls.pauseSprite); ((Component)ReplayPlaybackControls.playButtonSprite).transform.localScale = Vector3.one * 0.07f; GameObject val38 = Object.Instantiate(ResetRotationButton.GetGameObject(), val25.transform.GetChild(1)); GameObject val39 = Object.Instantiate(val38, val25.transform.GetChild(1)); ((Object)val38).name = "Stop Replay"; val38.transform.localPosition = new Vector3(-0.1527f, -0.6109f, 0f); val38.transform.localScale = Vector3.one * 2f; val38.transform.localRotation = Quaternion.identity; InteractionButton component20 = ((Component)val38.transform.GetChild(0)).GetComponent(); ((Behaviour)component20).enabled = true; ((UnityEventBase)component20.onPressed).RemoveAllListeners(); component20.onPressed.AddListener(UnityAction.op_Implicit((Action)delegate { Playback.StopReplay(); })); TextMeshPro component21 = ((Component)val38.transform.GetChild(1)).GetComponent(); ((TMP_Text)component21).text = "Stop Replay"; ((Graphic)component21).color = new Color(0.8f, 0f, 0f); ((TMP_Text)component21).ForceMeshUpdate(false, false); ((Component)component21).gameObject.SetActive(true); ((Object)val39).name = "Exit Map"; val39.transform.localPosition = new Vector3(0.1527f, -0.6109f, 0f); val39.transform.localScale = Vector3.one * 2f; val39.transform.localRotation = Quaternion.identity; InteractionButton component22 = ((Component)val39.transform.GetChild(0)).GetComponent(); ((Behaviour)component22).enabled = true; ((UnityEventBase)component22.onPressed).RemoveAllListeners(); component22.onPressed.AddListener(UnityAction.op_Implicit((Action)delegate { MelonCoroutines.Start(Utilities.LoadMap(1)); })); TextMeshPro component23 = ((Component)val39.transform.GetChild(1)).GetComponent(); ((TMP_Text)component23).text = "Exit Map"; ((Graphic)component23).color = new Color(0.8f, 0f, 0f); ((TMP_Text)component23).ForceMeshUpdate(false, false); ((Component)component23).gameObject.SetActive(true); GameObject val40 = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val40).name = "ReplayMarker"; val40.SetActive(false); MeshRenderer component24 = val40.GetComponent(); ((Renderer)component24).material = new Material(Shader.Find("Shader Graphs/RUMBLE_Prop")); ReplayPlaybackControls.playbackControls = val25; ReplayPlaybackControls.markerPrefab = val40; ReplayPlaybackControls.timeline = val29; ReplayPlaybackControls.currentDuration = component11; ReplayPlaybackControls.totalDuration = component12; ReplayPlaybackControls.playbackSpeedText = component14; ReplayPlaybackControls.playbackTitle = component13; ReplayPlaybackControls.destroyOnPunch = destroyOnPunch; GameObject val41 = Object.Instantiate(val25, val.transform); val41.SetActive(true); Object.Destroy((Object)(object)((Component)val41.transform.GetChild(6)).gameObject); ((Object)val41).name = "Replay Settings"; val41.transform.localScale = Vector3.one; ((Component)val41.transform.GetChild(0).GetChild(0)).gameObject.layer = LayerMask.NameToLayer("Default"); Object.Destroy((Object)(object)val41.GetComponent()); GameObject val42 = new GameObject("Replay Settings"); val42.SetActive(false); val42.transform.SetParent(val41.transform.GetChild(0), false); ((Component)val41.transform.GetChild(0)).transform.localRotation = Quaternion.Euler(0f, 180f, 0f); ((Component)val41.transform.GetChild(0).GetChild(0)).transform.localRotation = Quaternion.Euler(0f, 180f, 0f); for (int j = 0; j < val41.transform.GetChild(1).childCount; j++) { Object.Destroy((Object)(object)((Component)val41.transform.GetChild(1).GetChild(j)).gameObject); } val41.transform.localPosition = new Vector3(0.3782f, 0.88f, 0.1564f); val41.transform.localRotation = Quaternion.Euler(34.4376f, 90f, 90f); GameObject val43 = Object.Instantiate(ResetFighterButton.GetGameObject(), val42.transform); ((Object)val43).name = "POV Button"; val43.transform.localPosition = new Vector3(-0.2341f, 0.1793f, -0.0552f); val43.transform.localRotation = Quaternion.identity; val43.transform.localScale = Vector3.one * 1.1f; InteractionButton component25 = ((Component)val43.transform.GetChild(0)).GetComponent(); ((Behaviour)component25).enabled = true; component25.useLongPress = false; component25.onPressedAudioCall = ReplayCache.SFX["Call_GearMarket_GenericButton_Press"]; ((UnityEventBase)component25.onPressed).RemoveAllListeners(); component25.onPressed.AddListener(UnityAction.op_Implicit((Action)delegate { //IL_004f: 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) if (((Behaviour)RecordingCamera.GetGameObject().GetComponent()).enabled) { MelonCoroutines.Start(ReplaySettings.SelectPlayer(delegate(Player selectedPlayer) { Playback.UpdateReplayCameraPOV(selectedPlayer, ReplaySettings.hideLocalPlayer); }, 0.5f)); } else { ReplayError("Legacy cam must be enabled to use the POV feature."); } })); GameObject val44 = Object.Instantiate(ResetRotationButton.GetGameObject(), val42.transform); ((Object)val44).name = "Hide Local Player Toggle"; val44.transform.localPosition = new Vector3(-0.2195f, 0.0764f, -0.0483f); val44.transform.localRotation = Quaternion.identity; val44.transform.localScale = Vector3.one * 0.85f; TextMeshPro hideLocalPlayerTMP = ((Component)val44.transform.GetChild(1)).GetComponent(); ((TMP_Text)hideLocalPlayerTMP).text = "Hide Local Player"; hideLocalPlayerTMP.transform.localScale = Vector3.one * 0.7f; ((Component)hideLocalPlayerTMP).gameObject.SetActive(true); InteractionButton component26 = ((Component)val44.transform.GetChild(0)).GetComponent(); ((Behaviour)component26).enabled = true; component26.isToggleButton = true; component26.onToggleFalseAudioCall = ReplayCache.SFX["Call_GearMarket_GenericButton_Unpress"]; component26.onToggleTrueAudioCall = ReplayCache.SFX["Call_GearMarket_GenericButton_Press"]; ((UnityEventBase)component26.onPressed).RemoveAllListeners(); ((UnityEvent)(object)component26.onToggleStateChanged).AddListener(UnityAction.op_Implicit((Action)delegate(bool toggle) { //IL_0017: 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) ReplaySettings.hideLocalPlayer = toggle; ((Graphic)hideLocalPlayerTMP).color = (toggle ? Color.green : Color.red); if (ReplayPlayback.povPlayer != null) { Playback.UpdateReplayCameraPOV(ReplayPlayback.povPlayer, toggle); } })); component26.SetButtonToggleStatus(true, false, true); GameObject val45 = new GameObject("Player Icon"); val45.transform.SetParent(val43.transform.GetChild(0)); val45.transform.localPosition = new Vector3(0.0008f, 0.012f, -0.0039f); val45.transform.localRotation = Quaternion.Euler(90f, 0f, 0f); val45.transform.localScale = Vector3.one * 0.06f; Texture2D val46 = val2.LoadAsset("POVIcon"); val45.AddComponent().sprite = Sprite.Create(val46, new Rect(0f, 0f, (float)((Texture)val46).width, (float)((Texture)val46).height), Vector2.op_Implicit(new Vector3(0.5f, 0.5f)), 100f); GameObject val47 = Object.Instantiate(ResetFighterButton.GetGameObject(), val42.transform); ((Object)val47).name = "Open Controls Toggle"; val47.transform.localPosition = new Vector3(0.18f, 0.07f, -0.0502f); val47.transform.localRotation = Quaternion.Euler(0f, 0f, 90f); val47.transform.localScale = Vector3.one * 1.1f; InteractionButton component27 = ((Component)val47.transform.GetChild(0)).GetComponent(); ((Behaviour)component27).enabled = true; component27.useLongPress = false; ((UnityEventBase)component27.onPressed).RemoveAllListeners(); component27.onPressed.AddListener(UnityAction.op_Implicit((Action)delegate { //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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) if (ReplayPlaybackControls.playbackControlsOpen) { ReplayPlaybackControls.Close(); } else { ReplayPlaybackControls.Open(); string text = currentScene; if (1 == 0) { } Vector3 val77 = (Vector3)(text switch { "Gym" => new Vector3(4.2525f, 1.5936f, 4.2636f), "Map0" => new Vector3(13.8832f, -4.2314f, -9.1586f), "Map1" => new Vector3(-12.846f, 1.2404f, 1.294f), "Park" => new Vector3(-27.7917f, -1.4615f, -5.4588f), _ => Vector3.zero, }); if (1 == 0) { } Vector3 position = val77; string text2 = currentScene; if (1 == 0) { } Quaternion val78; switch (text2) { case "Gym": val78 = Quaternion.Euler(0f, 162.7955f, 0f); break; case "Map0": val78 = Quaternion.Euler(0f, 3.7954f, 0f); break; case "Map1": case "Park": val78 = Quaternion.Euler(0f, 143.5775f, 0f); break; default: val78 = Quaternion.identity; break; } if (1 == 0) { } Quaternion rotation = val78; ReplayPlaybackControls.playbackControls.transform.position = position; ReplayPlaybackControls.playbackControls.transform.rotation = rotation; } })); TextMeshPro component28 = Create.NewText().GetComponent(); ((Object)component28).name = "Open Controls Text"; component28.transform.SetParent(((Component)component27).transform); component28.transform.localPosition = new Vector3(0.0116f, 0.0117f, 0f); component28.transform.localRotation = Quaternion.Euler(90f, 90f, 0f); component28.transform.localScale = Vector3.one * 0.4f; ((TMP_Text)component28).text = ". . ."; ((Graphic)component28).color = Color.white; ((TMP_Text)component28).enableWordWrapping = false; ((TMP_Text)component28).fontSizeMax = 1.3f; ((TMP_Text)component28).ForceMeshUpdate(false, false); GameObject val48 = Object.Instantiate(val2.LoadAsset("SlideOutPlayerSelector"), val42.transform); ((Object)val48).name = "Player Selector Panel"; val48.transform.localScale = Vector3.one * 1.5f; val48.transform.localPosition = new Vector3(-0.0778f, 0.3898f, 0.0134f); val48.SetActive(false); GameObject val49 = Create.NewText(); ((Object)val49).name = "PlayerSelectorNameText"; val49.transform.SetParent(val48.transform); val49.transform.localPosition = new Vector3(0f, 0.072f, -0.004f); val49.transform.localRotation = Quaternion.identity; val49.transform.localScale = Vector3.one * 0.18f; TextMeshPro component29 = val49.GetComponent(); ((TMP_Text)component29).text = "Player Selector"; ((Graphic)component29).color = new Color(0.1137f, 0.1059f, 0.0392f); ((TMP_Text)component29).enableWordWrapping = false; ((TMP_Text)component29).fontSizeMax = 1f; ((TMP_Text)component29).fontSizeMin = 1f; ((TMP_Text)component29).ForceMeshUpdate(false, false); ReplaySettings.playerTags.Clear(); for (int k = 0; k < 4; k++) { int index = k; GameObject val50 = Object.Instantiate(PlayerTag20.GetGameObject(), val48.transform); ((Object)val50).name = $"Player Tag {index}"; val50.transform.localScale = Vector3.one * 0.5f; val50.transform.localPosition = new Vector3(0f, -0.0073f + -0.1091f * (float)index, -0.0098f); val50.transform.localRotation = Quaternion.identity; ((Component)val50.transform.GetChild(0).GetChild(1).GetChild(6)).gameObject.SetActive(false); InteractionButton component30 = ((Component)val50.transform.GetChild(0)).GetComponent(); ((UnityEventBase)component30.onPressed).RemoveAllListeners(); component30.onPressed.AddListener(UnityAction.op_Implicit((Action)delegate { ReplaySettings.selectedPlayer = ReplaySettings.PlayerAtIndex(index).player; })); ReplaySettings.playerTags.Add(((Component)((Component)component30).transform.parent).GetComponent()); } GameObject val51 = Object.Instantiate(val36, val48.transform); ((Object)val51).name = "Next Page"; val51.transform.localPosition = new Vector3(0.0822f, -0.4184f, 0.0371f); val51.transform.localRotation = Quaternion.Euler(270f, 0f, 0f); val51.transform.localScale = Vector3.one * 0.8f; ((Renderer)((Component)val51.transform.GetChild(0).GetChild(3)).GetComponent()).material.SetTexture("_Texture", (Texture)(object)ReplayPlaybackControls.playSprite); InteractionButton component31 = ((Component)val51.transform.GetChild(0)).GetComponent(); ((Behaviour)component31).enabled = true; ((UnityEventBase)component31.onPressed).RemoveAllListeners(); component31.onPressed.AddListener(UnityAction.op_Implicit((Action)delegate { ReplaySettings.SelectPlayerPage(ReplaySettings.currentPlayerPage + 1); })); GameObject val52 = Object.Instantiate(val36, val48.transform); ((Object)val52).name = "Previous Page"; val52.transform.localPosition = new Vector3(-0.0822f, -0.4184f, 0.0371f); val52.transform.localRotation = Quaternion.Euler(90f, 180f, 0f); val52.transform.localScale = Vector3.one * 0.8f; ((Renderer)((Component)val52.transform.GetChild(0).GetChild(3)).GetComponent()).material.SetTexture("_Texture", (Texture)(object)ReplayPlaybackControls.playSprite); InteractionButton component32 = ((Component)val52.transform.GetChild(0)).GetComponent(); ((Behaviour)component32).enabled = true; ((UnityEventBase)component32.onPressed).RemoveAllListeners(); component32.onPressed.AddListener(UnityAction.op_Implicit((Action)delegate { ReplaySettings.SelectPlayerPage(ReplaySettings.currentPlayerPage - 1); })); GameObject val53 = Create.NewText(); val53.transform.SetParent(val48.transform); val53.transform.localPosition = new Vector3(0f, -0.4152f, -0.0062f); val53.transform.localRotation = Quaternion.identity; val53.transform.localScale = Vector3.one * 0.4f; ((Object)val53).name = "Page Number"; TextMeshPro component33 = val53.GetComponent(); ((TMP_Text)component33).text = "0 / 0"; ((Graphic)component33).color = Color.white; ((TMP_Text)component33).horizontalAlignment = (HorizontalAlignmentOptions)2; ((TMP_Text)component33).enableWordWrapping = false; ((TMP_Text)component33).ForceMeshUpdate(false, false); GameObject val54 = new GameObject("Page Selector Buttons"); val54.transform.SetParent(val48.transform, false); val53.transform.SetParent(val54.transform, true); val51.transform.SetParent(val54.transform, true); val52.transform.SetParent(val54.transform, true); GameObject val55 = Object.Instantiate(val29, val42.transform); ((Object)val55).name = "Timeline"; val55.layer = LayerMask.NameToLayer("Default"); val55.transform.localPosition = new Vector3(-0.0138f, -0.0039f, -0.0451f); val55.transform.localScale = new Vector3(0.5168f, 0.0318f, 1.9291f); val55.transform.localRotation = Quaternion.identity; TextMeshPro val56 = Object.Instantiate(component12, val42.transform); ((Object)val56).name = "TotalDuration"; ((Component)val56).gameObject.layer = LayerMask.NameToLayer("Default"); val56.transform.localPosition = new Vector3(0f, 0.0433f, -0.0444f); val56.transform.localScale = Vector3.one * 0.5f; ((TMP_Text)((Component)val56).GetComponent()).enableWordWrapping = false; ((TMP_Text)((Component)val56).GetComponent()).ForceMeshUpdate(false, false); GameObject val57 = Object.Instantiate(((Component)component13).gameObject, val42.transform); val57.transform.localPosition = new Vector3(0f, 0.4527f, -0.0425f); val57.transform.localScale = Vector3.one * 0.5f; ((Object)val57).name = "Replay Title"; val57.layer = LayerMask.NameToLayer("Default"); TextMeshPro component34 = val57.GetComponent(); ((TMP_Text)component34).enableWordWrapping = true; ((TMP_Text)component34).enableAutoSizing = true; ((TMP_Text)component34).fontSizeMax = 2f; ((TMP_Text)component34).fontSizeMin = 0.6f; ((Component)component34).GetComponent().sizeDelta = new Vector2(1.2f, 0.1577f); ((TMP_Text)component34).alignment = (TextAlignmentOptions)258; GameObject val58 = Object.Instantiate(((Component)component13).gameObject, val42.transform); val58.transform.localPosition = new Vector3(0f, 0.3854f, -0.0436f); val58.transform.localScale = Vector3.one * 0.25f; ((Object)val58).name = "Date"; val58.layer = LayerMask.NameToLayer("Default"); ((TMP_Text)val58.GetComponent()).enableWordWrapping = false; GameObject val59 = Object.Instantiate(crystalizeButton, val42.transform); ((Object)val59).name = "DeleteReplay"; val59.transform.localPosition = new Vector3(0.1071f, -0.1486f, -0.0545f); val59.transform.localRotation = Quaternion.identity; val59.transform.localScale = Vector3.one * 1.1f; InteractionButton component35 = ((Component)val59.transform.GetChild(0)).GetComponent(); component35.onPressedAudioCall = component5.onPressedAudioCall; component35.longPressTime = 1f; ((UnityEventBase)component35.OnPressed).RemoveAllListeners(); component35.OnPressed.AddListener(UnityAction.op_Implicit((Action)delegate { //IL_0080: 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) if (ReplayFiles.explorer.currentIndex != -1) { if (crystalBreakCoroutine == null) { ReplayCrystals.Crystal crystal = ReplayCrystals.Crystals.FirstOrDefault((ReplayCrystals.Crystal c) => c.ReplayPath == ReplayFiles.explorer.CurrentReplayPath); crystalBreakCoroutine = MelonCoroutines.Start(ReplayCrystals.CrystalBreakAnimation(ReplayFiles.explorer.CurrentReplayPath, crystal)); } } else { ReplayError(); } })); SpriteRenderer component36 = ((Component)val59.transform.GetChild(0).GetChild(3)).GetComponent(); Texture2D val60 = val2.LoadAsset("trashcan"); component36.sprite = Sprite.Create(val60, new Rect(0f, 0f, (float)((Texture)val60).width, (float)((Texture)val60).height), Vector2.op_Implicit(new Vector3(0.5f, 0.5f)), 100f); component36.color = new Color(1f, 0.163f, 0.2132f, 1f); ((Component)component36).transform.localRotation = Quaternion.Euler(270f, 180f, 0f); ((Component)component36).transform.localScale = Vector3.one * 0.01f; ((Object)component36).name = "DeleteIcon"; TextMeshPro component37 = val57.GetComponent(); ((TMP_Text)component37).enableAutoSizing = true; ((TMP_Text)component37).fontSizeMin = 0.7f; ((TMP_Text)component37).fontSizeMax = 1.2f; TextMeshPro component38 = val58.GetComponent(); ((TMP_Text)component38).enableAutoSizing = true; ((TMP_Text)component38).fontSizeMin = 0.7f; ((TMP_Text)component38).fontSizeMax = 1.2f; GameObject val61 = Object.Instantiate(val58, val42.transform); ((Object)val61).name = "Rename Instructions"; val61.transform.localPosition = new Vector3(0f, 0.2898f, -0.0422f); val61.transform.localScale = Vector3.one * 0.55f; val61.SetActive(false); TextMeshPro component39 = val61.GetComponent(); ((TMP_Text)component39).text = "Please type on your keyboard to rename\n<#32a832>Enter - Confirm <#cc1b1b>Esc - Cancel"; ((TMP_Text)component39).enableWordWrapping = false; GameObject val62 = Object.Instantiate(val61, val59.transform); ((Object)val62).name = "DeleteText"; val62.transform.localPosition = new Vector3(0.0143f, 0.0713f, 0f); val62.SetActive(true); val62.transform.localScale = Vector3.one * 0.2f; TextMeshPro component40 = val62.GetComponent(); ((TMP_Text)component40).text = "<#cc1b1b>DELETE REPLAY"; ((TMP_Text)component40).enableWordWrapping = false; ((TMP_Text)component40).ForceMeshUpdate(false, false); GameObject val63 = Object.Instantiate(val59, val42.transform); ((Object)val63).name = "CopyPathButton"; val63.transform.localPosition = new Vector3(-0.0224f, -0.1486f, -0.0545f); val63.transform.localRotation = Quaternion.identity; ((TMP_Text)((Component)val63.transform.GetChild(2)).GetComponent()).text = "Copy Path"; ((TMP_Text)((Component)val63.transform.GetChild(2)).GetComponent()).ForceMeshUpdate(false, false); val63.transform.GetChild(2).localPosition = new Vector3(0.0143f, 0.0713f, 0f); SpriteRenderer component41 = ((Component)val63.transform.GetChild(0).GetChild(3)).GetComponent(); Texture2D val64 = val2.LoadAsset("copytoclipboard"); component41.sprite = Sprite.Create(val64, new Rect(0f, 0f, (float)((Texture)val64).width, (float)((Texture)val64).height), Vector2.op_Implicit(new Vector3(0.5f, 0.5f)), 100f); component41.color = Color.white; ((Component)component41).transform.localRotation = Quaternion.Euler(270f, 180f, 0f); ((Component)component41).transform.localScale = Vector3.one * -0.015f; ((Object)component41).name = "CopyPathIcon"; InteractionButton component42 = ((Component)val63.transform.GetChild(0)).GetComponent(); component42.useLongPress = false; ((UnityEventBase)component42.onPressed).RemoveAllListeners(); component42.onPressed.AddListener(UnityAction.op_Implicit((Action)delegate { GUIUtility.systemCopyBuffer = ReplayFiles.explorer.CurrentReplayPath; })); replaySettings = val41.AddComponent(); GameObject val65 = Object.Instantiate(val59, val42.transform); ((Object)val65).name = "RenameButton"; val65.transform.localPosition = new Vector3(-0.1522f, -0.1486f, -0.0545f); val65.transform.localRotation = Quaternion.identity; InteractionButton component43 = ((Component)val65.transform.GetChild(0)).GetComponent(); ((UnityEventBase)component43.onPressed).RemoveAllListeners(); component43.isToggleButton = true; component43.useLongPress = false; component43.onToggleFalseAudioCall = ReplayCache.SFX["Call_GearMarket_GenericButton_Unpress"]; component43.onToggleTrueAudioCall = ReplayCache.SFX["Call_GearMarket_GenericButton_Press"]; ((UnityEvent)(object)component43.onToggleStateChanged).AddListener(UnityAction.op_Implicit((Action)delegate(bool toggleState) { if (ReplayFiles.explorer.currentIndex != -1) { replaySettings.OnRenamePressed(!toggleState); } })); ((TMP_Text)((Component)val65.transform.GetChild(2)).GetComponent()).text = "Rename"; ((TMP_Text)((Component)val65.transform.GetChild(2)).GetComponent()).ForceMeshUpdate(false, false); val65.transform.GetChild(2).localPosition = new Vector3(0.0171f, 0.0713f, 0f); SpriteRenderer component44 = ((Component)val65.transform.GetChild(0).GetChild(3)).GetComponent(); Texture2D val66 = val2.LoadAsset("RenameIcon"); component44.sprite = Sprite.Create(val66, new Rect(0f, 0f, (float)((Texture)val66).width, (float)((Texture)val66).height), Vector2.op_Implicit(new Vector3(0.5f, 0.5f)), 100f); component44.color = Color.white; ((Component)component44).transform.localRotation = Quaternion.Euler(270f, 180f, 0f); ((Component)component44).transform.localScale = Vector3.one * 0.01f; ((Object)component44).name = "RenameIcon"; GameObject val67 = Object.Instantiate(ReportPlayerButton.GetGameObject(), val42.transform); ((Object)val67).name = "Favorite Button"; val67.transform.localPosition = new Vector3(-0.2489f, -0.0529f, -0.028f); val67.transform.localRotation = Quaternion.Euler(0f, 270f, 90f); val67.transform.localScale = Vector3.one * 0.35f; ((Component)val67.transform.GetChild(2)).gameObject.SetActive(false); InteractionButton component45 = ((Component)val67.transform.GetChild(0)).GetComponent(); ((Behaviour)component45).enabled = true; GameObject gameObject2 = TrackedIcon.GetGameObject(); Texture2D texture = gameObject2.GetComponent().sprite.texture; MeshRenderer component46 = ((Component)((Component)component45).transform.GetChild(5)).GetComponent(); ((Renderer)component46).material.SetTexture("_Texture", (Texture)(object)texture); ((Component)component46).transform.localScale = Vector3.one * 0.0708f; GameObject val68 = Object.Instantiate(gameObject2, val42.transform); ((Object)val68).name = "Favorited Icon"; val68.transform.localPosition = new Vector3(-0.3248f, 0.5046f, -0.047f); val68.transform.localRotation = Quaternion.Euler(0f, 0f, 22.0727f); val68.transform.localScale = Vector3.one * 0.003f; val68.SetActive(false); component45.useLongPress = false; ((UnityEventBase)component45.onPressed).RemoveAllListeners(); component45.onPressed.AddListener(UnityAction.op_Implicit((Action)delegate { ReplayExplorer.Entry entry = ReplayFiles.explorer.currentReplayEntries[ReplayFiles.explorer.currentIndex]; bool isFavorited = entry.header.isFavorited; entry.header.isFavorited = !isFavorited; ReplayArchive.WriteManifest(entry.FullPath, entry.header); ReplaySettings.favoritedIcon.SetActive(!isFavorited); ReplayFiles.ReloadReplays(); })); ReplaySettings.replaySettingsGO = val42; ReplaySettings.deleteButton = component35; ReplaySettings.replayName = component37; ReplaySettings.dateText = component38; ReplaySettings.renameInstructions = component39; ReplaySettings.renameButton = component43; ReplaySettings.timeline = val55; ReplaySettings.durationComp = val56; ReplaySettings.slideOutPanel = val48; ReplaySettings.pageNumberText = component33; ReplaySettings.povButton = val43; ReplaySettings.hideLocalPlayerToggle = val44; ReplaySettings.openControlsButton = val47; ReplaySettings.favoritedIcon = val68; GameObject val69 = new GameObject("Replay Explorer"); val69.transform.SetParent(val41.transform.GetChild(0), false); ReplaySettings.replayExplorerGO = val69; ReplayFiles.folderIcon = val2.LoadAsset("FolderIcon"); ((Object)ReplayFiles.folderIcon).hideFlags = (HideFlags)32; ReplayFiles.replayIcon = val2.LoadAsset("ReplayIcon"); ((Object)ReplayFiles.replayIcon).hideFlags = (HideFlags)32; for (int l = 0; l <= 5; l++) { GameObject val70 = Object.Instantiate(PlayerTag20.GetGameObject(), val69.transform); ((Object)val70).name = $"Selection_{l}"; val70.transform.localPosition = new Vector3(-0.0148f, 0.293f - 0.0935f * (float)l, -0.0418f); Transform child = val70.transform.GetChild(0).GetChild(0); Transform child2 = val70.transform.GetChild(0).GetChild(1); for (int m = 0; m < child.childCount; m++) { if (m != 0 && m != 1 && m != 3) { ((Component)child.GetChild(m)).gameObject.SetActive(false); } } for (int n = 0; n < child2.childCount; n++) { if (n != 0 && n != 3) { ((Component)child2.GetChild(n)).gameObject.SetActive(false); } } child.GetChild(0).localPosition = new Vector3(-0.2231f, 0.0344f, -0.0091f); child.GetChild(1).localPosition = new Vector3(0f, 0.0356f, -0.0039f); child.GetChild(1).localScale = new Vector3(0.0324f, 0.2663f, 0.1858f); child.GetChild(3).localPosition = new Vector3(0.0318f, 0.0341f, -0.0095f); child.GetChild(3).localScale = new Vector3(0.0324f, 0.2165f, 0.1285f); Object.Destroy((Object)(object)((Component)child.GetChild(7)).gameObject); child2.GetChild(0).localPosition = new Vector3(-0.1715f, 0.0113f, -0.0292f); TextMeshPro component47 = ((Component)child2.GetChild(0)).GetComponent(); RectTransform component48 = ((Component)child2.GetChild(0)).GetComponent(); ((TMP_Text)component47).fontSizeMin = 0.2f; ((TMP_Text)component47).alignment = (TextAlignmentOptions)513; component48.sizeDelta = new Vector2(0.42f, 0.0502f); child2.GetChild(3).localPosition = new Vector3(-0.2241f, 0.035f, -0.0288f); child2.GetChild(3).localScale = Vector3.one * 0.0422f; val70.GetComponent().RemovePressedCallback(); InteractionHapticsSignal val71 = ScriptableObject.CreateInstance(); val71.duration = 0.05f; val71.intensity = 0.5f; ((Component)val70.transform.GetChild(0)).GetComponent().onPressedHaptics = val71; MeshRenderer component49 = ((Component)val70.transform.GetChild(0).GetChild(0).GetChild(1)).GetComponent(); BoxCollider component50 = ((Component)val70.transform.GetChild(0)).GetComponent(); Transform transform3 = ((Component)val70.transform.GetChild(0)).transform; val28 = ((Renderer)component49).bounds; component50.center = transform3.InverseTransformPoint(((Bounds)(ref val28)).center); val28 = ((Renderer)component49).bounds; component50.size = ((Bounds)(ref val28)).size; GameObject val72 = Object.Instantiate(TrackedIcon.GetGameObject(), child2); val72.transform.localPosition = new Vector3(0.2455f, 0.0626f, -0.0338f); val72.transform.localScale = Vector3.one * 0.002f; val72.SetActive(false); } GameObject val73 = new GameObject("Path"); val73.transform.SetParent(val69.transform, false); Transform val74 = Object.Instantiate(PlayerTag20.GetGameObject().transform.GetChild(0).GetChild(0).GetChild(1), val73.transform); ((Component)val74).transform.localPosition = new Vector3(-0.0149f, 0.4088f, -0.0438f); ((Component)val74).transform.localRotation = Quaternion.Euler(270f, 90f, 0f); ((Component)val74).transform.localScale = new Vector3(0.0324f, 0.2663f, 0.1098f); ((Object)val74).name = "Path Background Block"; GameObject val75 = Create.NewText(":3", 1f, Color.white, Vector3.zero, Quaternion.identity); ((Object)val75).name = "Path Text"; val75.transform.SetParent(val73.transform); val75.transform.localRotation = Quaternion.identity; val75.transform.localPosition = new Vector3(-0.0112f, 0.4076f, -0.0645f); val75.transform.localScale = Vector3.one * 0.95f; TextMeshPro component51 = val75.GetComponent(); ((TMP_Text)component51).fontSizeMax = 0.3f; ((TMP_Text)component51).fontSizeMin = 0.1f; ((TMP_Text)component51).enableAutoSizing = true; ((TMP_Text)component51).enableWordWrapping = false; ((TMP_Text)component51).alignment = (TextAlignmentOptions)513; ((TMP_Text)component51).text = "Replays"; ((Graphic)component51).color = new Color(0.102f, 0.051f, 0.0275f); GameObject val76 = Object.Instantiate(val54, val69.transform); ((Object)val76).name = "Page Selector"; val76.transform.localPosition = new Vector3(-0.0138f, 0.297f, -0.0365f); val76.transform.localScale = Vector3.one * 1.3f; InteractionButton component52 = ((Component)val76.transform.GetChild(1).GetChild(0)).GetComponent(); InteractionButton component53 = ((Component)val76.transform.GetChild(2).GetChild(0)).GetComponent(); ((UnityEventBase)component52.onPressed).RemoveAllListeners(); component52.onPressed.AddListener(UnityAction.op_Implicit((Action)delegate { ReplayFiles.explorer.currentPage = Mathf.Clamp(++ReplayFiles.explorer.currentPage, 0, ReplayFiles.explorer.pageCount - 1); ReplayFiles.RefreshUI(); })); ((UnityEventBase)component53.onPressed).RemoveAllListeners(); component53.onPressed.AddListener(UnityAction.op_Implicit((Action)delegate { ReplayFiles.explorer.currentPage = Mathf.Clamp(--ReplayFiles.explorer.currentPage, 0, ReplayFiles.explorer.pageCount - 1); ReplayFiles.RefreshUI(); })); foreach (Renderer componentsInChild2 in val.GetComponentsInChildren(true)) { componentsInChild2.enabled = true; } foreach (Renderer componentsInChild3 in val25.GetComponentsInChildren(true)) { componentsInChild3.enabled = true; } Object.DontDestroyOnLoad((Object)(object)val); Object.DontDestroyOnLoad((Object)(object)val14); Object.DontDestroyOnLoad((Object)(object)val25); Object.DontDestroyOnLoad((Object)(object)clapperboardVFX); Object.DontDestroyOnLoad((Object)(object)val40); val2.Unload(false); } public void PlayClapperboardVFX(Vector3 position, Quaternion rotation) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: 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_01a0: 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_0200: Unknown result type (might be due to invalid IL or missing references) GameObject clapperboard = Object.Instantiate(clapperboardVFX); clapperboard.SetActive(true); clapperboard.transform.localScale = Vector3.zero; clapperboard.transform.position = position; clapperboard.transform.rotation = rotation; PooledMonoBehaviour val = Singleton.instance.GetPool("RockCamSpawn_VFX").FetchFromPool(position, rotation); Transform transform = ((Component)val).transform; transform.localPosition += new Vector3(0f, 0.1f, 0f); ((Component)val).transform.localScale = Vector3.one * 0.9f; Singleton.instance.Play((!Recording.isRecording) ? ReplayCache.SFX["Call_RockCam_StartRecording"] : ReplayCache.SFX["Call_RockCam_StopRecording"], position, false); MelonCoroutines.Start(Utilities.LerpValue((Func)(() => clapperboard.transform.localScale), (Action)delegate(Vector3 v) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) clapperboard.transform.localScale = v; }, (Func)Vector3.Lerp, Vector3.one * 5f, 0.5f, (Func)Utilities.EaseInOut, (Action)delegate { //IL_004b: Unknown result type (might be due to invalid IL or missing references) MelonCoroutines.Start(Utilities.LerpValue((Func)(() => clapperboard.transform.localScale), (Action)delegate(Vector3 v) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) clapperboard.transform.localScale = v; }, (Func)Vector3.Lerp, Vector3.zero, 0.5f, (Func)Utilities.EaseInOut, (Action)delegate { //IL_0022: Unknown result type (might be due to invalid IL or missing references) Object.Destroy((Object)(object)clapperboard); Singleton.instance.Play(ReplayCache.SFX["Call_RockCam_Despawn"], position, false); }, 0f, (Func)null)); }, 0f, (Func)null)); MelonCoroutines.Start(Utilities.LerpValue((Func)(() => clapperboard.transform.localRotation), (Action)delegate(Quaternion v) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) clapperboard.transform.localRotation = v; }, (Func)Quaternion.Slerp, rotation * Quaternion.Euler(0f, 17f, 0f), 0.8f, (Func)Utilities.EaseInOut, (Action)null, 0f, (Func)null)); MelonCoroutines.Start(Utilities.LerpValue((Func)(() => clapperboard.transform.GetChild(0).localRotation), (Action)delegate(Quaternion v) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) clapperboard.transform.GetChild(0).localRotation = v; }, (Func)Quaternion.Slerp, Quaternion.Euler(0f, 9.221f, 0f), 0.5f, (Func)Utilities.EaseInOut, (Action)delegate { //IL_005a: Unknown result type (might be due to invalid IL or missing references) MelonCoroutines.Start(Utilities.LerpValue((Func)(() => clapperboard.transform.GetChild(0).localRotation), (Action)delegate(Quaternion v) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) clapperboard.transform.GetChild(0).localRotation = v; }, (Func)Quaternion.Slerp, Quaternion.Euler(0f, 347.9986f, 0f), 0.5f, (Func)Utilities.EaseInOut, (Action)null, 0f, (Func)null)); }, 0f, (Func)null)); } public void LoadSelectedReplay() { //IL_0096: 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) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_029e: 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_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) DebugLog($"LoadReplay | Current:{currentScene} | Target:{ReplayFiles.currentHeader?.Scene} | Path:{ReplayFiles.explorer.CurrentReplayPath}"); if (ReplayFiles.explorer.currentIndex == -1) { ReplayError("Could not find file."); return; } if (currentScene == "Park") { Room currentRoom = PhotonNetwork.CurrentRoom; if (((currentRoom != null) ? currentRoom.PlayerCount : 0) > 1) { ReplayError("Cannot start replay in room with more than 1 player."); return; } } if (Playback.isPlaying) { Playback.StopReplay(); } string targetScene = ReplayFiles.currentHeader.Scene; bool flag = targetScene != currentScene; bool isCustomMap = (targetScene == "Map0" || targetScene == "Map1") && !string.IsNullOrWhiteSpace(ReplayFiles.currentHeader.CustomMap); bool isRawMapData = !string.IsNullOrWhiteSpace(ReplayFiles.currentHeader.CustomMap) && ReplayFiles.currentHeader.CustomMap.Split('|').Length > 15; DebugLog($"SwitchingScene:{flag} | Custom:{isCustomMap} | RawMap:{isRawMapData}"); GameObject replayCustomMap = null; if (ReplayFiles.currentHeader.CustomMap == "FlatLandSingle") { GameObject obj = flatLandRoot; if (obj == null || obj.gameObject.activeSelf) { GameObject obj2 = flatLandRoot; object obj3; if (obj2 == null) { obj3 = null; } else { Transform transform = obj2.transform; if (transform == null) { obj3 = null; } else { Transform child = transform.GetChild(1); if (child == null) { obj3 = null; } else { Transform child2 = child.GetChild(0); obj3 = ((child2 != null) ? ((Component)child2).GetComponent() : null); } } } InteractionButton val = (InteractionButton)obj3; if ((Object)(object)val == (Object)null) { ReplayError("Could not load FlatLand Replay. Please make sure FlatLand is installed."); return; } val.RPC_OnPressed(); MelonCoroutines.Start(DelayedFlatLandLoad()); return; } flag = false; } if (flag && isCustomMap && !isRawMapData) { replayCustomMap = Utilities.GetCustomMap(ReplayFiles.currentHeader.CustomMap); if ((Object)(object)replayCustomMap == (Object)null) { return; } } if (flag) { ReplayFiles.HideMetadata(); if (1 == 0) { } int num = targetScene switch { "Map0" => 3, "Map1" => 4, "Park" => 2, "Gym" => 1, _ => -1, }; if (1 == 0) { } int num2 = num; switch (num2) { case -1: ReplayError("Unknown scene '" + targetScene + "'"); return; case 2: { ParkBoardGymVariant component = Parkboard.GetGameObject().GetComponent(); ((InteractionNumericalBase)component.doorPolicySlider).SetStep(1, false, false); component.HostPark(); ReplayPlayback.isReplayScene = true; return; } } MelonCoroutines.Start(Utilities.LoadMap(num2, 2.5f, delegate { Playback.LoadReplay(ReplayFiles.explorer.CurrentReplayPath); ReplayFiles.ShowMetadata(); switch (targetScene) { case "Map0": MatchHandler.GetGameObject().SetActive(false); break; case "Map1": MatchHandler.GetGameObject().SetActive(false); SceneProcessors.GetGameObject().SetActive(false); break; case "Park": ParkInstance.GetGameObject().SetActive(false); break; } if (isCustomMap) { if ((Object)(object)replayCustomMap != (Object)null) { replayCustomMap.SetActive(true); } else if (isRawMapData) { MelonMod? obj4 = ((IEnumerable)MelonTypeBase.RegisteredMelons).FirstOrDefault((Func)((MelonMod m) => ((MelonBase)m).Info.Name == "CustomMultiplayerMaps")); object obj5; if (obj4 == null) { obj5 = null; } else { MelonAssembly melonAssembly = ((MelonBase)obj4).MelonAssembly; obj5 = ((melonAssembly == null) ? null : melonAssembly.Assembly?.GetTypes().FirstOrDefault((Type t) => t.Name == "main")); } Type type = (Type)obj5; if (type != null) { MethodInfo method = type.GetMethod("LoadCustomMap", BindingFlags.Static | BindingFlags.Public, null, new Type[1] { typeof(string[]) }, null); string[] array = ReplayFiles.currentHeader.CustomMap.Split('|'); method?.Invoke(null, new object[1] { array }); } } if (targetScene == "Map0") { Scene.GetGameObject().SetActive(false); } else if (targetScene == "Map1") { Scene.GetGameObject().SetActive(false); } } SimpleScreenFadeInstance.Progress = 0f; }, 2f)); } else { if (currentScene == "Park") { MelonCoroutines.Start(DelayedParkLoad()); } else { Playback.LoadReplay(ReplayFiles.explorer.CurrentReplayPath); } SimpleScreenFadeInstance.Progress = 0f; } } public override void OnUpdate() { //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: 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_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: 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_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) if (!UIInitialized) { return; } HandleReplayPose(); ReplayPlaybackControls.Update(); if (currentScene != "Loader") { ReplayCrystals.HandleCrystals(); } Player localPlayer = LocalPlayer; if ((Object)(object)((localPlayer != null) ? localPlayer.Controller : null) != (Object)null) { ((Component)LocalPlayer.Controller.PlayerNameTag).gameObject.SetActive(false); } if (currentScene != "Gym" || (Object)(object)replayTable == (Object)null || Object.op_Implicit((Object)(object)((Component)replayTable).gameObject) || (Object)(object)replayTable.metadataText == (Object)null) { return; } int num; if ((Object)(object)flatLandRoot != (Object)null) { GameObject obj = flatLandRoot; num = ((obj != null && obj.activeSelf) ? 1 : 0); } else { num = 0; } bool flag = (byte)num != 0; if (lastFlatLandActive != flag) { lastFlatLandActive = flag; ((Component)replayTable).gameObject.SetActive(true); ((Component)replayTable.metadataText).gameObject.SetActive(true); if (!flag) { replayTable.tableFloat.startPos = new Vector3(5.9641f, 1.1323f, -4.5477f); replayTable.metadataTextFloat.startPos = new Vector3(5.9641f, 1.1323f, -4.5477f); replayTable.tableOffset = -0.4f; ((Component)replayTable).transform.rotation = Quaternion.Euler(270f, 253.3632f, 0f); } else { replayTable.tableFloat.startPos = new Vector3(5.9506f, 1.3564f, 4.1906f); replayTable.metadataTextFloat.startPos = new Vector3(5.9575f, 1.8514f, 4.2102f); replayTable.tableOffset = 0f; ((Component)replayTable).transform.localRotation = Quaternion.Euler(270f, 121.5819f, 0f); } } } public override void OnLateUpdate() { if (UIInitialized) { Recording?.HandleRecording(); Playback?.HandlePlayback(); } } public override void OnFixedUpdate() { if (!(currentScene == "Loader") && UIInitialized) { TryHandleController(LeftHandControls.Value, LeftController.GetPrimary(), LeftController.GetSecondary(), isLeft: true); TryHandleController(RightHandControls.Value, RightController.GetPrimary(), RightController.GetSecondary(), isLeft: false); } } private bool IsFramePose(Transform handA, Transform handB) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_002b: 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_0033: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_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_0081: 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_009a: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_00dc: 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_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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) Vector3 right = head.right; Vector3 forward = handA.forward; Vector3 up = handA.up; Vector3 right2 = handA.right; Vector3 forward2 = handB.forward; Vector3 up2 = handB.up; Vector3 val = -handB.right; Vector3 val2 = head.position - handA.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; val2 = head.position - handB.position; Vector3 normalized2 = ((Vector3)(ref val2)).normalized; float num = Vector3.Dot(forward, right); bool flag = Mathf.Abs(num) > 0.7f; float num2 = Vector3.Dot(right2, normalized); bool flag2 = num2 > 0.6f; float num3 = Vector3.Dot(up, Vector3.up); bool flag3 = num3 > 0.6f; float num4 = Vector3.Dot(forward, forward2); bool flag4 = num4 < -0.7f; float num5 = Vector3.Dot(val, normalized2); bool flag5 = num5 < -0.6f; float num6 = Vector3.Dot(up2, Vector3.up); bool flag6 = num6 < -0.6f; float num7 = Vector3.Distance(handA.position, handB.position); float num8 = LocalPlayer.Data.PlayerMeasurement.ArmSpan * 0.23540491f; bool flag7 = num7 < num8; return flag && flag2 && flag3 && flag4 && flag5 && flag6 && flag7; } private bool IsPausePlayPose(Transform left, Transform right) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) Vector3 val = left.forward; float num = Vector3.Dot(((Vector3)(ref val)).normalized, head.up); bool flag = Mathf.Abs(num) < Mathf.Cos(60f * Mathf.Deg2Rad); val = left.right; float num2 = Vector3.Dot(((Vector3)(ref val)).normalized, -head.up); bool flag2 = num2 > Mathf.Cos(60f * Mathf.Deg2Rad); bool flag3 = flag && flag2; val = right.forward; float num3 = Vector3.Dot(((Vector3)(ref val)).normalized, head.up); bool flag4 = Mathf.Abs(num3) >= Mathf.Cos(35f * Mathf.Deg2Rad); val = -right.right; float num4 = Vector3.Dot(((Vector3)(ref val)).normalized, -head.right); bool flag5 = num4 > 0.5f; bool flag6 = flag4 && flag5; float num5 = Vector3.Distance(left.position, right.position); float num6 = LocalPlayer.Data.PlayerMeasurement.ArmSpan * 0.09808537f; bool flag7 = num5 < num6; bool flag8 = left.position.y > right.position.y; return flag3 && flag8 && flag6 && flag7; } public void HandleReplayPose() { //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: 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_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: 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_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) if (currentScene == "Loader") { return; } if ((Object)(object)leftHand == (Object)null || (Object)(object)rightHand == (Object)null || (Object)(object)head == (Object)null) { Player localPlayer = LocalPlayer; PlayerController val = ((localPlayer != null) ? localPlayer.Controller : null); if ((Object)(object)val == (Object)null) { return; } Transform transform = ((Component)val).transform; Transform val2 = ((transform != null && transform.childCount >= 3) ? ((Component)val).transform.GetChild(2) : null); if ((Object)(object)val2 == (Object)null || val2.childCount < 3) { return; } Transform child = val2.GetChild(0); if (child.childCount < 1) { return; } leftHand = val2.GetChild(1); rightHand = val2.GetChild(2); head = child.GetChild(0); } bool flag = IsFramePose(leftHand, rightHand); bool flag2 = LeftController.GetTrigger() > 0.8f && RightController.GetTrigger() > 0.8f; if (flag && LeftController.GetGrip() > 0.8f && RightController.GetGrip() > 0.8f) { heldTime += Time.deltaTime; soundTimer += Time.deltaTime; if (soundTimer >= 0.5f && !hasPlayed) { soundTimer -= 0.5f; Singleton.instance.Play(flag2 ? ReplayCache.SFX["Call_DressingRoom_PartPanelTick_BackwardLocked"] : ReplayCache.SFX["Call_DressingRoom_PartPanelTick_ForwardUnlocked"], head.position, false); } if (heldTime >= 2f && !hasPlayed) { hasPlayed = true; if (flag2) { if (Playback.isPlaying) { if (ReplayPlaybackControls.playbackControlsOpen && Vector3.Distance(ReplayPlaybackControls.playbackControls.transform.position, head.position) < LocalPlayer.Data.PlayerMeasurement.ArmSpan) { ReplayPlaybackControls.Close(); } else { ReplayPlaybackControls.Open(); } } else { ReplayError(); } } else { PlayClapperboardVFX(head.position + head.forward * 1.2f + new Vector3(0f, -0.1f, 0f), Quaternion.Euler(270f, head.eulerAngles.y + 180f, 0f)); if (Recording.isRecording) { Recording.StopRecording(); } else { Recording.StartRecording(); } } } } else { hasPlayed = false; heldTime = 0f; soundTimer = 0f; } bool flag3 = IsPausePlayPose(leftHand, rightHand); if (flag3 && LeftController.GetTrigger() < 0.4f && RightController.GetTrigger() < 0.4f && LeftController.GetGrip() < 0.4f && RightController.GetGrip() < 0.4f) { if (!Playback.hasPaused) { Playback.hasPaused = true; Playback.TogglePlayback(Playback.isPaused); } } else if (!flag3) { Playback.hasPaused = false; } } public void TryHandleController(ControllerAction action, float primary, float secondary, bool isLeft) { //IL_015a: 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_01f5: 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) if (primary <= 0f || secondary <= 0f || Time.time - lastTriggerTime <= 1f) { return; } lastTriggerTime = Time.time; if (action == ControllerAction.None) { return; } DebugLog($"Controller Action | {(isLeft ? "Left" : "Right")} | {action}"); switch (action) { case ControllerAction.ToggleRecording: if (Recording.isRecording) { Recording.StopRecording(); } else { Recording.StartRecording(); } break; case ControllerAction.SaveReplayBuffer: Recording.SaveReplayBuffer(); PlayHaptics(); break; case ControllerAction.AddMarker: if (Recording.isRecording || Recording.isBuffering) { Recording.AddMarker("core.manual", Color.white); PlayHaptics(); Singleton.instance.Play(ReplayCache.SFX["Call_DressingRoom_PartPanelTick_BackwardLocked"], head.position, false); } break; default: ReplayError($"'{action}' is not a valid binding ({(isLeft ? "Left Controller" : "Right Controller")})."); break; } void PlayHaptics() { PlayerHaptics subsystem = LocalPlayer.Controller.GetSubsystem(); if (EnableHaptics.Value) { if (isLeft) { subsystem.PlayControllerHaptics(1f, 0.05f, 0f, 0f); } else { subsystem.PlayControllerHaptics(0f, 0f, 1f, 0.05f); } } } } } [RegisterTypeInIl2Cpp] public class TableFloat : MonoBehaviour { public float amplitude = 0.25f; public float speed = 1f; public float stopRadius = 2f; public float resumeSpeed = 6f; private float floatTime; private float timeScale = 1f; public Vector3 startPos; public float targetY; private void Awake() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) startPos = ((Component)this).transform.localPosition; } private void Update() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ef: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Main.instance.head == (Object)null)) { startPos.y = Mathf.Lerp(startPos.y, targetY + Main.instance.tableOffset.Value, Time.deltaTime * 4f); Vector3 val = Main.instance.head.position - ((Component)this).transform.position; float magnitude = ((Vector3)(ref val)).magnitude; bool flag = magnitude < stopRadius; timeScale = Mathf.Lerp(timeScale, flag ? 0f : 1f, Time.deltaTime * resumeSpeed); floatTime += Time.deltaTime * speed * timeScale; float num = Mathf.Sin(floatTime) * amplitude; ((Component)this).transform.localPosition = startPos + Vector3.up * num; } } } [RegisterTypeInIl2Cpp] public class ReplayTable : MonoBehaviour { public GameObject TableRoot; public TableFloat tableFloat; public TableFloat metadataTextFloat; public InteractionButton nextButton; public InteractionButton previousButton; public InteractionButton loadButton; public InteractionButton crystalizeButton; public TextMeshPro replayNameText; public TextMeshPro indexText; public TextMeshPro metadataText; public TextMeshPro heisenhouserText; public float desiredTableHeight = 1.5481f; public float tableOffset = 0f; public float desiredMetadataTextHeight = 1.8513f; public bool isReadingCrystal = false; public void Start() { tableFloat = TableRoot.GetComponent(); metadataTextFloat = ((Component)metadataText).GetComponent(); } public void Update() { //IL_002f: 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_00b6: 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) if (!(Main.currentScene != "Loader") || Main.LocalPlayer == null) { return; } float armSpan = Main.LocalPlayer.Data.PlayerMeasurement.ArmSpan; if ((Object)(object)tableFloat != (Object)null) { tableFloat.targetY = armSpan * (desiredTableHeight / 1.2744f) + tableOffset; } if ((Object)(object)metadataTextFloat != (Object)null) { metadataTextFloat.targetY = armSpan * (desiredMetadataTextHeight / 1.2744f) + tableOffset; } ReplayCrystals.Crystal crystal = ReplayCrystals.FindClosestCrystal(((Component)this).transform.position + new Vector3(0f, 0.4f, 0f), 0.5f); if ((Object)(object)crystal == (Object)null && !Singleton.instance.IsLoadingScene) { if (ReplayFiles.metadataHidden && ReplayFiles.explorer.currentIndex != -1) { ReplayFiles.ShowMetadata(); } isReadingCrystal = false; return; } if (!ReplayFiles.metadataHidden) { ReplayFiles.HideMetadata(); } if (!isReadingCrystal && (Object)(object)crystal != (Object)null && !crystal.isGrabbed && crystal.hasLeftTable && !crystal.isAnimation) { isReadingCrystal = true; crystal.isAnimation = true; MelonCoroutines.Start(ReplayCrystals.ReadCrystal(crystal)); } } } public class Patches { [HarmonyPatch(typeof(PoolManager), "Instantiate")] public class Patch_PoolManager_Instantiate { private static void Postfix(GameObject __result) { if (Main.instance.UIInitialized && (Main.Recording.isRecording || Main.Recording.isBuffering)) { Structure component = __result.GetComponent(); Main.Recording.TryRegisterStructure(component); } } } [HarmonyPatch(typeof(AudioManager), "Play")] [HarmonyPatch(new Type[] { typeof(AudioCall), typeof(Vector3), typeof(bool) })] public class Patch_AudioManager_Play { private static void Postfix(Vector3 position, AudioCall call) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)call == (Object)null) && Main.instance.UIInitialized) { FXOneShotType value; FXOneShotType? fXOneShotType = (ReplayCache.AudioCallToFX.TryGetValue(((Object)call).name, out value) ? new FXOneShotType?(value) : null); if (fXOneShotType.HasValue) { Main.Recording.Events.Add(new EventChunk { type = EventType.OneShotFX, fxType = fXOneShotType.Value, position = position }); } } } } [HarmonyPatch(typeof(Pool), "FetchFromPool")] [HarmonyPatch(new Type[] { })] public class Patch_PoolMonoBehavior_FetchFromPoolNoParameters { private static void Postfix(PooledMonoBehaviour __result) { VisualEffect component = ((Component)__result).GetComponent(); if (!((Object)(object)component == (Object)null)) { component.playRate = 1f; } } } [HarmonyPatch(typeof(Pool), "FetchFromPool")] [HarmonyPatch(new Type[] { typeof(Vector3), typeof(Quaternion) })] public class Patch_PoolMonoBehavior_FetchFromPool { private static void Postfix(PooledMonoBehaviour __result, Vector3 position, Quaternion rotation) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00f8: 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_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: 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_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) if (Main.currentScene == "Loader" || !Main.instance.UIInitialized) { return; } VisualEffect vfx = ((Component)__result).GetComponent(); if ((Object)(object)vfx == (Object)null) { return; } string name = ((Object)vfx).name; if (name == "Ricochet_VFX") { EventChunk item = new EventChunk { type = EventType.OneShotFX, fxType = FXOneShotType.Ricochet, position = ((Component)vfx).transform.position, rotation = ((Component)vfx).transform.rotation }; Main.Recording.Events.Add(item); } else if (name == "Hitmarker") { EventChunk item2 = new EventChunk { type = EventType.OneShotFX, fxType = FXOneShotType.Hitmarker, position = ((Component)vfx).transform.position, damage = (byte)vfx.GetFloat("Damage") }; Main.Recording.Events.Add(item2); } if (Main.Playback.playbackSpeed == 0f || !Main.Playback.isPlaying) { return; } float num = 999999f; if (name == "VFX_Dust_Modifier_Jump" || name == "VFX_Dust_Modifier_Dash") { ReplayPlayback.Clone[] playbackPlayers = Main.Playback.PlaybackPlayers; if (playbackPlayers != null && playbackPlayers.Length != 0) { num = Main.Playback.PlaybackPlayers.Select((ReplayPlayback.Clone player) => Vector3.Distance(((Component)player.Controller).transform.GetChild(1).GetChild(2).position, ((Component)vfx).transform.position)).Min(); } } if (name == "VFX_Dust_Modifier_Free" || name == "VFX_Dust_Modifier_Ground") { GameObject[] playbackStructures = Main.Playback.PlaybackStructures; if (playbackStructures != null && playbackStructures.Length != 0) { num = Main.Playback.PlaybackStructures.Select((GameObject structure) => Vector3.Distance(structure.transform.position, ((Component)vfx).transform.position)).Min(); } } float num2 = num; float num3 = 1f; GameObject replayRoot = Main.Playback.ReplayRoot; float? obj; if (replayRoot == null) { obj = null; } else { Transform transform = replayRoot.transform; if (transform == null) { obj = null; } else { Vector3 localScale = transform.localScale; obj = ((Vector3)(ref localScale)).magnitude; } } if (num2 < num3 * obj) { vfx.playRate = Mathf.Abs(Main.Playback.playbackSpeed); Object.Destroy((Object)(object)((Component)vfx).GetComponent()); ((Component)vfx).transform.SetParent(Main.Playback.VFXParent.transform); ((Component)vfx).transform.localScale = Vector3.Scale(((Component)vfx).transform.localScale, Main.Playback.ReplayRoot.transform.localScale); ((Component)vfx).gameObject.AddComponent(); } else { vfx.playRate = 1f; } } } [HarmonyPatch(typeof(VFXFloatSwitch), "Apply")] public class Patch_VFXFloatSwitch_Apply { private static void Prefix(VFXFloatSwitch __instance, VisualEffect effect, int structureID) { //IL_0086: 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) if (Main.instance.UIInitialized && (Main.Recording.isRecording || Main.Recording.isBuffering) && ReplayCache.VFXNameToFX.TryGetValue(((Object)effect).name, out var value) && frameSeenEffects.Add(effect)) { EventChunk item = new EventChunk { type = EventType.OneShotFX, fxType = value, position = ((Component)effect).transform.position, structureId = structureID }; Main.Recording.Events.Add(item); } } } [HarmonyPatch(typeof(PlayerHealth), "ReduceHealth")] public class Patch_PlayerHealth_ReduceHealth { private static void Postfix(PlayerHealth __instance, short amount) { //IL_019e: Unknown result type (might be due to invalid IL or missing references) if (!Main.instance.UIInitialized || (!Main.Recording.isRecording && !Main.Recording.isBuffering) || !Main.instance.EnableLargeDamageMarker.Value) { return; } string playFabMasterId = ((PlayerControllerSubsystem)__instance).parentController.assignedPlayer.Data.GeneralData.PlayFabMasterId; if (!damageQueues.TryGetValue(playFabMasterId, out Queue<(float, int)> value)) { value = new Queue<(float, int)>(); damageQueues[playFabMasterId] = value; } float lastSampleTime = Main.Recording.lastSampleTime; value.Enqueue((lastSampleTime, amount)); while (value.Count > 0 && value.Peek().Item1 < lastSampleTime - Main.instance.DamageWindow.Value) { value.Dequeue(); } int num = 0; foreach (var item in value) { num += item.Item2; } float num2 = ((value.Count > 0) ? value.Peek().Item1 : (-999f)); float valueOrDefault = lastLargeDamageTime.GetValueOrDefault(playFabMasterId, -999f); if (num >= Main.instance.DamageThreshold.Value && num2 > valueOrDefault) { lastLargeDamageTime[playFabMasterId] = lastSampleTime; value.Clear(); Main.Recording.AddMarker("core.largeDamage", Color.red); } } } [HarmonyPatch(typeof(PlayerVisuals), "ApplyPlayerVisuals")] public class Patch_PlayerVisuals_ApplyPlayerVisuals { private static void Postfix(PlayerVisuals __instance) { if (Main.instance.UIInitialized && (Main.Recording.isRecording || Main.Recording.isBuffering)) { Player assignedPlayer = ((PlayerControllerSubsystem)__instance).ParentController.assignedPlayer; if (assignedPlayer != null) { Main.Recording.RegisterPlayer(assignedPlayer); } } } public static IEnumerator VisualDataDelay(Player player, int slot) { yield return (object)new WaitForSeconds(0.1f); if (player != null) { PlayerInfo info = new PlayerInfo(player); Main.Recording.PlayerInfos[player.Data.GeneralData.PlayFabMasterId] = info; while (Main.Recording.RecordedPlayerInfos.Count <= slot) { Main.Recording.RecordedPlayerInfos.Add(null); } Main.Recording.RecordedPlayerInfos[slot] = new PlayerInfo(player); } } } [HarmonyPatch(typeof(PlayerController), "DeActivate")] public class Patch_PlayerController_Destroy { private static void Prefix(PlayerController __instance) { if (!Main.instance.UIInitialized || (!Main.Recording.isRecording && !Main.Recording.isBuffering)) { return; } object obj; if (__instance == null) { obj = null; } else { Player assignedPlayer = __instance.assignedPlayer; if (assignedPlayer == null) { obj = null; } else { PlayerData data = assignedPlayer.Data; if (data == null) { obj = null; } else { GeneralData generalData = data.GeneralData; obj = ((generalData != null) ? generalData.PlayFabMasterId : null); } } } string key = (string)obj; if (Main.Recording.PlayerSlots.TryGetValue(key, out var value)) { Main.Recording.RecordedPlayers[value] = null; } } } [HarmonyPatch(typeof(PlayerStackProcessor), "Execute")] public class Patch_PlayerStackProcessor_Execute { private static void Postfix(Stack stack, PlayerStackProcessor __instance) { if (Main.instance.UIInitialized && (Main.Recording.isRecording || Main.Recording.isBuffering) && ReplayCache.NameToStackType.TryGetValue(stack.cachedName, out var value)) { activations.Add((((PlayerControllerSubsystem)__instance).ParentController.assignedPlayer.Data.GeneralData.PlayFabMasterId, (short)value)); } } } [HarmonyPatch(typeof(SceneManager), "LoadSceneAsync")] [HarmonyPatch(new Type[] { typeof(int), typeof(bool), typeof(bool), typeof(float), typeof(LoadSceneMode), typeof(AudioCall) })] public class Patch_SceneManager_LoadSceneAsync { private static void Prefix() { if (Main.instance.UIInitialized) { if (Main.Recording.isRecording) { Main.isSceneReady = false; Main.Recording.StopRecording(); } Main.Playback.StopReplay(); Il2CppReferenceArray equippedShiftstones = Main.LocalPlayer.Controller.PlayerShiftstones.GetEquippedShiftstones(); Main instance = Main.instance; ShiftStone obj = ((Il2CppArrayBase)(object)equippedShiftstones)[0]; instance.leftShiftstonePool = ((obj != null) ? ((PooledMonoBehaviour)obj).resourceName : null); Main instance2 = Main.instance; ShiftStone obj2 = ((Il2CppArrayBase)(object)equippedShiftstones)[1]; instance2.rightShiftstonePool = ((obj2 != null) ? ((PooledMonoBehaviour)obj2).resourceName : null); } } } [HarmonyPatch(typeof(ParkBoardTrigger), "OnTriggerEnter")] public class Patch_ParkBoardTrigger_OnTriggerEnter { private static void Postfix(Collider other) { if (PhotonNetwork.CurrentRoom == null && Main.currentScene == "Park") { MelonCoroutines.Start(Utilities.LoadMap(1)); } } } [HarmonyPatch(typeof(PlayerHandPresence), "UpdateHandPresenceAnimationStates")] public class Patch_PlayerHandPresence_UpdateHandPresenceAnimationStates { private static void Prefix(PlayerHandPresence __instance, Hand hand, ref HandPresenceInput input) { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Invalid comparison between Unknown and I4 //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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) if (!Main.instance.UIInitialized || (Object)(object)((PlayerControllerSubsystem)__instance).parentController == (Object)null || !Main.Playback.isPlaying || !Utilities.IsReplayClone(((PlayerControllerSubsystem)__instance).parentController) || Main.Playback.PlaybackPlayers == null) { return; } ReplayPlayback.Clone clone = null; ReplayPlayback.Clone[] playbackPlayers = Main.Playback.PlaybackPlayers; foreach (ReplayPlayback.Clone clone2 in playbackPlayers) { if (!((Object)(object)clone2 == (Object)null) && (Object)(object)clone2.Controller == (Object)(object)((PlayerControllerSubsystem)__instance).parentController) { clone = clone2; break; } } if (!((Object)(object)clone == (Object)null)) { input = (((int)hand == 1) ? clone.lHandInput : clone.rHandInput); } } } [HarmonyPatch(typeof(PlayerHealth), "AttemptResetHealth")] public class Patch_PlayerHealth_AttemptResetHealth { private static bool Prefix(PlayerHealth __instance) { if (!Main.instance.UIInitialized) { return true; } if (!Main.Playback.isPlaying || !Utilities.IsReplayClone(((PlayerControllerSubsystem)__instance).parentController)) { return true; } return false; } } public static List<(string playerId, short stackId)> activations = new List<(string, short)>(); public static Dictionary> damageQueues = new Dictionary>(); public static Dictionary lastLargeDamageTime = new Dictionary(); public static HashSet frameSeenEffects = new HashSet(); } public class ReplayPlayback { public struct PlaybackStructureState { public bool active; public bool isLeftHeld; public bool isRightHeld; public bool isFlicked; public PhysicsState currentState; } public struct PlaybackPlayerState { public bool active; public int health; public short currentStack; public PlayerShiftstoneVFX activeShiftstoneVFX; public int leftShiftstone; public int rightShiftstone; public bool rockCamActive; public PlayerMeasurement playerMeasurement; public string visualData; } public struct PlaybackPedestalState { public bool active; } [RegisterTypeInIl2Cpp] public class Clone : MonoBehaviour { public class VoiceTrack { public float StartTime; public AudioClip Clip; } public GameObject VRRig; public GameObject LeftHand; public GameObject RightHand; public GameObject Head; public PlayerController Controller; public HandPresenceInput lHandInput; public HandPresenceInput rHandInput; private static readonly int PoseFistsActiveHash = Animator.StringToHash("PoseFistsActive"); public float lastDashTime = -999f; private const float dashDuration = 1f; public PlayerAnimator pa; public PlayerMovement pm; public PlayerPoseSystem ps; public List VoiceTracks = new List(); public AudioSource VoiceSource; public VoiceTrack currentTrack; public void ApplyInterpolatedPose(PlayerState a, PlayerState b, float t) { //IL_000d: 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_0019: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0059: 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_0076: 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_0082: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) VRRig.transform.localPosition = Vector3.Lerp(a.VRRigPos, b.VRRigPos, t); VRRig.transform.localRotation = Quaternion.Slerp(a.VRRigRot, b.VRRigRot, t); Head.transform.localPosition = Vector3.Lerp(a.HeadPos, b.HeadPos, t); Head.transform.localRotation = Quaternion.Slerp(a.HeadRot, b.HeadRot, t); LeftHand.transform.localPosition = Vector3.Lerp(a.LHandPos, b.LHandPos, t); LeftHand.transform.localRotation = Quaternion.Slerp(a.LHandRot, b.LHandRot, t); RightHand.transform.localPosition = Vector3.Lerp(a.RHandPos, b.RHandPos, t); RightHand.transform.localRotation = Quaternion.Slerp(a.RHandRot, b.RHandRot, t); } private bool IsDashing() { if (!pm.IsGrounded()) { lastDashTime = -999f; } return Mathf.Abs(Main.Playback.elapsedPlaybackTime - lastDashTime) < 1f; } public void Update() { if ((Object)(object)Controller == (Object)null) { return; } if ((Object)(object)pa == (Object)null || (Object)(object)pm == (Object)null || (Object)(object)ps == (Object)null) { pa = Controller.PlayerAnimator; pm = Controller.PlayerMovement; ps = Controller.PlayerPoseSystem; } if ((Object)(object)VoiceSource == (Object)null) { VoiceSource = ((Component)Controller.PlayerVoiceSystem).GetComponent(); VoiceSource.spatialBlend = 1f; } int num = ((!pm.IsGrounded()) ? 2 : ((!IsDashing()) ? 1 : 4)); pa.animator.SetInteger(pa.movementStateAnimatorHash, num); if (Main.instance.CloseHandsOnPose.Value) { pa.animator.SetBool(PoseFistsActiveHash, ps.IsDoingAnyPose()); } float elapsedPlaybackTime = Main.Playback.elapsedPlaybackTime; VoiceTrack voiceTrack = null; foreach (VoiceTrack voiceTrack2 in VoiceTracks) { if (!((Object)(object)voiceTrack2.Clip == (Object)null)) { float num2 = voiceTrack2.StartTime + (float)voiceTrack2.Clip.samples / (float)voiceTrack2.Clip.frequency; if (elapsedPlaybackTime >= voiceTrack2.StartTime && elapsedPlaybackTime < num2) { voiceTrack = voiceTrack2; break; } } } if (voiceTrack != currentTrack) { VoiceSource.Stop(); currentTrack = voiceTrack; if (voiceTrack != null) { VoiceSource.clip = voiceTrack.Clip; VoiceSource.time = elapsedPlaybackTime - voiceTrack.StartTime; VoiceSource.Play(); } } else if (currentTrack != null && Main.instance.ToggleVoices.Value) { float num3 = elapsedPlaybackTime - currentTrack.StartTime; if (Mathf.Abs(VoiceSource.time - num3) > 0.1f) { VoiceSource.time = num3; } VoiceSource.pitch = Main.Playback.playbackSpeed; if (!VoiceSource.isPlaying) { VoiceSource.Play(); } } } } [RegisterTypeInIl2Cpp] public class ReplayTag : MonoBehaviour { public string Type; public Structure attachedStructure; } public ReplayRecording Recording; public ReplayInfo currentReplay; public bool isPlaying = false; public float playbackSpeed = 1f; public float elapsedPlaybackTime = 0f; public int currentPlaybackFrame = 0; public static bool isReplayScene; public bool hasPaused; public bool isPaused = false; public float previousPlaybackSpeed = 1f; public GameObject ReplayRoot; public GameObject replayStructures; public GameObject replayPlayers; public GameObject pedestalsParent; public GameObject scenePropsParent; public GameObject VFXParent; public GameObject[] PlaybackStructures; public static HashSet HiddenStructures = new HashSet(); public PlaybackStructureState[] playbackStructureStates; public bool disableBaseStructureSystems = true; public Clone[] PlaybackPlayers; public PlaybackPlayerState[] playbackPlayerStates; public static Player povPlayer; public GameObject playerPoolRoot; public List playerPool = new List(); public List replayPedestals = new List(); public PlaybackPedestalState[] playbackPedestalStates; public List replaySceneProps = new List(); public int lastEventFrame = -1; public ReplayPlayback(ReplayRecording recording = null) { Recording = recording ?? Main.Recording; } public void HandlePlayback() { if (!isPlaying) { return; } elapsedPlaybackTime += Time.deltaTime * playbackSpeed; if (elapsedPlaybackTime >= currentReplay.Frames[^1].Time) { SetPlaybackTime(currentReplay.Frames[^1].Time); if (Main.instance.StopReplayWhenDone.Value) { StopReplay(); } return; } if (elapsedPlaybackTime <= 0f) { SetPlaybackTime(0f); if (Main.instance.StopReplayWhenDone.Value) { StopReplay(); } return; } SetPlaybackTime(elapsedPlaybackTime); GameObject timeline = ReplayPlaybackControls.timeline; if (timeline != null) { MeshRenderer component = timeline.GetComponent(); if (component != null) { Material material = ((Renderer)component).material; if (material != null) { material.SetFloat("_BP_Current", elapsedPlaybackTime * 1000f); } } } if ((Object)(object)ReplayPlaybackControls.currentDuration != (Object)null) { TimeSpan timeSpan = TimeSpan.FromSeconds(elapsedPlaybackTime); ((TMP_Text)ReplayPlaybackControls.currentDuration).text = ((timeSpan.TotalHours >= 1.0) ? $"{(int)timeSpan.TotalHours}:{timeSpan.Minutes:D2}:{timeSpan.Seconds:D2}" : $"{(int)timeSpan.TotalMinutes}:{timeSpan.Seconds:D2}"); } } public void LoadReplay(string path, bool allowDifferentSceneLoad = false) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_002b: 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_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Expected O, but got Unknown //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) if (ReplayArchive.GetManifest(path).Scene != Main.currentScene && !allowDifferentSceneLoad) { Main.ReplayError("Replay attempted to load in wrong scene. Aborting."); return; } currentReplay = ReplaySerializer.LoadReplay(path); SetPlaybackSpeed(1f); ReplayRoot = new GameObject("Replay Root"); pedestalsParent = new GameObject("Pedestals"); replayPlayers = new GameObject("Replay Players"); scenePropsParent = new GameObject("Replay Scene Props"); VFXParent = new GameObject("Replay VFX"); VFXParent.transform.SetParent(ReplayRoot.transform); elapsedPlaybackTime = 0f; currentPlaybackFrame = 0; if ((Object)(object)replayStructures != (Object)null) { Object.Destroy((Object)(object)replayStructures); } HiddenStructures.Clear(); PlaybackStructures = null; Enumerator enumerator = SceneSingleton.instance.structures.GetEnumerator(); while (enumerator.MoveNext()) { Structure current = enumerator.Current; if (!((Object)(object)current == (Object)null)) { ((Component)current).gameObject.SetActive(false); HiddenStructures.Add(current); } } foreach (Fruit item in Object.FindObjectsOfType()) { ((Component)item).GetComponent().enabled = false; ((Component)item).GetComponent().enabled = false; } PlaybackStructures = (GameObject[])(object)new GameObject[currentReplay.Header.Structures.Length]; replayStructures = new GameObject("Replay Structures"); NetworkGameObject val = default(NetworkGameObject); for (int i = 0; i < PlaybackStructures.Length; i++) { StructureInfo structureInfo = currentReplay.Header.Structures[i]; Pool valueOrDefault = ReplayCache.structurePools.GetValueOrDefault(structureInfo.Type); if (valueOrDefault == null) { Main.ReplayError($"Could not find pool for structure of type '{structureInfo.Type}'"); return; } PlaybackStructures[i] = ((Component)ReplayCache.structurePools.GetValueOrDefault(structureInfo.Type).FetchFromPool()).gameObject; Structure component = PlaybackStructures[i].GetComponent(); if (disableBaseStructureSystems) { component.indistructable = true; component.onBecameFreeAudio = null; component.onBecameGroundedAudio = null; component.structureID = structureInfo.structureId; foreach (Collider componentsInChild in ((Component)component).GetComponentsInChildren()) { componentsInChild.enabled = false; } Object.Destroy((Object)(object)PlaybackStructures[i].GetComponent()); if (PlaybackStructures[i].TryGetComponent(ref val)) { Object.Destroy((Object)(object)val); } } if (currentReplay.Header.Structures[i].Type == StructureType.Target) { ((Component)component).GetComponent().SetTargetBaseTierPointsAndUpdateVisuals(structureInfo.targetDamage ?? 1); } if (Recording.isRecording || Recording.isBuffering) { Recording.TryRegisterStructure(component); } PlaybackStructures[i].SetActive(false); PlaybackStructures[i].transform.SetParent(replayStructures.transform); } playbackStructureStates = new PlaybackStructureState[PlaybackStructures.Length]; for (int j = 0; j < PlaybackStructures.Length; j++) { playbackStructureStates[j] = default(PlaybackStructureState); } if (PlaybackPlayers != null) { Clone[] playbackPlayers = PlaybackPlayers; foreach (Clone clone in playbackPlayers) { if (!((Object)(object)clone == (Object)null)) { Singleton.instance.AllPlayers.Remove(clone.Controller.assignedPlayer); } } } PlaybackPlayers = null; replayPedestals.Clear(); for (int l = 0; l < currentReplay.Header.PedestalCount; l++) { GameObject gameObject = ((Component)Singleton.instance.GetPool("MatchPedestal").FetchFromPool()).gameObject; gameObject.transform.SetParent(pedestalsParent.transform); replayPedestals.Add(gameObject); if (currentReplay.Header.PedestalCount == 0) { gameObject.SetActive(false); } } playbackPedestalStates = new PlaybackPedestalState[replayPedestals.Count]; MelonCoroutines.Start(SpawnClones(delegate { //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_031a: Unknown result type (might be due to invalid IL or missing references) replayStructures.transform.SetParent(ReplayRoot.transform); replayPlayers.transform.SetParent(ReplayRoot.transform); pedestalsParent.transform.SetParent(ReplayRoot.transform); scenePropsParent.transform.SetParent(ReplayRoot.transform); playbackPlayerStates = new PlaybackPlayerState[PlaybackPlayers.Length]; for (int m = 0; m < PlaybackPlayers.Length; m++) { if (!((Object)(object)PlaybackPlayers[m] == (Object)null)) { Il2CppStructArray currentShiftStoneConfiguration = PlaybackPlayers[m].Controller.PlayerShiftstones.GetCurrentShiftStoneConfiguration(); playbackPlayerStates[m] = new PlaybackPlayerState { playerMeasurement = PlaybackPlayers[m].Controller.assignedPlayer.Data.PlayerMeasurement, leftShiftstone = ((Il2CppArrayBase)(object)currentShiftStoneConfiguration)[0], rightShiftstone = ((Il2CppArrayBase)(object)currentShiftStoneConfiguration)[1], visualData = PlaybackPlayers[m].Controller.assignedPlayer.Data.VisualData.ToPlayfabDataString() }; } } ReorderPlayers(); try { if (currentReplay.Header.VoiceTrackInfos != null) { foreach (VoiceTrackInfo info in currentReplay.Header.VoiceTrackInfos) { Clone clone2 = PlaybackPlayers.FirstOrDefault((Clone p) => p.Controller.assignedPlayer.Data.GeneralData.PlayFabMasterId == info.MasterId); if (!((Object)(object)clone2 == (Object)null)) { string path2 = Path.Combine(currentReplay.Header.VoiceFolder, info.FileName); AudioClip val2 = ReplayVoices.LoadVoiceClipFromFile(path2); if (!((Object)(object)val2 == (Object)null)) { clone2.VoiceTracks.Add(new Clone.VoiceTrack { StartTime = info.StartTime, Clip = val2 }); } } } } } catch (Exception value) { Main.ReplayError($"Voice laoding failed: {value}"); } if (currentReplay.Header.Scene == "Gym") { Clone[] playbackPlayers2 = PlaybackPlayers; foreach (Clone clone3 in playbackPlayers2) { ((Component)((Component)clone3.Controller).transform.GetChild(6)).gameObject.SetActive(false); ((Component)((Component)clone3.Controller).transform.GetChild(9)).gameObject.SetActive(false); ((Component)clone3.Controller).transform.position = Vector3.zero; } } isPlaying = true; TogglePlayback(active: true); ReplayRoot.transform.position = Vector3.zero; MelonCoroutines.Start(DisableNameplate()); ReplayAPI.ReplayStartedInternal(currentReplay); })); MeshRenderer component2 = ReplayPlaybackControls.timeline.GetComponent(); ((Renderer)component2).material.SetFloat("_BP_Target", currentReplay.Header.Duration * 1000f); ((Renderer)component2).material.SetFloat("_BP_Current", 0f); TimeSpan timeSpan = TimeSpan.FromSeconds(currentReplay.Header.Duration); ((TMP_Text)ReplayPlaybackControls.totalDuration).text = ((timeSpan.TotalHours >= 1.0) ? $"{(int)timeSpan.TotalHours}:{timeSpan.Minutes:D2}:{timeSpan.Seconds:D2}" : $"{(int)timeSpan.TotalMinutes}:{timeSpan.Seconds:D2}"); ((TMP_Text)ReplayPlaybackControls.currentDuration).text = "0:00"; ((TMP_Text)ReplayPlaybackControls.playbackTitle).text = (Path.GetFileNameWithoutExtension(path).StartsWith("Replay") ? currentReplay.Header.Title : Path.GetFileNameWithoutExtension(path)); ReplaySettings.playerList = ReplaySettings.PaginateReplay(currentReplay.Header, PlaybackPlayers); ReplaySettings.SelectPlayerPage(0); ReplaySettings.povButton.SetActive(true); ReplaySettings.hideLocalPlayerToggle.SetActive(true); ReplaySettings.openControlsButton.SetActive(true); ((Component)ReplayPlaybackControls.timeline.transform.GetChild(0)).GetComponent().header = currentReplay.Header; Utilities.AddMarkers(currentReplay.Header, component2); static IEnumerator DisableNameplate() { yield return null; Player localPlayer = Main.LocalPlayer; if (localPlayer != null) { PlayerController controller = localPlayer.Controller; if (controller != null) { ((Component)((Component)controller).transform.GetChild(6)).gameObject.SetActive(false); } } } } public void StopReplay() { if (!isPlaying) { return; } isPlaying = false; ReplayPlaybackControls.Close(); string path = Path.Combine(MelonEnvironment.UserDataDirectory, "ReplayMod", "TempReplayVoices"); if (Directory.Exists(path)) { Directory.Delete(path, recursive: true); } UpdateReplayCameraPOV(Main.LocalPlayer); TogglePlayback(active: true); SetPlaybackSpeed(1f); GameObject[] playbackStructures = PlaybackStructures; foreach (GameObject val in playbackStructures) { if ((Object)(object)val == (Object)null) { continue; } Structure component = val.GetComponent(); component.indistructable = false; if ((Object)(object)component.currentFrictionVFX != (Object)null) { Object.Destroy((Object)(object)((Component)component.currentFrictionVFX).gameObject); } foreach (VisualEffect componentsInChild in val.GetComponentsInChildren()) { Object.Destroy((Object)(object)componentsInChild); } } foreach (Structure hiddenStructure in HiddenStructures) { if ((Object)(object)hiddenStructure != (Object)null) { ((Component)hiddenStructure).gameObject.SetActive(true); } } foreach (Fruit item in Object.FindObjectsOfType(true)) { ((Component)item).GetComponent().enabled = true; ((Component)item).GetComponent().enabled = true; } HiddenStructures.Clear(); if ((Object)(object)replayStructures != (Object)null) { Object.Destroy((Object)(object)replayStructures); } Clone[] playbackPlayers = PlaybackPlayers; foreach (Clone clone in playbackPlayers) { if (!((Object)(object)clone == (Object)null)) { Singleton.instance.AllPlayers.Remove(clone.Controller.assignedPlayer); ((Component)clone).gameObject.SetActive(false); ((Component)clone.Controller).transform.SetParent(playerPoolRoot.transform); } } if ((Object)(object)replayPlayers != (Object)null) { Object.Destroy((Object)(object)replayPlayers); } if ((Object)(object)pedestalsParent != (Object)null) { for (int num = pedestalsParent.transform.childCount - 1; num >= 0; num--) { Transform child = pedestalsParent.transform.GetChild(num); Object.Destroy((Object)(object)((Component)child).gameObject); } Object.Destroy((Object)(object)pedestalsParent); } if ((Object)(object)scenePropsParent != (Object)null) { for (int num2 = scenePropsParent.transform.childCount - 1; num2 >= 0; num2--) { Transform child2 = scenePropsParent.transform.GetChild(num2); Object.Destroy((Object)(object)((Component)child2).gameObject); } Object.Destroy((Object)(object)scenePropsParent); } if ((Object)(object)ReplayRoot != (Object)null) { Object.Destroy((Object)(object)ReplayRoot); } ReplaySettings.povButton.SetActive(false); ReplaySettings.hideLocalPlayerToggle.SetActive(false); ReplaySettings.openControlsButton.SetActive(false); replayStructures = null; replayPlayers = null; PlaybackStructures = null; PlaybackPlayers = null; ((Component)Main.LocalPlayer.Controller.PlayerNameTag).gameObject.SetActive(false); ReplayAPI.ReplayEndedInternal(currentReplay); } public void ReorderPlayers() { List allPlayers = Singleton.instance.AllPlayers; if (allPlayers == null || allPlayers.Count == 0) { return; } Dictionary dictionary = new Dictionary(); PlayerInfo[] players = currentReplay.Header.Players; foreach (PlayerInfo playerInfo in players) { if (playerInfo != null) { dictionary[playerInfo.MasterId] = playerInfo.WasHost; } } Player val = null; Player localPlayer = Main.LocalPlayer; List list = new List(); Enumerator enumerator = allPlayers.GetEnumerator(); while (enumerator.MoveNext()) { Player current = enumerator.Current; if (current != localPlayer) { if (dictionary.TryGetValue(current.Data.GeneralData.PlayFabMasterId, out var value) && value) { val = current; } else { list.Add(current); } } } allPlayers.Clear(); if (val != null) { allPlayers.Add(val); } foreach (Player item in list) { allPlayers.Add(item); } if (localPlayer != null) { allPlayers.Add(localPlayer); } } private IEnumerator SpawnClones(Action done = null) { int count = currentReplay.Header.Players.Length; PlaybackPlayers = new Clone[count]; Frame frame0 = currentReplay.Frames[0]; Clone[] chosen = new Clone[count]; HashSet used = new HashSet(); for (int i = 0; i < count; i++) { string visual = frame0.Players[i]?.visualData; if (visual == null) { continue; } foreach (Clone c2 in playerPool) { if (!used.Contains(c2) && c2.Controller.assignedPlayer.Data.VisualData.ToPlayfabDataString() == visual) { chosen[i] = c2; used.Add(c2); break; } } } for (int j = 0; j < count; j++) { if ((Object)(object)chosen[j] != (Object)null) { continue; } foreach (Clone c3 in playerPool) { if (!used.Contains(c3)) { chosen[j] = c3; used.Add(c3); break; } } } for (int k = 0; k < count; k++) { PlayerInfo pInfo = currentReplay.Header.Players[k]; if (pInfo == null) { Main.DebugLog($"Header.Players[{k}] is null."); continue; } Clone temp = chosen[k]; if ((Object)(object)temp == (Object)null) { MelonCoroutines.Start(BuildClone(pInfo, delegate(Clone c) { temp = c; })); while ((Object)(object)temp == (Object)null) { yield return null; } playerPool.Add(temp); } Singleton.instance.AllPlayers.Add(temp.Controller.assignedPlayer); ((Component)temp).gameObject.SetActive(true); PlaybackPlayers[k] = temp; ((Component)temp.Controller).transform.SetParent(replayPlayers.transform); } done?.Invoke(); } public static IEnumerator BuildClone(PlayerInfo pInfo, Action callback, Vector3 initialPosition = default(Vector3)) { //IL_0015: 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) string randomID = Guid.NewGuid().ToString(); pInfo.Name = (string.IsNullOrEmpty(pInfo.Name) ? ("Player_" + pInfo.MasterId) : pInfo.Name); if (pInfo.EquippedShiftStones == null) { pInfo.EquippedShiftStones = new short[2] { -1, -1 }; } Il2CppStructArray shiftstones = new Il2CppStructArray(2L); for (int i = 0; i < 2; i++) { ((Il2CppArrayBase)(object)shiftstones)[i] = pInfo.EquippedShiftStones[i]; } PlayerData data = new PlayerData(new GeneralData { PlayFabMasterId = (pInfo.MasterId ?? ""), PlayFabTitleId = randomID, BattlePoints = pInfo.BattlePoints, PublicUsername = pInfo.Name }, Main.LocalPlayer.Data.RedeemedMoves, Main.LocalPlayer.Data.EconomyData, shiftstones, PlayerVisualData.Default); data.PlayerMeasurement = ((pInfo.Measurement.Length != 0f) ? pInfo.Measurement : Main.LocalPlayer.Data.PlayerMeasurement); Player newPlayer = Player.CreateRemotePlayer(data); Singleton.instance.SpawnPlayerController(newPlayer, Vector3.zero, Quaternion.identity); while ((Object)(object)newPlayer.Controller == (Object)null) { yield return null; } GameObject body = ((Component)newPlayer.Controller).gameObject; ((Object)body).name = "Player_" + pInfo.MasterId; GameObject Overall = ((Component)body.transform.GetChild(2)).gameObject; GameObject LHand = ((Component)Overall.transform.GetChild(1)).gameObject; GameObject RHand = ((Component)Overall.transform.GetChild(2)).gameObject; GameObject Head = ((Component)Overall.transform.GetChild(0).GetChild(0)).gameObject; Object.Destroy((Object)(object)Overall.GetComponent()); Object.Destroy((Object)(object)Overall.GetComponent()); newPlayer.Controller.PlayerAnimator.animator.SetBool(-414412114, false); Object.Destroy((Object)(object)Overall.GetComponent()); Transform localTransform = ((Component)Main.LocalPlayer.Controller).transform; ((Component)newPlayer.Controller).transform.position = localTransform.position; ((Component)newPlayer.Controller).transform.rotation = localTransform.rotation; Transform physics = body.transform.GetChild(3); ConfigurableJoint lControllerPhysics = ((Component)physics.GetChild(2)).GetComponent(); lControllerPhysics.xMotion = (ConfigurableJointMotion)0; lControllerPhysics.yMotion = (ConfigurableJointMotion)0; lControllerPhysics.zMotion = (ConfigurableJointMotion)0; ConfigurableJoint rControllerPhysics = ((Component)physics.GetChild(3)).GetComponent(); rControllerPhysics.xMotion = (ConfigurableJointMotion)0; rControllerPhysics.yMotion = (ConfigurableJointMotion)0; rControllerPhysics.zMotion = (ConfigurableJointMotion)0; foreach (TrackedPoseDriver driver in body.GetComponentsInChildren()) { ((Behaviour)driver).enabled = false; } ((Component)body.transform.GetChild(6)).gameObject.SetActive(false); PlayerPoseSystem poseSystem = body.GetComponent(); Enumerator enumerator2 = Main.LocalPlayer.Controller.PlayerPoseSystem.currentInputPoses.GetEnumerator(); while (enumerator2.MoveNext()) { PoseInputSource pose = enumerator2.Current; poseSystem.currentInputPoses.Add(new PoseInputSource(pose.PoseSet)); } ((Behaviour)poseSystem).enabled = true; Clone clone = ((Component)newPlayer.Controller).gameObject.AddComponent(); ((Component)newPlayer.Controller.PlayerNameTag).gameObject.SetActive(Main.instance.ToggleNameplate.Value); ((Component)((Component)newPlayer.Controller.PlayerHealth).transform.GetChild(1)).gameObject.SetActive(Main.instance.ToggleHealthBar.Value); clone.VRRig = Overall; clone.LeftHand = LHand; clone.RightHand = RHand; clone.Head = Head; clone.Controller = newPlayer.Controller; body.transform.position = initialPosition; body.transform.rotation = Quaternion.identity; callback?.Invoke(clone); } public void ApplyInterpolatedFrame(int frameIndex, float t) { //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Invalid comparison between Unknown and I4 //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Invalid comparison between Unknown and I4 //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Invalid comparison between Unknown and I4 //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Invalid comparison between Unknown and I4 //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_0532: Unknown result type (might be due to invalid IL or missing references) //IL_132b: Unknown result type (might be due to invalid IL or missing references) //IL_1332: Unknown result type (might be due to invalid IL or missing references) //IL_1338: Unknown result type (might be due to invalid IL or missing references) //IL_133d: Unknown result type (might be due to invalid IL or missing references) //IL_1341: Unknown result type (might be due to invalid IL or missing references) //IL_1348: Unknown result type (might be due to invalid IL or missing references) //IL_134e: Unknown result type (might be due to invalid IL or missing references) //IL_1353: Unknown result type (might be due to invalid IL or missing references) //IL_135c: Unknown result type (might be due to invalid IL or missing references) //IL_135e: Unknown result type (might be due to invalid IL or missing references) //IL_128c: Unknown result type (might be due to invalid IL or missing references) //IL_1293: Unknown result type (might be due to invalid IL or missing references) //IL_1299: Unknown result type (might be due to invalid IL or missing references) //IL_129e: Unknown result type (might be due to invalid IL or missing references) //IL_12a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_06b2: Unknown result type (might be due to invalid IL or missing references) //IL_06c4: Unknown result type (might be due to invalid IL or missing references) //IL_0743: Unknown result type (might be due to invalid IL or missing references) //IL_0bd0: Unknown result type (might be due to invalid IL or missing references) //IL_14e2: Unknown result type (might be due to invalid IL or missing references) //IL_089d: Unknown result type (might be due to invalid IL or missing references) //IL_08a4: Unknown result type (might be due to invalid IL or missing references) //IL_0846: Unknown result type (might be due to invalid IL or missing references) //IL_084d: Unknown result type (might be due to invalid IL or missing references) //IL_0853: Unknown result type (might be due to invalid IL or missing references) //IL_0858: Unknown result type (might be due to invalid IL or missing references) //IL_0861: Unknown result type (might be due to invalid IL or missing references) //IL_0868: Unknown result type (might be due to invalid IL or missing references) //IL_086e: Unknown result type (might be due to invalid IL or missing references) //IL_0873: Unknown result type (might be due to invalid IL or missing references) //IL_0881: Unknown result type (might be due to invalid IL or missing references) //IL_0883: Unknown result type (might be due to invalid IL or missing references) //IL_0e46: Unknown result type (might be due to invalid IL or missing references) //IL_0e52: Unknown result type (might be due to invalid IL or missing references) //IL_0e58: Unknown result type (might be due to invalid IL or missing references) //IL_0e5d: Unknown result type (might be due to invalid IL or missing references) //IL_0e61: Unknown result type (might be due to invalid IL or missing references) //IL_0e6d: Unknown result type (might be due to invalid IL or missing references) //IL_0e73: Unknown result type (might be due to invalid IL or missing references) //IL_0e78: Unknown result type (might be due to invalid IL or missing references) //IL_0e81: Unknown result type (might be due to invalid IL or missing references) //IL_0e83: Unknown result type (might be due to invalid IL or missing references) //IL_0ef1: Unknown result type (might be due to invalid IL or missing references) //IL_0ef3: Unknown result type (might be due to invalid IL or missing references) //IL_0f09: Unknown result type (might be due to invalid IL or missing references) //IL_0f5f: Unknown result type (might be due to invalid IL or missing references) //IL_0901: Unknown result type (might be due to invalid IL or missing references) //IL_10f2: Unknown result type (might be due to invalid IL or missing references) //IL_10f7: Unknown result type (might be due to invalid IL or missing references) //IL_112a: Unknown result type (might be due to invalid IL or missing references) //IL_112c: Unknown result type (might be due to invalid IL or missing references) //IL_1131: Unknown result type (might be due to invalid IL or missing references) //IL_1136: Unknown result type (might be due to invalid IL or missing references) //IL_1169: Unknown result type (might be due to invalid IL or missing references) //IL_116b: Unknown result type (might be due to invalid IL or missing references) Frame[] frames = currentReplay.Frames; GameObject obj = replayPlayers; if (obj != null && !obj.activeSelf) { return; } GameObject obj2 = replayStructures; if ((obj2 != null && !obj2.activeSelf) || (playbackSpeed > 0f && frameIndex >= frames.Length - 1) || (playbackSpeed < 0f && frameIndex <= 0)) { return; } t = ((playbackSpeed >= 0f) ? t : (1f - t)); Frame frame = frames[frameIndex]; Frame frame2 = frames[frameIndex + ((playbackSpeed >= 0f) ? 1 : (-1))]; PoolManager poolManager = Singleton.instance; for (int i = 0; i < PlaybackStructures.Length; i++) { GameObject playbackStructure = PlaybackStructures[i]; Structure structureComp = playbackStructure.GetComponent(); StructureState sa = frame.Structures[i]; StructureState structureState = frame2.Structures[i]; ref PlaybackStructureState reference = ref playbackStructureStates[i]; foreach (Collider componentsInChild in playbackStructure.GetComponentsInChildren()) { componentsInChild.enabled = false; } if (reference.active && !structureState.active) { Singleton.instance.Play(playbackStructure.GetComponent().onDeathAudio, playbackStructure.transform.position, false); try { UnityEvent onStructureDestroyed = structureComp.onStructureDestroyed; if (onStructureDestroyed != null) { onStructureDestroyed.Invoke(); } } catch { } if ((Object)(object)structureComp.currentFrictionVFX != (Object)null) { Object.Destroy((Object)(object)((Component)structureComp.currentFrictionVFX).gameObject); } } if (!reference.active && structureState.active && frameIndex != 0) { string name2 = ((Object)playbackStructure).name; if (1 == 0) { } string text; switch (name2) { case "Wall": text = "Call_Structure_Spawn_Heavy"; break; case "Ball": case "Disc": text = "Call_Structure_Spawn_Light"; break; case "LargeRock": text = "Call_Structure_Spawn_Massive"; break; default: text = "Call_Structure_Spawn_Medium"; break; } if (1 == 0) { } string key2 = text; if (ReplayCache.SFX.TryGetValue(key2, out var value) && frameIndex + 2 < frames.Length) { Singleton.instance.Play(value, frames[frameIndex + 2].Structures[i].position, false); } foreach (PooledVisualEffect componentsInChild2 in playbackStructure.GetComponentsInChildren()) { Object.Destroy((Object)(object)((Component)componentsInChild2).gameObject); } ((PooledMonoBehaviour)structureComp).OnFetchFromPool(); } reference.active = structureState.active; playbackStructure.SetActive(reference.active); if (structureComp.currentPhysicsState != structureState.currentState) { reference.currentState = structureState.currentState; structureComp.currentPhysicsState = structureState.currentState; bool flag2 = (int)sa.currentState == 3 && (int)structureState.currentState == 4; bool flag3 = (int)reference.currentState == 3; Renderer componentInChildren = ((Component)((Component)structureComp).transform).GetComponentInChildren(); if (componentInChildren != null) { Material material = componentInChildren.material; if (material != null) { material.SetFloat("_shake", (float)(flag3 ? 1 : 0)); } } if (componentInChildren != null) { Material material2 = componentInChildren.material; if (material2 != null) { material2.SetFloat("_shakeFrequency", 75f * playbackSpeed); } } bool flag4 = (int)reference.currentState == 4; if (!flag2) { if (flag4) { Pool pool = poolManager.GetPool("Parry_VFX"); GameObject val = Object.Instantiate(((Component)pool.poolItem).gameObject, VFXParent.transform); val.transform.localPosition = sa.position; val.transform.localRotation = Quaternion.identity; VisualEffect component = val.GetComponent(); component.playRate = Mathf.Abs(playbackSpeed); val.GetComponent().parameterCollection.Apply(component, structureComp); val.GetComponent().Play(); val.AddComponent(); ReplayTag replayTag = val.AddComponent(); replayTag.attachedStructure = structureComp; replayTag.Type = "StructureParry"; Singleton.instance.Play(ReplayCache.SFX["Call_Modifier_Parry"], sa.position, false); } else { ReplayTag replayTag2 = ((IEnumerable)VFXParent.GetComponentsInChildren()).FirstOrDefault((ReplayTag tag) => tag.Type == "StructureParry" && (Object)(object)tag.attachedStructure == (Object)(object)structureComp); if ((Object)(object)replayTag2 != (Object)null) { Object.Destroy((Object)(object)((Component)replayTag2).gameObject); } } } } if (!reference.isLeftHeld && structureState.isLeftHeld) { SpawnHoldVFX("Left"); } if (!reference.isRightHeld && structureState.isRightHeld) { SpawnHoldVFX("Right"); } if (reference.isLeftHeld && !structureState.isLeftHeld) { DestroyHoldVFX("Left"); } if (reference.isRightHeld && !structureState.isRightHeld) { DestroyHoldVFX("Right"); } reference.isLeftHeld = Utilities.HasVFXType("StructureHold_Left", playbackStructure.transform); reference.isRightHeld = Utilities.HasVFXType("StructureHold_Right", playbackStructure.transform); if (!reference.isFlicked && structureState.isFlicked) { Pool pool2 = poolManager.GetPool("Flick_VFX"); GameObject val2 = Object.Instantiate(((Component)pool2.poolItem).gameObject, playbackStructure.transform); val2.transform.localPosition = Vector3.zero; val2.transform.localRotation = Quaternion.identity; VisualEffect component2 = val2.GetComponent(); component2.playRate = Mathf.Abs(playbackSpeed); val2.GetComponent().parameterCollection.Apply(component2, structureComp); val2.GetComponent().Play(); ReplayTag replayTag3 = val2.AddComponent(); replayTag3.Type = "StructureFlick"; Singleton.instance.Play(ReplayCache.SFX["Call_Modifier_Flick"], sa.position, false); } if (reference.isFlicked && !structureState.isFlicked) { foreach (ReplayTag componentsInChild3 in playbackStructure.GetComponentsInChildren()) { if ((Object)(object)componentsInChild3 == (Object)null || !((Object)componentsInChild3).name.Contains("Flick_VFX") || !((Object)(object)((Component)componentsInChild3).transform.parent == (Object)(object)playbackStructure.transform)) { continue; } Object.Destroy((Object)(object)((Component)componentsInChild3).gameObject); break; } } reference.isFlicked = Utilities.HasVFXType("StructureFlick", playbackStructure.transform); if (sa.active && structureState.active) { Vector3 val3 = Vector3.Lerp(sa.position, structureState.position, t); Quaternion val4 = Quaternion.Slerp(sa.rotation, structureState.rotation, t); playbackStructure.transform.SetLocalPositionAndRotation(val3, val4); } else { playbackStructure.transform.SetLocalPositionAndRotation(structureState.position, structureState.rotation); } foreach (VisualEffect componentsInChild4 in playbackStructure.GetComponentsInChildren()) { componentsInChild4.playRate = Mathf.Abs(playbackSpeed); if (((Object)componentsInChild4).name.Contains("ExplodeStatus_VFX")) { ((Component)componentsInChild4).transform.localScale = Vector3.one; } } if ((Object)(object)structureComp.currentFrictionVFX != (Object)null) { structureComp.currentFrictionVFX.visualEffect.playRate = Mathf.Abs(playbackSpeed); } void DestroyHoldVFX(string hand) { foreach (ReplayTag componentsInChild5 in playbackStructure.GetComponentsInChildren()) { if (!((Object)(object)componentsInChild5 == (Object)null) && componentsInChild5.Type == "StructureHold_" + hand && (Object)(object)((Component)componentsInChild5).transform.parent == (Object)(object)playbackStructure.transform) { Object.Destroy((Object)(object)((Component)componentsInChild5).gameObject); break; } } } void SpawnHoldVFX(string hand) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) Pool pool3 = poolManager.GetPool("Hold_VFX"); GameObject val19 = Object.Instantiate(((Component)pool3.poolItem).gameObject, playbackStructure.transform); val19.transform.localPosition = Vector3.zero; val19.transform.localRotation = Quaternion.identity; VisualEffect component3 = val19.GetComponent(); component3.playRate = Mathf.Abs(playbackSpeed); val19.GetComponent().parameterCollection.Apply(component3, structureComp); val19.GetComponent().Play(); ReplayTag replayTag4 = val19.AddComponent(); replayTag4.Type = "StructureHold_" + hand; Singleton.instance.Play(ReplayCache.SFX["Call_Modifier_Hold"], sa.position, false); } } PlayerMeasurement val9 = default(PlayerMeasurement); for (int j = 0; j < PlaybackPlayers.Length; j++) { Clone playbackPlayer = PlaybackPlayers[j]; if ((Object)(object)playbackPlayer == (Object)null) { continue; } PlayerState playerState = frame.Players[j]; PlayerState pb = frame2.Players[j]; ref PlaybackPlayerState reference2 = ref playbackPlayerStates[j]; if (reference2.health != pb.Health) { playbackPlayer.Controller.PlayerHealth.SetHealth(pb.Health, (short)reference2.health, true); } reference2.health = playbackPlayer.Controller.assignedPlayer.Data.HealthPoints; if (reference2.currentStack != pb.currentStack) { reference2.currentStack = pb.currentStack; if (pb.currentStack != 3 && pb.currentStack != 5 && pb.currentStack != 6 && pb.currentStack != 7 && pb.currentStack != 4 && pb.currentStack != 0) { KeyValuePair key = ReplayCache.NameToStackType.FirstOrDefault((KeyValuePair s) => (uint)s.Value == (byte)pb.currentStack); Stack val5 = ((IEnumerable)playbackPlayer.Controller.PlayerProcessor.availableStacks.ToArray()).FirstOrDefault((Func)((Stack s) => s.CachedName == key.Key)); if ((Object)(object)val5 != (Object)null) { playbackPlayer.Controller.PlayerProcessor.Execute(val5, (StackConfiguration)null); if (pb.currentStack == 1) { playbackPlayer.lastDashTime = elapsedPlaybackTime; } if (pb.currentStack == 2) { Singleton.instance.Play(ReplayCache.SFX["Call_Modifier_Jump"], playbackPlayer.Controller.PlayerVR.headset.Transform.position, false); } } } } Transform chest; PlayerShiftstoneVFX flags; if (reference2.activeShiftstoneVFX != pb.activeShiftstoneVFX) { reference2.activeShiftstoneVFX = pb.activeShiftstoneVFX; chest = playbackPlayer.Controller.PlayerIK.VrIK.references.chest; flags = reference2.activeShiftstoneVFX; TryToggleVFX("Chargestone VFX", PlayerShiftstoneVFX.Charge); TryToggleVFX("Adamantstone_VFX", PlayerShiftstoneVFX.Adamant); TryToggleVFX("Surgestone_VFX", PlayerShiftstoneVFX.Surge); TryToggleVFX("Vigorstone_VFX", PlayerShiftstoneVFX.Vigor); } if (reference2.leftShiftstone != pb.leftShiftstone) { reference2.leftShiftstone = pb.leftShiftstone; ApplyShiftstone(playbackPlayer.Controller, 0, pb.leftShiftstone); } if (reference2.rightShiftstone != pb.rightShiftstone) { reference2.rightShiftstone = pb.rightShiftstone; ApplyShiftstone(playbackPlayer.Controller, 1, pb.rightShiftstone); } PlayerLIV playerLIV = playbackPlayer.Controller.PlayerLIV; LCKTabletUtility val6 = ((playerLIV != null) ? playerLIV.LckTablet : null); if ((Object)(object)val6 != (Object)null && Main.instance.ToggleRockCam.Value) { if (reference2.rockCamActive != pb.rockCamActive) { reference2.rockCamActive = pb.rockCamActive; ((Component)val6).transform.SetParent(ReplayRoot.transform); ((Object)val6).name = ((Object)playbackPlayer).name + "_RockCam"; ((Component)val6).gameObject.SetActive(reference2.rockCamActive); for (int k = 0; k < ((Component)val6).transform.childCount; k++) { ((Component)((Component)val6).transform.GetChild(k)).gameObject.SetActive(reference2.rockCamActive); } } Vector3 val7 = Vector3.Lerp(playerState.rockCamPos, pb.rockCamPos, t); Quaternion val8 = Quaternion.Slerp(playerState.rockCamRot, pb.rockCamRot, t); ((Component)val6).transform.SetLocalPositionAndRotation(val7, val8); } if (reference2.playerMeasurement.ArmSpan != pb.ArmSpan || reference2.playerMeasurement.Length != pb.Length) { ((PlayerMeasurement)(ref val9))..ctor(pb.Length, pb.ArmSpan); reference2.playerMeasurement = val9; playbackPlayer.Controller.PlayerScaling.ScaleController(val9); UpdateReplayCameraPOV(povPlayer ?? Main.LocalPlayer, ReplaySettings.hideLocalPlayer); Singleton.instance.Play(ReplayCache.SFX["Call_Measurement_Succes"], playbackPlayer.Controller.PlayerIK.VrIK.references.head.position, false); } if (!string.Equals(reference2.visualData, pb.visualData) && !string.IsNullOrEmpty(pb.visualData)) { PlayerVisualData visualData = PlayerVisualData.FromPlayfabDataString(pb.visualData); playbackPlayer.Controller.assignedPlayer.Data.VisualData = visualData; playbackPlayer.Controller.Initialize(playbackPlayer.Controller.assignedPlayer); ((Component)((Component)playbackPlayer.Controller).transform.GetChild(9)).gameObject.SetActive(false); reference2.visualData = pb.visualData; } ((Component)playbackPlayer.Controller.PlayerNameTag).gameObject.SetActive(Main.instance.ToggleNameplate.Value); ((Component)((Component)playbackPlayer.Controller.PlayerHealth).transform.GetChild(1)).gameObject.SetActive(Main.instance.ToggleHealthBar.Value); if (reference2.active != pb.active) { ((Component)playbackPlayer.Controller).gameObject.SetActive(pb.active); } reference2.active = ((Component)playbackPlayer.Controller).gameObject.activeSelf; HandPresenceInput empty = HandPresenceInput.Empty; empty.gripInput = playerState.lgripInput; empty.thumbInput = playerState.lthumbInput; empty.indexInput = playerState.lindexInput; playbackPlayer.lHandInput = empty; HandPresenceInput empty2 = HandPresenceInput.Empty; empty2.gripInput = playerState.rgripInput; empty2.thumbInput = playerState.rthumbInput; empty2.indexInput = playerState.rindexInput; playbackPlayer.rHandInput = empty2; playbackPlayer.ApplyInterpolatedPose(playerState, pb, t); foreach (VisualEffect componentsInChild6 in ((Component)playbackPlayer).GetComponentsInChildren()) { componentsInChild6.playRate = Mathf.Abs(playbackSpeed); } void TryToggleVFX(string name, PlayerShiftstoneVFX flag) { //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) Transform obj4 = chest.Find(name); VisualEffect val18 = ((obj4 != null) ? ((Component)obj4).GetComponent() : null); if (!((Object)(object)val18 == (Object)null)) { if (1 == 0) { } string text2 = name switch { "Chargestone VFX" => "ChargeStone", "Surgestone_VFX" => "SurgeStone", "Vigorstone_VFX" => "VigorStone", "Adamantstone_VFX" => "AdamantStone", _ => "", }; if (1 == 0) { } string shiftstoneName = text2; if (flags.HasFlag(flag)) { ((Component)val18).transform.localScale = Vector3.one; val18.Play(); val18.playRate = Mathf.Abs(playbackSpeed); Singleton.instance.Play(ReplayCache.SFX["Call_Shiftstone_Use"], ((Component)chest).transform.position, false); ShiftstoneSocket? obj5 = ((IEnumerable)playbackPlayer.Controller.PlayerShiftstones.shiftStoneSockets).FirstOrDefault((Func)((ShiftstoneSocket s) => ((Object)s.assignedShifstone).name == shiftstoneName)); int? num = ((obj5 != null) ? new int?(obj5.assignedSocketIndex) : null); if (num.HasValue) { playbackPlayer.Controller.PlayerShiftstones.ActivateUseShiftstoneEffects((Hand)((num == 0) ? 1 : 2)); } } else { val18.Stop(); } } } } if (replayPedestals.Count >= currentReplay.Header.PedestalCount) { for (int l = 0; l < currentReplay.Header.PedestalCount; l++) { GameObject val10 = replayPedestals[l]; PedestalState pedestalState = frame.Pedestals[l]; PedestalState pedestalState2 = frame2.Pedestals[l]; ref PlaybackPedestalState reference3 = ref playbackPedestalStates[l]; if (reference3.active != pedestalState2.active) { val10.SetActive(pedestalState2.active); } reference3.active = val10.activeSelf; Vector3 localPosition = Vector3.Lerp(pedestalState.position, pedestalState2.position, t); val10.transform.localPosition = localPosition; } } if (replaySceneProps.Count >= currentReplay.Header.ScenePropCount) { for (int m = 0; m < currentReplay.Header.ScenePropCount; m++) { GameObject val11 = replaySceneProps[m]; ScenePropState scenePropState = frame.SceneProps[m]; ScenePropState scenePropState2 = frame2.SceneProps[m]; Vector3 val12 = Vector3.Lerp(scenePropState.position, scenePropState2.position, t); Quaternion val13 = Quaternion.Slerp(scenePropState.rotation, scenePropState2.rotation, t); val11.transform.SetLocalPositionAndRotation(val12, val13); } } EventChunk[] events = frame.Events; if (events == null || lastEventFrame == currentPlaybackFrame) { return; } lastEventFrame = currentPlaybackFrame; EventChunk[] array = events; foreach (EventChunk evt in array) { EventType type = evt.type; EventType eventType = type; if (eventType != EventType.OneShotFX) { continue; } GameObject val14 = SpawnFX(evt); if ((Object)(object)val14 != (Object)null) { Structure val15 = null; if (evt.structureId != -1) { val15 = PlaybackStructures.Select((GameObject s) => s.GetComponent()).FirstOrDefault((Func)((Structure s) => s.structureID == evt.structureId)); } if ((Object)(object)val15 != (Object)null) { val14.GetComponent().parameterCollection.Apply(val14.GetComponent(), val15); val14.GetComponent().Play(); } } if (evt.fxType == FXOneShotType.GroundedSFX) { Singleton.instance.Play(ReplayCache.SFX["Call_Modifier_Stomp"], evt.position, false); } } ReplayAPI.OnPlaybackFrameInternal(frame, frame2); foreach (ReplayExtension extension in ReplayAPI.Extensions) { if (extension.IsEnabled) { extension.OnPlaybackFrame(frame, frame2); } } void ApplyShiftstone(PlayerController controller, int socketIndex, int shiftstoneIndex) { //IL_0126: Unknown result type (might be due to invalid IL or missing references) PlayerShiftstoneSystem playerShiftstones = controller.PlayerShiftstones; if (1 == 0) { } PooledMonoBehaviour val16 = (PooledMonoBehaviour)(shiftstoneIndex switch { 0 => poolManager.GetPooledObject("AdamantStone"), 1 => poolManager.GetPooledObject("ChargeStone"), 2 => poolManager.GetPooledObject("FlowStone"), 3 => poolManager.GetPooledObject("GuardStone"), 4 => poolManager.GetPooledObject("StubbornStone"), 5 => poolManager.GetPooledObject("SurgeStone"), 6 => poolManager.GetPooledObject("VigorStone"), 7 => poolManager.GetPooledObject("VolatileStone"), _ => null, }); if (1 == 0) { } PooledMonoBehaviour val17 = val16; if ((Object)(object)val17 == (Object)null) { playerShiftstones.RemoveShiftStone(socketIndex, false, false); } else { playerShiftstones.AttachShiftStone(((Component)val17).GetComponent(), socketIndex, false, false); Singleton.instance.Play(ReplayCache.SFX["Call_Shiftstone_EquipBoth"], ((Component)val17).transform.position, false); } } } public GameObject SpawnFX(EventChunk fx) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) if (Recording.isRecording || Recording.isBuffering) { EventChunk eventChunk = new EventChunk { type = EventType.OneShotFX, fxType = fx.fxType, position = fx.position }; if (fx.fxType == FXOneShotType.Ricochet) { eventChunk.rotation = fx.rotation; } if (fx.fxType == FXOneShotType.Hitmarker) { eventChunk.damage = fx.damage; } Recording.Events.Add(eventChunk); } GameObject result = null; if (ReplayCache.FXToVFXName.TryGetValue(fx.fxType, out var value)) { FXOneShotType fxType = fx.fxType; if ((fxType == FXOneShotType.Break || fxType == FXOneShotType.DustImpact || fxType == FXOneShotType.Grounded || fxType == FXOneShotType.Spawn || fxType == FXOneShotType.Ungrounded) && !Main.instance.ToggleDust.Value) { return null; } PooledMonoBehaviour val = Object.Instantiate(Singleton.instance.GetPool(value).poolItem); if ((Object)(object)val != (Object)null) { ((Component)val).transform.SetParent(VFXParent.transform); ((Component)val).transform.SetLocalPositionAndRotation(fx.position, fx.rotation); ((Component)val).transform.localScale = Vector3.Scale(((Component)val).transform.localScale, ReplayRoot.transform.localScale); VisualEffect component = ((Component)val).GetComponent(); if ((Object)(object)component != (Object)null) { component.playRate = Mathf.Abs(playbackSpeed); } ReplayTag replayTag = ((Component)val).gameObject.AddComponent(); replayTag.Type = value; ((Component)val).gameObject.AddComponent(); result = ((Component)val).gameObject; } } if (fx.fxType == FXOneShotType.Hitmarker && Main.instance.ToggleHitmarkers.Value) { Pool pool = Singleton.instance.GetPool("PlayerHitmarker"); GameObject val2 = Object.Instantiate(((Component)pool.poolItem).gameObject, VFXParent.transform); val2.transform.localPosition = fx.position; val2.transform.localRotation = Quaternion.identity; val2.transform.localScale = Vector3.Scale(val2.transform.localScale, ReplayRoot.transform.localScale); val2.GetComponent().playRate = Mathf.Abs(playbackSpeed); val2.AddComponent(); val2.gameObject.AddComponent(); PlayerHitmarker component2 = val2.GetComponent(); component2.SetDamage((float)(int)fx.damage); ((Component)component2).gameObject.SetActive(true); component2.Play(); ((Component)component2).GetComponent().playRate = Mathf.Abs(playbackSpeed); } if (ReplayCache.FXToSFXName.TryGetValue(fx.fxType, out var value2) && ReplayCache.SFX.TryGetValue(value2, out var value3)) { Singleton.instance.Play(value3, fx.position, false); } return result; } public void TogglePlayback(bool active, bool setSpeed = true, bool ignoreIsPlaying = true) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) if (!isPlaying && !ignoreIsPlaying) { Main.ReplayError(); } else { if ((active && !isPaused) || (!active && isPaused)) { return; } isPaused = !active; ((Renderer)ReplayPlaybackControls.playButtonSprite).material.SetTexture("_Texture", (Texture)(object)((!isPaused) ? ReplayPlaybackControls.pauseSprite : ReplayPlaybackControls.playSprite)); if (active) { Singleton.instance.Play(ReplayCache.SFX["Call_DressingRoom_PartPanelTick_BackwardLocked"], Main.instance.head.position, false); if (Main.instance.EnableHaptics.Value) { Main.LocalPlayer.Controller.PlayerHaptics.PlayControllerHaptics(1f, 0.05f, 1f, 0.05f); } if (setSpeed) { SetPlaybackSpeed(previousPlaybackSpeed); } } else { previousPlaybackSpeed = playbackSpeed; Singleton.instance.Play(ReplayCache.SFX["Call_DressingRoom_PartPanelTick_ForwardUnlocked"], Main.instance.head.position, false); if (Main.instance.EnableHaptics.Value) { Main.LocalPlayer.Controller.PlayerHaptics.PlayControllerHaptics(1f, 0.05f, 1f, 0.05f); } if (setSpeed) { SetPlaybackSpeed(0f); } } ReplayAPI.ReplayPauseChangedInternal(active); } } public void SetPlaybackSpeed(float newSpeed) { playbackSpeed = newSpeed; if (isPlaying) { GameObject[] playbackStructures = PlaybackStructures; foreach (GameObject val in playbackStructures) { if ((Object)(object)val == (Object)null) { continue; } foreach (VisualEffect componentsInChild in val.GetComponentsInChildren()) { componentsInChild.playRate = Mathf.Abs(newSpeed); } if ((Object)(object)val.GetComponent().frictionVFX != (Object)null) { ((PooledMonoBehaviour)val.GetComponent().frictionVFX).returnToPoolTimer = null; } } for (int j = 0; j < VFXParent.transform.childCount; j++) { Transform child = VFXParent.transform.GetChild(j); ((Component)child).GetComponent().playRate = Mathf.Abs(newSpeed); } foreach (GameObject pedestal in Recording.Pedestals) { if ((Object)(object)pedestal == (Object)null) { continue; } foreach (VisualEffect componentsInChild2 in pedestal.GetComponentsInChildren()) { componentsInChild2.playRate = Mathf.Abs(newSpeed); } } } if ((Object)(object)ReplayPlaybackControls.playbackSpeedText != (Object)null) { string text = (Mathf.Approximately(playbackSpeed, 0f) ? "Paused" : ((!(playbackSpeed < 0f)) ? $">> {playbackSpeed:0.0}x" : $"<< {Mathf.Abs(playbackSpeed):0.0}x")); ((TMP_Text)ReplayPlaybackControls.playbackSpeedText).text = text; ((TMP_Text)ReplayPlaybackControls.playbackSpeedText).ForceMeshUpdate(false, false); } } public void AddPlaybackSpeed(float delta, float minSpeed = -8f, float maxSpeed = 8f) { TogglePlayback(isPaused && !Mathf.Approximately(playbackSpeed + delta, 0f), setSpeed: false); float num = playbackSpeed + delta; if (Mathf.Approximately(num, 0f)) { TogglePlayback(active: false); } else { TogglePlayback(active: true, setSpeed: false); } num = Mathf.Round(num * 10f) / 10f; num = Mathf.Clamp(num, minSpeed, maxSpeed); SetPlaybackSpeed(num); } public void SetPlaybackFrame(int frame) { int num = Mathf.Clamp(frame, 0, currentReplay.Frames.Length - 2); float time = currentReplay.Frames[num].Time; SetPlaybackTime(time); } public void SetPlaybackTime(float time) { elapsedPlaybackTime = Mathf.Clamp(time, 0f, currentReplay.Frames[^1].Time); for (int i = 0; i < currentReplay.Frames.Length - 2; i++) { if (currentReplay.Frames[i + 1].Time > elapsedPlaybackTime) { currentPlaybackFrame = i; break; } } Frame frame = currentReplay.Frames[currentPlaybackFrame]; Frame frame2 = currentReplay.Frames[currentPlaybackFrame + 1]; float num = frame2.Time - frame.Time; float num2 = ((num > 0f) ? ((elapsedPlaybackTime - frame.Time) / num) : 1f); ApplyInterpolatedFrame(currentPlaybackFrame, Mathf.Clamp01(num2)); ReplayAPI.ReplayTimeChangedInternal(time); } public void UpdateReplayCameraPOV(Player player, bool hideLocalPlayer = false) { //IL_0177: 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_02ed: Unknown result type (might be due to invalid IL or missing references) RecordingCamera component = RecordingCamera.GetGameObject().GetComponent(); Transform transform = ((Component)Main.LocalPlayer.Controller).transform; foreach (Renderer componentsInChild in ((Component)transform.GetChild(1)).GetComponentsInChildren()) { if (!((Object)componentsInChild).name.Contains("Collider")) { ((Component)componentsInChild).gameObject.layer = LayerMask.NameToLayer(hideLocalPlayer ? "ScreenFade" : "PlayerController"); } } ((Component)transform.GetChild(6)).gameObject.SetActive(!hideLocalPlayer); Player obj = povPlayer; Transform val = ((obj != null) ? obj.Controller.PlayerIK.VrIK.references.head : null); if ((Object)(object)val != (Object)null && povPlayer != null) { ((Component)val).transform.localScale = Vector3.one; ((Component)((Component)povPlayer.Controller).transform.GetChild(6)).gameObject.SetActive(true); ((Component)((Component)povPlayer.Controller).transform.GetChild(4)).gameObject.SetActive(true); } povPlayer = player; if (player != Main.LocalPlayer) { val = povPlayer.Controller.PlayerIK.VrIK.references.head; ((Component)val).transform.localScale = Vector3.zero; ((Component)((Component)povPlayer.Controller).transform.GetChild(6)).gameObject.SetActive(false); ((Component)((Component)povPlayer.Controller).transform.GetChild(9)).gameObject.SetActive(false); ((Component)((Component)povPlayer.Controller).transform.GetChild(4)).gameObject.SetActive(false); ((Behaviour)((Component)Main.LocalPlayer.Controller.PlayerCamera).GetComponent()).enabled = false; ((Component)Main.LocalPlayer.Controller.PlayerNameTag).gameObject.SetActive(false); ((Behaviour)((Component)povPlayer.Controller.PlayerCamera).GetComponent()).enabled = true; foreach (Renderer componentsInChild2 in ReplayPlaybackControls.playbackControls.GetComponentsInChildren(true)) { if (((Component)componentsInChild2).gameObject.layer != LayerMask.NameToLayer("InteractionBase")) { ((Component)componentsInChild2).gameObject.layer = LayerMask.NameToLayer("ScreenFade"); } } component.localPlayerVR = povPlayer.Controller.PlayerVR; return; } component.localPlayerVR = Main.LocalPlayer.Controller.PlayerVR; if ((Object)(object)val != (Object)null) { ((Component)val).transform.localScale = Vector3.one; } ((Behaviour)((Component)povPlayer.Controller.PlayerCamera).GetComponent()).enabled = false; ((Behaviour)((Component)Main.LocalPlayer.Controller.PlayerCamera).GetComponent()).enabled = true; foreach (Renderer componentsInChild3 in ((Component)transform.GetChild(1)).GetComponentsInChildren()) { ((Component)componentsInChild3).gameObject.layer = LayerMask.NameToLayer("PlayerController"); } foreach (Renderer componentsInChild4 in ReplayPlaybackControls.playbackControls.GetComponentsInChildren(true)) { if (((Component)componentsInChild4).gameObject.layer != LayerMask.NameToLayer("InteractionBase")) { ((Component)componentsInChild4).gameObject.layer = LayerMask.NameToLayer("Default"); } } } } public class ReplayRecording { public enum RecordingState { Idle, Recording, Saving } [RegisterTypeInIl2Cpp] public class RecordingIcon : MonoBehaviour { public TextMeshPro tmp; public ReplayRecording recording; public void TransitionAnimation(RecordingState from, RecordingState to) { //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0269: 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_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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0198: 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_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) if (from == to || (Object)(object)tmp == (Object)null) { return; } recording.CurrentRecordingState = to; (RecordingState, RecordingState) tuple = (from, to); (RecordingState, RecordingState) tuple2 = tuple; var (recordingState, _) = tuple2; if (recordingState == RecordingState.Idle) { switch (tuple2.Item2) { default: return; case RecordingState.Recording: AnimateScale(Vector3.one * 0.32f, Vector3.one * 0.4f, 0.5f, to, Utilities.EaseOut); AnimateColor(new Color(1f, 0f, 0f, 0f), Color.red, 0.5f, to, Utilities.EaseOut); return; case RecordingState.Saving: AnimateColor(new Color(1f, 0f, 0f, 0f), Color.red, 0.2f, to, Utilities.EaseOut, delegate { MelonCoroutines.Start(Pulse()); }); return; case RecordingState.Idle: break; } } else { RecordingState item = tuple2.Item2; if (item == RecordingState.Saving) { AnimateScale(((Component)this).transform.localScale, Vector3.one * 0.4f, 0.8f, to, Utilities.EaseIn); MelonCoroutines.Start(Pulse()); return; } if (recordingState == RecordingState.Saving) { switch (item) { case RecordingState.Recording: AnimateScale(((Component)this).transform.localScale, Vector3.one * 0.4f, 0.8f, to, Utilities.EaseIn); AnimateColor(Color.green, Color.red, 1.5f, to, Utilities.EaseOut); break; case RecordingState.Idle: AnimateScale(((Component)this).transform.localScale, Vector3.one * 0.4f, 0.8f, to, Utilities.EaseIn); AnimateColor(Color.green, Color.clear, 1.5f, to, Utilities.EaseOut); break; } return; } if (item != 0) { return; } } ((Graphic)tmp).color = Color.clear; ((Component)this).transform.localScale = Vector3.one * 0.4f; } public void SyncToState() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_002c: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) switch (recording.CurrentRecordingState) { case RecordingState.Recording: ((Component)this).transform.localScale = Vector3.one * 0.4f; ((Graphic)tmp).color = Color.red; break; case RecordingState.Idle: ((Component)this).transform.localScale = Vector3.one * 0.4f; ((Graphic)tmp).color = Color.clear; break; case RecordingState.Saving: ((Component)this).transform.localScale = Vector3.one * 0.4f; MelonCoroutines.Start(Pulse()); break; } } public void AnimateColor(Color from, Color to, float time, RecordingState required, Func easing, Action done = null) { //IL_001c: 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) ((Graphic)tmp).color = from; MelonCoroutines.Start(Utilities.LerpValue((Func)(() => ((Graphic)tmp).color), (Action)delegate(Color c) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) ((Graphic)tmp).color = c; }, (Func)Color.Lerp, to, time, easing, done, 0f, (Func)(() => recording.CurrentRecordingState == required))); } public void AnimateScale(Vector3 from, Vector3 to, float time, RecordingState required, Func easing, Action done = null) { //IL_001c: 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) ((Component)this).transform.localScale = from; MelonCoroutines.Start(Utilities.LerpValue((Func)(() => ((Component)this).transform.localScale), (Action)delegate(Vector3 s) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.localScale = s; }, (Func)Vector3.Lerp, to, time, easing, done, 0f, (Func)(() => recording.CurrentRecordingState == required))); } public IEnumerator Pulse() { Color a = new Color(1f, 0.2f, 0.2f); Color b = new Color(1f, 0.7f, 0.7f); float t = 0f; while (recording.CurrentRecordingState == RecordingState.Saving) { if ((Object)(object)tmp != (Object)null && (Object)(object)((Component)this).transform != (Object)null) { t += Time.deltaTime * 2f; float ping2 = Mathf.PingPong(t, 1f); ping2 = Utilities.EaseInOut(ping2); ((Graphic)tmp).color = Color.Lerp(a, b, ping2); float scale = Mathf.Lerp(0.95f, 1.05f, ping2); ((Component)this).transform.localScale = Vector3.one * (0.4f * scale); } yield return null; } } } public bool isRecording = false; public float lastSampleTime = 0f; public float recordingStartTime; public int pingSum; public int pingCount; public int pingMin = int.MaxValue; public int pingMax = 0; public float pingTimer = 0f; public string recordingSceneName; public static RecordingIcon recordingIcon; private RecordingState _recordingState = RecordingState.Idle; public List Frames = new List(); public List Events = new List(); public List recordingMarkers = new List(); public List RecordedPlayers = new List(); public Dictionary PlayerSlots = new Dictionary(); public Dictionary PlayerInfos = new Dictionary(); public List RecordedPlayerInfos = new List(); public List StructureInfos = new List(); public List ScenePropInfos = new List(); public Queue replayBuffer = new Queue(); public Queue bufferMarkers = new Queue(); public bool isBuffering = false; public List Structures = new List(); public List Pedestals = new List(); public List SceneProps = new List(); public RecordingState CurrentRecordingState { get { return _recordingState; } set { if (_recordingState != value) { RecordingState recordingState = _recordingState; _recordingState = value; recordingIcon?.TransitionAnimation(recordingState, value); } } } public void HandleRecording() { if ((!isRecording && !isBuffering) || Singleton.instance.IsLoadingScene) { return; } float num = 1f / (float)Main.instance.TargetRecordingFPS.Value; if (Time.time - lastSampleTime >= num) { lastSampleTime = Time.time; Frame frame = CaptureFrame(); frame.Time = Time.time; if (isRecording) { Frame frame2 = frame.Clone(); foreach (ReplayExtension extension in ReplayAPI.Extensions) { if (extension.IsEnabled) { extension.OnRecordFrame(frame2, isBuffer: false); } } ReplayAPI.OnRecordFrameInternal(frame2, isBuffer: false); Frames.Add(frame2); } if (isBuffering) { Frame frame3 = frame.Clone(); foreach (ReplayExtension extension2 in ReplayAPI.Extensions) { if (extension2.IsEnabled) { extension2.OnRecordFrame(frame3, isBuffer: true); } } ReplayAPI.OnRecordFrameInternal(frame3, isBuffer: true); replayBuffer.Enqueue(frame3); float num2 = frame.Time - (float)Main.instance.ReplayBufferDuration.Value; while (replayBuffer.Count > 0 && replayBuffer.Peek().Time < num2) { replayBuffer.Dequeue(); } } Patches.activations.Clear(); Patches.frameSeenEffects.Clear(); Events.Clear(); } if (!(Time.time - pingTimer >= 1f)) { return; } pingTimer = Time.time; bool flag = false; if (PhotonNetwork.InRoom) { Player localPlayer = PhotonNetwork.LocalPlayer; Object val = default(Object); if (localPlayer != null && ((Dictionary)(object)localPlayer.CustomProperties)?.TryGetValue(Object.op_Implicit("ping"), ref val) == true) { int num3 = ((Il2CppObjectBase)val).Unbox(); if (!PhotonNetwork.IsMasterClient) { Player masterClient = PhotonNetwork.MasterClient; Object val2 = default(Object); if (masterClient != null && ((Dictionary)(object)masterClient.CustomProperties)?.TryGetValue(Object.op_Implicit("ping"), ref val2) == true) { num3 += ((Il2CppObjectBase)val2).Unbox(); } } if (num3 >= 0) { pingSum += num3; pingCount++; if (num3 < pingMin) { pingMin = num3; } if (num3 > pingMax) { pingMax = num3; } flag = true; } } } if (!flag && PhotonNetwork.IsConnected) { int ping = PhotonNetwork.GetPing(); pingSum += ping; pingCount++; if (ping < pingMin) { pingMin = ping; } if (ping > pingMax) { pingMax = ping; } } } private Frame CaptureFrame() { //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_056b: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Unknown result type (might be due to invalid IL or missing references) //IL_057e: Unknown result type (might be due to invalid IL or missing references) //IL_0795: Unknown result type (might be due to invalid IL or missing references) //IL_079a: Unknown result type (might be due to invalid IL or missing references) //IL_0823: Unknown result type (might be due to invalid IL or missing references) //IL_0828: Unknown result type (might be due to invalid IL or missing references) //IL_0835: Unknown result type (might be due to invalid IL or missing references) //IL_083a: Unknown result type (might be due to invalid IL or missing references) //IL_06b9: Unknown result type (might be due to invalid IL or missing references) //IL_06be: Unknown result type (might be due to invalid IL or missing references) //IL_06cb: Unknown result type (might be due to invalid IL or missing references) //IL_06d0: Unknown result type (might be due to invalid IL or missing references) //IL_071c: Unknown result type (might be due to invalid IL or missing references) //IL_0721: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: 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_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: 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_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Unknown result type (might be due to invalid IL or missing references) //IL_04be: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_04ff: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_051b: Unknown result type (might be due to invalid IL or missing references) HashSet hashSet = new HashSet(); PlayerState[] array = Utilities.NewArray(RecordedPlayers.Count); for (int i = 0; i < RecordedPlayers.Count; i++) { Player p = RecordedPlayers[i]; if (p == null) { array[i] = new PlayerState { active = false }; continue; } PlayerController controller = p.Controller; PlayerStackProcessor val = ((controller != null) ? controller.GetSubsystem() : null); if ((Object)(object)val == (Object)null) { continue; } Stack val2 = null; Enumerator enumerator = val.availableStacks.GetEnumerator(); while (enumerator.MoveNext()) { Stack current = enumerator.Current; if ((Object)(object)current == (Object)null) { continue; } if (current.cachedName == "Flick") { val2 = current; } if (((val2 != null) ? val2.runningExecutions : null) == null) { continue; } Enumerator enumerator2 = val2.runningExecutions.GetEnumerator(); while (enumerator2.MoveNext()) { StackConfiguration current2 = enumerator2.Current; if (((current2 != null) ? current2.TargetProcessable : null) != null) { ProcessableComponent val3 = ((Il2CppObjectBase)current2.TargetProcessable).TryCast(); if ((Object)(object)((val3 != null) ? ((Component)val3).gameObject : null) != (Object)null) { hashSet.Add(((Component)val3).gameObject); } } } } Transform child = ((Component)p.Controller).transform.GetChild(2); Transform child2 = child.GetChild(1); Transform child3 = child.GetChild(2); Transform child4 = child.GetChild(0).GetChild(0); PlayerShiftstoneSystem playerShiftstones = p.Controller.PlayerShiftstones; Il2CppArrayBase source = playerShiftstones.currentShiftstoneEffects.ToArray(); Il2CppStructArray currentShiftStoneConfiguration = playerShiftstones.GetCurrentShiftStoneConfiguration(); int leftShiftstone = ((currentShiftStoneConfiguration != null && ((Il2CppArrayBase)(object)currentShiftStoneConfiguration).Count > 0) ? ((Il2CppArrayBase)(object)currentShiftStoneConfiguration)[0] : (-1)); int rightShiftstone = ((currentShiftStoneConfiguration != null && ((Il2CppArrayBase)(object)currentShiftStoneConfiguration).Count > 0) ? ((Il2CppArrayBase)(object)currentShiftStoneConfiguration)[1] : (-1)); PlayerShiftstoneVFX playerShiftstoneVFX = PlayerShiftstoneVFX.None; PooledVisualEffect val4 = ((IEnumerable)source).FirstOrDefault((Func)((PooledVisualEffect e) => ((PooledMonoBehaviour)e).ResourceName == "ChargeStone_VFX")); if ((Object)(object)val4 != (Object)null && val4.isPlaying) { playerShiftstoneVFX |= PlayerShiftstoneVFX.Charge; } PooledVisualEffect val5 = ((IEnumerable)source).FirstOrDefault((Func)((PooledVisualEffect e) => ((PooledMonoBehaviour)e).ResourceName == "AdamantStone_VFX")); if ((Object)(object)val5 != (Object)null && val5.isPlaying) { playerShiftstoneVFX |= PlayerShiftstoneVFX.Adamant; } PooledVisualEffect val6 = ((IEnumerable)source).FirstOrDefault((Func)((PooledVisualEffect e) => ((PooledMonoBehaviour)e).ResourceName == "SurgeStone_VFX")); if ((Object)(object)val6 != (Object)null && val6.isPlaying) { playerShiftstoneVFX |= PlayerShiftstoneVFX.Surge; } PooledVisualEffect val7 = ((IEnumerable)source).FirstOrDefault((Func)((PooledVisualEffect e) => ((PooledMonoBehaviour)e).ResourceName == "Vigorstone_VFX")); if ((Object)(object)val7 != (Object)null && val7.isPlaying) { playerShiftstoneVFX |= PlayerShiftstoneVFX.Vigor; } bool value = Main.instance.HandFingerRecording.Value; PlayerHandPresence subsystem = p.Controller.GetSubsystem(); PlayerLIV subsystem2 = p.Controller.GetSubsystem(); GameObject val8 = ((subsystem2 != null) ? ((Component)((Component)subsystem2.LckTablet).transform).gameObject : null); PlayerMeasurement playerMeasurement = p.Controller.assignedPlayer.Data.PlayerMeasurement; PlayerState playerState = new PlayerState { VRRigPos = child.position, VRRigRot = child.rotation, HeadPos = child4.localPosition, HeadRot = child4.localRotation, LHandPos = child2.localPosition, LHandRot = child2.localRotation, RHandPos = child3.localPosition, RHandRot = child3.localRotation, Health = p.Data.HealthPoints, currentStack = Patches.activations.FirstOrDefault(((string playerId, short stackId) s) => s.playerId == p.Data.GeneralData.PlayFabMasterId).stackId, active = ((Component)p.Controller).gameObject.activeInHierarchy, activeShiftstoneVFX = playerShiftstoneVFX, leftShiftstone = leftShiftstone, rightShiftstone = rightShiftstone, ArmSpan = playerMeasurement.ArmSpan, Length = playerMeasurement.Length, visualData = p.Data.VisualData.ToPlayfabDataString() }; try { HandPresenceInput handPresenceInputForHand = subsystem.GetHandPresenceInputForHand((Hand)1); HandPresenceInput handPresenceInputForHand2 = subsystem.GetHandPresenceInputForHand((Hand)2); if (value) { playerState.lgripInput = handPresenceInputForHand.gripInput; playerState.lindexInput = handPresenceInputForHand.indexInput; playerState.lthumbInput = handPresenceInputForHand.thumbInput; playerState.rindexInput = handPresenceInputForHand2.indexInput; playerState.rthumbInput = handPresenceInputForHand2.indexInput; playerState.rgripInput = handPresenceInputForHand2.gripInput; } } catch { } if ((Object)(object)val8 != (Object)null) { playerState.rockCamActive = ((Component)val8.transform.GetChild(0)).gameObject.activeInHierarchy; playerState.rockCamPos = val8.transform.position; playerState.rockCamRot = val8.transform.rotation; } array[i] = playerState; } StructureState[] array2 = Utilities.NewArray(Structures.Count); Structure val10 = default(Structure); for (int j = 0; j < Structures.Count; j++) { Structure val9 = Structures[j]; if (!((Object)(object)val9 == (Object)null) && ((Component)val9).TryGetComponent(ref val10) && !((Object)val9).name.StartsWith("Static Target") && !((Object)val9).name.StartsWith("Moving Target")) { bool flag = ((IEnumerable)((Component)val9).GetComponentsInChildren()).Any((ReplayPlayback.ReplayTag t) => t.Type == "StructureFlick"); bool isTargetDisk = ((Object)val9).name.Contains("Disc") && ((Component)((Component)val9).transform.GetChild(0).GetChild(0)).gameObject.activeInHierarchy; int num = ((IEnumerable)((Component)val9).GetComponentsInChildren()).Count((VisualEffect vfx) => ((Object)vfx).name.Contains("Hold_VFX")); array2[j] = new StructureState { position = ((Component)val9).transform.position, rotation = ((Component)val9).transform.rotation, active = ((Component)val9).gameObject.activeInHierarchy, isLeftHeld = (num >= 1), isRightHeld = (num >= 2), isFlicked = (hashSet.Contains(((Component)val9).gameObject) || flag), currentState = val9.currentPhysicsState, isTargetDisk = isTargetDisk }; } } PedestalState[] array3 = Utilities.NewArray(Pedestals.Count); for (int k = 0; k < Pedestals.Count; k++) { GameObject val11 = Pedestals[k]; if (!((Object)(object)val11 == (Object)null)) { array3[k] = new PedestalState { position = val11.transform.position, active = (((Behaviour)val11.GetComponent()).enabled && val11.activeInHierarchy) }; } } ScenePropState[] array4 = Utilities.NewArray(SceneProps.Count); for (int l = 0; l < SceneProps.Count; l++) { GameObject val12 = SceneProps[l]; if (!((Object)(object)val12 == (Object)null)) { array4[l] = new ScenePropState { position = val12.transform.position, rotation = val12.transform.rotation }; } } return new Frame { Structures = array2, Players = array, Pedestals = array3, SceneProps = array4, Events = Events.ToArray() }; } public void SaveReplay(Frame[] frames, List markers, string logPrefix, bool isBufferClip = false, Action onSave = null) { //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) Main.DebugLog($"[{logPrefix}] Saving | Frames: {frames.Length} | Markers: {markers.Count}"); if (frames.Length == 0) { ((MelonBase)Main.instance).LoggerInstance.Warning(logPrefix + " stopped, but no frames were captured. Replay was not saved."); return; } CurrentRecordingState = RecordingState.Saving; float num = frames[^1].Time - frames[0].Time; string text = Utilities.GetActiveCustomMapName(); if (string.IsNullOrEmpty(text)) { string[] array = Utilities.RebuildCustomMapFromScene(); if (array != null) { text = string.Join("|", array); } } if (Main.currentScene == "Gym") { GameObject flatLandRoot = Main.instance.flatLandRoot; if (flatLandRoot != null && !flatLandRoot.gameObject.activeSelf) { text = "FlatLandSingle"; } } float time = frames[0].Time; foreach (Frame frame in frames) { frame.Time -= time; } foreach (Marker marker in markers) { marker.time -= time; } ReplayInfo replayInfo = new ReplayInfo { Header = new ReplaySerializer.ReplayHeader { Version = "1.2.0", Date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Scene = (isBufferClip ? Main.currentScene : recordingSceneName), Duration = num, CustomMap = text, FrameCount = frames.Length, PedestalCount = Pedestals.Count, ScenePropCount = SceneProps.Count, MarkerCount = markers.Count, AvgPing = ((pingCount > 0) ? (pingSum / pingCount) : (-1)), MinPing = pingMin, MaxPing = pingMax, TargetFPS = Main.instance.TargetRecordingFPS.Value, Structures = StructureInfos.ToArray(), SceneProps = ScenePropInfos.ToArray(), Guid = Guid.NewGuid().ToString() }, Frames = frames }; replayInfo.Header.Players = RecordedPlayerInfos.ToArray(); replayInfo.Header.MarkerCount = markers.Count; replayInfo.Header.Markers = markers.ToArray(); string friendlySceneName = Utilities.GetFriendlySceneName(recordingSceneName); if (1 == 0) { } string text2; switch (friendlySceneName) { case "Gym": text2 = ReplayFiles.LoadFormatFile("AutoNameFormats/gym"); break; case "Park": text2 = ReplayFiles.LoadFormatFile("AutoNameFormats/park"); break; case "Pit": case "Ring": text2 = ReplayFiles.LoadFormatFile("AutoNameFormats/match"); break; default: text2 = null; break; } if (1 == 0) { } string text3 = text2; if (string.IsNullOrWhiteSpace(text3)) { Main.ReplayError(logPrefix + " was not saved due to missing name format file."); text3 = "{Host} vs {Client} - {Scene}"; } try { replayInfo.Header.Title = ReplayFormatting.FormatReplayString(text3, replayInfo.Header); } catch (Exception value) { Main.ReplayError($"Failed to format replay title: {value}"); replayInfo.Header.Title = "Invalid Replay Title"; } ((MelonBase)Main.instance).LoggerInstance.Msg($"{logPrefix} finished ({frames.Length} frames, {num:F2}s)."); Main.DebugLog($"[{logPrefix}] Header | Scene: {recordingSceneName} | Duration: {num:F2}s | Players: {replayInfo.Header.Players.Length} | Structures: {StructureInfos.Count}"); string path = ReplayFiles.replayFolder + "/Replays/" + ReplayFormatting.GetReplayName(replayInfo, isBufferClip); MelonCoroutines.Start(ReplayArchive.BuildReplayPackageSafe(path, replayInfo, delegate { //IL_0029: Unknown result type (might be due to invalid IL or missing references) Singleton.instance.Play(ReplayCache.SFX["Call_PoseGhost_PosePerformed"], ((Component)Main.LocalPlayer.Controller.GetSubsystem()).transform.position, false); ((MelonBase)Main.instance).LoggerInstance.Msg(logPrefix + " saved to disk: '" + path + "'"); if (Main.instance.EnableHaptics.Value) { Main.LocalPlayer.Controller.GetSubsystem().PlayControllerHaptics(1f, 0.15f, 1f, 0.15f); } CurrentRecordingState = (isRecording ? RecordingState.Recording : RecordingState.Idle); onSave?.Invoke(replayInfo, path); ReplayFiles.ReloadReplays(); })); } public bool TryRegisterStructure(Structure structure) { if (!isRecording && !isBuffering) { return false; } if ((Object)(object)structure == (Object)null) { return false; } if (Structures.Contains(structure)) { return false; } Structures.Add(structure); string resourceName = ((PooledMonoBehaviour)structure).resourceName; if (1 == 0) { } StructureType structureType = resourceName switch { "RockCube" => StructureType.Cube, "Pillar" => StructureType.Pillar, "Disc" => StructureType.Disc, "Wall" => StructureType.Wall, "Ball" => StructureType.Ball, "LargeRock" => StructureType.LargeRock, "SmallRock" => StructureType.SmallRock, "BoulderBall" => StructureType.CagedBall, "WrappedWall" => StructureType.WrappedWall, "PrisonedPillar" => StructureType.PrisonedPillar, "DockedDisk" => StructureType.DockedDisk, "CageCube" => StructureType.CageCube, "StructureTarget" => StructureType.Target, _ => StructureType.Cube, }; if (1 == 0) { } StructureType structureType2 = structureType; if (structureType2 == StructureType.Ball && ((Component)structure).transform.childCount >= 3 && ((Object)((Component)structure).transform.GetChild(2)).name == "Ballcage") { structureType2 = (((Object)(object)((Component)structure).GetComponent() != (Object)null) ? StructureType.TetheredCagedBall : StructureType.CagedBall); } int? targetDamage = null; if (structureType2 == StructureType.Target) { targetDamage = structure.baseStructureTier; } Main.DebugLog($"[Structure] Registered | {((PooledMonoBehaviour)structure).ResourceName} | Type: {structureType2}"); StructureInfos.Add(new StructureInfo { Type = structureType2, structureId = structure.structureID, targetDamage = targetDamage }); return true; } public void SetupRecordingData() { RecordedPlayers.Clear(); PlayerSlots.Clear(); PlayerInfos.Clear(); Structures.Clear(); StructureInfos.Clear(); ScenePropInfos.Clear(); Pedestals.Clear(); recordingSceneName = Main.currentScene; recordingStartTime = Time.time; Enumerator enumerator = SceneSingleton.instance.structures.GetEnumerator(); while (enumerator.MoveNext()) { Structure current = enumerator.Current; TryRegisterStructure(current); } Enumerator enumerator2 = Singleton.instance.AllPlayers.GetEnumerator(); while (enumerator2.MoveNext()) { Player current2 = enumerator2.Current; if (current2 != null) { Main.Recording.RegisterPlayer(current2); } } Pedestals.AddRange(Utilities.EnumerateMatchPedestals()); Il2CppArrayBase val = Object.FindObjectsOfType(); foreach (Fruit item in val) { ScenePropInfos.Add(new ScenePropInfo { type = ScenePropType.Fruit }); SceneProps.Add(((Component)item).gameObject); } Main.DebugLog($"[Recording] Setup | Scene: {recordingSceneName} | Players: {RecordedPlayers.Count} | Structures: {StructureInfos.Count} | Pedestals: {Pedestals.Count} | Scene Props: {ScenePropInfos.Count}"); } public int RegisterPlayer(Player player) { Main.DebugLog($"Register Player | ID: {player.Data.GeneralData.PlayFabMasterId} | Instance: {((Object)player.Controller).GetInstanceID()} | IsClone: {Utilities.IsReplayClone(player.Controller)}"); if (Utilities.IsReplayClone(player.Controller)) { int count = RecordedPlayers.Count; AddPlayer(player); Main.DebugLog($"Replay Clone ({player.Data.GeneralData.PlayFabMasterId}) | New Slot: {count} (Total: {RecordedPlayers.Count})"); return count; } string playFabMasterId = player.Data.GeneralData.PlayFabMasterId; if (PlayerSlots.TryGetValue(playFabMasterId, out var value)) { RecordedPlayers[value] = player; Main.DebugLog($"Existing Player Override ({playFabMasterId}) | Slot: {value} (Total: {RecordedPlayers.Count})"); return value; } int count2 = RecordedPlayers.Count; PlayerSlots[playFabMasterId] = count2; AddPlayer(player); Main.DebugLog($"New Player ({playFabMasterId}) | Slot: {count2} (Total: {RecordedPlayers.Count})"); return count2; } private int AddPlayer(Player player) { int count = RecordedPlayers.Count; RecordedPlayers.Add(player); MelonCoroutines.Start(Patches.Patch_PlayerVisuals_ApplyPlayerVisuals.VisualDataDelay(player, count)); return count; } public Marker AddMarker(string name, Color color) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return AddMarker(name, color, Time.time); } public Marker AddMarker(string name, Color color, float time) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (!isRecording && !isBuffering) { return null; } Marker marker = new Marker(name, time, color); if (isRecording) { recordingMarkers.Add(marker); } if (isBuffering) { bufferMarkers.Enqueue(marker); } Main.DebugLog($"[Marker] Added | {name} | Time: {time:F2} | Recording: {isRecording} | Buffering: {isBuffering}"); return marker; } public void StartBuffering() { isBuffering = true; SetupRecordingData(); replayBuffer.Clear(); bufferMarkers.Clear(); Main.DebugLog($"[Buffer] Started | Duration: {Main.instance.ReplayBufferDuration.Value}s"); } public void SaveReplayBuffer() { Main.DebugLog($"[Buffer] Saving | Frames:{replayBuffer.Count} | Markers: {bufferMarkers.Count}"); Frame[] frames = replayBuffer.ToArray(); SaveReplay(frames, bufferMarkers.ToList(), "Replay Buffer", isBufferClip: true, delegate(ReplayInfo info, string path) { ReplayAPI.ReplaySavedInternal(info, isBuffer: true, path); }); } public void StopRecording() { Main.DebugLog($"[Recording] Stopping | Frames: {Frames.Count} | Markers: {recordingMarkers.Count}"); isRecording = false; ReplayVoices.StopRecording(); Singleton.instance.LocalPlayer.Controller.PlayerVoiceSystem.recorder.DebugEchoMode = true; SaveReplay(Frames.ToArray(), recordingMarkers, "Recording", isBufferClip: false, delegate(ReplayInfo info, string path) { ReplayAPI.ReplaySavedInternal(info, isBuffer: false, path); }); Reset(); ReplayAPI.RecordingStoppedInternal(); } public void StartRecording() { isRecording = true; Singleton.instance.LocalPlayer.Controller.PlayerVoiceSystem.recorder.DebugEchoMode = true; ReplayVoices.StartRecording(); SetupRecordingData(); Frames.Clear(); Events.Clear(); recordingMarkers.Clear(); if (CurrentRecordingState != RecordingState.Saving) { CurrentRecordingState = RecordingState.Recording; } if (Main.instance.EnableHaptics.Value) { Main.LocalPlayer.Controller.GetSubsystem().PlayControllerHaptics(1f, 0.15f, 1f, 0.15f); } Main.DebugLog($"[Recording] Started | Scene: {recordingSceneName} | Players: {RecordedPlayers.Count} | Structures: {Structures.Count}"); ReplayAPI.RecordingStartedInternal(); } public void Reset() { replayBuffer.Clear(); lastSampleTime = 0f; pingCount = 0; pingSum = 0; pingMax = 0; pingMin = int.MaxValue; } } } namespace ReplayMod.docs.Extensions { public class ExampleMod : MelonMod { private enum BellField : byte { Position, Rotation } private class BellExtension : ReplayExtension { public override string Id => "BellSupport"; public override void OnRecordFrame(Frame frame, bool isBuffer) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_006a: Unknown result type (might be due to invalid IL or missing references) if (!(instance.currentScene != "Park") && recordBell.Value) { GameObject val = new GameObject("Bell"); if (!((Object)(object)val == (Object)null)) { frame.SetExtensionData(this, new BellState { Position = val.transform.position, Rotation = val.transform.rotation }); } } } public override void OnWriteFrame(ReplayAPI.FrameExtensionWriter writer, Frame frame) { if (frame.TryGetExtensionData(this, out var state)) { writer.WriteChunk(0, delegate(BinaryWriter w) { //IL_0009: 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) w.Write(BellField.Position, state.Position); w.Write(BellField.Rotation, state.Rotation); }); } } public override void OnReadFrame(BinaryReader br, Frame frame, int subIndex) { BellState bellState = ReplaySerializer.ReadChunk(br, () => lastState?.Clone() ?? new BellState(), delegate(BellState s, BellField field, ushort size, BinaryReader reader) { //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_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) switch (field) { case BellField.Position: s.Position = reader.ReadVector3(); break; case BellField.Rotation: s.Rotation = reader.ReadQuaternion(); break; } }); frame.SetExtensionData(this, bellState); lastState = bellState; } public override void OnPlaybackFrame(Frame frame, Frame nextFrame) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_004e: 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) if (!(instance.currentScene != "Park") && frame.TryGetExtensionData(this, out var value)) { GameObject val = new GameObject("Bell"); if (!((Object)(object)val == (Object)null)) { val.transform.position = value.Position; val.transform.rotation = value.Rotation; } } } } private class BellState { public Vector3 Position; public Quaternion Rotation; public BellState Clone() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) return new BellState { Position = Position, Rotation = Rotation }; } } public static ExampleMod instance; private static BellState lastState; private ReplayExtension mod; private static MelonPreferences_Entry recordBell; public string currentScene = "Loader"; public ExampleMod() { instance = this; } public override void OnLateInitializeMelon() { mod = ReplayAPI.RegisterExtension(new BellExtension()); recordBell = mod.Settings.CreateEntry("Record_Bell", true, "Record Bell", "Toggles whether the bell is recorded.", false, false, (ValueValidator)null, (string)null); ReplayAPI.onReplayEnded += delegate { lastState = null; }; } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { currentScene = sceneName; } } }