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 HarmonyLib;
using Microsoft.CodeAnalysis;
using TerminalApi;
using TerminalApi.Events;
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: AssemblyCompany("SoulWIthMae")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("3.0.0.1")]
[assembly: AssemblyInformationalVersion("1.0.0+5ecb0deca77ce3082f90381d9083ab1db0c422bc")]
[assembly: AssemblyProduct("CompanyExecutive")]
[assembly: AssemblyTitle("CompanyExecutive")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.0.0.1")]
[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 CompanyExecutive
{
[BepInPlugin("SoulWithMae.CompanyExecutive", "CompanyExecutive", "3.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public static ConfigEntry<bool> Enabled;
public static ConfigEntry<int> MoneyToGive;
public static ConfigEntry<bool> ConsistentGive;
public static ConfigEntry<bool> OverrideMoney;
private readonly Harmony _harmony = new Harmony("CompanyExecutive");
private void Awake()
{
Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "If the mod is enabled or not");
MoneyToGive = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MoneyToGive", 1000000, "The amount of money to give.");
ConsistentGive = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ConsistentGive", true, "Whether to give more money on each day or not.");
OverrideMoney = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "OverrideMoney", true, "Whether to override the starting money or just add to it.");
_harmony.PatchAll(typeof(TerminalPatch));
TerminalConfig.Init();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin CompanyExecutive is loaded!");
}
}
[HarmonyPatch(typeof(Terminal))]
internal class TerminalPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void Thingy(Terminal __instance, ref int ___groupCredits)
{
if (!GameNetworkManager.Instance.isHostingGame || !Plugin.Enabled.Value)
{
return;
}
if (!Plugin.ConsistentGive.Value)
{
if (TimeOfDay.Instance.daysUntilDeadline == 3 && TimeOfDay.Instance.profitQuota == 130)
{
if (Plugin.OverrideMoney.Value)
{
___groupCredits = Plugin.MoneyToGive.Value;
}
else
{
___groupCredits += Plugin.MoneyToGive.Value;
}
}
}
else if (Plugin.OverrideMoney.Value)
{
___groupCredits = Plugin.MoneyToGive.Value;
}
else
{
___groupCredits += Plugin.MoneyToGive.Value;
}
}
}
public static class TerminalConfig
{
[CompilerGenerated]
private static class <>O
{
public static TerminalParseSentenceEventHandler <0>__OnCommandSent;
}
public static void Init()
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Expected O, but got Unknown
TerminalApi.AddCommand("executive toggle", "Toggled pref.\n", (string)null, true);
TerminalApi.AddCommand("executive consistent", "Toggled pref.\n", (string)null, true);
TerminalApi.AddCommand("executive override", "Toggled pref.\n", (string)null, true);
TerminalApi.AddCommand("executive give", "Added money to account.\n", (string)null, true);
object obj = <>O.<0>__OnCommandSent;
if (obj == null)
{
TerminalParseSentenceEventHandler val = OnCommandSent;
<>O.<0>__OnCommandSent = val;
obj = (object)val;
}
Events.TerminalParsedSentence += (TerminalParseSentenceEventHandler)obj;
}
private static void OnCommandSent(object sender, TerminalParseSentenceEventArgs e)
{
Terminal val = Object.FindObjectOfType<Terminal>();
if (e.SubmittedText.Contains("executive toggle"))
{
Plugin.Enabled.Value = !Plugin.Enabled.Value;
}
if (e.SubmittedText.Contains("executive consistent"))
{
Plugin.ConsistentGive.Value = !Plugin.ConsistentGive.Value;
}
if (e.SubmittedText.Contains("executive override"))
{
Plugin.OverrideMoney.Value = !Plugin.OverrideMoney.Value;
}
if (e.SubmittedText.Contains("executive give") && GameNetworkManager.Instance.isHostingGame)
{
if (Plugin.OverrideMoney.Value)
{
val.groupCredits = Plugin.MoneyToGive.Value;
}
else
{
val.groupCredits += Plugin.MoneyToGive.Value;
}
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "CompanyExecutive";
public const string PLUGIN_NAME = "CompanyExecutive";
public const string PLUGIN_VERSION = "1.0.0";
}
}