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 Echoes Of Jeb v1.0.0
EchoesOfJeb.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Cryptography; using BepInEx; using BepInEx.Logging; using EchoesOfJeb.Generators; using EchoesOfJeb.Managers; using HarmonyLib; using Unity.Netcode; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("EchoesOfJeb")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("EchoesOfJeb")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4705e0f1-20b2-4459-8ffb-26183201b30a")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace EchoesOfJeb { [BepInPlugin("com.actus.lethalcompany.echoesofjeb", "Echoes of Jeb", "1.0.0")] public class EchoesOfJebBase : BaseUnityPlugin { private const string modGUID = "com.actus.lethalcompany.echoesofjeb"; private const string modName = "Echoes of Jeb"; private const string modVersion = "1.0.0"; internal static EchoesOfJebBase Instance; private readonly Harmony harmony = new Harmony("com.actus.lethalcompany.echoesofjeb"); internal static List<AudioClip> SoundFX; internal static ManualLogSource logger; internal AssetBundle networkAssets; private static string baseFolderPath; private static string soundFolderPath; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } logger = Logger.CreateLogSource("com.actus.lethalcompany.echoesofjeb"); baseFolderPath = ((BaseUnityPlugin)Instance).Info.Location.TrimEnd("EchoesOfJeb.dll".ToCharArray()); soundFolderPath = Path.Combine(baseFolderPath, "Sounds"); if (!Directory.Exists(soundFolderPath)) { logger.LogError((object)"Sounds folder missing, adding directory!"); Directory.CreateDirectory(soundFolderPath); } else { SoundFX = AudioManager.LoadAllAudioClips(soundFolderPath); } networkAssets = AssetBundle.LoadFromFile(Path.Combine(baseFolderPath, "echoesofjebnetworkasset")); harmony.PatchAll(); NetcodePatcher(); } private static void NetcodePatcher() { logger.LogInfo((object)"NetcodePatcher running!"); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } } } namespace EchoesOfJeb.Patches { [HarmonyPatch(typeof(DepositItemsDesk), "OpenShutDoor")] internal class OpenShutDoorPatch { [HarmonyPostfix] public static void ReplaceDoorSound(bool open, ref DepositItemsDesk __instance) { //IL_007d: 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_008b: Unknown result type (might be due to invalid IL or missing references) if ((NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) && open && EchoesOfJebBase.SoundFX.Count > 0) { int randomNumber = SecureRandomNumberGenerator.GetRandomNumber(0, EchoesOfJebBase.SoundFX.Count - 1); AudioClip val = EchoesOfJebBase.SoundFX[randomNumber]; EchoesOfJebBase.logger.LogInfo((object)("[Server] Sending audio clip " + ((Object)val).name + " to all clients.")); NetworkHandler.Instance.MakeDoorSoundClientRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)__instance), val); } } } } namespace EchoesOfJeb.Managers { public static class AudioManager { public static List<AudioClip> LoadAllAudioClips(string soundFolderPath) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) List<string> list = new List<string>(); list.AddRange(Directory.GetFiles(soundFolderPath, "*.wav", SearchOption.AllDirectories)); list.AddRange(Directory.GetFiles(soundFolderPath, "*.mp3", SearchOption.AllDirectories)); List<AudioClip> list2 = new List<AudioClip>(); foreach (string item in list) { AudioType type = (AudioType)(item.EndsWith(".mp3", StringComparison.OrdinalIgnoreCase) ? 13 : 20); list2.Add(LoadAudioClipFromDisk(item, type)); } return list2; } private static AudioClip LoadAudioClipFromDisk(string path, AudioType type) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 AudioClip val = null; UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(path, type); try { audioClip.SendWebRequest(); try { while (!audioClip.isDone) { } if ((int)audioClip.result != 1) { EchoesOfJebBase.logger.LogError((object)("Failed to load AudioClip from path: " + path + " Full error: " + audioClip.error)); } else { val = DownloadHandlerAudioClip.GetContent(audioClip); if ((Object)(object)val != (Object)null) { ((Object)val).name = Path.GetFileNameWithoutExtension(path); EchoesOfJebBase.logger.LogInfo((object)("Loaded sound: " + ((Object)val).name)); } } } catch (Exception ex) { EchoesOfJebBase.logger.LogError((object)(ex.Message + ", " + ex.StackTrace)); } } finally { ((IDisposable)audioClip)?.Dispose(); } return val; } } public class NetworkHandler : NetworkBehaviour { public static NetworkHandler Instance { get; private set; } [RuntimeInitializeOnLoadMethod] internal static void ConfigureRpcHandler() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown EchoesOfJebBase.logger.LogInfo((object)"[ConfigureRpcHandler] Starting RPC initialization process to ensure proper network communication."); NetworkManager.__rpc_func_table.Add(972684150u, new RpcReceiveHandler(__rpc_handler_972684150)); EchoesOfJebBase.logger.LogInfo((object)"[ConfigureRpcHandler] RPC initialization completed successfully. Network communication is now set up."); } public override void OnNetworkSpawn() { EchoesOfJebBase.logger.LogInfo((object)"[OnNetworkSpawn] Initializing NetworkHandler instance. Preparing to set up network behavior and spawn logic."); if ((Object)(object)Instance != (Object)null && (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)) { ((Component)Instance).gameObject.GetComponent<NetworkObject>().Despawn(true); } Instance = this; ((NetworkBehaviour)this).OnNetworkSpawn(); EchoesOfJebBase.logger.LogInfo((object)"[OnNetworkSpawn] NetworkHandler instance successfully initialized and ready. Network behavior and spawn logic are now active."); } [ClientRpc] public void MakeDoorSoundClientRpc(NetworkBehaviourReference __instance, AudioClip chosenClip, ClientRpcParams rpcParams = default(ClientRpcParams)) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Invalid comparison between Unknown and I4 //IL_004f: 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_0056: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (!((Object)(object)networkManager == (Object)null) && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(972684150u, rpcParams, (RpcDelivery)0); FastBufferWriter val2 = val; ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref __instance, default(ForNetworkSerializable)); val2 = val; ((FastBufferWriter)(ref val2)).WriteValueSafe(((Object)chosenClip).name, false); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 972684150u, rpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { EchoesOfJebBase.logger.LogInfo((object)("[Client] Received audio clip from server: " + ((Object)chosenClip).name)); ((DepositItemsDesk)NetworkBehaviourReference.op_Implicit(__instance)).deskAudio.PlayOneShot(chosenClip); } } } private static void __rpc_handler_972684150(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //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_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_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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) NetworkHandler networkHandler = target as NetworkHandler; NetworkManager networkManager = target.NetworkManager; if ((Object)(object)networkManager != (Object)null && networkManager.IsListening) { string clipName = string.Empty; NetworkBehaviourReference _instance = default(NetworkBehaviourReference); FastBufferReader val = reader; ((FastBufferReader)(ref val)).ReadValueSafe<NetworkBehaviourReference>(ref _instance, default(ForNetworkSerializable)); val = reader; ((FastBufferReader)(ref val)).ReadValueSafe(ref clipName, false); AudioClip chosenClip = ((IEnumerable<AudioClip>)EchoesOfJebBase.SoundFX).FirstOrDefault((Func<AudioClip, bool>)((AudioClip clip) => ((Object)clip).name == clipName)) ?? EchoesOfJebBase.SoundFX.FirstOrDefault(); ((NetworkBehaviour)networkHandler).__rpc_exec_stage = (__RpcExecStage)2; ((NetworkHandler)(object)target).MakeDoorSoundClientRpc(_instance, chosenClip); ((NetworkBehaviour)networkHandler).__rpc_exec_stage = (__RpcExecStage)0; } } } [HarmonyPatch] public class NetworkObjectManager { private static GameObject networkPrefab; [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] public static void Init() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown if (!((Object)(object)networkPrefab != (Object)null)) { networkPrefab = (GameObject)EchoesOfJebBase.Instance.networkAssets.LoadAsset("EchoesOfJebNetworkManager.prefab"); networkPrefab.AddComponent<NetworkHandler>(); NetworkManager.Singleton.AddNetworkPrefab(networkPrefab); EchoesOfJebBase.logger.LogInfo((object)"NetworkObjectManager set!"); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Awake")] private static void SpawnNetworkHandler() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { GameObject val = Object.Instantiate<GameObject>(networkPrefab, Vector3.zero, Quaternion.identity); val.GetComponent<NetworkObject>().Spawn(false); EchoesOfJebBase.logger.LogInfo((object)"NetworkObject SPAWNED!"); } } } } namespace EchoesOfJeb.Generators { internal static class SecureRandomNumberGenerator { public static int GetRandomNumber(int minInclusive, int maxInclusive) { using RNGCryptoServiceProvider rNGCryptoServiceProvider = new RNGCryptoServiceProvider(); byte[] array = new byte[4]; rNGCryptoServiceProvider.GetBytes(array); int num = BitConverter.ToInt32(array, 0) & 0x7FFFFFFF; return minInclusive + num % (maxInclusive - minInclusive + 1); } } }