Decompiled source of Kaching Cheat v1.0.3

Ka_ching_Cheat.dll

Decompiled 2 weeks ago
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.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using P1;
using P1.Bases;
using P2;
using P2.Bases;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Ka_ching_Cheat")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Ka-ching Cheat")]
[assembly: AssemblyTitle("Ka_ching_Cheat")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Ka_ching_Cheat
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Ka_ching_Cheat";

		public const string PLUGIN_NAME = "Ka-ching Cheat";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace Kaching_Cheat
{
	[BepInPlugin("com.melonthug.kachingcheat", "Ka-ching Cheat", "1.0.2")]
	public class Plugin : BasePlugin
	{
		public static Plugin Instance;

		public static ManualLogSource Logger;

		public static ConfigEntry<int> Kaching;

		public override void Load()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			Kaching = ((BasePlugin)this).Config.Bind<int>("Ka-ching Cheat", "Kaching", 0, "Set the amount of Kaching you would like to have here. Set to 0 to disable mod. Will automatically change to 0 after Ka-ching is successfully set to prevent constantly resetting.");
			Logger = ((BasePlugin)this).Log;
			Harmony val = new Harmony("com.melonthug.kachingcheat");
			val.PatchAll();
			Instance = this;
			Logger.LogInfo((object)"[Ka-ching Cheat] loaded");
		}
	}
	[HarmonyPatch(typeof(SaveDataManager), "P2LoadFromSlot")]
	internal class P2LoadFromSlotHook
	{
		private static void Postfix()
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			((BasePlugin)Plugin.Instance).Config.Reload();
			if (Plugin.Kaching.Value == 0)
			{
				return;
			}
			LaboCommon instance = LaboCommon.getInstance();
			if (instance == null)
			{
				return;
			}
			LaboGlobalData laboGlobalDataPtr_ = instance.laboGlobalDataPtr_;
			if (laboGlobalDataPtr_ == null)
			{
				return;
			}
			GlobalData basesData = laboGlobalDataPtr_.basesData;
			if (basesData != null)
			{
				uint energy = basesData.energy;
				basesData.energy = (uint)Plugin.Kaching.Value;
				ManualLogSource logger = Plugin.Logger;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(30, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("P2: Changed Ka-ching from ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(energy);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" -> ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(basesData.energy);
				}
				logger.LogInfo(val);
				Plugin.Kaching.Value = 0;
			}
		}
	}
	[HarmonyPatch(typeof(BasesScene), "initialize")]
	internal class initializeHook
	{
		private static void Prefix()
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			((BasePlugin)Plugin.Instance).Config.Reload();
			if (Plugin.Kaching.Value == 0)
			{
				return;
			}
			LaboCommon instance = LaboCommon.getInstance();
			if (instance == null)
			{
				return;
			}
			LaboGlobalData laboGlobalDataPtr_ = instance.laboGlobalDataPtr_;
			if (laboGlobalDataPtr_ == null)
			{
				return;
			}
			GlobalData basesData = laboGlobalDataPtr_.basesData;
			if (basesData != null)
			{
				uint energy = basesData.energy;
				basesData.energy = (uint)Plugin.Kaching.Value;
				ManualLogSource logger = Plugin.Logger;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(30, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("P1: Changed Ka-ching from ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(energy);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" -> ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(basesData.energy);
				}
				logger.LogInfo(val);
				Plugin.Kaching.Value = 0;
			}
		}
	}
}