Decompiled source of MetricCompany v0.1.1

today.theladpack.MetricCompany.dll

Decompiled a year 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 HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("today.theladpack.MetricCompany")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Displays the weight of items on you in kilograms (kg) rather than pounds (lbs)")]
[assembly: AssemblyFileVersion("0.1.1.0")]
[assembly: AssemblyInformationalVersion("0.1.1+49cd6d7130f2779cd52c1b0d09f5caa94e8c3b6c")]
[assembly: AssemblyProduct("MetricCompany")]
[assembly: AssemblyTitle("today.theladpack.MetricCompany")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.1.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 MetricCompany
{
	[BepInPlugin("today.theladpack.MetricCompany", "MetricCompany", "0.1.1")]
	[BepInProcess("Lethal Company.exe")]
	public class MetricCompany : BaseUnityPlugin
	{
		[HarmonyPatch]
		private class HUDDrawHook
		{
			[HarmonyPatch(typeof(HUDManager), "Update")]
			[HarmonyPostfix]
			private static void ConvertLbsToKg(ref TextMeshProUGUI ___weightCounter, ref Animator ___weightCounterAnimator)
			{
				float num = Mathf.Clamp(GameNetworkManager.Instance.localPlayerController.carryWeight - 1f, 0f, 100f) * 105f / 2.205f;
				((TMP_Text)___weightCounter).text = $"{num:0.#}" + " kg";
				___weightCounterAnimator.SetFloat("weight", num / 130f);
			}
		}

		private Harmony harmony;

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			harmony = new Harmony("today.theladpack.MetricCompany");
			harmony.PatchAll(Assembly.GetExecutingAssembly());
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MetricCompany is loaded");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "today.theladpack.MetricCompany";

		public const string PLUGIN_NAME = "MetricCompany";

		public const string PLUGIN_VERSION = "0.1.1";
	}
}