using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using Microsoft.CodeAnalysis; using ServersideQoL.Utilities; [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("Automatically closes doors")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: AssemblyInformationalVersion("2.0.0+cdafe98fecdc9c33d99ba13f064e37dcaca41712")] [assembly: AssemblyProduct("ServersideQoL.AutoDoors")] [assembly: AssemblyTitle("ServersideQoL.AutoDoors")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ArgusMagnus/ValheimServersideQoL")] [assembly: AssemblyVersion("2.0.0.0")] [module: RefSafetyRules(11)] 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.AutoDoors { [BepInPlugin("ArgusMagnus.ServersideQoL.AutoDoors", "ServersideQoL.AutoDoors", "2.0.0")] public sealed class AutoDoorsPlugin : ServersideQoLPluginBase { public const string Author = "ArgusMagnus"; public const string PluginName = "ServersideQoL.AutoDoors"; public const string PluginGuid = "ArgusMagnus.ServersideQoL.AutoDoors"; public const string PluginVersion = "2.0.0"; public const string PluginInformationalVersion = "2.0.0"; private DateTimeOffset BuildTimestamp { get; } = new DateTimeOffset(639245732084466982L, 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() { } } public sealed class Config : ConfigBase { private const string Section = "AutoDoors"; public override ConfigEntry Enabled { get; } = ConfigBase.BindEx(cfg, "AutoDoors", true, "Enables/disables the entire mod", (AcceptableValueBase)null, (Deprecated)null, "Enabled"); public ConfigEntry AutoCloseMinPlayerDistance { get; } = ConfigBase.BindEx(cfg, "AutoDoors", 4f, FormattableString.Invariant($"Minimum distance all players must have to the door before it is closed."), (AcceptableValueBase)null, (Deprecated)null, "AutoCloseMinPlayerDistance"); public ConfigEntry AutoCloseMinOpenSeconds { get; } = ConfigBase.BindEx(cfg, "AutoDoors", 2f, FormattableString.Invariant($"Minimum time the door must have been open before it is closed."), (AcceptableValueBase)null, (Deprecated)null, "AutoCloseMinOpenSeconds"); public Config(ConfigFile cfg, Logger logger) : base(cfg, logger) { } } [Processor("f91beb92-c76b-43d5-91d4-82c1f7de2929")] public sealed class DoorProcessor : Processor { public sealed record PrefabInfo(Door Door) : ProcessorPrefabInfo() { public override bool IsValid { get { Door door = Door; if (door != null && door.m_keyItem == null) { return !door.m_canNotBeClosed; } return false; } } [CompilerGenerated] public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("PrefabInfo"); stringBuilder.Append(" { "); if (((ProcessorPrefabInfo)this).PrintMembers(stringBuilder)) { stringBuilder.Append(' '); } stringBuilder.Append('}'); return stringBuilder.ToString(); } [CompilerGenerated] protected override bool PrintMembers(StringBuilder builder) { if (((ProcessorPrefabInfo)this).PrintMembers(builder)) { builder.Append(", "); } builder.Append("Door = "); builder.Append(Door); return true; } [CompilerGenerated] public override int GetHashCode() { return ((ProcessorPrefabInfo)this).GetHashCode() * -1521134295 + EqualityComparer.Default.GetHashCode(Door); } [CompilerGenerated] public sealed override bool Equals(ProcessorPrefabInfo? other) { return ((object)this).Equals((object?)other); } [CompilerGenerated] public bool Equals(PrefabInfo? other) { if ((object)this != other) { if (((ProcessorPrefabInfo)this).Equals((ProcessorPrefabInfo)(object)other)) { return EqualityComparer.Default.Equals(Door, other.Door); } return false; } return true; } [CompilerGenerated] private PrefabInfo(PrefabInfo original) : base((ProcessorPrefabInfo)(object)original) { Door = original.Door; } } private readonly Dictionary _closeAfter = new Dictionary(); protected override ProcessResult Process(ServersideQoLZDO zdo, IReadOnlyList peers, PrefabInfo prefabInfo) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) ZDOVars vars = zdo.Vars; PlayerID val = default(PlayerID); val = ((ZDOVars)(ref vars)).GetCreator(val); if (((PlayerID)(ref val)).Value == 0L) { return (ProcessResult)2; } vars = zdo.Vars; if (((ZDOVars)(ref vars)).GetState(0) == 0) { if (_closeAfter.Remove(zdo)) { zdo.Destroyed -= OnDoorDestroyed; } return (ProcessResult)0; } if (!Processor.CheckMinDistance(peers, zdo, ConfigBase.Instance.AutoCloseMinPlayerDistance.Value)) { return ((Processor)this).ScheduleReprocessing(0f); } Timestamp now; if (!_closeAfter.TryGetValue(zdo, out var value)) { Dictionary closeAfter = _closeAfter; now = Timestamp.Now; closeAfter.Add(zdo, value = ((Timestamp)(ref now)).AddSeconds(ConfigBase.Instance.AutoCloseMinOpenSeconds.Value)); zdo.Destroyed += OnDoorDestroyed; return ((Processor)this).ScheduleReprocessing(ConfigBase.Instance.AutoCloseMinOpenSeconds.Value); } float seconds = ((Timestamp)(ref value)).Seconds; now = Timestamp.Now; float num = seconds - ((Timestamp)(ref now)).Seconds; if (num > 0f) { return ((Processor)this).ScheduleReprocessing(num); } vars = zdo.Vars; ((ZDOVars)(ref vars)).SetState(0, "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.AutoDoors\\DoorProcessor.cs", 43); if (_closeAfter.Remove(zdo)) { zdo.Destroyed -= OnDoorDestroyed; } return (ProcessResult)0; } private void OnDoorDestroyed(ServersideQoLZDO zdo) { _closeAfter.Remove(zdo); } } }