Decompiled source of ErenshorQoL v2.2.26

ErenshorQoL.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
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("ErenshorQoL")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ffd7b68e34a4c7962fdd9ec1127961b89d70686f")]
[assembly: AssemblyProduct("ErenshorQoL")]
[assembly: AssemblyTitle("ErenshorQoL")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace ErenshorQoL
{
	[BepInPlugin("Brumdail.ErenshorQoLMod", "Erenshor Quality of Life Mods", "2.2.12.0000")]
	[BepInProcess("Erenshor.exe")]
	public class ErenshorQoLMod : BaseUnityPlugin
	{
		public enum Toggle
		{
			Off,
			On
		}

		internal class AcceptableShortcuts : AcceptableValueBase
		{
			public AcceptableShortcuts()
				: base(typeof(KeyboardShortcut))
			{
			}

			public override object Clamp(object value)
			{
				return value;
			}

			public override bool IsValid(object value)
			{
				return true;
			}

			public override string ToDescriptionString()
			{
				return "# Acceptable values: " + string.Join(", ", UnityInput.Current.SupportedKeyCodes);
			}
		}

		[HarmonyPatch(typeof(TypeText))]
		[HarmonyPatch("CheckCommands")]
		public class QoLCommands
		{
			private static void HelpMods()
			{
				if (QoLCommandsToggle.Value != 0)
				{
					UpdateSocialLog.LogAdd("QoL Modded commands: ", "lightblue");
					UpdateSocialLog.LogAdd("/bank - Opens the bank window", "lightblue");
					UpdateSocialLog.LogAdd("/forge - Opens the forge (blacksmithing) window", "lightblue");
					UpdateSocialLog.LogAdd("/auction - Opens the auction hall window", "lightblue");
					UpdateSocialLog.LogAdd("/allscenes - Lists all scenes", "lightblue");
					if (GuildInviteCommandToggle.Value == Toggle.On)
					{
						UpdateSocialLog.LogAdd("/guildinvite SimName - Invite a SimPlayer to your guild by name (alias: /ginvite)", "lightblue");
					}
				}
			}

			private static void HelpPlayer()
			{
				UpdateSocialLog.LogAdd("\nPlayers commands:", "yellow");
				UpdateSocialLog.LogAdd("/players - Get a list of players in zone", "yellow");
				UpdateSocialLog.LogAdd("/whisper PlayerName Msg - Send a private message", "yellow");
				UpdateSocialLog.LogAdd("/group - Send a message to your group (wait, attack, guard, etc)", "yellow");
				UpdateSocialLog.LogAdd("/dance - boogie down.", "yellow");
				UpdateSocialLog.LogAdd("/keyring - List held keys", "yellow");
				UpdateSocialLog.LogAdd("/showmap - Toggle the Map", "yellow");
				UpdateSocialLog.LogAdd("/ruleset - Display server modifiers", "yellow");
				UpdateSocialLog.LogAdd("/all players || /all pla - List all players in Erenshor", "yellow");
				UpdateSocialLog.LogAdd("/portsim SimName - Teleport specified SimPlayer to player", "yellow");
				UpdateSocialLog.LogAdd("/setname SimName - Rename targetted SimPlayer", "yellow");
				UpdateSocialLog.LogAdd("/shout - Message the entire zone", "yellow");
				UpdateSocialLog.LogAdd("/friend - Target SimPlayer is a FRIEND of this character. Their progress will be loosely tied to this character's progress.", "yellow");
				UpdateSocialLog.LogAdd("/time1 - Set Day/Night Cycle to normal speed. ");
				UpdateSocialLog.LogAdd("/time10, /time25, /time50 - Set TimeScale multiplier to 10x 25x or 50x speed.", "yellow");
				UpdateSocialLog.LogAdd("/time - See what time it is. ");
				UpdateSocialLog.LogAdd("/loc - Output player location X, Y, Z values", "yellow");
				UpdateSocialLog.LogAdd("Hotkeys:", "yellow");
				UpdateSocialLog.LogAdd("o - options", "yellow");
				UpdateSocialLog.LogAdd("i - inventory", "yellow");
				UpdateSocialLog.LogAdd("b - skills and spells book", "yellow");
				UpdateSocialLog.LogAdd("c - consider opponent", "yellow");
				UpdateSocialLog.LogAdd("h - greet your target", "yellow");
				UpdateSocialLog.LogAdd("q - autoattack toggle", "yellow");
				UpdateSocialLog.LogAdd("tab - cycle target", "yellow");
				UpdateSocialLog.LogAdd("spacebar - jump", "yellow");
				UpdateSocialLog.LogAdd("escape (hold) - exit to menu", "yellow");
			}

			private static void HelpGM()
			{
				if (QoLCommandsToggle.Value != 0)
				{
					UpdateSocialLog.LogAdd("\nGM commands: *not available in the demo build", "orange");
					UpdateSocialLog.LogAdd("/iamadev - Enable Dev Controls", "orange");
					UpdateSocialLog.LogAdd("/allitem - List all items", "orange");
					UpdateSocialLog.LogAdd("/item000, /item100, .../item 800  - List Items x00 through x99", "orange");
					UpdateSocialLog.LogAdd("/blessit - Bless item on mouse cursor", "orange");
					UpdateSocialLog.LogAdd("/additem 12 - (12: Cloth Sleeves) Add item to inventory; use /allitem or /item#00 to get item codes)", "orange");
					UpdateSocialLog.LogAdd("/cheater 35 (level 1-35) - OVERWRITE character level and load random level-appropriate equipment (CAUTION: Current character equipment and level will be overwritten!!)", "red");
					UpdateSocialLog.LogAdd("/loadset 35 (level 1-35) - Sets targetted SimPlayer to level and gear for level (CAUTION: Current character equipment and level will be overwritten!!)", "red");
					UpdateSocialLog.LogAdd("/bedazzl - Targetted SimPlayer gets equipment randomly upgraded to sparkly", "orange");
					UpdateSocialLog.LogAdd("/setnude - Targetted SimPlayer loses all equipment", "orange");
					UpdateSocialLog.LogAdd("/hpscale 1.0 (multiplier) - NPC HP scale modifier. You must zone to activate this modifier", "orange");
					UpdateSocialLog.LogAdd("/livenpc - List living NPCs in zone", "orange");
					UpdateSocialLog.LogAdd("/levelup - Maxes target's Earned XP", "orange");
					UpdateSocialLog.LogAdd("/level-- - Reduce target's level by 1", "orange");
					UpdateSocialLog.LogAdd("/simlocs - Report sim zone population", "orange");
					UpdateSocialLog.LogAdd("/sivakme - Add Sivakrux coin to inventory", "orange");
					UpdateSocialLog.LogAdd("/fastdev - Increases player RunSpeed to 24", "orange");
					UpdateSocialLog.LogAdd("/resists - Add 33 to all base resists", "orange");
					UpdateSocialLog.LogAdd("/raining - Changes atmosphere to raining", "orange");
					UpdateSocialLog.LogAdd("/thunder - Changes atmosphere to thunderstorm", "orange");
					UpdateSocialLog.LogAdd("/bluesky - Changes atmosphere to blue sky", "orange");
					UpdateSocialLog.LogAdd("/dosunny - Toggles sun", "orange");
					UpdateSocialLog.LogAdd("/cantdie - Target stays at max HP", "orange");
					UpdateSocialLog.LogAdd("/devkill - Kill current target", "orange");
					UpdateSocialLog.LogAdd("/killall - Kill all spawned NPCs", "orange");
					UpdateSocialLog.LogAdd("/add50xp - Add 50 xp to the player", "orange");
					UpdateSocialLog.LogAdd("/debugxp - Add 1000 xp to the player", "orange");
					UpdateSocialLog.LogAdd("/respec - Proficiency Points Reset", "orange");
					UpdateSocialLog.LogAdd("/specs - List targetted SimPlayer's proficiency points", "orange");
					UpdateSocialLog.LogAdd("/dospec - Targetted SimPlayer has proficiency points reset", "orange");
					UpdateSocialLog.LogAdd("/addphse - Applies Cave Lung debuff to the player", "red");
					UpdateSocialLog.LogAdd("/bombard - Applies a myriad of detrimental spells to the target.", "orange");
					UpdateSocialLog.LogAdd("/invisme - Toggle Dev Invis", "orange");
					UpdateSocialLog.LogAdd("/toscene Stowaway - Teleport to the named scene (may need to use Unstuck Me). Check scenes with /simlocs or use this list of Scenes: Stowaway, Tutorial, Abyssal, Azure, AzynthiClear, Blight, Bonepits, Brake, Braxonia, Braxonian, Duskenlight, Elderstone, FernallaField, Hidden, Krakengard, Loomingwood, Lost Cellar, Malaroth, PrielPlateau, Ripper, Rockshade, Rottenfoot, SaltedStrand, Silkengrass, Soluna, Underspine, Vitheo, VitheosEnd, Willowwatch, Windwashed", "orange");
					UpdateSocialLog.LogAdd("/invinci - Make player invincible", "orange");
					UpdateSocialLog.LogAdd("/faction 5 - Modify player's faction standing of the target's faction. Use negative numbers to decrease faction.", "orange");
				}
			}

			private static void HelpOther()
			{
				UpdateSocialLog.LogAdd("\nOther GM commands: *not available in the demo build", "orange");
				UpdateSocialLog.LogAdd("/viewgec - View the total global economy", "orange");
				UpdateSocialLog.LogAdd("/resetec - Rest the total global economy to 0", "orange");
				UpdateSocialLog.LogAdd("/stoprev - Set party to relaxed state or report who is in combat", "orange");
				UpdateSocialLog.LogAdd("/gamepad - Gamepad Control Enabled (experimental)", "orange");
				UpdateSocialLog.LogAdd("/control - Toggle between modern and standard controls", "orange");
				UpdateSocialLog.LogAdd("/steamid - Lists which AppID and build is running)", "orange");
				UpdateSocialLog.LogAdd("/gamerdr - NPC shouts about GamesRadar release date", "orange");
				UpdateSocialLog.LogAdd("/testnre - Causes a Null Reference Exception for testing", "orange");
				UpdateSocialLog.LogAdd("/force2h - Target SimPlayer forced to use two-handed weapon", "orange");
				UpdateSocialLog.LogAdd("/ascview - View target SimPlayer ascensions", "orange");
				UpdateSocialLog.LogAdd("/limit20, /limit30, /limit60 - Sets target frame rate", "orange");
				UpdateSocialLog.LogAdd("/preview - Enable Demonstration Mode (CAUTION: Save Files will be overwritten!!)", "red");
				UpdateSocialLog.LogAdd("/rocfest - Enable RocFest Demonstration Mode (CAUTION: Save Files will be overwritten!!)", "red");
				UpdateSocialLog.LogAdd("/saveloc - Output Save Data location", "orange");
				UpdateSocialLog.LogAdd("/droneme - Toggle Drone Mode for Camera (/droneme again to turn off)", "orange");
				UpdateSocialLog.LogAdd("/debugap - List NPCs attacking the player", "orange");
				UpdateSocialLog.LogAdd("/spychar - List information about the target", "orange");
				UpdateSocialLog.LogAdd("/spyloot - List loot information about the target", "orange");
				UpdateSocialLog.LogAdd("/nodechk - List Nodes in the current zone", "orange");
				UpdateSocialLog.LogAdd("/yousolo - Removes SimPlayer from group", "orange");
				UpdateSocialLog.LogAdd("/dismiss - Dismiss SimPlayer from group", "orange");
				UpdateSocialLog.LogAdd("/allgrps - List group data", "orange");
				UpdateSocialLog.LogAdd("/delachv - Clear Achievements", "red");
				UpdateSocialLog.LogAdd("/bkquest - Load Back Quest Achievements", "orange");
			}

			public static void DoHelp()
			{
				ErenshorQoLLogger.LogDebug((object)"QoLCommands.DoHelp() called");
				GameData.Misc.OpenCloseHelp();
				HelpOther();
				HelpGM();
				HelpPlayer();
				HelpMods();
				UpdateSocialLog.LogAdd("\nUse /help mods, /help gm, /help player, or /help other for the individual lists,", "orange");
			}

			public static void DoBank()
			{
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				ErenshorQoLLogger.LogDebug((object)$"DoBank called. QoLCommandsToggle.Value = {QoLCommandsToggle.Value}");
				if (QoLCommandsToggle.Value != 0)
				{
					if ((Object)(object)GameData.ItemOnCursor == (Object)null || (Object)(object)GameData.ItemOnCursor == (Object)(object)GameData.PlayerInv.Empty)
					{
						GameData.BankUI.OpenBank(((Component)GameData.PlayerControl).transform.position);
					}
					else
					{
						UpdateSocialLog.LogAdd("Remove item from cursor before interacting with the bank.", "yellow");
					}
				}
			}

			public static void DoAuction()
			{
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				if (QoLCommandsToggle.Value != 0)
				{
					if ((Object)(object)GameData.ItemOnCursor == (Object)null || (Object)(object)GameData.ItemOnCursor == (Object)(object)GameData.PlayerInv.Empty)
					{
						GameData.AHUI.OpenAuctionHouse(((Component)GameData.PlayerControl).transform.position);
					}
					else
					{
						UpdateSocialLog.LogAdd("Remove item from cursor before interacting with the auction house.", "yellow");
					}
				}
			}

			public static void DoForge()
			{
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				if (QoLCommandsToggle.Value != 0)
				{
					if ((Object)(object)GameData.ItemOnCursor == (Object)null || (Object)(object)GameData.ItemOnCursor == (Object)(object)GameData.PlayerInv.Empty)
					{
						GameData.PlayerAud.PlayOneShot(GameData.Misc.SmithingOpen, GameData.PlayerAud.volume * GameData.SFXVol);
						GameData.Smithing.OpenWindow(((Component)GameData.PlayerControl).transform.position);
					}
					else
					{
						UpdateSocialLog.LogAdd("Remove item from cursor before interacting with the forge.", "yellow");
					}
				}
			}

			public static void DoGuildInvite(string targetName)
			{
				if (GuildInviteCommandToggle.Value == Toggle.Off)
				{
					return;
				}
				if (string.IsNullOrEmpty(targetName))
				{
					UpdateSocialLog.LogAdd("Usage: /guildinvite SimPlayerName", "yellow");
					return;
				}
				if (string.IsNullOrEmpty(GameData.PlayerControl.MyGuild))
				{
					UpdateSocialLog.LogAdd("You're not currently in a guild.", "yellow");
					return;
				}
				LiveGuildData guildDataByID = GameData.GuildManager.GetGuildDataByID(GameData.PlayerControl.MyGuild);
				if (guildDataByID == null)
				{
					UpdateSocialLog.LogAdd("Could not find your guild data.", "yellow");
					return;
				}
				if (!guildDataByID.PlayerIsGuildLeader)
				{
					UpdateSocialLog.LogAdd("You must be a guild leader to invite players.", "yellow");
					return;
				}
				SimPlayerTracking val = null;
				foreach (SimPlayerTracking sim in GameData.SimMngr.Sims)
				{
					if (sim.SimName.Equals(targetName, StringComparison.OrdinalIgnoreCase))
					{
						val = sim;
						break;
					}
				}
				if (val == null)
				{
					UpdateSocialLog.LogAdd("Could not find a player named '" + targetName + "'.", "yellow");
					return;
				}
				UpdateSocialLog.LogAdd("Guild invite sent to " + val.SimName + "...", "yellow");
				GameData.PlayerAud.PlayOneShot(GameData.Misc.Click, GameData.SFXVol);
				GameData.GuildManager.SendSimPlayerGuildInvite(val, guildDataByID);
			}

			public static void DoAllScenes()
			{
				if (QoLCommandsToggle.Value != 0)
				{
					StringBuilder stringBuilder = new StringBuilder("Stowaway, Tutorial");
					ZoneAtlasEntry[] atlas = ZoneAtlas.Atlas;
					foreach (ZoneAtlasEntry val in atlas)
					{
						stringBuilder.Append(", " + val.ZoneName);
					}
					string text = stringBuilder.ToString();
					UpdateSocialLog.LogAdd("Zone Names: " + text);
				}
			}

			public static bool Prefix(TypeText __instance)
			{
				string text = __instance.typed.text;
				if (string.IsNullOrEmpty(text))
				{
					return true;
				}
				if (text.StartsWith("/"))
				{
					string[] array = text.Substring(1).Split(' ');
					string text2 = array[0].ToLower();
					string text3 = ((array.Length > 1) ? array[1].ToLower() : string.Empty);
					switch (text2)
					{
					case "bank":
						DoBank();
						return false;
					case "forge":
						DoForge();
						return false;
					case "auction":
						DoAuction();
						return false;
					case "allscenes":
						DoAllScenes();
						return false;
					case "ginvite":
					case "guildinvite":
						DoGuildInvite((array.Length > 1) ? text.Substring(text.IndexOf(' ') + 1).Trim() : string.Empty);
						return false;
					case "help":
						switch (text3)
						{
						case "player":
							HelpPlayer();
							break;
						case "other":
							HelpOther();
							break;
						case "mods":
							HelpMods();
							break;
						case "gm":
							HelpGM();
							break;
						default:
							ErenshorQoLLogger.LogDebug((object)"QoLCommands.DoHelp() called");
							DoHelp();
							break;
						}
						return false;
					}
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(AuctionHouseUI))]
		[HarmonyPatch("OpenListItem")]
		public class AutoPriceYourItem
		{
			private static void Postfix(AuctionHouseUI __instance)
			{
				if (AutoPriceItem.Value == Toggle.On)
				{
					int num = 0;
					num = GameData.SlotToBeListed.MyItem.ItemValue * 6 - 1;
					GameData.AHUI.ListPrice.text = $"{num}";
				}
			}
		}

		internal const string ModName = "ErenshorQoLMod";

		internal const string ModVersion = "2.2.12.0000";

		internal const string ModTitle = "Erenshor Quality of Life Mods";

		internal const string ModDescription = "Erenshor Quality of Life Mods";

		internal const string Author = "Brumdail";

		private const string ModGUID = "Brumdail.ErenshorQoLMod";

		private static string ConfigFileName = "Brumdail.ErenshorQoLMod.cfg";

		private static string ConfigFileFullPath = Paths.ConfigPath + Path.DirectorySeparatorChar + ConfigFileName;

		private FileSystemWatcher? watcher;

		internal static ErenshorQoLMod context = null;

		private readonly Harmony harmony = new Harmony("Brumdail.ErenshorQoLMod");

		public static readonly ManualLogSource ErenshorQoLLogger = Logger.CreateLogSource("ErenshorQoLMod");

		internal static ConfigEntry<Toggle> AutoLootToggle = null;

		internal static ConfigEntry<Toggle> AutoLootDebug = null;

		internal static ConfigEntry<float> AutoLootDistance = null;

		internal static ConfigEntry<int> AutoLootMinimum = null;

		internal static ConfigEntry<Toggle> QoLCommandsToggle = null;

		internal static ConfigEntry<KeyboardShortcut> QoLBankKey = null;

		internal static ConfigEntry<KeyboardShortcut> QoLAuctionKey = null;

		internal static ConfigEntry<KeyboardShortcut> QoLForgeKey = null;

		internal static ConfigEntry<Toggle> AutoAttackToggle = null;

		internal static ConfigEntry<Toggle> AutoAttackOnSkillToggle = null;

		internal static ConfigEntry<Toggle> AutoAttackOnAggro = null;

		internal static ConfigEntry<Toggle> AutoPetToggle = null;

		internal static ConfigEntry<Toggle> AutoPetOnSkillToggle = null;

		internal static ConfigEntry<Toggle> AutoPetOnAggro = null;

		internal static ConfigEntry<Toggle> AutoPetOnAutoAttackToggle = null;

		internal static ConfigEntry<Toggle> AutoPriceItem = null;

		internal static ConfigEntry<Toggle> GuildInviteCommandToggle = null;

		internal static ConfigEntry<int> ConfigCleanup = null;

		internal static bool _configApplied;

		private void Awake()
		{
			context = this;
			Utilities.GenerateConfigs();
			harmony.PatchAll();
			SetupWatcher();
		}

		private void OnDestroy()
		{
			((BaseUnityPlugin)this).Config.Save();
		}

		private void Update()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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)
			KeyboardShortcut value = QoLBankKey.Value;
			if (((KeyboardShortcut)(ref value)).IsDown())
			{
				ErenshorQoLLogger.LogDebug((object)"QoLCommands.DoBank() called");
				QoLCommands.DoBank();
				return;
			}
			value = QoLAuctionKey.Value;
			if (((KeyboardShortcut)(ref value)).IsDown())
			{
				ErenshorQoLLogger.LogDebug((object)"QoLCommands.DoAuction() called");
				QoLCommands.DoAuction();
				return;
			}
			value = QoLForgeKey.Value;
			if (((KeyboardShortcut)(ref value)).IsDown())
			{
				ErenshorQoLLogger.LogDebug((object)"QoLCommands.DoForge() called");
				QoLCommands.DoForge();
			}
		}

		private void SetupWatcher()
		{
			FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, ConfigFileName);
			fileSystemWatcher.Changed += ReadConfigValues;
			fileSystemWatcher.Created += ReadConfigValues;
			fileSystemWatcher.Renamed += ReadConfigValues;
			fileSystemWatcher.IncludeSubdirectories = true;
			fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject;
			fileSystemWatcher.EnableRaisingEvents = true;
		}

		private void ReadConfigValues(object sender, FileSystemEventArgs e)
		{
			if (!File.Exists(ConfigFileFullPath))
			{
				return;
			}
			try
			{
				ErenshorQoLLogger.LogDebug((object)"ReadConfigValues called");
				((BaseUnityPlugin)this).Config.Reload();
				((BaseUnityPlugin)this).Config.SaveOnConfigSet = true;
			}
			catch
			{
				ErenshorQoLLogger.LogError((object)("There was an issue loading your " + ConfigFileName));
				ErenshorQoLLogger.LogError((object)"Please check your config entries for spelling and format!");
			}
		}

		internal ConfigEntry<T> config<T>(string group, string name, T value, ConfigDescription description)
		{
			return ((BaseUnityPlugin)this).Config.Bind<T>(group, name, value, description);
		}

		internal ConfigEntry<T> config<T>(string group, string name, T value, string description)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			return ((BaseUnityPlugin)this).Config.Bind<T>(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()));
		}
	}
	public class Utilities
	{
		public static readonly ManualLogSource ErenshorUtilitiesLogger = Logger.CreateLogSource("ErenshorQoLUtilities");

		internal static void ApplyConfig()
		{
			ErenshorQoLMod._configApplied = true;
		}

		internal static void GenerateConfigs()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_0074: 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_0092: Expected O, but got Unknown
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Expected O, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Expected O, but got Unknown
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Expected O, but got Unknown
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Expected O, but got Unknown
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Expected O, but got Unknown
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Expected O, but got Unknown
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Expected O, but got Unknown
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Expected O, but got Unknown
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Expected O, but got Unknown
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Expected O, but got Unknown
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Expected O, but got Unknown
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Expected O, but got Unknown
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Expected O, but got Unknown
			ErenshorQoLMod.QoLCommandsToggle = ErenshorQoLMod.context.config("2 - QoL Commands", "Enable QoL Commands", ErenshorQoLMod.Toggle.On, "Enable additional Quality of Life commands like /bank, /auction, updated /help etc.");
			ErenshorQoLMod.QoLBankKey = ErenshorQoLMod.context.config<KeyboardShortcut>("2 - QoL Commands", "Bank Key", new KeyboardShortcut((KeyCode)290, Array.Empty<KeyCode>()), new ConfigDescription("Key(s) used to open the Bank window. Use https://docs.unity3d.com/Manual/ConventionalGameInput.html", (AcceptableValueBase)(object)new ErenshorQoLMod.AcceptableShortcuts(), Array.Empty<object>()));
			ErenshorQoLMod.QoLAuctionKey = ErenshorQoLMod.context.config<KeyboardShortcut>("2 - QoL Commands", "Auction Key", new KeyboardShortcut((KeyCode)291, Array.Empty<KeyCode>()), new ConfigDescription("Key(s) used to open the Auction House window. Use https://docs.unity3d.com/Manual/ConventionalGameInput.html", (AcceptableValueBase)(object)new ErenshorQoLMod.AcceptableShortcuts(), Array.Empty<object>()));
			ErenshorQoLMod.QoLForgeKey = ErenshorQoLMod.context.config<KeyboardShortcut>("2 - QoL Commands", "Forge Key", new KeyboardShortcut((KeyCode)291, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), new ConfigDescription("Key(s) used to open the Forge window. Use https://docs.unity3d.com/Manual/ConventionalGameInput.html", (AcceptableValueBase)(object)new ErenshorQoLMod.AcceptableShortcuts(), Array.Empty<object>()));
			ErenshorQoLMod.AutoPriceItem = ErenshorQoLMod.context.config("6 - Auto Price Item", "Auto Set AH Item Price", ErenshorQoLMod.Toggle.On, "Automatically start with the highest sellable auction house price when adding an item.");
			ErenshorQoLMod.GuildInviteCommandToggle = ErenshorQoLMod.context.config("2 - QoL Commands", "Enable Guild Invite Command", ErenshorQoLMod.Toggle.On, "Enable /guildinvite and /ginvite commands to invite SimPlayers to your guild by name.");
			ErenshorQoLMod.ConfigCleanup = ErenshorQoLMod.context.config("Utility", "ConfigCleanup", 0, "Tracks cleanup of obsolete config settings and can be ignored.");
			if (ErenshorQoLMod.ConfigCleanup.Value < 1)
			{
				ConfigDefinition val = new ConfigDefinition("1 - AutoLoot", "Enable AutoLoot");
				ConfigDefinition val2 = new ConfigDefinition("1 - AutoLoot", "Auto Loot Distance");
				ConfigDefinition val3 = new ConfigDefinition("1 - AutoLoot", "Auto Loot Minimum Threshold");
				ConfigDefinition val4 = new ConfigDefinition("1 - AutoLoot", "AutoLoot Debug Messages");
				ConfigDefinition val5 = new ConfigDefinition("1 - AutoLoot", "Enable AutoLooting into the Bank");
				ConfigDefinition val6 = new ConfigDefinition("3 - Auto Attack", "Enable Auto Attack");
				ConfigDefinition val7 = new ConfigDefinition("3 - Auto Attack", "Auto Attack on Skill Use");
				ConfigDefinition val8 = new ConfigDefinition("3 - Auto Attack", "Auto Target,Attack on Aggro");
				ConfigDefinition val9 = new ConfigDefinition("4 - Auto Pet", "Enable Auto Pet Command");
				ConfigDefinition val10 = new ConfigDefinition("4 - Auto Pet", "Auto Pet Command on Skill Use");
				ConfigDefinition val11 = new ConfigDefinition("4 - Auto Pet", "Auto Pet Command on Skill Use");
				ConfigDefinition val12 = new ConfigDefinition("4 - Auto Pet", "Auto Pet Command on Auto Attack");
				if (((BaseUnityPlugin)ErenshorQoLMod.context).Config.ContainsKey(val))
				{
					((BaseUnityPlugin)ErenshorQoLMod.context).Config.Remove(val);
					ErenshorUtilitiesLogger.LogInfo((object)"Removed obsolete setting: 'Enable AutoLoot'");
				}
				if (((BaseUnityPlugin)ErenshorQoLMod.context).Config.ContainsKey(val2))
				{
					((BaseUnityPlugin)ErenshorQoLMod.context).Config.Remove(val2);
					ErenshorUtilitiesLogger.LogInfo((object)"Removed obsolete setting: 'Auto Loot Distance'");
				}
				if (((BaseUnityPlugin)ErenshorQoLMod.context).Config.ContainsKey(val3))
				{
					((BaseUnityPlugin)ErenshorQoLMod.context).Config.Remove(val3);
					ErenshorUtilitiesLogger.LogInfo((object)"Removed obsolete setting: 'Auto Loot Minimum Threshold'");
				}
				if (((BaseUnityPlugin)ErenshorQoLMod.context).Config.ContainsKey(val4))
				{
					((BaseUnityPlugin)ErenshorQoLMod.context).Config.Remove(val4);
					ErenshorUtilitiesLogger.LogInfo((object)"Removed obsolete setting: 'AutoLoot Debug Messages'");
				}
				if (((BaseUnityPlugin)ErenshorQoLMod.context).Config.ContainsKey(val5))
				{
					((BaseUnityPlugin)ErenshorQoLMod.context).Config.Remove(val5);
					ErenshorUtilitiesLogger.LogInfo((object)"Removed obsolete setting: 'Enable AutoLooting into the Bank'");
				}
				if (((BaseUnityPlugin)ErenshorQoLMod.context).Config.ContainsKey(val6))
				{
					((BaseUnityPlugin)ErenshorQoLMod.context).Config.Remove(val6);
					ErenshorUtilitiesLogger.LogInfo((object)"Removed obsolete setting: 'Enable Auto Attack'");
				}
				if (((BaseUnityPlugin)ErenshorQoLMod.context).Config.ContainsKey(val7))
				{
					((BaseUnityPlugin)ErenshorQoLMod.context).Config.Remove(val7);
					ErenshorUtilitiesLogger.LogInfo((object)"Removed obsolete setting: 'Auto Attack on Skill Use'");
				}
				if (((BaseUnityPlugin)ErenshorQoLMod.context).Config.ContainsKey(val8))
				{
					((BaseUnityPlugin)ErenshorQoLMod.context).Config.Remove(val8);
					ErenshorUtilitiesLogger.LogInfo((object)"Removed obsolete setting: 'Auto Target,Attack on Aggro'");
				}
				if (((BaseUnityPlugin)ErenshorQoLMod.context).Config.ContainsKey(val9))
				{
					((BaseUnityPlugin)ErenshorQoLMod.context).Config.Remove(val9);
					ErenshorUtilitiesLogger.LogInfo((object)"Removed obsolete setting: 'Enable Auto Pet Command'");
				}
				if (((BaseUnityPlugin)ErenshorQoLMod.context).Config.ContainsKey(val10))
				{
					((BaseUnityPlugin)ErenshorQoLMod.context).Config.Remove(val10);
					ErenshorUtilitiesLogger.LogInfo((object)"Removed obsolete setting: 'Auto Pet Command on Skill Use'");
				}
				if (((BaseUnityPlugin)ErenshorQoLMod.context).Config.ContainsKey(val11))
				{
					((BaseUnityPlugin)ErenshorQoLMod.context).Config.Remove(val11);
					ErenshorUtilitiesLogger.LogInfo((object)"Removed obsolete setting: 'Auto Pet Command on Skill Use'");
				}
				if (((BaseUnityPlugin)ErenshorQoLMod.context).Config.ContainsKey(val12))
				{
					((BaseUnityPlugin)ErenshorQoLMod.context).Config.Remove(val12);
					ErenshorUtilitiesLogger.LogInfo((object)"Removed obsolete setting: 'Auto Pet Command on Auto Attack'");
				}
				ErenshorQoLMod.ConfigCleanup.Value = 1;
				((BaseUnityPlugin)ErenshorQoLMod.context).Config.Save();
				ErenshorUtilitiesLogger.LogInfo((object)"Erenshor QoL Config cleanup applied.");
			}
		}
	}
}