Decompiled source of TamingTools v0.0.1

TamingTools.dll

Decompiled 17 hours 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.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using JetBrains.Annotations;
using LocalizationManager;
using Microsoft.CodeAnalysis;
using ServerSync;
using TMPro;
using TamingTools.RPC;
using UnityEngine;
using UnityEngine.SceneManagement;
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: Guid("d8b8b522-7ea7-41eb-a21a-d076e3ab8dc5")]
[assembly: ComVisible(false)]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyProduct("TamingTools")]
[assembly: AssemblyCompany("")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyTitle("TamingTools")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyConfiguration("")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace TamingTools
{
	public class Enchants
	{
		public static void AddTamingFoodEffect(string itemName, Tameable tame)
		{
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			if (itemName == TamingTools.t1foodPrefabName)
			{
				tame.m_character.m_seman.AddStatusEffect(TamingTools.prefabManager.effect_tameFood1, true, 0, 0f);
			}
			else if (itemName == TamingTools.t2foodPrefabName)
			{
				tame.m_character.m_seman.AddStatusEffect(TamingTools.prefabManager.effect_tameFood2, true, 0, 0f);
			}
			else
			{
				if (!(itemName == TamingTools.t3foodPrefabName))
				{
					return;
				}
				tame.m_character.m_seman.AddStatusEffect(TamingTools.prefabManager.effect_tameFood3, true, 0, 0f);
			}
			if (!tame.IsTamed())
			{
				tame.m_nview.GetZDO().Set(ZDOVars.s_tameLastFeeding, 0L);
			}
			GameObject prefab = ZNetScene.instance.GetPrefab("fx_guardstone_permitted_add");
			Object.Instantiate<GameObject>(prefab, ((Component)tame).transform.position, ((Component)tame).transform.rotation);
		}

		public static float getTamingFoodEffect(Tameable tame)
		{
			SEMan seman = tame.m_character.m_seman;
			if (seman != null)
			{
				List<StatusEffect> statusEffects = seman.GetStatusEffects();
				foreach (StatusEffect item in statusEffects)
				{
					DBG.blogDebug("se.m_name=" + item.m_name);
					if (item.m_name == "$tt_effect_tamefood")
					{
						DBG.blogDebug("has tameFood:" + item.m_cooldown);
						return item.m_cooldown;
					}
				}
			}
			return 1f;
		}

		public static float getPlayersSpeedTame(Vector3 center, float maxdist)
		{
			//IL_0068: 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)
			List<Player> s_players = Player.s_players;
			float num = 0f;
			float time = Time.time;
			foreach (Player item in s_players)
			{
				if (!((Character)item).m_nview.IsValid())
				{
					continue;
				}
				DBG.tryblogDebug("plr=" + item.GetPlayerName(), "plr=could not get name");
				if (!(Vector3.Distance(((Component)item).transform.position, center) > maxdist))
				{
					ZDO zDO = ((Character)item).m_nview.GetZDO();
					if (time < zDO.GetFloat("SE_SpeedTame", 0f))
					{
						DBG.blogDebug("has Speed Tame");
						num += 3f;
					}
					if (time < zDO.GetFloat("SE_BestialCommand", 0f))
					{
						DBG.blogDebug("has Bestial Command");
						num += 1f;
					}
				}
			}
			return num;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Tameable), "OnConsumedItem")]
		private static void PostfixOnConsume(ItemDrop item, Tameable __instance)
		{
			if ((Object)(object)item != (Object)null)
			{
				AddTamingFoodEffect(((Object)item).name.Replace("(Clone)", ""), __instance);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Tameable), "Awake")]
		private static void Postfix_Tameable_Awake(Tameable __instance)
		{
			if ((Object)(object)__instance.m_monsterAI == (Object)null)
			{
				DBG.blogDebug("No monsterAI, skipping remove tamingfood");
				return;
			}
			List<ItemDrop> consumeItems = __instance.m_monsterAI.m_consumeItems;
			if (consumeItems == null || consumeItems.Count == 0)
			{
				return;
			}
			bool flag = __instance.IsTamed();
			int num = 0;
			for (int num2 = consumeItems.Count - 1; num2 >= 0; num2--)
			{
				if (((Object)consumeItems[num2]).name == TamingTools.t3foodPrefabName)
				{
					if (!flag)
					{
						return;
					}
					consumeItems.RemoveAt(num2);
					num++;
				}
				else if (((Object)consumeItems[num2]).name == TamingTools.t2foodPrefabName)
				{
					if (!flag)
					{
						return;
					}
					consumeItems.RemoveAt(num2);
					num++;
				}
				else if (((Object)consumeItems[num2]).name == TamingTools.t1foodPrefabName)
				{
					if (!flag)
					{
						return;
					}
					consumeItems.RemoveAt(num2);
					num++;
				}
				if (num >= PrefabManager.tamingfood_IDrops.Length)
				{
					return;
				}
			}
			if (flag)
			{
				return;
			}
			ItemDrop[] tamingfood_IDrops = PrefabManager.tamingfood_IDrops;
			foreach (ItemDrop item in tamingfood_IDrops)
			{
				consumeItems.Add(item);
			}
			GameObject prefab = ZNetScene.instance.GetPrefab(((Object)__instance).name.Replace("(Clone)", ""));
			if ((Object)(object)prefab != (Object)null)
			{
				List<ItemDrop> consumeItems2 = prefab.GetComponent<MonsterAI>().m_consumeItems;
				ItemDrop[] tamingfood_IDrops2 = PrefabManager.tamingfood_IDrops;
				foreach (ItemDrop item2 in tamingfood_IDrops2)
				{
					consumeItems2.Add(item2);
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Character), "SetTamed")]
		private static void Postfix_SetTame(Character __instance, bool tamed)
		{
			if (!tamed || (Object)(object)__instance.m_baseAI == (Object)null)
			{
				return;
			}
			BaseAI baseAI = __instance.m_baseAI;
			MonsterAI val = (MonsterAI)(object)((baseAI is MonsterAI) ? baseAI : null);
			if ((Object)(object)val == (Object)null)
			{
				DBG.blogDebug("skipping as type is:" + ((object)__instance.m_baseAI).GetType().Name);
				return;
			}
			List<ItemDrop> consumeItems = val.m_consumeItems;
			if (consumeItems == null || consumeItems.Count == 0)
			{
				return;
			}
			int num = 0;
			for (int num2 = consumeItems.Count - 1; num2 >= 0; num2--)
			{
				if (((Object)consumeItems[num2]).name == TamingTools.t3foodPrefabName)
				{
					DBG.blogDebug("Removing (" + num2 + ") " + ((Object)consumeItems[num2]).name);
					consumeItems.RemoveAt(num2);
					num++;
				}
				else if (((Object)consumeItems[num2]).name == TamingTools.t2foodPrefabName)
				{
					DBG.blogDebug("Removing (" + num2 + ") " + ((Object)consumeItems[num2]).name);
					consumeItems.RemoveAt(num2);
					num++;
				}
				else if (((Object)consumeItems[num2]).name == TamingTools.t1foodPrefabName)
				{
					DBG.blogDebug("Removing (" + num2 + ") " + ((Object)consumeItems[num2]).name);
					consumeItems.RemoveAt(num2);
					num++;
				}
				if (num >= PrefabManager.tamingfood_IDrops.Length)
				{
					break;
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Tameable), "DecreaseRemainingTime")]
		private static void PrefixDecreaseRemainingTime(Tameable __instance, ref float time)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			time += getPlayersSpeedTame(((Component)__instance).transform.position, 25f);
			time *= getTamingFoodEffect(__instance);
		}
	}
	public class TT_StatusEffect : StatusEffect
	{
		private ZNetView m_nview;

		public string ZDO_key = "";

		public float m_lvl = 1f;

		public float m_length = 600f;

		public float m_damageMod = 0.6f;

		public SkillType[] modifySkills = (SkillType[])(object)new SkillType[0];

		public override void Setup(Character character)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			base.m_character = character;
			if (!string.IsNullOrEmpty(base.m_startMessage))
			{
				base.m_character.Message(base.m_startMessageType, base.m_startMessage, 0, (Sprite)null);
			}
			m_nview = base.m_character.m_nview;
			if (m_nview.IsValid())
			{
				if (base.m_repeatInterval > 0f)
				{
					m_length = base.m_repeatInterval;
				}
				DBG.blogDebug("Setting " + ZDO_key + " to time " + (Time.time + m_length));
				m_nview.GetZDO().Set(ZDO_key, Time.time + m_length);
			}
			((StatusEffect)this).TriggerStartEffects();
		}

		public override void UpdateStatusEffect(float dt)
		{
			base.m_time += dt;
			if (base.m_repeatInterval > 0f)
			{
				base.m_msgTimer += dt;
				if (base.m_msgTimer > base.m_repeatInterval)
				{
					DBG.blogDebug("resetting timer for " + ZDO_key + " to time " + (Time.time + base.m_repeatInterval));
					base.m_msgTimer = 0f;
					m_nview.GetZDO().Set(ZDO_key, Time.time + base.m_repeatInterval);
				}
			}
		}

		public override void ModifyAttack(SkillType skill, ref HitData hitData)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			if (modifySkills.Length != 0 && (modifySkills.Contains(skill) || (int)modifySkills[0] == 999))
			{
				((DamageTypes)(ref hitData.m_damage)).Modify(m_damageMod);
			}
		}

		public override void Stop()
		{
			((StatusEffect)this).Stop();
			m_nview.GetZDO().Set(ZDO_key, 0f);
		}
	}
	public class PrefabManager : MonoBehaviour
	{
		public GameObject Root;

		public static ZNetScene zns;

		private static AssetBundle Assets;

		public const string assetBundleName = "tt_assets";

		public static string assetPath = TamingTools.assetPath;

		public static GameObject T1FoodPrefab;

		public static GameObject T2FoodPrefab;

		public static GameObject T3FoodPrefab;

		private static GameObject TameMeadBasePrefab;

		private static GameObject TameMeadPrefab;

		public StatusEffect effect_tamebuff = ScriptableObject.CreateInstance<StatusEffect>();

		public StatusEffect effect_tameFood1 = ScriptableObject.CreateInstance<StatusEffect>();

		public StatusEffect effect_tameFood2 = ScriptableObject.CreateInstance<StatusEffect>();

		public StatusEffect effect_tameFood3 = ScriptableObject.CreateInstance<StatusEffect>();

		public static TT_StatusEffect effect_speed_tame = ScriptableObject.CreateInstance<TT_StatusEffect>();

		public static ItemDrop[] tamingfood_IDrops = (ItemDrop[])(object)new ItemDrop[3];

		private static bool setItemConversions = false;

		public static bool hasInitItems = false;

		public static Dictionary<string, Shader> ShaderDict = new Dictionary<string, Shader>();

		public static List<GameObject> MocksToComplete = new List<GameObject>();

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			Root = new GameObject("PrefabList");
			Root.transform.SetParent(TamingTools.Root.transform);
			Root.SetActive(false);
			Assets = Utils.LoadAssetBundle("tt_assets", Assembly.GetExecutingAssembly());
			T1FoodPrefab = Assets.LoadAsset<GameObject>(assetPath + TamingTools.t1foodPrefabName + ".prefab");
			T2FoodPrefab = Assets.LoadAsset<GameObject>(assetPath + TamingTools.t2foodPrefabName + ".prefab");
			T3FoodPrefab = Assets.LoadAsset<GameObject>(assetPath + TamingTools.t3foodPrefabName + ".prefab");
			MocksToComplete.Add(T3FoodPrefab);
			tamingfood_IDrops[0] = T1FoodPrefab.GetComponent<ItemDrop>();
			tamingfood_IDrops[1] = T2FoodPrefab.GetComponent<ItemDrop>();
			tamingfood_IDrops[2] = T3FoodPrefab.GetComponent<ItemDrop>();
			TameMeadPrefab = Assets.LoadAsset<GameObject>(assetPath + "MeadSpeedTame.prefab");
			TameMeadBasePrefab = Assets.LoadAsset<GameObject>(assetPath + "MeadBaseSpeedTame.prefab");
		}

		public static AssetBundle getAssetBundle()
		{
			return Assets;
		}

		public static void InitItemReg()
		{
			DBG.blogDebug("InitItemReg");
			TamingTools.prefabManager.EffectReg();
			DBG.blogDebug("Post effect reg");
			TameMeadBasePrefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_consumeStatusEffect = (StatusEffect)(object)effect_speed_tame;
			TameMeadPrefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_consumeStatusEffect = (StatusEffect)(object)effect_speed_tame;
			CompleteAllMocks();
			hasInitItems = true;
		}

		public static void CompleteAllMocks()
		{
			for (int num = MocksToComplete.Count - 1; num >= 0; num--)
			{
				if (Utils.FixMock(MocksToComplete[num]))
				{
					MocksToComplete.RemoveAt(num);
				}
				else
				{
					DBG.blogDebug("failed to fix Mock on: " + ((Object)MocksToComplete[num]).name);
				}
			}
		}

		public static void ItemReg()
		{
			DBG.blogDebug("ItemReg");
			if (TamingTools.useTamingFoods.Value)
			{
				addItem(T1FoodPrefab, TamingTools.T1Food_Recipe.Value, TamingTools.T1Food_Station.Value);
				addItem(T2FoodPrefab, TamingTools.T2Food_Recipe.Value, TamingTools.T2Food_Station.Value);
				addItem(T3FoodPrefab, TamingTools.T3Food_Recipe.Value, TamingTools.T3Food_Station.Value);
			}
			else
			{
				removeItem("TT_T1Food");
				removeItem("TT_T2Food");
				removeItem("TT_T3Food");
			}
			if (TamingTools.useTamingMead.Value)
			{
				addSpeedTamePotion();
				return;
			}
			removeItem("MeadBaseSpeedTame");
			removeItem("MeadSpeedTame");
		}

		public static void addSpeedTamePotion()
		{
			DBG.blogDebug("Adding recipe for SpeedTamePotion");
			addItem(TameMeadBasePrefab, TamingTools.TamingMead_Recipe.Value, TamingTools.TamingMead_Station.Value);
			DBG.blogDebug("Added recipe for SpeedTamePotionBase");
			addItem(TameMeadPrefab, "", "");
			addFermenterConversions();
		}

		private static void addFermenterConversions()
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			if (!setItemConversions)
			{
				DBG.blogDebug("Adding conversion for SpeedTamePotion");
				GameObject prefab = ZNetScene.instance.GetPrefab("fermenter");
				if ((Object)(object)prefab == (Object)null)
				{
					DBG.blogDebug("Failed to find fermenter");
				}
				DBG.blogDebug("Got Fermenter prefab ");
				Fermenter component = prefab.GetComponent<Fermenter>();
				ItemConversion conversion = new ItemConversion();
				conversion.m_from = TameMeadBasePrefab.GetComponent<ItemDrop>();
				if (component.m_conversion.Exists((ItemConversion c) => (Object)(object)c.m_from == (Object)(object)conversion.m_from))
				{
					DBG.blogDebug("Already conversion for speed tame potion ");
					setItemConversions = true;
					return;
				}
				conversion.m_to = TameMeadPrefab.GetComponent<ItemDrop>();
				conversion.m_producedItems = 4;
				component.m_conversion.Add(conversion);
				DBG.blogDebug("Added conversion for SpeedTamePotion");
				setItemConversions = true;
			}
		}

		private static void removeItem(string prefabName)
		{
			GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(prefabName);
			if (!Object.op_Implicit((Object)(object)itemPrefab))
			{
				DBG.blogWarning("cannot remove: " + prefabName + " as not in OBjectDB");
			}
			else
			{
				ObjectDB.instance.m_items.Remove(itemPrefab);
			}
		}

		public static void addItem(GameObject go, string recipe, string station)
		{
			if ((Object)(object)go == (Object)null || ((Object)go).name == null)
			{
				DBG.blogDebug("go is null");
			}
			DBG.blogDebug("Attempting to add item:" + ((Object)go).name);
			if (Object.op_Implicit((Object)(object)ObjectDB.instance.GetItemPrefab(((Object)go).name)))
			{
				DBG.blogDebug("got item");
				if (Object.op_Implicit((Object)(object)ZNetScene.instance))
				{
					DBG.blogDebug("addItem resetting: " + ((Object)go).name + " recipe");
					ResetRecipe(recipe, station, ((Object)go).name);
				}
				DBG.blogDebug("already in oDB: " + ((Object)go).name);
			}
			else
			{
				DBG.blogDebug("addItem adding: " + ((Object)go).name + " to ObjectDB: " + ((Object)ObjectDB.instance).name);
				Utils.addItemToODB(go, ObjectDB.instance);
				DBG.blogDebug("Amount in objectDB=" + ObjectDB.instance.m_itemByHash.Count);
				if (Object.op_Implicit((Object)(object)ZNetScene.instance))
				{
					ResetRecipe(recipe, station, ((Object)go).name);
				}
			}
		}

		private static Recipe ResetRecipe(string recipeConfig, string craftingStation, string item)
		{
			if (recipeConfig == "" || craftingStation == "")
			{
				return null;
			}
			GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(item);
			DBG.blogDebug("resetting: " + item + " recipe");
			if ((Object)(object)itemPrefab == (Object)null)
			{
				DBG.blogWarning(item + " is null");
				return null;
			}
			ItemDrop item2 = default(ItemDrop);
			if (!itemPrefab.TryGetComponent<ItemDrop>(ref item2))
			{
				DBG.blogWarning(item + " does not have itemDrop");
				return null;
			}
			Recipe val = ScriptableObject.CreateInstance<Recipe>();
			((Object)val).name = "Recipe_" + item;
			val.m_item = item2;
			if (item == ((Object)T2FoodPrefab).name)
			{
				val.m_amount = 3;
			}
			string[] array = craftingStation.Split(new char[1] { ':' });
			GameObject prefab = ZNetScene.instance.GetPrefab(array[0]);
			CraftingStation val2 = default(CraftingStation);
			if ((Object)(object)prefab == (Object)null || !prefab.TryGetComponent<CraftingStation>(ref val2))
			{
				DBG.blogWarning("invalid crafting station: " + array[0]);
				return null;
			}
			val.m_craftingStation = val2;
			val.m_repairStation = val2;
			if (array.Length > 1 && int.TryParse(array[1], out var result))
			{
				val.m_minStationLevel = result;
			}
			else
			{
				val.m_minStationLevel = 5;
			}
			string[] array2 = recipeConfig.Split(new char[1] { ',' });
			int amt = 1;
			int upgrade_amt = 1;
			List<Requirement> list = new List<Requirement>();
			for (int i = 0; i < array2.Length; i++)
			{
				string[] array3 = array2[i].Split(new char[1] { ':' });
				if (array3.Length > 1 && int.TryParse(array3[1], out var result2))
				{
					if (array3.Length > 2 && int.TryParse(array3[2], out var result3))
					{
						amt = result2;
						upgrade_amt = result3;
					}
					else
					{
						amt = result2;
						upgrade_amt = Mathf.RoundToInt((float)result2 * 0.75f);
					}
				}
				Requirement val3 = makeRequirment(array3[0], amt, upgrade_amt);
				if (val3 == null)
				{
					return null;
				}
				list.Add(val3);
			}
			val.m_resources = list.ToArray();
			ObjectDB.instance.m_recipes.Add(val);
			return val;
		}

		private static Requirement makeRequirment(string itemStr, int amt, int upgrade_amt)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			Requirement val = new Requirement();
			GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(itemStr);
			ItemDrop resItem = default(ItemDrop);
			if (!Object.op_Implicit((Object)(object)itemPrefab) || !itemPrefab.TryGetComponent<ItemDrop>(ref resItem))
			{
				DBG.blogDebug("Ingredient: " + itemStr + " is not found");
				return null;
			}
			val.m_amount = amt;
			val.m_amountPerLevel = upgrade_amt;
			val.m_resItem = resItem;
			return val;
		}

		private void EffectReg()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			Transform transform = Assets.LoadAsset<GameObject>(assetPath + "vfx_Effects.prefab").transform;
			effect_tamebuff.m_startEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1];
			effect_tamebuff.m_startEffects.m_effectPrefabs[0] = new EffectData();
			EffectData val = effect_tamebuff.m_startEffects.m_effectPrefabs[0];
			val.m_attach = true;
			val.m_inheritParentRotation = true;
			val.m_inheritParentScale = true;
			val.m_scale = true;
			GameObject val2 = Object.Instantiate<GameObject>(((Component)transform.Find("vfx_TameFood")).gameObject, TamingTools.prefabManager.Root.transform);
			((Object)val2).name = ((Object)val2).name.Replace("(Clone)", "");
			effect_tamebuff.m_startEffects.m_effectPrefabs[0].m_prefab = val2;
			((Object)effect_tamebuff).name = "SE_TameBuff";
			effect_tamebuff.m_ttl = 600f;
			effect_tameFood1 = Object.Instantiate<StatusEffect>(effect_tamebuff, Root.transform);
			((Object)effect_tameFood1).name = "SE_TameFood1";
			effect_tameFood1.m_ttl = 620f;
			effect_tameFood1.m_name = "$tt_effect_tamefood";
			effect_tameFood1.m_cooldown = 1.18f;
			effect_tameFood2 = Object.Instantiate<StatusEffect>(effect_tameFood1, Root.transform);
			((Object)effect_tameFood2).name = "SE_TameFood2";
			effect_tameFood2.m_cooldown = 1.49f;
			effect_tameFood3 = Object.Instantiate<StatusEffect>(effect_tameFood1, Root.transform);
			((Object)effect_tameFood3).name = "SE_TameFood3";
			effect_tameFood3.m_cooldown = 2f;
			DBG.blogDebug("In Effect speed tame");
			((Object)effect_speed_tame).name = "SE_SpeedTame";
			((StatusEffect)effect_speed_tame).m_ttl = 600f;
			effect_speed_tame.ZDO_key = "SE_SpeedTame";
			DBG.blogDebug("In Effect speed tame icon");
			Object[] array = Assets.LoadAssetWithSubAssets(assetPath + "SpeedTamePotionIcon.png");
			DBG.blogDebug("In Effect speed tame sprite");
			ref Sprite icon = ref ((StatusEffect)effect_speed_tame).m_icon;
			Object obj = array[1];
			icon = (Sprite)(object)((obj is Sprite) ? obj : null);
			((StatusEffect)effect_speed_tame).m_name = "$at_effect_speed_tame";
			DBG.blogDebug("finsihed speed tame");
		}
	}
	internal class DBG
	{
		public static void blogInfo(object o)
		{
			TamingTools.logger.LogInfo(o);
		}

		public static void blogWarning(object o)
		{
			TamingTools.logger.LogWarning(o);
		}

		public static void blogDebug(object o)
		{
			if (TamingTools.debugout.Value)
			{
				TamingTools.logger.LogWarning(o);
			}
		}

		public static void tryblogDebug(object o, object o_backup)
		{
			try
			{
				if (TamingTools.debugout.Value)
				{
					TamingTools.logger.LogWarning(o);
				}
			}
			catch
			{
				TamingTools.logger.LogWarning(o_backup);
			}
		}
	}
	[BepInPlugin("meldurson.TamingTools", "TamingTools", "0.0.1")]
	public class TamingTools : BaseUnityPlugin
	{
		[Serializable]
		public class TameConfig : ICloneable
		{
			public string PrefabName { get; set; } = "";


			public bool commandable { get; set; } = true;


			public float tamingTime { get; set; } = 1800f;


			public float fedDuration { get; set; } = 600f;


			public float consumeRange { get; set; } = 2f;


			public float consumeSearchInterval { get; set; } = 10f;


			public float consumeSearchRange { get; set; } = 10f;


			public string consumeItems { get; set; } = "RawMeat";


			public bool changeGroup { get; set; } = false;


			public bool procretion { get; set; } = true;


			public bool procretionOverwrite { get; set; } = false;


			public int maxCreatures { get; set; } = 5;


			public float pregnancyChance { get; set; } = 0.33f;


			public float pregnancyDuration { get; set; } = 60f;


			public float growTime { get; set; } = 3000f;


			public float size { get; set; } = 1f;


			public float followDistMulti { get; set; } = 1f;


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


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


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


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


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


			public bool removeTameable { get; set; } = false;


			public object Clone()
			{
				return MemberwiseClone();
			}
		}

		[Serializable]
		public class specificMates : ICloneable
		{
			public string prefabName { get; set; } = "";


			public List<chanceOffspring> possibleOffspring { get; set; } = new List<chanceOffspring>();


			public object Clone()
			{
				return MemberwiseClone();
			}
		}

		[Serializable]
		public class chanceOffspring : ICloneable
		{
			public GameObject offspring { get; set; } = null;


			public float chance { get; set; } = 100f;


			public object Clone()
			{
				return MemberwiseClone();
			}
		}

		public const string versionNumber = "0.0.1";

		public const string versionMinimum = "0.0.1";

		public const string modName = "TamingTools";

		public const string GUID = "meldurson.TamingTools";

		public static ManualLogSource logger;

		public static string assetPath = "Assets/MeldursonAssets/";

		public static string t1foodPrefabName = "TT_T1Food";

		public static string t2foodPrefabName = "TT_T2Food";

		public static string t3foodPrefabName = "TT_T3Food";

		public static Dictionary<string, TameConfig> customTamesList = new Dictionary<string, TameConfig>();

		public static string[] fastTameFoods = new string[3] { t1foodPrefabName, t2foodPrefabName, t3foodPrefabName };

		public static GameObject Root;

		public static PrefabManager prefabManager;

		public static CfgPackage CfgPackage;

		public static bool ServerConfigReceived = false;

		public static bool localizeLoaded = false;

		public static Harmony harmony = new Harmony("meldurson.TamingTools");

		public static ConfigEntry<bool> debugout;

		public static ConfigEntry<bool> useTamingFoods;

		public static ConfigEntry<string> T1Food_Recipe;

		public static ConfigEntry<string> T1Food_Station;

		public static ConfigEntry<string> T2Food_Recipe;

		public static ConfigEntry<string> T2Food_Station;

		public static ConfigEntry<string> T3Food_Recipe;

		public static ConfigEntry<string> T3Food_Station;

		public static ConfigEntry<bool> useTamingMead;

		public static ConfigEntry<string> TamingMead_Recipe;

		public static ConfigEntry<string> TamingMead_Station;

		public static ConfigSync configSync = new ConfigSync("meldurson.TamingTools")
		{
			DisplayName = "TamingTools",
			CurrentVersion = "0.0.1",
			MinimumRequiredVersion = "0.0.1"
		};

		private void Awake()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Expected O, but got Unknown
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Expected O, but got Unknown
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Expected O, but got Unknown
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Expected O, but got Unknown
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Expected O, but got Unknown
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Expected O, but got Unknown
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Expected O, but got Unknown
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Expected O, but got Unknown
			logger = ((BaseUnityPlugin)this).Logger;
			debugout = config("1:General", "Debug Output", value: false, new ConfigDescription("Determines if debug is output to bepinex log", (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting: false);
			useTamingMead = config("1:General", "useTamingMead", value: true, new ConfigDescription("Use a taming equipment that helps with calming or seeing more stats of a creature", (AcceptableValueBase)null, Array.Empty<object>()));
			useTamingFoods = config("1:General", "useTamingFoods", value: true, new ConfigDescription("Use taming foods that can be used to speed up taming if fed to creatures", (AcceptableValueBase)null, Array.Empty<object>()));
			T1Food_Recipe = config("5: Recipes", "T1Food Recipe", "MeadTasty:1,MushroomYellow:3,LeatherScraps:1", new ConfigDescription("What is the recipe for crafting the Basic Food, separate amount with : and different items with ,", (AcceptableValueBase)null, Array.Empty<object>()));
			T1Food_Station = config("5: Recipes", "T1Food Station", "piece_cauldron:1", new ConfigDescription("What is the required Crafting Station and Level, separated by a : such as piece_workbench:3 would be lvl 3 Workbench (vanilla stations are: piece_workbench, forge, piece_cauldron, piece_stonecutter, piece_artisanstation, blackforge, piece_magetable, piece_MeadCauldron, piece_preptable", (AcceptableValueBase)null, Array.Empty<object>()));
			T2Food_Recipe = config("5: Recipes", "T2Food Recipe", "MeadHealthMedium:6,BarleyFlour:10,DragonTear:1", new ConfigDescription("What is the recipe for crafting the Superior Food, separate amount with : and different items with ,", (AcceptableValueBase)null, Array.Empty<object>()));
			T2Food_Station = config("5: Recipes", "T2Food Station", "piece_preptable:1", new ConfigDescription("What is the required Crafting Station and Level, separated by a : such as piece_workbench:3 would be lvl 3 Workbench (vanilla stations are: piece_workbench, forge, piece_cauldron, piece_stonecutter, piece_artisanstation, blackforge, piece_magetable, piece_MeadCauldron, piece_preptable", (AcceptableValueBase)null, Array.Empty<object>()));
			T3Food_Recipe = config("5: Recipes", "T3Food Recipe", "MeadEitrMinor:4,MeadHealthMajor:2,Fish9:1,MushroomMagecap:5", new ConfigDescription("What is the recipe for crafting the Excellent Food, separate amount with : and different items with ,", (AcceptableValueBase)null, Array.Empty<object>()));
			T3Food_Station = config("5: Recipes", "T3Food Station", "piece_cauldron:5", new ConfigDescription("What is the required Crafting Station and Level, separated by a : such as piece_workbench:3 would be lvl 3 Workbench (vanilla stations are: piece_workbench, forge, piece_cauldron, piece_stonecutter, piece_artisanstation, blackforge, piece_magetable, piece_MeadCauldron, piece_preptable", (AcceptableValueBase)null, Array.Empty<object>()));
			TamingMead_Recipe = config("5: Recipes", "TamingMead Recipe", "TrophyWolf:3,BarleyFlour:5,RawMeat:5,Honey:10", new ConfigDescription("What is the recipe for crafting the Taming Mead, separate amount with : and different items with ,", (AcceptableValueBase)null, Array.Empty<object>()));
			TamingMead_Station = config("5: Recipes", "TamingMead Station", "piece_MeadCauldron:1", new ConfigDescription("What is the required Crafting Station and Level, separated by a : such as piece_workbench:3 would be lvl 3 Workbench (vanilla stations are: piece_workbench, forge, piece_cauldron, piece_stonecutter, piece_artisanstation, blackforge, piece_magetable, piece_MeadCauldron, piece_preptable", (AcceptableValueBase)null, Array.Empty<object>()));
			((BaseUnityPlugin)this).Config.Save();
			Root = new GameObject("TamingTools Root");
			prefabManager = Root.AddComponent<PrefabManager>();
			Object.DontDestroyOnLoad((Object)(object)Root);
			PerformPatches();
		}

		public void PerformPatches()
		{
			harmony.PatchAll(typeof(TamingTools));
			harmony.PatchAll(typeof(Enchants));
			IEnumerable<MethodBase> patchedMethods = harmony.GetPatchedMethods();
			DBG.blogDebug("Patched Methods=");
			foreach (MethodBase item in patchedMethods)
			{
				DBG.blogDebug(item.ReflectedType?.ToString() + ":" + item.Name + " is patched");
			}
		}

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

		private ConfigEntry<T> config<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);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(ConfigSync), "HandleConfigSyncRPC")]
		private static void Postfix_HandleConfigSyncRPC()
		{
			DBG.blogDebug("Has Server HandleConfigSyncRPC");
			if (!PrefabManager.hasInitItems)
			{
				DBG.blogDebug("Has not done init item reg");
			}
			PrefabManager.ItemReg();
			DBG.blogDebug("Item Reg completed");
		}

		[HarmonyPriority(5)]
		[HarmonyPatch(typeof(ObjectDB), "Awake")]
		[HarmonyPostfix]
		private static void Postfix_ODB_Awake(ObjectDB __instance)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			DBG.blogDebug("In main Load");
			if (!localizeLoaded)
			{
				Localizer.Load();
				localizeLoaded = true;
			}
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name != "main")
			{
				DBG.blogDebug("Not Main Scene");
				return;
			}
			if (!Object.op_Implicit((Object)(object)ZNet.instance))
			{
				DBG.blogDebug("No instance of ZNet");
				return;
			}
			if (!PrefabManager.hasInitItems)
			{
				PrefabManager.zns = ((Component)__instance).gameObject.GetComponent<ZNetScene>();
				PrefabManager.InitItemReg();
			}
			if (!ZNet.instance.IsServer())
			{
				DBG.blogDebug("ZNet not server");
			}
			else
			{
				PrefabManager.ItemReg();
			}
		}
	}
	public static class Utils
	{
		public static AssetBundle LoadAssetBundle(string bundleName, Assembly assembly)
		{
			string text = null;
			try
			{
				text = assembly.GetManifestResourceNames().Single((string str) => str.EndsWith(bundleName));
			}
			catch
			{
			}
			if (text == null)
			{
				DBG.blogWarning("Could not find asset by the name " + bundleName);
				return null;
			}
			Stream manifestResourceStream = assembly.GetManifestResourceStream(text);
			AssetBundle result;
			using (manifestResourceStream)
			{
				result = AssetBundle.LoadFromStream(manifestResourceStream);
			}
			return result;
		}

		public static T CopyBroComponent<T, TU>(this Component comp, TU other) where T : Component
		{
			Type baseType = ((object)comp).GetType().BaseType;
			IEnumerable<FieldInfo> fields = baseType.GetFields();
			foreach (FieldInfo item in fields)
			{
				object value = item.GetValue(other);
				try
				{
					item.SetValue(comp, value);
				}
				catch
				{
					DBG.blogDebug("Failed bro copy for: " + item);
				}
			}
			return (T)(object)((comp is T) ? comp : null);
		}

		public static string GetPrefabName(string name)
		{
			int num = name.IndexOfAny(new char[2] { '(', ' ' });
			if (num != -1)
			{
				return name.Remove(num);
			}
			return name;
		}

		public static bool addToZNS(GameObject go)
		{
			ZNetScene instance = ZNetScene.instance;
			if (!Object.op_Implicit((Object)(object)instance))
			{
				return false;
			}
			int stableHashCode = StringExtensionMethods.GetStableHashCode(((Object)go).name);
			if (instance.m_namedPrefabs.ContainsKey(stableHashCode))
			{
				DBG.blogDebug("ZNS already has " + ((Object)go).name);
				return false;
			}
			if (Object.op_Implicit((Object)(object)go.GetComponent<ZNetView>()))
			{
				instance.m_prefabs.Add(go);
			}
			else
			{
				instance.m_nonNetViewPrefabs.Add(go);
			}
			instance.m_namedPrefabs.Add(stableHashCode, go);
			DBG.blogDebug("Added " + ((Object)go).name + " to zns");
			return true;
		}

		public static bool addItemToODB(GameObject go, ObjectDB odb)
		{
			int stableHashCode = StringExtensionMethods.GetStableHashCode(((Object)go).name);
			if ((Object)(object)go.GetComponent<ItemDrop>() == (Object)null)
			{
				DBG.blogDebug("Does not have ItemDrop: " + ((Object)go).name);
				return false;
			}
			if (odb.m_itemByHash.ContainsKey(stableHashCode))
			{
				DBG.blogDebug("Already added item " + ((Object)go).name);
				return false;
			}
			addToZNS(go);
			odb.m_items.Add(go);
			odb.m_itemByHash.Add(stableHashCode, go);
			return true;
		}

		public static void cloneProperties<TOne, TTwo>(TOne copyTo, TTwo CopyFrom) where TOne : Component where TTwo : Component
		{
			FieldInfo[] fields = ((object)CopyFrom).GetType().GetFields();
			foreach (FieldInfo fieldInfo in fields)
			{
				try
				{
					if ((fieldInfo.GetValue(copyTo) != null) & (fieldInfo.GetValue(CopyFrom) != fieldInfo.GetValue(copyTo)))
					{
						fieldInfo.SetValue(copyTo, fieldInfo.GetValue(CopyFrom));
						DBG.blogDebug("From " + ((object)CopyFrom).GetType()?.ToString() + fieldInfo.Name + " set to " + fieldInfo.GetValue(copyTo));
					}
				}
				catch
				{
					DBG.blogDebug(((object)copyTo).GetType()?.ToString() + " does not have " + fieldInfo.Name);
				}
			}
		}

		public static Color colFromHex(string hexStr)
		{
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				DBG.blogDebug("in colfromhex");
				int num = int.Parse(hexStr.Replace("#", ""), NumberStyles.HexNumber);
				float num2 = num & 0xFF;
				float num3 = (num >> 8) & 0xFF;
				float num4 = (num >> 16) & 0xFF;
				DBG.blogDebug("r,g,b=" + num4 + "," + num3 + "," + num2);
				Color result = default(Color);
				((Color)(ref result))..ctor(num4 / 255f, num3 / 255f, num2 / 255f);
				return result;
			}
			catch
			{
				DBG.blogWarning("Not a valid hex color code");
				return Color.white;
			}
		}

		public static Texture2D changeEggTex(Texture2D oldTex, Color col, bool invertShadow)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//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_01d8: Unknown result type (might be due to invalid IL or missing references)
			DBG.blogDebug("in change color");
			Texture2D val = Object.Instantiate<Texture2D>(oldTex);
			Color[] array = (Color[])(object)new Color[3] { col, col, col };
			int num = Mathf.Min(3, ((Texture)val).mipmapCount);
			Color val3 = default(Color);
			for (int i = 0; i < num; i++)
			{
				Color[] pixels = val.GetPixels(i);
				DBG.blogDebug("cols.length=" + pixels.Length);
				for (int j = 0; j < pixels.Length; j++)
				{
					Color val2 = pixels[j];
					if (invertShadow)
					{
						((Color)(ref val3))..ctor(1f - val2.r, 1f - val2.g, 1f - val2.b);
						Color val4 = val3 - new Color(Mathf.Min(val3.r, 0.6f), Mathf.Min(val3.g, 0.6f), Mathf.Min(val3.b, 0.6f));
						Color val5 = pixels[j] * col;
						pixels[j] = val5 - val5 * val4 * 1f;
						pixels[j] = changeHue(val5, 0.5f) * val3 * 1.3f + pixels[j];
					}
					else
					{
						Color val6 = Color.grey * val2;
						val6 -= new Color(Mathf.Min(val6.r, 0.25f), Mathf.Min(val6.g, 0.25f), Mathf.Min(val6.b, 0.25f));
						pixels[j] *= col;
					}
					pixels[j].a = val2.a;
				}
				val.SetPixels(pixels, i);
			}
			val.Apply(false);
			return val;
		}

		public static Color changeHue(Color col, float hue)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			float num2 = default(float);
			float num3 = default(float);
			float num = default(float);
			Color.RGBToHSV(col, ref num, ref num2, ref num3);
			num = (num + hue) % 1f;
			return Color.HSVToRGB(num, num2, num3);
		}

		public static T GetCopyOf<T>(this Component comp, T other) where T : Component
		{
			Type type = ((object)comp).GetType();
			if (type != ((object)other).GetType())
			{
				return default(T);
			}
			List<Type> list = new List<Type>();
			Type baseType = type.BaseType;
			while (baseType != null && !(baseType == typeof(MonoBehaviour)))
			{
				list.Add(baseType);
				baseType = baseType.BaseType;
			}
			IEnumerable<PropertyInfo> enumerable = type.GetProperties(BindingFlags.Public);
			foreach (Type item in list)
			{
				enumerable = enumerable.Concat(item.GetProperties(BindingFlags.Public));
			}
			enumerable = from property in enumerable
				where !(type == typeof(Rigidbody)) || !(property.Name == "inertiaTensor")
				where !property.CustomAttributes.Any((CustomAttributeData attribute) => attribute.AttributeType == typeof(ObsoleteAttribute))
				select property;
			foreach (PropertyInfo pinfo in enumerable)
			{
				if (pinfo.CanWrite && !enumerable.Any((PropertyInfo e) => e.Name == $"shared{char.ToUpper(pinfo.Name[0])}{pinfo.Name.Substring(1)}"))
				{
					try
					{
						pinfo.SetValue(comp, pinfo.GetValue(other, null), null);
					}
					catch
					{
					}
				}
			}
			IEnumerable<FieldInfo> enumerable2 = type.GetFields(BindingFlags.Public);
			foreach (FieldInfo finfo in enumerable2)
			{
				foreach (Type item2 in list)
				{
					if (!enumerable2.Any((FieldInfo e) => e.Name == $"shared{char.ToUpper(finfo.Name[0])}{finfo.Name.Substring(1)}"))
					{
						enumerable2 = enumerable2.Concat(item2.GetFields(BindingFlags.Public));
					}
				}
			}
			foreach (FieldInfo item3 in enumerable2)
			{
				item3.SetValue(comp, item3.GetValue(other));
			}
			enumerable2 = enumerable2.Where((FieldInfo field) => field.CustomAttributes.Any((CustomAttributeData attribute) => attribute.AttributeType == typeof(ObsoleteAttribute)));
			foreach (FieldInfo item4 in enumerable2)
			{
				item4.SetValue(comp, item4.GetValue(other));
			}
			return (T)(object)((comp is T) ? comp : null);
		}

		public static T AddComponent<T>(this GameObject go, T toAdd) where T : Component
		{
			return go.AddComponent(((object)toAdd).GetType()).GetCopyOf(toAdd);
		}

		public static T CopyIntoParent<T>(T go, T parent) where T : Component
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			T val = Object.Instantiate<T>(go);
			((Object)(object)val).name = ((Object)(object)go).name;
			((Component)val).transform.parent = ((Component)parent).transform;
			((Component)val).transform.localPosition = new Vector3(0f, 0f, 0f);
			return val;
		}

		public static bool FixMockMesh(MeshFilter meshFilter, ZNetScene zns)
		{
			string text = ((Object)meshFilter.mesh).name.Split(new char[1] { ' ' })[0];
			DBG.blogDebug("fullname=" + text);
			string[] array = text.Split(new char[1] { '_' });
			if (array[0] != "JVLmock")
			{
				DBG.blogDebug("Not Mock, Skipping");
				return false;
			}
			if (array.Length == 1)
			{
				DBG.blogDebug("Not long enough name, Skipping");
				return false;
			}
			GameObject val = zns.GetPrefab(array[1]);
			if ((Object)(object)val == (Object)null)
			{
				DBG.blogDebug("Could not find prefab with name:" + array[1]);
				return false;
			}
			string[] array2 = text.Split(new string[1] { "__" }, StringSplitOptions.None);
			for (int i = 1; i < array2.Length; i++)
			{
				Transform val2 = val.transform.Find(array2[i]);
				if ((Object)(object)val2 == (Object)null)
				{
					DBG.blogDebug("Child is null:" + array2[i]);
					return false;
				}
				DBG.blogDebug("Child is valid:" + array2[i]);
				val = ((Component)val2).gameObject;
			}
			MeshFilter component = val.GetComponent<MeshFilter>();
			if ((Object)(object)component == (Object)null)
			{
				DBG.blogDebug("No Mesh filter in object:" + ((Object)val).name);
				return false;
			}
			Mesh mesh = component.mesh;
			if ((Object)(object)mesh == (Object)null)
			{
				DBG.blogDebug("No Mesh in MeshFilter:" + ((Object)val).name);
				return false;
			}
			meshFilter.mesh = mesh;
			DBG.blogDebug("Fixed mesh on " + ((Object)meshFilter).name);
			return true;
		}

		public static bool FixMock(GameObject go, bool justMesh = true)
		{
			ZNetScene instance = ZNetScene.instance;
			bool flag = false;
			MeshFilter[] components = go.GetComponents<MeshFilter>();
			foreach (MeshFilter meshFilter in components)
			{
				flag = flag || FixMockMesh(meshFilter, instance);
			}
			MeshFilter[] componentsInChildren = go.GetComponentsInChildren<MeshFilter>();
			foreach (MeshFilter meshFilter2 in componentsInChildren)
			{
				flag = flag || FixMockMesh(meshFilter2, instance);
			}
			if (justMesh)
			{
				return flag;
			}
			return flag;
		}
	}
}
namespace TamingTools.RPC
{
	[Serializable]
	public class CfgPackage
	{
		[HarmonyPatch(typeof(Game), "Start")]
		public static class GameStartPatch
		{
			private static void Prefix()
			{
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Expected O, but got Unknown
				ZRoutedRpc.instance.Register<ZPackage>("TT_RecieveConfigs", (Action<long, ZPackage>)RPC_RecieveConfigs);
				ZRoutedRpc.instance.Register<ZPackage>("TT_Configs", (Action<long, ZPackage>)RPC_TT_Configs);
				DBG.blogDebug("RPCs Registered");
				ZPackage val = new ZPackage();
				val.Write("0.0.1");
				version = val;
			}
		}

		public static ZPackage version;

		public static void RPC_RecieveConfigs(long sender, ZPackage pkg)
		{
			DBG.blogInfo("Received Configs from Server");
			if (sender == ZRoutedRpc.instance.GetServerPeerID() && pkg != null && pkg.Size() > 0)
			{
				DBG.blogDebug("Has Valid Server and Package");
				DBG.blogDebug("Unpacked");
				PrefabManager.ItemReg();
			}
		}

		public static void RPC_TT_Configs(long sender, ZPackage pkg)
		{
			string text = pkg.ReadString();
			DBG.blogInfo("Local version:0.0.1,  remote: " + text);
			ZNetPeer peer = ZNet.instance.GetPeer(sender);
			if (ZNet.instance.IsServer())
			{
				if (peer == null)
				{
					DBG.blogInfo("Peer is Null");
				}
				else
				{
					DBG.blogInfo("Peer is not Null");
				}
			}
		}

		public static void RPC_TT_Version(ZRpc rpc, ZPackage pkg)
		{
			string text = pkg.ReadString();
			DBG.blogInfo("Local version:0.0.1,  remote: " + text);
			if (text != "0.0.1")
			{
				DBG.blogWarning("Let Me Tame You Versions do not match");
				if (ZNet.instance.IsServer())
				{
					DBG.blogWarning("Peer (" + rpc.m_socket.GetHostName() + ") has incompatible version, disconnecting...");
					rpc.Invoke("Error", new object[1] { 3 });
				}
			}
		}

		[HarmonyPatch(typeof(ZNet), "OnNewConnection")]
		[HarmonyPostfix]
		private static void SyncVersionPatch(ZNetPeer peer, ref ZNet __instance)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			DBG.blogDebug("Registering version RPC handler");
			peer.m_rpc.Register<ZPackage>("TT_Version", (Action<ZRpc, ZPackage>)RPC_TT_Version);
			DBG.blogDebug("Invoking version check");
			if (version == null)
			{
				ZPackage val = new ZPackage();
				val.Write("0.0.1");
				version = val;
			}
			peer.m_rpc.Invoke("TT_Version", new object[1] { version });
			ZRoutedRpc.instance.InvokeRoutedRPC(peer.m_uid, "TT_Version", new object[1] { version });
		}

		[HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")]
		[HarmonyPostfix]
		private static void SyncConfigsPatch_New(ZRpc rpc, ref ZNet __instance)
		{
			DBG.blogDebug("Registering version RPC handler");
			ZRoutedRpc.instance.InvokeRoutedRPC(__instance.GetPeer(rpc).m_uid, "TT_Configs", new object[1] { version });
		}
	}
}
namespace Microsoft.CodeAnalysis
{
	[<05c2fb3e-b1f5-4d55-b4f9-06940aed948b>Embedded]
	[CompilerGenerated]
	internal sealed class <05c2fb3e-b1f5-4d55-b4f9-06940aed948b>EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[<05c2fb3e-b1f5-4d55-b4f9-06940aed948b>Embedded]
	[CompilerGenerated]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	[<05c2fb3e-b1f5-4d55-b4f9-06940aed948b>Embedded]
	internal sealed class <50695eb0-1575-4a71-9582-f9a8395ba049>NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public <50695eb0-1575-4a71-9582-f9a8395ba049>NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public <50695eb0-1575-4a71-9582-f9a8395ba049>NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	[CompilerGenerated]
	[<05c2fb3e-b1f5-4d55-b4f9-06940aed948b>Embedded]
	internal sealed class <4dbd70ac-3833-421e-8d49-1c491cf72deb>NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public <4dbd70ac-3833-421e-8d49-1c491cf72deb>NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[<05c2fb3e-b1f5-4d55-b4f9-06940aed948b>Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class <a6eb0cb0-d2d8-45fe-8db2-8292719103e8>RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public <a6eb0cb0-d2d8-45fe-8db2-8292719103e8>RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace YamlDotNet
{
	[<4dbd70ac-3833-421e-8d49-1c491cf72deb>NullableContext(1)]
	[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(0)]
	internal sealed class <42fce5d2-ef4d-4e40-8dac-e68996dcdae3>CultureInfoAdapter : CultureInfo
	{
		private readonly IFormatProvider provider;

		public <42fce5d2-ef4d-4e40-8dac-e68996dcdae3>CultureInfoAdapter(CultureInfo baseCulture, IFormatProvider provider)
			: base(baseCulture.Name)
		{
			this.provider = provider;
		}

		[return: <50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)]
		public override object GetFormat(Type formatType)
		{
			return provider.GetFormat(formatType);
		}
	}
	[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(0)]
	[<4dbd70ac-3833-421e-8d49-1c491cf72deb>NullableContext(1)]
	internal static class Polyfills
	{
		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static bool Contains(this string source, char c)
		{
			return source.IndexOf(c) != -1;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static bool EndsWith(this string source, char c)
		{
			if (source.Length > 0)
			{
				return source[source.Length - 1] == c;
			}
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static bool StartsWith(this string source, char c)
		{
			if (source.Length > 0)
			{
				return source[0] == c;
			}
			return false;
		}
	}
	internal static class <409c1ef6-2c5d-48e3-a702-5dff2392221f>PropertyInfoExtensions
	{
		[<4dbd70ac-3833-421e-8d49-1c491cf72deb>NullableContext(1)]
		[return: <50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)]
		public static object ReadValue(this PropertyInfo property, object target)
		{
			return property.GetValue(target, null);
		}
	}
	[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(0)]
	[<4dbd70ac-3833-421e-8d49-1c491cf72deb>NullableContext(1)]
	internal static class <837dff35-c361-4d26-a79c-e914d6d4f5d5>ReflectionExtensions
	{
		private static readonly Func<PropertyInfo, bool> IsInstance = (PropertyInfo property) => !(property.GetMethod ?? property.SetMethod).IsStatic;

		private static readonly Func<PropertyInfo, bool> IsInstancePublic = (PropertyInfo property) => IsInstance(property) && (property.GetMethod ?? property.SetMethod).IsPublic;

		[return: <50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)]
		public static Type BaseType(this Type type)
		{
			return type.GetTypeInfo().BaseType;
		}

		public static bool IsValueType(this Type type)
		{
			return type.GetTypeInfo().IsValueType;
		}

		public static bool IsGenericType(this Type type)
		{
			return type.GetTypeInfo().IsGenericType;
		}

		public static bool IsGenericTypeDefinition(this Type type)
		{
			return type.GetTypeInfo().IsGenericTypeDefinition;
		}

		[return: <50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)]
		public static Type GetImplementationOfOpenGenericInterface(this Type type, Type openGenericType)
		{
			if (!openGenericType.IsGenericType || !openGenericType.IsInterface)
			{
				throw new ArgumentException("The type must be a generic type definition and an interface", "openGenericType");
			}
			if (IsGenericDefinitionOfType(type, openGenericType))
			{
				return type;
			}
			return type.FindInterfaces([<4dbd70ac-3833-421e-8d49-1c491cf72deb>NullableContext(0)] (Type t, object context) => IsGenericDefinitionOfType(t, context), openGenericType).FirstOrDefault();
			static bool IsGenericDefinitionOfType(Type t, [<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)] object context)
			{
				if (t.IsGenericType)
				{
					return t.GetGenericTypeDefinition() == (Type)context;
				}
				return false;
			}
		}

		public static bool IsInterface(this Type type)
		{
			return type.GetTypeInfo().IsInterface;
		}

		public static bool IsEnum(this Type type)
		{
			return type.GetTypeInfo().IsEnum;
		}

		public static bool IsRequired(this MemberInfo member)
		{
			return member.GetCustomAttributes(inherit: true).Any([<4dbd70ac-3833-421e-8d49-1c491cf72deb>NullableContext(0)] (object x) => x.GetType().FullName == "System.Runtime.CompilerServices.RequiredMemberAttribute");
		}

		public static bool HasDefaultConstructor(this Type type, bool allowPrivateConstructors)
		{
			BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Public;
			if (allowPrivateConstructors)
			{
				bindingFlags |= BindingFlags.NonPublic;
			}
			if (!type.IsValueType)
			{
				return type.GetConstructor(bindingFlags, null, Type.EmptyTypes, null) != null;
			}
			return true;
		}

		public static bool IsAssignableFrom(this Type type, Type source)
		{
			return type.IsAssignableFrom(source.GetTypeInfo());
		}

		public static bool IsAssignableFrom(this Type type, TypeInfo source)
		{
			return type.GetTypeInfo().IsAssignableFrom(source);
		}

		public static TypeCode GetTypeCode(this Type type)
		{
			if (IsEnum(type))
			{
				type = Enum.GetUnderlyingType(type);
			}
			if (type == typeof(bool))
			{
				return TypeCode.Boolean;
			}
			if (type == typeof(char))
			{
				return TypeCode.Char;
			}
			if (type == typeof(sbyte))
			{
				return TypeCode.SByte;
			}
			if (type == typeof(byte))
			{
				return TypeCode.Byte;
			}
			if (type == typeof(short))
			{
				return TypeCode.Int16;
			}
			if (type == typeof(ushort))
			{
				return TypeCode.UInt16;
			}
			if (type == typeof(int))
			{
				return TypeCode.Int32;
			}
			if (type == typeof(uint))
			{
				return TypeCode.UInt32;
			}
			if (type == typeof(long))
			{
				return TypeCode.Int64;
			}
			if (type == typeof(ulong))
			{
				return TypeCode.UInt64;
			}
			if (type == typeof(float))
			{
				return TypeCode.Single;
			}
			if (type == typeof(double))
			{
				return TypeCode.Double;
			}
			if (type == typeof(decimal))
			{
				return TypeCode.Decimal;
			}
			if (type == typeof(DateTime))
			{
				return TypeCode.DateTime;
			}
			if (type == typeof(string))
			{
				return TypeCode.String;
			}
			return TypeCode.Object;
		}

		public static bool IsDbNull(this object value)
		{
			return value?.GetType()?.FullName == "System.DBNull";
		}

		public static Type[] GetGenericArguments(this Type type)
		{
			return type.GetTypeInfo().GenericTypeArguments;
		}

		[return: <50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)]
		public static PropertyInfo GetPublicProperty(this Type type, string name)
		{
			return type.GetProperties(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public).FirstOrDefault([<4dbd70ac-3833-421e-8d49-1c491cf72deb>NullableContext(0)] (PropertyInfo p) => p.Name == name);
		}

		[return: <50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)]
		public static FieldInfo GetPublicStaticField(this Type type, string name)
		{
			return type.GetRuntimeField(name);
		}

		public static IEnumerable<PropertyInfo> GetProperties(this Type type, bool includeNonPublic)
		{
			Func<PropertyInfo, bool> predicate = (includeNonPublic ? IsInstance : IsInstancePublic);
			if (!IsInterface(type))
			{
				return type.GetRuntimeProperties().Where(predicate);
			}
			return new Type[1] { type }.Concat(type.GetInterfaces()).SelectMany([<4dbd70ac-3833-421e-8d49-1c491cf72deb>NullableContext(0)] (Type i) => i.GetRuntimeProperties().Where(predicate));
		}

		public static IEnumerable<PropertyInfo> GetPublicProperties(this Type type)
		{
			return GetProperties(type, includeNonPublic: false);
		}

		public static IEnumerable<FieldInfo> GetPublicFields(this Type type)
		{
			return from f in type.GetRuntimeFields()
				where !f.IsStatic && f.IsPublic
				select f;
		}

		public static IEnumerable<MethodInfo> GetPublicStaticMethods(this Type type)
		{
			return from m in type.GetRuntimeMethods()
				where m.IsPublic && m.IsStatic
				select m;
		}

		public static MethodInfo GetPrivateStaticMethod(this Type type, string name)
		{
			return type.GetRuntimeMethods().FirstOrDefault([<4dbd70ac-3833-421e-8d49-1c491cf72deb>NullableContext(0)] (MethodInfo m) => !m.IsPublic && m.IsStatic && m.Name.Equals(name)) ?? throw new MissingMethodException("Expected to find a method named '" + name + "' in '" + type.FullName + "'.");
		}

		[return: <50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)]
		public static MethodInfo GetPublicStaticMethod(this Type type, string name, params Type[] parameterTypes)
		{
			return type.GetRuntimeMethods().FirstOrDefault([<4dbd70ac-3833-421e-8d49-1c491cf72deb>NullableContext(0)] (MethodInfo m) =>
			{
				if (m.IsPublic && m.IsStatic && m.Name.Equals(name))
				{
					ParameterInfo[] parameters = m.GetParameters();
					if (parameters.Length == parameterTypes.Length)
					{
						return parameters.Zip(parameterTypes, [<4dbd70ac-3833-421e-8d49-1c491cf72deb>NullableContext(0)] (ParameterInfo pi, Type pt) => pi.ParameterType == pt).All((bool r) => r);
					}
					return false;
				}
				return false;
			});
		}

		[return: <50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)]
		public static MethodInfo GetPublicInstanceMethod(this Type type, string name)
		{
			return type.GetRuntimeMethods().FirstOrDefault([<4dbd70ac-3833-421e-8d49-1c491cf72deb>NullableContext(0)] (MethodInfo m) => m.IsPublic && !m.IsStatic && m.Name.Equals(name));
		}

		[return: <50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)]
		public static MethodInfo GetGetMethod(this PropertyInfo property, bool nonPublic)
		{
			MethodInfo methodInfo = property.GetMethod;
			if (!nonPublic && !methodInfo.IsPublic)
			{
				methodInfo = null;
			}
			return methodInfo;
		}

		[return: <50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)]
		public static MethodInfo GetSetMethod(this PropertyInfo property)
		{
			return property.SetMethod;
		}

		public static IEnumerable<Type> GetInterfaces(this Type type)
		{
			return type.GetTypeInfo().ImplementedInterfaces;
		}

		public static bool IsInstanceOf(this Type type, object o)
		{
			if (!(o.GetType() == type))
			{
				return o.GetType().GetTypeInfo().IsSubclassOf(type);
			}
			return true;
		}

		public static Attribute[] GetAllCustomAttributes<[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)] TAttribute>(this PropertyInfo member)
		{
			return Attribute.GetCustomAttributes(member, typeof(TAttribute), inherit: true);
		}

		public static bool AcceptsNull(this MemberInfo member)
		{
			object[] customAttributes = member.DeclaringType.GetCustomAttributes(inherit: true);
			object obj = customAttributes.FirstOrDefault([<4dbd70ac-3833-421e-8d49-1c491cf72deb>NullableContext(0)] (object x) => x.GetType().FullName == "System.Runtime.CompilerServices.NullableContextAttribute");
			int num = 0;
			if (obj != null)
			{
				Type type = obj.GetType();
				PropertyInfo property = type.GetProperty("Flag");
				num = (byte)property.GetValue(obj);
			}
			object[] customAttributes2 = member.GetCustomAttributes(inherit: true);
			object obj2 = customAttributes2.FirstOrDefault([<4dbd70ac-3833-421e-8d49-1c491cf72deb>NullableContext(0)] (object x) => x.GetType().FullName == "System.Runtime.CompilerServices.NullableAttribute");
			PropertyInfo propertyInfo = (obj2?.GetType())?.GetProperty("NullableFlags");
			byte[] source = (byte[])propertyInfo.GetValue(obj2);
			return source.Any((byte x) => x == 2) || num == 2;
		}
	}
	internal static class <411c97f1-e5ea-448a-b4ac-d107196038ac>StandardRegexOptions
	{
		public const RegexOptions Compiled = RegexOptions.Compiled;
	}
}
namespace YamlDotNet.Serialization
{
	[<4dbd70ac-3833-421e-8d49-1c491cf72deb>NullableContext(1)]
	[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(0)]
	internal abstract class <25991687-7b3c-412a-b54b-d6e0a23d8298>BuilderSkeleton<[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(0)] TBuilder> where TBuilder : <25991687-7b3c-412a-b54b-d6e0a23d8298>BuilderSkeleton<TBuilder>
	{
		internal <218821ec-88f6-4692-8f49-ed3ebea2712e>INamingConvention namingConvention = <30e63b9e-a982-41a6-b0ce-a9f90f53a05f>NullNamingConvention.Instance;

		internal <218821ec-88f6-4692-8f49-ed3ebea2712e>INamingConvention enumNamingConvention = <30e63b9e-a982-41a6-b0ce-a9f90f53a05f>NullNamingConvention.Instance;

		internal <8cdc06d7-cd4d-416a-a39c-cc81bcf75c66>ITypeResolver typeResolver;

		internal readonly <85fb2a34-c493-418c-9b45-1019521b1163>YamlAttributeOverrides overrides;

		internal readonly <e6c6a0d4-35c5-4f51-907d-ef63f4a4def5>LazyComponentRegistrationList<<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing, <015c6dc0-b58c-4c33-93e4-7e83db2082c6>IYamlTypeConverter> typeConverterFactories;

		internal readonly <e6c6a0d4-35c5-4f51-907d-ef63f4a4def5>LazyComponentRegistrationList<<619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector, <619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector> typeInspectorFactories;

		internal bool ignoreFields;

		internal bool includeNonPublicProperties;

		internal Settings settings;

		internal <2c4ee249-2d13-4aa3-9737-4c86eec88f67>YamlFormatter yamlFormatter = <2c4ee249-2d13-4aa3-9737-4c86eec88f67>YamlFormatter.Default;

		protected abstract TBuilder Self { get; }

		internal <25991687-7b3c-412a-b54b-d6e0a23d8298>BuilderSkeleton(<8cdc06d7-cd4d-416a-a39c-cc81bcf75c66>ITypeResolver typeResolver)
		{
			overrides = new <85fb2a34-c493-418c-9b45-1019521b1163>YamlAttributeOverrides();
			typeConverterFactories = new <e6c6a0d4-35c5-4f51-907d-ef63f4a4def5>LazyComponentRegistrationList<<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing, <015c6dc0-b58c-4c33-93e4-7e83db2082c6>IYamlTypeConverter>
			{
				{
					typeof(<809a1958-7a61-4ed6-ab2f-55af1aa3d906>GuidConverter),
					(<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => new <809a1958-7a61-4ed6-ab2f-55af1aa3d906>GuidConverter(jsonCompatible: false)
				},
				{
					typeof(<aaf86a10-5311-4a8e-9ca7-ddd36e849fb9>SystemTypeConverter),
					(<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => new <aaf86a10-5311-4a8e-9ca7-ddd36e849fb9>SystemTypeConverter()
				}
			};
			typeInspectorFactories = new <e6c6a0d4-35c5-4f51-907d-ef63f4a4def5>LazyComponentRegistrationList<<619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector, <619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector>();
			this.typeResolver = typeResolver ?? throw new ArgumentNullException("typeResolver");
			settings = new Settings();
		}

		public TBuilder IgnoreFields()
		{
			ignoreFields = true;
			return Self;
		}

		public TBuilder IncludeNonPublicProperties()
		{
			includeNonPublicProperties = true;
			return Self;
		}

		public TBuilder EnablePrivateConstructors()
		{
			settings.AllowPrivateConstructors = true;
			return Self;
		}

		public TBuilder WithNamingConvention(<218821ec-88f6-4692-8f49-ed3ebea2712e>INamingConvention namingConvention)
		{
			this.namingConvention = namingConvention ?? throw new ArgumentNullException("namingConvention");
			return Self;
		}

		public TBuilder WithEnumNamingConvention(<218821ec-88f6-4692-8f49-ed3ebea2712e>INamingConvention enumNamingConvention)
		{
			this.enumNamingConvention = enumNamingConvention;
			return Self;
		}

		public TBuilder WithTypeResolver(<8cdc06d7-cd4d-416a-a39c-cc81bcf75c66>ITypeResolver typeResolver)
		{
			this.typeResolver = typeResolver ?? throw new ArgumentNullException("typeResolver");
			return Self;
		}

		public abstract TBuilder WithTagMapping(<fb5701dc-7312-4dc7-91f9-86539539cfb2>TagName tag, Type type);

		public TBuilder WithAttributeOverride<[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)] TClass>(Expression<Func<TClass, object>> propertyAccessor, Attribute attribute)
		{
			overrides.Add(propertyAccessor, attribute);
			return Self;
		}

		public TBuilder WithAttributeOverride(Type type, string member, Attribute attribute)
		{
			overrides.Add(type, member, attribute);
			return Self;
		}

		public TBuilder WithTypeConverter(<015c6dc0-b58c-4c33-93e4-7e83db2082c6>IYamlTypeConverter typeConverter)
		{
			return WithTypeConverter(typeConverter, delegate(<40546893-04ba-4b2f-bf1c-157a7983f623>IRegistrationLocationSelectionSyntax<<015c6dc0-b58c-4c33-93e4-7e83db2082c6>IYamlTypeConverter> w)
			{
				w.OnTop();
			});
		}

		public TBuilder WithTypeConverter(<015c6dc0-b58c-4c33-93e4-7e83db2082c6>IYamlTypeConverter typeConverter, Action<<40546893-04ba-4b2f-bf1c-157a7983f623>IRegistrationLocationSelectionSyntax<<015c6dc0-b58c-4c33-93e4-7e83db2082c6>IYamlTypeConverter>> where)
		{
			if (typeConverter == null)
			{
				throw new ArgumentNullException("typeConverter");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(typeConverterFactories.CreateRegistrationLocationSelector(typeConverter.GetType(), (<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => typeConverter));
			return Self;
		}

		public TBuilder WithTypeConverter<[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(0)] TYamlTypeConverter>(<66417a64-dc4a-4a32-89d8-f2fe8a7d7ac7>WrapperFactory<<015c6dc0-b58c-4c33-93e4-7e83db2082c6>IYamlTypeConverter, <015c6dc0-b58c-4c33-93e4-7e83db2082c6>IYamlTypeConverter> typeConverterFactory, Action<<7e516d9c-028b-47f4-9887-542ac29c9e2a>ITrackingRegistrationLocationSelectionSyntax<<015c6dc0-b58c-4c33-93e4-7e83db2082c6>IYamlTypeConverter>> where) where TYamlTypeConverter : <015c6dc0-b58c-4c33-93e4-7e83db2082c6>IYamlTypeConverter
		{
			if (typeConverterFactory == null)
			{
				throw new ArgumentNullException("typeConverterFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(typeConverterFactories.CreateTrackingRegistrationLocationSelector(typeof(TYamlTypeConverter), (<015c6dc0-b58c-4c33-93e4-7e83db2082c6>IYamlTypeConverter wrapped, <f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => typeConverterFactory(wrapped)));
			return Self;
		}

		public TBuilder WithoutTypeConverter<[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(0)] TYamlTypeConverter>() where TYamlTypeConverter : <015c6dc0-b58c-4c33-93e4-7e83db2082c6>IYamlTypeConverter
		{
			return WithoutTypeConverter(typeof(TYamlTypeConverter));
		}

		public TBuilder WithoutTypeConverter(Type converterType)
		{
			if (converterType == null)
			{
				throw new ArgumentNullException("converterType");
			}
			typeConverterFactories.Remove(converterType);
			return Self;
		}

		public TBuilder WithTypeInspector<[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(0)] TTypeInspector>(Func<<619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector, TTypeInspector> typeInspectorFactory) where TTypeInspector : <619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector
		{
			return WithTypeInspector(typeInspectorFactory, delegate(<40546893-04ba-4b2f-bf1c-157a7983f623>IRegistrationLocationSelectionSyntax<<619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector> w)
			{
				w.OnTop();
			});
		}

		public TBuilder WithTypeInspector<[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(0)] TTypeInspector>(Func<<619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector, TTypeInspector> typeInspectorFactory, Action<<40546893-04ba-4b2f-bf1c-157a7983f623>IRegistrationLocationSelectionSyntax<<619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector>> where) where TTypeInspector : <619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector
		{
			if (typeInspectorFactory == null)
			{
				throw new ArgumentNullException("typeInspectorFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(typeInspectorFactories.CreateRegistrationLocationSelector(typeof(TTypeInspector), (<619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector inner) => typeInspectorFactory(inner)));
			return Self;
		}

		public TBuilder WithTypeInspector<[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(0)] TTypeInspector>(<10e7fbd0-709c-43d4-8f78-926f9e7bc0c7>WrapperFactory<<619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector, <619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector, TTypeInspector> typeInspectorFactory, Action<<7e516d9c-028b-47f4-9887-542ac29c9e2a>ITrackingRegistrationLocationSelectionSyntax<<619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector>> where) where TTypeInspector : <619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector
		{
			if (typeInspectorFactory == null)
			{
				throw new ArgumentNullException("typeInspectorFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(typeInspectorFactories.CreateTrackingRegistrationLocationSelector(typeof(TTypeInspector), (<619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector wrapped, <619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector inner) => typeInspectorFactory(wrapped, inner)));
			return Self;
		}

		public TBuilder WithoutTypeInspector<[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(0)] TTypeInspector>() where TTypeInspector : <619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector
		{
			return WithoutTypeInspector(typeof(TTypeInspector));
		}

		public TBuilder WithoutTypeInspector(Type inspectorType)
		{
			if (inspectorType == null)
			{
				throw new ArgumentNullException("inspectorType");
			}
			typeInspectorFactories.Remove(inspectorType);
			return Self;
		}

		public TBuilder WithYamlFormatter(<2c4ee249-2d13-4aa3-9737-4c86eec88f67>YamlFormatter formatter)
		{
			yamlFormatter = formatter ?? throw new ArgumentNullException("formatter");
			return Self;
		}

		protected IEnumerable<<015c6dc0-b58c-4c33-93e4-7e83db2082c6>IYamlTypeConverter> BuildTypeConverters()
		{
			return typeConverterFactories.BuildComponentList();
		}
	}
	internal delegate TComponent <66417a64-dc4a-4a32-89d8-f2fe8a7d7ac7>WrapperFactory<[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)] TComponentBase, TComponent>(TComponentBase wrapped) where TComponent : TComponentBase;
	internal delegate TComponent <10e7fbd0-709c-43d4-8f78-926f9e7bc0c7>WrapperFactory<[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)] TArgument, [<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)] TComponentBase, TComponent>(TComponentBase wrapped, TArgument argument) where TComponent : TComponentBase;
	[Flags]
	internal enum <d90fed3e-e02f-48d3-9de2-1d9b33f15769>DefaultValuesHandling
	{
		Preserve = 0,
		OmitNull = 1,
		OmitDefaults = 2,
		OmitEmptyCollections = 4
	}
	[<4dbd70ac-3833-421e-8d49-1c491cf72deb>NullableContext(1)]
	[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(0)]
	internal sealed class <da905783-e934-43a6-a0c3-eeed000f1549>Deserializer : <6bb2661e-9396-4da5-aeb8-c1201a976544>IDeserializer
	{
		private readonly <63a8773f-ae47-49dd-8c39-0296eaf7cd79>IValueDeserializer valueDeserializer;

		public <da905783-e934-43a6-a0c3-eeed000f1549>Deserializer()
			: this(new <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder().BuildValueDeserializer())
		{
		}

		private <da905783-e934-43a6-a0c3-eeed000f1549>Deserializer(<63a8773f-ae47-49dd-8c39-0296eaf7cd79>IValueDeserializer valueDeserializer)
		{
			this.valueDeserializer = valueDeserializer ?? throw new ArgumentNullException("valueDeserializer");
		}

		public static <da905783-e934-43a6-a0c3-eeed000f1549>Deserializer FromValueDeserializer(<63a8773f-ae47-49dd-8c39-0296eaf7cd79>IValueDeserializer valueDeserializer)
		{
			return new <da905783-e934-43a6-a0c3-eeed000f1549>Deserializer(valueDeserializer);
		}

		public T Deserialize<[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)] T>(string input)
		{
			using StringReader input2 = new StringReader(input);
			return Deserialize<T>(input2);
		}

		public T Deserialize<[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)] T>(TextReader input)
		{
			return Deserialize<T>(new <d4371f5c-5e45-4b3c-b949-438da3ad6ba5>Parser(input));
		}

		public T Deserialize<[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)] T>(<1f8efb3f-b6b8-48e6-86ff-e4c6b182ca62>IParser parser)
		{
			return (T)Deserialize(parser, typeof(T));
		}

		[return: <50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)]
		public object Deserialize(string input)
		{
			return Deserialize<object>(input);
		}

		[return: <50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)]
		public object Deserialize(TextReader input)
		{
			return Deserialize<object>(input);
		}

		[return: <50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)]
		public object Deserialize(<1f8efb3f-b6b8-48e6-86ff-e4c6b182ca62>IParser parser)
		{
			return Deserialize<object>(parser);
		}

		[return: <50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)]
		public object Deserialize(string input, Type type)
		{
			using StringReader input2 = new StringReader(input);
			return Deserialize(input2, type);
		}

		[return: <50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)]
		public object Deserialize(TextReader input, Type type)
		{
			return Deserialize(new <d4371f5c-5e45-4b3c-b949-438da3ad6ba5>Parser(input), type);
		}

		[return: <50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)]
		public object Deserialize(<1f8efb3f-b6b8-48e6-86ff-e4c6b182ca62>IParser parser, Type type)
		{
			if (parser == null)
			{
				throw new ArgumentNullException("parser");
			}
			if (type == null)
			{
				throw new ArgumentNullException("type");
			}
			<78824d44-d94a-4fb7-ae26-e026dd06d0f9>StreamStart @event;
			bool flag = parser.TryConsume<<78824d44-d94a-4fb7-ae26-e026dd06d0f9>StreamStart>(out @event);
			<eb6883aa-c049-41d0-8552-64328616633c>DocumentStart event2;
			bool flag2 = parser.TryConsume<<eb6883aa-c049-41d0-8552-64328616633c>DocumentStart>(out event2);
			object result = null;
			if (!parser.Accept<<7ea0e6af-60ef-4ac0-a61d-b669925591cd>DocumentEnd>(out var _) && !parser.Accept<<16dfd304-16ef-4003-b2e5-e59f3df7fbe6>StreamEnd>(out var _))
			{
				using <188dcaa7-a0e7-43b3-b6bc-224771d00acf>SerializerState <188dcaa7-a0e7-43b3-b6bc-224771d00acf>SerializerState = new <188dcaa7-a0e7-43b3-b6bc-224771d00acf>SerializerState();
				result = valueDeserializer.DeserializeValue(parser, type, <188dcaa7-a0e7-43b3-b6bc-224771d00acf>SerializerState, valueDeserializer);
				<188dcaa7-a0e7-43b3-b6bc-224771d00acf>SerializerState.OnDeserialization();
			}
			if (flag2)
			{
				parser.Consume<<7ea0e6af-60ef-4ac0-a61d-b669925591cd>DocumentEnd>();
			}
			if (flag)
			{
				parser.Consume<<16dfd304-16ef-4003-b2e5-e59f3df7fbe6>StreamEnd>();
			}
			return result;
		}
	}
	[<4dbd70ac-3833-421e-8d49-1c491cf72deb>NullableContext(1)]
	[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(new byte[] { 0, 1 })]
	internal sealed class <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder : <25991687-7b3c-412a-b54b-d6e0a23d8298>BuilderSkeleton<<07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder>
	{
		private Lazy<<2cd1ea38-f6a5-4a6a-9585-ef23bb2232b8>IObjectFactory> objectFactory;

		private readonly <e6c6a0d4-35c5-4f51-907d-ef63f4a4def5>LazyComponentRegistrationList<<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing, <944861a5-757a-4977-8b32-488cf68a0d63>INodeDeserializer> nodeDeserializerFactories;

		private readonly <e6c6a0d4-35c5-4f51-907d-ef63f4a4def5>LazyComponentRegistrationList<<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing, <9ba986bb-1912-4978-ba84-ec207338fd4a>INodeTypeResolver> nodeTypeResolverFactories;

		private readonly Dictionary<<fb5701dc-7312-4dc7-91f9-86539539cfb2>TagName, Type> tagMappings;

		private readonly Dictionary<Type, Type> typeMappings;

		private readonly ITypeConverter typeConverter;

		private bool ignoreUnmatched;

		private bool duplicateKeyChecking;

		private bool attemptUnknownTypeDeserialization;

		private bool enforceNullability;

		private bool caseInsensitivePropertyMatching;

		private bool enforceRequiredProperties;

		protected override <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder Self => this;

		public <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder()
			: base((<8cdc06d7-cd4d-416a-a39c-cc81bcf75c66>ITypeResolver)new <c19577c4-3562-4098-b9a2-7d323114f033>StaticTypeResolver())
		{
			typeMappings = new Dictionary<Type, Type>();
			objectFactory = new Lazy<<2cd1ea38-f6a5-4a6a-9585-ef23bb2232b8>IObjectFactory>(() => new <3603c483-9d87-48a7-92d4-dc6c6d12067f>DefaultObjectFactory(typeMappings, settings), isThreadSafe: true);
			tagMappings = new Dictionary<<fb5701dc-7312-4dc7-91f9-86539539cfb2>TagName, Type>
			{
				{
					<58f25cad-8c7c-4ad6-bddb-ae640550b10f>FailsafeSchema.Tags.Map,
					typeof(Dictionary<object, object>)
				},
				{
					<58f25cad-8c7c-4ad6-bddb-ae640550b10f>FailsafeSchema.Tags.Str,
					typeof(string)
				},
				{
					<edb99e99-c4af-4fee-9553-a7854ca0ebbd>JsonSchema.Tags.Bool,
					typeof(bool)
				},
				{
					<edb99e99-c4af-4fee-9553-a7854ca0ebbd>JsonSchema.Tags.Float,
					typeof(double)
				},
				{
					<edb99e99-c4af-4fee-9553-a7854ca0ebbd>JsonSchema.Tags.Int,
					typeof(int)
				},
				{
					<a488e164-8d5b-4ffc-9794-fa52a07d8e3f>DefaultSchema.Tags.Timestamp,
					typeof(DateTime)
				}
			};
			typeInspectorFactories.Add(typeof(<540e5e1f-8dce-42d7-9384-8f4a864f8613>CachedTypeInspector), (<619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector inner) => new <540e5e1f-8dce-42d7-9384-8f4a864f8613>CachedTypeInspector(inner));
			typeInspectorFactories.Add(typeof(<a10678bf-8bbf-48f5-a137-e8e53497635a>NamingConventionTypeInspector), (<619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector inner) => (!(namingConvention is <30e63b9e-a982-41a6-b0ce-a9f90f53a05f>NullNamingConvention)) ? new <a10678bf-8bbf-48f5-a137-e8e53497635a>NamingConventionTypeInspector(inner, namingConvention) : inner);
			typeInspectorFactories.Add(typeof(<b0e97467-9d56-415a-9e36-8b03a35e5129>YamlAttributesTypeInspector), (<619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector inner) => new <b0e97467-9d56-415a-9e36-8b03a35e5129>YamlAttributesTypeInspector(inner));
			typeInspectorFactories.Add(typeof(<0b2725d2-b351-42cc-bd16-50eadd20b1da>YamlAttributeOverridesInspector), (<619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector inner) => (overrides == null) ? inner : new <0b2725d2-b351-42cc-bd16-50eadd20b1da>YamlAttributeOverridesInspector(inner, overrides.Clone()));
			typeInspectorFactories.Add(typeof(<f0ea8e1a-d5d2-4fba-a863-003078c59956>ReadableAndWritablePropertiesTypeInspector), (<619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector inner) => new <f0ea8e1a-d5d2-4fba-a863-003078c59956>ReadableAndWritablePropertiesTypeInspector(inner));
			nodeDeserializerFactories = new <e6c6a0d4-35c5-4f51-907d-ef63f4a4def5>LazyComponentRegistrationList<<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing, <944861a5-757a-4977-8b32-488cf68a0d63>INodeDeserializer>
			{
				{
					typeof(<a0d9142b-193f-4213-93ce-fd98ed30c231>YamlConvertibleNodeDeserializer),
					(<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => new <a0d9142b-193f-4213-93ce-fd98ed30c231>YamlConvertibleNodeDeserializer(objectFactory.Value)
				},
				{
					typeof(<a67adb03-00e9-45c9-a3a3-0fa502f8db42>YamlSerializableNodeDeserializer),
					(<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => new <a67adb03-00e9-45c9-a3a3-0fa502f8db42>YamlSerializableNodeDeserializer(objectFactory.Value)
				},
				{
					typeof(<21c5f308-1af2-44bf-b83f-81b923682274>TypeConverterNodeDeserializer),
					(<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => new <21c5f308-1af2-44bf-b83f-81b923682274>TypeConverterNodeDeserializer(BuildTypeConverters())
				},
				{
					typeof(<093f568c-119a-49c6-a2d4-521d4d32223b>NullNodeDeserializer),
					(<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => new <093f568c-119a-49c6-a2d4-521d4d32223b>NullNodeDeserializer()
				},
				{
					typeof(<e9812539-c4a0-4398-8650-4ad234a1a8dc>ScalarNodeDeserializer),
					(<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => new <e9812539-c4a0-4398-8650-4ad234a1a8dc>ScalarNodeDeserializer(attemptUnknownTypeDeserialization, typeConverter, BuildTypeInspector(), yamlFormatter, enumNamingConvention)
				},
				{
					typeof(<911b0494-e9f2-4d6a-816a-26486bc81ec6>ArrayNodeDeserializer),
					(<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => new <911b0494-e9f2-4d6a-816a-26486bc81ec6>ArrayNodeDeserializer(enumNamingConvention, BuildTypeInspector())
				},
				{
					typeof(<d7d5920d-4699-4ca5-a442-7a25f988405d>DictionaryNodeDeserializer),
					(<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => new <d7d5920d-4699-4ca5-a442-7a25f988405d>DictionaryNodeDeserializer(objectFactory.Value, duplicateKeyChecking)
				},
				{
					typeof(<2f8837de-bd36-48c5-8e11-eb9414f13741>CollectionNodeDeserializer),
					(<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => new <2f8837de-bd36-48c5-8e11-eb9414f13741>CollectionNodeDeserializer(objectFactory.Value, enumNamingConvention, BuildTypeInspector())
				},
				{
					typeof(<497b9989-c4c7-4cd4-bf65-e80f57a3a6b6>EnumerableNodeDeserializer),
					(<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => new <497b9989-c4c7-4cd4-bf65-e80f57a3a6b6>EnumerableNodeDeserializer()
				},
				{
					typeof(<2ff18f22-cd92-4665-ba53-fa0e72df6327>ObjectNodeDeserializer),
					(<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => new <2ff18f22-cd92-4665-ba53-fa0e72df6327>ObjectNodeDeserializer(objectFactory.Value, BuildTypeInspector(), ignoreUnmatched, duplicateKeyChecking, typeConverter, enumNamingConvention, enforceNullability, caseInsensitivePropertyMatching, enforceRequiredProperties, BuildTypeConverters())
				},
				{
					typeof(FsharpListNodeDeserializer),
					(<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => new FsharpListNodeDeserializer(BuildTypeInspector(), enumNamingConvention)
				}
			};
			nodeTypeResolverFactories = new <e6c6a0d4-35c5-4f51-907d-ef63f4a4def5>LazyComponentRegistrationList<<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing, <9ba986bb-1912-4978-ba84-ec207338fd4a>INodeTypeResolver>
			{
				{
					typeof(<c9813d2e-07e1-431c-acac-4d119f12cfce>MappingNodeTypeResolver),
					(<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => new <c9813d2e-07e1-431c-acac-4d119f12cfce>MappingNodeTypeResolver(typeMappings)
				},
				{
					typeof(<8c8675f9-4e5b-4414-b959-5693892e4e73>YamlConvertibleTypeResolver),
					(<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => new <8c8675f9-4e5b-4414-b959-5693892e4e73>YamlConvertibleTypeResolver()
				},
				{
					typeof(<53a88709-58f0-44ef-8b8b-58b5ee976568>YamlSerializableTypeResolver),
					(<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => new <53a88709-58f0-44ef-8b8b-58b5ee976568>YamlSerializableTypeResolver()
				},
				{
					typeof(<00a0b88a-3d76-44e9-8a60-2e868ba785d7>TagNodeTypeResolver),
					(<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => new <00a0b88a-3d76-44e9-8a60-2e868ba785d7>TagNodeTypeResolver(tagMappings)
				},
				{
					typeof(<37dd94aa-34cd-45c2-b62a-b54d59fab845>PreventUnknownTagsNodeTypeResolver),
					(<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => new <37dd94aa-34cd-45c2-b62a-b54d59fab845>PreventUnknownTagsNodeTypeResolver()
				},
				{
					typeof(<0ad83501-6d5e-49c3-89f1-6e02596e68b2>DefaultContainersNodeTypeResolver),
					(<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => new <0ad83501-6d5e-49c3-89f1-6e02596e68b2>DefaultContainersNodeTypeResolver()
				}
			};
			typeConverter = new ReflectionTypeConverter();
		}

		public <619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector BuildTypeInspector()
		{
			<619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector <619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector2 = new WritablePropertiesTypeInspector(typeResolver, includeNonPublicProperties);
			if (!ignoreFields)
			{
				<619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector2 = new <e6f6c60f-ca4d-4078-b1d3-443a6205c9db>CompositeTypeInspector(new <9d7a06cf-6471-4a8c-815e-2d1a1656c07b>ReadableFieldsTypeInspector(typeResolver), <619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector2);
			}
			return typeInspectorFactories.BuildComponentChain(<619b34a7-c3cf-48e7-90cc-feead801e2f5>ITypeInspector2);
		}

		public <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder WithAttemptingUnquotedStringTypeDeserialization()
		{
			attemptUnknownTypeDeserialization = true;
			return this;
		}

		public <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder WithObjectFactory(<2cd1ea38-f6a5-4a6a-9585-ef23bb2232b8>IObjectFactory objectFactory)
		{
			if (objectFactory == null)
			{
				throw new ArgumentNullException("objectFactory");
			}
			this.objectFactory = new Lazy<<2cd1ea38-f6a5-4a6a-9585-ef23bb2232b8>IObjectFactory>(() => objectFactory, isThreadSafe: true);
			return this;
		}

		public <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder WithObjectFactory(Func<Type, object> objectFactory)
		{
			if (objectFactory == null)
			{
				throw new ArgumentNullException("objectFactory");
			}
			return WithObjectFactory(new <c5b36a09-278c-451d-a435-291e17162564>LambdaObjectFactory(objectFactory));
		}

		public <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder WithNodeDeserializer(<944861a5-757a-4977-8b32-488cf68a0d63>INodeDeserializer nodeDeserializer)
		{
			return WithNodeDeserializer(nodeDeserializer, delegate(<40546893-04ba-4b2f-bf1c-157a7983f623>IRegistrationLocationSelectionSyntax<<944861a5-757a-4977-8b32-488cf68a0d63>INodeDeserializer> w)
			{
				w.OnTop();
			});
		}

		public <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder WithNodeDeserializer(<944861a5-757a-4977-8b32-488cf68a0d63>INodeDeserializer nodeDeserializer, Action<<40546893-04ba-4b2f-bf1c-157a7983f623>IRegistrationLocationSelectionSyntax<<944861a5-757a-4977-8b32-488cf68a0d63>INodeDeserializer>> where)
		{
			if (nodeDeserializer == null)
			{
				throw new ArgumentNullException("nodeDeserializer");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(nodeDeserializerFactories.CreateRegistrationLocationSelector(nodeDeserializer.GetType(), (<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => nodeDeserializer));
			return this;
		}

		public <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder WithNodeDeserializer<[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(0)] TNodeDeserializer>(<66417a64-dc4a-4a32-89d8-f2fe8a7d7ac7>WrapperFactory<<944861a5-757a-4977-8b32-488cf68a0d63>INodeDeserializer, TNodeDeserializer> nodeDeserializerFactory, Action<<7e516d9c-028b-47f4-9887-542ac29c9e2a>ITrackingRegistrationLocationSelectionSyntax<<944861a5-757a-4977-8b32-488cf68a0d63>INodeDeserializer>> where) where TNodeDeserializer : <944861a5-757a-4977-8b32-488cf68a0d63>INodeDeserializer
		{
			if (nodeDeserializerFactory == null)
			{
				throw new ArgumentNullException("nodeDeserializerFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(nodeDeserializerFactories.CreateTrackingRegistrationLocationSelector(typeof(TNodeDeserializer), (<944861a5-757a-4977-8b32-488cf68a0d63>INodeDeserializer wrapped, <f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => nodeDeserializerFactory(wrapped)));
			return this;
		}

		public <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder WithoutNodeDeserializer<[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(0)] TNodeDeserializer>() where TNodeDeserializer : <944861a5-757a-4977-8b32-488cf68a0d63>INodeDeserializer
		{
			return WithoutNodeDeserializer(typeof(TNodeDeserializer));
		}

		public <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder WithoutNodeDeserializer(Type nodeDeserializerType)
		{
			if (nodeDeserializerType == null)
			{
				throw new ArgumentNullException("nodeDeserializerType");
			}
			nodeDeserializerFactories.Remove(nodeDeserializerType);
			return this;
		}

		public <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder WithTypeDiscriminatingNodeDeserializer(Action<ITypeDiscriminatingNodeDeserializerOptions> configureTypeDiscriminatingNodeDeserializerOptions, int maxDepth = -1, int maxLength = -1)
		{
			TypeDiscriminatingNodeDeserializerOptions typeDiscriminatingNodeDeserializerOptions = new TypeDiscriminatingNodeDeserializerOptions();
			configureTypeDiscriminatingNodeDeserializerOptions(typeDiscriminatingNodeDeserializerOptions);
			TypeDiscriminatingNodeDeserializer nodeDeserializer = new TypeDiscriminatingNodeDeserializer(nodeDeserializerFactories.BuildComponentList(), typeDiscriminatingNodeDeserializerOptions.discriminators, maxDepth, maxLength);
			return WithNodeDeserializer(nodeDeserializer, delegate(<40546893-04ba-4b2f-bf1c-157a7983f623>IRegistrationLocationSelectionSyntax<<944861a5-757a-4977-8b32-488cf68a0d63>INodeDeserializer> s)
			{
				s.Before<<d7d5920d-4699-4ca5-a442-7a25f988405d>DictionaryNodeDeserializer>();
			});
		}

		public <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder WithNodeTypeResolver(<9ba986bb-1912-4978-ba84-ec207338fd4a>INodeTypeResolver nodeTypeResolver)
		{
			return WithNodeTypeResolver(nodeTypeResolver, delegate(<40546893-04ba-4b2f-bf1c-157a7983f623>IRegistrationLocationSelectionSyntax<<9ba986bb-1912-4978-ba84-ec207338fd4a>INodeTypeResolver> w)
			{
				w.OnTop();
			});
		}

		public <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder WithNodeTypeResolver(<9ba986bb-1912-4978-ba84-ec207338fd4a>INodeTypeResolver nodeTypeResolver, Action<<40546893-04ba-4b2f-bf1c-157a7983f623>IRegistrationLocationSelectionSyntax<<9ba986bb-1912-4978-ba84-ec207338fd4a>INodeTypeResolver>> where)
		{
			if (nodeTypeResolver == null)
			{
				throw new ArgumentNullException("nodeTypeResolver");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(nodeTypeResolverFactories.CreateRegistrationLocationSelector(nodeTypeResolver.GetType(), (<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => nodeTypeResolver));
			return this;
		}

		public <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder WithNodeTypeResolver<[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(0)] TNodeTypeResolver>(<66417a64-dc4a-4a32-89d8-f2fe8a7d7ac7>WrapperFactory<<9ba986bb-1912-4978-ba84-ec207338fd4a>INodeTypeResolver, TNodeTypeResolver> nodeTypeResolverFactory, Action<<7e516d9c-028b-47f4-9887-542ac29c9e2a>ITrackingRegistrationLocationSelectionSyntax<<9ba986bb-1912-4978-ba84-ec207338fd4a>INodeTypeResolver>> where) where TNodeTypeResolver : <9ba986bb-1912-4978-ba84-ec207338fd4a>INodeTypeResolver
		{
			if (nodeTypeResolverFactory == null)
			{
				throw new ArgumentNullException("nodeTypeResolverFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(nodeTypeResolverFactories.CreateTrackingRegistrationLocationSelector(typeof(TNodeTypeResolver), (<9ba986bb-1912-4978-ba84-ec207338fd4a>INodeTypeResolver wrapped, <f31e24e0-3540-44a5-b987-80248d8ae485>Nothing _) => nodeTypeResolverFactory(wrapped)));
			return this;
		}

		public <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder WithCaseInsensitivePropertyMatching()
		{
			caseInsensitivePropertyMatching = true;
			return this;
		}

		public <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder WithEnforceNullability()
		{
			enforceNullability = true;
			return this;
		}

		public <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder WithEnforceRequiredMembers()
		{
			enforceRequiredProperties = true;
			return this;
		}

		public <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder WithoutNodeTypeResolver<[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(0)] TNodeTypeResolver>() where TNodeTypeResolver : <9ba986bb-1912-4978-ba84-ec207338fd4a>INodeTypeResolver
		{
			return WithoutNodeTypeResolver(typeof(TNodeTypeResolver));
		}

		public <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder WithoutNodeTypeResolver(Type nodeTypeResolverType)
		{
			if (nodeTypeResolverType == null)
			{
				throw new ArgumentNullException("nodeTypeResolverType");
			}
			nodeTypeResolverFactories.Remove(nodeTypeResolverType);
			return this;
		}

		public override <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder WithTagMapping(<fb5701dc-7312-4dc7-91f9-86539539cfb2>TagName tag, Type type)
		{
			if (tag.IsEmpty)
			{
				throw new ArgumentException("Non-specific tags cannot be maped");
			}
			if (type == null)
			{
				throw new ArgumentNullException("type");
			}
			if (tagMappings.TryGetValue(tag, out var value))
			{
				throw new ArgumentException($"Type already has a registered type '{value.FullName}' for tag '{tag}'", "tag");
			}
			tagMappings.Add(tag, type);
			return this;
		}

		public <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder WithTypeMapping<[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(2)] TInterface, [<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(0)] TConcrete>() where TConcrete : TInterface
		{
			Type typeFromHandle = typeof(TInterface);
			Type typeFromHandle2 = typeof(TConcrete);
			if (!typeFromHandle.IsAssignableFrom(typeFromHandle2))
			{
				throw new InvalidOperationException("The type '" + typeFromHandle2.Name + "' does not implement interface '" + typeFromHandle.Name + "'.");
			}
			if (!DictionaryExtensions.TryAdd(typeMappings, typeFromHandle, typeFromHandle2))
			{
				typeMappings[typeFromHandle] = typeFromHandle2;
			}
			return this;
		}

		public <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder WithoutTagMapping(<fb5701dc-7312-4dc7-91f9-86539539cfb2>TagName tag)
		{
			if (tag.IsEmpty)
			{
				throw new ArgumentException("Non-specific tags cannot be maped");
			}
			if (!tagMappings.Remove(tag))
			{
				throw new KeyNotFoundException($"Tag '{tag}' is not registered");
			}
			return this;
		}

		public <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder IgnoreUnmatchedProperties()
		{
			ignoreUnmatched = true;
			return this;
		}

		public <07eba1af-ec55-41ab-96ac-80f8030e44b1>DeserializerBuilder WithDuplicateKeyChecking()
		{
			duplicateKeyChecking = true;
			return this;
		}

		public <6bb2661e-9396-4da5-aeb8-c1201a976544>IDeserializer Build()
		{
			if (FsharpHelper.Instance == null)
			{
				FsharpHelper.Instance = new DefaultFsharpHelper();
			}
			return <da905783-e934-43a6-a0c3-eeed000f1549>Deserializer.FromValueDeserializer(BuildValueDeserializer());
		}

		public <63a8773f-ae47-49dd-8c39-0296eaf7cd79>IValueDeserializer BuildValueDeserializer()
		{
			return new <c891dcd8-8a65-4031-8004-6da5449668ef>AliasValueDeserializer(new <5135c096-4fa8-4ccf-a19a-8063b7a5188d>NodeValueDeserializer(nodeDeserializerFactories.BuildComponentList(), nodeTypeResolverFactories.BuildComponentList(), typeConverter, enumNamingConvention, BuildTypeInspector()));
		}
	}
	[<50695eb0-1575-4a71-9582-f9a8395ba049>Nullable(0)]
	[<4dbd70ac-3833-421e-8d49-1c491cf72deb>NullableContext(1)]
	internal sealed class <2d1f9551-49b2-4c6c-b2aa-e850505c24a3>EmissionPhaseObjectGraphVisitorArgs
	{
		private readonly IEnumerable<<b6a33241-7f15-4325-b6d9-861bbb0e719f>IObjectGraphVisitor<<f31e24e0-3540-44a5-b987-80248d8ae485>Nothing>> preProcessingPhaseVisitors;

		public <b6a33241-7f15-4325-b6d9-861bbb0e719f>IObjectGraphVisitor<<fd8f6139-9f9c-43f5-854e-3d3fe89ea0f9>I