Decompiled source of KoreanPatch v1.0.4

MineKoreanPatchPtoKg.dll

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

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Mine9289.MineKoreanPatchPtoKg
{
	[BepInPlugin("com.mine9289.MineKoreanPatchPtoKg", "MineKoreanPatchPtoKg", "1.1.0")]
	public class MineKoreanPatchPtoKgPlugin : BaseUnityPlugin
	{
		public const string ModGuid = "com.mine9289.MineKoreanPatchPtoKg";

		public const string ModName = "MineKoreanPatchPtoKg";

		public const string ModVersion = "1.1.0";

		private readonly Harmony _harmony = new Harmony("com.mine9289.MineKoreanPatchPtoKg");

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"MineKoreanPatchPtoKg v1.1.0");
			_harmony.PatchAll();
		}
	}
}
namespace Mine9289.MineKoreanPatchPtoKg.Patches
{
	[HarmonyPatch(typeof(HUDManager))]
	public static class HUDManagerPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Update")]
		public static void ConvertWeightToKg(HUDManager __instance, TextMeshProUGUI ___weightCounter)
		{
			if (!((Object)(object)__instance == (Object)null) && !((Object)(object)___weightCounter == (Object)null))
			{
				PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController;
				if (!((Object)(object)val == (Object)null) && !val.isPlayerDead)
				{
					float num = Mathf.RoundToInt(Mathf.Clamp(val.carryWeight - 1f, 0f, 100f) * 105f * 0.453592f);
					((TMP_Text)___weightCounter).text = $"{num} kg";
				}
			}
		}
	}
}