using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
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("Kilograms")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Kilograms")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5F5ACB51-F9E6-4E85-B3A4-028FEE7B0650")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Kilograms
{
[BepInPlugin("Filigrani.Kilograms", "Kilograms", "1.0.0")]
public class TVLoaderExtendedPlugin : BaseUnityPlugin
{
private const string MyGUID = "Filigrani.Kilograms";
private const string PluginName = "Kilograms";
private const string VersionString = "1.0.0";
private static readonly Harmony Harmony = new Harmony("Filigrani.Kilograms");
public static ManualLogSource Log = new ManualLogSource("Kilograms");
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
Harmony.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: Kilograms, VersionString: 1.0.0");
}
}
}
namespace Kilograms.Patches
{
[HarmonyPatch(typeof(HUDManager))]
internal class KilogramsPatches
{
[HarmonyPostfix]
[HarmonyPatch("Update")]
public static void Update(HUDManager __instance)
{
if (!((Object)(object)GameNetworkManager.Instance == (Object)null) && !((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) && !((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) && !GameNetworkManager.Instance.localPlayerController.isPlayerDead)
{
float num = Mathf.Clamp(GameNetworkManager.Instance.localPlayerController.carryWeight - 1f, 0f, 100f) * 105f;
double num2 = num * 453.592f;
if (num2 < 1000.0)
{
((TMP_Text)__instance.weightCounter).text = Math.Round(num2 / 1000.0, 2) + " kg";
}
else
{
((TMP_Text)__instance.weightCounter).text = Math.Round(num2 / 1000.0, 1) + " kg";
}
}
}
}
}