using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
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("CustomSellRate")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CustomSellRate")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("eb3d4025-008b-4f66-9268-ce3faffe1e1f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CustomSellRate;
[HarmonyPatch(typeof(TimeOfDay))]
internal class TimeOfDayPatch
{
[HarmonyPostfix]
[HarmonyPatch("SetBuyingRateForDay")]
private static void setBuyingRateForDayPatch()
{
if (ConfigSettings.EnableChanges.Value)
{
if (TimeOfDay.Instance.daysUntilDeadline != 0)
{
StartOfRound.Instance.companyBuyingRate = ConfigSettings.NormalSellRate.Value;
}
else
{
StartOfRound.Instance.companyBuyingRate = ConfigSettings.ZeroDaysSellRate.Value;
}
}
}
[HarmonyPostfix]
[HarmonyPatch("SetNewProfitQuota")]
private static void SetNewProfitQuotaPatch()
{
if (ConfigSettings.EnableChanges.Value)
{
if (TimeOfDay.Instance.daysUntilDeadline != 0)
{
StartOfRound.Instance.companyBuyingRate = ConfigSettings.NormalSellRate.Value;
}
else
{
StartOfRound.Instance.companyBuyingRate = ConfigSettings.ZeroDaysSellRate.Value;
}
}
}
}
[BepInPlugin("ZetaArcade.CustomSellRate", "CustomSellRate", "1.0.1")]
public class Plugin : BaseUnityPlugin
{
public static Plugin Instance;
private Harmony harmony = new Harmony("ZetaArcade.CustomSellRate");
private const string GUID = "ZetaArcade.CustomSellRate";
private const string NAME = "CustomSellRate";
private const string VERSION = "1.0.1";
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
ConfigSettings.BindConfigSettings();
harmony.PatchAll();
}
}
[Serializable]
public static class ConfigSettings
{
public static ConfigEntry<bool> EnableChanges;
public static ConfigEntry<float> NormalSellRate;
public static ConfigEntry<float> ZeroDaysSellRate;
public static void BindConfigSettings()
{
EnableChanges = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Sell Rate", "Enable Changes", true, "Whether to enable the following 2 configs for messing with the Sell Rate. Disable to let other mods/vanilla handle it");
NormalSellRate = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<float>("Sell Rate", "Normal Sell Rate", 0.5f, "The default sell rate for the Company when there are days remaining to the deadline, in the format of a float (1f = 100%)");
ZeroDaysSellRate = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<float>("Sell Rate", "0 Days Sell Rate", 1f, "The sell rate for the Company when there are 0 days remaining to the deadline, in the format of a float (1f = 100%)");
}
}