Decompiled source of Casual Options v0.3.0

BepInEx/plugins/com.binbin.CasualOptions.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
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 Cards;
using CasualOptions;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Obeliskial_Essentials;
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.CasualOptions")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.3.0.0")]
[assembly: AssemblyInformationalVersion("0.3.0+e1b75ca6968c627cc81edbcdd38416df38d4d8de")]
[assembly: AssemblyProduct("CasualOptions")]
[assembly: AssemblyTitle("com.binbin.CasualOptions")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.3.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 == true;
			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", "Casual Options", Plugin.PluginVersion, Plugin.ModDate, "https://github.com/binbinmods/GrindReducer", (string[])null, "", 100, (string[])null, "", true);
		Plugin.LogInfo(Plugin.PluginVersion + " has loaded with Essentials!");
	}
}
namespace CasualOptions
{
	[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;
		}
	}
	public class CasualOptionsFunctions
	{
		public enum Corruptors
		{
			ImpedingDoom,
			Decadence,
			RestrictedPower,
			ResistantMonsters,
			Equalizer,
			Poverty,
			OverchargedMonsters,
			RandomCombats,
			Despair
		}

		public static bool HasCorruptor(Corruptors corruptor)
		{
			return MadnessManager.Instance.IsMadnessTraitActive(corruptor.ToString().ToLower());
		}

		public static CombatTier GetNextCombatTier(CombatTier combatTier)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Expected I4, but got Unknown
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			int num = (int)combatTier;
			num++;
			num = Math.Min(num, 12);
			return (CombatTier)num;
		}

		public static bool IsLivingHero(Character character)
		{
			return character != null && character.IsHero && character.Alive;
		}
	}
	[HarmonyPatch]
	public class CasualOptionsPatches
	{
		public static bool devMode;

		public static int i;

		[HarmonyPrefix]
		[HarmonyPatch(typeof(CurrencyManager), "GivePlayer")]
		public static void GivePlayerPrefix(AtOManager __instance, CurrencyType type, ref int quantity, string to = "", string from = "", bool anim = true, bool save = false)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.EnableMod.Value)
			{
				return;
			}
			try
			{
				if (((int)type == 1 || (int)type == 0) && quantity >= 0 && Plugin.ResourceMultiplier.Value > 0)
				{
					Plugin.LogDebug($"GivePlayerPrefix - Multiplier: {Plugin.ResourceMultiplier.Value}, OG quantity: {quantity}, Final {Mathf.RoundToInt((float)Plugin.ResourceMultiplier.Value * 0.01f * (float)quantity)}", "GivePlayerPrefix");
					quantity = Mathf.RoundToInt((float)Plugin.ResourceMultiplier.Value * 0.01f * (float)quantity);
					if (quantity < 0)
					{
						quantity = 0;
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.LogError("Error: " + ex.Message, "GivePlayerPrefix");
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Character), "SetEvent")]
		public static void SetEventPostfix(ref Character __instance, EventActivation theEvent, Character target = null, int auxInt = 0, string auxString = "")
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.EnableMod.Value)
			{
				return;
			}
			try
			{
				int value = Plugin.BuffAmountToAdd.Value;
				string value2 = Plugin.BuffToAdd.Value;
				string value3 = Plugin.BuffWhenToAdd.Value;
				if (1 == 0)
				{
				}
				EventActivation val = (EventActivation)(value3 switch
				{
					"Combat Start" => 1, 
					"Every Turn" => 24, 
					"Every Round" => 2, 
					_ => 1, 
				});
				if (1 == 0)
				{
				}
				EventActivation val2 = val;
				if (theEvent == val2 && CasualOptionsFunctions.IsLivingHero(__instance))
				{
					Plugin.LogDebug("CasualOptions - SetEventPostfix", "SetEventPostfix");
					__instance.SetAuraCurse((Character)null, Globals.Instance.GetAuraCurseData(value2), value, false, (CardClass)11, false, true);
				}
			}
			catch (Exception ex)
			{
				Plugin.LogError("Error: " + ex.Message, "SetEventPostfix");
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Character), "AddCard")]
		public static bool AddCardPrefix(ref Character __instance, string originalCardName, int count = 1)
		{
			if (!Plugin.EnableMod.Value)
			{
				return true;
			}
			try
			{
				if (Plugin.NoDeathPenalty.Value && originalCardName.ToLower().StartsWith("deathsdoor"))
				{
					Plugin.LogDebug("No Death Penalty", "AddCardPrefix");
					return false;
				}
				return true;
			}
			catch (Exception ex)
			{
				Plugin.LogError("Error: " + ex.Message, "AddCardPrefix");
			}
			return true;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(SandboxManager), "GetSandboxMods")]
		public static void GetSandboxModsPostfix()
		{
			if (!Plugin.EnableMod.Value)
			{
				return;
			}
			try
			{
				if (Plugin.UnlimitedRerolls.Value)
				{
					Plugin.LogDebug("Unlimited free rerolls", "GetSandboxModsPostfix");
					SandboxManager.Instance.EnableSandbox();
					SandboxManager.Instance.FreeRerolls = true;
					SandboxManager.Instance.UnlimitedRerolls = true;
				}
			}
			catch (Exception ex)
			{
				Plugin.LogError("Error: " + ex.Message, "GetSandboxModsPostfix");
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Character), "GetEnergyTurn")]
		public static void GetEnergyTurnPost(ref Character __instance, ref int __result)
		{
			if (!Plugin.EnableMod.Value)
			{
				return;
			}
			try
			{
				if (Plugin.BonusEnergyPerTurn.Value > 0)
				{
					Plugin.LogDebug($"BonusEnergyPerTurn: {Plugin.BonusEnergyPerTurn.Value}", "GetEnergyTurnPost");
					__result += Plugin.BonusEnergyPerTurn.Value;
				}
			}
			catch (Exception ex)
			{
				Plugin.LogError("Error: " + ex.Message, "GetEnergyTurnPost");
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(AtOManager), "FinishCombat")]
		public static void FinishCombatPostFix(ref AtOManager __instance, bool resigned)
		{
			if (!Plugin.EnableMod.Value)
			{
				return;
			}
			try
			{
				Hero[] array = AtOManager.Instance.team.heroes.ToArray();
				for (int i = 0; i < 4; i++)
				{
					if (array[i] != null && (Object)(object)((Character)array[i]).HeroData != (Object)null)
					{
						object arg = Plugin.HPToGainPostCombat.Value;
						Hero obj = array[i];
						Plugin.LogDebug($"Adding {arg} HP to {((obj != null) ? ((Character)obj).SourceName : null)}", "FinishCombatPostFix");
						((Character)array[i]).ModifyMaxHP(Plugin.HPToGainPostCombat.Value);
						int num = Functions.FuncRoundToInt((float)(((Character)array[i]).Hp * Plugin.HPToGainPostCombat.Value) * 0.01f);
						((Character)array[i]).HpCurrent = Mathf.Clamp(((Character)array[i]).HpCurrent + num, 1, ((Character)array[i]).Hp);
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.LogError("Error: " + ex.Message, "FinishCombatPostFix");
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Item), "DoItemData")]
		public static void DoItemDataPrefix(ref Item __instance, Character target, string itemName, int auxInt, CardRealtimeData cardItem, string itemType, ItemData itemData, Character character, int order, CardRealtimeData castedCard = null, EventActivation theEvent = (EventActivation)0)
		{
			if (!Plugin.EnableMod.Value)
			{
				return;
			}
			try
			{
				if (Plugin.UnlimitedConsumables.Value)
				{
					itemData.DestroyAfterUse = false;
					itemData.DestroyAfterUses = 0;
					itemData.TimesPerCombat = 0;
					itemData.TimesPerTurn = 0;
				}
			}
			catch (Exception ex)
			{
				Plugin.LogError("Error: " + ex.Message, "DoItemDataPrefix");
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Character), "GrantExperience")]
		public static void GrantExperiencePrefix(ref Character __instance, ref int _experience)
		{
			if (!Plugin.EnableMod.Value)
			{
				return;
			}
			try
			{
				if (Plugin.ExpMultiplier.Value > 0)
				{
					Plugin.LogDebug($"GrantExperiencePrefix - Original XP: {_experience}, Multiplier: {(float)Plugin.ExpMultiplier.Value * 0.01f}", "GrantExperiencePrefix");
					_experience = Mathf.RoundToInt((float)Plugin.ExpMultiplier.Value * 0.01f * (float)_experience);
				}
			}
			catch (Exception ex)
			{
				Plugin.LogError("Error: " + ex.Message, "GrantExperiencePrefix");
			}
		}
	}
	[BepInPlugin("com.binbin.CasualOptions", "CasualOptions", "0.3.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.CasualOptions");

		internal static ManualLogSource Log;

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

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

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

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

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

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

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

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

		public static ConfigEntry<string> BuffToAdd { get; set; }

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

		public static ConfigEntry<string> BuffWhenToAdd { get; set; }

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

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

		public static ConfigEntry<int> PostCombatHeal { 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			//IL_0097: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			//IL_00c8: Expected O, but got Unknown
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Expected O, but got Unknown
			//IL_00f5: Expected O, but got Unknown
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Expected O, but got Unknown
			//IL_0122: Expected O, but got Unknown
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Expected O, but got Unknown
			//IL_0266: Expected O, but got Unknown
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Expected O, but got Unknown
			//IL_02a3: Expected O, but got Unknown
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Expected O, but got Unknown
			//IL_02d0: Expected O, but got Unknown
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Expected O, but got Unknown
			//IL_0325: Expected O, but got Unknown
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Expected O, but got Unknown
			//IL_0352: Expected O, but got Unknown
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Expected O, but got Unknown
			//IL_037f: Expected O, but got Unknown
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Expected O, but got Unknown
			//IL_03ad: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			string text = "CasualOptions";
			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>()));
			ResourceMultiplier = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition(text, "ResourceMultiplier"), 200, new ConfigDescription("Multiplier on Gold/Shards gained (in percent, so 200 will double exp gained). Does not appear visually.", (AcceptableValueBase)null, Array.Empty<object>()));
			ExpMultiplier = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition(text, "ExpMultiplier"), 200, new ConfigDescription("Multiplier on Experience gained (in percent, so 200 will double exp gained).", (AcceptableValueBase)null, Array.Empty<object>()));
			UnlimitedRerolls = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition(text, "UnlimitedRerolls"), true, new ConfigDescription("Enables Unlimited Rerolls in Towns", (AcceptableValueBase)null, Array.Empty<object>()));
			UnlimitedConsumables = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition(text, "UnlimitedConsumables"), true, new ConfigDescription("All Items can be activated an infinite number of times.", (AcceptableValueBase)null, Array.Empty<object>()));
			List<string> list = new List<string>(22)
			{
				"bless", "sharp", "inspire", "energize", "powerful", "fury", "fortify", "block", "shield", "fast",
				"mitigate", "regeneration", "reinforce", "spellsword", "stanzai", "stanzaii", "stanzaiii", "stealth", "taunt", "thorns",
				"vitality", "zeal"
			};
			list.Sort();
			BonusEnergyPerTurn = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition(text, "BonusEnergyPerTurn"), 1, new ConfigDescription("Bonus energy added each turn.", (AcceptableValueBase)null, Array.Empty<object>()));
			AcceptableValueList<string> val = new AcceptableValueList<string>(list.ToArray());
			BuffToAdd = ((BaseUnityPlugin)this).Config.Bind<string>(new ConfigDefinition(text, "BuffToAdd"), "bless", new ConfigDescription("Allows you to add a specific buff to all Heroes.", (AcceptableValueBase)(object)val, Array.Empty<object>()));
			BuffAmountToAdd = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition(text, "BuffAmountToAdd"), 5, new ConfigDescription("Amount of each buff to add.", (AcceptableValueBase)null, Array.Empty<object>()));
			AcceptableValueList<string> val2 = new AcceptableValueList<string>(new string[3] { "Combat Start", "Every Turn", "Every Round" });
			BuffWhenToAdd = ((BaseUnityPlugin)this).Config.Bind<string>(new ConfigDefinition(text, "BuffWhenToAdd"), "Combat Start", new ConfigDescription("Determines when you add the amount of the buff.", (AcceptableValueBase)(object)val2, Array.Empty<object>()));
			NoDeathPenalty = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition(text, "NoDeathPenalty"), true, new ConfigDescription("No longer gain Death's Door when a character dies.", (AcceptableValueBase)null, Array.Empty<object>()));
			HPToGainPostCombat = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition(text, "HPToGainPostCombat"), 2, new ConfigDescription("After every combat, all Heroes gain this much Max Health.", (AcceptableValueBase)null, Array.Empty<object>()));
			PostCombatHeal = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition(text, "PostCombatHealPercent"), 20, new ConfigDescription("After every combat, all Heroes will heal by this % of their Max HP.", (AcceptableValueBase)null, Array.Empty<object>()));
			EnableMod.SettingChanged += delegate
			{
				LogDebug($"EnableMod setting changed to {EnableMod.Value}", "Awake");
			};
			EnableDebugging.SettingChanged += delegate
			{
				LogDebug($"EnableDebugging setting changed to {EnableDebugging.Value}", "Awake");
			};
			ResourceMultiplier.SettingChanged += delegate
			{
				LogDebug($"ResourceMultiplier setting changed to {ResourceMultiplier.Value}", "Awake");
			};
			ExpMultiplier.SettingChanged += delegate
			{
				LogDebug($"ExpMultiplier setting changed to {ExpMultiplier.Value}", "Awake");
			};
			UnlimitedRerolls.SettingChanged += delegate
			{
				LogDebug($"UnlimitedRerolls setting changed to {UnlimitedRerolls.Value}", "Awake");
			};
			UnlimitedConsumables.SettingChanged += delegate
			{
				LogDebug($"UnlimitedConsumables setting changed to {UnlimitedConsumables.Value}", "Awake");
			};
			BonusEnergyPerTurn.SettingChanged += delegate
			{
				LogDebug($"BonusEnergyPerTurn setting changed to {BonusEnergyPerTurn.Value}", "Awake");
			};
			BuffToAdd.SettingChanged += delegate
			{
				LogDebug("BuffToAdd setting changed to " + BuffToAdd.Value, "Awake");
			};
			BuffAmountToAdd.SettingChanged += delegate
			{
				LogDebug($"BuffAmountToAdd setting changed to {BuffAmountToAdd.Value}", "Awake");
			};
			BuffWhenToAdd.SettingChanged += delegate
			{
				LogDebug("BuffWhenToAdd setting changed to " + BuffWhenToAdd.Value, "Awake");
			};
			NoDeathPenalty.SettingChanged += delegate
			{
				LogDebug($"NoDeathPenalty setting changed to {NoDeathPenalty.Value}", "Awake");
			};
			HPToGainPostCombat.SettingChanged += delegate
			{
				LogDebug($"HPToGainPostCombat setting changed to {HPToGainPostCombat.Value}", "Awake");
			};
			PostCombatHeal.SettingChanged += delegate
			{
				LogDebug($"PostCombatHeal setting changed to {PostCombatHeal.Value}", "Awake");
			};
			PluginName = "CasualOptions";
			PluginVersion = "0.3.0";
			PluginGUID = "com.binbin.CasualOptions";
			if (EnableMod.Value)
			{
				if (EssentialsCompatibility.Enabled)
				{
					EssentialsCompatibility.EssentialsRegister();
				}
				else
				{
					LogInfo(PluginGUID + " " + PluginVersion + " has loaded!");
				}
				harmony.PatchAll();
			}
		}

		internal static void LogDebug(string msg, [CallerMemberName] string caller = "")
		{
			if (EnableDebugging.Value)
			{
				Log.LogDebug((object)(debugBase + "- " + caller + " - " + msg));
			}
		}

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

		internal static void LogError(string msg, [CallerMemberName] string caller = "")
		{
			Log.LogError((object)(debugBase + "- " + caller + " - " + msg));
		}

		public static IEnumerator RunAfter(IEnumerator original, Action action)
		{
			while (original.MoveNext())
			{
				yield return original.Current;
			}
			action();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "com.binbin.CasualOptions";

		public const string PLUGIN_NAME = "CasualOptions";

		public const string PLUGIN_VERSION = "0.3.0";
	}
}