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 ServersideQoL AutoStore BETA v1.99.2
ServersideQoL.AutoStore.dll
Decompiled 15 hours agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ArgusMagnus")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("ArgusMagnus")] [assembly: AssemblyDescription("Automatically put dropped items and items in player inventories into nearby containers")] [assembly: AssemblyFileVersion("1.99.2.0")] [assembly: AssemblyInformationalVersion("1.99.2-beta+409ce8a87a5191770ee23cbbde9294d6a844dd0b")] [assembly: AssemblyProduct("ServersideQoL.AutoStore")] [assembly: AssemblyTitle("ServersideQoL.AutoStore")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ArgusMagnus/ValheimServersideQoL")] [assembly: AssemblyVersion("1.99.2.0")] [module: RefSafetyRules(11)] [CompilerGenerated] internal sealed class <>z__ReadOnlyList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { int ICollection.Count => _items.Count; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection<T>.Count => _items.Count; T IReadOnlyList<T>.this[int index] => _items[index]; int ICollection<T>.Count => _items.Count; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyList(List<T> items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return ((IEnumerable<T>)_items).GetEnumerator(); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return _items.Contains(item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { _items.CopyTo(array, arrayIndex); } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { return _items.IndexOf(item); } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ServersideQoL.AutoStore { [BepInDependency("ArgusMagnus.ServersideQoL", "1.99.2")] [BepInPlugin("ArgusMagnus.ServersideQoL.AutoStore", "ServersideQoL.AutoStore", "1.99.2")] public sealed class AutoStorePlugin : ServersideQoLPluginBase<AutoStorePlugin, Config> { public const string Author = "ArgusMagnus"; public const string PluginName = "ServersideQoL.AutoStore"; public const string PluginGuid = "ArgusMagnus.ServersideQoL.AutoStore"; public const string PluginVersion = "1.99.2"; public const string PluginInformationalVersion = "1.99.2-beta"; internal const string DependencyDirectory = "C:\\repos\\Valheim.ServersideQoL\\Dependencies\\"; private DateTimeOffset BuildTimestamp { get; } = new DateTimeOffset(639207788793123724L, default(TimeSpan)); protected override Config CreateConfigSingleton(ConfigFile configFile, Logger logger) { return new Config(configFile, logger); } protected override void RegisterProcessors(IProcessorCollection processors) { processors.Add<ContainerProcessor>().Add<ItemDropProcessor>(); } private void Awake() { bool flag = true; ServersideQoLPluginBase<AutoStorePlugin, Config>.Logger.LogWarning((object)string.Format("You are running a pre-release version: {0} ({1})", "1.99.2-beta", BuildTimestamp.LocalDateTime)); } } public sealed class Config : ConfigBase<Config> { public static class Types { public sealed class Localization { private string ContainerSorted { get; init; } = "{0} sorted"; private string AutoPickup { get; init; } = "{0}: $msg_added {1} {2}x"; public string FormatContainerSorted(string containerName) { return string.Format(ContainerSorted, containerName); } public string FormatAutoPickup(string containerName, string itemName, int stack) { return string.Format(AutoPickup, containerName, itemName, stack); } } } private const string Section = "AutoStore"; public override ConfigEntry<bool> Enabled { get; } = ConfigBase<Config>.BindEx<bool>(cfg, "AutoStore", true, "Enables/disables the entire mod", (AcceptableValueBase)null, (Deprecated<Config>)null, "Enabled"); public ConfigEntry<bool> AutoSort { get; } = ConfigBase<Config>.BindEx<bool>(cfg, "AutoStore", false, "True to auto sort container inventories", (AcceptableValueBase)null, (Deprecated<Config>)null, "AutoSort"); public ConfigEntry<MessageTypes> SortedMessageType { get; } = ConfigBase<Config>.BindEx<MessageTypes>(cfg, "AutoStore", (MessageTypes)0, "Type of message to show when a container was sorted", (AcceptableValueBase)(object)AcceptableEnum<MessageTypes>.Default, (Deprecated<Config>)null, "SortedMessageType"); public ConfigEntry<bool> AutoPickup { get; } = Shared.AutoPickup = ConfigBase<Config>.BindEx<bool>(cfg, "AutoStore", false, "True to automatically put dropped items into containers if they already contain said item", (AcceptableValueBase)null, (Deprecated<Config>)null, "AutoPickup"); public ConfigEntry<float> AutoPickupRange { get; } = ConfigBase<Config>.BindEx<float>(cfg, "AutoStore", 64f, "Required proximity of a container to a dropped item to be considered as auto pickup target. Can be overridden per chest with the ServersideQoL.ContainerSigns mod.", (AcceptableValueBase)null, (Deprecated<Config>)null, "AutoPickupRange"); public int? AutoPickupMaxRange => Shared.AutoPickupMaxRange?.Value; public ConfigEntry<float> AutoPickupMinPlayerDistance { get; } = ConfigBase<Config>.BindEx<float>(cfg, "AutoStore", 4f, "Min distance all players must have to a dropped item for it to be picked up", (AcceptableValueBase)null, (Deprecated<Config>)null, "AutoPickupMinPlayerDistance"); public ConfigEntry<bool> AutoPickupExcludeFodder { get; } = ConfigBase<Config>.BindEx<bool>(cfg, "AutoStore", true, "True to exclude food items for tames when tames are within search range", (AcceptableValueBase)null, (Deprecated<Config>)null, "AutoPickupExcludeFodder"); public ConfigEntry<bool> AutoPickupRequestOwnership { get; } = ConfigBase<Config>.BindEx<bool>(cfg, "AutoStore", true, "True to make the server request (and receive) ownership of dropped items from the clients before they are picked up. This will reduce the risk of data conflicts (e.g. item duplication) but will drastically decrease performance", (AcceptableValueBase)null, (Deprecated<Config>)null, "AutoPickupRequestOwnership"); public ConfigEntry<MessageTypes> PickedUpMessageType { get; } = ConfigBase<Config>.BindEx<MessageTypes>(cfg, "AutoStore", (MessageTypes)0, "Type of message to show when a dropped item is added to a container", (AcceptableValueBase)(object)AcceptableEnum<MessageTypes>.Default, (Deprecated<Config>)null, "PickedUpMessageType"); public ConfigEntry<Emotes> StackInventoryIntoContainersEmote { get; } public ConfigEntry<float> StackInventoryIntoContainersReturnDelay { get; } public YamlConfigEntry<Types.Localization> Localization { get; } public Config(ConfigFile cfg, Logger logger) { string text = $"Emote to stack inventory into containers.\r\nIf a player uses this emote, their inventory will be automatically stacked into nearby containers.\r\nThe rules for which containers are used are the same as for auto pickup.\r\n{(object)(Emotes)(-1)} to disable this feature, {(object)(Emotes)(-2)} to use any emote as trigger.\r\nFor example, on xbox you can use D-Pad down to execute the {(object)(Emotes)1} emote.\r\nIf you use emotes exclusively for this feature, it is recommended to set the value to {(object)(Emotes)(-2)} as it is more reliably detected than specific emotes, especially on bad connection/with crossplay."; List<Emotes> list = new List<Emotes>(); list.Add((Emotes)(-1)); list.Add((Emotes)(-2)); list.AddRange(Enum.GetValues(typeof(Emotes)).Cast<Emotes>()); StackInventoryIntoContainersEmote = ConfigBase<Config>.BindEx<Emotes>(cfg, "AutoStore", (Emotes)(-1), text, (AcceptableValueBase)(object)new AcceptableEnum<Emotes>((IEnumerable<Emotes>)new <>z__ReadOnlyList<Emotes>(list)), (Deprecated<Config>)null, "StackInventoryIntoContainersEmote"); StackInventoryIntoContainersReturnDelay = ConfigBase<Config>.BindEx<float>(cfg, "AutoStore", 1f, "Time in seconds after which items which could not be stacked into containers are returned to the player.\r\nIncreasing this value can help with bad connections.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), (Deprecated<Config>)null, "StackInventoryIntoContainersReturnDelay"); Localization = ConfigBase<Config>.BindYaml<Types.Localization>(cfg, "Localization"); base..ctor(cfg, logger); } } [Processor("e1c6ea7a-996b-4aad-8595-af86f02fe25b")] [RunBefore<ContainerRegistryProcessor>] [DependsOn<PlayerRegistryProcessor>] public sealed class ContainerProcessor : Processor<PrefabInfo> { private sealed record StackContainerState(ServersideQoLZDO PlayerZDO) { public DateTimeOffset RemoveAfter { get; set; } = DateTimeOffset.UtcNow.AddSeconds(20.0); public bool Stacked { get; set; } } private readonly Dictionary<ItemDataKey, int> _stackPerItem = new Dictionary<ItemDataKey, int>(); private readonly Dictionary<ServersideQoLZDO, StackContainerState> _stackContainers = new Dictionary<ServersideQoLZDO, StackContainerState>(); private SectorDictionary<SharedItemDataKey, HashSet<ServersideQoLZDO>>? _containersByItemName; private SectorDictionary<HashSet<ServersideQoLZDO>>? _containers; protected override void Initialize() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 Processor.Instance<PlayerRegistryProcessor>().EmoteDetected -= OnPlayerEmoteDetected; if ((int)ConfigBase<Config>.Instance.StackInventoryIntoContainersEmote.Value == -1) { _containersByItemName = null; _containers = null; } else { _containersByItemName = Processor.Instance<ContainerRegistryProcessor>().GetContainersByItemName(Mathf.Max(ConfigBase<Config>.Instance.AutoPickupRange.Value, (float)ConfigBase<Config>.Instance.AutoPickupMaxRange.GetValueOrDefault())); _containers = Processor.Instance<ContainerRegistryProcessor>().GetContainers(_containersByItemName.SectorWidth); Processor.Instance<PlayerRegistryProcessor>().EmoteDetected += OnPlayerEmoteDetected; } } protected override ProcessResult Process(ServersideQoLZDO zdo, IReadOnlyList<Peer> peers, PrefabInfo prefabInfo) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0805: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_0801: Unknown result type (might be due to invalid IL or missing references) //IL_0790: Unknown result type (might be due to invalid IL or missing references) //IL_0795: Unknown result type (might be due to invalid IL or missing references) //IL_07b3: Unknown result type (might be due to invalid IL or missing references) //IL_07f2: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0596: Unknown result type (might be due to invalid IL or missing references) //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_05ab: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Unknown result type (might be due to invalid IL or missing references) //IL_0721: Unknown result type (might be due to invalid IL or missing references) //IL_0726: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_0624: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_0617: Unknown result type (might be due to invalid IL or missing references) //IL_061c: Unknown result type (might be due to invalid IL or missing references) if (_stackContainers.TryGetValue(zdo, out StackContainerState value)) { return ProcessStackContainer(zdo, peers, Processor.Instance<ContainerRegistryProcessor>().GetState(zdo, prefabInfo), value); } if (!ConfigBase<Config>.Instance.AutoSort.Value) { return (ProcessResult)2; } ZDOVars vars = zdo.Vars; if (((ZDOVars)(ref vars)).GetInUse(false)) { return (ProcessResult)1; } ContainerState state = Processor.Instance<ContainerRegistryProcessor>().GetState(zdo, prefabInfo); bool flag = false; ItemData val = null; IInventory inventory = state.GetInventory(); _stackPerItem.Clear(); foreach (ItemData item in from x in inventory.Items orderby (!x.IsEquipable()) ? 1 : 0, x.m_shared.m_name, x.m_stack descending select x) { if (val != null && new ItemDataKey(item) == ItemDataKey.op_Implicit(val)) { flag = true; if (!zdo.IsOwnerOrUnassigned()) { break; } int num = Math.Min(item.m_stack, val.m_shared.m_maxStackSize - val.m_stack); ItemData obj = val; obj.m_stack += num; item.m_stack -= num; } if (item.m_stack != 0) { if (!_stackPerItem.TryGetValue(ItemDataKey.op_Implicit(item), out var value2)) { value2 = 0; } _stackPerItem[ItemDataKey.op_Implicit(item)] = value2 + 1; if (item.m_stack < item.m_shared.m_maxStackSize) { val = item; } } } if (flag && zdo.IsOwnerOrUnassigned()) { for (int num2 = inventory.Items.Count - 1; num2 >= 0; num2--) { if (inventory.Items[num2].m_stack == 0) { inventory.Items.RemoveAt(num2); } } } if (_stackPerItem.Count > 0) { ComponentFieldAccessor<Container> val2 = zdo.Fields<Container>(); int width = val2.GetInt((Func<Expression<Func<Container, int>>>)(() => (Container x) => x.m_width), "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.AutoStore\\ContainerProcessor.cs", 90); int height = val2.GetInt((Func<Expression<Func<Container, int>>>)(() => (Container x) => x.m_height), "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.AutoStore\\ContainerProcessor.cs", 91); if (_stackPerItem.Values.Sum((int x) => (int)Math.Ceiling((double)x / (double)width)) <= height) { int num3 = -1; int num4 = 0; ItemDataKey? val3 = null; foreach (ItemData item2 in from x in inventory.Items orderby (!x.IsEquipable()) ? 1 : 0, x.m_shared.m_name, x.m_stack descending select x) { if (++num3 >= width) { goto IL_0425; } if (val3.HasValue) { ItemDataKey? val4 = val3; ItemDataKey val5 = ItemDataKey.op_Implicit(item2); if (!val4.HasValue || val4.GetValueOrDefault() != val5) { goto IL_0425; } } goto IL_0430; IL_0425: num3 = 0; num4++; goto IL_0430; IL_0430: if (item2.m_gridPos.x != num3 || item2.m_gridPos.y != num4) { flag = true; if (zdo.IsOwnerOrUnassigned()) { item2.m_gridPos = new Vector2i(num3, num4); } } val3 = ItemDataKey.op_Implicit(item2); } } else if (_stackPerItem.Values.Sum((int x) => (int)Math.Ceiling((double)x / (double)height)) <= width) { int num5 = 0; int num6 = height; ItemDataKey? val6 = null; foreach (ItemData item3 in from x in inventory.Items orderby (!x.IsEquipable()) ? 1 : 0, x.m_shared.m_name, x.m_stack descending select x) { if (--num6 < 0) { goto IL_05c3; } if (val6.HasValue) { ItemDataKey? val4 = val6; ItemDataKey val5 = ItemDataKey.op_Implicit(item3); if (!val4.HasValue || val4.GetValueOrDefault() != val5) { goto IL_05c3; } } goto IL_05d6; IL_05c3: num6 = height - 1; num5++; goto IL_05d6; IL_05d6: if (item3.m_gridPos.x != num5 || item3.m_gridPos.y != num6) { flag = true; if (zdo.IsOwnerOrUnassigned()) { item3.m_gridPos = new Vector2i(num5, num6); } } val6 = ItemDataKey.op_Implicit(item3); } } else { int num7 = 0; int num8 = 0; foreach (ItemData item4 in from x in inventory.Items orderby (!x.IsEquipable()) ? 1 : 0, x.m_shared.m_name, x.m_stack descending select x) { if (item4.m_gridPos.x != num7 || item4.m_gridPos.y != num8) { flag = true; if (zdo.IsOwnerOrUnassigned()) { item4.m_gridPos = new Vector2i(num7, num8); } } if (++num7 >= width) { num7 = 0; num8++; } } } } if (flag) { if (!zdo.IsOwnerOrUnassigned()) { ContainerRegistryProcessor obj2 = Processor.Instance<ContainerRegistryProcessor>(); vars = zdo.Vars; obj2.RequestOwnership(zdo, ((ZDOVars)(ref vars)).GetCreator(0L), state, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.AutoStore\\ContainerProcessor.cs", 169); return (ProcessResult)32; } if (flag) { inventory.Save(); Processor.ShowMessage((IEnumerable<Peer>)peers, zdo, ConfigBase<Config>.Instance.Localization.Value.FormatContainerSorted(prefabInfo.Container.m_name), ConfigBase<Config>.Instance.SortedMessageType.Value, (TextType)0); } } return (ProcessResult)0; } private void OnPlayerEmoteDetected(ServersideQoLZDO zdo, PlayerState state, Emotes emote) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) if ((int)ConfigBase<Config>.Instance.StackInventoryIntoContainersEmote.Value != -2 && ConfigBase<Config>.Instance.StackInventoryIntoContainersEmote.Value != emote) { return; } List<ServersideQoLZDO> list = null; Dictionary<SharedItemDataKey, ItemData> dictionary = null; AdjacentEnumerator<HashSet<ServersideQoLZDO>> enumerator = _containers.EnumerateAdjacent(zdo.ZDO.GetPosition()).GetEnumerator(); try { while (enumerator.MoveNext()) { HashSet<ServersideQoLZDO> current = enumerator.Current; list?.Clear(); foreach (ServersideQoLZDO item in current) { ContainerState state2 = Processor.Instance<ContainerRegistryProcessor>().GetState(item); if (state2 == null) { (list ?? (list = new List<ServersideQoLZDO>())).Add(item); continue; } float num = state2.PickupRange ?? ConfigBase<Config>.Instance.AutoPickupRange.Value; num *= num; if (num == 0f || Utils.DistanceSqr(zdo.ZDO.GetPosition(), item.ZDO.GetPosition()) > num) { continue; } if ((int)state2.PrefabInfo.Container.m_privacy == 0) { ZDOVars vars = item.Vars; long creator = ((ZDOVars)(ref vars)).GetCreator(0L); vars = zdo.Vars; if (creator != ((ZDOVars)(ref vars)).GetPlayerID(0L)) { continue; } } IInventory inventory = state2.GetInventory(); foreach (ItemData item2 in inventory.Items) { (dictionary ?? (dictionary = new Dictionary<SharedItemDataKey, ItemData>())).TryAdd(SharedItemDataKey.op_Implicit(item2.m_shared), item2); } } if (list == null) { continue; } foreach (ServersideQoLZDO item3 in list) { current.Remove(item3); } } } finally { ((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } if (dictionary == null) { return; } Vector3 position = zdo.ZDO.GetPosition(); position.y = -1000f; ServersideQoLZDO val = ((Processor)this).PlacePiece(position, Prefabs.PrivateChest, 0f, (CreatorMarkers)0); int num2 = Math.Max(4, dictionary.Count); val.Fields<Container>().Set((Func<Expression<Func<Container, int>>>)(() => (Container x) => x.m_width), 8, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.AutoStore\\ContainerProcessor.cs", 227).Set((Func<Expression<Func<Container, int>>>)(() => (Container x) => x.m_height), num2, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.AutoStore\\ContainerProcessor.cs", 228); int num3 = 0; IInventory inventory2 = Processor.Instance<ContainerRegistryProcessor>().GetState(val).GetInventory(); foreach (ItemData value in dictionary.Values) { ItemData val2 = value.Clone(); val2.m_stack = 1; val2.m_gridPos = new Vector2i(0, num3++); inventory2.Items.Add(val2); } inventory2.Save(); val.ZDO.SetOwnerInternal(zdo.ZDO.GetOwner()); _stackContainers.Add(val, new StackContainerState(zdo)); val.Destroyed += OnStackContainerDestroyed; RPC.StackResponse(val, true); } private void OnStackContainerDestroyed(ServersideQoLZDO zdo) { _stackContainers.Remove(zdo); } private ProcessResult ProcessStackContainer(ServersideQoLZDO zdo, IReadOnlyList<Peer> peers, ContainerState state, StackContainerState stackContainerState) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_021e: 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_022c: Unknown result type (might be due to invalid IL or missing references) IInventory inventory = state.GetInventory(); if (inventory.Items.Count == 0) { return (ProcessResult)4; } if (stackContainerState.Stacked) { if (stackContainerState.RemoveAfter < DateTimeOffset.UtcNow) { RPC.TakeAllResponse(zdo, true); } else if (MoveItems(zdo, state, stackContainerState)) { zdo.Destroyed -= OnStackContainerDestroyed; _stackContainers.Remove(zdo); if (inventory.Items.Count == 0) { return (ProcessResult)4; } _stackContainers.Add(zdo = ((Processor)this).RecreatePiece(zdo), stackContainerState); zdo.Destroyed += OnStackContainerDestroyed; } return (ProcessResult)32; } if (inventory.Items.Any(delegate(ItemData x) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (x != null) { Vector2i gridPos = x.m_gridPos; int x2 = gridPos.x; if (x2 <= 0) { int stack = x.m_stack; if (stack <= 1) { goto IL_0026; } } return true; } goto IL_0026; IL_0026: return false; })) { for (int num = inventory.Items.Count - 1; num >= 0; num--) { ItemData val = inventory.Items[num]; if (val.m_gridPos.x == 0) { if (--val.m_stack == 0) { inventory.Items.RemoveAt(num); } } } inventory.Save(); stackContainerState.Stacked = true; stackContainerState.RemoveAfter = DateTimeOffset.UtcNow.AddSeconds(ConfigBase<Config>.Instance.StackInventoryIntoContainersReturnDelay.Value); zdo.Destroyed -= OnStackContainerDestroyed; _stackContainers.Remove(zdo); _stackContainers.Add(zdo = ((Processor)this).RecreatePiece(zdo), stackContainerState); zdo.Destroyed += OnStackContainerDestroyed; } else { if (stackContainerState.RemoveAfter < DateTimeOffset.UtcNow) { return (ProcessResult)4; } RPC.StackResponse(zdo, true); } return (ProcessResult)1; } private bool MoveItems(ServersideQoLZDO zdo, ContainerState state, StackContainerState stackContainerState) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) bool flag = false; HashSet<Vector2i> hashSet = null; List<ServersideQoLZDO> list = null; IInventory inventory = state.GetInventory(); for (int num = inventory.Items.Count - 1; num >= 0; num--) { ItemData val = inventory.Items[num]; AdjacentEnumerator<SharedItemDataKey, HashSet<ServersideQoLZDO>> enumerator = _containersByItemName.EnumerateAdjacent((stackContainerState.PlayerZDO.ZDO.GetPosition(), SharedItemDataKey.op_Implicit(val.m_shared))).GetEnumerator(); try { while (enumerator.MoveNext()) { HashSet<ServersideQoLZDO> current = enumerator.Current; list?.Clear(); foreach (ServersideQoLZDO item in current) { ContainerState state2 = Processor.Instance<ContainerRegistryProcessor>().GetState(item); if (state2 == null) { (list ?? (list = new List<ServersideQoLZDO>())).Add(item); continue; } ZDOVars vars = item.Vars; if (((ZDOVars)(ref vars)).GetInUse(false)) { continue; } float num2 = state2.PickupRange ?? ConfigBase<Config>.Instance.AutoPickupRange.Value; num2 *= num2; if (num2 == 0f || Utils.DistanceSqr(stackContainerState.PlayerZDO.ZDO.GetPosition(), item.ZDO.GetPosition()) > num2) { continue; } int num3 = val.m_stack; if (hashSet == null) { hashSet = new HashSet<Vector2i>(); } hashSet.Clear(); bool flag2 = false; IInventory inventory2 = state2.GetInventory(); ItemData val2 = null; foreach (ItemData item2 in inventory2.Items) { hashSet.Add(item2.m_gridPos); if (new ItemDataKey(val) != ItemDataKey.op_Implicit(item2)) { continue; } if (val2 == null) { val2 = item2; } int num4 = item2.m_shared.m_maxStackSize - item2.m_stack; if (num4 > 0) { if (!item.IsOwnerOrUnassigned()) { flag2 = true; break; } int num5 = Math.Min(num3, num4); item2.m_stack += num5; num3 -= num5; if (num3 == 0) { break; } } } if (val2 == null) { (list ?? (list = new List<ServersideQoLZDO>())).Add(item); continue; } int num6 = inventory2.Inventory.GetEmptySlots(); while (num3 > 0 && num6 > 0) { if (!item.IsOwnerOrUnassigned()) { flag2 = true; } if (flag2) { break; } int num7 = Math.Min(num3, val.m_shared.m_maxStackSize); ItemData val3 = val2.Clone(); val3.m_stack = num7; val3.m_gridPos.x = -1; for (int i = 0; i < inventory2.Inventory.GetWidth(); i++) { if (val3.m_gridPos.x >= 0) { break; } for (int j = 0; j < inventory2.Inventory.GetHeight(); j++) { if (hashSet.Add(new Vector2i(i, j))) { ref int x = ref val3.m_gridPos.x; ref int y = ref val3.m_gridPos.y; int num8 = i; int num9 = j; x = num8; y = num9; break; } } } inventory2.Items.Add(val3); num3 -= num7; num6--; } if (flag2) { ContainerRegistryProcessor obj = Processor.Instance<ContainerRegistryProcessor>(); vars = stackContainerState.PlayerZDO.Vars; obj.RequestOwnership(item, ((ZDOVars)(ref vars)).GetPlayerID(0L), state2, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.AutoStore\\ContainerProcessor.cs", 396); continue; } if (num3 != val.m_stack) { inventory2.Save(); ItemData val4 = val; int num9 = num3; int stack = val.m_stack; val4.m_stack = num9; num3 = stack; flag = true; } if (val.m_stack != 0) { continue; } inventory.Items.RemoveAt(num); break; } if (list != null) { foreach (ServersideQoLZDO item3 in list) { current.Remove(item3); } } if (val.m_stack == 0) { break; } } } finally { ((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } } if (flag) { inventory.Save(); } return flag; } } [Processor("5f86a765-e449-4047-afc8-a63e4d681a48")] [RunAfter<ContainerRegistryProcessor>] [RunAfter<TameableRegistryProcessor>] public sealed class ItemDropProcessor : Processor<ItemDropProcessor.PrefabInfo> { public sealed record PrefabInfo(ItemDrop ItemDrop, Piece? Piece, EggGrow? EggGrow, ZSyncTransform? ZSyncTransform) : ProcessorPrefabInfo() { [CompilerGenerated] public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("PrefabInfo"); stringBuilder.Append(" { "); if (((ProcessorPrefabInfo)this).PrintMembers(stringBuilder)) { stringBuilder.Append(' '); } stringBuilder.Append('}'); return stringBuilder.ToString(); } [CompilerGenerated] protected override bool PrintMembers(StringBuilder builder) { if (((ProcessorPrefabInfo)this).PrintMembers(builder)) { builder.Append(", "); } builder.Append("ItemDrop = "); builder.Append(ItemDrop); builder.Append(", Piece = "); builder.Append(Piece); builder.Append(", EggGrow = "); builder.Append(EggGrow); builder.Append(", ZSyncTransform = "); builder.Append(ZSyncTransform); return true; } [CompilerGenerated] public override int GetHashCode() { return (((((ProcessorPrefabInfo)this).GetHashCode() * -1521134295 + EqualityComparer<ItemDrop>.Default.GetHashCode(ItemDrop)) * -1521134295 + EqualityComparer<Piece>.Default.GetHashCode(Piece)) * -1521134295 + EqualityComparer<EggGrow>.Default.GetHashCode(EggGrow)) * -1521134295 + EqualityComparer<ZSyncTransform>.Default.GetHashCode(ZSyncTransform); } [CompilerGenerated] public sealed override bool Equals(ProcessorPrefabInfo? other) { return ((object)this).Equals((object?)other); } [CompilerGenerated] public bool Equals(PrefabInfo? other) { return (object)this == other || (((ProcessorPrefabInfo)this).Equals((ProcessorPrefabInfo)(object)other) && EqualityComparer<ItemDrop>.Default.Equals(ItemDrop, other.ItemDrop) && EqualityComparer<Piece>.Default.Equals(Piece, other.Piece) && EqualityComparer<EggGrow>.Default.Equals(EggGrow, other.EggGrow) && EqualityComparer<ZSyncTransform>.Default.Equals(ZSyncTransform, other.ZSyncTransform)); } [CompilerGenerated] private PrefabInfo(PrefabInfo original) : base((ProcessorPrefabInfo)(object)original) { ItemDrop = original.ItemDrop; Piece = original.Piece; EggGrow = original.EggGrow; ZSyncTransform = original.ZSyncTransform; } } private readonly Dictionary<ServersideQoLZDO, DateTimeOffset> _eggDropTime = new Dictionary<ServersideQoLZDO, DateTimeOffset>(); private SectorDictionary<HashSet<ServersideQoLZDO>>? _itemDrops; private SectorDictionary<SharedItemDataKey, HashSet<ServersideQoLZDO>>? _containersByItemName; protected override void Initialize() { Processor.Instance<ContainerRegistryProcessor>().ContainerChanged -= OnContainerChanged; if (ConfigBase<Config>.Instance.AutoPickup.Value) { _containersByItemName = Processor.Instance<ContainerRegistryProcessor>().GetContainersByItemName(Mathf.Max(ConfigBase<Config>.Instance.AutoPickupRange.Value, (float)ConfigBase<Config>.Instance.AutoPickupMaxRange.GetValueOrDefault())); _itemDrops = new SectorDictionary<HashSet<ServersideQoLZDO>>(_containersByItemName.SectorWidth); Processor.Instance<ContainerRegistryProcessor>().ContainerChanged += OnContainerChanged; } else { _containersByItemName = null; _itemDrops = null; } _eggDropTime.Clear(); } protected override ProcessResult Process(ServersideQoLZDO zdo, IReadOnlyList<Peer> peers, PrefabInfo prefabInfo) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0955: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0951: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Unknown result type (might be due to invalid IL or missing references) //IL_0901: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Expected O, but got Unknown //IL_0920: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_052b: Unknown result type (might be due to invalid IL or missing references) //IL_0532: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_0843: Unknown result type (might be due to invalid IL or missing references) //IL_06cd: Unknown result type (might be due to invalid IL or missing references) if (_containersByItemName == null || _itemDrops == null) { return (ProcessResult)2; } ZDOVars vars; if (prefabInfo.Piece != null) { vars = zdo.Vars; if (((ZDOVars)(ref vars)).GetPiece(false)) { return (ProcessResult)2; } } if (prefabInfo.EggGrow != null) { vars = zdo.Vars; if (((ZDOVars)(ref vars)).GetGrowStart(0f) > 0f) { return (ProcessResult)1; } if (!_eggDropTime.TryGetValue(zdo, out var value)) { _eggDropTime.Add(zdo, DateTimeOffset.UtcNow); zdo.Destroyed += delegate(ServersideQoLZDO key) { _eggDropTime.Remove(key); }; return (ProcessResult)32; } if (DateTimeOffset.UtcNow - value < TimeSpan.FromSeconds(2f * prefabInfo.EggGrow.m_updateInterval + 2f)) { return (ProcessResult)32; } } if (!Processor.CheckMinDistance(peers, zdo, ConfigBase<Config>.Instance.AutoPickupMinPlayerDistance.Value)) { return (ProcessResult)32; } SharedData shared = prefabInfo.ItemDrop.m_itemData.m_shared; bool flag = false; bool flag2 = !ConfigBase<Config>.Instance.AutoPickupExcludeFodder.Value; HashSet<Vector2i> hashSet = null; List<ServersideQoLZDO> list = null; ItemData val = null; AdjacentEnumerator<SharedItemDataKey, HashSet<ServersideQoLZDO>> enumerator = _containersByItemName.EnumerateAdjacent((zdo.ZDO.GetPosition(), SharedItemDataKey.op_Implicit(shared))).GetEnumerator(); try { while (enumerator.MoveNext()) { HashSet<ServersideQoLZDO> current = enumerator.Current; if (current.Count > 0 && !flag2) { flag2 = true; AdjacentEnumerator<HashSet<ServersideQoLZDO>> enumerator2 = Processor.Instance<TameableRegistryProcessor>().Tameables.EnumerateAdjacent(zdo.ZDO.GetPosition()).GetEnumerator(); try { while (enumerator2.MoveNext()) { HashSet<ServersideQoLZDO> current2 = enumerator2.Current; foreach (ServersideQoLZDO item in current2) { TameableState state = Processor.Instance<TameableRegistryProcessor>().GetState(item); if (state == null || !state.PrefabInfo.MonsterAI.m_consumeItems.Any((ItemDrop val6) => val6.m_itemData.m_shared.m_name == shared.m_name)) { continue; } float consumeSearchRange = state.PrefabInfo.MonsterAI.m_consumeSearchRange; consumeSearchRange *= consumeSearchRange; if (!(Utils.DistanceSqr(zdo.ZDO.GetPosition(), item.ZDO.GetPosition()) < consumeSearchRange)) { continue; } if (prefabInfo.ZSyncTransform != null && zdo.GetTimeSinceSpawned() < TimeSpan.FromSeconds(10.0)) { return (ProcessResult)32; } ProcessResult result = (ProcessResult)2; ComponentFieldAccessor<ItemDrop> val2 = zdo.Fields<ItemDrop>(); if (val2.UpdateValue((Func<Expression<Func<ItemDrop, bool>>>)(() => (ItemDrop val6) => val6.m_autoPickup), false, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.AutoStore\\ItemDropProcessor.cs", 90)) { result = (ProcessResult)8; } if (val2.UpdateValue((Func<Expression<Func<ItemDrop, bool>>>)(() => (ItemDrop val6) => val6.m_autoDestroy), false, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.AutoStore\\ItemDropProcessor.cs", 92)) { result = (ProcessResult)8; } return result; } } } finally { ((IDisposable)enumerator2/*cast due to .constrained prefix*/).Dispose(); } } list?.Clear(); foreach (ServersideQoLZDO item2 in current) { ContainerState state2 = Processor.Instance<ContainerRegistryProcessor>().GetState(item2); if (state2 == null) { (list ?? (list = new List<ServersideQoLZDO>())).Add(item2); continue; } vars = item2.Vars; if (((ZDOVars)(ref vars)).GetInUse(false)) { continue; } float num = state2.PickupRange ?? ConfigBase<Config>.Instance.AutoPickupRange.Value; num *= num; if (num == 0f || Utils.DistanceSqr(zdo.ZDO.GetPosition(), item2.ZDO.GetPosition()) > num) { continue; } if (val == null) { val = new ItemData { m_shared = shared }; ItemDrop.LoadFromZDO(val, zdo.ZDO, -1); } int num2 = val.m_stack; (hashSet ?? (hashSet = new HashSet<Vector2i>())).Clear(); bool flag3 = false; ItemData val3 = null; IInventory inventory = state2.GetInventory(); foreach (ItemData item3 in inventory.Items) { hashSet.Add(item3.m_gridPos); if (new ItemDataKey(val) != ItemDataKey.op_Implicit(item3)) { continue; } if (val3 == null) { val3 = item3; } int num3 = item3.m_shared.m_maxStackSize - item3.m_stack; if (num3 > 0) { if (ConfigBase<Config>.Instance.AutoPickupRequestOwnership.Value && !zdo.IsOwnerOrUnassigned()) { flag = true; } if (!item2.IsOwnerOrUnassigned()) { flag3 = true; } if (flag || flag3) { break; } int num4 = Math.Min(num2, num3); item3.m_stack += num4; num2 -= num4; if (num2 == 0) { break; } } } if (val3 == null) { (list ?? (list = new List<ServersideQoLZDO>())).Add(item2); continue; } int num5 = inventory.Inventory.GetEmptySlots(); while (num2 > 0 && num5 > 0) { if (ConfigBase<Config>.Instance.AutoPickupRequestOwnership.Value && !zdo.IsOwnerOrUnassigned()) { flag = true; } if (!item2.IsOwnerOrUnassigned()) { flag3 = true; } if (flag || flag3) { break; } int num6 = Math.Min(num2, val.m_shared.m_maxStackSize); ItemData val4 = val3.Clone(); val4.m_stack = num6; val4.m_gridPos.x = -1; for (int num7 = 0; num7 < inventory.Inventory.GetWidth(); num7++) { if (val4.m_gridPos.x >= 0) { break; } for (int num8 = 0; num8 < inventory.Inventory.GetHeight(); num8++) { if (hashSet.Add(new Vector2i(num7, num8))) { ref int x = ref val4.m_gridPos.x; ref int y = ref val4.m_gridPos.y; int num9 = num7; int num10 = num8; x = num9; y = num10; break; } } } inventory.Items.Add(val4); num2 -= num6; num5--; } if (flag || flag3) { if (flag3) { Processor.Instance<ContainerRegistryProcessor>().RequestOwnership(item2, 0L, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.AutoStore\\ItemDropProcessor.cs", 196); } continue; } if (num2 != val.m_stack) { inventory.Save(); ItemData val5 = val; int num10 = num2; int stack = val.m_stack; val5.m_stack = num10; num2 = stack; ItemDrop.SaveToZDO(val, zdo.ZDO, -1); Processor.ShowMessage((IEnumerable<Peer>)peers, item2, ConfigBase<Config>.Instance.Localization.Value.FormatAutoPickup(state2.PrefabInfo.Container.m_name, val.m_shared.m_name, num2), ConfigBase<Config>.Instance.PickedUpMessageType.Value, (TextType)0); } if (val.m_stack != 0) { continue; } break; } if (list != null) { foreach (ServersideQoLZDO item4 in list) { current.Remove(item4); } } int? num11 = val?.m_stack; if (num11.HasValue && num11.GetValueOrDefault() == 0) { return (ProcessResult)4; } if (flag) { RPC.RequestOwn(zdo, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.AutoStore\\ItemDropProcessor.cs", 225); return (ProcessResult)48; } } } finally { ((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } SectorDictionary.TryAdd(_itemDrops, zdo, true); return (ProcessResult)1; } private void OnContainerChanged(ServersideQoLZDO containerZdo, ContainerState containerState) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) if (_itemDrops == null) { Processor.Instance<ContainerRegistryProcessor>().ContainerChanged -= OnContainerChanged; } else { if (containerState.GetInventory().Items.Count == 0) { return; } float num = containerState.PickupRange ?? ConfigBase<Config>.Instance.AutoPickupRange.Value; num *= num; if (num == 0f) { return; } AdjacentEnumerator<HashSet<ServersideQoLZDO>> enumerator = _itemDrops.EnumerateAdjacent(containerZdo.ZDO.GetPosition()).GetEnumerator(); try { while (enumerator.MoveNext()) { HashSet<ServersideQoLZDO> current = enumerator.Current; foreach (ServersideQoLZDO item in current) { if (Utils.DistanceSqr(item.ZDO.GetPosition(), containerZdo.ZDO.GetPosition()) <= num) { ((Processor)this).ScheduleReprocessing(item); } } } } finally { ((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } } } } }