Decompiled source of YPlayBoombox v1.1.3
YPlay.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.IO.Compression; using System.Linq; using System.Net; using System.Net.Http; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using System.Threading; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.Networking; using YPlay.NetcodePatcher; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("YPlay")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("YPlay")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a9e02c48-30aa-4cf0-bbce-b71de7f55747")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace YPlay { internal class BoomboxAudioLoader : MonoBehaviour { internal static readonly Dictionary<string, AudioClip> filenameIdAudioClips = new Dictionary<string, AudioClip>(); internal static readonly List<string> filenameIdsDownloaded = new List<string>(); private static BoomboxAudioLoader Instance; internal void Start(IEnumerator routine) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Instance == (Object)null) { Instance = new GameObject(typeof(BoomboxAudioLoader).Name).AddComponent<BoomboxAudioLoader>(); Object.DontDestroyOnLoad((Object)(object)Instance); } ((MonoBehaviour)Instance).StartCoroutine(routine); } internal IEnumerator GetAudioClip(BoomboxItemController boomboxItemController, int requestId, string path, bool resync) { string filenameId = Path.GetFileNameWithoutExtension(path); bool flag = false; bool success = false; if (filenameIdAudioClips.ContainsKey(filenameId)) { AudioClip audioClip = filenameIdAudioClips[filenameId]; if (Object.op_Implicit((Object)(object)audioClip) && (int)audioClip.loadState == 2) { yield return null; SetAudio(filenameId, audioClip); flag = true; success = true; } else { filenameIdAudioClips.Remove(filenameId); } } bool flag2 = BoomboxAudioDownloader.IsFilenameIdDownloaded(filenameId); if (!flag && flag2) { if (filenameIdsDownloaded.Contains(filenameId)) { filenameIdsDownloaded.Remove(filenameId); } filenameIdsDownloaded.Insert(0, filenameId); AudioType audioType = BoomboxAudioDownloader.audioType; UnityWebRequest unityWebRequest = UnityWebRequestMultimedia.GetAudioClip(path, audioType); try { ((DownloadHandlerAudioClip)unityWebRequest.downloadHandler).streamAudio = (int)audioType == 13; yield return unityWebRequest.SendWebRequest(); if ((int)unityWebRequest.result == 1) { AudioClip content = DownloadHandlerAudioClip.GetContent(unityWebRequest); if ((int)content.loadState == 2) { boomboxItemController.audioType = audioType; SetAudio(filenameId, content); success = true; } } } finally { ((IDisposable)unityWebRequest)?.Dispose(); } } if (!success) { string text = "Error " + (resync ? "resyncing" : "loading") + " request" + BoomboxAudioDownloader.GetFilenameIdString(filenameId); YPlay.LogWarning(text); YPlayCorePatch.DrawString(text); } boomboxItemController.SendBoomboxLoadedServerDelegate(requestId, success, resync); } internal static void UnloadAudioClips() { Dictionary<string, AudioClip> dictionary = new Dictionary<string, AudioClip>(filenameIdAudioClips); foreach (KeyValuePair<string, AudioClip> item in dictionary) { AudioClip value = item.Value; string key = item.Key; value.UnloadAudioData(); filenameIdAudioClips.Remove(key); } } private void SetAudio(string filenameId, AudioClip audioClip) { filenameIdAudioClips[filenameId] = audioClip; YPlayCorePatch.DrawString("Loaded" + BoomboxAudioDownloader.GetFilenameIdString(filenameId)); } } internal class BoomboxAudioDownloader { [CompilerGenerated] private BoomboxItemController <boomboxItemController>P; internal static readonly Dictionary<string, string> audioIdTitles = new Dictionary<string, string>(); private static readonly Dictionary<string, int> audioIdDurations = new Dictionary<string, int>(); internal int lastDownloadRequestId; private readonly BoomboxAudioLoader boomboxAudioLoader; private BoomboxAudioProcess boomboxAudioProcess; internal static HashSet<string> filenameIdsResyncing = new HashSet<string>(); internal static string audioTypeExtension = "mp3"; internal const string AUDIO_TYPE_EXTENSION_TEMP = "part"; internal static AudioType audioType = (AudioType)13; public BoomboxAudioDownloader(BoomboxItemController boomboxItemController) { <boomboxItemController>P = boomboxItemController; lastDownloadRequestId = -1; boomboxAudioLoader = new BoomboxAudioLoader(); base..ctor(); } internal async void DownloadTask(int requestId, string filenameId, string title, int duration, string url, float time, bool resync = false) { if (filenameId == null || title == null || url == null) { YPlayCorePatch.DrawString("Invalid " + (resync ? "resync" : "download") + " request"); return; } if (resync) { filenameIdsResyncing.Add(filenameId); } lastDownloadRequestId = requestId; time = Mathf.Max(time, 0f); POST_TASK postTask = POST_TASK.NONE; audioIdTitles[filenameId] = title; audioIdDurations[filenameId] = duration; await Task.Run(delegate { string outputFileLocationForId = GetOutputFileLocationForId(filenameId); CancelCurrentProcess(); if (IsFilenameLoaded(filenameId)) { postTask = LoadFile(filenameId, outputFileLocationForId, requestId, resync); } else if (!YPlay.IsToolsValid()) { postTask = POST_TASK.ERROR_INVALID_TOOLS; } else { boomboxAudioProcess = new BoomboxAudioProcess(this, requestId, filenameId, outputFileLocationForId, url); postTask = boomboxAudioProcess.Start(resync); } }); switch (postTask) { case POST_TASK.ERROR_INVALID_TOOLS: { <boomboxItemController>P.SendBoomboxLoadedServerDelegate(requestId, loaded: false, resync, RLE_REASON.MISSING_TOOLS); string text = "Invalid tools, please try restarting the game"; YPlay.LogError(text); YPlayCorePatch.DrawString(text); break; } case POST_TASK.ERROR_LOADING_AUDIO: { <boomboxItemController>P.SendBoomboxLoadedServerDelegate(requestId, loaded: false, resync); string text = "Error loading request" + GetFilenameIdString(filenameId); YPlay.LogWarning(text); YPlayCorePatch.DrawString(text); break; } case POST_TASK.ERROR_DOWNLOADING_AUDIO: { <boomboxItemController>P.SendBoomboxLoadedServerDelegate(requestId, loaded: false, resync); string text = "Error downloading request" + GetFilenameIdString(filenameId); YPlay.LogWarning(text); YPlayCorePatch.DrawString(text); break; } } filenameIdsResyncing.Remove(filenameId); } internal void CancelCurrentProcess() { if (boomboxAudioProcess != null && boomboxAudioProcess.processState == PROCESS_STATE.PROCESSING) { boomboxAudioProcess.KillProcess(); YPlayCorePatch.DrawString("Previous process" + GetFilenameIdString(boomboxAudioProcess.filenameId) + " cancelled"); } } internal void KillRequestId(int requestId) { if (boomboxAudioProcess != null && boomboxAudioProcess.requestId == requestId) { CancelCurrentProcess(); } } internal async Task DownloadMetadata(BoomboxRequestMetadata boomboxRequestMetadata, string url, string filenameId, float time) { await Task.Run(delegate { if (!YPlay.IsToolsValid()) { boomboxRequestMetadata.rmStatus = RM_STATUS.INVALID_TOOLS; } else if (url == null || filenameId == null || url.Trim().Length == 0 || filenameId.Trim().Length == 0) { boomboxRequestMetadata.rmStatus = RM_STATUS.INVALID_METADATA; } else { string text = (audioIdTitles.ContainsKey(filenameId) ? audioIdTitles[filenameId] : null); int num = (audioIdDurations.ContainsKey(filenameId) ? audioIdDurations[filenameId] : 0); if (!IsMetadataLoadedForFilenameId(filenameId)) { (text, num) = GetAudioTitleDuration(url); if (text == null || text.Length == 0 || num == 0) { boomboxRequestMetadata.rmStatus = RM_STATUS.INVALID_METADATA; return; } audioIdTitles[filenameId] = text; audioIdDurations[filenameId] = num; } int num2 = num / 60; if (num2 > 10) { boomboxRequestMetadata.rmStatus = RM_STATUS.INVALID_MAX_DURATION; } else if (text == null || text.Length == 0 || num == 0) { boomboxRequestMetadata.rmStatus = RM_STATUS.INVALID_METADATA; } else { boomboxRequestMetadata.filenameId = filenameId; boomboxRequestMetadata.url = url; boomboxRequestMetadata.time = time; boomboxRequestMetadata.title = text; boomboxRequestMetadata.duration = num; if (boomboxRequestMetadata.rmStatus != RM_STATUS.CANCELLED) { boomboxRequestMetadata.rmStatus = RM_STATUS.VALID; } } } }); } private (string, int) GetAudioTitleDuration(string url) { string title = null; int duration = 0; int lineIndex = 0; Process process = new Process(); process.StartInfo.FileName = YPlay.ytdlpLocation; process.StartInfo.UseShellExecute = false; process.StartInfo.Arguments = "--force-ipv4 --no-playlist --get-title --get-duration " + url; process.StartInfo.CreateNoWindow = true; process.StartInfo.RedirectStandardOutput = true; process.OutputDataReceived += delegate(object sender, DataReceivedEventArgs args) { if (lineIndex == 0) { title = args.Data; } else if (lineIndex == 1) { duration = GetDurationSeconds(args.Data); } lineIndex++; }; try { process.Start(); process.BeginOutputReadLine(); process.WaitForExit(); if (title == null || title.Trim().Length == 0) { title = GetFilenameIdFromUrl(url); } } catch (Exception) { } finally { process?.Dispose(); } return (title, duration); } private int GetDurationSeconds(string duration) { string s = ""; string s2 = ""; string s3 = ""; string[] array = duration.Split(new char[1] { ':' }); if (array.Length == 1) { s2 = array[0]; } else if (array.Length == 2) { s3 = array[0]; s2 = array[1]; } else if (array.Length == 3) { s = array[0]; s3 = array[1]; s2 = array[2]; } int.TryParse(s, out var result); int.TryParse(s3, out var result2); int.TryParse(s2, out var result3); return result * 60 * 60 + result2 * 60 + result3; } internal POST_TASK LoadFile(string filenameId, string outputFileLocation, int requestId, bool resync) { if (IsFilenameLoaded(filenameId)) { boomboxAudioLoader.Start(boomboxAudioLoader.GetAudioClip(<boomboxItemController>P, requestId, outputFileLocation, resync)); return POST_TASK.NONE; } return POST_TASK.ERROR_LOADING_AUDIO; } private bool IsFilenameLoaded(string filenameId) { if (filenameId != null) { if (!IsFilenameIdDownloaded(filenameId)) { return BoomboxAudioLoader.filenameIdAudioClips.ContainsKey(filenameId); } return true; } return false; } internal static bool IsFilenameIdDownloaded(string id) { if (id == null) { return false; } string outputFileLocationForId = GetOutputFileLocationForId(id); string outputFileLocationTempForId = GetOutputFileLocationTempForId(id); string outputFileLocationWithoutExtensionForId = GetOutputFileLocationWithoutExtensionForId(id); bool flag = File.Exists(outputFileLocationForId) && new FileInfo(outputFileLocationForId).Length > 0; bool flag2 = !File.Exists(outputFileLocationTempForId) && !File.Exists(outputFileLocationWithoutExtensionForId); return flag && flag2; } internal static bool IsMetadataLoadedForFilenameId(string filenameId) { if (filenameId != null && audioIdTitles.ContainsKey(filenameId)) { return audioIdDurations.ContainsKey(filenameId); } return false; } internal static string GetFilenameIdFromUrl(string url) { if (url == null) { return null; } url = url.Replace("https://", "").Replace("http://", "").Replace("www.", ""); string text = null; int num = url.IndexOf("?v=", StringComparison.OrdinalIgnoreCase); int num2 = url.IndexOf("/shorts/", StringComparison.OrdinalIgnoreCase); int num3 = url.IndexOf("/", StringComparison.OrdinalIgnoreCase); if (num > -1) { text = url.Substring(num + "?v=".Length); } else if (num2 > -1) { text = url.Substring(num2 + "/shorts/".Length); } else if (num3 > -1) { text = url.Substring(num3 + "/".Length); } if (text != null) { int num4 = text.IndexOf("&", StringComparison.OrdinalIgnoreCase); if (num4 > -1) { text = text.Substring(0, num4); } int num5 = text.IndexOf("?", StringComparison.OrdinalIgnoreCase); if (num5 > -1) { text = text.Substring(0, num5); } } if (text == null || text.Trim().Length == 0) { return null; } return text; } internal static void KillAllBoomboxDownloaderProcesses() { Dictionary<ulong, BoomboxItemController> dictionary = new Dictionary<ulong, BoomboxItemController>(BoomboxItemController.boomboxItemControllers); foreach (KeyValuePair<ulong, BoomboxItemController> item in dictionary) { BoomboxItemController value = item.Value; value.boomboxAudioDownloader.CancelCurrentProcess(); } } internal static string GetOutputFileLocationWithoutExtensionForId(string id) { return YPlay.audioDirectory + "\\" + id; } internal static string GetOutputFileLocationTempForId(string id) { return GetOutputFileLocationWithoutExtensionForId(id) + ".part"; } internal static string GetOutputFileLocationForId(string id) { return GetOutputFileLocationWithoutExtensionForId(id) + "." + audioTypeExtension; } internal static string GetFilenameIdString(string filenameId) { if (filenameId == null) { return null; } return " [" + filenameId + "]"; } } internal class BoomboxAudioProcess { internal PROCESS_STATE processState; private readonly BoomboxAudioDownloader boomboxAudioDownloader; internal int requestId; internal string filenameId; internal string outputFileLocation; internal string url; internal string requestFilenameId; internal string requestOutputFileLocation; internal string requestOutputFileLocationTmp; internal string requestOutputFileLocationWithoutExt; internal Process process; internal BoomboxAudioProcess(BoomboxAudioDownloader boomboxAudioDownloader, int requestId, string filenameId, string outputFileLocation, string url) { this.boomboxAudioDownloader = boomboxAudioDownloader; this.requestId = requestId; this.filenameId = filenameId; this.outputFileLocation = outputFileLocation; this.url = url; requestFilenameId = $"{filenameId}.{YPlayCorePatch.LocalPlayerController.actualClientId}.{requestId}"; requestOutputFileLocation = BoomboxAudioDownloader.GetOutputFileLocationForId(requestFilenameId); requestOutputFileLocationTmp = BoomboxAudioDownloader.GetOutputFileLocationTempForId(requestFilenameId); requestOutputFileLocationWithoutExt = BoomboxAudioDownloader.GetOutputFileLocationWithoutExtensionForId(requestFilenameId); process = new Process(); } internal POST_TASK Start(bool resync) { process.StartInfo.FileName = YPlay.ytdlpLocation; process.StartInfo.UseShellExecute = false; process.StartInfo.Arguments = "-x --no-playlist --force-ipv4 -f 140 --audio-format " + BoomboxAudioDownloader.audioTypeExtension + " -o " + requestFilenameId + " " + url; process.StartInfo.WorkingDirectory = YPlay.audioDirectory; process.StartInfo.CreateNoWindow = true; process.StartInfo.RedirectStandardOutput = true; process.OutputDataReceived += ProcessDataHandler(); YPlayCorePatch.DrawString("Downloading" + BoomboxAudioDownloader.GetFilenameIdString(filenameId) + "..."); YPlay.CreateDirectory(YPlay.audioDirectory); try { process.Start(); process.BeginOutputReadLine(); process.WaitForExit(); if (processState == PROCESS_STATE.PROCESSING && boomboxAudioDownloader.lastDownloadRequestId == requestId) { if (BoomboxAudioDownloader.IsFilenameIdDownloaded(requestFilenameId) && !File.Exists(outputFileLocation)) { File.Move(requestOutputFileLocation, outputFileLocation); } processState = PROCESS_STATE.FINISHED; return boomboxAudioDownloader.LoadFile(filenameId, outputFileLocation, requestId, resync); } } catch (Exception) { KillProcess(); return POST_TASK.ERROR_DOWNLOADING_AUDIO; } finally { process?.Dispose(); DeleteRequestFiles(); } return POST_TASK.NONE; } internal void KillProcess() { if (processState != 0) { return; } processState = PROCESS_STATE.KILLED; try { process.Kill(); } catch (Exception) { } finally { DeleteRequestFiles(); } } private void DeleteRequestFiles() { YPlay.DeleteFile(requestOutputFileLocation); YPlay.DeleteFile(requestOutputFileLocationTmp); YPlay.DeleteFile(requestOutputFileLocationWithoutExt); } private DataReceivedEventHandler ProcessDataHandler() { return delegate(object sender, DataReceivedEventArgs e) { if (e.Data != null && e.Data.StartsWith("[ExtractAudio]") && !process.HasExited && processState == PROCESS_STATE.PROCESSING) { YPlayCorePatch.DrawString("Processing" + BoomboxAudioDownloader.GetFilenameIdString(filenameId) + "..."); } }; } } internal class BoomboxItemController : NetworkBehaviour { internal static readonly Dictionary<ulong, BoomboxItemController> boomboxItemControllers = new Dictionary<ulong, BoomboxItemController>(); private static readonly Dictionary<AudioClip, BoomboxItemController> audioClipBoomboxItemController = new Dictionary<AudioClip, BoomboxItemController>(); private static readonly Dictionary<ulong, double> clientIdsLastRequestSentMs = new Dictionary<ulong, double>(); private double lastRequestSentMs; internal BoomboxAudioDownloader boomboxAudioDownloader; internal BoomboxItem boomboxItem; internal string serverFilenameId; internal string serverUrl; internal string serverTitle; internal int serverDuration; internal float serverTime; internal string filenameId; private string url; private string title; private int duration; private float timeSaved; private float timeRequested; internal AudioType audioType = (AudioType)13; internal BoomboxRequestMetadata boomboxRequestMetadata; private CancellationTokenSource metadataCompletionCancellationTokenSource; private CancellationTokenSource requestCompletionCancellationTokenSource; private static readonly DateTime epochDateTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); internal const string BOOMBOX_SYNCED_STRING = "Boombox synced"; internal void Awake() { boomboxAudioDownloader = new BoomboxAudioDownloader(this); boomboxItem = ((Component)this).GetComponent<BoomboxItem>(); ((GrabbableObject)boomboxItem).itemProperties.requiresBattery = false; } internal void Start() { //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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0061: Unknown result type (might be due to invalid IL or missing references) ulong networkObjectId = ((NetworkBehaviour)boomboxItem).NetworkObjectId; boomboxItemControllers[networkObjectId] = this; if (Config.configEntryRandomColor.Value && IsHostOrIsOffline()) { Color randomBoomboxColor = GetRandomBoomboxColor(); if (((NetworkBehaviour)this).IsHost) { SyncBoomboxColorRequestClientRpc(randomBoomboxColor.r, randomBoomboxColor.g, randomBoomboxColor.b, ((NetworkBehaviour)this).NetworkManager.LocalClientId); } else { SyncBoomboxColorRequestClientShared(randomBoomboxColor.r, randomBoomboxColor.g, randomBoomboxColor.b, ((NetworkBehaviour)this).NetworkManager.LocalClientId); } } } internal void SendRequestServerDelegate(string url, float time) { //IL_0015: 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) if (YPlayCorePatch.IsOfflineMode()) { SendRequestServerLocal(url, time); } else { SendRequestServerRpc(url, time); } } internal void SendBoomboxLoadedServerDelegate(int requestId, bool loaded, bool resync, RLE_REASON rleReason = RLE_REASON.NONE) { //IL_001b: 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) if (YPlayCorePatch.IsOfflineMode()) { SendBoomboxLoadedServerLocal(requestId, loaded, resync, rleReason); } else { SendBoomboxLoadedServerRpc(requestId, loaded, resync, rleReason); } } internal void SyncBoomboxVolumeRequestServerDelegate(float volume, bool msg = false) { //IL_001f: 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) if (YPlayCorePatch.IsOfflineMode()) { SyncBoomboxVolumeRequestClientShared(volume, YPlayCorePatch.LocalPlayerController.actualClientId, msg); } else { SyncBoomboxVolumeRequestServerRpc(volume, msg); } } internal void SyncBoomboxColorRequestServerDelegate(float r, float g, float b) { //IL_0022: 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) if (YPlayCorePatch.IsOfflineMode()) { SyncBoomboxColorRequestClientShared(r, g, b, YPlayCorePatch.LocalPlayerController.actualClientId, msg: true); } else { SyncBoomboxColorRequestServerRpc(r, g, b); } } internal void ResetBoomboxRequestServerDelegate() { if (YPlayCorePatch.IsOfflineMode()) { ResetBoombox(); } else { ResetBoomboxRequestServerRpc(); } } internal void SyncBoomboxTimeRequestServerDelegate(float time, REQUEST_TYPE requestType = REQUEST_TYPE.NONE) { //IL_0015: 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) if (YPlayCorePatch.IsOfflineMode()) { SyncBoomboxTimeRequestServerLocal(time, requestType); } else { SyncBoomboxTimeRequestServerRpc(time, requestType); } } internal void SyncBoomboxRequestLookingAtServerDelegate(ulong boomboxLookingAtId) { //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) if (YPlayCorePatch.IsOfflineMode()) { SyncBoomboxRequestLookingAtServerLocal(boomboxLookingAtId); } else { SyncBoomboxRequestLookingAtServerRpc(boomboxLookingAtId); } } [ServerRpc(RequireOwnership = false)] internal void SendRequestServerRpc(string url, float time, ServerRpcParams serverRpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_011d: 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_0142: 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) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3425911769u, serverRpcParams, (RpcDelivery)0); bool flag = url != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(url, false); } ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref time, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3425911769u, serverRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost) || IsInvalidServerCall()) { return; } ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (ClientRequestWait(senderClientId)) { return; } if (!IsBoomboxValid(boomboxItem)) { ClientRpcParams clientRpcParams = default(ClientRpcParams); clientRpcParams.Send.TargetClientIds = new <>z__ReadOnlySingleElementList<ulong>(senderClientId); SendRequestFailedClientRpc(null, RM_STATUS.INVALID_BOOMBOX, clientRpcParams); return; } string filenameIdFromUrl = BoomboxAudioDownloader.GetFilenameIdFromUrl(url); if (url == null || url.Length == 0 || filenameIdFromUrl == null) { ClientRpcParams clientRpcParams2 = default(ClientRpcParams); clientRpcParams2.Send.TargetClientIds = new <>z__ReadOnlySingleElementList<ulong>(senderClientId); SendRequestFailedClientRpc(filenameIdFromUrl, RM_STATUS.INVALID_URL, clientRpcParams2); return; } if (!YPlay.IsToolsValid()) { ClientRpcParams clientRpcParams3 = default(ClientRpcParams); clientRpcParams3.Send.TargetClientIds = new <>z__ReadOnlySingleElementList<ulong>(senderClientId); SendRequestFailedClientRpc(filenameIdFromUrl, RM_STATUS.INVALID_TOOLS, clientRpcParams3); return; } if (boomboxRequestMetadata != null && boomboxRequestMetadata.rmStatus == RM_STATUS.INITIALIZING) { CancelBoomboxRequestServer(boomboxRequestMetadata.requestId, boomboxRequestMetadata.filenameId, senderClientId, RC_REASON.NEW_REQUEST); } DownloadMetadataServer(url, filenameIdFromUrl, time, senderClientId); } [ServerRpc(RequireOwnership = false)] internal void SendBoomboxLoadedServerRpc(int requestId, bool loaded, bool resync, RLE_REASON rleReason = RLE_REASON.NONE, ServerRpcParams serverRpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_008a: 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_00a5: 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_00c0: 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_00da: 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_0124: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1074417815u, serverRpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, requestId); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref loaded, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref resync, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<RLE_REASON>(ref rleReason, default(ForEnums)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1074417815u, serverRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost) || IsInvalidServerCall()) { return; } ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (resync && loaded) { SyncBoomboxRequestVerifyMultipleServer(resync, senderClientId); } else if (IsBoomboxRequestMetadataActive(boomboxRequestMetadata)) { if (!IsBoomboxValid(boomboxItem)) { CancelBoomboxRequestServer(requestId, boomboxRequestMetadata.filenameId, senderClientId, RC_REASON.INVALID_BOOMBOX); } else if (!YPlay.IsToolsValid()) { CancelBoomboxRequestServer(requestId, boomboxRequestMetadata.filenameId, senderClientId, RC_REASON.INVALID_TOOLS); } else { SendBoomboxLoadedCallServer(boomboxRequestMetadata, senderClientId, loaded, rleReason); } } } [ServerRpc(RequireOwnership = false)] internal void ResetBoomboxRequestServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2681523663u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2681523663u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && !IsInvalidServerCall() && IsBoomboxValid(boomboxItem)) { ResetBoomboxRequestClientRpc(); } } } [ServerRpc(RequireOwnership = false)] internal void SyncBoomboxRequestLookingAtServerRpc(ulong boomboxLookingAtId, ServerRpcParams serverRpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0089: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3702246251u, serverRpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, boomboxLookingAtId); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3702246251u, serverRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && !IsInvalidServerCall() && boomboxItemControllers.ContainsKey(boomboxLookingAtId)) { BoomboxItemController boomboxItemController = boomboxItemControllers[boomboxLookingAtId]; BoomboxItem val2 = boomboxItemController.boomboxItem; if (IsBoomboxValid(val2) && ShouldResync(boomboxItemController)) { ulong senderClientId = serverRpcParams.Receive.SenderClientId; SyncBoomboxRequestLookingAtClientRpc(boomboxLookingAtId, senderClientId); } } } [ServerRpc(RequireOwnership = false)] internal void SyncBoomboxTimeRequestServerRpc(float time, REQUEST_TYPE requestType = REQUEST_TYPE.NONE, ServerRpcParams serverRpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2185615963u, serverRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref time, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<REQUEST_TYPE>(ref requestType, default(ForEnums)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2185615963u, serverRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && !IsInvalidServerCall() && IsBoomboxValid(boomboxItem) && IsBoomboxTimeValid(time) && ShouldResyncTime(time)) { ulong senderClientId = serverRpcParams.Receive.SenderClientId; SyncBoomboxTimeRequestClientRpc(time, senderClientId, filenameId, requestType); } } } [ServerRpc(RequireOwnership = false)] internal void SyncBoomboxVolumeRequestServerRpc(float volume, bool msg, ServerRpcParams serverRpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(160244116u, serverRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref volume, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref msg, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 160244116u, serverRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && !IsInvalidServerCall() && IsBoomboxValid(boomboxItem)) { volume = Mathf.Clamp((float)Math.Round(volume, 1), 0f, 1f); if (ShouldResyncVolume(volume)) { ulong senderClientId = serverRpcParams.Receive.SenderClientId; SyncBoomboxVolumeRequestClientRpc(volume, senderClientId, msg); } } } [ServerRpc(RequireOwnership = false)] private void SyncBoomboxColorRequestServerRpc(float r, float g, float b, ServerRpcParams serverRpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_0115: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3549958353u, serverRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref r, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref g, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref b, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3549958353u, serverRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && !IsInvalidServerCall()) { ulong senderClientId = serverRpcParams.Receive.SenderClientId; SyncBoomboxColorRequestClientRpc(r, g, b, senderClientId, msg: true); } } } [ServerRpc(RequireOwnership = false)] internal void SyncAllBoomboxRequestServerRpc(ulong clientId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0089: 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_011c: 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) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_016a: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1929840421u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1929840421u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && !IsInvalidServerCall() && IsBoomboxValid(boomboxItem)) { ulong networkObjectId = ((NetworkBehaviour)boomboxItem).NetworkObjectId; BoomboxRequest boomboxRequest = GetBoomboxRequest(networkObjectId, request: true); if (boomboxRequest != null) { ClientRpcParams clientRpcParams = default(ClientRpcParams); clientRpcParams.Send.TargetClientIds = new <>z__ReadOnlySingleElementList<ulong>(clientId); SyncBoomboxVolumeRequestClientRpc(boomboxRequest.volume, 0uL, msg: false, clientRpcParams); Color boomboxBodyColor = GetBoomboxBodyColor(); SyncBoomboxColorRequestClientRpc(boomboxBodyColor.r, boomboxBodyColor.g, boomboxBodyColor.b, 0uL, msg: false, clientRpcParams); SyncBoomboxPlayingRequestClientRpc(boomboxRequest.filenameId, boomboxRequest.url, boomboxRequest.title, boomboxRequest.duration, boomboxRequest.time, boomboxRequest.isPlayingMusic, clientRpcParams); } } } private bool ClientRequestWait(ulong clientId) { //IL_005a: 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) double timeMs = GetTimeMs(); double val = 0.0; if (clientIdsLastRequestSentMs.ContainsKey(clientId)) { val = clientIdsLastRequestSentMs[clientId]; } else { clientIdsLastRequestSentMs[clientId] = timeMs; } double val2 = lastRequestSentMs; double num = Math.Max(val, val2); double num2 = timeMs - num; if (num2 <= 3000.0) { ClientRpcParams clientRpcParams = default(ClientRpcParams); clientRpcParams.Send.TargetClientIds = new <>z__ReadOnlySingleElementList<ulong>(clientId); double waitMs = Math.Max(0.0, 3000.0 - num2); SendRequestFailedWaitClientRpc(waitMs, clientRpcParams); return true; } clientIdsLastRequestSentMs[clientId] = (lastRequestSentMs = timeMs); return false; } private void SyncBoomboxRequestVerifyMultipleServer(bool resync = false, ulong clientId = 0uL) { //IL_008c: 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_0122: Unknown result type (might be due to invalid IL or missing references) if (IsInvalidServerCall()) { return; } Dictionary<ulong, BoomboxItemController> dictionary = new Dictionary<ulong, BoomboxItemController>(boomboxItemControllers); List<BoomboxItemController> list = new List<BoomboxItemController>(); foreach (KeyValuePair<ulong, BoomboxItemController> item in dictionary) { BoomboxItemController value = item.Value; if (!((Object)(object)value == (Object)null) && (resync || !((Object)(object)value == (Object)(object)this)) && !(value.filenameId != filenameId)) { list.Add(value); } } if (list.Count == 0) { return; } ClientRpcParams clientRpcParams = default(ClientRpcParams); if (resync) { clientRpcParams.Send.TargetClientIds = new <>z__ReadOnlySingleElementList<ulong>(clientId); } foreach (BoomboxItemController item2 in list) { ulong networkObjectId = ((NetworkBehaviour)item2).NetworkObjectId; BoomboxRequest boomboxRequest = item2.GetBoomboxRequest(networkObjectId); if (boomboxRequest != null) { item2.SyncBoomboxRequestVerifyMultipleClientRpc(boomboxRequest.filenameId, boomboxRequest.url, boomboxRequest.title, boomboxRequest.duration, boomboxRequest.time, boomboxRequest.isPlayingMusic, clientRpcParams); } } if (resync) { SendResyncedMessageClientRpc(clientRpcParams); } } internal void SendBoomboxLoadedCallServer(BoomboxRequestMetadata boomboxRequestMetadata, ulong clientId, bool loaded, RLE_REASON rleReason = RLE_REASON.NONE) { if (IsInvalidServerCall() || !IsBoomboxRequestMetadataActive(boomboxRequestMetadata) || !boomboxRequestMetadata.pendingClientIdRequests.Contains(clientId)) { return; } boomboxRequestMetadata.pendingClientIdRequests.Remove(clientId); int count = boomboxRequestMetadata.originalClientIdRequests.Count; int count2 = boomboxRequestMetadata.pendingClientIdRequests.Count; int loadedClientCount = Mathf.Clamp(count - count2, 0, count); SendBoomboxLoadedClientRpc(boomboxRequestMetadata.requestId, boomboxRequestMetadata.filenameId, clientId, loaded, loadedClientCount, count, rleReason); if (!loaded && clientId == YPlayCorePatch.LocalPlayerController.actualClientId) { CancelBoomboxRequestServer(boomboxRequestMetadata.requestId, boomboxRequestMetadata.filenameId, clientId, RC_REASON.HOST_FAILED); } else if (count2 == 0) { boomboxRequestMetadata.pendingClientIdRequests.Clear(); ulong networkObjectId = ((NetworkBehaviour)boomboxItem).NetworkObjectId; BoomboxRequest boomboxRequest = GetBoomboxRequest(networkObjectId, request: true); if (boomboxRequest != null) { boomboxRequest.filenameId = boomboxRequestMetadata.filenameId; boomboxRequest.url = boomboxRequestMetadata.url; boomboxRequest.title = boomboxRequestMetadata.title; boomboxRequest.duration = boomboxRequestMetadata.duration; boomboxRequest.time = boomboxRequestMetadata.time; SyncBoomboxRequestClientRpc(request: true, boomboxRequest.filenameId, boomboxRequest.url, boomboxRequest.title, boomboxRequest.duration, boomboxRequest.time, boomboxRequest.isPlayingMusic); SyncBoomboxRequestVerifyMultipleServer(resync: false, 0uL); } } } private async void DownloadMetadataServer(string url, string filenameId, float time, ulong clientId) { if (IsInvalidServerCall()) { return; } SendRequestInitialisingMessageClientRpc(clientId, filenameId); if (boomboxRequestMetadata != null) { KillRequestIdClientRpc(boomboxRequestMetadata.requestId); } CancelTimeoutTokensShared(); HashSet<ulong> collection = new HashSet<ulong>(YPlayCorePatch.modEnabledForClientIds); BoomboxRequestMetadata boomboxRequestMetadataLocal = (boomboxRequestMetadata = new BoomboxRequestMetadata { originalClientIdRequests = new HashSet<ulong>(collection), pendingClientIdRequests = new HashSet<ulong>(collection) }); CancellationTokenSource metadataCompletionCancellationTokenSourceLocal = (metadataCompletionCancellationTokenSource = new CancellationTokenSource()); Task metadataTask = boomboxAudioDownloader.DownloadMetadata(boomboxRequestMetadataLocal, url, filenameId, time); if (await Task.WhenAny(new Task[2] { metadataTask, Task.Delay(10000, metadataCompletionCancellationTokenSourceLocal.Token) }) != metadataTask) { if (metadataCompletionCancellationTokenSourceLocal.IsCancellationRequested || !IsBoomboxRequestMetadataActive(boomboxRequestMetadataLocal)) { return; } SendRequestFailedClientRpc(filenameId, boomboxRequestMetadataLocal.rmStatus = RM_STATUS.TIMEOUT); } if (boomboxRequestMetadataLocal.rmStatus != RM_STATUS.VALID) { SendRequestFailedClientRpc(filenameId, boomboxRequestMetadataLocal.rmStatus); return; } DownloadTaskClientRpc(boomboxRequestMetadataLocal.requestId, boomboxRequestMetadataLocal.filenameId, boomboxRequestMetadataLocal.title, boomboxRequestMetadataLocal.duration, boomboxRequestMetadataLocal.url, time); CancellationTokenSource requestCompletionCancellationTokenSourceLocal = (requestCompletionCancellationTokenSource = new CancellationTokenSource()); int num = 30000; Task requestCompletionTimeoutTask = RequestCompletionTimeoutTask(num); if (await Task.WhenAny(new Task[2] { requestCompletionTimeoutTask, Task.Delay(num, requestCompletionCancellationTokenSourceLocal.Token) }) == requestCompletionTimeoutTask || requestCompletionCancellationTokenSourceLocal.IsCancellationRequested || !IsBoomboxRequestMetadataActive(boomboxRequestMetadataLocal)) { return; } ulong actualClientId = YPlayCorePatch.LocalPlayerController.actualClientId; HashSet<ulong> hashSet = new HashSet<ulong>(); foreach (ulong pendingClientIdRequest in boomboxRequestMetadataLocal.pendingClientIdRequests) { hashSet.Add(pendingClientIdRequest); } HashSet<ulong> hashSet2 = hashSet; if (hashSet2.Contains(YPlayCorePatch.LocalPlayerController.actualClientId)) { hashSet2 = new HashSet<ulong> { actualClientId }; } foreach (ulong item in hashSet2) { SendBoomboxLoadedCallServer(boomboxRequestMetadataLocal, item, loaded: false, RLE_REASON.TIMEOUT); } } private async Task RequestCompletionTimeoutTask(int timeout) { await Task.Run(delegate { Thread.Sleep(timeout); }); } private void CancelBoomboxRequestServer(int requestId, string filenameId, ulong clientId, RC_REASON rcReason) { if (!IsInvalidServerCall()) { CancelBoomboxServer(requestId); SendBoomboxRequestCancelledMessageClientRpc(filenameId, clientId, rcReason); } } private void CancelBoomboxServer(int requestId) { if (!IsInvalidServerCall()) { if (boomboxRequestMetadata != null && boomboxRequestMetadata.requestId == requestId) { boomboxRequestMetadata.rmStatus = RM_STATUS.CANCELLED; boomboxRequestMetadata.pendingClientIdRequests.Clear(); CancelSendLoadedTimerShared(); } ClearPreviousAudioClipClientRpc(); } } public override void OnDestroy() { if (!IsInvalidServerCall()) { if (boomboxRequestMetadata != null) { CancelBoomboxServer(boomboxRequestMetadata.requestId); } ((NetworkBehaviour)this).OnDestroy(); } } [ClientRpc] private void KillRequestIdClientRpc(int requestId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0089: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3126721376u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, requestId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3126721376u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !IsInvalidClientCall()) { boomboxAudioDownloader.KillRequestId(requestId); } } } [ClientRpc] private void ClearPreviousAudioClipClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(995995495u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 995995495u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !IsInvalidClientCall()) { ClearUnusedAudioClips(); } } } [ClientRpc] private void SyncBoomboxRequestLookingAtClientRpc(ulong boomboxLookingAtId, ulong clientId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3898947593u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, boomboxLookingAtId); BytePacker.WriteValueBitPacked(val2, clientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3898947593u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !IsInvalidClientCall()) { SyncBoomboxRequestLookingAtClientShared(boomboxLookingAtId, clientId); } } } [ClientRpc] private void SendRequestInitialisingMessageClientRpc(ulong clientId, string filenameId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0095: 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_00c7: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2497770173u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); bool flag = filenameId != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(filenameId, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2497770173u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !IsInvalidClientCall()) { string playerUsernameFromClientId = YPlayCorePatch.GetPlayerUsernameFromClientId(clientId); YPlayCorePatch.DrawString(playerUsernameFromClientId + " requested [" + filenameId + "]..."); } } [ClientRpc] private void SendResyncedMessageClientRpc(ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3136043952u, clientRpcParams, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3136043952u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !IsInvalidClientCall()) { YPlayCorePatch.DrawString("Resync successful"); } } } [ClientRpc] private void DownloadTaskClientRpc(int requestId, string filenameId, string title, int duration, string url, float time) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0095: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(923605557u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, requestId); bool flag = filenameId != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(filenameId, false); } bool flag2 = title != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe(title, false); } BytePacker.WriteValueBitPacked(val2, duration); bool flag3 = url != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag3, default(ForPrimitives)); if (flag3) { ((FastBufferWriter)(ref val2)).WriteValueSafe(url, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref time, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 923605557u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !IsInvalidClientCall()) { DownloadTaskClientShared(requestId, filenameId, title, duration, url, time); } } [ClientRpc] private void SendRequestFailedClientRpc(string filenameId, RM_STATUS rmStatus, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2668383935u, clientRpcParams, (RpcDelivery)0); bool flag = filenameId != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(filenameId, false); } ((FastBufferWriter)(ref val)).WriteValueSafe<RM_STATUS>(ref rmStatus, default(ForEnums)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2668383935u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !IsInvalidClientCall()) { SendRequestFailedClientShared(filenameId, rmStatus); } } [ClientRpc] private void SendRequestFailedWaitClientRpc(double waitMs, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(115722075u, clientRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<double>(ref waitMs, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 115722075u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !IsInvalidClientCall()) { int num = Math.Max(1, (int)Math.Ceiling(TimeSpan.FromMilliseconds(waitMs).TotalSeconds)); YPlayCorePatch.DrawString(string.Format("Please wait {0} second{1} before calling this command", num, (num == 1) ? null : "s")); } } } [ClientRpc] private void SendBoomboxRequestCancelledMessageClientRpc(string filenameId, ulong clientId, RC_REASON rcReason) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_008e: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4201653590u, val, (RpcDelivery)0); bool flag = filenameId != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(filenameId, false); } BytePacker.WriteValueBitPacked(val2, clientId); ((FastBufferWriter)(ref val2)).WriteValueSafe<RC_REASON>(ref rcReason, default(ForEnums)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4201653590u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !IsInvalidClientCall()) { SendBoomboxRequestCancelledMessageClientShared(filenameId, rcReason); } } [ClientRpc] private void SendBoomboxLoadedClientRpc(int requestId, string filenameId, ulong clientId, bool loaded, int loadedClientCount, int originalRequestCount, RLE_REASON rleReason) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0095: 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_00bc: 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_00db: 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_00f1: 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) //IL_0110: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3390314703u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, requestId); bool flag = filenameId != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(filenameId, false); } BytePacker.WriteValueBitPacked(val2, clientId); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref loaded, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, loadedClientCount); BytePacker.WriteValueBitPacked(val2, originalRequestCount); ((FastBufferWriter)(ref val2)).WriteValueSafe<RLE_REASON>(ref rleReason, default(ForEnums)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3390314703u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !IsInvalidClientCall()) { SendBoomboxLoadedClientShared(requestId, filenameId, clientId, loaded, loadedClientCount, originalRequestCount, rleReason); } } [ClientRpc] private void ResetBoomboxRequestClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3381308416u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3381308416u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !IsInvalidClientCall()) { ResetBoombox(); } } } [ClientRpc] private void SyncBoomboxRequestClientRpc(bool request, string filenameId, string url, string title, int duration, float time, bool isPlayingMusic) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0083: 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_00a9: 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_00e7: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_015f: 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_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3399703514u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref request, default(ForPrimitives)); bool flag = filenameId != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(filenameId, false); } bool flag2 = url != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe(url, false); } bool flag3 = title != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag3, default(ForPrimitives)); if (flag3) { ((FastBufferWriter)(ref val2)).WriteValueSafe(title, false); } BytePacker.WriteValueBitPacked(val2, duration); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref time, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isPlayingMusic, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3399703514u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !IsInvalidClientCall()) { SyncBoomboxRequestClientShared(request, filenameId, url, title, duration, time, isPlayingMusic); } } [ClientRpc] private void SyncBoomboxRequestVerifyMultipleClientRpc(string filenameId, string url, string title, int duration, float time, bool isPlayingMusic, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_008e: 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_00cc: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_015f: 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_0179: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1261714853u, clientRpcParams, (RpcDelivery)0); bool flag = filenameId != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(filenameId, false); } bool flag2 = url != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val)).WriteValueSafe(url, false); } bool flag3 = title != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag3, default(ForPrimitives)); if (flag3) { ((FastBufferWriter)(ref val)).WriteValueSafe(title, false); } BytePacker.WriteValueBitPacked(val, duration); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref time, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref isPlayingMusic, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1261714853u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !IsInvalidClientCall() && !(filenameId == this.filenameId)) { AudioClip audioClipFromFilenameId = GetAudioClipFromFilenameId(filenameId); SyncBoombox(request: false, filenameId, url, title, duration, time, audioClipFromFilenameId, isPlayingMusic, autoRequestPlayState: false); ClearUnusedAudioClips(); } } [ClientRpc] private void SyncBoomboxTimeRequestClientRpc(float time, ulong clientId, string filenameId, REQUEST_TYPE requestType) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0083: 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_00b0: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1175447752u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref time, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, clientId); bool flag = filenameId != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(filenameId, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe<REQUEST_TYPE>(ref requestType, default(ForEnums)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1175447752u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !IsInvalidClientCall()) { SyncBoomboxTimeRequestClientShared(time, clientId, filenameId, requestType); } } [ClientRpc] internal void SyncBoomboxVolumeRequestClientRpc(float volume, ulong clientId, bool msg = false, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0083: 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_00a5: 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_00bf: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1318585972u, clientRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref volume, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val, clientId); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref msg, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1318585972u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !IsInvalidClientCall()) { SyncBoomboxVolumeRequestClientShared(volume, clientId, msg); } } } [ClientRpc] internal void SyncBoomboxColorRequestClientRpc(float r, float g, float b, ulong clientId, bool msg = false, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00db: 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_00f5: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2294642094u, clientRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref r, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref g, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref b, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val, clientId); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref msg, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2294642094u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !IsInvalidClientCall()) { SyncBoomboxColorRequestClientShared(r, g, b, clientId, msg); } } } [ClientRpc] internal void SyncBoomboxPlayingRequestClientRpc(string filenameId, string url, string title, int duration, float time, bool isPlayingMusic, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_008e: 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_00cc: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_015f: 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_0179: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1911341357u, clientRpcParams, (RpcDelivery)0); bool flag = filenameId != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(filenameId, false); } bool flag2 = url != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val)).WriteValueSafe(url, false); } bool flag3 = title != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag3, default(ForPrimitives)); if (flag3) { ((FastBufferWriter)(ref val)).WriteValueSafe(title, false); } BytePacker.WriteValueBitPacked(val, duration); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref time, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref isPlayingMusic, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1911341357u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !IsInvalidClientCall() && IsBoomboxValid(boomboxItem)) { AudioClip audioClipFromFilenameId = GetAudioClipFromFilenameId(filenameId); if (!Object.op_Implicit((Object)(object)audioClipFromFilenameId)) { ResetAudioClip(); } SyncBoombox(request: false, filenameId, url, title, duration, time, audioClipFromFilenameId, isPlayingMusic && !boomboxItem.isPlayingMusic); } } internal void PlayBoombox(float forceTime = 0f) { if (!IsBoomboxValid(boomboxItem)) { return; } AudioClip clip = boomboxItem.boomboxAudio.clip; if (!Config.configEntrySync.Value && (Object)(object)clip != (Object)null) { if (audioClipBoomboxItemController.ContainsKey(clip)) { BoomboxItemController boomboxItemController = audioClipBoomboxItemController[clip]; if ((Object)(object)boomboxItemController != (Object)(object)this && IsBoomboxValid(boomboxItemController.boomboxItem) && filenameId != null && boomboxItemController.filenameId == filenameId && boomboxItemController.boomboxItem.isPlayingMusic) { boomboxItemController.StopBoombox(); } } audioClipBoomboxItemController[clip] = this; } if (!IsAudioLoadedInMemory()) { boomboxItem.boomboxAudio.time = 0f; } else if (forceTime > 0f) { boomboxItem.boomboxAudio.time = forceTime; } else if (timeSaved > 0f) { boomboxItem.boomboxAudio.time = timeSaved; } boomboxItem.boomboxAudio.pitch = 1f; boomboxItem.boomboxAudio.Play(); boomboxItem.isPlayingMusic = (((GrabbableObject)boomboxItem).isBeingUsed = true); } internal void StopBoombox(float forceTime = 0f) { //IL_008c: 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) if (IsBoomboxValid(boomboxItem)) { if (!IsAudioLoadedInMemory()) { boomboxItem.boomboxAudio.time = (timeSaved = 0f); } else if (forceTime > 0f) { boomboxItem.boomboxAudio.time = (timeSaved = forceTime); } else { timeSaved = boomboxItem.boomboxAudio.time; } if (((NetworkBehaviour)this).IsHost) { SyncBoomboxTimeRequestServerRpc(boomboxItem.boomboxAudio.time, REQUEST_TYPE.STOP); } bool isPlayingMusic = boomboxItem.isPlayingMusic; boomboxItem.boomboxAudio.Stop(); if (isPlayingMusic) { boomboxItem.boomboxAudio.PlayOneShot(boomboxItem.stopAudios[Random.Range(0, boomboxItem.stopAudios.Length)]); } boomboxItem.isPlayingMusic = (((GrabbableObject)boomboxItem).isBeingUsed = false); } } private void ResetBoombox(float forceTime = 0f) { if (IsBoomboxValid(boomboxItem)) { if (!IsAudioLoadedInMemory()) { forceTime = 0f; } boomboxItem.boomboxAudio.time = (timeSaved = forceTime); if (boomboxItem.isPlayingMusic) { StopBoombox(); } } } private REQUEST_STATE SyncBoombox(bool request, string filenameId, string url, string title, int duration, float time, AudioClip audioClip, bool isPlayingMusic, bool autoRequestPlayState = true) { serverFilenameId = filenameId; serverUrl = url; serverTitle = title; serverDuration = duration; serverTime = time; if (!IsBoomboxValid(boomboxItem)) { return REQUEST_STATE.FAILURE; } if (Object.op_Implicit((Object)(object)audioClip)) { this.filenameId = filenameId; this.url = url; this.title = title; this.duration = duration; boomboxItem.boomboxAudio.clip = audioClip; boomboxItem.boomboxAudio.time = (timeSaved = (timeRequested = Mathf.Clamp(time, 0f, boomboxItem.boomboxAudio.clip.length))); } else { ResetAudioClip(); } time = boomboxItem.boomboxAudio.time; if (request && autoRequestPlayState) { if (((GrabbableObject)boomboxItem).isHeld) { if (isPlayingMusic) { ResetBoombox(time); } return REQUEST_STATE.SUCCESS; } PlayBoombox(); return REQUEST_STATE.AUTO_PLAY; } if (isPlayingMusic) { PlayBoombox(time); } else { StopBoombox(time); } return REQUEST_STATE.SUCCESS; } internal static float FloorRoundOneDecimalPlace(float f) { return Mathf.Floor(f * 10f) * 0.1f; } private static double GetTimeMs() { return DateTime.UtcNow.ToUniversalTime().Subtract(epochDateTime).TotalMilliseconds; } internal static bool IsBoomboxValid(BoomboxItem boomboxItem) { if (Object.op_Implicit((Object)(object)boomboxItem)) { return ((Behaviour)boomboxItem).isActiveAndEnabled; } return false; } internal static bool IsBoomboxHeldByUs(BoomboxItem boomboxItem) { if (IsBoomboxValid(boomboxItem)) { if (Object.op_Implicit((Object)(object)YPlayCorePatch.LocalPlayerController) && Object.op_Implicit((Object)(object)((GrabbableObject)boomboxItem).playerHeldBy)) { return (Object)(object)((GrabbableObject)boomboxItem).playerHeldBy == (Object)(object)YPlayCorePatch.LocalPlayerController; } return false; } return false; } internal static bool IsBoomboxHeldBySomeoneElse(BoomboxItem boomboxItem) { if (IsBoomboxValid(boomboxItem)) { if (Object.op_Implicit((Object)(object)YPlayCorePatch.LocalPlayerController) && Object.op_Implicit((Object)(object)((GrabbableObject)boomboxItem).playerHeldBy)) { return (Object)(object)((GrabbableObject)boomboxItem).playerHeldBy != (Object)(object)YPlayCorePatch.LocalPlayerController; } return false; } return false; } internal static bool IsBoomboxHeldBySomeoneElseOrUnattended(BoomboxItem boomboxItem) { if (IsBoomboxValid(boomboxItem)) { if (!IsBoomboxHeldBySomeoneElse(boomboxItem)) { return !((GrabbableObject)boomboxItem).isHeld; } return true; } return false; } internal static Color GetRandomBoomboxColor() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) float num = Random.Range(0f, 1f); float num2 = Random.Range(0f, 1f); float num3 = Random.Range(0f, 1f); return new Color(num, num2, num3); } internal static BoomboxItem GetHeldBoomboxItem(PlayerControllerB playerControllerB) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)playerControllerB)) { return null; } if (playerControllerB.currentItemSlot >= playerControllerB.ItemSlots.Length)