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 BossIdols v1.0.0
plugins\BossIdols.dll
Decompiled 2 days agousing System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using Jotunn; using Jotunn.Managers; using Jotunn.Utils; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("BossIdols")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BossIdols")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")] [assembly: AssemblyFileVersion("1.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] namespace BossIdols; [BepInPlugin("com.voxxsidus.bossidols", "BossIdols", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] internal class BossIdols : BaseUnityPlugin { public const string PluginGUID = "com.voxxsidus.bossidols"; public const string PluginName = "BossIdols"; public const string PluginVersion = "1.0.0"; public static ConfigEntry<bool> Enabled; public static ConfigEntry<int> MinPerIdol; public static ConfigEntry<int> MaxPerIdol; private ConfigFileWatcher _configWatcher; private void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown BindConfig(); _configWatcher = new ConfigFileWatcher(((BaseUnityPlugin)this).Config, 1000L); PrefabManager.OnPrefabsRegistered += IdolDrops.Apply; Logger.LogInfo((object)"BossIdols has landed"); } private void BindConfig() { Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, Synced("Whether bosses drop their biome's Battle and Protection Idols.", null)); MinPerIdol = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MinPerIdol", 1, Synced("Minimum number of each idol (Battle and Protection, rolled separately) a boss drops.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100))); MaxPerIdol = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MaxPerIdol", 3, Synced("Maximum number of each idol (Battle and Protection, rolled separately) a boss drops. Values below MinPerIdol are treated as MinPerIdol.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100))); SynchronizationManager.OnConfigurationSynchronized += delegate { IdolDrops.Apply(); }; Enabled.SettingChanged += delegate { IdolDrops.Apply(); }; MinPerIdol.SettingChanged += delegate { IdolDrops.Apply(); }; MaxPerIdol.SettingChanged += delegate { IdolDrops.Apply(); }; static ConfigDescription Synced(string description, AcceptableValueBase range) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown return new ConfigDescription(description, range, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } }); } } } internal static class IdolDrops { private static readonly (string Boss, int Tier)[] Bosses = new(string, int)[8] { ("Eikthyr", 0), ("gd_king", 1), ("Bonemass", 2), ("Dragon", 3), ("GoblinKing", 4), ("SeekerQueen", 5), ("Fader", 6), ("FrozenKing_p3", 7) }; public static void Apply() { //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)ZNetScene.instance)) { return; } bool value = BossIdols.Enabled.Value; int value2 = BossIdols.MinPerIdol.Value; int num = Mathf.Max(value2, BossIdols.MaxPerIdol.Value); int num2 = 0; (string, int)[] bosses = Bosses; ZNetView val2 = default(ZNetView); CharacterDrop characterDrop = default(CharacterDrop); for (int i = 0; i < bosses.Length; i++) { (string, int) tuple = bosses[i]; string item = tuple.Item1; int item2 = tuple.Item2; GameObject prefab = ZNetScene.instance.GetPrefab(item); CharacterDrop val = (Object.op_Implicit((Object)(object)prefab) ? prefab.GetComponent<CharacterDrop>() : null); if (!Object.op_Implicit((Object)(object)val)) { Logger.LogWarning((object)("Boss prefab '" + item + "' or its CharacterDrop not found, skipping")); continue; } List<GameObject> list = new List<GameObject>(); string[] array = new string[2] { $"Upgrader{item2}Weapon", $"Upgrader{item2}Armor" }; foreach (string text in array) { GameObject prefab2 = ZNetScene.instance.GetPrefab(text); if (Object.op_Implicit((Object)(object)prefab2)) { list.Add(prefab2); } else { Logger.LogWarning((object)("Idol prefab '" + text + "' not found, skipping it for " + item)); } } List<Drop> list2 = new List<Drop>(); if (value) { foreach (GameObject item3 in list) { list2.Add(new Drop { m_prefab = item3, m_amountMin = value2, m_amountMax = num + 1, m_chance = 1f, m_onePerPlayer = false, m_levelMultiplier = false, m_dontScale = true }); } } SetIdolDrops(val, list, list2); num2 += list2.Count; int stableHashCode = StringExtensionMethods.GetStableHashCode(item); foreach (Character allCharacter in Character.GetAllCharacters()) { if (((Component)allCharacter).TryGetComponent<ZNetView>(ref val2)) { ZDO zDO = val2.GetZDO(); if (zDO != null && zDO.GetPrefab() == stableHashCode && ((Component)allCharacter).TryGetComponent<CharacterDrop>(ref characterDrop)) { SetIdolDrops(characterDrop, list, list2); } } } } Logger.LogInfo((object)(value ? $"Added {num2} boss idol drops ({value2}-{num} each)" : "Disabled; boss idol drops removed")); } private static void SetIdolDrops(CharacterDrop characterDrop, List<GameObject> idols, List<Drop> drops) { characterDrop.m_drops.RemoveAll((Drop drop) => idols.Contains(drop.m_prefab)); characterDrop.m_drops.AddRange(drops); } }