Decompiled source of StoreDiv v1.0.0

StoreDiv.dll

Decompiled 8 months 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 Microsoft.CodeAnalysis;
using UnityEngine;
using Zorro.Core;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("StoreDiv")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Price Division Mod")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("StoreDiv")]
[assembly: AssemblyTitle("StoreDiv")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[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 StoreDiv
{
	[BepInPlugin("StoreDiv", "StoreDiv", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ConfigFile? StoreDivConfigFile;

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin StoreDiv is loaded!");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Config file is loaded!");
			StoreDivConfigFile = ((BaseUnityPlugin)this).Config;
			ConfigFile? storeDivConfigFile = StoreDivConfigFile;
			if (storeDivConfigFile != null)
			{
				storeDivConfigFile.Bind<int>("Settings", "PriceDivisionAmount", 2, "The division amount of the current prices.");
			}
			ItemDatabase instance = SingletonAsset<ItemDatabase>.Instance;
			Item[] objects = ((DatabaseAsset<ItemDatabase, Item>)(object)instance).Objects;
			foreach (Item val in objects)
			{
				if (val.purchasable)
				{
					int price = val.price;
					ConfigFile? storeDivConfigFile2 = StoreDivConfigFile;
					val.price = Mathf.RoundToInt((float)(price / ((storeDivConfigFile2 != null) ? new int?(storeDivConfigFile2.Bind<int>("Settings", "PriceDivisionAmount", 2, "The division amount of the current prices.").Value) : null).Value));
				}
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "StoreDiv";

		public const string PLUGIN_NAME = "StoreDiv";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}