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 BETA v1.99.2
ServersideQoL.ContainerSigns.dll
Decompiled 10 hours agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text.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<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() { 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<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) { return (!EqualityComparer<T>.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<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) { return (!EqualityComparer<T>.Default.Equals(_item, item)) ? (-1) : 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 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<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.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<int, ChestSignOffset> ChestSignOffsets => <ChestSignOffsets>k__BackingField ?? (<ChestSignOffsets>k__BackingField = ChestSignOffsetsYaml.ToDictionary<KeyValuePair<string, ChestSignOffset>, int, ChestSignOffset>((KeyValuePair<string, ChestSignOffset> x) => StringExtensionMethods.GetStableHashCode(x.Key, true), (KeyValuePair<string, ChestSignOffset> x) => x.Value)); } private const string Section = "ContainerSigns"; private const string DefaultPlaceholderString = "•"; public override ConfigEntry<bool> Enabled { get; } = ConfigBase<Config>.BindEx<bool>(cfg, "ContainerSigns", true, "Enables/disables the entire mod", (AcceptableValueBase)null, (Deprecated<Config>)null, "Enabled"); public ConfigEntry<string> ChestSignsDefaultText { get; } = ConfigBase<Config>.BindEx<string>(cfg, "ContainerSigns", "•", "Default text for chest signs", (AcceptableValueBase)null, (Deprecated<Config>)null, "ChestSignsDefaultText"); public ConfigEntry<string> ChestSignsContentListPlaceholder { get; } = ConfigBase<Config>.BindEx<string>(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<Config>)null, "ChestSignsContentListPlaceholder"); public ConfigEntry<int> ChestSignsContentListMaxCount { get; } = ConfigBase<Config>.BindEx<int>(cfg, "ContainerSigns", 3, "Max number of entries to show in the content list on chest signs.", (AcceptableValueBase)null, (Deprecated<Config>)null, "ChestSignsContentListMaxCount"); public ConfigEntry<string> ChestSignsContentListSeparator { get; } = ConfigBase<Config>.BindEx<string>(cfg, "ContainerSigns", "<br>", "Separator to use for content lists on chest signs", (AcceptableValueBase)null, (Deprecated<Config>)null, "ChestSignsContentListSeparator"); public ConfigEntry<string> ChestSignsContentListNameRest { get; } = ConfigBase<Config>.BindEx<string>(cfg, "ContainerSigns", "Other", "Text to show for the entry summarizing the rest of the items", (AcceptableValueBase)null, (Deprecated<Config>)null, "ChestSignsContentListNameRest"); public ConfigEntry<string> ChestSignsContentListEntryFormat { get; } = ConfigBase<Config>.BindEx<string>(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<Config>)null, "ChestSignsContentListEntryFormat"); public bool AutoPickup => Shared.AutoPickup?.Value ?? false; public ConfigEntry<int> AutoPickupMaxRange { get; } = Shared.AutoPickupMaxRange = ConfigBase<Config>.BindEx<int>(cfg, "ContainerSigns", 64, "Max auto pickup range players can set per chest (by putting '\ud83e\uddf2<Range>' on a chest sign).", (AcceptableValueBase)null, (Deprecated<Config>)null, "AutoPickupMaxRange"); public bool FeedFromContainers => Shared.FeedFromContainers?.Value ?? false; public ConfigEntry<int> FeedFromContainersMaxRange { get; } = Shared.FeedFromContainersMaxRange = ConfigBase<Config>.BindEx<int>(cfg, "ContainerSigns", 64, "Max feeding range players can set per chest (by putting '↔\ufe0f<Range>' on a chest sign)", (AcceptableValueBase)null, (Deprecated<Config>)null, "FeedFromContainersMaxRange"); public ConfigEntry<SignOptions> WoodChestSigns { get; } = ConfigBase<Config>.BindEx<SignOptions>(cfg, "ContainerSigns", SignOptions.None, "Options to automatically put signs on wood chests", (AcceptableValueBase)(object)AcceptableEnum<SignOptions>.Default, (Deprecated<Config>)null, "WoodChestSigns"); public ConfigEntry<SignOptions> ReinforcedChestSigns { get; } = ConfigBase<Config>.BindEx<SignOptions>(cfg, "ContainerSigns", SignOptions.None, "Options to automatically put signs on reinforced chests", (AcceptableValueBase)(object)AcceptableEnum<SignOptions>.Default, (Deprecated<Config>)null, "ReinforcedChestSigns"); public ConfigEntry<SignOptions> BlackmetalChestSigns { get; } = ConfigBase<Config>.BindEx<SignOptions>(cfg, "ContainerSigns", SignOptions.None, "Options to automatically put signs on blackmetal chests", (AcceptableValueBase)(object)AcceptableEnum<SignOptions>.Default, (Deprecated<Config>)null, "BlackmetalChestSigns"); public ConfigEntry<SignOptions> BarrelSigns { get; } = ConfigBase<Config>.BindEx<SignOptions>(cfg, "ContainerSigns", SignOptions.None, "Options to automatically put signs on barrels", (AcceptableValueBase)(object)AcceptableEnum<SignOptions>.Default, (Deprecated<Config>)null, "BarrelSigns"); public ConfigEntry<SignOptions> ObliteratorSigns { get; } = ConfigBase<Config>.BindEx<SignOptions>(cfg, "ContainerSigns", SignOptions.None, "Options to automatically put signs on obliterators", (AcceptableValueBase)(object)new AcceptableEnum<SignOptions>((IEnumerable<SignOptions>)new <>z__ReadOnlySingleElementList<SignOptions>(SignOptions.Front)), (Deprecated<Config>)null, "ObliteratorSigns"); public YamlConfigEntry<ChestSignOffsetConfig> ChestSignOffsets { get; } = ConfigBase<Config>.BindYaml<ChestSignOffsetConfig>(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<PrefabInfo> { private readonly Dictionary<ServersideQoLZDO, List<ServersideQoLZDO>> _signsByChests = new Dictionary<ServersideQoLZDO, List<ServersideQoLZDO>>(); private readonly Dictionary<ServersideQoLZDO, ServersideQoLZDO> _chestsBySigns = new Dictionary<ServersideQoLZDO, ServersideQoLZDO>(); public IReadOnlyDictionary<ServersideQoLZDO, List<ServersideQoLZDO>> SignsByChests => _signsByChests; public IReadOnlyDictionary<ServersideQoLZDO, ServersideQoLZDO> 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<Peer> 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<Config>.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<ContainerRegistryProcessor>().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<ServersideQoLZDO> list = new List<ServersideQoLZDO>(); 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<WearNTear>().Set((Func<Expression<Func<WearNTear, bool>>>)(() => (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<ServersideQoLZDO> 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<ContainerSignsPlugin, Config> { 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<ContainerProcessor>().Add<SignProcessor>(); } private void Awake() { bool flag = true; ServersideQoLPluginBase<ContainerSignsPlugin, Config>.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<SignPrefabInfo> { internal const string MagnetEmoji = "\ud83e\uddf2"; private readonly Regex _chestPickupRangeRegex = new Regex(Regex.Escape("\ud83e\uddf2") + "\\s*(?<R>\\d+)"); internal const string LeftRightArrowEmoji = "↔\ufe0f"; private readonly Regex _chestFeedRangeRegex = new Regex(Regex.Escape("↔\ufe0f") + "\\s*(?<R>\\d+)"); 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 = null; private readonly Dictionary<ServersideQoLZDO, uint> _chestDataRevisions = new Dictionary<ServersideQoLZDO, uint>(); protected override void Initialize() { _contentListRegex2 = new Regex(Regex.Escape(ConfigBase<Config>.Instance.ChestSignsContentListPlaceholder.Value)); _chestDataRevisions.Clear(); Processor.Instance<ContainerRegistryProcessor>().ContainerChanged -= OnContainerChanged; Processor.Instance<ContainerRegistryProcessor>().ContainerChanged += OnContainerChanged; } protected override ProcessResult Process(ServersideQoLZDO zdo, IReadOnlyList<Peer> 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<ContainerProcessor>().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<Config>.Instance.AutoPickup) { if (containerState == null) { containerState = Processor.Instance<ContainerRegistryProcessor>().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<Config>.Instance.AutoPickupMaxRange.Value) { num = ConfigBase<Config>.Instance.AutoPickupMaxRange.Value; result = FormattableString.Invariant(FormattableStringFactory.Create("{0}{1}", "\ud83e\uddf2", num)); } containerState.PickupRange = num; return result; }); } if (ConfigBase<Config>.Instance.FeedFromContainers) { if (containerState == null) { containerState = Processor.Instance<ContainerRegistryProcessor>().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<Config>.Instance.FeedFromContainersMaxRange.Value) { num = ConfigBase<Config>.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<ContainerRegistryProcessor>().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<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)> list = (from x in inventory.Items.GroupBy((ItemData x) => ((Object)x.m_dropPrefab).name, (string k, IEnumerable<ItemData> 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<Config>.Instance.ChestSignsContentListMaxCount.Value) { source = list.Take(ConfigBase<Config>.Instance.ChestSignsContentListMaxCount.Value - 1).Append((ConfigBase<Config>.Instance.ChestSignsContentListNameRest.Value, list.Skip(ConfigBase<Config>.Instance.ChestSignsContentListMaxCount.Value - 1).Sum<(string, int)>(((string Name, int Count) x) => x.Count))); } string text3 = 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>" + text3 + "<i le></i>"; } } return ConfigBase<Config>.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<ContainerProcessor>().SignsByChests.TryGetValue(zdo, out List<ServersideQoLZDO> 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); } } } }