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 AutoMapTables v2.0.0
ServersideQoL.AutoMapTables.dll
Decompiled 13 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; 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<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { 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<T>.Count => _items.Length; T IReadOnlyList<T>.this[int index] => _items[index]; int ICollection<T>.Count => _items.Length; bool ICollection<T>.IsReadOnly => true; T IList<T>.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<T> IEnumerable<T>.GetEnumerator() { return ((IEnumerable<T>)_items).GetEnumerator(); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return ((ICollection<T>)_items).Contains(item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { ((ICollection<T>)_items).CopyTo(array, arrayIndex); } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { return ((IList<T>)_items).IndexOf(item); } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } } [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() { 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<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) { if (!EqualityComparer<T>.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<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) { if (!EqualityComparer<T>.Default.Equals(_item, item)) { return -1; } return 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.AutoMapTables { [BepInPlugin("ArgusMagnus.ServersideQoL.AutoMapTables", "ServersideQoL.AutoMapTables", "2.0.0")] public sealed class AutoMapTablesPlugin : ServersideQoLPluginBase<AutoMapTablesPlugin, Config> { 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<AutoMapTablesProcessor>(); } private void Awake() { } } [Processor("05450dd6-13bd-42cc-9bd3-b1eed5e501af")] [DependsOn<PlayerRegistryProcessor>] public sealed class AutoMapTablesProcessor : Processor<AutoMapTablesProcessor.PrefabInfo> { 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 <MineRockPinConfig>k__BackingField ?? (<MineRockPinConfig>k__BackingField = ((MineRock5 != null && ConfigBase<Config>.Instance.AutoUpdateOreDeposits.TryGetValue(((ProcessorPrefabInfo)this).PrefabInfo.PrefabHash, out value)) ? value : null)); } } public Piece? Piece => <Piece>k__BackingField ?? (<Piece>k__BackingField = ((ProcessorPrefabInfo)this).PrefabInfo.GetComponent<Piece>()); 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<PieceTable>(); } goto IL_005b; IL_005b: return true; } } [CompilerGenerated] private Config.OreDepositConfig? <MineRockPinConfig>k__BackingField; [CompilerGenerated] private Piece? <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<MapTable>.Default.GetHashCode(MapTable)) * -1521134295 + EqualityComparer<PrivateArea>.Default.GetHashCode(PrivateArea)) * -1521134295 + EqualityComparer<TeleportWorld>.Default.GetHashCode(TeleportWorld)) * -1521134295 + EqualityComparer<Ship>.Default.GetHashCode(Ship)) * -1521134295 + EqualityComparer<MineRock5>.Default.GetHashCode(MineRock5)) * -1521134295 + EqualityComparer<LocationProxy>.Default.GetHashCode(LocationProxy)) * -1521134295 + EqualityComparer<Config.OreDepositConfig>.Default.GetHashCode(<MineRockPinConfig>k__BackingField)) * -1521134295 + EqualityComparer<Piece>.Default.GetHashCode(<Piece>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<MapTable>.Default.Equals(MapTable, other.MapTable) && EqualityComparer<PrivateArea>.Default.Equals(PrivateArea, other.PrivateArea) && EqualityComparer<TeleportWorld>.Default.Equals(TeleportWorld, other.TeleportWorld) && EqualityComparer<Ship>.Default.Equals(Ship, other.Ship) && EqualityComparer<MineRock5>.Default.Equals(MineRock5, other.MineRock5) && EqualityComparer<LocationProxy>.Default.Equals(LocationProxy, other.LocationProxy) && EqualityComparer<Config.OreDepositConfig>.Default.Equals(<MineRockPinConfig>k__BackingField, other.<MineRockPinConfig>k__BackingField)) { return EqualityComparer<Piece>.Default.Equals(<Piece>k__BackingField, other.<Piece>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; <MineRockPinConfig>k__BackingField = original.<MineRockPinConfig>k__BackingField; <Piece>k__BackingField = original.<Piece>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<ServersideQoLZDO> <UpToDateMapTables>k__BackingField; [CompilerGenerated] private HashSet<ServersideQoLZDO> <Portals>k__BackingField; [CompilerGenerated] private HashSet<ServersideQoLZDO> <Ships>k__BackingField; [CompilerGenerated] private HashSet<ServersideQoLZDO> <OreVeins>k__BackingField; [CompilerGenerated] private Dictionary<ServersideQoLZDO, (Vector3, string)?> <Dungeons>k__BackingField; public PlayerID PlayerID { get; } = playerID; public HashSet<ServersideQoLZDO> UpToDateMapTables => <UpToDateMapTables>k__BackingField ?? (<UpToDateMapTables>k__BackingField = new HashSet<ServersideQoLZDO>()); public HashSet<ServersideQoLZDO> Portals => <Portals>k__BackingField ?? (<Portals>k__BackingField = new HashSet<ServersideQoLZDO>()); public HashSet<ServersideQoLZDO> Ships => <Ships>k__BackingField ?? (<Ships>k__BackingField = new HashSet<ServersideQoLZDO>()); public HashSet<ServersideQoLZDO> OreVeins => <OreVeins>k__BackingField ?? (<OreVeins>k__BackingField = new HashSet<ServersideQoLZDO>()); public Dictionary<ServersideQoLZDO, (Vector3, string)?> Dungeons => <Dungeons>k__BackingField ?? (<Dungeons>k__BackingField = new Dictionary<ServersideQoLZDO, (Vector3, string)?>()); } private sealed class MapTableState(ServersideQoLZDO zdo) { public ServersideQoLZDO ZDO { get; } = zdo; public uint LastDataRevision { get; set; } public HashSet<ServersideQoLZDO>? Wards { get; set; } public HashSet<PlayerID>? PermittedPlayerIDs { get; set; } } public const string Id = "05450dd6-13bd-42cc-9bd3-b1eed5e501af"; private readonly Dictionary<ServersideQoLZDO, MapTableState> _mapTables = new Dictionary<ServersideQoLZDO, MapTableState>(); private readonly Dictionary<PlayerID, PlayerState> _playerStates = new Dictionary<PlayerID, PlayerState>(); private readonly HashSet<ServersideQoLZDO> _wards = new HashSet<ServersideQoLZDO>(); private readonly Dictionary<PlayerID, (Peer, PlayerState)> _updateList = new Dictionary<PlayerID, (Peer, PlayerState)>(); private readonly List<Pin> _pins = new List<Pin>(); 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<HashSet<PlayerID>> __playerIDsVar = ServersideQoLPluginBase<AutoMapTablesPlugin, Config>.RegisterServerVar<HashSet<PlayerID>>("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<Config>.Instance.MapTableRange.Value * ConfigBase<Config>.Instance.MapTableRange.Value; _oreDepositRangeSqr = ConfigBase<Config>.Instance.OreDepositsDiscoverRange.Value * ConfigBase<Config>.Instance.OreDepositsDiscoverRange.Value; _dungeonRangeSqr = ConfigBase<Config>.Instance.DungeonsDiscoverRange.Value * ConfigBase<Config>.Instance.DungeonsDiscoverRange.Value; _oreDepositPins.Clear(); foreach (var (val3, val4) in ConfigBase<Config>.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<PrefabInfo>.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<PlayerID> hashSet = __playerIDsVar.Get(item, (HashSet<PlayerID>)null); if (hashSet == null) { continue; } foreach (PlayerID item2 in hashSet) { GetOrAddPlayerState(item2).Dungeons.Add(item, null); } if ((int)ConfigBase<Config>.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<GameObject> 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<PlayerID> hashSet2 = __playerIDsVar.Get(item, (HashSet<PlayerID>)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<ServersideQoLZDO, MapTableState> 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<PrivateArea>().GetFloat((Func<Expression<Func<PrivateArea, float>>>)(() => (PrivateArea x) => x.m_radius), "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.AutoMapTables\\AutoMapTablesProcessor.cs", 123))) { value2 = mapTableState; (value2.Wards ?? (value2.Wards = new HashSet<ServersideQoLZDO>())).Add(ward); } } UpdateMapTablePermittedPlayerIDs(mapTableState); } } protected unsafe override ProcessResult Process(ServersideQoLZDO zdo, IReadOnlyList<Peer> 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<PrivateArea>().GetFloat((Func<Expression<Func<PrivateArea, float>>>)(() => (PrivateArea x) => x.m_radius), "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.AutoMapTables\\AutoMapTablesProcessor.cs", 145))) { MapTableState mapTableState = value; (mapTableState.Wards ?? (mapTableState.Wards = new HashSet<ServersideQoLZDO>())).Add(ward); } } UpdateMapTablePermittedPlayerIDs(value); } Enumerator<Peer> enumerator2 = ListExtensions.Enumerate<Peer>(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<ServersideQoLZDO> 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<ServersideQoLZDO, MapTableState> 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<PrivateArea>().GetFloat((Func<Expression<Func<PrivateArea, float>>>)(() => (PrivateArea x) => x.m_radius), "C:\\repos\\Valheim.ServersideQoL\\ServersideQoL.AutoMapTables\\AutoMapTablesProcessor.cs", 183))) { mapTableState = mapTableState2; (mapTableState.Wards ?? (mapTableState.Wards = new HashSet<ServersideQoLZDO>())).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<PlayerID> hashSet3 = null; Enumerator<Peer> enumerator5 = ListExtensions.Enumerate<Peer>(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<PlayerID>)null) ?? new HashSet<PlayerID>(); } hashSet3.Add(valueOrDefault2); value3.UpToDateMapTables.Clear(); if ((int)prefabInfo.MineRockPinConfig.PinType.Value != 8) { Processor.ShowMessage((IEnumerable<Peer>)new <>z__ReadOnlySingleElementList<Peer>(current4), zdo, ConfigBase<Config>.Instance.Localization.Value.Discovered(prefabInfo.MineRock5.m_name), ConfigBase<Config>.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<PlayerID> hashSet4 = null; Teleport[] componentsInChildren = prefab.GetComponentsInChildren<Teleport>(); foreach (Teleport val3 in componentsInChildren) { Vector3 val4 = zdo.ZDO.GetPosition() + zdo.ZDO.GetRotation() * ((Component)val3).gameObject.transform.position; if (Character.InInterior(val4)) { continue; } Enumerator<Peer> enumerator6 = ListExtensions.Enumerate<Peer>(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<PlayerID>)null) ?? new HashSet<PlayerID>(); } hashSet4.Add(valueOrDefault3); value4.UpToDateMapTables.Clear(); if ((int)ConfigBase<Config>.Instance.DungeonsPinType.Value != 8) { Processor.ShowMessage((IEnumerable<Peer>)new <>z__ReadOnlySingleElementList<Peer>(current5), zdo, ConfigBase<Config>.Instance.Localization.Value.Discovered(val3.m_enterText), ConfigBase<Config>.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<PlayerID> 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<ServersideQoLZDO> 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<PlayerID>())); } } } private unsafe void UpdateMapTable(MapTableState state, Dictionary<PlayerID, (Peer, PlayerState)> 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<ZPackage>.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<Config>.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<Config>.Instance.PortalsPinType.Value != 8) { foreach (ServersideQoLZDO portal in item2.Portals) { List<Pin> 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<Config>.Instance.PortalsPinType.Value, IsChecked: false, "ArgusMagnus.ServersideQoL.AutoMapTables")); } } if ((int)ConfigBase<Config>.Instance.ShipsPinType.Value != 8) { foreach (ServersideQoLZDO ship in item2.Ships) { List<Pin> pins2 = _pins; val2 = item2.PlayerID; pins2.Add(new Pin(((PlayerID)(ref val2)).AsModPlayerID(), Processor<PrefabInfo>.GetProcessorPrefabInfo(ship).Piece.m_name, ship.ZDO.GetPosition(), ConfigBase<Config>.Instance.ShipsPinType.Value, IsChecked: false, "ArgusMagnus.ServersideQoL.AutoMapTables")); } } if (_oreDepositPins.Count != 0) { foreach (ServersideQoLZDO oreVein in item2.OreVeins) { PrefabInfo processorPrefabInfo = Processor<PrefabInfo>.GetProcessorPrefabInfo(oreVein); if ((object)processorPrefabInfo == null) { continue; } Config.OreDepositConfig mineRockPinConfig = processorPrefabInfo.MineRockPinConfig; if ((object)mineRockPinConfig == null) { continue; } ConfigEntry<PinType> pinType = mineRockPinConfig.PinType; if (pinType != null && (int)pinType.Value != 8) { MineRock5 mineRock = processorPrefabInfo.MineRock5; if (mineRock != null) { List<Pin> 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<Config>.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<Teleport>(); 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<Pin> pins4 = _pins; val2 = item2.PlayerID; pins4.Add(new Pin(((PlayerID)(ref val2)).AsModPlayerID(), (ConfigBase<Config>.Instance.DungeonsLabel.Value == "Default") ? tuple3.Item2 : ConfigBase<Config>.Instance.DungeonsLabel.Value, val4.ZDO.GetPosition(), ConfigBase<Config>.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<Config>.Instance.Localization.Value.Updated, ConfigBase<Config>.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<PlayerID, PlayerState> 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<PlayerID, PlayerState> 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<PlayerID> hashSet = __playerIDsVar.Get(zdo, (HashSet<PlayerID>)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<Config> { public sealed record OreDepositConfig(ConfigEntry<PinType> PinType, ConfigEntry<string> 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<PinType> __acceptablePins; internal const string DefaultOreDepositName = "Default"; public override ConfigEntry<bool> Enabled { get; } = ConfigBase<Config>.BindEx<bool>(cfg, "AutoMapTables", true, "Enables/disables the entire mod", (AcceptableValueBase)null, (Deprecated<Config>)null, "Enabled"); public ConfigEntry<float> MapTableRange { get; } = ConfigBase<Config>.BindEx<float>(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<Config>)null, "MapTableRange"); public ConfigEntry<PinType> PortalsPinType { get; } = ConfigBase<Config>.BindEx<PinType>(cfg, "AutoMapTables", (PinType)6, "The pin type for portals on the map table", (AcceptableValueBase)(object)__acceptablePins, (Deprecated<Config>)null, "PortalsPinType"); public ConfigEntry<PinType> ShipsPinType { get; } public ConfigEntry<PinType> DungeonsPinType { get; } public ConfigEntry<string> DungeonsLabel { get; } public ConfigEntry<float> DungeonsDiscoverRange { get; } public IReadOnlyDictionary<int, OreDepositConfig> AutoUpdateOreDeposits { get; } public ConfigEntry<float> OreDepositsDiscoverRange { get; } public ConfigEntry<MessageTypes> UpdatedMessageType { get; } public ConfigEntry<MessageTypes> DiscoveredMessageType { get; } public ConfigEntry<bool> DiscardPlayerPins { get; } public YamlConfigEntry<LocalizationConfig> Localization { get; } public YamlConfigEntry<AdvancedConfig> 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<PinType> 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<Config>.BindEx<PinType>(cfg, "AutoMapTables", (PinType)10, "The pin type for ships on the map table", (AcceptableValueBase)(object)new AcceptableEnum<PinType>((IEnumerable<PinType>)new <>z__ReadOnlyArray<PinType>(array)), (Deprecated<Config>)null, "ShipsPinType"); DungeonsPinType = ConfigBase<Config>.BindEx<PinType>(cfg, "AutoMapTables", (PinType)2, "The pin type for dungeons on the map table", (AcceptableValueBase)(object)__acceptablePins, (Deprecated<Config>)null, "DungeonsPinType"); DungeonsLabel = ConfigBase<Config>.BindEx<string>(cfg, "AutoMapTables", "Default", "The pin label for duengons", (AcceptableValueBase)null, (Deprecated<Config>)null, "DungeonsLabel"); DungeonsDiscoverRange = ConfigBase<Config>.BindEx<float>(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<Config>)null, "DungeonsDiscoverRange"); AutoUpdateOreDeposits = GetPrefabPinConfig(cfg, logger) ?? EmptyReadOnlyCollections<int, OreDepositConfig>.Dictionary; OreDepositsDiscoverRange = ConfigBase<Config>.BindEx<float>(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<Config>)null, "OreDepositsDiscoverRange"); UpdatedMessageType = ConfigBase<Config>.BindEx<MessageTypes>(cfg, "AutoMapTables", (MessageTypes)0, "Type of message to show when a map table is updated", (AcceptableValueBase)(object)AcceptableEnum<MessageTypes>.Default, (Deprecated<Config>)null, "UpdatedMessageType"); MessageTypes[] array2 = new MessageTypes[4]; RuntimeHelpers.InitializeArray(array2, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); DiscoveredMessageType = ConfigBase<Config>.BindEx<MessageTypes>(cfg, "AutoMapTables", (MessageTypes)2, "Type of message to show to a player when they discovered map information", (AcceptableValueBase)(object)new AcceptableEnum<MessageTypes>((IEnumerable<MessageTypes>)new <>z__ReadOnlyArray<MessageTypes>((MessageTypes[])(object)array2)), (Deprecated<Config>)null, "DiscoveredMessageType"); DiscardPlayerPins = ConfigBase<Config>.BindEx<bool>(cfg, "AutoMapTables", false, "True to discard custom player pins from map tables", (AcceptableValueBase)null, (Deprecated<Config>)null, "DiscardPlayerPins"); Localization = ConfigBase<Config>.BindYaml<LocalizationConfig>(cfg, "Localization"); Advanced = ConfigBase<Config>.BindYaml<AdvancedConfig>(cfg, "Advanced"); base..ctor(cfg, logger); } private static IReadOnlyDictionary<int, OreDepositConfig>? 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<ItemDrop, OreDepositConfig> dictionary = new Dictionary<ItemDrop, OreDepositConfig>(); List<MineRock5> list = new List<MineRock5>(); foreach (GameObject prefab in ZNetScene.instance.m_prefabs) { Smelter component = prefab.GetComponent<Smelter>(); 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<MineRock5>(); if (component2 != null) { list.Add(component2); } } } Dictionary<int, OreDepositConfig> dictionary2 = null; PinType[] array = new PinType[6]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); AcceptableEnum<PinType> val = new AcceptableEnum<PinType>((IEnumerable<PinType>)new <>z__ReadOnlyArray<PinType>((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<ItemDrop>())) { 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<PinType>("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<object>())), cfg.Bind<string>("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<int, OreDepositConfig>())).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<PinType>((IEnumerable<PinType>)new <>z__ReadOnlyArray<PinType>((PinType[])(object)array)); } } }