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 FacilityMeltdownBlacklist v0.0.2
FacilityMeltdownBlacklist.dll
Decompiled 15 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Dawn; using DunGen.Graph; using FacilityMeltdown.API; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using loaforcsSoundAPI.SoundPacks.Data.Conditions; [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("FacilityMeltdownBlacklist")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.0.1.0")] [assembly: AssemblyInformationalVersion("0.0.1")] [assembly: AssemblyProduct("FacilityMeltdownBlacklist")] [assembly: AssemblyTitle("FacilityMeltdownBlacklist")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [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 FacilityMeltdownBlacklist { internal class ConfigManager { internal ConfigEntry<string> BlacklistedMoons { get; } internal ConfigEntry<string> BlacklistedInteriors { get; } internal ConfigEntry<string> BlacklistedMoonTags { get; } internal ConfigEntry<string> BlacklistedInteriorTags { get; } internal ConfigManager(ConfigFile config) { BlacklistedMoons = config.Bind<string>("Facility Meltdown Blacklist Options", "Blacklisted moons", "", "DawnLib moon namespaced keys where apparatus pulls cannot start FacilityMeltdown, separated by commas. E.g. 'lethal_company:experimentation,lethal_company:rend'"); BlacklistedInteriors = config.Bind<string>("Facility Meltdown Blacklist Options", "Blacklisted interiors", "", "DawnLib interior namespaced keys where apparatus pulls cannot start FacilityMeltdown, separated by commas. E.g. 'lethal_company:facility,therubberrooms:rubberroomsflow'"); BlacklistedMoonTags = config.Bind<string>("Facility Meltdown Blacklist Options", "Blacklisted moon tags", "", "DawnLib moon tag namespaced keys where apparatus pulls cannot start FacilityMeltdown, separated by commas. E.g. 'lethal_company:company,lethal_level_loader:valley,lunarcontenttag:argon'"); BlacklistedInteriorTags = config.Bind<string>("Facility Meltdown Blacklist Options", "Blacklisted interior tags", "", "DawnLib interior tag namespaced keys where apparatus pulls cannot start FacilityMeltdown, separated by commas. E.g. 'lethal_company:indoor,gray_apartments_dungeon:dusty'"); } } internal static class FacilityMeltdownPatches { [HarmonyPatch("FacilityMeltdown.Patches.ApparaticePatch, FacilityMeltdown", "BeginMeltdownSequence")] [HarmonyPrefix] private static bool BeginMeltdownSequencePrefix(LungProp __0, ref bool __1) { if (!((NetworkBehaviour)__0).IsHost || !__1 || MeltdownAPI.MeltdownStarted) { return true; } return !MeltdownBlacklist.ShouldBlockThisRound(); } } internal static class Log { internal static void Debug(string message) { Write((LogLevel)32, message); } internal static void Info(string message) { Write((LogLevel)16, message); } internal static void Warn(string message) { Write((LogLevel)4, message); } internal static void Error(string message) { Write((LogLevel)2, message); } internal static void Fatal(string message) { Write((LogLevel)1, message); } private static void Write(LogLevel logLevel, string message) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (Plugin.mls != null) { Plugin.mls.Log(logLevel, (object)message); } } } internal static class MeltdownBlacklist { internal static bool ShouldBlockThisRound() { RoundManager instance = RoundManager.Instance; DawnMoonInfo dawnInfo = SelectableLevelExtensions.GetDawnInfo(instance.currentLevel); if (Listed(Plugin.Configs.BlacklistedMoons.Value, ((DawnBaseInfo<DawnMoonInfo>)(object)dawnInfo).Key) || Tagged<DawnMoonInfo>((DawnBaseInfo<DawnMoonInfo>)(object)dawnInfo, Plugin.Configs.BlacklistedMoonTags.Value)) { Log.Info($"Meltdown blocked on moon {((DawnBaseInfo<DawnMoonInfo>)(object)dawnInfo).Key}"); return true; } DungeonFlow dungeonFlow = instance.dungeonFlowTypes[instance.currentDungeonType].dungeonFlow; DawnDungeonInfo val = default(DawnDungeonInfo); if (!DungeonFlowExtensions.TryGetDawnInfo(dungeonFlow, ref val)) { return false; } if (Listed(Plugin.Configs.BlacklistedInteriors.Value, ((DawnBaseInfo<DawnDungeonInfo>)(object)val).Key) || Tagged<DawnDungeonInfo>((DawnBaseInfo<DawnDungeonInfo>)(object)val, Plugin.Configs.BlacklistedInteriorTags.Value)) { Log.Info($"Meltdown blocked in interior {((DawnBaseInfo<DawnDungeonInfo>)(object)val).Key}"); return true; } return false; } private static bool Listed(string rawList, NamespacedKey key) { foreach (NamespacedKey item in Keys(rawList)) { if (((object)item).Equals((object?)key)) { return true; } } return false; } private static bool Tagged<T>(DawnBaseInfo<T> info, string rawTags) where T : DawnBaseInfo<T> { foreach (NamespacedKey item in Keys(rawTags)) { if (info.HasTag(item)) { return true; } } return false; } private static IEnumerable<NamespacedKey> Keys(string rawList) { string[] array = rawList.Split(','); NamespacedKey key = default(NamespacedKey); foreach (string rawEntry in array) { if (NamespacedKey.TryParse(rawEntry.Trim(), ref key)) { yield return key; } key = null; } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("MrHat.FacilityMeltdownBlacklist", "FacilityMeltdownBlacklist", "0.0.1")] internal class Plugin : BaseUnityPlugin { internal const string modGUID = "MrHat.FacilityMeltdownBlacklist"; internal const string modName = "FacilityMeltdownBlacklist"; private const string modVersion = "0.0.1"; internal const string DawnLibGUID = "com.github.teamxiaolan.dawnlib"; internal const string DuskGUID = "com.github.teamxiaolan.dawnlib.dusk"; internal const string FacilityMeltdownGUID = "me.loaforc.facilitymeltdown"; internal const string SoundAPIGUID = "me.loaforc.soundapi"; internal static Harmony _harmony; internal static ManualLogSource mls; internal static bool hasSoundAPI; internal static Plugin Instance { get; private set; } internal static ConfigManager Configs { get; private set; } private void Awake() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown Instance = this; mls = Logger.CreateLogSource("MrHat.FacilityMeltdownBlacklist"); _harmony = new Harmony("MrHat.FacilityMeltdownBlacklist"); hasSoundAPI = Chainloader.PluginInfos.ContainsKey("me.loaforc.soundapi"); Configs = new ConfigManager(((BaseUnityPlugin)this).Config); Log.Info("Blacklisted moons " + (string.IsNullOrWhiteSpace(Configs.BlacklistedMoons.Value) ? "none" : Configs.BlacklistedMoons.Value)); Log.Info("Blacklisted interiors " + (string.IsNullOrWhiteSpace(Configs.BlacklistedInteriors.Value) ? "none" : Configs.BlacklistedInteriors.Value)); Log.Info("Blacklisted moon tags " + (string.IsNullOrWhiteSpace(Configs.BlacklistedMoonTags.Value) ? "none" : Configs.BlacklistedMoonTags.Value)); Log.Info("Blacklisted interior tags " + (string.IsNullOrWhiteSpace(Configs.BlacklistedInteriorTags.Value) ? "none" : Configs.BlacklistedInteriorTags.Value)); _harmony.PatchAll(typeof(FacilityMeltdownPatches)); if (hasSoundAPI) { _harmony.PatchAll(typeof(SoundAPICompatibilityPatches)); mls.LogDebug((object)"Ran SoundAPI Compat"); } } } internal static class SoundAPICompatibilityPatches { private static bool loggedIncompatibleCondition; [HarmonyPatch(typeof(Conditional), "Evaluate")] [HarmonyFinalizer] private static Exception? EvaluateFinalizer(Exception? __exception, ref bool __result) { if (!(__exception is TypeLoadException)) { return __exception; } __result = false; if (!loggedIncompatibleCondition) { loggedIncompatibleCondition = true; Log.Warn("SoundAPI did something I did not want it to do."); } return null; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "FacilityMeltdownBlacklist"; public const string PLUGIN_NAME = "FacilityMeltdownBlacklist"; public const string PLUGIN_VERSION = "0.0.1"; } }