Decompiled source of AscentDetails v1.0.0

BepInEx/plugins/com.github.hyoelk.AscentDetails.dll

Decompiled 6 days 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.Logging;
using Microsoft.CodeAnalysis;
using On;

[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 = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.github.hyoelk.AscentDetails")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+3ccf67a11906a2f7e178ae6185013ad79632674f")]
[assembly: AssemblyProduct("com.github.hyoelk.AscentDetails")]
[assembly: AssemblyTitle("AscentDetails")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace AscentDetails
{
	[BepInPlugin("com.github.hyoelk.AscentDetails", "AscentDetails", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string Id = "com.github.hyoelk.AscentDetails";

		internal static ManualLogSource Log { get; private set; }

		public static string Name => "AscentDetails";

		public static string Version => "1.0.0";

		private void Awake()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
			BoardingPass.Initialize += new hook_Initialize(BoardingPass_Initialize);
		}

		private void BoardingPass_Initialize(orig_Initialize orig, BoardingPass self)
		{
			int currentAscent = Ascents.currentAscent;
			Ascents.currentAscent = -1;
			self.ascentData.ascents[Ascents.currentAscent + 1].description = "Climbing takes " + getPositivePercentage(1f - Ascents.climbStaminaMultiplier) + " less stamina.  Hunger grows " + getPositivePercentage(1f - Ascents.hungerRateMultiplier) + " slower. No time limit.";
			Ascents.currentAscent = 1;
			self.ascentData.ascents[Ascents.currentAscent + 1].description = "Fall damage is " + getNegativePercentage(Ascents.fallDamageMultiplier - 1f) + " greater.";
			Ascents.currentAscent = 2;
			self.ascentData.ascents[Ascents.currentAscent + 1].description = "Hunger grows " + getNegativePercentage(Ascents.hungerRateMultiplier - 1f) + " faster.";
			Ascents.currentAscent = 3;
			self.ascentData.ascents[Ascents.currentAscent + 1].description = "Items have their weight increased by " + printAsRed(Ascents.itemWeightModifier.ToString()) + ", equivalent to an extra apple for every item carried.";
			Ascents.currentAscent = 5;
			float num = Ascents.nightColdRate * 100f;
			float num2 = 1f;
			while (num < 1f)
			{
				num *= 10f;
				num2 *= 10f;
			}
			self.ascentData.ascents[Ascents.currentAscent + 1].description = "While in the night, get " + getNegativePercentage(num / 100f) + " cold every " + printSeconds(num2) + ".";
			Ascents.currentAscent = 6;
			self.ascentData.ascents[Ascents.currentAscent + 1].description = " Climbing takes additional " + getNegativePercentage(Ascents.climbStaminaMultiplier - 1f) + " stamina.";
			orig.Invoke(self);
		}

		private string getPositivePercentage(float percentage)
		{
			return printAsGreen((percentage * 100f).ToString()) + "%";
		}

		private string getNegativePercentage(float percentage)
		{
			return printAsRed((percentage * 100f).ToString()) + "%";
		}

		private string printSeconds(float seconds)
		{
			if (seconds < 1f)
			{
				return printAsBlue("second");
			}
			return printAsBlue(seconds + " seconds");
		}

		private string printAsGreen(string text)
		{
			return "<color=#2DD911>" + text + "</color>";
		}

		private string printAsRed(string text)
		{
			return "<color=#EF2E49>" + text + "</color>";
		}

		private string printAsBlue(string text)
		{
			return "<color=#2e49ef>" + text + "</color>";
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}