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 ContainerSigns v2.4.4
ServersideQoL.ContainerSigns.dll
Decompiled 5 days 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.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using Microsoft.CodeAnalysis; using ServersideQoL.Processors; using ServersideQoL.Utilities; using UnityEngine; using YamlDotNet.Serialization; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ArgusMagnus")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("ArgusMagnus")] [assembly: AssemblyDescription("Adds signs to chests and barrels. Optionally show automated content list and configure the container for other SQoL mods.")] [assembly: AssemblyFileVersion("2.4.4.0")] [assembly: AssemblyInformationalVersion("2.4.4+ba0fb1094844e7ab2a99f1c650d1dc969eeb654f")] [assembly: AssemblyProduct("ServersideQoL.ContainerSigns")] [assembly: AssemblyTitle("ServersideQoL.ContainerSigns")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ArgusMagnus/ValheimServersideQoL")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.4.4.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [CompilerGenerated] internal sealed class <>z__ReadOnlySingleElementList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator<T> { object IEnumerator.Current => _item; T IEnumerator<T>.Current => _item; public Enumerator(T item) { _item = item; } bool IEnumerator.MoveNext() { if (!_moveNextCalled) { return _moveNextCalled = true; } return false; } void IEnumerator.Reset() { _moveNextCalled = false; } void IDisposable.Dispose() { } } int ICollection.Count => 1; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection<T>.Count => 1; T IReadOnlyList<T>.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } } int ICollection<T>.Count => 1; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } public <>z__ReadOnlySingleElementList(T item) { _item = item; } IEnumerator IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.CopyTo(Array array, int index) { array.SetValue(_item, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return EqualityComparer<T>.Default.Equals(_item, (T)value); } int IList.IndexOf(object value) { if (!EqualityComparer<T>.Default.Equals(_item, (T)value)) { return -1; } return 0; } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return new Enumerator(_item); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return EqualityComparer<T>.Default.Equals(_item, item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { array[arrayIndex] = _item; } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { if (!EqualityComparer<T>.Default.Equals(_item, item)) { return -1; } return 0; } 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.ContainerSigns { public sealed class Config : ConfigBase<Config> { [Flags] public enum SignOptions { None = 0, Left = 1, Right = 2, Front = 4, Back = 8, TopLongitudinal = 0x10, TopLateral = 0x20 } public sealed class AdvancedConfig { public sealed record ChestSignOffset(float Left, float Right, float Front, float Back, float VerticalOffset, float Top) { private ChestSignOffset() : this(float.NaN, float.NaN, float.NaN, float.NaN, float.NaN, float.NaN) { } } [CompilerGenerated] private IReadOnlyDictionary<int, ChestSignOffset> <ChestSignOffsets>k__BackingField; [YamlMember(Alias = "ChestSignOffsets")] private Dictionary<string, ChestSignOffset> ChestSignOffsetsYaml { get; init; } = new Dictionary<string, ChestSignOffset> { ["piece_chest_wood"] = new ChestSignOffset(0.8f, 0.8f, 0.4f, 0.4f, 0.4f, 0.8f), ["piece_chest"] = new ChestSignOffset(0.85f, 0.85f, 0.5f, 0.5f, 0.55f, 1.1f), ["piece_chest_blackmetal"] = new ChestSignOffset(0.95f, 0.95f, 0.7f, 0.7f, 0.475f, 0.95f), ["piece_chest_grausten"] = new ChestSignOffset(0.8f, 0.8f, 0.5f, 0.5f, 0.5f, 1.2f), ["piece_chest_warderobe"] = new ChestSignOffset(0.8f, 0.8f, 0.5f, 0.5f, 1f, 2.7f), ["piece_chest_barrel"] = new ChestSignOffset(0.4f, 0.4f, 0.4f, 0.4f, 0.45f, 0.9f), ["incinerator"] = new ChestSignOffset(float.NaN, float.NaN, 0.1f, float.NaN, 1.75f, float.NaN) }; [YamlIgnore] public IReadOnlyDictionary<int, ChestSignOffset> ChestSignOffsets { get { return <ChestSignOffsets>k__BackingField ?? (<ChestSignOffsets>k__BackingField = ChestSignOffsetsYaml.ToDictionary<KeyValuePair<string, ChestSignOffset>, int, ChestSignOffset>((KeyValuePair<string, ChestSignOffset> x) => StringExtensionMethods.GetStableHashCode(x.Key), (KeyValuePair<string, ChestSignOffset> x) => x.Value)); } private set { <ChestSignOffsets>k__BackingField = value; } } internal void Reset() { ChestSignOffsets = null; } } private const string DefaultPlaceholderString = "•"; public override ConfigEntry<bool> Enabled { get; } = ConfigBase<Config>.BindEx<bool>(cfg, true, "Enables/disables the entire mod", (IAcceptableValueBase<bool>)null, (Deprecated<Config>)null, "Enabled"); public ConfigEntry<string> SignConnectText { get; } = ConfigBase<Config>.BindEx<string>(cfg, "•", "If a sign text is set to this value, the sign is connected to the closest container", (IAcceptableValueBase<string>)null, (Deprecated<Config>)null, "SignConnectText"); public ConfigEntry<string> ChestSignsDefaultText { get; } = ConfigBase<Config>.BindEx<string>(cfg, "•", "Default text for chest signs", (IAcceptableValueBase<string>)null, (Deprecated<Config>)null, "ChestSignsDefaultText"); public ConfigEntry<string> ChestSignsContentListPlaceholder { get; } = ConfigBase<Config>.BindEx<string>(cfg, "•", "If this value is found in the text of a chest sign, it will be replaced by a list of contained items in that chest", (IAcceptableValueBase<string>)null, (Deprecated<Config>)null, "ChestSignsContentListPlaceholder"); public ConfigEntry<int> ChestSignsContentListMaxCount { get; } = ConfigBase<Config>.BindEx<int>(cfg, 3, "Max number of entries to show in the content list on chest signs.", (IAcceptableValueBase<int>)null, (Deprecated<Config>)null, "ChestSignsContentListMaxCount"); public ConfigEntry<string> ChestSignsContentListSeparator { get; } = ConfigBase<Config>.BindEx<string>(cfg, "<br>", "Separator to use for content lists on chest signs", (IAcceptableValueBase<string>)null, (Deprecated<Config>)null, "ChestSignsContentListSeparator"); public ConfigEntry<string> ChestSignsContentListNameRest { get; } = ConfigBase<Config>.BindEx<string>(cfg, "Other", "Text to show for the entry summarizing the rest of the items", (IAcceptableValueBase<string>)null, (Deprecated<Config>)null, "ChestSignsContentListNameRest"); public ConfigEntry<string> ChestSignsContentListEntryFormat { get; } = ConfigBase<Config>.BindEx<string>(cfg, "{0} {1}", "Format string for entries in the content list, the first argument is the name of the item, the second is the total number of per item.", (IAcceptableValueBase<string>)new AcceptableFormatString(new object[2] { "Test", 0 }), (Deprecated<Config>)null, "ChestSignsContentListEntryFormat"); public bool AutoStorePickup => Shared.AutoStorePickup?.Value ?? false; public int? AutoStorePickupMaxRange => Shared.AutoStorePickupMaxRange?.Value; public ConfigEntry<string>? AutoStorePickupRangeSignPrefix => Shared.AutoStorePickupRangeSignPrefix; public bool AutoProcessFeedFromContainers => Shared.AutoProcessFeedFromContainers?.Value ?? false; public int? AutoProcessFeedFromContainersMaxRange => Shared.AutoProcessFeedFromContainersMaxRange?.Value; public ConfigEntry<string>? AutoProcessFeedFromContainersRangeSignPrefix => Shared.AutoProcessFeedFromContainersRangeSignPrefix; public bool TameAssistFeedFromContainers => Shared.TameAssistFeedFromContainers?.Value ?? false; public int? TameAssistFeedFromContainersMaxRange => Shared.TameAssistFeedFromContainersMaxRange?.Value; public ConfigEntry<string>? TameAssistFeedFromContainersRangeSignPrefix => Shared.TameAssistFeedFromContainersRangeSignPrefix; public ConfigEntry<SignOptions> WoodChestSigns { get; } = ConfigBase<Config>.BindEx<SignOptions>(cfg, SignOptions.None, "Options to automatically put signs on wood chests", (IAcceptableValueBase<SignOptions>)(object)AcceptableEnum<SignOptions>.Default, (Deprecated<Config>)null, "WoodChestSigns"); public ConfigEntry<SignOptions> ReinforcedChestSigns { get; } = ConfigBase<Config>.BindEx<SignOptions>(cfg, SignOptions.None, "Options to automatically put signs on reinforced chests", (IAcceptableValueBase<SignOptions>)(object)AcceptableEnum<SignOptions>.Default, (Deprecated<Config>)null, "ReinforcedChestSigns"); public ConfigEntry<SignOptions> BlackmetalChestSigns { get; } = ConfigBase<Config>.BindEx<SignOptions>(cfg, SignOptions.None, "Options to automatically put signs on blackmetal chests", (IAcceptableValueBase<SignOptions>)(object)AcceptableEnum<SignOptions>.Default, (Deprecated<Config>)null, "BlackmetalChestSigns"); public ConfigEntry<SignOptions> GraustenChestSigns { get; } = ConfigBase<Config>.BindEx<SignOptions>(cfg, SignOptions.None, "Options to automatically put signs on grausten chests", (IAcceptableValueBase<SignOptions>)(object)AcceptableEnum<SignOptions>.Default, (Deprecated<Config>)null, "GraustenChestSigns"); public ConfigEntry<SignOptions> WardrobeSigns { get; } = ConfigBase<Config>.BindEx<SignOptions>(cfg, SignOptions.None, "Options to automatically put signs on wardrobes", (IAcceptableValueBase<SignOptions>)(object)AcceptableEnum<SignOptions>.Default, (Deprecated<Config>)null, "WardrobeSigns"); public ConfigEntry<SignOptions> BarrelSigns { get; } = ConfigBase<Config>.BindEx<SignOptions>(cfg, SignOptions.None, "Options to automatically put signs on barrels", (IAcceptableValueBase<SignOptions>)(object)AcceptableEnum<SignOptions>.Default, (Deprecated<Config>)null, "BarrelSigns"); public ConfigEntry<SignOptions> ObliteratorSigns { get; } = ConfigBase<Config>.BindEx<SignOptions>(cfg, SignOptions.None, "Options to automatically put signs on obliterators", (IAcceptableValueBase<SignOptions>)(object)new AcceptableEnum<SignOptions>((IEnumerable<SignOptions>)new <>z__ReadOnlySingleElementList<SignOptions>(SignOptions.Front)), (Deprecated<Config>)null, "ObliteratorSigns"); public ConfigEntry<bool> ManuallyConnectedSignsReplaceAutoSigns { get; } = ConfigBase<Config>.BindEx<bool>(cfg, false, "If true, a player-placed sign that is connected to a chest via the SignConnectText option replaces automatically placed signs,\r\nmeaning the automatic signs will be removed from the chest until all manually connected signs are destroyed.", (IAcceptableValueBase<bool>)null, (Deprecated<Config>)null, "ManuallyConnectedSignsReplaceAutoSigns"); public YamlConfigEntry<AdvancedConfig> Advanced { get; } = ConfigBase<Config>.BindYaml<AdvancedConfig>(cfg, (Action<AdvancedConfig>)delegate(AdvancedConfig x) { x.Reset(); }, "Advanced"); public Config(ConfigFile cfg, Logger logger) : base(cfg, logger) { }//IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown internal SignOptions GetSignOptions(int prefab) { if (prefab == Prefabs.WoodChest) { return WoodChestSigns.Value; } if (prefab == Prefabs.ReinforcedChest) { return ReinforcedChestSigns.Value; } if (prefab == Prefabs.BlackmetalChest) { return BlackmetalChestSigns.Value; } if (prefab == Prefabs.GraustenChest) { return GraustenChestSigns.Value; } if (prefab == Prefabs.Wardrobe) { return WardrobeSigns.Value; } if (prefab == Prefabs.Barrel) { return BarrelSigns.Value; } if (prefab == Prefabs.Incinerator) { return ObliteratorSigns.Value; } return SignOptions.None; } } [Processor("bbbb47b4-3b9f-4d63-8bb2-a6f388ae1180")] [RunAfter<ContainerRegistryProcessor>] public sealed class ContainerAndSignProcessor : Processor<ContainerAndSignProcessor.PrefabInfo> { public sealed record PrefabInfo(Container? Container, Sign? Sign) : ProcessorPrefabInfo() { public override bool IsValid { get { if (Sign == null) { if (Container != null && ((ProcessorPrefabInfo)this).PrefabInfo.HasComponent<Piece>() && ((ProcessorPrefabInfo)this).PrefabInfo.HasComponent<PieceTable>()) { return !((ProcessorPrefabInfo)this).PrefabInfo.HasComponent<ZSyncTransform>(); } return false; } return true; } } [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("Container = "); builder.Append(Container); builder.Append(", Sign = "); builder.Append(Sign); return true; } [CompilerGenerated] public override int GetHashCode() { return (((ProcessorPrefabInfo)this).GetHashCode() * -1521134295 + EqualityComparer<Container>.Default.GetHashCode(Container)) * -1521134295 + EqualityComparer<Sign>.Default.GetHashCode(Sign); } [CompilerGenerated] public sealed override bool Equals(ProcessorPrefabInfo? other) { return ((object)this).Equals((object?)other); } [CompilerGenerated] public bool Equals(PrefabInfo? other) { if ((object)this != other) { if (((ProcessorPrefabInfo)this).Equals((ProcessorPrefabInfo)(object)other) && EqualityComparer<Container>.Default.Equals(Container, other.Container)) { return EqualityComparer<Sign>.Default.Equals(Sign, other.Sign); } return false; } return true; } [CompilerGenerated] private PrefabInfo(PrefabInfo original) : base((ProcessorPrefabInfo)(object)original) { Container = original.Container; Sign = original.Sign; } } public const string Id = "bbbb47b4-3b9f-4d63-8bb2-a6f388ae1180"; private readonly Dictionary<ServersideQoLZDO, List<ServersideQoLZDO>> _signsByChests = new Dictionary<ServersideQoLZDO, List<ServersideQoLZDO>>(); private readonly Dictionary<ServersideQoLZDO, List<ServersideQoLZDO>> _userSignsByChests = new Dictionary<ServersideQoLZDO, List<ServersideQoLZDO>>(); private readonly Dictionary<ServersideQoLZDO, ServersideQoLZDO> _chestsBySigns = new Dictionary<ServersideQoLZDO, ServersideQoLZDO>(); private SectorDictionary<HashSet<ServersideQoLZDO>>? _containers; private Regex? _chestAutoStorePickupRangeRegex; private Regex? _chestAutoProcessFeedRangeRegex; private Regex? _chestTameAssistFeedRangeRegex; private const string ContentListStart = "<i ls></i>"; private const string ContentListEnd = "<i le></i>"; private readonly Regex _contentListRegex = new Regex("<i ls></i>.*?<i le></i>"); private Regex _contentListRegex2; private readonly Dictionary<ServersideQoLZDO, uint> _chestDataRevisions = new Dictionary<ServersideQoLZDO, uint>(); private static readonly ServerVar<bool> __connectToChest = ServersideQoLPluginBaseCore<ContainerSignsPlugin, Config>.RegisterServerVar<bool>("ConnectToChest"); protected override void Initialize() { foreach (ServersideQoLZDO key in _chestsBySigns.Keys) { key.Destroyed -= OnAutoSignDestroyed; ((Processor)this).TryDestroyObject(key); } _signsByChests.Clear(); _userSignsByChests.Clear(); _chestsBySigns.Clear(); if (ConfigBase<Config>.Instance.AutoStorePickupRangeSignPrefix != null) { ConfigBase<Config>.Instance.AutoStorePickupRangeSignPrefix.SettingChanged -= OnConfigChanged; OnConfigChanged(null, null); ConfigBase<Config>.Instance.AutoStorePickupRangeSignPrefix.SettingChanged += OnConfigChanged; } if (ConfigBase<Config>.Instance.AutoProcessFeedFromContainersRangeSignPrefix != null) { ConfigBase<Config>.Instance.AutoProcessFeedFromContainersRangeSignPrefix.SettingChanged -= OnConfigChanged2; OnConfigChanged2(null, null); ConfigBase<Config>.Instance.AutoProcessFeedFromContainersRangeSignPrefix.SettingChanged += OnConfigChanged2; } if (ConfigBase<Config>.Instance.TameAssistFeedFromContainersRangeSignPrefix != null) { ConfigBase<Config>.Instance.TameAssistFeedFromContainersRangeSignPrefix.SettingChanged -= OnConfigChanged3; OnConfigChanged3(null, null); ConfigBase<Config>.Instance.TameAssistFeedFromContainersRangeSignPrefix.SettingChanged += OnConfigChanged3; } _contentListRegex2 = new Regex(Regex.Escape(ConfigBase<Config>.Instance.ChestSignsContentListPlaceholder.Value)); _chestDataRevisions.Clear(); Processor.Instance<ContainerRegistryProcessor>().ContainerChanged -= OnContainerChanged; Processor.Instance<ContainerRegistryProcessor>().ContainerChanged += OnContainerChanged; _containers = null; if (!string.IsNullOrWhiteSpace(ConfigBase<Config>.Instance.SignConnectText.Value)) { _containers = new SectorDictionary<HashSet<ServersideQoLZDO>>(32f); } void OnConfigChanged(object? sender, EventArgs? e) { string text = ConfigBase<Config>.Instance.AutoStorePickupRangeSignPrefix?.Value ?? ""; string text2 = text.Replace("\ufe0f", ""); _chestAutoStorePickupRangeRegex = ((text == text2) ? new Regex(Regex.Escape(text) + "(?<R>\\d+)") : new Regex("(?:" + Regex.Escape(text) + "|" + Regex.Escape(text2) + ")(?<R>\\d+)")); } void OnConfigChanged2(object? sender, EventArgs? e) { string text = ConfigBase<Config>.Instance.AutoProcessFeedFromContainersRangeSignPrefix?.Value ?? ""; string text2 = text.Replace("\ufe0f", ""); _chestAutoProcessFeedRangeRegex = ((text == text2) ? new Regex(Regex.Escape(text) + "(?<R>\\d+)") : new Regex("(?:" + Regex.Escape(text) + "|" + Regex.Escape(text2) + ")(?<R>\\d+)")); } void OnConfigChanged3(object? sender, EventArgs? e) { string text = ConfigBase<Config>.Instance.TameAssistFeedFromContainersRangeSignPrefix?.Value ?? ""; string text2 = text.Replace("\ufe0f", ""); _chestTameAssistFeedRangeRegex = ((text == text2) ? new Regex(Regex.Escape(text) + "(?<R>\\d+)") : new Regex("(?:" + Regex.Escape(text) + "|" + Regex.Escape(text2) + ")(?<R>\\d+)")); } } protected override bool ClaimExclusive(ServersideQoLZDO zdo) { return false; } protected override ProcessResult Process(ServersideQoLZDO zdo, IReadOnlyList<Peer> peers, PrefabInfo prefabInfo) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0748: Unknown result type (might be due to invalid IL or missing references) //IL_074d: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_04c9: Unknown result type (might be due to invalid IL or missing references) //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: 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_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_0970: Unknown result type (might be due to invalid IL or missing references) //IL_0975: Unknown result type (might be due to invalid IL or missing references) //IL_094b: Unknown result type (might be due to invalid IL or missing references) //IL_0950: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0219: 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_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_09be: Unknown result type (might be due to invalid IL or missing references) //IL_09c3: Unknown result type (might be due to invalid IL or missing references) //IL_09a5: Unknown result type (might be due to invalid IL or missing references) //IL_09ab: Unknown result type (might be due to invalid IL or missing references) //IL_09b2: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_0592: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_05ee: Unknown result type (might be due to invalid IL or missing references) //IL_05f3: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_05dc: Unknown result type (might be due to invalid IL or missing references) //IL_06c8: Unknown result type (might be due to invalid IL or missing references) //IL_06d2: Expected O, but got Unknown //IL_06e5: Unknown result type (might be due to invalid IL or missing references) //IL_06ef: Expected O, but got Unknown //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Expected O, but got Unknown //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Expected O, but got Unknown ZDOVars vars; if (prefabInfo.Container != null) { ProcessResult val = (ProcessResult)2; if (_containers != null) { SectorDictionary.TryAdd(_containers, zdo, true); val = (ProcessResult)(val | 0x40); } Config instance = ConfigBase<Config>.Instance; Config.SignOptions signOptions = instance.GetSignOptions(zdo.ZDO.GetPrefab()); if (signOptions == Config.SignOptions.None || !instance.Advanced.Value.ChestSignOffsets.TryGetValue(zdo.ZDO.GetPrefab(), out Config.AdvancedConfig.ChestSignOffset value)) { return val; } if (!_signsByChests.ContainsKey(zdo) && (!ConfigBase<Config>.Instance.ManuallyConnectedSignsReplaceAutoSigns.Value || !_userSignsByChests.TryGetValue(zdo, out List<ServersideQoLZDO> value2) || value2.Count == 0)) { vars = zdo.Vars; string text = ((ZDOVars)(ref vars)).GetText((string)null); if (text == null) { if (!zdo.IsOwnerOrUnassigned()) { return ((Processor)this).ScheduleReprocessing(Processor.Instance<ContainerRegistryProcessor>().RequestOwnership(zdo, default(PlayerID))); } vars = zdo.Vars; ((ZDOVars)(ref vars)).SetText(text = instance.ChestSignsDefaultText.Value, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.ContainerSigns\\ContainerAndSignProcessor.cs", 134); } Vector3 position = zdo.ZDO.GetPosition(); Quaternion rotation = zdo.ZDO.GetRotation(); float num = ((Quaternion)(ref rotation)).eulerAngles.y + 90f; List<ServersideQoLZDO> list = new List<ServersideQoLZDO>(); position.y += value.VerticalOffset; if (signOptions.HasFlag(Config.SignOptions.Left)) { list.Add(((Processor)this).PlacePiece(position + rotation * Vector3.right * value.Left, Prefabs.Sign, num)); } if (signOptions.HasFlag(Config.SignOptions.Right)) { list.Add(((Processor)this).PlacePiece(position + rotation * Vector3.left * value.Right, Prefabs.Sign, num + 180f)); } if (signOptions.HasFlag(Config.SignOptions.Front)) { list.Add(((Processor)this).PlacePiece(position + rotation * Vector3.forward * value.Front, Prefabs.Sign, num + 270f)); } if (signOptions.HasFlag(Config.SignOptions.Back)) { list.Add(((Processor)this).PlacePiece(position + rotation * Vector3.back * value.Back, Prefabs.Sign, num + 90f)); } position = zdo.ZDO.GetPosition(); position.y += value.Top; if (signOptions.HasFlag(Config.SignOptions.TopLongitudinal)) { list.Add(((Processor)this).PlacePiece(position, Prefabs.Sign, Quaternion.Euler(-90f, num - 90f, 0f))); } if (signOptions.HasFlag(Config.SignOptions.TopLateral)) { list.Add(((Processor)this).PlacePiece(position, Prefabs.Sign, Quaternion.Euler(-90f, num, 0f))); } _signsByChests.Add(zdo, list); foreach (ServersideQoLZDO item in list) { _chestsBySigns.Add(item, zdo); vars = item.Vars; ((ZDOVars)(ref vars)).SetText(text, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.ContainerSigns\\ContainerAndSignProcessor.cs", 159); item.Fields<WearNTear>().Set((Func<Expression<Func<WearNTear, bool>>>)(() => (WearNTear x) => x.m_supports), false, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.ContainerSigns\\ContainerAndSignProcessor.cs", 160); item.Destroyed += OnAutoSignDestroyed; } zdo.Destroyed -= OnChestDestroyed; zdo.Destroyed += OnChestDestroyed; zdo.Recreated -= new RecreatedHandler(OnChestRecreated); zdo.Recreated += new RecreatedHandler(OnChestRecreated); } return val; } ServersideQoLZDO chest; ContainerState containerState; bool found; if (prefabInfo.Sign != null) { string text2 = null; string text3 = null; if (!_chestsBySigns.TryGetValue(zdo, out chest)) { if (_containers == null) { return (ProcessResult)2; } if (text2 == null) { vars = zdo.Vars; text2 = ((ZDOVars)(ref vars)).GetText(""); } if (text3 == null) { text3 = text2; } if (!__connectToChest.Get(zdo, false) && StringExtensionMethods.RemoveRichTextTags(text2) != ConfigBase<Config>.Instance.SignConnectText.Value) { return (ProcessResult)0; } chest = null; float num2 = float.PositiveInfinity; AdjacentEnumerator<HashSet<ServersideQoLZDO>> enumerator2 = _containers.EnumerateAdjacent(zdo.ZDO.GetPosition()).GetEnumerator(); try { while (enumerator2.MoveNext()) { HashSet<ServersideQoLZDO> current2 = enumerator2.Current; foreach (ServersideQoLZDO item2 in current2) { float num3 = Utils.DistanceSqr(zdo.ZDO.GetPosition(), item2.ZDO.GetPosition()); if (!(num3 >= num2)) { num2 = num3; chest = item2; } } } } finally { ((IDisposable)enumerator2/*cast due to .constrained prefix*/).Dispose(); } if (chest == null) { return (ProcessResult)0; } __connectToChest.Set(zdo, true); vars = chest.Vars; string text4 = ((ZDOVars)(ref vars)).GetText((string)null); if (text4 != null) { text3 = text4; } else { if (!chest.IsOwnerOrUnassigned()) { return ((Processor)this).ScheduleReprocessing(Processor.Instance<ContainerRegistryProcessor>().RequestOwnership(chest, default(PlayerID))); } vars = chest.Vars; ((ZDOVars)(ref vars)).SetText(text3 = ConfigBase<Config>.Instance.ChestSignsDefaultText.Value, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.ContainerSigns\\ContainerAndSignProcessor.cs", 213); } _chestsBySigns.Add(zdo, chest); if (!_userSignsByChests.TryGetValue(chest, out List<ServersideQoLZDO> list2)) { _userSignsByChests.Add(chest, list2 = new List<ServersideQoLZDO>()); chest.Destroyed -= OnChestDestroyed; chest.Destroyed += OnChestDestroyed; chest.Recreated -= new RecreatedHandler(OnChestRecreated); chest.Recreated += new RecreatedHandler(OnChestRecreated); } list2.Add(zdo); zdo.Destroyed += delegate(ServersideQoLZDO val2) { list2.Remove(val2); if (_chestsBySigns.Remove(val2, out ServersideQoLZDO value4) && ConfigBase<Config>.Instance.ManuallyConnectedSignsReplaceAutoSigns.Value && list2.Count == 0) { value4.ReregisterAll(); ((Processor)this).ScheduleReprocessing(value4, 0f); } }; if (ConfigBase<Config>.Instance.ManuallyConnectedSignsReplaceAutoSigns.Value && _signsByChests.Remove(chest, out List<ServersideQoLZDO> value3)) { DestroyAutoSigns(value3); } } if (text2 == null) { vars = zdo.Vars; text2 = ((ZDOVars)(ref vars)).GetText(""); } if (text3 == null) { text3 = text2; } containerState = null; if (_chestAutoStorePickupRangeRegex != null && ConfigBase<Config>.Instance.AutoStorePickup) { int? autoStorePickupMaxRange = ConfigBase<Config>.Instance.AutoStorePickupMaxRange; if (autoStorePickupMaxRange.HasValue) { int autoPickupMaxRange = autoStorePickupMaxRange.GetValueOrDefault(); if (containerState == null) { containerState = Processor.Instance<ContainerRegistryProcessor>().GetState(chest); } containerState.AutoStorePickupRange = null; text3 = _chestAutoStorePickupRangeRegex.Replace(text3, delegate(Match match) { string result = match.Value; int num4 = int.Parse(match.Groups["R"].Value); if (num4 > autoPickupMaxRange) { num4 = autoPickupMaxRange; result = FormattableString.Invariant($"{ConfigBase<Config>.Instance.AutoStorePickupRangeSignPrefix.Value}{num4}"); } containerState.AutoStorePickupRange = num4; return result; }); } } if (_chestAutoProcessFeedRangeRegex != null && ConfigBase<Config>.Instance.AutoProcessFeedFromContainers) { int? autoStorePickupMaxRange = ConfigBase<Config>.Instance.AutoProcessFeedFromContainersMaxRange; if (autoStorePickupMaxRange.HasValue) { int feedMaxRange = autoStorePickupMaxRange.GetValueOrDefault(); if (containerState == null) { containerState = Processor.Instance<ContainerRegistryProcessor>().GetState(chest); } containerState.AutoProcessFeedRange = null; text3 = _chestAutoProcessFeedRangeRegex.Replace(text3, delegate(Match match) { string result = match.Value; int num4 = int.Parse(match.Groups["R"].Value); if (num4 > feedMaxRange) { num4 = feedMaxRange; result = FormattableString.Invariant($"{ConfigBase<Config>.Instance.AutoProcessFeedFromContainersRangeSignPrefix.Value}{num4}"); } containerState.AutoProcessFeedRange = num4; return result; }); } } if (_chestTameAssistFeedRangeRegex != null && ConfigBase<Config>.Instance.TameAssistFeedFromContainers) { int? autoStorePickupMaxRange = ConfigBase<Config>.Instance.TameAssistFeedFromContainersMaxRange; if (autoStorePickupMaxRange.HasValue) { int tamefeedMaxRange = autoStorePickupMaxRange.GetValueOrDefault(); if (containerState == null) { containerState = Processor.Instance<ContainerRegistryProcessor>().GetState(chest); } containerState.TameAssistFeedRange = null; text3 = _chestTameAssistFeedRangeRegex.Replace(text3, delegate(Match match) { string result = match.Value; int num4 = int.Parse(match.Groups["R"].Value); if (num4 > tamefeedMaxRange) { num4 = tamefeedMaxRange; result = FormattableString.Invariant($"{ConfigBase<Config>.Instance.TameAssistFeedFromContainersRangeSignPrefix.Value}{num4}"); } containerState.TameAssistFeedRange = num4; return result; }); } } found = false; text3 = _contentListRegex.Replace(text3, EvaluateMatch, 1); if (!found) { text3 = _contentListRegex2.Replace(text3, EvaluateMatch, 1); } if (text3 != text2) { vars = zdo.Vars; ((ZDOVars)(ref vars)).SetText(text2 = text3, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.ContainerSigns\\ContainerAndSignProcessor.cs", 329); } string text5 = text2; vars = chest.Vars; if (text5 != ((ZDOVars)(ref vars)).GetText("")) { if (!chest.IsOwnerOrUnassigned()) { return ((Processor)this).ScheduleReprocessing(Processor.Instance<ContainerRegistryProcessor>().RequestOwnership(chest, default(PlayerID))); } vars = chest.Vars; ((ZDOVars)(ref vars)).SetText(text2, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.ContainerSigns\\ContainerAndSignProcessor.cs", 336); } return (ProcessResult)0; } return (ProcessResult)2; string EvaluateMatch(Match match) { found = true; if (ConfigBase<Config>.Instance.ChestSignsContentListMaxCount.Value <= 0) { return ConfigBase<Config>.Instance.ChestSignsContentListPlaceholder.Value; } if (containerState == null) { containerState = Processor.Instance<ContainerRegistryProcessor>().GetState(chest); } IInventory inventory = containerState.GetInventory(); if (inventory != null) { List<ItemData> items = inventory.Items; if (items != null && items.Count > 0) { List<(string, int)> list3 = (from x in inventory.Items.GroupBy((ItemData x) => x.m_shared.m_name, (string k, IEnumerable<ItemData> g) => (Name: Localization.instance.Localize(k), Count: g.Sum((ItemData x) => x.m_stack))) orderby x.Count descending select x).ToList(); IEnumerable<(string, int)> source = list3.AsEnumerable(); if (list3.Count > ConfigBase<Config>.Instance.ChestSignsContentListMaxCount.Value) { source = list3.Take(ConfigBase<Config>.Instance.ChestSignsContentListMaxCount.Value - 1).Append((ConfigBase<Config>.Instance.ChestSignsContentListNameRest.Value, list3.Skip(ConfigBase<Config>.Instance.ChestSignsContentListMaxCount.Value - 1).Sum<(string, int)>(((string Name, int Count) x) => x.Count))); } string text6 = string.Join(ConfigBase<Config>.Instance.ChestSignsContentListSeparator.Value, source.Select<(string, int), string>(((string Name, int Count) x) => string.Format(ConfigBase<Config>.Instance.ChestSignsContentListEntryFormat.Value, x.Name, x.Count))); return "<i ls></i>" + text6 + "<i le></i>"; } } return ConfigBase<Config>.Instance.ChestSignsContentListPlaceholder.Value; } } private void OnChestDestroyed(ServersideQoLZDO zdo) { if (_signsByChests.Remove(zdo, out List<ServersideQoLZDO> value)) { DestroyAutoSigns(value); } if (!_userSignsByChests.Remove(zdo, out value)) { return; } foreach (ServersideQoLZDO item in value) { __connectToChest.Remove(item); } } private void OnChestRecreated(ServersideQoLZDO oldChest, ServersideQoLZDO newChest) { if (_signsByChests.Remove(oldChest, out List<ServersideQoLZDO> value)) { _signsByChests[newChest] = value; foreach (ServersideQoLZDO item in value) { _chestsBySigns[item] = newChest; } } if (!_userSignsByChests.Remove(oldChest, out value)) { return; } _userSignsByChests[newChest] = value; foreach (ServersideQoLZDO item2 in value) { _chestsBySigns[item2] = newChest; } } private void OnAutoSignDestroyed(ServersideQoLZDO sign) { if (_chestsBySigns.Remove(sign, out ServersideQoLZDO value) && _signsByChests.TryGetValue(value, out List<ServersideQoLZDO> value2)) { value2.Remove(sign); if (value2.Count == 0) { _signsByChests.Remove(value); } } } private void DestroyAutoSigns(List<ServersideQoLZDO> signs) { foreach (ServersideQoLZDO sign in signs) { sign.Destroyed -= OnAutoSignDestroyed; _chestsBySigns.Remove(sign); ((Processor)this).TryDestroyObject(sign); } } private void OnContainerChanged(ServersideQoLZDO zdo, ContainerState state) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) if (!_signsByChests.TryGetValue(zdo, out List<ServersideQoLZDO> value) && !_userSignsByChests.TryGetValue(zdo, out value)) { return; } uint dataRevision = zdo.ZDO.DataRevision; if (!_chestDataRevisions.TryGetValue(zdo, out var value2)) { _chestDataRevisions.Add(zdo, dataRevision); zdo.Destroyed += delegate(ServersideQoLZDO x) { _chestDataRevisions.Remove(x); }; } else { if (value2 == dataRevision) { return; } _chestDataRevisions[zdo] = dataRevision; } ZDOVars vars = zdo.Vars; string text = ((ZDOVars)(ref vars)).GetText(""); foreach (ServersideQoLZDO item in value) { vars = item.Vars; ((ZDOVars)(ref vars)).SetText(text, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.ContainerSigns\\ContainerAndSignProcessor.cs", 413); ((Processor)this).ScheduleReprocessing(item, 0f); } } } [BepInPlugin("ArgusMagnus.ServersideQoL.ContainerSigns", "ServersideQoL.ContainerSigns", "2.4.4")] public sealed class ContainerSignsPlugin : ServersideQoLPluginBase<ContainerSignsPlugin, Config> { public const string Author = "ArgusMagnus"; public const string PluginName = "ServersideQoL.ContainerSigns"; public const string PluginGuid = "ArgusMagnus.ServersideQoL.ContainerSigns"; public const string PluginVersion = "2.4.4"; public const string PluginInformationalVersion = "2.4.4"; private DateTimeOffset BuildTimestamp { get; } = new DateTimeOffset(639285926048262697L, default(TimeSpan)); protected override Config CreateConfigSingleton(ConfigFile configFile, Logger logger) { return new Config(configFile, logger); } protected override void RegisterProcessors(IProcessorCollection processors) { processors.Add<ContainerAndSignProcessor>(); } private void Awake() { } } }