Decompiled source of RealisticTransgendence v2.0.1

RealisticTransgendence.dll

Decompiled 10 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 On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
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.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("RealisticTransgendence")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RealisticTransgendence")]
[assembly: AssemblyTitle("RealisticTransgendence")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace RealisticTransgendence;

[BepInDependency(/*Could not decode attribute arguments.*/)]
[R2APISubmoduleDependency(new string[] { "LanguageAPI" })]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.TransRights.RealisticTransgendence", "RealisticTransgendence", "2.0.0")]
public class RealisticTransgendencePlugin : BaseUnityPlugin
{
	public const string guid = "com.TransRights.RealisticTransgendence";

	public const string modName = "RealisticTransgendence";

	public const string version = "2.0.0";

	internal static ConfigFile CustomConfigFile { get; set; }

	public static ConfigEntry<bool> OnlyOneExtraJump { get; set; }

	private void Awake()
	{
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Expected O, but got Unknown
		InitializeConfig();
		LanguageAPI.Add("ITEM_SHIELDONLY_PICKUP", "Convert all your health into shield. Increase maximum health. Gain an extra jump.");
		LanguageAPI.Add("ITEM_SHIELDONLY_DESC", "<style=cIsHealing>Convert</style> all but <style=cIsHealing>1 health</style> into <style=cIsHealing>regenerating shields</style>. <style=cIsHealing>Gain 50% <style=cStack>(+25% per stack)</style> maximum health</style>. " + (OnlyOneExtraJump.Value ? "Gain an additional jump" : "Gain 1 additional jump <style=cStack>(+1 per stack)</style>."));
		CharacterBody.RecalculateStats += new hook_RecalculateStats(TransgendenceDoubleJump);
	}

	private void InitializeConfig()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		CustomConfigFile = new ConfigFile(Paths.ConfigPath + "\\RealisticTransgendence.cfg", true);
		OnlyOneExtraJump = CustomConfigFile.Bind<bool>("Only One Extra Jump", "Should TRANSGENDENCE only provide one additional jump", true, "Set this to FALSE if you want TRANSGENDENCE's realistic double jumps to stack.");
	}

	private void TransgendenceDoubleJump(orig_RecalculateStats orig, CharacterBody self)
	{
		orig.Invoke(self);
		if ((Object)(object)self.inventory != (Object)null)
		{
			int itemCount = self.inventory.GetItemCount(Items.ShieldOnly);
			if (!OnlyOneExtraJump.Value)
			{
				self.maxJumpCount += itemCount;
			}
			else if (itemCount > 0)
			{
				self.maxJumpCount += 1;
			}
		}
	}
}