using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using AAACompany.Compatability; using AAACompany.Components; using AAACompany.NetcodePatcher; using AAACompany.Patches; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using JLL; using JLL.API; using JLLItemsModule.Components; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using Microsoft.CodeAnalysis; using Unity.Collections; using Unity.Netcode; using UnityEngine; [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: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: AssemblyCompany("AAACompany")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AAACompany")] [assembly: AssemblyTitle("AAACompany")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace AAACompany { [BepInPlugin("JacobG5.AAACompany", "AAACompany", "1.0.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class AAAPlugin : BaseUnityPlugin { [CompilerGenerated] private sealed class d__17 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public List coroutines; public AAAPlugin <>4__this; private VoicePack[] 5__1; private List 5__2; private int 5__3; private List.Enumerator <>s__4; private Coroutine 5__5; private VoicePack[] <>s__6; private int <>s__7; private VoicePack 5__8; private Dictionary.KeyCollection.Enumerator <>s__9; private string 5__10; private List.Enumerator <>s__11; private string 5__12; private List 5__13; private VoicePack[] <>s__14; private int <>s__15; private VoicePack 5__16; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__17(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; <>s__4 = default(List.Enumerator); 5__5 = null; <>s__6 = null; 5__8 = default(VoicePack); <>s__9 = default(Dictionary.KeyCollection.Enumerator); 5__10 = null; <>s__11 = default(List.Enumerator); 5__12 = null; 5__13 = null; <>s__14 = null; 5__16 = default(VoicePack); <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (coroutines.Count == 0) { mls.LogError((object)"No voice packs were loaded. Bad!"); return false; } <>s__4 = coroutines.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; 5__5 = null; break; } if (<>s__4.MoveNext()) { 5__5 = <>s__4.Current; <>2__current = 5__5; <>1__state = 1; return true; } <>m__Finally1(); <>s__4 = default(List.Enumerator); 5__1 = VoicePack.GetAll(); 5__2 = new List(); 5__3 = 0; <>s__6 = 5__1; for (<>s__7 = 0; <>s__7 < <>s__6.Length; <>s__7++) { 5__8 = <>s__6[<>s__7]; <>s__9 = 5__8.Keys.GetEnumerator(); try { while (<>s__9.MoveNext()) { 5__10 = <>s__9.Current; if (!5__2.Contains(5__10)) { 5__2.Add(5__10); } 5__10 = null; } } finally { ((IDisposable)<>s__9).Dispose(); } <>s__9 = default(Dictionary.KeyCollection.Enumerator); 5__8 = default(VoicePack); } <>s__6 = null; <>s__11 = 5__2.GetEnumerator(); try { while (<>s__11.MoveNext()) { 5__12 = <>s__11.Current; 5__13 = new List(); <>s__14 = 5__1; for (<>s__15 = 0; <>s__15 < <>s__14.Length; <>s__15++) { 5__16 = <>s__14[<>s__15]; 5__13.AddRange(5__16[5__12]); 5__16 = default(VoicePack); } <>s__14 = null; VoicePack.Every.Append(5__12, 5__13.ToArray()); 5__3 += 5__13.Count; 5__13 = null; 5__12 = null; } } finally { ((IDisposable)<>s__11).Dispose(); } <>s__11 = default(List.Enumerator); mls.LogInfo((object)$"All voices imported. {5__2.Count} Events + {5__3} Clips | Registered Voices:\n{string.Join('\n', VoicePack.GetKeys())}"); return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>s__4).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__16 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string path; public AAAPlugin <>4__this; private AssetBundleCreateRequest 5__1; private AssetBundle 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = AssetBundle.LoadFromFileAsync(path); <>2__current = 5__1; <>1__state = 1; return true; case 1: <>1__state = -1; 5__2 = 5__1.assetBundle; if (5__2.isStreamedSceneAssetBundle) { mls.LogError((object)("Bundle containted Streamed Scene Assets: " + path)); return false; } VoicePack.Import(5__2); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const string modGUID = "JacobG5.AAACompany"; private const string modName = "AAACompany"; private const string modVersion = "1.0.2"; private readonly Harmony harmony = new Harmony("JacobG5.AAACompany"); private static ManualLogSource mls; public static ConfigEntry voicePreference; public static ConfigEntry randomBlacklist; public static ConfigEntry speachFrequency; public static ConfigEntry randomFrequency; public static ConfigEntry speachVolume; public static ConfigEntry speachPitch; public static ConfigEntry otherVolume; public static ConfigEntry creaturesHear; public static ConfigEntry extendedLogs; public void Awake() { mls = Logger.CreateLogSource("JacobG5.AAACompany"); extendedLogs = ((BaseUnityPlugin)this).Config.Bind("Debug", "Extended Logs", false, "Enables logging of debug data."); voicePreference = ((BaseUnityPlugin)this).Config.Bind("Voice", "Preference", "Random", "Prefered voice. If invalid will select random."); randomBlacklist = ((BaseUnityPlugin)this).Config.Bind("Voice", "Random Blacklist", "", "Blacklisted voices from random selection. ',' seperated"); voicePreference.SettingChanged += delegate { AAANetwork.Instance?.UpdateMyVoice(); }; creaturesHear = ((BaseUnityPlugin)this).Config.Bind("Voice", "Creatures Hear", true, "Allows monsters like Eyeless Dogs to hear character voice lines."); speachFrequency = ((BaseUnityPlugin)this).Config.Bind("Voice", "Frequency", 1f, "Chance multiplier on if you should speak. Only applies to your own voice. (Multiplier)"); randomFrequency = ((BaseUnityPlugin)this).Config.Bind("Voice", "Passive Timer", 40f, "Time between passive voice lines."); speachVolume = ((BaseUnityPlugin)this).Config.Bind("Voice", "Self Volume", 0.8f, "Volume of your own voice lines"); speachVolume.SettingChanged += delegate { if ((Object)(object)AAANetwork.Instance != (Object)null) { AAANetwork.Instance.localVoiceSource.volume = speachVolume.Value; } }; speachPitch = ((BaseUnityPlugin)this).Config.Bind("Voice", "Self Pitch", 1f, "Pitch of your own voice lines."); speachPitch.SettingChanged += delegate { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)AAANetwork.Instance != (Object)null) { AAANetwork.Instance.SetMyPitchRpc(speachPitch.Value); } }; otherVolume = ((BaseUnityPlugin)this).Config.Bind("Voice", "Other Volume", 0.8f, "Volume of your crew's voice lines."); otherVolume.SettingChanged += delegate { if ((Object)(object)AAANetwork.Instance != (Object)null) { foreach (var (val, val2, voicePack) in AAANetwork.Instance.Voices.Values) { if (!((NetworkBehaviour)val).IsOwner) { val2.volume = otherVolume.Value; } } } }; if (JCompatabilityHelper.IsLoaded((CachedMods)5)) { AAALethalConfig.Init(); } JLL.NetcodePatch(mls, new Type[1] { typeof(AAANetwork) }); JLL.Instance.networkObject.AddComponent(); JLL.HarmonyPatch(harmony, mls, new Type[1] { typeof(AAAPatches) }); string[] files = Directory.GetFiles(Paths.PluginPath, "*.cvpbundle", SearchOption.AllDirectories); DebugLog($"{files.Length} *.cvpbundle found in plugins. Loading..."); List list = new List(); string[] array = files; foreach (string path in array) { list.Add(((MonoBehaviour)this).StartCoroutine(LoadCharacterVoiceBundle(path))); } ((MonoBehaviour)this).StartCoroutine(AllVoicesLoaded(list)); } internal static void DebugLog(string message, bool warn = false) { if (extendedLogs.Value) { if (warn) { mls.LogWarning((object)message); } else { mls.LogInfo((object)message); } } } [IteratorStateMachine(typeof(d__16))] private IEnumerator LoadCharacterVoiceBundle(string path) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__16(0) { <>4__this = this, path = path }; } [IteratorStateMachine(typeof(d__17))] private IEnumerator AllVoicesLoaded(List coroutines) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__17(0) { <>4__this = this, coroutines = coroutines }; } } public readonly struct VoicePack { private static readonly Dictionary _characterVoicePacks = new Dictionary(); public static readonly VoicePack Unknown = new VoicePack("Unknown"); public static readonly VoicePack Every = new VoicePack("Every"); public readonly string Name; private readonly Dictionary _clips; public Dictionary.KeyCollection Keys => _clips.Keys; public AudioClip[] this[string key] { get { AudioClip[] value; return _clips.TryGetValue(key.ToLower(), out value) ? value : Array.Empty(); } } private VoicePack(string name) { Name = name; _clips = new Dictionary(); } public static VoicePack Get(string identifier) { if (_characterVoicePacks.TryGetValue(identifier, out var value)) { return value; } if (identifier.Equals("every")) { return Every; } return Unknown; } public static bool ContainsKey(string key) { return _characterVoicePacks.ContainsKey(key) || key.Equals("every"); } public static string[] GetKeys() { return _characterVoicePacks.Keys.ToArray(); } public static VoicePack[] GetAll() { return _characterVoicePacks.Values.ToArray(); } public static void Import(AssetBundle bundle) { string[] allAssetNames = bundle.GetAllAssetNames(); Array.Sort(allAssetNames); Dictionary>> dictionary = new Dictionary>>(); string[] array = allAssetNames; foreach (string text in array) { if (!text.EndsWith(".ogg")) { continue; } string[] array2 = text.Split('/'); if (array2.Length < 3) { continue; } AudioClip val = bundle.LoadAsset(text); if (!((Object)(object)val == (Object)null)) { string key = array2[1]; if (!dictionary.TryGetValue(key, out var value)) { dictionary.Add(key, value = new Dictionary>()); } string key2 = string.Join('/', array2.Skip(2).SkipLast(1)); if (!value.TryGetValue(key2, out var value2)) { value.Add(key2, value2 = new List()); } value2.Add(val); } } foreach (KeyValuePair>> item in dictionary) { VoicePack value3 = new VoicePack(item.Key); int num = 0; foreach (KeyValuePair> item2 in item.Value) { value3.Append(item2.Key, item2.Value.ToArray()); num += item2.Value.Count; } _characterVoicePacks[value3.Name] = value3; AAAPlugin.DebugLog($"Loaded {value3.Name}: {item.Value.Count} Events + {num} Clips"); } } public void Append(string key, AudioClip[] clips) { _clips[key] = clips; } } } namespace AAACompany.Patches { internal static class AAAPatches { [HarmonyPatch(typeof(StartOfRound), "OnClientConnect")] [HarmonyPostfix] public static void OnClientConnect_Postfix(ulong clientId, StartOfRound __instance) { if (((NetworkBehaviour)__instance).IsServer) { AAANetwork.Instance.UpdateAllVoicesFor(clientId); } } [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] [HarmonyPostfix] public static void ConnectClientToPlayerObject_Postfix(PlayerControllerB __instance) { AAANetwork.Instance.UpdateMyVoice(); } [HarmonyPatch(typeof(PlayerControllerB), "SpawnPlayerAnimation")] [HarmonyPostfix] public static void SpawnPlayerAnimation_Postfix(PlayerControllerB __instance) { AAANetwork.Instance.PlayVoiceEventLocal((((NetworkBehaviour)__instance).IsHost && Random.value < 0.7f) ? "Spawn/Host" : "Spawn", 2f, replace: true); } [HarmonyPatch(typeof(StartOfRound), "DisableShipSpeaker")] [HarmonyPostfix] public static void DisableShipSpeaker_Postfix() { AAANetwork.Instance.PlayVoiceEventLocal("Speaker/Disable", 1f); } [HarmonyPatch(typeof(Terminal), "BeginUsingTerminal")] [HarmonyPostfix] public static void BeginUsingTerminal_Postfix() { AAANetwork.Instance.PlayVoiceEventLocal("Terminal/Use", 0.5f); } [HarmonyPatch(typeof(StartMatchLever), "PullLever")] [HarmonyPrefix] public static void PullLever_Postfix(StartMatchLever __instance) { AAANetwork.Instance.PlayVoiceEventLocal(__instance.leverHasBeenPulled ? "Lever/Land" : "Lever/Leave", 1f); } [HarmonyPatch(typeof(VehicleController), "SetIgnition")] [HarmonyPostfix] public static void SetIgnition_Postfix(bool started, VehicleController __instance) { if (started && __instance.localPlayerInControl) { AAANetwork.Instance.PlayVoiceEventLocal("Cruiser/Ignition/Success", 1f, replace: true); } } [HarmonyPatch(typeof(VehicleController), "StartTryCarIgnition")] [HarmonyPrefix] public static void StartTryCarIgnition_Prefix(VehicleController __instance, Coroutine ___keyIgnitionCoroutine) { if (__instance.localPlayerInControl && !__instance.ignitionStarted && ___keyIgnitionCoroutine == null) { AAANetwork.Instance.PlayVoiceEventLocal("Cruiser/Ignition/Attempt", 0.12f); } } [HarmonyPatch(typeof(VehicleController), "ReactToDamage")] [HarmonyPrefix] public static void ReactToDamage_Prefix(VehicleController __instance, bool ___isHoodOnFire) { if (__instance.localPlayerInControl && __instance.carHP < 3 && !___isHoodOnFire) { AAANetwork.Instance.PlayVoiceEventLocal("Cruiser/Burning", 1f, replace: true); } } [HarmonyPatch(typeof(EntranceTeleport), "TeleportPlayer")] [HarmonyPostfix] public static void TeleportPlayer_Postfix(EntranceTeleport __instance) { if ((Object)(object)__instance.exitScript == (Object)null) { AAANetwork.Instance.PlayVoiceEventLocal("Entrance/Blocked", 1f, replace: true); } else if (__instance.isEntranceToBuilding) { AAANetwork.Instance.PlayVoiceEventLocal("Entrance/Enter"); } else { AAANetwork.Instance.PlayVoiceEventLocal("Entrance/Exit"); } } [HarmonyPatch(typeof(JesterAI), "Update")] [HarmonyPrefix] public static void Update_Prefix(JesterAI __instance, int ___previousState) { //IL_0058: 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) if (((EnemyAI)__instance).currentBehaviourStateIndex == ___previousState) { return; } PlayerControllerB localPlayerController = RoundManager.Instance.playersManager.localPlayerController; if (localPlayerController.isInsideFactory == ((EnemyAI)__instance).isOutside) { return; } switch (((EnemyAI)__instance).currentBehaviourStateIndex) { case 1: if (Vector3.Distance(((Component)localPlayerController).transform.position, ((Component)__instance).transform.position) < 10f) { AAANetwork.Instance.PlayVoiceEventLocal("Jester/Cranking", 0.8f, replace: true); } break; case 2: AAANetwork.Instance.PlayVoiceEventLocal("Jester/Hunting", 0.4f, replace: true); break; } } [HarmonyPatch(typeof(CaveDwellerAI), "SetCryingLocalClient")] [HarmonyPrefix] public static void SetCryingLocalClient_Prefix(bool setCrying, CaveDwellerAI __instance) { if (setCrying && AAANetwork.EnemyValidForLocalReaction((EnemyAI)(object)__instance)) { AAANetwork.Instance.PlayVoiceEventLocal("Maneater/Crying", 0.5f, replace: true); } } [HarmonyPatch(typeof(CaveDwellerAI), "PickUpBabyLocalClient")] [HarmonyPostfix] public static void PickUpBabyLocalClient_Postfix(CaveDwellerAI __instance) { if (((NetworkBehaviour)__instance.playerHolding).IsOwner && AAANetwork.EnemyValidForLocalReaction((EnemyAI)(object)__instance)) { AAANetwork.Instance.PlayVoiceEventLocal("Maneater/Pickup"); } } [HarmonyPatch(typeof(CaveDwellerAI), "StartTransformationAnim")] [HarmonyPostfix] public static void StartTransformationAnim_Postfix(CaveDwellerAI __instance) { if (AAANetwork.EnemyValidForLocalReaction((EnemyAI)(object)__instance)) { AAANetwork.Instance.PlayVoiceEventLocal("Maneater/Transform", 1f, replace: true); } } [HarmonyPatch(typeof(PlayerControllerB), "GrabObjectClientRpc")] [HarmonyPostfix] public static void GrabObjectClientRpc_Postfix(PlayerControllerB __instance) { GrabbableObject currentlyHeldObjectServer = __instance.currentlyHeldObjectServer; if (!((NetworkBehaviour)__instance).IsOwner || !((Object)(object)currentlyHeldObjectServer != (Object)null) || !((Object)(object)currentlyHeldObjectServer.itemProperties != (Object)null) || !(Random.value > 0.1f)) { return; } AAANetwork.Instance.PlayVoiceEventLocal("Item/Unique/" + currentlyHeldObjectServer.itemProperties.itemName.Replace(' ', '_'), 0.65f); if (currentlyHeldObjectServer.itemProperties.isDefensiveWeapon) { if (currentlyHeldObjectServer is Shovel || currentlyHeldObjectServer is KnifeItem || currentlyHeldObjectServer is JMeleeWeapon) { AAANetwork.Instance.PlayVoiceEventLocal("Item/Weapon/Melee", 0.6f); } AAANetwork.Instance.PlayVoiceEventLocal("Item/Weapon", 0.6f); } if (currentlyHeldObjectServer.itemProperties.isScrap) { if (currentlyHeldObjectServer.scrapValue > 100) { AAANetwork.Instance.PlayVoiceEventLocal("Item/Valued", 0.6f); } if (currentlyHeldObjectServer.itemProperties.twoHanded) { AAANetwork.Instance.PlayVoiceEventLocal("Item/Large", 0.6f); } AAANetwork.Instance.PlayVoiceEventLocal("Item/Scrap", 0.6f); } } [HarmonyPatch(typeof(LungProp), "EquipItem")] [HarmonyPrefix] public static void EquipItem_Prefix(LungProp __instance) { if (__instance.isLungDocked && (Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null && ((NetworkBehaviour)((GrabbableObject)__instance).playerHeldBy).IsOwner) { AAANetwork.Instance.PlayVoiceEventLocal("Item/Apparatus", 2f, replace: true); } } [HarmonyPatch(typeof(PlayerControllerB), "DiscardHeldObject")] [HarmonyPostfix] public static void DiscardHeldObject_Postfix(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner) { AAANetwork.Instance.PlayVoiceEventLocal("Item/Drop", 0.6f); } } [HarmonyPatch(typeof(PlayerControllerB), "PerformEmote")] [HarmonyPostfix] public static void PerformEmote_Postfix(int emoteID, PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner) { AAANetwork.Instance.PlayVoiceEventLocal("Emote/" + emoteID, 0.4f); } } [HarmonyPatch(typeof(HUDManager), "UpdateHealthUI")] [HarmonyPostfix] public static void UpdateHealthUI_Postfix(int health, bool hurtPlayer, HUDManager __instance) { if (hurtPlayer) { if (health < 20) { AAANetwork.Instance.PlayVoiceEventLocal("Damage/Taken/Critical", 0.8f, replace: true); } AAANetwork.Instance.PlayVoiceEventLocal("Damage/Taken", 0.4f, replace: true); } } [HarmonyPatch(typeof(PlayerControllerB), "IHittable.Hit")] [HarmonyPostfix] public static void Player_Hit_Postfix(int force, PlayerControllerB playerWhoHit, bool __result) { if (((NetworkBehaviour)playerWhoHit).IsOwner && __result && force > 0) { AAANetwork.Instance.PlayVoiceEventLocal("Damage/Dealt/Player", 0.4f); } } [HarmonyPatch(typeof(EnemyAICollisionDetect), "IHittable.Hit")] [HarmonyPostfix] public static void Enemy_Hit_Postfix(int force, PlayerControllerB playerWhoHit, bool __result) { if (((NetworkBehaviour)playerWhoHit).IsOwner && __result && force > 0) { AAANetwork.Instance.PlayVoiceEventLocal("Damage/Dealt", 0.4f); } } [HarmonyPatch(typeof(StartOfRound), "OnShipLandedMiscEvents")] [HarmonyPostfix] public static void OnShipLandedMiscEvents_Postfix() { AAANetwork.PerformDelayed(Random.Range(0f, 10f), delegate(AAANetwork instance) { instance.PlayVoiceEventLocal("Ship/Landing/" + ((object)(LevelWeatherType)(ref TimeOfDay.Instance.currentLevelWeather)).ToString(), 0.6f); instance.PlayVoiceEventLocal("Ship/Landing", 0.25f); }); } [HarmonyPatch(typeof(DepositItemsDesk), "SellAndDisplayItemProfits")] [HarmonyPostfix] public static void SellAndDisplayItemProfits_Postfix() { AAANetwork.Instance.PlayVoiceEventLocal("Desk/Sell", 0.5f); } [HarmonyPatch(typeof(DepositItemsDesk), "Attack")] [HarmonyPostfix] public static void Attack_Postfix() { AAANetwork.Instance.PlayVoiceEventLocal("Desk/Attack", 0.7f, replace: true); } [HarmonyPatch(typeof(DepositItemsDesk), "OpenShutDoor")] [HarmonyPostfix] public static void OpenShutDoor_Postfix(bool open, DepositItemsDesk __instance) { //IL_001b: 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) if (open && !__instance.attacking && Vector3.Distance(((Component)StartOfRound.Instance.localPlayerController).transform.position, ((Component)__instance).transform.position) < 20f) { AAANetwork.Instance.PlayVoiceEventLocal("Desk/Open", 0.5f); } } [HarmonyPatch(typeof(KeyItem), "ItemActivate")] [HarmonyPostfix] public static void ItemActivate_Postfix(KeyItem __instance) { if (((NetworkBehaviour)((GrabbableObject)__instance).playerHeldBy).IsOwner) { AAANetwork.Instance.PlayVoiceEventLocal("Door/Unlock"); } } [HarmonyPatch(typeof(BoomboxItem), "StartMusic")] [HarmonyPostfix] public static void StartMusic_Postfix(bool startMusic, bool pitchDown, BoomboxItem __instance) { if (startMusic && !pitchDown && ((NetworkBehaviour)((GrabbableObject)__instance).playerHeldBy).IsOwner) { AAANetwork.Instance.PlayVoiceEventLocal("Item/Boombox"); } } [HarmonyPatch(typeof(TVScript), "TurnTVOnOff")] [HarmonyPostfix] public static void TurnTVOnOff_Postfix(bool on, TVScript __instance) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Distance(((Component)StartOfRound.Instance.localPlayerController).transform.position, ((Component)__instance).transform.position) < 5f) { AAANetwork.Instance.PlayVoiceEventLocal("TV/" + (on ? "On" : "Off"), 0.5f); } } [HarmonyPatch(typeof(TVScript), "TVFinishedClip")] [HarmonyPostfix] public static void TVFinishedClip_Postfix(TVScript __instance) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Distance(((Component)StartOfRound.Instance.localPlayerController).transform.position, ((Component)__instance).transform.position) < 8f) { AAANetwork.Instance.PlayVoiceEventLocal("TV/Next", 0.4f); } } [HarmonyPatch(typeof(GiantKiwiAI), "StartPryOpenDoorAnimationOnLocalClient")] [HarmonyPostfix] public static void StartPryOpenDoorAnimationOnLocalClient_Postfix(GiantKiwiAI __instance) { if (AAANetwork.EnemyValidForLocalReaction((EnemyAI)(object)__instance, 20f)) { AAANetwork.Instance.PlayVoiceEventLocal("Kiwi/Pry", 0.8f, replace: true); } } [HarmonyPatch(typeof(StartOfRound), "SetShipDoorsClosed")] [HarmonyPostfix] public static void SetShipDoorsClosed_Postfix(bool closed) { if (closed && StartOfRound.Instance.localPlayerController.isInHangarShipRoom) { AAANetwork.Instance.PlayVoiceEventLocal("Ship/Safe", 0.5f); } } [HarmonyPatch(typeof(PlayerControllerB), "UpdateSpecialAnimationValue")] [HarmonyPostfix] public static void UpdateSpecialAnimationValue_Postfix(bool climbingLadder, PlayerControllerB __instance) { if (climbingLadder && ((NetworkBehaviour)__instance).IsOwner) { AAANetwork.Instance.PlayVoiceEventLocal("Climb"); } } [HarmonyPatch(typeof(PlayerControllerB), "KillPlayerClientRpc")] [HarmonyPostfix] public static void KillPlayerClientRpc_Postfix(PlayerControllerB __instance) { //IL_000f: 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) if (!((NetworkBehaviour)__instance).IsOwner && Vector3.Distance(((Component)__instance).transform.position, ((Component)StartOfRound.Instance.localPlayerController).transform.position) < 20f) { AAANetwork.Instance.PlayVoiceEventLocal("Damage/Death", 0.9f, replace: true); } } } } namespace AAACompany.Components { public class AAANetwork : NetworkBehaviour { [CompilerGenerated] private sealed class d__22 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float delay; public Action action; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__22(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(delay); <>1__state = 1; return true; case 1: <>1__state = -1; action(Instance); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const string audioObject = "AAA-Voice"; public Dictionary Voices = new Dictionary(); public PlayerControllerB localPlayer; public AudioSource localVoiceSource; public VoicePack localVoicePack; public static AAANetwork Instance { get; private set; } public void Awake() { Instance = this; AAAPlugin.DebugLog("Initialized NetManager."); } public override void OnDestroy() { Instance = null; ((NetworkBehaviour)this).OnDestroy(); } public static AudioSource GetVoiceAudio(PlayerControllerB player) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) Transform val = ((Component)player).transform.Find("AAA-Voice"); if ((Object)(object)val == (Object)null) { val = new GameObject("AAA-Voice").transform; val.SetParent(((Component)player).transform); val.localPosition = Vector3.zero; if ((Object)(object)player == (Object)(object)StartOfRound.Instance.localPlayerController) { ((Component)val).gameObject.AddComponent().player = player; } } AudioSource val2 = default(AudioSource); if (!((Component)val).TryGetComponent(ref val2)) { val2 = ((Component)val).gameObject.AddComponent(); val2.playOnAwake = false; val2.spatialBlend = 1f; val2.rolloffMode = (AudioRolloffMode)2; val2.dopplerLevel = 0.3f; val2.spread = 71f; val2.maxDistance = 12f; val2.volume = (((NetworkBehaviour)player).IsOwner ? AAAPlugin.speachVolume.Value : AAAPlugin.otherVolume.Value); } return val2; } internal void UpdateMyVoice() { //IL_001e: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) string text = AAAPlugin.voicePreference.Value.ToLower(); if (VoicePack.ContainsKey(text)) { SetMyVoiceRpc(FixedString32Bytes.op_Implicit(text), AAAPlugin.speachPitch.Value); return; } string[] blacklist = (from str in AAAPlugin.randomBlacklist.Value.Split(',') select str.Trim().ToLower()).ToArray(); string[] array = (from str in VoicePack.GetKeys() where !blacklist.Contains(str) select str).ToArray(); SetMyVoiceRpc(FixedString32Bytes.op_Implicit((array.Length != 0) ? array[Random.Range(0, array.Length)] : "?"), AAAPlugin.speachPitch.Value); } [Rpc(/*Could not decode attribute arguments.*/)] public void SetMyVoiceRpc(FixedString32Bytes voicePack, float pitch, RpcParams rpcParams = default(RpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_0043: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(659043682u, rpcParams, val, (SendTo)6, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref voicePack, default(ForFixedStrings)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref pitch, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 659043682u, rpcParams, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; ulong senderClientId = rpcParams.Receive.SenderClientId; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val3 in allPlayerScripts) { if (((NetworkBehaviour)val3).OwnerClientId == senderClientId) { AudioSource voiceAudio = GetVoiceAudio(val3); voiceAudio.pitch = pitch; VoicePack item = VoicePack.Get(((object)(FixedString32Bytes)(ref voicePack)).ToString()); Voices[senderClientId] = (val3, voiceAudio, item); if (((NetworkBehaviour)val3).IsOwner) { AAAPlugin.DebugLog("Setting local voice to " + item.Name); localPlayer = val3; localVoiceSource = voiceAudio; localVoicePack = item; } break; } } } [Rpc(/*Could not decode attribute arguments.*/)] public void SetMyPitchRpc(float pitch, RpcParams rpcParams = default(RpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_0043: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_008e: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1687885041u, rpcParams, val, (SendTo)6, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref pitch, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1687885041u, rpcParams, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; ulong senderClientId = rpcParams.Receive.SenderClientId; if (Voices.TryGetValue(senderClientId, out (PlayerControllerB, AudioSource, VoicePack) value)) { value.Item2.pitch = pitch; } } } public void UpdateAllVoicesFor(ulong clientId) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair voice in Voices) { if (voice.Key != clientId) { UpdateClientVoiceRpc(voice.Key, FixedString32Bytes.op_Implicit(voice.Value.Item3.Name), voice.Value.Item2.pitch, RpcParams.op_Implicit(((NetworkBehaviour)this).RpcTarget.Single(clientId, (RpcTargetUse)0))); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void UpdateClientVoiceRpc(ulong clientId, FixedString32Bytes voicePack, float pitch, RpcParams rpcParams = default(RpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_0043: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1506149881u, rpcParams, val, (SendTo)8, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref voicePack, default(ForFixedStrings)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref pitch, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1506149881u, rpcParams, val, (SendTo)8, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val3 in allPlayerScripts) { if (((NetworkBehaviour)val3).OwnerClientId == clientId) { AudioSource voiceAudio = GetVoiceAudio(val3); voiceAudio.pitch = pitch; VoicePack item = VoicePack.Get(((object)(FixedString32Bytes)(ref voicePack)).ToString()); Voices[clientId] = (val3, voiceAudio, item); AAAPlugin.DebugLog($"Set {clientId} to {voicePack}"); return; } } AAAPlugin.DebugLog($"Failed Setting {clientId} to {voicePack}", warn: true); } public void PlayVoiceEventLocal(string eventId, float chance = 0.8f, bool replace = false) { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) if (replace) { localVoiceSource.Stop(); } if (!localPlayer.isPlayerDead && !localVoiceSource.isPlaying && !(Random.value > chance * AAAPlugin.speachFrequency.Value)) { AudioClip[] array = localVoicePack[eventId]; if (array.Length != 0) { int num = Random.Range(0, array.Length); AAAPlugin.DebugLog($"Local: {eventId} {num}"); AudioClip clip = array[Mathf.Min(array.Length - 1, num)]; PlayVoiceClip(localVoiceSource, clip); SendVoiceEventRpc(FixedString32Bytes.op_Implicit(eventId), num); } else { AAAPlugin.DebugLog($"no Local: {eventId} is {array.Length}"); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void SendVoiceEventRpc(FixedString32Bytes eventId, int index, RpcParams rpcParams = default(RpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_0043: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_0083: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2934096121u, rpcParams, val, (SendTo)5, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref eventId, default(ForFixedStrings)); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendRpc(ref val2, 2934096121u, rpcParams, val, (SendTo)5, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (Voices.TryGetValue(rpcParams.Receive.SenderClientId, out (PlayerControllerB, AudioSource, VoicePack) value)) { AAAPlugin.DebugLog($"Client {rpcParams.Receive.SenderClientId} says {eventId} {index}"); AudioClip[] array = value.Item3[((object)(FixedString32Bytes)(ref eventId)).ToString()]; if (array.Length != 0) { AudioClip clip = array[Mathf.Min(array.Length - 1, index)]; value.Item2.Stop(); PlayVoiceClip(value.Item2, clip); } } } private void PlayVoiceClip(AudioSource source, AudioClip clip) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) source.clip = clip; source.Play(); WalkieTalkie.TransmitOneShotAudio(source, clip, 0.85f); if (AAAPlugin.creaturesHear.Value) { RoundManager.Instance.PlayAudibleNoise(((Component)source).transform.position, 5f, 0.5f, 0, false, 0); } } public static bool EnemyValidForLocalReaction(EnemyAI enemy, float distance = 10f) { //IL_0037: 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) PlayerControllerB val = Instance.localPlayer; if ((Object)(object)val == (Object)null) { return false; } return !val.isPlayerDead && val.isInsideFactory != enemy.isOutside && Vector3.Distance(((Component)val).transform.position, ((Component)enemy).transform.position) < distance; } public static void PerformDelayed(float delay, Action action) { ((MonoBehaviour)Instance).StartCoroutine(DelayedAction(delay, action)); } [IteratorStateMachine(typeof(d__22))] private static IEnumerator DelayedAction(float delay, Action action) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__22(0) { delay = delay, action = action }; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(659043682u, new RpcReceiveHandler(__rpc_handler_659043682), "SetMyVoiceRpc"); ((NetworkBehaviour)this).__registerRpc(1687885041u, new RpcReceiveHandler(__rpc_handler_1687885041), "SetMyPitchRpc"); ((NetworkBehaviour)this).__registerRpc(1506149881u, new RpcReceiveHandler(__rpc_handler_1506149881), "UpdateClientVoiceRpc"); ((NetworkBehaviour)this).__registerRpc(2934096121u, new RpcReceiveHandler(__rpc_handler_2934096121), "SendVoiceEventRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_659043682(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { FixedString32Bytes voicePack = default(FixedString32Bytes); ((FastBufferReader)(ref reader)).ReadValueSafe(ref voicePack, default(ForFixedStrings)); float pitch = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref pitch, default(ForPrimitives)); RpcParams ext = rpcParams.Ext; target.__rpc_exec_stage = (__RpcExecStage)1; ((AAANetwork)(object)target).SetMyVoiceRpc(voicePack, pitch, ext); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1687885041(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float pitch = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref pitch, default(ForPrimitives)); RpcParams ext = rpcParams.Ext; target.__rpc_exec_stage = (__RpcExecStage)1; ((AAANetwork)(object)target).SetMyPitchRpc(pitch, ext); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1506149881(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0066: 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_006c: 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_0085: 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_009c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); FixedString32Bytes voicePack = default(FixedString32Bytes); ((FastBufferReader)(ref reader)).ReadValueSafe(ref voicePack, default(ForFixedStrings)); float pitch = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref pitch, default(ForPrimitives)); RpcParams ext = rpcParams.Ext; target.__rpc_exec_stage = (__RpcExecStage)1; ((AAANetwork)(object)target).UpdateClientVoiceRpc(clientId, voicePack, pitch, ext); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2934096121(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { FixedString32Bytes eventId = default(FixedString32Bytes); ((FastBufferReader)(ref reader)).ReadValueSafe(ref eventId, default(ForFixedStrings)); int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); RpcParams ext = rpcParams.Ext; target.__rpc_exec_stage = (__RpcExecStage)1; ((AAANetwork)(object)target).SendVoiceEventRpc(eventId, index, ext); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "AAANetwork"; } } public class PassiveVoiceController : MonoBehaviour { public PlayerControllerB player; private float passiveTimer = AAAPlugin.randomFrequency.Value; private float stillTimer = 0f; private float nextStillVoice = 60f; private Vector3 lastPos = Vector3.zero; private Quaternion lastRot = Quaternion.identity; private bool lastExhausted = false; public void Start() { AAAPlugin.DebugLog("Started Passive Voice Controller"); } public void Update() { //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) if (player.isPlayerDead) { return; } if (player.isExhausted != lastExhausted) { lastExhausted = player.isExhausted; if (lastExhausted) { AAANetwork.Instance.PlayVoiceEventLocal("Stamina/Depleted", 0.3f); } } if (!StartOfRound.Instance.inShipPhase) { EnemyAI val = null; float num = float.MaxValue; foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { if (!spawnedEnemy.isEnemyDead && !((Object)(object)spawnedEnemy.enemyType == (Object)null) && spawnedEnemy.isOutside != player.isInsideFactory) { float num2 = Vector3.Distance(lastPos, ((Component)spawnedEnemy).transform.position); if (num2 < 30f && num2 < num && player.HasLineOfSightToPosition(((Object)(object)spawnedEnemy.eye != (Object)null) ? spawnedEnemy.eye.position : ((Component)spawnedEnemy).transform.position, 45f, 60, -1f, -1)) { val = spawnedEnemy; num = num2; } } } float num3 = (((Object)(object)val != (Object)null) ? 2.2f : 1f); if (player.isPlayerAlone) { num3 += 0.2f; } passiveTimer -= Time.deltaTime * num3; if (passiveTimer < 0f) { passiveTimer = Random.Range(AAAPlugin.randomFrequency.Value, AAAPlugin.randomFrequency.Value * 4f); if ((Object)(object)val != (Object)null) { AAANetwork.Instance.PlayVoiceEventLocal("Passive/Enemy/" + val.enemyType.enemyName.Replace(' ', '_'), 1.2f); } AAANetwork.Instance.PlayVoiceEventLocal((player.isPlayerAlone && Random.value < 0.4f) ? "Passive/Alone" : "Passive", 0.9f); } if (((Component)player).transform.position != lastPos || ((Component)player).transform.rotation != lastRot) { lastPos = ((Component)player).transform.position; lastRot = ((Component)player).transform.rotation; stillTimer = 0f; nextStillVoice = 60f; return; } stillTimer += Time.deltaTime; if (stillTimer > nextStillVoice) { nextStillVoice += 10f; AAANetwork.Instance.PlayVoiceEventLocal("AFK", 1f); } } else { stillTimer = 0f; nextStillVoice = 60f; } } } } namespace AAACompany.Compatability { internal static class AAALethalConfig { public static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_0074: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00a9: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00de: Expected O, but got Unknown //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown //IL_0113: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown //IL_0148: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Expected O, but got Unknown LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(AAAPlugin.extendedLogs, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(AAAPlugin.voicePreference, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(AAAPlugin.randomBlacklist, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(AAAPlugin.creaturesHear, false)); ConfigEntry speachFrequency = AAAPlugin.speachFrequency; FloatInputFieldOptions val = new FloatInputFieldOptions { RequiresRestart = false }; ((BaseRangeOptions)val).Min = 0f; ((BaseRangeOptions)val).Max = float.MaxValue; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(speachFrequency, val)); ConfigEntry randomFrequency = AAAPlugin.randomFrequency; FloatInputFieldOptions val2 = new FloatInputFieldOptions { RequiresRestart = false }; ((BaseRangeOptions)val2).Min = 0f; ((BaseRangeOptions)val2).Max = float.MaxValue; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(randomFrequency, val2)); ConfigEntry speachVolume = AAAPlugin.speachVolume; FloatInputFieldOptions val3 = new FloatInputFieldOptions { RequiresRestart = false }; ((BaseRangeOptions)val3).Min = 0f; ((BaseRangeOptions)val3).Max = 10f; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(speachVolume, val3)); ConfigEntry speachPitch = AAAPlugin.speachPitch; FloatInputFieldOptions val4 = new FloatInputFieldOptions { RequiresRestart = false }; ((BaseRangeOptions)val4).Min = -3f; ((BaseRangeOptions)val4).Max = 3f; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(speachPitch, val4)); ConfigEntry otherVolume = AAAPlugin.otherVolume; FloatInputFieldOptions val5 = new FloatInputFieldOptions { RequiresRestart = false }; ((BaseRangeOptions)val5).Min = 0f; ((BaseRangeOptions)val5).Max = 10f; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(otherVolume, val5)); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace AAACompany.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }