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 UnityEngine; using YamlDotNet.Serialization; [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("Adds signs to chests and barrels. Optionally show automated content list and configure the container for other SQoL mods.")] [assembly: AssemblyFileVersion("1.99.2.0")] [assembly: AssemblyInformationalVersion("1.99.2-beta+409ce8a87a5191770ee23cbbde9294d6a844dd0b")] [assembly: AssemblyProduct("ServersideQoL.ContainerSigns")] [assembly: AssemblyTitle("ServersideQoL.ContainerSigns")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ArgusMagnus/ValheimServersideQoL")] [assembly: AssemblyVersion("1.99.2.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() { return !_moveNextCalled && (_moveNextCalled = true); } 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) { return (!EqualityComparer.Default.Equals(_item, (T)value)) ? (-1) : 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) { return (!EqualityComparer.Default.Equals(_item, item)) ? (-1) : 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 ChestSignOffsetConfig { 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] [DebuggerBrowsable(DebuggerBrowsableState.Never)] 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, true), (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 ChestSignOffsets { get; } = ConfigBase.BindYaml(cfg, "ChestSignOffsets"); 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_005e: 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_0056: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: 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_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: 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_0261: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: 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.ChestSignOffsets.Value.ChestSignOffsets.TryGetValue(zdo.ZDO.GetPrefab(), out Config.ChestSignOffsetConfig.ChestSignOffset value) || _signsByChests.ContainsKey(zdo)) { return (ProcessResult)2; } ZDOVars vars = zdo.Vars; string text = ((ZDOVars)(ref vars)).GetText((string)null); if (text == null) { if (!zdo.IsOwnerOrUnassigned()) { Processor.Instance().RequestOwnership(zdo, 0L, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.ContainerSigns\\ContainerProcessor.cs", 34); return (ProcessResult)48; } vars = zdo.Vars; ((ZDOVars)(ref vars)).SetText(text = instance.ChestSignsDefaultText.Value, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.ContainerSigns\\ContainerProcessor.cs", 37); } 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", 62); item.Fields().Set((Func>>)(() => (WearNTear x) => x.m_supports), false, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.ContainerSigns\\ContainerProcessor.cs", 63); } zdo.Destroyed += OnChestDestroyed; 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", "1.99.2")] 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 = "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(639207788837809442L, 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() { bool flag = true; ServersideQoLPluginBase.Logger.LogWarning((object)string.Format("You are running a pre-release version: {0} ({1})", "1.99.2-beta", BuildTimestamp.LocalDateTime)); } } [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 = null; 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, SignPrefabInfo prefabInfo) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: 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_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) if (!Processor.Instance().ChestsBySigns.TryGetValue(zdo, out ServersideQoLZDO chest)) { return (ProcessResult)2; } ZDOVars vars = zdo.Vars; string text = ((ZDOVars)(ref vars)).GetText(""); string input = text; ContainerState 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; }); } bool 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()) { Processor.Instance().RequestOwnership(chest, 0L, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.ContainerSigns\\SignProcessor.cs", 119); return (ProcessResult)32; } vars = chest.Vars; ((ZDOVars)(ref vars)).SetText(text, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.ContainerSigns\\SignProcessor.cs", 123); } return (ProcessResult)1; 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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", 148); ((Processor)this).ScheduleReprocessing(item); } } } }