using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Service; using SoftReferenceableAssets; using Splatform; using UnityEngine; using UpgradeWorld; [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("UpgradeWorld")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+7f11da1be1688f5f831a92b3019169e8d0402974")] [assembly: AssemblyProduct("UpgradeWorld")] [assembly: AssemblyTitle("UpgradeWorld")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.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 Service { public class ComponentInfo { private static Type[]? types; private static readonly Dictionary> PrefabComponents = new Dictionary>(); public static Type[] Types => types ?? (types = LoadTypes()); private static Type[] LoadTypes() { List list = new List(); list.Add(Assembly.GetAssembly(typeof(ZNetView))); list.AddRange(from p in Chainloader.PluginInfos.Values where (Object)(object)p.Instance != (Object)null select ((object)p.Instance).GetType().Assembly); List source = list; Assembly.GetAssembly(typeof(ZNetView)); Type baseType = typeof(MonoBehaviour); List list2 = new List(); list2.AddRange(source.SelectMany(delegate(Assembly s) { try { return s.GetTypes(); } catch (ReflectionTypeLoadException ex) { return ex.Types.Where((Type t) => t != null); } }).Where(delegate(Type t) { try { return baseType.IsAssignableFrom(t); } catch { return false; } })); return list2.ToArray(); } public static IEnumerable> HaveComponent(IEnumerable> objs, List typeSets) { List typeSets2 = typeSets; if (PrefabComponents.Count == 0) { foreach (KeyValuePair namedPrefab in ZNetScene.instance.m_namedPrefabs) { namedPrefab.Value.GetComponentsInChildren(ZNetView.m_tempComponents); foreach (MonoBehaviour tempComponent in ZNetView.m_tempComponents) { string key = ((object)tempComponent).GetType().Name.ToLowerInvariant(); if (!PrefabComponents.ContainsKey(key)) { PrefabComponents[key] = new HashSet(); } PrefabComponents[key].Add(namedPrefab.Key); } } } HashSet value; return objs.Where>((KeyValuePair obj) => typeSets2.Any((string[] types) => types.All((string type) => PrefabComponents.TryGetValue(type.ToLowerInvariant(), out value) && value.Contains(obj.Key)))); } } public class DataHelper { public static bool ClearData(ZDO zdo, string key) { //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_0038: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) ZDOID uid = zdo.m_uid; int stableHashCode = StringExtensionMethods.GetStableHashCode(key); int stableHashCode2 = StringExtensionMethods.GetStableHashCode(key + "_u"); int stableHashCode3 = StringExtensionMethods.GetStableHashCode(key + "_i"); bool flag = false; if (ZDOExtraData.s_vec3.TryGetValue(uid, out var value)) { flag |= value.Remove(stableHashCode); } if (ZDOExtraData.s_quats.TryGetValue(uid, out var value2)) { flag |= value2.Remove(stableHashCode); } if (ZDOExtraData.s_longs.TryGetValue(uid, out var value3)) { flag |= value3.Remove(stableHashCode); flag |= value3.Remove(stableHashCode2); flag |= value3.Remove(stableHashCode3); } if (ZDOExtraData.s_strings.TryGetValue(uid, out var value4)) { flag |= value4.Remove(stableHashCode); } if (ZDOExtraData.s_ints.TryGetValue(uid, out var value5)) { flag |= value5.Remove(stableHashCode); } if (ZDOExtraData.s_floats.TryGetValue(uid, out var value6)) { flag |= value6.Remove(stableHashCode); } return flag; } public static string GetData(ZDO zdo, string key, string type) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_00ac: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) if (key == "*") { List allData = GetAllData(zdo, type); if (allData.Count <= 0) { return "No data"; } return string.Join("; ", allData); } ZDOID uid = zdo.m_uid; int stableHashCode = StringExtensionMethods.GetStableHashCode(key); int stableHashCode2 = StringExtensionMethods.GetStableHashCode(key + "_u"); int stableHashCode3 = StringExtensionMethods.GetStableHashCode(key + "_i"); bool num = ZDOExtraData.s_vec3.ContainsKey(uid) && ZDOExtraData.s_vec3[uid].ContainsKey(stableHashCode); bool flag = ZDOExtraData.s_quats.ContainsKey(uid) && ZDOExtraData.s_quats[uid].ContainsKey(stableHashCode); bool flag2 = ZDOExtraData.s_longs.ContainsKey(uid) && ZDOExtraData.s_longs[uid].ContainsKey(stableHashCode); bool flag3 = ZDOExtraData.s_strings.ContainsKey(uid) && ZDOExtraData.s_strings[uid].ContainsKey(stableHashCode); bool flag4 = ZDOExtraData.s_ints.ContainsKey(uid) && ZDOExtraData.s_ints[uid].ContainsKey(stableHashCode); bool flag5 = ZDOExtraData.s_floats.ContainsKey(uid) && ZDOExtraData.s_floats[uid].ContainsKey(stableHashCode); bool flag6 = ZDOExtraData.s_longs.ContainsKey(uid) && ZDOExtraData.s_longs[uid].ContainsKey(stableHashCode2) && ZDOExtraData.s_longs[uid].ContainsKey(stableHashCode3); if (num && (type == "" || type == "vector")) { return Helper.PrintVectorXZY(ZDOExtraData.s_vec3[uid][stableHashCode]) + " (vector)"; } if (flag && (type == "" || type == "quat")) { return Helper.PrintAngleYXZ(ZDOExtraData.s_quats[uid][stableHashCode]) + " (quat)"; } if (flag2 && (type == "" || type == "long")) { if (stableHashCode == ZDOVars.s_timeOfDeath) { return Helper.PrintDay(ZDOExtraData.s_longs[uid][stableHashCode]) + " (long)"; } return ZDOExtraData.s_longs[uid][stableHashCode] + " (long)"; } if (flag3 && (type == "" || type == "string")) { return ZDOExtraData.s_strings[uid][stableHashCode] + " (string)"; } if (flag4 && (type == "" || type == "int")) { return ZDOExtraData.s_ints[uid][stableHashCode] + " (int)"; } if (flag5 && (type == "" || type == "float")) { return ZDOExtraData.s_floats[uid][stableHashCode].ToString("F1") + " (float)"; } if (flag6 && (type == "" || type == "id")) { return ZDOExtraData.s_longs[uid][stableHashCode2] + "/" + ZDOExtraData.s_longs[uid][stableHashCode3] + " (id)"; } return "No data"; } public static bool SetData(ZDO zdo, string key, string data, string type) { //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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) ZDOID uid = zdo.m_uid; int stableHashCode = StringExtensionMethods.GetStableHashCode(key); int stableHashCode2 = StringExtensionMethods.GetStableHashCode(key + "_u"); bool flag = ZDOExtraData.s_vec3.ContainsKey(uid) && ZDOExtraData.s_vec3[uid].ContainsKey(stableHashCode); bool flag2 = ZDOExtraData.s_quats.ContainsKey(uid) && ZDOExtraData.s_quats[uid].ContainsKey(stableHashCode); bool flag3 = ZDOExtraData.s_longs.ContainsKey(uid) && ZDOExtraData.s_longs[uid].ContainsKey(stableHashCode); bool flag4 = ZDOExtraData.s_strings.ContainsKey(uid) && ZDOExtraData.s_strings[uid].ContainsKey(stableHashCode); bool flag5 = ZDOExtraData.s_ints.ContainsKey(uid) && ZDOExtraData.s_ints[uid].ContainsKey(stableHashCode); bool flag6 = ZDOExtraData.s_floats.ContainsKey(uid) && ZDOExtraData.s_floats[uid].ContainsKey(stableHashCode); bool flag7 = ZDOExtraData.s_longs.ContainsKey(uid) && ZDOExtraData.s_longs[uid].ContainsKey(stableHashCode2); if (type == "vector" || (type == "" && flag)) { zdo.Set(stableHashCode, Parse.VectorXZY(Parse.Split(data), Vector3.zero)); } else if (type == "quat" || (type == "" && flag2)) { zdo.Set(stableHashCode, Parse.AngleYXZ(data)); } else if (type == "long" || (type == "" && flag3)) { if (stableHashCode == ZDOVars.s_timeOfDeath) { zdo.Set(stableHashCode, Helper.ToTick(Parse.Long(data, 0L))); } else { zdo.Set(stableHashCode, Parse.Long(data, 0L)); } } else if (type == "string" || (type == "" && flag4)) { zdo.Set(stableHashCode, data); } else if (type == "int" || (type == "" && flag5)) { zdo.Set(stableHashCode, Parse.Int(data), false); } else if (type == "float" || (type == "" && flag6)) { zdo.Set(stableHashCode, Parse.Float(data)); } else { if (!(type == "id") && !(type == "" && flag7)) { return false; } string[] array = Parse.Split(data, '/'); int stableHashCode3 = StringExtensionMethods.GetStableHashCode(key + "_i"); zdo.Set(stableHashCode2, Parse.Long(array[0], 0L)); zdo.Set(stableHashCode3, Parse.Long(array, 1, 0L)); } return true; } public static bool HasData(ZDO zdo, string key, string data, bool includeEmpty) { //IL_0016: 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_0039: 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_007e: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_012c: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) if (key == "*") { return HasAnyData(zdo, data); } ZDOID uid = zdo.m_uid; int stableHashCode = StringExtensionMethods.GetStableHashCode(key); int stableHashCode2 = StringExtensionMethods.GetStableHashCode(key + "_u"); if (ZDOExtraData.s_vec3.ContainsKey(uid) && ZDOExtraData.s_vec3[uid].ContainsKey(stableHashCode)) { return Parse.VectorXZYRange(data, Vector3.zero).Includes(ZDOExtraData.s_vec3[uid][stableHashCode]); } if (ZDOExtraData.s_quats.ContainsKey(uid) && ZDOExtraData.s_quats[uid].ContainsKey(stableHashCode)) { return Parse.AngleYXZ(data) == ZDOExtraData.s_quats[uid][stableHashCode]; } if (ZDOExtraData.s_longs.ContainsKey(uid) && ZDOExtraData.s_longs[uid].ContainsKey(stableHashCode)) { if (stableHashCode == ZDOVars.s_timeOfDeath) { return Parse.LongRange(data, 0L).Includes(Helper.ToDay(ZDOExtraData.s_longs[uid][stableHashCode])); } return Parse.LongRange(data, 0L).Includes(ZDOExtraData.s_longs[uid][stableHashCode]); } if (ZDOExtraData.s_strings.ContainsKey(uid) && ZDOExtraData.s_strings[uid].ContainsKey(stableHashCode)) { return data == ZDOExtraData.s_strings[uid][stableHashCode]; } if (ZDOExtraData.s_ints.ContainsKey(uid) && ZDOExtraData.s_ints[uid].ContainsKey(stableHashCode)) { return Parse.IntRange(data).Includes(ZDOExtraData.s_ints[uid][stableHashCode]); } if (ZDOExtraData.s_floats.ContainsKey(uid) && ZDOExtraData.s_floats[uid].ContainsKey(stableHashCode)) { return Parse.FloatRange(data).Includes(ZDOExtraData.s_floats[uid][stableHashCode]); } int stableHashCode3 = StringExtensionMethods.GetStableHashCode(key + "_i"); if (ZDOExtraData.s_longs.ContainsKey(uid) && ZDOExtraData.s_longs[uid].ContainsKey(stableHashCode2) && ZDOExtraData.s_longs[uid].ContainsKey(stableHashCode3)) { return data == ZDOExtraData.s_longs[uid][stableHashCode2] + "/" + ZDOExtraData.s_longs[uid][stableHashCode3]; } return includeEmpty; } private static List GetAllData(ZDO zdo, string type) { //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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_01d3: Unknown result type (might be due to invalid IL or missing references) ZDOID uid = zdo.m_uid; List list = new List(); if ((type == "" || type == "vector") && ZDOExtraData.s_vec3.TryGetValue(uid, out var value)) { list.AddRange(((IEnumerable>)value).Select((KeyValuePair pair) => pair.Key + "=" + Helper.PrintVectorXZY(pair.Value) + " (vector)")); } if ((type == "" || type == "quat") && ZDOExtraData.s_quats.TryGetValue(uid, out var value2)) { list.AddRange(((IEnumerable>)value2).Select((KeyValuePair pair) => pair.Key + "=" + Helper.PrintAngleYXZ(pair.Value) + " (quat)")); } if ((type == "" || type == "long") && ZDOExtraData.s_longs.TryGetValue(uid, out var value3)) { list.AddRange(((IEnumerable>)value3).Select((KeyValuePair pair) => (pair.Key == ZDOVars.s_timeOfDeath) ? (pair.Key + "=" + Helper.PrintDay(pair.Value) + " (long)") : (pair.Key + "=" + pair.Value + " (long)"))); } if ((type == "" || type == "string") && ZDOExtraData.s_strings.TryGetValue(uid, out var value4)) { list.AddRange(((IEnumerable>)value4).Select((KeyValuePair pair) => pair.Key + "=" + pair.Value + " (string)")); } if ((type == "" || type == "int") && ZDOExtraData.s_ints.TryGetValue(uid, out var value5)) { list.AddRange(((IEnumerable>)value5).Select((KeyValuePair pair) => pair.Key + "=" + pair.Value + " (int)")); } if ((type == "" || type == "float") && ZDOExtraData.s_floats.TryGetValue(uid, out var value6)) { list.AddRange(((IEnumerable>)value6).Select((KeyValuePair pair) => pair.Key + "=" + pair.Value.ToString("F1") + " (float)")); } return list; } private static bool HasAnyData(ZDO zdo, string data) { //IL_000e: 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_0019: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) string data2 = data; ZDOID uid = zdo.m_uid; if (ZDOExtraData.s_strings.TryGetValue(uid, out var value) && ((IEnumerable>)value).Any((KeyValuePair pair) => data2 == pair.Value)) { return true; } if (int.TryParse(data2, NumberStyles.Integer, CultureInfo.InvariantCulture, out var intValue) && ZDOExtraData.s_ints.TryGetValue(uid, out var value2) && ((IEnumerable>)value2).Any((KeyValuePair pair) => pair.Value == intValue)) { return true; } if (long.TryParse(data2, NumberStyles.Integer, CultureInfo.InvariantCulture, out var longValue) && ZDOExtraData.s_longs.TryGetValue(uid, out var value3) && ((IEnumerable>)value3).Any((KeyValuePair pair) => pair.Value == longValue)) { return true; } if (Parse.TryFloat(data2, out var floatValue) && ZDOExtraData.s_floats.TryGetValue(uid, out var value4) && ((IEnumerable>)value4).Any((KeyValuePair pair) => Mathf.Approximately(pair.Value, floatValue))) { return true; } return false; } } public static class Hash { public static int Changed = StringExtensionMethods.GetStableHashCode("override_changed"); public static int OverrideItems = StringExtensionMethods.GetStableHashCode("override_items"); } public class Range where T : IComparable { public T Min; public T Max; public Range(T value) { Min = value; Max = value; } public Range(T min, T max) { Min = min; Max = max; } public bool Includes(T value) { if (Min.CompareTo(value) <= 0) { return Max.CompareTo(value) >= 0; } return false; } } public class Vector3Range { public Vector3 Min; public Vector3 Max; public Vector3Range(Vector3 value) { //IL_0007: 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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Min = value; Max = value; } public Vector3Range(Vector3 min, Vector3 max) { //IL_0007: 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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Min = min; Max = max; } public bool Includes(Vector3 value) { if (((Vector3)(ref Min)).sqrMagnitude <= ((Vector3)(ref value)).sqrMagnitude) { return ((Vector3)(ref value)).sqrMagnitude <= ((Vector3)(ref Max)).sqrMagnitude; } return false; } } public static class Parse { private static readonly HashSet Truthies = new HashSet { "1", "true", "yes", "on" }; private static readonly HashSet Falsies = new HashSet { "0", "false", "no", "off" }; private static Range Range(string arg) { List list = arg.Split(new char[1] { '-' }).ToList(); if (list.Count > 1 && list[0] == "") { list[0] = "-" + list[1]; list.RemoveAt(1); } if (list.Count > 2 && list[1] == "") { list[1] = "-" + list[2]; list.RemoveAt(2); } if (list.Count == 1) { return new Range(list[0]); } return new Range(list[0], list[1]); } public static int Int(string arg, int defaultValue = 0) { if (!int.TryParse(arg, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { return defaultValue; } return result; } public static int Int(string[] args, int index, int defaultValue = 0) { if (args.Length <= index) { return defaultValue; } return Int(args[index], defaultValue); } public static Range IntRange(string arg, int defaultValue = 0) { Range range = Range(arg); return new Range(Int(range.Min, defaultValue), Int(range.Max, defaultValue)); } public static Range IntRange(string[] args, int index, int defaultValue = 0) { if (args.Length <= index) { return new Range(defaultValue); } return IntRange(args[index], defaultValue); } public static uint UInt(string arg, uint defaultValue = 0u) { if (!uint.TryParse(arg, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { return defaultValue; } return result; } public static uint UInt(string[] args, int index, uint defaultValue = 0u) { if (args.Length <= index) { return defaultValue; } return UInt(args[index], defaultValue); } public static Range UIntRange(string arg, uint defaultValue = 0u) { Range range = Range(arg); return new Range(UInt(range.Min, defaultValue), UInt(range.Max, defaultValue)); } public static Range UIntRange(string[] args, int index, uint defaultValue = 0u) { if (args.Length <= index) { return new Range(defaultValue); } return UIntRange(args[index], defaultValue); } public static long Long(string arg, long defaultValue = 0L) { if (!long.TryParse(arg, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { return defaultValue; } return result; } public static long Long(string[] args, int index, long defaultValue = 0L) { if (args.Length <= index) { return defaultValue; } return Long(args[index], defaultValue); } public static Range LongRange(string arg, long defaultValue = 0L) { Range range = Range(arg); return new Range(Long(range.Min, defaultValue), Long(range.Max, defaultValue)); } public static Range LongRange(string[] args, int index, long defaultValue = 0L) { if (args.Length <= index) { return new Range(defaultValue); } return LongRange(args[index], defaultValue); } public static bool TryFloat(string arg, out float value) { return float.TryParse(arg, NumberStyles.Float, CultureInfo.InvariantCulture, out value); } public static float Float(string arg, float defaultValue = 0f) { if (!TryFloat(arg, out var value)) { return defaultValue; } return value; } public static float Float(string[] args, int index, float defaultValue = 0f) { if (args.Length <= index) { return defaultValue; } return Float(args[index], defaultValue); } public static Range FloatRange(string arg, float defaultValue = 0f) { Range range = Range(arg); return new Range(Float(range.Min, defaultValue), Float(range.Max, defaultValue)); } public static Range FloatRange(string[] args, int index, float defaultValue = 0f) { if (args.Length <= index) { return new Range(defaultValue); } return FloatRange(args[index], defaultValue); } public static string String(string[] args, int index, string defaultValue = "") { if (args.Length <= index) { return defaultValue; } return args[index]; } public static Quaternion AngleYXZ(string arg) { //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) return AngleYXZ(arg, Quaternion.identity); } public static Quaternion AngleYXZ(string arg, Quaternion defaultValue) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_002f: 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_005d: 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) string[] args = Split(arg); Vector3 zero = Vector3.zero; zero.y = Float(args, 0, ((Quaternion)(ref defaultValue)).eulerAngles.y); zero.x = Float(args, 1, ((Quaternion)(ref defaultValue)).eulerAngles.x); zero.z = Float(args, 2, ((Quaternion)(ref defaultValue)).eulerAngles.z); return Quaternion.Euler(zero); } public static Vector3 VectorXZY(string[] args) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return VectorXZY(args, 0, Vector3.zero); } public static Vector3 VectorXZY(string[] args, Vector3 defaultValue) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) return VectorXZY(args, 0, defaultValue); } public static Vector3 VectorXZY(string[] args, int index) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return VectorXZY(args, index, Vector3.zero); } public static Vector3 VectorXZY(string[] args, int index, Vector3 defaultValue) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_0036: 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) Vector3 zero = Vector3.zero; zero.x = Float(args, index, defaultValue.x); zero.y = Float(args, index + 2, defaultValue.y); zero.z = Float(args, index + 1, defaultValue.z); return zero; } public static Vector3Range VectorXZYRange(string arg, Vector3 defaultValue) { //IL_000a: 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_0025: Unknown result type (might be due to invalid IL or missing references) string[] args = Split(arg); Range x = FloatRange(args, 0, defaultValue.x); Range y = FloatRange(args, 2, defaultValue.y); Range z = FloatRange(args, 1, defaultValue.z); return ToVectorRange(x, y, z); } public static Vector3 VectorZXY(string[] args) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return VectorZXY(args, 0, Vector3.zero); } public static Vector3 VectorZXY(string[] args, Vector3 defaultValue) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) return VectorZXY(args, 0, defaultValue); } public static Vector3 VectorZXY(string[] args, int index) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return VectorZXY(args, index, Vector3.zero); } public static Vector3 VectorZXY(string[] args, int index, Vector3 defaultValue) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) Vector3 zero = Vector3.zero; zero.x = Float(args, index + 1, defaultValue.x); zero.y = Float(args, index + 2, defaultValue.y); zero.z = Float(args, index, defaultValue.z); return zero; } public static Vector3Range VectorZXYRange(string arg, Vector3 defaultValue) { //IL_000a: 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_0025: Unknown result type (might be due to invalid IL or missing references) string[] args = Split(arg); Range x = FloatRange(args, 1, defaultValue.x); Range y = FloatRange(args, 2, defaultValue.y); Range z = FloatRange(args, 0, defaultValue.z); return ToVectorRange(x, y, z); } private static Vector3Range ToVectorRange(Range x, Range y, Range z) { //IL_0012: 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) Vector3 min = new Vector3(x.Min, y.Min, z.Min); Vector3 max = default(Vector3); ((Vector3)(ref max))..ctor(x.Max, y.Max, z.Max); return new Vector3Range(min, max); } public static Vector3 VectorYXZ(string[] args) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return VectorYXZ(args, 0, Vector3.zero); } public static Vector3 VectorYXZ(string[] args, Vector3 defaultValue) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) return VectorYXZ(args, 0, defaultValue); } public static Vector3 VectorYXZ(string[] args, int index) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return VectorYXZ(args, index, Vector3.zero); } public static Vector3 VectorYXZ(string[] args, int index, Vector3 defaultValue) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_0036: 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) Vector3 zero = Vector3.zero; zero.y = Float(args, index, defaultValue.y); zero.x = Float(args, index + 1, defaultValue.x); zero.z = Float(args, index + 2, defaultValue.z); return zero; } public static Vector3Range VectorYXZRange(string arg, Vector3 defaultValue) { //IL_000a: 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_0025: Unknown result type (might be due to invalid IL or missing references) string[] args = Split(arg); Range x = FloatRange(args, 1, defaultValue.x); Range y = FloatRange(args, 0, defaultValue.y); Range z = FloatRange(args, 2, defaultValue.z); return ToVectorRange(x, y, z); } public static Vector3 Scale(string[] args) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return Scale(args, 0); } public static Vector3 Scale(string[] args, int index) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return SanityCheck(VectorXZY(args, index)); } private static Vector3 SanityCheck(Vector3 scale) { //IL_0000: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (scale.x == 0f) { scale.x = 1f; } if (scale.y == 0f) { scale.y = scale.x; } if (scale.z == 0f) { scale.z = scale.x; } return scale; } public static Vector3Range ScaleRange(string arg) { //IL_0038: 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) //IL_0042: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) string[] args = Split(arg); Range x = FloatRange(args, 0); Range y = FloatRange(args, 1); Range z = FloatRange(args, 2); Vector3Range vector3Range = ToVectorRange(x, y, z); vector3Range.Min = SanityCheck(vector3Range.Min); vector3Range.Max = SanityCheck(vector3Range.Max); return vector3Range; } public static string[] Split(string arg, char separator = ',') { List list = new List(); list.AddRange(from s in arg.Split(new char[1] { separator }) select s.Trim() into s where s != "" select s); return list.ToArray(); } public static string[] Split(string[] args, int index, char separator) { if (args.Length > index) { return Split(args[index], separator); } return Array.Empty(); } private static bool IsTruthy(string value) { return Truthies.Contains(value); } private static bool IsFalsy(string value) { return Falsies.Contains(value); } public static bool? Boolean(string arg) { if (IsTruthy(arg)) { return true; } if (IsFalsy(arg)) { return false; } return null; } public static IEnumerable Flag(IEnumerable parameters, string flag, out bool value) { string flag2 = flag; value = parameters.FirstOrDefault((string arg) => arg.ToLower() == flag2) != null; return parameters.Where((string arg) => arg.ToLower() != flag2); } public static bool Flag(List parameters, string flag) { string flag2 = flag; string text = parameters.FirstOrDefault((string value) => value.ToLower() == flag2.ToLower()); if (text == null) { return false; } return parameters.Remove(text); } public static Vector2i Zone(string arg) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) string[] array = Split(arg).ToArray(); Vector2i result = default(Vector2i); if (array.Length != 0) { result.x = Int(array[0]); } if (array.Length > 1) { result.y = Int(array[1]); } return result; } public static Vector2 Pos(string arg) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) string[] array = Split(arg).ToArray(); Vector2 result = default(Vector2); if (array.Length != 0) { result.x = Float(array[0]); } if (array.Length > 1) { result.y = Float(array[1]); } return result; } public static HashSet Biomes(string arg) { //IL_0037: 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: Unknown result type (might be due to invalid IL or missing references) HashSet hashSet = new HashSet(); foreach (Biome item in Split(arg).Select(Helper.GetBiome)) { hashSet.Add(item); } return hashSet; } } public class ZDOData { public ZDO Zdo; public int Prefab; public Dictionary Strings = new Dictionary(); public Dictionary Floats = new Dictionary(); public Dictionary Ints = new Dictionary(); public Dictionary Longs = new Dictionary(); public Dictionary Vecs = new Dictionary(); public Dictionary Quats = new Dictionary(); public Dictionary ByteArrays = new Dictionary(); public ConnectionType ConnectionType; public int ConnectionHash; public ZDOID OriginalId = ZDOID.None; public ZDOID TargetConnectionId = ZDOID.None; public ZDOData(ZDO zdo) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_005e: Unknown result type (might be due to invalid IL or missing references) Zdo = zdo; Load(zdo); } public ZDO Clone() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) ZDO val = ZDOMan.instance.CreateNewZDO(Zdo.m_position, 0); val.Persistent = Zdo.Persistent; val.Type = Zdo.Type; val.Distant = Zdo.Distant; val.m_prefab = Prefab; val.m_rotation = Zdo.m_rotation; val.SetOwnerInternal(Zdo.GetOwner()); Write(val); return val; } public ZDO Move(Vector3 pos, Quaternion rot) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_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) ZDO val = ZDOMan.instance.CreateNewZDO(pos, 0); val.Persistent = Zdo.Persistent; val.Type = Zdo.Type; val.Distant = Zdo.Distant; val.m_prefab = Prefab; val.m_rotation = ((Quaternion)(ref rot)).eulerAngles; val.SetOwnerInternal(Zdo.GetOwner()); Write(val); return val; } private void Write(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_001a: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) ZDOID uid = zdo.m_uid; if (Floats.Count > 0) { ZDOHelper.Init(ZDOExtraData.s_floats, uid); } if (Vecs.Count > 0) { ZDOHelper.Init(ZDOExtraData.s_vec3, uid); } if (Quats.Count > 0) { ZDOHelper.Init(ZDOExtraData.s_quats, uid); } if (Ints.Count > 0) { ZDOHelper.Init(ZDOExtraData.s_ints, uid); } if (Longs.Count > 0) { ZDOHelper.Init(ZDOExtraData.s_longs, uid); } if (Strings.Count > 0) { ZDOHelper.Init(ZDOExtraData.s_strings, uid); } if (ByteArrays.Count > 0) { ZDOHelper.Init(ZDOExtraData.s_byteArrays, uid); } foreach (KeyValuePair @float in Floats) { ZDOExtraData.s_floats[uid].SetValue(@float.Key, @float.Value); } foreach (KeyValuePair vec in Vecs) { ZDOExtraData.s_vec3[uid].SetValue(vec.Key, vec.Value); } foreach (KeyValuePair quat in Quats) { ZDOExtraData.s_quats[uid].SetValue(quat.Key, quat.Value); } foreach (KeyValuePair @int in Ints) { ZDOExtraData.s_ints[uid].SetValue(@int.Key, @int.Value); } foreach (KeyValuePair @long in Longs) { ZDOExtraData.s_longs[uid].SetValue(@long.Key, @long.Value); } foreach (KeyValuePair @string in Strings) { ZDOExtraData.s_strings[uid].SetValue(@string.Key, @string.Value); } foreach (KeyValuePair byteArray in ByteArrays) { ZDOExtraData.s_byteArrays[uid].SetValue(byteArray.Key, byteArray.Value); } HandleConnection(zdo); HandleHashConnection(zdo); } 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 keyValuePair = ZDOExtraData.s_connections.FirstOrDefault((KeyValuePair 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)ZDOExtraData.GetAllConnectionZDOIDs((ConnectionType)val)).FirstOrDefault((Func)((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 = (ZDO)(flag ? ((object)ownZdo) : ((object)zDO)); ZDOID val4 = (flag ? val2 : uid); val3.SetConnection((ConnectionType)3, val4); } if ((ConnectionType & 2) > 0) { ZDO val5 = (ZDO)(flag ? ((object)ownZdo) : ((object)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 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: 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_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_0313: 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_031e: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: 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_0329: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) ZDOID uid = zdo.m_uid; Prefab = zdo.m_prefab; Floats = (ZDOExtraData.s_floats.ContainsKey(uid) ? ((IEnumerable>)ZDOExtraData.s_floats[uid]).ToDictionary((KeyValuePair kvp) => kvp.Key, (KeyValuePair kvp) => kvp.Value) : new Dictionary()); Ints = (ZDOExtraData.s_ints.ContainsKey(uid) ? ((IEnumerable>)ZDOExtraData.s_ints[uid]).ToDictionary((KeyValuePair kvp) => kvp.Key, (KeyValuePair kvp) => kvp.Value) : new Dictionary()); Longs = (ZDOExtraData.s_longs.ContainsKey(uid) ? ((IEnumerable>)ZDOExtraData.s_longs[uid]).ToDictionary((KeyValuePair kvp) => kvp.Key, (KeyValuePair kvp) => kvp.Value) : new Dictionary()); Strings = (ZDOExtraData.s_strings.ContainsKey(uid) ? ((IEnumerable>)ZDOExtraData.s_strings[uid]).ToDictionary((KeyValuePair kvp) => kvp.Key, (KeyValuePair kvp) => kvp.Value) : new Dictionary()); Vecs = (ZDOExtraData.s_vec3.ContainsKey(uid) ? ((IEnumerable>)ZDOExtraData.s_vec3[uid]).ToDictionary((KeyValuePair kvp) => kvp.Key, (KeyValuePair kvp) => kvp.Value) : new Dictionary()); Quats = (ZDOExtraData.s_quats.ContainsKey(uid) ? ((IEnumerable>)ZDOExtraData.s_quats[uid]).ToDictionary((KeyValuePair kvp) => kvp.Key, (KeyValuePair kvp) => kvp.Value) : new Dictionary()); ByteArrays = (ZDOExtraData.s_byteArrays.ContainsKey(uid) ? ((IEnumerable>)ZDOExtraData.s_byteArrays[uid]).ToDictionary((KeyValuePair kvp) => kvp.Key, (KeyValuePair kvp) => kvp.Value) : new Dictionary()); 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; } } } } namespace UpgradeWorld { public abstract class BaseOperation { [CompilerGenerated] private bool P; protected int LocationProxyHash; protected int LocationHash; protected Terminal Context; public ZRpc? User; private readonly List Pins; protected BaseOperation(Terminal context, bool pin = false) { P = pin; LocationProxyHash = StringExtensionMethods.GetStableHashCode("LocationProxy"); LocationHash = StringExtensionMethods.GetStableHashCode("location"); Context = (Terminal)(((object)context) ?? ((object)Console.instance)); User = ServerExecution.User; Pins = new List(); base..ctor(); } public void Print(string value, bool addDot = true) { if (addDot && !value.EndsWith(".")) { value += "."; } Helper.Print(Context, User, value); } protected void Log(IEnumerable values) { ZLog.Log((object)("\n" + string.Join("\n", values))); } protected void Print(IEnumerable values, bool addDot = true) { foreach (string value in values) { Print(value, addDot); } } protected void PrintOnce(string value, bool addDot = true) { if (addDot && !value.EndsWith(".")) { value += "."; } Helper.PrintOnce(Context, User, value, 10f); } protected void AddPin(Vector3 pos) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (P) { Pins.Add(pos); } } protected void PrintPins() { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) if (!P) { return; } if (User != null) { User.Invoke(ServerExecution.RPC_Pins, new object[1] { string.Join("|", Pins.Select(Helper.PrintPin)) }); return; } List findPins = ((Terminal)Console.instance).m_findPins; foreach (PinData item in findPins) { Minimap instance = Minimap.instance; if (instance != null) { instance.RemovePin(item); } } findPins.Clear(); foreach (Vector3 pin in Pins) { Minimap instance2 = Minimap.instance; PinData val = ((instance2 != null) ? instance2.AddPin(pin, (PinType)3, "", false, false, Player.m_localPlayer.GetPlayerID(), default(PlatformUserID)) : null); if (val != null) { findPins.Add(val); } } } } public abstract class EntityOperation : BaseOperation { private static readonly int PlayerHash = StringExtensionMethods.GetStableHashCode("Player"); private static Dictionary HashToName = new Dictionary(); protected EntityOperation(Terminal context, bool pin) : base(context, pin) { } protected static string S(int i) { if (i <= 1) { return ""; } return "s"; } public static string GetName(int prefab) { if (!HashToName.TryGetValue(prefab, out string value)) { return ""; } return value; } public static HashSet GetPrefabs(IEnumerable id, List types) { List types2 = types; if (id.Count() == 0) { return GetPrefabs("*", types2); } HashSet hashSet = new HashSet(); foreach (int item in id.SelectMany((string id) => GetPrefabs(id, types2))) { hashSet.Add(item); } return hashSet; } public static HashSet GetPrefabs(string id, List types) { string id2 = id; if (HashToName.Count == 0) { HashToName = ZNetScene.instance.m_namedPrefabs.ToDictionary((KeyValuePair kvp) => StringExtensionMethods.GetStableHashCode(((Object)kvp.Value).name), (KeyValuePair kvp) => ((Object)kvp.Value).name); } IEnumerable> source = ZNetScene.instance.m_namedPrefabs.Where((KeyValuePair kvp) => kvp.Key != PlayerHash); if (!(id2 == "*")) { source = ((!id2.Contains("*")) ? source.Where((KeyValuePair kvp) => string.Equals(((Object)kvp.Value).name, id2, StringComparison.OrdinalIgnoreCase)) : source.Where((KeyValuePair kvp) => Helper.IsIncluded(id2, ((Object)kvp.Value).name))); } if (types.Count > 0) { source = ComponentInfo.HaveComponent(source.ToArray(), types); } HashSet hashSet = new HashSet(); foreach (int item in source.Select((KeyValuePair kvp) => kvp.Key)) { hashSet.Add(item); } return hashSet; } public static ZDO[] GetZDOs(ZDO[] zdos, int hash) { List list = new List(); list.AddRange(zdos.Where((ZDO zdo) => hash == zdo.m_prefab)); return list.ToArray(); } public static ZDO[] GetZDOs(FiltererParameters args, HashSet prefabs) { HashSet prefabs2 = prefabs; IEnumerable zdos = ZDOMan.instance.m_objectsByID.Values.Where((ZDO zdo) => prefabs2.Contains(zdo.m_prefab)); List list = new List(); list.AddRange(FilterZdos(zdos, args)); return list.ToArray(); } public static ZDO[] GetZDOs(DataParameters args, HashSet prefabs) { HashSet prefabs2 = prefabs; IEnumerable zdos = ZDOMan.instance.m_objectsByID.Values.Where((ZDO zdo) => prefabs2.Contains(zdo.m_prefab)); List list = new List(); list.AddRange(FilterZdos(zdos, args)); return list.ToArray(); } public static ZDO[] GetZDOs(FiltererParameters args) { List list = new List(); list.AddRange(FilterZdos(ZDOMan.instance.m_objectsByID.Values, args)); return list.ToArray(); } public static ZDO[] GetZDOs(DataParameters args) { List list = new List(); list.AddRange(FilterZdos(ZDOMan.instance.m_objectsByID.Values, args)); return list.ToArray(); } public static ZDO[] GetZDOs(string id) { return GetZDOs(StringExtensionMethods.GetStableHashCode(id)); } public static ZDO[] GetZDOs(int hash) { List list = new List(); list.AddRange(ZDOMan.instance.m_objectsByID.Values.Where((ZDO zdo) => hash == zdo.m_prefab)); return list.ToArray(); } public static IEnumerable FilterZdos(IEnumerable zdos, DataParameters args) { return args.LimitZdos(args.FilterZdos(zdos, checkExcludedZones: false)); } public static IEnumerable FilterZdos(IEnumerable zdos, FiltererParameters args) { return args.LimitZdos(args.FilterZdos(zdos, checkExcludedZones: false)); } } public abstract class ExecutedEntityOperation : ExecutedOperation { protected readonly IEnumerable Ids; protected readonly DataParameters Args; protected HashSet Prefabs; protected ZDO[] ZdosToProcess; protected Dictionary Counts; protected int ProcessedCount; protected int TotalCount; protected ExecutedEntityOperation(Terminal context, IEnumerable ids, DataParameters args) { Ids = ids; Args = args; Prefabs = new HashSet(); ZdosToProcess = Array.Empty(); Counts = new Dictionary(); base..ctor(context, args.Pin); } protected override string OnInit() { Prefabs = GetPrefabsForOperation(); ZdosToProcess = EntityOperation.GetZDOs(Args, Prefabs); TotalCount = ZdosToProcess.Length; Counts = Prefabs.ToDictionary((int prefab) => prefab, (int prefab) => 0); if (TotalCount == 0) { Print(GetNoObjectsMessage()); return ""; } return GetInitMessage(); } protected override IEnumerator OnExecute(Stopwatch sw) { if (TotalCount == 0) { yield break; } int processed = 0; ZDO[] zdosToProcess = ZdosToProcess; foreach (ZDO val in zdosToProcess) { if (ProcessZDO(val)) { Counts[val.m_prefab]++; ProcessedCount++; AddPin(val.GetPosition()); } processed++; if (processed >= 10000) { processed = 0; yield return null; } } } protected override void OnEnd() { IEnumerable collection = from kvp in Counts where kvp.Value > 0 select GetCountMessage(kvp.Value, kvp.Key) into msg where !string.IsNullOrEmpty(msg) select msg; List list = new List(); list.Add(GetProcessedMessage()); list.AddRange(collection); string[] values = list.ToArray(); if (Args.Log) { Log(values); } else { Print(values, addDot: false); } PrintPins(); } protected virtual HashSet GetPrefabsForOperation() { return EntityOperation.GetPrefabs(Ids, Args.Types); } protected abstract bool ProcessZDO(ZDO zdo); protected abstract string GetNoObjectsMessage(); protected abstract string GetInitMessage(); protected abstract string GetProcessedMessage(); protected abstract string GetCountMessage(int count, int prefab); } public abstract class ExecutedOperation : BaseOperation { protected int Failed; protected ExecutedOperation(Terminal context, bool pin = false) : base(context, pin) { } public IEnumerator Execute(Stopwatch sw) { IEnumerator enumerator; try { OnStart(); enumerator = OnExecute(sw); } catch (InvalidOperationException ex) { Helper.Print(Context, User, ex.Message); OnEnd(); yield break; } yield return enumerator; PrintPins(); OnEnd(); } protected abstract IEnumerator OnExecute(Stopwatch sw); public bool Init(bool autoStart) { string text = OnInit(); if (text == "") { return false; } if (!autoStart) { text += Helper.GetStartMessage(); } Print(text); return true; } protected abstract string OnInit(); public string GetInfo() { string text = OnInit(); if (!(text != "")) { return GetType().Name; } return text; } protected virtual void OnStart() { } protected virtual void OnEnd() { } } public abstract class TimeOperation : BaseOperation { protected TimeOperation(Terminal context) : base(context) { } protected void Change(double time) { //IL_00e3: Unknown result type (might be due to invalid IL or missing references) if (time < 0.0) { Print("Error: New time would be negative."); return; } ZNet instance = ZNet.instance; long ticks = instance.GetTime().Ticks; instance.SetNetTime(time); _ = instance.GetTime().Ticks; int num = 0; int num2 = 0; Dictionary dictionary = new Dictionary(); IEnumerable timeBasedDataNames = Settings.TimeBasedDataNames; HashSet hashSet = timeBasedDataNames.Select((string par) => StringExtensionMethods.GetStableHashCode(par)).ToHashSet(); foreach (int item in hashSet) { dictionary.Add(item, 0); } foreach (ZDO value2 in ZDOMan.instance.m_objectsByID.Values) { if (!ZDOExtraData.s_longs.TryGetValue(value2.m_uid, out var value)) { continue; } bool flag = false; if (value2.m_prefab == Settings.ZoneControlHash) { num2++; foreach (int item2 in value.Keys.ToList()) { if (value[item2] != 0L) { flag = true; num++; value[item2] = (long)time; } } } foreach (int item3 in hashSet) { if (value.ContainsKey(item3) && value[item3] != 0L) { value[item3] = (long)time; dictionary[item3]++; flag = true; } } if (flag) { value2.IncreaseDataRevision(); } } if (Settings.Verbose) { Print("Updated " + num + " spawn zones in " + num2 + " of zones"); foreach (string item4 in timeBasedDataNames) { int stableHashCode = StringExtensionMethods.GetStableHashCode(item4); Print("Updated " + dictionary[stableHashCode] + " of " + item4); } } Print("Setting time to " + time.ToString("0") + "s , Day: " + EnvMan.instance.GetDay(time)); } } public abstract class ZoneOperation : ExecutedOperation { public string Operation = "BaseOperation"; protected Vector2i[] ZonesToUpgrade = Zones.GetZones(args); protected int ZoneIndex; protected int PreOperated; protected FiltererParameters Args; protected List Filterers; protected string InitString; private readonly Stopwatch LastSuccessTimer; protected ZoneOperation(Terminal context, FiltererParameters args) { Args = args; Filterers = new List(); InitString = ""; LastSuccessTimer = Stopwatch.StartNew(); base..ctor(context, args.Pin); } protected override string OnInit() { List messages = new List(); ZonesToUpgrade = Filterers.Aggregate(ZonesToUpgrade, (Vector2i[] zones, IZoneFilterer filterer) => filterer.FilterZones(zones, ref messages)); InitString += $" {ZonesToUpgrade.Length} zones"; if (messages.Count > 0) { InitString = InitString + ": " + Helper.JoinRows(messages); } InitString += "."; return InitString; } protected abstract bool ExecuteZone(Vector2i zone); protected override IEnumerator OnExecute(Stopwatch sw) { if (ZonesToUpgrade == null || ZonesToUpgrade.Length == 0) { yield break; } LastSuccessTimer.Restart(); while (ZoneIndex < ZonesToUpgrade.Length) { Vector2i zone = ZonesToUpgrade[ZoneIndex]; bool flag = ExecuteZone(zone); MoveToNextZone(flag); if (flag) { if (sw.ElapsedMilliseconds >= 100) { UpdateConsole(); yield return null; sw.Restart(); } } else { yield return null; sw.Restart(); } } UpdateConsole(); } private void MoveToNextZone(bool success) { if (success) { LastSuccessTimer.Restart(); ZoneIndex++; } else if (LastSuccessTimer.ElapsedMilliseconds >= 10000) { Failed++; LastSuccessTimer.Restart(); ZoneIndex++; } } private void UpdateConsole() { if (Settings.Verbose) { string text = (ZonesToUpgrade.Length + PreOperated).ToString(); string text2 = (ZoneIndex + PreOperated).ToString().PadLeft(text.Length, '0'); PrintOnce(Operation + ": " + text2 + "/" + text, addDot: false); } else { int num = Math.Min(100, (ZonesToUpgrade.Length == 0) ? 100 : ((int)Math.Floor(100.0 * (double)(ZoneIndex + PreOperated) / (double)(ZonesToUpgrade.Length + PreOperated)))); PrintOnce(Operation + ": " + num + "%", addDot: false); } } } public class ChangeTime : TimeOperation { public ChangeTime(Terminal context, double time) : base(context) { Change(ZNet.instance.GetTimeSeconds() + time); } } public class CountBiomes : BaseOperation { public CountBiomes(Terminal context, float frequency, FiltererParameters args) : base(context) { Count(frequency, args); } private void Count(float frequency, FiltererParameters args) { //IL_005a: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00e2: 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) if (!args.Pos.HasValue) { return; } if (args.MaxDistance == 0f) { args.MaxDistance = Settings.WorldRadius; } Dictionary dictionary = new Dictionary(); float num = (0f - (float)Math.Ceiling(args.MaxDistance / frequency)) * frequency; for (float num2 = num; num2 <= args.MaxDistance; num2 += frequency) { for (float num3 = num; num3 <= args.MaxDistance; num3 += frequency) { Vector2 val = new Vector2(num2, num3); float magnitude = ((Vector2)(ref val)).magnitude; if (magnitude < args.MinDistance || magnitude > args.MaxDistance) { continue; } Biome biome = WorldGenerator.instance.GetBiome(args.Pos.Value.x + num2, args.Pos.Value.y + num3, 0.02f, false); if (args.IsBiomeValid(biome)) { if (!dictionary.ContainsKey(biome)) { dictionary[biome] = 0; } dictionary[biome]++; } } } float total = dictionary.Values.Sum(); IEnumerable values = from kvp in dictionary orderby Enum.GetName(typeof(Biome), kvp.Key) select Enum.GetName(typeof(Biome), kvp.Key) + ": " + kvp.Value + "/" + total + " (" + ((float)kvp.Value / total).ToString("P2", CultureInfo.InvariantCulture) + ")"; Print(string.Join("\n", values)); } } public class Generate : ZoneOperation { private readonly bool Empty; public Generate(Terminal context, FiltererParameters args, bool empty) : base(context, args) { Operation = "Generate"; InitString = args.Print("Generate"); Filterers = FiltererFactory.Create(args); Empty = empty; } protected override bool ExecuteZone(Vector2i zone) { //IL_001e: 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_0029: Unknown result type (might be due to invalid IL or missing references) ZoneSystem instance = ZoneSystem.instance; if (Empty) { instance.m_generatedZones.Add(zone); return true; } if (instance.IsZoneGenerated(zone)) { return true; } GameObject val = default(GameObject); return instance.SpawnZone(zone, (SpawnMode)2, ref val); } protected override void OnEnd() { int num = ZonesToUpgrade.Length - Failed; string text = Operation + " completed. " + num + " zones generated."; if (Failed > 0) { text = text + " " + Failed + " errors."; } Print(text); } } public class CountLocations : EntityOperation { public CountLocations(Terminal context, HashSet ids, bool log, FiltererParameters args) : base(context, args.Pin) { CountPositions(ids, log, args); } private void CountPositions(HashSet ids, bool log, FiltererParameters args) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) HashSet ids2 = ids; ZoneSystem instance = ZoneSystem.instance; List list = (from l in args.FilterLocations(instance.m_locationInstances.Values) where ids2.Count() == 0 || ids2.Contains(l.m_location?.m_prefab.Name ?? "") select l).ToList(); int num = 0; Dictionary dictionary = new Dictionary(); foreach (LocationInstance item in list) { string name = item.m_location.m_prefab.Name; if (!dictionary.ContainsKey(name)) { dictionary[name] = 0; } dictionary[name]++; num++; AddPin(item.m_position); } IEnumerable collection = from kvp in dictionary orderby kvp.Key select $"{kvp.Key}: {kvp.Value}"; List list2 = new List(); list2.Add($"Total: {num}"); list2.AddRange(collection); string[] values = list2.ToArray(); if (log) { Log(values); } else { Print(values, addDot: false); } PrintPins(); } } public class DistributeLocations : ExecutedOperation { private readonly string[] Ids = Array.Empty(); public float Chance = 1f; public int Added; private int Total; public static HashSet AllowedZones = new HashSet(); private readonly Dictionary Counts = new Dictionary(); public DistributeLocations(Terminal context, HashSet ids, FiltererParameters args) { //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) HashSet ids2 = ids; FiltererParameters args2 = args; base..ctor(context, args2.Start); List list = new List(); list.AddRange(from loc in ZoneSystem.instance.m_locations.Where(Helper.IsValid) where ids2.Contains(loc.m_prefab.Name) where loc.m_enable && loc.m_quantity != 0 where (loc.m_biome & args2.BiomeMask) > 0 orderby loc.m_prioritized descending select loc.m_prefab.Name); Ids = list.ToArray(); if (Ids.Length == 0) { Print("Error: No valid location ids."); return; } Chance = args2.Chance; args2 = new FiltererParameters(args2) { TargetZones = TargetZones.All }; List source = FiltererFactory.Create(args2); List messages = new List(); HashSet hashSet = new HashSet(); foreach (Vector2i item in source.Aggregate(Zones.GetZones(args2), (Vector2i[] zones, IZoneFilterer filterer) => filterer.FilterZones(zones, ref messages)).Distinct()) { hashSet.Add(item); } AllowedZones = hashSet; } protected override IEnumerator OnExecute(Stopwatch sw) { if (Ids.Length == 0) { Print("No locations to generate."); yield break; } ClearNotSpawned(Ids); int counter = 0; string[] ids = Ids; foreach (string id in ids) { counter++; ZoneSystem zs = ZoneSystem.instance; ZoneLocation[] array = zs.m_locations.Where((ZoneLocation location) => Helper.IsValid(location) && location.m_prefab.Name == id).ToArray(); if (array.Length == 0) { continue; } Print("Generating locations " + id + ". This may take a while..."); int value; int before = (Counts.TryGetValue(id, out value) ? value : 0); ZoneLocation[] array2 = array; foreach (ZoneLocation location2 in array2) { yield return GenerateLocationsTimeSliced(location2, sw); } if (Chance < 1f) { zs.m_locationInstances = zs.m_locationInstances.Where((KeyValuePair kvp) => kvp.Value.m_placed || kvp.Value.m_location.m_prefab.Name != id || FiltererParameters.random.NextDouble() < (double)Chance).ToDictionary((KeyValuePair kvp) => kvp.Key, (KeyValuePair kvp) => kvp.Value); } foreach (KeyValuePair item in zs.m_locationInstances.Where((KeyValuePair kvp) => kvp.Value.m_location.m_prefab.Name == id && !kvp.Value.m_placed).ToList()) { AddPin(item.Value.m_position); } Total += Count(id); Added += Total - before; } if (Object.op_Implicit((Object)(object)Hud.instance)) { Hud.instance.m_loadingIndicator.SetShowProgress(false); } } private void ClearNotSpawned(string[] ids) { Counts.Clear(); foreach (string text in ids) { Counts[text] = Count(text); } ZoneSystem instance = ZoneSystem.instance; instance.m_locationInstances = instance.m_locationInstances.Where((KeyValuePair kvp) => kvp.Value.m_placed || !Counts.ContainsKey(kvp.Value.m_location.m_prefab.Name)).ToDictionary((KeyValuePair kvp) => kvp.Key, (KeyValuePair kvp) => kvp.Value); DummyClearNonPlacedLocations.Skip = true; instance.ClearNonPlacedLocations(); DummyClearNonPlacedLocations.Skip = false; } private int Count(string id) { string id2 = id; return ZoneSystem.instance.m_locationInstances.Count((KeyValuePair kvp) => kvp.Value.m_location.m_prefab.Name == id2); } protected override void OnEnd() { if (Added >= 0) { Print($"{Added} locations{LocationOperation.IdString(Ids)} added to the world (total amount in the world: {Total})."); } else { Print($"{Math.Abs(Added)} locations{LocationOperation.IdString(Ids)} removed from the world (total amount in the world: {Total})."); } } protected override string OnInit() { return "Generate locations" + LocationOperation.IdString(Ids) + "."; } private IEnumerator GenerateLocationsTimeSliced(ZoneLocation location, Stopwatch timeSliceStopwatch) { ZoneSystem zs = ZoneSystem.instance; int num = WorldGenerator.instance.GetSeed() + StringExtensionMethods.GetStableHashCode(location.m_prefab.Name); State state = Random.state; Random.InitState(num); int errorLocationInZone = 0; int errorCenterDistance = 0; int errorBiome = 0; int errorBiomeArea = 0; int errorAlt = 0; int errorForest = 0; int errorSimilar = 0; int errorNotSimilar = 0; int errorTerrainDelta = 0; int errorVegetation = 0; float maxRadius = Mathf.Max(location.m_exteriorRadius, location.m_interiorRadius); int attempts = (location.m_prioritized ? 200000 : 100000); int iterations = 0; int placed = zs.CountNrOfLocation(location); float maxRange = 10000f; if (location.m_centerFirst) { maxRange = location.m_minDistance; } if (!location.m_unique || placed <= 0) { zs.s_tempVeg.Clear(); int i = 0; Color val = default(Color); float num5 = default(float); Vector3 val2 = default(Vector3); Color val4 = default(Color); while (i < attempts && placed < location.m_quantity) { if (timeSliceStopwatch.Elapsed.TotalSeconds >= (double)zs.m_timeSlicedGenerationTimeBudget) { State insideState2 = Random.state; Random.state = state; yield return null; timeSliceStopwatch.Restart(); state = Random.state; Random.state = insideState2; } Vector2i zoneID = ZoneSystem.GetRandomZone(maxRange); if (location.m_centerFirst) { maxRange += 1f; } int num2; if (zs.m_locationInstances.ContainsKey(zoneID)) { num2 = errorLocationInZone + 1; errorLocationInZone = num2; } else if (AllowedZones.Contains(zoneID)) { Vector3 zonePos = ZoneSystem.GetZonePos(zoneID); BiomeArea biomeArea = WorldGenerator.instance.GetBiomeArea(zonePos); if ((location.m_biomeArea & biomeArea) == 0) { num2 = errorBiomeArea + 1; errorBiomeArea = num2; } else { for (int j = 0; j < 20; num2 = j + 1, j = num2) { if (timeSliceStopwatch.Elapsed.TotalSeconds >= (double)zs.m_timeSlicedGenerationTimeBudget) { State insideState2 = Random.state; Random.state = state; yield return null; timeSliceStopwatch.Restart(); state = Random.state; Random.state = insideState2; } num2 = iterations + 1; iterations = num2; Vector3 randomPointInZone = ZoneSystem.GetRandomPointInZone(zoneID, maxRadius); float magnitude = ((Vector3)(ref randomPointInZone)).magnitude; if (location.m_minDistance != 0f && magnitude < location.m_minDistance) { num2 = errorCenterDistance + 1; errorCenterDistance = num2; continue; } if (location.m_maxDistance != 0f && magnitude > location.m_maxDistance) { num2 = errorCenterDistance + 1; errorCenterDistance = num2; continue; } Biome biome = WorldGenerator.instance.GetBiome(randomPointInZone); if ((location.m_biome & biome) == 0) { num2 = errorBiome + 1; errorBiome = num2; continue; } randomPointInZone.y = WorldGenerator.instance.GetHeight(randomPointInZone.x, randomPointInZone.z, ref val); float num3 = (float)((double)randomPointInZone.y - 30.0); if (num3 < location.m_minAltitude || num3 > location.m_maxAltitude) { num2 = errorAlt + 1; errorAlt = num2; continue; } if (location.m_inForest) { float forestFactor = WorldGenerator.GetForestFactor(randomPointInZone); if (forestFactor < location.m_forestTresholdMin || forestFactor > location.m_forestTresholdMax) { num2 = errorForest + 1; errorForest = num2; continue; } } if (location.m_minDistanceFromCenter > 0f || location.m_maxDistanceFromCenter > 0f) { float num4 = Utils.LengthXZ(randomPointInZone); if ((location.m_minDistanceFromCenter > 0f && num4 < location.m_minDistanceFromCenter) || (location.m_maxDistanceFromCenter > 0f && num4 > location.m_maxDistanceFromCenter)) { continue; } } WorldGenerator.instance.GetTerrainDelta(randomPointInZone, location.m_exteriorRadius, ref num5, ref val2); if (num5 > location.m_maxTerrainDelta || num5 < location.m_minTerrainDelta) { num2 = errorTerrainDelta + 1; errorTerrainDelta = num2; continue; } if (location.m_minDistanceFromSimilar > 0f && zs.HaveLocationInRange(location.m_prefab.Name, location.m_group, randomPointInZone, location.m_minDistanceFromSimilar, false)) { num2 = errorSimilar + 1; errorSimilar = num2; continue; } if (location.m_maxDistanceFromSimilar > 0f && !zs.HaveLocationInRange(location.m_prefab.Name, location.m_groupMax, randomPointInZone, location.m_maxDistanceFromSimilar, true)) { num2 = errorNotSimilar + 1; errorNotSimilar = num2; continue; } float a = val.a; if (location.m_minimumVegetation > 0f && a <= location.m_minimumVegetation) { num2 = errorVegetation + 1; errorVegetation = num2; continue; } if (location.m_maximumVegetation >= 1f || a < location.m_maximumVegetation) { if (location.m_surroundCheckVegetation) { float num6 = 0f; for (int k = 0; k < location.m_surroundCheckLayers; k++) { float num7 = (float)(k + 1) / (float)location.m_surroundCheckLayers * location.m_surroundCheckDistance; for (int l = 0; l < 6; l++) { float num8 = (float)l / 6f * (float)Math.PI * 2f; Vector3 val3 = randomPointInZone + new Vector3(Mathf.Sin(num8) * num7, 0f, Mathf.Cos(num8) * num7); WorldGenerator.instance.GetHeight(val3.x, val3.z, ref val4); float num9 = (location.m_surroundCheckDistance - num7) / (location.m_surroundCheckDistance * 2f); num6 += val4.a * num9; } } zs.s_tempVeg.Add(num6); if (zs.s_tempVeg.Count < 10) { continue; } float num10 = zs.s_tempVeg.Max(); float num11 = zs.s_tempVeg.Average(); float num12 = num11 + (num10 - num11) * location.m_surroundBetterThanAverage; if (num6 < num12) { continue; } } zs.RegisterLocation(location, randomPointInZone, false); num2 = placed + 1; placed = num2; break; } num2 = errorVegetation + 1; errorVegetation = num2; } } } num2 = i + 1; i = num2; } if (placed < location.m_quantity) { Print($"Failed to place all {location.m_prefab.Name}, placed {placed} out of {location.m_quantity}."); if (Settings.VerboseLocations) { if (errorLocationInZone > 0) { Print("Failed " + errorLocationInZone + " times because the zone already had a location."); } if (errorCenterDistance > 0) { Print("Failed " + errorCenterDistance + " times because the location had wrong distance from the world center."); } if (errorBiome > 0) { Print("Failed " + errorBiome + " times because the biome was wrong."); } if (errorBiomeArea > 0) { Print("Failed " + errorBiomeArea + " times because the biome area was wrong."); } if (errorAlt > 0) { Print("Failed " + errorAlt + " times because the altitude was wrong."); } if (errorForest > 0) { Print("Failed " + errorForest + " times because the forest factor was wrong."); } if (errorSimilar > 0) { Print("Failed " + errorSimilar + " times because there was a similar location too close."); } if (errorNotSimilar > 0) { Print("Failed " + errorNotSimilar + " times because there was no similar location close enough."); } if (errorTerrainDelta > 0) { Print("Failed " + errorTerrainDelta + " times because the terrain delta was too high."); } if (errorVegetation > 0) { Print("Failed " + errorVegetation + " times because the vegetation factor was wrong."); } } } } Random.state = state; } } [HarmonyPatch(typeof(ZoneSystem), "ClearNonPlacedLocations")] public class DummyClearNonPlacedLocations { public static bool Skip; private static bool Prefix() { return !Skip; } } public class FixLocations : BaseOperation { private int Fixed; public FixLocations(Terminal context, FiltererParameters args) : base(context, args.Pin) { Execute(); } private void Execute() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) foreach (ZDO value in ZDOMan.instance.m_objectsByID.Values) { if (value.m_prefab != LocationProxyHash) { continue; } int @int = value.GetInt(ZDOVars.s_location, 0); ZoneLocation location = ZoneSystem.instance.GetLocation(@int); if (location == null || !Helper.IsValid(location)) { continue; } Vector2i zone = ZoneSystem.GetZone(value.m_position); if (!ZoneSystem.instance.m_locationInstances.ContainsKey(zone)) { ZoneSystem.instance.m_locationInstances[zone] = new LocationInstance { m_location = location, m_position = value.m_position, m_placed = true }; Fixed++; AddPin(value.m_position); if (Settings.Verbose) { Print($"Fixed location {location.m_prefabName} at {zone}"); } } } Print($"{Fixed} locations fixed."); PrintPins(); } } public class ListLocationPositions : EntityOperation { public ListLocationPositions(Terminal context, HashSet ids, bool log, FiltererParameters args) : base(context, args.Pin) { ListPositions(ids, log, args); } private void ListPositions(HashSet ids, bool log, FiltererParameters args) { //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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00b9: Unknown result type (might be due to invalid IL or missing references) HashSet ids2 = ids; ZoneSystem instance = ZoneSystem.instance; List list = new List(); List list2 = (from l in args.FilterLocations(instance.m_locationInstances.Values) where ids2.Count() == 0 || ids2.Contains(l.m_location?.m_prefab.Name ?? "") select l).ToList(); if (list2.Count == 0) { Print("No locations found."); PrintPins(); return; } foreach (LocationInstance item in list2) { string name = item.m_location.m_prefab.Name; list.Add($"{name}: {Helper.PrintVectorXZY(item.m_position)} {WorldGenerator.instance.GetBiome(item.m_position)}"); AddPin(item.m_position); } if (log) { Log(list); } else { Print(list, addDot: false); } PrintPins(); } } public abstract class LocationOperation : ZoneOperation { protected int Operated; protected string Verb = ""; private static List? ServerIds = null; private static int ServerIdsHash = 0; private static readonly Dictionary?>> Named = CreateNamed(); private static readonly List Parameters; private static readonly Func> AutoComplete; public LocationOperation(Terminal context, FiltererParameters args) : base(context, args) { args.TargetZones = TargetZones.Generated; Filterers = FiltererFactory.Create(args); } protected override bool ExecuteZone(Vector2i zone) { //IL_000c: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) ZoneSystem instance = ZoneSystem.instance; if (!instance.m_locationInstances.TryGetValue(zone, out var value)) { return true; } if (instance.IsZoneLoaded(zone)) { if (ExecuteLocation(zone, value)) { Operated++; } Zones.ReleaseZone(zone); return true; } Zones.PokeZone(zone); return false; } protected abstract bool ExecuteLocation(Vector2i zone, LocationInstance location); protected override void OnEnd() { string text = $"{Operation} completed. {Operated} locations {Verb}."; if (Failed > 0) { text = text + " " + Failed + " errors."; } Print(text); } protected void SpawnLocation(Vector2i zone, LocationInstance location, float clearRadius) { //IL_000c: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) ZoneSystem instance = ZoneSystem.instance; GameObject root = instance.m_zones[zone].m_root; Vector3 zonePos = ZoneSystem.GetZonePos(zone); Heightmap heightmap = Zones.GetHeightmap(root); Helper.ClearAreaForLocation(zone, location, clearRadius); float radius = ((Args.TerrainReset == 0f) ? location.m_location.m_exteriorRadius : Args.TerrainReset); ResetTerrain.Execute(location.m_position, radius); instance.m_tempSpawnedObjects.Clear(); instance.m_tempClearAreas.Clear(); instance.PlaceLocations(zone, zonePos, root.transform, heightmap, instance.m_tempClearAreas, (SpawnMode)2, instance.m_tempSpawnedObjects); foreach (GameObject tempSpawnedObject in instance.m_tempSpawnedObjects) { Object.Destroy((Object)(object)tempSpawnedObject); } instance.m_tempSpawnedObjects.Clear(); } public static HashSet Ids(IEnumerable ids, IEnumerable ignore) { IEnumerable ids2 = ids; IEnumerable ignore2 = ignore; if (ids2.Count() == 0) { return new HashSet(); } HashSet hashSet = new HashSet(); foreach (string item in from id in AllIds() where ids2.Any((string x) => Helper.IsIncluded(x, id)) && (ignore2.Count() == 0 || !ignore2.Contains(id)) select id) { hashSet.Add(item); } return hashSet; } public static List AllIds() { if (ServerIds != null) { return ServerIds; } List list = new List(); list.AddRange((from location in ZoneSystem.instance.m_locations.Where(Helper.IsValid) select location.m_prefab.Name).Distinct()); return list; } public static void SetServerIds(string? data) { if (data == null) { ServerIds = null; ServerIdsHash = 0; return; } int stableHashCode = StringExtensionMethods.GetStableHashCode(data); if (ServerIdsHash != stableHashCode) { ServerIdsHash = stableHashCode; List list = new List(); list.AddRange(from s in data.Split(new char[1] { '|' }) where !string.IsNullOrEmpty(s) select s); ServerIds = list; } } public static int GetServerIdsHash() { return ServerIdsHash; } public static string IdString(IEnumerable ids) { if (ids.Count() == AllIds().Count) { return ""; } if (ids.Count() == 0) { return ""; } return " " + Helper.JoinRows(ids); } public static void Register(string name) { CommandWrapper.Register(name, AutoComplete, Named); } private static Dictionary?>> CreateNamed() { Dictionary?>> autoComplete = FiltererParameters.GetAutoComplete(); autoComplete["id"] = (int index) => AllIds(); autoComplete["ignore"] = (int index) => AllIds(); return autoComplete; } static LocationOperation() { List list = new List(); list.AddRange(from x in FiltererParameters.Parameters.Concat(new <>z__ReadOnlyArray(new string[2] { "id", "ignore" })) orderby x select x); Parameters = list; AutoComplete = (int index) => (index != 0) ? Parameters : AllIds(); } } public class RegisterLocation : BaseOperation { public RegisterLocation(Terminal context, string id, Vector3 position) : base(context) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) Register(id, position); } private void Register(string id, Vector3 position) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) int stableHashCode = StringExtensionMethods.GetStableHashCode(id); ZoneSystem instance = ZoneSystem.instance; if (!instance.m_locationsByHash.TryGetValue(stableHashCode, out var value)) { throw new InvalidOperationException("Location " + id + " not found."); } Vector2i zone = ZoneSystem.GetZone(position); int num = ZDOMan.instance.SectorToIndex(zone); List list = ZDOMan.instance.m_objectsBySector[num]; if (list != null) { foreach (ZDO item in list) { if (item.m_prefab == LocationProxyHash && item.GetInt(LocationHash, 0) == stableHashCode) { position = item.GetPosition(); Print("Using position " + Helper.PrintVectorXZY(position) + " of already existing location."); break; } } } instance.m_locationInstances.Remove(zone); instance.RegisterLocation(value, position, instance.IsZoneGenerated(zone)); AddPin(position); Print("Location " + id + " registered to " + Helper.PrintVectorXZY(position) + "."); Print("To actually spawn the registered locations, reset the zone or spawn them manually."); } } public class RemoveLocations : ExecutedOperation { private readonly HashSet Ids; private readonly FiltererParameters Args; public RemoveLocations(Terminal context, HashSet ids, FiltererParameters args) : base(context, args.Start) { Args = new FiltererParameters(args) { TargetZones = TargetZones.All }; Ids = ids; } protected override void OnStart() { if (Args.SafeZones != 0) { new PlayerBaseFilterer(Args.SafeZones).CalculateExcluded(); } } private int RemoveSpawned() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0203: 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_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0241: 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_026e: Unknown result type (might be due to invalid IL or missing references) ZoneSystem instance = ZoneSystem.instance; IEnumerable zdos = ZDOMan.instance.m_objectsByID.Values.Where((ZDO zdo) => LocationProxyHash == zdo.m_prefab); zdos = Args.FilterZdos(zdos, checkExcludedZones: true); int num = 0; foreach (ZDO item in zdos) { Vector2i zone = ZoneSystem.GetZone(item.GetPosition()); string text = "???"; if (instance.m_locationsByHash.TryGetValue(item.GetInt(LocationHash, 0), out var value)) { text = value.m_prefab.Name; if (!Ids.Contains(text)) { continue; } float distance = value.m_exteriorRadius; if (Args.ObjectReset.HasValue) { distance = Args.ObjectReset.Value; } AddPin(item.GetPosition()); Helper.ClearZDOsWithinDistance(zone, item.GetPosition(), distance); } Helper.RemoveZDO(item); num++; instance.m_locationInstances.Remove(zone); if (Settings.Verbose) { Print($"Location {text} removed at {zone}."); } } foreach (KeyValuePair item2 in instance.m_locationInstances.Where((KeyValuePair kvp) => Args.FilterPosition(kvp.Value.m_position, checkExcludedZones: true)).ToList()) { if (!Args.Roll()) { continue; } Vector2i key = item2.Key; ZoneLocation location = item2.Value.m_location; string name = location.m_prefab.Name; if (Ids.Count <= 0 || Ids.Contains(name)) { float distance2 = location.m_exteriorRadius; if (Args.ObjectReset.HasValue) { distance2 = Args.ObjectReset.Value; } Helper.ClearZDOsWithinDistance(key, item2.Value.m_position, distance2); AddPin(item2.Value.m_position); float radius = ((Args.TerrainReset == 0f) ? location.m_exteriorRadius : Args.TerrainReset); ResetTerrain.Execute(item2.Value.m_position, radius); num++; instance.m_locationInstances.Remove(key); if (Settings.Verbose) { Print($"Location {name} removed at {key}."); } } } return num; } private int RemoveNotSpawned() { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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) ZoneSystem instance = ZoneSystem.instance; List list = FiltererFactory.Create(Args); List list2 = new List(1 + list.Count); list2.AddRange(list); list2.Add(new LocationFilterer(Ids, OnlyMissing: false)); List messages = new List(); Args.TargetZones = TargetZones.All; Vector2i[] array = list2.Aggregate(Zones.GetZones(Args), (Vector2i[] zones, IZoneFilterer filterer) => filterer.FilterZones(zones, ref messages)); int num = 0; Vector2i[] array2 = array; for (int i = 0; i < array2.Length; i++) { Vector2i key = array2[i]; if (instance.m_locationInstances.TryGetValue(key, out var value)) { num++; AddPin(value.m_position); if (Settings.Verbose) { Print("Location " + value.m_location.m_prefab.Name + " removed at " + ((object)(Vector2i)(ref key)).ToString()); } instance.m_locationInstances.Remove(key); } } return num; } protected override IEnumerator OnExecute(Stopwatch sw) { int num = RemoveSpawned() + RemoveNotSpawned(); Print($"Removed {num} locations."); yield break; } protected override string OnInit() { return Args.Print("Remove locations" + LocationOperation.IdString(Ids) + " from"); } } public class RegenerateLocations : LocationOperation { public RegenerateLocations(Terminal context, HashSet ids, FiltererParameters args) : base(context, args) { Operation = "Reset locations"; InitString = args.Print("Reset locations at"); Verb = "reseted"; List filterers = Filterers; List list = new List(1 + filterers.Count); list.AddRange(filterers); list.Add(new LocationFilterer(ids, OnlyMissing: false)); Filterers = list; } protected override bool ExecuteLocation(Vector2i zone, LocationInstance location) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_007e: 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) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) if (!location.m_placed) { return false; } location.m_placed = false; ZoneSystem.instance.m_locationInstances[zone] = location; ZoneLocation location2 = location.m_location; if (location2 != null) { _ = location2.m_prefab; if (0 == 0) { float clearRadius = location.m_location.m_exteriorRadius; if (Args.ObjectReset.HasValue) { clearRadius = Args.ObjectReset.Value; } SpawnLocation(zone, location, clearRadius); AddPin(location.m_position); if (Settings.Verbose) { Print("Location " + location.m_location.m_prefab.Name + " reseted at " + ((object)(Vector2i)(ref zone)).ToString()); } return true; } } Print("Location " + (location.m_location?.m_prefab.Name ?? "???") + " is missing at " + ((object)(Vector2i)(ref zone)).ToString()); return false; } } public class SpawnLocations : LocationOperation { private readonly HashSet Id; public SpawnLocations(Terminal context, HashSet ids, FiltererParameters args) : base(context, args) { Operation = "Spawn missing locations"; InitString = args.Print("Spawn missing locations to"); Verb = "spawned to already generated areas"; args.Chance = 1f; Id = ids; } protected override void OnStart() { LocationFilterer locationFilterer = new LocationFilterer(Id, OnlyMissing: true); List messages = new List(); ZonesToUpgrade = locationFilterer.FilterZones(ZonesToUpgrade, ref messages); } protected override bool ExecuteLocation(Vector2i zone, LocationInstance location) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) if (location.m_placed) { return false; } ZoneLocation location2 = location.m_location; if (location2 != null) { _ = location2.m_prefab; if (0 == 0) { float clearRadius = (location.m_location.m_clearArea ? location.m_location.m_exteriorRadius : 0f); if (Args.ObjectReset.HasValue) { clearRadius = Args.ObjectReset.Value; } SpawnLocation(zone, location, clearRadius); AddPin(location.m_position); if (Settings.Verbose) { Print("Location " + location.m_location.m_prefab.Name + " spawned at " + ((object)(Vector2i)(ref zone)).ToString()); } return true; } } Print("Location " + (location.m_location?.m_prefab.Name ?? "???") + " is missing at " + ((object)(Vector2i)(ref zone)).ToString()); return false; } } public class SwapLocations : EntityOperation { public SwapLocations(Terminal context, IEnumerable ids, DataParameters args) : base(context, args.Pin) { Swap(ids, args); } private void Swap(IEnumerable ids, DataParameters args) { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) int stableHashCode = StringExtensionMethods.GetStableHashCode(ids.FirstOrDefault()); HashSet prefabs = (from id in ids.Skip(1) select StringExtensionMethods.GetStableHashCode(id)).ToHashSet(); int num = 0; ZDO[] array = (from zdo in EntityOperation.GetZDOs(args) where LocationProxyHash == zdo.m_prefab select zdo).ToArray(); foreach (ZDO val in array) { if (prefabs.Contains(val.GetInt(LocationHash, 0))) { num++; if (!val.IsOwner()) { val.SetOwner(ZDOMan.GetSessionID()); } val.Set(LocationHash, stableHashCode, false); AddPin(val.GetPosition()); Refresh(val); } } Dictionary locationInstances = ZoneSystem.instance.m_locationInstances; ZoneLocation location = ZoneSystem.instance.m_locationsByHash[stableHashCode]; KeyValuePair[] array2 = locationInstances.Where(delegate(KeyValuePair kvp) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) HashSet hashSet = prefabs; ZoneLocation location2 = kvp.Value.m_location; if (!hashSet.Contains((location2 != null) ? location2.Hash : 0)) { HashSet hashSet2 = prefabs; ZoneLocation location3 = kvp.Value.m_location; return hashSet2.Contains((location3 != null) ? StringExtensionMethods.GetStableHashCode(location3.m_prefab.Name) : 0); } return true; }).ToArray(); KeyValuePair[] array3 = array2; for (int i = 0; i < array3.Length; i++) { KeyValuePair keyValuePair = array3[i]; LocationInstance value = locationInstances[keyValuePair.Key]; value.m_location = location; locationInstances[keyValuePair.Key] = value; } int num2 = array2.Length; Print($"Swapped {num} location objects and {num2} location entries.", addDot: false); PrintPins(); } private static void Refresh(ZDO zdo) { if (ZNetScene.instance.m_instances.TryGetValue(zdo, out var value)) { GameObject val = ZNetScene.instance.CreateObject(zdo); Object.Destroy((Object)(object)((Component)value).gameObject); ZNetScene.instance.m_instances[zdo] = val.GetComponent(); } } } public class UnregisterLocation : BaseOperation { public UnregisterLocation(Terminal context, Vector3 position) : base(context) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) Register(position); } private void Register(Vector3 position) { //IL_0005: 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_000b: 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_0068: 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_0042: 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) ZoneSystem instance = ZoneSystem.instance; Vector2i zone = ZoneSystem.GetZone(position); if (instance.m_locationInstances.TryGetValue(zone, out var value)) { Print("Location $" + value.m_location.m_prefabName + " removed from " + Helper.PrintVectorXZY(value.m_position) + "."); } else { Print($"No location registered in zone {zone}."); } } } public class CleanChests : EntityOperation { public CleanChests(Terminal context, ZDO[] zdos, bool pin, bool alwaysPrint) : base(context, pin) { Clean(zdos, alwaysPrint); } private void Clean(ZDO[] zdos, bool alwaysPrint) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) int num = 0; foreach (ZDO val in zdos) { string @string = val.GetString(ZDOVars.s_items, ""); if (@string == "") { continue; } ZPackage from = new ZPackage(@string); ZPackage val2 = new ZPackage(); int num2 = CleanChest(from, val2); if (num2 != 0) { AddPin(val.m_position); num += num2; if (!val.IsOwner()) { val.SetOwner(ZDOMan.GetSessionID()); } val.Set(ZDOVars.s_items, val2.GetBase64()); } } if (alwaysPrint || num > 0) { Print($"Removed {num} missing object{EntityOperation.S(num)} from chests"); } } private int CleanChest(ZPackage from, ZPackage to) { //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) int num = from.ReadInt(); if (num == 0) { return 0; } to.Write(num); int num2 = from.ReadInt(); to.Write(num2); int num3 = 0; try { for (int i = 0; i < num2; i++) { string text = from.ReadString(); if (ZNetScene.instance.m_namedPrefabs.ContainsKey(StringExtensionMethods.GetStableHashCode(text))) { to.Write(text); to.Write(from.ReadInt()); to.Write(from.ReadSingle()); to.Write(from.ReadVector2i()); to.Write(from.ReadBool()); if (num >= 101) { to.Write(from.ReadInt()); } if (num >= 102) { to.Write(from.ReadInt()); } if (num >= 103) { to.Write(from.ReadLong()); to.Write(from.ReadString()); } if (num >= 104) { int num4 = from.ReadInt(); to.Write(num4); for (int j = 0; j < num4; j++) { to.Write(from.ReadString()); to.Write(from.ReadString()); } } if (num >= 105) { to.Write(from.ReadInt()); } if (num >= 106) { to.Write(from.ReadBool()); } continue; } num3++; from.ReadInt(); from.ReadSingle(); from.ReadVector2i(); from.ReadBool(); if (num >= 101) { from.ReadInt(); } if (num >= 102) { from.ReadInt(); } if (num >= 103) { from.ReadLong(); from.ReadString(); } if (num >= 104) { int num5 = from.ReadInt(); for (int k = 0; k < num5; k++) { from.ReadString(); from.ReadString(); } } if (num >= 105) { from.ReadInt(); } if (num >= 106) { from.ReadBool(); } } } catch { num3 = num2; } if (num3 > 0) { to.SetPos(4); to.Write(num2 - num3); } return num3; } } public class CleanDungeons : EntityOperation { public CleanDungeons(Terminal context, ZDO[] zdos, bool pin, bool alwaysPrint) : base(context, pin) { Clean(zdos, alwaysPrint); } private void Clean(ZDO[] zdos, bool alwaysPrint) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) int num = 0; foreach (ZDO val in zdos) { if (val.GetInt(ZDOVars.s_rooms, 0) != 0) { AddPin(val.m_position); ZDOMan.instance.ConvertDungeonRooms(new List(1) { val }); Print("Optimized dungeon at " + Helper.PrintVectorXZY(val.GetPosition()) + "."); num++; } } if (alwaysPrint || num > 0) { Print($"Optimized {num} dungeon{EntityOperation.S(num)}."); } } } public class CleanDuplicates : EntityOperation { public CleanDuplicates(Terminal context, bool pin, bool alwaysPrint) : base(context, pin) { Clean(alwaysPrint); } private void Clean(bool alwaysPrint) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) HashSet generatedZones = ZoneSystem.instance.m_generatedZones; HashSet hashSet = new HashSet(); foreach (Vector2i item in generatedZones) { List zDOs = Helper.GetZDOs(item); if (zDOs == null) { continue; } for (int i = 0; i < zDOs.Count; i++) { ZDO val = zDOs[i]; for (int j = i + 1; j < zDOs.Count; j++) { ZDO val2 = zDOs[j]; if (val.m_prefab == val2.m_prefab && val.m_position == val2.m_position && val.m_rotation == val2.m_rotation) { hashSet.Add(val2); } } } } HashSet hashSet2 = new HashSet(); ZNetScene instance = ZNetScene.instance; foreach (ZDO item2 in hashSet) { if (!hashSet2.Contains(item2.m_position)) { AddPin(item2.m_position); hashSet2.Add(item2.m_position); } if (Settings.Verbose) { GameObject prefab = instance.GetPrefab(item2.m_prefab); Print($"Removed duplicate object {((prefab != null) ? ((Object)prefab).name : null)} at {item2.m_position}."); } Helper.RemoveZDO(item2); } if (alwaysPrint || hashSet.Count > 0) { Print($"Removed {hashSet.Count} duplicated object{EntityOperation.S(hashSet.Count)}."); } } } public class CleanHealth : EntityOperation { private static readonly int WearNTearField = StringExtensionMethods.GetStableHashCode("WearNTear.m_health"); private static readonly HashSet Structures = new HashSet(); private static readonly HashSet Characters = new HashSet(); public CleanHealth(Terminal context, ZDO[] zdos, bool pin, bool alwaysPrint) : base(context, pin) { Clean(zdos, alwaysPrint); } private void Clean(ZDO[] zdos, bool alwaysPrint) { ZNetScene instance = ZNetScene.instance; FindPrefabs(); int num = 0; ZDO[] array = zdos; foreach (ZDO val in array) { if (!Structures.Contains(val.m_prefab)) { continue; } float @float = val.GetFloat(ZDOVars.s_health, 0f); if (@float <= 0f) { continue; } float float2 = val.GetFloat(WearNTearField, 0f); if (!(float2 > 0f) || @float == float2) { GameObject prefab = instance.GetPrefab(val.m_prefab); WearNTear obj = ((prefab != null) ? prefab.GetComponent() : null); if (obj != null && obj.m_health == @float) { val.SetOwner(ZDOMan.GetSessionID()); val.RemoveFloat(ZDOVars.s_health); val.IncreaseDataRevision(); num++; } } } if (alwaysPrint || num > 0) { Print($"Cleared {num} health value{EntityOperation.S(num)} from structure."); } num = 0; array = zdos; foreach (ZDO val2 in array) { if (!Characters.Contains(val2.m_prefab)) { continue; } float float3 = val2.GetFloat(ZDOVars.s_health, 0f); if (!(float3 <= 0f)) { float float4 = val2.GetFloat(ZDOVars.s_maxHealth, 0f); if (float3 == float4) { val2.SetOwner(ZDOMan.GetSessionID()); val2.RemoveFloat(ZDOVars.s_health); val2.IncreaseDataRevision(); num++; } } } if (alwaysPrint || num > 0) { Print($"Cleared {num} health value{EntityOperation.S(num)} from creatures."); } } private void FindPrefabs() { if (Structures.Count > 0) { return; } foreach (KeyValuePair namedPrefab in ZNetScene.instance.m_namedPrefabs) { if (Object.op_Implicit((Object)(object)namedPrefab.Value.GetComponent())) { Structures.Add(namedPrefab.Key); } if (Object.op_Implicit((Object)(object)namedPrefab.Value.GetComponent())) { Characters.Add(namedPrefab.Key); } } } } public class CleanLocations : EntityOperation { public CleanLocations(Terminal context, ZDO[] zdos, bool pin, bool alwaysPrint) : base(context, pin) { Clean(zdos, alwaysPrint); } private void Clean(ZDO[] zdos, bool alwaysPrint) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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) _ = ZNetScene.instance; ZoneSystem instance = ZoneSystem.instance; List list = (from x in instance.m_locationInstances.Where(delegate(KeyValuePair x) { //IL_0002: 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_003b: Unknown result type (might be due to invalid IL or missing references) AssetID? val2 = x.Value.m_location?.m_prefab.m_assetID; return !val2.HasValue || !Runtime.Loader.IsAvailable(val2.Value); }) select x.Key).ToList(); foreach (Vector2i item in list) { instance.m_locationInstances.Remove(item); } if (alwaysPrint || list.Count > 0) { Print($"Removed {list.Count} missing location entries."); } int num = 0; foreach (ZDO val in zdos) { if (val.m_prefab == LocationProxyHash && instance.GetLocation(val.GetInt(LocationHash, 0)) == null) { Helper.RemoveZDO(val); num++; } } if (alwaysPrint || num > 0) { Print($"Removed {num} missing location object{EntityOperation.S(num)}."); } } } public class CleanObjects : EntityOperation { public CleanObjects(Terminal context, ZDO[] zdos, bool pin, bool alwaysPrint) : base(context, pin) { Clean(zdos, alwaysPrint); } private void Clean(ZDO[] zdos, bool alwaysPrint) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) ZNetScene instance = ZNetScene.instance; int num = 0; foreach (ZDO val in zdos) { if (!instance.m_namedPrefabs.ContainsKey(val.m_prefab)) { AddPin(val.m_position); Helper.RemoveZDO(val); num++; if (Settings.Verbose) { Print($"Removed missing object {val.m_prefab} at {val.m_position}."); } } } if (alwaysPrint || num > 0) { Print($"Removed {num} missing object{EntityOperation.S(num)}."); } } } public class CleanSpawns : EntityOperation { public CleanSpawns(Terminal context, ZDO[] zdos, bool pin, bool alwaysPrint) : base(context, pin) { Clean(zdos, alwaysPrint); } private void Clean(ZDO[] zdos, bool alwaysPrint) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0074: Unknown result type (might be due to invalid IL or missing references) int stableHashCode = StringExtensionMethods.GetStableHashCode(((Object)ZoneSystem.instance.m_zoneCtrlPrefab).name); int num = 0; int num2 = 0; foreach (ZDO val in zdos) { if (val.m_prefab == stableHashCode) { ZDOID uid = val.m_uid; List> longs = ZDOExtraData.GetLongs(uid); if (longs.Count >= 1) { AddPin(val.m_position); num2 += longs.Count; val.SetOwner(ZDOMan.GetSessionID()); ZDOHelper.Release(ZDOExtraData.s_longs, uid); val.IncreaseDataRevision(); num++; } } } if (alwaysPrint || num2 > 0) { Print($"Cleared {num2} spawn data from {num} zone control{EntityOperation.S(num)}."); } } } public class CleanStands : EntityOperation { public CleanStands(Terminal context, ZDO[] zdos, bool pin, bool alwaysPrint) : base(context, pin) { Clean(zdos, alwaysPrint); } private void Clean(ZDO[] zdos, bool alwaysPrint) { //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) int num = 0; ZDO[] array = zdos; foreach (ZDO val in array) { int num2 = num; if (Clean(val, "0_")) { num++; } if (Clean(val, "1_")) { num++; } if (Clean(val, "2_")) { num++; } if (Clean(val, "3_")) { num++; } if (Clean(val, "4_")) { num++; } if (Clean(val, "5_")) { num++; } if (Clean(val, "6_")) { num++; } if (Clean(val, "7_")) { num++; } if (Clean(val, "8_")) { num++; } if (Clean(val, "9_")) { num++; } if (num > num2) { AddPin(val.m_position); } } if (alwaysPrint || num > 0) { Print($"Removed {num} missing object{EntityOperation.S(num)} from armor stands"); } num = 0; array = zdos; foreach (ZDO val2 in array) { if (Clean(val2, "")) { AddPin(val2.m_position); num++; } } if (alwaysPrint || num > 0) { Print($"Removed {num} missing object{EntityOperation.S(num)} from item stands"); } } private bool Clean(ZDO zdo, string prefix) { ZNetScene instance = ZNetScene.instance; string @string = zdo.GetString(prefix + "item", ""); if (@string == "") { return false; } if (instance.m_namedPrefabs.ContainsKey(StringExtensionMethods.GetStableHashCode(@string))) { return false; } if (!zdo.IsOwner()) { zdo.SetOwner(ZDOMan.GetSessionID()); } zdo.Set(prefix + "item", ""); zdo.Set(prefix + "variant", 0); if (prefix == "") { zdo.Set(prefix + "quality", 1); } return true; } } public class CountObjects : EntityOperation { public CountObjects(Terminal context, HashSet ids, DataParameters args, Range countRange) : base(context, args.Pin) { Count(ids, args, countRange); } private void Count(HashSet ids, DataParameters args, Range countRange) { Range countRange2 = countRange; HashSet prefabs = EntityOperation.GetPrefabs(ids, args.Types); ZDO[] zDOs = EntityOperation.GetZDOs(args, prefabs); int num = 0; Dictionary dictionary = prefabs.ToDictionary((int prefab) => prefab, (int prefab) => 0); ZDO[] array = zDOs; for (int i = 0; i < array.Length; i++) { dictionary[array[i].m_prefab]++; num++; } IEnumerable collection = from kvp in dictionary where kvp.Value >= countRange2.Min && kvp.Value < countRange2.Max select $"{EntityOperation.GetName(kvp.Key)}: {kvp.Value}"; List list = new List(); list.Add($"Total: {num}"); list.AddRange(collection); string[] values = list.ToArray(); if (args.Log) { Log(values); } else { Print(values, addDot: false); } PrintPins(); } } public class EditObjects : ExecutedEntityOperation { public EditObjects(Terminal context, IEnumerable ids, DataParameters args) : base(context, ids, args) { } private bool SetData(ZDO zdo, List datas) { ZDO zdo2 = zdo; uint dataRevision = zdo2.DataRevision; bool num = datas.Count(delegate(string data) { string[] array = Parse.Split(data); if (array.Length == 1) { return DataHelper.ClearData(zdo2, array[0]); } string data2 = ((array.Length > 1) ? array[1] : ""); string type = ((array.Length > 2) ? array[2] : ""); return DataHelper.SetData(zdo2, array[0], data2, type); }) > 0; if (num) { if (!zdo2.IsOwner()) { zdo2.SetOwner(ZDOMan.GetSessionID()); } zdo2.DataRevision = dataRevision + 1; } return num; } protected override bool ProcessZDO(ZDO zdo) { return SetData(zdo, Args.Datas); } protected override string GetNoObjectsMessage() { return "No objects found to update."; } protected override string GetInitMessage() { return string.Format("Updating {0} object{1}.", TotalCount, (TotalCount > 1) ? "s" : ""); } protected override string GetProcessedMessage() { return $"Updated: {ProcessedCount}"; } protected override string GetCountMessage(int count, int prefab) { return $"Updated {count} of {EntityOperation.GetName(prefab)}."; } } public class ListObjectPositions : EntityOperation { public ListObjectPositions(Terminal context, HashSet ids, DataParameters args) : base(context, args.Pin) { ListPositions(ids, args); } private string GetData(ZDO zdo, List prints) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) ZDO zdo2 = zdo; if (prints.Count == 0) { Biome biome = WorldGenerator.instance.GetBiome(zdo2.GetPosition()); return ((object)(Biome)(ref biome)).ToString(); } return string.Join(" | ", prints.Select(delegate(string print) { string[] array = Parse.Split(print); string type = ((array.Length > 1) ? array[1] : ""); return DataHelper.GetData(zdo2, array[0], type); }).ToList()); } private void ListPositions(HashSet ids, DataParameters args) { if (ids.Count > 0 && ids.All((string id) => int.TryParse(id, out var _))) { HashSet ids2 = new HashSet(ids.Select(int.Parse)); ListPositions(ids2, args); } else { ListPositions(EntityOperation.GetPrefabs(ids, args.Types), args); } } private void ListPositions(HashSet ids, DataParameters args) { DataParameters args2 = args; ZDO[] zDOs = EntityOperation.GetZDOs(args2, ids); if (zDOs.Length == 0) { Print("No objects found."); PrintPins(); return; } string[] values = zDOs.Select(delegate(ZDO zdo) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) AddPin(zdo.GetPosition()); return $"{EntityOperation.GetName(zdo.m_prefab)} {((ZDOID)(ref zdo.m_uid)).ID} {Helper.PrintVectorXZY(zdo.GetPosition())}: {GetData(zdo, args2.Prints)}"; }).ToArray(); if (args2.Log) { Log(values); } else { Print(values, addDot: false); } PrintPins(); } } public class RefreshObjects : ExecutedEntityOperation { public RefreshObjects(Terminal context, HashSet ids, DataParameters args) : base(context, ids, args) { } private bool SetData(ZDO zdo) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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) bool flag = false; ZDOID connectionZDOID = zdo.GetConnectionZDOID((ConnectionType)3); if (!((ZDOID)(ref connectionZDOID)).IsNone()) { flag = true; if (ZDOMan.instance.m_objectsByID.TryGetValue(connectionZDOID, out var value)) { Helper.RemoveZDO(value); } ZDOExtraData.ReleaseConnection(zdo.m_uid); zdo.Set(ZDOVars.s_aliveTime, 0, false); } if (zdo.GetLong(ZDOVars.s_pickedTime, 0L) != 0L) { flag = true; zdo.Set(ZDOVars.s_pickedTime, 0L); } if (zdo.GetLong(ZDOVars.s_spawnTime, 0L) != 0L) { flag = true; zdo.Set(ZDOVars.s_spawnTime, 0L); } if (zdo.GetBool(ZDOVars.s_addedDefaultItems, false)) { GameObject prefab = ZNetScene.instance.GetPrefab(zdo.m_prefab); if (!(zdo.GetString(Hash.OverrideItems, "") != "")) { Container component = prefab.GetComponent(); if (component != null && component.m_defaultItems.IsEmpty()) { goto IL_00fa; } } flag = true; zdo.Set(ZDOVars.s_addedDefaultItems, false); zdo.Set(ZDOVars.s_items, ClearChest(zdo)); } goto IL_00fa; IL_00fa: if (zdo.GetLong(Hash.Changed, 0L) != 0L) { flag = true; zdo.Set(Hash.Changed, 0L); } if (flag && !zdo.IsOwner()) { zdo.SetOwner(ZDOMan.GetSessionID()); } return flag; } protected override bool ProcessZDO(ZDO zdo) { return SetData(zdo); } protected override string GetNoObjectsMessage() { return "No objects found to refresh."; } protected override string GetInitMessage() { return string.Format("Refreshing {0} object{1}.", TotalCount, (TotalCount > 1) ? "s" : ""); } protected override string GetProcessedMessage() { return $"Refreshed: {ProcessedCount}"; } protected override string GetCountMessage(int count, int prefab) { return $"Refreshed {count} of {EntityOperation.GetName(prefab)}."; } private string ClearChest(ZDO zdo) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) string @string = zdo.GetString(ZDOVars.s_items, ""); if (string.IsNullOrEmpty(@string)) { return ""; } ZPackage val = new ZPackage(@string); ZPackage val2 = new ZPackage(); val2.Write(val.ReadInt()); val2.Write(0); return val2.GetBase64(); } } public class RemoveObjects : ExecutedEntityOperation { public RemoveObjects(Terminal context, IEnumerable ids, DataParameters args) : base(context, ids, args) { } protected override bool ProcessZDO(ZDO zdo) { if (zdo.m_prefab == 0) { return false; } Helper.RemoveZDO(zdo); return true; } protected override string GetNoObjectsMessage() { return "No objects found to remove."; } protected override string GetInitMessage() { return string.Format("Removing {0} object{1}.", TotalCount, (TotalCount > 1) ? "s" : ""); } protected override string GetProcessedMessage() { return $"Removed: {ProcessedCount}"; } protected override string GetCountMessage(int count, int prefab) { return $"Removed {count} of {EntityOperation.GetName(prefab)}."; } } public class ResetChests : ExecutedEntityOperation { private static List chestNames = new List(); private readonly HashSet AllowedItems; private readonly string[] ChestIds; private readonly bool Looted; private Dictionary ChestPrefabs; public ResetChests(string[] chestIds, IEnumerable allowedItems, bool looted, DataParameters args, Terminal context) { HashSet hashSet = new HashSet(); foreach (string item in allowedItems.Select(Helper.Normalize)) { hashSet.Add(item); } AllowedItems = hashSet; ChestIds = chestIds; Looted = looted; ChestPrefabs = new Dictionary(); base..ctor(context, chestIds, args); } protected override HashSet GetPrefabsForOperation() { ChestPrefabs = ChestIds.ToDictionary((string id) => StringExtensionMethods.GetStableHashCode(id), (string id) => ZNetScene.instance.GetPrefab(id)); if (ChestPrefabs.Values.Any((GameObject prefab) => (Object)(object)prefab == (Object)null || (Object)(object)prefab.GetComponent() == (Object)null)) { throw new InvalidOperationException("Error: Invalid chest ID."); } HashSet hashSet = new HashSet(); foreach (int key in ChestPrefabs.Keys) { hashSet.Add(key); } return hashSet; } protected override bool ProcessZDO(ZDO zdo) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (!ShouldResetChest(zdo)) { return false; } ZDOData zDOData = new ZDOData(zdo); zDOData.Ints.Remove(ZDOVars.s_addedDefaultItems); zDOData.Strings.Remove(ZDOVars.s_items); zDOData.Clone(); Helper.RemoveZDO(zdo); ResetTerrain.Execute(zdo.GetPosition(), Args.TerrainReset); return true; } protected override string GetNoObjectsMessage() { return "No chests found to reset."; } protected override string GetInitMessage() { return string.Format("Resetting {0} chest{1}.", TotalCount, (TotalCount > 1) ? "s" : ""); } protected override string GetProcessedMessage() { return $"Chests reseted ({ProcessedCount} of {TotalCount})."; } protected override string GetCountMessage(int count, int prefab) { return ""; } public static List ChestNames() { if (chestNames.Count == 0) { List list = new List(); Container val = default(Container); list.AddRange(from prefab in ZNetScene.instance.m_prefabs where prefab.TryGetComponent(ref val) && !val.m_defaultItems.IsEmpty() select prefab into obj select ((Object)obj).name into item orderby item select item); chestNames = list; } return chestNames; } private bool ShouldResetChest(ZDO zdo) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown if (!zdo.GetBool(ZDOVars.s_addedDefaultItems, false)) { if (Settings.Verbose) { Print("Skipping a chest: Drops already unrolled."); } return false; } if (!Looted || AllowedItems.Count > 0) { Container component = ChestPrefabs[zdo.m_prefab].GetComponent(); Inventory val = new Inventory(component.m_name, component.m_bkg, component.m_width, component.m_height); ZPackage val2 = new ZPackage(zdo.GetString(ZDOVars.s_items, "")); val.Load(val2); if (val.GetAllItems().Count == 0 && !Looted) { if (Settings.Verbose) { Print("Skipping a chest: Already looted."); } return false; } if (AllowedItems.Count > 0 && !val.GetAllItems().All(IsValid)) { return false; } } return true; } private bool IsValid(ItemData item) { bool flag = AllowedItems.Contains(Helper.Normalize(((Object)item.m_dropPrefab).name)); if (Settings.Verbose && !flag) { Print("Skipping a chest: Extra item " + ((Object)item.m_dropPrefab).name + "."); } return flag; } } public class SearchChests : EntityOperation { public SearchChests(Terminal context, IEnumerable ids, DataParameters args) : base(context, args.Pin) { Search(ids, args); } private string SearchStand(ZDO zdo, string prefix, HashSet ids) { string text = zdo.GetString(prefix + "item", ""); if (text == "") { return ""; } if (!ids.Contains(StringExtensionMethods.GetStableHashCode(text))) { return ""; } int @int = zdo.GetInt(prefix + "variant", 0); int int2 = zdo.GetInt(prefix + "quality", 0); if (@int > 1) { text = text + ", style " + @int; } if (int2 > 1) { text = text + ", level " + int2; } return text; } private void Search(IEnumerable ids, DataParameters args) { HashSet prefabs = EntityOperation.GetPrefabs(ids, args.Types); ZDO[] zDOs = EntityOperation.GetZDOs(args); ZNetScene zs = ZNetScene.instance; string[] prefixes = new string[11] { "", "0_", "1_", "2_", "3_", "4_", "5_", "6_", "7_", "8_", "9_" }; List values = (from x in zDOs.Select(delegate(ZDO zdo) { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) List list = (from prefix in prefixes select SearchStand(zdo, prefix, prefabs) into x where x != "" select x).ToList(); if (list.Count == 0) { return ""; } string name2 = ((Object)zs.m_namedPrefabs[zdo.m_prefab]).name; return string.Concat(name2 + " " + ((ZDOID)(ref zdo.m_uid)).ID + " " + Helper.PrintVectorXZY(zdo.GetPosition()), "\n", string.Join("\n", list)); }) where x != "" select x).ToList(); if (args.Log) { Log(values); } else { Print(values, addDot: false); } List values2 = (from x in zDOs.Select(delegate(ZDO zdo) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0060: 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) if (zdo.GetString(ZDOVars.s_items, "") == "") { return ""; } ZPackage @from = new ZPackage(zdo.GetString(ZDOVars.s_items, "")); Dictionary dictionary = SearchChest(@from, prefabs); if (dictionary.Count == 0) { return ""; } AddPin(zdo.GetPosition()); string name = ((Object)zs.m_namedPrefabs[zdo.m_prefab]).name; return string.Concat(name + " " + ((ZDOID)(ref zdo.m_uid)).ID + " " + Helper.PrintVectorXZY(zdo.GetPosition()), "\n", string.Join("\n", dictionary.Select((KeyValuePair x) => x.Key + ": " + x.Value))); }) where x != "" select x).ToList(); if (args.Log) { Log(values2); } else { Print(values2, addDot: false); } PrintPins(); } private Dictionary SearchChest(ZPackage from, HashSet ids) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) Dictionary dictionary = new Dictionary(); int num = from.ReadInt(); int num2 = from.ReadInt(); for (int i = 0; i < num2; i++) { string text = from.ReadString(); int num3 = from.ReadInt(); from.ReadSingle(); from.ReadVector2i(); from.ReadBool(); string text2 = ""; if (num >= 101) { int num4 = from.ReadInt(); if (num4 > 1) { text2 = " , level " + num4; } } string text3 = ""; if (num >= 102) { int num5 = from.ReadInt(); if (num5 > 0) { text3 = ", style " + num5; } } if (num >= 103) { from.ReadLong(); from.ReadString(); } if (num >= 104) { int num6 = from.ReadInt(); for (int j = 0; j < num6; j++) { from.ReadString(); from.ReadString(); } } if (num >= 105) { from.ReadInt(); } if (num >= 106) { from.ReadBool(); } if (ids.Contains(StringExtensionMethods.GetStableHashCode(text))) { string key = text + text3 + text2; if (dictionary.ContainsKey(key)) { dictionary[key] += num3; } else { dictionary.Add(key, num3); } } } return dictionary; } } public class SwapObjects : ExecutedEntityOperation { private int ToSwap; public SwapObjects(Terminal context, IEnumerable ids, DataParameters args) : base(context, ids, args) { } protected override HashSet GetPrefabsForOperation() { ToSwap = StringExtensionMethods.GetStableHashCode(Ids.FirstOrDefault()); return EntityOperation.GetPrefabs(Ids.Skip(1).ToList(), Args.Types); } protected override bool ProcessZDO(ZDO zdo) { if (zdo.m_prefab == ToSwap) { return false; } ZDOData zDOData = new ZDOData(zdo); zDOData.Prefab = ToSwap; zDOData.Clone(); Helper.RemoveZDO(zdo); return true; } protected override string GetNoObjectsMessage() { return "No objects found to swap."; } protected override string GetInitMessage() { return string.Format("Swapping {0} object{1}", TotalCount, (TotalCount > 1) ? "s" : ""); } protected override string GetProcessedMessage() { return $"Swapped: {ProcessedCount}"; } protected override string GetCountMessage(int count, int prefab) { return $"Swapped {count} of {EntityOperation.GetName(prefab)}."; } } public class Print : ExecutedOperation { [CompilerGenerated] private string P; [CompilerGenerated] private string P; public Print(Terminal context, string initText, string text) { P = initText; P = text; base..ctor(context); } protected override IEnumerator OnExecute(Stopwatch sw) { if (P != "") { Print(P); } yield break; } protected override string OnInit() { return P; } } [Flags] public enum Direction { None = 0, North = 1, East = 2, South = 4, West = 8, NorthEast = 0x10, SouthEast = 0x20, SouthWest = 0x40, NorthWest = 0x80 } public class ResetBorder : EntityOperation { public ResetBorder(Terminal context, Dictionary zones) : base(context, pin: false) { Execute(zones); } private void Execute(Dictionary zones) { //IL_0016: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) ZDO[] zDOs = EntityOperation.GetZDOs(Settings.TerrainCompilerHash); int num = 0; ZDO[] array = zDOs; foreach (ZDO val in array) { Vector2i zone = ZoneSystem.GetZone(val.GetPosition()); if (zones.ContainsKey(zone)) { Update(val, zones[zone]); num++; } } Print($"{num} border zones reseted"); } private void Update(ZDO zdo, Direction direction) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) byte[] byteArray = zdo.GetByteArray("TCData", (byte[])null); if (byteArray == null) { return; } bool flag = false; ZPackage val = new ZPackage(Utils.Decompress(byteArray)); ZPackage val2 = new ZPackage(); val2.Write(val.ReadInt()); val2.Write(val.ReadInt() + 1); val2.Write(val.ReadVector3()); val2.Write(val.ReadSingle()); int num = val.ReadInt(); val2.Write(num); int num2 = (int)Math.Sqrt(num); for (int i = 0; i < num; i++) { bool flag2; bool num3 = (flag2 = val.ReadBool()); int num4 = i / num2; int num5 = i % num2; if (direction.HasFlag(Direction.North) && num4 == num2 - 1) { flag2 = false; } if (direction.HasFlag(Direction.East) && num5 == num2 - 1) { flag2 = false; } if (direction.HasFlag(Direction.South) && num4 == 0) { flag2 = false; } if (direction.HasFlag(Direction.West) && num5 == 0) { flag2 = false; } if (direction.HasFlag(Direction.NorthEast) && num4 == num2 - 1 && num5 == num2 - 1) { flag2 = false; } if (direction.HasFlag(Direction.NorthWest) && num4 == num2 - 1 && num5 == 0) { flag2 = false; } if (direction.HasFlag(Direction.SouthWest) && num4 == 0 && num5 == 0) { flag2 = false; } if (direction.HasFlag(Direction.SouthEast) && num4 == 0 && num5 == num2 - 1) { flag2 = false; } val2.Write(flag2); if (flag2) { val2.Write(val.ReadSingle()); val2.Write(val.ReadSingle()); } if (num3 && !flag2) { flag = true; val.ReadSingle(); val.ReadSingle(); } } num = val.ReadInt(); val2.Write(num); for (int j = 0; j < num; j++) { bool flag3 = val.ReadBool(); val2.Write(flag3); if (flag3) { val2.Write(val.ReadSingle()); val2.Write(val.ReadSingle()); val2.Write(val.ReadSingle()); val2.Write(val.ReadSingle()); } } byte[] array = Utils.Compress(val2.GetArray()); if (flag) { if (!zdo.IsOwner()) { zdo.SetOwner(ZDOMan.GetSessionID()); } zdo.Set("TCData", array); } } } [HarmonyPatch(typeof(ZoneSystem))] public class ResetTerrain { public static ILookup? TCZdos = null; public static DateTime LastUpdate = DateTime.MinValue; public static bool Active = false; [HarmonyPatch("GetGroundData")] [HarmonyPostfix] private static void OverrideGroundDataWithDefaultHeight(ref Vector3 p) { if (Active) { p.y = WorldGenerator.instance.GetHeight(p.x, p.z); } } [HarmonyPatch("GetGroundHeight", new Type[] { typeof(Vector3) })] [HarmonyPrefix] private static bool OverrideGroundHeightWithDefaultHeight(Vector3 p, ref float __result) { //IL_000f: 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) if (!Active) { return true; } __result = WorldGenerator.instance.GetHeight(p.x, p.z); return false; } private static Vector3 VertexToWorld(Vector3 pos, int j, int i) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) pos.x += (float)i - 32.5f; pos.z += (float)j - 32.5f; return pos; } public static void Execute(Vector3 pos, float radius) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) if (radius == 0f) { return; } if (TCZdos == null || DateTime.Now - LastUpdate > TimeSpan.FromSeconds(10.0)) { LastUpdate = DateTime.Now; TCZdos = EntityOperation.GetZDOs(Settings.TerrainCompilerHash).ToLookup((ZDO zdo) => ZoneSystem.GetZone(zdo.GetPosition())); } bool flag = false; Vector2i zone = ZoneSystem.GetZone(pos); int num = (int)Math.Ceiling(radius / 64f); Vector2i val = default(Vector2i); for (int i = zone.x - num; i <= zone.x + num; i++) { for (int j = zone.y - num; j <= zone.y + num; j++) { ((Vector2i)(ref val))..ctor(i, j); if (TCZdos == null || !TCZdos.Contains(val)) { continue; } IEnumerable source = TCZdos[val]; ResetTerrainInZdo(pos, radius, val, source.First()); if (source.Count() <= 1) { continue; } UpgradeWorld.Log.LogWarning((object)$"Overlapping terrain controls in zone {val}. Removing..."); source = source.Skip(1); flag = true; foreach (ZDO item in source) { Helper.RemoveZDO(item); } } } if (flag) { TCZdos = null; } } private static void ResetTerrainInZdo(Vector3 pos, float radius, Vector2i zone, ZDO zdo) { //IL_0011: 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_0017: 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_0026: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) byte[] byteArray = zdo.GetByteArray(ZDOVars.s_TCData, (byte[])null); if (byteArray == null) { return; } Vector3 zonePos = ZoneSystem.GetZonePos(zone); bool flag = false; ZPackage val = new ZPackage(Utils.Decompress(byteArray)); ZPackage val2 = new ZPackage(); val2.Write(val.ReadInt()); val2.Write(val.ReadInt() + 1); val2.Write(val.ReadVector3()); val2.Write(val.ReadSingle()); int num = val.ReadInt(); val2.Write(num); int num2 = (int)Math.Sqrt(num); for (int i = 0; i < num; i++) { bool flag2; bool num3 = (flag2 = val.ReadBool()); int num4 = i / num2; int num5 = i % num2; if (num4 >= 0 && num4 <= num2 - 1 && num5 >= 0 && num5 <= num2 - 1 && Utils.DistanceXZ(VertexToWorld(zonePos, num4, num5), pos) < radius) { flag2 = false; } val2.Write(flag2); if (flag2) { val2.Write(val.ReadSingle()); val2.Write(val.ReadSingle()); } if (num3 && !flag2) { flag = true; val.ReadSingle(); val.ReadSingle(); } } num = val.ReadInt(); val2.Write(num); for (int j = 0; j < num; j++) { bool flag3; bool num6 = (flag3 = val.ReadBool()); int j2 = j / num2; int i2 = j % num2; if (Utils.DistanceXZ(VertexToWorld(zonePos, j2, i2), pos) < radius) { flag3 = false; } val2.Write(flag3); if (flag3) { val2.Write(val.ReadSingle()); val2.Write(val.ReadSingle()); val2.Write(val.ReadSingle()); val2.Write(val.ReadSingle()); } if (num6 && !flag3) { flag = true; val.ReadSingle(); val.ReadSingle(); val.ReadSingle(); val.ReadSingle(); } } byte[] array = Utils.Compress(val2.GetArray()); if (flag) { if (!zdo.IsOwner()) { zdo.SetOwner(ZDOMan.GetSessionID()); } zdo.Set(ZDOVars.s_TCData, array); } } } public class ResetZones : ZoneOperation { private Dictionary BorderZones = new Dictionary(); private int Reseted; public ResetZones(Terminal context, FiltererParameters args) : base(context, args) { Operation = "Reset"; args.TargetZones = TargetZones.Generated; InitString = args.Print("Reset"); Filterers = FiltererFactory.Create(args); } protected override bool ExecuteZone(Vector2i zone) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_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) ZoneSystem instance = ZoneSystem.instance; _ = ZNetScene.instance; List zDOs = Helper.GetZDOs(zone); HashSet hashSet = ZNet.instance.m_players.Select((PlayerInfo player) => player.m_characterID).ToHashSet(); if (zDOs != null) { foreach (ZDO item in zDOs) { if (!hashSet.Contains(item.m_uid) && ZoneSystem.GetZone(item.GetPosition()) == zone) { Helper.RemoveZDO(item); } } } if (instance.m_locationInstances.TryGetValue(zone, out var value)) { value.m_placed = false; value.m_position = new Vector3(value.m_position.x, WorldGenerator.instance.GetHeight(value.m_position.x, value.m_position.z), value.m_position.z); instance.m_locationInstances[zone] = value; } instance.m_generatedZones.Remove(zone); Reseted++; AddBorder(zone, Direction.North); AddBorder(zone, Direction.East); AddBorder(zone, Direction.South); AddBorder(zone, Direction.West); AddBorder(zone, Direction.NorthWest); AddBorder(zone, Direction.NorthEast); AddBorder(zone, Direction.SouthWest); AddBorder(zone, Direction.SouthEast); return true; } private void AddBorder(Vector2i zone, Direction direction) { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) if (direction == Direction.North) { zone.y--; } if (direction == Direction.East) { zone.x--; } if (direction == Direction.South) { zone.y++; } if (direction == Direction.West) { zone.x++; } if (direction == Direction.NorthWest) { zone.y--; zone.x++; } if (direction == Direction.NorthEast) { zone.y--; zone.x--; } if (direction == Direction.SouthWest) { zone.y++; zone.x++; } if (direction == Direction.SouthEast) { zone.y++; zone.x--; } if (BorderZones.ContainsKey(zone)) { direction |= BorderZones[zone]; } BorderZones[zone] = direction; } protected override void OnEnd() { string text = $"{Operation} completed. {Reseted} zones reseted."; if (Failed > 0) { text = text + " " + Failed + " errors."; } Print(text); BorderZones = BorderZones.Where((KeyValuePair kvp) => ZoneSystem.instance.IsZoneGenerated(kvp.Key)).ToDictionary((KeyValuePair kvp) => kvp.Key, (KeyValuePair kvp) => kvp.Value); new ResetBorder(Context, BorderZones); ClutterSystem instance = ClutterSystem.instance; if (instance != null) { instance.ClearAll(); } Helper.RecalculateTerrain(); Minimap instance2 = Minimap.instance; if (instance2 != null) { instance2.UpdateLocationPins(1000f); } } } public class RestoreZones : ZoneOperation { protected int Added; public RestoreZones(Terminal context, FiltererParameters args) : base(context, args) { Operation = "Restore zones"; args.TargetZones = TargetZones.Generated; args.SafeZones = 0; InitString = args.Print("Restore"); Filterers = FiltererFactory.Create(args); } protected override bool ExecuteZone(Vector2i zone) { //IL_000b: 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_004f: Unknown result type (might be due to invalid IL or missing references) ZoneSystem instance = ZoneSystem.instance; Vector3 zonePos = ZoneSystem.GetZonePos(zone); GameObject zoneCtrlPrefab = instance.m_zoneCtrlPrefab; int hash = StringExtensionMethods.GetStableHashCode(((Object)zoneCtrlPrefab).name); List zDOs = Helper.GetZDOs(zone); if (zDOs == null || !zDOs.Any((ZDO zdo) => zdo.m_prefab == hash)) { ZDOMan.instance.CreateNewZDO(zonePos, hash).SetPrefab(hash); Added++; } return true; } protected override void OnEnd() { string text = Operation + " completed."; text += $" {Added} zone controls added."; if (Failed > 0) { text = text + " " + Failed + " errors."; } Print(text); } } public class TempleVersion : ExecutedOperation { private readonly string Version; private static readonly int HashTemple = StringExtensionMethods.GetStableHashCode("StartTemple"); private static readonly int HashEikthyr = StringExtensionMethods.GetStableHashCode("BossStone_Eikthyr"); private static readonly int HashElder = StringExtensionMethods.GetStableHashCode("BossStone_TheElder"); private static readonly int HashBonemass = StringExtensionMethods.GetStableHashCode("BossStone_Bonemass"); private static readonly int HashModer = StringExtensionMethods.GetStableHashCode("BossStone_DragonQueen"); private static readonly int HashYagluth = StringExtensionMethods.GetStableHashCode("BossStone_Yagluth"); private static readonly int HashQueen = StringExtensionMethods.GetStableHashCode("BossStone_TheQueen"); private static readonly int HashProxy = StringExtensionMethods.GetStableHashCode("LocationProxy"); private static readonly HashSet BossStones = new HashSet { HashEikthyr, HashQueen }; private static readonly Dictionary MistlandsPos = new Dictionary { { HashEikthyr, new Vector3(-7.27f, -0.14f, 3.81f) }, { HashElder, new Vector3(-1.76f, -0.21f, 8.11f) }, { HashBonemass, new Vector3(7.02f, -0.32f, 5.53f) }, { HashModer, new Vector3(9.61f, -0.04f, -4.28f) }, { HashYagluth, new Vector3(1.61f, -0.04f, -11.27f) }, { HashQueen, new Vector3(-6.85f, 0f, -6.97f) } }; private static readonly Dictionary MistlandsRot = new Dictionary { { HashEikthyr, new Quaternion(0f, 0.45976f, 0f, -0.88804f) }, { HashElder, new Quaternion(0f, 0.06553f, 0f, -0.99785f) }, { HashBonemass, new Quaternion(0f, 0.43752f, 0f, 0.89921f) }, { HashModer, new Quaternion(0f, 0.8279f, 0f, 0.56088f) }, { HashYagluth, new Quaternion(0f, 0.99785f, 0f, 0.06556f) }, { HashQueen, new Quaternion(0f, 0.87991f, 0f, -0.47513f) } }; private static readonly Dictionary AshlandsPos = new Dictionary { { HashEikthyr, new Vector3(-6.4f, -0.14f, 5.04f) }, { HashElder, new Vector3(-1.76f, -0.21f, 8.11f) }, { HashBonemass, new Vector3(7.02f, -0.32f, 5.53f) }, { HashModer, new Vector3(9.61f, -0.04f, -4.28f) }, { HashYagluth, new Vector3(1.61f, -0.04f, -11.27f) }, { HashQueen, new Vector3(-5.38f, 0f, -8.71f) } }; private static readonly Dictionary AshlandsRot = new Dictionary { { HashEikthyr, new Quaternion(0f, 0.43937f, 0f, -0.8983f) }, { HashElder, new Quaternion(0f, 0.06553f, 0f, -0.99785f) }, { HashBonemass, new Quaternion(0f, 0.43752f, 0f, 0.89921f) }, { HashModer, new Quaternion(0f, 0.8279f, 0f, 0.56088f) }, { HashYagluth, new Quaternion(0f, 0.99785f, 0f, 0.06556f) }, { HashQueen, new Quaternion(0f, 0.93423f, 0f, -0.35667f) } }; public TempleVersion(Terminal context, string version) { Version = version; base..ctor(context); } protected override IEnumerator OnExecute(Stopwatch sw) { KeyValuePair[] array = ZDOMan.instance.m_objectsByID.Where((KeyValuePair kvp) => kvp.Value.m_prefab == HashProxy && kvp.Value.GetInt(ZDOVars.s_location, 0) == HashTemple).ToArray(); if (array.Length == 0) { Print("Error: StartTemple location not found."); yield break; } KeyValuePair[] array2 = array; for (int i = 0; i < array2.Length; i++) { KeyValuePair keyValuePair = array2[i]; List zDOs = Helper.GetZDOs(ZoneSystem.GetZone(keyValuePair.Value.m_position)); if (zDOs == null) { continue; } List list = new List(); list.AddRange(zDOs.Where((ZDO zdo) => BossStones.Contains(zdo.m_prefab))); zDOs = list; Vector3 pos = keyValuePair.Value.m_position; Quaternion rot = keyValuePair.Value.GetRotation(); foreach (ZDO item in zDOs) { string name = ((Object)ZNetScene.instance.GetPrefab(item.m_prefab)).name; if (Version == "mistlands") { Vector3 val = pos + rot * MistlandsPos[item.m_prefab]; Quaternion val2 = rot * MistlandsRot[item.m_prefab]; Helper.MoveZDO(item, val, val2); Print("Moved " + name + " to " + Helper.PrintVectorXZY(val) + " / " + Helper.PrintAngleYXZ(val2) + "."); } else if (Version == "ashlands") { Vector3 val3 = pos + rot * AshlandsPos[item.m_prefab]; Quaternion val4 = rot * AshlandsRot[item.m_prefab]; Helper.MoveZDO(item, val3, val4); Print("Moved " + name + " to " + Helper.PrintVectorXZY(val3) + " / " + Helper.PrintAngleYXZ(val4) + "."); } else { Vector3 val5 = Quaternion.Inverse(rot) * (item.GetPosition() - pos); Quaternion val6 = Quaternion.Inverse(rot) * item.GetRotation(); Log(new <>z__ReadOnlySingleElementList($"Stone {name} at pos {val5} and rot {val6}.")); } yield return null; } yield return null; } if (Version != "") { Print("Updated start temple version to " + Version + "."); } } protected override string OnInit() { if (Version == "") { return "Printing boss stone positions."; } return "Updating start temple version to " + Version + ". This moves boss stones."; } } public class SetTime : TimeOperation { public SetTime(Terminal context, double time) : base(context) { Change(time); } } public class WorldVersion : ExecutedOperation { private readonly int Version; public WorldVersion(Terminal context, int version) { Version = version; base..ctor(context); } protected override IEnumerator OnExecute(Stopwatch sw) { World world = WorldGenerator.instance.m_world; world.m_worldGenVersion = Version; WorldGenerator.Initialize(world); Minimap instance = Minimap.instance; if (instance != null) { instance.ForceRegen(); } Print($"Updated world version to {world.m_worldGenVersion}."); yield break; } protected override string OnInit() { return $"Updating world version to {Version}. This may change biome distribution."; } } public class Upgrade : BaseOperation { public static List Types = new List(12) { "tarpits", "onions", "mistlands", "mistlands_worldgen", "hh_worldgen", "legacy_worldgen", "mountain_caves", "hildir", "ashlands", "deepnorth", "bogwitch", "combatruins" }; public Upgrade(Terminal context, string type, List extra, FiltererParameters args) : base(context) { AddOperations(type, extra, args); Types.Sort(); } private void AddOperations(string type, List extra, FiltererParameters args) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) if (type == null || type == "") { Print("Error: Missing upgrade type"); return; } type = type.ToLower(); switch (type) { case "ashlands": { if (args.Biomes.Count() > 0) { Print("Error: This operation doesn't support custom biomes " + string.Join(", ", args.Biomes)); break; } args.Pos = new Vector2(0f, 4000f); args.MinDistance = 11600f; HashSet hashSet3 = (from loc in ZoneSystem.instance.m_locations where Helper.IsValid(loc) && (int)loc.m_biome == 32 && loc.m_enable select loc.m_prefab.Name).ToHashSet(); Executor.AddOperation(new RemoveLocations(Context, new HashSet(), args), autoStart: false); Executor.AddOperation(new ResetZones(Context, args), autoStart: false); if (hashSet3.Count() > 0) { Executor.AddOperation(new DistributeLocations(Context, hashSet3, args), autoStart: false); } Executor.AddOperation(new TempleVersion(Context, "ashlands"), args.Start); break; } case "deepnorth": { if (args.Biomes.Count() > 0) { Print("Error: This operation doesn't support custom biomes " + string.Join(", ", args.Biomes)); break; } args.Pos = new Vector2(0f, -4000f); args.MinDistance = 11600f; HashSet hashSet2 = (from loc in ZoneSystem.instance.m_locations where Helper.IsValid(loc) && (int)loc.m_biome == 64 && loc.m_enable select loc.m_prefab.Name).ToHashSet(); Executor.AddOperation(new RemoveLocations(Context, new HashSet(), args), autoStart: false); Executor.AddOperation(new ResetZones(Context, args), autoStart: false); if (hashSet2.Count() > 0) { Executor.AddOperation(new DistributeLocations(Context, hashSet2, args), args.Start); } break; } case "mountain_caves": Executor.AddOperation(new DistributeLocations(Context, new HashSet { "MountainCave02" }, args), autoStart: false); Executor.AddOperation(new SpawnLocations(Context, new HashSet { "MountainCave02" }, args), args.Start); break; case "bogwitch": Executor.AddOperation(new DistributeLocations(Context, new HashSet { "BogWitch_Camp" }, args), autoStart: false); Executor.AddOperation(new SpawnLocations(Context, new HashSet { "BogWitch_Camp" }, args), args.Start); break; case "combatruins": Executor.AddOperation(new DistributeLocations(Context, new HashSet { "CombatRuin01" }, args), autoStart: false); Executor.AddOperation(new SpawnLocations(Context, new HashSet { "CombatRuin01" }, args), args.Start); break; case "tarpits": Executor.AddOperation(new DistributeLocations(Context, new HashSet { "TarPit1", "TarPit2", "TarPit3" }, args), autoStart: false); Executor.AddOperation(new SpawnLocations(Context, new HashSet { "TarPit1", "TarPit2", "TarPit3" }, args), args.Start); break; case "onions": if (extra.Count() > 0) { Print("Error: This operation doesn't support extra parameters " + string.Join(", ", extra)); break; } new ResetChests(new string[1] { "TreasureChest_mountains" }, new <>z__ReadOnlyArray(new string[7] { "Amber", "Coins", "AmberPearl", "Ruby", "Obsidian", "ArrowFrost", "OnionSeeds" }), args.Start, new DataParameters(args), Context); break; case "mistlands": { if (args.Biomes.Count() > 0) { Print("Error: This operation doesn't support custom biomes " + string.Join(", ", args.Biomes)); break; } args.Biomes = new HashSet { (Biome)512 }; Executor.AddOperation(new ResetZones(Context, args), autoStart: false); HashSet ids = (from loc in ZoneSystem.instance.m_locations where Helper.IsValid(loc) && (int)loc.m_biome == 512 && loc.m_enable select loc.m_prefab.Name).ToHashSet(); Executor.AddOperation(new DistributeLocations(Context, ids, args), args.Start); break; } case "mistlands_worldgen": { Executor.AddOperation(new WorldVersion(Context, 2), autoStart: false); args.MinDistance = 5901f; Terminal context = Context; HashSet hashSet = new HashSet(); foreach (string item in LocationOperation.AllIds()) { hashSet.Add(item); } Executor.AddOperation(new RemoveLocations(context, hashSet, args), autoStart: false); context = Context; hashSet = new HashSet(); foreach (string item2 in LocationOperation.AllIds()) { hashSet.Add(item2); } Executor.AddOperation(new DistributeLocations(context, hashSet, args), autoStart: false); Executor.AddOperation(new ResetZones(Context, args), autoStart: false); Executor.AddOperation(new Print(Context, "If you don't want to automatically reset outer areas, use stop and then world_gen mistlands commands.", ""), args.Start); break; } case "hh_worldgen": Executor.AddOperation(new WorldVersion(Context, 1), autoStart: false); Executor.AddOperation(new Print(Context, "To reset outer areas, use world_reset minDistance=5900 command.", ""), args.Start); break; case "legacy_worldgen": Executor.AddOperation(new WorldVersion(Context, 0), args.Start); break; case "hildir": Executor.AddOperation(new DistributeLocations(Context, new HashSet { "Hildir_plainsfortress", "Hildir_crypt", "Hildir_camp", "Hildir_cave" }, args), autoStart: false); Executor.AddOperation(new SpawnLocations(Context, new HashSet { "Hildir_plainsfortress", "Hildir_crypt", "Hildir_camp", "Hildir_cave" }, args), args.Start); break; default: Print("Error: Invalid upgrade type"); break; } } } public class AddVegetation : VegetationOperation { public int Counter; public AddVegetation(Terminal context, HashSet ids, FiltererParameters args) : base(context, ids, args) { Operation = "Add vegetation"; InitString = args.Print("Add vegetation" + Helper.IdString(ids) + " to"); args.TargetZones = TargetZones.Generated; Filterers = FiltererFactory.Create(args); } protected override bool ExecuteZone(Vector2i zone) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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) if (ZoneSystem.instance.IsZoneLoaded(zone)) { SpawnVegetation(zone); Zones.ReleaseZone(zone); return true; } Zones.PokeZone(zone); return false; } protected override void OnEnd() { base.OnEnd(); string text = $"{Operation} completed. {Counter} vegetations added."; if (Failed > 0) { text = text + " " + Failed + " errors."; } Print(text); } public static List GetClearAreas(Vector2i zone) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown ZoneSystem instance = ZoneSystem.instance; instance.m_tempClearAreas.Clear(); if (instance.m_locationInstances.TryGetValue(zone, out var value) && value.m_location.m_clearArea) { instance.m_tempClearAreas.Add(new ClearArea(value.m_position, value.m_location.m_exteriorRadius)); } return instance.m_tempClearAreas; } protected void SpawnVegetation(Vector2i zone) { //IL_000c: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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) ZoneSystem instance = ZoneSystem.instance; GameObject root = instance.m_zones[zone].m_root; Vector3 zonePos = ZoneSystem.GetZonePos(zone); Heightmap heightmap = Zones.GetHeightmap(root); ResetTerrain.Active = Args.TerrainReset != 0f; List clearAreas = GetClearAreas(zone); instance.m_tempSpawnedObjects.Clear(); OverrideVegetation(); instance.PlaceVegetation(zone, zonePos, root.transform, heightmap, clearAreas, (SpawnMode)2, instance.m_tempSpawnedObjects); RestoreVegetation(); Counter += instance.m_tempSpawnedObjects.Count; foreach (GameObject tempSpawnedObject in instance.m_tempSpawnedObjects) { ResetTerrain.Execute(tempSpawnedObject.transform.position, Args.TerrainReset); AddPin(tempSpawnedObject.transform.position); Object.Destroy((Object)(object)tempSpawnedObject); } instance.m_tempSpawnedObjects.Clear(); ResetTerrain.Active = false; } } public class RemoveVegetation : ZoneOperation { protected int Removed; private readonly HashSet Hashes = new HashSet(); public RemoveVegetation(Terminal context, HashSet ids, FiltererParameters args) : base(context, args) { Operation = "Remove vegetation"; InitString = args.Print("Remove vegetation" + Helper.IdString(ids) + " from"); args.TargetZones = TargetZones.Generated; Filterers = FiltererFactory.Create(args); if (ids.Count == 0) { HashSet hashSet = new HashSet(); foreach (string item in ZoneSystem.instance.m_vegetation.Select((ZoneVegetation veg) => ((Object)veg.m_prefab).name)) { hashSet.Add(item); } ids = hashSet; } HashSet hashSet2 = new HashSet(); foreach (int item2 in ids.Select((string id) => StringExtensionMethods.GetStableHashCode(id))) { hashSet2.Add(item2); } Hashes = hashSet2; foreach (string id in ids) { if (Object.op_Implicit((Object)(object)ZNetScene.instance.GetPrefab(id + "_frac"))) { Hashes.Add(StringExtensionMethods.GetStableHashCode(id + "_frac")); } } } protected override bool ExecuteZone(Vector2i zone) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Remove(zone); return true; } protected void Remove(Vector2i zone) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) List zDOs = Helper.GetZDOs(zone); if (zDOs == null) { return; } foreach (ZDO item in zDOs) { if (Args.RollAmount() && Hashes.Contains(item.m_prefab)) { AddPin(item.GetPosition()); Helper.RemoveZDO(item); Removed++; } } } protected override void OnEnd() { base.OnEnd(); string text = $"{Operation} completed. {Removed} vegetations removed."; if (Failed > 0) { text = text + " " + Failed + " errors."; } Print(text); } } public class ResetVegetation : VegetationOperation { public int Counter; protected int Removed; public HashSet Hashes = new HashSet(); public ResetVegetation(Terminal context, HashSet ids, FiltererParameters args) : base(context, ids, args) { Operation = "Reset vegetation"; InitString = args.Print("Reset vegetation" + Helper.IdString(ids) + " from"); args.TargetZones = TargetZones.Generated; Filterers = FiltererFactory.Create(args); if (ids.Count == 0) { HashSet hashSet = new HashSet(); foreach (string item in ZoneSystem.instance.m_vegetation.Select((ZoneVegetation veg) => ((Object)veg.m_prefab).name)) { hashSet.Add(item); } ids = hashSet; } HashSet hashSet2 = new HashSet(); foreach (int item2 in ids.Select((string id) => StringExtensionMethods.GetStableHashCode(id))) { hashSet2.Add(item2); } Hashes = hashSet2; foreach (string id in ids) { if (Object.op_Implicit((Object)(object)ZNetScene.instance.GetPrefab(id + "_frac"))) { Hashes.Add(StringExtensionMethods.GetStableHashCode(id + "_frac")); } } } protected override bool ExecuteZone(Vector2i zone) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_001b: Unknown result type (might be due to invalid IL or missing references) if (ZoneSystem.instance.IsZoneLoaded(zone)) { Remove(zone); SpawnVegetation(zone); Zones.ReleaseZone(zone); return true; } Zones.PokeZone(zone); return false; } protected void Remove(Vector2i zone) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) List zDOs = Helper.GetZDOs(zone); if (zDOs == null) { return; } foreach (ZDO item in zDOs) { if (Args.RollAmount() && Hashes.Contains(item.m_prefab)) { AddPin(item.GetPosition()); Helper.RemoveZDO(item); Removed++; } } } protected void SpawnVegetation(Vector2i zone) { //IL_000c: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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) ZoneSystem instance = ZoneSystem.instance; GameObject root = instance.m_zones[zone].m_root; Vector3 zonePos = ZoneSystem.GetZonePos(zone); Heightmap heightmap = Zones.GetHeightmap(root); ResetTerrain.Active = Args.TerrainReset != 0f; List clearAreas = AddVegetation.GetClearAreas(zone); instance.m_tempSpawnedObjects.Clear(); OverrideVegetation(); instance.PlaceVegetation(zone, zonePos, root.transform, heightmap, clearAreas, (SpawnMode)2, instance.m_tempSpawnedObjects); RestoreVegetation(); Counter += instance.m_tempSpawnedObjects.Count; foreach (GameObject tempSpawnedObject in instance.m_tempSpawnedObjects) { ResetTerrain.Execute(tempSpawnedObject.transform.position, Args.TerrainReset); AddPin(tempSpawnedObject.transform.position); Object.Destroy((Object)(object)tempSpawnedObject); } instance.m_tempSpawnedObjects.Clear(); ResetTerrain.Active = false; } protected override void OnEnd() { base.OnEnd(); string text = $"{Operation} completed. {Removed} vegetations removed. {Counter} vegetations added."; if (Failed > 0) { text = text + " " + Failed + " errors."; } Print(text); } } public abstract class VegetationOperation : ZoneOperation { private static List? ServerIds = null; private static int ServerIdsHash = 0; public HashSet Ids = new HashSet(); private readonly float Amount = 1f; private static List OriginalVegetation = new List(); private static List Vegetation = new List(); private static readonly Dictionary?>> Named = CreateNamed(); private static readonly List Parameters; private static readonly Func> AutoComplete; public static List AllIds() { if (ServerIds != null) { return ServerIds; } List list = new List(); list.AddRange(ZoneSystem.instance.m_vegetation.Select((ZoneVegetation veg) => ((Object)veg.m_prefab).name).Distinct()); return list; } public static void SetServerIds(string? data) { if (data == null) { ServerIds = null; ServerIdsHash = 0; return; } int stableHashCode = StringExtensionMethods.GetStableHashCode(data); if (ServerIdsHash != stableHashCode) { ServerIdsHash = stableHashCode; List list = new List(); list.AddRange(from s in data.Split(new char[1] { '|' }) where !string.IsNullOrEmpty(s) select s); ServerIds = list; } } public static int GetServerIdsHash() { return ServerIdsHash; } public static HashSet GetIds(List ids, List ignore) { List ids2 = ids; List ignore2 = ignore; HashSet hashSet = new HashSet(); foreach (string item in from id in AllIds() where (ids2.Count == 0 || ids2.Contains(id)) && (ignore2.Count == 0 || !ignore2.Contains(id)) select id) { hashSet.Add(item); } return hashSet; } public VegetationOperation(Terminal context, HashSet ids, FiltererParameters args) : base(context, args) { args.TargetZones = TargetZones.Generated; Amount = args.Amount; Ids = ids; } protected override void OnStart() { base.OnStart(); OriginalVegetation = ZoneSystem.instance.m_vegetation; List list = new List(); list.AddRange(ZoneSystem.instance.m_vegetation.Select((ZoneVegetation veg) => veg.Clone())); Vegetation = list; if (Ids.Count > 0) { Set(GetWithOnlyIds(Ids, value: true)); } if (Amount != 1f) { SetAmount(Amount); } } protected void OverrideVegetation() { ZoneSystem.instance.m_vegetation = Vegetation; } protected void RestoreVegetation() { ZoneSystem.instance.m_vegetation = OriginalVegetation; } private static bool[] GetWithOnlyIds(HashSet ids, bool value) { HashSet ids2 = ids; List list = new List(); list.AddRange(Vegetation.Select((ZoneVegetation veg) => (!ids2.Contains(((Object)veg.m_prefab).name)) ? (!value) : value)); return list.ToArray(); } private static void Set(bool[] values) { for (int i = 0; i < Vegetation.Count; i++) { Vegetation[i].m_enable = values[i]; } } private static void SetAmount(float amount) { foreach (ZoneVegetation item in Vegetation) { item.m_min += amount; item.m_max += amount; } } public static void Register(string name) { CommandWrapper.Register(name, AutoComplete, Named); } private static Dictionary?>> CreateNamed() { Dictionary?>> autoComplete = FiltererParameters.GetAutoComplete(); autoComplete["id"] = (int index) => AllIds(); autoComplete["ignore"] = (int index) => AllIds(); return autoComplete; } static VegetationOperation() { List list = new List(); list.AddRange(from x in FiltererParameters.Parameters.Concat(new <>z__ReadOnlyArray(new string[2] { "id", "ignore" })) orderby x select x); Parameters = list; AutoComplete = (int index) => (index != 0) ? Parameters : AllIds(); } } public class BiomesCountCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; internal List <.ctor>b__0_0(int index) { if (index == 0) { return CommandWrapper.Info("How precisely the biome is checked (meters). Lower value increases precision but takes longer to measure."); } return FiltererParameters.Parameters; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Unhandled.Count < 1) { Helper.Print(args.Context, "Error: Missing precision."); return; } if (!Parse.TryFloat(filtererParameters.Unhandled.First(), out var value)) { Helper.Print(args.Context, "Error: Precision has wrong format."); return; } if (filtererParameters.Zone.HasValue) { Helper.Print(args.Context, "Error: zone is not supported."); return; } filtererParameters.Unhandled.Remove(filtererParameters.Unhandled.First()); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { new CountBiomes(args.Context, value, filtererParameters); } } } public BiomesCountCommand() { //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_005d: Expected O, but got Unknown CommandWrapper.Register("biomes_count", (int index) => (index == 0) ? CommandWrapper.Info("How precisely the biome is checked (meters). Lower value increases precision but takes longer to measure.") : FiltererParameters.Parameters, FiltererParameters.GetAutoComplete()); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); float value; if (filtererParameters.Unhandled.Count < 1) { Helper.Print(args.Context, "Error: Missing precision."); } else if (!Parse.TryFloat(filtererParameters.Unhandled.First(), out value)) { Helper.Print(args.Context, "Error: Precision has wrong format."); } else if (filtererParameters.Zone.HasValue) { Helper.Print(args.Context, "Error: zone is not supported."); } else { filtererParameters.Unhandled.Remove(filtererParameters.Unhandled.First()); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { new CountBiomes(args.Context, value, filtererParameters); } } }; <>c.<>9__0_1 = val; obj = (object)val; } Helper.Command("biomes_count", "[precision] [...args] - Counts biomes by sampling points with a given precision (meters).", (ConsoleEvent)obj); } } public class ChestsResetCommand { [CompilerGenerated] private static class <>O { public static ConsoleOptionsFetcher <0>__ChestNames; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; internal List <.ctor>b__0_0(int index) { if (index == 0) { return ResetChests.ChestNames(); } return DataParameters.Parameters; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { DataParameters dataParameters = new DataParameters(args, requireId: false); bool looted = Parse.Flag(dataParameters.Unhandled, "looted"); if (!dataParameters.Valid(args.Context)) { return; } string[] chestIds = ResetChests.ChestNames().ToArray(); HashSet allowedItems = new HashSet(); if (dataParameters.Ids().Count() > 0) { chestIds = new string[1] { dataParameters.Ids().First() }; HashSet hashSet = new HashSet(); foreach (string item in dataParameters.Ids().Skip(1)) { hashSet.Add(item); } allowedItems = hashSet; } if (!Helper.IsClient(args)) { Executor.AddOperation(new ResetChests(chestIds, allowedItems, looted, dataParameters, args.Context), dataParameters.Start); } } } public ChestsResetCommand() { //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_005d: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown CommandWrapper.Register("chests_reset", (int index) => (index == 0) ? ResetChests.ChestNames() : DataParameters.Parameters, DataParameters.GetAutoComplete()); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { DataParameters dataParameters = new DataParameters(args, requireId: false); bool looted = Parse.Flag(dataParameters.Unhandled, "looted"); if (dataParameters.Valid(args.Context)) { string[] chestIds = ResetChests.ChestNames().ToArray(); HashSet allowedItems = new HashSet(); if (dataParameters.Ids().Count() > 0) { chestIds = new string[1] { dataParameters.Ids().First() }; HashSet hashSet = new HashSet(); foreach (string item in dataParameters.Ids().Skip(1)) { hashSet.Add(item); } allowedItems = hashSet; } if (!Helper.IsClient(args)) { Executor.AddOperation(new ResetChests(chestIds, allowedItems, looted, dataParameters, args.Context), dataParameters.Start); } } }; <>c.<>9__0_1 = val; obj = (object)val; } object obj2 = <>O.<0>__ChestNames; if (obj2 == null) { ConsoleOptionsFetcher val2 = ResetChests.ChestNames; <>O.<0>__ChestNames = val2; obj2 = (object)val2; } Helper.Command("chests_reset", "[chest_name] [looted] [...item_ids] [...args] - Rerolls items at given chests, if they only have given items (all chests if no items specified).", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class ChestsSearchCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; public static ConsoleOptionsFetcher <>9__0_2; internal List <.ctor>b__0_0(int index) { if (index == 0) { return CommandWrapper.ObjectIds(); } return DataParameters.Parameters; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { DataParameters dataParameters = new DataParameters(args, requireId: true); if (dataParameters.Valid(args.Context) && !Helper.IsClient(args)) { new SearchChests(args.Context, dataParameters.Ids(), dataParameters); } } internal List <.ctor>b__0_2() { return ZNetScene.instance.GetPrefabNames(); } } public ChestsSearchCommand() { //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_005d: Expected O, but got Unknown //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) //IL_007c: Expected O, but got Unknown CommandWrapper.Register("chests_search", (int index) => (index == 0) ? CommandWrapper.ObjectIds() : DataParameters.Parameters, DataParameters.GetAutoComplete()); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { DataParameters dataParameters = new DataParameters(args, requireId: true); if (dataParameters.Valid(args.Context) && !Helper.IsClient(args)) { new SearchChests(args.Context, dataParameters.Ids(), dataParameters); } }; <>c.<>9__0_1 = val; obj = (object)val; } object obj2 = <>c.<>9__0_2; if (obj2 == null) { ConsoleOptionsFetcher val2 = () => ZNetScene.instance.GetPrefabNames(); <>c.<>9__0_2 = val2; obj2 = (object)val2; } Helper.Command("chests_search", "[id1,id2,...] [...args] - Searchs contents of chests and stands.", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class CleanChestsCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; internal List <.ctor>b__0_0(int index) { return FiltererParameters.Parameters; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { ZDO[] zDOs = EntityOperation.GetZDOs(filtererParameters); new CleanChests(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: true); } } } public CleanChestsCommand() { //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_005d: Expected O, but got Unknown CommandWrapper.Register("clean_chests", (int index) => FiltererParameters.Parameters, FiltererParameters.GetAutoComplete()); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { ZDO[] zDOs = EntityOperation.GetZDOs(filtererParameters); new CleanChests(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: true); } }; <>c.<>9__0_1 = val; obj = (object)val; } Helper.Command("clean_chests", "[...args] - Removes missing objects from chests.", (ConsoleEvent)obj); } } public class CleanDungeonsCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; internal List <.ctor>b__0_0(int index) { return FiltererParameters.Parameters; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { ZDO[] zDOs = EntityOperation.GetZDOs(filtererParameters); new CleanDungeons(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: true); } } } public CleanDungeonsCommand() { //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_005d: Expected O, but got Unknown CommandWrapper.Register("clean_dungeons", (int index) => FiltererParameters.Parameters, FiltererParameters.GetAutoComplete()); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { ZDO[] zDOs = EntityOperation.GetZDOs(filtererParameters); new CleanDungeons(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: true); } }; <>c.<>9__0_1 = val; obj = (object)val; } Helper.Command("clean_dungeons", "[...args] - Optimizes old dungeons.", (ConsoleEvent)obj); } } public class CleanDuplicatesCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; internal List <.ctor>b__0_0(int index) { return FiltererParameters.Parameters; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { new CleanDuplicates(args.Context, filtererParameters.Pin, alwaysPrint: true); } } } public CleanDuplicatesCommand() { //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_005d: Expected O, but got Unknown CommandWrapper.Register("clean_duplicates", (int index) => FiltererParameters.Parameters, FiltererParameters.GetAutoComplete()); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { new CleanDuplicates(args.Context, filtererParameters.Pin, alwaysPrint: true); } }; <>c.<>9__0_1 = val; obj = (object)val; } Helper.Command("clean_duplicates", "[...args] - Removes duplicated objects.", (ConsoleEvent)obj); } } public class CleanHealthCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; internal List <.ctor>b__0_0(int index) { return FiltererParameters.Parameters; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { ZDO[] zDOs = EntityOperation.GetZDOs(filtererParameters); new CleanHealth(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: true); } } } public CleanHealthCommand() { //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_005d: Expected O, but got Unknown CommandWrapper.Register("clean_health", (int index) => FiltererParameters.Parameters, FiltererParameters.GetAutoComplete()); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { ZDO[] zDOs = EntityOperation.GetZDOs(filtererParameters); new CleanHealth(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: true); } }; <>c.<>9__0_1 = val; obj = (object)val; } Helper.Command("clean_health", "[...args] - Removes excess health data from creatures and structures.", (ConsoleEvent)obj); } } public class CleanLocationsCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; internal List <.ctor>b__0_0(int index) { return FiltererParameters.Parameters; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { ZDO[] zDOs = EntityOperation.GetZDOs(filtererParameters); new CleanLocations(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: true); } } } public CleanLocationsCommand() { //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_005d: Expected O, but got Unknown CommandWrapper.Register("clean_locations", (int index) => FiltererParameters.Parameters, FiltererParameters.GetAutoComplete()); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { ZDO[] zDOs = EntityOperation.GetZDOs(filtererParameters); new CleanLocations(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: true); } }; <>c.<>9__0_1 = val; obj = (object)val; } Helper.Command("clean_locations", "[...args] - Removes missing locations.", (ConsoleEvent)obj); } } public class CleanObjectsCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; internal List <.ctor>b__0_0(int index) { return FiltererParameters.Parameters; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { ZDO[] zDOs = EntityOperation.GetZDOs(filtererParameters); new CleanObjects(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: true); } } } public CleanObjectsCommand() { //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_005d: Expected O, but got Unknown CommandWrapper.Register("clean_objects", (int index) => FiltererParameters.Parameters, FiltererParameters.GetAutoComplete()); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { ZDO[] zDOs = EntityOperation.GetZDOs(filtererParameters); new CleanObjects(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: true); } }; <>c.<>9__0_1 = val; obj = (object)val; } Helper.Command("clean_objects", "[...args] - Removes missing objects.", (ConsoleEvent)obj); } } public class CleanSpawnsCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; internal List <.ctor>b__0_0(int index) { return FiltererParameters.Parameters; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { ZDO[] zDOs = EntityOperation.GetZDOs(filtererParameters); new CleanSpawns(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: true); } } } public CleanSpawnsCommand() { //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_005d: Expected O, but got Unknown CommandWrapper.Register("clean_spawns", (int index) => FiltererParameters.Parameters, FiltererParameters.GetAutoComplete()); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { ZDO[] zDOs = EntityOperation.GetZDOs(filtererParameters); new CleanSpawns(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: true); } }; <>c.<>9__0_1 = val; obj = (object)val; } Helper.Command("clean_spawns", "[...args] - Removes timtestamps from the spawn system.", (ConsoleEvent)obj); } } public class CleanStandsCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; internal List <.ctor>b__0_0(int index) { return FiltererParameters.Parameters; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { ZDO[] zDOs = EntityOperation.GetZDOs(filtererParameters); new CleanStands(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: true); } } } public CleanStandsCommand() { //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_005d: Expected O, but got Unknown CommandWrapper.Register("clean_stands", (int index) => FiltererParameters.Parameters, FiltererParameters.GetAutoComplete()); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { ZDO[] zDOs = EntityOperation.GetZDOs(filtererParameters); new CleanStands(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: true); } }; <>c.<>9__0_1 = val; obj = (object)val; } Helper.Command("clean_stands", "[...args] - Removes missing objects from armor and item stands.", (ConsoleEvent)obj); } } public class LocationRegisterCommand { [CompilerGenerated] private static class <>O { public static ConsoleOptionsFetcher <0>__AllIds; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func?> <>9__0_2; public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; internal List? <.ctor>b__0_2(int subIndex) { return CommandWrapper.XZY("pos", "Coordinates for the position. If not given, player's position is used", subIndex); } internal List <.ctor>b__0_0(int index, int subIndex) { return index switch { 0 => LocationOperation.AllIds(), 1 => CommandWrapper.XZY("pos", "Coordinates for the position. If not given, player's position is used", subIndex), _ => null, }; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) if (args.Length == 0) { Helper.Print(args.Context, "Error: Missing the location id."); } else { if (Helper.IsClient(args)) { return; } string id = args[1]; Vector3 position = Helper.GetPlayerPosition(); if (args.Length > 2) { string[] array = Parse.Split(args[2], '='); if (array.Length == 1) { position = Parse.VectorXZY(Parse.Split(array[0])); } else { if (!(array[0].ToLower() == "pos")) { Helper.Print(args.Context, "Error: Invalid position argument."); return; } position = Parse.VectorXZY(Parse.Split(array[1])); } } new RegisterLocation(args.Context, id, position); } } } public LocationRegisterCommand() { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown Dictionary>> named = new Dictionary>> { { "pos", (int subIndex) => CommandWrapper.XZY("pos", "Coordinates for the position. If not given, player's position is used", subIndex) } }; CommandWrapper.Register("location_register", (int index, int subIndex) => index switch { 0 => LocationOperation.AllIds(), 1 => CommandWrapper.XZY("pos", "Coordinates for the position. If not given, player's position is used", subIndex), _ => null, }, named); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) if (args.Length == 0) { Helper.Print(args.Context, "Error: Missing the location id."); } else if (!Helper.IsClient(args)) { string id = args[1]; Vector3 position = Helper.GetPlayerPosition(); if (args.Length > 2) { string[] array = Parse.Split(args[2], '='); if (array.Length == 1) { position = Parse.VectorXZY(Parse.Split(array[0])); } else { if (!(array[0].ToLower() == "pos")) { Helper.Print(args.Context, "Error: Invalid position argument."); return; } position = Parse.VectorXZY(Parse.Split(array[1])); } } new RegisterLocation(args.Context, id, position); } }; <>c.<>9__0_1 = val; obj = (object)val; } object obj2 = <>O.<0>__AllIds; if (obj2 == null) { ConsoleOptionsFetcher val2 = LocationOperation.AllIds; <>O.<0>__AllIds = val2; obj2 = (object)val2; } Helper.Command("location_register", "[id] [x,z,y=player position] - Registers a location without placing it.", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class LocationsAddCommand { [CompilerGenerated] private static class <>O { public static ConsoleOptionsFetcher <0>__AllIds; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__0_0; internal void <.ctor>b__0_0(ConsoleEventArgs args) { LocationIdParameters locationIdParameters = new LocationIdParameters(args); if (!Helper.IsClient(args) && locationIdParameters.Valid(args.Context)) { Executor.AddOperation(new DistributeLocations(args.Context, locationIdParameters.Ids, locationIdParameters), autoStart: false); Executor.AddOperation(new SpawnLocations(args.Context, locationIdParameters.Ids, locationIdParameters), locationIdParameters.Start); } } } public LocationsAddCommand() { //IL_002e: 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_0039: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown LocationOperation.Register("locations_add"); object obj = <>c.<>9__0_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { LocationIdParameters locationIdParameters = new LocationIdParameters(args); if (!Helper.IsClient(args) && locationIdParameters.Valid(args.Context)) { Executor.AddOperation(new DistributeLocations(args.Context, locationIdParameters.Ids, locationIdParameters), autoStart: false); Executor.AddOperation(new SpawnLocations(args.Context, locationIdParameters.Ids, locationIdParameters), locationIdParameters.Start); } }; <>c.<>9__0_0 = val; obj = (object)val; } object obj2 = <>O.<0>__AllIds; if (obj2 == null) { ConsoleOptionsFetcher val2 = LocationOperation.AllIds; <>O.<0>__AllIds = val2; obj2 = (object)val2; } Helper.Command("locations_add", "[id1,id2,...] [...args] - Adds missing locations to generated areas.", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class LocationsCountCommand { [CompilerGenerated] private static class <>O { public static ConsoleOptionsFetcher <0>__AllIds; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__0_0; internal void <.ctor>b__0_0(ConsoleEventArgs args) { LocationIdParameters locationIdParameters = new LocationIdParameters(args); if (locationIdParameters.Valid(args.Context) && !Helper.IsClient(args)) { new CountLocations(args.Context, locationIdParameters.Ids, locationIdParameters.Log, locationIdParameters); } } } public LocationsCountCommand() { //IL_002e: 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_0039: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown LocationOperation.Register("locations_count"); object obj = <>c.<>9__0_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { LocationIdParameters locationIdParameters = new LocationIdParameters(args); if (locationIdParameters.Valid(args.Context) && !Helper.IsClient(args)) { new CountLocations(args.Context, locationIdParameters.Ids, locationIdParameters.Log, locationIdParameters); } }; <>c.<>9__0_0 = val; obj = (object)val; } object obj2 = <>O.<0>__AllIds; if (obj2 == null) { ConsoleOptionsFetcher val2 = LocationOperation.AllIds; <>O.<0>__AllIds = val2; obj2 = (object)val2; } Helper.Command("locations_count", "[id1,id2,...] [...args] - Counts locations and returns totals for each location type.", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class LocationsFixCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; internal List <.ctor>b__0_0(int index, int subIndex) { return null; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { LocationIdParameters args2 = new LocationIdParameters(args); if (!Helper.IsClient(args)) { new FixLocations(args.Context, args2); } } } public LocationsFixCommand() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown CommandWrapper.Register("locations_fix", (int index, int subIndex) => null); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { LocationIdParameters args2 = new LocationIdParameters(args); if (!Helper.IsClient(args)) { new FixLocations(args.Context, args2); } }; <>c.<>9__0_1 = val; obj = (object)val; } Helper.Command("locations_fix", "- Fixes missing location registrations.", (ConsoleEvent)obj); } } public class LocationsListCommand { [CompilerGenerated] private static class <>O { public static ConsoleOptionsFetcher <0>__AllIds; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__0_0; internal void <.ctor>b__0_0(ConsoleEventArgs args) { LocationIdParameters locationIdParameters = new LocationIdParameters(args); if (locationIdParameters.Valid(args.Context) && !Helper.IsClient(args)) { new ListLocationPositions(args.Context, locationIdParameters.Ids, locationIdParameters.Log, locationIdParameters); } } } public LocationsListCommand() { //IL_002e: 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_0039: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown LocationOperation.Register("locations_list"); object obj = <>c.<>9__0_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { LocationIdParameters locationIdParameters = new LocationIdParameters(args); if (locationIdParameters.Valid(args.Context) && !Helper.IsClient(args)) { new ListLocationPositions(args.Context, locationIdParameters.Ids, locationIdParameters.Log, locationIdParameters); } }; <>c.<>9__0_0 = val; obj = (object)val; } object obj2 = <>O.<0>__AllIds; if (obj2 == null) { ConsoleOptionsFetcher val2 = LocationOperation.AllIds; <>O.<0>__AllIds = val2; obj2 = (object)val2; } Helper.Command("locations_list", "[id1,id2,...] [...args] - Lists locations showing their position and biome.", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class LocationsRemoveCommand { [CompilerGenerated] private static class <>O { public static ConsoleOptionsFetcher <0>__AllIds; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__0_0; internal void <.ctor>b__0_0(ConsoleEventArgs args) { LocationIdParameters locationIdParameters = new LocationIdParameters(args); if (!Helper.IsClient(args) && locationIdParameters.Valid(args.Context)) { Executor.AddOperation(new RemoveLocations(args.Context, locationIdParameters.Ids, locationIdParameters), locationIdParameters.Start); } } } public LocationsRemoveCommand() { //IL_002e: 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_0039: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown LocationOperation.Register("locations_remove"); object obj = <>c.<>9__0_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { LocationIdParameters locationIdParameters = new LocationIdParameters(args); if (!Helper.IsClient(args) && locationIdParameters.Valid(args.Context)) { Executor.AddOperation(new RemoveLocations(args.Context, locationIdParameters.Ids, locationIdParameters), locationIdParameters.Start); } }; <>c.<>9__0_0 = val; obj = (object)val; } object obj2 = <>O.<0>__AllIds; if (obj2 == null) { ConsoleOptionsFetcher val2 = LocationOperation.AllIds; <>O.<0>__AllIds = val2; obj2 = (object)val2; } Helper.Command("locations_remove", "[id1,id2,...] [...args] - Removes locations and prevents new ones from appearing (until a command like 'genloc' or 'locations_add' is used).", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class LocationsResetCommand { [CompilerGenerated] private static class <>O { public static ConsoleOptionsFetcher <0>__AllIds; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__0_0; internal void <.ctor>b__0_0(ConsoleEventArgs args) { LocationIdParameters locationIdParameters = new LocationIdParameters(args); if (!Helper.IsClient(args) && locationIdParameters.Valid(args.Context)) { Executor.AddOperation(new RegenerateLocations(args.Context, locationIdParameters.Ids, locationIdParameters), locationIdParameters.Start); } } } public LocationsResetCommand() { //IL_002e: 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_0039: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown LocationOperation.Register("locations_reset"); object obj = <>c.<>9__0_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { LocationIdParameters locationIdParameters = new LocationIdParameters(args); if (!Helper.IsClient(args) && locationIdParameters.Valid(args.Context)) { Executor.AddOperation(new RegenerateLocations(args.Context, locationIdParameters.Ids, locationIdParameters), locationIdParameters.Start); } }; <>c.<>9__0_0 = val; obj = (object)val; } object obj2 = <>O.<0>__AllIds; if (obj2 == null) { ConsoleOptionsFetcher val2 = LocationOperation.AllIds; <>O.<0>__AllIds = val2; obj2 = (object)val2; } Helper.Command("locations_reset", "[id1,id2,...] [...args] - Resets locations by removing them and then placing them at the same position. Dungeons which have a random rotation will also get a new layout.", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class LocationsSwapCommand { [CompilerGenerated] private static class <>O { public static ConsoleOptionsFetcher <0>__AllIds; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__0_0; internal void <.ctor>b__0_0(ConsoleEventArgs args) { DataParameters dataParameters = new DataParameters(args, requireId: true, validate: false); if (dataParameters.Valid(args.Context) && !Helper.IsClient(args)) { new SwapLocations(args.Context, dataParameters.Ids(), dataParameters); } } } public LocationsSwapCommand() { //IL_002e: 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_0039: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown LocationOperation.Register("locations_swap"); object obj = <>c.<>9__0_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { DataParameters dataParameters = new DataParameters(args, requireId: true, validate: false); if (dataParameters.Valid(args.Context) && !Helper.IsClient(args)) { new SwapLocations(args.Context, dataParameters.Ids(), dataParameters); } }; <>c.<>9__0_0 = val; obj = (object)val; } object obj2 = <>O.<0>__AllIds; if (obj2 == null) { ConsoleOptionsFetcher val2 = LocationOperation.AllIds; <>O.<0>__AllIds = val2; obj2 = (object)val2; } Helper.Command("locations_swap", "[new id,id1,id2,...] [...args] - Swaps locations to a different one.", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class LocationUnregisterCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; internal List <.ctor>b__0_0(int index, int subIndex) { if (index == 0) { return CommandWrapper.XZY("pos", "Coordinates for the position. If not given, player's position is used", subIndex); } return null; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (!Helper.IsClient(args)) { Vector3 position = Helper.GetPlayerPosition(); if (args.Length > 1) { position = Parse.VectorXZY(Parse.Split(args[1])); } new UnregisterLocation(args.Context, position); } } } public LocationUnregisterCommand() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown CommandWrapper.Register("location_unregister", (int index, int subIndex) => (index == 0) ? CommandWrapper.XZY("pos", "Coordinates for the position. If not given, player's position is used", subIndex) : null); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (!Helper.IsClient(args)) { Vector3 position = Helper.GetPlayerPosition(); if (args.Length > 1) { position = Parse.VectorXZY(Parse.Split(args[1])); } new UnregisterLocation(args.Context, position); } }; <>c.<>9__0_1 = val; obj = (object)val; } Helper.Command("location_unregister", "[x,z,y=player position] - Removes location registration.", (ConsoleEvent)obj); } } public class ObjectsCountCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; public static ConsoleOptionsFetcher <>9__0_2; internal List <.ctor>b__0_0(int index) { if (index == 0) { return CommandWrapper.ObjectIds(); } return CountParameters.Parameters; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { CountParameters countParameters = new CountParameters(args); if (countParameters.Valid(args.Context) && !Helper.IsClient(args)) { new CountObjects(args.Context, countParameters.Ids(), countParameters, countParameters.Count); } } internal List <.ctor>b__0_2() { return ZNetScene.instance.GetPrefabNames(); } } public ObjectsCountCommand() { //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_005d: Expected O, but got Unknown //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) //IL_007c: Expected O, but got Unknown CommandWrapper.Register("objects_count", (int index) => (index == 0) ? CommandWrapper.ObjectIds() : CountParameters.Parameters, CountParameters.GetAutoComplete()); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { CountParameters countParameters = new CountParameters(args); if (countParameters.Valid(args.Context) && !Helper.IsClient(args)) { new CountObjects(args.Context, countParameters.Ids(), countParameters, countParameters.Count); } }; <>c.<>9__0_1 = val; obj = (object)val; } object obj2 = <>c.<>9__0_2; if (obj2 == null) { ConsoleOptionsFetcher val2 = () => ZNetScene.instance.GetPrefabNames(); <>c.<>9__0_2 = val2; obj2 = (object)val2; } Helper.Command("objects_count", "[id1,id2,...] [...args] - Counts objects.", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class ObjectsEditCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; public static ConsoleOptionsFetcher <>9__0_2; internal List <.ctor>b__0_0(int index) { if (index == 0) { return CommandWrapper.ObjectIds(); } return DataParameters.Parameters; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { DataParameters dataParameters = new DataParameters(args, requireId: true); if (dataParameters.Valid(args.Context) && !Helper.IsClient(args)) { Executor.AddOperation(new EditObjects(args.Context, dataParameters.Ids(), dataParameters), dataParameters.Start); } } internal List <.ctor>b__0_2() { return ZNetScene.instance.GetPrefabNames(); } } public ObjectsEditCommand() { //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_005d: Expected O, but got Unknown //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) //IL_007c: Expected O, but got Unknown CommandWrapper.Register("objects_edit", (int index) => (index == 0) ? CommandWrapper.ObjectIds() : DataParameters.Parameters, DataParameters.GetAutoComplete()); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { DataParameters dataParameters = new DataParameters(args, requireId: true); if (dataParameters.Valid(args.Context) && !Helper.IsClient(args)) { Executor.AddOperation(new EditObjects(args.Context, dataParameters.Ids(), dataParameters), dataParameters.Start); } }; <>c.<>9__0_1 = val; obj = (object)val; } object obj2 = <>c.<>9__0_2; if (obj2 == null) { ConsoleOptionsFetcher val2 = () => ZNetScene.instance.GetPrefabNames(); <>c.<>9__0_2 = val2; obj2 = (object)val2; } Helper.Command("objects_edit", "[id1,id2,...] [...args] - Edits objects.", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class ObjectsListCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; public static ConsoleOptionsFetcher <>9__0_2; internal List <.ctor>b__0_0(int index) { if (index == 0) { return CommandWrapper.ObjectIds(); } return DataParameters.Parameters; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { DataParameters dataParameters = new DataParameters(args, requireId: false); if (dataParameters.Valid(args.Context) && !Helper.IsClient(args)) { new ListObjectPositions(args.Context, dataParameters.Ids(), dataParameters); } } internal List <.ctor>b__0_2() { return ZNetScene.instance.GetPrefabNames(); } } public ObjectsListCommand() { //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_005d: Expected O, but got Unknown //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) //IL_007c: Expected O, but got Unknown CommandWrapper.Register("objects_list", (int index) => (index == 0) ? CommandWrapper.ObjectIds() : DataParameters.Parameters, DataParameters.GetAutoComplete()); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { DataParameters dataParameters = new DataParameters(args, requireId: false); if (dataParameters.Valid(args.Context) && !Helper.IsClient(args)) { new ListObjectPositions(args.Context, dataParameters.Ids(), dataParameters); } }; <>c.<>9__0_1 = val; obj = (object)val; } object obj2 = <>c.<>9__0_2; if (obj2 == null) { ConsoleOptionsFetcher val2 = () => ZNetScene.instance.GetPrefabNames(); <>c.<>9__0_2 = val2; obj2 = (object)val2; } Helper.Command("objects_list", "[id1,id2,...] [...args] - Lists objects showing their position and biome.", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class ObjetsRefreshCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; public static ConsoleOptionsFetcher <>9__0_2; internal List <.ctor>b__0_0(int index) { if (index == 0) { return CommandWrapper.ObjectIds(); } return DataParameters.Parameters; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { DataParameters dataParameters = new DataParameters(args, requireId: false); if (dataParameters.Valid(args.Context) && !Helper.IsClient(args)) { Executor.AddOperation(new RefreshObjects(args.Context, dataParameters.Ids(), dataParameters), dataParameters.Start); } } internal List <.ctor>b__0_2() { return ZNetScene.instance.GetPrefabNames(); } } public ObjetsRefreshCommand() { //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_005d: Expected O, but got Unknown //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) //IL_007c: Expected O, but got Unknown CommandWrapper.Register("objects_refresh", (int index) => (index == 0) ? CommandWrapper.ObjectIds() : DataParameters.Parameters, DataParameters.GetAutoComplete()); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { DataParameters dataParameters = new DataParameters(args, requireId: false); if (dataParameters.Valid(args.Context) && !Helper.IsClient(args)) { Executor.AddOperation(new RefreshObjects(args.Context, dataParameters.Ids(), dataParameters), dataParameters.Start); } }; <>c.<>9__0_1 = val; obj = (object)val; } object obj2 = <>c.<>9__0_2; if (obj2 == null) { ConsoleOptionsFetcher val2 = () => ZNetScene.instance.GetPrefabNames(); <>c.<>9__0_2 = val2; obj2 = (object)val2; } Helper.Command("objects_refresh", "[id1,id2,...] [...args] - Refreshes / respawn objects.", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class ObjectsRemoveCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; public static ConsoleOptionsFetcher <>9__0_2; internal List <.ctor>b__0_0(int index) { if (index == 0) { return CommandWrapper.ObjectIds(); } return DataParameters.Parameters; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { DataParameters dataParameters = new DataParameters(args, requireId: true); if (dataParameters.Valid(args.Context) && !Helper.IsClient(args)) { Executor.AddOperation(new RemoveObjects(args.Context, dataParameters.Ids(), dataParameters), dataParameters.Start); } } internal List <.ctor>b__0_2() { return ZNetScene.instance.GetPrefabNames(); } } public ObjectsRemoveCommand() { //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_005d: Expected O, but got Unknown //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) //IL_007c: Expected O, but got Unknown CommandWrapper.Register("objects_remove", (int index) => (index == 0) ? CommandWrapper.ObjectIds() : DataParameters.Parameters, DataParameters.GetAutoComplete()); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { DataParameters dataParameters = new DataParameters(args, requireId: true); if (dataParameters.Valid(args.Context) && !Helper.IsClient(args)) { Executor.AddOperation(new RemoveObjects(args.Context, dataParameters.Ids(), dataParameters), dataParameters.Start); } }; <>c.<>9__0_1 = val; obj = (object)val; } object obj2 = <>c.<>9__0_2; if (obj2 == null) { ConsoleOptionsFetcher val2 = () => ZNetScene.instance.GetPrefabNames(); <>c.<>9__0_2 = val2; obj2 = (object)val2; } Helper.Command("objects_remove", "[id1,id2,...] [...args] - Removes objects.", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class ObjectsSwapCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; public static ConsoleOptionsFetcher <>9__0_2; internal List <.ctor>b__0_0(int index) { if (index == 0) { return CommandWrapper.ObjectIds(); } return DataParameters.Parameters; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { DataParameters dataParameters = new DataParameters(args, requireId: true); if (dataParameters.Valid(args.Context) && !Helper.IsClient(args)) { Executor.AddOperation(new SwapObjects(args.Context, dataParameters.Ids(), dataParameters), dataParameters.Start); } } internal List <.ctor>b__0_2() { return ZNetScene.instance.GetPrefabNames(); } } public ObjectsSwapCommand() { //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_005d: Expected O, but got Unknown //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) //IL_007c: Expected O, but got Unknown CommandWrapper.Register("objects_swap", (int index) => (index == 0) ? CommandWrapper.ObjectIds() : DataParameters.Parameters, DataParameters.GetAutoComplete()); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { DataParameters dataParameters = new DataParameters(args, requireId: true); if (dataParameters.Valid(args.Context) && !Helper.IsClient(args)) { Executor.AddOperation(new SwapObjects(args.Context, dataParameters.Ids(), dataParameters), dataParameters.Start); } }; <>c.<>9__0_1 = val; obj = (object)val; } object obj2 = <>c.<>9__0_2; if (obj2 == null) { ConsoleOptionsFetcher val2 = () => ZNetScene.instance.GetPrefabNames(); <>c.<>9__0_2 = val2; obj2 = (object)val2; } Helper.Command("objects_swap", "[new id,id1,id2,...] [...args] - Swaps objects to a different one.", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class SavingCommands { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__1_0; public static ConsoleEvent <>9__1_1; internal void <.ctor>b__1_0(ConsoleEventArgs args) { if (!Helper.IsClient(args)) { SavingDisabled = true; Helper.Print(args.Context, "Saving disabled."); } } internal void <.ctor>b__1_1(ConsoleEventArgs args) { if (!Helper.IsClient(args)) { SavingDisabled = false; ZoneSystem.instance.m_didZoneTest = false; Helper.Print(args.Context, "Saving enabled."); } } } public static bool SavingDisabled; public SavingCommands() { //IL_002e: 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_0039: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown CommandWrapper.RegisterEmpty("save_disable"); object obj = <>c.<>9__1_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { if (!Helper.IsClient(args)) { SavingDisabled = true; Helper.Print(args.Context, "Saving disabled."); } }; <>c.<>9__1_0 = val; obj = (object)val; } Helper.Command("save_disable", "- Disables saving.", (ConsoleEvent)obj); CommandWrapper.RegisterEmpty("save_enable"); object obj2 = <>c.<>9__1_1; if (obj2 == null) { ConsoleEvent val2 = delegate(ConsoleEventArgs args) { if (!Helper.IsClient(args)) { SavingDisabled = false; ZoneSystem.instance.m_didZoneTest = false; Helper.Print(args.Context, "Saving enabled."); } }; <>c.<>9__1_1 = val2; obj2 = (object)val2; } Helper.Command("save_enable", "- Enables saving.", (ConsoleEvent)obj2); } } [HarmonyPatch(typeof(ZoneSystem), "SkipSaving")] public class SkipSaving { private static bool Prefix(ref bool __result) { if (SavingCommands.SavingDisabled) { __result = true; return false; } return true; } } public class StartStopCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__0_0; public static ConsoleEvent <>9__0_1; public static ConsoleEvent <>9__0_2; internal void <.ctor>b__0_0(ConsoleEventArgs args) { if (!Helper.IsClient(args)) { Executor.SetUser(ServerExecution.User); Executor.StartExecution(); } } internal void <.ctor>b__0_1(ConsoleEventArgs args) { if (!Helper.IsClient(args)) { Executor.StopExecution(); } } internal void <.ctor>b__0_2(ConsoleEventArgs args) { if (Helper.IsClient(args)) { return; } List operations = Executor.GetOperations(); if (operations.Count == 0) { Helper.Print(args.Context, "No operations queued."); return; } Helper.Print(args.Context, $"Queued operations ({operations.Count}):"); for (int i = 0; i < operations.Count; i++) { string info = operations[i].GetInfo(); Helper.Print(args.Context, $"{i + 1}. {info}"); } } } public StartStopCommand() { //IL_002e: 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_0039: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown CommandWrapper.RegisterEmpty("start"); object obj = <>c.<>9__0_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { if (!Helper.IsClient(args)) { Executor.SetUser(ServerExecution.User); Executor.StartExecution(); } }; <>c.<>9__0_0 = val; obj = (object)val; } Helper.Command("start", "- Starts execution of operations.", (ConsoleEvent)obj); CommandWrapper.RegisterEmpty("stop"); object obj2 = <>c.<>9__0_1; if (obj2 == null) { ConsoleEvent val2 = delegate(ConsoleEventArgs args) { if (!Helper.IsClient(args)) { Executor.StopExecution(); } }; <>c.<>9__0_1 = val2; obj2 = (object)val2; } Helper.Command("stop", "- Stops execution of operations.", (ConsoleEvent)obj2); CommandWrapper.RegisterEmpty("uw_check"); object obj3 = <>c.<>9__0_2; if (obj3 == null) { ConsoleEvent val3 = delegate(ConsoleEventArgs args) { if (!Helper.IsClient(args)) { List operations = Executor.GetOperations(); if (operations.Count == 0) { Helper.Print(args.Context, "No operations queued."); } else { Helper.Print(args.Context, $"Queued operations ({operations.Count}):"); for (int i = 0; i < operations.Count; i++) { string info = operations[i].GetInfo(); Helper.Print(args.Context, $"{i + 1}. {info}"); } } } }; <>c.<>9__0_2 = val3; obj3 = (object)val3; } Helper.Command("uw_check", "- Prints list of queued operations.", (ConsoleEvent)obj3); } } public class TempleVersionCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__1_0; public static ConsoleEvent <>9__1_1; public static ConsoleOptionsFetcher <>9__1_2; internal List <.ctor>b__1_0(int index) { return index switch { 0 => Versions, 1 => new List(1) { "start" }, _ => null, }; } internal void <.ctor>b__1_1(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); string version = ""; if (filtererParameters.Unhandled.Contains("mistlands")) { version = "mistlands"; } if (filtererParameters.Unhandled.Contains("ashlands")) { version = "ashlands"; } if (!Helper.IsClient(args)) { Executor.AddOperation(new TempleVersion(args.Context, version), filtererParameters.Start); } } internal List <.ctor>b__1_2() { return Versions; } } private static readonly List Versions = new List(2) { "mistlands", "ashlands" }; public TempleVersionCommand() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_006c: 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_0077: Expected O, but got Unknown CommandWrapper.Register("temple_gen", (int index) => index switch { 0 => Versions, 1 => new List(1) { "start" }, _ => null, }); object obj = <>c.<>9__1_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); string version = ""; if (filtererParameters.Unhandled.Contains("mistlands")) { version = "mistlands"; } if (filtererParameters.Unhandled.Contains("ashlands")) { version = "ashlands"; } if (!Helper.IsClient(args)) { Executor.AddOperation(new TempleVersion(args.Context, version), filtererParameters.Start); } }; <>c.<>9__1_1 = val; obj = (object)val; } object obj2 = <>c.<>9__1_2; if (obj2 == null) { ConsoleOptionsFetcher val2 = () => Versions; <>c.<>9__1_2 = val2; obj2 = (object)val2; } Helper.Command("temple_gen", "[version] - Sets the altar generation version.", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class TimeChangeCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; public static Func> <>9__0_2; public static ConsoleEvent <>9__0_3; internal List <.ctor>b__0_0(int index) { if (index == 0) { return CommandWrapper.Info("Amount of seconds to go forward or backward."); } return null; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { if (args.Args.Count() == 0) { Helper.Print(args.Context, "Error: Missing seconds."); return; } int num = Parse.Int(args[1]); if (num == 0) { Helper.Print(args.Context, "Error: Invalid format for seconds."); } else if (args.Args.Count() > 2) { Helper.Print(args.Context, "Error: Too many parameters."); } else if (!Helper.IsClient(args)) { new ChangeTime(args.Context, num); } } internal List <.ctor>b__0_2(int index) { if (index == 0) { return CommandWrapper.Info("Amount of days to go forward or backward."); } return null; } internal void <.ctor>b__0_3(ConsoleEventArgs args) { if (args.Args.Count() == 0) { Helper.Print(args.Context, "Error: Missing day."); return; } int num = Parse.Int(args[1]); if (num == 0) { Helper.Print(args.Context, "Error: Invalid format for day."); } else if (args.Args.Count() > 2) { Helper.Print(args.Context, "Error: Too many parameters."); } else if (!Helper.IsClient(args)) { new ChangeTime(args.Context, num * EnvMan.instance.m_dayLengthSec); } } } public TimeChangeCommand() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_00a5: 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_00b0: Expected O, but got Unknown CommandWrapper.Register("time_change", (int index) => (index == 0) ? CommandWrapper.Info("Amount of seconds to go forward or backward.") : null); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { if (args.Args.Count() == 0) { Helper.Print(args.Context, "Error: Missing seconds."); } else { int num2 = Parse.Int(args[1]); if (num2 == 0) { Helper.Print(args.Context, "Error: Invalid format for seconds."); } else if (args.Args.Count() > 2) { Helper.Print(args.Context, "Error: Too many parameters."); } else if (!Helper.IsClient(args)) { new ChangeTime(args.Context, num2); } } }; <>c.<>9__0_1 = val; obj = (object)val; } Helper.Command("time_change", "[seconds] - Changes the world time and updates object timestamps.", (ConsoleEvent)obj); CommandWrapper.Register("time_change_day", (int index) => (index == 0) ? CommandWrapper.Info("Amount of days to go forward or backward.") : null); object obj2 = <>c.<>9__0_3; if (obj2 == null) { ConsoleEvent val2 = delegate(ConsoleEventArgs args) { if (args.Args.Count() == 0) { Helper.Print(args.Context, "Error: Missing day."); } else { int num = Parse.Int(args[1]); if (num == 0) { Helper.Print(args.Context, "Error: Invalid format for day."); } else if (args.Args.Count() > 2) { Helper.Print(args.Context, "Error: Too many parameters."); } else if (!Helper.IsClient(args)) { new ChangeTime(args.Context, num * EnvMan.instance.m_dayLengthSec); } } }; <>c.<>9__0_3 = val2; obj2 = (object)val2; } Helper.Command("time_change_day", "[days] - Changes the world time and updates object timestamps.", (ConsoleEvent)obj2); } } public class TimeSetCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; public static Func> <>9__0_2; public static ConsoleEvent <>9__0_3; internal List <.ctor>b__0_0(int index) { if (index == 0) { return CommandWrapper.Info("The amount of seconds to set the time."); } return null; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { if (args.Args.Count() == 0) { Helper.Print(args.Context, "Error: Missing seconds."); return; } int num = Parse.Int(args[1]); if (num == 0) { Helper.Print(args.Context, "Error: Invalid format for seconds."); } else if (args.Args.Count() > 2) { Helper.Print(args.Context, "Error: Too many parameters."); } else if (!Helper.IsClient(args)) { new SetTime(args.Context, num); } } internal List <.ctor>b__0_2(int index) { if (index == 0) { return CommandWrapper.Info("The day to set the time."); } return null; } internal void <.ctor>b__0_3(ConsoleEventArgs args) { if (args.Args.Count() == 0) { Helper.Print(args.Context, "Error: Missing day."); return; } int num = Parse.Int(args[1]); if (num == 0) { Helper.Print(args.Context, "Error: Invalid format for day."); } else if (args.Args.Count() > 2) { Helper.Print(args.Context, "Error: Too many parameters."); } else if (!Helper.IsClient(args)) { new SetTime(args.Context, num * EnvMan.instance.m_dayLengthSec); } } } public TimeSetCommand() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_00a5: 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_00b0: Expected O, but got Unknown CommandWrapper.Register("time_set", (int index) => (index == 0) ? CommandWrapper.Info("The amount of seconds to set the time.") : null); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { if (args.Args.Count() == 0) { Helper.Print(args.Context, "Error: Missing seconds."); } else { int num2 = Parse.Int(args[1]); if (num2 == 0) { Helper.Print(args.Context, "Error: Invalid format for seconds."); } else if (args.Args.Count() > 2) { Helper.Print(args.Context, "Error: Too many parameters."); } else if (!Helper.IsClient(args)) { new SetTime(args.Context, num2); } } }; <>c.<>9__0_1 = val; obj = (object)val; } Helper.Command("time_set", "[seconds] - Sets the world time and updates object timestamps.", (ConsoleEvent)obj); CommandWrapper.Register("time_set_day", (int index) => (index == 0) ? CommandWrapper.Info("The day to set the time.") : null); object obj2 = <>c.<>9__0_3; if (obj2 == null) { ConsoleEvent val2 = delegate(ConsoleEventArgs args) { if (args.Args.Count() == 0) { Helper.Print(args.Context, "Error: Missing day."); } else { int num = Parse.Int(args[1]); if (num == 0) { Helper.Print(args.Context, "Error: Invalid format for day."); } else if (args.Args.Count() > 2) { Helper.Print(args.Context, "Error: Too many parameters."); } else if (!Helper.IsClient(args)) { new SetTime(args.Context, num * EnvMan.instance.m_dayLengthSec); } } }; <>c.<>9__0_3 = val2; obj2 = (object)val2; } Helper.Command("time_set_day", "[days] - Sets the world time and updates object timestamps.", (ConsoleEvent)obj2); } } public class UpgradeCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; public static ConsoleOptionsFetcher <>9__0_2; internal List <.ctor>b__0_0(int index) { if (index != 0) { return FiltererParameters.Parameters; } return Upgrade.Types; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); string type = ""; foreach (string type2 in Upgrade.Types) { if (Parse.Flag(filtererParameters.Unhandled, type2.ToLower())) { type = type2; } } if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { new Upgrade(args.Context, type, filtererParameters.Unhandled, filtererParameters); } } internal List <.ctor>b__0_2() { return Upgrade.Types; } } public UpgradeCommand() { //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_005d: Expected O, but got Unknown //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) //IL_007c: Expected O, but got Unknown CommandWrapper.Register("upgrade", (int index) => (index != 0) ? FiltererParameters.Parameters : Upgrade.Types, FiltererParameters.GetAutoComplete()); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); string type = ""; foreach (string type2 in Upgrade.Types) { if (Parse.Flag(filtererParameters.Unhandled, type2.ToLower())) { type = type2; } } if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { new Upgrade(args.Context, type, filtererParameters.Unhandled, filtererParameters); } }; <>c.<>9__0_1 = val; obj = (object)val; } object obj2 = <>c.<>9__0_2; if (obj2 == null) { ConsoleOptionsFetcher val2 = () => Upgrade.Types; <>c.<>9__0_2 = val2; obj2 = (object)val2; } Helper.Command("upgrade", "[operation] [...args] - Performs a predefined upgrade operation.", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class VegetationAddCommand { [CompilerGenerated] private static class <>O { public static ConsoleOptionsFetcher <0>__AllIds; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__0_0; internal void <.ctor>b__0_0(ConsoleEventArgs args) { IdParameters idParameters = new IdParameters(args); if (idParameters.Valid(args.Context) && !Helper.IsClient(args)) { Executor.AddOperation(new AddVegetation(args.Context, idParameters.VegIds(), idParameters), idParameters.Start); } } } public VegetationAddCommand() { //IL_002e: 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_0039: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown VegetationOperation.Register("vegetation_add"); object obj = <>c.<>9__0_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { IdParameters idParameters = new IdParameters(args); if (idParameters.Valid(args.Context) && !Helper.IsClient(args)) { Executor.AddOperation(new AddVegetation(args.Context, idParameters.VegIds(), idParameters), idParameters.Start); } }; <>c.<>9__0_0 = val; obj = (object)val; } object obj2 = <>O.<0>__AllIds; if (obj2 == null) { ConsoleOptionsFetcher val2 = VegetationOperation.AllIds; <>O.<0>__AllIds = val2; obj2 = (object)val2; } Helper.Command("vegetation_add", "[id1,id2,...] [...args] - Adds vegetation to generated areas.", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class VegetationRemoveCommand { [CompilerGenerated] private static class <>O { public static ConsoleOptionsFetcher <0>__AllIds; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__0_0; internal void <.ctor>b__0_0(ConsoleEventArgs args) { IdParameters idParameters = new IdParameters(args); if (idParameters.Valid(args.Context) && !Helper.IsClient(args)) { Executor.AddOperation(new RemoveVegetation(args.Context, idParameters.VegIds(), idParameters), idParameters.Start); } } } public VegetationRemoveCommand() { //IL_002e: 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_0039: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown VegetationOperation.Register("vegetation_remove"); object obj = <>c.<>9__0_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { IdParameters idParameters = new IdParameters(args); if (idParameters.Valid(args.Context) && !Helper.IsClient(args)) { Executor.AddOperation(new RemoveVegetation(args.Context, idParameters.VegIds(), idParameters), idParameters.Start); } }; <>c.<>9__0_0 = val; obj = (object)val; } object obj2 = <>O.<0>__AllIds; if (obj2 == null) { ConsoleOptionsFetcher val2 = VegetationOperation.AllIds; <>O.<0>__AllIds = val2; obj2 = (object)val2; } Helper.Command("vegetation_remove", "[id1,id2,...] [...args] - Removes vegetation from generated areas.", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class VegetationResetCommand { [CompilerGenerated] private static class <>O { public static ConsoleOptionsFetcher <0>__AllIds; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__0_0; internal void <.ctor>b__0_0(ConsoleEventArgs args) { IdParameters idParameters = new IdParameters(args); if (idParameters.Valid(args.Context) && !Helper.IsClient(args)) { Executor.AddOperation(new ResetVegetation(args.Context, idParameters.VegIds(), idParameters), idParameters.Start); } } } public VegetationResetCommand() { //IL_002e: 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_0039: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown VegetationOperation.Register("vegetation_reset"); object obj = <>c.<>9__0_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { IdParameters idParameters = new IdParameters(args); if (idParameters.Valid(args.Context) && !Helper.IsClient(args)) { Executor.AddOperation(new ResetVegetation(args.Context, idParameters.VegIds(), idParameters), idParameters.Start); } }; <>c.<>9__0_0 = val; obj = (object)val; } object obj2 = <>O.<0>__AllIds; if (obj2 == null) { ConsoleOptionsFetcher val2 = VegetationOperation.AllIds; <>O.<0>__AllIds = val2; obj2 = (object)val2; } Helper.Command("vegetation_reset", "[id1,id2,...] [...args] - Removes and adds vegetation to generated areas.", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class VerboseCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__0_0; internal void <.ctor>b__0_0(ConsoleEventArgs args) { if (!Helper.IsClient(args)) { Settings.configVerbose.Value = !Settings.Verbose; if (Settings.Verbose) { Helper.Print(args.Context, "Verbose mode enabled."); } else { Helper.Print(args.Context, "Verbose mode disabled."); } } } } public VerboseCommand() { //IL_002e: 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_0039: Expected O, but got Unknown CommandWrapper.RegisterEmpty("verbose"); object obj = <>c.<>9__0_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { if (!Helper.IsClient(args)) { Settings.configVerbose.Value = !Settings.Verbose; if (Settings.Verbose) { Helper.Print(args.Context, "Verbose mode enabled."); } else { Helper.Print(args.Context, "Verbose mode disabled."); } } }; <>c.<>9__0_0 = val; obj = (object)val; } Helper.Command("verbose", "- Toggles the verbose mode.", (ConsoleEvent)obj); } } public class WorldCleanCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; internal List <.ctor>b__0_0(int index) { return FiltererParameters.Parameters; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { ZDO[] zDOs = EntityOperation.GetZDOs(filtererParameters); new CleanDuplicates(args.Context, filtererParameters.Pin, alwaysPrint: false); new CleanLocations(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: false); new CleanObjects(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: false); new CleanChests(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: false); new CleanStands(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: false); new CleanDungeons(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: false); new CleanSpawns(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: false); new CleanHealth(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: false); args.Context.AddString("World cleaned."); } } } public WorldCleanCommand() { //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_005d: Expected O, but got Unknown CommandWrapper.Register("world_clean", (int index) => FiltererParameters.Parameters, FiltererParameters.GetAutoComplete()); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { ZDO[] zDOs = EntityOperation.GetZDOs(filtererParameters); new CleanDuplicates(args.Context, filtererParameters.Pin, alwaysPrint: false); new CleanLocations(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: false); new CleanObjects(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: false); new CleanChests(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: false); new CleanStands(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: false); new CleanDungeons(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: false); new CleanSpawns(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: false); new CleanHealth(args.Context, zDOs, filtererParameters.Pin, alwaysPrint: false); args.Context.AddString("World cleaned."); } }; <>c.<>9__0_1 = val; obj = (object)val; } Helper.Command("world_clean", "[...args] - Removes missing locations and objects.", (ConsoleEvent)obj); } } public class WorldResetCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; public static ConsoleOptionsFetcher <>9__0_2; internal List <.ctor>b__0_0(int index) { return FiltererParameters.Parameters; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (!filtererParameters.Valid(args.Context) || Helper.IsClient(args)) { return; } LocationOperation.AllIds(); Terminal context = args.Context; HashSet hashSet = new HashSet(); foreach (string item in LocationOperation.AllIds()) { hashSet.Add(item); } Executor.AddOperation(new RemoveLocations(context, hashSet, filtererParameters), autoStart: false); context = args.Context; hashSet = new HashSet(); foreach (string item2 in LocationOperation.AllIds()) { hashSet.Add(item2); } Executor.AddOperation(new DistributeLocations(context, hashSet, filtererParameters), autoStart: false); Executor.AddOperation(new ResetZones(args.Context, filtererParameters), filtererParameters.Start); } internal List <.ctor>b__0_2() { return FiltererParameters.Parameters; } } public WorldResetCommand() { //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_005d: Expected O, but got Unknown //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) //IL_007c: Expected O, but got Unknown CommandWrapper.Register("world_reset", (int index) => FiltererParameters.Parameters, FiltererParameters.GetAutoComplete()); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { LocationOperation.AllIds(); Terminal context = args.Context; HashSet hashSet = new HashSet(); foreach (string item in LocationOperation.AllIds()) { hashSet.Add(item); } Executor.AddOperation(new RemoveLocations(context, hashSet, filtererParameters), autoStart: false); context = args.Context; hashSet = new HashSet(); foreach (string item2 in LocationOperation.AllIds()) { hashSet.Add(item2); } Executor.AddOperation(new DistributeLocations(context, hashSet, filtererParameters), autoStart: false); Executor.AddOperation(new ResetZones(args.Context, filtererParameters), filtererParameters.Start); } }; <>c.<>9__0_1 = val; obj = (object)val; } object obj2 = <>c.<>9__0_2; if (obj2 == null) { ConsoleOptionsFetcher val2 = () => FiltererParameters.Parameters; <>c.<>9__0_2 = val2; obj2 = (object)val2; } Helper.Command("world_reset", "[...args] - Resets zones and locations.", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class WorldVersionCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__1_0; public static ConsoleEvent <>9__1_1; public static ConsoleOptionsFetcher <>9__1_2; internal List <.ctor>b__1_0(int index) { return index switch { 0 => Versions, 1 => new List(1) { "start" }, _ => null, }; } internal void <.ctor>b__1_1(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); int num = -1; if (filtererParameters.Unhandled.Contains("legacy")) { num = 0; } if (filtererParameters.Unhandled.Contains("hh")) { num = 1; } if (filtererParameters.Unhandled.Contains("mistlands")) { num = 2; } if (num == -1) { Helper.Print(args.Context, "Error: Missing or incorrect version parameter."); } else if (!Helper.IsClient(args)) { Executor.AddOperation(new WorldVersion(args.Context, num), filtererParameters.Start); } } internal List <.ctor>b__1_2() { return Versions; } } private static readonly List Versions = new List(3) { "legacy", "hh", "mistlands" }; public WorldVersionCommand() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_006c: 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_0077: Expected O, but got Unknown CommandWrapper.Register("world_gen", (int index) => index switch { 0 => Versions, 1 => new List(1) { "start" }, _ => null, }); object obj = <>c.<>9__1_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); int num = -1; if (filtererParameters.Unhandled.Contains("legacy")) { num = 0; } if (filtererParameters.Unhandled.Contains("hh")) { num = 1; } if (filtererParameters.Unhandled.Contains("mistlands")) { num = 2; } if (num == -1) { Helper.Print(args.Context, "Error: Missing or incorrect version parameter."); } else if (!Helper.IsClient(args)) { Executor.AddOperation(new WorldVersion(args.Context, num), filtererParameters.Start); } }; <>c.<>9__1_1 = val; obj = (object)val; } object obj2 = <>c.<>9__1_2; if (obj2 == null) { ConsoleOptionsFetcher val2 = () => Versions; <>c.<>9__1_2 = val2; obj2 = (object)val2; } Helper.Command("world_gen", "[version] - Sets the world generation version.", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class ZonesGenerateCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; public static ConsoleOptionsFetcher <>9__0_2; internal List <.ctor>b__0_0(int index) { return FiltererParameters.Parameters; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args) { TargetZones = TargetZones.Ungenerated, SafeZones = 0 }; bool empty = Parse.Flag(filtererParameters.Unhandled, "empty"); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { Executor.AddOperation(new Generate(args.Context, filtererParameters, empty), filtererParameters.Start); } } internal List <.ctor>b__0_2() { string[] names = Enum.GetNames(typeof(Biome)); List list = new List(names.Length); list.AddRange(names); return list; } } public ZonesGenerateCommand() { //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_005d: Expected O, but got Unknown //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) //IL_007c: Expected O, but got Unknown CommandWrapper.Register("zones_generate", (int index) => FiltererParameters.Parameters, FiltererParameters.GetAutoComplete()); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args) { TargetZones = TargetZones.Ungenerated, SafeZones = 0 }; bool empty = Parse.Flag(filtererParameters.Unhandled, "empty"); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { Executor.AddOperation(new Generate(args.Context, filtererParameters, empty), filtererParameters.Start); } }; <>c.<>9__0_1 = val; obj = (object)val; } object obj2 = <>c.<>9__0_2; if (obj2 == null) { ConsoleOptionsFetcher val2 = delegate { string[] names = Enum.GetNames(typeof(Biome)); List list = new List(names.Length); list.AddRange(names); return list; }; <>c.<>9__0_2 = val2; obj2 = (object)val2; } Helper.Command("zones_generate", "[...args] [empty] - Pre-generates areas without having to visit them.", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class ZonesResetCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; public static ConsoleOptionsFetcher <>9__0_2; internal List <.ctor>b__0_0(int index) { return FiltererParameters.Parameters; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { Executor.AddOperation(new ResetZones(args.Context, filtererParameters), filtererParameters.Start); } } internal List <.ctor>b__0_2() { return FiltererParameters.Parameters; } } public ZonesResetCommand() { //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_005d: Expected O, but got Unknown //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) //IL_007c: Expected O, but got Unknown CommandWrapper.Register("zones_reset", (int index) => FiltererParameters.Parameters, FiltererParameters.GetAutoComplete()); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { Executor.AddOperation(new ResetZones(args.Context, filtererParameters), filtererParameters.Start); } }; <>c.<>9__0_1 = val; obj = (object)val; } object obj2 = <>c.<>9__0_2; if (obj2 == null) { ConsoleOptionsFetcher val2 = () => FiltererParameters.Parameters; <>c.<>9__0_2 = val2; obj2 = (object)val2; } Helper.Command("zones_reset", "[...args] - Destroys areas making them ungenerated. These areas will be generated when visited.", (ConsoleEvent)obj, (ConsoleOptionsFetcher?)obj2); } } public class ZonesRestoreCommand { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func> <>9__0_0; public static ConsoleEvent <>9__0_1; internal List <.ctor>b__0_0(int index) { return FiltererParameters.Parameters; } internal void <.ctor>b__0_1(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { Executor.AddOperation(new RestoreZones(args.Context, filtererParameters), filtererParameters.Start); } } } public ZonesRestoreCommand() { //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_005d: Expected O, but got Unknown CommandWrapper.Register("zones_restore", (int index) => FiltererParameters.Parameters, FiltererParameters.GetAutoComplete()); object obj = <>c.<>9__0_1; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { FiltererParameters filtererParameters = new FiltererParameters(args); if (filtererParameters.Valid(args.Context) && !Helper.IsClient(args)) { Executor.AddOperation(new RestoreZones(args.Context, filtererParameters), filtererParameters.Start); } }; <>c.<>9__0_1 = val; obj = (object)val; } Helper.Command("zones_restore", "[...args] - Restores missing zone control objects.", (ConsoleEvent)obj); } } public static class CommandWrapper { public static Assembly ServerDevcommands = null; private const string GUID = "server_devcommands"; private static readonly BindingFlags PublicBinding = BindingFlags.Static | BindingFlags.Public; public static void Init() { if (Chainloader.PluginInfos.TryGetValue("server_devcommands", out var value)) { if (value.Metadata.Version.Major == 1 && value.Metadata.Version.Minor < 51) { UpgradeWorld.Log.LogWarning((object)$"Server devcommands v{value.Metadata.Version.Major}.{value.Metadata.Version.Minor} is outdated. Please update for better command instructions!"); } else { ServerDevcommands = ((object)value.Instance).GetType().Assembly; } } } private static Type Type() { return ServerDevcommands.GetType("ServerDevcommands.AutoComplete"); } private static Type InfoType() { return ServerDevcommands.GetType("ServerDevcommands.ParameterInfo"); } private static MethodInfo GetMethod(Type type, string name, Type[] types) { return type.GetMethod(name, PublicBinding, null, CallingConventions.Standard, types, null); } public static void Register(string command, Func> action) { if (!(ServerDevcommands == null)) { GetMethod(Type(), "Register", new Type[2] { typeof(string), typeof(Func>) }).Invoke(null, new object[2] { command, action }); } } public static void Register(string command, Func> action) { if (!(ServerDevcommands == null)) { GetMethod(Type(), "Register", new Type[2] { typeof(string), typeof(Func>) }).Invoke(null, new object[2] { command, action }); } } public static void Register(string command, Func> action, Dictionary>> named) { if (!(ServerDevcommands == null)) { GetMethod(Type(), "Register", new Type[3] { typeof(string), typeof(Func>), typeof(Dictionary>>) }).Invoke(null, new object[3] { command, action, named }); } } public static void Register(string command, Func> action, Dictionary>> named) { if (!(ServerDevcommands == null)) { GetMethod(Type(), "Register", new Type[3] { typeof(string), typeof(Func>), typeof(Dictionary>>) }).Invoke(null, new object[3] { command, action, named }); } } public static List Info(string value) { if (ServerDevcommands == null) { return new List(); } return GetMethod(InfoType(), "Create", new Type[1] { typeof(string) }).Invoke(null, new object[1] { value }) as List; } public static List XZ(string name, string description, int index) { if (ServerDevcommands == null) { return new List(); } return GetMethod(InfoType(), "XZ", new Type[3] { typeof(string), typeof(string), typeof(int) }).Invoke(null, new object[3] { name, description, index }) as List; } public static List XZY(string name, string description, int index) { if (ServerDevcommands == null) { return new List(); } return GetMethod(InfoType(), "XZY", new Type[3] { typeof(string), typeof(string), typeof(int) }).Invoke(null, new object[3] { name, description, index }) as List; } public static List Flag(string name, string description) { if (ServerDevcommands == null) { return new List(); } MethodInfo method = GetMethod(InfoType(), "Flag", new Type[2] { typeof(string), typeof(string) }); object[] parameters = new string[2] { name, description }; return method.Invoke(null, parameters) as List; } public static List ObjectIds() { if (ServerDevcommands == null) { return new List(); } return InfoType().GetProperty("ObjectIds", PublicBinding).GetValue(null) as List; } public static void RegisterEmpty(string command) { if (!(ServerDevcommands == null)) { Type().GetMethod("RegisterEmpty", PublicBinding).Invoke(null, new object[1] { command }); } } } public static class Executor { private static readonly List operations = new List(); private static Coroutine? executionCoroutine; private static MonoBehaviour? context; public const long ProgressMin = 100L; public const int ZdoMaxUpdates = 10000; public static void SetUser(ZRpc? user) { foreach (ExecutedOperation operation in operations) { operation.User = user; } } public static void SetContext(MonoBehaviour context) { Executor.context = context; } public static void StartExecution() { if ((Object)(object)context == (Object)null) { throw new Exception("Executor context is not set. Call Executor.SetContext from a MonoBehaviour before starting execution."); } if (executionCoroutine == null) { executionCoroutine = context.StartCoroutine(ExecuteCoroutine()); } } public static void StopExecution() { if ((Object)(object)context == (Object)null) { throw new Exception("Executor context is not set. Call Executor.SetContext from a MonoBehaviour before stopping execution."); } operations.Clear(); if (Object.op_Implicit((Object)(object)Hud.instance)) { Hud.instance.m_loadingIndicator.SetShowProgress(false); } if (executionCoroutine != null) { context.StopCoroutine(executionCoroutine); executionCoroutine = null; } } public static void AddOperation(ExecutedOperation operation, bool autoStart) { bool flag = Settings.AutoStart || autoStart; if (operation.Init(flag)) { operations.Add(operation); if (executionCoroutine == null && flag) { StartExecution(); } } } public static List GetOperations() { return operations; } private static IEnumerator ExecuteCoroutine() { Stopwatch sw = Stopwatch.StartNew(); while (operations.Count > 0) { sw.Restart(); yield return operations[0].Execute(sw); operations.RemoveAt(0); } sw.Stop(); StopExecution(); } } public class BiomeFilterer : IZoneFilterer { [CompilerGenerated] private IEnumerable P; [CompilerGenerated] private bool P; public BiomeFilterer(IEnumerable Biomes, bool IncludeEdges) { P = Biomes; P = IncludeEdges; base..ctor(); } public Vector2i[] FilterZones(Vector2i[] zones, ref List messages) { if (P.Count() == 0) { return zones; } int num = zones.Length; zones = FilterByBiomes(zones); int num2 = num - zones.Length; if (num2 > 0) { messages.Add(num2 + " skipped by having wrong biomes"); } return zones; } private Vector2i[] FilterByBiomes(Vector2i[] zones) { ZoneSystem instance = ZoneSystem.instance; float halfZone = instance.m_zoneSize / 2f; List list = new List(); list.AddRange(zones.Where(delegate(Vector2i zone) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) Vector3 zonePos = ZoneSystem.GetZonePos(zone); Vector3 val = zonePos + new Vector3(halfZone, 0f, halfZone); Vector3 val2 = zonePos + new Vector3(0f - halfZone, 0f, halfZone); Vector3 val3 = zonePos + new Vector3(halfZone, 0f, 0f - halfZone); Vector3 val4 = zonePos + new Vector3(0f - halfZone, 0f, 0f - halfZone); Biome biome2 = WorldGenerator.instance.GetBiome(val); Biome biome3 = WorldGenerator.instance.GetBiome(val2); Biome biome4 = WorldGenerator.instance.GetBiome(val3); Biome biome5 = WorldGenerator.instance.GetBiome(val4); return (P || (biome2 == biome3 && biome2 == biome4 && biome2 == biome5)) && P.Any((Biome biome) => biome == biome2 || biome == biome3 || biome == biome4 || biome == biome5); })); return list.ToArray(); } } public class ChanceFilterer : IZoneFilterer { private static Random random = new Random(); public float Chance; public ChanceFilterer(float chance) { Chance = chance; base..ctor(); } public Vector2i[] FilterZones(Vector2i[] zones, ref List messages) { int num = zones.Length; List list = new List(); list.AddRange(zones.Where((Vector2i zone) => random.NextDouble() < (double)Chance)); zones = list.ToArray(); int num2 = num - zones.Length; if (num2 > 0) { messages.Add(num2 + " skipped by chance"); } return zones; } } public class DistanceFilterer : IZoneFilterer { [CompilerGenerated] private Vector3
P; [CompilerGenerated] private float P; [CompilerGenerated] private float P; public DistanceFilterer(Vector3 center, float minDistance, float maxDistance) { //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)
P = center; P = minDistance; P = maxDistance; base..ctor(); } public Vector2i[] FilterZones(Vector2i[] zones, ref List messages) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) int num = zones.Length; zones = FilterByDistance(zones,
P, P, P); int num2 = num - zones.Length; if (num2 > 0) { messages.Add(num2 + " skipped by the command"); } return zones; } private static Vector2i[] FilterByDistance(Vector2i[] zones, Vector3 position, float minDistance, float maxDistance) { //IL_0007: 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) List list = new List(); list.AddRange(zones.Where(delegate(Vector2i zone) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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_0013: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) Vector3 zonePos = ZoneSystem.GetZonePos(zone); zonePos.y = 0f; Vector3 val = zonePos - position; bool num = ((Vector3)(ref val)).sqrMagnitude >= minDistance * minDistance; bool flag = maxDistance == 0f || ((Vector3)(ref val)).sqrMagnitude <= maxDistance * maxDistance; return num && flag; })); return list.ToArray(); } } public class LocationFilterer : IZoneFilterer { [CompilerGenerated] private IEnumerable P; [CompilerGenerated] private bool P; public LocationFilterer(IEnumerable Ids, bool OnlyMissing) { P = Ids; P = OnlyMissing; base..ctor(); } public Vector2i[] FilterZones(Vector2i[] zones, ref List messages) { HashSet locationObjects = P.Select((string id) => StringExtensionMethods.GetStableHashCode(id)).ToHashSet(); ZoneSystem zs = ZoneSystem.instance; int num = zones.Length; List list = new List(); list.AddRange(zones.Where((Vector2i zone) => zs.m_locationInstances.TryGetValue(zone, out var value) && (!P || !value.m_placed) && locationObjects.Contains(value.m_location.Hash))); zones = list.ToArray(); int num2 = num - zones.Length; if (num2 > 0) { messages.Add(num2 + " skipped by not having the location"); } return zones; } } public class PlayerBaseFilterer : IZoneFilterer { public static HashSet ExcludedZones = new HashSet(); public static DateTime LastUpdate = DateTime.MinValue; public static int LastSize = 0; public int Size; public PlayerBaseFilterer(int size) { Size = size; base..ctor(); } public void CalculateExcluded() { if (Size != LastSize || DateTime.Now - LastUpdate > TimeSpan.FromSeconds(10.0)) { ExcludedZones = CalculateExcluded(Size); LastUpdate = DateTime.Now; LastSize = Size; } } private static HashSet CalculateExcluded(int size) { //IL_0059: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) HashSet hashSet = new HashSet(); if (size == 0) { return hashSet; } int num = size - 1; HashSet ids = Settings.SafeZoneItems; HashSet allIds = Settings.SafeZoneObjects; foreach (ZDO item in ZDOMan.instance.m_objectsByID.Values.Where((ZDO zdo) => allIds.Contains(zdo.m_prefab) || (ids.Contains(zdo.m_prefab) && zdo.GetLong(ZDOVars.s_creator, 0L) != 0))) { Vector2i zone = ZoneSystem.GetZone(item.GetPosition()); for (int i = -num; i <= num; i++) { for (int j = -num; j <= num; j++) { hashSet.Add(new Vector2i(zone.x + i, zone.y + j)); } } } return hashSet; } public Vector2i[] FilterZones(Vector2i[] zones, ref List messages) { CalculateExcluded(); int num = zones.Length; List list = new List(); list.AddRange(zones.Where((Vector2i zone) => !ExcludedZones.Contains(zone))); zones = list.ToArray(); int num2 = num - zones.Length; if (num2 > 0) { messages.Add(num2 + " skipped by having a player base"); } return zones; } } public class PrefabFilterer : IZoneFilterer { [CompilerGenerated] private string P; public PrefabFilterer(string id) { P = id; base..ctor(); } public Vector2i[] FilterZones(Vector2i[] zones, ref List messages) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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) int hash = StringExtensionMethods.GetStableHashCode(P); IEnumerable source = ZDOMan.instance.m_objectsByID.Values.Where((ZDO zdo) => zdo.m_prefab == hash); HashSet hashSet = new HashSet(); foreach (Vector2i item in source.Select((ZDO zdo) => ZoneSystem.GetZone(zdo.GetPosition())).Distinct()) { hashSet.Add(item); } HashSet hashSet2 = hashSet; if (hashSet2 == null) { int num = zones.Length; List list = new List(); list.AddRange(zones.Where((Vector2i zone) => false)); zones = list.ToArray(); int num2 = num - zones.Length; if (num2 > 0) { messages.Add(num2 + " skipped by having invalid entity id"); } return zones; } int num3 = zones.Length; List list2 = new List(); list2.AddRange(zones.Where(hashSet2.Contains)); zones = list2.ToArray(); int num4 = num3 - zones.Length; if (num4 > 0) { messages.Add(num4 + " skipped by not having the entity"); } return zones; } } public class ZoneDistanceFilterer : IZoneFilterer { private Vector2i Center; private readonly int MinDistance; private readonly int MaxDistance; public ZoneDistanceFilterer(Vector2i center, int minDistance, int maxDistance) { //IL_0007: 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) Center = center; MinDistance = minDistance; MaxDistance = maxDistance; if (MaxDistance == 0 && MinDistance > 0) { MaxDistance = int.MaxValue; } } public Vector2i[] FilterZones(Vector2i[] zones, ref List messages) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) int num = zones.Length; zones = FilterByAdjacent(zones, Center, MinDistance, MaxDistance); int num2 = num - zones.Length; if (num2 > 0) { messages.Add(num2 + " skipped by being at wrong distance"); } return zones; } private static Vector2i[] FilterByAdjacent(Vector2i[] zones, Vector2i centerZone, int minDistance, int maxDistance) { //IL_0007: 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) List list = new List(); list.AddRange(zones.Where(delegate(Vector2i zone) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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) bool num = Math.Abs(centerZone.x - zone.x) >= minDistance; bool flag = Math.Abs(centerZone.y - zone.y) >= minDistance; bool flag2 = Math.Abs(centerZone.x - zone.x) <= maxDistance; bool flag3 = Math.Abs(centerZone.y - zone.y) <= maxDistance; return (num || flag) && flag2 && flag3; })); return list.ToArray(); } } public interface IZoneFilterer { Vector2i[] FilterZones(Vector2i[] zones, ref List messages); } public static class FiltererFactory { public static List Create(FiltererParameters args) { //IL_005c: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) List list = new List(); if (args.Biomes.Count > 0) { list.Add(new BiomeFilterer(args.Biomes, !args.NoEdges)); } if (args.Zone.HasValue && (args.MinDistance != 0f || args.MaxDistance != 0f)) { list.Add(new ZoneDistanceFilterer(args.Zone.Value, (int)args.MinDistance, (int)args.MaxDistance)); } else if (args.Pos.HasValue && (args.MinDistance != 0f || args.MaxDistance != 0f)) { list.Add(new DistanceFilterer(new Vector3(args.Pos.Value.x, 0f, args.Pos.Value.y), args.MinDistance, args.MaxDistance)); } if (args.SafeZones > 0) { list.Add(new PlayerBaseFilterer(args.SafeZones)); } if (args.Chance < 1f) { list.Add(new ChanceFilterer(args.Chance)); } if (args.LocationIds.Count > 0) { list.Add(new LocationFilterer(args.LocationIds, OnlyMissing: false)); } return list; } } [HarmonyPatch(typeof(ZoneSystem), "Load")] public class PreventGenloc { private static void Postfix(ZoneSystem __instance) { if (Settings.DisableAutomaticGenloc && !__instance.m_locationsGenerated && __instance.m_locationInstances.Count > 0) { __instance.m_locationsGenerated = true; UpgradeWorld.Log.LogWarning((object)"Skipped automatic genloc. Run the command manually if needed."); } } } public static class Helper { private static string Previous = ""; private static DateTime PreviousTime = new DateTime(0L); public static string GetStartMessage() { return "\nUse command start to execute."; } public static bool IsValid(ZoneLocation loc) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) if (loc != null) { _ = loc.m_prefab; if (!loc.m_prefab.IsValid) { return loc.m_prefab.m_name != null; } return true; } return false; } public static string Normalize(string value) { return value.Trim().ToLower(); } public static string JoinRows(IEnumerable values) { return string.Join(", ", values); } public static Biome GetBiome(string name) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) name = Normalize(name); if (Enum.TryParse(name, ignoreCase: true, out Biome result)) { return result; } return (Biome)0; } public static List? GetZDOs(Vector2i zone) { //IL_0007: 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) ZDOMan instance = ZDOMan.instance; int num = instance.SectorToIndex(zone); if (num >= 0 && num < instance.m_objectsBySector.Length) { return instance.m_objectsBySector[num]; } if (instance.m_objectsByOutsideSector.TryGetValue(zone, out var value)) { return value; } return null; } public static void RemoveZDO(ZDO zdo) { //IL_0034: 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) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) ZDO zdo2 = zdo; if (zdo2 != null && zdo2.IsValid() && (!Object.op_Implicit((Object)(object)Player.m_localPlayer) || !(((Character)Player.m_localPlayer).GetZDOID() == zdo2.m_uid)) && !ZNet.instance.m_peers.Any((ZNetPeer peer) => peer.m_characterID == zdo2.m_uid)) { zdo2.SetOwner(ZDOMan.GetSessionID()); ZDOID connectionZDOID = zdo2.GetConnectionZDOID((ConnectionType)3); if (connectionZDOID != ZDOID.None && ZDOMan.instance.m_objectsByID.TryGetValue(connectionZDOID, out var value) && value != zdo2) { RemoveZDO(value); } if (ZNetScene.instance.m_instances.TryGetValue(zdo2, out var value2)) { ZNetScene.instance.Destroy(((Component)value2).gameObject); } else { ZDOMan.instance.DestroyZDO(zdo2); } } } public static void MoveZDO(ZDO zdo, Vector3 pos, Quaternion rot) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) new ZDOData(zdo).Move(pos, rot); RemoveZDO(zdo); } public static void ClearAreaForLocation(Vector2i zone, LocationInstance location, float radius) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (radius > 0f) { ClearZDOsWithinDistance(zone, location.m_position, radius); } } public static void ClearZDOsWithinDistance(Vector2i zone, Vector3 center, float distance) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (distance == 0f) { return; } List zDOs = GetZDOs(zone); if (zDOs == null) { return; } foreach (ZDO item in zDOs) { if (item.m_prefab != Settings.ZoneControlHash && item.m_prefab != Settings.TerrainCompilerHash) { Vector3 position = item.GetPosition(); Vector3 val = center - position; val.y = 0f; if (position.y > 4000f || ((Vector3)(ref val)).magnitude < distance) { RemoveZDO(item); } } } } public static Vector3 GetPlayerPosition() { //IL_0016: 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) //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return ((Component)Player.m_localPlayer).transform.position; } if (ServerExecution.User != null) { ZNetPeer val = ZNet.instance.m_peers.Find((ZNetPeer peer) => peer.IsReady() && peer.m_socket.GetHostName() == ServerExecution.User.GetSocket().GetHostName()); if (val != null) { return val.m_refPos; } } return Vector3.zero; } public static Vector2i GetPlayerZone() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return ZoneSystem.GetZone(GetPlayerPosition()); } public static bool CheckUnhandled(ConsoleEventArgs args, IEnumerable extra, int handled = 0) { if (extra.Count() > handled) { Print(args.Context, "Error: Unhandled parameters " + string.Join(", ", extra.Skip(handled))); return false; } return true; } public static bool IsClient(ConsoleEventArgs args) { if (!Object.op_Implicit((Object)(object)ZNet.instance) || !ZNet.instance.IsServer()) { ServerExecution.Send(args); return true; } if (Object.op_Implicit((Object)(object)ZNet.instance) && ZNet.instance.IsDedicated() && ServerExecution.User == null && !Settings.IsRoot("-1")) { Print(args.Context, "Error: Dedicated server is not allowed to directly execute any commands (-1 is missing from root users)."); return true; } return false; } public static void Print(Terminal terminal, ZRpc? user, string value) { if (ZNet.m_isServer && user != null) { ZNet.instance.RemotePrint(user, value); } if (Object.op_Implicit((Object)(object)terminal)) { terminal.AddString(value); } } public static void Print(Terminal terminal, string value) { Print(terminal, ServerExecution.User, value); } public static void PrintOnce(Terminal terminal, ZRpc? user, string value, float limiter = 0f) { if (ZNet.m_isServer && user != null) { DateTime now = DateTime.Now; if (limiter == 0f || now.Subtract(PreviousTime).TotalSeconds > (double)limiter) { user.Invoke(ServerExecution.RPC_RemotePrintOnce, new object[1] { value }); PreviousTime = now; } } if (!Object.op_Implicit((Object)(object)terminal) || terminal.m_chatBuffer.LastOrDefault() == value) { return; } if (Previous != "") { while (terminal.m_chatBuffer.Remove(Previous)) { } } Previous = value; Print(terminal, null, value); } public static string IdString(IEnumerable ids) { if (ids.Count() == 0) { return ""; } return " " + JoinRows(ids); } public static bool IsIncluded(string id, string name) { if (id == "*") { return true; } if (id[0] == '*' && id[id.Length - 1] == '*') { return name.Contains(id.Substring(1, id.Length - 2)); } if (id[0] == '*') { return name.EndsWith(id.Substring(1), StringComparison.OrdinalIgnoreCase); } if (id[id.Length - 1] == '*') { return name.StartsWith(id.Substring(0, id.Length - 1), StringComparison.OrdinalIgnoreCase); } return id == name; } public static string PrintPin(Vector3 vector) { return vector.x.ToString("F0") + ", " + vector.z.ToString("F0") + ", " + vector.y.ToString("F0"); } public static string PrintVectorXZY(Vector3 vector) { return "(" + vector.x.ToString("F0") + ", " + vector.z.ToString("F0") + ", " + vector.y.ToString("F0") + ")"; } public static string PrintVectorYXZ(Vector3 vector) { return "(" + vector.y.ToString("F0") + ", " + vector.x.ToString("F0") + ", " + vector.z.ToString("F0") + ")"; } public static string PrintAngleYXZ(Quaternion quaternion) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return PrintVectorYXZ(((Quaternion)(ref quaternion)).eulerAngles); } public static string PrintDay(long v) { return ToDay(v).ToString(); } public static long ToDay(long v) { return v / 1000 / 10000 / 1800; } public static long ToTick(long v) { return v * 1000 * 10000 * 1800; } public static void RecalculateTerrain() { foreach (Heightmap s_heightmap in Heightmap.s_heightmaps) { s_heightmap.m_buildData = null; s_heightmap.Poke(true); } } public static void Command(string name, string description, ConsoleEvent action, ConsoleOptionsFetcher? fetcter = null) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) new ConsoleCommand(name, description, Catch(action), true, true, false, false, false, fetcter, false, false, false); } public static ConsoleEvent Catch(ConsoleEvent action) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown ConsoleEvent action2 = action; return (ConsoleEvent)delegate(ConsoleEventArgs args) { try { action2.Invoke(args); } catch (InvalidOperationException ex) { AddError(args.Context, ex.Message); } }; } public static void Command(string name, string description, ConsoleEventFailable action, ConsoleOptionsFetcher? fetcter = null) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) new ConsoleCommand(name, description, Catch(action), true, true, false, false, false, fetcter, false, false, false); } public static ConsoleEventFailable Catch(ConsoleEventFailable action) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown ConsoleEventFailable action2 = action; return (ConsoleEventFailable)delegate(ConsoleEventArgs args) { try { return action2.Invoke(args); } catch (InvalidOperationException ex) { AddError(args.Context, ex.Message); } return null; }; } public static void AddError(Terminal context, string message, bool priority = false) { AddMessage(context, "Error: " + message, priority); } public static void AddMessage(Terminal context, string message, bool priority = false) { if ((Object)(object)context == (Object)(object)Console.instance) { context.AddString(message); } MessageHud instance = MessageHud.instance; if (!Object.op_Implicit((Object)(object)instance) || !Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return; } if (priority) { MsgData[] array = instance.m_msgQeue.ToArray(); instance.m_msgQeue.Clear(); ((Character)Player.m_localPlayer).Message((MessageType)1, message, 0, (Sprite)null); MsgData[] array2 = array; foreach (MsgData item in array2) { instance.m_msgQeue.Enqueue(item); } instance.m_msgQueueTimer = 10f; } else { ((Character)Player.m_localPlayer).Message((MessageType)1, message, 0, (Sprite)null); } } } public class CountParameters : DataParameters { public Range Count = new Range(1, int.MaxValue); public new static List Parameters; public CountParameters(FiltererParameters pars) : base(pars) { } public CountParameters(ConsoleEventArgs args) : base(args, requireId: false) { foreach (string item in Unhandled.ToList()) { string[] array = item.Split(new char[1] { '=' }); if (array[0] == "count") { Count = Parse.IntRange(array[1]); Unhandled.Remove(item); } } } public new static Dictionary?>> GetAutoComplete() { Dictionary?>> autoComplete = DataParameters.GetAutoComplete(); autoComplete["count"] = (int index) => (index != 0) ? null : CommandWrapper.Info("count=amount or count=min-max | Required amount of objects to be included in the count."); return autoComplete; } static CountParameters() { List list = new List(); list.AddRange(GetAutoComplete().Keys.OrderBy((string s) => s)); Parameters = list; } } public class DataParameters : IdParameters { public Range? Level; public List Prints = new List(); public List Datas = new List(); public List Filters = new List(); public bool Log; public new bool RequireId; public List Types = new List(); public new static List Parameters; private static List parameterComponents; public static List ParameterComponents { get { if (parameterComponents.Count == 0) { List list = new List(); list.AddRange(ComponentInfo.Types.Select((Type t) => t.Name)); parameterComponents = list; } return parameterComponents; } } public DataParameters(FiltererParameters pars) : base(pars) { } public DataParameters(ConsoleEventArgs args, bool requireId, bool validate = true) : base(args, requireId, validate) { foreach (string item in Unhandled.ToList()) { string[] array = item.Split(new char[1] { '=' }); string text = array[0]; string text2 = string.Join("=", array.Skip(1)); switch (text) { case "level": Level = Parse.IntRange(text2); break; case "log": Log = true; break; case "print": Prints.Add(text2); break; case "data": Datas.Add(text2); break; case "filter": Filters.Add(text2); break; case "type": Types.Add(Parse.Split(array[1])); break; default: continue; } Unhandled.Remove(item); } } public override IEnumerable FilterZdos(IEnumerable zdos, bool checkExcludedZones) { zdos = base.FilterZdos(zdos, checkExcludedZones); if (Level != null) { bool emptyOk = Level.Min <= 1; zdos = zdos.Where(delegate(ZDO zdo) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (!ZDOExtraData.s_ints.TryGetValue(zdo.m_uid, out var value2)) { return emptyOk; } int num = default(int); if (!value2.TryGetValue(ZDOVars.s_level, ref num)) { return emptyOk; } return Level.Min <= num && num <= Level.Max; }); } if (LocationIds.Count > 0) { HashSet ids = LocationIds.Select((string s) => StringExtensionMethods.GetStableHashCode(s)).ToHashSet(); zdos = zdos.Where((ZDO zdo) => ids.Contains(zdo.GetInt(ZDOVars.s_location, 0))); } foreach (string filter in Filters) { string[] split = Parse.Split(filter); string value = ((split.Length > 1) ? split[1] : ""); bool includeEmpty = split.Length > 2 && Parse.Boolean(split[2]).GetValueOrDefault(); zdos = zdos.Where((ZDO zdo) => DataHelper.HasData(zdo, split[0], value, includeEmpty)); } return zdos; } public new static Dictionary?>> GetAutoComplete() { List types = new List(7) { "float", "id", "int", "long", "quat", "string", "vector" }; List truths = new List(2) { "true", "false" }; Dictionary?>> autoComplete = FiltererParameters.GetAutoComplete(); autoComplete["level"] = (int index) => (index != 0) ? null : CommandWrapper.Info("level=amount or level=min-max | Levels of the creature."); autoComplete["print"] = (int index) => index switch { 0 => CommandWrapper.Info("print=key,type | Prints data with a given key. Use key=* to print all data."), 1 => types, _ => null, }; autoComplete["data"] = (int index) => index switch { 0 => CommandWrapper.Info("data=key,value,type | Sets data to a given key. Type is required for new entries."), 1 => CommandWrapper.Info("data=key,value,type | Data value."), 2 => types, _ => null, }; autoComplete["filter"] = (int index) => index switch { 0 => CommandWrapper.Info("filter=key,value,includeEmpty | Filter by a data value. Use key=* to match any key."), 1 => CommandWrapper.Info("filter=key,value,includeEmpty | Value or data type for new entries."), 2 => truths, _ => null, }; autoComplete["type"] = (int index) => ParameterComponents; autoComplete["log"] = (int index) => (index != 0) ? null : CommandWrapper.Info("Out put to log file instead of console."); autoComplete["location"] = (int index) => LocationOperation.AllIds(); return autoComplete; } static DataParameters() { List list = new List(); list.AddRange(GetAutoComplete().Keys.OrderBy((string s) => s)); Parameters = list; parameterComponents = new List(); } } public enum TargetZones { Generated, Ungenerated, All } public class FiltererParameters { public HashSet Biomes = new HashSet(); public Biome BiomeMask = (Biome)(-1); public int Limit; public bool NoEdges; public bool Start; public Vector2? Pos; public Vector2i? Zone; public float MinDistance; public float MaxDistance; public float Chance = 1f; public float Amount = 1f; public float TerrainReset; public float? ObjectReset; public int SafeZones = Settings.SafeZoneSize; public HashSet LocationIds = new HashSet(); public TargetZones TargetZones; public bool Pin; public List Unhandled = new List(); public static List Parameters = new List(16) { "clear", "terrain", "pos", "zone", "biomes", "locations", "min", "minDistance", "max", "maxDistance", "distance", "start", "noEdges", "safeZones", "chance", "force" }; public static Random random = new Random(); public bool IsBiomeValid(Biome biome) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (Biomes.Count() != 0) { return Biomes.Contains(biome); } return true; } public bool IsBiomeValid(Vector3 pos) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return IsBiomeValid(WorldGenerator.instance.GetBiome(pos)); } public bool IsBiomeValid(Vector2 pos) { //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_0018: Unknown result type (might be due to invalid IL or missing references) return IsBiomeValid(WorldGenerator.instance.GetBiome(pos.x, pos.y, 0.02f, false)); } public FiltererParameters(FiltererParameters pars) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) Biomes = pars.Biomes; BiomeMask = pars.BiomeMask; NoEdges = pars.NoEdges; Start = pars.Start; Pos = pars.Pos; Zone = pars.Zone; MinDistance = pars.MinDistance; MaxDistance = pars.MaxDistance; Chance = pars.Chance; Amount = pars.Amount; SafeZones = pars.SafeZones; TargetZones = pars.TargetZones; Unhandled = pars.Unhandled; ObjectReset = pars.ObjectReset; TerrainReset = pars.TerrainReset; } public FiltererParameters(ConsoleEventArgs args) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) string[] array = args.Args.Skip(1).ToArray(); foreach (string text in array) { string[] array2 = text.Split(new char[1] { '=' }); string text2 = array2[0].ToLower(); if (array2.Length > 1) { string text3 = array2[1]; switch (text2) { case "safezones": SafeZones = Parse.Int(text3, 2); break; case "limit": Limit = Parse.Int(text3); break; case "pos": Pos = Parse.Pos(text3); break; case "zone": Zone = Parse.Zone(text3); break; case "min": case "mindistance": MinDistance = Parse.Float(text3); break; case "max": case "maxdistance": MaxDistance = Parse.Float(text3); break; case "chance": Chance = Parse.Float(text3); break; case "amount": Amount = Parse.Float(text3); break; case "terrain": TerrainReset = Parse.Float(text3); break; case "clear": ObjectReset = Parse.Float(text3); break; case "distance": { Range range = Parse.FloatRange(text3); MinDistance = range.Min; MaxDistance = range.Max; break; } case "biomes": Biomes = Parse.Biomes(text3); break; case "locations": LocationIds = LocationOperation.Ids(text3.Split(new char[1] { ',' }), Array.Empty()); break; default: Unhandled.Add(text); break; } } else { switch (text2) { case "noedges": NoEdges = true; break; case "start": Start = true; break; case "pin": Pin = true; break; case "zone": Zone = Helper.GetPlayerZone(); break; case "force": SafeZones = 0; break; default: Unhandled.Add(text); break; } } } if (Chance > 1f) { Chance /= 100f; } if (!Zone.HasValue && !Pos.HasValue) { Pos = new Vector2(0f, 0f); } if (Biomes.Count() > 0) { BiomeMask = Biomes.Aggregate((Biome mask, Biome biome) => (Biome)(mask | biome)); } } public virtual bool Valid(Terminal terminal) { if (Unhandled.Count() > 0) { Helper.Print(terminal, "Error: Unhandled parameters " + string.Join(", ", Unhandled)); return false; } if (Zone.HasValue && Pos.HasValue) { Helper.Print(terminal, "Error: pos and zone can't be used at the same time."); return false; } if (Biomes.Contains((Biome)0)) { Helper.Print(terminal, "Error: Invalid biomes."); return false; } if (!Zone.HasValue && !Pos.HasValue) { Helper.Print(terminal, "Error: Position or zone is not defined."); return false; } return true; } public bool FilterPosition(Vector3 pos, bool checkExcludedZones) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 //IL_0044: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) if (Biomes.Count() > 0 && !IsBiomeValid(pos)) { return false; } if (NoEdges && (int)WorldGenerator.instance.GetBiomeArea(pos) != 2) { return false; } if (Zone.HasValue) { if (!Zones.IsWithin(Zone.Value, min: (int)MinDistance, max: (int)MaxDistance, b: ZoneSystem.GetZone(pos))) { return false; } } else if (Pos.HasValue) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(Pos.Value.x, 0f, Pos.Value.y); if (MinDistance > 0f && Utils.DistanceXZ(pos, val) < MinDistance) { return false; } if (MaxDistance > 0f && Utils.DistanceXZ(pos, val) > MaxDistance) { return false; } } if (checkExcludedZones && PlayerBaseFilterer.ExcludedZones.Contains(ZoneSystem.GetZone(pos))) { return false; } if (LocationIds.Count > 0) { Vector2i zone = ZoneSystem.GetZone(pos); if (ZoneSystem.instance.m_locationInstances.TryGetValue(zone, out var value2) && LocationIds.Contains(value2.m_location.m_prefab.Name)) { return false; } } return true; } public virtual IEnumerable FilterZdos(IEnumerable zdos, bool checkExcludedZones) { return zdos.Where((ZDO zdo) => FilterPosition(zdo.GetPosition(), checkExcludedZones) && Roll()); } public IEnumerable LimitZdos(IEnumerable zdos) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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) if (Limit <= 0) { return zdos; } Vector3 pos = (Vector3)(Pos.HasValue ? new Vector3(Pos.Value.x, 0f, Pos.Value.y) : (Zone.HasValue ? ZoneSystem.GetZonePos(Zone.Value) : Vector3.zero)); return zdos.OrderBy((ZDO zdo) => Utils.DistanceXZ(zdo.GetPosition(), pos)).Take(Limit); } public virtual IEnumerable FilterLocations(IEnumerable locations) { return locations.Where((LocationInstance location) => FilterPosition(location.m_position, checkExcludedZones: true)); } public string Print(string operation) { //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_024a: 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_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) string text = operation + " "; if (Biomes.Count > 0) { text += string.Join(", ", Biomes.Select((Biome biome) => Enum.GetName(typeof(Biome), biome))); if (NoEdges) { text += " (excluding biome edges)"; } } else { text += "zones"; } if (MinDistance > 0f || MaxDistance > 0f) { if (Zone.HasValue) { if (MinDistance > 0f) { text = text + " more than " + (MinDistance - 1f); } if (MinDistance > 0f && MaxDistance > 0f) { text += " and"; } if (MaxDistance > 0f) { text = text + " less than " + (MaxDistance + 1f); } text += " zones"; } else { if (MinDistance > 0f) { text = text + " more than " + MinDistance; } if (MinDistance > 0f && MaxDistance > 0f) { text += " and"; } if (MaxDistance > 0f) { text = text + " less than " + MaxDistance; } text += " meters"; } text += " away from the "; if (Zone.HasValue) { text = text + "zone " + Zone.Value.x + "," + Zone.Value.y; } else if (Pos.HasValue && Pos.Value.x == 0f && Pos.Value.y == 0f) { text += "world center"; } else if (Pos.HasValue && Pos.Value.x == Helper.GetPlayerPosition().x && Pos.Value.y == Helper.GetPlayerPosition().z) { text += "player"; } else if (Pos.HasValue) { text = text + "coordinates " + Pos.Value.x + "," + Pos.Value.y; } } else if (Zone.HasValue) { text = text + " at index " + Zone.Value.x + "," + Zone.Value.y; } int num = 1 + (SafeZones - 1) * 2; text = ((SafeZones > 0) ? (text + ". Player base detection (" + num + "x" + num + " safe zones).") : (text + ". No player base detection.")); if (LocationIds.Count > 0) { text = text + "\nOnly locations" + LocationOperation.IdString(LocationIds); } return text; } public static Dictionary?>> GetAutoComplete() { return new Dictionary>> { { "pos", (int index) => CommandWrapper.XZ("pos", "Coordinates for the center point. If not given, player's position is used", index) }, { "limit", (int index) => CommandWrapper.Info("limit=amount | Limits the amount of objects.") }, { "zone", (int index) => CommandWrapper.XZ("zone", "Indices for the center zone", index) }, { "biomes", (int index) => Enum.GetNames(typeof(Biome)).ToList() }, { "locations", (int index) => LocationOperation.AllIds() }, { "min", (int index) => (index != 0) ? null : CommandWrapper.Info("min=meters or zones | Minimum distance from the center point / zone.") }, { "minDistance", (int index) => (index != 0) ? null : CommandWrapper.Info("minDistance=meters or zones | Minimum distance from the center point / zone.") }, { "max", (int index) => (index != 0) ? null : CommandWrapper.Info("max=meters or zones | Maximum distance from the center point / zone.") }, { "maxDistance", (int index) => (index != 0) ? null : CommandWrapper.Info("maxDistance=meters or zones | Maximum distance from the center point / zone.") }, { "safeZones", (int index) => (index != 0) ? null : CommandWrapper.Info("safezones=amount | The size of protected areas around player base structures.") }, { "chance", (int index) => (index != 0) ? null : CommandWrapper.Info("chance=percentage (from 0 to 100) | The chance of a single operation being done.") }, { "amount", (int index) => (index != 0) ? null : CommandWrapper.Info("amount=number | Multiplies the affected objects.") }, { "terrain", (int index) => (index != 0) ? null : CommandWrapper.Info("terrain=meters | Radius of reseted terrain.") }, { "clear", (int index) => (index != 0) ? null : CommandWrapper.Info("clear=meters | Overrides the radius of removed objects.") }, { "start", (int index) => CommandWrapper.Flag("start", "Starts the operation instantly") }, { "force", (int index) => CommandWrapper.Flag("force", "Disables the player base detection") }, { "pin", (int index) => CommandWrapper.Flag("pin", "Pins results on the map") }, { "noEdges", (int index) => CommandWrapper.Flag("noedges", "Excludes zones with multiple biomes") }, { "distance", (int index) => index switch { 0 => CommandWrapper.Info("distance=min,max | Minimum distance from the center point / zone."), 1 => CommandWrapper.Info("distance=min,max | Maximum distance from the center point / zone."), _ => null, } } }; } public bool Roll() { if (!(Chance >= 1f)) { return random.NextDouble() < (double)Chance; } return true; } public bool RollAmount() { if (!(Amount >= 1f)) { return random.NextDouble() < (double)Amount; } return true; } } public class IdParameters : FiltererParameters { private List Include = new List(); private readonly List Ignore = new List(); public bool RequireId; public bool Validate; public HashSet VegIds() { return VegetationOperation.GetIds(Include, Ignore); } public HashSet Ids() { HashSet hashSet = new HashSet(); foreach (string item in Include) { hashSet.Add(item); } return hashSet; } public IdParameters(FiltererParameters pars) : base(pars) { } public IdParameters(ConsoleEventArgs args, bool requireId, bool validate) : base(args) { RequireId = requireId; Validate = validate; foreach (string item in Unhandled.ToList()) { string[] array = item.Split(new char[1] { '=' }); string text = array[0]; if (text == "id") { string[] array2 = array[1].Split(new char[1] { ',' }); List list = new List(array2.Length); list.AddRange(array2); Include = list; } else { if (!(text == "ignore")) { continue; } string[] array2 = array[1].Split(new char[1] { ',' }); List list2 = new List(array2.Length); list2.AddRange(array2); Ignore = list2; } Unhandled.Remove(item); } } public override bool Valid(Terminal terminal) { List list = new List(); list.AddRange(Unhandled.SelectMany((string kvp) => Parse.Split(kvp))); Include = list; Unhandled.Clear(); if (!base.Valid(terminal)) { return false; } if (RequireId && Include.Count() == 0) { Helper.Print(terminal, "Error: Missing ids."); return false; } int result; IEnumerable enumerable = Include.Where((string id) => !id.Contains("*") && !int.TryParse(id, out result) && (Object)(object)ZNetScene.instance.GetPrefab(id) == (Object)null); if (Validate && enumerable.Count() > 0) { Helper.Print(terminal, "Error: Entity id " + string.Join(", ", enumerable) + " not recognized."); return false; } return true; } public IdParameters(ConsoleEventArgs args) : base(args) { } } public class LocationIdParameters : FiltererParameters { private List Include = new List(); private readonly List Ignore = new List(); public HashSet Ids = new HashSet(); public bool Log; public LocationIdParameters(FiltererParameters pars) : base(pars) { } public LocationIdParameters(ConsoleEventArgs args) : base(args) { foreach (string item in Unhandled.ToList()) { string[] array = item.Split(new char[1] { '=' }); switch (array[0]) { case "id": { string[] array2 = array[1].Split(new char[1] { ',' }); List list2 = new List(array2.Length); list2.AddRange(array2); Include = list2; break; } case "ignore": { string[] array2 = array[1].Split(new char[1] { ',' }); List list = new List(array2.Length); list.AddRange(array2); Ignore = list; break; } case "log": Log = true; break; default: continue; } Unhandled.Remove(item); } } public override bool Valid(Terminal terminal) { List list = new List(); list.AddRange(Unhandled.SelectMany((string kvp) => Parse.Split(kvp)).Distinct()); Include = list; Unhandled.Clear(); if (!base.Valid(terminal)) { return false; } IEnumerable enumerable = Include.Where((string id) => !id.Contains("*") && ZoneSystem.instance.GetLocation(id) == null); if (enumerable.Count() > 0) { Helper.Print(terminal, ServerExecution.User, "Error: Location id " + string.Join(", ", enumerable) + " not recognized."); return false; } IEnumerable enumerable2 = Ignore.Where((string id) => !id.Contains("*") && ZoneSystem.instance.GetLocation(id) == null); if (enumerable2.Count() > 0) { Helper.Print(terminal, ServerExecution.User, "Error: Location id " + string.Join(", ", enumerable2) + " not recognized."); return false; } Ids = LocationOperation.Ids(Include, Ignore); if (Ids.Count == 0) { Helper.Print(terminal, ServerExecution.User, "Error: No valid location ids."); return false; } return true; } } [HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")] public class ServerExecution { public static ZRpc? User = null; public static string RPC_Command = "UpgradeWorld_Command"; public static string RPC_Pins = "DEV_Pins"; public static string RPC_RemotePrintOnce = "UpgradeWorld_RemotePrintOnce"; public static string RPC_RequestSync = "UpgradeWorld_RequestSync"; public static string RPC_SyncData = "UpgradeWorld_SyncData"; public static void Send(string command) { if (Object.op_Implicit((Object)(object)ZNet.instance)) { ZRpc serverRPC = ZNet.instance.GetServerRPC(); if (serverRPC != null) { Helper.Print((Terminal)(object)Console.instance, "Sending command: " + command); serverRPC.Invoke(RPC_Command, new object[1] { command }); } } } public static void Send(IEnumerable args) { Send(string.Join(" ", args)); } public static void Send(ConsoleEventArgs args) { Send((IEnumerable)args.Args); } private static bool IsAllowed(ZRpc rpc) { if (!((Behaviour)ZNet.instance).enabled) { return false; } if (rpc == null) { return false; } if (Settings.IsRoot(rpc.GetSocket().GetHostName())) { return true; } Helper.Print((Terminal)(object)Console.instance, rpc, "Unauthorized to use Upgrade World commands."); return false; } private static void RPC_Do_Command(ZRpc rpc, string command) { User = rpc; if (IsAllowed(rpc)) { Terminal.m_cheat = true; ((Terminal)Console.instance).TryRunCommand(command, false, false); } User = null; } private static void RPC_PrintOnce(ZRpc rpc, string value) { Helper.PrintOnce((Terminal)(object)Console.instance, null, value); } private static void RPC_Do_RequestSync(ZRpc rpc, int clientLocationHash, int clientVegetationHash) { if (IsAllowed(rpc)) { string text = string.Join("|", LocationOperation.AllIds()); string text2 = string.Join("|", VegetationOperation.AllIds()); int stableHashCode = StringExtensionMethods.GetStableHashCode(text); int stableHashCode2 = StringExtensionMethods.GetStableHashCode(text2); if (stableHashCode != clientLocationHash || stableHashCode2 != clientVegetationHash) { rpc.Invoke(RPC_SyncData, new object[2] { text, text2 }); } } } private static void RPC_Do_SyncData(ZRpc rpc, string locationIds, string vegetationIds) { LocationOperation.SetServerIds(locationIds); VegetationOperation.SetServerIds(vegetationIds); } public static void RequestSync() { ZRpc serverRPC = ZNet.instance.GetServerRPC(); if (serverRPC != null) { int serverIdsHash = LocationOperation.GetServerIdsHash(); int serverIdsHash2 = VegetationOperation.GetServerIdsHash(); serverRPC.Invoke(RPC_RequestSync, new object[2] { serverIdsHash, serverIdsHash2 }); } } private static void Postfix(ZNet __instance, ZRpc rpc) { if (__instance.IsDedicated()) { rpc.Register(RPC_Command, (Action)RPC_Do_Command); rpc.Register(RPC_RequestSync, (Action)RPC_Do_RequestSync); } else { rpc.Register(RPC_RemotePrintOnce, (Action)RPC_PrintOnce); rpc.Register(RPC_SyncData, (Action)RPC_Do_SyncData); } } } public struct FilterPoint { public float x; public float y; public float min; public float max; } public static class Settings { public static ConfigEntry configDisableAutomaticGenloc; public static ConfigEntry configVerbose; public static ConfigEntry configVerboseLocations; public static ConfigEntry configAutoStart; public static ConfigEntry configWorldRadius; public static ConfigEntry configWorldEdge; public static ConfigEntry configSafeZoneItems; public static ConfigEntry configSafeZoneObjects; public static ConfigEntry configSafeZoneSize; public static ConfigEntry configTimeBasedDataNames; public static int ZoneControlHash = StringExtensionMethods.GetStableHashCode("_ZoneCtrl"); public static int TerrainCompilerHash = StringExtensionMethods.GetStableHashCode("_TerrainCompiler"); public static ConfigEntry configRootUsers; private static HashSet RootUsers = new HashSet(); public static bool DisableAutomaticGenloc => configDisableAutomaticGenloc.Value; public static bool Verbose => configVerbose.Value; public static bool VerboseLocations => configVerboseLocations.Value; public static bool AutoStart => configAutoStart.Value; public static int WorldRadius => configWorldRadius.Value; public static int WorldEdge => configWorldEdge.Value; public static HashSet SafeZoneItems { get { HashSet hashSet = new HashSet(); foreach (int item in from name in configSafeZoneItems.Value.Split(new char[1] { ',' }) select StringExtensionMethods.GetStableHashCode(name.Trim())) { hashSet.Add(item); } return hashSet; } } public static HashSet SafeZoneObjects { get { HashSet hashSet = new HashSet(); foreach (int item in from name in configSafeZoneObjects.Value.Split(new char[1] { ',' }) select StringExtensionMethods.GetStableHashCode(name.Trim())) { hashSet.Add(item); } return hashSet; } } public static int SafeZoneSize => configSafeZoneSize.Value; public static IEnumerable TimeBasedDataNames => from name in configTimeBasedDataNames.Value.Split(new char[1] { ',' }) select name.Trim(); private static void UpdateRootUsers() { HashSet hashSet = new HashSet(); foreach (string item in from s in configRootUsers.Value.Split(new char[1] { ',' }) select s.Trim() into s where s != "" select s) { hashSet.Add(item); } RootUsers = hashSet; } public static bool IsRoot(string id) { //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_0049: Unknown result type (might be due to invalid IL or missing references) PlatformUserID user = GetUser(id); if (RootUsers.Count == 0) { if (!(id == "-1")) { return ZNet.instance.ListContainsId(ZNet.instance.m_adminList, ((object)(PlatformUserID)(ref user)).ToString()); } return true; } if (RootUsers.Contains(user.m_userID)) { return true; } if (RootUsers.Contains(((object)(PlatformUserID)(ref user)).ToString())) { return true; } return false; } private static PlatformUserID GetUser(string id) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (id.Contains("_")) { return new PlatformUserID(id); } return new PlatformUserID(ZNet.instance.m_steamPlatform, id); } public static void Init(ConfigFile config) { string text = "1. General"; configVerbose = config.Bind(text, "Verbose output", false, "If true, more detailed is printed (useful for debugging but may contain spoilers)."); configVerboseLocations = config.Bind(text, "Verbose locations", false, "If true, more detailed location generation information is printed."); configAutoStart = config.Bind(text, "Automatic start", false, "If true, operations start automatically without having to use the start command."); configWorldRadius = config.Bind(text, "World radius", 10500, "Max radius for operations."); configWorldEdge = config.Bind(text, "World edge", 500, "Size of world edge."); configWorldRadius.SettingChanged += delegate { Zones.ResetAllZones(); }; configSafeZoneItems = config.Bind(text, "Safe zone items", "blastfurnace,bonfire,charcoal_kiln,fermenter,fire_pit,forge,guard_stone,hearth,piece_artisanstation,piece_bed02,piece_brazierceiling01,piece_groundtorch,piece_groundtorch_blue,piece_groundtorch_green,piece_groundtorch_wood,piece_oven,piece_spinningwheel,piece_stonecutter,piece_walltorch,piece_workbench,portal,portal_wood,smelter,windmill,piece_chest,piece_chest_blackmetal,piece_chest_private,piece_chest_treasure,piece_chest_wood", "List of player placed objects that prevent zones being modified."); configSafeZoneObjects = config.Bind(text, "Safe zone objects", "Player_tombstone", "List of object ids that prevent zones being modified."); configSafeZoneSize = config.Bind(text, "Safe zones", 2, "0 = disable, 1 = only the zone, 2 = 3x3 zones, 3 = 5x5 zones, etc."); configRootUsers = config.Bind(text, "Root users", "", "SteamIDs that can execute commands on servers (-1 for the dedicated server). If not set, then all admins can execute commands."); configRootUsers.SettingChanged += delegate { UpdateRootUsers(); }; UpdateRootUsers(); configDisableAutomaticGenloc = config.Bind(text, "Disable automatic genloc", false, "If enabled, new content updates won't automatically redistribute locations."); configTimeBasedDataNames = config.Bind("3. Change time/day", "Time based data names", "spawntime,lastTime,SpawnTime,StartTime,alive_time,spawn_time,picked_time,plantTime,pregnant,TameLastFeeding", "Names of the data values that should be updated with the new time. Changing these is NOT recommended."); } } [BepInPlugin("upgrade_world", "Upgrade World", "1.79")] public class UpgradeWorld : BaseUnityPlugin { private const string GUID = "upgrade_world"; private const string NAME = "Upgrade World"; private const string VERSION = "1.79"; public static ManualLogSource Log; private bool WasConsoleVisible; public void Awake() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; Settings.Init(((BaseUnityPlugin)this).Config); new Harmony("upgrade_world").PatchAll(); SetupWatcher(); } public void Start() { Executor.SetContext((MonoBehaviour)(object)this); CommandWrapper.Init(); FiltererParameters.Parameters.Sort(); } private void SetupWatcher() { FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Path.GetDirectoryName(((BaseUnityPlugin)this).Config.ConfigFilePath), Path.GetFileName(((BaseUnityPlugin)this).Config.ConfigFilePath)); fileSystemWatcher.Changed += ReadConfigValues; fileSystemWatcher.Created += ReadConfigValues; fileSystemWatcher.Renamed += ReadConfigValues; fileSystemWatcher.IncludeSubdirectories = true; fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject; fileSystemWatcher.EnableRaisingEvents = true; } public void LateUpdate() { if (!Object.op_Implicit((Object)(object)ZNet.instance)) { LocationOperation.SetServerIds(null); VegetationOperation.SetServerIds(null); return; } bool flag = Console.IsVisible(); if (flag && !WasConsoleVisible) { ServerExecution.RequestSync(); } WasConsoleVisible = flag; } private void OnDestroy() { Executor.StopExecution(); ((BaseUnityPlugin)this).Config.Save(); } private void ReadConfigValues(object sender, FileSystemEventArgs e) { if (!File.Exists(((BaseUnityPlugin)this).Config.ConfigFilePath)) { return; } try { Log.LogDebug((object)"ReadConfigValues called"); ((BaseUnityPlugin)this).Config.Reload(); } catch { Log.LogError((object)("There was an issue loading your " + ((BaseUnityPlugin)this).Config.ConfigFilePath)); Log.LogError((object)"Please check your config entries for spelling and format!"); } } } [HarmonyPatch(typeof(Console), "IsConsoleEnabled")] public class IsConsoleEnabled { private static void Postfix(ref bool __result) { __result = true; } } [HarmonyPatch(typeof(Terminal), "InitTerminal")] public class SetCommands { public static void Postfix() { new TimeChangeCommand(); new BiomesCountCommand(); new ObjectsCountCommand(); new ZonesResetCommand(); new ZonesGenerateCommand(); new ObjectsListCommand(); new LocationsListCommand(); new LocationsAddCommand(); new LocationsResetCommand(); new ObjectsRemoveCommand(); new ObjectsEditCommand(); new ChestsSearchCommand(); new LocationRegisterCommand(); new LocationsRemoveCommand(); new ChestsResetCommand(); new ObjectsSwapCommand(); new TimeSetCommand(); new ObjetsRefreshCommand(); new StartStopCommand(); new UpgradeCommand(); new VerboseCommand(); new VegetationResetCommand(); new VegetationAddCommand(); new VegetationRemoveCommand(); new SavingCommands(); new WorldResetCommand(); new ZonesRestoreCommand(); new WorldVersionCommand(); new WorldCleanCommand(); new LocationsSwapCommand(); new TempleVersionCommand(); new CleanChestsCommand(); new CleanDungeonsCommand(); new CleanObjectsCommand(); new CleanLocationsCommand(); new CleanHealthCommand(); new CleanSpawnsCommand(); new CleanStandsCommand(); new CleanDuplicatesCommand(); new LocationsFixCommand(); new LocationUnregisterCommand(); new LocationsCountCommand(); if (Terminal.commands.TryGetValue("genloc", out var value)) { value.IsCheat = false; value.OnlyServer = false; } } } [HarmonyPatch(typeof(ZDOMan), "SendDestroyed")] public class SendDestroyed { public static bool Prefix(ZDOMan __instance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) List destroySendList = __instance.m_destroySendList; if (destroySendList.Count < 10000) { return true; } ZPackage val = new ZPackage(); val.Write(10000); for (int i = 0; i < 10000; i++) { val.Write(destroySendList[i]); } destroySendList.RemoveRange(0, 10000); ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "DestroyZDO", new object[1] { val }); return false; } } public static class Zones { private static Vector2i[]? AllZones; private static readonly HashSet LoadedZones = new HashSet(); public static Heightmap GetHeightmap(GameObject root) { return root.GetComponentInChildren(); } private static Vector2i[] Sort(IEnumerable zones) { List list = new List(); list.AddRange(zones.OrderBy((Vector2i zone) => (zone.x != int.MinValue && zone.y != int.MinValue) ? ((Vector2i)(ref zone)).Magnitude() : int.MinValue)); return list.ToArray(); } public static Vector2i[] GetZones(FiltererParameters args) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_006b: Unknown result type (might be due to invalid IL or missing references) ZoneSystem instance = ZoneSystem.instance; if (args.Zone.HasValue && args.MaxDistance == 0f && args.MinDistance == 0f) { if (args.TargetZones == TargetZones.Generated && !instance.m_generatedZones.Contains(args.Zone.Value)) { return Array.Empty(); } if (args.TargetZones != TargetZones.Ungenerated || !instance.m_generatedZones.Contains(args.Zone.Value)) { return (Vector2i[])(object)new Vector2i[1] { args.Zone.Value }; } return Array.Empty(); } return GetZones(args.TargetZones); } private static Vector2i[] GetZones(TargetZones zones) { if (zones == TargetZones.All) { return GetAllZones(); } ZoneSystem zs = ZoneSystem.instance; if (zones == TargetZones.Generated) { return Sort(zs.m_generatedZones); } List list = new List(); list.AddRange(from zone in GetAllZones() where !zs.m_generatedZones.Contains(zone) select zone); return list.ToArray(); } public static Vector2i[] GetAllZones() { return AllZones ?? (AllZones = GetWorldZones()); } public static void ResetAllZones() { AllZones = null; } private static Vector2i[] GetWorldZones() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) ZoneSystem instance = ZoneSystem.instance; HashSet hashSet = instance.m_generatedZones.ToHashSet(); int num = (int)Math.Ceiling((float)Settings.WorldRadius / instance.m_zoneSize); for (int i = -num; i <= num; i++) { for (int j = -num; j <= num; j++) { if (i * i + j * j <= num * num) { hashSet.Add(new Vector2i(i, j)); } } } return Sort(hashSet); } public static int Distance(Vector2i a, Vector2i b) { //IL_0000: 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_0012: 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) return Math.Max(Math.Abs(a.x - b.x), Math.Abs(a.y - b.y)); } public static bool IsWithin(Vector2i a, Vector2i b, int min, int max) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) int num = Distance(a, b); if (max == 0 && min > 0) { max = int.MaxValue; } if (num >= min) { return num <= max; } return false; } public static void PokeZone(Vector2i zone) { //IL_0005: 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) LoadedZones.Add(zone); ZoneSystem.instance.PokeLocalZone(zone); } public static void ReleaseZone(Vector2i zone) { //IL_0005: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) if (!LoadedZones.Contains(zone)) { return; } LoadedZones.Remove(zone); List zDOs = Helper.GetZDOs(zone); if (zDOs != null) { ZNetScene instance = ZNetScene.instance; foreach (ZDO item in zDOs) { if (instance.m_instances.TryGetValue(item, out var value)) { value.ResetZDO(); Object.Destroy((Object)(object)value); instance.m_instances.Remove(item); } } } if (ZoneSystem.instance.m_zones.TryGetValue(zone, out var value2)) { Object.Destroy((Object)(object)value2.m_root); ZoneSystem.instance.m_zones.Remove(zone); } } } } internal sealed class <>z__ReadOnlyArray : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { int ICollection.Count => _items.Length; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection.Count => _items.Length; T IReadOnlyList.this[int index] => _items[index]; int ICollection.Count => _items.Length; bool ICollection.IsReadOnly => true; T IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return ((ICollection)_items).Contains(item); } void ICollection.CopyTo(T[] array, int arrayIndex) { ((ICollection)_items).CopyTo(array, arrayIndex); } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { return ((IList)_items).IndexOf(item); } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } } internal sealed class <>z__ReadOnlySingleElementList : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator { object IEnumerator.Current => _item; T IEnumerator.Current => _item; public Enumerator(T item) { _item = item; } bool IEnumerator.MoveNext() { if (!_moveNextCalled) { return _moveNextCalled = true; } return false; } void IEnumerator.Reset() { _moveNextCalled = false; } void IDisposable.Dispose() { } } int ICollection.Count => 1; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection.Count => 1; T IReadOnlyList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } } int ICollection.Count => 1; bool ICollection.IsReadOnly => true; T IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } public <>z__ReadOnlySingleElementList(T item) { _item = item; } IEnumerator IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.CopyTo(Array array, int index) { array.SetValue(_item, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return EqualityComparer.Default.Equals(_item, (T)value); } int IList.IndexOf(object value) { if (!EqualityComparer.Default.Equals(_item, (T)value)) { return -1; } return 0; } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return EqualityComparer.Default.Equals(_item, item); } void ICollection.CopyTo(T[] array, int arrayIndex) { array[arrayIndex] = _item; } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { if (!EqualityComparer.Default.Equals(_item, item)) { return -1; } return 0; } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } }