Decompiled source of VRPCrafts v0.0.1

files/plugins/VRPCrafts.dll

Decompiled a week 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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using JetBrains.Annotations;
using Jotunn;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using ServerSync;
using SimpleJson;
using TMPro;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
using VRPCrafts.Constants;
using VRPCrafts.Data;
using VRPCrafts.Helpers;
using VRPCrafts.Patches;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Core.ObjectPool;
using YamlDotNet.Core.Tokens;
using YamlDotNet.Helpers;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.BufferedDeserialization;
using YamlDotNet.Serialization.BufferedDeserialization.TypeDiscriminators;
using YamlDotNet.Serialization.Callbacks;
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.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("VRPCrafts")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("VRPCrafts")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4358610B-F3F4-4843-B7AF-98B7BC60DCDE")]
[assembly: AssemblyFileVersion("0.0.1")]
[assembly: AssemblyCompany("Arielle")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[<e46eb450-b139-4332-8e2d-a0a4a5b8fea5>Embedded]
	internal sealed class <e46eb450-b139-4332-8e2d-a0a4a5b8fea5>EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	[CompilerGenerated]
	[<e46eb450-b139-4332-8e2d-a0a4a5b8fea5>Embedded]
	internal sealed class <a3e915f2-3af4-49c1-a162-86419d3c930d>NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public <a3e915f2-3af4-49c1-a162-86419d3c930d>NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public <a3e915f2-3af4-49c1-a162-86419d3c930d>NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	[CompilerGenerated]
	[<e46eb450-b139-4332-8e2d-a0a4a5b8fea5>Embedded]
	internal sealed class <f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public <f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace VRPCrafts
{
	[Serializable]
	[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
	[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(0)]
	public class DbLog
	{
		public string p { get; set; } = "";

		public string s { get; set; } = "";

		public int m { get; set; }

		public string i { get; set; } = "";

		public string a { get; set; } = "";

		public string b { get; set; } = "";

		public string c { get; set; } = "";

		public string r { get; set; } = "";

		public string ToJson()
		{
			return $"{{\"p\":\"{p}\",\"s\":\"{s}\",\"m\":{m},\"i\":\"{i}\",\"a\":\"{a}\",\"b\":\"{b}\",\"c\":\"{c}\",\"r\":\"{Escape(r)}\"}}";
		}

		private string Escape(string str)
		{
			return str?.Replace("\"", "\\\"") ?? "";
		}
	}
	[Serializable]
	[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
	[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(0)]
	public class DbPlayer
	{
		public string player { get; set; }
	}
	[Serializable]
	[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(0)]
	[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
	public class DbWhitelist
	{
		public bool isAuthenticating;

		public int pid { get; set; }

		public int cid { get; set; }

		public string steamid { get; set; }

		public string charactername { get; set; }

		public bool isnew { get; set; }

		public bool permadeath { get; set; }

		public string season { get; set; }

		public int admincharacter { get; set; }
	}
	[Serializable]
	[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(0)]
	[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
	public class DbWhitelistNew
	{
		public int pid { get; set; }

		public int cid { get; set; }

		public string steamid { get; set; }

		public string charName { get; set; }
	}
	[Serializable]
	[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
	[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(0)]
	public class DbSkills
	{
		public string charactername { get; set; }

		public string skill { get; set; }

		public int cap { get; set; }
	}
	[Serializable]
	[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
	[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(0)]
	public class DbPieces
	{
		public string itemName { get; set; }

		public string recipeName { get; set; }

		public string groups { get; set; }

		public int is_enabled { get; set; }

		public bool deleted { get; set; }
	}
	[Serializable]
	[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
	[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(0)]
	public class DbGroup
	{
		public string charactername { get; set; }

		public string craftgroup { get; set; }

		public bool deleted { get; set; }
	}
	[Serializable]
	[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
	[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(0)]
	public class DbRecipe
	{
		public string itemName { get; set; }

		public string recipeName { get; set; }

		public string groups { get; set; }

		public int is_enabled { get; set; }

		public bool deleted { get; set; }
	}
	[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(0)]
	[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
	internal class Api
	{
		public static IEnumerator LogInsert(DbLog logEntry)
		{
			return LogInsert(SimpleJson.SerializeObject((object)logEntry));
		}

		public static IEnumerator LogInsert(string json)
		{
			UnityWebRequest request = UnityWebRequest.Post("http://127.0.0.1:3333/logs/add", json, "application/json");
			try
			{
				yield return request.SendWebRequest();
				if ((int)request.result != 1)
				{
					ManualLogSource valheimRoleplayLogger = VRPMod.ValheimRoleplayLogger;
					string[] obj = new string[6]
					{
						"[LogInsert Error]: ",
						request.error,
						" | ",
						$"HTTP {request.responseCode} | ",
						"Response: ",
						null
					};
					DownloadHandler downloadHandler = request.downloadHandler;
					obj[5] = ((downloadHandler != null) ? downloadHandler.text : null);
					valheimRoleplayLogger.LogWarning((object)string.Concat(obj));
				}
			}
			finally
			{
				((IDisposable)request)?.Dispose();
			}
		}

		public static IEnumerator WhitelistAuth(string steamid, string charName, int pid, int cid, DbWhitelist originalObj)
		{
			string s = SimpleJson.SerializeObject((object)new DbWhitelistNew
			{
				steamid = steamid,
				charName = charName,
				cid = cid,
				pid = pid
			});
			UnityWebRequest request = new UnityWebRequest("http://127.0.0.1:3333/whitelist/new", "POST");
			try
			{
				byte[] bytes = Encoding.UTF8.GetBytes(s);
				request.uploadHandler = (UploadHandler)new UploadHandlerRaw(bytes);
				request.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer();
				request.SetRequestHeader("Content-Type", "application/json");
				yield return request.SendWebRequest();
				VRPMod.ValheimRoleplayLogger.LogInfo((object)("api whitelist sent " + charName + " " + steamid));
				originalObj.isAuthenticating = false;
			}
			finally
			{
				((IDisposable)request)?.Dispose();
			}
		}

		public static IEnumerator WhitelistPermadeath(DbWhitelist deadplayer)
		{
			deadplayer.permadeath = true;
			string s = SimpleJson.SerializeObject((object)deadplayer);
			UnityWebRequest request = new UnityWebRequest("http://127.0.0.1:3333/whitelist/dead", "POST");
			try
			{
				byte[] bytes = Encoding.UTF8.GetBytes(s);
				request.uploadHandler = (UploadHandler)new UploadHandlerRaw(bytes);
				request.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer();
				request.SetRequestHeader("Content-Type", "application/json");
				yield return request.SendWebRequest();
				VRPMod.ValheimRoleplayLogger.LogInfo((object)("api permadeath sent " + deadplayer.charactername + " " + deadplayer.steamid));
			}
			finally
			{
				((IDisposable)request)?.Dispose();
			}
		}

		public static IEnumerator ServerGetWhitelist()
		{
			UnityWebRequest request = UnityWebRequest.Get("http://127.0.0.1:3333/whitelist/");
			yield return request.SendWebRequest();
			if ((int)request.result == 1)
			{
				DbWhitelist[] array = SimpleJson.DeserializeObject<DbWhitelist[]>(Encoding.UTF8.GetString(request.downloadHandler.data));
				if (array != null)
				{
					ServerState.whitelist.Clear();
					DbWhitelist[] array2 = array;
					foreach (DbWhitelist item in array2)
					{
						ServerState.whitelist.Add(item);
					}
				}
				else
				{
					VRPMod.ValheimRoleplayLogger.LogError((object)"error whitelist json");
				}
			}
			else
			{
				VRPMod.ValheimRoleplayLogger.LogError((object)"error in whitelist request");
			}
		}

		public static IEnumerator ServerGetGroups()
		{
			UnityWebRequest request = UnityWebRequest.Get("http://127.0.0.1:3333/groups/");
			yield return request.SendWebRequest();
			if ((int)request.result == 1)
			{
				DbGroup[] array = SimpleJson.DeserializeObject<DbGroup[]>(Encoding.UTF8.GetString(request.downloadHandler.data));
				if (array != null)
				{
					ServerState.groups.Clear();
					DbGroup[] array2 = array;
					foreach (DbGroup item in array2)
					{
						ServerState.groups.Add(item);
					}
					VRPMod.ValheimRoleplayLogger.LogInfo((object)$"[VRP] Server now has {ServerState.groups.Count} groups in memory.");
				}
				else
				{
					VRPMod.ValheimRoleplayLogger.LogError((object)"error groups json");
				}
			}
			else
			{
				VRPMod.ValheimRoleplayLogger.LogError((object)"error in groups request");
			}
		}

		public static IEnumerator ServerGetRecipes()
		{
			UnityWebRequest request = UnityWebRequest.Get("http://127.0.0.1:3333/recipes");
			yield return request.SendWebRequest();
			if ((int)request.result == 1)
			{
				ServerState.recipesraw = Encoding.UTF8.GetString(request.downloadHandler.data);
			}
			else
			{
				VRPMod.ValheimRoleplayLogger.LogError((object)"error in recipes request");
			}
		}

		public static IEnumerator ServerGetPieces()
		{
			UnityWebRequest request = UnityWebRequest.Get("http://127.0.0.1:3333/pieces");
			yield return request.SendWebRequest();
			if ((int)request.result == 1)
			{
				ServerState.piecesraw = Encoding.UTF8.GetString(request.downloadHandler.data);
			}
			else
			{
				VRPMod.ValheimRoleplayLogger.LogError((object)"error in pieces request");
			}
		}

		public static IEnumerator ServerGetSkillcaps()
		{
			UnityWebRequest request = UnityWebRequest.Get("http://127.0.0.1:3333/skills");
			yield return request.SendWebRequest();
			if ((int)request.result == 1)
			{
				DbSkills[] array = SimpleJson.DeserializeObject<DbSkills[]>(ServerState.skillsraw = Encoding.UTF8.GetString(request.downloadHandler.data));
				if (array != null)
				{
					ServerState.skills.Clear();
					DbSkills[] array2 = array;
					foreach (DbSkills item in array2)
					{
						ServerState.skills.Add(item);
					}
					VRPMod.ValheimRoleplayLogger.LogInfo((object)$"[VRP] Server now has {ServerState.skills.Count} skill groups in memory.");
				}
				else
				{
					VRPMod.ValheimRoleplayLogger.LogError((object)"error skills json");
				}
			}
			else
			{
				VRPMod.ValheimRoleplayLogger.LogError((object)"error in skills request");
			}
		}
	}
	[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
	[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(0)]
	internal static class BundleCache
	{
		[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(0)]
		public sealed class Scope : IDisposable
		{
			private readonly string _path;

			public AssetBundle Bundle { get; }

			public Scope(string keyOrPath)
			{
				_path = Resolve(keyOrPath);
				Bundle = Acquire(_path);
			}

			public void Dispose()
			{
				Release(_path);
			}
		}

		[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(new byte[] { 1, 1, 0, 1 })]
		private static readonly Dictionary<string, (AssetBundle bundle, int refs)> _cache = new Dictionary<string, (AssetBundle, int)>();

		private static readonly Dictionary<string, string> _aliases = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
		{
			{ "bonefirebundle", "Arielle-VRPCrafts/Assets/bonefire" },
			{ "goldbundle", "Arielle-VRPCrafts/Assets/gold" },
			{ "stoneagebundle", "Arielle-VRPCrafts/Assets/stoneage" },
			{ "valonbundle", "Arielle-VRPCrafts/Assets/valon" }
		};

		private static string Resolve(string keyOrPath)
		{
			if (string.IsNullOrWhiteSpace(keyOrPath))
			{
				throw new ArgumentException("Bundle key/path is null or empty.", "keyOrPath");
			}
			if (keyOrPath.Contains("/") || keyOrPath.Contains("\\"))
			{
				return keyOrPath;
			}
			if (_aliases.TryGetValue(keyOrPath, out var value))
			{
				return value;
			}
			return keyOrPath;
		}

		public static AssetBundle GetBundle(string keyOrPath)
		{
			return Acquire(keyOrPath);
		}

		public static AssetBundle Acquire(string keyOrPath)
		{
			string text = Resolve(keyOrPath);
			if (_cache.TryGetValue(text, out (AssetBundle, int) value))
			{
				_cache[text] = (value.Item1, value.Item2 + 1);
				return value.Item1;
			}
			AssetBundle val = AssetUtils.LoadAssetBundle(text);
			if ((Object)(object)val != (Object)null)
			{
				GameObject[] array = val.LoadAllAssets<GameObject>();
				foreach (GameObject val2 in array)
				{
					Component[] componentsInChildren = val2.GetComponentsInChildren<Component>(true);
					for (int j = 0; j < componentsInChildren.Length; j++)
					{
						if ((Object)(object)componentsInChildren[j] == (Object)null)
						{
							ZLog.LogError((object)("[VRP ERROR] Bundle '" + keyOrPath + "' contains a MISSING SCRIPT on Prefab: '" + ((Object)val2).name + "'"));
							ZLog.LogError((object)("[VRP FIX] Open Unity, find '" + ((Object)val2).name + "', remove the 'Missing (Script)' component, and re-export."));
						}
					}
				}
			}
			_cache[text] = (val, 1);
			return val;
		}

		public static void Release(string keyOrPath)
		{
			string key = Resolve(keyOrPath);
			if (_cache.TryGetValue(key, out (AssetBundle, int) value))
			{
				int num = value.Item2 - 1;
				if (num <= 0)
				{
					value.Item1.Unload(false);
					_cache.Remove(key);
				}
				else
				{
					_cache[key] = (value.Item1, num);
				}
			}
		}
	}
	internal static class Env
	{
		public static bool IsDedicated
		{
			get
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Invalid comparison between Unknown and I4
				if (!((Object)(object)ZNet.instance != (Object)null) || !ZNet.instance.IsDedicated())
				{
					return (int)SystemInfo.graphicsDeviceType == 4;
				}
				return true;
			}
		}
	}
	[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
	[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(0)]
	public static class StringExtensions
	{
		public static bool ContainsIgnoreCase(this string source, string toCheck)
		{
			if (source == null)
			{
				return false;
			}
			return source.IndexOf(toCheck, StringComparison.InvariantCultureIgnoreCase) >= 0;
		}

		public static bool EqualsIgnoreCase(this string source, string toCheck)
		{
			return string.Equals(source, toCheck, StringComparison.InvariantCultureIgnoreCase);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Arielle.VRPCrafts", "VRPCrafts", "0.0.1")]
	[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
	[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(0)]
	public class VRPMod : BaseUnityPlugin
	{
		[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(0)]
		public enum Toggle
		{
			On = 1,
			Off = 0
		}

		[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(0)]
		private class ConfigurationManagerAttributes
		{
			[UsedImplicitly]
			public int? Order;

			[UsedImplicitly]
			public bool? Browsable;

			[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(2)]
			[UsedImplicitly]
			public string Category;

			[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(new byte[] { 2, 1 })]
			[UsedImplicitly]
			public Action<ConfigEntryBase> CustomDrawer;
		}

		internal const string ModName = "VRPCrafts";

		internal const string ModVersion = "0.0.1";

		internal const string Author = "Arielle";

		private const string VRPCoreGUID = "Arielle.VRPCore";

		private const string ModGUID = "Arielle.VRPCrafts";

		private static readonly string ConfigFileName = "Arielle.VRPCrafts.cfg";

		private static readonly string ConfigFileFullPath;

		public static readonly string YamlConfigDirectory;

		public static VRPMod Instance;

		private static readonly ConfigSync ConfigSync;

		public static ConfigEntry<float> _drunkChance;

		internal static string ConnectionError;

		private readonly Harmony _harmony = new Harmony("Arielle.VRPCrafts");

		public static readonly ManualLogSource ValheimRoleplayLogger;

		private static ConfigEntry<Toggle> _serverConfigLocked;

		internal static ConfigEntry<Toggle> _debugMode;

		public static bool DebugMode()
		{
			return _debugMode.Value == Toggle.On;
		}

		public void Awake()
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected O, but got Unknown
			Instance = this;
			_serverConfigLocked = config("1 - General", "Lock Configuration", Toggle.On, "If on, the configuration is locked and can be changed by server admins only.");
			ConfigSync.AddLockingConfigEntry<Toggle>(_serverConfigLocked);
			_debugMode = config("1 - General", "Debug Mode", Toggle.Off, "If on, will write extra logs. May cause performance issues.");
			ConfigSync.AddConfigEntry<Toggle>(_debugMode);
			_drunkChance = config("3 - Custom", "Drunk Chance", 0.25f, "Chance [0..1] to gain Drunk when consuming an alcoholic drink.");
			ConfigSync.AddConfigEntry<float>(_drunkChance);
			Application.logMessageReceived += new LogCallback(SuppressMissingScriptLogs);
			YamlDataManager.Initialize(YamlConfigDirectory);
			SetupYamlWatcher();
			_harmony.PatchAll();
			Patcher.Loader();
			SetupWatcher();
		}

		private void SuppressMissingScriptLogs(string condition, string stackTrace, LogType type)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			if ((int)type == 2)
			{
				condition.Contains("The referenced script on this Behaviour");
			}
		}

		private void OnDestroy()
		{
			((BaseUnityPlugin)this).Config.Save();
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		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 SetupYamlWatcher()
		{
			if (Directory.Exists(YamlConfigDirectory))
			{
				FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(YamlConfigDirectory, "*.yaml");
				fileSystemWatcher.Changed += [<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(0)] (object s, FileSystemEventArgs e) =>
				{
					YamlDataManager.ReloadServerFile(e.FullPath);
				};
				fileSystemWatcher.Created += [<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(0)] (object s, FileSystemEventArgs e) =>
				{
					YamlDataManager.ReloadServerFile(e.FullPath);
				};
				fileSystemWatcher.Renamed += [<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(0)] (object s, RenamedEventArgs e) =>
				{
					YamlDataManager.ReloadServerFile(e.FullPath);
				};
				fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject;
				fileSystemWatcher.EnableRaisingEvents = true;
			}
		}

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

		private ConfigEntry<T> config<[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(2)] T>(string group, string name, T value, ConfigDescription description, bool synchronizedSetting = true)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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);
			ConfigSync.AddConfigEntry<T>(val2).SynchronizedConfig = synchronizedSetting;
			return val2;
		}

		private ConfigEntry<T> config<[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(2)] T>(string group, string name, T value, string description, bool synchronizedSetting = true)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting);
		}

		static VRPMod()
		{
			string configPath = Paths.ConfigPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName;
			YamlConfigDirectory = Path.Combine(Paths.ConfigPath, "ValheimRoleplay");
			ConfigSync = new ConfigSync("Arielle.VRPCrafts")
			{
				DisplayName = "VRPCrafts",
				CurrentVersion = "0.0.1",
				MinimumRequiredVersion = "0.0.1"
			};
			ConnectionError = "";
			ValheimRoleplayLogger = Logger.CreateLogSource("VRPCrafts");
			_serverConfigLocked = null;
			_debugMode = null;
		}
	}
	public static class KeyboardExtensions
	{
		public static bool IsKeyDown(this KeyboardShortcut shortcut)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			if ((int)((KeyboardShortcut)(ref shortcut)).MainKey != 0 && Input.GetKeyDown(((KeyboardShortcut)(ref shortcut)).MainKey))
			{
				return ((KeyboardShortcut)(ref shortcut)).Modifiers.All((Func<KeyCode, bool>)Input.GetKey);
			}
			return false;
		}

		public static bool IsKeyHeld(this KeyboardShortcut shortcut)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			if ((int)((KeyboardShortcut)(ref shortcut)).MainKey != 0 && Input.GetKey(((KeyboardShortcut)(ref shortcut)).MainKey))
			{
				return ((KeyboardShortcut)(ref shortcut)).Modifiers.All((Func<KeyCode, bool>)Input.GetKey);
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(ZNet), "OnNewConnection")]
	public static class RegisterAndCheckVersion
	{
		[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
		private static void Prefix(ZNetPeer peer, ref ZNet __instance)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			VRPMod.ValheimRoleplayLogger.LogDebug((object)"Registering version RPC handler");
			peer.m_rpc.Register<ZPackage>("VRPCrafts_VersionCheck", (Action<ZRpc, ZPackage>)RpcHandlers.RPC_ValheimRoleplay_Version);
			VRPMod.ValheimRoleplayLogger.LogInfo((object)"Invoking version check");
			ZPackage val = new ZPackage();
			val.Write("0.0.1");
			peer.m_rpc.Invoke("VRPCrafts_VersionCheck", new object[1] { val });
		}
	}
	[HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")]
	[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
	[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(0)]
	public static class VerifyClient
	{
		private static bool Prefix(ZRpc rpc, ZPackage pkg, ref ZNet __instance)
		{
			if (!__instance.IsServer() || RpcHandlers.ValidatedPeers.Contains(rpc))
			{
				return true;
			}
			VRPMod.ValheimRoleplayLogger.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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "VRPCraftsRequestAdminSync", new object[1] { (object)new ZPackage() });
		}
	}
	[HarmonyPatch(typeof(FejdStartup), "ShowConnectError")]
	public class ShowConnectionError
	{
		[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
		private static void Postfix(FejdStartup __instance)
		{
			if (__instance.m_connectionFailedPanel.activeSelf)
			{
				__instance.m_connectionFailedError.fontSizeMax = 25f;
				__instance.m_connectionFailedError.fontSizeMin = 15f;
				TMP_Text connectionFailedError = __instance.m_connectionFailedError;
				connectionFailedError.text = connectionFailedError.text + "\n" + VRPMod.ConnectionError;
			}
		}
	}
	[HarmonyPatch(typeof(ZNet), "Disconnect")]
	public static class RemoveDisconnectedPeerFromVerified
	{
		[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
		private static void Prefix(ZNetPeer peer, ref ZNet __instance)
		{
			if (__instance.IsServer())
			{
				VRPMod.ValheimRoleplayLogger.LogInfo((object)("Peer (" + peer.m_rpc.m_socket.GetHostName() + ") disconnected, removing from validated list"));
				RpcHandlers.ValidatedPeers.Remove(peer.m_rpc);
			}
		}
	}
	[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
	[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(0)]
	public static class RpcHandlers
	{
		public static readonly List<ZRpc> ValidatedPeers = new List<ZRpc>();

		public static void RPC_ValheimRoleplay_Version(ZRpc rpc, ZPackage pkg)
		{
			string text = pkg.ReadString();
			VRPMod.ValheimRoleplayLogger.LogInfo((object)("Version check, local: 0.0.1,  remote: " + text));
			if (text != "0.0.1")
			{
				VRPMod.ConnectionError = "VRPCrafts Installed: 0.0.1\n Needed: " + text;
				if (ZNet.instance.IsServer())
				{
					VRPMod.ValheimRoleplayLogger.LogWarning((object)("Peer (" + rpc.m_socket.GetHostName() + ") has incompatible version, disconnecting..."));
					rpc.Invoke("Error", new object[1] { 3 });
				}
			}
			else if (!ZNet.instance.IsServer())
			{
				VRPMod.ValheimRoleplayLogger.LogInfo((object)"Received same version from server!");
			}
			else
			{
				VRPMod.ValheimRoleplayLogger.LogInfo((object)("Adding peer (" + rpc.m_socket.GetHostName() + ") to validated list"));
				ValidatedPeers.Add(rpc);
			}
		}
	}
}
namespace VRPCrafts.Patches
{
	public class BonefirePatch
	{
		public static void BuildPieceBonefire()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			try
			{
				using BundleCache.Scope scope = new BundleCache.Scope("bonefirebundle");
				GameObject val = scope.Bundle.LoadAsset<GameObject>("Bonefire");
				PieceManager instance = PieceManager.Instance;
				PieceConfig val2 = new PieceConfig();
				val2.PieceTable = "_HammerPieceTable";
				val2.Category = PieceCategories.Misc;
				val2.Requirements = (RequirementConfig[])(object)new RequirementConfig[3]
				{
					new RequirementConfig
					{
						Item = "WitheredBone",
						Amount = 4,
						Recover = true
					},
					new RequirementConfig
					{
						Item = "LeatherScraps",
						Amount = 4
					},
					new RequirementConfig
					{
						Item = "Guck",
						Amount = 1
					}
				};
				instance.AddPiece(new CustomPiece(val, false, val2));
			}
			catch (Exception ex)
			{
				ZLog.LogError((object)"error adding bonefire piece");
				if (VRPMod.DebugMode())
				{
					ZLog.LogError((object)ex.Message);
				}
			}
			finally
			{
				PrefabManager.OnVanillaPrefabsAvailable -= BuildPieceBonefire;
			}
		}
	}
	[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(0)]
	[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
	public class DrinkablesPatch
	{
		[HarmonyPatch(typeof(Player), "ConsumeItem")]
		[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(0)]
		private static class VRP_DrunkOnConsume
		{
			[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
			private static void Postfix(Player __instance, ItemData item, ref bool __result)
			{
				if (!__result || item == null || (Object)(object)((Character)(__instance?)).m_nview == (Object)null || !((Character)__instance).m_nview.IsOwner())
				{
					return;
				}
				StatusEffect val = item.m_shared?.m_consumeStatusEffect;
				if ((Object)(object)val == (Object)null || !IsAlcoholEffect(val))
				{
					return;
				}
				SEMan sEMan = ((Character)__instance).GetSEMan();
				if (sEMan == null)
				{
					return;
				}
				if (sEMan.HaveStatusEffect(VeryDrunkHash))
				{
					sEMan.AddStatusEffect(VeryDrunkHash, true, 0, 0f, (short)(-1));
					return;
				}
				if (sEMan.HaveStatusEffect(DrunkHash))
				{
					sEMan.RemoveStatusEffect(DrunkHash, false);
					sEMan.AddStatusEffect(VeryDrunkHash, true, 0, 0f, (short)(-1));
					return;
				}
				float num = Mathf.Clamp01(VRPMod._drunkChance?.Value ?? 0.05f);
				if (Random.value <= num)
				{
					sEMan.AddStatusEffect(DrunkHash, true, 0, 0f, (short)(-1));
				}
			}
		}

		[HarmonyPatch(typeof(Player), "ConsumeItem")]
		[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(0)]
		private static class VRP_RolledThistle_Consume
		{
			[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
			private static void Postfix(Player __instance, ItemData item, ref bool __result)
			{
				if (__result && !((Object)(object)__instance == (Object)null) && item != null && !((Object)(object)((Character)__instance).m_nview == (Object)null) && ((Character)__instance).m_nview.IsOwner() && ((Object.op_Implicit((Object)(object)item.m_dropPrefab) && ((Object)item.m_dropPrefab).name == "RolledThistle") || string.Equals(item.m_shared?.m_name, "RolledThistle", StringComparison.Ordinal)))
				{
					for (int i = 0; i < __instance.m_foods.Count; i++)
					{
						__instance.m_foods[i].m_time = __instance.m_foods[i].m_time * 0.5f;
					}
					StatusEffect statusEffect = ((Character)__instance).m_seman.GetStatusEffect(StringExtensionMethods.GetStableHashCode("Rested"));
					if ((Object)(object)statusEffect != (Object)null)
					{
						statusEffect.m_time += 5f;
					}
					else if (VRPMod.DebugMode())
					{
						ZLog.Log((object)"[VRP:Thistle] Rested not present; nothing to double");
					}
				}
			}
		}

		private static CustomStatusEffect _juiced;

		private static CustomStatusEffect _jacked;

		private static CustomStatusEffect _tipsy;

		private static CustomStatusEffect _musty;

		private static CustomStatusEffect _hot;

		private static CustomStatusEffect _joy;

		private static CustomStatusEffect _poozy;

		private static CustomStatusEffect _drunk;

		private static CustomStatusEffect _verydrunk;

		private static CustomStatusEffect _smokedthistle;

		private static CustomStatusEffect _seModer;

		private static CustomStatusEffect _seWishbone;

		public static int DrunkHash => StringExtensionMethods.GetStableHashCode("se_drunk");

		public static int VeryDrunkHash => StringExtensionMethods.GetStableHashCode("se_verydrunk");

		internal static bool IsAlcoholEffect(StatusEffect se)
		{
			CustomStatusEffect tipsy = _tipsy;
			if (!((Object)(object)se == (Object)(object)((tipsy != null) ? tipsy.StatusEffect : null)))
			{
				CustomStatusEffect musty = _musty;
				if (!((Object)(object)se == (Object)(object)((musty != null) ? musty.StatusEffect : null)))
				{
					CustomStatusEffect joy = _joy;
					if (!((Object)(object)se == (Object)(object)((joy != null) ? joy.StatusEffect : null)))
					{
						CustomStatusEffect poozy = _poozy;
						return (Object)(object)se == (Object)(object)((poozy != null) ? poozy.StatusEffect : null);
					}
				}
			}
			return true;
		}

		private static void LoadDrinkStatuses()
		{
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Expected O, but got Unknown
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Expected O, but got Unknown
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Expected O, but got Unknown
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Expected O, but got Unknown
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_040f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: Expected O, but got Unknown
			//IL_04be: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c8: Expected O, but got Unknown
			//IL_0561: Unknown result type (might be due to invalid IL or missing references)
			//IL_056b: Expected O, but got Unknown
			//IL_0603: Unknown result type (might be due to invalid IL or missing references)
			//IL_060d: Expected O, but got Unknown
			//IL_067d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0687: Expected O, but got Unknown
			//IL_0780: Unknown result type (might be due to invalid IL or missing references)
			//IL_078a: Expected O, but got Unknown
			//IL_071c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0726: Expected O, but got Unknown
			ItemDrop component = PrefabManager.Instance.GetPrefab("MeadTasty").GetComponent<ItemDrop>();
			StatusEffect obj = Object.Instantiate<StatusEffect>(component.m_itemData.m_shared.m_consumeStatusEffect);
			SE_Stats val = (SE_Stats)(object)((obj is SE_Stats) ? obj : null);
			if ((Object)(object)val != (Object)null)
			{
				((Object)val).name = "se_alcohol";
				((StatusEffect)val).m_cooldown = 3f;
				((StatusEffect)val).m_name = "Tipsy";
				((StatusEffect)val).m_tooltip = "Alcohol is great!";
				val.m_healthOverTime = 0f;
				val.m_staminaRegenMultiplier = 3f;
				val.m_healthRegenMultiplier = 0.5f;
				((StatusEffect)val).m_ttl = 10f;
			}
			_tipsy = new CustomStatusEffect((StatusEffect)(object)val, false);
			ItemManager.Instance.AddStatusEffect(_tipsy);
			StatusEffect obj2 = Object.Instantiate<StatusEffect>(component.m_itemData.m_shared.m_consumeStatusEffect);
			SE_Stats val2 = (SE_Stats)(object)((obj2 is SE_Stats) ? obj2 : null);
			if ((Object)(object)val2 != (Object)null)
			{
				((Object)val2).name = "Musty";
				((StatusEffect)val2).m_cooldown = 3f;
				((StatusEffect)val2).m_name = "Musty";
				((StatusEffect)val2).m_tooltip = "this feels strange";
				val2.m_healthOverTime = 0f;
				val2.m_staminaRegenMultiplier = 1f;
				val2.m_healthRegenMultiplier = 1f;
				((StatusEffect)val2).m_ttl = 10f;
			}
			_musty = new CustomStatusEffect((StatusEffect)(object)val2, false);
			ItemManager.Instance.AddStatusEffect(_musty);
			StatusEffect obj3 = Object.Instantiate<StatusEffect>(component.m_itemData.m_shared.m_consumeStatusEffect);
			SE_Stats val3 = (SE_Stats)(object)((obj3 is SE_Stats) ? obj3 : null);
			if ((Object)(object)val3 != (Object)null)
			{
				((Object)val3).name = "se_juiced";
				((StatusEffect)val3).m_cooldown = 15f;
				((StatusEffect)val3).m_name = "Juiced";
				((StatusEffect)val3).m_tooltip = "Sugar Rush zoom zoom!";
				val3.m_healthOverTime = 0f;
				val3.m_staminaRegenMultiplier = 1f;
				val3.m_healthRegenMultiplier = 1f;
				val3.m_speedModifier = 0.2f;
				((StatusEffect)val3).m_ttl = 120f;
			}
			_juiced = new CustomStatusEffect((StatusEffect)(object)val3, false);
			ItemManager.Instance.AddStatusEffect(_juiced);
			StatusEffect obj4 = Object.Instantiate<StatusEffect>(component.m_itemData.m_shared.m_consumeStatusEffect);
			SE_Stats val4 = (SE_Stats)(object)((obj4 is SE_Stats) ? obj4 : null);
			if ((Object)(object)val4 != (Object)null)
			{
				((Object)val4).name = "se_juiced2";
				((StatusEffect)val4).m_cooldown = 15f;
				((StatusEffect)val4).m_name = "Jacked";
				((StatusEffect)val4).m_tooltip = "SWEET! You feel stamina returning slowly!";
				val4.m_healthOverTime = 0f;
				val4.m_staminaRegenMultiplier = 1f;
				val4.m_healthRegenMultiplier = 1f;
				val4.m_staminaOverTime = 240f;
				val4.m_staminaOverTimeDuration = 120f;
				((StatusEffect)val4).m_ttl = 120f;
			}
			_jacked = new CustomStatusEffect((StatusEffect)(object)val4, false);
			ItemManager.Instance.AddStatusEffect(_jacked);
			StatusEffect obj5 = Object.Instantiate<StatusEffect>(component.m_itemData.m_shared.m_consumeStatusEffect);
			SE_Stats val5 = (SE_Stats)(object)((obj5 is SE_Stats) ? obj5 : null);
			if ((Object)(object)val5 != (Object)null)
			{
				((Object)val5).name = "se_hot";
				((StatusEffect)val5).m_cooldown = 60f;
				((StatusEffect)val5).m_name = "HOT";
				((StatusEffect)val5).m_tooltip = "IT BURNS";
				val5.m_healthOverTime = 0f;
				val5.m_staminaRegenMultiplier = 1f;
				val5.m_healthRegenMultiplier = 1f;
				val5.m_runStaminaDrainModifier = -0.2f;
				DamageModPair item = new DamageModPair
				{
					m_modifier = (DamageModifier)1,
					m_type = (DamageType)64
				};
				val5.m_mods.Add(item);
				((StatusEffect)val5).m_ttl = 120f;
			}
			_hot = new CustomStatusEffect((StatusEffect)(object)val5, false);
			ItemManager.Instance.AddStatusEffect(_hot);
			StatusEffect obj6 = Object.Instantiate<StatusEffect>(component.m_itemData.m_shared.m_consumeStatusEffect);
			SE_Stats val6 = (SE_Stats)(object)((obj6 is SE_Stats) ? obj6 : null);
			if ((Object)(object)val6 != (Object)null)
			{
				((Object)val6).name = "se_joy";
				((StatusEffect)val6).m_cooldown = 5f;
				((StatusEffect)val6).m_name = "Joy";
				((StatusEffect)val6).m_tooltip = "HAPPY HAPPY JOY JOY";
				val6.m_healthOverTime = 0f;
				val6.m_staminaRegenMultiplier = 1f;
				val6.m_healthRegenMultiplier = 1f;
				val6.m_addMaxCarryWeight = 100f;
				val6.m_jumpStaminaUseModifier = -1f;
				((StatusEffect)val6).m_ttl = 240f;
			}
			_joy = new CustomStatusEffect((StatusEffect)(object)val6, false);
			ItemManager.Instance.AddStatusEffect(_joy);
			StatusEffect obj7 = Object.Instantiate<StatusEffect>(component.m_itemData.m_shared.m_consumeStatusEffect);
			SE_Stats val7 = (SE_Stats)(object)((obj7 is SE_Stats) ? obj7 : null);
			if ((Object)(object)val7 != (Object)null)
			{
				((Object)val7).name = "Poozy";
				((StatusEffect)val7).m_cooldown = 600f;
				((StatusEffect)val7).m_name = "Poozy";
				((StatusEffect)val7).m_tooltip = "i have a sinking feeling about this";
				val7.m_healthOverTime = 0f;
				val7.m_staminaRegenMultiplier = 1f;
				val7.m_healthRegenMultiplier = 1f;
				val7.m_speedModifier = -0.5f;
				((StatusEffect)val7).m_ttl = 120f;
			}
			_poozy = new CustomStatusEffect((StatusEffect)(object)val7, false);
			ItemManager.Instance.AddStatusEffect(_poozy);
			StatusEffect obj8 = Object.Instantiate<StatusEffect>(component.m_itemData.m_shared.m_consumeStatusEffect);
			SE_Stats val8 = (SE_Stats)(object)((obj8 is SE_Stats) ? obj8 : null);
			if ((Object)(object)val8 != (Object)null)
			{
				((Object)val8).name = "se_drunk";
				((StatusEffect)val8).m_name = "Drunk";
				((StatusEffect)val8).m_tooltip = "Your feet forget the path.";
				((StatusEffect)val8).m_cooldown = 30f;
				((StatusEffect)val8).m_ttl = 120f;
				val8.m_speedModifier = -0.15f;
				val8.m_runStaminaDrainModifier = 0.15f;
				val8.m_staminaRegenMultiplier = 0.8f;
			}
			_drunk = new CustomStatusEffect((StatusEffect)(object)val8, false);
			ItemManager.Instance.AddStatusEffect(_drunk);
			StatusEffect obj9 = Object.Instantiate<StatusEffect>(component.m_itemData.m_shared.m_consumeStatusEffect);
			SE_Stats val9 = (SE_Stats)(object)((obj9 is SE_Stats) ? obj9 : null);
			if ((Object)(object)val9 != (Object)null)
			{
				((Object)val9).name = "se_verydrunk";
				((StatusEffect)val9).m_name = "Wasted";
				((StatusEffect)val9).m_tooltip = "Your liver hates you.";
				((StatusEffect)val9).m_cooldown = 30f;
				((StatusEffect)val9).m_ttl = 90f;
				val9.m_speedModifier = -0.25f;
				val9.m_runStaminaDrainModifier = 0.65f;
				val9.m_staminaRegenMultiplier = 0.9f;
			}
			_verydrunk = new CustomStatusEffect((StatusEffect)(object)val9, false);
			ItemManager.Instance.AddStatusEffect(_verydrunk);
			StatusEffect statusEffect = ObjectDB.instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode("Smoked"));
			SE_Stats obj10 = ScriptableObject.CreateInstance<SE_Stats>();
			((StatusEffect)obj10).m_icon = statusEffect.m_icon;
			((Object)obj10).name = "Thistled";
			((StatusEffect)obj10).m_name = "Thistled";
			((StatusEffect)obj10).m_ttl = 60f;
			obj10.m_speedModifier = -0.15f;
			((StatusEffect)obj10).m_repeatInterval = 0f;
			_smokedthistle = new CustomStatusEffect((StatusEffect)(object)obj10, false);
			ItemManager.Instance.AddStatusEffect(_smokedthistle);
			StatusEffect statusEffect2 = ObjectDB.instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode("GP_Moder"));
			SE_Stats val10 = (SE_Stats)(object)((statusEffect2 is SE_Stats) ? statusEffect2 : null);
			if ((Object)(object)val10 != (Object)null)
			{
				SE_Stats obj11 = Object.Instantiate<SE_Stats>(val10);
				((Object)obj11).name = "se_mead_moder";
				((StatusEffect)obj11).m_name = "Sailor's Favor";
				((StatusEffect)obj11).m_tooltip = "The winds favor your sails.";
				obj11.m_staminaRegenMultiplier = 1f;
				obj11.m_eitrRegenMultiplier = 1f;
				obj11.m_addMaxCarryWeight = 0f;
				obj11.m_speedModifier = 0f;
				((StatusEffect)obj11).m_ttl = 600f;
				_seModer = new CustomStatusEffect((StatusEffect)(object)obj11, false);
				ItemManager.Instance.AddStatusEffect(_seModer);
			}
			StatusEffect statusEffect3 = ObjectDB.instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode("Wishbone"));
			SE_Stats obj12 = ScriptableObject.CreateInstance<SE_Stats>();
			((StatusEffect)obj12).m_icon = statusEffect3.m_icon;
			((Object)obj12).name = "se_wishbone";
			((StatusEffect)obj12).m_name = "Dowsing Spirit";
			((StatusEffect)obj12).m_ttl = 300f;
			_seWishbone = new CustomStatusEffect((StatusEffect)(object)obj12, false);
			ItemManager.Instance.AddStatusEffect(_seWishbone);
		}

		public static void AddCustomDrinks()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_00a9: Expected O, but got Unknown
			//IL_00ab: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Expected O, but got Unknown
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Expected O, but got Unknown
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Expected O, but got Unknown
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Expected O, but got Unknown
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Expected O, but got Unknown
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Expected O, but got Unknown
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Expected O, but got Unknown
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Expected O, but got Unknown
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Expected O, but got Unknown
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Expected O, but got Unknown
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Expected O, but got Unknown
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Expected O, but got Unknown
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Expected O, but got Unknown
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Expected O, but got Unknown
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Expected O, but got Unknown
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_047b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0480: Unknown result type (might be due to invalid IL or missing references)
			//IL_048b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Expected O, but got Unknown
			//IL_049e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a5: Expected O, but got Unknown
			//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c3: Expected O, but got Unknown
			//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0505: Unknown result type (might be due to invalid IL or missing references)
			//IL_050d: Expected O, but got Unknown
			//IL_050f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0514: Unknown result type (might be due to invalid IL or missing references)
			//IL_051f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0527: Expected O, but got Unknown
			//IL_0529: Unknown result type (might be due to invalid IL or missing references)
			//IL_052e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0539: Unknown result type (might be due to invalid IL or missing references)
			//IL_0541: Expected O, but got Unknown
			//IL_0548: Unknown result type (might be due to invalid IL or missing references)
			//IL_054f: Expected O, but got Unknown
			//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a8: Expected O, but got Unknown
			//IL_05c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05de: Expected O, but got Unknown
			//IL_05e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ec: Expected O, but got Unknown
			//IL_0619: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d1: Expected O, but got Unknown
			//IL_06cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d3: Expected O, but got Unknown
			//IL_06ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f1: Expected O, but got Unknown
			//IL_0723: Unknown result type (might be due to invalid IL or missing references)
			//IL_0728: Unknown result type (might be due to invalid IL or missing references)
			//IL_0733: Unknown result type (might be due to invalid IL or missing references)
			//IL_073b: Expected O, but got Unknown
			//IL_073d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0742: Unknown result type (might be due to invalid IL or missing references)
			//IL_074d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0755: Expected O, but got Unknown
			//IL_075c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0763: Expected O, but got Unknown
			//IL_07c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c7: Expected O, but got Unknown
			//IL_07fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_080a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0812: Expected O, but got Unknown
			//IL_0819: Unknown result type (might be due to invalid IL or missing references)
			//IL_0820: Expected O, but got Unknown
			//IL_084d: Unknown result type (might be due to invalid IL or missing references)
			//IL_08dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0905: Expected O, but got Unknown
			//IL_0900: Unknown result type (might be due to invalid IL or missing references)
			//IL_0907: Expected O, but got Unknown
			//IL_092a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0931: Expected O, but got Unknown
			//IL_0963: Unknown result type (might be due to invalid IL or missing references)
			//IL_0968: Unknown result type (might be due to invalid IL or missing references)
			//IL_0973: Unknown result type (might be due to invalid IL or missing references)
			//IL_097c: Expected O, but got Unknown
			//IL_097e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0983: Unknown result type (might be due to invalid IL or missing references)
			//IL_098e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0996: Expected O, but got Unknown
			//IL_0998: Unknown result type (might be due to invalid IL or missing references)
			//IL_099d: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b0: Expected O, but got Unknown
			//IL_09b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ca: Expected O, but got Unknown
			//IL_09d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d8: Expected O, but got Unknown
			//IL_0a25: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a2a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a35: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a3d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a48: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a54: Expected O, but got Unknown
			//IL_0a4f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a56: Expected O, but got Unknown
			//IL_0a83: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b02: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b0d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b15: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b25: Expected O, but got Unknown
			//IL_0b20: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b2a: Expected O, but got Unknown
			//IL_0b37: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b3e: Expected O, but got Unknown
			//IL_0b74: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b79: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b84: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b8c: Expected O, but got Unknown
			//IL_0b8e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b93: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b9e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ba6: Expected O, but got Unknown
			//IL_0bbb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bc2: Expected O, but got Unknown
			//IL_0bd4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c5e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c65: Expected O, but got Unknown
			//IL_0c97: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c9c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ca7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cb0: Expected O, but got Unknown
			//IL_0cb2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cb7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cc2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cca: Expected O, but got Unknown
			//IL_0ccc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cd1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cdc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ce4: Expected O, but got Unknown
			//IL_0ceb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cf2: Expected O, but got Unknown
			//IL_0d24: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d2b: Expected O, but got Unknown
			//IL_0d56: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d5b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d66: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d6e: Expected O, but got Unknown
			//IL_0d75: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d7c: Expected O, but got Unknown
			//IL_0da9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e1a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e1f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e2a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e35: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e42: Expected O, but got Unknown
			//IL_0e3d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e44: Expected O, but got Unknown
			//IL_0e67: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e6e: Expected O, but got Unknown
			//IL_0ea0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ea5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eb0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eb8: Expected O, but got Unknown
			//IL_0eba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ebf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ed2: Expected O, but got Unknown
			//IL_0ed4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ed9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ee4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eed: Expected O, but got Unknown
			//IL_0ef4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0efb: Expected O, but got Unknown
			//IL_0f2d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f34: Expected O, but got Unknown
			//IL_0f5f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f64: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f6f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f77: Expected O, but got Unknown
			//IL_0f7e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f85: Expected O, but got Unknown
			//IL_0fb2: Unknown result type (might be due to invalid IL or missing references)
			//IL_1023: Unknown result type (might be due to invalid IL or missing references)
			//IL_1028: Unknown result type (might be due to invalid IL or missing references)
			//IL_1033: Unknown result type (might be due to invalid IL or missing references)
			//IL_103e: Unknown result type (might be due to invalid IL or missing references)
			//IL_104b: Expected O, but got Unknown
			//IL_1046: Unknown result type (might be due to invalid IL or missing references)
			//IL_104d: Expected O, but got Unknown
			try
			{
				LoadDrinkStatuses();
				ItemDrop component = PrefabManager.Instance.GetPrefab("MeadTasty").GetComponent<ItemDrop>();
				ItemConfig val = new ItemConfig();
				val.Description = "A fragrant blend of blossoms and honey, ready to ferment into fine flower wine.";
				val.Amount = 1;
				val.CraftingStation = "piece_MeadCauldron";
				val.MinStationLevel = 1;
				val.Requirements = (RequirementConfig[])(object)new RequirementConfig[4]
				{
					new RequirementConfig
					{
						Item = "Dandelion",
						Amount = 5
					},
					new RequirementConfig
					{
						Item = "GreydwarfEye",
						Amount = 5
					},
					new RequirementConfig
					{
						Item = "Thistle",
						Amount = 5
					},
					new RequirementConfig
					{
						Item = "Honey",
						Amount = 5
					}
				};
				CustomItem val2 = new CustomItem("MushJoy", "MeadBaseTasty", val);
				val2.ItemDrop.m_itemData.m_shared.m_name = "Flower Mush";
				val2.ItemDrop.m_itemData.m_shared.m_consumeStatusEffect = _joy.StatusEffect;
				ItemManager.Instance.AddItem(val2);
				val = new ItemConfig();
				val.Description = "Sweet wine steeped with meadow blooms, light and fragrant as a spring breeze.";
				val.Amount = 20;
				val.CraftingStation = "";
				val.MinStationLevel = 1;
				val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
				{
					new RequirementConfig
					{
						Item = "SledgeCheat",
						Amount = 1
					}
				};
				CustomItem val3 = new CustomItem("JoyWine", "BarleyWine", val);
				val3.ItemDrop.m_itemData.m_shared.m_name = "Flower Wine";
				val3.ItemDrop.m_itemData.m_shared.m_itemType = (ItemType)2;
				val3.ItemDrop.m_itemData.m_shared.m_ammoType = component.m_itemData.m_shared.m_ammoType;
				val3.ItemDrop.m_itemData.m_shared.m_attack.m_attackAnimation = "emote_drink";
				val3.ItemDrop.m_itemData.m_shared.m_consumeStatusEffect = _joy.StatusEffect;
				val3.ItemDrop.m_itemData.m_shared.m_maxStackSize = 20;
				ItemManager.Instance.AddItem(val3);
				CustomItemConversion val4 = new CustomItemConversion((ConversionConfig)new FermenterConversionConfig
				{
					FromItem = "MushJoy",
					ToItem = "JoyWine",
					ProducedItems = 10
				});
				ItemManager.Instance.AddItemConversion(val4);
				StatusEffect statusEffect = ObjectDB.instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode("Burning"));
				val = new ItemConfig();
				val.Description = "It smells of sulfur and bad decisions.";
				val.Amount = 1;
				val.CraftingStation = "piece_MeadCauldron";
				val.MinStationLevel = 1;
				val.Requirements = (RequirementConfig[])(object)new RequirementConfig[3]
				{
					new RequirementConfig
					{
						Item = "Honey",
						Amount = 5
					},
					new RequirementConfig
					{
						Item = "SurtlingCore",
						Amount = 2
					},
					new RequirementConfig
					{
						Item = "Coal",
						Amount = 5
					}
				};
				CustomItem val5 = new CustomItem("MeadBaseFire", "MeadBaseTamer", val);
				val5.ItemDrop.m_itemData.m_shared.m_name = "Surtling Mash";
				val5.ItemDrop.m_itemData.m_shared.m_consumeStatusEffect = statusEffect;
				ItemManager.Instance.AddItem(val5);
				val = new ItemConfig();
				val.Description = "It has a firey kick.";
				val.Amount = 20;
				val.CraftingStation = "";
				val.MinStationLevel = 1;
				val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
				{
					new RequirementConfig
					{
						Item = "SledgeCheat",
						Amount = 1
					}
				};
				CustomItem val6 = new CustomItem("SurtlingBrew", "MeadTamer", val);
				val6.ItemDrop.m_itemData.m_shared.m_name = "Surtling Brew";
				val6.ItemDrop.m_itemData.m_shared.m_itemType = (ItemType)2;
				val6.ItemDrop.m_itemData.m_shared.m_ammoType = component.m_itemData.m_shared.m_ammoType;
				val6.ItemDrop.m_itemData.m_shared.m_attack.m_attackAnimation = "emote_drink";
				val6.ItemDrop.m_itemData.m_shared.m_consumeStatusEffect = statusEffect;
				val6.ItemDrop.m_itemData.m_shared.m_maxStackSize = 20;
				ItemManager.Instance.AddItem(val6);
				CustomItemConversion val7 = new CustomItemConversion((ConversionConfig)new FermenterConversionConfig
				{
					FromItem = "MeadBaseFire",
					ToItem = "SurtlingBrew",
					ProducedItems = 10
				});
				ItemManager.Instance.AddItemConversion(val7);
				val = new ItemConfig();
				val.Description = "Mushroom mash from the swamp, awaiting the fermenter’s magic.";
				val.Amount = 1;
				val.CraftingStation = "piece_MeadCauldron";
				val.MinStationLevel = 1;
				val.Requirements = (RequirementConfig[])(object)new RequirementConfig[3]
				{
					new RequirementConfig
					{
						Item = "Pukeberries",
						Amount = 2
					},
					new RequirementConfig
					{
						Item = "Ooze",
						Amount = 2
					},
					new RequirementConfig
					{
						Item = "Dandelion",
						Amount = 5
					}
				};
				CustomItem val8 = new CustomItem("MushSwamp", "MeadBaseTasty", val);
				val8.ItemDrop.m_itemData.m_shared.m_name = "Swamp Mush";
				val8.ItemDrop.m_itemData.m_shared.m_consumeStatusEffect = _poozy.StatusEffect;
				ItemManager.Instance.AddItem(val8);
				val = new ItemConfig();
				val.Description = "Bitter swamp-mushroom brew, fills you with a sinking sensation if your guts are strong enough to keep it down";
				val.Amount = 1;
				val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
				{
					new RequirementConfig
					{
						Item = "SledgeCheat",
						Amount = 2
					}
				};
				CustomItem val9 = new CustomItem("BeerSwamp", "Tankard", val);
				val9.ItemDrop.m_itemData.m_shared.m_name = "Poozle";
				val9.ItemDrop.m_itemData.m_shared.m_itemType = (ItemType)2;
				val9.ItemDrop.m_itemData.m_shared.m_ammoType = component.m_itemData.m_shared.m_ammoType;
				val9.ItemDrop.m_itemData.m_shared.m_attack.m_attackAnimation = "emote_drink";
				val9.ItemDrop.m_itemData.m_shared.m_consumeStatusEffect = _poozy.StatusEffect;
				val9.ItemDrop.m_itemData.m_shared.m_maxStackSize = 30;
				ItemManager.Instance.AddItem(val9);
				CustomItemConversion val10 = new CustomItemConversion((ConversionConfig)new FermenterConversionConfig
				{
					FromItem = "MushSwamp",
					ToItem = "BeerSwamp",
					ProducedItems = 10
				});
				ItemManager.Instance.AddItemConversion(val10);
				val = new ItemConfig();
				val.Description = "Pine-tipped barley wort, needing time to become hearty forest beer.";
				val.Amount = 1;
				val.CraftingStation = "piece_MeadCauldron";
				val.MinStationLevel = 1;
				val.Requirements = (RequirementConfig[])(object)new RequirementConfig[2]
				{
					new RequirementConfig
					{
						Item = "Thistle",
						Amount = 5
					},
					new RequirementConfig
					{
						Item = "Mushroom",
						Amount = 5
					}
				};
				CustomItem val11 = new CustomItem("MushForest", "MeadBaseTasty", val);
				val11.ItemDrop.m_itemData.m_shared.m_name = "Forest Mush";
				val11.ItemDrop.m_itemData.m_shared.m_consumeStatusEffect = _musty.StatusEffect;
				ItemManager.Instance.AddItem(val11);
				ServingTrayHelper.AddToServingTray(val3, "Mead");
				val = new ItemConfig();
				val.Description = "Hearty ale with pine and barley, best after a long hunt in the wilds.";
				val.Amount = 20;
				val.CraftingStation = "";
				val.MinStationLevel = 1;
				val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
				{
					new RequirementConfig
					{
						Item = "SledgeCheat",
						Amount = 1
					}
				};
				CustomItem val12 = new CustomItem("BeerForest", "MeadTasty", val);
				val12.ItemDrop.m_itemData.m_shared.m_name = "Musky Beer";
				val12.ItemDrop.m_itemData.m_shared.m_itemType = (ItemType)2;
				val12.ItemDrop.m_itemData.m_shared.m_ammoType = component.m_itemData.m_shared.m_ammoType;
				val12.ItemDrop.m_itemData.m_shared.m_attack.m_attackAnimation = "emote_drink";
				val12.ItemDrop.m_itemData.m_shared.m_consumeStatusEffect = _musty.StatusEffect;
				val12.ItemDrop.m_itemData.m_shared.m_maxStackSize = 20;
				ItemManager.Instance.AddItem(val12);
				CustomItemConversion val13 = new CustomItemConversion((ConversionConfig)new FermenterConversionConfig
				{
					FromItem = "MushForest",
					ToItem = "BeerForest",
					ProducedItems = 10
				});
				ItemManager.Instance.AddItemConversion(val13);
				ServingTrayHelper.AddToServingTray(val12, "Mead");
				val = new ItemConfig();
				val.Description = "Thistle-bitten mush, steeped for the green fairy.";
				val.Amount = 1;
				val.CraftingStation = CraftingStations.MeadKetill;
				val.MinStationLevel = 1;
				val.Requirements = (RequirementConfig[])(object)new RequirementConfig[4]
				{
					new RequirementConfig
					{
						Item = "Pukeberries",
						Amount = 10
					},
					new RequirementConfig
					{
						Item = "NeckTail",
						Amount = 5
					},
					new RequirementConfig
					{
						Item = "Honey",
						Amount = 5
					},
					new RequirementConfig
					{
						Item = "Guck",
						Amount = 1
					}
				};
				CustomItem val14 = new CustomItem("MushWyrmwood", "MeadBaseTasty", val);
				val14.ItemDrop.m_itemData.m_shared.m_name = "Wyrmwood Mush";
				val14.ItemDrop.m_itemData.m_shared.m_description = "Bitter green spirit steeped in thistle and honey. Sip carefully.";
				ItemManager.Instance.AddItem(val14);
				CustomItem val15 = new CustomItem("WyrmwoodSpirit", "MeadSwimmer", new ItemConfig
				{
					Description = "Bitter green spirit steeped in thistle and honey. Sip carefully.",
					Amount = 20,
					CraftingStation = "",
					MinStationLevel = 1
				});
				val15.ItemDrop.m_itemData.m_shared.m_name = "Wyrmwood Spirit";
				val15.ItemDrop.m_itemData.m_shared.m_itemType = (ItemType)2;
				val15.ItemDrop.m_itemData.m_shared.m_attack.m_attackAnimation = "emote_drink";
				val15.ItemDrop.m_itemData.m_shared.m_consumeStatusEffect = _verydrunk.StatusEffect;
				val15.ItemDrop.m_itemData.m_shared.m_maxStackSize = 20;
				ItemManager.Instance.AddItem(val15);
				ItemManager.Instance.AddItemConversion(new CustomItemConversion((ConversionConfig)new FermenterConversionConfig
				{
					FromItem = "MushWyrmwood",
					ToItem = "WyrmwoodSpirit",
					ProducedItems = 10,
					Station = "fermenter"
				}));
				ServingTrayHelper.AddToServingTray(val15, "Mead");
				val = new ItemConfig();
				val.Name = "Rolled Thistle";
				val.Description = "rolled up thistle";
				val.CraftingStation = "piece_workbench";
				val.MinStationLevel = 2;
				val.Requirements = (RequirementConfig[])(object)new RequirementConfig[2]
				{
					new RequirementConfig
					{
						Item = "Thistle",
						Amount = 3
					},
					new RequirementConfig
					{
						Item = "Floam",
						Amount = 1
					}
				};
				ItemConfig val16 = val;
				CustomItem val17 = new CustomItem("RolledThistle", "Thistle", val16);
				val17.ItemDrop.m_itemData.m_shared.m_itemType = (ItemType)2;
				val17.ItemDrop.m_itemData.m_shared.m_name = "Rolled Thistle";
				val17.ItemDrop.m_itemData.m_shared.m_maxStackSize = 20;
				val17.ItemDrop.m_itemData.m_shared.m_weight = 0.5f;
				val17.ItemDrop.m_itemData.m_shared.m_consumeStatusEffect = _smokedthistle.StatusEffect;
				ItemManager.Instance.AddItem(val17);
				val = new ItemConfig();
				val.Description = "A swirl of blue eyes and honey, waiting to find the wind.";
				val.Amount = 1;
				val.CraftingStation = "piece_MeadCauldron";
				val.MinStationLevel = 1;
				val.Requirements = (RequirementConfig[])(object)new RequirementConfig[3]
				{
					new RequirementConfig
					{
						Item = "GreydwarfEye",
						Amount = 10
					},
					new RequirementConfig
					{
						Item = "Gloam",
						Amount = 1
					},
					new RequirementConfig
					{
						Item = "Honey",
						Amount = 5
					}
				};
				CustomItem val18 = new CustomItem("MushWayfinder", "MeadBaseSwimmer", val);
				val18.ItemDrop.m_itemData.m_shared.m_name = "Wayfinder's Mead Base";
				ItemManager.Instance.AddItem(val18);
				val = new ItemConfig();
				val.Description = "It grants even a novice the instincts of an expert sailor.";
				val.Amount = 20;
				val.CraftingStation = "";
				val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
				{
					new RequirementConfig
					{
						Item = "SledgeCheat",
						Amount = 1
					}
				};
				CustomItem val19 = new CustomItem("MeadModer", "MeadLightfoot", val);
				val19.ItemDrop.m_itemData.m_shared.m_name = "Wayfinder's Brew";
				val19.ItemDrop.m_itemData.m_shared.m_itemType = (ItemType)2;
				val19.ItemDrop.m_itemData.m_shared.m_attack.m_attackAnimation = "emote_drink";
				SharedData shared = val19.ItemDrop.m_itemData.m_shared;
				CustomStatusEffect seModer = _seModer;
				shared.m_consumeStatusEffect = ((seModer != null) ? seModer.StatusEffect : null);
				val19.ItemDrop.m_itemData.m_shared.m_maxStackSize = 20;
				ItemManager.Instance.AddItem(val19);
				CustomItemConversion val20 = new CustomItemConversion((ConversionConfig)new FermenterConversionConfig
				{
					FromItem = "MushWayfinder",
					ToItem = "MeadModer",
					ProducedItems = 10
				});
				ItemManager.Instance.AddItemConversion(val20);
				ServingTrayHelper.AddToServingTray(val19, "Mead");
				val = new ItemConfig();
				val.Description = "A dead man's key. The bones of a pirate. A bit of honey to dilute the horror of the pot.";
				val.Amount = 1;
				val.CraftingStation = "piece_MeadCauldron";
				val.MinStationLevel = 1;
				val.Requirements = (RequirementConfig[])(object)new RequirementConfig[3]
				{
					new RequirementConfig
					{
						Item = "CryptKey",
						Amount = 1
					},
					new RequirementConfig
					{
						Item = "Honey",
						Amount = 5
					},
					new RequirementConfig
					{
						Item = "BoneFragments",
						Amount = 10
					}
				};
				CustomItem val21 = new CustomItem("MushDowser", "MeadBaseLightFoot", val);
				val21.ItemDrop.m_itemData.m_shared.m_name = "Dead Man Ale Base";
				ItemManager.Instance.AddItem(val21);
				val = new ItemConfig();
				val.Description = "A heavy, metallic liquid. It causes your blood to pulse when standing over secret treasures.";
				val.Amount = 20;
				val.CraftingStation = "";
				val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
				{
					new RequirementConfig
					{
						Item = "SledgeCheat",
						Amount = 1
					}
				};
				CustomItem val22 = new CustomItem("MeadWishbone", "MeadEitrLingering", val);
				val22.ItemDrop.m_itemData.m_shared.m_name = "Dead Man's Ale";
				val22.ItemDrop.m_itemData.m_shared.m_itemType = (ItemType)2;
				val22.ItemDrop.m_itemData.m_shared.m_attack.m_attackAnimation = "emote_drink";
				SharedData shared2 = val22.ItemDrop.m_itemData.m_shared;
				CustomStatusEffect seWishbone = _seWishbone;
				shared2.m_consumeStatusEffect = ((seWishbone != null) ? seWishbone.StatusEffect : null);
				val22.ItemDrop.m_itemData.m_shared.m_maxStackSize = 20;
				ItemManager.Instance.AddItem(val22);
				CustomItemConversion val23 = new CustomItemConversion((ConversionConfig)new FermenterConversionConfig
				{
					FromItem = "MushDowser",
					ToItem = "MeadWishbone",
					ProducedItems = 10
				});
				ItemManager.Instance.AddItemConversion(val23);
				ServingTrayHelper.AddToServingTray(val22, "Mead");
			}
			catch (Exception ex)
			{
				ZLog.LogError((object)"error vrp custom materials");
				if (VRPMod.DebugMode())
				{
					ZLog.LogError((object)ex.Message);
				}
			}
			finally
			{
				PrefabManager.OnPrefabsRegistered -= AddCustomDrinks;
			}
		}
	}
	public class GoldItemPatch
	{
		public static void CraftGoldItems()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			try
			{
				using BundleCache.Scope scope = new BundleCache.Scope("goldbundle");
				AssetBundle ab = scope.Bundle;
				ItemConfig val = new ItemConfig();
				val.Requirements = (RequirementConfig[])(object)new RequirementConfig[2]
				{
					new RequirementConfig
					{
						Item = "Tankard",
						Amount = 1
					},
					new RequirementConfig
					{
						Item = "Coins",
						Amount = 999
					}
				};
				RecipeHelper.AddVRPItem("TankardGold", ref ab, val);
				val = new ItemConfig();
				val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
				{
					new RequirementConfig
					{
						Item = "Coins",
						Amount = 20000
					}
				};
				RecipeHelper.AddVRPItem("BandGold", ref ab, val);
			}
			catch (Exception ex)
			{
				ZLog.LogError((object)"error adding gold items");
				if (VRPMod.DebugMode())
				{
					ZLog.LogError((object)ex.Message);
				}
			}
			finally
			{
				PrefabManager.OnVanillaPrefabsAvailable -= CraftGoldItems;
			}
		}
	}
	internal class Patcher
	{
		public static void Loader()
		{
			PrefabManager.OnVanillaPrefabsAvailable += BonefirePatch.BuildPieceBonefire;
			PrefabManager.OnVanillaPrefabsAvailable += GoldItemPatch.CraftGoldItems;
			PrefabManager.OnVanillaPrefabsAvailable += ValonPatch.ValonItems;
			PrefabManager.OnVanillaPrefabsAvailable += StoneAgePatch.StoneAgeItems;
		}
	}
	public class StoneAgePatch
	{
		public static void StoneAgeItems()
		{
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Expected O, but got Unknown
			try
			{
				foreach (IGrouping<string, KeyValuePair<string, StoneAgeBundleData.ComplexRecipe>> item in StoneAgeBundleData.VRP_Armor.GroupBy<KeyValuePair<string, StoneAgeBundleData.ComplexRecipe>, string>((KeyValuePair<string, StoneAgeBundleData.ComplexRecipe> kv) => kv.Value.BundleKey, StringComparer.OrdinalIgnoreCase))
				{
					using BundleCache.Scope scope = new BundleCache.Scope(item.Key);
					AssetBundle ab = scope.Bundle;
					if ((Object)(object)ab == (Object)null)
					{
						Logger.LogWarning((object)("Missing bundle for recipe group: " + item.Key));
						continue;
					}
					foreach (KeyValuePair<string, StoneAgeBundleData.ComplexRecipe> item2 in item)
					{
						string key = item2.Key;
						StoneAgeBundleData.ComplexRecipe value = item2.Value;
						RequirementConfig[] requirements = ((IEnumerable<KeyValuePair<string, (int, int)>>)value.Requirements).Select((Func<KeyValuePair<string, (int, int)>, RequirementConfig>)((KeyValuePair<string, (int baseAmount, int perLevel)> req) => new RequirementConfig
						{
							Item = req.Key,
							Amount = req.Value.baseAmount,
							AmountPerLevel = req.Value.perLevel
						})).ToArray();
						ItemConfig ic = new ItemConfig
						{
							CraftingStation = value.CraftingStation,
							MinStationLevel = value.StationLevel,
							Requirements = requirements
						};
						RecipeHelper.AddVRPItem(key, ref ab, ic);
					}
				}
			}
			catch (Exception ex)
			{
				ZLog.LogError((object)"error adding vrp armor items");
				if (VRPMod.DebugMode())
				{
					ZLog.LogError((object)ex.Message);
				}
			}
			finally
			{
				PrefabManager.OnVanillaPrefabsAvailable -= StoneAgeItems;
			}
		}
	}
	public class ValonPatch
	{
		public static void ValonItems()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			try
			{
				using BundleCache.Scope scope = new BundleCache.Scope("valonbundle");
				AssetBundle bundle = scope.Bundle;
				ItemConfig val = new ItemConfig();
				val.Name = "BanditHelm";
				val.Description = "A weird hat to hide your identity";
				val.CraftingStation = "piece_workbench";
				val.MinStationLevel = 1;
				val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
				{
					new RequirementConfig
					{
						Item = "Wood",
						Amount = 10
					}
				};
				ItemConfig val2 = val;
				CustomItem val3 = new CustomItem(bundle, "ValonHelm", false, val2);
				ItemManager.Instance.AddItem(val3);
			}
			catch (Exception ex)
			{
				ZLog.LogError((object)"error adding gold items");
				if (VRPMod.DebugMode())
				{
					ZLog.LogError((object)ex.Message);
				}
			}
			finally
			{
				PrefabManager.OnVanillaPrefabsAvailable -= ValonItems;
			}
		}
	}
}
namespace VRPCrafts.Helpers
{
	public static class RecipeHelper
	{
		[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
		public static void AddVRPItem(string prefabname, ref AssetBundle ab, ItemConfig ic)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			try
			{
				GameObject val = ab.LoadAsset<GameObject>(prefabname);
				if (Object.op_Implicit((Object)(object)val))
				{
					CustomItem val2 = new CustomItem(val, true, ic);
					ItemManager.Instance.AddItem(val2);
					if (VRPMod.DebugMode())
					{
						ZLog.Log((object)("vrp added item " + prefabname));
					}
				}
				else
				{
					ZLog.LogWarning((object)("vrp did not find prefab " + prefabname));
				}
			}
			catch (Exception ex)
			{
				Logger.LogError((object)(prefabname + ex.Message));
			}
		}
	}
	[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(0)]
	[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
	public static class ServingTrayHelper
	{
		private static void CreatePrefabForServingTray(GameObject prefab, string name, string description, string category = "VRP", string displayName = null)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			PieceConfig val = new PieceConfig();
			val.Name = displayName ?? name;
			val.Description = description;
			val.PieceTable = PieceTables.ServingTray;
			val.Category = category;
			val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
			{
				new RequirementConfig
				{
					Item = name,
					Amount = 1
				}
			};
			PieceConfig val2 = val;
			PieceManager.Instance.AddPiece(new CustomPiece(prefab, false, val2));
		}

		public static void AddToServingTray(CustomItem item, string category = "VRP")
		{
			CreatePrefabForServingTray(item.ItemPrefab, ((Object)item.ItemDrop).name, item.ItemDrop.m_itemData.m_shared.m_description, category, item.ItemDrop.GetHoverName());
		}

		public static void AddToServingTray(string foodPrefabName, string category = "VRP")
		{
			GameObject prefab = PrefabManager.Instance.GetPrefab(foodPrefabName);
			ItemDrop val = (Object.op_Implicit((Object)(object)prefab) ? prefab.GetComponent<ItemDrop>() : null);
			if (!Object.op_Implicit((Object)(object)val))
			{
				ZLog.LogWarning((object)("Food prefab '" + foodPrefabName + "' not found or missing ItemDrop."));
				return;
			}
			string text = "ST_" + ((Object)prefab).name;
			if (PieceManager.Instance.GetPiece(text) != null)
			{
				ZLog.Log((object)("Piece '" + text + "' already added; skipping."));
				return;
			}
			string hoverName = val.GetHoverName();
			string description = val.m_itemData?.m_shared?.m_description ?? "";
			val.m_itemData?.m_shared?.m_icons?.FirstOrDefault();
			CreatePrefabForServingTray(prefab, foodPrefabName, description, category, hoverName);
		}
	}
	[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
	[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(0)]
	public static class VignetteHelper
	{
		private static Sprite _generatedVignette;

		public static GameObject CreateOverlay(string name, Color color, bool startEnabled = false)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			Object.DontDestroyOnLoad((Object)(object)val);
			Canvas obj = val.AddComponent<Canvas>();
			obj.renderMode = (RenderMode)0;
			obj.sortingOrder = 90;
			CanvasScaler obj2 = val.AddComponent<CanvasScaler>();
			obj2.uiScaleMode = (ScaleMode)1;
			obj2.referenceResolution = new Vector2(1920f, 1080f);
			GameObject val2 = new GameObject("VignetteImage");
			val2.transform.SetParent(val.transform);
			Image obj3 = val2.AddComponent<Image>();
			if ((Object)(object)_generatedVignette == (Object)null)
			{
				_generatedVignette = CreateRadialSprite();
			}
			obj3.sprite = _generatedVignette;
			obj3.type = (Type)0;
			((Graphic)obj3).color = color;
			((Graphic)obj3).raycastTarget = false;
			RectTransform component = ((Component)obj3).GetComponent<RectTransform>();
			component.anchorMin = Vector2.zero;
			component.anchorMax = Vector2.one;
			component.offsetMin = Vector2.zero;
			component.offsetMax = Vector2.one;
			val.SetActive(startEnabled);
			return val;
		}

		private static Sprite CreateRadialSprite()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			int num = 256;
			Texture2D val = new Texture2D(num, num);
			((Texture)val).wrapMode = (TextureWrapMode)1;
			float num2 = (float)num / 2f;
			for (int i = 0; i < num; i++)
			{
				for (int j = 0; j < num; j++)
				{
					float num3 = Mathf.Clamp01(Mathf.Pow(Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num2, num2)) / num2, 2.5f));
					val.SetPixel(j, i, new Color(1f, 1f, 1f, num3));
				}
			}
			val.Apply();
			return Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num), new Vector2(0.5f, 0.5f));
		}

		public static void SetIntensity(GameObject overlay, float intensity)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)overlay == (Object)null))
			{
				Image componentInChildren = overlay.GetComponentInChildren<Image>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					Color color = ((Graphic)componentInChildren).color;
					color.a = Mathf.Clamp(intensity, 0f, 0.95f);
					((Graphic)componentInChildren).color = color;
				}
			}
		}
	}
}
namespace VRPCrafts.MessageRouter
{
	public abstract class RpcMethodHandler
	{
		[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
		public abstract bool Process(RoutedRPCData routedRpcData);
	}
}
namespace VRPCrafts.Handlers
{
	[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
	[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(0)]
	public static class RoutedRPCDataExtensions
	{
		public static void DeserializeFrom(this RoutedRPCData routedRpcData, ref ZPackage sourcePackage)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			routedRpcData.m_msgID = sourcePackage.ReadLong();
			routedRpcData.m_senderPeerID = sourcePackage.ReadLong();
			routedRpcData.m_targetPeerID = sourcePackage.ReadLong();
			routedRpcData.m_targetZDO = sourcePackage.ReadZDOID();
			routedRpcData.m_methodHash = sourcePackage.ReadInt();
			sourcePackage.ReadPackageTo(ref routedRpcData.m_parameters);
		}

		public static void Clear(this RoutedRPCData routedRpcData)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			routedRpcData.m_msgID = 0L;
			routedRpcData.m_senderPeerID = 0L;
			routedRpcData.m_targetPeerID = 0L;
			routedRpcData.m_targetZDO = default(ZDOID);
			routedRpcData.m_methodHash = 0;
			ZPackage parameters = routedRpcData.m_parameters;
			if (parameters != null)
			{
				parameters.Clear();
			}
		}
	}
	[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
	[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(0)]
	public class StatusOverlayManager : MonoBehaviour
	{
		private static StatusOverlayManager _instance;

		private GameObject _masterOverlay;

		private Image _overlayImage;

		private float _targetAlpha;

		private const float FadeSpeed = 1.5f;

		public static StatusOverlayManager Instance
		{
			get
			{
				//IL_0012: 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)
				//IL_0027: Expected O, but got Unknown
				if ((Object)(object)_instance == (Object)null)
				{
					GameObject val = new GameObject("StatusOverlayManager_AutoCreated");
					_instance = val.AddComponent<StatusOverlayManager>();
					Object.DontDestroyOnLoad((Object)val);
				}
				return _instance;
			}
		}

		private void Awake()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_instance == (Object)null)
			{
				_instance = this;
				Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			}
			else if ((Object)(object)_instance != (Object)(object)this)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			_masterOverlay = VignetteHelper.CreateOverlay("MasterStatusOverlay", new Color(1f, 1f, 1f, 0f));
			if ((Object)(object)_masterOverlay != (Object)null)
			{
				_overlayImage = _masterOverlay.GetComponentInChildren<Image>();
			}
		}

		private void Update()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_masterOverlay == (Object)null || (Object)(object)_overlayImage == (Object)null)
			{
				return;
			}
			float a = ((Graphic)_overlayImage).color.a;
			if (!Mathf.Approximately(a, _targetAlpha))
			{
				float num = Mathf.MoveTowards(a, _targetAlpha, Time.deltaTime * 1.5f);
				VignetteHelper.SetIntensity(_masterOverlay, num);
				if (num <= 0f && _targetAlpha == 0f)
				{
					_masterOverlay.SetActive(false);
				}
			}
		}

		public void UpdateOverlay(Color color, float intensity, bool enabled, float strength = 1f)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_masterOverlay == (Object)null)
			{
				return;
			}
			if (enabled)
			{
				_targetAlpha = intensity * strength;
				_masterOverlay.SetActive(true);
				if ((Object)(object)_overlayImage != (Object)null)
				{
					Color color2 = color;
					color2.a = ((Graphic)_overlayImage).color.a;
					((Graphic)_overlayImage).color = color2;
				}
			}
			else
			{
				_targetAlpha = 0f;
			}
		}
	}
	public static class ZPackageExtensions
	{
		[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
		public static void ReadPackageTo(this ZPackage sourcePackage, ref ZPackage targetPackage)
		{
			int num = sourcePackage.m_reader.ReadInt32();
			if (num <= 0)
			{
				targetPackage.m_writer.Flush();
				targetPackage.m_stream.SetLength(0L);
				return;
			}
			byte[] array = new byte[num];
			int num2 = sourcePackage.m_reader.Read(array, 0, num);
			if (num2 != num)
			{
				Array.Resize(ref array, num2);
			}
			targetPackage.m_writer.Flush();
			targetPackage.m_stream.SetLength(array.Length);
			targetPackage.m_stream.Position = 0L;
			targetPackage.m_stream.Write(array, 0, array.Length);
		}
	}
}
namespace VRPCrafts.Data
{
	[<f0a9e327-155b-4b02-a5f5-742527f7f2f2>NullableContext(1)]
	[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(0)]
	public static class StoneAgeBundleData
	{
		[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(0)]
		public class ComplexRecipe
		{
			public string Item { get; set; }

			public int Amount { get; set; } = 1;

			public string CraftingStation { get; set; } = string.Empty;

			public string Description { get; set; }

			public int StationLevel { get; set; } = 1;

			[<a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(new byte[] { 1, 1, 0 })]
			[field: <a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(new byte[] { 1, 1, 0 })]
			public Dictionary<string, (int baseAmount, int perLevel)> Requirements
			{
				[return: <a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(new byte[] { 1, 1, 0 })]
				get;
				[param: <a3e915f2-3af4-49c1-a162-86419d3c930d>Nullable(new byte[] { 1, 1, 0 })]
				set;
			}

			public string BundleKey { get; set; }
		}

		public static readonly Dictionary<string, ComplexRecipe> VRP_Armor = new Dictionary<string, ComplexRecipe>
		{
			["LeatherChestRed"] = new ComplexRecipe
			{
				Item = "LeatherChestRed",
				Amount = 1,
				CraftingStation = "piece_workbench",
				StationLevel = 1,
				BundleKey = "stoneagebundle",
				Requirements = new Dictionary<string, (int, int)>
				{
					["DeerHide"] = (6, 10),
					["BoneFragments"] = (0, 10)
				}
			},
			["LeatherChestGreen"] = new ComplexRecipe
			{
				Item = "LeatherChestGreen",
				Amount = 1,
				CraftingStation = "piece_workbench",
				StationLevel = 1,
				BundleKey = "stoneagebundle",
				Requirements = new Dictionary<string, (int, int)>
				{
					["DeerHide"] = (6, 10),
					["BoneFragments"] = (0, 10)
				}
			},
			["LeatherChestBlue"] = new ComplexRecipe
			{
				Item = "LeatherChestBlue",
				Amount = 1,
				CraftingStation = "piece_workbench",
				StationLevel = 1,
				BundleKey = "stoneagebundle",
				Requirements = new Dictionary<string, (int, int)>
				{
					["DeerHide"] = (6, 10),
					["BoneFragments"] = (0, 10)
				}
			},
			["LeatherTrousersRed"] = new ComplexRecipe
			{
				Item = "LeatherTrousersRed",
				Amount = 1,
				CraftingStation = "piece_workbench",
				StationLevel = 1,
				BundleKey = "stoneagebundle",
				Requirements = new Dictionary<string, (int, int)>
				{
					["DeerHide"] = (6, 10),
					["BoneFragments"] = (0, 10)
				}
			},
			["LeatherTrousersGreen"] = new ComplexRecipe
			{
				Item = "LeatherTrousersGreen",
				Amount = 1,
				CraftingStation = "piece_workbench",
				StationLevel = 1,
				BundleKey = "stoneagebundle",
				Requirements = new Dictionary<string, (int, int)>
				{
					["DeerHide"] = (6, 10),
					["BoneFragments"] = (0, 10)
				}
			},
			["LeatherTrousersBlue"] = new ComplexRecipe
			{
				Item = "LeatherTrousersBlue",
				Amount = 1,
				CraftingStation = "piece_workbench",
				StationLevel = 1,
				BundleKey = "stoneagebundle",
				Requirements = new Dictionary<string, (int, int)>
				{
					["DeerHide"] = (6, 10),
					["BoneFragments"] = (0, 10)
				}
			},
			["LeatherHelmRed"] = new ComplexRecipe
			{
				Item = "LeatherHelmRed",
				Amount = 1,
				CraftingStation = "piece_workbench",
				StationLevel = 1,
				BundleKey = "stoneagebundle",
				Requirements = new Dictionary<string, (int, int)>
				{
					["DeerHide"] = (6, 10),
					["BoneFragments"] = (0, 10)
				}
			},
			["LeatherHelmBlue"] = new ComplexRecipe
			{
				Item = "LeatherHelmBlue",
				Amount = 1,
				CraftingStation = "piece_workbench",
				StationLevel = 1,
				BundleKey = "stoneagebundle",
				Requirements = new Dictionary<string, (int, int)>
				{
					["DeerHide"] = (6, 10),
					["BoneFragments"] = (0, 10)
				}
			},
			["LeatherHelmGreen"] = new ComplexRecipe
			{
				Item = "LeatherHelmGreen",
				Amount = 1,
				CraftingStation = "piece_workbench",
				StationLevel = 1,
				BundleKey = "stoneagebundle",
				Requirements = new Dictionary<string, (int, int)>
				{
					["DeerHide"] = (6, 10),
					["BoneFragments"] = (0, 10)
				}
			},
			["TrollChestBlack"] = new ComplexRecipe
			{
				Item = "TrollChestBlack",
				Amount = 1,
				CraftingStation = "piece_workbench",
				StationLevel = 2,
				BundleKey = "stoneagebundle",
				Requirements = new Dictionary<string, (int, int)>
				{
					["TrollHide"] = (5, 5),
					["BoneFragments"] = (2, 5)
				}
			},
			["TrollChestBrown"] = new ComplexRecipe
			{
				Item = "TrollChestBrown",
				Amount = 1,
				CraftingStation = "piece_workbench",
				StationLevel = 2,
				BundleKey = "stoneagebundle",
				Requirements = new Dictionary<string, (int, int)>
				{
					["TrollHide"] = (5, 5),
					["BoneFragments"] =