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; using BepInEx; using BepInEx.Configuration; using Microsoft.CodeAnalysis; using ServersideQoL.Processors; using ServersideQoL.Utilities; using SoftReferenceableAssets; using UnityEngine; [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 update map tables with icons for portals, ships, ore deposits and more.")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: AssemblyInformationalVersion("2.0.0+cdafe98fecdc9c33d99ba13f064e37dcaca41712")] [assembly: AssemblyProduct("ServersideQoL.AutoMapTables")] [assembly: AssemblyTitle("ServersideQoL.AutoMapTables")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ArgusMagnus/ValheimServersideQoL")] [assembly: AssemblyVersion("2.0.0.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(); } } [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.AutoMapTables { [BepInPlugin("ArgusMagnus.ServersideQoL.AutoMapTables", "ServersideQoL.AutoMapTables", "2.0.0")] public sealed class AutoMapTablesPlugin : ServersideQoLPluginBase { public static readonly int PluginGuidHash = StringExtensionMethods.GetStableHashCode("ArgusMagnus.ServersideQoL.AutoMapTables"); public const string Author = "ArgusMagnus"; public const string PluginName = "ServersideQoL.AutoMapTables"; public const string PluginGuid = "ArgusMagnus.ServersideQoL.AutoMapTables"; public const string PluginVersion = "2.0.0"; public const string PluginInformationalVersion = "2.0.0"; private DateTimeOffset BuildTimestamp { get; } = new DateTimeOffset(639245732099507220L, 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() { } } [Processor("05450dd6-13bd-42cc-9bd3-b1eed5e501af")] [DependsOn] public sealed class AutoMapTablesProcessor : Processor { public sealed record PrefabInfo(MapTable? MapTable, PrivateArea? PrivateArea, TeleportWorld? TeleportWorld, Ship? Ship, MineRock5? MineRock5, LocationProxy? LocationProxy) : ProcessorPrefabInfo() { public Config.OreDepositConfig? MineRockPinConfig { get { Config.OreDepositConfig value; return k__BackingField ?? (k__BackingField = ((MineRock5 != null && ConfigBase.Instance.AutoUpdateOreDeposits.TryGetValue(((ProcessorPrefabInfo)this).PrefabInfo.PrefabHash, out value)) ? value : null)); } } public Piece? Piece => k__BackingField ?? (k__BackingField = ((ProcessorPrefabInfo)this).PrefabInfo.GetComponent()); public override bool IsValid { get { if ((object)this != null) { PrivateArea privateArea = PrivateArea; if (privateArea == null) { TeleportWorld teleportWorld = TeleportWorld; if (teleportWorld == null) { Ship ship = Ship; if (ship == null) { MineRock5 mineRock = MineRock5; if (mineRock != null) { return (object)MineRockPinConfig != null; } goto IL_005b; } } } return Piece != null && ((ProcessorPrefabInfo)this).PrefabInfo.HasComponent(); } goto IL_005b; IL_005b: return true; } } [CompilerGenerated] private Config.OreDepositConfig? k__BackingField; [CompilerGenerated] private Piece? k__BackingField; [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("MapTable = "); builder.Append(MapTable); builder.Append(", PrivateArea = "); builder.Append(PrivateArea); builder.Append(", TeleportWorld = "); builder.Append(TeleportWorld); builder.Append(", Ship = "); builder.Append(Ship); builder.Append(", MineRock5 = "); builder.Append(MineRock5); builder.Append(", LocationProxy = "); builder.Append(LocationProxy); builder.Append(", MineRockPinConfig = "); builder.Append(MineRockPinConfig); builder.Append(", Piece = "); builder.Append(Piece); return true; } [CompilerGenerated] public override int GetHashCode() { return (((((((((ProcessorPrefabInfo)this).GetHashCode() * -1521134295 + EqualityComparer.Default.GetHashCode(MapTable)) * -1521134295 + EqualityComparer.Default.GetHashCode(PrivateArea)) * -1521134295 + EqualityComparer.Default.GetHashCode(TeleportWorld)) * -1521134295 + EqualityComparer.Default.GetHashCode(Ship)) * -1521134295 + EqualityComparer.Default.GetHashCode(MineRock5)) * -1521134295 + EqualityComparer.Default.GetHashCode(LocationProxy)) * -1521134295 + EqualityComparer.Default.GetHashCode(k__BackingField)) * -1521134295 + EqualityComparer.Default.GetHashCode(k__BackingField); } [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) && EqualityComparer.Default.Equals(MapTable, other.MapTable) && EqualityComparer.Default.Equals(PrivateArea, other.PrivateArea) && EqualityComparer.Default.Equals(TeleportWorld, other.TeleportWorld) && EqualityComparer.Default.Equals(Ship, other.Ship) && EqualityComparer.Default.Equals(MineRock5, other.MineRock5) && EqualityComparer.Default.Equals(LocationProxy, other.LocationProxy) && EqualityComparer.Default.Equals(k__BackingField, other.k__BackingField)) { return EqualityComparer.Default.Equals(k__BackingField, other.k__BackingField); } return false; } return true; } [CompilerGenerated] private PrefabInfo(PrefabInfo original) : base((ProcessorPrefabInfo)(object)original) { MapTable = original.MapTable; PrivateArea = original.PrivateArea; TeleportWorld = original.TeleportWorld; Ship = original.Ship; MineRock5 = original.MineRock5; LocationProxy = original.LocationProxy; k__BackingField = original.k__BackingField; k__BackingField = original.k__BackingField; } } private readonly record struct Pin(PlayerID OwnerId, string Tag, Vector3 Pos, PinType Type, bool IsChecked, string Author) { [CompilerGenerated] public void Deconstruct(out PlayerID OwnerId, out string Tag, out Vector3 Pos, out PinType Type, out bool IsChecked, out string Author) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected I4, but got Unknown OwnerId = this.OwnerId; Tag = this.Tag; Pos = this.Pos; Type = (PinType)(int)this.Type; IsChecked = this.IsChecked; Author = this.Author; } } private sealed class PlayerState(PlayerID playerID) { [CompilerGenerated] private HashSet k__BackingField; [CompilerGenerated] private HashSet k__BackingField; [CompilerGenerated] private HashSet k__BackingField; [CompilerGenerated] private HashSet k__BackingField; [CompilerGenerated] private Dictionary k__BackingField; public PlayerID PlayerID { get; } = playerID; public HashSet UpToDateMapTables => k__BackingField ?? (k__BackingField = new HashSet()); public HashSet Portals => k__BackingField ?? (k__BackingField = new HashSet()); public HashSet Ships => k__BackingField ?? (k__BackingField = new HashSet()); public HashSet OreVeins => k__BackingField ?? (k__BackingField = new HashSet()); public Dictionary Dungeons => k__BackingField ?? (k__BackingField = new Dictionary()); } private sealed class MapTableState(ServersideQoLZDO zdo) { public ServersideQoLZDO ZDO { get; } = zdo; public uint LastDataRevision { get; set; } public HashSet? Wards { get; set; } public HashSet? PermittedPlayerIDs { get; set; } } public const string Id = "05450dd6-13bd-42cc-9bd3-b1eed5e501af"; private readonly Dictionary _mapTables = new Dictionary(); private readonly Dictionary _playerStates = new Dictionary(); private readonly HashSet _wards = new HashSet(); private readonly Dictionary _updateList = new Dictionary(); private readonly List _pins = new List(); private readonly HashSet<(PinType, string)> _oreDepositPins = new HashSet<(PinType, string)>(); private byte[]? _emptyExplored; private float _mapTableRangeSqr; private float _oreDepositRangeSqr; private float _dungeonRangeSqr; private static readonly ServerVar> __playerIDsVar = ServersideQoLPluginBase.RegisterServerVar>("PlayerIDs"); protected override void Initialize() { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Invalid comparison between Unknown and I4 //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Invalid comparison between Unknown and I4 //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) _mapTableRangeSqr = ConfigBase.Instance.MapTableRange.Value * ConfigBase.Instance.MapTableRange.Value; _oreDepositRangeSqr = ConfigBase.Instance.OreDepositsDiscoverRange.Value * ConfigBase.Instance.OreDepositsDiscoverRange.Value; _dungeonRangeSqr = ConfigBase.Instance.DungeonsDiscoverRange.Value * ConfigBase.Instance.DungeonsDiscoverRange.Value; _oreDepositPins.Clear(); foreach (var (val3, val4) in ConfigBase.Instance.AutoUpdateOreDeposits.Values) { if ((int)val3.Value != 8) { _oreDepositPins.Add((val3.Value, val4.Value)); } } _mapTables.Clear(); _playerStates.Clear(); _wards.Clear(); foreach (ServersideQoLZDO item in from x in PrivateAccessor.GetObjects(ZDOMan.instance) select x.ServersideQoLZDO) { PrefabInfo processorPrefabInfo = Processor.GetProcessorPrefabInfo(item); if ((object)processorPrefabInfo == null) { continue; } MapTable mapTable = processorPrefabInfo.MapTable; if (mapTable == null) { PrivateArea privateArea = processorPrefabInfo.PrivateArea; if (privateArea == null) { TeleportWorld teleportWorld = processorPrefabInfo.TeleportWorld; ZDOVars vars; if (teleportWorld == null) { Ship ship = processorPrefabInfo.Ship; if (ship == null) { Config.OreDepositConfig mineRockPinConfig = processorPrefabInfo.MineRockPinConfig; if ((object)mineRockPinConfig == null) { LocationProxy locationProxy = processorPrefabInfo.LocationProxy; if (locationProxy == null) { continue; } HashSet hashSet = __playerIDsVar.Get(item, (HashSet)null); if (hashSet == null) { continue; } foreach (PlayerID item2 in hashSet) { GetOrAddPlayerState(item2).Dungeons.Add(item, null); } if ((int)ConfigBase.Instance.DungeonsPinType.Value == 8) { continue; } vars = item.Vars; int location = ((ZDOVars)(ref vars)).GetLocation(0); if (location != 0 && PrivateAccessor.GetLocationsByHash(ZoneSystem.instance).TryGetValue(location, out var value)) { SoftReference prefab = value.m_prefab; if (prefab.IsValid && !prefab.IsLoaded && !prefab.IsLoading) { value.m_prefab.LoadAsync(); } } } else { if (Character.InInterior(item.ZDO.GetPosition())) { continue; } item.Destroyed += OnOreDepositDestroyed; HashSet hashSet2 = __playerIDsVar.Get(item, (HashSet)null); if (hashSet2 == null) { continue; } foreach (PlayerID item3 in hashSet2) { GetOrAddPlayerState(item3).OreVeins.Add(item); } } } else { vars = item.Vars; GetOrAddPlayerState(((ZDOVars)(ref vars)).GetCreator(default(PlayerID))).Ships.Add(item); item.Destroyed += OnShipDestroyed; } } else { vars = item.Vars; GetOrAddPlayerState(((ZDOVars)(ref vars)).GetCreator(default(PlayerID))).Portals.Add(item); item.Destroyed += OnPortalDestroyed; } } else { _wards.Add(item); item.Destroyed += OnWardDestroyed; } } else { _mapTables.Add(item, new MapTableState(item)); item.Destroyed += OnMapTableDestroyed; } } _playerStates.Remove(default(PlayerID)); if (_wards.Count == 0) { return; } foreach (KeyValuePair mapTable2 in _mapTables) { mapTable2.Deconstruct(out var key, out var value2); ServersideQoLZDO val5 = key; MapTableState mapTableState = value2; foreach (ServersideQoLZDO ward in _wards) { if (!(Utils.DistanceXZ(ward.ZDO.GetPosition(), val5.ZDO.GetPosition()) > ward.Fields().GetFloat((Func>>)(() => (PrivateArea x) => x.m_radius), "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.AutoMapTables\\AutoMapTablesProcessor.cs", 123))) { value2 = mapTableState; (value2.Wards ?? (value2.Wards = new HashSet())).Add(ward); } } UpdateMapTablePermittedPlayerIDs(mapTableState); } } protected unsafe override ProcessResult Process(ServersideQoLZDO zdo, IReadOnlyList peers, PrefabInfo prefabInfo) { //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0410: 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) //IL_0060: 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_0629: Unknown result type (might be due to invalid IL or missing references) //IL_062e: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0290: 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_0647: Unknown result type (might be due to invalid IL or missing references) //IL_064c: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0658: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0672: Unknown result type (might be due to invalid IL or missing references) //IL_0677: Unknown result type (might be due to invalid IL or missing references) //IL_085f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_069f: Unknown result type (might be due to invalid IL or missing references) //IL_06aa: Unknown result type (might be due to invalid IL or missing references) //IL_06bb: Unknown result type (might be due to invalid IL or missing references) //IL_06c0: Unknown result type (might be due to invalid IL or missing references) //IL_06c5: Unknown result type (might be due to invalid IL or missing references) //IL_06ca: Unknown result type (might be due to invalid IL or missing references) //IL_06cc: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_06d9: Unknown result type (might be due to invalid IL or missing references) //IL_06de: Unknown result type (might be due to invalid IL or missing references) //IL_06e2: Unknown result type (might be due to invalid IL or missing references) //IL_06e7: Unknown result type (might be due to invalid IL or missing references) //IL_0846: Unknown result type (might be due to invalid IL or missing references) //IL_084b: Unknown result type (might be due to invalid IL or missing references) //IL_04fb: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_0508: Unknown result type (might be due to invalid IL or missing references) //IL_051c: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_070e: Unknown result type (might be due to invalid IL or missing references) //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Invalid comparison between Unknown and I4 //IL_0728: Unknown result type (might be due to invalid IL or missing references) //IL_072d: Unknown result type (might be due to invalid IL or missing references) //IL_0735: Unknown result type (might be due to invalid IL or missing references) //IL_05e3: Unknown result type (might be due to invalid IL or missing references) //IL_0749: Unknown result type (might be due to invalid IL or missing references) //IL_0750: Unknown result type (might be due to invalid IL or missing references) //IL_076d: Unknown result type (might be due to invalid IL or missing references) //IL_07a4: Unknown result type (might be due to invalid IL or missing references) //IL_07c2: Unknown result type (might be due to invalid IL or missing references) //IL_07c8: Invalid comparison between Unknown and I4 //IL_07f7: Unknown result type (might be due to invalid IL or missing references) if (prefabInfo.MapTable != null) { if (!_mapTables.TryGetValue(zdo, out MapTableState value)) { _mapTables.Add(zdo, value = new MapTableState(zdo)); zdo.Destroyed += OnMapTableDestroyed; foreach (ServersideQoLZDO ward in _wards) { if (!(Utils.DistanceXZ(ward.ZDO.GetPosition(), zdo.ZDO.GetPosition()) > ward.Fields().GetFloat((Func>>)(() => (PrivateArea x) => x.m_radius), "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.AutoMapTables\\AutoMapTablesProcessor.cs", 145))) { MapTableState mapTableState = value; (mapTableState.Wards ?? (mapTableState.Wards = new HashSet())).Add(ward); } } UpdateMapTablePermittedPlayerIDs(value); } Enumerator enumerator2 = ListExtensions.Enumerate(peers).GetEnumerator(); try { while (enumerator2.MoveNext()) { Peer current2 = enumerator2.Current; PlayerState playerState = current2.PlayerState; PlayerID? val = ((playerState != null) ? new PlayerID?(playerState.PlayerID) : ((PlayerID?)null)); if (val.HasValue) { PlayerID valueOrDefault = val.GetValueOrDefault(); HashSet wards = value.Wards; if ((wards == null || wards.Count <= 0 || value.PermittedPlayerIDs.Contains(valueOrDefault)) && _playerStates.TryGetValue(valueOrDefault, out PlayerState value2) && !value2.UpToDateMapTables.Contains(zdo) && !(Utils.DistanceSqr(zdo.ZDO.GetPosition(), current2.RefPos) > _mapTableRangeSqr)) { _updateList.Add(valueOrDefault, (current2, value2)); } } } } finally { ((IDisposable)enumerator2/*cast due to .constrained prefix*/).Dispose(); } if (_updateList.Count > 0 || value.LastDataRevision != zdo.ZDO.DataRevision) { UpdateMapTable(value, _updateList); _updateList.Clear(); } return ((Processor)this).ScheduleReprocessing(0.5f); } if (prefabInfo.PrivateArea != null) { if (_wards.Add(zdo)) { zdo.Destroyed += OnWardDestroyed; foreach (KeyValuePair mapTable in _mapTables) { mapTable.Deconstruct(out var key, out var mapTableState); ServersideQoLZDO val2 = key; MapTableState mapTableState2 = mapTableState; if (!(Utils.DistanceXZ(zdo.ZDO.GetPosition(), val2.ZDO.GetPosition()) > zdo.Fields().GetFloat((Func>>)(() => (PrivateArea x) => x.m_radius), "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.AutoMapTables\\AutoMapTablesProcessor.cs", 183))) { mapTableState = mapTableState2; (mapTableState.Wards ?? (mapTableState.Wards = new HashSet())).Add(zdo); } } } foreach (MapTableState value5 in _mapTables.Values) { UpdateMapTablePermittedPlayerIDs(value5); } } ZDOVars vars; if (prefabInfo.TeleportWorld != null) { vars = zdo.Vars; PlayerID playerID = ((ZDOVars)(ref vars)).GetCreator(default(PlayerID)); if (((PlayerID)(ref playerID)).Value != 0L) { if (peers.Any(delegate(Peer x) { //IL_000c: 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) PlayerState playerState4 = x.PlayerState; return playerState4 != null && playerState4.PlayerID == playerID; })) { PlayerState orAddPlayerState = GetOrAddPlayerState(playerID); if (orAddPlayerState.Portals.Add(zdo)) { zdo.Destroyed += OnPortalDestroyed; orAddPlayerState.UpToDateMapTables.Clear(); } } return (ProcessResult)0; } return (ProcessResult)2; } if (prefabInfo.Ship != null) { vars = zdo.Vars; PlayerID playerID2 = ((ZDOVars)(ref vars)).GetCreator(default(PlayerID)); if (((PlayerID)(ref playerID2)).Value != 0L) { if (peers.Any(delegate(Peer x) { //IL_000c: 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) PlayerState playerState4 = x.PlayerState; return playerState4 != null && playerState4.PlayerID == playerID2; })) { PlayerState orAddPlayerState2 = GetOrAddPlayerState(playerID2); if (orAddPlayerState2.Ships.Add(zdo)) { zdo.Destroyed += OnShipDestroyed; orAddPlayerState2.UpToDateMapTables.Clear(); } } return (ProcessResult)0; } return (ProcessResult)2; } if ((object)prefabInfo != null && prefabInfo.MineRock5 != null && (object)prefabInfo.MineRockPinConfig != null) { if (!Character.InInterior(zdo.ZDO.GetPosition())) { HashSet hashSet3 = null; Enumerator enumerator5 = ListExtensions.Enumerate(peers).GetEnumerator(); try { while (enumerator5.MoveNext()) { Peer current4 = enumerator5.Current; PlayerState playerState2 = current4.PlayerState; PlayerID? val = ((playerState2 != null) ? new PlayerID?(playerState2.PlayerID) : ((PlayerID?)null)); if (!val.HasValue) { continue; } PlayerID valueOrDefault2 = val.GetValueOrDefault(); if (_playerStates.TryGetValue(valueOrDefault2, out PlayerState value3) && !(Utils.DistanceSqr(zdo.ZDO.GetPosition(), current4.RefPos) > _oreDepositRangeSqr) && value3.OreVeins.Add(zdo)) { zdo.Destroyed -= OnOreDepositDestroyed; zdo.Destroyed += OnOreDepositDestroyed; if (hashSet3 == null) { hashSet3 = __playerIDsVar.Get(zdo, (HashSet)null) ?? new HashSet(); } hashSet3.Add(valueOrDefault2); value3.UpToDateMapTables.Clear(); if ((int)prefabInfo.MineRockPinConfig.PinType.Value != 8) { Processor.ShowMessage((IEnumerable)new <>z__ReadOnlySingleElementList(current4), zdo, ConfigBase.Instance.Localization.Value.Discovered(prefabInfo.MineRock5.m_name), ConfigBase.Instance.DiscoveredMessageType.Value, (TextType)0); } } } } finally { ((IDisposable)enumerator5/*cast due to .constrained prefix*/).Dispose(); } if (hashSet3 != null) { __playerIDsVar.Set(zdo, hashSet3); } return (ProcessResult)0; } return (ProcessResult)2; } if (prefabInfo.LocationProxy != null) { vars = zdo.Vars; int location = ((ZDOVars)(ref vars)).GetLocation(0); if (location == 0) { return (ProcessResult)0; } Location andLoadLocationByHash = PrivateAccessor.GetAndLoadLocationByHash(ZoneSystem.instance, location); try { if (!((Location)(ref andLoadLocationByHash)).IsValid) { return (ProcessResult)2; } GameObject prefab = ((Location)(ref andLoadLocationByHash)).Prefab; if (prefab == null) { return ((Processor)this).ScheduleReprocessing(0f); } HashSet hashSet4 = null; Teleport[] componentsInChildren = prefab.GetComponentsInChildren(); foreach (Teleport val3 in componentsInChildren) { Vector3 val4 = zdo.ZDO.GetPosition() + zdo.ZDO.GetRotation() * ((Component)val3).gameObject.transform.position; if (Character.InInterior(val4)) { continue; } Enumerator enumerator6 = ListExtensions.Enumerate(peers).GetEnumerator(); try { while (enumerator6.MoveNext()) { Peer current5 = enumerator6.Current; PlayerState playerState3 = current5.PlayerState; PlayerID? val = ((playerState3 != null) ? new PlayerID?(playerState3.PlayerID) : ((PlayerID?)null)); if (!val.HasValue) { continue; } PlayerID valueOrDefault3 = val.GetValueOrDefault(); if (_playerStates.TryGetValue(valueOrDefault3, out PlayerState value4) && !(Utils.DistanceSqr(zdo.ZDO.GetPosition(), current5.RefPos) > _dungeonRangeSqr) && value4.Dungeons.TryAdd(zdo, (val4, val3.m_enterText))) { if (hashSet4 == null) { hashSet4 = __playerIDsVar.Get(zdo, (HashSet)null) ?? new HashSet(); } hashSet4.Add(valueOrDefault3); value4.UpToDateMapTables.Clear(); if ((int)ConfigBase.Instance.DungeonsPinType.Value != 8) { Processor.ShowMessage((IEnumerable)new <>z__ReadOnlySingleElementList(current5), zdo, ConfigBase.Instance.Localization.Value.Discovered(val3.m_enterText), ConfigBase.Instance.DiscoveredMessageType.Value, (TextType)0); } } } } finally { ((IDisposable)enumerator6/*cast due to .constrained prefix*/).Dispose(); } break; } if (hashSet4 != null) { __playerIDsVar.Set(zdo, hashSet4); } return ((Processor)this).ScheduleReprocessing(0.5f); } finally { ((IDisposable)(*(Location*)(&andLoadLocationByHash))/*cast due to .constrained prefix*/).Dispose(); } } return (ProcessResult)2; } private PlayerState GetOrAddPlayerState(PlayerID playerID) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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) if (!_playerStates.TryGetValue(playerID, out PlayerState value)) { _playerStates.Add(playerID, value = new PlayerState(playerID)); } return value; } private static void AddPermittedPlayerIDs(ServersideQoLZDO ward, HashSet permittedPlayerIDs) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0066: Unknown result type (might be due to invalid IL or missing references) ZDOVars vars = ward.Vars; permittedPlayerIDs.Add(((ZDOVars)(ref vars)).GetCreator(default(PlayerID))); vars = ward.Vars; int permitted = ((ZDOVars)(ref vars)).GetPermitted(0); for (int i = 0; i < permitted; i++) { long num = ward.ZDO.GetLong(FormattableString.Invariant($"pu_id{i}"), 0L); if (num != 0L) { permittedPlayerIDs.Add(new PlayerID(num)); } } } private void UpdateMapTablePermittedPlayerIDs(MapTableState state) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) foreach (PlayerState value in _playerStates.Values) { value.UpToDateMapTables.Remove(state.ZDO); } state.PermittedPlayerIDs?.Clear(); HashSet wards = state.Wards; if (wards == null || wards.Count <= 0) { return; } foreach (ServersideQoLZDO ward in state.Wards) { ZDOVars vars = ward.Vars; if (((ZDOVars)(ref vars)).GetEnabled(false)) { AddPermittedPlayerIDs(ward, state.PermittedPlayerIDs ?? (state.PermittedPlayerIDs = new HashSet())); } } } private unsafe void UpdateMapTable(MapTableState state, Dictionary peers) { //IL_000c: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_004d: 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_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Invalid comparison between Unknown and I4 //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Invalid comparison between Unknown and I4 //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Invalid comparison between Unknown and I4 //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: 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_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_06b3: Unknown result type (might be due to invalid IL or missing references) //IL_06b8: Unknown result type (might be due to invalid IL or missing references) //IL_06d6: Unknown result type (might be due to invalid IL or missing references) //IL_06e3: Unknown result type (might be due to invalid IL or missing references) //IL_06ed: Expected I4, but got Unknown //IL_0726: Unknown result type (might be due to invalid IL or missing references) //IL_072b: Unknown result type (might be due to invalid IL or missing references) //IL_0796: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_053a: Unknown result type (might be due to invalid IL or missing references) //IL_053f: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Invalid comparison between Unknown and I4 //IL_0582: Unknown result type (might be due to invalid IL or missing references) //IL_0591: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Unknown result type (might be due to invalid IL or missing references) //IL_05e6: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) ZPackage instance = SingletonCache.Instance; ZDOVars vars = state.ZDO.Vars; byte[] array = ((ZDOVars)(ref vars)).GetData((byte[])null); PlayerID val2; if (array != null) { array = Utils.Decompress(array); instance.Load(array); SharedMap val = (SharedMap)instance.ReadInt(); if ((int)val != 3) { ((Processor)this).Logger.LogWarning((object)FormattableString.Invariant($"MapTable data version {val:D} [{val}] is not supported")); return; } array = instance.ReadByteArray(); if (array.Length != Minimap.instance.m_textureSize * Minimap.instance.m_textureSize) { ((Processor)this).Logger.LogWarning((object)"Invalid explored map data length"); array = null; } int num = instance.ReadInt(); if (_pins.Capacity < num) { _pins.Capacity = num; } PlayerID key = default(PlayerID); for (int i = 0; i < num; i++) { Pin item = new Pin(new PlayerID(instance.ReadLong()), instance.ReadString(), instance.ReadVector3(), (PinType)instance.ReadInt(), instance.ReadBool(), instance.ReadString()); val2 = item.OwnerId; if (((PlayerID)(ref val2)).IsModPlayerID(ref key)) { if (!peers.ContainsKey(key)) { _pins.Add(item); } } else if (!ConfigBase.Instance.DiscardPlayerPins.Value || _oreDepositPins.Contains((item.Type, item.Tag))) { _pins.Add(item); } } } foreach (var value in peers.Values) { PlayerState item2 = value.Item2; item2.UpToDateMapTables.Add(state.ZDO); if ((int)ConfigBase.Instance.PortalsPinType.Value != 8) { foreach (ServersideQoLZDO portal in item2.Portals) { List pins = _pins; val2 = item2.PlayerID; PlayerID ownerId = ((PlayerID)(ref val2)).AsModPlayerID(); vars = portal.Vars; pins.Add(new Pin(ownerId, ((ZDOVars)(ref vars)).GetTag(""), portal.ZDO.GetPosition(), ConfigBase.Instance.PortalsPinType.Value, IsChecked: false, "ArgusMagnus.ServersideQoL.AutoMapTables")); } } if ((int)ConfigBase.Instance.ShipsPinType.Value != 8) { foreach (ServersideQoLZDO ship in item2.Ships) { List pins2 = _pins; val2 = item2.PlayerID; pins2.Add(new Pin(((PlayerID)(ref val2)).AsModPlayerID(), Processor.GetProcessorPrefabInfo(ship).Piece.m_name, ship.ZDO.GetPosition(), ConfigBase.Instance.ShipsPinType.Value, IsChecked: false, "ArgusMagnus.ServersideQoL.AutoMapTables")); } } if (_oreDepositPins.Count != 0) { foreach (ServersideQoLZDO oreVein in item2.OreVeins) { PrefabInfo processorPrefabInfo = Processor.GetProcessorPrefabInfo(oreVein); if ((object)processorPrefabInfo == null) { continue; } Config.OreDepositConfig mineRockPinConfig = processorPrefabInfo.MineRockPinConfig; if ((object)mineRockPinConfig == null) { continue; } ConfigEntry pinType = mineRockPinConfig.PinType; if (pinType != null && (int)pinType.Value != 8) { MineRock5 mineRock = processorPrefabInfo.MineRock5; if (mineRock != null) { List pins3 = _pins; val2 = item2.PlayerID; pins3.Add(new Pin(((PlayerID)(ref val2)).AsModPlayerID(), (mineRockPinConfig.Label.Value == "Default") ? mineRock.m_name : mineRockPinConfig.Label.Value, oreVein.ZDO.GetPosition(), mineRockPinConfig.PinType.Value, IsChecked: false, "ArgusMagnus.ServersideQoL.AutoMapTables")); } } } } if ((int)ConfigBase.Instance.DungeonsPinType.Value == 8) { continue; } List<(ServersideQoLZDO, Vector3, string)> list = null; foreach (var (val4, tuple2) in item2.Dungeons) { (Vector3, string) tuple3; if (tuple2.HasValue) { tuple3 = tuple2.GetValueOrDefault(); goto IL_0532; } vars = val4.Vars; int location = ((ZDOVars)(ref vars)).GetLocation(0); if (location == 0) { continue; } Location andLoadLocationByHash = PrivateAccessor.GetAndLoadLocationByHash(ZoneSystem.instance, location); try { GameObject prefab = ((Location)(ref andLoadLocationByHash)).Prefab; if (prefab == null) { continue; } bool flag = false; tuple3 = default((Vector3, string)); Teleport[] componentsInChildren = prefab.GetComponentsInChildren(); foreach (Teleport val5 in componentsInChildren) { Vector3 val6 = val4.ZDO.GetPosition() + val4.ZDO.GetRotation() * ((Component)val5).gameObject.transform.position; if (!Character.InInterior(val6)) { flag = true; (list ?? (list = new List<(ServersideQoLZDO, Vector3, string)>())).Add((val4, val6, val5.m_enterText)); tuple3 = (val6, val5.m_enterText); break; } } if (!flag) { continue; } goto IL_0532; } finally { ((IDisposable)(*(Location*)(&andLoadLocationByHash))/*cast due to .constrained prefix*/).Dispose(); } IL_0532: List pins4 = _pins; val2 = item2.PlayerID; pins4.Add(new Pin(((PlayerID)(ref val2)).AsModPlayerID(), (ConfigBase.Instance.DungeonsLabel.Value == "Default") ? tuple3.Item2 : ConfigBase.Instance.DungeonsLabel.Value, val4.ZDO.GetPosition(), ConfigBase.Instance.DungeonsPinType.Value, IsChecked: false, "ArgusMagnus.ServersideQoL.AutoMapTables")); } if (list == null) { continue; } foreach (var (key2, item3, item4) in list) { item2.Dungeons[key2] = (item3, item4); } } instance.Clear(); instance.Write(3); instance.Write(array ?? _emptyExplored ?? (_emptyExplored = new byte[Minimap.instance.m_textureSize * Minimap.instance.m_textureSize])); instance.Write(_pins.Count); foreach (Pin pin in _pins) { val2 = pin.OwnerId; instance.Write(((PlayerID)(ref val2)).Value); instance.Write(pin.Tag); instance.Write(pin.Pos); instance.Write((int)pin.Type); instance.Write(pin.IsChecked); instance.Write(pin.Author); } vars = state.ZDO.Vars; ((ZDOVars)(ref vars)).SetData(Utils.Compress(instance.GetArray()), "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.AutoMapTables\\AutoMapTablesProcessor.cs", 468); Processor.ShowMessage(peers.Values.Select<(Peer, PlayerState), Peer>(((Peer, PlayerState) x) => x.Item1), state.ZDO, ConfigBase.Instance.Localization.Value.Updated, ConfigBase.Instance.UpdatedMessageType.Value, (TextType)0); state.LastDataRevision = state.ZDO.ZDO.DataRevision; _pins.Clear(); } private void OnMapTableDestroyed(ServersideQoLZDO zdo) { if (!_mapTables.Remove(zdo)) { return; } foreach (PlayerState value in _playerStates.Values) { value.UpToDateMapTables.Remove(zdo); } } private void OnPortalDestroyed(ServersideQoLZDO zdo) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Dictionary playerStates = _playerStates; ZDOVars vars = zdo.Vars; if (playerStates.TryGetValue(((ZDOVars)(ref vars)).GetCreator(default(PlayerID)), out PlayerState value) && value.Portals.Remove(zdo)) { value.UpToDateMapTables.Clear(); } } private void OnShipDestroyed(ServersideQoLZDO zdo) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Dictionary playerStates = _playerStates; ZDOVars vars = zdo.Vars; if (playerStates.TryGetValue(((ZDOVars)(ref vars)).GetCreator(default(PlayerID)), out PlayerState value) && value.Ships.Remove(zdo)) { value.UpToDateMapTables.Clear(); } } private void OnWardDestroyed(ServersideQoLZDO zdo) { if (!_wards.Remove(zdo)) { return; } foreach (MapTableState value in _mapTables.Values) { if (value.Wards?.Remove(zdo) ?? false) { UpdateMapTablePermittedPlayerIDs(value); } } } private void OnOreDepositDestroyed(ServersideQoLZDO zdo) { //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_0028: Unknown result type (might be due to invalid IL or missing references) HashSet hashSet = __playerIDsVar.Get(zdo, (HashSet)null); if (hashSet == null) { return; } foreach (PlayerID item in hashSet) { if (_playerStates.TryGetValue(item, out PlayerState value) && value.OreVeins.Remove(zdo)) { value.UpToDateMapTables.Clear(); } } } } public sealed class Config : ConfigBase { public sealed record OreDepositConfig(ConfigEntry PinType, ConfigEntry Label); public sealed class LocalizationConfig { public string Updated { get; init; } = "$msg_mapsaved"; private string DiscoveredFormat { get; init; } = "{0} discovered"; public string Discovered(string name) { return string.Format(DiscoveredFormat, name); } } public sealed class AdvancedConfig { public float MapTableUpdateInterval { get; init; } = 5f; } private const string Section = "AutoMapTables"; private static readonly AcceptableEnum __acceptablePins; internal const string DefaultOreDepositName = "Default"; public override ConfigEntry Enabled { get; } = ConfigBase.BindEx(cfg, "AutoMapTables", true, "Enables/disables the entire mod", (AcceptableValueBase)null, (Deprecated)null, "Enabled"); public ConfigEntry MapTableRange { get; } = ConfigBase.BindEx(cfg, "AutoMapTables", 64f, "If a player enters this range around a map table, their discovered information (portal/ship/ore deposits/etc. position) is transfered to the map table.", (AcceptableValueBase)null, (Deprecated)null, "MapTableRange"); public ConfigEntry PortalsPinType { get; } = ConfigBase.BindEx(cfg, "AutoMapTables", (PinType)6, "The pin type for portals on the map table", (AcceptableValueBase)(object)__acceptablePins, (Deprecated)null, "PortalsPinType"); public ConfigEntry ShipsPinType { get; } public ConfigEntry DungeonsPinType { get; } public ConfigEntry DungeonsLabel { get; } public ConfigEntry DungeonsDiscoverRange { get; } public IReadOnlyDictionary AutoUpdateOreDeposits { get; } public ConfigEntry OreDepositsDiscoverRange { get; } public ConfigEntry UpdatedMessageType { get; } public ConfigEntry DiscoveredMessageType { get; } public ConfigEntry DiscardPlayerPins { get; } public YamlConfigEntry Localization { get; } public YamlConfigEntry Advanced { get; } public Config(ConfigFile cfg, Logger logger) { //IL_008b: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected I4, but got Unknown IReadOnlyList acceptableValues = __acceptablePins.AcceptableValues; int num = 0; PinType[] array = (PinType[])(object)new PinType[1 + acceptableValues.Count]; foreach (PinType item in acceptableValues) { array[num] = (PinType)(int)item; num++; } array[num] = (PinType)10; ShipsPinType = ConfigBase.BindEx(cfg, "AutoMapTables", (PinType)10, "The pin type for ships on the map table", (AcceptableValueBase)(object)new AcceptableEnum((IEnumerable)new <>z__ReadOnlyArray(array)), (Deprecated)null, "ShipsPinType"); DungeonsPinType = ConfigBase.BindEx(cfg, "AutoMapTables", (PinType)2, "The pin type for dungeons on the map table", (AcceptableValueBase)(object)__acceptablePins, (Deprecated)null, "DungeonsPinType"); DungeonsLabel = ConfigBase.BindEx(cfg, "AutoMapTables", "Default", "The pin label for duengons", (AcceptableValueBase)null, (Deprecated)null, "DungeonsLabel"); DungeonsDiscoverRange = ConfigBase.BindEx(cfg, "AutoMapTables", 4f, "A dungeon is considered 'discovered by a player' when that player is detected within this range around the entrance", (AcceptableValueBase)null, (Deprecated)null, "DungeonsDiscoverRange"); AutoUpdateOreDeposits = GetPrefabPinConfig(cfg, logger) ?? EmptyReadOnlyCollections.Dictionary; OreDepositsDiscoverRange = ConfigBase.BindEx(cfg, "AutoMapTables", 32f, "An ore deposit is considered 'discovered by a player' when that player was within this range around the deposit while it was struck by a pickaxe", (AcceptableValueBase)null, (Deprecated)null, "OreDepositsDiscoverRange"); UpdatedMessageType = ConfigBase.BindEx(cfg, "AutoMapTables", (MessageTypes)0, "Type of message to show when a map table is updated", (AcceptableValueBase)(object)AcceptableEnum.Default, (Deprecated)null, "UpdatedMessageType"); MessageTypes[] array2 = new MessageTypes[4]; RuntimeHelpers.InitializeArray(array2, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); DiscoveredMessageType = ConfigBase.BindEx(cfg, "AutoMapTables", (MessageTypes)2, "Type of message to show to a player when they discovered map information", (AcceptableValueBase)(object)new AcceptableEnum((IEnumerable)new <>z__ReadOnlyArray((MessageTypes[])(object)array2)), (Deprecated)null, "DiscoveredMessageType"); DiscardPlayerPins = ConfigBase.BindEx(cfg, "AutoMapTables", false, "True to discard custom player pins from map tables", (AcceptableValueBase)null, (Deprecated)null, "DiscardPlayerPins"); Localization = ConfigBase.BindYaml(cfg, "Localization"); Advanced = ConfigBase.BindYaml(cfg, "Advanced"); base..ctor(cfg, logger); } private static IReadOnlyDictionary? GetPrefabPinConfig(ConfigFile cfg, Logger logger) { //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Expected O, but got Unknown Dictionary dictionary = new Dictionary(); List list = new List(); foreach (GameObject prefab in ZNetScene.instance.m_prefabs) { Smelter component = prefab.GetComponent(); if (component != null) { foreach (ItemDrop item in from x in component.m_conversion select x.m_from into x where x != null select x) { dictionary.TryAdd(item, null); } } else { MineRock5 component2 = prefab.GetComponent(); if (component2 != null) { list.Add(component2); } } } Dictionary dictionary2 = null; PinType[] array = new PinType[6]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); AcceptableEnum val = new AcceptableEnum((IEnumerable)new <>z__ReadOnlyArray((PinType[])(object)array)); foreach (MineRock5 item2 in list) { OreDepositConfig value = null; foreach (ItemDrop item3 in item2.m_dropItems.m_drops.Select((DropData x) => x.m_item.GetComponent())) { if (item3 == null || !dictionary.TryGetValue(item3, out value)) { continue; } if ((object)value == null) { string text = ((Object)item3).name; if (!char.IsUpper(text[0])) { text = $"{char.ToUpperInvariant(text[0])}{text.Substring(1)}"; } value = (dictionary[item3] = new OreDepositConfig(cfg.Bind("AutoMapTables", text + "PinType", (PinType)3, new ConfigDescription("The pin icon to use for " + Localization.instance.Localize(item3.m_itemData.m_shared.m_name) + ".\r\nPins will only be added to the map table after the ore deposit was hit at least once with a pickaxe.", (AcceptableValueBase)(object)val, Array.Empty())), cfg.Bind("AutoMapTables", text + "Label", GetDefaultLabel(text), "The label to use for " + Localization.instance.Localize(item3.m_itemData.m_shared.m_name) + " pins"))); } break; } if ((object)value != null) { (dictionary2 ?? (dictionary2 = new Dictionary())).Add(StringExtensionMethods.GetStableHashCode(((Object)((Component)item2).gameObject).name), value); } } return dictionary2; static string GetDefaultLabel(string itemName) { if (itemName.Contains("Iron", StringComparison.OrdinalIgnoreCase)) { return "Fe"; } if (itemName.Contains("Copper", StringComparison.OrdinalIgnoreCase)) { return "Cu"; } if (itemName.Contains("Silver", StringComparison.OrdinalIgnoreCase)) { return "Ag"; } if (itemName.Contains("Tin", StringComparison.OrdinalIgnoreCase)) { return "Sn"; } return "Default"; } } static Config() { PinType[] array = new PinType[6]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); __acceptablePins = new AcceptableEnum((IEnumerable)new <>z__ReadOnlyArray((PinType[])(object)array)); } } }