Decompiled source of Shuffle Slowdown v1.0.0

BepInEx/plugins/com.binbin.ShuffleSlowdown.dll

Decompiled a day 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.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Obeliskial_Essentials;
using ShuffleSlowdown;
using UnityEngine;

[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("com.binbin.ShuffleSlowdown")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+dd0b227d36f72f0bc4d95b32ad13f69d63a35ab9")]
[assembly: AssemblyProduct("ShuffleSlowdown")]
[assembly: AssemblyTitle("com.binbin.ShuffleSlowdown")]
[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;
		}
	}
}
public static class EssentialsCompatibility
{
	private static bool? _enabled;

	public static bool Enabled
	{
		get
		{
			bool valueOrDefault = _enabled.GetValueOrDefault();
			if (!_enabled.HasValue)
			{
				valueOrDefault = Chainloader.PluginInfos.ContainsKey("com.stiffmeds.obeliskialessentials");
				_enabled = valueOrDefault;
			}
			return _enabled.Value;
		}
	}

	[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
	public static void EssentialsRegister()
	{
		Essentials.RegisterMod(Plugin.PluginName, "binbin", "Shuffle Slowdown", Plugin.PluginVersion, Plugin.ModDate, "https://github.com/binbinmods/ShuffleSlowdown", (string[])null, "", 100, (string[])null, "", true);
		Plugin.LogInfo(Plugin.PluginGUID + " " + Plugin.PluginVersion + " has loaded with Essentials!");
	}
}
namespace ShuffleSlowdown
{
	[HarmonyPatch]
	public class AntiCheat
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(SteamManager), "SetObeliskScore")]
		public static bool SetObeliskScorePrefix(ref SteamManager __instance, int score, bool singleplayer = true)
		{
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(SteamManager), "SetScore")]
		public static bool SetScorePrefix(ref SteamManager __instance, int score, bool singleplayer = true)
		{
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(SteamManager), "SetSingularityScore")]
		public static bool SetSingularityScorePrefix(ref SteamManager __instance, int score, bool singleplayer = true)
		{
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(SteamManager), "SetObeliskScoreLeaderboard")]
		public static bool SetObeliskScoreLeaderboardPrefix(ref SteamManager __instance, int score, bool singleplayer = true)
		{
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(SteamManager), "SetScoreLeaderboard")]
		public static bool SetScoreLeaderboardPrefix(ref SteamManager __instance, int score, bool singleplayer = true)
		{
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(SteamManager), "SetSingularityScoreLeaderboard")]
		public static bool SetSingularityScoreLeaderboardPrefix(ref SteamManager __instance, int score, bool singleplayer = true)
		{
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(SteamManager), "SetWeeklyScore")]
		public static bool SetWeeklyScorePrefix(ref SteamManager __instance, int score, int week, string nick, string nickgroup, bool singleplayer = true)
		{
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(SteamManager), "SetWeeklyScoreLeaderboard")]
		public static bool SetWeeklyScoreLeaderboardPrefix(ref SteamManager __instance, int score, int week, string nick, string nickgroup, bool singleplayer = true)
		{
			return false;
		}
	}
	[BepInPlugin("com.binbin.ShuffleSlowdown", "ShuffleSlowdown", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInProcess("AcrossTheObelisk.exe")]
	public class Plugin : BaseUnityPlugin
	{
		public static string PluginName;

		public static string PluginVersion;

		public static string PluginGUID;

		internal static int ModDate = int.Parse(DateTime.Today.ToString("yyyyMMdd"));

		private readonly Harmony harmony = new Harmony("com.binbin.ShuffleSlowdown");

		internal static ManualLogSource Log;

		public static string debugBase = "com.binbin.ShuffleSlowdown ";

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

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

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

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

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

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

		private void Awake()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0039: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_0066: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			//IL_0094: Expected O, but got Unknown
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			//IL_00c2: Expected O, but got Unknown
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Expected O, but got Unknown
			//IL_00ef: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			string text = "ShuffleSlowdown";
			EnableMod = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition(text, "EnableMod"), true, new ConfigDescription("Enables the mod. If false, the mod will not work then next time you load the game.", (AcceptableValueBase)null, Array.Empty<object>()));
			EnableDebugging = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition(text, "EnableDebugging"), false, new ConfigDescription("Enables the debugging", (AcceptableValueBase)null, Array.Empty<object>()));
			ModSpeed = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition(text, "ModSpeed"), 10, new ConfigDescription("Speed of the cardpack Shuffler. 10 is the default, 1 is the slowest. 100 is the fastest.", (AcceptableValueBase)null, Array.Empty<object>()));
			ModIterations = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition(text, "ModIterations"), 10, new ConfigDescription("Iterations of the cardpack Shuffler. 10 is the default, 1 is the fewest`. 100 is the most.", (AcceptableValueBase)null, Array.Empty<object>()));
			DisableShuffle = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition(text, "DisableShuffle"), false, new ConfigDescription("Disables the shuffling of the cardpack. Makes it so you should always win.", (AcceptableValueBase)null, Array.Empty<object>()));
			ModSpeed.Value = Mathf.Clamp(ModSpeed.Value, 1, 100);
			ModIterations.Value = Mathf.Clamp(ModIterations.Value, 1, 100);
			ModSpeed.SettingChanged += delegate
			{
				ModSpeed.Value = Mathf.Clamp(ModSpeed.Value, 1, 100);
			};
			ModIterations.SettingChanged += delegate
			{
				ModIterations.Value = Mathf.Clamp(ModIterations.Value, 1, 100);
			};
			PluginName = "ShuffleSlowdown";
			PluginVersion = "1.0.0";
			PluginGUID = "com.binbin.ShuffleSlowdown";
			if (EnableMod.Value)
			{
				EssentialsCompatibility.EssentialsRegister();
				harmony.PatchAll();
			}
		}

		internal static void LogDebug(string msg)
		{
			if (EnableDebugging.Value)
			{
				Log.LogDebug((object)(debugBase + msg));
			}
		}

		internal static void LogInfo(string msg)
		{
			Log.LogInfo((object)(debugBase + msg));
		}

		internal static void LogError(string msg)
		{
			Log.LogError((object)(debugBase + msg));
		}
	}
	public class ShuffleSlowdownFunctions
	{
	}
	[HarmonyPatch]
	public class ShuffleSlowdownPatches
	{
		public static bool devMode;

		public static bool bSelectingPerk;

		public static bool IsHost()
		{
			return GameManager.Instance.IsMultiplayer() && NetworkManager.Instance.IsMaster();
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(CardPlayerManager), "MoveCo")]
		public static void MoveCo(ref CardPlayerManager __instance)
		{
			CardPlayerPackData value = Traverse.Create((object)__instance).Field("_pack").GetValue<CardPlayerPackData>();
			value.ModSpeed = Plugin.ModSpeed.Value - 10;
			value.ModIterations = Plugin.ModIterations.Value - 10;
			if (Plugin.DisableShuffle.Value)
			{
				value.ModIterations = -100;
			}
			Traverse.Create((object)__instance).Field("_pack").SetValue((object)value);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "com.binbin.ShuffleSlowdown";

		public const string PLUGIN_NAME = "ShuffleSlowdown";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}