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 EnemyReplacer v1.0.2
EnemyReplacer.dll
Decompiled 5 hours agousing System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; 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: AssemblyCompany("EnemyReplacer")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("EnemyReplacer")] [assembly: AssemblyTitle("EnemyReplacer")] [assembly: AssemblyVersion("1.0.0.0")] namespace CustomLethalMod; [BepInPlugin("com.yourname.enemyreplacer", "Enemy Replacer Mod", "1.1.0")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("com.yourname.enemyreplacer"); public static Sprite BugSprite; public static Sprite NutcrackerSprite; public static AudioClip BugMusic; public static AudioClip NutcrackerMusic; private void Awake() { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); string text = Path.Combine(directoryName, "my_custom_assets"); if (!File.Exists(text)) { ((BaseUnityPlugin)this).Logger.LogError((object)("[EnemyReplacer] КРИТИЧЕСКАЯ ОШИБКА: Файл ассетов не найден по пути: " + text)); return; } AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val != (Object)null) { BugSprite = val.LoadAsset<Sprite>("BugImage"); BugMusic = val.LoadAsset<AudioClip>("BugAudio"); NutcrackerSprite = val.LoadAsset<Sprite>("NutcrackerImage"); NutcrackerMusic = val.LoadAsset<AudioClip>("NutcrackerAudio"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[EnemyReplacer] Все кастомные ассеты успешно загружены."); } harmony.PatchAll(); } public static void ConfigureAudioSource(AudioSource source, AudioClip clip) { source.clip = clip; source.spatialBlend = 1f; source.dopplerLevel = 0f; source.rolloffMode = (AudioRolloffMode)1; source.minDistance = 2f; source.maxDistance = 12f; source.loop = true; source.bypassEffects = true; source.bypassReverbZones = true; } } public class Billboard : MonoBehaviour { private void Update() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0050: 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_0060: 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) Camera val = GameNetworkManager.Instance?.localPlayerController?.gameplayCamera; if ((Object)(object)val != (Object)null) { ((Component)this).transform.LookAt(((Component)this).transform.position + ((Component)val).transform.rotation * Vector3.forward, ((Component)val).transform.rotation * Vector3.up); } } } [HarmonyPatch(typeof(HoarderBugAI))] internal class HoarderBugPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start(HoarderBugAI __instance) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0057: 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) Renderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { val.enabled = false; } GameObject val2 = new GameObject("2D_Bug"); val2.transform.SetParent(((Component)__instance).transform); val2.transform.localPosition = new Vector3(0f, 3f, 0f); val2.AddComponent<SpriteRenderer>().sprite = Plugin.BugSprite; val2.transform.localScale = new Vector3(2f, 2f, 2f); val2.AddComponent<Billboard>(); AudioSource val3 = val2.AddComponent<AudioSource>(); Plugin.ConfigureAudioSource(val3, Plugin.BugMusic); val3.Play(); } [HarmonyPatch("Update")] [HarmonyPostfix] private static void Update(HoarderBugAI __instance) { AudioSource componentInChildren = ((Component)__instance).GetComponentInChildren<AudioSource>(); if ((Object)(object)componentInChildren != (Object)null && ((EnemyAI)__instance).isEnemyDead) { componentInChildren.Stop(); } } } [HarmonyPatch(typeof(NutcrackerEnemyAI))] internal class NutcrackerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start(NutcrackerEnemyAI __instance) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0057: 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) Renderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { val.enabled = false; } GameObject val2 = new GameObject("2D_Nutcracker"); val2.transform.SetParent(((Component)__instance).transform); val2.transform.localPosition = new Vector3(0f, 2.5f, 0f); val2.AddComponent<SpriteRenderer>().sprite = Plugin.NutcrackerSprite; val2.transform.localScale = new Vector3(1.2f, 1.2f, 1.2f); val2.AddComponent<Billboard>(); AudioSource source = val2.AddComponent<AudioSource>(); Plugin.ConfigureAudioSource(source, Plugin.NutcrackerMusic); } [HarmonyPatch("Update")] [HarmonyPostfix] private static void Update(NutcrackerEnemyAI __instance) { AudioSource componentInChildren = ((Component)__instance).GetComponentInChildren<AudioSource>(); if (!((Object)(object)componentInChildren == (Object)null)) { bool flag = !((EnemyAI)__instance).isEnemyDead; if (flag && !componentInChildren.isPlaying) { componentInChildren.Play(); } if (!flag && componentInChildren.isPlaying) { componentInChildren.Stop(); } } } }