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 AAACompany v1.0.2
BepInEx/plugins/AAACompany/AAACompany.dll
Decompiled 2 months agousing 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 <AllVoicesLoaded>d__17 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public List<Coroutine> coroutines; public AAAPlugin <>4__this; private VoicePack[] <packs>5__1; private List<string> <keys>5__2; private int <clipCount>5__3; private List<Coroutine>.Enumerator <>s__4; private Coroutine <routine>5__5; private VoicePack[] <>s__6; private int <>s__7; private VoicePack <pack>5__8; private Dictionary<string, AudioClip[]>.KeyCollection.Enumerator <>s__9; private string <key>5__10; private List<string>.Enumerator <>s__11; private string <key>5__12; private List<AudioClip> <clips>5__13; private VoicePack[] <>s__14; private int <>s__15; private VoicePack <pack>5__16; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <AllVoicesLoaded>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(); } } <packs>5__1 = null; <keys>5__2 = null; <>s__4 = default(List<Coroutine>.Enumerator); <routine>5__5 = null; <>s__6 = null; <pack>5__8 = default(VoicePack); <>s__9 = default(Dictionary<string, AudioClip[]>.KeyCollection.Enumerator); <key>5__10 = null; <>s__11 = default(List<string>.Enumerator); <key>5__12 = null; <clips>5__13 = null; <>s__14 = null; <pack>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; <routine>5__5 = null; break; } if (<>s__4.MoveNext()) { <routine>5__5 = <>s__4.Current; <>2__current = <routine>5__5; <>1__state = 1; return true; } <>m__Finally1(); <>s__4 = default(List<Coroutine>.Enumerator); <packs>5__1 = VoicePack.GetAll(); <keys>5__2 = new List<string>(); <clipCount>5__3 = 0; <>s__6 = <packs>5__1; for (<>s__7 = 0; <>s__7 < <>s__6.Length; <>s__7++) { <pack>5__8 = <>s__6[<>s__7]; <>s__9 = <pack>5__8.Keys.GetEnumerator(); try { while (<>s__9.MoveNext()) { <key>5__10 = <>s__9.Current; if (!<keys>5__2.Contains(<key>5__10)) { <keys>5__2.Add(<key>5__10); } <key>5__10 = null; } } finally { ((IDisposable)<>s__9).Dispose(); } <>s__9 = default(Dictionary<string, AudioClip[]>.KeyCollection.Enumerator); <pack>5__8 = default(VoicePack); } <>s__6 = null; <>s__11 = <keys>5__2.GetEnumerator(); try { while (<>s__11.MoveNext()) { <key>5__12 = <>s__11.Current; <clips>5__13 = new List<AudioClip>(); <>s__14 = <packs>5__1; for (<>s__15 = 0; <>s__15 < <>s__14.Length; <>s__15++) { <pack>5__16 = <>s__14[<>s__15]; <clips>5__13.AddRange(<pack>5__16[<key>5__12]); <pack>5__16 = default(VoicePack); } <>s__14 = null; VoicePack.Every.Append(<key>5__12, <clips>5__13.ToArray()); <clipCount>5__3 += <clips>5__13.Count; <clips>5__13 = null; <key>5__12 = null; } } finally { ((IDisposable)<>s__11).Dispose(); } <>s__11 = default(List<string>.Enumerator); mls.LogInfo((object)$"All voices imported. {<keys>5__2.Count} Events + {<clipCount>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 <LoadCharacterVoiceBundle>d__16 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string path; public AAAPlugin <>4__this; private AssetBundleCreateRequest <request>5__1; private AssetBundle <bundle>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadCharacterVoiceBundle>d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <request>5__1 = null; <bundle>5__2 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <request>5__1 = AssetBundle.LoadFromFileAsync(path); <>2__current = <request>5__1; <>1__state = 1; return true; case 1: <>1__state = -1; <bundle>5__2 = <request>5__1.assetBundle; if (<bundle>5__2.isStreamedSceneAssetBundle) { mls.LogError((object)("Bundle containted Streamed Scene Assets: " + path)); return false; } VoicePack.Import(<bundle>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<string> voicePreference; public static ConfigEntry<string> randomBlacklist; public static ConfigEntry<float> speachFrequency; public static ConfigEntry<float> randomFrequency; public static ConfigEntry<float> speachVolume; public static ConfigEntry<float> speachPitch; public static ConfigEntry<float> otherVolume; public static ConfigEntry<bool> creaturesHear; public static ConfigEntry<bool> extendedLogs; public void Awake() { mls = Logger.CreateLogSource("JacobG5.AAACompany"); extendedLogs = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "Extended Logs", false, "Enables logging of debug data."); voicePreference = ((BaseUnityPlugin)this).Config.Bind<string>("Voice", "Preference", "Random", "Prefered voice. If invalid will select random."); randomBlacklist = ((BaseUnityPlugin)this).Config.Bind<string>("Voice", "Random Blacklist", "", "Blacklisted voices from random selection. ',' seperated"); voicePreference.SettingChanged += delegate { AAANetwork.Instance?.UpdateMyVoice(); }; creaturesHear = ((BaseUnityPlugin)this).Config.Bind<bool>("Voice", "Creatures Hear", true, "Allows monsters like Eyeless Dogs to hear character voice lines."); speachFrequency = ((BaseUnityPlugin)this).Config.Bind<float>("Voice", "Frequency", 1f, "Chance multiplier on if you should speak. Only applies to your own voice. (Multiplier)"); randomFrequency = ((BaseUnityPlugin)this).Config.Bind<float>("Voice", "Passive Timer", 40f, "Time between passive voice lines."); speachVolume = ((BaseUnityPlugin)this).Config.Bind<float>("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<float>("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<float>("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<AAANetwork>(); 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<Coroutine> list = new List<Coroutine>(); 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(<LoadCharacterVoiceBundle>d__16))] private IEnumerator LoadCharacterVoiceBundle(string path) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadCharacterVoiceBundle>d__16(0) { <>4__this = this, path = path }; } [IteratorStateMachine(typeof(<AllVoicesLoaded>d__17))] private IEnumerator AllVoicesLoaded(List<Coroutine> coroutines) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <AllVoicesLoaded>d__17(0) { <>4__this = this, coroutines = coroutines }; } } public readonly struct VoicePack { private static readonly Dictionary<string, VoicePack> _characterVoicePacks = new Dictionary<string, VoicePack>(); public static readonly VoicePack Unknown = new VoicePack("Unknown"); public static readonly VoicePack Every = new VoicePack("Every"); public readonly string Name; private readonly Dictionary<string, AudioClip[]> _clips; public Dictionary<string, AudioClip[]>.KeyCollection Keys => _clips.Keys; public AudioClip[] this[string key] { get { AudioClip[] value; return _clips.TryGetValue(key.ToLower(), out value) ? value : Array.Empty<AudioClip>(); } } private VoicePack(string name) { Name = name; _clips = new Dictionary<string, AudioClip[]>(); } 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<string, Dictionary<string, List<AudioClip>>> dictionary = new Dictionary<string, Dictionary<string, List<AudioClip>>>(); 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<AudioClip>(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, List<AudioClip>>()); } string key2 = string.Join('/', array2.Skip(2).SkipLast(1)); if (!value.TryGetValue(key2, out var value2)) { value.Add(key2, value2 = new List<AudioClip>()); } value2.Add(val); } } foreach (KeyValuePair<string, Dictionary<string, List<AudioClip>>> item in dictionary) { VoicePack value3 = new VoicePack(item.Key); int num = 0; foreach (KeyValuePair<string, List<AudioClip>> 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 <DelayedAction>d__22 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float delay; public Action<AAANetwork> action; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayedAction>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<ulong, (PlayerControllerB player, AudioSource source, VoicePack pack)> Voices = new Dictionary<ulong, (PlayerControllerB, AudioSource, VoicePack)>(); 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<PassiveVoiceController>().player = player; } } AudioSource val2 = default(AudioSource); if (!((Component)val).TryGetComponent<AudioSource>(ref val2)) { val2 = ((Component)val).gameObject.AddComponent<AudioSource>(); 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<FixedString32Bytes>(ref voicePack, default(ForFixedStrings)); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(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<float>(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<ulong, (PlayerControllerB, AudioSource, VoicePack)> 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<FixedString32Bytes>(ref voicePack, default(ForFixedStrings)); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(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<FixedString32Bytes>(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<AAANetwork> action) { ((MonoBehaviour)Instance).StartCoroutine(DelayedAction(delay, action)); } [IteratorStateMachine(typeof(<DelayedAction>d__22))] private static IEnumerator DelayedAction(float delay, Action<AAANetwork> action) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DelayedAction>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<FixedString32Bytes>(ref voicePack, default(ForFixedStrings)); float pitch = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(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<float>(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<FixedString32Bytes>(ref voicePack, default(ForFixedStrings)); float pitch = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(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<FixedString32Bytes>(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<float> speachFrequency = AAAPlugin.speachFrequency; FloatInputFieldOptions val = new FloatInputFieldOptions { RequiresRestart = false }; ((BaseRangeOptions<float>)val).Min = 0f; ((BaseRangeOptions<float>)val).Max = float.MaxValue; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(speachFrequency, val)); ConfigEntry<float> randomFrequency = AAAPlugin.randomFrequency; FloatInputFieldOptions val2 = new FloatInputFieldOptions { RequiresRestart = false }; ((BaseRangeOptions<float>)val2).Min = 0f; ((BaseRangeOptions<float>)val2).Max = float.MaxValue; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(randomFrequency, val2)); ConfigEntry<float> speachVolume = AAAPlugin.speachVolume; FloatInputFieldOptions val3 = new FloatInputFieldOptions { RequiresRestart = false }; ((BaseRangeOptions<float>)val3).Min = 0f; ((BaseRangeOptions<float>)val3).Max = 10f; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(speachVolume, val3)); ConfigEntry<float> speachPitch = AAAPlugin.speachPitch; FloatInputFieldOptions val4 = new FloatInputFieldOptions { RequiresRestart = false }; ((BaseRangeOptions<float>)val4).Min = -3f; ((BaseRangeOptions<float>)val4).Max = 3f; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(speachPitch, val4)); ConfigEntry<float> otherVolume = AAAPlugin.otherVolume; FloatInputFieldOptions val5 = new FloatInputFieldOptions { RequiresRestart = false }; ((BaseRangeOptions<float>)val5).Min = 0f; ((BaseRangeOptions<float>)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 { } }