using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using QuotaSetting.Patches;
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("Funny")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Funny")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8ddda834-48b6-4333-baab-9779753a355c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace QuotaSetting
{
[BepInPlugin("Fred.QuotaSettings", "QuotaSettings", "1.0.5")]
public class ModBase : BaseUnityPlugin
{
private const string modGUID = "Fred.QuotaSettings";
private const string modName = "QuotaSettings";
private const string modVersion = "1.0.5";
private readonly Harmony harmony = new Harmony("Fred.QuotaSettings");
internal static ModBase Instance;
internal ConfigurationController ConfigManager;
internal ManualLogSource mls = Logger.CreateLogSource("Fred.QuotaSettings");
public static int startingCredits;
public static int startingQuota;
public static int quotaDeadline;
public static int baseQuotaIncrease;
public static int quotaCurveMultiplier;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
ConfigManager = new ConfigurationController(((BaseUnityPlugin)this).Config);
startingCredits = ConfigManager.StartingCredits;
startingQuota = ConfigManager.StartingQuota;
quotaDeadline = ConfigManager.QuotaDeadline;
baseQuotaIncrease = ConfigManager.BaseQuotaIncrease;
quotaCurveMultiplier = ConfigManager.QuotaCurveMultiplier;
Instance.mls.LogInfo((object)"Quota Settings is active!");
harmony.PatchAll(typeof(ModBase));
harmony.PatchAll(typeof(TimeOfDayPatch));
}
}
internal class ConfigurationController
{
private ConfigEntry<int> StartingCreditsCfg;
private ConfigEntry<int> StartingQuotaCfg;
private ConfigEntry<int> QuotaDeadlineCfg;
private ConfigEntry<int> BaseQuotaIncreaseCfg;
private ConfigEntry<int> QuotaCurveMultiplierCfg;
internal int StartingCredits
{
get
{
if (StartingCreditsCfg.Value < 0)
{
StartingCreditsCfg.Value = (int)((ConfigEntryBase)StartingCreditsCfg).DefaultValue;
}
return StartingCreditsCfg.Value;
}
set
{
StartingCreditsCfg.Value = value;
}
}
internal int StartingQuota
{
get
{
if (StartingQuotaCfg.Value < 0)
{
StartingQuotaCfg.Value = (int)((ConfigEntryBase)StartingQuotaCfg).DefaultValue;
}
return StartingQuotaCfg.Value;
}
set
{
StartingQuotaCfg.Value = value;
}
}
internal int QuotaDeadline
{
get
{
if (QuotaDeadlineCfg.Value < 0)
{
QuotaDeadlineCfg.Value = (int)((ConfigEntryBase)QuotaDeadlineCfg).DefaultValue;
}
return QuotaDeadlineCfg.Value;
}
set
{
QuotaDeadlineCfg.Value = value;
}
}
internal int BaseQuotaIncrease
{
get
{
if (BaseQuotaIncreaseCfg.Value < 0)
{
BaseQuotaIncreaseCfg.Value = (int)((ConfigEntryBase)BaseQuotaIncreaseCfg).DefaultValue;
}
return BaseQuotaIncreaseCfg.Value;
}
set
{
BaseQuotaIncreaseCfg.Value = value;
}
}
internal int QuotaCurveMultiplier
{
get
{
if (QuotaCurveMultiplierCfg.Value < 0)
{
QuotaCurveMultiplierCfg.Value = (int)((ConfigEntryBase)QuotaCurveMultiplierCfg).DefaultValue;
}
return QuotaCurveMultiplierCfg.Value;
}
set
{
QuotaCurveMultiplierCfg.Value = value;
}
}
public ConfigurationController(ConfigFile Config)
{
StartingCreditsCfg = Config.Bind<int>("General", "Starting Credits", 60, "The amount of credits you start with.");
StartingQuotaCfg = Config.Bind<int>("General", "Starting Quota", 130, "The first quota you need to reach.");
BaseQuotaIncreaseCfg = Config.Bind<int>("General", "Base Quota Increase", 200, "When you reach quota this is the base amount it goes up.");
QuotaDeadlineCfg = Config.Bind<int>("General", "Starting Deadline", 3, "How many days you have until you are forced to sell or...");
QuotaCurveMultiplierCfg = Config.Bind<int>("General", "Curve Multiplier", 1, "The higher the number, the larger the quota.");
}
}
}
namespace QuotaSetting.Patches
{
[HarmonyPatch(typeof(TimeOfDay))]
internal class TimeOfDayPatch
{
[HarmonyPatch("Awake")]
[HarmonyPostfix]
private static void AwakePatch(ref TimeOfDay __instance)
{
__instance.quotaVariables.startingCredits = ModBase.startingCredits;
__instance.quotaVariables.startingQuota = ModBase.startingQuota;
__instance.quotaVariables.deadlineDaysAmount = ModBase.quotaDeadline;
__instance.quotaVariables.baseIncrease = ModBase.baseQuotaIncrease;
}
}
}