Decompiled source of Just Keep My Skills Please v0.9.0

BepInEx/plugins/JustKeepMySkillsPlease.dll

Decompiled 2 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Just Keep My Skills Please")]
[assembly: AssemblyDescription("No skill loss on death + corpse run related things")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Just Keep My Skills Please")]
[assembly: AssemblyCopyright("Copyright © Ravenis 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7C60F62F-A027-415B-9BC5-829E55843008")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace JustKeepMySkillsPlease;

[BepInPlugin("ravenis.justkeepmyskillsplease", "Just Keep My Skills Please", "0.9.0")]
public class JustKeepMySkillsPlease : BaseUnityPlugin
{
	[HarmonyPatch(typeof(Skills))]
	private static class SkillsPatches
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void Awake_Postfix(Skills __instance)
		{
			__instance.m_DeathLowerFactor = skillLoss * 0f;
		}
	}

	[HarmonyPatch(typeof(TombStone))]
	private static class TombStone_Patches
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void Awake_Postfix(TombStone __instance)
		{
			__instance.m_lootStatusEffect.m_ttl = safeRunDuration.Value;
			sTombStones.Add(__instance);
		}

		[HarmonyPatch("UpdateDespawn")]
		[HarmonyPostfix]
		private static void UpdateDespawn_Postfix(TombStone __instance)
		{
			sTombStones.Remove(__instance);
		}
	}

	public static bool modEnabled;

	public const string ModId = "ravenis.justkeepmyskillsplease";

	public static float skillLoss;

	public static ConfigEntry<float> safeRunDuration;

	private static List<TombStone> sTombStones;

	private void OnDestroy()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("ravenis.justkeepmyskillsplease");
		val.UnpatchSelf();
	}

	private void Awake()
	{
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Expected O, but got Unknown
		modEnabled = true;
		skillLoss = 0f;
		safeRunDuration = ((BaseUnityPlugin)this).Config.Bind<float>("After corpse run", "safeRunDuration", 10f, "Status effect duration in seconds, that is granted after looting a tombstone to boost regen rates and other stats. Vanilla default is 50s. This mod default is 10s");
		sTombStones = new List<TombStone>();
		Harmony val = new Harmony("ravenis.justkeepmyskillsplease");
		val.PatchAll();
	}
}