Decompiled source of DeathPenaltyReducedMod v1.0.0

DeathPenaltyReducedMod.dll

Decompiled a year ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
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("DeathPenaltyReduced")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DeathPenaltyReduced")]
[assembly: AssemblyCopyright("Copyright © Anders <Branders> Blomqvist 2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("324e9af5-3a4c-474d-bc53-6d974e7ede9f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DeathAnnouncer;

[BepInPlugin("com.yamato.DeathPenaltyReducedMod", "Death Penalty Reduced", "1.0.0.0")]
public class DeathPenaltyReducedMod : BaseUnityPlugin
{
	public static ConfigEntry<bool> IsEnable;

	private void Awake()
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Expected O, but got Unknown
		IsEnable = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "IsEnable_DeathPenaltyReduced", true, "");
		Harmony val = new Harmony("com.yamato.DeathPenaltyReducedMod");
		val.PatchAll();
		Harmony.CreateAndPatchAll(typeof(DeathPenaltyReducedMod), (string)null);
	}

	[HarmonyPatch(typeof(Skills), "LowerAllSkills")]
	[HarmonyTranspiler]
	private static IEnumerable<CodeInstruction> ReducePenatly(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
	{
		List<CodeInstruction> newInstructions = new List<CodeInstruction>(instructions);
		int offset = 1;
		int index = newInstructions.FindIndex((CodeInstruction instruction) => instruction.opcode == OpCodes.Stloc_1) + offset;
		newInstructions.RemoveRange(index, 13);
		for (int z = 0; z < newInstructions.Count; z++)
		{
			yield return newInstructions[z];
		}
	}
}