Decompiled source of LethalAdjustments v1.0.1

LethalAdjustments.dll

Decompiled 8 months ago
using System;
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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7", FrameworkDisplayName = ".NET Framework 4.7")]
[assembly: AssemblyCompany("LethalAdjustments")]
[assembly: AssemblyConfiguration("release")]
[assembly: AssemblyDescription("Lets you adjust various internal values")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LethalAdjustments")]
[assembly: AssemblyTitle("LethalAdjustments")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LethalAdjustments
{
	[BepInPlugin("LethalAdjustments", "LethalAdjustments", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Patches.Init(((BaseUnityPlugin)this).Logger);
			new Harmony("LethalAdjustments").PatchAll(typeof(Patches));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalAdjustments is loaded!");
		}
	}
	internal class Config
	{
		private static ConfigFile MapSizeFile { get; set; }

		internal static ConfigEntry<float> MapSizeMultiplier { get; set; }

		private static ConfigFile ScrapAmountFile { get; set; }

		internal static ConfigEntry<float> ScrapAmountMultiplier { get; set; }

		private static ConfigFile ScrapValueFile { get; set; }

		internal static ConfigEntry<float> ScrapValueMultiplier { get; set; }

		static Config()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			MapSizeFile = new ConfigFile(Paths.ConfigPath + "\\LethalAdjustments\\MapSize.cfg", true);
			MapSizeMultiplier = MapSizeFile.Bind<float>("MapSize", "Multiplier", 1f, "Multiplier of the map's size");
			ScrapAmountFile = new ConfigFile(Paths.ConfigPath + "\\LethalAdjustments\\ScrapAmount.cfg", true);
			ScrapAmountMultiplier = ScrapAmountFile.Bind<float>("ScrapAmount", "Multiplier", 1f, "Multiplier of the amount of scrap spawned");
			ScrapValueFile = new ConfigFile(Paths.ConfigPath + "\\LethalAdjustments\\ScrapValue.cfg", true);
			ScrapValueMultiplier = ScrapValueFile.Bind<float>("ScrapValue", "Multiplier", 1f, "Multiplier of the value of scrap spawned");
		}
	}
	internal class Patches
	{
		private static ManualLogSource Logger { get; set; }

		public static void Init(ManualLogSource logger)
		{
			Logger = logger;
		}

		[HarmonyPatch(typeof(RoundManager), "Awake")]
		[HarmonyPostfix]
		private static void AwakePatch()
		{
			Logger.LogInfo((object)$"RoundManager: mapSizeMultiplier = {Config.MapSizeMultiplier.Value}");
			RoundManager.Instance.mapSizeMultiplier = Config.MapSizeMultiplier.Value;
			Logger.LogInfo((object)$"RoundManager: scrapAmountMultiplier = {Config.ScrapAmountMultiplier.Value}");
			RoundManager.Instance.scrapAmountMultiplier = Config.ScrapAmountMultiplier.Value;
			Logger.LogInfo((object)$"RoundManager: scrapValueMultiplier = {Config.ScrapValueMultiplier.Value}");
			RoundManager.Instance.scrapValueMultiplier = Config.ScrapValueMultiplier.Value;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LethalAdjustments";

		public const string PLUGIN_NAME = "LethalAdjustments";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}