Decompiled source of YapYapInfMoney v1.2.0

plugins/YapYapInfMoney.dll

Decompiled 5 hours ago
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
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: AssemblyCompany("YapYapInfMoney")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("YapYapInfMoney")]
[assembly: AssemblyTitle("YapYapInfMoney")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 YapYapSimpleMod
{
	[BepInPlugin("com.playset.yapyap.infmoney", "Infinite Money", "1.0.0")]
	public class SimpleInfMoney : BaseUnityPlugin
	{
		private bool showGUI;

		private object gameManager;

		private FieldInfo goldField;

		private void Update()
		{
			if (Input.GetKeyDown((KeyCode)283))
			{
				showGUI = !showGUI;
			}
		}

		private void OnGUI()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (showGUI)
			{
				GUILayout.Window(1, new Rect(20f, 20f, 200f, 100f), new WindowFunction(DrawGUI), "Money Mod", Array.Empty<GUILayoutOption>());
			}
		}

		private void DrawGUI(int id)
		{
			if (GUILayout.Button("Add 100 Coins", Array.Empty<GUILayoutOption>()))
			{
				AddMoney(100);
			}
			if (GUILayout.Button("Add 1000 Coins", Array.Empty<GUILayoutOption>()))
			{
				AddMoney(1000);
			}
			GUI.DragWindow();
		}

		private void AddMoney(int amount)
		{
			if (gameManager == null)
			{
				FindGameManager();
			}
			if (gameManager != null && goldField != null)
			{
				int num = (int)goldField.GetValue(gameManager);
				goldField.SetValue(gameManager, num + amount);
			}
		}

		private void FindGameManager()
		{
			Type type = Assembly.Load("Assembly-CSharp").GetTypes().FirstOrDefault((Type t) => t.Name == "GameManager");
			if (type != null)
			{
				gameManager = Object.FindFirstObjectByType(type);
				goldField = type.GetField("gold", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			}
		}
	}
}