Decompiled source of IsItWorth v1.0.1

plugins/jp.piyoryyta.IsItWorth.dll

Decompiled 20 hours 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 BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PerfectRandom.Sulfur.Core;
using PerfectRandom.Sulfur.Core.Items;
using PerfectRandom.Sulfur.Core.UI;
using PerfectRandom.Sulfur.Core.UI.ItemDescription;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("jp.piyoryyta.IsItWorth")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("IsItWorth")]
[assembly: AssemblyTitle("jp.piyoryyta.IsItWorth")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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 IsItWorth
{
	[BepInPlugin("jp.piyoryyta.IsItWorth", "IsItWorth", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		public static ConfigEntry<bool> ConfigShowBuyPrice;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin jp.piyoryyta.IsItWorth is loaded!");
			ConfigShowBuyPrice = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShowBuyPrice", false, "Show the buy price instead of the base price");
			Harmony.CreateAndPatchAll(typeof(ShowCosts), (string)null);
		}
	}
	[HarmonyPatch]
	internal class ShowCosts
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(ItemDescription), "AddPriceInfo")]
		private static void AddPriceInfoPostfix(ref ItemDescriptionAttribute ___price, InventoryItem item, ref int childIndex)
		{
			if ((item.itemDefinition.sellable || !item.OwnedByPlayer) && !StaticInstance<UIManager>.Instance.InventoryUI.InShopUI)
			{
				((Component)___price).gameObject.SetActive(true);
				((Component)___price).transform.SetSiblingIndex(childIndex);
				childIndex++;
				if (Plugin.ConfigShowBuyPrice.Value)
				{
					___price.SetValue("", item.PriceBuy.ToString(), "", false);
				}
				else
				{
					___price.SetValue("", item.PriceBase.ToString(), "", false);
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "jp.piyoryyta.IsItWorth";

		public const string PLUGIN_NAME = "IsItWorth";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}