Decompiled source of CCM DevAssistant v1.0.0

CCM-DevAssistant.dll

Decompiled 9 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using CCM_DevAssistant.Patches;
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("CCM-DevAssistant")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CCM-DevAssistant")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c70dc5c4-8a6a-47ba-9ae7-3506a78855fa")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CCM_DevAssistant
{
	[BepInPlugin("CptnsCompatibleMods.DevAssistant", "CCM-DevAssistant", "1.0.0")]
	public class DevAssistantMain : BaseUnityPlugin
	{
		public const string modGUID = "CptnsCompatibleMods.DevAssistant";

		public const string modName = "CCM-DevAssistant";

		public const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("CptnsCompatibleMods.DevAssistant");

		private static DevAssistantMain Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("CptnsCompatibleMods.DevAssistant");
			mls.LogInfo((object)"Loading CCM-DevAssistant");
			harmony.PatchAll(typeof(DevAssistantMain));
			harmony.PatchAll(typeof(StartMatchLeverPatch));
			mls.LogInfo((object)"Finished loading CCM-DevAssistant");
		}
	}
}
namespace CCM_DevAssistant.Patches
{
	[HarmonyPatch(typeof(StartMatchLever))]
	internal class StartMatchLeverPatch
	{
		private static ManualLogSource mls = Logger.CreateLogSource("CptnsCompatibleMods.DevAssistant");

		private static int creditsToStartWith = 10000;

		[HarmonyPatch("StartGame")]
		[HarmonyPostfix]
		private static void InfiniteStartingCredits(ref StartOfRound ___playersManager)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			int daysSpent = ___playersManager.gameStats.daysSpent;
			if (daysSpent <= 0)
			{
				mls.LogInfo((object)$"Setting starting credits to: {creditsToStartWith}");
				HUDManager val = (HUDManager)Object.FindObjectOfType(typeof(HUDManager));
				Terminal val2 = (Terminal)Object.FindObjectOfType(typeof(Terminal));
				val2.SyncGroupCreditsServerRpc(creditsToStartWith, val2.numberOfItemsInDropship);
				mls.LogInfo((object)$"New credits value: {val2.groupCredits}");
			}
		}
	}
}