Decompiled source of SlightlyCasualDebuffs v1.0.0

SlightlyCasualDebuffs.dll

Decompiled a week 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 HarmonyLib;
using Microsoft.CodeAnalysis;
using Peak.Afflictions;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: AssemblyCompany("SlightlyCasualDebuffs")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("A debuff rebalancing mod.")]
[assembly: AssemblyTitle("SlightlyCasualDebuffs")]
[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 SlightlyCasualDebuffs
{
	[BepInPlugin("saitelait.slightlycasualdebuffs", "Slightly Casual Debuffs", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static ConfigEntry<float> DebuffMultiplier { get; private set; }

		public static ConfigEntry<float> TimerMultiplier { get; private set; }

		private void Awake()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			DebuffMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Slightly Casual Debuffs", "DebuffMultiplier", 0.6f, "Multiplier for the intensity of all debuffs.");
			TimerMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Slightly Casual Debuffs", "TimerMultiplier", 0.65f, "Multiplier for the duration of timed debuffs.");
			Harmony val = new Harmony("saitelait.slightlycasualdebuffs");
			val.PatchAll();
		}
	}
	[HarmonyPatch(typeof(CharacterAfflictions))]
	public static class TimedAfflictionPatches
	{
		[HarmonyPatch("AddAffliction")]
		[HarmonyPrefix]
		public static void ModifyAffliction(ref Affliction affliction)
		{
			if (affliction == null)
			{
				return;
			}
			Affliction obj = affliction;
			obj.totalTime *= Plugin.TimerMultiplier.Value;
			Affliction val = affliction;
			Affliction val2 = val;
			Affliction_PoisonOverTime val3 = (Affliction_PoisonOverTime)(object)((val2 is Affliction_PoisonOverTime) ? val2 : null);
			if (val3 == null)
			{
				Affliction_AdjustColdOverTime val4 = (Affliction_AdjustColdOverTime)(object)((val2 is Affliction_AdjustColdOverTime) ? val2 : null);
				if (val4 == null)
				{
					Affliction_AdjustDrowsyOverTime val5 = (Affliction_AdjustDrowsyOverTime)(object)((val2 is Affliction_AdjustDrowsyOverTime) ? val2 : null);
					if (val5 != null)
					{
						val5.statusPerSecond *= Plugin.DebuffMultiplier.Value;
					}
				}
				else
				{
					val4.statusPerSecond *= Plugin.DebuffMultiplier.Value;
				}
			}
			else
			{
				val3.statusPerSecond *= Plugin.DebuffMultiplier.Value;
			}
		}
	}
	[HarmonyPatch(typeof(CharacterAfflictions))]
	public static class DirectStatusPatches
	{
		[HarmonyPatch("AddStatus")]
		[HarmonyPrefix]
		public static void ModifyDirectStatus(STATUSTYPE statusType, ref float amount)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			if ((int)statusType != 7)
			{
				amount *= Plugin.DebuffMultiplier.Value;
			}
		}
	}
	public static class Consts
	{
		public const string PLUGIN_GUID = "saitelait.slightlycasualdebuffs";

		public const string PLUGIN_NAME = "Slightly Casual Debuffs";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}