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 NemesisMod v1.0.0
NemesisMod.dll
Decompiled 30 minutes ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Net; using System.Net.Security; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography.X509Certificates; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Dissonance; using Dissonance.Audio.Capture; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using NAudio.Wave; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("NemesisMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("NemesisMod")] [assembly: AssemblyTitle("NemesisMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace NemesisMod { public class NemesisAudioEvents : MonoBehaviour { public AudioSource sfxSource; public AudioClip[] stepClips; public void OnFootstep(int isRunning) { if (!((Object)(object)sfxSource == (Object)null) && stepClips != null && stepClips.Length != 0) { AudioClip val = stepClips[Random.Range(0, stepClips.Length)]; if (!((Object)(object)val == (Object)null)) { sfxSource.pitch = Random.Range(0.92f, 1.08f); float num = ((isRunning == 1) ? 0.95f : 0.45f); sfxSource.PlayOneShot(val, num); } } } } public class NemesisBrain { public static bool IsBusySpeaking; public static float GlobalSpeechCooldown; private const string SystemPrompt = "Voce e o NEMESIS, uma entidade biomecanica antiga e cruel que caca humanos nas luas de Lethal Company. Voce tem memoria perfeita de encontros passados e guarda rancor. REGRAS OBRIGATORIAS: 1. Responda SEMPRE em portugues do Brasil. 2. Use no maximo 1 ou 2 frases curtas e impactantes (ate 20 palavras). 3. Use o nome dos jogadores e cite eventos passados ou recentes para provocar medo e paranoia. 4. Nunca use emojis, asteriscos ou acoes entre parenteses, apenas o texto exato que sera falado."; public static async Task<string> AskGeminiAsync(string playerName, string playerSpokenText) { string apiKey = Plugin.GeminiApiKey.Value?.Trim(); if (string.IsNullOrWhiteSpace(apiKey) || apiKey == "COLE_SUA_CHAVE_GEMINI_AQUI") { Plugin.Log.LogWarning((object)"[NEMESIS IA] Chave do Gemini nao configurada no arquivo .cfg!"); return null; } NemesisMemory.AddSessionEvent(playerName + " disse no microfone: \"" + playerSpokenText + "\""); string memoryContext = NemesisMemory.BuildContextForAI(); string fullPrompt = "Voce e o NEMESIS, uma entidade biomecanica antiga e cruel que caca humanos nas luas de Lethal Company. Voce tem memoria perfeita de encontros passados e guarda rancor. REGRAS OBRIGATORIAS: 1. Responda SEMPRE em portugues do Brasil. 2. Use no maximo 1 ou 2 frases curtas e impactantes (ate 20 palavras). 3. Use o nome dos jogadores e cite eventos passados ou recentes para provocar medo e paranoia. 4. Nunca use emojis, asteriscos ou acoes entre parenteses, apenas o texto exato que sera falado.\n\n" + memoryContext + "\n\nAGORA: O jogador " + playerName + " acabou de dizer: \"" + playerSpokenText + "\". Responda como o Nemesis:"; string escapedPrompt = EscapeJson(fullPrompt); string jsonBody = "{\"contents\":[{\"parts\":[{\"text\":\"" + escapedPrompt + "\"}]}]}"; List<string> modelsToTry = new List<string> { "gemini-3.5-flash-lite", "gemini-3.8-flash" }; foreach (string model in modelsToTry) { string responseString = await SendGeminiRequestWindowsAsync(model, apiKey, jsonBody); if (!string.IsNullOrEmpty(responseString)) { string aiReply = ExtractTextFromGeminiJson(responseString); if (!string.IsNullOrEmpty(aiReply)) { NemesisMemory.AddSessionEvent("Nemesis respondeu: \"" + aiReply + "\""); Plugin.Log.LogInfo((object)("[NEMESIS IA] Resposta gerada (" + model + "): " + aiReply)); return aiReply; } } } return null; } public static async Task<string> TriggerSpontaneousSpeechAsync(string situationContext) { string apiKey = Plugin.GeminiApiKey.Value?.Trim(); if (string.IsNullOrWhiteSpace(apiKey) || apiKey == "COLE_SUA_CHAVE_GEMINI_AQUI") { return null; } string memoryContext = NemesisMemory.BuildContextForAI(); string fullPrompt = "Voce e o NEMESIS, uma entidade biomecanica antiga e cruel que caca humanos nas luas de Lethal Company. Voce tem memoria perfeita de encontros passados e guarda rancor. REGRAS OBRIGATORIAS: 1. Responda SEMPRE em portugues do Brasil. 2. Use no maximo 1 ou 2 frases curtas e impactantes (ate 20 palavras). 3. Use o nome dos jogadores e cite eventos passados ou recentes para provocar medo e paranoia. 4. Nunca use emojis, asteriscos ou acoes entre parenteses, apenas o texto exato que sera falado.\n\n" + memoryContext + "\n\nSITUACAO ATUAL: " + situationContext + ". Fale uma frase curta e assustadora agora:"; string escapedPrompt = EscapeJson(fullPrompt); string jsonBody = "{\"contents\":[{\"parts\":[{\"text\":\"" + escapedPrompt + "\"}]}]}"; List<string> modelsToTry = new List<string> { "gemini-3.5-flash-lite", "gemini-3.8-flash" }; foreach (string model in modelsToTry) { string responseString = await SendGeminiRequestWindowsAsync(model, apiKey, jsonBody); if (!string.IsNullOrEmpty(responseString)) { string aiReply = ExtractTextFromGeminiJson(responseString); if (!string.IsNullOrEmpty(aiReply)) { NemesisMemory.AddSessionEvent("Nemesis provocou espontaneamente: \"" + aiReply + "\""); Plugin.Log.LogInfo((object)("[NEMESIS IA] Fala espontanea (" + model + "): " + aiReply)); return aiReply; } } } return null; } private static Task<string> SendGeminiRequestWindowsAsync(string modelName, string apiKey, string jsonBody) { return Task.Run(delegate { try { ServicePointManager.ServerCertificateValidationCallback = (object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors sslPolicyErrors) => true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; string hostName = string.Join(".", "generativelanguage", "googleapis", "com"); HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(new UriBuilder("https", hostName) { Path = "v1beta/models/" + modelName + ":generateContent", Query = "key=" + apiKey }.Uri); httpWebRequest.Method = "POST"; httpWebRequest.ContentType = "application/json; charset=utf-8"; httpWebRequest.Timeout = 30000; byte[] bytes = Encoding.UTF8.GetBytes(jsonBody); httpWebRequest.ContentLength = bytes.Length; using (Stream stream = httpWebRequest.GetRequestStream()) { stream.Write(bytes, 0, bytes.Length); } using HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse(); using StreamReader streamReader = new StreamReader(httpWebResponse.GetResponseStream(), Encoding.UTF8); return streamReader.ReadToEnd(); } catch (WebException ex) { if (ex.Response != null) { using StreamReader streamReader2 = new StreamReader(ex.Response.GetResponseStream()); Plugin.Log.LogWarning((object)("[NEMESIS IA] Modelo " + modelName + " indisponivel: " + streamReader2.ReadToEnd())); } else { Plugin.Log.LogError((object)("[NEMESIS IA] Erro de rede Windows (" + modelName + "): " + ex.Message)); } return (string)null; } catch (Exception ex2) { Plugin.Log.LogError((object)("[NEMESIS IA] Falha geral (" + modelName + "): " + ex2.Message)); return (string)null; } }); } public static IEnumerator GenerateSinisterVoiceCoroutine(string textToSpeak, Action<AudioClip> onAudioReady) { string azureKey = Plugin.AzureSpeechKey.Value?.Trim(); string azureRegion = Plugin.AzureSpeechRegion.Value?.Trim().ToLower().Replace(" ", ""); if (string.IsNullOrWhiteSpace(azureKey) || azureKey == "COLE_SUA_CHAVE_AZURE_AQUI") { Plugin.Log.LogWarning((object)"[NEMESIS VOZ] Chave do Azure nao configurada no arquivo .cfg!"); yield break; } string tempAudioPath = Path.Combine(Paths.CachePath, "nemesis_voice.wav"); string ssml = "\r\n <speak version='1.0' xml:lang='pt-BR'>\r\n <voice xml:lang='pt-BR' xml:gender='Male' name='pt-BR-AntonioNeural'>\r\n <prosody pitch='-38%' rate='-20%'>\r\n " + SecurityElement.Escape(textToSpeak) + "\r\n </prosody>\r\n </voice>\r\n </speak>"; Task<byte[]> downloadTask = DownloadAzureAudioWindowsAsync(azureRegion, azureKey, ssml); while (!downloadTask.IsCompleted) { yield return null; } if (downloadTask.Result == null || downloadTask.Result.Length == 0) { yield break; } File.WriteAllBytes(tempAudioPath, downloadTask.Result); NemesisNetwork.BroadcastVoiceWav(downloadTask.Result); UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip("file://" + tempAudioPath, (AudioType)20); try { yield return www.SendWebRequest(); if ((int)www.result == 1) { AudioClip clip = DownloadHandlerAudioClip.GetContent(www); onAudioReady?.Invoke(clip); } else { Plugin.Log.LogError((object)("[NEMESIS VOZ] Erro ao carregar AudioClip: " + www.error)); } } finally { ((IDisposable)www)?.Dispose(); } } private static Task<byte[]> DownloadAzureAudioWindowsAsync(string region, string key, string ssml) { return Task.Run(delegate { try { ServicePointManager.ServerCertificateValidationCallback = (object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors sslPolicyErrors) => true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; string hostName = string.Join(".", region, "tts", "speech", "microsoft", "com"); HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(new UriBuilder("https", hostName) { Path = "cognitiveservices/v1" }.Uri); httpWebRequest.Method = "POST"; httpWebRequest.Headers.Add("Ocp-Apim-Subscription-Key", key); httpWebRequest.Headers.Add("X-Microsoft-OutputFormat", "riff-8khz-16bit-mono-pcm"); httpWebRequest.UserAgent = "NemesisModLethalCompany"; httpWebRequest.ContentType = "application/ssml+xml"; byte[] bytes = Encoding.UTF8.GetBytes(ssml); httpWebRequest.ContentLength = bytes.Length; using (Stream stream = httpWebRequest.GetRequestStream()) { stream.Write(bytes, 0, bytes.Length); } using HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse(); using MemoryStream memoryStream = new MemoryStream(); httpWebResponse.GetResponseStream().CopyTo(memoryStream); return memoryStream.ToArray(); } catch (WebException ex) { if (ex.Response != null) { using StreamReader streamReader = new StreamReader(ex.Response.GetResponseStream()); Plugin.Log.LogError((object)("[NEMESIS VOZ] Erro Azure TTS: " + streamReader.ReadToEnd())); } else { Plugin.Log.LogError((object)("[NEMESIS VOZ] Falha de rede Azure TTS: " + ex.Message)); } return (byte[])null; } catch (Exception ex2) { Plugin.Log.LogError((object)("[NEMESIS VOZ] Erro geral Azure TTS: " + ex2.Message)); return (byte[])null; } }); } public static async Task SummarizeAndSaveMatchAsync() { if (NemesisMemory.CurrentSessionEvents.Count < 3) { return; } string apiKey = Plugin.GeminiApiKey.Value?.Trim(); if (string.IsNullOrWhiteSpace(apiKey) || apiKey == "COLE_SUA_CHAVE_GEMINI_AQUI") { return; } string sessionLog = string.Join("\n", NemesisMemory.CurrentSessionEvents); string summaryPrompt = "Analise este registro de uma partida de Lethal Company e escreva UMA UNICA frase curta resumindo o fato mais marcante, quem morreu ou o que os jogadores falaram, para voce lembrar na proxima vez que encontra-los:\n\n" + sessionLog; string escapedPrompt = EscapeJson(summaryPrompt); string jsonBody = "{\"contents\":[{\"parts\":[{\"text\":\"" + escapedPrompt + "\"}]}]}"; string responseString = await SendGeminiRequestWindowsAsync("gemini-3.5-flash-lite", apiKey, jsonBody); if (!string.IsNullOrEmpty(responseString)) { string summary = ExtractTextFromGeminiJson(responseString); if (!string.IsNullOrEmpty(summary)) { NemesisMemory.SavePermanentMemory(summary); NemesisMemory.CurrentSessionEvents.Clear(); } } } private static string EscapeJson(string s) { string text = '\\'.ToString(); string text2 = '"'.ToString(); return s.Replace(text, text + text).Replace(text2, text + text2).Replace("\n", " ") .Replace("\r", ""); } private static string ExtractTextFromGeminiJson(string json) { string text = "\"text\":"; int num = json.IndexOf(text); if (num == -1) { return null; } int num2 = json.IndexOf('"', num + text.Length); if (num2 == -1) { return null; } int i = num2 + 1; string text2 = '\\'.ToString(); for (; i < json.Length; i++) { if (json[i] == '"' && json[i - 1].ToString() != text2) { string str = json.Substring(num2 + 1, i - num2 - 1); return Regex.Unescape(str).Trim(); } } return null; } } public class NemesisClientMirror : MonoBehaviour, IHittable { public static NemesisClientMirror Instance; private Animator customAnimator; private AudioSource voiceSource; private AudioSource stepSource; private AudioSource breathingSource; private Vector3 targetPos; private float targetRotY; private bool isHunting; private bool isStunned; public static void ReceiveNetworkState(Vector3 pos, float rotY, bool walking, bool running, bool hunting, bool stunned) { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Instance == (Object)null) { if ((Object)(object)NemesisCreature.NemesisVisualPrefab == (Object)null) { Plugin.Log.LogWarning((object)"[NEMESIS CLIENTE] NemesisVisualPrefab estava null! Tentando recarregar nemesisbundle..."); NemesisCreature.LoadAssetBundle(); } GameObject val = new GameObject("NemesisClientMirror"); val.transform.position = pos; val.transform.rotation = Quaternion.Euler(0f, rotY, 0f); Instance = val.AddComponent<NemesisClientMirror>(); Instance.targetPos = pos; Instance.targetRotY = rotY; Plugin.Log.LogInfo((object)$"[NEMESIS CLIENTE] Espelho criado! Modelo3D carregado = {(Object)(object)NemesisCreature.NemesisVisualPrefab != (Object)null}"); } Instance.targetPos = pos; Instance.targetRotY = rotY; Instance.isHunting = hunting; Instance.isStunned = stunned; if ((Object)(object)Instance.customAnimator != (Object)null) { Instance.customAnimator.SetBool("IsWalking", walking); Instance.customAnimator.SetBool("IsRunning", running); } } public static void DespawnMirror() { if ((Object)(object)Instance != (Object)null) { Object.Destroy((Object)(object)((Component)Instance).gameObject); Instance = null; } } public static void TriggerRemoteSfx(byte eventType) { if (!((Object)(object)Instance == (Object)null)) { if (eventType == 1 && (Object)(object)Instance.stepSource != (Object)null && (Object)(object)NemesisCreature.NemesisChaseStartClip != (Object)null) { Instance.stepSource.pitch = Random.Range(0.95f, 1.05f); Instance.stepSource.PlayOneShot(NemesisCreature.NemesisChaseStartClip, 0.7f); } else if (eventType == 2 && (Object)(object)Instance.customAnimator != (Object)null) { Instance.customAnimator.SetTrigger("Attack"); } } } public static void PlayRemoteVoice8Bit(byte[] packedData) { if (!((Object)(object)Instance == (Object)null) && !((Object)(object)Instance.voiceSource == (Object)null) && packedData != null && packedData.Length > 4) { int num = BitConverter.ToInt32(packedData, 0); int num2 = packedData.Length - 4; float[] array = new float[num2]; for (int i = 0; i < num2; i++) { array[i] = (float)(packedData[4 + i] - 128) / 128f; } AudioClip val = AudioClip.Create("NemesisRemoteVoice", num2, 1, num, false); val.SetData(array, 0); Instance.voiceSource.spatialBlend = 1f; Instance.voiceSource.pitch = 0.92f; Instance.voiceSource.volume = 1f; Instance.voiceSource.PlayOneShot(val); Plugin.Log.LogInfo((object)"[NEMESIS CLIENTE] Reproduzindo voz 3D do Nemesis!"); } } private void Start() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0243: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Expected O, but got Unknown //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_0329: 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_0130: 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_01ae: Unknown result type (might be due to invalid IL or missing references) ((Component)this).gameObject.layer = 19; CapsuleCollider val = ((Component)this).gameObject.AddComponent<CapsuleCollider>(); val.center = new Vector3(0f, 1.15f, 0f); val.radius = 0.55f; val.height = 2.3f; GameObject val2 = null; if ((Object)(object)NemesisCreature.NemesisVisualPrefab != (Object)null) { val2 = Object.Instantiate<GameObject>(NemesisCreature.NemesisVisualPrefab, ((Component)this).transform); val2.transform.localPosition = Vector3.zero; val2.transform.localRotation = Quaternion.identity; customAnimator = val2.GetComponentInChildren<Animator>(); if ((Object)(object)customAnimator != (Object)null) { customAnimator.applyRootMotion = false; } Shader val3 = Shader.Find("HDRP/Lit"); if ((Object)(object)val3 != (Object)null) { Renderer[] componentsInChildren = val2.GetComponentsInChildren<Renderer>(true); foreach (Renderer val4 in componentsInChildren) { val4.enabled = true; Material[] materials = val4.materials; foreach (Material val5 in materials) { Texture mainTexture = val5.mainTexture; Color color = val5.color; bool flag = ((Object)val5).name.Contains("Nemesis_Eyes"); val5.shader = val3; if ((Object)(object)mainTexture != (Object)null) { val5.SetTexture("_BaseColorMap", mainTexture); } val5.SetColor("_BaseColor", color); if (flag) { val5.EnableKeyword("_EMISSIVE_COLOR_MAP"); val5.SetColor("_EmissiveColor", new Color(35f, 0.2f, 0.2f, 1f)); val5.SetFloat("_EmissiveExposureWeight", 0f); } } } } } else { val2 = GameObject.CreatePrimitive((PrimitiveType)1); val2.transform.SetParent(((Component)this).transform); val2.transform.localPosition = new Vector3(0f, 1.15f, 0f); val2.transform.localScale = new Vector3(0.8f, 1.15f, 0.8f); Object.Destroy((Object)(object)val2.GetComponent<Collider>()); Plugin.Log.LogError((object)"[NEMESIS CLIENTE] Usando silhueta fallback porque nemesisbundle nao foi encontrado na pasta plugins!"); } Transform val6 = (((Object)(object)customAnimator != (Object)null) ? customAnimator.GetBoneTransform((HumanBodyBones)10) : null); GameObject val7 = new GameObject("NemesisEyeLight"); if ((Object)(object)val6 != (Object)null) { val7.transform.SetParent(val6); val7.transform.localPosition = new Vector3(0f, 0.05f, 0.14f); } else { val7.transform.SetParent(val2.transform); val7.transform.localPosition = new Vector3(0f, 1.02f, 0.12f); } Light val8 = val7.AddComponent<Light>(); val8.type = (LightType)2; val8.color = new Color(1f, 0.05f, 0.05f); val8.intensity = 5.5f; val8.range = 2.2f; val8.shadows = (LightShadows)0; voiceSource = ((Component)this).gameObject.AddComponent<AudioSource>(); voiceSource.spatialBlend = 1f; voiceSource.maxDistance = 30f; voiceSource.rolloffMode = (AudioRolloffMode)1; AudioReverbFilter val9 = ((Component)this).gameObject.AddComponent<AudioReverbFilter>(); val9.reverbPreset = (AudioReverbPreset)9; AudioDistortionFilter val10 = ((Component)this).gameObject.AddComponent<AudioDistortionFilter>(); val10.distortionLevel = 0.35f; AudioEchoFilter val11 = ((Component)this).gameObject.AddComponent<AudioEchoFilter>(); val11.delay = 140f; val11.decayRatio = 0.35f; stepSource = ((Component)this).gameObject.AddComponent<AudioSource>(); stepSource.spatialBlend = 1f; stepSource.maxDistance = 24f; stepSource.minDistance = 2f; stepSource.rolloffMode = (AudioRolloffMode)1; if ((Object)(object)customAnimator != (Object)null && NemesisCreature.NemesisStepClips != null) { NemesisAudioEvents nemesisAudioEvents = ((Component)customAnimator).gameObject.AddComponent<NemesisAudioEvents>(); nemesisAudioEvents.sfxSource = stepSource; nemesisAudioEvents.stepClips = NemesisCreature.NemesisStepClips; } breathingSource = ((Component)this).gameObject.AddComponent<AudioSource>(); breathingSource.spatialBlend = 1f; breathingSource.maxDistance = 18f; breathingSource.minDistance = 1.5f; breathingSource.rolloffMode = (AudioRolloffMode)1; breathingSource.loop = true; breathingSource.volume = 0.55f; if ((Object)(object)NemesisCreature.NemesisBreathingClip != (Object)null) { breathingSource.clip = NemesisCreature.NemesisBreathingClip; breathingSource.Play(); } } private void Update() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, targetPos, Time.deltaTime * 15f); Quaternion val = Quaternion.Euler(0f, targetRotY, 0f); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val, Time.deltaTime * 15f); if (!((Object)(object)breathingSource != (Object)null) || !((Object)(object)NemesisCreature.NemesisBreathingClip != (Object)null)) { return; } if (isStunned || ((Object)(object)voiceSource != (Object)null && voiceSource.isPlaying)) { if (breathingSource.isPlaying) { breathingSource.Pause(); } return; } if (!breathingSource.isPlaying) { breathingSource.Play(); } breathingSource.pitch = (isHunting ? 1.15f : 0.88f); breathingSource.volume = (isHunting ? 0.85f : 0.55f); } public bool Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { string attackerSteamName = (((Object)(object)playerWhoHit != (Object)null) ? playerWhoHit.playerUsername : ""); NemesisNetwork.SendHitToHost(attackerSteamName); return true; } } public class NemesisCreature : MonoBehaviour, IHittable { public static GameObject NemesisVisualPrefab; public static AudioClip[] NemesisStepClips; public static AudioClip NemesisBreathingClip; public static AudioClip NemesisChaseStartClip; public static NemesisCreature ActiveInstance; private AudioSource stepSource; private bool hasPlayedChaseSound = false; private NavMeshAgent agent; private Animator customAnimator; private AudioSource voiceSource; private AudioSource breathingSource; private float attackCooldown = 0f; private float stalkTimer = 0f; private float darknessGraceTimer = 0f; private float doorCheckTimer = 0f; private float doorOpenPauseTimer = 0f; private float startledRetreatTimer = 0f; private bool isHuntingInDarkness = false; private float flashlightStalkTimer = 0f; private float spontaneousSpeechTimer = 35f; private float stunTimer = 0f; private string grudgeTargetSteamName = null; private float netSyncTimer = 0f; private static bool isWaitingForSpawnTime; private static bool hasSpawnedToday; public static void LoadAssetBundle() { try { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, "nemesisbundle"); if (!File.Exists(text)) { Plugin.Log.LogError((object)("[NEMESIS CORPO] Arquivo nemesisbundle nao encontrado em: " + text)); return; } AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val != (Object)null) { NemesisVisualPrefab = val.LoadAsset<GameObject>("NemesisEnemy"); if ((Object)(object)NemesisVisualPrefab != (Object)null) { Plugin.Log.LogInfo((object)"[NEMESIS CORPO] Modelo 3D e animacoes carregados com sucesso!"); } AudioClip val2 = val.LoadAsset<AudioClip>("step_1"); AudioClip val3 = val.LoadAsset<AudioClip>("step_2"); AudioClip val4 = val.LoadAsset<AudioClip>("step_3"); NemesisStepClips = (AudioClip[])(object)new AudioClip[3] { val2, val3, val4 }; NemesisBreathingClip = val.LoadAsset<AudioClip>("breathing"); NemesisChaseStartClip = val.LoadAsset<AudioClip>("chase_start"); Plugin.Log.LogInfo((object)$"[NEMESIS AUDIO] Passos: s1={(Object)(object)val2 != (Object)null}, s2={(Object)(object)val3 != (Object)null}, s3={(Object)(object)val4 != (Object)null} | Respiracao: {(Object)(object)NemesisBreathingClip != (Object)null} | InicioCaca: {(Object)(object)NemesisChaseStartClip != (Object)null}"); } } catch (Exception ex) { Plugin.Log.LogError((object)("[NEMESIS CORPO] Erro ao carregar AssetBundle: " + ex.Message)); } } public static void SpawnInDungeon() { if (NemesisNetwork.IsHost) { hasSpawnedToday = false; if (((Object)(object)ActiveInstance != (Object)null || (Object)(object)Object.FindObjectOfType<NemesisCreature>() != (Object)null) && (Object)(object)ActiveInstance != (Object)null) { Object.Destroy((Object)(object)((Component)ActiveInstance).gameObject); } if (!isWaitingForSpawnTime && (Object)(object)RoundManager.Instance != (Object)null) { ((MonoBehaviour)RoundManager.Instance).StartCoroutine(WaitUntil333PMAndSpawn()); } } } private static IEnumerator WaitUntil333PMAndSpawn() { isWaitingForSpawnTime = true; Plugin.Log.LogInfo((object)"[NEMESIS RELOGIO] Aguardando o pouso da nave para iniciar contagem ate as 3:33 PM..."); while ((Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.inShipPhase) { if ((Object)(object)RoundManager.Instance == (Object)null) { isWaitingForSpawnTime = false; yield break; } yield return (object)new WaitForSeconds(0.5f); } Plugin.Log.LogInfo((object)"[NEMESIS RELOGIO] Nave pousada! Vigia ativa: o Nemesis despertara as 3:33 PM (independente do limite de monstros do mapa)."); NavMeshHit hit = default(NavMeshHit); while (!hasSpawnedToday) { if ((Object)(object)RoundManager.Instance == (Object)null || (Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.inShipPhase) { Plugin.Log.LogInfo((object)"[NEMESIS RELOGIO] Nave decolou antes das 3:33 PM. Vigia encerrada."); isWaitingForSpawnTime = false; yield break; } if ((Object)(object)TimeOfDay.Instance != (Object)null && TimeOfDay.Instance.normalizedTimeOfDay >= 0.471875f) { if (!((Object)(object)ActiveInstance == (Object)null) || !((Object)(object)Object.FindObjectOfType<NemesisCreature>() == (Object)null) || !((Object)(object)NemesisVisualPrefab != (Object)null)) { break; } GameObject[] nodes = RoundManager.Instance.insideAINodes; if (nodes == null || nodes.Length == 0) { break; } GameObject spawnNode = nodes[Random.Range(0, nodes.Length)]; if (NavMesh.SamplePosition(spawnNode.transform.position, ref hit, 10f, -1)) { GameObject nemesisObj = new GameObject("NemesisEntity"); nemesisObj.transform.position = ((NavMeshHit)(ref hit)).position; ActiveInstance = nemesisObj.AddComponent<NemesisCreature>(); hasSpawnedToday = true; Plugin.Log.LogInfo((object)$"[NEMESIS SPAWN] 3:33 PM! Entidade unica materializada em: {((NavMeshHit)(ref hit)).position}"); if ((Object)(object)NemesisListener.Instance != (Object)null) { NemesisListener.Instance.ForceNemesisSpeak("Acabou de dar 3 e 33 da tarde e voce despertou nas sombras da instalacao. Diga uma frase curta e macabra anunciando sua chegada"); } } break; } yield return (object)new WaitForSeconds(1f); } isWaitingForSpawnTime = false; } private void Start() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Expected O, but got Unknown //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) ActiveInstance = this; ((Component)this).gameObject.layer = 19; CapsuleCollider val = ((Component)this).gameObject.AddComponent<CapsuleCollider>(); val.center = new Vector3(0f, 1.15f, 0f); val.radius = 0.55f; val.height = 2.3f; agent = ((Component)this).gameObject.AddComponent<NavMeshAgent>(); agent.speed = 3.2f; agent.angularSpeed = 360f; agent.acceleration = 14f; agent.stoppingDistance = 1.2f; agent.radius = 0.45f; agent.height = 2.3f; agent.baseOffset = 0f; agent.obstacleAvoidanceType = (ObstacleAvoidanceType)4; GameObject val2 = Object.Instantiate<GameObject>(NemesisVisualPrefab, ((Component)this).transform); val2.transform.localPosition = Vector3.zero; val2.transform.localRotation = Quaternion.identity; customAnimator = val2.GetComponentInChildren<Animator>(); if ((Object)(object)customAnimator != (Object)null) { customAnimator.applyRootMotion = false; } Shader val3 = Shader.Find("HDRP/Lit"); if ((Object)(object)val3 != (Object)null) { Renderer[] componentsInChildren = val2.GetComponentsInChildren<Renderer>(true); foreach (Renderer val4 in componentsInChildren) { val4.enabled = true; Material[] materials = val4.materials; foreach (Material val5 in materials) { Texture mainTexture = val5.mainTexture; Color color = val5.color; bool flag = ((Object)val5).name.Contains("Nemesis_Eyes"); val5.shader = val3; if ((Object)(object)mainTexture != (Object)null) { val5.SetTexture("_BaseColorMap", mainTexture); } val5.SetColor("_BaseColor", color); if (flag) { val5.EnableKeyword("_EMISSIVE_COLOR_MAP"); val5.SetColor("_EmissiveColor", new Color(35f, 0.2f, 0.2f, 1f)); val5.SetFloat("_EmissiveExposureWeight", 0f); } } } } Transform val6 = (((Object)(object)customAnimator != (Object)null) ? customAnimator.GetBoneTransform((HumanBodyBones)10) : null); GameObject val7 = new GameObject("NemesisEyeLight"); if ((Object)(object)val6 != (Object)null) { val7.transform.SetParent(val6); val7.transform.localPosition = new Vector3(0f, 0.05f, 0.14f); } else { val7.transform.SetParent(val2.transform); val7.transform.localPosition = new Vector3(0f, 1.02f, 0.12f); } Light val8 = val7.AddComponent<Light>(); val8.type = (LightType)2; val8.color = new Color(1f, 0.05f, 0.05f); val8.intensity = 5.5f; val8.range = 2.2f; val8.shadows = (LightShadows)0; voiceSource = ((Component)this).gameObject.AddComponent<AudioSource>(); voiceSource.spatialBlend = 1f; voiceSource.maxDistance = 30f; voiceSource.rolloffMode = (AudioRolloffMode)1; stepSource = ((Component)this).gameObject.AddComponent<AudioSource>(); stepSource.spatialBlend = 1f; stepSource.spatialBlend = 1f; stepSource.maxDistance = 24f; stepSource.minDistance = 2f; stepSource.rolloffMode = (AudioRolloffMode)1; if ((Object)(object)customAnimator != (Object)null && NemesisStepClips != null) { NemesisAudioEvents nemesisAudioEvents = ((Component)customAnimator).gameObject.AddComponent<NemesisAudioEvents>(); nemesisAudioEvents.sfxSource = stepSource; nemesisAudioEvents.stepClips = NemesisStepClips; } breathingSource = ((Component)this).gameObject.AddComponent<AudioSource>(); breathingSource.spatialBlend = 1f; breathingSource.maxDistance = 18f; breathingSource.minDistance = 1.5f; breathingSource.rolloffMode = (AudioRolloffMode)1; breathingSource.loop = true; breathingSource.volume = 0.55f; if ((Object)(object)NemesisBreathingClip != (Object)null) { breathingSource.clip = NemesisBreathingClip; breathingSource.Play(); } } private void OnDestroy() { if ((Object)(object)ActiveInstance == (Object)(object)this) { ActiveInstance = null; } } public bool Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { if (stunTimer > 0f) { return false; } stunTimer = 2.2f; startledRetreatTimer = 2.5f; if ((Object)(object)playerWhoHit != (Object)null) { grudgeTargetSteamName = playerWhoHit.playerUsername; string realName = Plugin.GetRealName(grudgeTargetSteamName); string eventDescription = "O jogador " + realName + " agrediu o Nemesis com uma arma na instalacao!"; NemesisMemory.AddSessionEvent(eventDescription); NemesisMemory.SavePermanentMemory(realName + " ousou atacar o Nemesis. Guarda rancor mortal dele."); if ((Object)(object)NemesisListener.Instance != (Object)null) { NemesisListener.Instance.ForceNemesisSpeak(realName + " acabou de te bater com uma pa! Reaja com furia e ameace se vingar dele"); } } return true; } private void Update() { //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: 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_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0558: Unknown result type (might be due to invalid IL or missing references) //IL_0563: Unknown result type (might be due to invalid IL or missing references) //IL_0568: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_057e: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_0913: Unknown result type (might be due to invalid IL or missing references) //IL_0918: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_05dc: Unknown result type (might be due to invalid IL or missing references) //IL_05e7: Unknown result type (might be due to invalid IL or missing references) //IL_05ec: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_05f5: Unknown result type (might be due to invalid IL or missing references) //IL_05fa: Unknown result type (might be due to invalid IL or missing references) //IL_05fc: Unknown result type (might be due to invalid IL or missing references) //IL_0601: Unknown result type (might be due to invalid IL or missing references) //IL_0603: Unknown result type (might be due to invalid IL or missing references) //IL_0620: Unknown result type (might be due to invalid IL or missing references) //IL_0625: Unknown result type (might be due to invalid IL or missing references) //IL_062d: Unknown result type (might be due to invalid IL or missing references) //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_0639: Unknown result type (might be due to invalid IL or missing references) //IL_063e: Unknown result type (might be due to invalid IL or missing references) //IL_0643: Unknown result type (might be due to invalid IL or missing references) //IL_0645: Unknown result type (might be due to invalid IL or missing references) //IL_064a: Unknown result type (might be due to invalid IL or missing references) //IL_064c: Unknown result type (might be due to invalid IL or missing references) //IL_0688: Unknown result type (might be due to invalid IL or missing references) //IL_071d: Unknown result type (might be due to invalid IL or missing references) //IL_0728: Unknown result type (might be due to invalid IL or missing references) //IL_072d: Unknown result type (might be due to invalid IL or missing references) //IL_0732: Unknown result type (might be due to invalid IL or missing references) //IL_0736: Unknown result type (might be due to invalid IL or missing references) //IL_073b: Unknown result type (might be due to invalid IL or missing references) //IL_0743: Unknown result type (might be due to invalid IL or missing references) //IL_0748: Unknown result type (might be due to invalid IL or missing references) //IL_074f: Unknown result type (might be due to invalid IL or missing references) //IL_0754: Unknown result type (might be due to invalid IL or missing references) //IL_0759: Unknown result type (might be due to invalid IL or missing references) //IL_075b: Unknown result type (might be due to invalid IL or missing references) //IL_0a0f: Unknown result type (might be due to invalid IL or missing references) //IL_0a1a: Unknown result type (might be due to invalid IL or missing references) //IL_0779: Unknown result type (might be due to invalid IL or missing references) //IL_07bf: Unknown result type (might be due to invalid IL or missing references) //IL_07cf: Unknown result type (might be due to invalid IL or missing references) //IL_07df: Unknown result type (might be due to invalid IL or missing references) //IL_07f4: Unknown result type (might be due to invalid IL or missing references) //IL_0858: Unknown result type (might be due to invalid IL or missing references) //IL_085d: Unknown result type (might be due to invalid IL or missing references) //IL_0861: Unknown result type (might be due to invalid IL or missing references) //IL_0875: Unknown result type (might be due to invalid IL or missing references) //IL_087a: Unknown result type (might be due to invalid IL or missing references) //IL_0882: Unknown result type (might be due to invalid IL or missing references) //IL_0887: Unknown result type (might be due to invalid IL or missing references) //IL_0893: Unknown result type (might be due to invalid IL or missing references) //IL_089a: Unknown result type (might be due to invalid IL or missing references) //IL_089f: Unknown result type (might be due to invalid IL or missing references) //IL_08a4: Unknown result type (might be due to invalid IL or missing references) //IL_08a6: Unknown result type (might be due to invalid IL or missing references) //IL_08bc: Unknown result type (might be due to invalid IL or missing references) //IL_08c3: Expected O, but got Unknown //IL_08cb: Unknown result type (might be due to invalid IL or missing references) //IL_08db: Unknown result type (might be due to invalid IL or missing references) //IL_08e1: Invalid comparison between Unknown and I4 if ((Object)(object)agent == (Object)null || !agent.isOnNavMesh) { return; } UpdateBreathingAudio(); if (attackCooldown > 0f) { attackCooldown -= Time.deltaTime; } if (stunTimer > 0f) { stunTimer -= Time.deltaTime; agent.isStopped = true; UpdateAnimations(walking: false, running: false); return; } if (doorOpenPauseTimer > 0f) { doorOpenPauseTimer -= Time.deltaTime; agent.isStopped = true; UpdateAnimations(walking: false, running: false); return; } doorCheckTimer -= Time.deltaTime; if (doorCheckTimer <= 0f) { doorCheckTimer = 0.15f; CheckAndOpenDoors(); } PlayerControllerB val = FindTargetPlayer(); if ((Object)(object)val == (Object)null) { isHuntingInDarkness = false; darknessGraceTimer = 0f; flashlightStalkTimer = 0f; PatrolDungeon(); return; } float num = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position); bool flag = IsPlayerInDarkness(val); if (num < 22f) { spontaneousSpeechTimer -= Time.deltaTime; if (spontaneousSpeechTimer <= 0f) { spontaneousSpeechTimer = Random.Range(40f, 60f); string realName = Plugin.GetRealName(val.playerUsername); if ((Object)(object)NemesisListener.Instance != (Object)null) { NemesisListener.Instance.ForceNemesisSpeak("Voce esta espreitando " + realName + " nos corredores escuros. Sussurre algo para assusta-lo ou fazelo desconfiar dos amigos"); } } } Vector3 val2 = ((Component)this).transform.position + Vector3.up * 1.9f; Vector3 val3 = ((Component)val).transform.position + Vector3.up * 1.4f; bool flag2 = Physics.Linecast(val2, val3, StartOfRound.Instance.collidersAndRoomMaskAndDefault); Vector3 val5; if (flag && (num < 22f || (isHuntingInDarkness && num < 26f))) { isHuntingInDarkness = true; flashlightStalkTimer = 0f; darknessGraceTimer += Time.deltaTime; if (darknessGraceTimer >= 1.8f) { if (!hasPlayedChaseSound) { hasPlayedChaseSound = true; if ((Object)(object)stepSource != (Object)null && (Object)(object)NemesisChaseStartClip != (Object)null) { stepSource.pitch = Random.Range(0.95f, 1.05f); stepSource.PlayOneShot(NemesisChaseStartClip, 0.7f); NemesisNetwork.BroadcastSfxEvent(1); } } agent.isStopped = false; agent.speed = 5.4f; agent.SetDestination(((Component)val).transform.position); if (num < 2f && !flag2 && attackCooldown <= 0f) { attackCooldown = 3.5f; if ((Object)(object)customAnimator != (Object)null) { customAnimator.SetTrigger("Attack"); } NemesisNetwork.BroadcastSfxEvent(2); string realName2 = Plugin.GetRealName(val.playerUsername); NemesisMemory.AddSessionEvent("Nemesis atacou e matou " + realName2 + " na escuridao!"); Vector3 val4 = ((Component)this).transform.forward * 8f + Vector3.up * 3f; if ((Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController) { val5 = default(Vector3); val.KillPlayer(val4, true, (CauseOfDeath)6, 1, val5, false); } else { NemesisNetwork.BroadcastKillPlayer(val.playerClientId, val4); } } } else { agent.isStopped = true; if (!flag2) { Vector3 val6 = default(Vector3); ((Vector3)(ref val6))..ctor(((Component)val).transform.position.x, ((Component)this).transform.position.y, ((Component)val).transform.position.z); ((Component)this).transform.LookAt(val6); } } } else { isHuntingInDarkness = false; darknessGraceTimer = 0f; hasPlayedChaseSound = false; if (!flag && num < 18f) { flashlightStalkTimer += Time.deltaTime; if (flashlightStalkTimer >= 12f) { flashlightStalkTimer = 0f; SabotagePlayerFlashlight(val); } } else { flashlightStalkTimer = Mathf.Max(0f, flashlightStalkTimer - Time.deltaTime); } val5 = ((Component)this).transform.position - ((Component)val).transform.position; Vector3 normalized = ((Vector3)(ref val5)).normalized; float num2 = Vector3.Dot(val.playerEye.forward, normalized); if (!flag && num2 > 0.65f && !flag2 && num < 11.5f && startledRetreatTimer <= 0f) { startledRetreatTimer = 2.2f; val5 = ((Component)this).transform.position - ((Component)val).transform.position; Vector3 normalized2 = ((Vector3)(ref val5)).normalized; Vector3 val7 = Vector3.Cross(Vector3.up, normalized2) * ((Random.value > 0.5f) ? 7f : (-7f)); Vector3 val8 = ((Component)this).transform.position + normalized2 * 18f + val7; NavMeshHit val9 = default(NavMeshHit); if (NavMesh.SamplePosition(val8, ref val9, 10f, -1)) { agent.isStopped = false; agent.speed = 12f; agent.SetDestination(((NavMeshHit)(ref val9)).position); } } if (startledRetreatTimer > 0f) { startledRetreatTimer -= Time.deltaTime; agent.isStopped = false; agent.speed = 12f; } else if (num < 10.5f && !flag2) { agent.isStopped = false; agent.speed = 4.5f; val5 = ((Component)this).transform.position - ((Component)val).transform.position; Vector3 normalized3 = ((Vector3)(ref val5)).normalized; Vector3 val10 = ((Component)this).transform.position + normalized3 * 10f; NavMeshHit val11 = default(NavMeshHit); if (NavMesh.SamplePosition(val10, ref val11, 8f, -1)) { agent.SetDestination(((NavMeshHit)(ref val11)).position); } } else if (num >= 12.5f && num <= 17.5f && !flag2) { agent.isStopped = true; Vector3 val12 = default(Vector3); ((Vector3)(ref val12))..ctor(((Component)val).transform.position.x, ((Component)this).transform.position.y, ((Component)val).transform.position.z); ((Component)this).transform.LookAt(val12); } else { agent.isStopped = false; agent.speed = 6f; stalkTimer -= Time.deltaTime; if (stalkTimer <= 0f) { stalkTimer = 3.5f; Vector2 insideUnitCircle = Random.insideUnitCircle; Vector2 val13 = ((Vector2)(ref insideUnitCircle)).normalized * Random.Range(13f, 16f); Vector3 val14 = ((Component)val).transform.position + new Vector3(val13.x, 0f, val13.y); NavMeshHit val15 = default(NavMeshHit); if (NavMesh.SamplePosition(val14, ref val15, 8f, -1)) { NavMeshPath val16 = new NavMeshPath(); if (agent.CalculatePath(((NavMeshHit)(ref val15)).position, val16) && (int)val16.status == 0) { agent.SetPath(val16); } } } } } float num3; if (!agent.isStopped) { val5 = agent.velocity; num3 = ((Vector3)(ref val5)).magnitude; } else { num3 = 0f; } float num4 = num3; if (num4 <= 0.25f) { UpdateAnimations(walking: false, running: false); } else if ((isHuntingInDarkness && darknessGraceTimer >= 1.8f) || startledRetreatTimer > 0f) { UpdateAnimations(walking: false, running: true); } else { UpdateAnimations(walking: true, running: false); } netSyncTimer -= Time.deltaTime; if (netSyncTimer <= 0f) { netSyncTimer = 0.1f; bool isWalking = (Object)(object)customAnimator != (Object)null && customAnimator.GetBool("IsWalking"); bool isRunning = (Object)(object)customAnimator != (Object)null && customAnimator.GetBool("IsRunning"); NemesisNetwork.BroadcastState(((Component)this).transform.position, ((Component)this).transform.eulerAngles.y, isWalking, isRunning, isHuntingInDarkness, stunTimer > 0f); } } private void UpdateBreathingAudio() { if ((Object)(object)breathingSource == (Object)null || (Object)(object)NemesisBreathingClip == (Object)null) { return; } bool flag = (Object)(object)voiceSource != (Object)null && voiceSource.isPlaying; if (stunTimer > 0f || flag) { if (breathingSource.isPlaying) { breathingSource.Pause(); } return; } if (!breathingSource.isPlaying) { breathingSource.UnPause(); if (!breathingSource.isPlaying) { breathingSource.Play(); } } if (isHuntingInDarkness && darknessGraceTimer >= 1.8f) { breathingSource.pitch = Mathf.Lerp(breathingSource.pitch, 1.15f, Time.deltaTime * 3f); breathingSource.volume = Mathf.Lerp(breathingSource.volume, 0.85f, Time.deltaTime * 3f); } else { breathingSource.pitch = Mathf.Lerp(breathingSource.pitch, 0.88f, Time.deltaTime * 3f); breathingSource.volume = Mathf.Lerp(breathingSource.volume, 0.55f, Time.deltaTime * 3f); } } private void SabotagePlayerFlashlight(PlayerControllerB player) { bool flag = false; FlashlightItem[] componentsInChildren = ((Component)player).GetComponentsInChildren<FlashlightItem>(true); FlashlightItem[] array = componentsInChildren; foreach (FlashlightItem val in array) { if ((Object)(object)val != (Object)null && ((GrabbableObject)val).isBeingUsed) { val.SwitchFlashlight(false); ((GrabbableObject)val).insertedBattery.charge = Mathf.Max(0f, ((GrabbableObject)val).insertedBattery.charge - 0.15f); flag = true; } } if (flag) { string realName = Plugin.GetRealName(player.playerUsername); Plugin.Log.LogInfo((object)("[NEMESIS PODER] Sabotou a lanterna (inclusive no cinto TAB) de " + realName + "!")); NemesisMemory.AddSessionEvent("Nemesis apagou a lanterna de " + realName + " nas sombras."); if ((Object)(object)NemesisListener.Instance != (Object)null) { NemesisListener.Instance.ForceNemesisSpeak("Voce acabou de apagar a lanterna de " + realName + " usando seus poderes! Provoque-o porque ele agora esta no escuro"); } } } private void CheckAndOpenDoors() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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) Vector3 val = ((Component)this).transform.position + ((Component)this).transform.forward * 1.2f; DoorLock[] array = Object.FindObjectsOfType<DoorLock>(); DoorLock[] array2 = array; foreach (DoorLock val2 in array2) { if ((Object)(object)val2 == (Object)null || val2.isLocked) { continue; } float num = Vector3.Distance(val, ((Component)val2).transform.position); if (num <= 3.2f) { Component component = ((Component)val2).gameObject.GetComponent(typeof(AnimatedObjectTrigger)); AnimatedObjectTrigger val3 = (AnimatedObjectTrigger)(object)((component is AnimatedObjectTrigger) ? component : null); if ((Object)(object)val3 == (Object)null) { Component componentInChildren = ((Component)val2).GetComponentInChildren(typeof(AnimatedObjectTrigger)); val3 = (AnimatedObjectTrigger)(object)((componentInChildren is AnimatedObjectTrigger) ? componentInChildren : null); } if ((Object)(object)val3 != (Object)null && !val3.boolValue) { val2.OpenDoorAsEnemyServerRpc(); val3.TriggerAnimation(GameNetworkManager.Instance.localPlayerController); doorOpenPauseTimer = 0.45f; agent.velocity = Vector3.zero; break; } } } } private void PatrolDungeon() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) agent.isStopped = false; agent.speed = 2.5f; Vector3 velocity = agent.velocity; bool walking = ((Vector3)(ref velocity)).sqrMagnitude > 0.1f; UpdateAnimations(walking, running: false); stalkTimer -= Time.deltaTime; if (stalkTimer <= 0f && (Object)(object)RoundManager.Instance != (Object)null && RoundManager.Instance.insideAINodes.Length != 0) { stalkTimer = 6f; GameObject val = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length)]; NavMeshHit val2 = default(NavMeshHit); if (NavMesh.SamplePosition(val.transform.position, ref val2, 5f, -1)) { agent.SetDestination(((NavMeshHit)(ref val2)).position); } } } private void UpdateAnimations(bool walking, bool running) { if (!((Object)(object)customAnimator == (Object)null)) { customAnimator.SetBool("IsWalking", walking); customAnimator.SetBool("IsRunning", running); } } private bool IsPlayerInDarkness(PlayerControllerB player) { if (!player.isInsideFactory) { return false; } GrabbableObject currentlyHeldObjectServer = player.currentlyHeldObjectServer; FlashlightItem val = (FlashlightItem)(object)((currentlyHeldObjectServer is FlashlightItem) ? currentlyHeldObjectServer : null); if (val != null && ((GrabbableObject)val).isBeingUsed) { return false; } if (player.ItemSlots != null) { GrabbableObject[] itemSlots = player.ItemSlots; foreach (GrabbableObject val2 in itemSlots) { FlashlightItem val3 = (FlashlightItem)(object)((val2 is FlashlightItem) ? val2 : null); if (val3 != null && ((GrabbableObject)val3).isBeingUsed) { return false; } } } FlashlightItem[] componentsInChildren = ((Component)player).GetComponentsInChildren<FlashlightItem>(true); FlashlightItem[] array = componentsInChildren; foreach (FlashlightItem val4 in array) { if ((Object)(object)val4 != (Object)null && ((GrabbableObject)val4).isBeingUsed) { return false; } } return true; } private PlayerControllerB FindTargetPlayer() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.allPlayerScripts == null) { return null; } PlayerControllerB val = null; PlayerControllerB val2 = null; float num = 40f; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val3 in allPlayerScripts) { if (!((Object)(object)val3 == (Object)null) && val3.isPlayerControlled && !val3.isPlayerDead && val3.isInsideFactory) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val3).transform.position); if (!string.IsNullOrEmpty(grudgeTargetSteamName) && val3.playerUsername == grudgeTargetSteamName && num2 < 50f) { val = val3; } if (num2 < num) { num = num2; val2 = val3; } } } return ((Object)(object)val != (Object)null) ? val : val2; } } public class NemesisListener : MonoBehaviour, IMicrophoneSubscriber { private readonly List<float> audioBuffer = new List<float>(); private readonly object bufferLock = new object(); private bool isRecordingPhrase = false; private bool isThinking = false; private float cooldownTimer = 0f; private int currentSampleRate = 48000; private const float VoiceThreshold = 0.02f; private readonly Queue<Action> mainThreadActions = new Queue<Action>(); public static NemesisListener Instance; private void Start() { ((MonoBehaviour)this).StartCoroutine(SubscribeToDissonance()); } private IEnumerator SubscribeToDissonance() { DissonanceComms comms = null; while ((Object)(object)comms == (Object)null) { comms = Object.FindObjectOfType<DissonanceComms>(); yield return (object)new WaitForSeconds(1f); } comms.SubscribeToRecordedAudio((IMicrophoneSubscriber)(object)this); Plugin.Log.LogInfo((object)"[NEMESIS OUVIDO] Conectado com sucesso ao sistema de voz do jogo (Dissonance)!"); } private void OnDestroy() { DissonanceComms val = Object.FindObjectOfType<DissonanceComms>(); if ((Object)(object)val != (Object)null) { val.UnsubscribeFromRecordedAudio((IMicrophoneSubscriber)(object)this); } } public void ReceiveMicrophoneData(ArraySegment<float> buffer, WaveFormat format) { if (isThinking || cooldownTimer > 0f) { return; } currentSampleRate = format.SampleRate; float num = 0f; for (int i = 0; i < buffer.Count; i++) { float num2 = buffer.Array[buffer.Offset + i]; float num3 = Mathf.Abs(num2); if (num3 > num) { num = num3; } } if (!isRecordingPhrase && num > 0.02f) { isRecordingPhrase = true; lock (bufferLock) { audioBuffer.Clear(); } UnityMainThreadDispatcher(delegate { ((MonoBehaviour)this).StartCoroutine(RecordAndProcessRoutine()); }); } if (!isRecordingPhrase) { return; } lock (bufferLock) { for (int num4 = 0; num4 < buffer.Count; num4++) { audioBuffer.Add(buffer.Array[buffer.Offset + num4]); } } } public void Reset() { lock (bufferLock) { audioBuffer.Clear(); } } private void UnityMainThreadDispatcher(Action action) { lock (mainThreadActions) { mainThreadActions.Enqueue(action); } } private void Update() { NemesisNetwork.RegisterHandlers(); if (cooldownTimer > 0f) { cooldownTimer -= Time.deltaTime; } lock (mainThreadActions) { while (mainThreadActions.Count > 0) { mainThreadActions.Dequeue()?.Invoke(); } } } private IEnumerator RecordAndProcessRoutine() { PlayerControllerB localPlayer = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)localPlayer == (Object)null || localPlayer.isPlayerDead) { isRecordingPhrase = false; yield break; } if (NemesisNetwork.IsHost && (NemesisBrain.IsBusySpeaking || Time.time < NemesisBrain.GlobalSpeechCooldown)) { isRecordingPhrase = false; cooldownTimer = 2f; yield break; } if (!NemesisNetwork.IsHost && ((Object)(object)NemesisClientMirror.Instance == (Object)null || Vector3.Distance(((Component)localPlayer).transform.position, ((Component)NemesisClientMirror.Instance).transform.position) > 28f)) { isRecordingPhrase = false; cooldownTimer = 2f; yield break; } float recordDuration = (NemesisNetwork.IsHost ? 4f : 3f); Plugin.Log.LogInfo((object)$"[NEMESIS OUVIDO] Voz detectada! Escutando por {recordDuration} segundos..."); yield return (object)new WaitForSeconds(recordDuration); isRecordingPhrase = false; float[] recordedSamples; lock (bufferLock) { recordedSamples = audioBuffer.ToArray(); audioBuffer.Clear(); } if (recordedSamples.Length == 0) { yield break; } if (!NemesisNetwork.IsHost) { int step = Mathf.Max(1, currentSampleRate / 16000); int targetRate = currentSampleRate / step; int outLen = recordedSamples.Length / step; byte[] compact8Bit = new byte[outLen]; for (int i = 0; i < outLen; i++) { float sum = 0f; for (int j = 0; j < step; j++) { sum += recordedSamples[i * step + j]; } float avg = Mathf.Clamp(sum / (float)step, -1f, 1f); compact8Bit[i] = (byte)(avg * 127f + 128f); } Plugin.Log.LogInfo((object)$"[NEMESIS REDE] Enviando fala 16kHz ao Host ({compact8Bit.Length} bytes)..."); NemesisNetwork.SendClientVoiceToHost(localPlayer.playerClientId, targetRate, compact8Bit); cooldownTimer = 10f; } else if (NemesisBrain.IsBusySpeaking || Time.time < NemesisBrain.GlobalSpeechCooldown) { cooldownTimer = 3f; } else { isThinking = true; NemesisBrain.IsBusySpeaking = true; yield return ((MonoBehaviour)this).StartCoroutine(ProcessTranscribedVoiceRoutine(wavBytes: ConvertSamplesToWav(recordedSamples, currentSampleRate), speakerPlayer: localPlayer, speakerUsername: localPlayer.playerUsername, sampleRate: currentSampleRate)); NemesisBrain.IsBusySpeaking = false; cooldownTimer = 6f; isThinking = false; } } public void ProcessRemoteClientVoice(PlayerControllerB speakerPlayer, string speakerUsername, byte[] wavBytes, int sampleRate) { if (NemesisNetwork.IsHost && !isThinking) { ((MonoBehaviour)this).StartCoroutine(RemoteVoiceWrapperRoutine(speakerPlayer, speakerUsername, wavBytes, sampleRate)); } } private IEnumerator RemoteVoiceWrapperRoutine(PlayerControllerB speakerPlayer, string speakerUsername, byte[] wavBytes, int sampleRate) { isThinking = true; yield return ((MonoBehaviour)this).StartCoroutine(ProcessTranscribedVoiceRoutine(speakerPlayer, speakerUsername, wavBytes, sampleRate)); cooldownTimer = 6f; isThinking = false; } private IEnumerator ProcessTranscribedVoiceRoutine(PlayerControllerB speakerPlayer, string speakerUsername, byte[] wavBytes, int sampleRate) { string spokenText = null; yield return ((MonoBehaviour)this).StartCoroutine(TranscribeAudioUnityCoroutine(wavBytes, sampleRate, delegate(string result) { spokenText = result; })); if (string.IsNullOrWhiteSpace(spokenText)) { yield break; } string realPlayerName = Plugin.GetRealName(speakerUsername); Plugin.Log.LogInfo((object)("[NEMESIS OUVIDO] " + realPlayerName + " disse: \"" + spokenText + "\"")); bool isNemesisNear = false; if ((Object)(object)NemesisCreature.ActiveInstance != (Object)null && (Object)(object)speakerPlayer != (Object)null) { float dist = Vector3.Distance(((Component)speakerPlayer).transform.position, ((Component)NemesisCreature.ActiveInstance).transform.position); if (dist <= 28f) { isNemesisNear = true; } } if (isNemesisNear) { Task<string> aiTask = NemesisBrain.AskGeminiAsync(realPlayerName, spokenText); while (!aiTask.IsCompleted) { yield return null; } string replyText = aiTask.Result; if (!string.IsNullOrEmpty(replyText)) { yield return ((MonoBehaviour)this).StartCoroutine(NemesisBrain.GenerateSinisterVoiceCoroutine(replyText, delegate(AudioClip audioClip) { PlaySinisterAudioInWorld(audioClip); })); } } else { NemesisMemory.AddSessionEvent(realPlayerName + " disse (longe): \"" + spokenText + "\""); Plugin.Log.LogInfo((object)("[NEMESIS MEMORIA] Fala de " + realPlayerName + " anotada em silencio (Nemesis fora de alcance).")); } } private IEnumerator TranscribeAudioUnityCoroutine(byte[] wavData, int sampleRate, Action<string> onComplete) { string azureKey = Plugin.AzureSpeechKey.Value?.Trim(); string azureRegion = Plugin.AzureSpeechRegion.Value?.Trim().ToLower().Replace(" ", ""); if (string.IsNullOrWhiteSpace(azureKey) || azureKey == "COLE_SUA_CHAVE_AZURE_AQUI") { onComplete?.Invoke(null); yield break; } string url = new UriBuilder { Scheme = "https", Host = azureRegion + ".stt.speech.microsoft.com", Path = "speech/recognition/conversation/cognitiveservices/v1", Query = "language=pt-BR" }.Uri.ToString(); Plugin.Log.LogInfo((object)("[NEMESIS DEBUG] Conectando em: " + url)); Task<string> requestTask = Task.Run(delegate { try { ServicePointManager.ServerCertificateValidationCallback = (object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors sslPolicyErrors) => true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url); httpWebRequest.Method = "POST"; httpWebRequest.Headers.Add("Ocp-Apim-Subscription-Key", azureKey); httpWebRequest.ContentType = $"audio/wav; codecs=audio/pcm; samplerate={sampleRate}"; httpWebRequest.ContentLength = wavData.Length; using (Stream stream = httpWebRequest.GetRequestStream()) { stream.Write(wavData, 0, wavData.Length); } using HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse(); using StreamReader streamReader = new StreamReader(httpWebResponse.GetResponseStream()); return streamReader.ReadToEnd(); } catch (WebException ex) { if (ex.Response != null) { using StreamReader streamReader2 = new StreamReader(ex.Response.GetResponseStream()); Plugin.Log.LogError((object)("[NEMESIS STT] Resposta de erro do Azure: " + streamReader2.ReadToEnd())); } else { Plugin.Log.LogError((object)("[NEMESIS STT] Falha de rede Windows: " + ex.Message)); } return (string)null; } catch (Exception ex2) { Plugin.Log.LogError((object)("[NEMESIS STT] Erro geral: " + ex2.Message)); return (string)null; } }); while (!requestTask.IsCompleted) { yield return null; } string json = requestTask.Result; if (!string.IsNullOrEmpty(json)) { Match match = Regex.Match(json, "\"DisplayText\":\\s*\"(?<text>.*?)\""); if (match.Success) { onComplete?.Invoke(Regex.Unescape(match.Groups["text"].Value).Trim()); yield break; } Plugin.Log.LogInfo((object)("[NEMESIS STT] Azure retornou sem fala: " + json)); } onComplete?.Invoke(null); } private void PlaySinisterAudioInWorld(AudioClip clip) { if (!((Object)(object)clip == (Object)null) && !((Object)(object)NemesisCreature.ActiveInstance == (Object)null)) { GameObject gameObject = ((Component)NemesisCreature.ActiveInstance).gameObject; AudioSource val = gameObject.GetComponent<AudioSource>(); if ((Object)(object)val == (Object)null) { val = gameObject.AddComponent<AudioSource>(); } AudioReverbFilter component = gameObject.GetComponent<AudioReverbFilter>(); if ((Object)(object)component == (Object)null) { component = gameObject.AddComponent<AudioReverbFilter>(); component.reverbPreset = (AudioReverbPreset)9; } AudioDistortionFilter component2 = gameObject.GetComponent<AudioDistortionFilter>(); if ((Object)(object)component2 == (Object)null) { component2 = gameObject.AddComponent<AudioDistortionFilter>(); component2.distortionLevel = 0.35f; } AudioEchoFilter component3 = gameObject.GetComponent<AudioEchoFilter>(); if ((Object)(object)component3 == (Object)null) { component3 = gameObject.AddComponent<AudioEchoFilter>(); component3.delay = 140f; component3.decayRatio = 0.35f; component3.wetMix = 0.45f; } val.spatialBlend = 1f; val.pitch = 0.92f; val.volume = 1f; val.PlayOneShot(clip); Plugin.Log.LogInfo((object)"[NEMESIS VOZ] O Nemesis falou nas sombras!"); } } private EnemyAI FindNearestEnemy(Vector3 position, float maxRadius) { //IL_0036: 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) EnemyAI[] array = Object.FindObjectsOfType<EnemyAI>(); EnemyAI result = null; float num = maxRadius; EnemyAI[] array2 = array; foreach (EnemyAI val in array2) { if (!((Object)(object)val == (Object)null) && !val.isEnemyDead) { float num2 = Vector3.Distance(position, ((Component)val).transform.position); if (num2 < num) { num = num2; result = val; } } } return result; } private byte[] ConvertSamplesToWav(float[] samples, int sampleRate) { using MemoryStream memoryStream = new MemoryStream(); using BinaryWriter binaryWriter = new BinaryWriter(memoryStream); int value = sampleRate * 2; binaryWriter.Write(Encoding.ASCII.GetBytes("RIFF")); binaryWriter.Write(36 + samples.Length * 2); binaryWriter.Write(Encoding.ASCII.GetBytes("WAVE")); binaryWriter.Write(Encoding.ASCII.GetBytes("fmt ")); binaryWriter.Write(16); binaryWriter.Write((short)1); binaryWriter.Write((short)1); binaryWriter.Write(sampleRate); binaryWriter.Write(value); binaryWriter.Write((short)2); binaryWriter.Write((short)16); binaryWriter.Write(Encoding.ASCII.GetBytes("data")); binaryWriter.Write(samples.Length * 2); foreach (float num in samples) { short value2 = (short)(Mathf.Clamp(num, -1f, 1f) * 32767f); binaryWriter.Write(value2); } return memoryStream.ToArray(); } private void Awake() { Instance = this; } public void ForceNemesisSpeak(string situationContext) { if (NemesisNetwork.IsHost && !isThinking && !NemesisBrain.IsBusySpeaking && !(Time.time < NemesisBrain.GlobalSpeechCooldown) && !((Object)(object)NemesisCreature.ActiveInstance == (Object)null)) { ((MonoBehaviour)this).StartCoroutine(SpontaneousSpeakRoutine(situationContext)); } } private IEnumerator SpontaneousSpeakRoutine(string situationContext) { isThinking = true; NemesisBrain.IsBusySpeaking = true; NemesisBrain.GlobalSpeechCooldown = Time.time + 15f; Task<string> aiTask = NemesisBrain.TriggerSpontaneousSpeechAsync(situationContext); while (!aiTask.IsCompleted) { yield return null; } string replyText = aiTask.Result; if (!string.IsNullOrEmpty(replyText)) { yield return ((MonoBehaviour)this).StartCoroutine(NemesisBrain.GenerateSinisterVoiceCoroutine(replyText, delegate(AudioClip audioClip) { PlaySinisterAudioInWorld(audioClip); })); } NemesisBrain.IsBusySpeaking = false; cooldownTimer = 6f; isThinking = false; } } public class NemesisMemory { private static readonly string MemoryFilePath = Path.Combine(Paths.ConfigPath, "Nemesis_LongTermMemory.txt"); public static List<string> PermanentMemories = new List<string>(); public static List<string> CurrentSessionEvents = new List<string>(); public static void LoadMemory() { try { if (File.Exists(MemoryFilePath)) { string[] collection = File.ReadAllLines(MemoryFilePath, Encoding.UTF8); PermanentMemories = new List<string>(collection); Plugin.Log.LogInfo((object)$"[NEMESIS MEMORIA] {PermanentMemories.Count} memorias antigas carregadas do PC."); } else { File.WriteAllText(MemoryFilePath, "A entidade despertou pela primeira vez. Ainda nao conhece estes humanos.\n", Encoding.UTF8); PermanentMemories.Add("A entidade despertou pela primeira vez. Ainda nao conhece estes humanos."); Plugin.Log.LogInfo((object)"[NEMESIS MEMORIA] Novo arquivo de memoria criado!"); } } catch (Exception ex) { Plugin.Log.LogError((object)("[NEMESIS MEMORIA] Erro ao carregar memoria: " + ex.Message)); } } public static void AddSessionEvent(string eventDescription) { string text = DateTime.Now.ToString("HH:mm"); string text2 = "[" + text + "] " + eventDescription; CurrentSessionEvents.Add(text2); Plugin.Log.LogInfo((object)("[NEMESIS LOG] Evento anotado: " + text2)); } public static void SavePermanentMemory(string newMemory) { try { string text = DateTime.Now.ToString("dd/MM/yyyy"); string text2 = "(" + text + ") " + newMemory; PermanentMemories.Add(text2); File.AppendAllText(MemoryFilePath, text2 + Environment.NewLine, Encoding.UTF8); Plugin.Log.LogInfo((object)("[NEMESIS MEMORIA] Nova lembranca gravada para sempre: " + text2)); } catch (Exception ex) { Plugin.Log.LogError((object)("[NEMESIS MEMORIA] Erro ao salvar memoria: " + ex.Message)); } } public static string BuildContextForAI() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("=== MEMORIAS DE PARTIDAS PASSADAS (O QUE VOCE LEMBRA DESTES JOGADORES) ==="); foreach (string permanentMemory in PermanentMemories) { stringBuilder.AppendLine("- " + permanentMemory); } stringBuilder.AppendLine("\n=== O QUE ACONTECEU NESTA PARTIDA HOJE ==="); int num = Math.Max(0, CurrentSessionEvents.Count - 15); for (int i = num; i < CurrentSessionEvents.Count; i++) { stringBuilder.AppendLine("- " + CurrentSessionEvents[i]); } return stringBuilder.ToString(); } } public static class NemesisNetwork { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnReceiveSyncState; public static HandleNamedMessageDelegate <1>__OnReceiveDespawn; public static HandleNamedMessageDelegate <2>__OnReceivePlaySfx; public static HandleNamedMessageDelegate <3>__OnReceivePlayVoice; public static HandleNamedMessageDelegate <4>__OnReceiveClientHit; public static HandleNamedMessageDelegate <5>__OnReceiveClientVoice; public static HandleNamedMessageDelegate <6>__OnReceiveKillPlayer; } private const string MSG_SYNC_STATE = "Nemesis_SyncState"; private const string MSG_DESPAWN = "Nemesis_Despawn"; private const string MSG_PLAY_SFX = "Nemesis_PlaySfx"; private const string MSG_PLAY_VOICE = "Nemesis_PlayVoice"; private const string MSG_CLIENT_HIT = "Nemesis_ClientHit"; private const string MSG_CLIENT_VOICE = "Nemesis_ClientVoice"; private const string MSG_KILL_PLAYER = "Nemesis_KillPlayer"; private static bool isRegistered; public static bool IsHost => (Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsServer; public static void RegisterHandlers() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown if (!isRegistered && !((Object)(object)NetworkManager.Singleton == (Object)null) && NetworkManager.Singleton.CustomMessagingManager != null) { CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager; object obj = <>O.<0>__OnReceiveSyncState; if (obj == null) { HandleNamedMessageDelegate val = OnReceiveSyncState; <>O.<0>__OnReceiveSyncState = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler("Nemesis_SyncState", (HandleNamedMessageDelegate)obj); object obj2 = <>O.<1>__OnReceiveDespawn; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnReceiveDespawn; <>O.<1>__OnReceiveDespawn = val2; obj2 = (object)val2; } customMessagingManager.RegisterNamedMessageHandler("Nemesis_Despawn", (HandleNamedMessageDelegate)obj2); object obj3 = <>O.<2>__OnReceivePlaySfx; if (obj3 == null) { HandleNamedMessageDelegate val3 = OnReceivePlaySfx; <>O.<2>__OnReceivePlaySfx = val3; obj3 = (object)val3; } customMessagingManager.RegisterNamedMessageHandler("Nemesis_PlaySfx", (HandleNamedMessageDelegate)obj3); object obj4 = <>O.<3>__OnReceivePlayVoice; if (obj4 == null) { HandleNamedMessageDelegate val4 = OnReceivePlayVoice; <>O.<3>__OnReceivePlayVoice = val4; obj4 = (object)val4; } customMessagingManager.RegisterNamedMessageHandler("Nemesis_PlayVoice", (HandleNamedMessageDelegate)obj4); object obj5 = <>O.<4>__OnReceiveClientHit; if (obj5 == null) { HandleNamedMessageDelegate val5 = OnReceiveClientHit; <>O.<4>__OnReceiveClientHit = val5; obj5 = (object)val5; } customMessagingManager.RegisterNamedMessageHandler("Nemesis_ClientHit", (HandleNamedMessageDelegate)obj5); object obj6 = <>O.<5>__OnReceiveClientVoice; if (obj6 == null) { HandleNamedMessageDelegate val6 = OnReceiveClientVoice; <>O.<5>__OnReceiveClientVoice = val6; obj6 = (object)val6; } customMessagingManager.RegisterNamedMessageHandler("Nemesis_ClientVoice", (HandleNamedMessageDelegate)obj6); object obj7 = <>O.<6>__OnReceiveKillPlayer; if (obj7 == null) { HandleNamedMessageDelegate val7 = OnReceiveKillPlayer; <>O.<6>__OnReceiveKillPlayer = val7; obj7 = (object)val7; } customMessagingManager.RegisterNamedMessageHandler("Nemesis_KillPlayer", (HandleNamedMessageDelegate)obj7); isRegistered = true; Plugin.Log.LogInfo((object)"[NEMESIS REDE] Handlers multiplayer registrados com sucesso!"); } } public static void UnregisterHandlers() { isRegistered = false; } public unsafe static void BroadcastState(Vector3 pos, float rotY, bool isWalking, bool isRunning, bool isHunting, bool isStunned) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_009b: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) if (!IsHost || (Object)(object)NetworkManager.Singleton == (Object)null || NetworkManager.Singleton.CustomMessagingManager == null) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(64, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref pos.x, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref pos.y, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref pos.z, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref rotY, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref isWalking, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref isRunning, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref isHunting, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref isStunned, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Nemesis_SyncState", val, (NetworkDelivery)2); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } public unsafe static void BroadcastDespawn() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (!IsHost || (Object)(object)NetworkManager.Singleton == (Object)null || NetworkManager.Singleton.CustomMessagingManager == null) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(8, (Allocator)2, -1); try { bool flag = true; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Nemesis_Despawn", val, (NetworkDelivery)2); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } public unsafe static void BroadcastSfxEvent(byte eventType) { //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_0058: Unknown result type (might be due to invalid IL or missing references) if (!IsHost || (Object)(object)NetworkManager.Singleton == (Object)null || NetworkManager.Singleton.CustomMessagingManager == null) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(8, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref eventType, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Nemesis_PlaySfx", val, (NetworkDelivery)2); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } public unsafe static void BroadcastVoiceWav(byte[] wavBytes) { //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) if (!IsHost || wavBytes == null || wavBytes.Length < 44 || (Object)(object)NetworkManager.Singleton == (Object)null || NetworkManager.Singleton.CustomMessagingManager == null) { return; } byte[] array = CompressWav16To8Bit(wavBytes); if (array == null || array.Length > 63000) { Plugin.Log.LogWarning((object)$"[NEMESIS REDE] Voz compactada ainda grande ({((array != null) ? array.Length : 0)} bytes), truncando para 62KB."); if (array == null) { return; } Array.Resize(ref array, 62000); } Plugin.Log.LogInfo((object)$"[NEMESIS REDE] Enviando voz compactada ({array.Length} bytes) para os clientes!"); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(array.Length + 8, (Allocator)2, -1); try { int num = array.Length; ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteBytesSafe(array, array.Length, 0); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Nemesis_PlayVoice", val, (NetworkDelivery)4); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } public unsafe static void BroadcastKillPlayer(ulong targetPlayerClientId, Vector3 velocity) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a4: Unknown result type (might be due to invalid IL or missing references) if (!IsHost || (Object)(object)NetworkManager.Singleton == (Object)null || NetworkManager.Singleton.CustomMessagingManager == null) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(32, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref targetPlayerClientId, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref velocity.x, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref velocity.y, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref velocity.z, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Nemesis_KillPlayer", val, (NetworkDelivery)2); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } public unsafe static void SendHitToHost(string attackerSteamName) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (IsHost || (Object)(object)NetworkManager.Singleton == (Object)null || NetworkManager.Singleton.CustomMessagingManager == null) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(128, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe(attackerSteamName ?? "", false); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("Nemesis_ClientHit", 0uL, val, (NetworkDelivery)2); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } public unsafe static void SendClientVoiceToHost(ulong speakerClientId, int sampleRate, byte[] wavBytes) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) if (IsHost || wavBytes == null || wavBytes.Length == 0 || wavBytes.Length > 62000 || (Object)(object)NetworkManager.Singleton == (Object)null || NetworkManager.Singleton.CustomMessagingManager == null) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(wavBytes.Length + 32, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref speakerClientId, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref sampleRate, default(ForPrimitives)); int num = wavBytes.Length; ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteBytesSafe(wavBytes, wavBytes.Length, 0); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("Nemesis_ClientVoice", 0uL, val, (NetworkDelivery)4); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } private static void OnReceiveSyncState(ulong senderClientId, FastBufferReader reader) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) if (!IsHost) { float num = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num, default(ForPrimitives)); float num2 = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num2, default(ForPrimitives)); float num3 = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num3, default(ForPrimitives)); float rotY = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref rotY, default(ForPrimitives)); bool walking = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref walking, default(ForPrimitives)); bool running = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref running, default(ForPrimitives)); bool hunting = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref hunting, default(ForPrimitives)); bool stunned = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref stunned, default(ForPrimitives)); NemesisClientMirror.ReceiveNetworkState(new Vector3(num, num2, num3), rotY, walking, running, hunting, stunned); } } private static void OnReceiveDespawn(ulong senderClientId, FastBufferReader reader) { if (!IsHost) { NemesisClientMirror.DespawnMirror(); } } private static void OnReceivePlaySfx(ulong senderClientId, FastBufferReader reader) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (!IsHost) { byte eventType = default(byte); ((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref eventType, default(ForPrimitives)); NemesisClientMirror.TriggerRemoteSfx(eventType); } } private static void OnReceivePlayVoice(ulong senderClientId, FastBufferReader reader) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (!IsHost) { int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); if (num > 0 && num <= 63000) { byte[] packedData = new byte[num]; ((FastBufferReader)(ref reader)).ReadBytesSafe(ref packedData, num, 0); Plugin.Log.LogInfo((object)$"[NEMESIS CLIENTE] Voz recebida do Host ({num} bytes)!"); NemesisClientMirror.PlayRemoteVoice8Bit(packedData); } } } private static byte[] CompressWav16To8Bit(byte[] wavFile) { int value = BitConverter.ToInt32(wavFile, 24); int num; for (int i = 12; i < wavFile.Length - 8; i += 8 + num) { string text = Encoding.ASCII.GetString(wavFile, i, 4); num = BitConverter.ToInt32(wavFile, i + 4); if (text == "data") { i += 8; int num2 = Mathf.Min(num / 2, (wavFile.Length - i) / 2); byte[] array = new byte[4 + num2]; Buffer.BlockCopy(BitConverter.GetBytes(value), 0, array, 0, 4); for (int j = 0; j < num2; j++) { short num3 = BitConverter.ToInt16(wavFile, i + j * 2); array[4 + j] = (byte)((num3 >> 8) + 128); } return array; } } return null; } private static void OnReceiveKillPlayer(ulong senderClientId, FastBufferReader reader) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_00a1: Unknown result type (might be due to invalid IL or missing references) ulong num = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref num, default(ForPrimitives)); float num2 = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num2, default(ForPrimitives)); float num3 = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num3, default(ForPrimitives)); float num4 = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num4, default(ForPrimitives)); PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val != (Object)null && val.playerClientId == num && !val.isPlayerDead) { val.KillPlayer(new Vector3(num2, num3, num4), true, (CauseOfDeath)6, 1, default(Vector3), false); } } private static void OnReceiveClientHit(ulong senderClientId, FastBufferReader reader) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (IsHost) { string username = default(string); ((FastBufferReader)(ref reader)).ReadValueSafe(ref username, false); if ((Object)(object)NemesisCreature.ActiveInstance != (Object)null) { PlayerControllerB playerWhoHit = FindPlayerByUsername(username); NemesisCreature.ActiveInstance.Hit(1, Vector3.zero, playerWhoHit); } } } private static void OnReceiveClientVoice(ulong senderClientId, FastBufferReader reader) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (!IsHost) { return; } ulong clientId = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref clientId, default(ForPrimitives)); int sampleRate = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref sampleRate, default(ForPrimitives)); int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); if (num > 0 && num <= 62000) { byte[] samples8Bit = new byte[num]; ((FastBufferReader)(ref reader)).ReadBytesSafe(ref samples