Decompiled source of Expand World Prefabs v1.12.0

ExpandWorldPrefabs.dll

Decompiled 4 days 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.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
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 BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Data;
using ExpandWorld.Prefab;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Service;
using UnityEngine;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Core.Tokens;
using YamlDotNet.Helpers;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.Converters;
using YamlDotNet.Serialization.EventEmitters;
using YamlDotNet.Serialization.NamingConventions;
using YamlDotNet.Serialization.NodeDeserializers;
using YamlDotNet.Serialization.NodeTypeResolvers;
using YamlDotNet.Serialization.ObjectFactories;
using YamlDotNet.Serialization.ObjectGraphTraversalStrategies;
using YamlDotNet.Serialization.ObjectGraphVisitors;
using YamlDotNet.Serialization.Schemas;
using YamlDotNet.Serialization.TypeInspectors;
using YamlDotNet.Serialization.TypeResolvers;
using YamlDotNet.Serialization.Utilities;
using YamlDotNet.Serialization.ValueDeserializers;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("ExpandWorldPrefabs")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ExpandWorldPrefabs")]
[assembly: AssemblyTitle("ExpandWorldPrefabs")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[<68fdcdf9-ac8a-4503-957d-2502d50ed3a7>Embedded]
	internal sealed class <68fdcdf9-ac8a-4503-957d-2502d50ed3a7>EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[<68fdcdf9-ac8a-4503-957d-2502d50ed3a7>Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class <aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public <aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public <aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[<68fdcdf9-ac8a-4503-957d-2502d50ed3a7>Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class <7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public <7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[<68fdcdf9-ac8a-4503-957d-2502d50ed3a7>Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Data
{
	[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(1)]
	[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(0)]
	public class Calculator
	{
		public static Vector3 EvaluateVector3(string expression)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			Vector3 zero = Vector3.zero;
			string[] array = Parse.Split(expression);
			zero.x = EvaluateFloat(array[0]).GetValueOrDefault();
			if (array.Length > 1)
			{
				zero.z = EvaluateFloat(array[1]).GetValueOrDefault();
			}
			if (array.Length > 2)
			{
				zero.y = EvaluateFloat(array[2]).GetValueOrDefault();
			}
			return zero;
		}

		public static Vector3 EvaluateVector3(string[] s, int index)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			Vector3 zero = Vector3.zero;
			if (s.Length > index)
			{
				zero.x = EvaluateFloat(s[index]).GetValueOrDefault();
			}
			if (s.Length > index + 1)
			{
				zero.z = EvaluateFloat(s[index + 1]).GetValueOrDefault();
			}
			if (s.Length > index + 2)
			{
				zero.y = EvaluateFloat(s[index + 2]).GetValueOrDefault();
			}
			return zero;
		}

		public static Quaternion EvaluateQuaternion(string expression)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			Vector3 zero = Vector3.zero;
			string[] array = Parse.Split(expression);
			zero.y = EvaluateFloat(array[0]).GetValueOrDefault();
			if (array.Length > 1)
			{
				zero.x = EvaluateFloat(array[1]).GetValueOrDefault();
			}
			if (array.Length > 2)
			{
				zero.z = EvaluateFloat(array[2]).GetValueOrDefault();
			}
			return Quaternion.Euler(zero);
		}

		public static Quaternion EvaluateQuaternion(string[] s, int index)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			Vector3 zero = Vector3.zero;
			if (s.Length > index)
			{
				zero.y = EvaluateFloat(s[index]).GetValueOrDefault();
			}
			if (s.Length > index + 1)
			{
				zero.x = EvaluateFloat(s[index + 1]).GetValueOrDefault();
			}
			if (s.Length > index + 2)
			{
				zero.z = EvaluateFloat(s[index + 2]).GetValueOrDefault();
			}
			return Quaternion.Euler(zero);
		}

		public static int? EvaluateInt(string expression)
		{
			try
			{
				return (int?)EvaluateLong(expression);
			}
			catch
			{
				return null;
			}
		}

		public static float? EvaluateFloat(string expression)
		{
			try
			{
				return (float)EvaluateDouble(expression);
			}
			catch
			{
				return null;
			}
		}

		private static double EvaluateDouble(string expression)
		{
			string[] array = expression.Split(new char[1] { '+' });
			if (array.Length > 1)
			{
				double num = 0.0;
				string[] array2 = array;
				foreach (string expression2 in array2)
				{
					num += EvaluateDouble(expression2);
				}
				return num;
			}
			string[] array3 = expression.Split(new char[1] { '-' });
			if (array3.Where([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (string s) => s != "").Count() > 1)
			{
				double? num2 = null;
				for (int j = 0; j < array3.Length; j++)
				{
					if (!(array3[j] == "") || j + 1 >= array3.Length)
					{
						num2 = (num2.HasValue ? (num2 - EvaluateDouble(array3[j])) : new double?(EvaluateDouble(array3[j])));
					}
					else
					{
						array3[j + 1] = "-" + array3[j + 1];
					}
				}
				return num2.GetValueOrDefault();
			}
			string[] array4 = expression.Split(new char[1] { '*' });
			if (array4.Length > 1)
			{
				double num3 = 1.0;
				string[] array2 = array4;
				foreach (string expression3 in array2)
				{
					num3 *= EvaluateDouble(expression3);
				}
				return num3;
			}
			string[] array5 = expression.Split(new char[1] { '/' });
			if (array5.Length > 1)
			{
				double num4 = EvaluateDouble(array5[0]);
				for (int k = 1; k < array5.Length; k++)
				{
					num4 /= EvaluateDouble(array5[k]);
				}
				return num4;
			}
			try
			{
				return double.Parse(expression.Trim(), NumberFormatInfo.InvariantInfo);
			}
			catch
			{
				throw new InvalidOperationException("Failed to parse expression: " + expression);
			}
		}

		public static long? EvaluateLong(string expression)
		{
			try
			{
				return EvalLong(expression);
			}
			catch
			{
				return null;
			}
		}

		private static long EvalLong(string expression)
		{
			string[] array = expression.Split(new char[1] { '+' });
			if (array.Length > 1)
			{
				long num = 0L;
				string[] array2 = array;
				foreach (string expression2 in array2)
				{
					num += EvalLong(expression2);
				}
				return num;
			}
			string[] array3 = expression.Split(new char[1] { '-' });
			if (array3.Where([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (string s) => s != "").Count() > 1)
			{
				long? num2 = null;
				for (int j = 0; j < array3.Length; j++)
				{
					if (!(array3[j] == "") || j + 1 >= array3.Length)
					{
						num2 = (num2.HasValue ? (num2 - EvalLong(array3[j])) : new long?(EvalLong(array3[j])));
					}
					else
					{
						array3[j + 1] = "-" + array3[j + 1];
					}
				}
				return num2.GetValueOrDefault();
			}
			string[] array4 = expression.Split(new char[1] { '*' });
			if (array4.Length > 1)
			{
				long num3 = 1L;
				string[] array2 = array4;
				foreach (string expression3 in array2)
				{
					num3 *= EvalLong(expression3);
				}
				return num3;
			}
			string[] array5 = expression.Split(new char[1] { '/' });
			if (array5.Length > 1)
			{
				long num4 = EvalLong(array5[0]);
				for (int k = 1; k < array5.Length; k++)
				{
					num4 /= EvalLong(array5[k]);
				}
				return num4;
			}
			try
			{
				return long.Parse(expression.Trim(), NumberFormatInfo.InvariantInfo);
			}
			catch
			{
				throw new InvalidOperationException("Failed to parse expression: " + expression);
			}
		}
	}
	[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(2)]
	[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(0)]
	public class DataData
	{
		[DefaultValue(null)]
		public string name;

		[DefaultValue(null)]
		public string connection;

		[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 2, 1 })]
		[DefaultValue(null)]
		public string[] bools;

		[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 2, 1 })]
		[DefaultValue(null)]
		public string[] ints;

		[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 2, 1 })]
		[DefaultValue(null)]
		public string[] hashes;

		[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 2, 1 })]
		[DefaultValue(null)]
		public string[] floats;

		[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 2, 1 })]
		[DefaultValue(null)]
		public string[] strings;

		[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 2, 1 })]
		[DefaultValue(null)]
		public string[] longs;

		[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 2, 1 })]
		[DefaultValue(null)]
		public string[] vecs;

		[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 2, 1 })]
		[DefaultValue(null)]
		public string[] quats;

		[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 2, 1 })]
		[DefaultValue(null)]
		public string[] bytes;

		[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 2, 1 })]
		[DefaultValue(null)]
		public ItemData[] items;

		[DefaultValue(null)]
		public string containerSize;

		[DefaultValue(null)]
		public string itemAmount;

		[DefaultValue(null)]
		public string valueGroup;

		[DefaultValue(null)]
		public string value;

		[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 2, 1 })]
		[DefaultValue(null)]
		public string[] values;
	}
	[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(1)]
	[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(0)]
	public class ItemData
	{
		public string pos = "";

		[DefaultValue(1f)]
		public float chance = 1f;

		[DefaultValue("")]
		public string prefab = "";

		[DefaultValue("1")]
		public string stack = "1";

		[DefaultValue("1")]
		public string quality = "1";

		[DefaultValue("0")]
		public string variant = "0";

		[DefaultValue("0")]
		public string durability = "0";

		[DefaultValue("0")]
		public string crafterID = "0";

		[DefaultValue("")]
		public string crafterName = "";

		[DefaultValue("0")]
		public string worldLevel = "0";

		[DefaultValue("false")]
		public string equipped = "false";

		[DefaultValue("false")]
		public string pickedUp = "false";

		[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 2, 1, 1 })]
		[DefaultValue(null)]
		public Dictionary<string, string> customData;
	}
	[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(1)]
	[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(0)]
	public class DataEntry
	{
		[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 2, 1 })]
		public Dictionary<int, IStringValue> Strings;

		[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 2, 1 })]
		public Dictionary<int, IFloatValue> Floats;

		[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 2, 1 })]
		public Dictionary<int, IIntValue> Ints;

		[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 2, 1 })]
		public Dictionary<int, IBoolValue> Bools;

		[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 2, 1 })]
		public Dictionary<int, IHashValue> Hashes;

		[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 2, 1 })]
		public Dictionary<int, ILongValue> Longs;

		[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 2, 1 })]
		public Dictionary<int, IVector3Value> Vecs;

		[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 2, 1 })]
		public Dictionary<int, IQuaternionValue> Quats;

		[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 2, 1 })]
		public Dictionary<int, byte[]> ByteArrays;

		[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 2, 1 })]
		public List<ItemValue> Items;

		public Vector2i? ContainerSize;

		[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(2)]
		public IIntValue ItemAmount;

		public ConnectionType ConnectionType;

		public int ConnectionHash;

		public ZDOID OriginalId = ZDOID.None;

		public ZDOID TargetConnectionId = ZDOID.None;

		public HashSet<string> RequiredParameters = new HashSet<string>();

		public DataEntry()
		{
		}//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)


		public DataEntry(string base64)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			this.Load(new ZPackage(base64));
		}

		public DataEntry(DataData data)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			Load(data);
		}

		public DataEntry(ZDO zdo)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			Load(zdo);
		}

		public void Load(ZDO zdo)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			ZDOID uid = zdo.m_uid;
			Floats = (ZDOExtraData.s_floats.ContainsKey(uid) ? ((IEnumerable<KeyValuePair<int, float>>)ZDOExtraData.s_floats[uid]).ToDictionary([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, float> kvp) => kvp.Key, [<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, float> kvp) => DataValue.Simple(kvp.Value)) : null);
			Ints = (ZDOExtraData.s_ints.ContainsKey(uid) ? ((IEnumerable<KeyValuePair<int, int>>)ZDOExtraData.s_ints[uid]).ToDictionary([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, int> kvp) => kvp.Key, [<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, int> kvp) => DataValue.Simple(kvp.Value)) : null);
			Longs = (ZDOExtraData.s_longs.ContainsKey(uid) ? ((IEnumerable<KeyValuePair<int, long>>)ZDOExtraData.s_longs[uid]).ToDictionary([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, long> kvp) => kvp.Key, [<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, long> kvp) => DataValue.Simple(kvp.Value)) : null);
			Strings = (ZDOExtraData.s_strings.ContainsKey(uid) ? ((IEnumerable<KeyValuePair<int, string>>)ZDOExtraData.s_strings[uid]).ToDictionary([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, string> kvp) => kvp.Key, [<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, string> kvp) => DataValue.Simple(kvp.Value)) : null);
			Vecs = (ZDOExtraData.s_vec3.ContainsKey(uid) ? ((IEnumerable<KeyValuePair<int, Vector3>>)ZDOExtraData.s_vec3[uid]).ToDictionary([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, Vector3> kvp) => kvp.Key, [<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, Vector3> kvp) => DataValue.Simple(kvp.Value)) : null);
			Quats = (ZDOExtraData.s_quats.ContainsKey(uid) ? ((IEnumerable<KeyValuePair<int, Quaternion>>)ZDOExtraData.s_quats[uid]).ToDictionary([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, Quaternion> kvp) => kvp.Key, [<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, Quaternion> kvp) => DataValue.Simple(kvp.Value)) : null);
			ByteArrays = (ZDOExtraData.s_byteArrays.ContainsKey(uid) ? ((IEnumerable<KeyValuePair<int, byte[]>>)ZDOExtraData.s_byteArrays[uid]).ToDictionary([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, byte[]> kvp) => kvp.Key, [<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, byte[]> kvp) => kvp.Value) : null);
			if (ZDOExtraData.s_connectionsHashData.TryGetValue(uid, out var value))
			{
				ConnectionType = value.m_type;
				ConnectionHash = value.m_hash;
			}
			OriginalId = uid;
			if (ZDOExtraData.s_connections.TryGetValue(uid, out var value2) && value2.m_target != ZDOID.None)
			{
				TargetConnectionId = value2.m_target;
				ConnectionType = value2.m_type;
			}
		}

		public void Load(DataEntry data)
		{
			//IL_0411: Unknown result type (might be due to invalid IL or missing references)
			//IL_0416: Unknown result type (might be due to invalid IL or missing references)
			//IL_0429: Unknown result type (might be due to invalid IL or missing references)
			//IL_042e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Unknown result type (might be due to invalid IL or missing references)
			if (data.Floats != null)
			{
				if (Floats == null)
				{
					Floats = new Dictionary<int, IFloatValue>();
				}
				foreach (KeyValuePair<int, IFloatValue> @float in data.Floats)
				{
					Floats[@float.Key] = @float.Value;
				}
			}
			if (data.Vecs != null)
			{
				if (Vecs == null)
				{
					Vecs = new Dictionary<int, IVector3Value>();
				}
				foreach (KeyValuePair<int, IVector3Value> vec in data.Vecs)
				{
					Vecs[vec.Key] = vec.Value;
				}
			}
			if (data.Quats != null)
			{
				if (Quats == null)
				{
					Quats = new Dictionary<int, IQuaternionValue>();
				}
				foreach (KeyValuePair<int, IQuaternionValue> quat in data.Quats)
				{
					Quats[quat.Key] = quat.Value;
				}
			}
			if (data.Ints != null)
			{
				if (Ints == null)
				{
					Ints = new Dictionary<int, IIntValue>();
				}
				foreach (KeyValuePair<int, IIntValue> @int in data.Ints)
				{
					Ints[@int.Key] = @int.Value;
				}
			}
			if (data.Strings != null)
			{
				if (Strings == null)
				{
					Strings = new Dictionary<int, IStringValue>();
				}
				foreach (KeyValuePair<int, IStringValue> @string in data.Strings)
				{
					Strings[@string.Key] = @string.Value;
				}
			}
			if (data.ByteArrays != null)
			{
				if (ByteArrays == null)
				{
					ByteArrays = new Dictionary<int, byte[]>();
				}
				foreach (KeyValuePair<int, byte[]> byteArray in data.ByteArrays)
				{
					ByteArrays[byteArray.Key] = byteArray.Value;
				}
			}
			if (data.Longs != null)
			{
				if (Longs == null)
				{
					Longs = new Dictionary<int, ILongValue>();
				}
				foreach (KeyValuePair<int, ILongValue> @long in data.Longs)
				{
					Longs[@long.Key] = @long.Value;
				}
			}
			if (data.Bools != null)
			{
				if (Bools == null)
				{
					Bools = new Dictionary<int, IBoolValue>();
				}
				foreach (KeyValuePair<int, IBoolValue> @bool in data.Bools)
				{
					Bools[@bool.Key] = @bool.Value;
				}
			}
			if (data.Hashes != null)
			{
				if (Hashes == null)
				{
					Hashes = new Dictionary<int, IHashValue>();
				}
				foreach (KeyValuePair<int, IHashValue> hash in data.Hashes)
				{
					Hashes[hash.Key] = hash.Value;
				}
			}
			if (data.Items != null)
			{
				if (Items == null)
				{
					Items = new List<ItemValue>();
				}
				foreach (ItemValue item in data.Items)
				{
					Items.Add(item);
				}
			}
			if (data.ContainerSize.HasValue)
			{
				ContainerSize = data.ContainerSize;
			}
			if (data.ItemAmount != null)
			{
				ItemAmount = data.ItemAmount;
			}
			ConnectionType = data.ConnectionType;
			ConnectionHash = data.ConnectionHash;
			OriginalId = data.OriginalId;
			TargetConnectionId = data.TargetConnectionId;
			foreach (string requiredParameter in data.RequiredParameters)
			{
				RequiredParameters.Add(requiredParameter);
			}
		}

		public DataEntry Reset(DataData data)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//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)
			Floats = null;
			Vecs = null;
			Quats = null;
			Ints = null;
			Strings = null;
			ByteArrays = null;
			Longs = null;
			Bools = null;
			Hashes = null;
			Items = null;
			ContainerSize = null;
			ItemAmount = null;
			ConnectionType = (ConnectionType)0;
			ConnectionHash = 0;
			OriginalId = ZDOID.None;
			TargetConnectionId = ZDOID.None;
			RequiredParameters.Clear();
			Load(data);
			return this;
		}

		public void Load(DataData data)
		{
			//IL_0782: Unknown result type (might be due to invalid IL or missing references)
			//IL_087f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0884: Unknown result type (might be due to invalid IL or missing references)
			HashSet<string> hashSet = new HashSet<string>();
			if (data.floats != null)
			{
				if (Floats == null)
				{
					Floats = new Dictionary<int, IFloatValue>();
				}
				string[] floats = data.floats;
				foreach (string text in floats)
				{
					KeyValuePair<string, string> keyValuePair = Parse.Kvp(text);
					if (keyValuePair.Key == "")
					{
						throw new InvalidOperationException("Failed to parse float " + text + ".");
					}
					if (keyValuePair.Key.Contains("."))
					{
						hashSet.Add(keyValuePair.Key.Split(new char[1] { '.' })[0]);
					}
					Floats.Add(Hash(keyValuePair.Key), DataValue.Float(keyValuePair.Value, RequiredParameters));
				}
			}
			if (data.ints != null)
			{
				if (Ints == null)
				{
					Ints = new Dictionary<int, IIntValue>();
				}
				string[] floats = data.ints;
				foreach (string text2 in floats)
				{
					KeyValuePair<string, string> keyValuePair2 = Parse.Kvp(text2);
					if (keyValuePair2.Key == "")
					{
						throw new InvalidOperationException("Failed to parse int " + text2 + ".");
					}
					if (keyValuePair2.Key.Contains("."))
					{
						hashSet.Add(keyValuePair2.Key.Split(new char[1] { '.' })[0]);
					}
					Ints.Add(Hash(keyValuePair2.Key), DataValue.Int(keyValuePair2.Value, RequiredParameters));
				}
			}
			if (data.bools != null)
			{
				if (Bools == null)
				{
					Bools = new Dictionary<int, IBoolValue>();
				}
				string[] floats = data.bools;
				foreach (string text3 in floats)
				{
					KeyValuePair<string, string> keyValuePair3 = Parse.Kvp(text3);
					if (keyValuePair3.Key == "")
					{
						throw new InvalidOperationException("Failed to parse bool " + text3 + ".");
					}
					if (keyValuePair3.Key.Contains("."))
					{
						hashSet.Add(keyValuePair3.Key.Split(new char[1] { '.' })[0]);
					}
					Bools.Add(Hash(keyValuePair3.Key), DataValue.Bool(keyValuePair3.Value, RequiredParameters));
				}
			}
			if (data.hashes != null)
			{
				if (Hashes == null)
				{
					Hashes = new Dictionary<int, IHashValue>();
				}
				string[] floats = data.hashes;
				foreach (string text4 in floats)
				{
					KeyValuePair<string, string> keyValuePair4 = Parse.Kvp(text4);
					if (keyValuePair4.Key == "")
					{
						throw new InvalidOperationException("Failed to parse hash " + text4 + ".");
					}
					if (keyValuePair4.Key.Contains("."))
					{
						hashSet.Add(keyValuePair4.Key.Split(new char[1] { '.' })[0]);
					}
					Hashes.Add(Hash(keyValuePair4.Key), DataValue.Hash(keyValuePair4.Value, RequiredParameters));
				}
			}
			if (data.longs != null)
			{
				if (Longs == null)
				{
					Longs = new Dictionary<int, ILongValue>();
				}
				string[] floats = data.longs;
				foreach (string text5 in floats)
				{
					KeyValuePair<string, string> keyValuePair5 = Parse.Kvp(text5);
					if (keyValuePair5.Key == "")
					{
						throw new InvalidOperationException("Failed to parse long " + text5 + ".");
					}
					if (keyValuePair5.Key.Contains("."))
					{
						hashSet.Add(keyValuePair5.Key.Split(new char[1] { '.' })[0]);
					}
					Longs.Add(Hash(keyValuePair5.Key), DataValue.Long(keyValuePair5.Value, RequiredParameters));
				}
			}
			if (data.strings != null)
			{
				if (Strings == null)
				{
					Strings = new Dictionary<int, IStringValue>();
				}
				string[] floats = data.strings;
				foreach (string text6 in floats)
				{
					KeyValuePair<string, string> keyValuePair6 = Parse.Kvp(text6);
					if (keyValuePair6.Key == "")
					{
						throw new InvalidOperationException("Failed to parse string " + text6 + ".");
					}
					if (keyValuePair6.Key.Contains("."))
					{
						hashSet.Add(keyValuePair6.Key.Split(new char[1] { '.' })[0]);
					}
					Strings.Add(Hash(keyValuePair6.Key), DataValue.String(keyValuePair6.Value, RequiredParameters));
				}
			}
			if (data.vecs != null)
			{
				if (Vecs == null)
				{
					Vecs = new Dictionary<int, IVector3Value>();
				}
				string[] floats = data.vecs;
				foreach (string text7 in floats)
				{
					KeyValuePair<string, string> keyValuePair7 = Parse.Kvp(text7);
					if (keyValuePair7.Key == "")
					{
						throw new InvalidOperationException("Failed to parse vector " + text7 + ".");
					}
					if (keyValuePair7.Key.Contains("."))
					{
						hashSet.Add(keyValuePair7.Key.Split(new char[1] { '.' })[0]);
					}
					Vecs.Add(Hash(keyValuePair7.Key), DataValue.Vector3(keyValuePair7.Value, RequiredParameters));
				}
			}
			if (data.quats != null)
			{
				if (Quats == null)
				{
					Quats = new Dictionary<int, IQuaternionValue>();
				}
				string[] floats = data.quats;
				foreach (string text8 in floats)
				{
					KeyValuePair<string, string> keyValuePair8 = Parse.Kvp(text8);
					if (keyValuePair8.Key == "")
					{
						throw new InvalidOperationException("Failed to parse quaternion " + text8 + ".");
					}
					if (keyValuePair8.Key.Contains("."))
					{
						hashSet.Add(keyValuePair8.Key.Split(new char[1] { '.' })[0]);
					}
					Quats.Add(Hash(keyValuePair8.Key), DataValue.Quaternion(keyValuePair8.Value, RequiredParameters));
				}
			}
			if (data.bytes != null)
			{
				if (ByteArrays == null)
				{
					ByteArrays = new Dictionary<int, byte[]>();
				}
				string[] floats = data.bytes;
				foreach (string text9 in floats)
				{
					KeyValuePair<string, string> keyValuePair9 = Parse.Kvp(text9);
					if (keyValuePair9.Key == "")
					{
						throw new InvalidOperationException("Failed to parse byte array " + text9 + ".");
					}
					if (keyValuePair9.Key.Contains("."))
					{
						hashSet.Add(keyValuePair9.Key.Split(new char[1] { '.' })[0]);
					}
					ByteArrays.Add(Hash(keyValuePair9.Key), Convert.FromBase64String(keyValuePair9.Value));
				}
			}
			if (data.items != null)
			{
				Items = data.items.Select([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (ItemData item) => new ItemValue(item, RequiredParameters)).ToList();
			}
			if (!string.IsNullOrWhiteSpace(data.containerSize))
			{
				ContainerSize = Parse.Vector2Int(data.containerSize);
			}
			if (!string.IsNullOrWhiteSpace(data.itemAmount))
			{
				ItemAmount = DataValue.Int(data.itemAmount, RequiredParameters);
			}
			if (hashSet.Count > 0)
			{
				if (Ints == null)
				{
					Ints = new Dictionary<int, IIntValue>();
				}
				Ints[StringExtensionMethods.GetStableHashCode("HasFields")] = DataValue.Simple(1);
				foreach (string item in hashSet)
				{
					Ints[StringExtensionMethods.GetStableHashCode("HasFields" + item)] = DataValue.Simple(1);
				}
			}
			if (string.IsNullOrWhiteSpace(data.connection))
			{
				return;
			}
			string[] array = Parse.SplitWithEmpty(data.connection);
			if (array.Length > 1)
			{
				List<string> list = array.Take(array.Length - 1).ToList();
				string text10 = array[^1];
				ConnectionType = ToByteEnum<ConnectionType>(list);
				ConnectionHash = Parse.Int(text10);
				if (ConnectionHash == 0)
				{
					ConnectionHash = StringExtensionMethods.GetStableHashCode(text10);
				}
			}
		}

		public void Load(ZPackage pkg)
		{
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			pkg.SetPos(0);
			int num = pkg.ReadInt();
			if (((uint)num & (true ? 1u : 0u)) != 0)
			{
				if (Floats == null)
				{
					Floats = new Dictionary<int, IFloatValue>();
				}
				byte b = pkg.ReadByte();
				for (int i = 0; i < b; i++)
				{
					Floats[pkg.ReadInt()] = DataValue.Float(pkg);
				}
			}
			if (((uint)num & 2u) != 0)
			{
				if (Vecs == null)
				{
					Vecs = new Dictionary<int, IVector3Value>();
				}
				byte b2 = pkg.ReadByte();
				for (int j = 0; j < b2; j++)
				{
					Vecs[pkg.ReadInt()] = DataValue.Vector3(pkg);
				}
			}
			if (((uint)num & 4u) != 0)
			{
				if (Quats == null)
				{
					Quats = new Dictionary<int, IQuaternionValue>();
				}
				byte b3 = pkg.ReadByte();
				for (int k = 0; k < b3; k++)
				{
					Quats[pkg.ReadInt()] = DataValue.Quaternion(pkg);
				}
			}
			if (((uint)num & 8u) != 0)
			{
				if (Ints == null)
				{
					Ints = new Dictionary<int, IIntValue>();
				}
				byte b4 = pkg.ReadByte();
				for (int l = 0; l < b4; l++)
				{
					Ints[pkg.ReadInt()] = DataValue.Int(pkg);
				}
			}
			if (((uint)num & 0x40u) != 0)
			{
				if (Longs == null)
				{
					Longs = new Dictionary<int, ILongValue>();
				}
				byte b5 = pkg.ReadByte();
				for (int m = 0; m < b5; m++)
				{
					Longs[pkg.ReadInt()] = DataValue.Long(pkg);
				}
			}
			if (((uint)num & 0x10u) != 0)
			{
				if (Strings == null)
				{
					Strings = new Dictionary<int, IStringValue>();
				}
				byte b6 = pkg.ReadByte();
				for (int n = 0; n < b6; n++)
				{
					Strings[pkg.ReadInt()] = DataValue.String(pkg);
				}
			}
			if (((uint)num & 0x80u) != 0)
			{
				if (ByteArrays == null)
				{
					ByteArrays = new Dictionary<int, byte[]>();
				}
				byte b7 = pkg.ReadByte();
				for (int num2 = 0; num2 < b7; num2++)
				{
					ByteArrays[pkg.ReadInt()] = pkg.ReadByteArray();
				}
			}
			if (((uint)num & 0x100u) != 0)
			{
				ConnectionType = (ConnectionType)pkg.ReadByte();
				ConnectionHash = pkg.ReadInt();
			}
		}

		public bool Match(Dictionary<string, string> pars, ZDO zdo)
		{
			AddParameters(pars, zdo);
			if (Strings != null && Strings.Any([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, IStringValue> pair) => pair.Value.Match(pars, zdo.GetString(pair.Key, "")) == false))
			{
				return false;
			}
			if (Floats != null && Floats.Any([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, IFloatValue> pair) => pair.Value.Match(pars, zdo.GetFloat(pair.Key, 0f)) == false))
			{
				return false;
			}
			if (Ints != null && Ints.Any([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, IIntValue> pair) => pair.Value.Match(pars, zdo.GetInt(pair.Key, 0)) == false))
			{
				return false;
			}
			if (Longs != null && Longs.Any([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, ILongValue> pair) => pair.Value.Match(pars, zdo.GetLong(pair.Key, 0L)) == false))
			{
				return false;
			}
			if (Bools != null && Bools.Any([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, IBoolValue> pair) => pair.Value.Match(pars, zdo.GetBool(pair.Key, false)) == false))
			{
				return false;
			}
			if (Hashes != null && Hashes.Any([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, IHashValue> pair) => pair.Value.Match(pars, zdo.GetInt(pair.Key, 0)) == false))
			{
				return false;
			}
			if (Vecs != null && Vecs.Any([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, IVector3Value> pair) => pair.Value.Match(pars, zdo.GetVec3(pair.Key, Vector3.zero)) == false))
			{
				return false;
			}
			if (Quats != null && Quats.Any([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, IQuaternionValue> pair) => pair.Value.Match(pars, zdo.GetQuaternion(pair.Key, Quaternion.identity)) == false))
			{
				return false;
			}
			if (ByteArrays != null && ByteArrays.Any([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, byte[]> pair) => !pair.Value.SequenceEqual(zdo.GetByteArray(pair.Key, (byte[])null))))
			{
				return false;
			}
			return true;
		}

		public bool Unmatch(Dictionary<string, string> pars, ZDO zdo)
		{
			AddParameters(pars, zdo);
			if (Strings != null && Strings.Any([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, IStringValue> pair) => pair.Value.Match(pars, zdo.GetString(pair.Key, "")) == true))
			{
				return false;
			}
			if (Floats != null && Floats.Any([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, IFloatValue> pair) => pair.Value.Match(pars, zdo.GetFloat(pair.Key, 0f)) == true))
			{
				return false;
			}
			if (Ints != null && Ints.Any([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, IIntValue> pair) => pair.Value.Match(pars, zdo.GetInt(pair.Key, 0)) == true))
			{
				return false;
			}
			if (Longs != null && Longs.Any([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, ILongValue> pair) => pair.Value.Match(pars, zdo.GetLong(pair.Key, 0L)) == true))
			{
				return false;
			}
			if (Bools != null && Bools.Any([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, IBoolValue> pair) => pair.Value.Match(pars, zdo.GetBool(pair.Key, false)) == true))
			{
				return false;
			}
			if (Hashes != null && Hashes.Any([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, IHashValue> pair) => pair.Value.Match(pars, zdo.GetInt(pair.Key, 0)) == true))
			{
				return false;
			}
			if (Vecs != null && Vecs.Any([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, IVector3Value> pair) => pair.Value.Match(pars, zdo.GetVec3(pair.Key, Vector3.zero)) == true))
			{
				return false;
			}
			if (Quats != null && Quats.Any([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, IQuaternionValue> pair) => pair.Value.Match(pars, zdo.GetQuaternion(pair.Key, Quaternion.identity)) == true))
			{
				return false;
			}
			if (ByteArrays != null && ByteArrays.Any([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, byte[]> pair) => pair.Value.SequenceEqual(zdo.GetByteArray(pair.Key, (byte[])null))))
			{
				return false;
			}
			return true;
		}

		private void AddParameters(Dictionary<string, string> pars, [<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(2)] ZDO zdo)
		{
			string[] array = pars.Values.ToArray();
			foreach (string value in array)
			{
				AddNestedParameters(value, pars, zdo);
			}
			foreach (string requiredParameter in RequiredParameters)
			{
				string key = "<" + requiredParameter + ">";
				if (!pars.ContainsKey(key))
				{
					AddParameter(requiredParameter, pars, zdo);
				}
			}
		}

		private void AddNestedParameters(string value, Dictionary<string, string> pars, [<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(2)] ZDO zdo)
		{
			if (!value.Contains("<"))
			{
				return;
			}
			string[] array = value.Split('<', '>');
			for (int i = 1; i < array.Length; i += 2)
			{
				string key = "<" + array[i] + ">";
				if (!pars.ContainsKey(key))
				{
					AddParameter(array[i], pars, zdo);
				}
			}
		}

		private void AddParameter(string par, Dictionary<string, string> pars, [<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(2)] ZDO zdo)
		{
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			string text = "<" + par + ">";
			if (DataLoading.TryGetValueFromGroup(par, out var value))
			{
				pars[text] = value;
				AddNestedParameters(value, pars, zdo);
			}
			else if (par.Contains("_"))
			{
				if (zdo == null)
				{
					return;
				}
				KeyValuePair<string, string> keyValuePair = Parse.Kvp(par, '_');
				if (!(keyValuePair.Value == ""))
				{
					string key = keyValuePair.Key;
					string value2 = keyValuePair.Value;
					if (key == "key")
					{
						pars[text] = DataHelper.GetGlobalKey(value2);
					}
					switch (key)
					{
					case "string":
						pars[text] = zdo.GetString(value2, "");
						break;
					case "float":
						pars[text] = zdo.GetFloat(value2, 0f).ToString(CultureInfo.InvariantCulture);
						break;
					case "int":
						pars[text] = zdo.GetInt(value2, 0).ToString(CultureInfo.InvariantCulture);
						break;
					case "long":
						pars[text] = zdo.GetLong(value2, 0L).ToString(CultureInfo.InvariantCulture);
						break;
					case "bool":
						pars[text] = zdo.GetBool(value2, false).ToString();
						break;
					case "hash":
						pars[text] = zdo.GetInt(value2, 0).ToString(CultureInfo.InvariantCulture);
						break;
					case "vec":
						pars[text] = PrintVectorXZY(zdo.GetVec3(value2, Vector3.zero));
						break;
					case "quat":
						pars[text] = PrintAngleYXZ(zdo.GetQuaternion(value2, Quaternion.identity));
						break;
					case "byte":
						pars[text] = Convert.ToBase64String(zdo.GetByteArray(value2, (byte[])null));
						break;
					}
				}
			}
			else if (text == "<time>")
			{
				pars[text] = ZNet.instance.GetTime().Ticks.ToString();
			}
			else if (text == "<x>" && zdo != null)
			{
				pars[text] = zdo.m_position.x.ToString(CultureInfo.InvariantCulture);
			}
			else if (text == "<y>" && zdo != null)
			{
				pars[text] = zdo.m_position.y.ToString(CultureInfo.InvariantCulture);
			}
			else if (text == "<z>" && zdo != null)
			{
				pars[text] = zdo.m_position.z.ToString(CultureInfo.InvariantCulture);
			}
			else if (text == "<rot>" && zdo != null)
			{
				pars[text] = PrintAngleYXZ(zdo.GetRotation());
			}
		}

		public static string PrintVectorXZY(Vector3 vector)
		{
			return vector.x.ToString("0.##", CultureInfo.InvariantCulture) + ", " + vector.z.ToString("0.##", CultureInfo.InvariantCulture) + ", " + vector.y.ToString("0.##", CultureInfo.InvariantCulture);
		}

		public static string PrintAngleYXZ(Quaternion quaternion)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return PrintVectorYXZ(((Quaternion)(ref quaternion)).eulerAngles);
		}

		private static string PrintVectorYXZ(Vector3 vector)
		{
			return vector.y.ToString("0.##", CultureInfo.InvariantCulture) + ", " + vector.x.ToString("0.##", CultureInfo.InvariantCulture) + ", " + vector.z.ToString("0.##", CultureInfo.InvariantCulture);
		}

		[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)]
		private static T ToByteEnum<T>([<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(1)] List<string> list) where T : struct, [<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(1)] Enum
		{
			byte b = 0;
			foreach (string item in list)
			{
				string text = item.Trim();
				if (Enum.TryParse<T>(text, ignoreCase: true, out var result))
				{
					b += (byte)(object)result;
				}
				else
				{
					Log.Warning("Failed to parse value " + text + " as T.");
				}
			}
			return (T)(object)b;
		}

		public Dictionary<string, string> InsertParameters(Dictionary<string, string> pars, ZDO zdo)
		{
			AddParameters(pars, zdo);
			return pars;
		}

		public void Write(Dictionary<string, string> pars, ZDO zdo)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0363: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0423: Unknown result type (might be due to invalid IL or missing references)
			//IL_0490: Unknown result type (might be due to invalid IL or missing references)
			RollItems(pars);
			ZDOID uid = zdo.m_uid;
			Dictionary<int, IFloatValue> floats = Floats;
			if (floats != null && floats.Count > 0)
			{
				ZDOHelper.Init<float>(ZDOExtraData.s_floats, uid);
				foreach (KeyValuePair<int, IFloatValue> @float in Floats)
				{
					float? num = @float.Value.Get(pars);
					if (num.HasValue)
					{
						ZDOExtraData.s_floats[uid].SetValue(@float.Key, num.Value);
					}
				}
			}
			Dictionary<int, IVector3Value> vecs = Vecs;
			if (vecs != null && vecs.Count > 0)
			{
				ZDOHelper.Init<Vector3>(ZDOExtraData.s_vec3, uid);
				foreach (KeyValuePair<int, IVector3Value> vec in Vecs)
				{
					Vector3? val = vec.Value.Get(pars);
					if (val.HasValue)
					{
						ZDOExtraData.s_vec3[uid].SetValue(vec.Key, val.Value);
					}
				}
			}
			Dictionary<int, IQuaternionValue> quats = Quats;
			if (quats != null && quats.Count > 0)
			{
				ZDOHelper.Init<Quaternion>(ZDOExtraData.s_quats, uid);
				foreach (KeyValuePair<int, IQuaternionValue> quat in Quats)
				{
					Quaternion? val2 = quat.Value.Get(pars);
					if (val2.HasValue)
					{
						ZDOExtraData.s_quats[uid].SetValue(quat.Key, val2.Value);
					}
				}
			}
			Dictionary<int, IIntValue> ints = Ints;
			if (ints != null && ints.Count > 0)
			{
				ZDOHelper.Init<int>(ZDOExtraData.s_ints, uid);
				foreach (KeyValuePair<int, IIntValue> int2 in Ints)
				{
					int? num2 = int2.Value.Get(pars);
					if (num2.HasValue)
					{
						ZDOExtraData.s_ints[uid].SetValue(int2.Key, num2.Value);
					}
				}
			}
			Dictionary<int, IHashValue> hashes = Hashes;
			if (hashes != null && hashes.Count > 0)
			{
				ZDOHelper.Init<int>(ZDOExtraData.s_ints, uid);
				foreach (KeyValuePair<int, IHashValue> hash in Hashes)
				{
					int? num3 = hash.Value.Get(pars);
					if (num3.HasValue)
					{
						ZDOExtraData.s_ints[uid].SetValue(hash.Key, num3.Value);
					}
				}
			}
			Dictionary<int, IBoolValue> bools = Bools;
			if (bools != null && bools.Count > 0)
			{
				ZDOHelper.Init<int>(ZDOExtraData.s_ints, uid);
				foreach (KeyValuePair<int, IBoolValue> @bool in Bools)
				{
					int? @int = @bool.Value.GetInt(pars);
					if (@int.HasValue)
					{
						ZDOExtraData.s_ints[uid].SetValue(@bool.Key, @int.Value);
					}
				}
			}
			Dictionary<int, ILongValue> longs = Longs;
			if (longs != null && longs.Count > 0)
			{
				ZDOHelper.Init<long>(ZDOExtraData.s_longs, uid);
				foreach (KeyValuePair<int, ILongValue> @long in Longs)
				{
					long? num4 = @long.Value.Get(pars);
					if (num4.HasValue)
					{
						ZDOExtraData.s_longs[uid].SetValue(@long.Key, num4.Value);
					}
				}
			}
			Dictionary<int, IStringValue> strings = Strings;
			if (strings != null && strings.Count > 0)
			{
				ZDOHelper.Init<string>(ZDOExtraData.s_strings, uid);
				foreach (KeyValuePair<int, IStringValue> @string in Strings)
				{
					string text = @string.Value.Get(pars);
					if (text != null)
					{
						ZDOExtraData.s_strings[uid].SetValue(@string.Key, text);
					}
				}
			}
			Dictionary<int, byte[]> byteArrays = ByteArrays;
			if (byteArrays != null && byteArrays.Count > 0)
			{
				ZDOHelper.Init<byte[]>(ZDOExtraData.s_byteArrays, uid);
				foreach (KeyValuePair<int, byte[]> byteArray in ByteArrays)
				{
					ZDOExtraData.s_byteArrays[uid].SetValue(byteArray.Key, byteArray.Value);
				}
			}
			HandleConnection(zdo);
			HandleHashConnection(zdo);
		}

		public string GetBase64(Dictionary<string, string> pars)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			ZPackage val = new ZPackage();
			Write(pars, val);
			return val.GetBase64();
		}

		public void Write(Dictionary<string, string> pars, ZPackage pkg)
		{
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_061f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0630: Unknown result type (might be due to invalid IL or missing references)
			//IL_063a: Expected I4, but got Unknown
			AddParameters(pars, null);
			RollItems(pars);
			int num = 0;
			if (Floats != null)
			{
				num |= 1;
			}
			if (Vecs != null)
			{
				num |= 2;
			}
			if (Quats != null)
			{
				num |= 4;
			}
			if (Ints != null || Hashes != null || Bools != null)
			{
				num |= 8;
			}
			if (Strings != null)
			{
				num |= 0x10;
			}
			if (Longs != null)
			{
				num |= 0x40;
			}
			if (ByteArrays != null)
			{
				num |= 0x80;
			}
			if ((int)ConnectionType != 0 && ConnectionHash != 0)
			{
				num |= 0x100;
			}
			pkg.Write(num);
			if (Floats != null)
			{
				KeyValuePair<int, float?>[] array = (from kvp in Floats
					select new KeyValuePair<int, float?>(kvp.Key, kvp.Value.Get(pars)) into kvp
					where kvp.Value.HasValue
					select kvp).ToArray();
				pkg.Write((byte)array.Count());
				KeyValuePair<int, float?>[] array2 = array;
				for (int i = 0; i < array2.Length; i++)
				{
					KeyValuePair<int, float?> keyValuePair = array2[i];
					pkg.Write(keyValuePair.Key);
					pkg.Write(keyValuePair.Value.Value);
				}
			}
			if (Vecs != null)
			{
				KeyValuePair<int, Vector3?>[] array3 = (from kvp in Vecs
					select new KeyValuePair<int, Vector3?>(kvp.Key, kvp.Value.Get(pars)) into kvp
					where kvp.Value.HasValue
					select kvp).ToArray();
				pkg.Write((byte)array3.Count());
				KeyValuePair<int, Vector3?>[] array4 = array3;
				for (int i = 0; i < array4.Length; i++)
				{
					KeyValuePair<int, Vector3?> keyValuePair2 = array4[i];
					pkg.Write(keyValuePair2.Key);
					pkg.Write(keyValuePair2.Value.Value);
				}
			}
			if (Quats != null)
			{
				KeyValuePair<int, Quaternion?>[] array5 = (from kvp in Quats
					select new KeyValuePair<int, Quaternion?>(kvp.Key, kvp.Value.Get(pars)) into kvp
					where kvp.Value.HasValue
					select kvp).ToArray();
				pkg.Write((byte)array5.Count());
				KeyValuePair<int, Quaternion?>[] array6 = array5;
				for (int i = 0; i < array6.Length; i++)
				{
					KeyValuePair<int, Quaternion?> keyValuePair3 = array6[i];
					pkg.Write(keyValuePair3.Key);
					pkg.Write(keyValuePair3.Value.Value);
				}
			}
			if (Ints != null || Hashes != null || Bools != null)
			{
				KeyValuePair<int, int?>[] obj = (from kvp in Ints?.Select([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, IIntValue> kvp) => new KeyValuePair<int, int?>(kvp.Key, kvp.Value.Get(pars)))
					where kvp.Value.HasValue
					select kvp).ToArray() ?? new KeyValuePair<int, int?>[0];
				KeyValuePair<int, int?>[] array7 = (from kvp in Hashes?.Select([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, IHashValue> kvp) => new KeyValuePair<int, int?>(kvp.Key, kvp.Value.Get(pars)))
					where kvp.Value.HasValue
					select kvp).ToArray() ?? new KeyValuePair<int, int?>[0];
				KeyValuePair<int, int?>[] array8 = (from kvp in Bools?.Select([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<int, IBoolValue> kvp) => new KeyValuePair<int, int?>(kvp.Key, kvp.Value.GetInt(pars)))
					where kvp.Value.HasValue
					select kvp).ToArray() ?? new KeyValuePair<int, int?>[0];
				int num2 = obj.Length + array7.Length + array8.Length;
				pkg.Write((byte)num2);
				KeyValuePair<int, int?>[] array9 = obj;
				for (int i = 0; i < array9.Length; i++)
				{
					KeyValuePair<int, int?> keyValuePair4 = array9[i];
					pkg.Write(keyValuePair4.Key);
					pkg.Write(keyValuePair4.Value.Value);
				}
				array9 = array7;
				for (int i = 0; i < array9.Length; i++)
				{
					KeyValuePair<int, int?> keyValuePair5 = array9[i];
					pkg.Write(keyValuePair5.Key);
					pkg.Write(keyValuePair5.Value.Value);
				}
				array9 = array8;
				for (int i = 0; i < array9.Length; i++)
				{
					KeyValuePair<int, int?> keyValuePair6 = array9[i];
					pkg.Write(keyValuePair6.Key);
					pkg.Write(keyValuePair6.Value.Value);
				}
			}
			if (Longs != null)
			{
				KeyValuePair<int, long?>[] array10 = (from kvp in Longs
					select new KeyValuePair<int, long?>(kvp.Key, kvp.Value.Get(pars)) into kvp
					where kvp.Value.HasValue
					select kvp).ToArray();
				pkg.Write((byte)array10.Count());
				KeyValuePair<int, long?>[] array11 = array10;
				for (int i = 0; i < array11.Length; i++)
				{
					KeyValuePair<int, long?> keyValuePair7 = array11[i];
					pkg.Write(keyValuePair7.Key);
					pkg.Write(keyValuePair7.Value.Value);
				}
			}
			if (Strings != null)
			{
				KeyValuePair<int, string>[] array12 = (from kvp in Strings
					select new KeyValuePair<int, string>(kvp.Key, kvp.Value.Get(pars)) into kvp
					where kvp.Value != null
					select kvp).ToArray();
				pkg.Write((byte)array12.Count());
				KeyValuePair<int, string>[] array13 = array12;
				for (int i = 0; i < array13.Length; i++)
				{
					KeyValuePair<int, string> keyValuePair8 = array13[i];
					pkg.Write(keyValuePair8.Key);
					pkg.Write(keyValuePair8.Value);
				}
			}
			if (ByteArrays != null)
			{
				pkg.Write((byte)ByteArrays.Count());
				foreach (KeyValuePair<int, byte[]> byteArray in ByteArrays)
				{
					pkg.Write(byteArray.Key);
					pkg.Write(byteArray.Value);
				}
			}
			if ((int)ConnectionType != 0 && ConnectionHash != 0)
			{
				pkg.Write((byte)(int)ConnectionType);
				pkg.Write(ConnectionHash);
			}
		}

		private void RollItems(Dictionary<string, string> pars)
		{
			List<ItemValue> items = Items;
			if (items != null && items.Count > 0)
			{
				string value = ItemValue.LoadItems(pars, Items, ContainerSize, (ItemAmount?.Get(pars)).GetValueOrDefault());
				if (Strings == null)
				{
					Strings = new Dictionary<int, IStringValue>();
				}
				Strings[ZDOVars.s_items] = DataValue.Simple(value);
			}
		}

		private void HandleConnection(ZDO ownZdo)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Invalid comparison between Unknown and I4
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			if (OriginalId == ZDOID.None)
			{
				return;
			}
			ZDOID uid = ownZdo.m_uid;
			if (TargetConnectionId != ZDOID.None)
			{
				ZDO zDO = ZDOMan.instance.GetZDO(TargetConnectionId);
				if (zDO != null)
				{
					ownZdo.SetConnection(ConnectionType, TargetConnectionId);
					if ((int)ConnectionType == 1)
					{
						zDO.SetConnection((ConnectionType)1, uid);
					}
				}
				return;
			}
			KeyValuePair<ZDOID, ZDOConnection> keyValuePair = ZDOExtraData.s_connections.FirstOrDefault([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<ZDOID, ZDOConnection> kvp) => kvp.Value.m_target == OriginalId);
			if (keyValuePair.Value != null)
			{
				ZDO zDO2 = ZDOMan.instance.GetZDO(keyValuePair.Key);
				if (zDO2 != null)
				{
					zDO2.SetConnection(keyValuePair.Value.m_type, uid);
				}
			}
		}

		private void HandleHashConnection(ZDO ownZdo)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Invalid comparison between Unknown and I4
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Invalid comparison between Unknown and I4
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Invalid comparison between Unknown and I4
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Invalid comparison between Unknown and I4
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			if (ConnectionHash == 0 || (int)ConnectionType == 0)
			{
				return;
			}
			ZDOID uid = ownZdo.m_uid;
			ZDOExtraData.SetConnectionData(uid, ConnectionType, ConnectionHash);
			? val = ConnectionType ^ 0x10;
			bool flag = (ConnectionType & 0x10) == 0;
			ZDOID val2 = ((IEnumerable<ZDOID>)ZDOExtraData.GetAllConnectionZDOIDs((ConnectionType)val)).FirstOrDefault((Func<ZDOID, bool>)((ZDOID z) => ZDOExtraData.GetConnectionHashData(z, ConnectionType)?.m_hash == ConnectionHash));
			if (val2 == ZDOID.None)
			{
				return;
			}
			ZDO zDO = ZDOMan.instance.GetZDO(val2);
			if (zDO != null)
			{
				if ((ConnectionType & 3) > 0)
				{
					ZDO val3 = (flag ? ownZdo : zDO);
					ZDOID val4 = (flag ? val2 : uid);
					val3.SetConnection((ConnectionType)3, val4);
				}
				if ((ConnectionType & 2) > 0)
				{
					ZDO val5 = (flag ? ownZdo : zDO);
					ZDOID val6 = (flag ? val2 : uid);
					val5.SetConnection((ConnectionType)2, val6);
				}
				if ((ConnectionType & 1) > 0)
				{
					zDO.SetConnection((ConnectionType)1, uid);
					ownZdo.SetConnection((ConnectionType)1, val2);
				}
			}
		}

		private static int Hash(string key)
		{
			if (key.StartsWith("$", StringComparison.InvariantCultureIgnoreCase))
			{
				int hash = ZSyncAnimation.GetHash(key.Substring(1));
				if (key == "$anim_speed")
				{
					return hash;
				}
				return 438569 + hash;
			}
			return StringExtensionMethods.GetStableHashCode(key);
		}
	}
	[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(1)]
	[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(0)]
	public class DataHelper
	{
		[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(2)]
		public static DataEntry Merge([<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 1, 2 })] params DataEntry[] datas)
		{
			DataEntry[] array = datas.Where([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (DataEntry d) => d != null).ToArray();
			if (array.Length == 0)
			{
				return null;
			}
			if (array.Length == 1)
			{
				return array[0];
			}
			DataEntry dataEntry = new DataEntry();
			DataEntry[] array2 = array;
			foreach (DataEntry data in array2)
			{
				dataEntry.Load(data);
			}
			return dataEntry;
		}

		public static bool Exists(int hash)
		{
			return DataLoading.Data.ContainsKey(hash);
		}

		public static bool Match(int hash, ZDO zdo)
		{
			if (DataLoading.Data.TryGetValue(hash, out var value))
			{
				return value.Match(new Dictionary<string, string>(), zdo);
			}
			return false;
		}

		public static bool Match(int hash, ZDO zdo, Dictionary<string, string> pars)
		{
			if (DataLoading.Data.TryGetValue(hash, out var value))
			{
				return value.Match(pars, zdo);
			}
			return false;
		}

		[return: <aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(2)]
		public static DataEntry Get(string name)
		{
			if (!(name == ""))
			{
				return DataLoading.Get(name);
			}
			return null;
		}

		public static void Init(GameObject obj, Vector3 pos, Quaternion rot, Vector3? scale, [<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(2)] DataEntry data, Dictionary<string, string> pars)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			ZNetView val = default(ZNetView);
			if ((data != null || scale.HasValue) && obj.TryGetComponent<ZNetView>(ref val))
			{
				int stableHashCode = StringExtensionMethods.GetStableHashCode(Utils.GetPrefabName(obj));
				ZNetView.m_initZDO = ZDOMan.instance.CreateNewZDO(pos, stableHashCode);
				if (data != null)
				{
					pars = data.InsertParameters(pars, ZNetView.m_initZDO);
					data.Write(pars, ZNetView.m_initZDO);
				}
				ZNetView.m_initZDO.m_rotation = ((Quaternion)(ref rot)).eulerAngles;
				ZNetView.m_initZDO.Type = val.m_type;
				ZNetView.m_initZDO.Distant = val.m_distant;
				ZNetView.m_initZDO.Persistent = val.m_persistent;
				ZNetView.m_initZDO.m_prefab = stableHashCode;
				if (val.m_syncInitialScale && scale.HasValue)
				{
					ZNetView.m_initZDO.Set(ZDOVars.s_scaleHash, scale.Value);
				}
				ZNetView.m_initZDO.DataRevision = 0u;
				ZNetView.m_initZDO.IncreaseDataRevision();
			}
		}

		[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(2)]
		public static ZDO Init([<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(1)] GameObject obj, Vector3 pos, Quaternion rot, Vector3? scale, DataEntry data)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			if (data == null && !scale.HasValue)
			{
				return null;
			}
			ZNetView val = default(ZNetView);
			if (!obj.TryGetComponent<ZNetView>(ref val))
			{
				return null;
			}
			int stableHashCode = StringExtensionMethods.GetStableHashCode(Utils.GetPrefabName(obj));
			ZNetView.m_initZDO = ZDOMan.instance.CreateNewZDO(pos, stableHashCode);
			if (data != null)
			{
				Dictionary<string, string> pars = data.InsertParameters(new Dictionary<string, string>(), ZNetView.m_initZDO);
				data.Write(pars, ZNetView.m_initZDO);
			}
			ZNetView.m_initZDO.m_rotation = ((Quaternion)(ref rot)).eulerAngles;
			ZNetView.m_initZDO.Type = val.m_type;
			ZNetView.m_initZDO.Distant = val.m_distant;
			ZNetView.m_initZDO.Persistent = val.m_persistent;
			ZNetView.m_initZDO.m_prefab = stableHashCode;
			if (val.m_syncInitialScale && scale.HasValue)
			{
				ZNetView.m_initZDO.Set(ZDOVars.s_scaleHash, scale.Value);
			}
			ZNetView.m_initZDO.DataRevision = 0u;
			ZNetView.m_initZDO.IncreaseDataRevision();
			return ZNetView.m_initZDO;
		}

		public static void CleanUp()
		{
			ZNetView.m_initZDO = null;
		}

		[return: <aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(new byte[] { 2, 1 })]
		public static List<string> GetValuesFromGroup(string group)
		{
			int stableHashCode = StringExtensionMethods.GetStableHashCode(group.ToLowerInvariant());
			if (DataLoading.ValueGroups.TryGetValue(stableHashCode, out var value))
			{
				return value;
			}
			return null;
		}

		public static List<string> ResolvePrefabs(string values)
		{
			HashSet<string> hashSet = new HashSet<string>();
			ResolvePrefabsSub(hashSet, values);
			List<string> list = new List<string>();
			foreach (string item in hashSet)
			{
				list.Add(item);
			}
			return list;
		}

		private static void ResolvePrefabsSub(HashSet<string> prefabs, string value)
		{
			if (value == "all" || ZNetScene.instance.m_namedPrefabs.ContainsKey(StringExtensionMethods.GetStableHashCode(value)))
			{
				prefabs.Add(value);
				return;
			}
			List<string> valuesFromGroup = GetValuesFromGroup(value);
			if (valuesFromGroup != null)
			{
				foreach (string item in valuesFromGroup)
				{
					ResolvePrefabsSub(prefabs, item);
				}
				return;
			}
			Log.Warning("Failed to resolve prefab: " + value);
		}

		public static string GetGlobalKey(string key)
		{
			string lower = key.ToLowerInvariant();
			return ZoneSystem.instance.m_globalKeysValues.FirstOrDefault([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<string, string> kvp) => kvp.Key.ToLowerInvariant() == lower).Value ?? "";
		}
	}
	[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(1)]
	[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(0)]
	public class DataLoading
	{
		private static readonly string GamePath = Path.GetFullPath(Path.Combine("BepInEx", "config", "data"));

		private static readonly string ProfilePath = Path.GetFullPath(Path.Combine(Paths.ConfigPath, "data"));

		public static Dictionary<int, DataEntry> Data = new Dictionary<int, DataEntry>();

		public static readonly Dictionary<int, List<string>> ValueGroups = new Dictionary<int, List<string>>();

		private static readonly Dictionary<int, List<string>> DefaultValueGroups = new Dictionary<int, List<string>>();

		private static readonly int WearNTearHash = StringExtensionMethods.GetStableHashCode("wearntear");

		private static readonly int HumanoidHash = StringExtensionMethods.GetStableHashCode("humanoid");

		private static readonly int CreatureHash = StringExtensionMethods.GetStableHashCode("creature");

		private static readonly int StructureHash = StringExtensionMethods.GetStableHashCode("structure");

		public static string Pattern = "expand_data*.yaml";

		public static DataEntry Get(string name)
		{
			int stableHashCode = StringExtensionMethods.GetStableHashCode(name);
			if (!Data.ContainsKey(stableHashCode))
			{
				try
				{
					Data[stableHashCode] = new DataEntry(name);
				}
				catch (Exception innerException)
				{
					if (name.Contains("=") || name.Length > 32)
					{
						throw new InvalidOperationException("Can't load data value: " + name, innerException);
					}
					throw new InvalidOperationException("Can't find data entry: " + name, innerException);
				}
			}
			return Data[stableHashCode];
		}

		[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(2)]
		public static DataEntry Get(int hash)
		{
			if (!Data.ContainsKey(hash))
			{
				return null;
			}
			return Data[hash];
		}

		public static bool TryGetValueFromGroup(string group, out string value)
		{
			int stableHashCode = StringExtensionMethods.GetStableHashCode(group.ToLowerInvariant());
			if (!ValueGroups.ContainsKey(stableHashCode))
			{
				value = group;
				return false;
			}
			int index = Random.Range(0, ValueGroups[stableHashCode].Count);
			value = ValueGroups[stableHashCode][index];
			return true;
		}

		public static void LoadEntries()
		{
			Dictionary<int, DataEntry> data = Data;
			Data = new Dictionary<int, DataEntry>();
			ValueGroups.Clear();
			string[] array = Directory.GetFiles(GamePath, "*.yaml").Concat(Directory.GetFiles(ProfilePath, "*.yaml")).Concat(Directory.GetFiles(Yaml.BaseDirectory, Pattern))
				.Select(Path.GetFullPath)
				.Distinct()
				.ToArray();
			for (int i = 0; i < array.Length; i++)
			{
				LoadEntry(array[i], data);
			}
			Log.Info($"Loaded {Data.Count} data entries.");
			if (ValueGroups.Count > 0)
			{
				Log.Info($"Loaded {ValueGroups.Count} value groups.");
			}
			LoadDefaultValueGroups();
		}

		private static void LoadEntry(string file, Dictionary<int, DataEntry> oldData)
		{
			foreach (DataData item2 in Yaml.LoadList<DataData>(file))
			{
				if (item2.value != null)
				{
					KeyValuePair<string, string> keyValuePair = Parse.Kvp(item2.value);
					int stableHashCode = StringExtensionMethods.GetStableHashCode(keyValuePair.Key.ToLowerInvariant());
					if (ValueGroups.ContainsKey(stableHashCode))
					{
						Log.Warning("Duplicate value group entry: " + keyValuePair.Key + " at " + file);
					}
					if (!ValueGroups.ContainsKey(stableHashCode))
					{
						ValueGroups[stableHashCode] = new List<string>();
					}
					ValueGroups[stableHashCode].Add(keyValuePair.Value);
				}
				if (item2.valueGroup != null && item2.values != null)
				{
					int stableHashCode2 = StringExtensionMethods.GetStableHashCode(item2.valueGroup.ToLowerInvariant());
					if (ValueGroups.ContainsKey(stableHashCode2))
					{
						Log.Warning("Duplicate value group entry: " + item2.valueGroup + " at " + file);
					}
					if (!ValueGroups.ContainsKey(stableHashCode2))
					{
						ValueGroups[stableHashCode2] = new List<string>();
					}
					string[] values = item2.values;
					foreach (string item in values)
					{
						ValueGroups[stableHashCode2].Add(item);
					}
				}
				if (item2.name != null)
				{
					int stableHashCode3 = StringExtensionMethods.GetStableHashCode(item2.name);
					if (Data.ContainsKey(stableHashCode3))
					{
						Log.Warning("Duplicate data entry: " + item2.name + " at " + file);
					}
					Data[stableHashCode3] = (oldData.TryGetValue(stableHashCode3, out var value) ? value.Reset(item2) : new DataEntry(item2));
				}
			}
		}

		private static void LoadDefaultValueGroups()
		{
			if (DefaultValueGroups.Count == 0)
			{
				foreach (GameObject value in ZNetScene.instance.m_namedPrefabs.Values)
				{
					value.GetComponentsInChildren<MonoBehaviour>(ZNetView.m_tempComponents);
					foreach (MonoBehaviour tempComponent in ZNetView.m_tempComponents)
					{
						int stableHashCode = StringExtensionMethods.GetStableHashCode(((object)tempComponent).GetType().Name.ToLowerInvariant());
						if (!DefaultValueGroups.ContainsKey(stableHashCode))
						{
							DefaultValueGroups[stableHashCode] = new List<string>();
						}
						DefaultValueGroups[stableHashCode].Add(((Object)value).name);
					}
				}
				DefaultValueGroups[CreatureHash] = DefaultValueGroups[HumanoidHash];
				DefaultValueGroups[StructureHash] = DefaultValueGroups[WearNTearHash];
			}
			foreach (KeyValuePair<int, List<string>> defaultValueGroup in DefaultValueGroups)
			{
				if (!ValueGroups.ContainsKey(defaultValueGroup.Key))
				{
					ValueGroups[defaultValueGroup.Key] = defaultValueGroup.Value;
				}
			}
		}

		public static void SetupWatcher()
		{
			if (!Directory.Exists(GamePath))
			{
				Directory.CreateDirectory(GamePath);
			}
			if (!Directory.Exists(ProfilePath))
			{
				Directory.CreateDirectory(ProfilePath);
			}
			if (!Directory.Exists(Yaml.BaseDirectory))
			{
				Directory.CreateDirectory(Yaml.BaseDirectory);
			}
			Yaml.SetupWatcher(GamePath, "*", LoadEntries);
			if (GamePath != ProfilePath)
			{
				Yaml.SetupWatcher(ProfilePath, "*", LoadEntries);
			}
			Yaml.SetupWatcher(Pattern, LoadEntries);
		}
	}
	[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(1)]
	[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(0)]
	public class DataValue
	{
		public static IIntValue Simple(int value)
		{
			return new SimpleIntValue(value);
		}

		public static IStringValue Simple(string value)
		{
			return new SimpleStringValue(value);
		}

		public static IFloatValue Simple(float value)
		{
			return new SimpleFloatValue(value);
		}

		public static ILongValue Simple(long value)
		{
			return new SimpleLongValue(value);
		}

		public static IVector3Value Simple(Vector3 value)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return new SimpleVector3Value(value);
		}

		public static IQuaternionValue Simple(Quaternion value)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return new SimpleQuaternionValue(value);
		}

		public static IIntValue Int(ZPackage pkg)
		{
			return new SimpleIntValue(pkg.ReadInt());
		}

		public static IIntValue Int(string values, HashSet<string> requiredParameters)
		{
			bool num = CheckParameters(values, requiredParameters);
			string[] array = Parse.SplitWithEmpty(values);
			if (!num && array.Length == 1 && int.TryParse(array[0], out var result))
			{
				return new SimpleIntValue(result);
			}
			return new IntValue(array);
		}

		public static IFloatValue Float(ZPackage pkg)
		{
			return new SimpleFloatValue(pkg.ReadSingle());
		}

		public static IFloatValue Float(string values, HashSet<string> requiredParameters)
		{
			bool num = CheckParameters(values, requiredParameters);
			string[] array = Parse.SplitWithEmpty(values);
			if (!num && array.Length == 1 && Parse.TryFloat(array[0], out var result))
			{
				return new SimpleFloatValue(result);
			}
			return new FloatValue(array);
		}

		public static ILongValue Long(ZPackage pkg)
		{
			return new SimpleLongValue(pkg.ReadLong());
		}

		public static ILongValue Long(string values, HashSet<string> requiredParameters)
		{
			bool num = CheckParameters(values, requiredParameters);
			string[] array = Parse.SplitWithEmpty(values);
			if (!num && array.Length == 1 && long.TryParse(array[0], out var result))
			{
				return new SimpleLongValue(result);
			}
			return new LongValue(array);
		}

		public static IStringValue String(ZPackage pkg)
		{
			return new SimpleStringValue(pkg.ReadString());
		}

		public static IStringValue String(string values, HashSet<string> requiredParameters)
		{
			bool num = CheckParameters(values, requiredParameters);
			string[] array = Parse.SplitWithEscape(values);
			if (!num && array.Length == 1)
			{
				return new SimpleStringValue(array[0]);
			}
			return new StringValue(array);
		}

		public static IBoolValue Bool(bool value)
		{
			return new SimpleBoolValue(value);
		}

		public static IBoolValue Bool(string values, HashSet<string> requiredParameters)
		{
			bool num = CheckParameters(values, requiredParameters);
			string[] array = Parse.SplitWithEmpty(values);
			if (!num && array.Length == 1 && bool.TryParse(array[0], out var result))
			{
				return new SimpleBoolValue(result);
			}
			return new BoolValue(array);
		}

		public static IHashValue Hash(string value)
		{
			return new SimpleHashValue(value);
		}

		public static IHashValue Hash(string values, HashSet<string> requiredParameters)
		{
			bool num = CheckParameters(values, requiredParameters);
			string[] array = Parse.SplitWithEmpty(values);
			if (!num && array.Length == 1)
			{
				return new SimpleHashValue(array[0]);
			}
			return new HashValue(array);
		}

		public static IVector3Value Vector3(ZPackage pkg)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return new SimpleVector3Value(pkg.ReadVector3());
		}

		public static IVector3Value Vector3(string values, HashSet<string> requiredParameters)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			bool num = CheckParameters(values, requiredParameters);
			string[] values2 = Parse.SplitWithEscape(values);
			Vector3? val = Parse.VectorXZYNull(values);
			if (!num && val.HasValue)
			{
				return new SimpleVector3Value(val.Value);
			}
			return new Vector3Value(values2);
		}

		public static IQuaternionValue Quaternion(ZPackage pkg)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return new SimpleQuaternionValue(pkg.ReadQuaternion());
		}

		public static IQuaternionValue Quaternion(string values, HashSet<string> requiredParameters)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			bool num = CheckParameters(values, requiredParameters);
			string[] values2 = Parse.SplitWithEscape(values);
			Quaternion? val = Parse.AngleYXZNull(values);
			if (!num && val.HasValue)
			{
				return new SimpleQuaternionValue(val.Value);
			}
			return new QuaternionValue(values2);
		}

		private static bool CheckParameters(string value, HashSet<string> requiredParameters)
		{
			if (!value.Contains("<") || !value.Contains(">"))
			{
				return false;
			}
			string[] array = value.Split('<', '>');
			for (int i = 1; i < array.Length; i += 2)
			{
				requiredParameters.Add(array[i]);
			}
			return array.Length > 1;
		}
	}
	[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(1)]
	[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(0)]
	public class AnyValue
	{
		protected readonly string[] Values;

		public AnyValue(string[] values)
		{
			Values = values;
			base..ctor();
		}

		[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(2)]
		private string RollValue()
		{
			if (Values.Length == 1)
			{
				return Values[0];
			}
			return Values[Random.Range(0, Values.Length)];
		}

		[return: <aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(2)]
		protected string GetValue(Dictionary<string, string> pars)
		{
			string text = RollValue();
			if (text == null || text == "<none>")
			{
				return null;
			}
			return ReplaceParameters(text, pars);
		}

		[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(2)]
		protected string GetValue()
		{
			string text = RollValue();
			if (text != null && !(text == "<none>"))
			{
				return text;
			}
			return null;
		}

		protected string[] GetAllValues(Dictionary<string, string> pars)
		{
			return (from v in Values
				select ReplaceParameters(v, pars) into v
				where v != null && v != "<none"
				select v).ToArray();
		}

		protected string ReplaceParameters(string value, Dictionary<string, string> pars)
		{
			foreach (KeyValuePair<string, string> par in pars)
			{
				value = value.Replace(par.Key, par.Value);
			}
			return value;
		}
	}
	[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(1)]
	[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(0)]
	public class ItemValue
	{
		public IStringValue Prefab = DataValue.String(data.prefab, requiredParameters);

		public float Chance = data.chance;

		public IIntValue Stack = DataValue.Int(data.stack, requiredParameters);

		public IFloatValue Durability = DataValue.Float(data.durability, requiredParameters);

		public string Position = data.pos;

		private Vector2i RolledPosition = Parse.Vector2Int(data.pos);

		public IBoolValue Equipped = DataValue.Bool(data.equipped, requiredParameters);

		public IIntValue Quality = DataValue.Int(data.quality, requiredParameters);

		public IIntValue Variant = DataValue.Int(data.variant, requiredParameters);

		public ILongValue CrafterID = DataValue.Long(data.crafterID, requiredParameters);

		public IStringValue CrafterName = DataValue.String(data.crafterName, requiredParameters);

		public Dictionary<string, IStringValue> CustomData = data.customData?.ToDictionary([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<string, string> kvp) => kvp.Key, [<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (KeyValuePair<string, string> kvp) => DataValue.String(kvp.Value, requiredParameters)) ?? new Dictionary<string, IStringValue>();

		public IIntValue WorldLevel = DataValue.Int(data.worldLevel, requiredParameters);

		public IBoolValue PickedUp = DataValue.Bool(data.pickedUp, requiredParameters);

		private string RolledPrefab = "";

		public ItemValue(ItemData data, HashSet<string> requiredParameters)
		{
		}//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)


		public static string LoadItems(Dictionary<string, string> pars, List<ItemValue> items, Vector2i? size, int amount)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_0026: 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)
			ZPackage val = new ZPackage();
			val.Write(106);
			items = Generate(pars, items, (Vector2i)(((??)size) ?? new Vector2i(0, 0)), amount);
			val.Write(items.Count);
			foreach (ItemValue item in items)
			{
				item.Write(pars, val);
			}
			return val.GetBase64();
		}

		public static List<ItemValue> Generate(Dictionary<string, string> pars, List<ItemValue> data, Vector2i size, int amount)
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			List<ItemValue> list = data.Where([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (ItemValue item) => item.Position != "").ToList();
			List<ItemValue> items = data.Where([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (ItemValue item) => item.Position == "").ToList();
			Dictionary<Vector2i, ItemValue> dictionary = new Dictionary<Vector2i, ItemValue>();
			foreach (ItemValue item in list)
			{
				if (item.Roll(pars))
				{
					dictionary[item.RolledPosition] = item;
				}
			}
			if (amount == 0)
			{
				GenerateEach(pars, dictionary, size, items);
			}
			else
			{
				GenerateAmount(pars, dictionary, size, items, amount);
			}
			List<ItemValue> list2 = new List<ItemValue>();
			foreach (ItemValue value in dictionary.Values)
			{
				list2.Add(value);
			}
			return list2;
		}

		private static void GenerateEach(Dictionary<string, string> pars, Dictionary<Vector2i, ItemValue> inventory, Vector2i size, List<ItemValue> items)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			foreach (ItemValue item in items)
			{
				if (item.Roll(pars))
				{
					Vector2i? val = FindNextFreeSlot(inventory, size);
					if (!val.HasValue)
					{
						break;
					}
					item.RolledPosition = val.Value;
					inventory[val.Value] = item;
				}
			}
		}

		private static void GenerateAmount(Dictionary<string, string> pars, Dictionary<Vector2i, ItemValue> inventory, Vector2i size, List<ItemValue> items, int amount)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			float num = items.Sum([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (ItemValue item) => item.Chance);
			for (int i = 0; i < amount; i++)
			{
				if (items.Count <= 0)
				{
					break;
				}
				Vector2i? val = FindNextFreeSlot(inventory, size);
				if (val.HasValue)
				{
					ItemValue itemValue = RollItem(items, num);
					itemValue.RolledPosition = val.Value;
					if (itemValue.RollPrefab(pars))
					{
						inventory[val.Value] = itemValue;
					}
					num -= itemValue.Chance;
					items.Remove(itemValue);
					continue;
				}
				break;
			}
		}

		private static ItemValue RollItem(List<ItemValue> items, float maxWeight)
		{
			float num = Random.Range(0f, maxWeight);
			foreach (ItemValue item in items)
			{
				if (num < item.Chance)
				{
					return item;
				}
				num -= item.Chance;
			}
			return items.Last();
		}

		private static Vector2i? FindNextFreeSlot(Dictionary<Vector2i, ItemValue> inventory, Vector2i size)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: 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_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			int num = ((size.x == 0) ? 4 : size.x);
			int num2 = ((size.y == 0) ? 2 : size.y);
			Vector2i val = default(Vector2i);
			for (int i = 0; i < num2; i++)
			{
				for (int j = 0; j < num; j++)
				{
					((Vector2i)(ref val))..ctor(j, i);
					if (!inventory.ContainsKey(val))
					{
						return val;
					}
				}
			}
			return null;
		}

		public bool RollPrefab(Dictionary<string, string> pars)
		{
			RolledPrefab = Prefab.Get(pars) ?? "";
			return RolledPrefab != "";
		}

		public bool RollChance()
		{
			if (!(Chance >= 1f))
			{
				return Random.value <= Chance;
			}
			return true;
		}

		public bool Roll(Dictionary<string, string> pars)
		{
			if (RollChance())
			{
				return RollPrefab(pars);
			}
			return false;
		}

		public void Write(Dictionary<string, string> pars, ZPackage pkg)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			pkg.Write(RolledPrefab);
			pkg.Write(Stack.Get(pars) ?? 1);
			pkg.Write(Durability.Get(pars) ?? 100f);
			pkg.Write(RolledPosition);
			pkg.Write(Equipped.GetBool(pars).GetValueOrDefault());
			pkg.Write(Quality.Get(pars) ?? 1);
			pkg.Write(Variant.Get(pars) ?? 1);
			pkg.Write(CrafterID.Get(pars).GetValueOrDefault());
			pkg.Write(CrafterName.Get(pars) ?? "");
			pkg.Write(CustomData?.Count ?? 0);
			foreach (KeyValuePair<string, IStringValue> item in CustomData ?? new Dictionary<string, IStringValue>())
			{
				pkg.Write(item.Key);
				pkg.Write(item.Value.Get(pars));
			}
			pkg.Write(WorldLevel.Get(pars) ?? 1);
			pkg.Write(PickedUp.GetBool(pars).GetValueOrDefault());
		}
	}
	[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(1)]
	[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(0)]
	public class BoolValue : AnyValue, IBoolValue
	{
		public BoolValue(string[] values)
			: base(values)
		{
		}

		public int? GetInt(Dictionary<string, string> pars)
		{
			string value = GetValue(pars);
			if (value == null)
			{
				return null;
			}
			return (value == "true") ? 1 : 0;
		}

		public bool? GetBool(Dictionary<string, string> pars)
		{
			string value = GetValue(pars);
			if (value == null)
			{
				return null;
			}
			return value == "true";
		}

		public bool? Match(Dictionary<string, string> pars, bool value)
		{
			bool flag = true;
			string[] values = Values;
			foreach (string value2 in values)
			{
				string text = ReplaceParameters(value2, pars);
				if (text != null)
				{
					flag = false;
					if (text == "true" == value)
					{
						return true;
					}
				}
			}
			if (!flag)
			{
				return false;
			}
			return null;
		}
	}
	[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(1)]
	[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(0)]
	public class SimpleBoolValue : IBoolValue
	{
		private readonly bool Value;

		public SimpleBoolValue(bool value)
		{
			Value = value;
			base..ctor();
		}

		public int? GetInt(Dictionary<string, string> pars)
		{
			return Value ? 1 : 0;
		}

		public bool? GetBool(Dictionary<string, string> pars)
		{
			return Value;
		}

		public bool? Match(Dictionary<string, string> pars, bool value)
		{
			return Value == value;
		}
	}
	[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(1)]
	public interface IBoolValue
	{
		int? GetInt(Dictionary<string, string> pars);

		bool? GetBool(Dictionary<string, string> pars);

		bool? Match(Dictionary<string, string> pars, bool value);
	}
	[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(1)]
	[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(0)]
	public class FloatValue : AnyValue, IFloatValue
	{
		public FloatValue(string[] values)
			: base(values)
		{
		}

		public float? Get(Dictionary<string, string> pars)
		{
			string value = GetValue(pars);
			if (value == null)
			{
				return null;
			}
			if (!value.Contains(";"))
			{
				return Calculator.EvaluateFloat(value);
			}
			string[] array = value.Split(new char[1] { ';' });
			if (array.Length < 2)
			{
				throw new InvalidOperationException("Invalid range format: " + value);
			}
			float? num = Calculator.EvaluateFloat(array[0]);
			float? num2 = Calculator.EvaluateFloat(array[1]);
			if (!num.HasValue || !num2.HasValue)
			{
				return null;
			}
			float? num3;
			if (array.Length < 3 || array[2] == "")
			{
				num3 = Random.Range(num.Value, num2.Value);
			}
			else
			{
				float? num4 = Calculator.EvaluateFloat(array[2]);
				if (!num4.HasValue)
				{
					num3 = Random.Range(num.Value, num2.Value);
				}
				else
				{
					int num5 = (int)((num2.Value - num.Value) / num4.Value);
					int num6 = Random.Range(0, num5 + 1);
					num3 = num + (float)num6 * num4;
				}
			}
			if (array.Length < 4)
			{
				return num3;
			}
			return Calculator.EvaluateFloat(array[3].Replace("<value>", num3?.ToString(CultureInfo.InvariantCulture)));
		}

		public bool? Match(Dictionary<string, string> pars, float value)
		{
			bool flag = true;
			string[] values = Values;
			foreach (string value2 in values)
			{
				string text = ReplaceParameters(value2, pars);
				if (!text.Contains(";"))
				{
					float? num = Calculator.EvaluateFloat(text);
					if (num.HasValue)
					{
						flag = false;
						if (Helper.Approx(num.Value, value))
						{
							return true;
						}
					}
					continue;
				}
				string[] array = text.Split(new char[1] { ';' });
				if (array.Length < 2)
				{
					throw new InvalidOperationException("Invalid range format: " + text);
				}
				float? num2 = Calculator.EvaluateFloat(array[0]);
				float? num3 = Calculator.EvaluateFloat(array[1]);
				if (!num2.HasValue || !num3.HasValue)
				{
					continue;
				}
				if (array.Length < 3)
				{
					flag = false;
					if (Helper.ApproxBetween(value, num2.Value, num3.Value))
					{
						return true;
					}
					continue;
				}
				if (array.Length < 4)
				{
					float? num4 = Calculator.EvaluateFloat(array[2]);
					if (!num4.HasValue)
					{
						continue;
					}
					flag = false;
					int num5 = (int)((num3.Value - num2.Value) / num4.Value);
					for (int j = 0; j <= num5; j++)
					{
						if (Helper.Approx(num2.Value + (float)j * num4.Value, value))
						{
							return true;
						}
					}
					continue;
				}
				if (array[2] == "")
				{
					float? num6 = Calculator.EvaluateFloat(array[3].Replace("<value>", num2?.ToString(CultureInfo.InvariantCulture)));
					float? num7 = Calculator.EvaluateFloat(array[3].Replace("<value>", num3?.ToString(CultureInfo.InvariantCulture)));
					if (num6.HasValue && num7.HasValue)
					{
						flag = false;
						if (Helper.ApproxBetween(value, num6.Value, num7.Value))
						{
							return true;
						}
					}
					continue;
				}
				float? num8 = Calculator.EvaluateFloat(array[2]);
				if (!num8.HasValue)
				{
					continue;
				}
				flag = false;
				int num9 = (int)((num3.Value - num2.Value) / num8.Value);
				for (int k = 0; k <= num9; k++)
				{
					float? num10 = num2;
					float num11 = k;
					float? num12 = num8;
					float? num13 = Calculator.EvaluateFloat(array[3].Replace("<value>", (num10 + num11 * num12)?.ToString(CultureInfo.InvariantCulture)));
					if (num13.HasValue && Helper.Approx(num13.Value, value))
					{
						return true;
					}
				}
			}
			if (!flag)
			{
				return false;
			}
			return null;
		}
	}
	public class SimpleFloatValue : IFloatValue
	{
		private readonly float Value;

		public SimpleFloatValue(float value)
		{
			Value = value;
			base..ctor();
		}

		[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(1)]
		public float? Get(Dictionary<string, string> pars)
		{
			return Value;
		}

		[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(1)]
		public bool? Match(Dictionary<string, string> pars, float value)
		{
			return Value == value;
		}
	}
	[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(1)]
	public interface IFloatValue
	{
		float? Get(Dictionary<string, string> pars);

		bool? Match(Dictionary<string, string> pars, float value);
	}
	[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(1)]
	[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(0)]
	public class HashValue : AnyValue, IHashValue
	{
		public HashValue(string[] values)
			: base(values)
		{
		}

		public int? Get(Dictionary<string, string> pars)
		{
			string value = GetValue(pars);
			if (value == null)
			{
				return null;
			}
			return StringExtensionMethods.GetStableHashCode(value);
		}

		public bool? Match(Dictionary<string, string> pars, int value)
		{
			string[] allValues = GetAllValues(pars);
			if (allValues.Length == 0)
			{
				return null;
			}
			return allValues.Any([<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(0)] (string v) => StringExtensionMethods.GetStableHashCode(v) == value);
		}
	}
	[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(1)]
	[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(0)]
	public class SimpleHashValue : IHashValue
	{
		private readonly int Value = StringExtensionMethods.GetStableHashCode(value);

		public SimpleHashValue(string value)
		{
		}

		public int? Get(Dictionary<string, string> pars)
		{
			return Value;
		}

		public bool? Match(Dictionary<string, string> pars, int value)
		{
			return Value == value;
		}
	}
	[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(1)]
	public interface IHashValue
	{
		int? Get(Dictionary<string, string> pars);

		bool? Match(Dictionary<string, string> pars, int value);
	}
	[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(1)]
	[<aa2a4400-5e40-435a-9a5d-aafbff1ba5a8>Nullable(0)]
	public class IntValue : AnyValue, IIntValue
	{
		public IntValue(string[] values)
			: base(values)
		{
		}

		public int? Get(Dictionary<string, string> pars)
		{
			string value = GetValue(pars);
			if (value == null)
			{
				return null;
			}
			if (!value.Contains(";"))
			{
				return Calculator.EvaluateInt(value);
			}
			string[] array = value.Split(new char[1] { ';' });
			if (array.Length < 2)
			{
				throw new InvalidOperationException("Invalid range format: " + value);
			}
			int? num = Calculator.EvaluateInt(array[0]);
			int? num2 = Calculator.EvaluateInt(array[1]);
			if (!num.HasValue || !num2.HasValue)
			{
				return null;
			}
			int? result;
			if (array.Length < 3 || array[2] == "")
			{
				result = Random.Range(num.Value, num2.Value + 1);
			}
			else
			{
				int? num3 = Calculator.EvaluateInt(array[2]);
				if (!num3.HasValue)
				{
					result = Random.Range(num.Value, num2.Value + 1);
				}
				else
				{
					int num4 = Random.Range(0, ((num2 - num) / num3).Value + 1);
					result = num + num4 * num3;
				}
			}
			if (array.Length < 4)
			{
				return result;
			}
			return Calculator.EvaluateInt(array[3].Replace("<value>", result.ToString()));
		}

		public bool? Match(Dictionary<string, string> pars, int value)
		{
			bool flag = true;
			string[] values = Values;
			foreach (string value2 in values)
			{
				string text = ReplaceParameters(value2, pars);
				if (!text.Contains(";"))
				{
					int? num = Calculator.EvaluateInt(text);
					if (num.HasValue)
					{
						flag = false;
						if (num.Value == value)
						{
							return true;
						}
					}
					continue;
				}
				string[] array = text.Split(new char[1] { ';' });
				if (array.Length < 2)
				{
					throw new InvalidOperationException("Invalid range format: " + text);
				}
				int? num2 = Calculator.EvaluateInt(array[0]);
				int? num3 = Calculator.EvaluateInt(array[1]);
				if (!num2.HasValue || !num3.HasValue)
				{
					continue;
				}
				if (array.Length < 3)
				{
					flag = false;
					if (value >= num2.Value && value <= num3.Value)
					{
						return true;
					}
					continue;
				}
				if (array.Length < 4)
				{
					int? num4 = Calculator.EvaluateInt(array[2]);
					if (!num4.HasValue)
					{
						continue;
					}
					flag = false;
					int num5 = (num3.Value - num2.Value) / num4.Value;
					for (int j = 0; j <= num5; j++)
					{
						if (num2.Value + j * num4.Value == value)
						{
							return true;
						}
					}
					continue;
				}
				if (array[2] == "")
				{
					int? num6 = Calculator.EvaluateInt(array[3].Replace("<value>", num2?.ToString(CultureInfo.InvariantCulture)));
					int? num7 = Calculator.EvaluateInt(array[3].Replace("<value>", num3?.ToString(CultureInfo.InvariantCulture)));
					if (num6.HasValue && num7.HasValue)
					{
						flag = false;
						if (value >= num6.Value && value <= num7.Value)
						{
							return true;
						}
					}
					continue;
				}
				int? num8 = Calculator.EvaluateInt(array[2]);
				if (!num8.HasValue)
				{
					continue;
				}
				flag = false;
				int num9 = (num3.Value - num2.Value) / num8.Value;
				for (int k = 0; k <= num9; k++)
				{
					int? num10 = num2;
					int num11 = k;
					int? num12 = num8;
					int? num13 = Calculator.EvaluateInt(array[3].Replace("<value>", (num10 + num11 * num12)?.ToString(CultureInfo.InvariantCulture)));
					if (num13.HasValue && num13.Value == value)
					{
						return true;
					}
				}
			}
			if (!flag)
			{
				return false;
			}
			return null;
		}
	}
	public class SimpleIntValue : IIntValue
	{
		private readonly int Value;

		public SimpleIntValue(int value)
		{
			Value = value;
			base..ctor();
		}

		[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(1)]
		public int? Get(Dictionary<string, string> pars)
		{
			return Value;
		}

		[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(1)]
		public bool? Match(Dictionary<string, string> pars, int value)
		{
			return Value == value;
		}
	}
	[<7349fc7e-ef47-4379-84e1-1270a4e3747a>NullableContext(1)]
	public interface IIntValue
	{
		int? Get(Dictionary<