Decompiled source of Expand World Data v1.31.0
ExpandWorldData.dll
Decompiled 3 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.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 ExpandWorldData; using ExpandWorldData.Dungeon; using HarmonyLib; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using ServerSync; using Service; using SoftReferenceableAssets; using TMPro; 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("ExpandWorldData")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ExpandWorldData")] [assembly: AssemblyTitle("ExpandWorldData")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [CompilerGenerated] internal delegate TResult <>f__AnonymousDelegate0<T1, T2, T3, T4, T5, TResult>(T1 arg1, T2 arg2, T3 arg3, out T4 arg4, T5 arg5 = default(T5)); namespace Microsoft.CodeAnalysis { [CompilerGenerated] [<f3df1be8-e3f7-4044-a988-5caa68422752>Embedded] internal sealed class <f3df1be8-e3f7-4044-a988-5caa68422752>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [<f3df1be8-e3f7-4044-a988-5caa68422752>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class <bb9efeec-8bdf-47fb-ae74-335ea0339a69>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <bb9efeec-8bdf-47fb-ae74-335ea0339a69>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <bb9efeec-8bdf-47fb-ae74-335ea0339a69>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [<f3df1be8-e3f7-4044-a988-5caa68422752>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class <af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContextAttribute : Attribute { public readonly byte Flag; public <af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [<f3df1be8-e3f7-4044-a988-5caa68422752>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 { [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(0)] public class Calculator { 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([<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>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([<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>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); } } } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(2)] [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(0)] public class DataData { [DefaultValue(null)] public string name; [DefaultValue(null)] public string connection; [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(new byte[] { 2, 1 })] [DefaultValue(null)] public string[] bools; [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(new byte[] { 2, 1 })] [DefaultValue(null)] public string[] ints; [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(new byte[] { 2, 1 })] [DefaultValue(null)] public string[] hashes; [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(new byte[] { 2, 1 })] [DefaultValue(null)] public string[] floats; [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(new byte[] { 2, 1 })] [DefaultValue(null)] public string[] strings; [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(new byte[] { 2, 1 })] [DefaultValue(null)] public string[] longs; [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(new byte[] { 2, 1 })] [DefaultValue(null)] public string[] vecs; [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(new byte[] { 2, 1 })] [DefaultValue(null)] public string[] quats; [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(new byte[] { 2, 1 })] [DefaultValue(null)] public string[] bytes; [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>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; [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(new byte[] { 2, 1 })] [DefaultValue(null)] public string[] values; } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>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"; [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(new byte[] { 2, 1, 1 })] [DefaultValue(null)] public Dictionary<string, string> customData; } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(0)] public class DataEntry { [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(new byte[] { 2, 1 })] public Dictionary<int, IStringValue> Strings; [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(new byte[] { 2, 1 })] public Dictionary<int, IFloatValue> Floats; [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(new byte[] { 2, 1 })] public Dictionary<int, IIntValue> Ints; [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(new byte[] { 2, 1 })] public Dictionary<int, IBoolValue> Bools; [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(new byte[] { 2, 1 })] public Dictionary<int, IHashValue> Hashes; [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(new byte[] { 2, 1 })] public Dictionary<int, ILongValue> Longs; [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(new byte[] { 2, 1 })] public Dictionary<int, IVector3Value> Vecs; [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(new byte[] { 2, 1 })] public Dictionary<int, IQuaternionValue> Quats; [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(new byte[] { 2, 1 })] public Dictionary<int, byte[]> ByteArrays; [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(new byte[] { 2, 1 })] public List<ItemValue> Items; public Vector2i? ContainerSize; [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>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([<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(0)] (KeyValuePair<int, float> kvp) => kvp.Key, [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>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([<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(0)] (KeyValuePair<int, int> kvp) => kvp.Key, [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>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([<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(0)] (KeyValuePair<int, long> kvp) => kvp.Key, [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>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([<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(0)] (KeyValuePair<int, string> kvp) => kvp.Key, [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>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([<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(0)] (KeyValuePair<int, Vector3> kvp) => kvp.Key, [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>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([<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(0)] (KeyValuePair<int, Quaternion> kvp) => kvp.Key, [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>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([<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(0)] (KeyValuePair<int, byte[]> kvp) => kvp.Key, [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>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([<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>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(); } } private void AddParameters(Dictionary<string, string> pars, [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>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, [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>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, [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(2)] ZDO zdo) { //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: 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; switch (key) { case "key": pars[text] = DataHelper.GetGlobalKey(value2); break; 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 == "<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()); } } private static string PrintVectorXZY(Vector3 vector) { return vector.x.ToString("0.##", CultureInfo.InvariantCulture) + ", " + vector.z.ToString("0.##", CultureInfo.InvariantCulture) + ", " + vector.y.ToString("0.##", CultureInfo.InvariantCulture); } private 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); } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(0)] private static T ToByteEnum<T>([<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(1)] List<string> list) where T : struct, [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>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 void Write(Dictionary<string, string> pars, ZDO zdo) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) AddParameters(pars, zdo); 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([<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>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([<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>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([<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>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([<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>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); } } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(0)] public class DataHelper { [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(2)] public static DataEntry Merge([<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(new byte[] { 1, 2 })] params DataEntry[] datas) { DataEntry[] array = datas.Where([<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>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); } [return: <bb9efeec-8bdf-47fb-ae74-335ea0339a69>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, [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(2)] DataEntry data, Dictionary<string, string> pars) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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); 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(); } } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(2)] public static ZDO Init([<bb9efeec-8bdf-47fb-ae74-335ea0339a69>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_0054: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) 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); data?.Write(new Dictionary<string, string>(), 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: <bb9efeec-8bdf-47fb-ae74-335ea0339a69>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([<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(0)] (KeyValuePair<string, string> kvp) => kvp.Key.ToLowerInvariant() == lower).Value ?? ""; } } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>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]; } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>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.Directory, 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); } } Log.Info($"Loaded {DefaultValueGroups.Count} default value groups."); if (DefaultValueGroups.ContainsKey(HumanoidHash)) { DefaultValueGroups[CreatureHash] = DefaultValueGroups[HumanoidHash]; } if (DefaultValueGroups.ContainsKey(WearNTearHash)) { 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); } Yaml.SetupWatcher(GamePath, "*", LoadEntries); if (GamePath != ProfilePath) { Yaml.SetupWatcher(ProfilePath, "*", LoadEntries); } Yaml.SetupWatcher(Pattern, LoadEntries); } } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>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; } } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(0)] public class AnyValue { protected readonly string[] Values; public AnyValue(string[] values) { Values = values; base..ctor(); } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(2)] private string RollValue() { if (Values.Length == 1) { return Values[0]; } return Values[Random.Range(0, Values.Length)]; } [return: <bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(2)] protected string GetValue(Dictionary<string, string> pars) { string text = RollValue(); if (text == null || text == "<none>") { return null; } return ReplaceParameters(text, pars); } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>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; } } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>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([<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(0)] (KeyValuePair<string, string> kvp) => kvp.Key, [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>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([<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(0)] (ItemValue item) => item.Position != "").ToList(); List<ItemValue> items = data.Where([<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>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([<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>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()); } } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>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 class SimpleBoolValue : IBoolValue { private readonly bool Value; public SimpleBoolValue(bool value) { Value = value; base..ctor(); } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public int? GetInt(Dictionary<string, string> pars) { return Value ? 1 : 0; } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public bool? GetBool(Dictionary<string, string> pars) { return Value; } } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public interface IBoolValue { int? GetInt(Dictionary<string, string> pars); bool? GetBool(Dictionary<string, string> pars); } public class FloatValue : AnyValue, IFloatValue { [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public FloatValue(string[] values) : base(values) { } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] 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 class SimpleFloatValue : IFloatValue { private readonly float Value; public SimpleFloatValue(float value) { Value = value; base..ctor(); } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public float? Get(Dictionary<string, string> pars) { return Value; } } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public interface IFloatValue { float? Get(Dictionary<string, string> pars); } public class HashValue : AnyValue, IHashValue { [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public HashValue(string[] values) : base(values) { } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public int? Get(Dictionary<string, string> pars) { string value = GetValue(pars); if (value == null) { return null; } return StringExtensionMethods.GetStableHashCode(value); } } public class SimpleHashValue : IHashValue { private readonly int Value = StringExtensionMethods.GetStableHashCode(value); [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public SimpleHashValue(string value) { } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public int? Get(Dictionary<string, string> pars) { return Value; } } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public interface IHashValue { int? Get(Dictionary<string, string> pars); } public class IntValue : AnyValue, IIntValue { [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public IntValue(string[] values) : base(values) { } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] 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 class SimpleIntValue : IIntValue { private readonly int Value; public SimpleIntValue(int value) { Value = value; base..ctor(); } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public int? Get(Dictionary<string, string> pars) { return Value; } } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public interface IIntValue { int? Get(Dictionary<string, string> pars); } public class LongValue : AnyValue, ILongValue { [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public LongValue(string[] values) : base(values) { } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public long? Get(Dictionary<string, string> pars) { string value = GetValue(pars); if (value == null) { return null; } if (!value.Contains(";")) { return Calculator.EvaluateLong(value); } string[] array = value.Split(new char[1] { ';' }); if (array.Length < 2) { throw new InvalidOperationException("Invalid range format: " + value); } long? num = Calculator.EvaluateLong(array[0]); long? num2 = Calculator.EvaluateLong(array[1]); if (!num.HasValue || !num2.HasValue) { return null; } long? result; if (array.Length < 3 || array[2] == "") { result = (long)(Random.value * (float)(num2.Value - num.Value) + (float)num.Value); } else { long? num3 = Calculator.EvaluateLong(array[2]); if (!num3.HasValue) { result = (long)(Random.value * (float)(num2.Value - num.Value) + (float)num.Value); } else { float num4 = Random.Range(0f, (float)(((num2 - num) / num3).Value + 1)); result = (long?)((float?)num + num4 * (float?)num3); } } if (array.Length < 4) { return result; } return Calculator.EvaluateLong(array[3].Replace("<value>", result.ToString())); } } public class SimpleLongValue : ILongValue { private readonly long Value; public SimpleLongValue(long value) { Value = value; base..ctor(); } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public long? Get(Dictionary<string, string> pars) { return Value; } } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public interface ILongValue { long? Get(Dictionary<string, string> pars); } public class QuaternionValue : AnyValue, IQuaternionValue { [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public QuaternionValue(string[] values) : base(values) { } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public Quaternion? Get(Dictionary<string, string> pars) { return Parse.AngleYXZNull(GetValue(pars)); } } public class SimpleQuaternionValue : IQuaternionValue { private readonly Quaternion Value; public SimpleQuaternionValue(Quaternion value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Value = value; base..ctor(); } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public Quaternion? Get(Dictionary<string, string> pars) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Value; } } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public interface IQuaternionValue { Quaternion? Get(Dictionary<string, string> pars); } public class StringValue : AnyValue, IStringValue { [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public StringValue(string[] values) : base(values) { } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] [return: <bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(2)] public string Get(Dictionary<string, string> pars) { return GetValue(pars); } } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(0)] public class SimpleStringValue : IStringValue { private readonly string Value; public SimpleStringValue(string value) { Value = value; base..ctor(); } [return: <bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(2)] public string Get(Dictionary<string, string> pars) { return Value; } } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public interface IStringValue { [return: <bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(2)] string Get(Dictionary<string, string> pars); } public class Vector3Value : AnyValue, IVector3Value { [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public Vector3Value(string[] values) : base(values) { } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public Vector3? Get(Dictionary<string, string> pars) { return Parse.VectorXZYNull(GetValue(pars)); } } public class SimpleVector3Value : IVector3Value { private readonly Vector3 Value; public SimpleVector3Value(Vector3 value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Value = value; base..ctor(); } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public Vector3? Get(Dictionary<string, string> pars) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Value; } } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] public interface IVector3Value { Vector3? Get(Dictionary<string, string> pars); } } namespace Service { [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(0)] public class ConfigWrapper { private readonly ConfigFile ConfigFile; private readonly ConfigSync ConfigSync; private readonly Action Regenerate; public static Dictionary<ConfigEntry<string>, float> Floats = new Dictionary<ConfigEntry<string>, float>(); public static Dictionary<ConfigEntry<string>, int?> Ints = new Dictionary<ConfigEntry<string>, int?>(); public static Dictionary<ConfigEntry<int>, float> Amounts = new Dictionary<ConfigEntry<int>, float>(); private readonly Dictionary<string, Action<Terminal, string>> SettingHandlers = new Dictionary<string, Action<Terminal, string>>(); private static readonly HashSet<string> Truthies = new HashSet<string> { "1", "true", "yes", "on" }; private static readonly HashSet<string> Falsies = new HashSet<string> { "0", "false", "no", "off" }; public ConfigWrapper(string command, ConfigFile configFile, ConfigSync configSync, Action regenerate) { //IL_004d: 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) //IL_006b: Expected O, but got Unknown //IL_006b: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) ConfigWrapper configWrapper = this; ConfigFile = configFile; ConfigSync = configSync; Regenerate = regenerate; new ConsoleCommand(command, "[key] [value] - Toggles or sets a config value.", (ConsoleEvent)delegate(ConsoleEventArgs args) { Action<Terminal, string> value; if (configSync.IsLocked && !configSync.IsAdmin) { args.Context.AddString("Error: Unable to edit locked config."); } else if (args.Length < 2) { args.Context.AddString("Error: Missing the key."); } else if (!configWrapper.SettingHandlers.TryGetValue(args[1].ToLowerInvariant(), out value)) { args.Context.AddString("Error: Key not found."); } else if (args.Length == 2) { value(args.Context, ""); } else { value(args.Context, string.Join(" ", args.Args.Skip(2))); } }, false, false, false, false, false, (ConsoleOptionsFetcher)([<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(0)] () => configWrapper.SettingHandlers.Keys.ToList()), false, false, false); } public CustomSyncedValue<string> AddValue(string identifier) { return new CustomSyncedValue<string>(ConfigSync, identifier); } public ConfigEntry<bool> BindLocking(string group, string name, bool value, ConfigDescription description) { ConfigEntry<bool> val = ConfigFile.Bind<bool>(group, name, value, description); Register(val); ConfigSync.AddLockingConfigEntry<bool>(val).SynchronizedConfig = true; return val; } public ConfigEntry<bool> BindLocking(string group, string name, bool value, string description) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown return BindLocking(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>())); } public ConfigEntry<T> Bind<[<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(2)] T>(string group, string name, T value, bool automaticRegenerate, ConfigDescription description, bool synchronizedSetting = true) { ConfigEntry<T> val = ConfigFile.Bind<T>(group, name, value, description); if (automaticRegenerate) { val.SettingChanged += ForceRegen; } if (val is ConfigEntry<bool> setting) { Register(setting); } else { if (!(val is ConfigEntry<string> setting2)) { throw new NotImplementedException("Config type not implemented for " + name + "."); } Register(setting2); } ConfigSync.AddConfigEntry<T>(val).SynchronizedConfig = synchronizedSetting; return val; } public ConfigEntry<T> Bind<[<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(2)] T>(string group, string name, T value, bool forceRegen, string description = "", bool synchronizedSetting = true) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown return Bind(group, name, value, forceRegen, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting); } private void ForceRegen(object e, EventArgs s) { Regenerate(); } public ConfigEntry<string> BindFloat(string group, string name, float value, bool forceRegen, string description = "", bool synchronizedSetting = true) { ConfigEntry<string> entry = Bind(group, name, value.ToString(NumberFormatInfo.InvariantInfo), forceRegen, description, synchronizedSetting); entry.SettingChanged += [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(0)] (object s, EventArgs e) => { Floats[entry] = TryParseFloat(entry); }; Floats[entry] = TryParseFloat(entry); return entry; } public ConfigEntry<string> BindInt(string group, string name, int? value, bool forceRegen, string description = "", bool synchronizedSetting = true) { ConfigEntry<string> entry = Bind(group, name, value.HasValue ? value.ToString() : "", forceRegen, description, synchronizedSetting); entry.SettingChanged += [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(0)] (object s, EventArgs e) => { Ints[entry] = TryParseInt(entry); }; Ints[entry] = TryParseInt(entry); return entry; } private static void AddMessage(Terminal context, string message) { context.AddString(message); Player localPlayer = Player.m_localPlayer; if (localPlayer != null) { ((Character)localPlayer).Message((MessageType)1, message, 0, (Sprite)null); } } private string ToKey(string name) { return name.ToLowerInvariant().Replace(' ', '_').Replace("(", "") .Replace(")", ""); } private void Register(ConfigEntry<bool> setting) { string name = ((ConfigEntryBase)setting).Definition.Key; string key = ToKey(name); SettingHandlers.Add(key, delegate(Terminal terminal, string value) { Toggle(terminal, setting, name, value); }); } private void Register(ConfigEntry<string> setting) { string name = ((ConfigEntryBase)setting).Definition.Key; string key = ToKey(name); SettingHandlers.Add(key, delegate(Terminal terminal, string value) { SetValue(terminal, setting, name, value); }); } private static string State(bool value) { if (!value) { return "disabled"; } return "enabled"; } private static bool IsTruthy(string value) { return Truthies.Contains(value); } private static bool IsFalsy(string value) { return Falsies.Contains(value); } private static void Toggle(Terminal context, ConfigEntry<bool> setting, string name, string value) { if (value == "") { setting.Value = !setting.Value; } else if (IsTruthy(value)) { setting.Value = true; } else if (IsFalsy(value)) { setting.Value = false; } AddMessage(context, name + " " + State(setting.Value) + "."); } private static int? TryParseInt(ConfigEntry<string> setting) { if (int.TryParse(setting.Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { return result; } return null; } private static float TryParseFloat(string value, float defaultValue) { if (float.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { return result; } return defaultValue; } private static float TryParseFloat(ConfigEntry<string> setting) { if (float.TryParse(setting.Value, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { return result; } return TryParseFloat((string)((ConfigEntryBase)setting).DefaultValue, 0f); } private static void SetValue(Terminal context, ConfigEntry<string> setting, string name, string value) { if (value == "") { AddMessage(context, name + ": " + setting.Value + "."); return; } setting.Value = value; AddMessage(context, name + " set to " + value + "."); } } [<af722cf0-b9de-42e9-b9b6-6fa6196e87f0>NullableContext(1)] [<bb9efeec-8bdf-47fb-ae74-335ea0339a69>Nullable(0)] public class AssetTracker { private static readonly Dictionary<string, string> PrefabToBundleMapping = new Dictionary<string, string>(); private static readonly Dictionary<string, string> BundleToModMapping = new Dictionary<string, string>(); internal static void MapPrefabsToBundles() { foreach (AssetBundle allLoadedAss