Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of DropNSpawn v1.2.1
DropNSpawn.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Data; using ExpandWorldData; using HarmonyLib; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using ServerSync; using Splatform; using TMPro; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Core.ObjectPool; using YamlDotNet.Core.Tokens; using YamlDotNet.Helpers; using YamlDotNet.RepresentationModel; using YamlDotNet.Serialization; using YamlDotNet.Serialization.BufferedDeserialization; using YamlDotNet.Serialization.BufferedDeserialization.TypeDiscriminators; using YamlDotNet.Serialization.Callbacks; using YamlDotNet.Serialization.Converters; using YamlDotNet.Serialization.EventEmitters; using YamlDotNet.Serialization.NamingConventions; using YamlDotNet.Serialization.NodeDeserializers; using YamlDotNet.Serialization.NodeTypeResolvers; using YamlDotNet.Serialization.ObjectFactories; using YamlDotNet.Serialization.ObjectGraphTraversalStrategies; using YamlDotNet.Serialization.ObjectGraphVisitors; using YamlDotNet.Serialization.Schemas; using YamlDotNet.Serialization.TypeInspectors; using YamlDotNet.Serialization.TypeResolvers; using YamlDotNet.Serialization.Utilities; using YamlDotNet.Serialization.ValueDeserializers; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("DropNSpawn")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("sighsorry")] [assembly: AssemblyProduct("DropNSpawn")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4358610B-F3F4-4843-B7AF-98B7BC60DCDE")] [assembly: AssemblyFileVersion("1.2.1")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.1.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; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class ExtensionMarkerAttribute : Attribute { private readonly string <Name>k__BackingField; public string Name => <Name>k__BackingField; public ExtensionMarkerAttribute(string name) { <Name>k__BackingField = name; } } } namespace LocalizationManager { [PublicAPI] public class Localizer { private static readonly Dictionary<string, Dictionary<string, Func<string>>> PlaceholderProcessors; private static readonly Dictionary<string, Dictionary<string, string>> loadedTexts; private static readonly ConditionalWeakTable<Localization, string> localizationLanguage; private static readonly List<WeakReference<Localization>> localizationObjects; private static BaseUnityPlugin? _plugin; private static readonly List<string> fileExtensions; private static BaseUnityPlugin plugin { get { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown if (_plugin == null) { IEnumerable<TypeInfo> source; try { source = Assembly.GetExecutingAssembly().DefinedTypes.ToList(); } catch (ReflectionTypeLoadException ex) { source = from t in ex.Types where t != null select t.GetTypeInfo(); } _plugin = (BaseUnityPlugin)Chainloader.ManagerObject.GetComponent((Type)source.First((TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t))); } return _plugin; } } public static event Action? OnLocalizationComplete; private static void UpdatePlaceholderText(Localization localization, string key) { localizationLanguage.TryGetValue(localization, out string value); string text = loadedTexts[value][key]; if (PlaceholderProcessors.TryGetValue(key, out Dictionary<string, Func<string>> value2)) { text = value2.Aggregate(text, (string current, KeyValuePair<string, Func<string>> kv) => current.Replace("{" + kv.Key + "}", kv.Value())); } localization.AddWord(key, text); } public static void AddPlaceholder<T>(string key, string placeholder, ConfigEntry<T> config, Func<T, string>? convertConfigValue = null) where T : notnull { string key2 = key; string placeholder2 = placeholder; Func<T, string> convertConfigValue2 = convertConfigValue; ConfigEntry<T> config2 = config; if (convertConfigValue2 == null) { convertConfigValue2 = (T val) => val.ToString(); } if (!PlaceholderProcessors.ContainsKey(key2)) { PlaceholderProcessors[key2] = new Dictionary<string, Func<string>>(); } config2.SettingChanged += delegate { UpdatePlaceholder(); }; if (loadedTexts.ContainsKey(Localization.instance.GetSelectedLanguage())) { UpdatePlaceholder(); } void UpdatePlaceholder() { PlaceholderProcessors[key2][placeholder2] = () => convertConfigValue2(config2.Value); UpdatePlaceholderText(Localization.instance, key2); } } public static void AddText(string key, string text) { List<WeakReference<Localization>> list = new List<WeakReference<Localization>>(); foreach (WeakReference<Localization> localizationObject in localizationObjects) { if (localizationObject.TryGetTarget(out var target)) { Dictionary<string, string> dictionary = loadedTexts[localizationLanguage.GetOrCreateValue(target)]; if (!target.m_translations.ContainsKey(key)) { dictionary[key] = text; target.AddWord(key, text); } } else { list.Add(localizationObject); } } foreach (WeakReference<Localization> item in list) { localizationObjects.Remove(item); } } public static void Load() { _ = plugin; } public static void LoadLocalizationLater(Localization __instance) { LoadLocalization(Localization.instance, __instance.GetSelectedLanguage()); } public static void SafeCallLocalizeComplete() { Localizer.OnLocalizationComplete?.Invoke(); } private static void LoadLocalization(Localization __instance, string language) { if (!localizationLanguage.Remove(__instance)) { localizationObjects.Add(new WeakReference<Localization>(__instance)); } localizationLanguage.Add(__instance, language); Dictionary<string, string> dictionary = new Dictionary<string, string>(); foreach (string item in from f in Directory.GetFiles(Path.GetDirectoryName(Paths.PluginPath), plugin.Info.Metadata.Name + ".*", SearchOption.AllDirectories) where fileExtensions.IndexOf(Path.GetExtension(f)) >= 0 select f) { string[] array = Path.GetFileNameWithoutExtension(item).Split('.'); if (array.Length >= 2) { string text = array[1]; if (dictionary.ContainsKey(text)) { Debug.LogWarning((object)("Duplicate key " + text + " found for " + plugin.Info.Metadata.Name + ". The duplicate file found at " + item + " will be skipped.")); } else { dictionary[text] = item; } } } byte[] array2 = LoadTranslationFromAssembly("English"); if (array2 == null) { throw new Exception("Found no English localizations in mod " + plugin.Info.Metadata.Name + ". Expected an embedded resource translations/English.json or translations/English.yml."); } Dictionary<string, string> dictionary2 = new DeserializerBuilder().IgnoreFields().Build().Deserialize<Dictionary<string, string>>(Encoding.UTF8.GetString(array2)); if (dictionary2 == null) { throw new Exception("Localization for mod " + plugin.Info.Metadata.Name + " failed: Localization file was empty."); } string text2 = null; if (language != "English") { if (dictionary.TryGetValue(language, out var value)) { text2 = File.ReadAllText(value); } else { byte[] array3 = LoadTranslationFromAssembly(language); if (array3 != null) { text2 = Encoding.UTF8.GetString(array3); } } } if (text2 == null && dictionary.TryGetValue("English", out var value2)) { text2 = File.ReadAllText(value2); } if (text2 != null) { foreach (KeyValuePair<string, string> item2 in new DeserializerBuilder().IgnoreFields().Build().Deserialize<Dictionary<string, string>>(text2) ?? new Dictionary<string, string>()) { dictionary2[item2.Key] = item2.Value; } } loadedTexts[language] = dictionary2; foreach (KeyValuePair<string, string> item3 in dictionary2) { UpdatePlaceholderText(__instance, item3.Key); } } static Localizer() { //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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_008f: 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_00ca: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown PlaceholderProcessors = new Dictionary<string, Dictionary<string, Func<string>>>(); loadedTexts = new Dictionary<string, Dictionary<string, string>>(); localizationLanguage = new ConditionalWeakTable<Localization, string>(); localizationObjects = new List<WeakReference<Localization>>(); fileExtensions = new List<string>(2) { ".json", ".yml" }; Harmony val = new Harmony("org.bepinex.helpers.LocalizationManager"); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Localization), "SetupLanguage", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Localizer), "LoadLocalization", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(FejdStartup), "SetupGui", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Localizer), "LoadLocalizationLater", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(FejdStartup), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Localizer), "SafeCallLocalizeComplete", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static byte[]? LoadTranslationFromAssembly(string language) { foreach (string fileExtension in fileExtensions) { byte[] array = ReadEmbeddedFileBytes("translations." + language + fileExtension); if (array != null) { return array; } } return null; } public static byte[]? ReadEmbeddedFileBytes(string resourceFileName, Assembly? containingAssembly = null) { string resourceFileName2 = resourceFileName; using MemoryStream memoryStream = new MemoryStream(); if ((object)containingAssembly == null) { containingAssembly = Assembly.GetCallingAssembly(); } string text = containingAssembly.GetManifestResourceNames().FirstOrDefault((string str) => str.EndsWith(resourceFileName2, StringComparison.Ordinal)); if (text != null) { containingAssembly.GetManifestResourceStream(text)?.CopyTo(memoryStream); } return (memoryStream.Length == 0L) ? null : memoryStream.ToArray(); } } public static class LocalizationManagerVersion { public const string Version = "1.4.1"; } } namespace DropNSpawn { internal sealed class LocationConfigurationEntry { [YamlMember(Order = 1)] public string Prefab { get; set; } = ""; [YamlMember(Order = 2)] public bool Enabled { get; set; } = true; [YamlMember(Order = 3)] public ConditionsDefinition? Conditions { get; set; } [YamlMember(Order = 4)] public LocationOfferingBowlDefinition? OfferingBowl { get; set; } [YamlMember(Order = 5)] public List<LocationItemStandDefinition>? ItemStands { get; set; } [YamlMember(Order = 6)] public List<LocationVegvisirDefinition>? Vegvisirs { get; set; } [YamlMember(Order = 7)] public List<LocationRunestoneDefinition>? Runestones { get; set; } [YamlMember(Order = 8)] public LocationRunestoneGlobalPinsDefinition? RunestoneGlobalPins { get; set; } [YamlIgnore] public string RuleId { get; set; } = ""; [YamlIgnore] public string? SourcePath { get; set; } [YamlIgnore] public int SourceLine { get; set; } [YamlIgnore] public int SourceColumn { get; set; } } internal sealed class LocationReferenceEntry { [YamlMember(Order = 1)] public string Prefab { get; set; } = ""; [YamlMember(Order = 2)] public LocationOfferingBowlDefinition? OfferingBowl { get; set; } [YamlMember(Order = 3)] public List<LocationItemStandDefinition>? ItemStands { get; set; } [YamlMember(Order = 4)] public List<LocationVegvisirDefinition>? Vegvisirs { get; set; } [YamlMember(Order = 5)] public List<LocationRunestoneDefinition>? Runestones { get; set; } } internal sealed class LocationOfferingBowlDefinition { [YamlMember(Order = 1)] public string? Name { get; set; } [YamlMember(Order = 2)] public string? UseItemText { get; set; } [YamlMember(Order = 3)] public string? UsedAltarText { get; set; } [YamlMember(Order = 4)] public string? CantOfferText { get; set; } [YamlMember(Order = 5)] public string? WrongOfferText { get; set; } [YamlMember(Order = 6)] public string? IncompleteOfferText { get; set; } [YamlMember(Order = 7)] public string? BossItem { get; set; } [YamlMember(Order = 8)] public int? BossItems { get; set; } [YamlMember(Order = 9)] public string? BossPrefab { get; set; } [YamlMember(Order = 10)] public string? ItemPrefab { get; set; } [YamlMember(Order = 11)] public string? SetGlobalKey { get; set; } [YamlMember(Order = 12)] public bool? RenderSpawnAreaGizmos { get; set; } [YamlMember(Order = 13)] public bool? AlertOnSpawn { get; set; } [YamlMember(Order = 14)] public float? SpawnBossDelay { get; set; } [YamlMember(Order = 15)] public FloatRangeDefinition? SpawnBossDistance { get; set; } [YamlIgnore] public float? SpawnBossMaxDistance { get; set; } [YamlIgnore] public float? SpawnBossMinDistance { get; set; } [YamlMember(Order = 18)] public float? SpawnBossMaxYDistance { get; set; } [YamlMember(Order = 19)] public int? GetSolidHeightMargin { get; set; } [YamlMember(Order = 20)] public bool? EnableSolidHeightCheck { get; set; } [YamlMember(Order = 21)] public float? SpawnPointClearingRadius { get; set; } [YamlMember(Order = 22)] public float? SpawnYOffset { get; set; } [YamlMember(Order = 23)] public bool? UseItemStands { get; set; } [YamlMember(Order = 24)] public string? ItemStandPrefix { get; set; } [YamlMember(Order = 25)] public float? ItemStandMaxRange { get; set; } [YamlMember(Order = 26)] public float? RespawnMinutes { get; set; } [YamlMember(Order = 27)] public string? Data { get; set; } [YamlMember(Order = 28)] public Dictionary<string, string>? Fields { get; set; } [YamlMember(Order = 29)] public List<string>? Objects { get; set; } } internal sealed class LocationVegvisirDefinition { [YamlMember(Order = 1)] public string Path { get; set; } = ""; [YamlMember(Order = 2)] public List<string>? ExpectedLocations { get; set; } [YamlMember(Order = 3)] public string? Name { get; set; } [YamlMember(Order = 4)] public string? UseText { get; set; } [YamlMember(Order = 5)] public string? HoverName { get; set; } [YamlMember(Order = 6)] public string? SetsGlobalKey { get; set; } [YamlMember(Order = 7)] public string? SetsPlayerKey { get; set; } [YamlMember(Order = 8)] public List<LocationVegvisirTargetDefinition>? Locations { get; set; } } internal sealed class LocationItemStandDefinition { [YamlMember(Order = 1)] public string? Path { get; set; } [YamlMember(Order = 2)] public string? Name { get; set; } [YamlMember(Order = 3)] public bool? CanBeRemoved { get; set; } [YamlMember(Order = 4)] public bool? AutoAttach { get; set; } [YamlMember(Order = 5)] public string? OrientationType { get; set; } [YamlMember(Order = 6)] public List<string>? SupportedTypes { get; set; } [YamlMember(Order = 7)] public List<string>? SupportedItems { get; set; } [YamlMember(Order = 8)] public List<string>? UnsupportedItems { get; set; } [YamlMember(Order = 9)] public float? PowerActivationDelay { get; set; } [YamlMember(Order = 10)] public string? GuardianPower { get; set; } } internal sealed class LocationRunestoneDefinition { [YamlMember(Order = 1)] public string Path { get; set; } = ""; [YamlMember(Order = 2)] public string? ExpectedLocationName { get; set; } [YamlMember(Order = 3)] public string? ExpectedLabel { get; set; } [YamlMember(Order = 4)] public string? ExpectedTopic { get; set; } [YamlMember(Order = 5)] public string? Name { get; set; } [YamlMember(Order = 6)] public string? Topic { get; set; } [YamlMember(Order = 7)] public string? Label { get; set; } [YamlMember(Order = 8)] public string? Text { get; set; } [YamlMember(Order = 9)] public List<LocationRunestoneTextDefinition>? RandomTexts { get; set; } [YamlMember(Order = 10)] public string? LocationName { get; set; } [YamlMember(Order = 11)] public string? PinName { get; set; } [YamlMember(Order = 12)] public string? PinType { get; set; } [YamlMember(Order = 13)] public bool? ShowMap { get; set; } [YamlMember(Order = 14)] public float? Chance { get; set; } } internal sealed class LocationRunestoneTextDefinition { [YamlMember(Order = 1)] public string? Topic { get; set; } [YamlMember(Order = 2)] public string? Label { get; set; } [YamlMember(Order = 3)] public string? Text { get; set; } } internal sealed class LocationRunestoneGlobalPinsDefinition { [YamlMember(Order = 1)] public List<LocationRunestoneGlobalPinTargetDefinition>? TargetLocations { get; set; } } internal sealed class LocationRunestoneGlobalPinTargetDefinition { [YamlMember(Order = 1)] public string LocationName { get; set; } = ""; [YamlMember(Order = 2)] public float? Chance { get; set; } [YamlMember(Order = 3)] public List<string>? SourceBiomes { get; set; } [YamlMember(Order = 4)] public string? PinName { get; set; } [YamlMember(Order = 5)] public string? PinType { get; set; } } internal sealed class LocationVegvisirTargetDefinition { [YamlMember(Order = 1)] public string LocationName { get; set; } = ""; [YamlMember(Order = 2)] public string? PinName { get; set; } [YamlMember(Order = 3)] public string? PinType { get; set; } [YamlMember(Order = 4)] public bool? DiscoverAll { get; set; } [YamlMember(Order = 5)] public bool? ShowMap { get; set; } [YamlMember(Order = 6)] public float? Weight { get; set; } } internal static class LocationManager { private sealed class OfferingBowlSnapshot { public string Name { get; set; } = ""; public string UseItemText { get; set; } = ""; public string UsedAltarText { get; set; } = ""; public string CantOfferText { get; set; } = ""; public string WrongOfferText { get; set; } = ""; public string IncompleteOfferText { get; set; } = ""; public string BossItem { get; set; } = ""; public int BossItems { get; set; } public string BossPrefab { get; set; } = ""; public string ItemPrefab { get; set; } = ""; public string SetGlobalKey { get; set; } = ""; public bool RenderSpawnAreaGizmos { get; set; } public bool AlertOnSpawn { get; set; } public float SpawnBossDelay { get; set; } public float SpawnBossMaxDistance { get; set; } public float SpawnBossMinDistance { get; set; } public float SpawnBossMaxYDistance { get; set; } public int GetSolidHeightMargin { get; set; } public bool EnableSolidHeightCheck { get; set; } public float SpawnPointClearingRadius { get; set; } public float SpawnYOffset { get; set; } public bool UseItemStands { get; set; } public string ItemStandPrefix { get; set; } = ""; public float ItemStandMaxRange { get; set; } } private sealed class VegvisirTargetSnapshot { public string LocationName { get; set; } = ""; public string PinName { get; set; } = ""; public string PinType { get; set; } = ""; public bool DiscoverAll { get; set; } public bool ShowMap { get; set; } } private sealed class VegvisirSnapshot { public string Name { get; set; } = ""; public string UseText { get; set; } = ""; public string HoverName { get; set; } = ""; public string SetsGlobalKey { get; set; } = ""; public string SetsPlayerKey { get; set; } = ""; public List<VegvisirTargetSnapshot> Locations { get; set; } = new List<VegvisirTargetSnapshot>(); } private sealed class PathScopedVegvisirSnapshot { public string Path { get; set; } = ""; public VegvisirSnapshot Snapshot { get; set; } = new VegvisirSnapshot(); } private sealed class RunestoneTextSnapshot { public string Topic { get; set; } = ""; public string Label { get; set; } = ""; public string Text { get; set; } = ""; } private sealed class RunestoneSnapshot { public string Name { get; set; } = ""; public string Topic { get; set; } = ""; public string Label { get; set; } = ""; public string Text { get; set; } = ""; public List<RunestoneTextSnapshot> RandomTexts { get; set; } = new List<RunestoneTextSnapshot>(); public string LocationName { get; set; } = ""; public string PinName { get; set; } = ""; public string PinType { get; set; } = ""; public bool ShowMap { get; set; } } private sealed class RunestonePinChanceState { public string RollKey { get; set; } = ""; public bool AllowsPin { get; set; } = true; } private sealed class PathScopedRunestoneSnapshot { public string Path { get; set; } = ""; public RunestoneSnapshot Snapshot { get; set; } = new RunestoneSnapshot(); } private sealed class PathScopedOfferingBowlSnapshot { public string Path { get; set; } = ""; public OfferingBowlSnapshot Snapshot { get; set; } = new OfferingBowlSnapshot(); } private sealed class ItemStandSnapshot { public string Name { get; set; } = ""; public bool CanBeRemoved { get; set; } public bool AutoAttach { get; set; } public string OrientationType { get; set; } = ""; public List<string> SupportedTypes { get; set; } = new List<string>(); public List<string> SupportedItems { get; set; } = new List<string>(); public List<string> UnsupportedItems { get; set; } = new List<string>(); public float PowerActivationDelay { get; set; } public string GuardianPower { get; set; } = ""; } private sealed class PathScopedItemStandSnapshot { public string Path { get; set; } = ""; public ItemStandSnapshot Snapshot { get; set; } = new ItemStandSnapshot(); } private sealed class LocationSnapshot { public string Prefab { get; set; } = ""; public OfferingBowlSnapshot? OfferingBowl { get; set; } public List<PathScopedItemStandSnapshot> ItemStands { get; set; } = new List<PathScopedItemStandSnapshot>(); public List<PathScopedVegvisirSnapshot> Vegvisirs { get; set; } = new List<PathScopedVegvisirSnapshot>(); public List<PathScopedRunestoneSnapshot> Runestones { get; set; } = new List<PathScopedRunestoneSnapshot>(); } private sealed class LiveLocationSnapshot { public string Prefab { get; set; } = ""; public PathScopedOfferingBowlSnapshot? OfferingBowl { get; set; } public List<PathScopedItemStandSnapshot> ItemStands { get; set; } = new List<PathScopedItemStandSnapshot>(); public List<PathScopedVegvisirSnapshot> Vegvisirs { get; set; } = new List<PathScopedVegvisirSnapshot>(); public List<PathScopedRunestoneSnapshot> Runestones { get; set; } = new List<PathScopedRunestoneSnapshot>(); } private sealed class SyncedLocationConfigurationState { public List<LocationConfigurationEntry> Configuration { get; set; } = new List<LocationConfigurationEntry>(); public Dictionary<string, List<LocationConfigurationEntry>> ActiveEntriesByPrefab { get; } = new Dictionary<string, List<LocationConfigurationEntry>>(StringComparer.OrdinalIgnoreCase); public Dictionary<string, List<LocationConfigurationEntry>> LooseItemStandEntriesByPrefab { get; } = new Dictionary<string, List<LocationConfigurationEntry>>(StringComparer.OrdinalIgnoreCase); public string ConfigurationSignature { get; set; } = ""; } private sealed class LocationComponentCatalog { public string Prefab { get; set; } = ""; public string? OfferingBowlPath { get; set; } public List<string> ItemStandPaths { get; set; } = new List<string>(); public List<string> VegvisirPaths { get; set; } = new List<string>(); public List<string> RunestonePaths { get; set; } = new List<string>(); } private sealed class LocationRuntimeComponents { public Transform Root { get; set; } public List<OfferingBowl> OfferingBowls { get; } = new List<OfferingBowl>(); public OfferingBowl? PrimaryOfferingBowl { get; set; } public List<ItemStand> ItemStands { get; } = new List<ItemStand>(); public List<Vegvisir> Vegvisirs { get; } = new List<Vegvisir>(); public List<RuneStone> Runestones { get; } = new List<RuneStone>(); public Dictionary<string, OfferingBowl> OfferingBowlsByPath { get; set; } = new Dictionary<string, OfferingBowl>(StringComparer.Ordinal); public Dictionary<string, ItemStand> ItemStandsByPath { get; set; } = new Dictionary<string, ItemStand>(StringComparer.Ordinal); public Dictionary<string, Vegvisir> VegvisirsByPath { get; set; } = new Dictionary<string, Vegvisir>(StringComparer.Ordinal); public Dictionary<string, RuneStone> RunestonesByPath { get; set; } = new Dictionary<string, RuneStone>(StringComparer.Ordinal); public List<ItemStand> RelevantItemStands { get; set; } = new List<ItemStand>(); } private sealed class LocationProxyObservationState { public ZNetView? NView { get; set; } public uint LastObservedDataRevision { get; set; } = uint.MaxValue; public string LastObservedAlias { get; set; } = ""; public int StablePollCount { get; set; } public int LastObservedDemandEpoch { get; set; } = -1; } private sealed class LocationAliasRefreshRequestState { public int LastQueuedAliasEpoch { get; set; } = -1; public int LastQueuedFrame { get; set; } = -1; public string LastQueuedResolvedPrefabName { get; set; } = ""; } private sealed class PendingLocationProxyAliasZdoFlush { public int Epoch { get; set; } public int DueFrame { get; set; } public uint DataRevision { get; set; } } private enum LooseOfferingBowlOverrideMode { RestoreOnly, Apply } private readonly struct LooseOfferingBowlOverrideStamp : IEquatable<LooseOfferingBowlOverrideStamp> { public int ReconcileQueueEpoch { get; } public int RegistryVersion { get; } public LooseOfferingBowlOverrideMode Mode { get; } public int RootInstanceId { get; } public string PrefabName { get; } public string ConfigurationSignature { get; } public int EntryPlanCount { get; } public int RelevantItemStandCount { get; } public int RelevantItemStandSignature { get; } public LooseOfferingBowlOverrideStamp(int reconcileQueueEpoch, int registryVersion, LooseOfferingBowlOverrideMode mode, int rootInstanceId, string prefabName, string configurationSignature, int entryPlanCount, int relevantItemStandCount, int relevantItemStandSignature) { ReconcileQueueEpoch = reconcileQueueEpoch; RegistryVersion = registryVersion; Mode = mode; RootInstanceId = rootInstanceId; PrefabName = prefabName ?? ""; ConfigurationSignature = configurationSignature ?? ""; EntryPlanCount = entryPlanCount; RelevantItemStandCount = relevantItemStandCount; RelevantItemStandSignature = relevantItemStandSignature; } public bool Equals(LooseOfferingBowlOverrideStamp other) { if (ReconcileQueueEpoch == other.ReconcileQueueEpoch && RegistryVersion == other.RegistryVersion && Mode == other.Mode && RootInstanceId == other.RootInstanceId && StringComparer.Ordinal.Equals(PrefabName, other.PrefabName) && StringComparer.Ordinal.Equals(ConfigurationSignature, other.ConfigurationSignature) && EntryPlanCount == other.EntryPlanCount && RelevantItemStandCount == other.RelevantItemStandCount) { return RelevantItemStandSignature == other.RelevantItemStandSignature; } return false; } public override bool Equals(object? obj) { if (obj is LooseOfferingBowlOverrideStamp other) { return Equals(other); } return false; } public override int GetHashCode() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) HashCode val = default(HashCode); ((HashCode)(ref val)).Add<int>(ReconcileQueueEpoch); ((HashCode)(ref val)).Add<int>(RegistryVersion); ((HashCode)(ref val)).Add<int>((int)Mode); ((HashCode)(ref val)).Add<int>(RootInstanceId); ((HashCode)(ref val)).Add<string>(PrefabName, (IEqualityComparer<string>)StringComparer.Ordinal); ((HashCode)(ref val)).Add<string>(ConfigurationSignature, (IEqualityComparer<string>)StringComparer.Ordinal); ((HashCode)(ref val)).Add<int>(EntryPlanCount); ((HashCode)(ref val)).Add<int>(RelevantItemStandCount); ((HashCode)(ref val)).Add<int>(RelevantItemStandSignature); return ((HashCode)(ref val)).ToHashCode(); } } private sealed class LooseOfferingBowlOverrideState { public bool HasLastAppliedStamp { get; set; } public LooseOfferingBowlOverrideStamp LastAppliedStamp { get; set; } } private readonly struct PendingLocationProxyObservation { public LocationProxy Proxy { get; } public int ProxyInstanceId { get; } public int Epoch { get; } public int DueFrame { get; } public PendingLocationProxyObservation(LocationProxy proxy, int proxyInstanceId, int epoch, int dueFrame) { Proxy = proxy; ProxyInstanceId = proxyInstanceId; Epoch = epoch; DueFrame = dueFrame; } } private sealed class ScheduledFrameQueue<T> { private readonly SortedDictionary<int, RingBufferQueue<T>> _buckets = new SortedDictionary<int, RingBufferQueue<T>>(); public int Count { get; private set; } public void Enqueue(int dueFrame, T item) { if (!_buckets.TryGetValue(dueFrame, out RingBufferQueue<T> value)) { value = new RingBufferQueue<T>(); _buckets[dueFrame] = value; } value.Enqueue(item); Count++; } public bool TryPeekDueFrame(out int dueFrame) { using (SortedDictionary<int, RingBufferQueue<T>>.Enumerator enumerator = _buckets.GetEnumerator()) { if (enumerator.MoveNext()) { dueFrame = enumerator.Current.Key; return true; } } dueFrame = int.MaxValue; return false; } public bool HasDueItems(int currentFrame) { if (TryPeekDueFrame(out var dueFrame)) { return dueFrame <= currentFrame; } return false; } public bool TryDequeue(out int dueFrame, out T item) { while (TryPeekDueFrame(out dueFrame)) { RingBufferQueue<T> ringBufferQueue = _buckets[dueFrame]; if (!ringBufferQueue.TryDequeue(out item)) { _buckets.Remove(dueFrame); continue; } Count--; if (ringBufferQueue.Count == 0) { _buckets.Remove(dueFrame); } return true; } dueFrame = int.MaxValue; item = default(T); return false; } public void Clear() { _buckets.Clear(); Count = 0; } } private sealed class AuthoredItemStandSlotTemplate { public string Path { get; set; } = ""; public Vector3 OfferingBowlLocalOffset { get; set; } } private enum PendingLocationRootPhase { TraverseHierarchy, ReconcileLocations } private readonly struct PendingLocationTraversalNode { public Transform Transform { get; } public Location? CurrentLocation { get; } public PendingLocationTraversalNode(Transform transform, Location? currentLocation) { Transform = transform; CurrentLocation = currentLocation; } } private sealed class PendingLocationRootReconcile { public int RootInstanceId { get; set; } public GameObject RootObject { get; set; } public int Epoch { get; set; } public PendingLocationRootPhase Phase { get; set; } public List<Location>? Locations { get; set; } public List<PendingLocationTraversalNode>? TraversalStack { get; set; } public Dictionary<int, LocationRuntimeComponents>? RuntimeComponentsByLocationId { get; set; } public int NextIndex { get; set; } } private readonly struct PendingLocationReconcile { public Location Location { get; } public int LocationInstanceId { get; } public int Epoch { get; } public PendingLocationReconcile(Location location, int locationInstanceId, int epoch) { Location = location; LocationInstanceId = locationInstanceId; Epoch = epoch; } } private readonly struct PendingLooseOfferingBowlOverride { public OfferingBowl OfferingBowl { get; } public int OfferingBowlInstanceId { get; } public int Epoch { get; } public PendingLooseOfferingBowlOverride(OfferingBowl offeringBowl, int offeringBowlInstanceId, int epoch) { OfferingBowl = offeringBowl; OfferingBowlInstanceId = offeringBowlInstanceId; Epoch = epoch; } } private sealed class LocationApplyOperations : IStandardBaselineDesiredStateOperations<LocationDesiredState> { public static LocationApplyOperations Instance { get; } = new LocationApplyOperations(); public string DomainKey => "location"; public BaselineDesiredStateCapabilities Capabilities => BaselineDesiredStateCapabilities.Validation | BaselineDesiredStateCapabilities.LiveApply; public void Validate(LocationDesiredState desiredState) { ValidateLocationDesiredState(desiredState); } public void RestoreStaticBaseline(LocationDesiredState desiredState) { RestoreLocationStaticBaseline(desiredState); } public void ApplyDesiredStateToStaticBaseline(LocationDesiredState desiredState) { ApplyLocationDesiredStateToStaticBaseline(desiredState); } public void PrepareLiveBaseline(LocationDesiredState desiredState) { PrepareLocationLiveBaseline(desiredState); } public void ApplyDesiredStateToLive(LocationDesiredState desiredState) { ApplyLocationDesiredStateToLive(desiredState); } public void Commit(LocationDesiredState desiredState) { RecordAppliedState(desiredState.GameDataSignature, desiredState.DomainEnabled, desiredState.CurrentEntrySignatures); } public void HandleFailure(LocationDesiredState desiredState, StandardApplyFailureContext failureContext) { if (failureContext.LiveStageFailed && desiredState.ReloadPrefabs.Count != 0) { QueueRegisteredLocationReconciles(desiredState.ReloadPrefabs); } } } private sealed class CompiledLocationOfferingBowlPlan { public LocationOfferingBowlDefinition Definition { get; set; } = new LocationOfferingBowlDefinition(); } private sealed class CompiledLocationItemStandPlan { public LocationItemStandDefinition Definition { get; set; } = new LocationItemStandDefinition(); public string Path { get; set; } = ""; public bool HasPath { get; set; } } private sealed class CompiledLocationVegvisirPlan { public LocationVegvisirDefinition Definition { get; set; } = new LocationVegvisirDefinition(); } private sealed class CompiledLocationRunestonePlan { public LocationRunestoneDefinition Definition { get; set; } = new LocationRunestoneDefinition(); } private sealed class CompiledLocationEntryPlan { public ConditionsDefinition? Conditions { get; set; } public bool HasConditions { get; set; } public CompiledLocationOfferingBowlPlan? OfferingBowl { get; set; } public List<CompiledLocationItemStandPlan> ItemStands { get; } = new List<CompiledLocationItemStandPlan>(); public List<CompiledLocationVegvisirPlan> Vegvisirs { get; } = new List<CompiledLocationVegvisirPlan>(); public List<CompiledLocationRunestonePlan> Runestones { get; } = new List<CompiledLocationRunestonePlan>(); } private sealed class CompiledLocationPrefabPlan { public List<CompiledLocationEntryPlan> ActiveEntryPlans { get; } = new List<CompiledLocationEntryPlan>(); public List<CompiledLocationEntryPlan> LooseItemStandPlans { get; } = new List<CompiledLocationEntryPlan>(); } private sealed class LocationRuntimeConfigurationState { public static LocationRuntimeConfigurationState Empty { get; } = new LocationRuntimeConfigurationState(); public Dictionary<string, CompiledLocationPrefabPlan> PlansByPrefab { get; } = new Dictionary<string, CompiledLocationPrefabPlan>(StringComparer.OrdinalIgnoreCase); } private sealed class LocationDesiredState { public StandardDomainApplyPlan ApplyPlan { get; set; } public int GameDataSignature { get; set; } public Dictionary<string, string> CurrentEntrySignatures { get; set; } = EmptyEntrySignatures; public bool DomainEnabled { get; set; } public bool QueueLiveReconcile { get; set; } public HashSet<string> ReloadPrefabs { get; set; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase); public LocationRuntimeConfigurationState RuntimeConfigurationState { get; set; } = LocationRuntimeConfigurationState.Empty; } private readonly struct InvalidEntryWarningSuppressionScope : IDisposable { private readonly bool _active; public InvalidEntryWarningSuppressionScope(bool active) { _active = active; if (_active) { _invalidEntryWarningSuppressionDepth++; } } public void Dispose() { if (_active) { _invalidEntryWarningSuppressionDepth--; } } } internal enum OfferingBowlBlockReason { None, SameBossNearby, RespawnCooldownActive } internal readonly struct OfferingBowlBlockResult { internal static OfferingBowlBlockResult None => default(OfferingBowlBlockResult); public bool Blocked { get; } public OfferingBowlBlockReason Reason { get; } public OfferingBowlBlockResult(bool blocked, OfferingBowlBlockReason reason) { Blocked = blocked; Reason = reason; } } private sealed class RunestoneGlobalPinsRollState { public string RollKey { get; set; } = ""; public ResolvedRunestoneGlobalPin? Pin { get; set; } } private sealed class RunestoneGlobalPinCandidate { public float Chance { get; set; } public ResolvedRunestoneGlobalPin Pin { get; set; } = new ResolvedRunestoneGlobalPin(); } private sealed class ResolvedRunestoneGlobalPin { public string LocationName { get; set; } = ""; public string PinName { get; set; } = ""; public PinType PinType { get; set; } = (PinType)3; public Vector3 Position { get; set; } } private sealed class RunestoneGlobalPinLocationIndex { public int ZoneSystemId { get; set; } public int LocationInstanceCount { get; set; } public Dictionary<string, List<LocationInstance>> InstancesByName { get; } = new Dictionary<string, List<LocationInstance>>(StringComparer.OrdinalIgnoreCase); } [CompilerGenerated] private sealed class <BuildConfiguredLocationResolutionKeys>d__169 : IEnumerable<string>, IEnumerable, IEnumerator<string>, IDisposable, IEnumerator { private int <>1__state; private string <>2__current; private int <>l__initialThreadId; private HashSet<string> <seen>5__2; private Dictionary<string, List<LocationConfigurationEntry>>.Enumerator <>7__wrap2; private List<LocationConfigurationEntry>.Enumerator <>7__wrap3; private LocationConfigurationEntry <entry>5__5; private IEnumerator<string> <>7__wrap5; private List<LocationItemStandDefinition>.Enumerator <>7__wrap6; string IEnumerator<string>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <BuildConfiguredLocationResolutionKeys>d__169(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if ((uint)(num - -7) <= 4u || (uint)(num - 1) <= 1u) { try { if ((uint)(num - -7) <= 3u || (uint)(num - 1) <= 1u) { try { switch (num) { case -5: case 1: try { } finally { <>m__Finally3(); } break; case -7: case -6: case 2: try { if (num == -7 || num == 2) { try { } finally { <>m__Finally5(); } } } finally { <>m__Finally4(); } break; } } finally { <>m__Finally2(); } } } finally { <>m__Finally1(); } } <seen>5__2 = null; <>7__wrap2 = default(Dictionary<string, List<LocationConfigurationEntry>>.Enumerator); <>7__wrap3 = default(List<LocationConfigurationEntry>.Enumerator); <entry>5__5 = null; <>7__wrap5 = null; <>7__wrap6 = default(List<LocationItemStandDefinition>.Enumerator); <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <seen>5__2 = new HashSet<string>(StringComparer.OrdinalIgnoreCase); <>7__wrap2 = ActiveEntriesByPrefab.GetEnumerator(); <>1__state = -3; goto IL_01ff; case 1: <>1__state = -5; goto IL_00f6; case 2: { <>1__state = -7; goto IL_019a; } IL_01ff: if (<>7__wrap2.MoveNext()) { <>7__wrap2.Current.Deconstruct(out string _, out List<LocationConfigurationEntry> value); List<LocationConfigurationEntry> list = value; <>7__wrap3 = list.GetEnumerator(); <>1__state = -4; goto IL_01dd; } <>m__Finally1(); <>7__wrap2 = default(Dictionary<string, List<LocationConfigurationEntry>>.Enumerator); return false; IL_00f6: if (<>7__wrap5.MoveNext()) { string current = <>7__wrap5.Current; <>2__current = current; <>1__state = 1; return true; } <>m__Finally3(); <>7__wrap5 = null; goto IL_0110; IL_01b4: if (<>7__wrap6.MoveNext()) { LocationItemStandDefinition current2 = <>7__wrap6.Current; <>7__wrap5 = BuildConfiguredLocationResolutionKeys(current2, <seen>5__2).GetEnumerator(); <>1__state = -7; goto IL_019a; } <>m__Finally4(); <>7__wrap6 = default(List<LocationItemStandDefinition>.Enumerator); <entry>5__5 = null; goto IL_01dd; IL_01dd: if (<>7__wrap3.MoveNext()) { <entry>5__5 = <>7__wrap3.Current; LocationOfferingBowlDefinition offeringBowl = <entry>5__5.OfferingBowl; if (offeringBowl != null) { <>7__wrap5 = BuildConfiguredLocationResolutionKeys(offeringBowl, <seen>5__2).GetEnumerator(); <>1__state = -5; goto IL_00f6; } goto IL_0110; } <>m__Finally2(); <>7__wrap3 = default(List<LocationConfigurationEntry>.Enumerator); goto IL_01ff; IL_019a: if (<>7__wrap5.MoveNext()) { string current3 = <>7__wrap5.Current; <>2__current = current3; <>1__state = 2; return true; } <>m__Finally5(); <>7__wrap5 = null; goto IL_01b4; IL_0110: if (<entry>5__5.ItemStands != null) { <>7__wrap6 = <entry>5__5.ItemStands.GetEnumerator(); <>1__state = -6; goto IL_01b4; } goto IL_01dd; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>7__wrap2).Dispose(); } private void <>m__Finally2() { <>1__state = -3; ((IDisposable)<>7__wrap3).Dispose(); } private void <>m__Finally3() { <>1__state = -4; if (<>7__wrap5 != null) { <>7__wrap5.Dispose(); } } private void <>m__Finally4() { <>1__state = -4; ((IDisposable)<>7__wrap6).Dispose(); } private void <>m__Finally5() { <>1__state = -6; if (<>7__wrap5 != null) { <>7__wrap5.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<string> IEnumerable<string>.GetEnumerator() { if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; return this; } return new <BuildConfiguredLocationResolutionKeys>d__169(0); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<string>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <BuildConfiguredLocationResolutionKeys>d__170 : IEnumerable<string>, IEnumerable, IEnumerator<string>, IDisposable, IEnumerator { private int <>1__state; private string <>2__current; private int <>l__initialThreadId; private LocationOfferingBowlDefinition definition; public LocationOfferingBowlDefinition <>3__definition; private HashSet<string> seen; public HashSet<string> <>3__seen; string IEnumerator<string>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <BuildConfiguredLocationResolutionKeys>d__170(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { string key2; string key3; switch (<>1__state) { default: return false; case 0: { <>1__state = -1; if (TryBuildResolvedPrefabSignatureKey("item", definition.BossItem, ResolveItemPrefab(definition.BossItem, null), out string key) && seen.Add(key)) { <>2__current = key; <>1__state = 1; return true; } goto IL_0075; } case 1: <>1__state = -1; goto IL_0075; case 2: <>1__state = -1; goto IL_00c4; case 3: { <>1__state = -1; break; } IL_00c4: if (TryBuildResolvedPrefabSignatureKey("item", definition.ItemPrefab, ResolveItemPrefab(definition.ItemPrefab, null), out key2) && seen.Add(key2)) { <>2__current = key2; <>1__state = 3; return true; } break; IL_0075: if (TryBuildResolvedPrefabSignatureKey("spawn", definition.BossPrefab, ResolveSpawnPrefab(definition.BossPrefab, null), out key3) && seen.Add(key3)) { <>2__current = key3; <>1__state = 2; return true; } goto IL_00c4; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<string> IEnumerable<string>.GetEnumerator() { <BuildConfiguredLocationResolutionKeys>d__170 <BuildConfiguredLocationResolutionKeys>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <BuildConfiguredLocationResolutionKeys>d__ = this; } else { <BuildConfiguredLocationResolutionKeys>d__ = new <BuildConfiguredLocationResolutionKeys>d__170(0); } <BuildConfiguredLocationResolutionKeys>d__.definition = <>3__definition; <BuildConfiguredLocationResolutionKeys>d__.seen = <>3__seen; return <BuildConfiguredLocationResolutionKeys>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<string>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <BuildConfiguredLocationResolutionKeys>d__171 : IEnumerable<string>, IEnumerable, IEnumerator<string>, IDisposable, IEnumerator { private int <>1__state; private string <>2__current; private int <>l__initialThreadId; private LocationItemStandDefinition definition; public LocationItemStandDefinition <>3__definition; private HashSet<string> seen; public HashSet<string> <>3__seen; private IEnumerator<string> <>7__wrap1; string IEnumerator<string>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <BuildConfiguredLocationResolutionKeys>d__171(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { switch (<>1__state) { case -3: case 1: try { } finally { <>m__Finally1(); } break; case -4: case 2: try { } finally { <>m__Finally2(); } break; } <>7__wrap1 = null; <>1__state = -2; } private bool MoveNext() { try { string key2; IEnumerable<string> supportedItems; switch (<>1__state) { default: return false; case 0: <>1__state = -1; supportedItems = definition.SupportedItems; <>7__wrap1 = (supportedItems ?? Enumerable.Empty<string>()).GetEnumerator(); <>1__state = -3; goto IL_00a8; case 1: <>1__state = -3; goto IL_00a8; case 2: <>1__state = -4; goto IL_013c; case 3: { <>1__state = -1; break; } IL_013c: while (<>7__wrap1.MoveNext()) { string current = <>7__wrap1.Current; if (TryBuildResolvedPrefabSignatureKey("item", current, ResolveItemPrefab(current, null), out string key) && seen.Add(key)) { <>2__current = key; <>1__state = 2; return true; } } <>m__Finally2(); <>7__wrap1 = null; if (TryBuildResolvedStatusEffectSignatureKey(definition.GuardianPower, out key2) && seen.Add(key2)) { <>2__current = key2; <>1__state = 3; return true; } break; IL_00a8: while (<>7__wrap1.MoveNext()) { string current2 = <>7__wrap1.Current; if (TryBuildResolvedPrefabSignatureKey("item", current2, ResolveItemPrefab(current2, null), out string key3) && seen.Add(key3)) { <>2__current = key3; <>1__state = 1; return true; } } <>m__Finally1(); <>7__wrap1 = null; supportedItems = definition.UnsupportedItems; <>7__wrap1 = (supportedItems ?? Enumerable.Empty<string>()).GetEnumerator(); <>1__state = -4; goto IL_013c; } return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap1 != null) { <>7__wrap1.Dispose(); } } private void <>m__Finally2() { <>1__state = -1; if (<>7__wrap1 != null) { <>7__wrap1.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<string> IEnumerable<string>.GetEnumerator() { <BuildConfiguredLocationResolutionKeys>d__171 <BuildConfiguredLocationResolutionKeys>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <BuildConfiguredLocationResolutionKeys>d__ = this; } else { <BuildConfiguredLocationResolutionKeys>d__ = new <BuildConfiguredLocationResolutionKeys>d__171(0); } <BuildConfiguredLocationResolutionKeys>d__.definition = <>3__definition; <BuildConfiguredLocationResolutionKeys>d__.seen = <>3__seen; return <BuildConfiguredLocationResolutionKeys>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<string>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <BuildLiveLocationSourceKeys>d__168 : IEnumerable<string>, IEnumerable, IEnumerator<string>, IDisposable, IEnumerator { private int <>1__state; private string <>2__current; private int <>l__initialThreadId; private List<ZoneLocation>.Enumerator <>7__wrap1; string IEnumerator<string>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <BuildLiveLocationSourceKeys>d__168(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <>7__wrap1 = default(List<ZoneLocation>.Enumerator); <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if ((Object)(object)ZoneSystem.instance == (Object)null) { return false; } <>7__wrap1 = ZoneSystem.instance.m_locations.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; break; } while (<>7__wrap1.MoveNext()) { string text = ReferenceRefreshSupport.NormalizeKey(GetZoneLocationPrefabName(<>7__wrap1.Current)); if (text.Length != 0) { <>2__current = text; <>1__state = 1; return true; } } <>m__Finally1(); <>7__wrap1 = default(List<ZoneLocation>.Enumerator); return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>7__wrap1).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<string> IEnumerable<string>.GetEnumerator() { if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; return this; } return new <BuildLiveLocationSourceKeys>d__168(0); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<string>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <EnumerateOverrideConfigurationPaths>d__227 : IEnumerable<string>, IEnumerable, IEnumerator<string>, IDisposable, IEnumerator { private int <>1__state; private string <>2__current; private int <>l__initialThreadId; private IEnumerator<string> <>7__wrap1; string IEnumerator<string>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <EnumerateOverrideConfigurationPaths>d__227(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 3) { try { } finally { <>m__Finally1(); } } <>7__wrap1 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (!Directory.Exists(DropNSpawnPlugin.YamlConfigDirectoryPath)) { return false; } if (File.Exists(PrimaryOverrideConfigurationPathYml)) { <>2__current = PrimaryOverrideConfigurationPathYml; <>1__state = 1; return true; } goto IL_006a; case 1: <>1__state = -1; goto IL_006a; case 2: <>1__state = -1; goto IL_0093; case 3: { <>1__state = -3; break; } IL_006a: if (File.Exists(PrimaryOverrideConfigurationPathYaml)) { <>2__current = PrimaryOverrideConfigurationPathYaml; <>1__state = 2; return true; } goto IL_0093; IL_0093: <>7__wrap1 = EnumerateSupplementalOverrideConfigurationPaths().GetEnumerator(); <>1__state = -3; break; } if (<>7__wrap1.MoveNext()) { string current = <>7__wrap1.Current; <>2__current = current; <>1__state = 3; return true; } <>m__Finally1(); <>7__wrap1 = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap1 != null) { <>7__wrap1.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<string> IEnumerable<string>.GetEnumerator() { if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; return this; } return new <EnumerateOverrideConfigurationPaths>d__227(0); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<string>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <GetRegisteredLocations>d__259 : IEnumerable<Location>, IEnumerable, IEnumerator<Location>, IDisposable, IEnumerator { private int <>1__state; private Location <>2__current; private int <>l__initialThreadId; private HashSet<string> dirtyPrefabs; public HashSet<string> <>3__dirtyPrefabs; private HashSet<Location> <visited>5__2; private HashSet<string>.Enumerator <>7__wrap2; private HashSet<Location>.Enumerator <>7__wrap3; Location IEnumerator<Location>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GetRegisteredLocations>d__259(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if ((uint)(num - -4) <= 1u || num == 1) { try { if (num == -4 || num == 1) { try { } finally { <>m__Finally2(); } } } finally { <>m__Finally1(); } } <visited>5__2 = null; <>7__wrap2 = default(HashSet<string>.Enumerator); <>7__wrap3 = default(HashSet<Location>.Enumerator); <>1__state = -2; } private bool MoveNext() { try { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -4; goto IL_00d1; } <>1__state = -1; CleanupRegisteredLocations(); <visited>5__2 = new HashSet<Location>(); <>7__wrap2 = dirtyPrefabs.GetEnumerator(); <>1__state = -3; goto IL_00f0; IL_00d1: while (<>7__wrap3.MoveNext()) { Location current = <>7__wrap3.Current; if ((Object)(object)current != (Object)null && (Object)(object)((Component)current).gameObject != (Object)null && <visited>5__2.Add(current)) { <>2__current = current; <>1__state = 1; return true; } } <>m__Finally2(); <>7__wrap3 = default(HashSet<Location>.Enumerator); goto IL_00f0; IL_00f0: string current2; HashSet<Location> value; do { if (<>7__wrap2.MoveNext()) { current2 = <>7__wrap2.Current; continue; } <>m__Finally1(); <>7__wrap2 = default(HashSet<string>.Enumerator); return false; } while (!LiveLocationsByPrefab.TryGetValue(current2, out value)); <>7__wrap3 = value.GetEnumerator(); <>1__state = -4; goto IL_00d1; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>7__wrap2).Dispose(); } private void <>m__Finally2() { <>1__state = -3; ((IDisposable)<>7__wrap3).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<Location> IEnumerable<Location>.GetEnumerator() { <GetRegisteredLocations>d__259 <GetRegisteredLocations>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <GetRegisteredLocations>d__ = this; } else { <GetRegisteredLocations>d__ = new <GetRegisteredLocations>d__259(0); } <GetRegisteredLocations>d__.dirtyPrefabs = <>3__dirtyPrefabs; return <GetRegisteredLocations>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<Location>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <GetTrackedLooseItemStands>d__405 : IEnumerable<ItemStand>, IEnumerable, IEnumerator<ItemStand>, IDisposable, IEnumerator { private int <>1__state; private ItemStand <>2__current; private int <>l__initialThreadId; private HashSet<string> dirtyPrefabs; public HashSet<string> <>3__dirtyPrefabs; private List<KeyValuePair<ItemStand, string>>.Enumerator <>7__wrap1; ItemStand IEnumerator<ItemStand>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GetTrackedLooseItemStands>d__405(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <>7__wrap1 = default(List<KeyValuePair<ItemStand, string>>.Enumerator); <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: { <>1__state = -1; CleanupTrackedLooseItemStandPrefabs(); List<KeyValuePair<ItemStand, string>> list = TrackedLooseItemStandPrefabs.ToList(); <>7__wrap1 = list.GetEnumerator(); <>1__state = -3; break; } case 1: <>1__state = -3; break; } while (<>7__wrap1.MoveNext()) { var (val2, item) = (KeyValuePair<ItemStand, string>)(ref <>7__wrap1.Current); if ((Object)(object)val2 != (Object)null && (Object)(object)((Component)val2).gameObject != (Object)null && dirtyPrefabs.Contains(item)) { <>2__current = val2; <>1__state = 1; return true; } } <>m__Finally1(); <>7__wrap1 = default(List<KeyValuePair<ItemStand, string>>.Enumerator); return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>7__wrap1).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<ItemStand> IEnumerable<ItemStand>.GetEnumerator() { <GetTrackedLooseItemStands>d__405 <GetTrackedLooseItemStands>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <GetTrackedLooseItemStands>d__ = this; } else { <GetTrackedLooseItemStands>d__ = new <GetTrackedLooseItemStands>d__405(0); } <GetTrackedLooseItemStands>d__.dirtyPrefabs = <>3__dirtyPrefabs; return <GetTrackedLooseItemStands>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<ItemStand>)this).GetEnumerator(); } } private const string ReferenceAutoUpdateStateKey = "location"; private static readonly ConditionalWeakTable<RuneStone, RunestonePinChanceState> RunestonePinChanceRolls = new ConditionalWeakTable<RuneStone, RunestonePinChanceState>(); private static readonly object RunestonePinChanceLock = new object(); private static readonly Random RunestonePinChanceRandom = new Random(); internal static readonly DomainModuleDefinition<LocationConfigurationEntry> Module = new DomainModuleDefinition<LocationConfigurationEntry>("location", DropNSpawnPlugin.ReloadDomain.Location, "location_yaml", 97, ShouldReloadForPath, ReloadConfiguration, OnGameDataReady, HandleExpandWorldDataReady, 12, DomainTransportProfile.SmallConfig, "location", "location", 20, (LocationConfigurationEntry entry) => entry.RuleId, ApplySyncedPayload, DomainWorkKinds.Runtime | DomainWorkKinds.Reconcile, null, null, HasPendingReconcileWork, ProcessQueuedReconcileStep, MarkSyncedPayloadPending, EnterPendingSyncedPayloadState); private static readonly int OfferingBowlLastUseTicksKey = StringExtensionMethods.GetStableHashCode("DropNSpawn.offering_bowl_last_use_ticks"); private const int LocationProxyAliasForceSendDebounceFrames = 2; private const int LocationProxyAliasForceSendBudgetPerFrame = 8; private const int LocationProxyUnresolvedObservationMaxStableCount = 90; private const int LocationProxyResolvedObservationMaxStableCount = 24; private static readonly object Sync = new object(); private static readonly IDeserializer Deserializer = new DeserializerBuilder().WithNamingConvention(CamelCaseNamingConvention.Instance).Build(); private static readonly ISerializer Serializer = new SerializerBuilder().WithNamingConvention(CamelCaseNamingConvention.Instance).ConfigureDefaultValuesHandling(DefaultValuesHandling.OmitNull | DefaultValuesHandling.OmitDefaults).Build(); private static readonly List<LocationSnapshot> Snapshots = new List<LocationSnapshot>(); private static readonly Dictionary<string, LocationSnapshot> SnapshotsByPrefab = new Dictionary<string, LocationSnapshot>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<string, List<LocationConfigurationEntry>> ActiveEntriesByPrefab = new Dictionary<string, List<LocationConfigurationEntry>>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<int, string> LocationPrefabNamesByHash = new Dictionary<int, string>(); private static readonly Dictionary<LocationProxy, string> RuntimeLocationProxyPrefabsByInstance = new Dictionary<LocationProxy, string>(); private static readonly Dictionary<ZDOID, string> RuntimeLocationProxyPrefabsByZdoId = new Dictionary<ZDOID, string>(); private static readonly ConditionalWeakTable<LocationProxy, LocationProxyObservationState> LocationProxyObservationStates = new ConditionalWeakTable<LocationProxy, LocationProxyObservationState>(); private static readonly ConditionalWeakTable<Location, LocationAliasRefreshRequestState> LocationAliasRefreshRequestStates = new ConditionalWeakTable<Location, LocationAliasRefreshRequestState>(); private const string LocationProxyResolvedPrefabZdoKey = "DropNSpawn Location Prefab"; private static readonly HashSet<string> InvalidEntryWarnings = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private static readonly HashSet<string> DuplicateComponentWarnings = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private static readonly HashSet<string> OfferingBowlDiagnosticLogs = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private static readonly HashSet<string> ItemStandDiagnosticLogs = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private static readonly HashSet<string> LocationDiagnosticLogs = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private static readonly HashSet<string> RedundantLocationConditionWarnings = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private static readonly HashSet<string> VegvisirWarningLogs = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private static readonly HashSet<string> RunestoneWarningLogs = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<ItemStand, ItemStandSnapshot> LooseItemStandSnapshots = new Dictionary<ItemStand, ItemStandSnapshot>(); private static readonly Dictionary<Location, LiveLocationSnapshot> LiveLocationSnapshots = new Dictionary<Location, LiveLocationSnapshot>(); private static readonly Dictionary<string, LocationComponentCatalog> CatalogsByPrefab = new Dictionary<string, LocationComponentCatalog>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<string, HashSet<Location>> LiveLocationsByPrefab = new Dictionary<string, HashSet<Location>>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<Location, string> LiveLocationPrefabsByInstance = new Dictionary<Location, string>(); private static readonly HashSet<LocationProxy> TrackedLocationProxies = new HashSet<LocationProxy>(); private static readonly ConditionalWeakTable<OfferingBowl, LooseOfferingBowlOverrideState> LooseOfferingBowlOverrideStates = new ConditionalWeakTable<OfferingBowl, LooseOfferingBowlOverrideState>(); private static readonly Dictionary<string, List<AuthoredItemStandSlotTemplate>> AuthoredItemStandSlotsByPrefab = new Dictionary<string, List<AuthoredItemStandSlotTemplate>>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<string, List<LocationConfigurationEntry>> LooseItemStandEntriesByPrefab = new Dictionary<string, List<LocationConfigurationEntry>>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<ItemStand, string> TrackedLooseItemStandPrefabs = new Dictionary<ItemStand, string>(); private static readonly Dictionary<ItemStand, string> LooseItemStandAuthoredPathsByInstance = new Dictionary<ItemStand, string>(); private static readonly RingBufferQueue<PendingLocationReconcile> PendingLocationReconciles = new RingBufferQueue<PendingLocationReconcile>(); private static readonly HashSet<int> PendingLocationReconcileIds = new HashSet<int>(); private static readonly Dictionary<int, int> SuppressedQueuedLocationReconciles = new Dictionary<int, int>(); private static readonly RingBufferQueue<PendingLocationRootReconcile> PendingLocationRootReconciles = new RingBufferQueue<PendingLocationRootReconcile>(); private static readonly HashSet<int> PendingLocationRootReconcileIds = new HashSet<int>(); private static readonly RingBufferQueue<PendingLooseOfferingBowlOverride> PendingLooseOfferingBowlOverrides = new RingBufferQueue<PendingLooseOfferingBowlOverride>(); private static readonly HashSet<int> PendingLooseOfferingBowlOverrideIds = new HashSet<int>(); private static readonly ScheduledFrameQueue<ZDOID> PendingLocationProxyAliasZdoFlushIds = new ScheduledFrameQueue<ZDOID>(); private static readonly Dictionary<ZDOID, PendingLocationProxyAliasZdoFlush> PendingLocationProxyAliasZdoFlushes = new Dictionary<ZDOID, PendingLocationProxyAliasZdoFlush>(); private static readonly Dictionary<ZDOID, int> PendingLocationProxyAliasZdoFlushEnqueuedDueFrames = new Dictionary<ZDOID, int>(); private static readonly ScheduledFrameQueue<PendingLocationProxyObservation> PendingLocationProxyObservations = new ScheduledFrameQueue<PendingLocationProxyObservation>(); private static readonly HashSet<int> PendingLocationProxyObservationIds = new HashSet<int>(); private static readonly List<string> PendingLocationProxyCreationPrefabs = new List<string>(); private static readonly HashSet<string> PendingRuntimeLocationProxyAliasDemands = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private const int LocationAliasRefreshInteractionCooldownFrames = 30; private static List<LocationConfigurationEntry> _configuration = new List<LocationConfigurationEntry>(); private static string _configurationSignature = ""; private static bool _initialized; private static bool _snapshotsCaptured; private static int? _lastProcessedGameDataSignature; private static bool _referenceArtifactsAutoRefreshConsumed; private static readonly Dictionary<string, string> _lastAppliedEntrySignaturesByPrefab = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); private static string _lastAppliedConfigurationSignature = ""; private static int? _lastAppliedGameDataSignature; private static bool? _lastAppliedDomainEnabled; private static bool _lastAppliedSynchronizedPayloadReady; private static bool _synchronizedPayloadReady; private static int? _lastCommittedAuthorityEpoch; private static int _reconcileQueueEpoch; private static bool _needsRuntimeLocationProxyObservation; private static int _locationProxyObservationDemandEpoch; private static int _runtimeLocationAliasEpoch; private static int _locationProxyAliasFlushBudgetFrame = int.MinValue; private static int _locationProxyAliasFlushesSentThisFrame; private static readonly DomainConfigurationRuntime<LocationConfigurationEntry, SyncedLocationConfigurationState> ConfigurationRuntime = new DomainConfigurationRuntime<LocationConfigurationEntry, SyncedLocationConfigurationState>(new DomainLoadHooks<LocationConfigurationEntry, SyncedLocationConfigurationState>(ParseLocalConfigurationDocuments, BuildSyncedConfigurationState, CommitSyncedConfigurationState, RejectLocalConfigurationPayload, (SyncedLocationConfigurationState state) => state.ActiveEntriesByPrefab.Count, null, LogLocalConfigurationLoaded, OnSourceOfTruthPayloadUnchanged, delegate { ConfigurationDomainHost.PublishSyncedPayload(DropNSpawnPlugin.IsSourceOfTruth, Descriptor, _configuration, _configurationSignature); }), new DomainSyncHooks<LocationConfigurationEntry, SyncedLocationConfigurationState>(delegate(out List<LocationConfigurationEntry> configuration, out string payloadToken) { return ConfigurationDomainHost.TryGetSyncedEntries(Descriptor, out configuration, out payloadToken); }, (string payloadToken) => ConfigurationDomainHost.ShouldSkipSyncedPayload(LoadState, payloadToken, Volatile.Read(ref _synchronizedPayloadReady)), BuildSyncedConfigurationState, CommitSyncedConfigurationState, (SyncedLocationConfigurationState state) => state.ActiveEntriesByPrefab.Count, "ServerSync:DropNSpawnLocation", delegate { ConfigurationDomainHost.HandleWaitingForSyncedPayload(MarkSyncedPayloadPending, "Waiting for synchronized location override payload from the server."); }, LogSyncedLocationConfigurationLoaded, LogSyncedLocationConfigurationFailure)); private static readonly Dictionary<string, string> EmptyEntrySignatures = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); private static LocationRuntimeConfigurationState _runtimeConfigurationState = LocationRuntimeConfigurationState.Empty; private static int? _runtimeConfigurationGameDataSignature; private static string _runtimeConfigurationSignature = ""; private static int _invalidEntryWarningSuppressionDepth; private static readonly ConditionalWeakTable<RuneStone, RunestoneGlobalPinsRollState> RunestoneGlobalPinsRolls = new ConditionalWeakTable<RuneStone, RunestoneGlobalPinsRollState>(); private static readonly object RunestoneGlobalPinsLock = new object(); private static readonly Random RunestoneGlobalPinsRandom = new Random(); private static readonly Dictionary<string, string> RunestoneGlobalPinDiscoverLabels = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); private static readonly HashSet<string> RunestoneGlobalPinWarningLogs = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private static RunestoneGlobalPinLocationIndex? RunestoneGlobalPinLocationIndexCache; private static readonly FieldInfo? MinimapPinsField = AccessTools.Field(typeof(Minimap), "m_pins"); internal static DomainDescriptor<LocationConfigurationEntry> Descriptor => Module.DescriptorTyped; internal static DomainTransportMetadata<LocationConfigurationEntry> TransportMetadata => Module.TransportMetadataTyped; private static string ReferenceConfigurationPath => Path.Combine(DropNSpawnPlugin.YamlConfigDirectoryPath, PluginSettingsFacade.GetYamlDomainFilePrefix("location") + ".reference.yml"); private static string PrimaryOverrideConfigurationPathYml => Path.Combine(DropNSpawnPlugin.YamlConfigDirectoryPath, PluginSettingsFacade.GetYamlDomainFilePrefix("location") + ".yml"); private static string PrimaryOverrideConfigurationPathYaml => Path.Combine(DropNSpawnPlugin.YamlConfigDirectoryPath, PluginSettingsFacade.GetYamlDomainFilePrefix("location") + ".yaml"); private static string FullScaffoldConfigurationPath => Path.Combine(DropNSpawnPlugin.YamlConfigDirectoryPath, PluginSettingsFacade.GetYamlDomainFilePrefix("location") + ".full.yml"); private static DomainLoadState LoadState => ConfigurationRuntime.LoadState; internal static bool ShouldReloadForPath(string? path) { if (PluginSettingsFacade.IsEligibleOverrideConfigurationPath(path)) { return IsOverrideConfigurationFileName(Path.GetFileName(path ?? "")); } return false; } internal static void Initialize() { lock (Sync) { if (!_initialized) { LoadConfiguration(); _initialized = true; } } } internal static void ReloadConfiguration() { lock (Sync) { LoadConfiguration(); ApplyIfReady(queueLiveReconcile: true); } } internal static void MarkSyncedPayloadPending() { lock (Sync) { ConfigurationRuntime.MarkSyncedPayloadPending(DropNSpawnPlugin.IsSourceOfTruth, delegate { Volatile.Write(ref _synchronizedPayloadReady, value: false); }); } } internal static void EnterPendingSyncedPayloadState() { lock (Sync) { HashSet<string> previouslyAppliedPrefabs = BuildLastAppliedPrefabs(); ConfigurationRuntime.EnterPendingSyncedPayloadState(DropNSpawnPlugin.IsSourceOfTruth, ResetLoadedConfigurationState, delegate { _configurationSignature = ""; _lastAppliedSynchronizedPayloadReady = false; RestoreTrackedLocations(previouslyAppliedPrefabs); }); } } private static bool CanUseCurrentRuntimeState() { if (!DropNSpawnPlugin.IsSourceOfTruth && !Volatile.Read(ref _synchronizedPayloadReady)) { return _lastCommittedAuthorityEpoch == NetworkPayloadSyncSupport.CurrentAuthorityEpoch; } return true; } private static HashSet<string> BuildLastAppliedPrefabs() { HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase); if (!_lastAppliedDomainEnabled.GetValueOrDefault()) { return hashSet; } foreach (string key in _lastAppliedEntrySignaturesByPrefab.Keys) { hashSet.Add(key); } return hashSet; } private static void RestoreTrackedLocations(HashSet<string> prefabs) { if (prefabs.Count != 0 && IsGameDataReady()) { ReapplyActiveEntriesToRegisteredLocations(prefabs); } } internal static bool HandleExpandWorldDataReady() { lock (Sync) { if (!DropNSpawnPlugin.IsSourceOfTruth) { return false; } string text = NetworkPayloadSyncSupport.ComputeLocationConfigurationSignature(_configuration); if (string.Equals(text, _configurationSignature, StringComparison.Ordinal)) { return false; } _configurationSignature = text; ConfigurationDomainHost.PublishSyncedPayload(DropNSpawnPlugin.IsSourceOfTruth, Descriptor, _configuration, _configurationSignature); ApplyIfReady(queueLiveReconcile: true); return true; } } internal static void ApplySyncedPayload() { lock (Sync) { ConfigurationRuntime.ApplySyncedPayload(delegate { ApplyIfReady(queueLiveReconcile: true); }); } } internal static void OnGameDataReady(string source) { lock (Sync) { if (!_initialized) { Initialize(); } if (!IsGameDataReady()) { return; } int num = ComputeGameDataSignature(); if (_lastProcessedGameDataSignature == num) { return; } ResetReferenceSnapshots(); ResetRuntimeState(preserveLiveRegistries: true); CleanupRegisteredLocations(); if (DropNSpawnPlugin.IsSourceOfTruth) { if (!_referenceArtifactsAutoRefreshConsumed) { EnsureReferenceArtifactsUpToDate(); _referenceArtifactsAutoRefreshConsumed = true; } if (EnsurePrimaryOverrideConfigurationFileExists()) { LoadConfiguration(); } } else { _referenceArtifactsAutoRefreshConsumed = true; } ApplyIfReady(queueLiveReconcile: true); _lastProcessedGameDataSignature = num; DropNSpawnPlugin.DropNSpawnLogger.LogInfo((object)("Locations processed after " + source + ".")); } } internal static void ReconcileLocationInstance(Location location) { lock (Sync) { TrackLocationInstanceInternal(location); if (!_initialized) { Initialize(); } if (IsGameDataReady()) { ReconcileLocationInstanceInternal(location); } } } private static bool HasCurrentLocationReconcileWorkForPrefab(string prefabName) { if (prefabName.Length > 0) { if (!ActiveEntriesByPrefab.ContainsKey(prefabName)) { return LooseItemStandEntriesByPrefab.ContainsKey(prefabName); } return true; } return false; } private static bool ShouldQueueLocationReconcileLocked(Location? location) { if ((Object)(object)location == (Object)null || (Object)(object)((Component)location).gameObject == (Object)null) { return false; } if (LiveLocationSnapshots.ContainsKey(location)) { return true; } if (LiveLocationPrefabsByInstance.TryGetValue(location, out string value) && HasCurrentLocationReconcileWorkForPrefab(value ?? "")) { return true; } if (TryGetLocationPrefabName(location, out string prefabName)) { return HasCurrentLocationReconcileWorkForPrefab(prefabName); } return false; } internal static void QueueLocationReconcile(Location? location) { lock (Sync) { if (ShouldQueueLocationReconcileLocked(location)) { int instanceID = ((Object)location).GetInstanceID(); if (PendingLocationReconcileIds.Add(instanceID)) { PendingLocationReconciles.Enqueue(new PendingLocationReconcile(location, instanceID, _reconcileQueueEpoch)); } } } } internal static void RecordLocationProxyResolvedPrefab(LocationProxy? proxy, string? prefabName) { if ((Object)(object)proxy == (Object)null) { return; } string text = (prefabName ?? "").Trim(); if (text.Length != 0) { LocationProxyObservationState orCreateValue = LocationProxyObservationStates.GetOrCreateValue(proxy); LocationProxyObservationState locationProxyObservationState = orCreateValue; if (locationProxyObservationState.NView == null) { ZNetView val = (locationProxyObservationState.NView = ((Component)proxy).GetComponent<ZNetView>()); } lock (Sync) { TrackLocationProxyInternal(proxy); CacheLocationProxyResolvedPrefabInternal(proxy, text, (Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsServer(), queueLocationReconciles: true); } ZNetView? nView = orCreateValue.NView; ZDO val2 = ((nView != null) ? nView.GetZDO() : null); orCreateValue.LastObservedAlias = text; orCreateValue.LastObservedDataRevision = ((val2 != null) ? val2.DataRevision : uint.MaxValue); orCreateValue.StablePollCount = 0; orCreateValue.LastObservedDemandEpoch = _locationProxyObservationDemandEpoch; } } internal static void QueueLocationProxyObservation(LocationProxy? proxy) { lock (Sync) { QueueLocationProxyObservationInternal(proxy, Time.frameCount); } } internal static bool HasRuntimeLocationAliasDemand() { lock (Sync) { return _needsRuntimeLocationProxyObservation; } } internal static void UntrackLocationProxy(LocationProxy? proxy) { //IL_007a: 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_008e: 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_009d: 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_00af: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)proxy == (Object)null) { return; } LocationProxyObservationStates.Remove(proxy); lock (Sync) { TrackedLocationProxies.Remove(proxy); PendingLocationProxyObservationIds.Remove(((Object)proxy).GetInstanceID()); RuntimeLocationProxyPrefabsByInstance.Remove(proxy); ZNetView component = ((Component)proxy).GetComponent<ZNetView>(); ZDOID val = (ZDOID)(((??)((component == null) ? null : component.GetZDO()?.m_uid)) ?? ZDOID.None); if (val != ZDOID.None) { RuntimeLocationProxyPrefabsByZdoId.Remove(val); } RefreshLocationProxyObservationDemandLocked(); } } internal static void BeginLocationProxyCreationContext(string? prefabName) { string text = (prefabName ?? "").Trim(); if (text.Length == 0) { return; } lock (Sync) { PendingLocationProxyCreationPrefabs.Add(text); } } private static int GetLocationProxyObservationDelayFrames(bool hasObservedAlias, int stablePollCount) { if (!hasObservedAlias) { if (stablePollCount >= 60) { if (stablePollCount < 180) { return 10; } return 60; } return 1; } if (stablePollCount >= 30) { if (stablePollCount < 120) { return 30; } return 180; } return 5; } private static bool ShouldContinueLocationProxyObservation(bool hasObservedAlias, int stablePollCount) { return stablePollCount < (hasObservedAlias ? 24 : 90); } internal static void EndLocationProxyCreationContext() { lock (Sync) { int count = PendingLocationProxyCreationPrefabs.Count; if (count > 0) { PendingLocationProxyCreationPrefabs.RemoveAt(count - 1); } } } internal static bool TryGetPendingLocationProxyCreationPrefabName(out string prefabName) { lock (Sync) { int count = PendingLocationProxyCreationPrefabs.Count; if (count > 0) { prefabName = PendingLocationProxyCreationPrefabs[count - 1]; return prefabName.Length > 0; } } prefabName = ""; return false; } private static void CacheLocationProxyResolvedPrefabInternal(LocationProxy proxy, string prefabName, bool persistToZdo, bool queueLocationReconciles) { //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_005f: 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_0071: 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) if ((Object)(object)proxy == (Object)null || prefabName.Length == 0) { return; } TrackLocationProxyInternal(proxy); string value; bool flag = !RuntimeLocationProxyPrefabsByInstance.TryGetValue(proxy, out value) || !string.Equals(value, prefabName, StringComparison.OrdinalIgnoreCase); RuntimeLocationProxyPrefabsByInstance[proxy] = prefabName; ZNetView component = ((Component)proxy).GetComponent<ZNetView>(); ZDO val = ((component != null) ? component.GetZDO() : null); if (val != null) { ZDOID uid = val.m_uid; if (uid != ZDOID.None && (!RuntimeLocationProxyPrefabsByZdoId.TryGetValue(uid, out string value2) || !string.Equals(value2, prefabName, StringComparison.OrdinalIgnoreCase))) { RuntimeLocationProxyPrefabsByZdoId[uid] = prefabName; flag = true; } if (persistToZdo && !string.Equals(val.GetString("DropNSpawn Location Prefab", ""), prefabName, StringComparison.Ordinal)) { val.Set("DropNSpawn Location Prefab", prefabName); QueueLocationProxyAliasZdoFlushLocked(val); flag = true; } } if (flag && queueLocationReconciles) { QueueLocationReconcilesUnderProxyInternal(proxy); } if (flag) { _runtimeLocationAliasEpoch++; RefreshLocationProxyObservationDemandLocked(); } } private static void QueueLocationProxyAliasZdoFlushLocked(ZDO zdo) { //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_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_0048: 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_0072: 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) if (zdo == null) { return; } ZDOID uid = zdo.m_uid; if (!(uid == ZDOID.None)) { PendingLocationProxyAliasZdoFlush pendingLocationProxyAliasZdoFlush = new PendingLocationProxyAliasZdoFlush { Epoch = _reconcileQueueEpoch, DueFrame = Time.frameCount + 2, DataRevision = zdo.DataRevision }; PendingLocationProxyAliasZdoFlushes[uid] = pendingLocationProxyAliasZdoFlush; if (!PendingLocationProxyAliasZdoFlushEnqueuedDueFrames.TryGetValue(uid, out var value) || value != pendingLocationProxyAliasZdoFlush.DueFrame) { PendingLocationProxyAliasZdoFlushIds.Enqueue(pendingLocationProxyAliasZdoFlush.DueFrame, uid); PendingLocationProxyAliasZdoFlushEnqueuedDueFrames[uid] = pendingLocationProxyAliasZdoFlush.DueFrame; } } } private static bool TryProcessPendingLocationProxyAliasZdoFlushLocked(float deadline) { //IL_008a: 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_00b6: 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_00e5: 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_014c: 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_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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_0138: Unknown result type (might be due to invalid IL or missing references) if (PendingLocationProxyAliasZdoFlushes.Count == 0 || (Object)(object)ZNet.instance == (Object)null || !ZNet.instance.IsServer() || ZDOMan.instance == null) { return false; } int frameCount = Time.frameCount; if (_locationProxyAliasFlushBudgetFrame != frameCount) { _locationProxyAliasFlushBudgetFrame = frameCount; _locationProxyAliasFlushesSentThisFrame = 0; } if (_locationProxyAliasFlushesSentThisFrame >= 8) { return false; } if (!PendingLocationProxyAliasZdoFlushIds.TryPeekDueFrame(out var dueFrame) || dueFrame > frameCount) { return false; } while (PendingLocationProxyAliasZdoFlushIds.TryPeekDueFrame(out dueFrame) && dueFrame <= frameCount) { if (Time.realtimeSinceStartup >= deadline) { return false; } if (!PendingLocationProxyAliasZdoFlushIds.TryDequeue(out var dueFrame2, out var item)) { return false; } if (!PendingLocationProxyAliasZdoFlushes.TryGetValue(item, out PendingLocationProxyAliasZdoFlush value)) { continue; } if (value.Epoch != _reconcileQueueEpoch) { PendingLocationProxyAliasZdoFlushes.Remove(item); PendingLocationProxyAliasZdoFlushEnqueuedDueFrames.Remove(item); } else { if (value.DueFrame != dueFrame2) { continue; } ZDO zDO = ZDOMan.instance.GetZDO(item); if (zDO == null) { PendingLocationProxyAliasZdoFlushes.Remove(item); PendingLocationProxyAliasZdoFlushEnqueuedDueFrames.Remove(item); continue; } if (zDO.DataRevision >= value.DataRevision) { PendingLocationProxyAliasZdoFlushes.Remove(item); PendingLocationProxyAliasZdoFlushEnqueuedDueFrames.Remove(item); _locationProxyAliasFlushesSentThisFrame++; ZDOMan.instance.ForceSendZDO(item); return true; } value.DueFrame = frameCount + 1; PendingLocationProxyAliasZdoFlushes[item] = value; PendingLocationProxyAliasZdoFlushIds.Enqueue(value.DueFrame, item); PendingLocationProxyAliasZdoFlushEnqueuedDueFrames[item] = value.DueFrame; } } return false; } private static void TrackLocationProxyInternal(LocationProxy? proxy) { if (!((Object)(object)proxy == (Object)null) && !((Object)(object)((Component)proxy).gameObject == (Object)null)) { TrackedLocationProxies.Add(proxy); LocationProxyObservationState orCreateValue = LocationProxyObservationStates.GetOrCreateValue(proxy); if (orCreateValue.NView == null) { ZNetView val = (orCreateValue.NView = ((Component)proxy).GetComponent<ZNetView>()); } } } private static void CleanupTrackedLocationProxiesLocked() { List<LocationProxy> list = new List<LocationProxy>(); foreach (LocationProxy trackedLocationProxy in TrackedLocationProxies) { if ((Object)(object)trackedLocationProxy == (Object)null || (Object)(object)((Component)trackedLocationProxy).gameObject == (Object)null) { list.Add(trackedLocationProxy); } } foreach (LocationProxy item in list) { if ((Object)(object)item != (Object)null) { TrackedLocationProxies.Remove(item); } } } private static bool ShouldObserveLocationProxyResolvedPrefabLocked(LocationProxy proxy, LocationProxyObservationState observationState) { if (!_needsRuntimeLocationProxyObservation || (Object)(object)proxy == (Object)null || (Object)(object)((Component)proxy).gameObject == (Object)null) { return false; } if (observationState.LastObservedDemandEpoch != _locationProxyObservationDemandEpoch) { observationState.LastObservedDemandEpoch = _locationProxyObservationDemandEpoch; observationState.StablePollCount = 0; } if (observationState.LastObservedAlias.Length != 0) { return PendingRuntimeLocationProxyAliasDemands.Contains(observationState.LastObservedAlias); } return true; } private static void QueueTrackedLocationProxyObservationsLocked(int dueFrame) { CleanupTrackedLocationProxiesLocked(); foreach (LocationProxy item in TrackedLocationProxies.ToList()) { QueueLocationProxyObservationInternal(item, dueFrame); } } private static void QueueLocationProxyObservationInternal(LocationProxy? proxy, int dueFrame) { if ((Object)(object)proxy == (Object)null || (Object)(object)((Component)proxy).gameObject == (Object)null) { return; } TrackLocationProxyInternal(proxy); LocationProxyObservationState orCreateValue = LocationProxyObservationStates.GetOrCreateValue(proxy); if (ShouldObserveLocationProxyResolvedPrefabLocked(proxy, orCreateValue)) { int instanceID = ((Object)proxy).GetInstanceID(); if (PendingLocationProxyObservationIds.Add(instanceID)) { PendingLocationProxyObservations.Enqueue(dueFrame, new PendingLocationProxyObservation(proxy, instanceID, _reconcileQueueEpoch, dueFrame)); } } } private static void QueueNextLocationProxyObservationLocked(LocationProxy proxy, LocationProxyObservationState observationState, bool hasObservedAlias) { observationState.StablePollCount++; if (ShouldContinueLocationProxyObservation(hasObservedAlias, observationState.StablePollCount)) { QueueLocationProxyObservationInternal(proxy, Time.frameCount + GetLocationProxyObservationDelayFrames(hasObservedAlias, observationState.StablePollCount)); } } private static bool TryProcessPendingLocationProxyObservationLocked(float deadline) { int frameCount = Time.frameCount; if (!PendingLocationProxyObservations.TryPeekDueFrame(out var dueFrame) || dueFrame > frameCount) { return false; } while (PendingLocationProxyObserva