Decompiled source of ValueOnHandMod v1.0.0

BepInEx/plugins/ValueOnHandMod.dll

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

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ValueOnHandMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ValueOnHandMod")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("647cc7b3-b8ab-4ccd-a1bb-4232b63e1853")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ValueOnHandMod;

[BepInPlugin("belea.ValueOnHand", "Value On Hand Mod", "1.0.0")]
public class PluginBase : BaseUnityPlugin
{
	private const string modGUID = "belea.ValueOnHand";

	private const string modName = "Value On Hand Mod";

	private const string modVersion = "1.0.0";

	private readonly Harmony harmony = new Harmony("belea.ValueOnHand");

	private static PluginBase Instance;

	internal ManualLogSource mls;

	private void Awake()
	{
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		mls = Logger.CreateLogSource("belea.ValueOnHand");
		harmony.PatchAll(typeof(PluginBase));
		mls.LogInfo((object)"The Value-On-Hand add-on has been installed...");
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(HUDManager), "ChangeControlTipMultiple")]
	public static void ChangeControlTipMultiplePatch(bool holdingItem, Item itemProperties, HUDManager __instance)
	{
		if (!holdingItem || !itemProperties.isScrap)
		{
			return;
		}
		PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
		GrabbableObject val = localPlayerController.ItemSlots[localPlayerController.currentItemSlot];
		string text = $"Value : ▮{val.scrapValue}";
		for (int i = 0; i < __instance.controlTipLines.Length; i++)
		{
			if (((TMP_Text)__instance.controlTipLines[i]).text == "" || ((TMP_Text)__instance.controlTipLines[i]).text.StartsWith("Value : "))
			{
				((TMP_Text)__instance.controlTipLines[i]).text = text;
				break;
			}
		}
	}
}