Decompiled source of GambitConfig v0.1.0

plugins/yazirushi-GambitConfig/GambitConfig.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("HighBetGambit")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HighBetGambit")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5ea80a69-1e7f-435c-be76-ef53c298ec6d")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace GambitConfig;

[BepInPlugin("yazirushi.GambitConfig", "GambitConfig", "0.1.0")]
public class GambitConfig : BaseUnityPlugin
{
	private readonly Harmony harmony = new Harmony("yazirushi.GambitConfig");

	internal static ManualLogSource mls;

	public static ConfigEntry<int> Green_Value;

	public static ConfigEntry<int> Red_Value;

	public static ConfigEntry<int> Yellow_Value;

	public static ConfigEntry<int> Black_Value;

	public static ConfigEntry<bool> EnableLogging;

	private void Awake()
	{
		Green_Value = ((BaseUnityPlugin)this).Config.Bind<int>("Green", "Heal amount", 50, "---");
		Red_Value = ((BaseUnityPlugin)this).Config.Bind<int>("Red", "Damage amount", 100, "---");
		Yellow_Value = ((BaseUnityPlugin)this).Config.Bind<int>("Yellow", "Reward amount", 50000, "---");
		Black_Value = ((BaseUnityPlugin)this).Config.Bind<int>("Black", "Remaining health", 0, "---");
		EnableLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "EnableLogging", false, "---");
		mls = ((BaseUnityPlugin)this).Logger;
		mls.LogInfo((object)"\n\n ██▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▌       ▄▅▅▅▅▅▅▅▄      \n ██▌▐▀▀▀▀▀▀█▀▀▀▀▀█▀▀▀▀▀▀█▀▀▀▀▀█▀▀▀▀█▀▀▀▀▀▀▌▐     ▄█▀▒▒▒▒▒▓▓▀█▅▄   \n ███ ▌ ▅▅▅▅   ▅▅   ▅   ▅  ▅▅▅   ▅▅▅  ▅▅▅▅ ▐ ▌   ▐█░░░▒▒█▓▓▓▓▓▊▐▌  \n ███ ▌ █ ▅▅  █▅▅█  ██▅██  █▅▅▀   █    █   ▐ ▌   ██░░░░▐█▌░░░░█▅▌  \n ███ ▌ █▅▅█  █  █  █ █ █  █▅▅▀  ▅█▅   █   ▐ ▌  ▐▌█▓▓▓▓▓▒▒▒░░░██   \n ███ ▌ ▅▅▅▅  ▅▅▅▅  ▅   ▅  ▅▅▅▅  ▅▅▅  ▅▅▅▅ ▐ ▌  ▐▅██▄▓▓▒▒▒▒▒▄██▀   \n ███ ▌ █  ▀  █  █  █▀▅▄█  █▅▅    █   █ ▅▅ ▐ ▌   ▀▀██████████▀     \n ███ ▌ █▅▅█  █▅▅█  █  ▀█  █     ▅█▅  █▅▅█ ▐ ▌       ▀▀██▀▀        \n ██▌▐▄▄▄▄▄▄█▄▄▄▄▄█▄▄▄▄▄▄█▄▄▄▄▄█▄▄▄▄█▄▄▄▄▄▄▌▐     ▄▄▅▀▀██▀▀▅▄▄     \n ██▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▌    ▐▐▐▐▀ ██ ▀▌▌▌▌    \n █████████████████████████████████████████▌           ▌▐          \n");
		mls.LogInfo((object)"Starting GambitConfig...");
		harmony.PatchAll();
	}
}
[HarmonyPatch(typeof(EnemySpinny), "Update")]
public class ResultPatch
{
	[CompilerGenerated]
	private sealed class <Transpiler>d__0 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private CodeInstruction <>2__current;

		private int <>l__initialThreadId;

		private IEnumerable<CodeInstruction> instructions;

		public IEnumerable<CodeInstruction> <>3__instructions;

		private int <ldc_i4_1>5__1;

		private IEnumerator<CodeInstruction> <>s__2;

		private CodeInstruction <code>5__3;

		CodeInstruction IEnumerator<CodeInstruction>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <Transpiler>d__0(int <>1__state)
		{
			this.<>1__state = <>1__state;
			<>l__initialThreadId = Environment.CurrentManagedThreadId;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			int num = <>1__state;
			if (num == -3 || (uint)(num - 1) <= 3u)
			{
				try
				{
				}
				finally
				{
					<>m__Finally1();
				}
			}
			<>s__2 = null;
			<code>5__3 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Expected O, but got Unknown
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Expected O, but got Unknown
			try
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<ldc_i4_1>5__1 = 0;
					<>s__2 = instructions.GetEnumerator();
					<>1__state = -3;
					break;
				case 1:
					<>1__state = -3;
					GambitConfig.mls.LogInfo((object)"HighBetGambit: Green ok");
					break;
				case 2:
					<>1__state = -3;
					GambitConfig.mls.LogInfo((object)"HighBetGambit: Red ok");
					break;
				case 3:
					<>1__state = -3;
					GambitConfig.mls.LogInfo((object)"HighBetGambit: Black ok");
					break;
				case 4:
					<>1__state = -3;
					<code>5__3 = null;
					break;
				}
				if (<>s__2.MoveNext())
				{
					<code>5__3 = <>s__2.Current;
					if (<code>5__3.opcode == OpCodes.Ldc_I4_S && Convert.ToInt32(<code>5__3.operand) == 25)
					{
						<>2__current = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ResultPatch), "GreenValue", (Type[])null, (Type[])null));
						<>1__state = 1;
						return true;
					}
					if (<code>5__3.opcode == OpCodes.Ldc_I4_S && Convert.ToInt32(<code>5__3.operand) == 50)
					{
						<>2__current = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ResultPatch), "RedValue", (Type[])null, (Type[])null));
						<>1__state = 2;
						return true;
					}
					if (<code>5__3.opcode == OpCodes.Ldc_I4_1 || (<code>5__3.opcode == OpCodes.Ldc_I4 && Convert.ToInt32(<code>5__3.operand) == 1))
					{
						<ldc_i4_1>5__1++;
						if (<ldc_i4_1>5__1 == 6)
						{
							<>2__current = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ResultPatch), "BlackValue", (Type[])null, (Type[])null));
							<>1__state = 3;
							return true;
						}
					}
					<>2__current = <code>5__3;
					<>1__state = 4;
					return true;
				}
				<>m__Finally1();
				<>s__2 = null;
				return false;
			}
			catch
			{
				//try-fault
				((IDisposable)this).Dispose();
				throw;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		private void <>m__Finally1()
		{
			<>1__state = -1;
			if (<>s__2 != null)
			{
				<>s__2.Dispose();
			}
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}

		[DebuggerHidden]
		IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator()
		{
			<Transpiler>d__0 <Transpiler>d__;
			if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
			{
				<>1__state = 0;
				<Transpiler>d__ = this;
			}
			else
			{
				<Transpiler>d__ = new <Transpiler>d__0(0);
			}
			<Transpiler>d__.instructions = <>3__instructions;
			return <Transpiler>d__;
		}

		[DebuggerHidden]
		IEnumerator IEnumerable.GetEnumerator()
		{
			return ((IEnumerable<CodeInstruction>)this).GetEnumerator();
		}
	}

	[IteratorStateMachine(typeof(<Transpiler>d__0))]
	private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <Transpiler>d__0(-2)
		{
			<>3__instructions = instructions
		};
	}

	public static int GreenValue()
	{
		return GambitConfig.Green_Value.Value;
	}

	public static int RedValue()
	{
		return GambitConfig.Red_Value.Value;
	}

	public static int BlackValue()
	{
		return GambitConfig.Black_Value.Value;
	}
}
[HarmonyPatch(typeof(EnemySpinny), "SpawnMoneyBag")]
public class ResultPatch2
{
	[CompilerGenerated]
	private sealed class <Transpiler>d__0 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private CodeInstruction <>2__current;

		private int <>l__initialThreadId;

		private IEnumerable<CodeInstruction> instructions;

		public IEnumerable<CodeInstruction> <>3__instructions;

		private IEnumerator<CodeInstruction> <>s__1;

		private CodeInstruction <code>5__2;

		CodeInstruction IEnumerator<CodeInstruction>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <Transpiler>d__0(int <>1__state)
		{
			this.<>1__state = <>1__state;
			<>l__initialThreadId = Environment.CurrentManagedThreadId;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			int num = <>1__state;
			if (num == -3 || (uint)(num - 1) <= 1u)
			{
				try
				{
				}
				finally
				{
					<>m__Finally1();
				}
			}
			<>s__1 = null;
			<code>5__2 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Expected O, but got Unknown
			try
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>s__1 = instructions.GetEnumerator();
					<>1__state = -3;
					break;
				case 1:
					<>1__state = -3;
					GambitConfig.mls.LogInfo((object)"HighBetGambit: Yellow ok");
					break;
				case 2:
					<>1__state = -3;
					<code>5__2 = null;
					break;
				}
				if (<>s__1.MoveNext())
				{
					<code>5__2 = <>s__1.Current;
					if (<code>5__2.opcode == OpCodes.Ldc_I4 && Convert.ToInt32(<code>5__2.operand) == 5000)
					{
						<>2__current = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ResultPatch2), "YellowValue", (Type[])null, (Type[])null));
						<>1__state = 1;
						return true;
					}
					<>2__current = <code>5__2;
					<>1__state = 2;
					return true;
				}
				<>m__Finally1();
				<>s__1 = null;
				return false;
			}
			catch
			{
				//try-fault
				((IDisposable)this).Dispose();
				throw;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		private void <>m__Finally1()
		{
			<>1__state = -1;
			if (<>s__1 != null)
			{
				<>s__1.Dispose();
			}
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}

		[DebuggerHidden]
		IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator()
		{
			<Transpiler>d__0 <Transpiler>d__;
			if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
			{
				<>1__state = 0;
				<Transpiler>d__ = this;
			}
			else
			{
				<Transpiler>d__ = new <Transpiler>d__0(0);
			}
			<Transpiler>d__.instructions = <>3__instructions;
			return <Transpiler>d__;
		}

		[DebuggerHidden]
		IEnumerator IEnumerable.GetEnumerator()
		{
			return ((IEnumerable<CodeInstruction>)this).GetEnumerator();
		}
	}

	[IteratorStateMachine(typeof(<Transpiler>d__0))]
	private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <Transpiler>d__0(-2)
		{
			<>3__instructions = instructions
		};
	}

	public static int YellowValue()
	{
		return GambitConfig.Yellow_Value.Value;
	}
}