Decompiled source of Almanac v3.4.9

Almanac.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using Almanac.API;
using Almanac.Achievements;
using Almanac.Bounties;
using Almanac.Data;
using Almanac.FileSystem;
using Almanac.TreasureHunt;
using Almanac.UI;
using Almanac.Utilities;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Groups;
using HarmonyLib;
using JetBrains.Annotations;
using Managers;
using Microsoft.CodeAnalysis;
using ServerSync;
using Splatform;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Core.Tokens;
using YamlDotNet.Helpers;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.BufferedDeserialization;
using YamlDotNet.Serialization.BufferedDeserialization.TypeDiscriminators;
using YamlDotNet.Serialization.Converters;
using YamlDotNet.Serialization.EventEmitters;
using YamlDotNet.Serialization.NamingConventions;
using YamlDotNet.Serialization.NodeDeserializers;
using YamlDotNet.Serialization.NodeTypeResolvers;
using YamlDotNet.Serialization.ObjectFactories;
using YamlDotNet.Serialization.ObjectGraphTraversalStrategies;
using YamlDotNet.Serialization.ObjectGraphVisitors;
using YamlDotNet.Serialization.Schemas;
using YamlDotNet.Serialization.TypeInspectors;
using YamlDotNet.Serialization.TypeResolvers;
using YamlDotNet.Serialization.Utilities;
using YamlDotNet.Serialization.ValueDeserializers;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Almanac")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("Almanac")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("E0E2F92E-557C-4A05-9D89-AA92A0BD75C4")]
[assembly: AssemblyFileVersion("3.4.9")]
[assembly: AssemblyCompany("RustyMods")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.4.9.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[<df13d4f2-00de-45ff-86b7-0e0a477d021f>Embedded]
	internal sealed class <df13d4f2-00de-45ff-86b7-0e0a477d021f>EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[<df13d4f2-00de-45ff-86b7-0e0a477d021f>Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class <2143be97-af53-4a5a-8697-a04eada779f2>NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public <2143be97-af53-4a5a-8697-a04eada779f2>NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public <2143be97-af53-4a5a-8697-a04eada779f2>NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[<df13d4f2-00de-45ff-86b7-0e0a477d021f>Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class <fb7ef35b-7515-4cea-86da-528618495a61>NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public <fb7ef35b-7515-4cea-86da-528618495a61>NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace Managers
{
	[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
	[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(0)]
	public static class FontManager
	{
		[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(0)]
		public enum FontOptions
		{
			Norse,
			NorseBold,
			AveriaSerifLibre,
			AveriaSerifLibreBold,
			AveriaSerifLibreLight,
			LegacyRuntime
		}

		[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(0)]
		private class TextFont
		{
			private readonly Text m_text;

			public TextFont(Text text, [<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(2)] Font font)
			{
				m_text = text;
				Update(font);
				m_allTexts.Add(this);
			}

			[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(2)]
			public void Update(Font font)
			{
				m_text.font = font;
			}
		}

		[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(new byte[] { 1, 2 })]
		private static readonly Dictionary<FontOptions, Font> m_fonts = new Dictionary<FontOptions, Font>();

		private static readonly List<TextFont> m_allTexts = new List<TextFont>();

		private static string GetFontName(FontOptions option)
		{
			if (1 == 0)
			{
			}
			string result = option switch
			{
				FontOptions.Norse => "Norse", 
				FontOptions.AveriaSerifLibre => "AveriaSerifLibre-Regular", 
				FontOptions.AveriaSerifLibreBold => "AveriaSerifLibre-Bold", 
				FontOptions.AveriaSerifLibreLight => "AveriaSerifLibre-Light", 
				FontOptions.NorseBold => "Norsebold", 
				FontOptions.LegacyRuntime => "LegacyRuntime", 
				_ => "AveriaSerifLibre-Regular", 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(2)]
		public static Font GetFont(FontOptions option)
		{
			if (m_fonts.TryGetValue(option, out var value))
			{
				return value;
			}
			Font[] source = Resources.FindObjectsOfTypeAll<Font>();
			Font val = ((IEnumerable<Font>)source).FirstOrDefault((Func<Font, bool>)([<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(0)] (Font x) => ((Object)x).name == GetFontName(option)));
			m_fonts[option] = val;
			return val;
		}

		public static void OnFontChange(object sender, EventArgs args)
		{
			Font font = GetFont(FontOptions.AveriaSerifLibre);
			foreach (TextFont allText in m_allTexts)
			{
				allText.Update(font);
			}
		}

		public static void SetFont(Text[] array)
		{
			foreach (Text text in array)
			{
				TextFont textFont = new TextFont(text, GetFont(FontOptions.AveriaSerifLibre));
			}
		}
	}
}
namespace Almanac
{
	[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
	[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(0)]
	[BepInIncompatibility("randyknapp.mods.auga")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("RustyMods.Almanac", "Almanac", "3.4.9")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class AlmanacPlugin : BaseUnityPlugin
	{
		[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(0)]
		public enum Toggle
		{
			On = 1,
			Off = 0
		}

		internal const string ModName = "Almanac";

		internal const string ModVersion = "3.4.9";

		internal const string Author = "RustyMods";

		public const string ModGUID = "RustyMods.Almanac";

		private static readonly string ConfigFileName = "RustyMods.Almanac.cfg";

		private static readonly string ConfigFileFullPath;

		internal static string ConnectionError;

		private readonly Harmony _harmony = new Harmony("RustyMods.Almanac");

		public static readonly ManualLogSource AlmanacLogger;

		public static readonly ConfigSync ConfigSync;

		public static AlmanacPlugin _plugin;

		public static GameObject _root;

		public static readonly AssetBundle _UIAssets;

		public static bool KrumpacLoaded;

		public static bool JewelCraftLoaded;

		public static bool KGEnchantmentLoaded;

		private static ConfigEntry<Toggle> _serverConfigLocked;

		public static ConfigEntry<Toggle> _KnowledgeWall;

		public static ConfigEntry<Toggle> _UseIgnoreList;

		public static ConfigEntry<Toggle> _AchievementIcons;

		public static ConfigEntry<Toggle> _AchievementPowers;

		public static ConfigEntry<int> _AchievementThreshold;

		public static ConfigEntry<Toggle> _ShowAllData;

		public static ConfigEntry<Color> _OutlineColor;

		public static ConfigEntry<KeyCode> _AlmanacHotKey;

		public static ConfigEntry<int> _TreasureCooldown;

		public static ConfigEntry<int> _BountyCooldown;

		public static ConfigEntry<Toggle> _TreasureEnabled;

		public static ConfigEntry<Toggle> _BountyEnabled;

		public static ConfigEntry<Toggle> _AchievementsEnabled;

		public static ConfigEntry<Toggle> _Transparent;

		public void SpawnBounty()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			Almanac.Bounties.Data.BountyLocation activeBountyLocation = Bounty.ActiveBountyLocation;
			if (activeBountyLocation != null)
			{
				GameObject val = Object.Instantiate<GameObject>(activeBountyLocation.m_critter, activeBountyLocation.m_position, Quaternion.identity);
				Bounty bounty = val.AddComponent<Bounty>();
				ISerializer serializer = new SerializerBuilder().Build();
				string text = serializer.Serialize(activeBountyLocation.m_data);
				bounty._znv.GetZDO().Set(Bounty.bountyHash, text);
				CachedEffects.m_spawnEffects.Create(val.transform.position, Quaternion.identity);
			}
		}

		public void Awake()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			Localizer.Load();
			_plugin = this;
			_root = new GameObject("root");
			Object.DontDestroyOnLoad((Object)(object)_root);
			_root.SetActive(false);
			InitConfigs();
			CheckChainLoader();
			AlmanacPaths.CreateFolderDirectories();
			AchievementYML.Init();
			Filters.InitFilters();
			FileWatcher.InitFileSystemWatch();
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			_harmony.PatchAll(executingAssembly);
			SetupWatcher();
		}

		public void Update()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && Object.op_Implicit((Object)(object)AlmanacUI.m_instance) && Input.GetKeyDown(_AlmanacHotKey.Value))
			{
				AlmanacUI.m_instance.Toggle();
			}
		}

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

		private static void CheckChainLoader()
		{
			if (Chainloader.PluginInfos.ContainsKey("kg.ValheimEnchantmentSystem"))
			{
				AlmanacLogger.LogInfo((object)"KG Enchantment System Loaded");
				KGEnchantmentLoaded = true;
			}
			if (Chainloader.PluginInfos.ContainsKey("Krumpac.Krumpac_Reforge_Core"))
			{
				AlmanacLogger.LogInfo((object)"Krumpac Loaded");
				KrumpacLoaded = true;
			}
			if (Chainloader.PluginInfos.ContainsKey("org.bepinex.plugins.jewelcrafting"))
			{
				AlmanacLogger.LogInfo((object)"Jewel Crafting Loaded");
				JewelCraftLoaded = true;
			}
		}

		private static AssetBundle GetAssetBundle(string fileName)
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string name = executingAssembly.GetManifestResourceNames().Single([<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(0)] (string str) => str.EndsWith(fileName));
			using Stream stream = executingAssembly.GetManifestResourceStream(name);
			return AssetBundle.LoadFromStream(stream);
		}

		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
			{
				AlmanacLogger.LogDebug((object)"ReadConfigValues called");
				((BaseUnityPlugin)this).Config.Reload();
			}
			catch
			{
				AlmanacLogger.LogError((object)("There was an issue loading your " + ConfigFileName));
				AlmanacLogger.LogError((object)"Please check your config entries for spelling and format!");
			}
		}

		private void InitConfigs()
		{
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			_serverConfigLocked = config("1 - General", "0 - Lock Configuration", Toggle.On, "If on, the configuration is locked and can be changed by server admins only.");
			ConfigSync.AddLockingConfigEntry<Toggle>(_serverConfigLocked);
			_KnowledgeWall = config("1 - General", "1 - Knowledge Wall", Toggle.On, "If on, the plugin blacks out unknown items from the almanac");
			_UseIgnoreList = config("1 - General", "2 - Use Ignore List", Toggle.On, "If on, the plugin uses the IgnoreList.yml to filter almanac");
			_ShowAllData = config("1 - General", "3 - Show All Data", Toggle.Off, "If on, Almanac does not filter extra data, like prefab name and material name");
			_AchievementIcons = config("Achievements", "HUD Icons", Toggle.Off, "If on, achievements icons appear alongside status effects on HUD");
			_AchievementIcons.SettingChanged += AchievementManager.OnAchievementConfigChanged;
			_AchievementPowers = config("Achievements", "Bonuses Enabled", Toggle.On, "If on, achievements are interactable and reward players with bonuses");
			_AchievementPowers.SettingChanged += AchievementManager.OnAchievementConfigChanged;
			_AchievementThreshold = config("Achievements", "Threshold", 3, "Total amount of achievement effects allowed at the same time");
			_OutlineColor = config<Color>("1 - General", "6 - Outline Color", new Color(1f, 1f, 1f, 0.1f), "Set the color of the outline for selected items");
			_AlmanacHotKey = config<KeyCode>("1 - General", "7 - Almanac HotKey", (KeyCode)287, "Set the hotkey to open almanac", synchronizedSetting: false);
			_TreasureCooldown = config("Cooldown", "Treasure Hunt", 30, "Set cooldown between treasure hunts, in minutes");
			_BountyCooldown = config("Cooldown", "Bounties", 30, "Set cooldown between bounty hunts, in minutes");
			_BountyEnabled = config("2 - Settings", "Bounties", Toggle.On, "If on, bounty feature is enabled");
			_TreasureEnabled = config("2 - Settings", "Treasures", Toggle.On, "If on, treasure feature is enabled");
			_AchievementsEnabled = config("3 - Achievements", "Enabled", Toggle.On, "If on, achievements is enabled");
			_Transparent = config("2 - Settings", "Transparent Panels", Toggle.Off, "If on, panels are transparent");
		}

		private ConfigEntry<T> config<[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(2)] T>(string group, string name, T value, ConfigDescription description, bool synchronizedSetting = true)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			ConfigDescription val = new ConfigDescription(description.Description + (synchronizedSetting ? " [Synced with Server]" : " [Not Synced with Server]"), description.AcceptableValues, description.Tags);
			ConfigEntry<T> val2 = ((BaseUnityPlugin)this).Config.Bind<T>(group, name, value, val);
			SyncedConfigEntry<T> syncedConfigEntry = ConfigSync.AddConfigEntry<T>(val2);
			syncedConfigEntry.SynchronizedConfig = synchronizedSetting;
			return val2;
		}

		private ConfigEntry<T> config<[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(2)] T>(string group, string name, T value, string description, bool synchronizedSetting = true)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting);
		}

		static AlmanacPlugin()
		{
			string configPath = Paths.ConfigPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName;
			ConnectionError = "";
			AlmanacLogger = Logger.CreateLogSource("Almanac");
			ConfigSync = new ConfigSync("RustyMods.Almanac")
			{
				DisplayName = "Almanac",
				CurrentVersion = "3.4.9",
				MinimumRequiredVersion = "3.4.9"
			};
			_plugin = null;
			_root = null;
			_UIAssets = GetAssetBundle("almanacui");
			KrumpacLoaded = false;
			JewelCraftLoaded = false;
			KGEnchantmentLoaded = false;
			_serverConfigLocked = null;
			_KnowledgeWall = null;
			_UseIgnoreList = null;
			_AchievementIcons = null;
			_AchievementPowers = null;
			_AchievementThreshold = null;
			_ShowAllData = null;
			_OutlineColor = null;
			_AlmanacHotKey = null;
			_TreasureCooldown = null;
			_BountyCooldown = null;
			_TreasureEnabled = null;
			_BountyEnabled = null;
			_AchievementsEnabled = null;
			_Transparent = null;
		}
	}
	[HarmonyPatch(typeof(ZNet), "OnNewConnection")]
	public static class RegisterAndCheckVersion
	{
		[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
		private static void Prefix(ZNetPeer peer, ref ZNet __instance)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			AlmanacPlugin.AlmanacLogger.LogDebug((object)"Registering version RPC handler");
			peer.m_rpc.Register<ZPackage>("Almanac_VersionCheck", (Action<ZRpc, ZPackage>)RpcHandlers.RPC_Almanac_Version);
			AlmanacPlugin.AlmanacLogger.LogDebug((object)"Invoking version check");
			ZPackage val = new ZPackage();
			val.Write("3.4.9");
			peer.m_rpc.Invoke("Almanac_VersionCheck", new object[1] { val });
		}
	}
	[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(0)]
	[HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")]
	[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
	public static class VerifyClient
	{
		private static bool Prefix(ZRpc rpc, ZPackage pkg, ref ZNet __instance)
		{
			if (!__instance.IsServer() || RpcHandlers.ValidatedPeers.Contains(rpc))
			{
				return true;
			}
			AlmanacPlugin.AlmanacLogger.LogWarning((object)("Peer (" + rpc.m_socket.GetHostName() + ") never sent version or couldn't due to previous disconnect, disconnecting"));
			rpc.Invoke("Error", new object[1] { 3 });
			return false;
		}

		private static void Postfix(ZNet __instance)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "RequestAdminSync", new object[1] { (object)new ZPackage() });
		}
	}
	[HarmonyPatch(typeof(FejdStartup), "ShowConnectError")]
	public class ShowConnectionError
	{
		[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
		private static void Postfix(FejdStartup __instance)
		{
			if (__instance.m_connectionFailedPanel.activeSelf)
			{
				__instance.m_connectionFailedError.fontSizeMax = 25f;
				__instance.m_connectionFailedError.fontSizeMax = 15f;
				TMP_Text connectionFailedError = __instance.m_connectionFailedError;
				connectionFailedError.text = connectionFailedError.text + "\n" + AlmanacPlugin.ConnectionError;
			}
		}
	}
	[HarmonyPatch(typeof(ZNet), "Disconnect")]
	public static class RemoveDisconnectedPeerFromVerified
	{
		[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
		private static void Prefix(ZNetPeer peer, ref ZNet __instance)
		{
			if (__instance.IsServer())
			{
				AlmanacPlugin.AlmanacLogger.LogInfo((object)("Peer (" + peer.m_rpc.m_socket.GetHostName() + ") disconnected, removing from validated list"));
				RpcHandlers.ValidatedPeers.Remove(peer.m_rpc);
			}
		}
	}
	[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
	[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(0)]
	public static class RpcHandlers
	{
		public static readonly List<ZRpc> ValidatedPeers = new List<ZRpc>();

		public static void RPC_Almanac_Version(ZRpc rpc, ZPackage pkg)
		{
			string text = pkg.ReadString();
			AlmanacPlugin.AlmanacLogger.LogInfo((object)("Version check, local: 3.4.9,  remote: " + text));
			if (text != "3.4.9")
			{
				AlmanacPlugin.ConnectionError = "Almanac Installed: 3.4.9\n Needed: " + text;
				if (ZNet.instance.IsServer())
				{
					AlmanacPlugin.AlmanacLogger.LogWarning((object)("Peer (" + rpc.m_socket.GetHostName() + ") has incompatible version, disconnecting"));
					rpc.Invoke("Error", new object[1] { 3 });
				}
			}
			else if (!ZNet.instance.IsServer())
			{
				AlmanacPlugin.AlmanacLogger.LogInfo((object)"Received same version from server!");
			}
			else
			{
				AlmanacPlugin.AlmanacLogger.LogInfo((object)("Adding peer (" + rpc.m_socket.GetHostName() + ") to validated list"));
				ValidatedPeers.Add(rpc);
			}
		}
	}
}
namespace Almanac.Utilities
{
	[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
	[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(0)]
	public static class CommandsManager
	{
		[HarmonyPatch(typeof(Terminal), "Awake")]
		[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(0)]
		private static class Terminal_Awake_Patch
		{
			[Serializable]
			[CompilerGenerated]
			private sealed class <>c
			{
				public static readonly <>c <>9 = new <>c();

				public static ConsoleEventFailable <>9__0_0;

				public static ConsoleOptionsFetcher <>9__0_1;

				[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(new byte[] { 0, 1 })]
				public static Func<ConsoleEventArgs, bool> <>9__0_2;

				public static Func<string, string> <>9__0_16;

				public static Func<string, string> <>9__0_17;

				[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(new byte[] { 0, 1 })]
				public static Func<ConsoleEventArgs, bool> <>9__0_3;

				[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(new byte[] { 0, 1 })]
				public static Func<ConsoleEventArgs, bool> <>9__0_4;

				[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(new byte[] { 0, 1 })]
				public static Func<ConsoleEventArgs, bool> <>9__0_5;

				[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(new byte[] { 0, 1, 1 })]
				public static Func<List<string>> <>9__0_6;

				[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(new byte[] { 0, 1 })]
				public static Func<ConsoleEventArgs, bool> <>9__0_7;

				[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(new byte[] { 0, 1 })]
				public static Func<ConsoleEventArgs, bool> <>9__0_8;

				public static Func<Creatures.Data, string> <>9__0_18;

				[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(new byte[] { 0, 1, 1 })]
				public static Func<List<string>> <>9__0_9;

				public static Func<Items.Data, bool> <>9__0_19;

				[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(new byte[] { 0, 1 })]
				public static Func<ConsoleEventArgs, bool> <>9__0_10;

				public static Func<AchievementTypes.AchievementType, string> <>9__0_20;

				[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(new byte[] { 0, 1, 1 })]
				public static Func<List<string>> <>9__0_11;

				[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(new byte[] { 0, 1 })]
				public static Func<ConsoleEventArgs, bool> <>9__0_12;

				[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(new byte[] { 0, 1 })]
				public static Func<ConsoleEventArgs, bool> <>9__0_13;

				[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(new byte[] { 0, 1 })]
				public static Func<ConsoleEventArgs, bool> <>9__0_14;

				[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(new byte[] { 0, 1 })]
				public static Func<ConsoleEventArgs, bool> <>9__0_15;

				internal object <Postfix>b__0_0(ConsoleEventArgs args)
				{
					if (args.Length < 2)
					{
						return false;
					}
					if (!m_commands.TryGetValue(args[1], out var value))
					{
						return false;
					}
					return value.Run(args);
				}

				internal List<string> <Postfix>b__0_1()
				{
					return m_commands.Keys.ToList();
				}

				[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
				internal bool <Postfix>b__0_2(ConsoleEventArgs _)
				{
					Debug.Log((object)"Kill Keys: ");
					foreach (KeyValuePair<string, int> kill in PlayerStats.m_records.m_kills)
					{
						Debug.Log((object)$"{kill.Key} - {kill.Value}");
					}
					Debug.Log((object)"Death Keys: ");
					foreach (KeyValuePair<string, int> death in PlayerStats.m_records.m_deaths)
					{
						Debug.Log((object)$"{death.Key} - {death.Value}");
					}
					return true;
				}

				[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
				internal bool <Postfix>b__0_3(ConsoleEventArgs _)
				{
					int num = 0;
					int num2 = 0;
					foreach (string item in PlayerStats.m_records.m_kills.Keys.ToList())
					{
						int num3 = PlayerStats.m_records.m_kills[item];
						Creatures.Data value;
						if (num3 == 0)
						{
							PlayerStats.m_records.m_kills.Remove(item);
						}
						else if (!Creatures.m_creatures.TryGetValue(item.ToLower(), out value))
						{
							if (item.StartsWith("defeated"))
							{
								string text = item.Replace("defeated_", string.Empty);
								if (!Utility.IsNullOrWhiteSpace(text))
								{
									string[] value2 = (from part in text.Split(new char[1] { '_' })
										select char.ToUpper(part[0]) + part.Substring(1)).ToArray();
									string key = string.Join("_", value2).ToLower();
									if (!Creatures.m_creatures.TryGetValue(key, out value))
									{
										Debug.Log((object)("Failed to fix key: " + item));
										continue;
									}
									Utils.IncrementOrSet<string>(PlayerStats.m_records.m_kills, value.m_prefabName, num3);
									PlayerStats.m_records.m_kills.Remove(item);
									num++;
								}
								else
								{
									Debug.Log((object)("Failed to fix key: " + item));
								}
							}
							else if (Creatures.m_defeatKeyCreatures.TryGetValue(item, out value))
							{
								Utils.IncrementOrSet<string>(PlayerStats.m_records.m_kills, value.m_prefabName, PlayerStats.m_records.m_kills[item]);
								PlayerStats.m_records.m_kills.Remove(item);
								num++;
							}
						}
						else if (item != value.m_prefabName)
						{
							Utils.IncrementOrSet<string>(PlayerStats.m_records.m_kills, value.m_prefabName, PlayerStats.m_records.m_kills[item]);
							PlayerStats.m_records.m_kills.Remove(item);
							num++;
						}
					}
					foreach (string item2 in PlayerStats.m_records.m_deaths.Keys.ToList())
					{
						Creatures.Data value3;
						if (PlayerStats.m_records.m_deaths[item2] == 0)
						{
							PlayerStats.m_records.m_deaths.Remove(item2);
						}
						else if (!Creatures.m_creatures.TryGetValue(item2.ToLower(), out value3))
						{
							if (item2.StartsWith("defeated"))
							{
								string text2 = item2.Replace("defeated_", string.Empty);
								if (!Utility.IsNullOrWhiteSpace(text2))
								{
									string[] value4 = (from part in text2.Split(new char[1] { '_' })
										select char.ToUpper(part[0]) + part.Substring(1)).ToArray();
									string key2 = string.Join("_", value4);
									if (!Creatures.m_creatures.TryGetValue(key2, out value3))
									{
										Debug.Log((object)("Failed to fix key: " + item2));
										continue;
									}
									Utils.IncrementOrSet<string>(PlayerStats.m_records.m_deaths, value3.m_prefabName, PlayerStats.m_records.m_deaths[item2]);
									PlayerStats.m_records.m_deaths.Remove(item2);
									num2++;
								}
							}
							else if (Creatures.m_defeatKeyCreatures.TryGetValue(item2, out value3))
							{
								Utils.IncrementOrSet<string>(PlayerStats.m_records.m_deaths, value3.m_prefabName, PlayerStats.m_records.m_deaths[item2]);
								PlayerStats.m_records.m_deaths.Remove(item2);
								num2++;
							}
						}
						else if (item2 != value3.m_prefabName)
						{
							Utils.IncrementOrSet<string>(PlayerStats.m_records.m_deaths, value3.m_prefabName, PlayerStats.m_records.m_deaths[item2]);
							PlayerStats.m_records.m_deaths.Remove(item2);
							num2++;
						}
					}
					AlmanacPlugin.AlmanacLogger.LogInfo((object)$"Fixed {num} kill keys and fixed {num2} death keys");
					return true;
				}

				internal string <Postfix>b__0_16(string part)
				{
					return char.ToUpper(part[0]) + part.Substring(1);
				}

				internal string <Postfix>b__0_17(string part)
				{
					return char.ToUpper(part[0]) + part.Substring(1);
				}

				[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
				internal bool <Postfix>b__0_4(ConsoleEventArgs _)
				{
					if (!Object.op_Implicit((Object)(object)Player.m_localPlayer))
					{
						return false;
					}
					if (!Player.m_localPlayer.m_customData.TryGetValue("AlmanacStats", out var value))
					{
						AlmanacPlugin.AlmanacLogger.LogInfo((object)"No Almanac custom player data found");
						return false;
					}
					int byteCount = Encoding.UTF8.GetByteCount(value);
					double num = (double)byteCount / 1024.0;
					AlmanacPlugin.AlmanacLogger.LogInfo((object)("Almanac Custom Data size: " + num + " kilobytes"));
					return true;
				}

				[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
				internal bool <Postfix>b__0_5(ConsoleEventArgs args)
				{
					if (args.Length < 3)
					{
						AlmanacPlugin.AlmanacLogger.LogInfo((object)"Invalid information: ex: almanac pickable [pickable prefab name]");
						return false;
					}
					if (args[2] == "all")
					{
						foreach (KeyValuePair<string, int> item in PlayerStats.m_records.m_picked)
						{
							AlmanacPlugin.AlmanacLogger.LogInfo((object)(item.Key + " : " + item.Value));
						}
						return true;
					}
					if (!PlayerStats.m_records.m_picked.TryGetValue(args[2], out var value))
					{
						AlmanacPlugin.AlmanacLogger.LogInfo((object)"Failed to get pickable value");
						return false;
					}
					AlmanacPlugin.AlmanacLogger.LogInfo((object)(((Character)Player.m_localPlayer).GetHoverName() + " has picked " + value + " " + args[2]));
					return true;
				}

				[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
				internal List<string> <Postfix>b__0_6()
				{
					List<string> list = new List<string>();
					list.AddRange(PlayerStats.m_records.m_picked.Keys);
					list.Add("all");
					list.Sort();
					return list;
				}

				[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
				internal bool <Postfix>b__0_7(ConsoleEventArgs _)
				{
					if (!Object.op_Implicit((Object)(object)AlmanacUI.m_instance))
					{
						return false;
					}
					AlmanacUI.m_instance.ReloadAssets();
					return true;
				}

				[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
				internal bool <Postfix>b__0_8(ConsoleEventArgs args)
				{
					if (args.Length < 3)
					{
						return false;
					}
					if (!Creatures.m_creatures.TryGetValue(args[2].ToLower(), out var value))
					{
						return false;
					}
					int valueOrDefault = PlayerStats.m_records.m_deaths.GetValueOrDefault(value.m_defeatKey, 0);
					int valueOrDefault2 = PlayerStats.m_records.m_kills.GetValueOrDefault(value.m_defeatKey, 0);
					AlmanacPlugin.AlmanacLogger.LogInfo((object)$"Key: {args[2]} , kills: {valueOrDefault2} , deaths: {valueOrDefault}");
					return true;
				}

				[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
				internal List<string> <Postfix>b__0_9()
				{
					return Creatures.m_creatures.Values.Select((Creatures.Data x) => x.m_prefabName).ToList();
				}

				internal string <Postfix>b__0_18(Creatures.Data x)
				{
					return x.m_prefabName;
				}

				[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
				internal bool <Postfix>b__0_10(ConsoleEventArgs args)
				{
					//IL_0092: Unknown result type (might be due to invalid IL or missing references)
					//IL_0097: Unknown result type (might be due to invalid IL or missing references)
					//IL_009c: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
					//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
					//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
					//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
					//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
					//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
					if (args.Length < 3)
					{
						return false;
					}
					if (!Enum.TryParse<AchievementTypes.AchievementType>(args[2], ignoreCase: true, out var result))
					{
						return false;
					}
					switch (result)
					{
					case AchievementTypes.AchievementType.MeadowCreatures:
					case AchievementTypes.AchievementType.BlackForestCreatures:
					case AchievementTypes.AchievementType.SwampCreatures:
					case AchievementTypes.AchievementType.MountainCreatures:
					case AchievementTypes.AchievementType.PlainsCreatures:
					case AchievementTypes.AchievementType.MistLandCreatures:
					case AchievementTypes.AchievementType.AshLandCreatures:
					case AchievementTypes.AchievementType.DeepNorthCreatures:
					case AchievementTypes.AchievementType.OceanCreatures:
					{
						if (1 == 0)
						{
						}
						Biome val = (Biome)(result switch
						{
							AchievementTypes.AchievementType.MeadowCreatures => 1, 
							AchievementTypes.AchievementType.BlackForestCreatures => 8, 
							AchievementTypes.AchievementType.SwampCreatures => 2, 
							AchievementTypes.AchievementType.MountainCreatures => 4, 
							AchievementTypes.AchievementType.PlainsCreatures => 16, 
							AchievementTypes.AchievementType.MistLandCreatures => 512, 
							AchievementTypes.AchievementType.AshLandCreatures => 32, 
							AchievementTypes.AchievementType.DeepNorthCreatures => 64, 
							AchievementTypes.AchievementType.OceanCreatures => 256, 
							_ => 0, 
						});
						if (1 == 0)
						{
						}
						Biome land = val;
						List<Creatures.Data> biomeCreatures = CreatureLists.GetBiomeCreatures(land);
						foreach (Creatures.Data item in biomeCreatures)
						{
							AlmanacPlugin.AlmanacLogger.LogInfo((object)item.m_prefabName);
						}
						AlmanacPlugin.AlmanacLogger.LogInfo((object)("Total: " + biomeCreatures.Count));
						break;
					}
					case AchievementTypes.AchievementType.CustomCreatureGroups:
					{
						if (args.Length < 4)
						{
							AlmanacPlugin.AlmanacLogger.LogWarning((object)"Missing key specifier, example: almanac achievement customcreaturegroup custom_brute_group");
							return true;
						}
						List<Creatures.Data> customCreatureGroup = CreatureLists.GetCustomCreatureGroup(args[3]);
						foreach (Creatures.Data item2 in customCreatureGroup)
						{
							AlmanacPlugin.AlmanacLogger.LogInfo((object)item2.m_prefabName);
						}
						AlmanacPlugin.AlmanacLogger.LogInfo((object)("Total: " + customCreatureGroup.Count));
						break;
					}
					case AchievementTypes.AchievementType.Fish:
					case AchievementTypes.AchievementType.Materials:
					case AchievementTypes.AchievementType.Consumables:
					case AchievementTypes.AchievementType.Weapons:
					case AchievementTypes.AchievementType.Swords:
					case AchievementTypes.AchievementType.Axes:
					case AchievementTypes.AchievementType.PoleArms:
					case AchievementTypes.AchievementType.Spears:
					case AchievementTypes.AchievementType.Maces:
					case AchievementTypes.AchievementType.Knives:
					case AchievementTypes.AchievementType.Shields:
					case AchievementTypes.AchievementType.Staves:
					case AchievementTypes.AchievementType.Arrows:
					case AchievementTypes.AchievementType.Bows:
					case AchievementTypes.AchievementType.Valuables:
					case AchievementTypes.AchievementType.Potions:
					case AchievementTypes.AchievementType.Trophies:
					{
						if (1 == 0)
						{
						}
						List<Items.Data> list = result switch
						{
							AchievementTypes.AchievementType.Fish => Items.GetFishes(), 
							AchievementTypes.AchievementType.Materials => Items.GetMaterials(), 
							AchievementTypes.AchievementType.Consumables => Items.GetConsumables(), 
							AchievementTypes.AchievementType.Weapons => Items.GetWeapons(), 
							AchievementTypes.AchievementType.Swords => Items.GetWeaponBySkill((SkillType)1), 
							AchievementTypes.AchievementType.Axes => Items.GetWeaponBySkill((SkillType)7), 
							AchievementTypes.AchievementType.PoleArms => Items.GetWeaponBySkill((SkillType)4), 
							AchievementTypes.AchievementType.Spears => Items.GetWeaponBySkill((SkillType)5), 
							AchievementTypes.AchievementType.Maces => Items.GetWeaponBySkill((SkillType)3), 
							AchievementTypes.AchievementType.Knives => Items.GetWeaponBySkill((SkillType)2), 
							AchievementTypes.AchievementType.Shields => Items.GetWeaponBySkill((SkillType)6), 
							AchievementTypes.AchievementType.Staves => Items.GetStaves(), 
							AchievementTypes.AchievementType.Arrows => Items.GetAmmunition(), 
							AchievementTypes.AchievementType.Bows => Items.GetWeaponBySkill((SkillType)8), 
							AchievementTypes.AchievementType.Valuables => Items.GetValuables(), 
							AchievementTypes.AchievementType.Potions => Items.GetPotions(), 
							AchievementTypes.AchievementType.Trophies => Items.GetTrophies(), 
							_ => new List<Items.Data>(), 
						};
						if (1 == 0)
						{
						}
						List<Items.Data> source = list;
						source = source.Where((Items.Data x) => !Items.IsTool(x.m_item) || !Items.IsBait(x.m_item)).ToList();
						foreach (Items.Data item3 in source)
						{
							AlmanacPlugin.AlmanacLogger.LogInfo((object)((Object)item3.m_item).name);
						}
						AlmanacPlugin.AlmanacLogger.LogInfo((object)("Total: " + source.Count));
						break;
					}
					}
					return true;
				}

				internal bool <Postfix>b__0_19(Items.Data x)
				{
					return !Items.IsTool(x.m_item) || !Items.IsBait(x.m_item);
				}

				[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
				internal List<string> <Postfix>b__0_11()
				{
					List<AchievementTypes.AchievementType> source = new List<AchievementTypes.AchievementType>
					{
						AchievementTypes.AchievementType.MeadowCreatures,
						AchievementTypes.AchievementType.BlackForestCreatures,
						AchievementTypes.AchievementType.SwampCreatures,
						AchievementTypes.AchievementType.MountainCreatures,
						AchievementTypes.AchievementType.PlainsCreatures,
						AchievementTypes.AchievementType.MistLandCreatures,
						AchievementTypes.AchievementType.AshLandCreatures,
						AchievementTypes.AchievementType.DeepNorthCreatures,
						AchievementTypes.AchievementType.OceanCreatures,
						AchievementTypes.AchievementType.CustomCreatureGroups,
						AchievementTypes.AchievementType.Fish,
						AchievementTypes.AchievementType.Materials,
						AchievementTypes.AchievementType.Consumables,
						AchievementTypes.AchievementType.Weapons,
						AchievementTypes.AchievementType.Swords,
						AchievementTypes.AchievementType.Axes,
						AchievementTypes.AchievementType.PoleArms,
						AchievementTypes.AchievementType.Spears,
						AchievementTypes.AchievementType.Maces,
						AchievementTypes.AchievementType.Knives,
						AchievementTypes.AchievementType.Shields,
						AchievementTypes.AchievementType.Staves,
						AchievementTypes.AchievementType.Arrows,
						AchievementTypes.AchievementType.Bows,
						AchievementTypes.AchievementType.Valuables,
						AchievementTypes.AchievementType.Potions,
						AchievementTypes.AchievementType.Trophies
					};
					return source.Select((AchievementTypes.AchievementType x) => x.ToString()).ToList();
				}

				internal string <Postfix>b__0_20(AchievementTypes.AchievementType x)
				{
					return x.ToString();
				}

				[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
				internal bool <Postfix>b__0_12(ConsoleEventArgs _)
				{
					if (!Object.op_Implicit((Object)(object)Player.m_localPlayer))
					{
						return false;
					}
					PlayerStats.m_records.m_picked.Clear();
					PlayerStats.m_records.m_kills.Clear();
					PlayerStats.m_records.m_deaths.Clear();
					Player.m_localPlayer.m_customData.Remove("AlmanacStats");
					Player.m_localPlayer.m_customData.Remove("AlmanacCollectedRewards");
					Player.m_localPlayer.m_customData.Remove("AlmanacAchievements");
					Player.m_localPlayer.m_customData.Remove("AlmanacRecords");
					EffectMan.Clear();
					AlmanacPlugin.AlmanacLogger.LogInfo((object)"Cleared Almanac Records from Player Save");
					return true;
				}

				[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
				internal bool <Postfix>b__0_13(ConsoleEventArgs _)
				{
					if (!Object.op_Implicit((Object)(object)Game.instance) || Game.instance.m_playerProfile == null)
					{
						return false;
					}
					Game.instance.m_playerProfile.m_playerStats.m_stats.Clear();
					return true;
				}

				[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
				internal bool <Postfix>b__0_14(ConsoleEventArgs _)
				{
					if (!Object.op_Implicit((Object)(object)Game.instance) || Game.instance.m_playerProfile == null)
					{
						return false;
					}
					AlmanacPlugin.AlmanacLogger.LogInfo((object)"Enemy Stats");
					foreach (KeyValuePair<string, float> enemyStat in Game.instance.m_playerProfile.m_enemyStats)
					{
						Debug.Log((object)$"{enemyStat.Key}: {enemyStat.Value}");
					}
					AlmanacPlugin.AlmanacLogger.LogInfo((object)"Item Craft Stats");
					foreach (KeyValuePair<string, float> itemCraftStat in Game.instance.m_playerProfile.m_itemCraftStats)
					{
						Debug.Log((object)$"{itemCraftStat.Key}: {itemCraftStat.Value}");
					}
					return true;
				}

				[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
				internal bool <Postfix>b__0_15(ConsoleEventArgs _)
				{
					foreach (KeyValuePair<string, AlmanacCommand> command in m_commands)
					{
						AlmanacPlugin.AlmanacLogger.LogInfo((object)(command.Key + " - " + command.Value.m_description));
					}
					return true;
				}
			}

			private static void Postfix()
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Expected O, but got Unknown
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Expected O, but got Unknown
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Expected O, but got Unknown
				object obj = <>c.<>9__0_0;
				if (obj == null)
				{
					ConsoleEventFailable val = delegate(ConsoleEventArgs args)
					{
						if (args.Length < 2)
						{
							return false;
						}
						AlmanacCommand value8;
						return (!m_commands.TryGetValue(args[1], out value8)) ? ((object)false) : ((object)value8.Run(args));
					};
					<>c.<>9__0_0 = val;
					obj = (object)val;
				}
				object obj2 = <>c.<>9__0_1;
				if (obj2 == null)
				{
					ConsoleOptionsFetcher val2 = () => m_commands.Keys.ToList();
					<>c.<>9__0_1 = val2;
					obj2 = (object)val2;
				}
				ConsoleCommand val3 = new ConsoleCommand("almanac", "use help to list out commands", (ConsoleEventFailable)obj, false, false, false, false, false, (ConsoleOptionsFetcher)obj2, false, false, false);
				AlmanacCommand almanacCommand = new AlmanacCommand("keys", "Similar to listkeys, almanac keys prints all the current global keys and private keys the player current holds", [<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)] (ConsoleEventArgs _) =>
				{
					Debug.Log((object)"Kill Keys: ");
					foreach (KeyValuePair<string, int> kill in PlayerStats.m_records.m_kills)
					{
						Debug.Log((object)$"{kill.Key} - {kill.Value}");
					}
					Debug.Log((object)"Death Keys: ");
					foreach (KeyValuePair<string, int> death in PlayerStats.m_records.m_deaths)
					{
						Debug.Log((object)$"{death.Key} - {death.Value}");
					}
					return true;
				});
				AlmanacCommand almanacCommand2 = new AlmanacCommand("fix", "attempts to fix player kill / death data for any invalid entries", [<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)] (ConsoleEventArgs _) =>
				{
					int num2 = 0;
					int num3 = 0;
					foreach (string item in PlayerStats.m_records.m_kills.Keys.ToList())
					{
						int num4 = PlayerStats.m_records.m_kills[item];
						Creatures.Data value4;
						if (num4 == 0)
						{
							PlayerStats.m_records.m_kills.Remove(item);
						}
						else if (!Creatures.m_creatures.TryGetValue(item.ToLower(), out value4))
						{
							if (item.StartsWith("defeated"))
							{
								string text = item.Replace("defeated_", string.Empty);
								if (!Utility.IsNullOrWhiteSpace(text))
								{
									string[] value5 = (from part in text.Split(new char[1] { '_' })
										select char.ToUpper(part[0]) + part.Substring(1)).ToArray();
									string key = string.Join("_", value5).ToLower();
									if (!Creatures.m_creatures.TryGetValue(key, out value4))
									{
										Debug.Log((object)("Failed to fix key: " + item));
									}
									else
									{
										Utils.IncrementOrSet<string>(PlayerStats.m_records.m_kills, value4.m_prefabName, num4);
										PlayerStats.m_records.m_kills.Remove(item);
										num2++;
									}
								}
								else
								{
									Debug.Log((object)("Failed to fix key: " + item));
								}
							}
							else if (Creatures.m_defeatKeyCreatures.TryGetValue(item, out value4))
							{
								Utils.IncrementOrSet<string>(PlayerStats.m_records.m_kills, value4.m_prefabName, PlayerStats.m_records.m_kills[item]);
								PlayerStats.m_records.m_kills.Remove(item);
								num2++;
							}
						}
						else if (item != value4.m_prefabName)
						{
							Utils.IncrementOrSet<string>(PlayerStats.m_records.m_kills, value4.m_prefabName, PlayerStats.m_records.m_kills[item]);
							PlayerStats.m_records.m_kills.Remove(item);
							num2++;
						}
					}
					foreach (string item2 in PlayerStats.m_records.m_deaths.Keys.ToList())
					{
						Creatures.Data value6;
						if (PlayerStats.m_records.m_deaths[item2] == 0)
						{
							PlayerStats.m_records.m_deaths.Remove(item2);
						}
						else if (!Creatures.m_creatures.TryGetValue(item2.ToLower(), out value6))
						{
							if (item2.StartsWith("defeated"))
							{
								string text2 = item2.Replace("defeated_", string.Empty);
								if (!Utility.IsNullOrWhiteSpace(text2))
								{
									string[] value7 = (from part in text2.Split(new char[1] { '_' })
										select char.ToUpper(part[0]) + part.Substring(1)).ToArray();
									string key2 = string.Join("_", value7);
									if (!Creatures.m_creatures.TryGetValue(key2, out value6))
									{
										Debug.Log((object)("Failed to fix key: " + item2));
									}
									else
									{
										Utils.IncrementOrSet<string>(PlayerStats.m_records.m_deaths, value6.m_prefabName, PlayerStats.m_records.m_deaths[item2]);
										PlayerStats.m_records.m_deaths.Remove(item2);
										num3++;
									}
								}
							}
							else if (Creatures.m_defeatKeyCreatures.TryGetValue(item2, out value6))
							{
								Utils.IncrementOrSet<string>(PlayerStats.m_records.m_deaths, value6.m_prefabName, PlayerStats.m_records.m_deaths[item2]);
								PlayerStats.m_records.m_deaths.Remove(item2);
								num3++;
							}
						}
						else if (item2 != value6.m_prefabName)
						{
							Utils.IncrementOrSet<string>(PlayerStats.m_records.m_deaths, value6.m_prefabName, PlayerStats.m_records.m_deaths[item2]);
							PlayerStats.m_records.m_deaths.Remove(item2);
							num3++;
						}
					}
					AlmanacPlugin.AlmanacLogger.LogInfo((object)$"Fixed {num2} kill keys and fixed {num3} death keys");
					return true;
				});
				AlmanacCommand almanacCommand3 = new AlmanacCommand("size", "Prints the kilobyte size of almanac custom data saved in player save file", [<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)] (ConsoleEventArgs _) =>
				{
					if (!Object.op_Implicit((Object)(object)Player.m_localPlayer))
					{
						return false;
					}
					if (!Player.m_localPlayer.m_customData.TryGetValue("AlmanacStats", out var value3))
					{
						AlmanacPlugin.AlmanacLogger.LogInfo((object)"No Almanac custom player data found");
						return false;
					}
					int byteCount = Encoding.UTF8.GetByteCount(value3);
					double num = (double)byteCount / 1024.0;
					AlmanacPlugin.AlmanacLogger.LogInfo((object)("Almanac Custom Data size: " + num + " kilobytes"));
					return true;
				});
				AlmanacCommand almanacCommand4 = new AlmanacCommand("pickable", "[prefabName] - Prints total amount of picked item, you can use 'all' to print a list of entire pickable data", [<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)] (ConsoleEventArgs args) =>
				{
					if (args.Length < 3)
					{
						AlmanacPlugin.AlmanacLogger.LogInfo((object)"Invalid information: ex: almanac pickable [pickable prefab name]");
						return false;
					}
					if (args[2] == "all")
					{
						foreach (KeyValuePair<string, int> item3 in PlayerStats.m_records.m_picked)
						{
							AlmanacPlugin.AlmanacLogger.LogInfo((object)(item3.Key + " : " + item3.Value));
						}
						return true;
					}
					if (!PlayerStats.m_records.m_picked.TryGetValue(args[2], out var value2))
					{
						AlmanacPlugin.AlmanacLogger.LogInfo((object)"Failed to get pickable value");
						return false;
					}
					AlmanacPlugin.AlmanacLogger.LogInfo((object)(((Character)Player.m_localPlayer).GetHoverName() + " has picked " + value2 + " " + args[2]));
					return true;
				}, [<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)] () =>
				{
					List<string> list2 = new List<string>();
					list2.AddRange(PlayerStats.m_records.m_picked.Keys);
					list2.Add("all");
					list2.Sort();
					return list2;
				});
				AlmanacCommand almanacCommand5 = new AlmanacCommand("reload", "Reloads graphic assets", [<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)] (ConsoleEventArgs _) =>
				{
					if (!Object.op_Implicit((Object)(object)AlmanacUI.m_instance))
					{
						return false;
					}
					AlmanacUI.m_instance.ReloadAssets();
					return true;
				});
				AlmanacCommand almanacCommand6 = new AlmanacCommand("kd", "[prefabName] - local kill / death tracked almanac data", [<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)] (ConsoleEventArgs args) =>
				{
					if (args.Length < 3)
					{
						return false;
					}
					if (!Creatures.m_creatures.TryGetValue(args[2].ToLower(), out var value))
					{
						return false;
					}
					int valueOrDefault = PlayerStats.m_records.m_deaths.GetValueOrDefault(value.m_defeatKey, 0);
					int valueOrDefault2 = PlayerStats.m_records.m_kills.GetValueOrDefault(value.m_defeatKey, 0);
					AlmanacPlugin.AlmanacLogger.LogInfo((object)$"Key: {args[2]} , kills: {valueOrDefault2} , deaths: {valueOrDefault}");
					return true;
				}, [<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)] () => Creatures.m_creatures.Values.Select((Creatures.Data x) => x.m_prefabName).ToList());
				AlmanacCommand almanacCommand7 = new AlmanacCommand("achievement", "[type] [key?]- list of prefabs included in the completion count, only list achievements", [<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)] (ConsoleEventArgs args) =>
				{
					//IL_0092: Unknown result type (might be due to invalid IL or missing references)
					//IL_0097: Unknown result type (might be due to invalid IL or missing references)
					//IL_009c: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
					//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
					//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
					//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
					//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
					//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
					if (args.Length < 3)
					{
						return false;
					}
					if (!Enum.TryParse<AchievementTypes.AchievementType>(args[2], ignoreCase: true, out var result))
					{
						return false;
					}
					switch (result)
					{
					case AchievementTypes.AchievementType.MeadowCreatures:
					case AchievementTypes.AchievementType.BlackForestCreatures:
					case AchievementTypes.AchievementType.SwampCreatures:
					case AchievementTypes.AchievementType.MountainCreatures:
					case AchievementTypes.AchievementType.PlainsCreatures:
					case AchievementTypes.AchievementType.MistLandCreatures:
					case AchievementTypes.AchievementType.AshLandCreatures:
					case AchievementTypes.AchievementType.DeepNorthCreatures:
					case AchievementTypes.AchievementType.OceanCreatures:
					{
						if (1 == 0)
						{
						}
						Biome val4 = (Biome)(result switch
						{
							AchievementTypes.AchievementType.MeadowCreatures => 1, 
							AchievementTypes.AchievementType.BlackForestCreatures => 8, 
							AchievementTypes.AchievementType.SwampCreatures => 2, 
							AchievementTypes.AchievementType.MountainCreatures => 4, 
							AchievementTypes.AchievementType.PlainsCreatures => 16, 
							AchievementTypes.AchievementType.MistLandCreatures => 512, 
							AchievementTypes.AchievementType.AshLandCreatures => 32, 
							AchievementTypes.AchievementType.DeepNorthCreatures => 64, 
							AchievementTypes.AchievementType.OceanCreatures => 256, 
							_ => 0, 
						});
						if (1 == 0)
						{
						}
						Biome land = val4;
						List<Creatures.Data> biomeCreatures = CreatureLists.GetBiomeCreatures(land);
						foreach (Creatures.Data item4 in biomeCreatures)
						{
							AlmanacPlugin.AlmanacLogger.LogInfo((object)item4.m_prefabName);
						}
						AlmanacPlugin.AlmanacLogger.LogInfo((object)("Total: " + biomeCreatures.Count));
						break;
					}
					case AchievementTypes.AchievementType.CustomCreatureGroups:
					{
						if (args.Length < 4)
						{
							AlmanacPlugin.AlmanacLogger.LogWarning((object)"Missing key specifier, example: almanac achievement customcreaturegroup custom_brute_group");
							return true;
						}
						List<Creatures.Data> customCreatureGroup = CreatureLists.GetCustomCreatureGroup(args[3]);
						foreach (Creatures.Data item5 in customCreatureGroup)
						{
							AlmanacPlugin.AlmanacLogger.LogInfo((object)item5.m_prefabName);
						}
						AlmanacPlugin.AlmanacLogger.LogInfo((object)("Total: " + customCreatureGroup.Count));
						break;
					}
					case AchievementTypes.AchievementType.Fish:
					case AchievementTypes.AchievementType.Materials:
					case AchievementTypes.AchievementType.Consumables:
					case AchievementTypes.AchievementType.Weapons:
					case AchievementTypes.AchievementType.Swords:
					case AchievementTypes.AchievementType.Axes:
					case AchievementTypes.AchievementType.PoleArms:
					case AchievementTypes.AchievementType.Spears:
					case AchievementTypes.AchievementType.Maces:
					case AchievementTypes.AchievementType.Knives:
					case AchievementTypes.AchievementType.Shields:
					case AchievementTypes.AchievementType.Staves:
					case AchievementTypes.AchievementType.Arrows:
					case AchievementTypes.AchievementType.Bows:
					case AchievementTypes.AchievementType.Valuables:
					case AchievementTypes.AchievementType.Potions:
					case AchievementTypes.AchievementType.Trophies:
					{
						if (1 == 0)
						{
						}
						List<Items.Data> list = result switch
						{
							AchievementTypes.AchievementType.Fish => Items.GetFishes(), 
							AchievementTypes.AchievementType.Materials => Items.GetMaterials(), 
							AchievementTypes.AchievementType.Consumables => Items.GetConsumables(), 
							AchievementTypes.AchievementType.Weapons => Items.GetWeapons(), 
							AchievementTypes.AchievementType.Swords => Items.GetWeaponBySkill((SkillType)1), 
							AchievementTypes.AchievementType.Axes => Items.GetWeaponBySkill((SkillType)7), 
							AchievementTypes.AchievementType.PoleArms => Items.GetWeaponBySkill((SkillType)4), 
							AchievementTypes.AchievementType.Spears => Items.GetWeaponBySkill((SkillType)5), 
							AchievementTypes.AchievementType.Maces => Items.GetWeaponBySkill((SkillType)3), 
							AchievementTypes.AchievementType.Knives => Items.GetWeaponBySkill((SkillType)2), 
							AchievementTypes.AchievementType.Shields => Items.GetWeaponBySkill((SkillType)6), 
							AchievementTypes.AchievementType.Staves => Items.GetStaves(), 
							AchievementTypes.AchievementType.Arrows => Items.GetAmmunition(), 
							AchievementTypes.AchievementType.Bows => Items.GetWeaponBySkill((SkillType)8), 
							AchievementTypes.AchievementType.Valuables => Items.GetValuables(), 
							AchievementTypes.AchievementType.Potions => Items.GetPotions(), 
							AchievementTypes.AchievementType.Trophies => Items.GetTrophies(), 
							_ => new List<Items.Data>(), 
						};
						if (1 == 0)
						{
						}
						List<Items.Data> source2 = list;
						source2 = source2.Where((Items.Data x) => !Items.IsTool(x.m_item) || !Items.IsBait(x.m_item)).ToList();
						foreach (Items.Data item6 in source2)
						{
							AlmanacPlugin.AlmanacLogger.LogInfo((object)((Object)item6.m_item).name);
						}
						AlmanacPlugin.AlmanacLogger.LogInfo((object)("Total: " + source2.Count));
						break;
					}
					}
					return true;
				}, [<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)] () =>
				{
					List<AchievementTypes.AchievementType> source = new List<AchievementTypes.AchievementType>
					{
						AchievementTypes.AchievementType.MeadowCreatures,
						AchievementTypes.AchievementType.BlackForestCreatures,
						AchievementTypes.AchievementType.SwampCreatures,
						AchievementTypes.AchievementType.MountainCreatures,
						AchievementTypes.AchievementType.PlainsCreatures,
						AchievementTypes.AchievementType.MistLandCreatures,
						AchievementTypes.AchievementType.AshLandCreatures,
						AchievementTypes.AchievementType.DeepNorthCreatures,
						AchievementTypes.AchievementType.OceanCreatures,
						AchievementTypes.AchievementType.CustomCreatureGroups,
						AchievementTypes.AchievementType.Fish,
						AchievementTypes.AchievementType.Materials,
						AchievementTypes.AchievementType.Consumables,
						AchievementTypes.AchievementType.Weapons,
						AchievementTypes.AchievementType.Swords,
						AchievementTypes.AchievementType.Axes,
						AchievementTypes.AchievementType.PoleArms,
						AchievementTypes.AchievementType.Spears,
						AchievementTypes.AchievementType.Maces,
						AchievementTypes.AchievementType.Knives,
						AchievementTypes.AchievementType.Shields,
						AchievementTypes.AchievementType.Staves,
						AchievementTypes.AchievementType.Arrows,
						AchievementTypes.AchievementType.Bows,
						AchievementTypes.AchievementType.Valuables,
						AchievementTypes.AchievementType.Potions,
						AchievementTypes.AchievementType.Trophies
					};
					return source.Select((AchievementTypes.AchievementType x) => x.ToString()).ToList();
				});
				AlmanacCommand almanacCommand8 = new AlmanacCommand("reset", "clears almanac data from player save file", [<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)] (ConsoleEventArgs _) =>
				{
					if (!Object.op_Implicit((Object)(object)Player.m_localPlayer))
					{
						return false;
					}
					PlayerStats.m_records.m_picked.Clear();
					PlayerStats.m_records.m_kills.Clear();
					PlayerStats.m_records.m_deaths.Clear();
					Player.m_localPlayer.m_customData.Remove("AlmanacStats");
					Player.m_localPlayer.m_customData.Remove("AlmanacCollectedRewards");
					Player.m_localPlayer.m_customData.Remove("AlmanacAchievements");
					Player.m_localPlayer.m_customData.Remove("AlmanacRecords");
					EffectMan.Clear();
					AlmanacPlugin.AlmanacLogger.LogInfo((object)"Cleared Almanac Records from Player Save");
					return true;
				});
				AlmanacCommand almanacCommand9 = new AlmanacCommand("wipe", "clears player save file of recorded player stats", [<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)] (ConsoleEventArgs _) =>
				{
					if (!Object.op_Implicit((Object)(object)Game.instance) || Game.instance.m_playerProfile == null)
					{
						return false;
					}
					Game.instance.m_playerProfile.m_playerStats.m_stats.Clear();
					return true;
				});
				AlmanacCommand almanacCommand10 = new AlmanacCommand("current", "prints current session enemy stats and item craft stats", [<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)] (ConsoleEventArgs _) =>
				{
					if (!Object.op_Implicit((Object)(object)Game.instance) || Game.instance.m_playerProfile == null)
					{
						return false;
					}
					AlmanacPlugin.AlmanacLogger.LogInfo((object)"Enemy Stats");
					foreach (KeyValuePair<string, float> enemyStat in Game.instance.m_playerProfile.m_enemyStats)
					{
						Debug.Log((object)$"{enemyStat.Key}: {enemyStat.Value}");
					}
					AlmanacPlugin.AlmanacLogger.LogInfo((object)"Item Craft Stats");
					foreach (KeyValuePair<string, float> itemCraftStat in Game.instance.m_playerProfile.m_itemCraftStats)
					{
						Debug.Log((object)$"{itemCraftStat.Key}: {itemCraftStat.Value}");
					}
					return true;
				});
				AlmanacCommand almanacCommand11 = new AlmanacCommand("help", "list of almanac commands", [<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)] (ConsoleEventArgs _) =>
				{
					foreach (KeyValuePair<string, AlmanacCommand> command in m_commands)
					{
						AlmanacPlugin.AlmanacLogger.LogInfo((object)(command.Key + " - " + command.Value.m_description));
					}
					return true;
				});
			}
		}

		[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(0)]
		[HarmonyPatch(typeof(Terminal), "updateSearch")]
		private static class Terminal_UpdateSearch_Patch
		{
			private static bool Prefix(Terminal __instance, string word)
			{
				if ((Object)(object)__instance.m_search == (Object)null)
				{
					return true;
				}
				string[] array = ((TMP_InputField)__instance.m_input).text.Split(new char[1] { ' ' });
				if (array.Length < 3)
				{
					return true;
				}
				if (array[0] != "almanac")
				{
					return true;
				}
				return HandleSearch(__instance, word, array);
			}

			private static bool HandleSearch(Terminal __instance, string word, string[] strArray)
			{
				if (!m_commands.TryGetValue(strArray[1], out var value))
				{
					return true;
				}
				if (value.HasOptions() && strArray.Length == 3)
				{
					List<string> list = value.FetchOptions();
					string currentSearch = strArray[2];
					List<string> list2;
					if (!Utility.IsNullOrWhiteSpace(currentSearch))
					{
						int num = list.IndexOf(currentSearch);
						list2 = ((num != -1) ? list.GetRange(num, list.Count - num) : list);
						list2 = list2.FindAll((string x) => x.ToLower().Contains(currentSearch.ToLower()));
					}
					else
					{
						list2 = list;
					}
					if (list2.Count <= 0)
					{
						__instance.m_search.text = value.m_description;
					}
					else
					{
						__instance.m_lastSearch.Clear();
						__instance.m_lastSearch.AddRange(list2);
						__instance.m_lastSearch.Remove(word);
						__instance.m_search.text = "";
						int num2 = 10;
						int num3 = Math.Min(__instance.m_lastSearch.Count, num2);
						for (int i = 0; i < num3; i++)
						{
							string text = __instance.m_lastSearch[i];
							TMP_Text search = __instance.m_search;
							search.text = search.text + text + " ";
						}
						if (__instance.m_lastSearch.Count <= num2)
						{
							return false;
						}
						int num4 = __instance.m_lastSearch.Count - num2;
						TMP_Text search2 = __instance.m_search;
						search2.text += $"... {num4} more.";
					}
				}
				else
				{
					__instance.m_search.text = value.m_description;
				}
				return false;
			}
		}

		[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(0)]
		private class AlmanacCommand
		{
			public readonly string m_input;

			public readonly string m_description;

			private readonly bool m_isSecret;

			private readonly bool m_adminOnly;

			private readonly Func<ConsoleEventArgs, bool> m_command;

			[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(new byte[] { 2, 1, 1 })]
			private readonly Func<List<string>> m_optionFetcher;

			public bool Run(ConsoleEventArgs args)
			{
				return !IsAdmin() || m_command(args);
			}

			private bool IsAdmin()
			{
				if (!m_adminOnly || ZNet.m_instance.LocalPlayerIsAdminOrHost())
				{
					return true;
				}
				AlmanacPlugin.AlmanacLogger.LogWarning((object)"Admin only command");
				return false;
			}

			public bool IsSecret()
			{
				return m_isSecret;
			}

			public List<string> FetchOptions()
			{
				return (m_optionFetcher == null) ? new List<string>() : m_optionFetcher();
			}

			public bool HasOptions()
			{
				return m_optionFetcher != null;
			}

			[Description("Register a custom command with the prefix almanac")]
			public AlmanacCommand(string input, string description, Func<ConsoleEventArgs, bool> command, [<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(new byte[] { 2, 1, 1 })] Func<List<string>> optionsFetcher = null, bool isSecret = false, bool adminOnly = false)
			{
				m_input = input;
				m_description = description;
				m_command = command;
				m_isSecret = isSecret;
				m_commands[m_input] = this;
				m_optionFetcher = optionsFetcher;
				m_adminOnly = adminOnly;
			}
		}

		private static readonly Dictionary<string, AlmanacCommand> m_commands = new Dictionary<string, AlmanacCommand>();
	}
	[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(0)]
	[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
	public static class Assets
	{
		public static Transform TrophiesFrame;

		public static TMP_FontAsset NorseFont;

		public static TMP_FontAsset NorseFontBold;

		public static TextMeshProUGUI TopicTextMeshPro;

		public static ButtonSfx ButtonSFX;

		public static Image ButtonImage;

		public static Button ButtonComponent;

		public static Image TrophyImage;

		public static Image WoodPanel;

		public static Sprite m_woodPanel;

		public static Image BraidLeft;

		public static Image BraidRight;

		public static Material LitHud;

		public static Sprite InputFieldBkg;

		public static void Cache()
		{
			TrophiesFrame = Utils.FindChild(((Component)InventoryGui.instance).transform, "TrophiesFrame", (IterativeSearchType)0);
			Transform val = Utils.FindChild(TrophiesFrame, "Closebutton", (IterativeSearchType)0);
			Transform val2 = ((Component)InventoryGui.m_instance).transform.Find("root/Trophies/TrophiesFrame/border (1)");
			Transform val3 = Utils.FindChild(TrophiesFrame, "topic", (IterativeSearchType)0);
			Transform val4 = Utils.FindChild(TrophiesFrame, "Text", (IterativeSearchType)0);
			Transform val5 = Utils.FindChild(TrophiesFrame, "icon_bkg", (IterativeSearchType)0);
			InputFieldBkg = ((Component)((Component)InventoryGui.instance).transform.Find("root/Trophies/TrophiesFrame/Trophies/TrophyList")).GetComponent<Image>().sprite;
			NorseFont = ((TMP_Text)((Component)val4).GetComponent<TextMeshProUGUI>()).font;
			TopicTextMeshPro = ((Component)val3).GetComponent<TextMeshProUGUI>();
			NorseFontBold = ((TMP_Text)TopicTextMeshPro).font;
			ButtonSFX = ((Component)val).GetComponent<ButtonSfx>();
			ButtonImage = ((Component)val).GetComponent<Image>();
			ButtonComponent = ((Component)val).GetComponent<Button>();
			TrophyImage = ((Component)val5).GetComponent<Image>();
			WoodPanel = ((Component)val2).GetComponent<Image>();
			m_woodPanel = WoodPanel.sprite;
			LitHud = ((Graphic)WoodPanel).material;
			BraidLeft = ((Component)((Component)InventoryGui.instance.m_info).transform.Find("TitlePanel/BraidLineHorisontalMedium (1)")).GetComponent<Image>();
			BraidRight = ((Component)((Component)InventoryGui.instance.m_info).transform.Find("TitlePanel/BraidLineHorisontalMedium (2)")).GetComponent<Image>();
		}
	}
	[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
	[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(0)]
	public static class Helpers
	{
		public static readonly Color32 OrangeColor = new Color32(byte.MaxValue, (byte)164, (byte)0, byte.MaxValue);

		public static string ConvertSkills(SkillType type)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected I4, but got Unknown
			//IL_0049: 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_007e: Expected I4, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Invalid comparison between Unknown and I4
			if (1 == 0)
			{
			}
			string result;
			switch ((int)type)
			{
			default:
				switch (type - 100)
				{
				case 0:
					goto IL_0112;
				case 1:
					goto IL_011a;
				case 2:
					goto IL_0122;
				case 3:
					goto IL_012a;
				case 4:
					goto IL_0132;
				case 10:
					goto IL_013a;
				case 5:
				case 6:
				case 7:
				case 8:
				case 9:
					goto IL_014a;
				}
				if ((int)type != 999)
				{
					goto IL_014a;
				}
				result = "$skill_all";
				break;
			case 0:
				result = "$text_none";
				break;
			case 1:
				result = "$skill_swords";
				break;
			case 2:
				result = "$skill_knives";
				break;
			case 3:
				result = "$skill_clubs";
				break;
			case 4:
				result = "$skill_polearms";
				break;
			case 5:
				result = "$skill_spears";
				break;
			case 6:
				result = "$skill_shields";
				break;
			case 7:
				result = "$skill_axes";
				break;
			case 8:
				result = "$skill_bows";
				break;
			case 9:
				result = "$skill_elementalmagic";
				break;
			case 10:
				result = "$skill_bloodmagic";
				break;
			case 11:
				result = "$skill_unarmed";
				break;
			case 13:
				result = "$skill_woodcutting";
				break;
			case 14:
				result = "$skill_crossbows";
				break;
			case 12:
				goto IL_014a;
				IL_013a:
				result = "$skill_ride";
				break;
				IL_0132:
				result = "$skill_fishing";
				break;
				IL_012a:
				result = "$skill_swim";
				break;
				IL_0122:
				result = "$skill_run";
				break;
				IL_011a:
				result = "$skill_sneak";
				break;
				IL_0112:
				result = "$skill_jump";
				break;
				IL_014a:
				result = "Unknown Skill";
				break;
			}
			if (1 == 0)
			{
			}
			return result;
		}

		public static string ConvertBoolean(bool input)
		{
			if (1 == 0)
			{
			}
			string result = ((!input) ? "$text_false" : "$text_true");
			if (1 == 0)
			{
			}
			return result;
		}

		public static string ConvertEffectModifiers(EffectMan.Modifier type)
		{
			if (1 == 0)
			{
			}
			string result = type switch
			{
				EffectMan.Modifier.None => "$text_none", 
				EffectMan.Modifier.Attack => "$se_attack", 
				EffectMan.Modifier.HealthRegen => "$se_healthregen", 
				EffectMan.Modifier.StaminaRegen => "$se_staminaregen", 
				EffectMan.Modifier.RaiseSkills => "$se_raiseskill", 
				EffectMan.Modifier.Speed => "$se_speed", 
				EffectMan.Modifier.Noise => "$se_noisemod", 
				EffectMan.Modifier.MaxCarryWeight => "$se_max_carryweight", 
				EffectMan.Modifier.Stealth => "$se_stealth", 
				EffectMan.Modifier.RunStaminaDrain => "$se_runstamina", 
				EffectMan.Modifier.DamageReduction => "$se_damagereduction", 
				EffectMan.Modifier.FallDamage => "$item_falldamage", 
				EffectMan.Modifier.EitrRegen => "$se_eitrregen", 
				EffectMan.Modifier.Health => "$se_health", 
				EffectMan.Modifier.Stamina => "$se_stamina", 
				EffectMan.Modifier.Eitr => "$se_eitr", 
				EffectMan.Modifier.LifeSteal => "$se_lifesteal", 
				EffectMan.Modifier.Armor => "$item_armor", 
				_ => "$text_none", 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		public static string SplitCamelCase(string input)
		{
			string input2 = Regex.Replace(input, "([A-Z])", " $1");
			input2 = Regex.Replace(input2, "([A-Z]+)([A-Z][a-z])", "$1 $2");
			return input2.TrimStart(Array.Empty<char>());
		}
	}
	[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(0)]
	[PublicAPI]
	[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
	public class Localizer
	{
		private static readonly Dictionary<string, Dictionary<string, Func<string>>> PlaceholderProcessors;

		private static readonly Dictionary<string, Dictionary<string, string>> loadedTexts;

		private static readonly ConditionalWeakTable<Localization, string> localizationLanguage;

		private static readonly List<WeakReference<Localization>> localizationObjects;

		[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(2)]
		private static BaseUnityPlugin _plugin;

		private static readonly List<string> fileExtensions;

		private static BaseUnityPlugin plugin
		{
			get
			{
				//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Expected O, but got Unknown
				if (_plugin == null)
				{
					IEnumerable<TypeInfo> source;
					try
					{
						source = Assembly.GetExecutingAssembly().DefinedTypes.ToList();
					}
					catch (ReflectionTypeLoadException ex)
					{
						source = from t in ex.Types
							where t != null
							select t.GetTypeInfo();
					}
					_plugin = (BaseUnityPlugin)Chainloader.ManagerObject.GetComponent((Type)source.First([<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(0)] (TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t)));
				}
				return _plugin;
			}
		}

		private static void UpdatePlaceholderText(Localization localization, string key)
		{
			localizationLanguage.TryGetValue(localization, out var value);
			string text = loadedTexts[value][key];
			if (PlaceholderProcessors.TryGetValue(key, out var value2))
			{
				text = value2.Aggregate(text, [<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(0)] (string current, KeyValuePair<string, Func<string>> kv) => current.Replace("{" + kv.Key + "}", kv.Value()));
			}
			localization.AddWord(key, text);
		}

		public static void AddPlaceholder<T>(string key, string placeholder, ConfigEntry<T> config, [<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(new byte[] { 2, 1, 1 })] Func<T, string> convertConfigValue = null)
		{
			if (convertConfigValue == null)
			{
				convertConfigValue = [<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(0)] [return: <2143be97-af53-4a5a-8697-a04eada779f2>Nullable(1)] (T val) => val.ToString();
			}
			if (!PlaceholderProcessors.ContainsKey(key))
			{
				PlaceholderProcessors[key] = new Dictionary<string, Func<string>>();
			}
			config.SettingChanged += [<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(0)] (object _, EventArgs _) =>
			{
				UpdatePlaceholder();
			};
			if (loadedTexts.ContainsKey(Localization.instance.GetSelectedLanguage()))
			{
				UpdatePlaceholder();
			}
			void UpdatePlaceholder()
			{
				PlaceholderProcessors[key][placeholder] = () => convertConfigValue(config.Value);
				UpdatePlaceholderText(Localization.instance, key);
			}
		}

		public static void AddText(string key, string text)
		{
			List<WeakReference<Localization>> list = new List<WeakReference<Localization>>();
			foreach (WeakReference<Localization> localizationObject in localizationObjects)
			{
				if (localizationObject.TryGetTarget(out var target))
				{
					Dictionary<string, string> dictionary = loadedTexts[localizationLanguage.GetOrCreateValue(target)];
					if (!target.m_translations.ContainsKey(key))
					{
						dictionary[key] = text;
						target.AddWord(key, text);
					}
				}
				else
				{
					list.Add(localizationObject);
				}
			}
			foreach (WeakReference<Localization> item in list)
			{
				localizationObjects.Remove(item);
			}
		}

		public static void Load()
		{
			LoadLocalization(Localization.instance, Localization.instance.GetSelectedLanguage());
		}

		private static void LoadLocalization(Localization __instance, string language)
		{
			if (!localizationLanguage.Remove(__instance))
			{
				localizationObjects.Add(new WeakReference<Localization>(__instance));
			}
			localizationLanguage.Add(__instance, language);
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			foreach (string item in from f in Directory.GetFiles(Path.GetDirectoryName(Paths.PluginPath), plugin.Info.Metadata.Name + ".*", SearchOption.AllDirectories)
				where fileExtensions.IndexOf(Path.GetExtension(f)) >= 0
				select f)
			{
				string text = Path.GetFileNameWithoutExtension(item).Split(new char[1] { '.' })[1];
				if (dictionary.ContainsKey(text))
				{
					Debug.LogWarning((object)("Duplicate key " + text + " found for " + plugin.Info.Metadata.Name + ". The duplicate file found at " + item + " will be skipped."));
				}
				else
				{
					dictionary[text] = item;
				}
			}
			byte[] array = LoadTranslationFromAssembly("English");
			if (array == null)
			{
				throw new Exception("Found no English localizations in mod " + plugin.Info.Metadata.Name + ". Expected an embedded resource translations/English.json or translations/English.yml.");
			}
			Dictionary<string, string> dictionary2 = new DeserializerBuilder().IgnoreFields().Build().Deserialize<Dictionary<string, string>>(Encoding.UTF8.GetString(array));
			if (dictionary2 == null)
			{
				throw new Exception("Localization for mod " + plugin.Info.Metadata.Name + " failed: Localization file was empty.");
			}
			string text2 = null;
			if (language != "English")
			{
				if (dictionary.ContainsKey(language))
				{
					text2 = File.ReadAllText(dictionary[language]);
				}
				else
				{
					byte[] array2 = LoadTranslationFromAssembly(language);
					if (array2 != null)
					{
						text2 = Encoding.UTF8.GetString(array2);
					}
				}
			}
			if (text2 == null && dictionary.ContainsKey("English"))
			{
				text2 = File.ReadAllText(dictionary["English"]);
			}
			if (text2 != null)
			{
				foreach (KeyValuePair<string, string> item2 in new DeserializerBuilder().IgnoreFields().Build().Deserialize<Dictionary<string, string>>(text2) ?? new Dictionary<string, string>())
				{
					dictionary2[item2.Key] = item2.Value;
				}
			}
			loadedTexts[language] = dictionary2;
			foreach (KeyValuePair<string, string> item3 in dictionary2)
			{
				UpdatePlaceholderText(__instance, item3.Key);
			}
		}

		static Localizer()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			PlaceholderProcessors = new Dictionary<string, Dictionary<string, Func<string>>>();
			loadedTexts = new Dictionary<string, Dictionary<string, string>>();
			localizationLanguage = new ConditionalWeakTable<Localization, string>();
			localizationObjects = new List<WeakReference<Localization>>();
			fileExtensions = new List<string> { ".json", ".yml" };
			Harmony val = new Harmony("org.bepinex.helpers.LocalizationManager");
			val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Localization), "LoadCSV", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Localizer), "LoadLocalization", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		[return: <2143be97-af53-4a5a-8697-a04eada779f2>Nullable(2)]
		private static byte[] LoadTranslationFromAssembly(string language)
		{
			foreach (string fileExtension in fileExtensions)
			{
				byte[] array = ReadEmbeddedFileBytes("translations." + language + fileExtension);
				if (array != null)
				{
					return array;
				}
			}
			return null;
		}

		[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(2)]
		public static byte[] ReadEmbeddedFileBytes([<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(1)] string resourceFileName, Assembly containingAssembly = null)
		{
			using MemoryStream memoryStream = new MemoryStream();
			if ((object)containingAssembly == null)
			{
				containingAssembly = Assembly.GetCallingAssembly();
			}
			string text = containingAssembly.GetManifestResourceNames().FirstOrDefault([<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(0)] (string str) => str.EndsWith(resourceFileName, StringComparison.Ordinal));
			if (text != null)
			{
				containingAssembly.GetManifestResourceStream(text)?.CopyTo(memoryStream);
			}
			return (memoryStream.Length == 0L) ? null : memoryStream.ToArray();
		}
	}
	[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(2)]
	[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(0)]
	public static class SpriteManager
	{
		public static readonly Sprite AlmanacIcon = RegisterSprite("AlmanacIconButton.png");

		private static readonly Sprite boneSkullIcon = RegisterSprite("bone_skull.png");

		private static readonly Sprite swordBasicBlueIcon = RegisterSprite("sword_basic_blue.png");

		private static readonly Sprite swordBasicBrownIcon = RegisterSprite("sword_basic4_blue.png");

		private static readonly Sprite arrowBasicIcon = RegisterSprite("arrow_basic.png");

		private static readonly Sprite capeHoodIcon = RegisterSprite("cape_hood_darkyellow.png");

		private static readonly Sprite bottleStandardEmptyIcon = RegisterSprite("bottle_standard_empty.png");

		private static readonly Sprite bottleStandardBlueIcon = RegisterSprite("bottle_standard_blue.png");

		private static readonly Sprite fishGreenIcon = RegisterSprite("fish_green.png");

		private static readonly Sprite bowWoodIcon = RegisterSprite("bow_wood1.png");

		private static readonly Sprite necklaceSilverRed = RegisterSprite("necklace_silver_red.png");

		private static readonly Sprite mushroomBigRedIcon = RegisterSprite("mushroom_big_red.png");

		private static readonly Sprite goldCoinsPileIcon = RegisterSprite("gold_coins_many.png");

		private static readonly Sprite keySilverIcon = RegisterSprite("key_silver.png");

		private static readonly Sprite boneWhiteIcon = RegisterSprite("bone_white.png");

		public static readonly Sprite bookClosedRedIcon = RegisterSprite("book_closed_red.png");

		private static readonly Sprite bottleStandardGreenIcon = RegisterSprite("bottle_standard_green.png");

		public static readonly Sprite crownGoldIcon = RegisterSprite("crown_gold.png");

		private static readonly Sprite gemDiamondRedIcon = RegisterSprite("gem_diamond_red.png");

		private static readonly Sprite goldBarsIcon = RegisterSprite("gold_bars_three.png");

		private static readonly Sprite scrollMapIcon = RegisterSprite("scroll_map2.png");

		private static readonly Sprite shieldBasicIcon = RegisterSprite("shield_basic_metal.png");

		private static readonly Sprite silverBarsIcon = RegisterSprite("silver_bars.png");

		private static readonly Sprite silverCoinsIcon = RegisterSprite("silver_coins_many.png");

		private static readonly Sprite woodLogIcon = RegisterSprite("wood_log.png");

		private static readonly Sprite woodLogsIcon = RegisterSprite("wood_logs_three.png");

		private static readonly Sprite ringGoldMagic = RegisterSprite("ring_gold_magic.png");

		public static readonly Sprite Checkmark = RegisterSprite("Checkmark.png");

		public static readonly Sprite FlatDaggers = RegisterSprite("Daggers_Icon.png");

		public static readonly Sprite DropdownArrow = RegisterSprite("arrowdrop.png", "assets");

		public static readonly Sprite ToggleOn = RegisterSprite("toggleOn.png", "assets");

		public static readonly Sprite ToggleOff = RegisterSprite("toggleOff.png", "assets");

		[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
		public static bool GetSprite(string name, [<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(2)] out Sprite sprite)
		{
			if (1 == 0)
			{
			}
			Sprite val = (Sprite)(name switch
			{
				"skull" => boneSkullIcon, 
				"sword_blue" => swordBasicBlueIcon, 
				"sword_brown" => swordBasicBrownIcon, 
				"arrow" => arrowBasicIcon, 
				"hood" => capeHoodIcon, 
				"bottle_empty" => bottleStandardEmptyIcon, 
				"bottle_blue" => bottleStandardBlueIcon, 
				"bottle_green" => bottleStandardGreenIcon, 
				"fish" => fishGreenIcon, 
				"bow" => bowWoodIcon, 
				"necklace" => necklaceSilverRed, 
				"mushroom" => mushroomBigRedIcon, 
				"coins_gold" => goldCoinsPileIcon, 
				"key" => keySilverIcon, 
				"bone" => boneWhiteIcon, 
				"book" => bookClosedRedIcon, 
				"crown" => crownGoldIcon, 
				"gem" => gemDiamondRedIcon, 
				"gold" => goldBarsIcon, 
				"map" => scrollMapIcon, 
				"shield" => shieldBasicIcon, 
				"silver" => silverBarsIcon, 
				"coins_silver" => silverCoinsIcon, 
				"log" => woodLogIcon, 
				"log_stack" => woodLogsIcon, 
				"ring" => ringGoldMagic, 
				"checkmark" => Checkmark, 
				_ => null, 
			});
			if (1 == 0)
			{
			}
			sprite = val;
			return Object.op_Implicit((Object)(object)sprite);
		}

		[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
		[return: <2143be97-af53-4a5a-8697-a04eada779f2>Nullable(2)]
		private static Sprite RegisterSprite(string fileName, string folderName = "icons")
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string name = "Almanac." + folderName + "." + fileName;
			using Stream stream = executingAssembly.GetManifestResourceStream(name);
			if (stream == null)
			{
				return null;
			}
			byte[] array = new byte[stream.Length];
			int num = stream.Read(array, 0, array.Length);
			Texture2D val = new Texture2D(2, 2);
			return ImageConversion.LoadImage(val, array) ? Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), Vector2.zero) : null;
		}
	}
}
namespace Almanac.UI
{
	[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
	[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(0)]
	public class AlmanacElement : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IPointerClickHandler
	{
		public static readonly List<AlmanacElement> m_instances = new List<AlmanacElement>();

		public Image m_bkg = null;

		public Image m_icon = null;

		public Image m_iconBgk = null;

		public TextMeshProUGUI m_name = null;

		public TextMeshProUGUI m_desc = null;

		public Color m_nameBaseColor;

		public AlmanacUI.ElementData m_data = null;

		public string m_localizedName = "";

		public AlmanacUI.Element m_element = null;

		public bool m_interactable = true;

		public bool m_loaded;

		public void Awake()
		{
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			if (!m_loaded)
			{
				m_bkg = ((Component)((Component)this).transform.Find("bkg")).GetComponent<Image>();
				((Component)m_bkg).gameObject.SetActive(true);
				m_iconBgk = ((Component)((Component)this).transform.Find("icon_bkg")).GetComponent<Image>();
				m_icon = ((Component)((Component)m_iconBgk).transform.Find("icon")).GetComponent<Image>();
				m_name = ((Component)((Component)this).transform.Find("name")).GetComponent<TextMeshProUGUI>();
				m_desc = ((Component)((Component)this).transform.Find("description")).GetComponent<TextMeshProUGUI>();
				m_nameBaseColor = ((Graphic)m_name).color;
				m_instances.Add(this);
				SetBackground(enable: false);
				m_loaded = true;
			}
		}

		public void OnDestroy()
		{
			m_instances.Remove(this);
			AlmanacUI.m_elements.Remove(m_element);
		}

		public void Setup(AlmanacUI.ElementData data)
		{
			if (!m_loaded)
			{
				Awake();
			}
			m_data = data;
			SetIcon(data.m_icon, data.m_isKnown);
			SetName(data.m_name, data.m_isKnown || data.m_type == AlmanacUI.ElementData.ReferenceType.Achievement);
			SetDescription(data.m_desc, data.m_isKnown || data.m_type == AlmanacUI.ElementData.ReferenceType.Achievement);
			UpdateBackground();
			m_interactable = data.m_isKnown;
		}

		public void UpdateBackground()
		{
			if (m_data.m_achievement != null && !((Object)(object)m_data.m_achievement.m_statusEffect == (Object)null))
			{
				SetBackground(EffectMan.ActiveAchievementEffects.Contains(m_data.m_achievement.m_statusEffect));
			}
		}

		[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(2)]
		public void SetIcon(Sprite icon, bool known)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			m_icon.sprite = icon;
			((Graphic)m_icon).color = (known ? Color.white : Color.black);
		}

		public void SetName(string text, bool known)
		{
			m_localizedName = Localization.instance.Localize(text);
			((TMP_Text)m_name).text = (known ? m_localizedName : "???");
		}

		public void SetDescription(string text, bool known)
		{
			((TMP_Text)m_desc).text = (known ? Localization.instance.Localize(text) : "???");
		}

		public void SetBackground(bool enable)
		{
			//IL_0016: 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_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)m_bkg).color = (enable ? AlmanacPlugin._OutlineColor.Value : Color.clear);
			((Graphic)m_name).color = (enable ? Color.white : m_nameBaseColor);
		}

		public void OnPointerEnter(PointerEventData eventData)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = ((Component)m_iconBgk).transform;
			transform.localScale *= 1.15f;
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = ((Component)m_iconBgk).transform;
			transform.localScale /= 1.15f;
		}

		public void OnPointerClick(PointerEventData eventData)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Invalid comparison between Unknown and I4
			AlmanacUI.ElementData.ReferenceType type = m_data.m_type;
			bool flag = ((type == AlmanacUI.ElementData.ReferenceType.Item || type == AlmanacUI.ElementData.ReferenceType.Piece) ? true : false);
			if (flag && !m_interactable)
			{
				SidePanel.m_instance.ShowMetrics();
				return;
			}
			if (m_data.m_type == AlmanacUI.ElementData.ReferenceType.Achievement && (int)eventData.button == 1 && m_data.m_achievement != null && m_data.m_achievement.IsComplete())
			{
				m_data.m_achievement.Collect();
			}
			SidePanel.m_instance.Setup(new SidePanel.PanelData(m_data));
		}

		public static void UpdateBackgrounds()
		{
			foreach (AlmanacElement instance in m_instances)
			{
				instance.UpdateBackground();
			}
		}
	}
	[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
	[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(0)]
	public class AlmanacUI : MonoBehaviour
	{
		[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(0)]
		public class Element
		{
			public readonly GameObject m_go;

			public readonly string m_text;

			public readonly ElementData m_data;

			public Element(GameObject go, string text, ElementData data)
			{
				m_go = go;
				m_text = text;
				m_data = data;
				m_elements.Add(this);
			}
		}

		[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(0)]
		public class ElementData
		{
			[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(0)]
			public enum ReferenceType
			{
				Item,
				Creature,
				Piece,
				Treasure,
				Bounty,
				Achievement
			}

			public readonly string m_name;

			public readonly string m_desc;

			[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(2)]
			public readonly Sprite m_icon;

			public readonly bool m_isKnown;

			public readonly ReferenceType m_type;

			[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(2)]
			public readonly Items.Data m_item;

			[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(2)]
			public readonly BuildPieces.PieceData m_pieceData;

			[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(2)]
			public readonly Creatures.Data m_critterData;

			[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(2)]
			public readonly Almanac.TreasureHunt.Data.Treasure m_treasure;

			[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(2)]
			public readonly Almanac.Bounties.Data.ValidatedBounty m_bounty;

			[<2143be97-af53-4a5a-8697-a04eada779f2>Nullable(2)]
			public readonly AchievementManager.Achievement m_achievement;

			public ElementData(Almanac.Bounties.Data.ValidatedBounty data)
			{
				m_bounty = data;
				m_name = data.m_creatureName;
				m_desc = ((object)(Biome)(ref data.m_biome)).ToString();
				m_icon = data.m_icon;
				m_type = ReferenceType.Bounty;
				m_isKnown = PlayerStats.m_records.m_kills.ContainsKey(((Object)data.m_critter).name);
			}

			public ElementData(Almanac.TreasureHunt.Data.Treasure data)
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				m_treasure = data;
				m_name = data.m_name;
				Biome biome = data.m_biome;
				m_desc = ((object)(Biome)(ref biome)).ToString();
				m_icon = data.m_sprite;
				m_type = ReferenceType.Treasure;
				m_isKnown = Player.m_localPlayer.IsBiomeKnown(data.m_biome);
			}

			public ElementData(AchievementManager.Achievement data)
			{
				data.Check();
				m_achievement = data;
				m_name = data.GetDisplayName();
				m_desc = data.GetDescription();
				m_icon = data.GetIcon();
				m_isKnown = data.IsComplete();
				m_type = ReferenceType.Achievement;
			}

			public ElementData(Creatures.Data data)
			{
				m_type = ReferenceType.Creature;
				m_critterData = data;
				m_name = data.m_name;
				m_desc = data.m_defeatKey;
				m_icon = data.GetIcon();
				m_isKnown = ZoneSystem.instance.GetGlobalKeys().Contains(data.m_defeatKey) || ZoneSystem.instance.GetGlobalKey(data.m_defeatKey) || AlmanacPlugin._KnowledgeWall.Value == AlmanacPlugin.Toggle.Off || Player.m_localPlayer.NoCostCheat();
			}

			public ElementData(Items.Data data)
			{
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Invalid comparison between Unknown and I4
				m_type = ReferenceType.Item;
				m_item = data;
				m_name = data.m_item.m_itemData.m_shared.m_name;
				m_desc = (((int)data.m_item.m_itemData.m_shared.m_itemType == 13) ? (data.m_item.m_itemData.m_shared.m_name + "_lore") : data.m_item.m_itemData.m_shared.m_description);
				m_icon = data.GetIcon();
				m_isKnown = AlmanacPlugin._KnowledgeWall.Value == AlmanacPlugin.Toggle.Off || Player.m_localPlayer.IsKnownMaterial(data.m_item.m_itemData.m_shared.m_name) || Player.m_localPlayer.NoCostCheat();
			}

			public ElementData(BuildPieces.PieceData data)
			{
				m_type = ReferenceType.Piece;
				m_pieceData = data;
				m_name = data.m_piece.m_name;
				if (BuildPieces.m_localizeOverride.TryGetValue(((Object)data.m_piece).name, out var value))
				{
					m_name = value;
				}
				m_desc = data.m_piece.m_description;
				m_icon = data.m_piece.m_icon;
				m_isKnown = AlmanacPlugin._KnowledgeWall.Value == AlmanacPlugin.Toggle.Off || Player.m_localPlayer.IsRecipeKnown(data.m_piece.m_name) || Player.m_localPlayer.NoCostCheat();
			}
		}

		[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(0)]
		[HarmonyPatch(typeof(InventoryGui), "OnOpenTrophies")]
		private static class UpdateAlmanacAssets
		{
			[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
			private static void Postfix(InventoryGui __instance)
			{
				if (Object.op_Implicit((Object)(object)__instance))
				{
					m_instance.OnOpen();
				}
			}
		}

		[HarmonyPatch(typeof(InventoryGui), "OnCloseTrophies")]
		[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(0)]
		private static class DestroyAlmanacAssets
		{
			[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
			private static void Postfix(InventoryGui __instance)
			{
				if (Object.op_Implicit((Object)(object)__instance))
				{
					m_instance.OnClose();
				}
			}
		}

		[HarmonyPatch(typeof(InventoryGui), "UpdateTrophyList")]
		[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(0)]
		private static class UpdateTrophyListPatch
		{
			private static bool Prefix()
			{
				m_instance.UpdateList();
				return false;
			}
		}

		[HarmonyPatch(typeof(InventoryGui), "Awake")]
		[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(0)]
		private static class InventoryGUI_Awake_Patch
		{
			[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(1)]
			private static void Postfix(InventoryGui __instance)
			{
				Assets.Cache();
				((Component)__instance).gameObject.AddComponent<AlmanacUI>().Init();
				Transform val = Utils.FindChild(((Component)__instance.m_inventoryRoot).transform, "Info", (IterativeSearchType)0);
				Transform val2 = Utils.FindChild(val, "Trophies", (IterativeSearchType)0);
				Transform val3 = Utils.FindChild(val2, "Image", (IterativeSearchType)0);
				UITooltip val4 = default(UITooltip);
				if (((Component)val2).TryGetComponent<UITooltip>(ref val4))
				{
					val4.m_text = "$title_almanac";
				}
				Image val5 = default(Image);
				if (((Component)val3).TryGetComponent<Image>(ref val5))
				{
					val5.sprite = SpriteManager.AlmanacIcon;
				}
			}
		}

		[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(0)]
		[HarmonyPatch(typeof(PlayerController), "FixedUpdate")]
		private static class PlayerControllerOverride
		{
			private static bool Prefix()
			{
				return !IsTrophyPanelActive();
			}
		}

		[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(0)]
		[HarmonyPatch(typeof(ZInput), "GetButtonDown")]
		private static class ZInputPatch
		{
			private static bool Prefix()
			{
				return !IsTrophyPanelActive();
			}
		}

		[<fb7ef35b-7515-4cea-86da-528618495a61>NullableContext(0)]
		[HarmonyPatch(typeof(InventoryGui), "Hide")]
		private static class AlmanacHidePatch
		{
			private static void Postfix()
			{
				if (Object.op_Implicit((Object)(object)m_instance))
				{
					m_instance.OnClose();
				}
			}
		}

		public static readonly List<Element> m_elements = new List<Element>();

		public static AlmanacUI m_instance = null;

		public static GameObject m_element = null;

		public static GameObject m_buttonElement = null;

		public Dictionary<string, Func<List<ElementData>>> m_options = new Dictionary<string, Func<List<ElementData>>>();

		public RectTransform m_listRoot = null;

		public Scrollbar m_scrollbar = null;

		public GridLayoutGroup m_gridLayoutGroup = null;

		public Dropdown m_dropdown = null;

		public InputField m_searchField = null;

		public RectTransform m_dropdownTemplate = null;

		public Image m_background = null;

		public Vector2 m_panelPos = new Vector2(-220f, 0f);

		public Vector2 m_spacing = new Vector2(30f, 30f);

		public Vector2 m_cellSize = new Vector2(180f, 180f);

		public float m_listHeight = 650f;

		public float m_elementHeight = 210f;

		public float m_creatureHeight = 45f;

		public Vector2 m_creatureSpacing = new Vector2(5f, 5f);

		public Vector2 m_creatureCellSize = new Vector2(310f, 40f);

		public string m_selectedTab = "";

		public Toggle m_toggle = null;

		public Image m_toggleImage = null;

		public Text m_toggleText = null;

		public Image m_dropdownImg = null;

		public Image m_templateImg = null;

		public Image m_searchFieldImg = null;

		public GameObject m_craftingPanel = null;

		public GameObject m_inventoryPanel = null;

		public GameObject m_containerPanel = null;

		public GameObject m_infoPanel = null;

		public bool m_visible;

		public void Update()
		{
			if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && Object.op_Implicit((Object)(object)m_instance) && (Input.GetKeyDown((KeyCode)27) || Input.GetKeyDown((KeyCode)9) || ((Character)Player.m_localPlayer).IsDead()))
			{
				OnClose();
			}
		}

		public void Toggle()
		{
			if (!m_visible)
			{
				InventoryGui.m_instance.Show((Container)null, 1);
				InventoryGui.m_instance.OnOpenTrophies();
			}
			else
			{
				InventoryGui.m_instance.Hide();
			}
		}

		public void Init()
		{
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			m_craftingPanel = ((Component)((Component)this).transform.Find("root/Crafting")).gameObject;
			m_inventoryPanel = ((Component)((Component)this).transform.Find("root/Player")).gameObject;
			m_containerPanel = ((Component)((C