using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using Microsoft.CodeAnalysis; [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("Show in-game time on signs and set default sign color")] [assembly: AssemblyFileVersion("1.99.2.0")] [assembly: AssemblyInformationalVersion("1.99.2-beta+409ce8a87a5191770ee23cbbde9294d6a844dd0b")] [assembly: AssemblyProduct("ServersideQoL.Signs")] [assembly: AssemblyTitle("ServersideQoL.Signs")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ArgusMagnus/ValheimServersideQoL")] [assembly: AssemblyVersion("1.99.2.0")] [module: RefSafetyRules(11)] [CompilerGenerated] internal sealed class <>z__ReadOnlyArray : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { int ICollection.Count => _items.Length; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection.Count => _items.Length; T IReadOnlyList.this[int index] => _items[index]; int ICollection.Count => _items.Length; bool ICollection.IsReadOnly => true; T IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return ((ICollection)_items).Contains(item); } void ICollection.CopyTo(T[] array, int arrayIndex) { ((ICollection)_items).CopyTo(array, arrayIndex); } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { return ((IList)_items).IndexOf(item); } 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.Signs { public sealed class Config : ConfigBase { private const string Section = "Signs"; public override ConfigEntry Enabled { get; } = ConfigBase.BindEx(cfg, "Signs", true, "Enables/disables the entire mod", (AcceptableValueBase)null, (Deprecated)null, "Enabled"); public ConfigEntry DefaultColor { get; } = ConfigBase.BindEx(cfg, "Signs", "", "Default color for signs. Can be a color name or hex code (e.g. #FF0000 for red)", (AcceptableValueBase)null, (Deprecated)null, "DefaultColor"); public ConfigEntry TimeSigns { get; } = ConfigBase.BindEx(cfg, "Signs", true, FormattableString.Invariant($"True to update sign texts which contain time emojis (any of {string.Concat(SignProcessor.ClockEmojis)}) with the in-game time"), (AcceptableValueBase)null, (Deprecated)null, "TimeSigns"); public Config(ConfigFile cfg, Logger logger) : base(cfg, logger) { } } [Processor("806bdb85-c857-4154-a246-a0b1d0917987")] public sealed class SignProcessor : Processor { private readonly Regex _clockRegex = new Regex("(?:" + string.Join("|", ClockEmojis.Select(Regex.Escape)) + ")(?:\\s*\\d\\d\\:\\d\\d)?"); private readonly Regex _defaultColorRegex = new Regex("]+ d>"); private string _defaultColor = ""; private string? _timeText; internal static IReadOnlyList ClockEmojis { get; } = new <>z__ReadOnlyArray(new string[24] { "\ud83d\udd5b", "\ud83d\udd67", "\ud83d\udd50", "\ud83d\udd5c", "\ud83d\udd51", "\ud83d\udd5d", "\ud83d\udd52", "\ud83d\udd5e", "\ud83d\udd53", "\ud83d\udd5f", "\ud83d\udd54", "\ud83d\udd60", "\ud83d\udd55", "\ud83d\udd61", "\ud83d\udd56", "\ud83d\udd62", "\ud83d\udd57", "\ud83d\udd63", "\ud83d\udd58", "\ud83d\udd64", "\ud83d\udd59", "\ud83d\udd65", "\ud83d\udd5a", "\ud83d\udd66" }); protected override void Initialize() { _defaultColor = (ConfigBase.Instance.DefaultColor.Value.StartsWith('#') ? ConfigBase.Instance.DefaultColor.Value : (string.IsNullOrEmpty(ConfigBase.Instance.DefaultColor.Value) ? "" : ("\"" + ConfigBase.Instance.DefaultColor.Value + "\""))); } protected override void PreProcess(PeersEnumerable peers) { _timeText = null; } protected override ProcessResult Process(ServersideQoLZDO zdo, IReadOnlyList peers, SignPrefabInfo prefabInfo) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) Config instance = ConfigBase.Instance; ProcessResult result = (ProcessResult)1; ZDOVars vars = zdo.Vars; string text = ((ZDOVars)(ref vars)).GetText(""); if (instance.TimeSigns.Value) { string text2 = _clockRegex.Replace(text, delegate { //IL_0004: Unknown result type (might be due to invalid IL or missing references) result = (ProcessResult)32; if (_timeText == null) { float dayFraction = EnvMan.instance.GetDayFraction(); int index = (int)Math.Floor((float)(ClockEmojis.Count * 2) * dayFraction) % ClockEmojis.Count; TimeSpan timeSpan = TimeSpan.FromDays(dayFraction); _timeText = $"{ClockEmojis[index]} {timeSpan:hh\\:mm}"; } return _timeText; }); if (text2 != text) { vars = zdo.Vars; ((ZDOVars)(ref vars)).SetText(text = text2, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.Signs\\SignProcessor.cs", 49); } } bool found = false; string text3 = _defaultColorRegex.Replace(text, delegate { found = true; return ""; }, 1); if (!found && !string.IsNullOrEmpty(_defaultColor)) { text3 = "" + text; } if (text3 != text) { vars = zdo.Vars; ((ZDOVars)(ref vars)).SetText(text = text3, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.Signs\\SignProcessor.cs", 66); } return result; } } [BepInDependency("ArgusMagnus.ServersideQoL", "1.99.2")] [BepInPlugin("ArgusMagnus.ServersideQoL.Signs", "ServersideQoL.Signs", "1.99.2")] public sealed class SignsPlugin : ServersideQoLPluginBase { public const string Author = "ArgusMagnus"; public const string PluginName = "ServersideQoL.Signs"; public const string PluginGuid = "ArgusMagnus.ServersideQoL.Signs"; 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(639207788837708255L, default(TimeSpan)); protected override Config CreateConfigSingleton(ConfigFile configFile, Logger logger) { return new Config(configFile, logger); } protected override void RegisterProcessors(IProcessorCollection processors) { processors.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)); } } }