Decompiled source of Kilogrammes v1.0.0

BepInEx/plugins/Kilogrammes.dll

Decompiled a year ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Kilogrammes")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Kilogrammes")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("33caef0a-7dfb-4fe0-96a1-78b0195dbf15")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Kilogrammes;

public class Class1
{
}
[BepInPlugin("pandonut.lethalcompany.kilogrammes", "Kilogrammes", "1.0.0.0")]
public class Kilogrammes : BaseUnityPlugin
{
	public const string pluginGuid = "pandonut.lethalcompany.kilogrammes";

	public const string pluginName = "Kilogrammes";

	public const string pluginVersion = "1.0.0.0";

	public void Awake()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Expected O, but got Unknown
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading Kilogrammes");
		Harmony val = new Harmony("pandonut.lethalcompany.kilogrammes");
		MethodInfo methodInfo = AccessTools.Method(typeof(HUDManager), "Update", (Type[])null, (Type[])null);
		MethodInfo methodInfo2 = AccessTools.Method(typeof(Patches), "Update_Patch", (Type[])null, (Type[])null);
		val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
	}
}
public class Patches
{
	private static void Update_Patch(HUDManager __instance)
	{
		if (!GameNetworkManager.Instance.localPlayerController.isPlayerDead)
		{
			float num = Mathf.RoundToInt((float)Mathf.RoundToInt(Mathf.Clamp(GameNetworkManager.Instance.localPlayerController.carryWeight - 1f, 0f, 100f) * 105f) / 2.205f);
			((TMP_Text)__instance.weightCounter).text = $"{num} kg";
			__instance.weightCounterAnimator.SetFloat("weight", num / 130f);
		}
	}
}