Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Wendigos Voice Cloning v2.0.5
Wendigos.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.CodeDom.Compiler; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Net.Http; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Threading; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Microsoft.Extensions.AI; using NAudio.CoreAudioApi; using NAudio.Lame; using NAudio.Wave; using TimShaw.VoiceBox.Components; using TimShaw.VoiceBox.Core; using TimShaw.VoiceBox.Data; using TimShaw.VoiceBox.GUI; using TimShaw.VoiceBox.Generics; using TimShaw.VoiceBox.Modding; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.SceneManagement; using Wendigos.NetcodePatcher; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("Wendigos")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Voice Cloning Mod for Lethal Company")] [assembly: AssemblyFileVersion("2.0.5.0")] [assembly: AssemblyInformationalVersion("2.0.5")] [assembly: AssemblyProduct("Wendigos")] [assembly: AssemblyTitle("Wendigos")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.5.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] [CompilerGenerated] internal sealed class <>z__ReadOnlySingleElementList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator<T> { object IEnumerator.Current => _item; T IEnumerator<T>.Current => _item; public Enumerator(T item) { _item = item; } bool IEnumerator.MoveNext() { if (!_moveNextCalled) { return _moveNextCalled = true; } return false; } void IEnumerator.Reset() { _moveNextCalled = false; } void IDisposable.Dispose() { } } int ICollection.Count => 1; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection<T>.Count => 1; T IReadOnlyList<T>.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } } int ICollection<T>.Count => 1; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } public <>z__ReadOnlySingleElementList(T item) { _item = item; } IEnumerator IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.CopyTo(Array array, int index) { array.SetValue(_item, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return EqualityComparer<T>.Default.Equals(_item, (T)value); } int IList.IndexOf(object value) { if (!EqualityComparer<T>.Default.Equals(_item, (T)value)) { return -1; } return 0; } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return new Enumerator(_item); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return EqualityComparer<T>.Default.Equals(_item, item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { array[arrayIndex] = _item; } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { if (!EqualityComparer<T>.Default.Equals(_item, item)) { return -1; } return 0; } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public static class SavWav { private const uint HeaderSize = 44u; private const float RescaleFactor = 32767f; public static void Save(string filename, AudioClip clip, bool trim = false) { if (!filename.ToLower().EndsWith(".wav")) { filename += ".wav"; } string path = Path.Combine(Application.persistentDataPath, filename); Directory.CreateDirectory(Path.GetDirectoryName(path)); using FileStream output = new FileStream(path, FileMode.Create); using BinaryWriter binaryWriter = new BinaryWriter(output); uint length; byte[] wav = GetWav(clip, out length, trim); binaryWriter.Write(wav, 0, (int)length); } public static byte[] GetWav(AudioClip clip, out uint length, bool trim = false) { uint samplesAfterTrimming; byte[] array = ConvertAndWrite(clip, out length, out samplesAfterTrimming, trim); WriteHeader(array, clip, length, samplesAfterTrimming); return array; } private static byte[] ConvertAndWrite(AudioClip clip, out uint length, out uint samplesAfterTrimming, bool trim) { float[] array = new float[clip.samples * clip.channels]; clip.GetData(array, 0); int num = array.Length; int num2 = 0; int num3 = num - 1; if (trim) { for (int i = 0; i < num; i++) { if ((short)(array[i] * 32767f) != 0) { num2 = i; break; } } for (int num4 = num - 1; num4 >= 0; num4--) { if ((short)(array[num4] * 32767f) != 0) { num3 = num4; break; } } } byte[] array2 = new byte[(long)(num * 2) + 44L]; uint num5 = 44u; for (int j = num2; j <= num3; j++) { short num6 = (short)(array[j] * 32767f); array2[num5++] = (byte)num6; array2[num5++] = (byte)(num6 >> 8); } length = num5; samplesAfterTrimming = (uint)(num3 - num2 + 1); return array2; } private static void AddDataToBuffer(byte[] buffer, ref uint offset, byte[] addBytes) { foreach (byte b in addBytes) { buffer[offset++] = b; } } private static void WriteHeader(byte[] stream, AudioClip clip, uint length, uint samples) { int frequency = clip.frequency; ushort num = (ushort)clip.channels; uint offset = 0u; byte[] bytes = Encoding.UTF8.GetBytes("RIFF"); AddDataToBuffer(stream, ref offset, bytes); byte[] bytes2 = BitConverter.GetBytes(length - 8); AddDataToBuffer(stream, ref offset, bytes2); byte[] bytes3 = Encoding.UTF8.GetBytes("WAVE"); AddDataToBuffer(stream, ref offset, bytes3); byte[] bytes4 = Encoding.UTF8.GetBytes("fmt "); AddDataToBuffer(stream, ref offset, bytes4); byte[] bytes5 = BitConverter.GetBytes(16u); AddDataToBuffer(stream, ref offset, bytes5); byte[] bytes6 = BitConverter.GetBytes((ushort)1); AddDataToBuffer(stream, ref offset, bytes6); byte[] bytes7 = BitConverter.GetBytes(num); AddDataToBuffer(stream, ref offset, bytes7); byte[] bytes8 = BitConverter.GetBytes((uint)frequency); AddDataToBuffer(stream, ref offset, bytes8); byte[] bytes9 = BitConverter.GetBytes((uint)(frequency * num * 2)); AddDataToBuffer(stream, ref offset, bytes9); ushort value = (ushort)(num * 2); AddDataToBuffer(stream, ref offset, BitConverter.GetBytes(value)); byte[] bytes10 = BitConverter.GetBytes((ushort)16); AddDataToBuffer(stream, ref offset, bytes10); byte[] bytes11 = Encoding.UTF8.GetBytes("data"); AddDataToBuffer(stream, ref offset, bytes11); byte[] bytes12 = BitConverter.GetBytes(samples * 2); AddDataToBuffer(stream, ref offset, bytes12); } } namespace Wendigos { public static class AudioUtils { public static void CopyTo(this AudioSource original, AudioSource destination) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) destination.volume = original.volume; destination.pitch = original.pitch; destination.spatialBlend = original.spatialBlend; destination.dopplerLevel = original.dopplerLevel; destination.spread = original.spread; destination.rolloffMode = original.rolloffMode; destination.minDistance = original.minDistance; destination.maxDistance = original.maxDistance; destination.priority = original.priority; destination.outputAudioMixerGroup = original.outputAudioMixerGroup; destination.bypassEffects = original.bypassEffects; destination.bypassListenerEffects = original.bypassListenerEffects; destination.bypassReverbZones = original.bypassReverbZones; } public static void CopyOcclusion(this OccludeAudio original, GameObject destination) { if (!((Object)(object)original == (Object)null)) { OccludeAudio obj = destination.AddComponent<OccludeAudio>(); obj.useReverb = original.useReverb; obj.overridingLowPass = original.overridingLowPass; obj.lowPassOverride = original.lowPassOverride; obj.debugLog = original.debugLog; } } public static void AudioClipToMp3File(AudioClip clip, string name, string path) { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown if (name.EndsWith(".mp3", StringComparison.OrdinalIgnoreCase)) { name = name.Substring(0, name.Length - 4); } string text = Path.Combine(path, name + ".mp3"); float[] array = new float[clip.samples * clip.channels]; clip.GetData(array, 0); byte[] array2 = new byte[array.Length * 2]; int num = 0; for (int i = 0; i < array.Length; i++) { short num2 = (short)(Mathf.Clamp(array[i], -1f, 1f) * 32767f); array2[num++] = (byte)((uint)num2 & 0xFFu); array2[num++] = (byte)((uint)(num2 >> 8) & 0xFFu); } WaveFormat val = new WaveFormat(clip.frequency, 16, clip.channels); using MemoryStream memoryStream = new MemoryStream(array2); RawSourceWaveStream val2 = new RawSourceWaveStream((Stream)memoryStream, val); try { LameMP3FileWriter val3 = new LameMP3FileWriter(text, val, (LAMEPreset)1001, (ID3TagData)null); try { ((Stream)(object)val2).CopyTo((Stream)(object)val3); } finally { ((IDisposable)val3)?.Dispose(); } } finally { ((IDisposable)val2)?.Dispose(); } } public static byte[] AudioClipToMp3Data(AudioClip clip) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown float[] array = new float[clip.samples * clip.channels]; clip.GetData(array, 0); byte[] array2 = new byte[array.Length * 2]; int num = 0; for (int i = 0; i < array.Length; i++) { short num2 = (short)(Mathf.Clamp(array[i], -1f, 1f) * 32767f); array2[num++] = (byte)((uint)num2 & 0xFFu); array2[num++] = (byte)((uint)(num2 >> 8) & 0xFFu); } WaveFormat val = new WaveFormat(clip.frequency, 16, clip.channels); using MemoryStream memoryStream = new MemoryStream(); LameMP3FileWriter val2 = new LameMP3FileWriter((Stream)memoryStream, val, (LAMEPreset)1001, (ID3TagData)null); try { ((Stream)(object)val2).Write(array2, 0, array2.Length); } finally { ((IDisposable)val2)?.Dispose(); } return memoryStream.ToArray(); } } internal static class ElevenLabs { private const string baseDir = ".\\"; private const string baseURL = "https://api.elevenlabs.io/v1/text-to-speech/"; public static string VOICE_ID; public static float masked_volume = 0f; public static Dictionary<string, TTSManager> ttsManagerComponents = new Dictionary<string, TTSManager>(); public static void Init(string api_key, string voice_id, float volumeBoost) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown try { if (!(voice_id == string.Empty) && !ttsManagerComponents.ContainsKey(voice_id)) { Console.WriteLine("[Wendigos TTS] Creating TTS manager object. Disregard \"Service config is null\" errors."); GameObject val = new GameObject("wendigosTtsManager" + voice_id); ttsManagerComponents.TryAdd(voice_id, val.AddComponent<TTSManager>()); ElevenlabsTTSServiceConfig val2 = ModdingTools.CreateTTSServiceConfig<ElevenlabsTTSServiceConfig>(); val2.voiceId = voice_id; val2.modelID = "eleven_flash_v2_5"; if (api_key.Length == 0) { Console.WriteLine("[Wendigos TTS] No Elevenlabs API key found. Attempting to load from environment variable " + ((GenericTTSServiceConfig)val2).apiKeyJSONString + " ..."); ModdingTools.InitTTSManagerObject(ttsManagerComponents[voice_id], (GenericTTSServiceConfig)(object)val2, "", (string)null); } else { ModdingTools.InitTTSManagerObject(ttsManagerComponents[voice_id], (GenericTTSServiceConfig)(object)val2, "", api_key); } VOICE_ID = voice_id; masked_volume = volumeBoost; Console.WriteLine("[Wendigos TTS] Created TTS manager."); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } public static void ConvertMp3ToWav(string _inPath_, string _outPath_) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown Mp3FileReader val = new Mp3FileReader(_inPath_); try { WaveStream val2 = WaveFormatConversionStream.CreatePcmStream((WaveStream)(object)val); try { WaveFileWriter.CreateWaveFile(_outPath_, (IWaveProvider)(object)val2); } finally { ((IDisposable)val2)?.Dispose(); } } finally { ((IDisposable)val)?.Dispose(); } } public static void IncreaseVolume(string inputPath, string outputPath, double db) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown double num = Math.Pow(10.0, db / 10.0); WaveFileReader val = new WaveFileReader(inputPath); try { new VolumeWaveProvider16((IWaveProvider)(object)val); WaveFileWriter val2 = new WaveFileWriter(outputPath, ((WaveStream)val).WaveFormat); try { while (true) { float[] array = val.ReadNextSampleFrame(); if (array == null) { break; } float num2 = array[0] * (float)num; if (num2 < -0.6f) { num2 = -0.6f; } if (num2 > 0.6f) { num2 = 0.6f; } val2.WriteSample(array[0] * (float)num); } } finally { ((IDisposable)val2)?.Dispose(); } } finally { ((IDisposable)val)?.Dispose(); } } public static void RequestAudio(string prompt, string voiceID, string fileName, string dir, int fileNum, Action<string> onSuccess) { while (File.Exists(Path.Combine(dir, fileName + fileNum))) { fileNum++; } fileName += fileNum; ttsManagerComponents[voiceID].GenerateSpeechFileFromText(prompt, fileName, dir, (Action<string>)delegate { onSuccess(dir + fileName + ".mp3"); }, (Action<string>)delegate(string err) { Debug.LogError((object)err); }, default(CancellationToken)); } public static void StreamAudio(string prompt, string voiceID, AudioStreamer audioStreamer) { audioStreamer.StopStreaming(ttsManagerComponents[voiceID].TextToSpeechService); ((Component)audioStreamer).GetComponent<AudioSource>().volume = ((masked_volume > 1f) ? 1f : masked_volume); GenericTTSServiceConfig textToSpeechConfig = ttsManagerComponents[voiceID].textToSpeechConfig; Console.WriteLine(((ElevenlabsTTSServiceConfig)((textToSpeechConfig is ElevenlabsTTSServiceConfig) ? textToSpeechConfig : null)).voiceId); ttsManagerComponents[voiceID].RequestAudioAndStream(prompt, audioStreamer); } public static void StreamAudioChunk(string promptChunk, string voiceID, bool isFinalSegment, AudioStreamer audioStreamer) { ((Component)audioStreamer).GetComponent<AudioSource>().volume = ((masked_volume > 1f) ? 1f : masked_volume); try { ttsManagerComponents[voiceID].RequestAudioAndStream(promptChunk, isFinalSegment, audioStreamer); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } GenericTTSServiceConfig textToSpeechConfig = ttsManagerComponents[voiceID].textToSpeechConfig; Console.WriteLine(promptChunk + " : " + ((ElevenlabsTTSServiceConfig)((textToSpeechConfig is ElevenlabsTTSServiceConfig) ? textToSpeechConfig : null)).voiceId); } } [BepInPlugin("Wendigos", "Wendigos", "2.0.5")] public class Plugin : BaseUnityPlugin { public class WendigosNetworkManager : NetworkBehaviour { public static WendigosNetworkManager Instance { get; private set; } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); ((NetworkBehaviour)this).NetworkManager.OnClientConnectedCallback += OnClientConnectedCallback; ShareVoiceIDServerRpc(NetworkManager.Singleton.LocalClientId, TTS_voice_id.Value); ShareNameServerRpc(NetworkManager.Singleton.LocalClientId, player_name.Value); } private void OnClientConnectedCallback(ulong obj) { if (!((NetworkBehaviour)this).IsServer) { return; } foreach (ulong connectedClientsId in NetworkManager.Singleton.ConnectedClientsIds) { _ = connectedClientsId; ulong[] array = clientVoiceIDLookup.Keys.ToArray(); foreach (ulong num in array) { ShareVoiceIDClientRpc(num, clientVoiceIDLookup[num]); } array = clientNameLookup.Keys.ToArray(); foreach (ulong num2 in array) { ShareNameClientRpc(num2, clientNameLookup[num2]); } } WriteToConsole(clientVoiceIDLookup.Values.ToArray().ToString()); WriteToConsole(clientNameLookup.Values.ToArray().ToString()); if (enable_config_sync.Value) { PromptToShareDataWithClients(); } } internal static void ClientConnectInitializer(Scene sceneName, LoadSceneMode sceneEnum) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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: Expected O, but got Unknown Scene val = sceneName; if (((Scene)(ref val)).name == "SampleSceneRelay") { uint num = BitConverter.ToUInt32(MD5.Create().ComputeHash(Encoding.UTF8.GetBytes("Wendigos.MyNetworkPrefab"))); GameObject val2 = new GameObject("WendigosMessageHandler"); val2.AddComponent<WendigosNetworkManager>(); val2.AddComponent<NetworkObject>(); PropertyInfo? property = typeof(NetworkObject).GetProperty("NetworkObjectId", BindingFlags.Instance | BindingFlags.Public); WriteToConsole((property == null).ToString() ?? ""); property.SetValue(val2.GetComponent<NetworkObject>(), (ulong)num); WriteToConsole("NETWORK MANAGER ID IS " + val2.GetComponent<NetworkObject>().NetworkObjectId); FieldInfo? field = typeof(NetworkObject).GetField("GlobalObjectIdHash", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); WriteToConsole((field == null).ToString() ?? ""); field.SetValue(val2.GetComponent<NetworkObject>(), num); } } private void Awake() { if ((Object)(object)Instance != (Object)null) { Object.Destroy((Object)(object)this); } else { Instance = this; } } private void Update() { Action result; while (MainThreadInvoker._actions.TryDequeue(out result)) { result(); } } public override void OnNetworkDespawn() { STT.StopSpeechTranscription(); WendigosChatManager.chats.Clear(); ElevenLabs.ttsManagerComponents.Clear(); sharedMaskedClientDict.Clear(); clientNameLookup.Clear(); clientVoiceIDLookup.Clear(); STT.speakingClips.Clear(); ((NetworkBehaviour)this).NetworkManager.OnClientConnectedCallback -= OnClientConnectedCallback; } [ClientRpc] public void SetMaskedSuitClientRpc(string maskedId, int suitid) { //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_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_010c: 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_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 != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1082237979u, val, (RpcDelivery)0); bool flag = maskedId != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(maskedId, false); } BytePacker.WriteValueBitPacked(val2, suitid); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1082237979u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; string maskedId2 = maskedId; int suitid2 = suitid; try { Task.Run(() => WaitThenSetSuit(maskedId2, suitid2)); } catch (Exception ex) { WriteToConsole("Error trying to set masked suit: " + ex.Message); } } private async Task WaitThenSetSuit(string maskedId, int suitid) { for (int attempts = 0; attempts < 3; attempts++) { if (maskedInstanceLookup.Keys.Contains(maskedId)) { break; } await Task.Delay(100); } maskedInstanceLookup[maskedId].SetSuit(suitid); } [ServerRpc(RequireOwnership = false)] public void AddToMaskedClientDictServerRpc(string maskedID, 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_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_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_010c: 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_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 != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1451840012u, val, (RpcDelivery)0); bool flag = maskedID != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(maskedID, false); } BytePacker.WriteValueBitPacked(val2, clientID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1451840012u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; AddToMaskedClientDictClientRpc(maskedID, clientID); } } [ClientRpc] public void AddToMaskedClientDictClientRpc(string maskedID, 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_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_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_010c: 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_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 != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1980800722u, val, (RpcDelivery)0); bool flag = maskedID != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(maskedID, false); } BytePacker.WriteValueBitPacked(val2, clientID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1980800722u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; string maskedID2 = maskedID; WriteToConsole("Trying to add masked to masked_client_dict"); if (sharedMaskedClientDict.TryAdd(maskedID2, clientID)) { WriteToConsole("Added masked " + maskedID2 + " to masked_client_dict"); } else { WriteToConsole("Failed to add masked " + maskedID2 + " to masked_client_dict"); } Task.Run(() => WaitThenInitMaskedTTS(maskedID2)); } } private async Task WaitThenInitMaskedTTS(string maskedId) { for (int attempts = 0; attempts < 3; attempts++) { if (maskedInstanceLookup.Keys.Contains(maskedId)) { break; } await Task.Delay(100); } MainThreadInvoker.Enqueue(delegate { InitMaskedTTS(maskedInstanceLookup[maskedId]); }); } [ServerRpc(RequireOwnership = false)] public void ShareVoiceIDServerRpc(ulong clientID, string VoiceID) { //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_010c: 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 != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(888146200u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientID); bool flag = VoiceID != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(VoiceID, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 888146200u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (!clientVoiceIDLookup.ContainsKey(clientID)) { clientVoiceIDLookup.Add(clientID, VoiceID); WriteToConsole("Server added " + clientID + " " + VoiceID); } else { if (clientVoiceIDLookup[clientID] == "") { clientVoiceIDLookup[clientID] = VoiceID; } WriteToConsole("Server has " + clientID + " " + VoiceID); } ShareVoiceIDClientRpc(clientID, VoiceID); } [ClientRpc] public void ShareVoiceIDClientRpc(ulong clientID, string VoiceID) { //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_010c: 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 != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3668387743u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientID); bool flag = VoiceID != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(VoiceID, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3668387743u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (!clientVoiceIDLookup.ContainsKey(clientID)) { clientVoiceIDLookup.Add(clientID, VoiceID); WriteToConsole("Client added " + clientID + " " + VoiceID); return; } if (clientVoiceIDLookup[clientID] == "") { clientVoiceIDLookup[clientID] = VoiceID; } WriteToConsole("Client has " + clientID + " " + VoiceID); } [ServerRpc(RequireOwnership = false)] public void ShareNameServerRpc(ulong clientID, string name) { //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_010c: 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 != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2581621959u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientID); bool flag = name != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(name, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2581621959u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!clientNameLookup.ContainsKey(clientID)) { clientNameLookup.Add(clientID, name); WriteToConsole("Server added " + clientID + " " + name); } else { WriteToConsole("Server has " + clientID + " " + name); } } } [ClientRpc] public void ShareNameClientRpc(ulong clientID, string name) { //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_010c: 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 != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1451705257u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientID); bool flag = name != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(name, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1451705257u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!clientNameLookup.ContainsKey(clientID)) { clientNameLookup.Add(clientID, name); WriteToConsole("Client added " + clientID + " " + name); } else { WriteToConsole("Client has " + clientID + " " + name); } } } [ClientRpc] public void InitSTTClientRpc() { //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) //IL_00c1: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1714730178u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1714730178u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; WriteToConsole("STT MANAGER IS: " + (object)STT.manager); if ((Object)(object)STT.manager == (Object)null) { STT.num_gens = 0; STT.Init(ChooseApiKey(STT_api_key.Value, temp_STT_api_key), STT_region.Value, STT_language.Value, mic_name); } STT.StartSpeechTranscription(Chat_prompt.Value); } } [ServerRpc(RequireOwnership = false)] public void ShareAudioDataServerRpc(byte[] audioData, string MaskedID, 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0150: 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_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ac: 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_0105: 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(1634666820u, serverRpcParams, (RpcDelivery)0); bool flag = audioData != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(audioData, default(ForPrimitives)); } bool flag2 = MaskedID != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val)).WriteValueSafe(MaskedID, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1634666820u, serverRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; ulong senderClientId = serverRpcParams.Receive.SenderClientId; ClientRpcParams val2 = default(ClientRpcParams); val2.Send = new ClientRpcSendParams { TargetClientIds = NetworkManager.Singleton.ConnectedClientsIds.Except(new ulong[1] { senderClientId }).ToList() }; ClientRpcParams clientRpcParams = val2; PlayAudioDataClientRpc(audioData, MaskedID, clientRpcParams); } } [ClientRpc] public void PlayAudioDataClientRpc(byte[] audioData, string MaskedID, 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_014a: 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_00ac: 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_0105: 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.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(892336189u, clientRpcParams, (RpcDelivery)0); bool flag = audioData != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(audioData, default(ForPrimitives)); } bool flag2 = MaskedID != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val)).WriteValueSafe(MaskedID, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val, 892336189u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; MaskedEnemyIdentifier component = ((Component)maskedInstanceLookup[MaskedID]).GetComponent<MaskedEnemyIdentifier>(); if ((Object)(object)component != (Object)null) { component.child.GetComponent<MaskedAudioComponent>().audioQueue.Feed(audioData, true); } } } [ServerRpc(RequireOwnership = false)] public void RequestMaskedResponseServerRpc(string maskedID, string playerName, string playerSpeech, bool respondingToPlayer = true) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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) 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(58846502u, val, (RpcDelivery)0); bool flag = maskedID != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(maskedID, false); } bool flag2 = playerName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe(playerName, false); } bool flag3 = playerSpeech != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag3, default(ForPrimitives)); if (flag3) { ((FastBufferWriter)(ref val2)).WriteValueSafe(playerSpeech, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref respondingToPlayer, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 58846502u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; ulong item = sharedMaskedClientDict[maskedID]; ClientRpcParams val3 = default(ClientRpcParams); val3.Send = new ClientRpcSendParams { TargetClientIds = new <>z__ReadOnlySingleElementList<ulong>(item) }; ClientRpcParams clientParams = val3; RequestMaskedResponseClientRpc(maskedID, playerName, playerSpeech, respondingToPlayer, clientParams); } } [ClientRpc] public void RequestMaskedResponseClientRpc(string maskedID, string playerName, string playerSpeech, bool respondingToPlayer = true, ClientRpcParams clientParams = 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_0196: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2757415658u, clientParams, (RpcDelivery)0); bool flag = maskedID != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(maskedID, false); } bool flag2 = playerName != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val)).WriteValueSafe(playerName, false); } bool flag3 = playerSpeech != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag3, default(ForPrimitives)); if (flag3) { ((FastBufferWriter)(ref val)).WriteValueSafe(playerSpeech, false); } ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref respondingToPlayer, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2757415658u, clientParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; STT.SendToChatAndChooseResponse(maskedInstanceLookup[maskedID], playerName, playerSpeech, respondingToPlayer); } } private void PromptToShareDataWithClients() { SimpleConfirmationGUI.CreateConfirmationGUI("Do you want to share your Wendigos config with all clients (including API keys?). Close this window to decline.", show_name_input_box: false).onButtonClicked = delegate { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer) { ShareConfigToClientsServerRpc(); } }; } [ServerRpc(RequireOwnership = false)] public void ShareConfigToClientsServerRpc(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_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) //IL_00c1: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_0194: 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(1113147307u, serverRpcParams, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1113147307u, serverRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; ulong senderClientId = serverRpcParams.Receive.SenderClientId; ClientRpcParams val2 = default(ClientRpcParams); val2.Send = new ClientRpcSendParams { TargetClientIds = NetworkManager.Singleton.ConnectedClientsIds.Except(new ulong[1] { senderClientId }).ToList() }; ClientRpcParams clientParams = val2; RecieveConfigClientRpc(ChatServiceProvider.Value, Chat_api_key.Value, Chat_model.Value, Chat_prompt.Value, enable_realtime_responses.Value, max_clip_count.Value, talk_probability.Value, STT_service.Value, STT_api_key.Value, STT_region.Value, STT_language.Value, TTS_enabled.Value, TTS_api_key.Value, clientParams); } } } [ClientRpc] public void RecieveConfigClientRpc(string chatServiceProvider, string chatApiKey, string chatModel, string prompt, bool realtimeResponses, uint maxClips, uint talkProbability, string sttService, string sttApiKey, string region, string language, bool ttsEnabled, string ttsApiKey, ClientRpcParams clientParams = 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_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0314: 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_033f: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0175: 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_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: 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.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1784179457u, clientParams, (RpcDelivery)0); bool flag = chatServiceProvider != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(chatServiceProvider, false); } bool flag2 = chatApiKey != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val)).WriteValueSafe(chatApiKey, false); } bool flag3 = chatModel != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag3, default(ForPrimitives)); if (flag3) { ((FastBufferWriter)(ref val)).WriteValueSafe(chatModel, false); } bool flag4 = prompt != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag4, default(ForPrimitives)); if (flag4) { ((FastBufferWriter)(ref val)).WriteValueSafe(prompt, false); } ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref realtimeResponses, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val, maxClips); BytePacker.WriteValueBitPacked(val, talkProbability); bool flag5 = sttService != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag5, default(ForPrimitives)); if (flag5) { ((FastBufferWriter)(ref val)).WriteValueSafe(sttService, false); } bool flag6 = sttApiKey != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag6, default(ForPrimitives)); if (flag6) { ((FastBufferWriter)(ref val)).WriteValueSafe(sttApiKey, false); } bool flag7 = region != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag7, default(ForPrimitives)); if (flag7) { ((FastBufferWriter)(ref val)).WriteValueSafe(region, false); } bool flag8 = language != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag8, default(ForPrimitives)); if (flag8) { ((FastBufferWriter)(ref val)).WriteValueSafe(language, false); } ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref ttsEnabled, default(ForPrimitives)); bool flag9 = ttsApiKey != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag9, default(ForPrimitives)); if (flag9) { ((FastBufferWriter)(ref val)).WriteValueSafe(ttsApiKey, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1784179457u, clientParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; string chatServiceProvider2 = chatServiceProvider; string chatApiKey2 = chatApiKey; string chatModel2 = chatModel; string prompt2 = prompt; bool realtimeResponses2 = realtimeResponses; uint maxClips2 = maxClips; uint talkProbability2 = talkProbability; string sttService2 = sttService; string sttApiKey2 = sttApiKey; string region2 = region; string language2 = language; bool ttsEnabled2 = ttsEnabled; string ttsApiKey2 = ttsApiKey; string text = "Host has requested to sync Wendigos config with you!"; if (TTS_api_key.Value != "") { text += " You already have a TTS api key set so TTS options will be skipped."; } if (STT_api_key.Value != "") { text += " You already have an STT api key set so STT options will be skipped."; } if (Chat_api_key.Value != "") { text += " You already have a Chat api key set so Chat options will be skipped."; } text += " Are you sure you want to continue?"; SimpleConfirmationGUI.CreateConfirmationGUI(text, show_name_input_box: true).onButtonClicked = delegate { if (Chat_api_key.Value == "") { ChatServiceProvider.Value = chatServiceProvider2; temp_Chat_api_key = chatApiKey2; Chat_model.Value = chatModel2; Chat_prompt.Value = prompt2; WendigosChatManager.Init(ChooseApiKey(Chat_api_key.Value, temp_Chat_api_key), Chat_model.Value, ChatServiceProvider.Value); } enable_realtime_responses.Value = realtimeResponses2; max_clip_count.Value = maxClips2; talk_probability.Value = talkProbability2; if (STT_api_key.Value == "") { STT_service.Value = sttService2; temp_STT_api_key = sttApiKey2; STT_region.Value = region2; STT_language.Value = language2; } if (TTS_api_key.Value == "") { TTS_enabled.Value = ttsEnabled2; temp_TTS_api_key = ttsApiKey2; } }; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1082237979u, new RpcReceiveHandler(__rpc_handler_1082237979), "SetMaskedSuitClientRpc"); ((NetworkBehaviour)this).__registerRpc(1451840012u, new RpcReceiveHandler(__rpc_handler_1451840012), "AddToMaskedClientDictServerRpc"); ((NetworkBehaviour)this).__registerRpc(1980800722u, new RpcReceiveHandler(__rpc_handler_1980800722), "AddToMaskedClientDictClientRpc"); ((NetworkBehaviour)this).__registerRpc(888146200u, new RpcReceiveHandler(__rpc_handler_888146200), "ShareVoiceIDServerRpc"); ((NetworkBehaviour)this).__registerRpc(3668387743u, new RpcReceiveHandler(__rpc_handler_3668387743), "ShareVoiceIDClientRpc"); ((NetworkBehaviour)this).__registerRpc(2581621959u, new RpcReceiveHandler(__rpc_handler_2581621959), "ShareNameServerRpc"); ((NetworkBehaviour)this).__registerRpc(1451705257u, new RpcReceiveHandler(__rpc_handler_1451705257), "ShareNameClientRpc"); ((NetworkBehaviour)this).__registerRpc(1714730178u, new RpcReceiveHandler(__rpc_handler_1714730178), "InitSTTClientRpc"); ((NetworkBehaviour)this).__registerRpc(1634666820u, new RpcReceiveHandler(__rpc_handler_1634666820), "ShareAudioDataServerRpc"); ((NetworkBehaviour)this).__registerRpc(892336189u, new RpcReceiveHandler(__rpc_handler_892336189), "PlayAudioDataClientRpc"); ((NetworkBehaviour)this).__registerRpc(58846502u, new RpcReceiveHandler(__rpc_handler_58846502), "RequestMaskedResponseServerRpc"); ((NetworkBehaviour)this).__registerRpc(2757415658u, new RpcReceiveHandler(__rpc_handler_2757415658), "RequestMaskedResponseClientRpc"); ((NetworkBehaviour)this).__registerRpc(1113147307u, new RpcReceiveHandler(__rpc_handler_1113147307), "ShareConfigToClientsServerRpc"); ((NetworkBehaviour)this).__registerRpc(1784179457u, new RpcReceiveHandler(__rpc_handler_1784179457), "RecieveConfigClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_1082237979(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_006e: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string maskedId = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref maskedId, false); } int suitid = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref suitid); target.__rpc_exec_stage = (__RpcExecStage)1; ((WendigosNetworkManager)(object)target).SetMaskedSuitClientRpc(maskedId, suitid); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1451840012(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_006e: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string maskedID = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref maskedID, false); } ulong clientID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientID); target.__rpc_exec_stage = (__RpcExecStage)1; ((WendigosNetworkManager)(object)target).AddToMaskedClientDictServerRpc(maskedID, clientID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1980800722(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_006e: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string maskedID = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref maskedID, false); } ulong clientID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientID); target.__rpc_exec_stage = (__RpcExecStage)1; ((WendigosNetworkManager)(object)target).AddToMaskedClientDictClientRpc(maskedID, clientID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_888146200(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong clientID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientID); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string voiceID = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref voiceID, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((WendigosNetworkManager)(object)target).ShareVoiceIDServerRpc(clientID, voiceID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3668387743(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong clientID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientID); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string voiceID = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref voiceID, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((WendigosNetworkManager)(object)target).ShareVoiceIDClientRpc(clientID, voiceID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2581621959(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong clientID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientID); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string name = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref name, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((WendigosNetworkManager)(object)target).ShareNameServerRpc(clientID, name); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1451705257(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong clientID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientID); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string name = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref name, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((WendigosNetworkManager)(object)target).ShareNameClientRpc(clientID, name); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1714730178(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((WendigosNetworkManager)(object)target).InitSTTClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1634666820(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); byte[] audioData = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref audioData, default(ForPrimitives)); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); string maskedID = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref maskedID, false); } ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((WendigosNetworkManager)(object)target).ShareAudioDataServerRpc(audioData, maskedID, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_892336189(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); byte[] audioData = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref audioData, default(ForPrimitives)); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); string maskedID = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref maskedID, false); } ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((WendigosNetworkManager)(object)target).PlayAudioDataClientRpc(audioData, maskedID, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_58846502(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string maskedID = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref maskedID, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); string playerName = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref playerName, false); } bool flag3 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag3, default(ForPrimitives)); string playerSpeech = null; if (flag3) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref playerSpeech, false); } bool respondingToPlayer = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref respondingToPlayer, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((WendigosNetworkManager)(object)target).RequestMaskedResponseServerRpc(maskedID, playerName, playerSpeech, respondingToPlayer); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2757415658(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string maskedID = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref maskedID, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); string playerName = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref playerName, false); } bool flag3 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag3, default(ForPrimitives)); string playerSpeech = null; if (flag3) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref playerSpeech, false); } bool respondingToPlayer = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref respondingToPlayer, default(ForPrimitives)); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((WendigosNetworkManager)(object)target).RequestMaskedResponseClientRpc(maskedID, playerName, playerSpeech, respondingToPlayer, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1113147307(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((WendigosNetworkManager)(object)target).ShareConfigToClientsServerRpc(server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1784179457(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_011e: 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_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string chatServiceProvider = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref chatServiceProvider, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); string chatApiKey = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref chatApiKey, false); } bool flag3 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag3, default(ForPrimitives)); string chatModel = null; if (flag3) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref chatModel, false); } bool flag4 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag4, default(ForPrimitives)); string prompt = null; if (flag4) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref prompt, false); } bool realtimeResponses = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref realtimeResponses, default(ForPrimitives)); uint maxClips = default(uint); ByteUnpacker.ReadValueBitPacked(reader, ref maxClips); uint talkProbability = default(uint); ByteUnpacker.ReadValueBitPacked(reader, ref talkProbability); bool flag5 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag5, default(ForPrimitives)); string sttService = null; if (flag5) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref sttService, false); } bool flag6 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag6, default(ForPrimitives)); string sttApiKey = null; if (flag6) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref sttApiKey, false); } bool flag7 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag7, default(ForPrimitives)); string region = null; if (flag7) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref region, false); } bool flag8 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag8, default(ForPrimitives)); string language = null; if (flag8) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref language, false); } bool ttsEnabled = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref ttsEnabled, default(ForPrimitives)); bool flag9 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag9, default(ForPrimitives)); string ttsApiKey = null; if (flag9) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref ttsApiKey, false); } ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((WendigosNetworkManager)(object)target).RecieveConfigClientRpc(chatServiceProvider, chatApiKey, chatModel, prompt, realtimeResponses, maxClips, talkProbability, sttService, sttApiKey, region, language, ttsEnabled, ttsApiKey, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "WendigosNetworkManager"; } } public class MainThreadInvoker { public static readonly ConcurrentQueue<Action> _actions = new ConcurrentQueue<Action>(); public static void Enqueue(Action action) { if (action == null) { throw new ArgumentNullException("action"); } _actions.Enqueue(action); } } public class MaskedEnemyIdentifier : MonoBehaviour { public string id; public GameObject child; public ConcurrentQueue<byte[]> audioNetworkQueue = new ConcurrentQueue<byte[]>(); private void Update() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (audioNetworkQueue.TryDequeue(out var result)) { int i = 0; int num = result.Length; child.GetComponent<MaskedAudioComponent>(); int num2; for (; i < num; i += num2) { num2 = Math.Min(32768, num - i); byte[] array = new byte[num2]; Array.Copy(result, i, array, 0, num2); WendigosNetworkManager.Instance.ShareAudioDataServerRpc(array.ToArray(), id); } } } } public class MaskedAudioComponent : MonoBehaviour { public StreamingAudioDecoder audioQueue = new StreamingAudioDecoder(48000, 2); private AudioSource _audioSource; private AudioClip _streamingClip; private int SampleRate = 48000; private int Channels = 2; public void Awake() { AudioSource component = ((Component)this).GetComponent<AudioSource>(); if ((Object)(object)component != (Object)null) { ((EnemyAI)((Component)((Component)this).transform.parent).GetComponent<MaskedPlayerEnemy>()).creatureVoice.CopyTo(component); } _audioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); _audioSource.playOnAwake = false; ((EnemyAI)((Component)((Component)this).transform.parent).GetComponent<MaskedPlayerEnemy>()).creatureVoice.CopyTo(_audioSource); } private void Start() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown audioQueue.Reset(); SampleRate = AudioSettings.outputSampleRate; Channels = (((int)AudioSettings.speakerMode == 1) ? 1 : 2); _streamingClip = AudioClip.Create("NetworkStream", SampleRate, Channels, SampleRate, true, new PCMReaderCallback(OnAudioRead)); _audioSource.clip = _streamingClip; _audioSource.loop = true; if (!_audioSource.isPlaying) { _audioSource.Play(); } } private void OnAudioRead(float[] data) { float num = default(float); for (int i = 0; i < data.Length; i++) { if (audioQueue.TryGetSample(ref num)) { data[i] = num; } else { data[i] = 0f; } } } } [HarmonyPatch(typeof(StartOfRound), "OnPlayerDC")] private class PlayerDCPatch { private static void Prefix(int playerObjectNumber, ulong clientId) { if (!((NetworkBehaviour)WendigosNetworkManager.Instance).IsServer) { return; } foreach (string key in new Dictionary<string, ulong>(sharedMaskedClientDict).Keys) { if (sharedMaskedClientDict[key] == clientId) { sharedMaskedClientDict.Remove(key); } } } } [HarmonyPatch(typeof(MaskedPlayerEnemy), "DoAIInterval")] private class MaskedPlayerEnemyAIPatch { private static void Prefix(MaskedPlayerEnemy __instance) { //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)__instance).isEnemyDead) { ((EnemyAI)__instance).agent.speed = 0f; return; } string text = ((Component)__instance).gameObject.GetComponent<MaskedEnemyIdentifier>()?.id; if (text == string.Empty) { return; } ulong num = 0uL; if (!sharedMaskedClientDict.Keys.Contains(text)) { return; } num = sharedMaskedClientDict[text]; if (num != NetworkManager.Singleton.LocalClientId) { return; } switch (((EnemyAI)__instance).currentBehaviourStateIndex) { case 0: { PlayerControllerB val = ((EnemyAI)__instance).CheckLineOfSightForClosestPlayer(45f, 60, -1, 0f); if ((Object)(object)val != (Object)null) { if (!enable_realtime_responses.Value && serverRand.Next(100) >= 100 - talk_probability.Value && Vector3.Distance(((Component)val.gameplayCamera).transform.position, ((EnemyAI)__instance).eye.position) > 15f) { WendigosNetworkManager.Instance.RequestMaskedResponseServerRpc(text, "", "", respondingToPlayer: false); } } else if (serverRand.Next(100) >= 100 - talk_probability.Value) { PlayLocalAudioClipAndQueue(__instance); } break; } case 1: case 2: break; } } } [HarmonyPatch(typeof(MaskedPlayerEnemy), "SetVisibilityOfMaskedEnemy")] private class MaskedPlayerEnemyVisibilityPatch { public static void Postfix(MaskedPlayerEnemy __instance) { if (!enable_masked_visuals.Value && (bool)Traverse.Create((object)__instance).Field("enemyEnabled").GetValue()) { ((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/HeadMaskComedy")).gameObject.SetActive(false); ((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/HeadMaskTragedy")).gameObject.SetActive(false); } } } [HarmonyPatch(typeof(MaskedPlayerEnemy), "SetHandsOutClientRpc")] private class MaskedPlayerEnemyRemoveHands { public static void Prefix(ref bool setOut, MaskedPlayerEnemy __instance) { if (!enable_masked_visuals.Value) { setOut = false; } } } [HarmonyPatch(typeof(MaskedPlayerEnemy), "HitEnemy")] private class MaskedPlayerEnemyDamagePatch { private static void Prefix(MaskedPlayerEnemy __instance) { try { string id = ((Component)__instance).gameObject.GetComponent<MaskedEnemyIdentifier>().id; _ = sharedMaskedClientDict[id]; if (!enable_realtime_responses.Value && serverRand.Next(3) == 0) { WendigosNetworkManager.Instance.RequestMaskedResponseServerRpc(id, "", "{DAMAGED}", respondingToPlayer: false); } } catch { } } } [HarmonyPatch(typeof(MaskedPlayerEnemy), "Start")] private class MaskedStartPatch { public static void Postfix(MaskedPlayerEnemy __instance) { //IL_0010: Unknown result type (might be due to invalid IL or missing references