using 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.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.0.4.0")] [assembly: AssemblyInformationalVersion("2.0.4+0a0af0ca3aa30d19443a0911d50026310656d882")] [assembly: AssemblyProduct("ServersideQoL.ContainerSigns")] [assembly: AssemblyTitle("ServersideQoL.ContainerSigns")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ArgusMagnus/ValheimServersideQoL")] [assembly: AssemblyVersion("2.0.4.0")] [module: RefSafetyRules(11)] [CompilerGenerated] internal sealed class <>z__ReadOnlySingleElementList : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator { object IEnumerator.Current => _item; T IEnumerator.Current => _item; public Enumerator(T item) { _item = item; } bool IEnumerator.MoveNext() { if (!_moveNextCalled) { return _moveNextCalled = true; } return false; } void IEnumerator.Reset() { _moveNextCalled = false; } void IDisposable.Dispose() { } } int ICollection.Count => 1; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection.Count => 1; T IReadOnlyList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } } int ICollection.Count => 1; bool ICollection.IsReadOnly => true; T IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } public <>z__ReadOnlySingleElementList(T item) { _item = item; } IEnumerator IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.CopyTo(Array array, int index) { array.SetValue(_item, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return EqualityComparer.Default.Equals(_item, (T)value); } int IList.IndexOf(object value) { if (!EqualityComparer.Default.Equals(_item, (T)value)) { return -1; } return 0; } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return EqualityComparer.Default.Equals(_item, item); } void ICollection.CopyTo(T[] array, int arrayIndex) { array[arrayIndex] = _item; } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { if (!EqualityComparer.Default.Equals(_item, item)) { return -1; } return 0; } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } } 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 { [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 Top) { private ChestSignOffset() : this(float.NaN, float.NaN, float.NaN, float.NaN, float.NaN) { } } [CompilerGenerated] private IReadOnlyDictionary k__BackingField; [YamlMember(Alias = "ChestSignOffsets")] private Dictionary ChestSignOffsetsYaml { get; init; } = new Dictionary { ["piece_chest_wood"] = new ChestSignOffset(0.8f, 0.8f, 0.4f, 0.4f, 0.8f), ["piece_chest"] = new ChestSignOffset(0.85f, 0.85f, 0.5f, 0.5f, 1.1f), ["piece_chest_blackmetal"] = new ChestSignOffset(0.95f, 0.95f, 0.7f, 0.7f, 0.95f), ["piece_chest_barrel"] = new ChestSignOffset(0.4f, 0.4f, 0.4f, 0.4f, 0.9f), ["incinerator"] = new ChestSignOffset(float.NaN, float.NaN, 0.1f, float.NaN, 3f) }; [YamlIgnore] public IReadOnlyDictionary ChestSignOffsets => k__BackingField ?? (k__BackingField = ChestSignOffsetsYaml.ToDictionary, int, ChestSignOffset>((KeyValuePair x) => StringExtensionMethods.GetStableHashCode(x.Key), (KeyValuePair x) => x.Value)); } private const string Section = "ContainerSigns"; private const string DefaultPlaceholderString = "•"; public override ConfigEntry Enabled { get; } = ConfigBase.BindEx(cfg, "ContainerSigns", true, "Enables/disables the entire mod", (AcceptableValueBase)null, (Deprecated)null, "Enabled"); public ConfigEntry ChestSignsDefaultText { get; } = ConfigBase.BindEx(cfg, "ContainerSigns", "•", "Default text for chest signs", (AcceptableValueBase)null, (Deprecated)null, "ChestSignsDefaultText"); public ConfigEntry ChestSignsContentListPlaceholder { get; } = ConfigBase.BindEx(cfg, "ContainerSigns", "•", "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", (AcceptableValueBase)null, (Deprecated)null, "ChestSignsContentListPlaceholder"); public ConfigEntry ChestSignsContentListMaxCount { get; } = ConfigBase.BindEx(cfg, "ContainerSigns", 3, "Max number of entries to show in the content list on chest signs.", (AcceptableValueBase)null, (Deprecated)null, "ChestSignsContentListMaxCount"); public ConfigEntry ChestSignsContentListSeparator { get; } = ConfigBase.BindEx(cfg, "ContainerSigns", "
", "Separator to use for content lists on chest signs", (AcceptableValueBase)null, (Deprecated)null, "ChestSignsContentListSeparator"); public ConfigEntry ChestSignsContentListNameRest { get; } = ConfigBase.BindEx(cfg, "ContainerSigns", "Other", "Text to show for the entry summarizing the rest of the items", (AcceptableValueBase)null, (Deprecated)null, "ChestSignsContentListNameRest"); public ConfigEntry ChestSignsContentListEntryFormat { get; } = ConfigBase.BindEx(cfg, "ContainerSigns", "{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.", (AcceptableValueBase)new AcceptableFormatString(new object[2] { "Test", 0 }), (Deprecated)null, "ChestSignsContentListEntryFormat"); public bool AutoPickup => Shared.AutoPickup?.Value ?? false; public ConfigEntry AutoPickupMaxRange { get; } = Shared.AutoPickupMaxRange = ConfigBase.BindEx(cfg, "ContainerSigns", 64, "Max auto pickup range players can set per chest (by putting '\ud83e\uddf2' on a chest sign).", (AcceptableValueBase)null, (Deprecated)null, "AutoPickupMaxRange"); public bool FeedFromContainers => Shared.FeedFromContainers?.Value ?? false; public ConfigEntry FeedFromContainersMaxRange { get; } = Shared.FeedFromContainersMaxRange = ConfigBase.BindEx(cfg, "ContainerSigns", 64, "Max feeding range players can set per chest (by putting '↔\ufe0f' on a chest sign)", (AcceptableValueBase)null, (Deprecated)null, "FeedFromContainersMaxRange"); public ConfigEntry WoodChestSigns { get; } = ConfigBase.BindEx(cfg, "ContainerSigns", SignOptions.None, "Options to automatically put signs on wood chests", (AcceptableValueBase)(object)AcceptableEnum.Default, (Deprecated)null, "WoodChestSigns"); public ConfigEntry ReinforcedChestSigns { get; } = ConfigBase.BindEx(cfg, "ContainerSigns", SignOptions.None, "Options to automatically put signs on reinforced chests", (AcceptableValueBase)(object)AcceptableEnum.Default, (Deprecated)null, "ReinforcedChestSigns"); public ConfigEntry BlackmetalChestSigns { get; } = ConfigBase.BindEx(cfg, "ContainerSigns", SignOptions.None, "Options to automatically put signs on blackmetal chests", (AcceptableValueBase)(object)AcceptableEnum.Default, (Deprecated)null, "BlackmetalChestSigns"); public ConfigEntry BarrelSigns { get; } = ConfigBase.BindEx(cfg, "ContainerSigns", SignOptions.None, "Options to automatically put signs on barrels", (AcceptableValueBase)(object)AcceptableEnum.Default, (Deprecated)null, "BarrelSigns"); public ConfigEntry ObliteratorSigns { get; } = ConfigBase.BindEx(cfg, "ContainerSigns", SignOptions.None, "Options to automatically put signs on obliterators", (AcceptableValueBase)(object)new AcceptableEnum((IEnumerable)new <>z__ReadOnlySingleElementList(SignOptions.Front)), (Deprecated)null, "ObliteratorSigns"); public YamlConfigEntry Advanced { get; } = ConfigBase.BindYaml(cfg, "Advanced"); public Config(ConfigFile cfg, Logger logger) : base(cfg, logger) { }//IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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.Barrel) { return BarrelSigns.Value; } if (prefab == Prefabs.Incinerator) { return ObliteratorSigns.Value; } return SignOptions.None; } } [Processor("bbbb47b4-3b9f-4d63-8bb2-a6f388ae1180")] public sealed class ContainerProcessor : Processor { private readonly Dictionary> _signsByChests = new Dictionary>(); private readonly Dictionary _chestsBySigns = new Dictionary(); public IReadOnlyDictionary> SignsByChests => _signsByChests; public IReadOnlyDictionary ChestsBySigns => _chestsBySigns; protected override void Initialize() { foreach (ServersideQoLZDO key in _chestsBySigns.Keys) { key.Destroy(); } _signsByChests.Clear(); _chestsBySigns.Clear(); } protected override ProcessResult Process(ServersideQoLZDO zdo, IReadOnlyList peers, PrefabInfo prefabInfo) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) Config instance = ConfigBase.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) && !_signsByChests.ContainsKey(zdo)) { ZDOVars vars = zdo.Vars; string text = ((ZDOVars)(ref vars)).GetText((string)null); if (text == null) { if (!zdo.IsOwnerOrUnassigned()) { return ((Processor)this).ScheduleReprocessing(Processor.Instance().RequestOwnership(zdo, default(PlayerID), "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.ContainerSigns\\ContainerProcessor.cs", 35)); } vars = zdo.Vars; ((ZDOVars)(ref vars)).SetText(text = instance.ChestSignsDefaultText.Value, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.ContainerSigns\\ContainerProcessor.cs", 36); } Vector3 position = zdo.ZDO.GetPosition(); Quaternion rotation = zdo.ZDO.GetRotation(); float num = ((Quaternion)(ref rotation)).eulerAngles.y + 90f; List list = new List(); position.y += value.Top / 2f; if (signOptions.HasFlag(Config.SignOptions.Left)) { list.Add(((Processor)this).PlacePiece(position + rotation * Vector3.right * value.Left, Prefabs.Sign, num, (CreatorMarkers)0)); } if (signOptions.HasFlag(Config.SignOptions.Right)) { list.Add(((Processor)this).PlacePiece(position + rotation * Vector3.left * value.Right, Prefabs.Sign, num + 180f, (CreatorMarkers)0)); } if (signOptions.HasFlag(Config.SignOptions.Front)) { list.Add(((Processor)this).PlacePiece(position + rotation * Vector3.forward * value.Front, Prefabs.Sign, num + 270f, (CreatorMarkers)0)); } if (signOptions.HasFlag(Config.SignOptions.Back)) { list.Add(((Processor)this).PlacePiece(position + rotation * Vector3.back * value.Back, Prefabs.Sign, num + 90f, (CreatorMarkers)0)); } 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), (CreatorMarkers)0)); } if (signOptions.HasFlag(Config.SignOptions.TopLateral)) { list.Add(((Processor)this).PlacePiece(position, Prefabs.Sign, Quaternion.Euler(-90f, num, 0f), (CreatorMarkers)0)); } _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\\ContainerProcessor.cs", 61); item.Fields().Set((Func>>)(() => (WearNTear x) => x.m_supports), false, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.ContainerSigns\\ContainerProcessor.cs", 62); } zdo.Destroyed += OnChestDestroyed; return (ProcessResult)66; } return (ProcessResult)2; } private void OnChestDestroyed(ServersideQoLZDO zdo) { if (!_signsByChests.Remove(zdo, out List value)) { return; } foreach (ServersideQoLZDO item in value) { _chestsBySigns.Remove(item); item.Destroy(); } } } [BepInPlugin("ArgusMagnus.ServersideQoL.ContainerSigns", "ServersideQoL.ContainerSigns", "2.0.4")] public sealed class ContainerSignsPlugin : ServersideQoLPluginBase { public const string Author = "ArgusMagnus"; public const string PluginName = "ServersideQoL.ContainerSigns"; public const string PluginGuid = "ArgusMagnus.ServersideQoL.ContainerSigns"; public const string PluginVersion = "2.0.4"; public const string PluginInformationalVersion = "2.0.4"; private DateTimeOffset BuildTimestamp { get; } = new DateTimeOffset(639246652997903653L, default(TimeSpan)); protected override Config CreateConfigSingleton(ConfigFile configFile, Logger logger) { return new Config(configFile, logger); } protected override void RegisterProcessors(IProcessorCollection processors) { processors.Add().Add(); } private void Awake() { } } [Processor("9091713d-f86e-43ab-bf37-9d64a9649858")] [RunAfter("806bdb85-c857-4154-a246-a0b1d0917987")] public sealed class SignProcessor : Processor> { internal const string MagnetEmoji = "\ud83e\uddf2"; private readonly Regex _chestPickupRangeRegex = new Regex(Regex.Escape("\ud83e\uddf2") + "\\s*(?\\d+)"); internal const string LeftRightArrowEmoji = "↔\ufe0f"; private readonly Regex _chestFeedRangeRegex = new Regex(Regex.Escape("↔\ufe0f") + "\\s*(?\\d+)"); private const string ContentListStart = ""; private const string ContentListEnd = ""; private readonly Regex _contentListRegex = new Regex(".*?"); private Regex _contentListRegex2; private readonly Dictionary _chestDataRevisions = new Dictionary(); protected override void Initialize() { _contentListRegex2 = new Regex(Regex.Escape(ConfigBase.Instance.ChestSignsContentListPlaceholder.Value)); _chestDataRevisions.Clear(); Processor.Instance().ContainerChanged -= OnContainerChanged; Processor.Instance().ContainerChanged += OnContainerChanged; } protected override ProcessResult Process(ServersideQoLZDO zdo, IReadOnlyList peers, ProcessorPrefabInfo prefabInfo) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: 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_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) ContainerState containerState; bool found; if (Processor.Instance().ChestsBySigns.TryGetValue(zdo, out ServersideQoLZDO chest)) { ZDOVars vars = zdo.Vars; string text = ((ZDOVars)(ref vars)).GetText(""); string input = text; containerState = null; if (ConfigBase.Instance.AutoPickup) { if (containerState == null) { containerState = Processor.Instance().GetState(chest); } containerState.PickupRange = null; input = _chestPickupRangeRegex.Replace(input, delegate(Match match) { string result = match.Value; int num = int.Parse(match.Groups["R"].Value); if (num > ConfigBase.Instance.AutoPickupMaxRange.Value) { num = ConfigBase.Instance.AutoPickupMaxRange.Value; result = FormattableString.Invariant(FormattableStringFactory.Create("{0}{1}", "\ud83e\uddf2", num)); } containerState.PickupRange = num; return result; }); } if (ConfigBase.Instance.FeedFromContainers) { if (containerState == null) { containerState = Processor.Instance().GetState(chest); } containerState.FeedRange = null; input = _chestFeedRangeRegex.Replace(input, delegate(Match match) { string result = match.Value; int num = int.Parse(match.Groups["R"].Value); if (num > ConfigBase.Instance.FeedFromContainersMaxRange.Value) { num = ConfigBase.Instance.FeedFromContainersMaxRange.Value; result = FormattableString.Invariant(FormattableStringFactory.Create("{0}{1}", "↔\ufe0f", num)); } containerState.FeedRange = num; return result; }); } found = false; input = _contentListRegex.Replace(input, EvaluateMatch, 1); if (!found) { input = _contentListRegex2.Replace(input, EvaluateMatch, 1); } if (input != text) { vars = zdo.Vars; ((ZDOVars)(ref vars)).SetText(text = input, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.ContainerSigns\\SignProcessor.cs", 113); } string text2 = text; vars = chest.Vars; if (text2 != ((ZDOVars)(ref vars)).GetText("")) { if (!chest.IsOwnerOrUnassigned()) { return ((Processor)this).ScheduleReprocessing(Processor.Instance().RequestOwnership(chest, default(PlayerID), "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.ContainerSigns\\SignProcessor.cs", 118)); } vars = chest.Vars; ((ZDOVars)(ref vars)).SetText(text, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.ContainerSigns\\SignProcessor.cs", 120); } return (ProcessResult)0; } return (ProcessResult)2; string EvaluateMatch(Match match) { found = true; if (ConfigBase.Instance.ChestSignsContentListMaxCount.Value <= 0) { return ConfigBase.Instance.ChestSignsContentListPlaceholder.Value; } if (containerState == null) { containerState = Processor.Instance().GetState(chest); } IInventory inventory = containerState.GetInventory(); if (inventory != null) { List items = inventory.Items; if (items != null && items.Count > 0) { List<(string, int)> list = (from x in inventory.Items.GroupBy((ItemData x) => ((Object)x.m_dropPrefab).name, (string k, IEnumerable g) => (Name: k, Count: g.Sum((ItemData x) => x.m_stack))) orderby x.Count descending select x).ToList(); IEnumerable<(string, int)> source = list.AsEnumerable(); if (list.Count > ConfigBase.Instance.ChestSignsContentListMaxCount.Value) { source = list.Take(ConfigBase.Instance.ChestSignsContentListMaxCount.Value - 1).Append((ConfigBase.Instance.ChestSignsContentListNameRest.Value, list.Skip(ConfigBase.Instance.ChestSignsContentListMaxCount.Value - 1).Sum<(string, int)>(((string Name, int Count) x) => x.Count))); } string text3 = string.Join(ConfigBase.Instance.ChestSignsContentListSeparator.Value, source.Select<(string, int), string>(((string Name, int Count) x) => string.Format(ConfigBase.Instance.ChestSignsContentListEntryFormat.Value, x.Name, x.Count))); return "" + text3 + ""; } } return ConfigBase.Instance.ChestSignsContentListPlaceholder.Value; } } private void OnContainerChanged(ServersideQoLZDO zdo, ContainerState state) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) if (!Processor.Instance().SignsByChests.TryGetValue(zdo, out List 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\\SignProcessor.cs", 145); ((Processor)this).ScheduleReprocessing(item, 0f); } } } }