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 Chdata NecoArcHoarderBugMod v1.0.0
ChdataNecoArcHoarderBug.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using LCSoundTool; using Microsoft.CodeAnalysis; 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: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("ChdataNecoArcHoarderBug")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Replaces Hoarder Bug with Neco Arc")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Chdata's Neco Arc Hoarder Bug Mod")] [assembly: AssemblyTitle("ChdataNecoArcHoarderBug")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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 ChdataNecoArcHoarderBug { [BepInPlugin("ChdataNecoArcHoarderBug", "Chdata's Neco Arc Hoarder Bug Mod", "1.0.0")] public class NecoArcModBase : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("ChdataNecoArcHoarderBug"); private static NecoArcModBase Instance; public static ManualLogSource mls; internal static ConfigEntry<bool> configIncreaseNecoArcSpawns; internal static ConfigEntry<int> configMaxEnemyPowerCount; internal static ConfigEntry<int> configNecoArcRarityWeight; internal static ConfigEntry<int> configNecoArcDay; private AudioClip soundNecoArcAngry1; private AudioClip soundNecoArcAngry2; private AudioClip soundNecoArcChitter1; private AudioClip soundNecoArcChitter2; private AudioClip soundNecoArcChitter3; private AudioClip soundNecoArcCry; private AudioClip soundNecoArcDie; private AudioClip soundNecoArcFly; public static GameObject NecoArcPrefab; public static int DaysPassed; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("ChdataNecoArcHoarderBug"); mls.LogInfo((object)"--=== CHDATA's NECO ARC MOD LOADED ===--"); mls.LogInfo((object)"--==="); mls.LogInfo((object)"--=== CHDATA's NECO ARC MOD LOADED ===--"); configIncreaseNecoArcSpawns = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Increase Neco Arc Spawns", true, "Determines whether or not to increase the chance of Neco Arc spawning."); configMaxEnemyPowerCount = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Max Enemy Power Count", 10, "Power Count determines the maximum number of enemies that may spawn. The normal value for Experiment, for example, is 4."); configNecoArcRarityWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Neco Arc Rarity Weight", 512, "Increases the chance of Neco Arc spawning. A normal value is 10-80. Higher = more likely."); configNecoArcDay = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Neco Arc Day", -1, "Neco Arc will have increased spawn rate on this day. -1 means all days."); string text = Path.Combine(Environment.CurrentDirectory, "BepInEx", "plugins", "ChdataNecoArcHoarderBug", "Angry.Neco_B0AA24.wav"); mls.LogDebug((object)text); harmony.PatchAll(typeof(NecoArcModBase)); string text2 = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "necoarcremake_bynerro13.assetbundle"); mls.LogDebug((object)text2); AssetBundle val = AssetBundle.LoadFromFile(text2); NecoArcPrefab = val.LoadAsset<GameObject>("Assets/Import/NecoArc/NecoArcRemake_ByNerro13.prefab"); SkinnedMeshRenderer[] componentsInChildren = NecoArcPrefab.GetComponentsInChildren<SkinnedMeshRenderer>(true); SkinnedMeshRenderer[] array = componentsInChildren; foreach (SkinnedMeshRenderer val2 in array) { ((Component)val2).gameObject.layer = LayerMask.NameToLayer("Enemies"); } LoadSoundFiles(); } private async void LoadSoundFiles() { string path5 = Path.Combine(Environment.CurrentDirectory, "BepInEx", "plugins", "ChdataNecoArcHoarderBug", "Angry.Neco_B0AA24.wav"); mls.LogDebug((object)path5); soundNecoArcAngry1 = await LoadClip(path5); path5 = Path.Combine(Environment.CurrentDirectory, "BepInEx", "plugins", "ChdataNecoArcHoarderBug", "Angry.Neco_B0AA48a.wav"); mls.LogDebug((object)path5); soundNecoArcAngry2 = await LoadClip(path5); path5 = Path.Combine(Environment.CurrentDirectory, "BepInEx", "plugins", "ChdataNecoArcHoarderBug", "Chitter.Neco_B0AA01.wav"); mls.LogDebug((object)path5); soundNecoArcChitter1 = await LoadClip(path5); path5 = Path.Combine(Environment.CurrentDirectory, "BepInEx", "plugins", "ChdataNecoArcHoarderBug", "Chitter.Neco_B2AA005.wav"); mls.LogDebug((object)path5); soundNecoArcChitter2 = await LoadClip(path5); path5 = Path.Combine(Environment.CurrentDirectory, "BepInEx", "plugins", "ChdataNecoArcHoarderBug", "Chitter.Neco_B2AA008.wav"); mls.LogDebug((object)path5); soundNecoArcChitter3 = await LoadClip(path5); path5 = Path.Combine(Environment.CurrentDirectory, "BepInEx", "plugins", "ChdataNecoArcHoarderBug", "cry.Neco_B0AA06.wav"); mls.LogDebug((object)path5); soundNecoArcCry = await LoadClip(path5); path5 = Path.Combine(Environment.CurrentDirectory, "BepInEx", "plugins", "ChdataNecoArcHoarderBug", "die.neco74.wav"); mls.LogDebug((object)path5); soundNecoArcDie = await LoadClip(path5); path5 = Path.Combine(Environment.CurrentDirectory, "BepInEx", "plugins", "ChdataNecoArcHoarderBug", "fly.neco33.wav"); mls.LogDebug((object)path5); soundNecoArcFly = await LoadClip(path5); SoundTool.ReplaceAudioClip("AngryScreech", soundNecoArcAngry1); SoundTool.ReplaceAudioClip("AngryScreech2", soundNecoArcAngry2); SoundTool.ReplaceAudioClip("Chitter1", soundNecoArcChitter1); SoundTool.ReplaceAudioClip("Chitter2", soundNecoArcChitter2); SoundTool.ReplaceAudioClip("Chitter3", soundNecoArcChitter3); SoundTool.ReplaceAudioClip("HoarderBugCry", soundNecoArcCry); SoundTool.ReplaceAudioClip("BugDie", soundNecoArcDie); SoundTool.ReplaceAudioClip("Fly", soundNecoArcFly); mls.LogInfo((object)"--=== All sounds are loaded! ===--"); } private async Task<AudioClip> LoadClip(string path) { AudioClip clip = null; UnityWebRequest uwr = UnityWebRequestMultimedia.GetAudioClip(path, (AudioType)20); try { uwr.SendWebRequest(); try { while (!uwr.isDone) { await Task.Delay(5); } if ((int)uwr.result == 2 || (int)uwr.result == 3 || (int)uwr.result == 4) { mls.LogError((object)(uwr.error ?? "")); } else { clip = DownloadHandlerAudioClip.GetContent(uwr); } } catch (Exception ex) { Exception err = ex; mls.LogError((object)(err.Message + ", " + err.StackTrace)); } } finally { ((IDisposable)uwr)?.Dispose(); } return clip; } [HarmonyPatch(typeof(HoarderBugAI), "__initializeVariables")] [HarmonyPostfix] public static void PluginDetectSummonBug(HoarderBugAI __instance) { //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) mls.LogInfo((object)"--=== Hoarder Bug Summoned ===--"); mls.LogInfo((object)"--=== Convert to Neco Arc ===--"); Transform val = ((Component)__instance).transform.Find("HoarderBugModel"); if ((Object)(object)val == (Object)null) { mls.LogInfo((object)"--=== NOT FOUND ===--"); } else { mls.LogInfo((object)"--=== FOUND ===--"); } Object.Destroy((Object)(object)((Component)((Component)__instance).gameObject.transform.Find("HoarderBugModel").Find("Cube")).gameObject.GetComponent<SkinnedMeshRenderer>()); Object.Destroy((Object)(object)((Component)((Component)__instance).gameObject.transform.Find("HoarderBugModel").Find("Cube.001")).gameObject.GetComponent<SkinnedMeshRenderer>()); GameObject val2 = Object.Instantiate<GameObject>(NecoArcPrefab); val2.transform.SetParent(val); val2.transform.localPosition = Vector3.zero; val2.transform.localRotation = Quaternion.identity; } [HarmonyPatch(typeof(RoundManager), "LoadNewLevel")] [HarmonyPrefix] private static bool ModifiedLoad(ref SelectableLevel newLevel) { mls.LogInfo((object)("Client is host: " + ((NetworkBehaviour)RoundManager.Instance).IsHost)); if (!((NetworkBehaviour)RoundManager.Instance).IsHost) { return true; } int levelID = newLevel.levelID; if (newLevel.levelID == 3) { mls.LogInfo((object)"Level is company, skipping"); DaysPassed = 0; return true; } DaysPassed++; mls.LogInfo((object)$"Days passed: {DaysPassed}"); SelectableLevel val = newLevel; Dictionary<Type, int> dictionary = new Dictionary<Type, int>(); dictionary.Clear(); if (configIncreaseNecoArcSpawns.Value && (configNecoArcDay.Value == -1 || configNecoArcDay.Value == DaysPassed)) { val.maxEnemyPowerCount = configMaxEnemyPowerCount.Value + 16; dictionary.Add(typeof(HoarderBugAI), configNecoArcRarityWeight.Value); mls.LogInfo((object)"Increased Max Power Counter and Hoarder Bug Spawns"); } else { mls.LogInfo((object)"Default settings"); } newLevel = val; return true; } } public static class PluginInfo { public const string PLUGIN_GUID = "ChdataNecoArcHoarderBug"; public const string PLUGIN_NAME = "Chdata's Neco Arc Hoarder Bug Mod"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }