Decompiled source of Multiple Rerolls v1.0.0

BepInEx/plugins/MultipleReroll.dll

Decompiled 20 hours 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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Obeliskial_Essentials;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MultipleReroll")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyInformationalVersion("1.0.3+8e198eb048ac4f1eabbcce20f0cac4e39d139aac")]
[assembly: AssemblyProduct("Multiple Rerolls")]
[assembly: AssemblyTitle("MultipleReroll")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.3.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 MultipleReroll
{
	[HarmonyPatch]
	public class RerollPatches
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(AtOManager), "IsTownRerollAvailable")]
		public static bool IsTownRerollAvailable(AtOManager __instance, ref bool __result)
		{
			Plugin.Log.LogDebug((object)"Binbin -- Attempting set Rerolls to 3");
			Plugin.Log.LogDebug((object)("Binbin -- Hopefully Logging Remaining Rerolls: " + __instance.HowManyTownRerolls()));
			bool value = Plugin.EnableMultipleReroll.Value;
			bool value2 = Plugin.LimitRerollsForLowMadness.Value;
			int num = Plugin.NumberOfRerolls.Value - 1;
			Plugin.Log.LogDebug((object)("Binbin -- n_rerolls: " + num));
			Plugin.Log.LogDebug((object)("Binbin -- n_rerolls: " + value2));
			Plugin.Log.LogDebug((object)("Binbin -- n_rerolls: " + value));
			if (value)
			{
				if (value2)
				{
					__result = !__instance.IsTownRerollLimited() || __instance.HowManyTownRerolls() <= num;
					return false;
				}
				__result = !__instance.IsTownRerollLimited() || __instance.HowManyTownRerolls() <= num;
				return false;
			}
			return true;
		}
	}
	[BepInPlugin("MultipleReroll", "Multiple Rerolls", "1.0.3")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInProcess("AcrossTheObelisk.exe")]
	public class Plugin : BaseUnityPlugin
	{
		internal const int ModDate = 20241002;

		private readonly Harmony harmony = new Harmony("MultipleReroll");

		internal static ManualLogSource Log;

		public static ConfigEntry<bool> EnableMultipleReroll { get; set; }

		public static ConfigEntry<bool> LimitRerollsForLowMadness { get; set; }

		public static ConfigEntry<int> NumberOfRerolls { get; set; }

		private void Awake()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_0047: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_0078: Expected O, but got Unknown
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Expected O, but got Unknown
			//IL_00a9: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"MultipleReroll 1.0.3 has loaded!");
			EnableMultipleReroll = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Debug", "Enable Multiple Rerolls"), true, new ConfigDescription("Enables the Multiple Reroll Mod. By default, only works for M3+", (AcceptableValueBase)null, Array.Empty<object>()));
			LimitRerollsForLowMadness = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Debug", "Limit Rerolls for Low Madness"), true, new ConfigDescription("Limits the rolls for low Madness (Below Base Madness 3)", (AcceptableValueBase)null, Array.Empty<object>()));
			NumberOfRerolls = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition("Debug", "Number of Rerolls"), 3, new ConfigDescription("Sets the number of rerolls. This will increase the number of rerolls for high madness and decrease it for low madnesss (if enabled).", (AcceptableValueBase)null, Array.Empty<object>()));
			Essentials.RegisterMod("Multiple Rerolls", "binbin", "Multiple Shop Rerolls", "1.0.3", 20241002, "https://github.com/binbinmods/multiplereroll", (string[])null, "", 100, (string[])null, "", true);
			harmony.PatchAll();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "MultipleReroll";

		public const string PLUGIN_NAME = "Multiple Rerolls";

		public const string PLUGIN_VERSION = "1.0.3";
	}
}