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 ScrapSettings v1.1.2
ScrapSettings.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ScrapSettings")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ScrapSettings")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("538b9fbb-17d4-44de-8afb-f9b336a945ce")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace ScrapSettings; [BepInPlugin("Fred.ScrapSettings", "ScrapSettings", "1.1.2")] public class ModBase : BaseUnityPlugin { internal class ConfigurationController { private ConfigEntry<float> ScrapValMultiCfg; private ConfigEntry<float> ScrapAmountMultiCfg; private ConfigEntry<float> MapSizeMultiCfg; internal float ScrapValMulti { get { if (ScrapValMultiCfg.Value < 0f) { ScrapValMultiCfg.Value = (float)((ConfigEntryBase)ScrapValMultiCfg).DefaultValue; } return ScrapValMultiCfg.Value; } set { ScrapValMultiCfg.Value = value; } } internal float ScrapAmountMulti { get { if (ScrapAmountMultiCfg.Value < 0f) { ScrapAmountMultiCfg.Value = (int)((ConfigEntryBase)ScrapAmountMultiCfg).DefaultValue; } return ScrapAmountMultiCfg.Value; } set { ScrapAmountMultiCfg.Value = value; } } internal float MapSizeMulti { get { if (MapSizeMultiCfg.Value < 0f) { MapSizeMultiCfg.Value = (float)((ConfigEntryBase)MapSizeMultiCfg).DefaultValue; } return MapSizeMultiCfg.Value; } set { MapSizeMultiCfg.Value = value; } } public ConfigurationController(ConfigFile Config) { ScrapValMultiCfg = Config.Bind<float>("General", "Scrap Value Multiplier", 1f, "Thfe higher the number, the more valuable the scrap."); ScrapAmountMultiCfg = Config.Bind<float>("General", "Scrap Amount Multiplier", 1f, "The higher the number, the more the scrap."); MapSizeMultiCfg = Config.Bind<float>("General", "Map Size Multiplier", 1f, "The higher the number, the bigger the scrap."); } } private const string modGUID = "Fred.ScrapSettings"; private const string modName = "ScrapSettings"; private const string modVersion = "1.1.2"; private readonly Harmony harmony = new Harmony("Fred.ScrapSettings"); internal ConfigurationController ConfigManager; internal static ModBase Instance; public static float ScrapValMulti; public static float ScrapAmountMulti; public static float MapSizeMulti; internal ManualLogSource mls = Logger.CreateLogSource("Fred.ScrapSettings"); private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } ConfigManager = new ConfigurationController(((BaseUnityPlugin)this).Config); ScrapAmountMulti = ConfigManager.ScrapAmountMulti; MapSizeMulti = ConfigManager.MapSizeMulti; ScrapValMulti = ConfigManager.ScrapValMulti; Instance.mls.LogInfo((object)"Scrap Settings is active!"); harmony.PatchAll(typeof(ModBase)); harmony.PatchAll(typeof(ScrapSettingsPatch)); } } [HarmonyPatch(typeof(RoundManager))] internal class ScrapSettingsPatch { [HarmonyPatch("Awake")] [HarmonyPrefix] private static void PatchRoundManager(ref RoundManager ___instance) { ___instance.scrapValueMultiplier = ModBase.ScrapValMulti; ___instance.scrapAmountMultiplier = ModBase.ScrapAmountMulti; ___instance.mapSizeMultiplier = ModBase.MapSizeMulti; } }