Decompiled source of Coil Head Weight Adjustment v1.2.1

SpringManWeightFix2.dll

Decompiled 7 months ago
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 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("SpringManWeightFix2")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A simple mod to change the weightin gof the coil head")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SpringManWeightFix2")]
[assembly: AssemblyTitle("SpringManWeightFix2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace SpringManWeightFix2;

[BepInPlugin("SpringManWeightFix2", "SpringManWeightFix2", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private readonly Harmony harmony = new Harmony("SpringManWeightFix2");

	private static ConfigEntry<float> weightConfig;

	private void Awake()
	{
		harmony.PatchAll(typeof(Plugin));
		weightConfig = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Power Level", 3f, "The new power level of a coil-head");
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin SpringManWeightFix2 is loaded!");
	}

	[HarmonyPatch(typeof(StartOfRound), "StartGame")]
	[HarmonyPrefix]
	public static void SpringManWeightPatch(StartOfRound __instance)
	{
		foreach (SpawnableEnemyWithRarity enemy in __instance.currentLevel.Enemies)
		{
			SpringManAI component = enemy.enemyType.enemyPrefab.GetComponent<SpringManAI>();
			if ((Object)(object)component != (Object)null)
			{
				enemy.enemyType.PowerLevel = weightConfig.Value;
			}
		}
	}
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "SpringManWeightFix2";

	public const string PLUGIN_NAME = "SpringManWeightFix2";

	public const string PLUGIN_VERSION = "1.0.0";
}