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 EasyQuota.Patches;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("zeus1000.EasyQuota")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.3.0")]
[assembly: AssemblyInformationalVersion("1.1.3")]
[assembly: AssemblyProduct("EasyQuota")]
[assembly: AssemblyTitle("zeus1000.EasyQuota")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.3.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.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = 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 EasyQuota
{
[BepInPlugin("zeus1000.EasyQuota", "EasyQuota", "1.1.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("zeus1000.EasyQuota");
public ConfigEntry<bool> isModEnabled;
public ConfigEntry<float> quotaMultiplier;
public ConfigEntry<float> quotaIncrease;
public ConfigEntry<float> quotaSteepness;
public ConfigEntry<int> startingQuota;
public ConfigEntry<int> startingCredits;
public ConfigEntry<int> startingDays;
public static Plugin Instance { get; set; }
internal static ManualLogSource logger { get; set; }
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
logger = ((BaseUnityPlugin)this).Logger;
logger.LogDebug((object)"Loading Configs...");
LoadConfigs();
logger.LogDebug((object)"Configs loaded!");
if (!isModEnabled.Value)
{
logger.LogWarning((object)"EasyQuota is disabled. Please enable it back and restart the game to have access to it.");
return;
}
logger.LogDebug((object)"Patching Quota Settings...");
harmony.PatchAll(typeof(Plugin));
harmony.PatchAll(typeof(QuotaSettingsPatch));
logger.LogDebug((object)"Quota Settings successfully patched!");
logger.LogInfo((object)"EasyQuota successfully loaded! v1.1.3");
logger.LogDebug((object)"To use your custom quota settings, go into LethalConfig and modify the values.");
}
private void LoadConfigs()
{
isModEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Mod", "Is Mod Enabled", true, "Is the mod enabled? YOU WILL NEED TO RESTART THE GAME IF THE OPTION WAS DISABLED AT THE INITIAL LAUNCH AND YOU WANT TO USE EASYQUOTA.");
CreateBoxConfig(isModEnabled);
quotaMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Quota", "Multiplier", 1f, "Customize the quota randomizer multiplier (Determines the severity of the quota randomizer curve)");
CreateFloatSliderConfig(quotaMultiplier);
quotaIncrease = ((BaseUnityPlugin)this).Config.Bind<float>("Quota", "Increase", 200f, "Customize the quota base increase (The minimum amount to increase the quota)");
CreateFloatInputConfig(quotaIncrease);
quotaSteepness = ((BaseUnityPlugin)this).Config.Bind<float>("Quota", "Steepness", 4f, "Customize the quota steepness (Higher value means a less steep exponential increase of the quota)");
CreateFloatSliderConfig(quotaSteepness);
startingQuota = ((BaseUnityPlugin)this).Config.Bind<int>("Game", "Starting Quota", 130, "Customize the starting quota");
CreateIntConfig(startingQuota);
startingCredits = ((BaseUnityPlugin)this).Config.Bind<int>("Game", "Starting Credits", 60, "Customize the starting credits");
CreateIntConfig(startingCredits);
startingDays = ((BaseUnityPlugin)this).Config.Bind<int>("Game", "Starting Days", 4, "Customize the quota starting days");
CreateIntConfig(startingDays);
LethalConfigManager.SkipAutoGen();
}
private void CreateFloatSliderConfig(ConfigEntry<float> configEntry)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Expected O, but got Unknown
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected O, but got Unknown
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Expected O, but got Unknown
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Expected O, but got Unknown
FloatSliderOptions val = new FloatSliderOptions();
((BaseRangeOptions<float>)val).Min = 0f;
((BaseRangeOptions<float>)val).Max = 100f;
((BaseOptions)val).RequiresRestart = false;
FloatSliderConfigItem val2 = new FloatSliderConfigItem(configEntry, val);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
FloatSliderOptions val3 = new FloatSliderOptions();
((BaseRangeOptions<float>)val3).Min = 0f;
((BaseRangeOptions<float>)val3).Max = 100f;
((BaseOptions)val3).RequiresRestart = false;
FloatSliderConfigItem val4 = new FloatSliderConfigItem(configEntry, val3);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val4);
}
private void CreateBoxConfig(ConfigEntry<bool> configEntry)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
BoolCheckBoxConfigItem val = new BoolCheckBoxConfigItem(configEntry, new BoolCheckBoxOptions
{
Name = "Is Mod Enabled",
Description = "Is the mod enabled?",
RequiresRestart = false
});
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
}
private void CreateIntConfig(ConfigEntry<int> configEntry)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Expected O, but got Unknown
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Expected O, but got Unknown
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Expected O, but got Unknown
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Expected O, but got Unknown
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Expected O, but got Unknown
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
IntInputFieldOptions val = new IntInputFieldOptions();
((BaseRangeOptions<int>)val).Min = 0;
((BaseRangeOptions<int>)val).Max = 1000000;
((BaseOptions)val).RequiresRestart = false;
IntInputFieldConfigItem val2 = new IntInputFieldConfigItem(configEntry, val);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
IntInputFieldOptions val3 = new IntInputFieldOptions();
((BaseRangeOptions<int>)val3).Min = 0;
((BaseRangeOptions<int>)val3).Max = 1000000;
((BaseOptions)val3).RequiresRestart = false;
IntInputFieldConfigItem val4 = new IntInputFieldConfigItem(configEntry, val3);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val4);
IntInputFieldOptions val5 = new IntInputFieldOptions();
((BaseRangeOptions<int>)val5).Min = 0;
((BaseRangeOptions<int>)val5).Max = 1000000;
((BaseOptions)val5).RequiresRestart = false;
IntInputFieldConfigItem val6 = new IntInputFieldConfigItem(configEntry, val5);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val6);
}
private void CreateFloatInputConfig(ConfigEntry<float> configEntry)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
FloatInputFieldOptions val = new FloatInputFieldOptions();
((BaseRangeOptions<float>)val).Min = 0f;
((BaseRangeOptions<float>)val).Max = 1000f;
((BaseOptions)val).RequiresRestart = false;
FloatInputFieldConfigItem val2 = new FloatInputFieldConfigItem(configEntry, val);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "zeus1000.EasyQuota";
public const string PLUGIN_NAME = "EasyQuota";
public const string PLUGIN_VERSION = "1.1.3";
}
}
namespace EasyQuota.Patches
{
[HarmonyPatch(typeof(TimeOfDay))]
public class QuotaSettingsPatch
{
[HarmonyPatch("Awake")]
[HarmonyPrefix]
private static void QuotaPrefix(TimeOfDay __instance)
{
if (Plugin.Instance.isModEnabled.Value)
{
__instance.quotaVariables.randomizerMultiplier = Plugin.Instance.quotaMultiplier.Value;
Plugin.logger.LogDebug((object)"Successfully patched Quota Randomizer Multiplier Value");
__instance.quotaVariables.baseIncrease = Plugin.Instance.quotaIncrease.Value;
Plugin.logger.LogDebug((object)"Successfully patched Quota Base Increase Value");
__instance.quotaVariables.increaseSteepness = Plugin.Instance.quotaSteepness.Value;
Plugin.logger.LogDebug((object)"Successfully patched Quota Steepness Value");
__instance.quotaVariables.startingQuota = Plugin.Instance.startingQuota.Value;
Plugin.logger.LogDebug((object)"Successfully patched Starting Quota Value");
__instance.quotaVariables.startingCredits = Plugin.Instance.startingCredits.Value;
Plugin.logger.LogDebug((object)"Successfully patched Starting Credits Value");
__instance.quotaVariables.deadlineDaysAmount = Plugin.Instance.startingDays.Value;
Plugin.logger.LogDebug((object)"Successfully patched Deadline Days Amount");
}
else
{
Plugin.logger.LogDebug((object)".");
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}