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 MansionRend v1.1.0
baer1.MansionRend.dll
Decompiled a year 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.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; [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("baer1.MansionRend")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0+9673c734ec138503aaea55e7544847c5af155169")] [assembly: AssemblyProduct("MansionRend")] [assembly: AssemblyTitle("baer1.MansionRend")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.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 MansionRend { [BepInPlugin("baer1.MansionRend", "MansionRend", "1.1.0")] public class MansionRend : BaseUnityPlugin { [HarmonyPatch(typeof(RoundManager), "LoadNewLevelWait")] public class LoadNewLevelWaitPatch { private static void Prefix(ref RoundManager __instance, ref int randomSeed) { Logger.LogDebug((object)$">> LoadNewLevelWait: {__instance.currentLevel.PlanetName} (seed:{randomSeed}, id:{__instance.currentLevel.levelID}) {__instance.currentLevel.dungeonFlowTypes.Length} interiors found:"); IntWithRarity[] dungeonFlowTypes = __instance.currentLevel.dungeonFlowTypes; foreach (IntWithRarity val in dungeonFlowTypes) { Logger.LogDebug((object)$" {val.id} - {val.rarity}"); } if (__instance.currentLevel.levelID != 6) { return; } Logger.LogDebug((object)"Finding seed with mansion generation..."); try { while (!IsGeneration(ref __instance, randomSeed, 1)) { Logger.LogDebug((object)$"Seed {randomSeed} does not have mansion generation, trying next seed"); StartOfRound.Instance.ChooseNewRandomMapSeed(); randomSeed = StartOfRound.Instance.randomMapSeed; } Logger.LogDebug((object)$"Seed {randomSeed} has mansion generation, proceeding"); } catch (Exception ex) { Logger.LogError((object)("An unexpected error occurred: " + ex.GetType().Name + " " + ex.StackTrace)); } if (IsGeneration(ref __instance, randomSeed, 1)) { Logger.LogDebug((object)$"<< LoadNewLevelWait: seed {randomSeed} has mansion generation"); } else { Logger.LogError((object)$"<< LoadNewLevelWait: seed {randomSeed} does not have mansion generation"); } } internal static bool IsGeneration(ref RoundManager __instance, int randomSeed, int generationId) { if (__instance.currentLevel.dungeonFlowTypes == null || __instance.currentLevel.dungeonFlowTypes.Length == 0) { return false; } List<int> list = new List<int>(); list.AddRange(__instance.currentLevel.dungeonFlowTypes.Select((IntWithRarity i) => i.rarity)); int randomWeightedIndex = __instance.GetRandomWeightedIndex(list.ToArray(), new Random(randomSeed)); return __instance.currentLevel.dungeonFlowTypes[randomWeightedIndex].id == generationId; } } internal const int REND = 6; internal const int MANSION = 1; internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } private void Awake() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; if (Harmony == null) { Harmony = new Harmony("baer1.MansionRend"); } Logger.LogDebug((object)"Patching..."); Harmony.PatchAll(); Logger.LogDebug((object)"Finished patching!"); Logger.LogInfo((object)"baer1.MansionRend v1.1.0 has loaded!"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "baer1.MansionRend"; public const string PLUGIN_NAME = "MansionRend"; public const string PLUGIN_VERSION = "1.1.0"; } }