Please disclose if your mod was created primarily 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 ArtificeTweaks v0.1.1
ArlenFreii.ArtificeTweaks.dll
Decompiled a year agousing System; 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 DunGen; 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: AssemblyCompany("ArlenFreii.ArtificeTweaks")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.1.1.0")] [assembly: AssemblyInformationalVersion("0.1.1+c2d14a41781129a229feb69ba1e4cd0048e2021b")] [assembly: AssemblyProduct("ArtificeTweaks")] [assembly: AssemblyTitle("ArlenFreii.ArtificeTweaks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.1.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 ArtificeTweaks { internal enum InteriorIDs { Factory = 0, Mansion = 1, Mineshaft = 4 } [BepInPlugin("ArlenFreii.ArtificeTweaks", "ArtificeTweaks", "0.1.1")] public class ArtificeTweaks : BaseUnityPlugin { public static readonly string LevelName = "ArtificeLevel"; public static readonly IntWithRarity[] UpdatedDungeonFlows = (IntWithRarity[])(object)new IntWithRarity[3] { new IntWithRarity { id = 0, rarity = 25 }, new IntWithRarity { id = 1, rarity = 50 }, new IntWithRarity { id = 4, rarity = 25 } }; public static readonly float UpdatedFactorySizeMultiplier = 2f; public static readonly int UpdatedMinScrap = 30; public static readonly int UpdatedMaxScrap = 38; public static ArtificeTweaks Instance { get; private set; } = null; internal static ManualLogSource Logger { get; private set; } = null; internal static Harmony? Harmony { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; Patch(); Logger.LogInfo((object)"ArlenFreii.ArtificeTweaks v0.1.1 has loaded!"); } internal static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("ArlenFreii.ArtificeTweaks"); } Logger.LogDebug((object)"Patching..."); Harmony.PatchAll(); Logger.LogDebug((object)"Finished patching!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } public static void TimedLog(LogLevel level, object data) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) Logger.Log(level, (object)$"{DateTime.UtcNow} | {data}"); } public static string PPFlowTypes(IntWithRarity[] flows) { return string.Join(", ", flows.Select((IntWithRarity flow) => $"{Enum.GetName(typeof(InteriorIDs), flow.id)} - {flow.rarity}")); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "ArlenFreii.ArtificeTweaks"; public const string PLUGIN_NAME = "ArtificeTweaks"; public const string PLUGIN_VERSION = "0.1.1"; } } namespace ArtificeTweaks.Patches { [HarmonyPatch(typeof(RoundManager))] internal class RoundManager_Patches { [HarmonyPatch("LoadNewLevel")] [HarmonyPriority(800)] [HarmonyPrefix] private static void LoadNewLevel_Prefix(ref SelectableLevel newLevel) { if (((Object)newLevel).name == ArtificeTweaks.LevelName) { ArtificeTweaks.TimedLog((LogLevel)16, "Level loading is Artifice, applying scrap count range and factory size multiplier tweaks."); newLevel.minScrap = ArtificeTweaks.UpdatedMinScrap; newLevel.maxScrap = ArtificeTweaks.UpdatedMaxScrap; newLevel.factorySizeMultiplier = ArtificeTweaks.UpdatedFactorySizeMultiplier; ArtificeTweaks.TimedLog((LogLevel)16, "Successfully applied."); } } [HarmonyPatch("GenerateNewFloor")] [HarmonyPriority(200)] [HarmonyPrefix] private static void GenerateNewFloor_Prefix(RoundManager __instance) { if (((Object)__instance.currentLevel).name == ArtificeTweaks.LevelName) { ArtificeTweaks.TimedLog((LogLevel)16, "Level loading is Artifice, applying dungeon flow and factory size tweaks."); SelectableLevel currentLevel = __instance.currentLevel; currentLevel.dungeonFlowTypes = ArtificeTweaks.UpdatedDungeonFlows; currentLevel.factorySizeMultiplier = ArtificeTweaks.UpdatedFactorySizeMultiplier; ArtificeTweaks.TimedLog((LogLevel)16, "Successfully applied."); } } } [HarmonyPatch(typeof(RuntimeDungeon))] internal class RuntimeDungeon_Patches { [HarmonyPatch("Generate")] [HarmonyPriority(300)] [HarmonyPrefix] private static void Generate_Prefix(RuntimeDungeon __instance) { if (((Object)RoundManager.Instance.currentLevel).name == ArtificeTweaks.LevelName) { ArtificeTweaks.TimedLog((LogLevel)16, "Generating Artifice interior, applying updated factory size multiplier value."); __instance.Generator.LengthMultiplier = RoundManager.Instance.mapSizeMultiplier * RoundManager.Instance.currentLevel.factorySizeMultiplier; ArtificeTweaks.TimedLog((LogLevel)16, "Successfully applied."); } } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRound_Patches { [HarmonyPatch("OnShipLandedMiscEvents")] [HarmonyPostfix] private static void OnShipLandedMiscEvents_Postfix() { if (((Object)RoundManager.Instance.currentLevel).name == ArtificeTweaks.LevelName) { SelectableLevel currentLevel = RoundManager.Instance.currentLevel; int num = (from ob in Object.FindObjectsOfType<GrabbableObject>() where ob.itemProperties.isScrap && !ob.isInShipRoom && !ob.isInElevator select ob).Count(); string name = Enum.GetName(typeof(InteriorIDs), RoundManager.Instance.currentDungeonType); ArtificeTweaks.TimedLog((LogLevel)32, "Ship landed, tweaked values are:"); ArtificeTweaks.TimedLog((LogLevel)32, $"factorySizeMultiplier: {currentLevel.factorySizeMultiplier};"); ArtificeTweaks.TimedLog((LogLevel)32, $"minScrap, maxScrap, scrapSpawned: {currentLevel.minScrap}, {currentLevel.maxScrap}, {num};"); ArtificeTweaks.TimedLog((LogLevel)32, "dungeonFlowTypes: " + ArtificeTweaks.PPFlowTypes(currentLevel.dungeonFlowTypes) + ";"); ArtificeTweaks.TimedLog((LogLevel)32, "interiorSpawned: " + name + ";"); } } } }