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 FacilityOrMansion v1.0.3
FacilityOrMansion.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DunGen.Graph; using FacilityOrMansion.Patches; using HarmonyLib; using Microsoft.CodeAnalysis; 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: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.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.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] [Microsoft.CodeAnalysis.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] [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 FacilityOrMansion { [BepInPlugin("1.0.3", "Facility or Mansion", "1.0.3")] public class FacilityOrMansionBase : BaseUnityPlugin { public const string PLUGIN_GUID = "DeathWrench.FacilityOrMansion"; public const string PLUGIN_NAME = "Facility or Mansion"; public const string PLUGIN_VERSION = "1.0.3"; private readonly Harmony harmony = new Harmony("DeathWrench.FacilityOrMansion"); public static FacilityOrMansionBase Instance { get; private set; } public static ConfigEntry<bool> modIsEnabled { get; set; } public static ConfigEntry<bool> mansionOnly { get; set; } public static ConfigEntry<bool> facilityOnly { get; set; } public static ManualLogSource mls { get; private set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } modIsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Facility or Mansion", "Mod Enabled", false, "Enable or disable the mod."); mansionOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("Choose Only One", "Mansion Only", false, "Interiors set to Mansion."); facilityOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("Choose Only One", "Facility Only", false, "Interiors set to Facility."); mls = Logger.CreateLogSource("DeathWrench.FacilityOrMansion".ToString()); mls.LogInfo((object)"Facility or Mansion 1.0.3 loaded succesfully!"); harmony.PatchAll(typeof(DungeonFlowTypePatch)); } } } namespace FacilityOrMansion.Patches { public static class DungeonFlowTypeExtensions { public static IntWithRarity[] SetDungeonFlowTypeRarity(this RoundManager manager) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown FacilityOrMansionBase.mls.LogInfo((object)"Entered SetDungeonFlowTypeRarity"); List<IntWithRarity> list = new List<IntWithRarity>(); for (int i = 0; i < manager.dungeonFlowTypes.Length; i++) { IntWithRarity val = new IntWithRarity(); val.id = i; FacilityOrMansionBase.mls.LogInfo((object)("DungeonFlow Name = " + ((Object)manager.dungeonFlowTypes[i].dungeonFlow).name)); int num = (FacilityOrMansionBase.mansionOnly.Value ? 150 : 0); int num2 = (FacilityOrMansionBase.facilityOnly.Value ? 300 : 0); val.rarity = ((num > num2) ? num : num2); FacilityOrMansionBase.mls.LogInfo((object)$"New Rarity = {val.rarity}"); list.Add(val); } return list.ToArray(); } } internal class DungeonFlowTypePatch { [HarmonyPatch(typeof(RoundManager), "Awake")] [HarmonyPriority(250)] [HarmonyPostfix] private static void onStartPrefix(RoundManager __instance) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown if (FacilityOrMansionBase.modIsEnabled.Value) { List<IndoorMapType> list = new List<IndoorMapType>(); FacilityOrMansionBase.mls.LogInfo((object)"Inserting missing dungeon flows into the RoundManager"); List<IndoorMapType> list2 = __instance.dungeonFlowTypes.ToList(); Object[] array = Resources.FindObjectsOfTypeAll(typeof(IndoorMapType)); foreach (Object val in array) { Type type = ((object)val).GetType(); DungeonFlow val2 = (DungeonFlow)type.GetProperty("dungeonFlow").GetValue(type); float mapTileSize = (float)type.GetProperty("MapTileSize").GetValue(type); FacilityOrMansionBase.mls.LogInfo((object)("mapsize: " + mapTileSize)); IndoorMapType val3 = new IndoorMapType(); val3.dungeonFlow = val2; val3.MapTileSize = mapTileSize; FacilityOrMansionBase.mls.LogInfo((object)("map name: " + ((Object)val2).name)); list.Add(val3); } for (int j = 0; j < list.Count; j++) { IndoorMapType item = list[j]; list2.Add(item); } __instance.dungeonFlowTypes = list2.ToArray(); } } [HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")] [HarmonyPrefix] private static void FlowTypeUpdate(RoundManager __instance) { if (FacilityOrMansionBase.modIsEnabled.Value) { SelectableLevel currentLevel = __instance.currentLevel; FacilityOrMansionBase.mls.LogInfo((object)"Changing dungeon flow values"); currentLevel.dungeonFlowTypes = __instance.SetDungeonFlowTypeRarity(); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }