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.4
DropNSpawn.dll
Decompiled 2 weeks 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.4")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.4.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 LocationVegvisirGlobalEffectsDefinition? VegvisirGlobalEffects { get; set; } [YamlMember(Order = 7)] 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; } } 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 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 LocationVegvisirGlobalEffectsDefinition : IYamlConvertible { [YamlMember(Order = 1)] public List<LocationVegvisirGlobalEffectsBiomeDefinition>? Biomes { get; set; } [YamlMember(Order = 2)] public LocationVegvisirGlobalEffectsLocalizationDefinition? Localize { get; set; } void IYamlConvertible.Read(IParser parser, Type expectedType, ObjectDeserializer nestedObjectDeserializer) { List<LocationVegvisirGlobalEffectsBiomeDefinition> list = new List<LocationVegvisirGlobalEffectsBiomeDefinition>(); LocationVegvisirGlobalEffectsLocalizationDefinition localize = null; parser.Consume<SequenceStart>(); SequenceEnd @event; while (!parser.Accept<SequenceEnd>(out @event)) { parser.Consume<MappingStart>(); MappingEnd event2; while (!parser.Accept<MappingEnd>(out event2)) { string text = (parser.Consume<YamlDotNet.Core.Events.Scalar>().Value ?? "").Trim(); if (string.Equals(text, "Localize", StringComparison.OrdinalIgnoreCase)) { localize = (LocationVegvisirGlobalEffectsLocalizationDefinition)nestedObjectDeserializer(typeof(LocationVegvisirGlobalEffectsLocalizationDefinition)); continue; } List<LocationVegvisirGlobalEffectDefinition> statusEffects = (List<LocationVegvisirGlobalEffectDefinition>)nestedObjectDeserializer(typeof(List<LocationVegvisirGlobalEffectDefinition>)); list.Add(new LocationVegvisirGlobalEffectsBiomeDefinition { Biome = ParseVegvisirGlobalEffectsBiomeKey(text), StatusEffects = statusEffects }); } parser.Consume<MappingEnd>(); } parser.Consume<SequenceEnd>(); Biomes = list; Localize = localize; } void IYamlConvertible.Write(IEmitter emitter, ObjectSerializer nestedObjectSerializer) { emitter.Emit(new SequenceStart(null, null, isImplicit: false, SequenceStyle.Block)); IEnumerable<LocationVegvisirGlobalEffectsBiomeDefinition> biomes = Biomes; foreach (LocationVegvisirGlobalEffectsBiomeDefinition item in biomes ?? Enumerable.Empty<LocationVegvisirGlobalEffectsBiomeDefinition>()) { emitter.Emit(new MappingStart(null, null, isImplicit: false, MappingStyle.Block)); emitter.Emit(new YamlDotNet.Core.Events.Scalar(FormatVegvisirGlobalEffectsBiomeKey(item.Biome))); nestedObjectSerializer(item.StatusEffects ?? new List<LocationVegvisirGlobalEffectDefinition>()); emitter.Emit(new MappingEnd()); } if (Localize != null) { emitter.Emit(new MappingStart(null, null, isImplicit: false, MappingStyle.Block)); emitter.Emit(new YamlDotNet.Core.Events.Scalar("Localize")); nestedObjectSerializer(Localize); emitter.Emit(new MappingEnd()); } emitter.Emit(new SequenceEnd()); } private static string? ParseVegvisirGlobalEffectsBiomeKey(string rawKey) { string text = rawKey.Trim(); if (text.Length == 0) { throw new YamlException("vegvisirGlobalEffects biome key cannot be empty. Use All to match every biome."); } if (text.StartsWith("[", StringComparison.Ordinal) || text.EndsWith("]", StringComparison.Ordinal)) { throw new YamlException("vegvisirGlobalEffects biome key '" + text + "' is invalid. Use one biome name per row, or All to match every biome."); } if (text.Contains(',')) { throw new YamlException("vegvisirGlobalEffects biome key '" + text + "' is invalid. Use one biome name per row instead of comma-separated biome names."); } if (text == "*") { throw new YamlException("vegvisirGlobalEffects uses '*' as a biome wildcard. Use All instead."); } if (!string.Equals(text, "all", StringComparison.OrdinalIgnoreCase)) { return text; } return null; } private static string FormatVegvisirGlobalEffectsBiomeKey(string? biome) { string text = (biome ?? "").Trim(); if (text.Length == 0) { return "All"; } return text; } } internal sealed class LocationVegvisirGlobalEffectsLocalizationDefinition : IYamlConvertible { [YamlIgnore] public string? YouHaveReceived { get; set; } [YamlIgnore] public string? YouGotBamboozled { get; set; } [YamlIgnore] public string? BuffCooldownNs { get; set; } [YamlIgnore] public string? AlreadyActive { get; set; } void IYamlConvertible.Read(IParser parser, Type expectedType, ObjectDeserializer nestedObjectDeserializer) { parser.Consume<SequenceStart>(); SequenceEnd @event; while (!parser.Accept<SequenceEnd>(out @event)) { parser.Consume<MappingStart>(); MappingEnd event2; while (!parser.Accept<MappingEnd>(out event2)) { string key = (parser.Consume<YamlDotNet.Core.Events.Scalar>().Value ?? "").Trim(); string value = parser.Consume<YamlDotNet.Core.Events.Scalar>().Value; SetMessage(key, value); } parser.Consume<MappingEnd>(); } parser.Consume<SequenceEnd>(); } void IYamlConvertible.Write(IEmitter emitter, ObjectSerializer nestedObjectSerializer) { emitter.Emit(new SequenceStart(null, null, isImplicit: false, SequenceStyle.Block)); EmitMessage(emitter, "You have received {name}", YouHaveReceived); EmitMessage(emitter, "You got bamboozled", YouGotBamboozled); EmitMessage(emitter, "Buff Cooldown {seconds}s", BuffCooldownNs); EmitMessage(emitter, "Already active {name}", AlreadyActive); emitter.Emit(new SequenceEnd()); } private void SetMessage(string key, string? value) { if (string.Equals(key, "You have received {name}", StringComparison.OrdinalIgnoreCase)) { YouHaveReceived = NormalizeMessage(value); return; } if (string.Equals(key, "You got bamboozled", StringComparison.OrdinalIgnoreCase)) { YouGotBamboozled = NormalizeMessage(value); return; } if (string.Equals(key, "Buff Cooldown {seconds}s", StringComparison.OrdinalIgnoreCase)) { BuffCooldownNs = NormalizeMessage(value); return; } if (string.Equals(key, "Already active {name}", StringComparison.OrdinalIgnoreCase)) { AlreadyActive = NormalizeMessage(value); return; } throw new YamlException("vegvisirGlobalEffects Localize key '" + key + "' is invalid. Supported keys: You have received {name}, You got bamboozled, Buff Cooldown {seconds}s, Already active {name}."); } private static string? NormalizeMessage(string? value) { string text = (value ?? "").Trim(); if (text.Length != 0) { return text; } return null; } private static void EmitMessage(IEmitter emitter, string key, string? value) { emitter.Emit(new MappingStart(null, null, isImplicit: false, MappingStyle.Block)); emitter.Emit(new YamlDotNet.Core.Events.Scalar(key)); emitter.Emit(new YamlDotNet.Core.Events.Scalar(value ?? "")); emitter.Emit(new MappingEnd()); } } internal sealed class LocationVegvisirGlobalEffectsBiomeDefinition { [YamlMember(Order = 1)] public string? Biome { get; set; } [YamlMember(Order = 2)] public List<LocationVegvisirGlobalEffectDefinition>? StatusEffects { get; set; } } internal sealed class LocationVegvisirGlobalEffectDefinition : IYamlConvertible { [YamlIgnore] public string StatusEffect { get; set; } = ""; [YamlIgnore] public float? Weight { get; set; } [YamlIgnore] public float? CooldownSeconds { get; set; } [YamlIgnore] public float? DurationSeconds { get; set; } [YamlIgnore] public string? EffectPrefab { get; set; } void IYamlConvertible.Read(IParser parser, Type expectedType, ObjectDeserializer nestedObjectDeserializer) { if (!parser.TryConsume<YamlDotNet.Core.Events.Scalar>(out var @event)) { throw new YamlException("vegvisirGlobalEffects status effect rows must use scalar shorthand: StatusEffect, durationSeconds, cooldownSeconds, weight, effectPrefab."); } ReadShorthand(@event.Value); } void IYamlConvertible.Write(IEmitter emitter, ObjectSerializer nestedObjectSerializer) { emitter.Emit(new YamlDotNet.Core.Events.Scalar(FormatShorthand())); } private void ReadShorthand(string? rawValue) { string[] array = (rawValue ?? "").Split(','); if (array.Length > 5) { throw new YamlException("vegvisirGlobalEffects status effect rows support at most five comma-separated values: StatusEffect, durationSeconds, cooldownSeconds, weight, effectPrefab."); } StatusEffect = ((array.Length != 0) ? array[0].Trim() : ""); DurationSeconds = ((array.Length > 1) ? ParseOptionalFloat(array[1], "durationSeconds") : null); CooldownSeconds = ((array.Length > 2) ? ParseOptionalFloat(array[2], "cooldownSeconds") : null); Weight = ((array.Length > 3) ? ParseOptionalFloat(array[3], "weight") : null); EffectPrefab = ((array.Length > 4) ? ParseOptionalString(array[4]) : null); } private string FormatShorthand() { List<string> list = new List<string> { StatusEffect ?? "" }; int num = ((!string.IsNullOrWhiteSpace(EffectPrefab)) ? 4 : (Weight.HasValue ? 3 : (CooldownSeconds.HasValue ? 2 : (DurationSeconds.HasValue ? 1 : 0)))); if (num >= 1) { list.Add(FormatOptionalFloat(DurationSeconds)); } if (num >= 2) { list.Add(FormatOptionalFloat(CooldownSeconds)); } if (num >= 3) { list.Add(FormatOptionalFloat(Weight)); } if (num >= 4) { list.Add(EffectPrefab ?? ""); } return string.Join(", ", list); } private static float? ParseOptionalFloat(string? rawValue, string fieldName) { string text = (rawValue ?? "").Trim(); if (text.Length == 0) { return null; } if (!float.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { throw new YamlException("vegvisirGlobalEffects value '" + text + "' is not a valid " + fieldName + " number."); } return result; } private static string FormatOptionalFloat(float? value) { if (!value.HasValue) { return ""; } return value.Value.ToString("R", CultureInfo.InvariantCulture); } private static string? ParseOptionalString(string? rawValue) { string text = (rawValue ?? "").Trim(); if (text.Length != 0) { return text; } return null; } } 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 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 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>(); } private sealed class LiveLocationSnapshot { public string Prefab { get; set; } = ""; public PathScopedOfferingBowlSnapshot? OfferingBowl { get; set; } public List<PathScopedItemStandSnapshot> ItemStands { get; set; } = new List<PathScopedItemStandSnapshot>(); } 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>(); } 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<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 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 : StandardBaselineDesiredStateOperations<LocationDesiredState> { public static LocationApplyOperations Instance { get; } = new LocationApplyOperations(); public override string DomainKey => "location"; public override BaselineDesiredStateCapabilities Capabilities => BaselineDesiredStateCapabilities.Validation | BaselineDesiredStateCapabilities.LiveApply; public override void Validate(LocationDesiredState desiredState) { ValidateLocationDesiredState(desiredState); } public override void ApplyDesiredStateToLive(LocationDesiredState desiredState) { ApplyLocationDesiredStateToLive(desiredState); } public override void Commit(LocationDesiredState desiredState) { RecordAppliedState(desiredState.GameDataSignature, desiredState.DomainEnabled, desiredState.CurrentEntrySignatures); } public override 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 CompiledLocationEntryPlan { public ConditionsDefinition? Conditions { get; set; } public bool HasConditions { get; set; } public CompiledLocationOfferingBowlPlan? OfferingBowl { get; set; } public List<CompiledLocationItemStandPlan> ItemStands { get; } = new List<CompiledLocationItemStandPlan>(); } 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; } 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 LocationConfigurationRuntimeState { public List<LocationConfigurationEntry> Configuration { get; set; } = new List<LocationConfigurationEntry>(); public string ConfigurationSignature { get; set; } = ""; 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 void Reset() { Configuration = new List<LocationConfigurationEntry>(); ConfigurationSignature = ""; ActiveEntriesByPrefab.Clear(); LooseItemStandEntriesByPrefab.Clear(); } } private sealed class LocationPendingRuntimeState { public InstanceReconcileQueue<Location, PendingLocationReconcile> LocationReconciles { get; } = new InstanceReconcileQueue<Location, PendingLocationReconcile>((Location location, int instanceId, int epoch) => new PendingLocationReconcile(location, instanceId, epoch), (PendingLocationReconcile queuedReconcile) => queuedReconcile.LocationInstanceId, (PendingLocationReconcile queuedReconcile) => queuedReconcile.Epoch, (PendingLocationReconcile queuedReconcile) => queuedReconcile.Location); public Dictionary<int, int> SuppressedLocationReconciles { get; } = new Dictionary<int, int>(); public RingBufferQueue<PendingLocationRootReconcile> LocationRootReconciles { get; } = new RingBufferQueue<PendingLocationRootReconcile>(); public HashSet<int> LocationRootReconcileIds { get; } = new HashSet<int>(); public InstanceReconcileQueue<OfferingBowl, PendingLooseOfferingBowlOverride> LooseOfferingBowlOverrides { get; } = new InstanceReconcileQueue<OfferingBowl, PendingLooseOfferingBowlOverride>((OfferingBowl offeringBowl, int instanceId, int epoch) => new PendingLooseOfferingBowlOverride(offeringBowl, instanceId, epoch), (PendingLooseOfferingBowlOverride queuedOverride) => queuedOverride.OfferingBowlInstanceId, (PendingLooseOfferingBowlOverride queuedOverride) => queuedOverride.Epoch, (PendingLooseOfferingBowlOverride queuedOverride) => queuedOverride.OfferingBowl); public ScheduledFrameQueue<ZDOID> LocationProxyAliasZdoFlushIds { get; } = new ScheduledFrameQueue<ZDOID>(); public Dictionary<ZDOID, PendingLocationProxyAliasZdoFlush> LocationProxyAliasZdoFlushes { get; } = new Dictionary<ZDOID, PendingLocationProxyAliasZdoFlush>(); public Dictionary<ZDOID, int> LocationProxyAliasZdoFlushEnqueuedDueFrames { get; } = new Dictionary<ZDOID, int>(); public ScheduledFrameQueue<PendingLocationProxyObservation> LocationProxyObservations { get; } = new ScheduledFrameQueue<PendingLocationProxyObservation>(); public HashSet<int> LocationProxyObservationIds { get; } = new HashSet<int>(); public List<string> LocationProxyCreationPrefabs { get; } = new List<string>(); public HashSet<string> RuntimeLocationProxyAliasDemands { get; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase); public int ReconcileQueueEpoch { get; private set; } public bool NeedsRuntimeLocationProxyObservation { get; set; } public int LocationProxyObservationDemandEpoch { get; set; } public int LocationProxyAliasFlushBudgetFrame { get; set; } = int.MinValue; public int LocationProxyAliasFlushesSentThisFrame { get; set; } public bool HasPendingReconcileWork(int currentFrame, bool hasPendingLooseOverrideWork) { if (!(LocationReconciles.HasPendingWork || LocationRootReconciles.Count > 0 || hasPendingLooseOverrideWork) && (LocationProxyObservationIds.Count <= 0 || !LocationProxyObservations.HasDueItems(currentFrame))) { if (LocationProxyAliasZdoFlushes.Count > 0) { return LocationProxyAliasZdoFlushIds.HasDueItems(currentFrame); } return false; } return true; } public int GetPendingReconcileWorkCount() { return LocationReconciles.Count + LocationRootReconciles.Count + LooseOfferingBowlOverrides.Count + LocationProxyObservationIds.Count + LocationProxyAliasZdoFlushes.Count; } public void ClearQueuedReconcileState() { ReconcileQueueEpoch++; LocationReconciles.Clear(); SuppressedLocationReconciles.Clear(); LocationRootReconciles.Clear(); LocationRootReconcileIds.Clear(); LooseOfferingBowlOverrides.Clear(); LocationProxyAliasZdoFlushIds.Clear(); LocationProxyAliasZdoFlushes.Clear(); LocationProxyAliasZdoFlushEnqueuedDueFrames.Clear(); LocationProxyObservations.Clear(); LocationProxyObservationIds.Clear(); LocationProxyAliasFlushBudgetFrame = int.MinValue; LocationProxyAliasFlushesSentThisFrame = 0; } } private sealed class LocationLiveRuntimeState { public Dictionary<int, string> LocationPrefabNamesByHash { get; } = new Dictionary<int, string>(); public Dictionary<LocationProxy, string> RuntimeLocationProxyPrefabsByInstance { get; } = new Dictionary<LocationProxy, string>(); public Dictionary<ZDOID, string> RuntimeLocationProxyPrefabsByZdoId { get; } = new Dictionary<ZDOID, string>(); public ConditionalWeakTable<LocationProxy, LocationProxyObservationState> LocationProxyObservationStates { get; } = new ConditionalWeakTable<LocationProxy, LocationProxyObservationState>(); public ConditionalWeakTable<Location, LocationAliasRefreshRequestState> LocationAliasRefreshRequestStates { get; } = new ConditionalWeakTable<Location, LocationAliasRefreshRequestState>(); public Dictionary<ItemStand, ItemStandSnapshot> LooseItemStandSnapshots { get; } = new Dictionary<ItemStand, ItemStandSnapshot>(); public Dictionary<Location, LiveLocationSnapshot> LiveLocationSnapshots { get; } = new Dictionary<Location, LiveLocationSnapshot>(); public Dictionary<string, LocationComponentCatalog> CatalogsByPrefab { get; } = new Dictionary<string, LocationComponentCatalog>(StringComparer.OrdinalIgnoreCase); public Dictionary<string, HashSet<Location>> LiveLocationsByPrefab { get; } = new Dictionary<string, HashSet<Location>>(StringComparer.OrdinalIgnoreCase); public Dictionary<Location, string> LiveLocationPrefabsByInstance { get; } = new Dictionary<Location, string>(); public HashSet<LocationProxy> TrackedLocationProxies { get; } = new HashSet<LocationProxy>(); public ConditionalWeakTable<OfferingBowl, LooseOfferingBowlOverrideState> LooseOfferingBowlOverrideStates { get; } = new ConditionalWeakTable<OfferingBowl, LooseOfferingBowlOverrideState>(); public Dictionary<string, List<AuthoredItemStandSlotTemplate>> AuthoredItemStandSlotsByPrefab { get; } = new Dictionary<string, List<AuthoredItemStandSlotTemplate>>(StringComparer.OrdinalIgnoreCase); public Dictionary<ItemStand, string> TrackedLooseItemStandPrefabs { get; } = new Dictionary<ItemStand, string>(); public Dictionary<ItemStand, string> LooseItemStandAuthoredPathsByInstance { get; } = new Dictionary<ItemStand, string>(); public int RuntimeLocationAliasEpoch { get; set; } public void ClearLoadedConfigurationCaches() { LocationPrefabNamesByHash.Clear(); AuthoredItemStandSlotsByPrefab.Clear(); } public void ClearRuntimeState(bool preserveLiveRegistries) { CatalogsByPrefab.Clear(); LiveLocationSnapshots.Clear(); LooseItemStandSnapshots.Clear(); TrackedLooseItemStandPrefabs.Clear(); LooseItemStandAuthoredPathsByInstance.Clear(); if (!preserveLiveRegistries) { LiveLocationsByPrefab.Clear(); LiveLocationPrefabsByInstance.Clear(); TrackedLocationProxies.Clear(); RuntimeLocationProxyPrefabsByInstance.Clear(); RuntimeLocationProxyPrefabsByZdoId.Clear(); RuntimeLocationAliasEpoch++; } } } 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); } private sealed class VegvisirGlobalEffectCandidate { public LocationVegvisirGlobalEffectDefinition Definition { get; set; } = new LocationVegvisirGlobalEffectDefinition(); public StatusEffect? StatusEffect { get; set; } public Biome SourceBiome { get; set; } public float Weight { get; set; } public bool ClearsStatusEffects { get; set; } public string EffectKey { get; set; } = ""; } private sealed class VegvisirGlobalEffectSelectionState { public string CandidateSignature { get; set; } = ""; public int SelectedIndex { get; set; } = -1; public Dictionary<long, DateTime> LastGrantedByPlayer { get; } = new Dictionary<long, DateTime>(); } [CompilerGenerated] private sealed class <BuildConfiguredLocationResolutionKeys>d__202 : 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 List<LocationConfigurationEntry>.Enumerator <>7__wrap2; private IEnumerator<string> <>7__wrap3; private Dictionary<string, List<LocationConfigurationEntry>>.Enumerator <>7__wrap4; private LocationConfigurationEntry <entry>5__6; 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__202(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; switch (num) { case -4: case -3: case 1: try { if (num == -4 || num == 1) { try { } finally { <>m__Finally2(); } } } finally { <>m__Finally1(); } break; case -9: case -8: case -7: case -6: case -5: case 2: case 3: try { if ((uint)(num - -9) > 3u && (uint)(num - 2) > 1u) { break; } try { switch (num) { case -7: case 2: try { } finally { <>m__Finally5(); } break; case -9: case -8: case 3: try { if (num == -9 || num == 3) { try { } finally { <>m__Finally7(); } } } finally { <>m__Finally6(); } break; } } finally { <>m__Finally4(); } } finally { <>m__Finally3(); } break; } <seen>5__2 = null; <>7__wrap2 = default(List<LocationConfigurationEntry>.Enumerator); <>7__wrap3 = null; <>7__wrap4 = default(Dictionary<string, List<LocationConfigurationEntry>>.Enumerator); <entry>5__6 = null; <>7__wrap6 = default(List<LocationItemStandDefinition>.Enumerator); <>1__state = -2; } private bool MoveNext() { try { LocationConfigurationEntry current; switch (<>1__state) { default: return false; case 0: <>1__state = -1; <seen>5__2 = new HashSet<string>(StringComparer.OrdinalIgnoreCase); <>7__wrap2 = _configuration.GetEnumerator(); <>1__state = -3; goto IL_00d2; case 1: <>1__state = -4; goto IL_00b8; case 2: <>1__state = -7; goto IL_01b6; case 3: { <>1__state = -9; goto IL_025a; } IL_00d2: while (<>7__wrap2.MoveNext()) { current = <>7__wrap2.Current; if (current.VegvisirGlobalEffects == null) { continue; } goto IL_0069; } <>m__Finally1(); <>7__wrap2 = default(List<LocationConfigurationEntry>.Enumerator); <>7__wrap4 = ActiveEntriesByPrefab.GetEnumerator(); <>1__state = -5; goto IL_02bf; IL_0069: <>7__wrap3 = BuildConfiguredLocationResolutionKeys(current.VegvisirGlobalEffects, <seen>5__2).GetEnumerator(); <>1__state = -4; goto IL_00b8; IL_02bf: if (<>7__wrap4.MoveNext()) { <>7__wrap4.Current.Deconstruct(out string _, out List<LocationConfigurationEntry> value); List<LocationConfigurationEntry> list = value; <>7__wrap2 = list.GetEnumerator(); <>1__state = -6; goto IL_029d; } <>m__Finally3(); <>7__wrap4 = default(Dictionary<string, List<LocationConfigurationEntry>>.Enumerator); return false; IL_025a: if (<>7__wrap3.MoveNext()) { string current2 = <>7__wrap3.Current; <>2__current = current2; <>1__state = 3; return true; } <>m__Finally7(); <>7__wrap3 = null; goto IL_0274; IL_01d0: if (<entry>5__6.ItemStands != null) { <>7__wrap6 = <entry>5__6.ItemStands.GetEnumerator(); <>1__state = -8; goto IL_0274; } goto IL_029d; IL_029d: if (<>7__wrap2.MoveNext()) { <entry>5__6 = <>7__wrap2.Current; LocationOfferingBowlDefinition offeringBowl = <entry>5__6.OfferingBowl; if (offeringBowl != null) { <>7__wrap3 = BuildConfiguredLocationResolutionKeys(offeringBowl, <seen>5__2).GetEnumerator(); <>1__state = -7; goto IL_01b6; } goto IL_01d0; } <>m__Finally4(); <>7__wrap2 = default(List<LocationConfigurationEntry>.Enumerator); goto IL_02bf; IL_00b8: if (<>7__wrap3.MoveNext()) { string current3 = <>7__wrap3.Current; <>2__current = current3; <>1__state = 1; return true; } <>m__Finally2(); <>7__wrap3 = null; goto IL_00d2; IL_0274: if (<>7__wrap6.MoveNext()) { LocationItemStandDefinition current4 = <>7__wrap6.Current; <>7__wrap3 = BuildConfiguredLocationResolutionKeys(current4, <seen>5__2).GetEnumerator(); <>1__state = -9; goto IL_025a; } <>m__Finally6(); <>7__wrap6 = default(List<LocationItemStandDefinition>.Enumerator); <entry>5__6 = null; goto IL_029d; IL_01b6: if (<>7__wrap3.MoveNext()) { string current5 = <>7__wrap3.Current; <>2__current = current5; <>1__state = 2; return true; } <>m__Finally5(); <>7__wrap3 = null; goto IL_01d0; } } 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; if (<>7__wrap3 != null) { <>7__wrap3.Dispose(); } } private void <>m__Finally3() { <>1__state = -1; ((IDisposable)<>7__wrap4).Dispose(); } private void <>m__Finally4() { <>1__state = -5; ((IDisposable)<>7__wrap2).Dispose(); } private void <>m__Finally5() { <>1__state = -6; if (<>7__wrap3 != null) { <>7__wrap3.Dispose(); } } private void <>m__Finally6() { <>1__state = -6; ((IDisposable)<>7__wrap6).Dispose(); } private void <>m__Finally7() { <>1__state = -8; if (<>7__wrap3 != null) { <>7__wrap3.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__202(0); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<string>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <BuildConfiguredLocationResolutionKeys>d__203 : IEnumerable<string>, IEnumerable, IEnumerator<string>, IDisposable, IEnumerator { private int <>1__state; private string <>2__current; private int <>l__initialThreadId; private LocationVegvisirGlobalEffectsDefinition definition; public LocationVegvisirGlobalEffectsDefinition <>3__definition; private HashSet<string> seen; public HashSet<string> <>3__seen; private IEnumerator<LocationVegvisirGlobalEffectsBiomeDefinition> <>7__wrap1; private IEnumerator<LocationVegvisirGlobalEffectDefinition> <>7__wrap2; string IEnumerator<string>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <BuildConfiguredLocationResolutionKeys>d__203(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(); } } <>7__wrap1 = null; <>7__wrap2 = null; <>1__state = -2; } private bool MoveNext() { try { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -4; goto IL_00d6; } <>1__state = -1; IEnumerable<LocationVegvisirGlobalEffectsBiomeDefinition> biomes = definition.Biomes; <>7__wrap1 = (biomes ?? Enumerable.Empty<LocationVegvisirGlobalEffectsBiomeDefinition>()).GetEnumerator(); <>1__state = -3; goto IL_00f0; IL_00f0: if (<>7__wrap1.MoveNext()) { LocationVegvisirGlobalEffectsBiomeDefinition current = <>7__wrap1.Current; IEnumerable<LocationVegvisirGlobalEffectDefinition> statusEffects = current.StatusEffects; <>7__wrap2 = (statusEffects ?? Enumerable.Empty<LocationVegvisirGlobalEffectDefinition>()).GetEnumerator(); <>1__state = -4; goto IL_00d6; } <>m__Finally1(); <>7__wrap1 = null; return false; IL_00d6: while (<>7__wrap2.MoveNext()) { LocationVegvisirGlobalEffectDefinition current2 = <>7__wrap2.Current; if (!IsVegvisirGlobalClearStatusEffect(current2.StatusEffect) && TryBuildResolvedStatusEffectSignatureKey(current2.StatusEffect, out string key) && seen.Add(key)) { <>2__current = key; <>1__state = 1; return true; } } <>m__Finally2(); <>7__wrap2 = null; goto IL_00f0; } 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 = -3; if (<>7__wrap2 != null) { <>7__wrap2.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<string> IEnumerable<string>.GetEnumerator() { <BuildConfiguredLocationResolutionKeys>d__203 <BuildConfiguredLocationResolutionKeys>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <BuildConfiguredLocationResolutionKeys>d__ = this; } else { <BuildConfiguredLocationResolutionKeys>d__ = new <BuildConfiguredLocationResolutionKeys>d__203(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__204 : 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__204(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__204 <BuildConfiguredLocationResolutionKeys>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <BuildConfiguredLocationResolutionKeys>d__ = this; } else { <BuildConfiguredLocationResolutionKeys>d__ = new <BuildConfiguredLocationResolutionKeys>d__204(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__205 : 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__205(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__205 <BuildConfiguredLocationResolutionKeys>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <BuildConfiguredLocationResolutionKeys>d__ = this; } else { <BuildConfiguredLocationResolutionKeys>d__ = new <BuildConfiguredLocationResolutionKeys>d__205(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__201 : 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__201(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__201(0); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<string>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <GetRegisteredLocations>d__279 : 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__279(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__279 <GetRegisteredLocations>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <GetRegisteredLocations>d__ = this; } else { <GetRegisteredLocations>d__ = new <GetRegisteredLocations>d__279(0); } <GetRegisteredLocations>d__.dirtyPrefabs = <>3__dirtyPrefabs; return <GetRegisteredLocations>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<Location>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <GetTrackedLooseItemStands>d__380 : 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__380(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__380 <GetTrackedLooseItemStands>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <GetTrackedLooseItemStands>d__ = this; } else { <GetTrackedLooseItemStands>d__ = new <GetTrackedLooseItemStands>d__380(0); } <GetTrackedLooseItemStands>d__.dirtyPrefabs = <>3__dirtyPrefabs; return <GetTrackedLooseItemStands>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<ItemStand>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <ShowVegvisirGlobalEffectCenterMessageAfterDelay>d__527 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public long playerId; public string message; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ShowVegvisirGlobalEffectCenterMessageAfterDelay>d__527(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: { <>1__state = -1; Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || localPlayer.GetPlayerID() != playerId) { return false; } ((Character)localPlayer).Message((MessageType)2, message, 0, (Sprite)null); 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(); } } private const string ReferenceAutoUpdateStateKey = "location"; internal static readonly DomainModuleDefinition<LocationConfigurationEntry> Module = new DomainModuleDefinition<LocationConfigurationEntry>(new DomainModuleOptions<LocationConfigurationEntry> { DomainKey = "location", ReloadDomain = DropNSpawnPlugin.ReloadDomain.Location, ManifestSettingKey = "location_yaml", ManifestPriority = 97, ShouldReloadForPath = ShouldReloadForPath, Reload = ReloadConfiguration, InitializeRuntime = Initialize, OnGameDataReady = OnGameDataReady, HandleExpandWorldDataReady = HandleExpandWorldDataReady, DtoVersion = 16, TransportProfile = DomainTransportProfile.SmallConfig, DisplayName = "location", CacheDirectoryName = "location", ClientRequestPriority = 20, KeySelector = (LocationConfigurationEntry entry) => entry.RuleId, ApplyPayloadAction = ApplySyncedPayload, WorkKinds = (DomainWorkKinds.Runtime | DomainWorkKinds.Reconcile), HasPendingReconcileWork = HasPendingReconcileWork, GetPendingReconcileWorkCount = GetPendingReconcileWorkCount, ProcessPendingReconcileStep = ProcessQueuedReconcileStep, BeforeClientManifestChanged = MarkSyncedPayloadPending, OnClientAuthorityCutover = 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 LocationConfigurationRuntimeState RuntimeState = new LocationConfigurationRuntimeState(); private static readonly LocationLiveRuntimeState LiveRuntimeState = new LocationLiveRuntimeState(); private const string LocationProxyResolvedPrefabZdoKey = "DropNSpawn Location Prefab"; private static readonly InvalidEntryDiagnostics InvalidEntryWarnings = new InvalidEntryDiagnostics(); private static readonly HashSet<string> DuplicateComponentWarnings = 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 LocationPendingRuntimeState PendingRuntimeState = new LocationPendingRuntimeState(); private const int LocationAliasRefreshInteractionCooldownFrames = 30; 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 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 const int RunestoneGlobalPinRpcVersion = 1; private const string RunestoneGlobalPinRequestRpc = "DropNSpawn Runestone GlobalPin Request"; private const string RunestoneGlobalPinResponseRpc = "DropNSpawn Runestone GlobalPin Response"; 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, ResolvedRunestoneGlobalPin?> RunestoneGlobalPinServerRolls = new Dictionary<string, ResolvedRunestoneGlobalPin>(StringComparer.Ordinal); private static readonly Dictionary<string, string> RunestoneGlobalPinDefaultPinNames = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); private static readonly HashSet<string> RunestoneGlobalPinWarningLogs = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private static readonly FieldRef<ZRoutedRpc, long> RunestoneGlobalPinRoutedRpcIdRef = AccessTools.FieldRefAccess<ZRoutedRpc, long>("m_id"); private static RunestoneGlobalPinLocationIndex? RunestoneGlobalPinLocationIndexCache; private static ZRoutedRpc? RunestoneGlobalPinRegisteredRpcInstance; private static readonly FieldInfo? MinimapPinsField = AccessTools.Field(typeof(Minimap), "m_pins"); private const string VegvisirGlobalEffectClearStatusKey = "DNS_ClearStatus"; private static readonly object VegvisirGlobalEffectsLock = new object(); private static readonly Random VegvisirGlobalEffectsRandom = new Random(); private static readonly ConditionalWeakTable<Vegvisir, VegvisirGlobalEffectSelectionState> VegvisirGlobalEffectSelections = new ConditionalWeakTable<Vegvisir, VegvisirGlobalEffectSelectionState>(); private static readonly HashSet<string> VegvisirGlobalEffectMissingEffectPrefabWarnings = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private static readonly HashSet<string> VegvisirGlobalEffectInvalidEffectPrefabWarnings = new HashSet<string>(StringComparer.OrdinalIgnoreCase); internal static DomainDescriptor<LocationConfigurationEntry> Descriptor => Module.DescriptorTyped; internal static DomainTransportMetadata<LocationConfigurationEntry> TransportMetadata => Module.TransportMetadataTyped; private static Dictionary<string, List<LocationConfigurationEntry>> ActiveEntriesByPrefab => RuntimeState.ActiveEntriesByPrefab; private static Dictionary<int, string> LocationPrefabNamesByHash => LiveRuntimeState.LocationPrefabNamesByHash; private static Dictionary<LocationProxy, string> RuntimeLocationProxyPrefabsByInstance => LiveRuntimeState.RuntimeLocationProxyPrefabsByInstance; private static Dictionary<ZDOID, string> RuntimeLocationProxyPrefabsByZdoId => LiveRuntimeState.RuntimeLocationProxyPrefabsByZdoId; private static ConditionalWeakTable<LocationProxy, LocationProxyObservationState> LocationProxyObservationStates => LiveRuntimeState.LocationProxyObservationStates; private static ConditionalWeakTable<Location, LocationAliasRefreshRequestState> LocationAliasRefreshRequestStates => LiveRuntimeState.LocationAliasRefreshRequestStates; private static Dictionary<ItemStand, ItemStandSnapshot> LooseItemStandSnapshots => LiveRuntimeState.LooseItemStandSnapshots; private static Dictionary<Location, LiveLocationSnapshot> LiveLocationSnapshots => LiveRuntimeState.LiveLocationSnapshots; private static Dictionary<string, LocationComponentCatalog> CatalogsByPrefab => LiveRuntimeState.CatalogsByPrefab; private static Dictionary<string, HashSet<Location>> LiveLocationsByPrefab => LiveRuntimeState.LiveLocationsByPrefab; private static Dictionary<Location, string> LiveLocationPrefabsByInstance => LiveRuntimeState.LiveLocationPrefabsByInstance; private static HashSet<LocationProxy> TrackedLocationProxies => LiveRuntimeState.TrackedLocationProxies; private static ConditionalWeakTable<OfferingBowl, LooseOfferingBowlOverrideState> LooseOfferingBowlOverrideStates => LiveRuntimeState.LooseOfferingBowlOverrideStates; private static Dictionary<string, List<AuthoredItemStandSlotTemplate>> AuthoredItemStandSlotsByPrefab => LiveRuntimeState.AuthoredItemStandSlotsByPrefab; private static Dictionary<string, List<LocationConfigurationEntry>> LooseItemStandEntriesByPrefab => RuntimeState.LooseItemStandEntriesByPrefab; private static Dictionary<ItemStand, string> TrackedLooseItemStandPrefabs => LiveRuntimeState.TrackedLooseItemStandPrefabs; private static Dictionary<ItemStand, string> LooseItemStandAuthoredPathsByInstance => LiveRuntimeState.LooseItemStandAuthoredPathsByInstance; private static InstanceReconcileQueue<Location, PendingLocationReconcile> PendingLocationReconciles => PendingRuntimeState.LocationReconciles; private static Dictionary<int, int> SuppressedQueuedLocationReconciles => PendingRuntimeState.SuppressedLocationReconciles; private static RingBufferQueue<PendingLocationRootReconcile> PendingLocationRootReconciles => PendingRuntimeState.LocationRootReconciles; private static HashSet<int> PendingLocationRootReconcileIds => PendingRuntimeState.LocationRootReconcileIds; private static InstanceReconcileQueue<OfferingBowl, PendingLooseOfferingBowlOverride> PendingLooseOfferingBowlOverrides => PendingRuntimeState.LooseOfferingBowlOverrides; private static ScheduledFrameQueue<ZDOID> PendingLocationProxyAliasZdoFlushIds => PendingRuntimeState.LocationProxyAliasZdoFlushIds; private static Dictionary<ZDOID, PendingLocationProxyAliasZdoFlush> PendingLocationProxyAliasZdoFlushes => PendingRuntimeState.LocationProxyAliasZdoFlushes; private static Dictionary<ZDOID, int> PendingLocationProxyAliasZdoFlushEnqueuedDueFrames => PendingRuntimeState.LocationProxyAliasZdoFlushEnqueuedDueFrames; private static ScheduledFrameQueue<PendingLocationProxyObservation> PendingLocationProxyObservations => PendingRuntimeState.LocationProxyObservations; private static HashSet<int> PendingLocationProxyObservationIds => PendingRuntimeState.LocationProxyObservationIds; private static List<string> PendingLocationProxyCreationPrefabs => PendingRuntimeState.LocationProxyCreationPrefabs; private static HashSet<string> PendingRuntimeLocationProxyAliasDemands => PendingRuntimeState.RuntimeLocationProxyAliasDemands; private static List<LocationConfigurationEntry> _configuration { get { return RuntimeState.Configuration; } set { RuntimeState.Configuration = value; } } private static string _configurationSignature { get { return RuntimeState.ConfigurationSignature; } set { RuntimeState.ConfigurationSignature = value; } } private static int _reconcileQueueEpoch => PendingRuntimeState.ReconcileQueueEpoch; private static bool _needsRuntimeLocationProxyObservation { get { return PendingRuntimeState.NeedsRuntimeLocationProxyObservation; } set { PendingRuntimeState.NeedsRuntimeLocationProxyObservation = value; } } private static int _locationProxyObservationDemandEpoch { get { return PendingRuntimeState.LocationProxyObservationDemandEpoch; } set { PendingRuntimeState.LocationProxyObservationDemandEpoch = value; } } private static int _runtimeLocationAliasEpoch { get { return LiveRuntimeState.RuntimeLocationAliasEpoch; } set { LiveRuntimeState.RuntimeLocationAliasEpoch = value; } } private static int _locationProxyAliasFlushBudgetFrame { get { return PendingRuntimeState.LocationProxyAliasFlushBudgetFrame; } set { PendingRuntimeState.LocationProxyAliasFlushBudgetFrame = value; } } private static int _locationProxyAliasFlushesSentThisFrame { get { return PendingRuntimeState.LocationProxyAliasFlushesSentThisFrame; } set { PendingRuntimeState.LocationProxyAliasFlushesSentThisFrame = value; } } 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