Decompiled source of TamingTools v0.0.2

TamingTools.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using BepInEx;
using BepInEx.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: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyTitle("TamingTools")]
[assembly: AssemblyDescription("")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TamingTools")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d8b8b522-7ea7-41eb-a21a-d076e3ab8dc5")]
[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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: 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, (short)(-1));
			}
			else if (itemName == TamingTools.t2foodPrefabName)
			{
				tame.m_character.m_seman.AddStatusEffect(TamingTools.prefabManager.effect_tameFood2, true, 0, 0f, (short)(-1));
			}
			else
			{
				if (!(itemName == TamingTools.t3foodPrefabName))
				{
					return;
				}
				tame.m_character.m_seman.AddStatusEffect(TamingTools.prefabManager.effect_tameFood3, true, 0, 0f, (short)(-1));
			}
			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 (zDO.GetFloat("SE_BestialCommand", 0f) > 0f)
					{
						DBG.blogDebug("has Bestial Command");
						num += 1f;
					}
					StatusEffect val = ((Character)item).m_seman.GetStatusEffects().Find((StatusEffect se) => ((Object)se).name == "SE_SpeedTame");
					if ((Object)(object)val != (Object)null)
					{
						num += 3f;
					}
				}
			}
			return num;
		}

		public static void LongUpdateAI(MonsterAI mAI)
		{
			if (((BaseAI)mAI).m_nview.IsValid() && ((BaseAI)mAI).m_nview.IsOwner() && ((BaseAI)mAI).m_character.IsTamed())
			{
				float num = Time.time - ((BaseAI)mAI).m_nview.GetZDO().GetFloat("AT_LongUpdate", 0f);
				num = ((num > 0f) ? num : (0f - num));
				if (!(num < 5f))
				{
					((BaseAI)mAI).m_nview.GetZDO().Set("AT_LongUpdate", Time.time);
					receivePlrEffects(mAI, 15f);
				}
			}
		}

		public static void receivePlrEffects(MonsterAI mAI, float maxdist)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			List<Player> s_players = Player.s_players;
			Vector3 position = ((Component)mAI).transform.position;
			foreach (Player item in s_players)
			{
				DBG.blogDebug("plr dist=" + ((object)((Component)item).transform.position/*cast due to .constrained prefix*/).ToString());
				if (!((Character)item).m_nview.IsValid() || Vector3.Distance(((Component)item).transform.position, position) > maxdist || !(((Character)item).m_nview.GetZDO().GetFloat("SE_BestialCommand", 0f) > Time.time))
				{
					continue;
				}
				((BaseAI)mAI).m_nview.GetZDO().Set("SE_hasBC", Time.time + 15f);
				DBG.blogDebug("set BC to " + (Time.time + 15f));
				break;
			}
		}

		[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);
		}

		[HarmonyPatch(typeof(MonsterAI), "UpdateAI")]
		[HarmonyPostfix]
		private static void PostfixBaseAIUpdateAI(MonsterAI __instance)
		{
			LongUpdateAI(__instance);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Attack), "ModifyDamage")]
		private static void PostfixAttackModifyDamage(Attack __instance, ref HitData hitData)
		{
			if (Object.op_Implicit((Object)(object)__instance.m_character))
			{
				ZNetView nview = ((Character)__instance.m_character).m_nview;
				if (nview.IsValid() && nview.IsOwner() && nview.GetZDO().GetFloat("SE_hasBC", 0f) > Time.time)
				{
					DBG.blogDebug("multiplying by 1.3 for " + ((Object)__instance.m_character).name);
					((DamageTypes)(ref hitData.m_damage)).Modify(1.3f);
				}
			}
		}
	}
	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, false);
			}
			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 static GameObject TameChestPrefab;

		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 TT_StatusEffect effect_bestial_command = ScriptableObject.CreateInstance<TT_StatusEffect>();

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

		private static bool setItemConversions = false;

		public static bool hasInitBaseObj = 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");
			TameChestPrefab = Assets.LoadAsset<GameObject>(assetPath + TamingTools.tameChestPrefabName + ".prefab");
			TameMeadPrefab = Assets.LoadAsset<GameObject>(assetPath + "MeadSpeedTame.prefab");
			TameMeadBasePrefab = Assets.LoadAsset<GameObject>(assetPath + "MeadBaseSpeedTame.prefab");
		}

		public static AssetBundle getAssetBundle()
		{
			return Assets;
		}

		public static void InitBaseObjects(ObjectDB oDB)
		{
			DBG.blogWarning("Init Base Objects");
			if (hasInitBaseObj)
			{
				DBG.blogWarning("Already Init Base Objects");
				return;
			}
			if (Object.op_Implicit((Object)(object)oDB))
			{
				DBG.blogWarning("Setting new zns");
				zns = ((Component)oDB).gameObject.GetComponent<ZNetScene>();
			}
			else
			{
				DBG.blogWarning("odb null");
				if (!Object.op_Implicit((Object)(object)zns))
				{
					DBG.blogWarning("zns also null");
					return;
				}
			}
			if (!Object.op_Implicit((Object)(object)zns))
			{
				DBG.blogWarning("zns null");
				return;
			}
			MocksToComplete.Add(T3FoodPrefab);
			MocksToComplete.Add(TameChestPrefab);
			tamingfood_IDrops[0] = T1FoodPrefab.GetComponent<ItemDrop>();
			tamingfood_IDrops[1] = T2FoodPrefab.GetComponent<ItemDrop>();
			tamingfood_IDrops[2] = T3FoodPrefab.GetComponent<ItemDrop>();
			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;
			TameChestPrefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_equipStatusEffect = (StatusEffect)(object)effect_bestial_command;
			CompleteAllMocks();
			FixShaders(((Component)TameChestPrefab.transform.GetChild(0)).gameObject);
			hasInitBaseObj = true;
		}

		public static void CompleteAllMocks()
		{
			if ((Object)(object)zns == (Object)null)
			{
				zns = ZNetScene.instance;
				if ((Object)(object)zns == (Object)null)
				{
					DBG.blogWarning("ZNS is null, aborting!");
					return;
				}
			}
			for (int num = MocksToComplete.Count - 1; num >= 0; num--)
			{
				if (Utils.FixMock(MocksToComplete[num], zns))
				{
					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();
			}
			else
			{
				removeItem("MeadBaseSpeedTame");
				removeItem("MeadSpeedTame");
			}
			if (TamingTools.useTamingEquipment.Value)
			{
				addItem(TameChestPrefab, TamingTools.TamingRobe_Recipe.Value, TamingTools.TamingRobe_Station.Value);
			}
			else
			{
				removeItem(TamingTools.tameChestPrefabName);
			}
		}

		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");
			DBG.blogDebug("In Effect BC");
			((Object)effect_bestial_command).name = "SE_BestialCommand";
			((StatusEffect)effect_bestial_command).m_ttl = 0f;
			effect_bestial_command.ZDO_key = "SE_BestialCommand";
			DBG.blogDebug("In Effect BC icon");
			Object[] array2 = Assets.LoadAssetWithSubAssets(assetPath + "BestialCommandIcon.png");
			DBG.blogDebug("In Effect BC sprite");
			ref Sprite icon2 = ref ((StatusEffect)effect_bestial_command).m_icon;
			Object obj2 = array2[1];
			icon2 = (Sprite)(object)((obj2 is Sprite) ? obj2 : null);
			((StatusEffect)effect_bestial_command).m_name = "$at_effect_command";
			((StatusEffect)effect_bestial_command).m_tooltip = "<color=green>+25%</color> $at_increased_tame_dmg \n<color=red>-40%</color> $at_decreased_plr_dmg \n<color=green>33%</color> $at_increased_tame_speed";
			effect_bestial_command.modifySkills = (SkillType[])(object)new SkillType[1] { (SkillType)999 };
			DBG.blogDebug("finsihed BC");
		}

		private static Shader getFixedShader(string shaderName)
		{
			if (ShaderDict.TryGetValue(shaderName, out var value))
			{
				return value;
			}
			Shader val = null;
			try
			{
				switch (shaderName)
				{
				case "Custom/Vegetation":
				{
					GameObject val2 = FindShaderObject("AshlandsBranch1");
					if ((Object)(object)val2 != (Object)null)
					{
						val = ((Component)val2.transform.GetChild(0)).GetComponent<Renderer>().material.shader;
					}
					break;
				}
				case "Custom/Player":
				{
					GameObject val2 = FindShaderObject("ArmorAshlandsMediumChest");
					if ((Object)(object)val2 != (Object)null)
					{
						val = val2.GetComponent<ItemDrop>().m_itemData.m_shared.m_armorMaterial.shader;
					}
					break;
				}
				case "Standard":
					return null;
				default:
				{
					if (ShaderDict.TryGetValue("Standard", out var value2))
					{
						return value2;
					}
					GameObject val2 = FindShaderObject("AmberPearl");
					if ((Object)(object)val2 != (Object)null)
					{
						val = val2.GetComponentInChildren<Renderer>().material.shader;
						shaderName = "Standard";
						ShaderDict.Add(shaderName, val);
					}
					return val;
				}
				}
			}
			catch
			{
				DBG.blogWarning("Failed shader fix with " + shaderName);
				if (ShaderDict.TryGetValue("Standard", out var value3))
				{
					return value3;
				}
				GameObject val2 = FindShaderObject("AmberPearl");
				if ((Object)(object)val2 != (Object)null)
				{
					val = val2.GetComponentInChildren<Renderer>().material.shader;
					shaderName = "Standard";
					ShaderDict.Add(shaderName, val);
					return val;
				}
				DBG.blogWarning("Failed secondary fix with " + shaderName);
			}
			if (((Object)(object)val != (Object)null) & !ShaderDict.ContainsKey(shaderName))
			{
				ShaderDict.Add(shaderName, val);
			}
			return val;
		}

		public static void FixShaders(GameObject go)
		{
			DBG.blogDebug("Start Fixing Shaders for " + ((Object)go).name);
			Renderer[] componentsInChildren = go.GetComponentsInChildren<Renderer>();
			Renderer[] array = componentsInChildren;
			foreach (Renderer val in array)
			{
				Material[] materials = val.materials;
				foreach (Material val2 in materials)
				{
					string text = ((Object)val2.shader).name;
					if (text.StartsWith("Mock_"))
					{
						text = text.Substring(5);
					}
					DBG.blogDebug("Shader " + text + " is attempting to be switched");
					if (text == "Standard")
					{
						DBG.blogDebug("Skipping Standard");
						continue;
					}
					Shader fixedShader = getFixedShader(text);
					if ((Object)(object)fixedShader != (Object)null)
					{
						val2.shader = fixedShader;
						DBG.blogDebug("Switched Shader for " + ((Object)go).name);
					}
				}
			}
		}

		private static GameObject FindShaderObject(string name)
		{
			ZNetScene instance = ZNetScene.instance;
			if ((Object)(object)instance == (Object)null)
			{
				instance = zns;
			}
			if (instance.m_namedPrefabs.Count > 0)
			{
				DBG.blogDebug("znet has init when setting shader: " + name);
				return instance.GetPrefab(name);
			}
			DBG.blogDebug("znet is not init when setting shader: " + name);
			return instance.m_prefabs.Find((GameObject x) => ((Object)x).name.Contains(name));
		}
	}
	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.2")]
	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.2";

		public const string versionMinimum = "0.0.2";

		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 string tameChestPrefabName = "TT_Robe";

		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 ConfigEntry<bool> useTamingEquipment;

		public static ConfigEntry<string> TamingRobe_Recipe;

		public static ConfigEntry<string> TamingRobe_Station;

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

		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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Expected O, but got Unknown
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Expected O, but got Unknown
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Expected O, but got Unknown
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Expected O, but got Unknown
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Expected O, but got Unknown
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Expected O, but got Unknown
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Expected O, but got Unknown
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Expected O, but got Unknown
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Expected O, but got Unknown
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Expected O, but got Unknown
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: 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>()));
			useTamingEquipment = config("1:General", "useTamingEquipment", value: true, new ConfigDescription("Use taming equipment that gives buffs to taming or tamed 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>()));
			TamingRobe_Recipe = config("5: Recipes", "Bestial Robe Recipe", "TrophyGreydwarfShaman:2:1,Root:5,BjornHide:5,Honey:10:10", new ConfigDescription("What is the recipe for crafting the Bestial Robe, separate amount with : and different items with ,", (AcceptableValueBase)null, Array.Empty<object>()));
			TamingRobe_Station = config("5: Recipes", "Bestial Robe Station", "piece_workbench:2", 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);
		}

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

		[HarmonyPatch(typeof(ObjectDB), "Awake")]
		[HarmonyPriority(5)]
		[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");
			}
			else if (!Object.op_Implicit((Object)(object)ZNet.instance))
			{
				DBG.blogDebug("No instance of ZNet");
			}
			else if (!ZNet.instance.IsServer())
			{
				DBG.blogDebug("ZNet not server");
			}
			else
			{
				PrefabManager.ItemReg();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ObjectDB), "CopyOtherDB")]
		private static void Prefix_ObjectDB_CopyOther(ObjectDB __instance, ObjectDB other)
		{
			PrefabManager.InitBaseObjects(other);
			if ((Object)(object)other != (Object)null && ((Object)other).name == "_NetScene")
			{
				Utils.addItemToODB(PrefabManager.TameChestPrefab, other);
			}
		}
	}
	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[] splitName = text.Split(new char[1] { '_' });
			if (splitName[0] != "JVLmock")
			{
				DBG.blogDebug("Not Mock, Skipping");
				return false;
			}
			if (splitName.Length == 1)
			{
				DBG.blogDebug("Not long enough name, Skipping");
				return false;
			}
			GameObject val = null;
			val = (GameObject)((zns.m_namedPrefabs.Count != 0) ? ((object)zns.GetPrefab(splitName[1])) : ((object)zns.m_prefabs.Find((GameObject x) => ((Object)x).name == splitName[1])));
			if ((Object)(object)val == (Object)null)
			{
				DBG.blogDebug("Could not find prefab with name:" + splitName[1]);
				return false;
			}
			string[] array = text.Split(new string[1] { "__" }, StringSplitOptions.None);
			for (int num = 1; num < array.Length; num++)
			{
				Transform val2 = val.transform.Find(array[num]);
				if ((Object)(object)val2 == (Object)null)
				{
					DBG.blogDebug("Child is null:" + array[num]);
					return false;
				}
				DBG.blogDebug("Child is valid:" + array[num]);
				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 FixMockMeshSkin(SkinnedMeshRenderer skinMesh, ZNetScene zns)
		{
			string text = ((Object)skinMesh.sharedMesh).name.Split(new char[1] { ' ' })[0];
			DBG.blogDebug("skin: 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;
			}
			string[] array2 = text.Split(new string[1] { "__" }, StringSplitOptions.None);
			string basePrefName = array2[0].Remove(0, 8);
			DBG.blogDebug("basePrefName=" + basePrefName);
			GameObject val = null;
			val = (GameObject)((zns.m_namedPrefabs.Count != 0) ? ((object)zns.GetPrefab(basePrefName)) : ((object)zns.m_prefabs.Find((GameObject x) => ((Object)x).name == basePrefName)));
			if ((Object)(object)val == (Object)null)
			{
				DBG.blogDebug("Could not find prefab with name:" + basePrefName[1]);
				return false;
			}
			for (int num = 1; num < array2.Length; num++)
			{
				Transform val2 = val.transform.Find(array2[num]);
				if ((Object)(object)val2 == (Object)null)
				{
					DBG.blogDebug("Child is null:" + array2[num]);
					DBG.blogDebug("baseGo:" + ((Object)val).name);
					DBG.blogDebug("Child count:" + val.transform.childCount);
					for (int num2 = 0; num2 < val.transform.childCount; num2++)
					{
						DBG.blogDebug("Child:" + ((Object)val.transform.GetChild(num2)).name);
					}
					return false;
				}
				DBG.blogDebug("Child is valid:" + array2[num]);
				val = ((Component)val2).gameObject;
			}
			SkinnedMeshRenderer component = val.GetComponent<SkinnedMeshRenderer>();
			if ((Object)(object)component == (Object)null)
			{
				DBG.blogDebug("No Mesh skin in object:" + ((Object)val).name);
				return false;
			}
			Mesh sharedMesh = component.sharedMesh;
			if ((Object)(object)sharedMesh == (Object)null)
			{
				DBG.blogDebug("No Mesh in SkinMesh:" + ((Object)val).name);
				return false;
			}
			skinMesh.sharedMesh = sharedMesh;
			DBG.blogDebug("Fixed mesh on " + ((Object)skinMesh).name);
			return true;
		}

		public static bool FixMock(GameObject go, ZNetScene zns, bool justMesh = true)
		{
			bool flag = false;
			MeshFilter[] components = go.GetComponents<MeshFilter>();
			foreach (MeshFilter meshFilter in components)
			{
				flag = FixMockMesh(meshFilter, zns) || flag;
			}
			MeshFilter[] componentsInChildren = go.GetComponentsInChildren<MeshFilter>(true);
			foreach (MeshFilter meshFilter2 in componentsInChildren)
			{
				flag = FixMockMesh(meshFilter2, zns) || flag;
			}
			SkinnedMeshRenderer[] componentsInChildren2 = go.GetComponentsInChildren<SkinnedMeshRenderer>(true);
			foreach (SkinnedMeshRenderer skinMesh in componentsInChildren2)
			{
				flag = FixMockMeshSkin(skinMesh, zns) || flag;
			}
			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.2");
				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.2,  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.2,  remote: " + text);
			if (text != "0.0.2")
			{
				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 });
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(ZNet), "OnNewConnection")]
		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.2");
				version = val;
			}
			peer.m_rpc.Invoke("TT_Version", new object[1] { version });
			ZRoutedRpc.instance.InvokeRoutedRPC(peer.m_uid, "TT_Version", new object[1] { version });
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")]
		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
{
	[<c5c851bc-5f9a-4be6-a4ca-d9fc152c6f9c>Embedded]
	[CompilerGenerated]
	internal sealed class <c5c851bc-5f9a-4be6-a4ca-d9fc152c6f9c>EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[<c5c851bc-5f9a-4be6-a4ca-d9fc152c6f9c>Embedded]
	[CompilerGenerated]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[<c5c851bc-5f9a-4be6-a4ca-d9fc152c6f9c>Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class <f6918b5b-5fc8-4898-9cc6-d188d597af5e>NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public <f6918b5b-5fc8-4898-9cc6-d188d597af5e>NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public <f6918b5b-5fc8-4898-9cc6-d188d597af5e>NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[<c5c851bc-5f9a-4be6-a4ca-d9fc152c6f9c>Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	[CompilerGenerated]
	internal sealed class <70f360ff-d83b-4539-97f1-360dbdfcacdf>NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public <70f360ff-d83b-4539-97f1-360dbdfcacdf>NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	[<c5c851bc-5f9a-4be6-a4ca-d9fc152c6f9c>Embedded]
	[CompilerGenerated]
	internal sealed class <1a206514-c856-4b0d-9b18-83c26c9c470f>RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public <1a206514-c856-4b0d-9b18-83c26c9c470f>RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace YamlDotNet
{
	[<70f360ff-d83b-4539-97f1-360dbdfcacdf>NullableContext(1)]
	[<f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(0)]
	internal sealed class <fd20eec0-e047-4e6d-8997-29ae5abb0f4f>CultureInfoAdapter : CultureInfo
	{
		private readonly IFormatProvider provider;

		public <fd20eec0-e047-4e6d-8997-29ae5abb0f4f>CultureInfoAdapter(CultureInfo baseCulture, IFormatProvider provider)
			: base(baseCulture.Name)
		{
			this.provider = provider;
		}

		[return: <f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(2)]
		public override object GetFormat(Type formatType)
		{
			return provider.GetFormat(formatType);
		}
	}
	[<70f360ff-d83b-4539-97f1-360dbdfcacdf>NullableContext(1)]
	[<f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(0)]
	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 <c6dfe401-36b2-42d5-a20d-d4d7ccbee55f>PropertyInfoExtensions
	{
		[<70f360ff-d83b-4539-97f1-360dbdfcacdf>NullableContext(1)]
		[return: <f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(2)]
		public static object ReadValue(this PropertyInfo property, object target)
		{
			return property.GetValue(target, null);
		}
	}
	[<f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(0)]
	[<70f360ff-d83b-4539-97f1-360dbdfcacdf>NullableContext(1)]
	internal static class <635300ee-84f8-409c-8909-df602a5252bf>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: <f6918b5b-5fc8-4898-9cc6-d188d597af5e>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: <f6918b5b-5fc8-4898-9cc6-d188d597af5e>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([<70f360ff-d83b-4539-97f1-360dbdfcacdf>NullableContext(0)] (Type t, object context) => IsGenericDefinitionOfType(t, context), openGenericType).FirstOrDefault();
			static bool IsGenericDefinitionOfType(Type t, [<f6918b5b-5fc8-4898-9cc6-d188d597af5e>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([<70f360ff-d83b-4539-97f1-360dbdfcacdf>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: <f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(2)]
		public static PropertyInfo GetPublicProperty(this Type type, string name)
		{
			return type.GetProperties(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public).FirstOrDefault([<70f360ff-d83b-4539-97f1-360dbdfcacdf>NullableContext(0)] (PropertyInfo p) => p.Name == name);
		}

		[return: <f6918b5b-5fc8-4898-9cc6-d188d597af5e>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([<70f360ff-d83b-4539-97f1-360dbdfcacdf>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([<70f360ff-d83b-4539-97f1-360dbdfcacdf>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: <f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(2)]
		public static MethodInfo GetPublicStaticMethod(this Type type, string name, params Type[] parameterTypes)
		{
			return type.GetRuntimeMethods().FirstOrDefault([<70f360ff-d83b-4539-97f1-360dbdfcacdf>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, [<70f360ff-d83b-4539-97f1-360dbdfcacdf>NullableContext(0)] (ParameterInfo pi, Type pt) => pi.ParameterType == pt).All((bool r) => r);
					}
					return false;
				}
				return false;
			});
		}

		[return: <f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(2)]
		public static MethodInfo GetPublicInstanceMethod(this Type type, string name)
		{
			return type.GetRuntimeMethods().FirstOrDefault([<70f360ff-d83b-4539-97f1-360dbdfcacdf>NullableContext(0)] (MethodInfo m) => m.IsPublic && !m.IsStatic && m.Name.Equals(name));
		}

		[return: <f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(2)]
		public static MethodInfo GetGetMethod(this PropertyInfo property, bool nonPublic)
		{
			MethodInfo methodInfo = property.GetMethod;
			if (!nonPublic && !methodInfo.IsPublic)
			{
				methodInfo = null;
			}
			return methodInfo;
		}

		[return: <f6918b5b-5fc8-4898-9cc6-d188d597af5e>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<[<f6918b5b-5fc8-4898-9cc6-d188d597af5e>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([<70f360ff-d83b-4539-97f1-360dbdfcacdf>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([<70f360ff-d83b-4539-97f1-360dbdfcacdf>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 <79acd750-ad26-4716-9628-f6ea93887868>StandardRegexOptions
	{
		public const RegexOptions Compiled = RegexOptions.Compiled;
	}
}
namespace YamlDotNet.Serialization
{
	[<f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(0)]
	[<70f360ff-d83b-4539-97f1-360dbdfcacdf>NullableContext(1)]
	internal abstract class <246ffa96-9eee-4f9a-8eda-98b918a66d4f>BuilderSkeleton<[<f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(0)] TBuilder> where TBuilder : <246ffa96-9eee-4f9a-8eda-98b918a66d4f>BuilderSkeleton<TBuilder>
	{
		internal <6087985c-005c-4b9d-8175-38c1235a0a94>INamingConvention namingConvention = <ef67f711-3e94-4433-9af4-f1c077e88ede>NullNamingConvention.Instance;

		internal <6087985c-005c-4b9d-8175-38c1235a0a94>INamingConvention enumNamingConvention = <ef67f711-3e94-4433-9af4-f1c077e88ede>NullNamingConvention.Instance;

		internal <2bbf0f25-5400-44c0-838a-782b7b4e161d>ITypeResolver typeResolver;

		internal readonly <134113b9-cad9-429f-8357-e688b3971ed5>YamlAttributeOverrides overrides;

		internal readonly <4c1906d8-771d-4afc-85a3-468adda110f3>LazyComponentRegistrationList<<7212991f-f70e-4b6e-b844-5114b554b13a>Nothing, <6870f17c-6dd9-44cf-a882-9deff8638f4f>IYamlTypeConverter> typeConverterFactories;

		internal readonly <4c1906d8-771d-4afc-85a3-468adda110f3>LazyComponentRegistrationList<<c1cf28fc-b517-4db5-86da-94f16c017537>ITypeInspector, <c1cf28fc-b517-4db5-86da-94f16c017537>ITypeInspector> typeInspectorFactories;

		internal bool ignoreFields;

		internal bool includeNonPublicProperties;

		internal Settings settings;

		internal <0df89de9-8c3e-4e69-8c96-460b2cf1bd51>YamlFormatter yamlFormatter = <0df89de9-8c3e-4e69-8c96-460b2cf1bd51>YamlFormatter.Default;

		protected abstract TBuilder Self { get; }

		internal <246ffa96-9eee-4f9a-8eda-98b918a66d4f>BuilderSkeleton(<2bbf0f25-5400-44c0-838a-782b7b4e161d>ITypeResolver typeResolver)
		{
			overrides = new <134113b9-cad9-429f-8357-e688b3971ed5>YamlAttributeOverrides();
			typeConverterFactories = new <4c1906d8-771d-4afc-85a3-468adda110f3>LazyComponentRegistrationList<<7212991f-f70e-4b6e-b844-5114b554b13a>Nothing, <6870f17c-6dd9-44cf-a882-9deff8638f4f>IYamlTypeConverter>
			{
				{
					typeof(<54b8266b-3a24-4814-93a6-054ce0648470>GuidConverter),
					(<7212991f-f70e-4b6e-b844-5114b554b13a>Nothing _) => new <54b8266b-3a24-4814-93a6-054ce0648470>GuidConverter(jsonCompatible: false)
				},
				{
					typeof(<a5cd24c8-7ced-4b41-8062-78228cfc34d1>SystemTypeConverter),
					(<7212991f-f70e-4b6e-b844-5114b554b13a>Nothing _) => new <a5cd24c8-7ced-4b41-8062-78228cfc34d1>SystemTypeConverter()
				}
			};
			typeInspectorFactories = new <4c1906d8-771d-4afc-85a3-468adda110f3>LazyComponentRegistrationList<<c1cf28fc-b517-4db5-86da-94f16c017537>ITypeInspector, <c1cf28fc-b517-4db5-86da-94f16c017537>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(<6087985c-005c-4b9d-8175-38c1235a0a94>INamingConvention namingConvention)
		{
			this.namingConvention = namingConvention ?? throw new ArgumentNullException("namingConvention");
			return Self;
		}

		public TBuilder WithEnumNamingConvention(<6087985c-005c-4b9d-8175-38c1235a0a94>INamingConvention enumNamingConvention)
		{
			this.enumNamingConvention = enumNamingConvention;
			return Self;
		}

		public TBuilder WithTypeResolver(<2bbf0f25-5400-44c0-838a-782b7b4e161d>ITypeResolver typeResolver)
		{
			this.typeResolver = typeResolver ?? throw new ArgumentNullException("typeResolver");
			return Self;
		}

		public abstract TBuilder WithTagMapping(<7cde6ad2-d454-4564-bbe0-5a28dd8f20a0>TagName tag, Type type);

		public TBuilder WithAttributeOverride<[<f6918b5b-5fc8-4898-9cc6-d188d597af5e>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(<6870f17c-6dd9-44cf-a882-9deff8638f4f>IYamlTypeConverter typeConverter)
		{
			return WithTypeConverter(typeConverter, delegate(<2a1ab94a-ceda-4a1a-bd12-aba2aceb78c5>IRegistrationLocationSelectionSyntax<<6870f17c-6dd9-44cf-a882-9deff8638f4f>IYamlTypeConverter> w)
			{
				w.OnTop();
			});
		}

		public TBuilder WithTypeConverter(<6870f17c-6dd9-44cf-a882-9deff8638f4f>IYamlTypeConverter typeConverter, Action<<2a1ab94a-ceda-4a1a-bd12-aba2aceb78c5>IRegistrationLocationSelectionSyntax<<6870f17c-6dd9-44cf-a882-9deff8638f4f>IYamlTypeConverter>> where)
		{
			if (typeConverter == null)
			{
				throw new ArgumentNullException("typeConverter");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(typeConverterFactories.CreateRegistrationLocationSelector(typeConverter.GetType(), (<7212991f-f70e-4b6e-b844-5114b554b13a>Nothing _) => typeConverter));
			return Self;
		}

		public TBuilder WithTypeConverter<[<f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(0)] TYamlTypeConverter>(<602e8692-f56d-4559-8071-d7966f92da50>WrapperFactory<<6870f17c-6dd9-44cf-a882-9deff8638f4f>IYamlTypeConverter, <6870f17c-6dd9-44cf-a882-9deff8638f4f>IYamlTypeConverter> typeConverterFactory, Action<<da7ee084-1a2b-4596-a2b2-c210bde3e591>ITrackingRegistrationLocationSelectionSyntax<<6870f17c-6dd9-44cf-a882-9deff8638f4f>IYamlTypeConverter>> where) where TYamlTypeConverter : <6870f17c-6dd9-44cf-a882-9deff8638f4f>IYamlTypeConverter
		{
			if (typeConverterFactory == null)
			{
				throw new ArgumentNullException("typeConverterFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(typeConverterFactories.CreateTrackingRegistrationLocationSelector(typeof(TYamlTypeConverter), (<6870f17c-6dd9-44cf-a882-9deff8638f4f>IYamlTypeConverter wrapped, <7212991f-f70e-4b6e-b844-5114b554b13a>Nothing _) => typeConverterFactory(wrapped)));
			return Self;
		}

		public TBuilder WithoutTypeConverter<[<f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(0)] TYamlTypeConverter>() where TYamlTypeConverter : <6870f17c-6dd9-44cf-a882-9deff8638f4f>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<[<f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(0)] TTypeInspector>(Func<<c1cf28fc-b517-4db5-86da-94f16c017537>ITypeInspector, TTypeInspector> typeInspectorFactory) where TTypeInspector : <c1cf28fc-b517-4db5-86da-94f16c017537>ITypeInspector
		{
			return WithTypeInspector(typeInspectorFactory, delegate(<2a1ab94a-ceda-4a1a-bd12-aba2aceb78c5>IRegistrationLocationSelectionSyntax<<c1cf28fc-b517-4db5-86da-94f16c017537>ITypeInspector> w)
			{
				w.OnTop();
			});
		}

		public TBuilder WithTypeInspector<[<f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(0)] TTypeInspector>(Func<<c1cf28fc-b517-4db5-86da-94f16c017537>ITypeInspector, TTypeInspector> typeInspectorFactory, Action<<2a1ab94a-ceda-4a1a-bd12-aba2aceb78c5>IRegistrationLocationSelectionSyntax<<c1cf28fc-b517-4db5-86da-94f16c017537>ITypeInspector>> where) where TTypeInspector : <c1cf28fc-b517-4db5-86da-94f16c017537>ITypeInspector
		{
			if (typeInspectorFactory == null)
			{
				throw new ArgumentNullException("typeInspectorFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(typeInspectorFactories.CreateRegistrationLocationSelector(typeof(TTypeInspector), (<c1cf28fc-b517-4db5-86da-94f16c017537>ITypeInspector inner) => typeInspectorFactory(inner)));
			return Self;
		}

		public TBuilder WithTypeInspector<[<f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(0)] TTypeInspector>(<2bcbd54a-a2a7-4d23-9451-62c68f534433>WrapperFactory<<c1cf28fc-b517-4db5-86da-94f16c017537>ITypeInspector, <c1cf28fc-b517-4db5-86da-94f16c017537>ITypeInspector, TTypeInspector> typeInspectorFactory, Action<<da7ee084-1a2b-4596-a2b2-c210bde3e591>ITrackingRegistrationLocationSelectionSyntax<<c1cf28fc-b517-4db5-86da-94f16c017537>ITypeInspector>> where) where TTypeInspector : <c1cf28fc-b517-4db5-86da-94f16c017537>ITypeInspector
		{
			if (typeInspectorFactory == null)
			{
				throw new ArgumentNullException("typeInspectorFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(typeInspectorFactories.CreateTrackingRegistrationLocationSelector(typeof(TTypeInspector), (<c1cf28fc-b517-4db5-86da-94f16c017537>ITypeInspector wrapped, <c1cf28fc-b517-4db5-86da-94f16c017537>ITypeInspector inner) => typeInspectorFactory(wrapped, inner)));
			return Self;
		}

		public TBuilder WithoutTypeInspector<[<f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(0)] TTypeInspector>() where TTypeInspector : <c1cf28fc-b517-4db5-86da-94f16c017537>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(<0df89de9-8c3e-4e69-8c96-460b2cf1bd51>YamlFormatter formatter)
		{
			yamlFormatter = formatter ?? throw new ArgumentNullException("formatter");
			return Self;
		}

		protected IEnumerable<<6870f17c-6dd9-44cf-a882-9deff8638f4f>IYamlTypeConverter> BuildTypeConverters()
		{
			return typeConverterFactories.BuildComponentList();
		}
	}
	internal delegate TComponent <602e8692-f56d-4559-8071-d7966f92da50>WrapperFactory<[<f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(2)] TComponentBase, TComponent>(TComponentBase wrapped) where TComponent : TComponentBase;
	internal delegate TComponent <2bcbd54a-a2a7-4d23-9451-62c68f534433>WrapperFactory<[<f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(2)] TArgument, [<f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(2)] TComponentBase, TComponent>(TComponentBase wrapped, TArgument argument) where TComponent : TComponentBase;
	[Flags]
	internal enum <db7a6ce3-36b7-423d-8eee-ad3a60d3232e>DefaultValuesHandling
	{
		Preserve = 0,
		OmitNull = 1,
		OmitDefaults = 2,
		OmitEmptyCollections = 4
	}
	[<f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(0)]
	[<70f360ff-d83b-4539-97f1-360dbdfcacdf>NullableContext(1)]
	internal sealed class <f85fa31c-93bb-48a2-808e-7062a372b42d>Deserializer : <d3f00e01-d9d5-44e0-9552-afe1e86cf5b5>IDeserializer
	{
		private readonly <124f2a2f-996f-465d-8a93-20b2b8e01dc8>IValueDeserializer valueDeserializer;

		public <f85fa31c-93bb-48a2-808e-7062a372b42d>Deserializer()
			: this(new <cd7bd0a3-9052-47c6-aed4-ba76b7785c24>DeserializerBuilder().BuildValueDeserializer())
		{
		}

		private <f85fa31c-93bb-48a2-808e-7062a372b42d>Deserializer(<124f2a2f-996f-465d-8a93-20b2b8e01dc8>IValueDeserializer valueDeserializer)
		{
			this.valueDeserializer = valueDeserializer ?? throw new ArgumentNullException("valueDeserializer");
		}

		public static <f85fa31c-93bb-48a2-808e-7062a372b42d>Deserializer FromValueDeserializer(<124f2a2f-996f-465d-8a93-20b2b8e01dc8>IValueDeserializer valueDeserializer)
		{
			return new <f85fa31c-93bb-48a2-808e-7062a372b42d>Deserializer(valueDeserializer);
		}

		public T Deserialize<[<f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(2)] T>(string input)
		{
			using StringReader input2 = new StringReader(input);
			return Deserialize<T>(input2);
		}

		public T Deserialize<[<f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(2)] T>(TextReader input)
		{
			return Deserialize<T>(new <0a900672-4132-4288-890e-eb03574f65e4>Parser(input));
		}

		public T Deserialize<[<f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(2)] T>(<8f512aab-fb4a-4c85-8abf-89328afb7840>IParser parser)
		{
			return (T)Deserialize(parser, typeof(T));
		}

		[return: <f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(2)]
		public object Deserialize(string input)
		{
			return Deserialize<object>(input);
		}

		[return: <f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(2)]
		public object Deserialize(TextReader input)
		{
			return Deserialize<object>(input);
		}

		[return: <f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(2)]
		public object Deserialize(<8f512aab-fb4a-4c85-8abf-89328afb7840>IParser parser)
		{
			return Deserialize<object>(parser);
		}

		[return: <f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(2)]
		public object Deserialize(string input, Type type)
		{
			using StringReader input2 = new StringReader(input);
			return Deserialize(input2, type);
		}

		[return: <f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(2)]
		public object Deserialize(TextReader input, Type type)
		{
			return Deserialize(new <0a900672-4132-4288-890e-eb03574f65e4>Parser(input), type);
		}

		[return: <f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(2)]
		public object Deserialize(<8f512aab-fb4a-4c85-8abf-89328afb7840>IParser parser, Type type)
		{
			if (parser == null)
			{
				throw new ArgumentNullException("parser");
			}
			if (type == null)
			{
				throw new ArgumentNullException("type");
			}
			<a99ecd43-2bbb-4384-9e4e-90ac209bb247>StreamStart @event;
			bool flag = parser.TryConsume<<a99ecd43-2bbb-4384-9e4e-90ac209bb247>StreamStart>(out @event);
			<6c4260e7-df25-4d67-9a87-77d817d30c73>DocumentStart event2;
			bool flag2 = parser.TryConsume<<6c4260e7-df25-4d67-9a87-77d817d30c73>DocumentStart>(out event2);
			object result = null;
			if (!parser.Accept<<277f7248-07a4-4971-95b2-2f90cee029a9>DocumentEnd>(out var _) && !parser.Accept<<2d5badcf-b4a5-451d-afae-9909f8551a14>StreamEnd>(out var _))
			{
				using <2e3056b0-9701-4a72-b1ab-bcfa4ea55a9a>SerializerState <2e3056b0-9701-4a72-b1ab-bcfa4ea55a9a>SerializerState = new <2e3056b0-9701-4a72-b1ab-bcfa4ea55a9a>SerializerState();
				result = valueDeserializer.DeserializeValue(parser, type, <2e3056b0-9701-4a72-b1ab-bcfa4ea55a9a>SerializerState, valueDeserializer);
				<2e3056b0-9701-4a72-b1ab-bcfa4ea55a9a>SerializerState.OnDeserialization();
			}
			if (flag2)
			{
				parser.Consume<<277f7248-07a4-4971-95b2-2f90cee029a9>DocumentEnd>();
			}
			if (flag)
			{
				parser.Consume<<2d5badcf-b4a5-451d-afae-9909f8551a14>StreamEnd>();
			}
			return result;
		}
	}
	[<f6918b5b-5fc8-4898-9cc6-d188d597af5e>Nullable(new byte[] { 0, 1 })]
	[<70f360ff-d83b-4539-97f1-360dbdfcacdf>NullableContext(1)]
	internal sealed class <cd7bd0a3-9052-47c6-aed4-ba76b7785c24>DeserializerBuilder : <246ffa96-9eee-4f9a-8eda-98b918a66d4f>BuilderSkeleton<<cd7bd0a3-9052-47c6-aed4-ba76b7785c24>DeserializerBuilder>
	{
		private Lazy<<8dca3b34-6e4d-48a3-a923-e2b47fa12f08>IObjectFactory> objectFactory;

		private readonly <4c1906d8-771d-4afc-85a3-468adda110f3>LazyComponentRegistrationList<<7212991f-f70e-4b6e-b844-5114b554b13a>Nothing, <e9828495-5277-47a2-8d48-f226ba4022e5>INodeDeserializer> nodeDeserializerFactories;

		private readonly <4c1906d8-771d-4afc-85a3-468adda110f3>LazyComponentRegistrationList<<7212991f-f70e-4b6e-b844-5114b554b13a>Nothing, <6cbb1eac-3b5d-43b8-badc-8d386086b063>INodeTypeResolver> nodeTypeResolverFactories;

		private readonly Dictionary<<7cde6ad2-d454-4564-bbe0-5a28dd8f20a0>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 <cd7bd0a3-9052-47c6-aed4-ba76b7785c24>DeserializerBuilder Self => this;

		public <cd7bd0a3-9052-47c6-aed4-ba76b7785c24>DeserializerBuilder()
			: base((<2bbf0f25-5400-44c0-838a-782b7b4e161d>ITypeResolver)new <54a937eb-5c1c-49ba-aad6-3a98024d191b>StaticTypeResolver())
		{
			typeMappings = new Dictionary<Type, Type>();
			objectFactory = new Lazy<<8dca3b34-6e4d-48a3-a923-e2b47fa12f08>IObjectFactory>(() => new <f093cf7a-b8fc-49d9-a2ed-bc0686343c20>DefaultObjectFactory(typeMappings, settings), isThreadSafe: true);
			tagMappings = new Dictionary<<7cde6ad2-d454-4564-bbe0-5a28dd8f20a0>TagName, Type>
			{
				{
					<8f8caf54-7a72-454e-b8a0-654322e51e67>FailsafeSchema.Tags.Map,
					typeof(Dictionary<object, object>)
				},
				{
					<8f8caf54-7a72-454e-b8a0-654322e51e67>FailsafeSchema.Tags.Str,
					typeof(string)
				},
				{
					<c5205cfe-e880-458e-8769-7fa654e2ea93>JsonSchema.Tags.Bool,
					typeof(bool)
				},
				{
					<c5205cfe-e880-458e-8769-7fa654e2ea93>JsonSchema.Tags.Float,
					typeof(double)
				},
				{
					<c5205cfe-e880-458e-8769-7fa654e2ea93>JsonSchema.Tags.Int,
					typeof(int)
				},
				{
					<477abf8b-b05e-4880-851e-399f56e69200>DefaultSchema.Tags.Timestamp,
					typeof(DateTime)
				}
			};
			typeInspectorFactories.Add(typeof(<6aa4b6ff-9f9e-4d5a-9a2e-52a5b0d30ce4>CachedTypeInspector), (<c1cf28fc-b517-4db5-86da-94f16c017537>ITypeInspector inner) => new <6aa4b6ff-9f9e-4d5a-9a2e-52a5b0d30ce4>CachedTypeInspector(inner));
			typeInspectorFactories.Add(typeof(<56252ba2-66a1-4c45-a6d4-6d6688a13e17>NamingConventionTypeInspector), (<c1cf28fc-b517-4db5-86da-94f16c017537>ITypeInspector inner) => (!(namingConvention is <ef67f711-3e94-4433-9af4-f1c077e88ede>NullNamingConvention)) ? new <56252ba2-66a1-4c45-a6d4-6d6688a13e17>NamingConventionTypeInspector(inner, namingConvention) : inner);
			typeInspectorFactories.Add(typeof(<a9301966-6907-483c-a662-b65609c1debf>YamlAttributesTypeInspector), (<c1cf28fc-b517-4db5-86da-94f16c017537>ITypeInspector inner) => new <a9301966-6907-483c-a662-b65609c1debf>YamlAttributesTypeInspector(inner));
			typeInspectorFactories.Add(typeof(<7583e70c-565f-4768-ac96-f1108d46e002>YamlAttributeOverridesInspector), (<c1cf28fc-b517-4db5-86da-94f16c017537>ITypeInspector inner) => (overrides == null) ? inner : new <7583e70c-565f-4768-ac96-f1108d46e002>YamlAttributeOverridesInspector(inner, overrides.Clone()));
			typeInspectorFactories.Add(typeof(<e1f440de-22ca-49cb-a9f6-75086d0bb985>ReadableAndWritablePropertiesTypeInspector), (<c1cf28fc-b517-4db5-86da-94f16c017537>ITypeInspector inner) => new <e1f440de-22ca-49cb-a9f6-75086d0bb985>ReadableAndWritablePropertiesTypeInspector(inner));
			nodeDeserializerFactories = new <4c1906d8-771d-4afc-85a3-468adda110f3>LazyComponentRegistrationList<<7212991f-f70e-4b6e-b844-5114b554b13a>Nothing, <e9828495-5277-47a2-8d48-f226ba4022e5>INodeDeserializer>
			{
				{
					typeof(<9dbcd232-fe6d-43e3-8cd2-048d0d0dbb16>YamlConvertibleNodeDeserializer),
					(<7212991f-f70e-4b6e-b844-5114b554b13a>Nothing _) => new <9dbcd232-fe6d-43e3-8cd2-048d0d0dbb16>YamlConvertibleNodeDeserializer(objectFactory.Value)
				},
				{
					typeof(<d42492f2-ace6-4fd2-a82b-bbbfa3fa2c8e>YamlSerializableNodeDeserializer),
					(<7212991f-f70e-4b6e-b844-5114b554b13a>Nothing _) => new <d42492f2-ace6-4fd2-a82b-bbbfa3fa2c8e>YamlSerializableNodeDeserializer(objectFactory.Value)
				},
				{
					typeof(<33a7bd3a-d5c0-47a2-a7b7-7d818f8a2ee4>TypeConverterNodeDeserializer),
					(<7212991f-f70e-4b6e-b844-5114b554b13a>Nothing _) => new <33a7bd3a-d5c0-47a2-a7b7-7d818f8a2ee4>TypeConverterNodeDeserializer(BuildTypeConverters())
				},
				{
					typeof(<67d999b3-950a-4190-9f98-17cc149a757d>NullNodeDeserializer),
					(<7212991f-f70e-4b6e-b844-5114b554b13a>Nothing _) => new <67d999b3-950a-4190-9f98-17cc149a757d>NullNodeDeserializer()
				},
				{
					typeof(<87cc22f6-0b5b-4e35-a25a-6aaec2113a79>ScalarNodeDeserializer),
					(<7212991f-f70e-4b6e-b844-5114b554b13a>Nothing _) => new <87cc22f6-0b5b-4e35-a25a-6aaec2113a79>ScalarNodeDeserializer(attemptUnknownTypeDeserialization, typeConverter, BuildTypeInspector(), yamlFormatter, enumNamingConvention)
				},
				{
					typeof(<db615049-10d4-4cb5-a6a0-ce0c43d212ed>ArrayNodeDeserializer),
					(<7212991f-f70e-4b6e-b844-5114b554b13a>Nothing _) => new <db615049-10d4-4cb5-a6a0-ce0c43d212ed>ArrayNodeDeserializer(enumNamingConvention, BuildTypeInspector())
				},
				{
					typeof(<126c4e8c-d0d8-40ce-b42c-be65c2af1102>DictionaryNodeDeserializer),
					(<7212991f-f70e-4b6e-b844-5114b554b13a>Nothing _) => new <126c4e8c-d0d8-40ce-b42c-be65c2af1102>DictionaryNodeDeserializer(objectFactory.Value, duplicateKeyChecking)
				},
				{
					typeof(<7b432650-6ecd-4231-977e-d34df37afc68>CollectionNodeDeserializer),
					(<7212991f-f70e-4b6e-b844-5114b554b13a>Nothing _) => new <7b432650-6ecd-4231-977e-d34df37afc68>CollectionNodeDeserializer(objectFactory.Value, enumNamingConvention, BuildTypeInspector())
				},
				{
					typeof(<cd398304-b51d-41a2-a48e-b5a4bdf13546>EnumerableNodeDeserializer),
					(<7212991f-f70e-4b6e-b844-5114b554b13a>Nothing _) => new <cd398304-b51d-41a2-a48e-b5a4bdf13546>EnumerableNodeDeserializer()
				},
				{
					typeof(<cd9d5f2a-0126-42eb-a8a7-9bb635bed667>ObjectNodeDeserializer),
					(<7212991f-f70e-4b6e-b844-5114b554b13a>Nothing _) => new <cd9d5f2a-0126-42eb-a8a7-9bb635bed667>ObjectNodeDeserializer(objectFactory.Value, BuildTypeInspector(), ignoreUnmatched, duplicateKeyChecking, typeConverter, enumNamingConvention, enforceNullability, caseInsensitivePropertyMatching, enforceRequiredProperties, BuildTypeConverters())
				},
				{
					typeof(FsharpListNodeDeserializer),
					(<7212991f-f70e-4b6e-b844-5114b554b13a>Nothing _) => new FsharpListNodeDeserializer(BuildTypeInspector(), enumNamingConvention)
				}
			};
			nodeTypeResolverFactories = new <4c1906d8-771d-4afc-85a3-468adda110f3>LazyComponentRegistrationList<<7212991f-f70e-4b6e-b844-5114b554b13a>Nothing, <6cbb1eac-3b5d-43b8-badc-8d386086b063>INodeTypeResolver>
			{
				{
					typeof(<69ead46c-3146-4bbb-b063-cd045eb98761>MappingNodeTypeResolver),
					(<7212991f-f70e-4b6e-b844-5114b554b13a>Nothing _) => new <69ead46c-3146-4bbb-b063-cd045eb98761>MappingNodeTypeResolver(typeMappings)
				},
				{
					typeof(<9bff0c04-b3b4-4135-a4fa-ff28a5d2fbbe>YamlConvertibleTypeResolver),
					(<7212991f-f70e-4b6e-b844-5114b554b13a>Nothing _) => new <9bff0c04-b3b4-4135-a4fa-ff28a5d2fbbe>YamlConvertibleTypeResolver()
				},
				{
					typeof(<6852acd4-26ed-46d0-9446-7b051035910f>YamlSerializableTypeResolver),
					(<7212991f-f70e-4b6e-b844-5114b