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 Travel v1.0.1
meadworks.travel.dll
Decompiled 29 minutes ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using MeadWorks.Core; using MeadWorks.UI; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Splatform; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("assembly_guiutils")] [assembly: IgnoresAccessChecksTo("assembly_utils")] [assembly: IgnoresAccessChecksTo("assembly_valheim")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("expDARE")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright (c) 2026 expDARE")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("meadworks.travel")] [assembly: AssemblyTitle("meadworks.travel")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 MeadWorks.Travel { internal static class BedBook { private static class Patches { [HarmonyPatch(typeof(Player), "OnSpawned")] [HarmonyPostfix] private static void Spawn(Player __instance) { if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer || (Object)(object)ZNet.instance == (Object)null) { return; } string text = "meadworks.travel.beds." + ZNet.instance.GetWorldUID(); if ((Object)(object)_player != (Object)(object)__instance || _key != text) { Clear(); _player = __instance; _key = text; if (_player.m_customData.TryGetValue(text, out var value)) { if (BedBookRules.TryRead(value, out var entries)) { foreach (BedBookRules.Entry item in entries) { Beds[item.Id] = item; } } else { _readOnly = true; MwLog.Warn((object)"travel: preserving unreadable bed list"); } } } Reconcile(); foreach (string key in Beds.Keys) { Show(key); } } [HarmonyPatch(typeof(Bed), "Awake")] [HarmonyPostfix] private static void Awake(Bed __instance) { if (!((Object)(object)__instance.m_nview == (Object)null) && __instance.m_nview.IsValid()) { Loaded[__instance.m_nview] = __instance; Observe(__instance); } } [HarmonyPatch(typeof(ZNetView), "OnDestroy")] [HarmonyPrefix] private static void Unloaded(ZNetView __instance) { Loaded.Remove(__instance); } [HarmonyPatch(typeof(Bed), "RPC_SetOwner")] [HarmonyPostfix] private static void Owner(Bed __instance) { if ((Object)(object)__instance.m_nview != (Object)null && __instance.m_nview.IsOwner() && __instance.GetOwner() != 0L) { StableObjectId.Ensure(__instance.m_nview.GetZDO()); } Observe(__instance); } [HarmonyPatch(typeof(Bed), "GetHoverText")] [HarmonyPostfix] private static void Seen(Bed __instance) { Observe(__instance); } [HarmonyPatch(typeof(ZNetScene), "OnZDODestroyed")] [HarmonyPostfix] private static void Destroyed(ZDO zdo) { if (Beds.Count != 0) { string text = BedBookRules.Identity(StableObjectId.Read(zdo)); if (text != null) { Forget(text); } } } [HarmonyPatch(typeof(Player), "Save")] [HarmonyPrefix] private static void Saving(Player __instance) { if ((Object)(object)__instance == (Object)(object)_player) { Save(); } } [HarmonyPatch(typeof(Minimap), "Start")] [HarmonyPostfix] private static void MapReady() { foreach (string key in Beds.Keys) { Show(key); } } [HarmonyPatch(typeof(Minimap), "SetMapMode")] [HarmonyPostfix] private static void MapOpened() { Reconcile(); } [HarmonyPatch(typeof(ZNet), "StopAll")] [HarmonyPrefix] private static void Leaving() { Leave(); } } private static readonly Dictionary<string, BedBookRules.Entry> Beds = new Dictionary<string, BedBookRules.Entry>(); private static readonly Dictionary<string, PinData> Pins = new Dictionary<string, PinData>(); private static readonly Dictionary<ZNetView, Bed> Loaded = new Dictionary<ZNetView, Bed>(); private static Player _player; private static string _key; private static bool _readOnly; public static void Init() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown Harmony val = new Harmony("expdare.meadworks.travel.beds"); LedgerTrack.Patch(val, "travel bed book"); val.PatchAll(typeof(Patches)); Ledger.Add("travel bed book state", (Action)Leave); } private static void Leave() { Clear(); Loaded.Clear(); } private static void Clear() { Minimap instance = Minimap.instance; foreach (PinData value in Pins.Values) { FullMap.ReleaseIfTracked(value); if ((Object)(object)instance != (Object)null) { instance.RemovePin(value); } } Pins.Clear(); Beds.Clear(); _player = null; _key = null; _readOnly = false; } private static void Save() { if ((Object)(object)_player != (Object)null && _key != null && !_readOnly) { _player.m_customData[_key] = JsonConvert.SerializeObject((object)new List<BedBookRules.Entry>(Beds.Values)); } } private static void Show(string id) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) Minimap instance = Minimap.instance; if (!((Object)(object)instance == (Object)null) && !Pins.ContainsKey(id)) { BedBookRules.Entry entry = Beds[id]; Pins[id] = instance.AddPin(new Vector3(entry.X, entry.Y, entry.Z), (PinType)5, Lang.T("travel.owned_bed", "Owned bed"), false, false, 0L, default(PlatformUserID)); } } private static void Forget(string id, bool save = true) { if (!Beds.Remove(id)) { return; } if (Pins.TryGetValue(id, out var value)) { FullMap.ReleaseIfTracked(value); if ((Object)(object)Minimap.instance != (Object)null) { Minimap.instance.RemovePin(value); } Pins.Remove(id); } if (save) { Save(); } } private static bool Owned(Bed bed) { if ((Object)(object)bed != (Object)null && (Object)(object)bed.m_nview != (Object)null && bed.m_nview.IsValid()) { return bed.GetOwner() == _player.GetPlayerID(); } return false; } private static string Observe(Bed bed, bool reconcile = false) { //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_player == (Object)null || (Object)(object)bed == (Object)null || (Object)(object)bed.m_nview == (Object)null || !bed.m_nview.IsValid()) { return null; } ZDO zDO = bed.m_nview.GetZDO(); long num = StableObjectId.Read(zDO); string text = BedBookRules.Identity(num); if (!Owned(bed)) { if (text != null) { Forget(text); } return null; } if (num == 0L) { if (zDO.IsOwner()) { num = StableObjectId.Ensure(zDO); } else if (reconcile) { Vector3 val = ((Component)_player).transform.position - zDO.GetPosition(); if (((Vector3)(ref val)).sqrMagnitude <= 100f) { StableObjectId.Request(zDO); } } text = BedBookRules.Identity(num); if (text == null) { return null; } } Vector3 pos = bed.GetSpawnPoint(); if (!reconcile && Beds.ContainsKey(text)) { return text; } BedBookRules.Entry[] array = Beds.Values.Where((BedBookRules.Entry e) => BedBookRules.LegacyMatch(e, pos.x, pos.y, pos.z)).ToArray(); BedBookRules.Entry[] array2 = array; foreach (BedBookRules.Entry entry in array2) { if (!reconcile || !ZNetScene.instance.IsAreaReady(pos) || Loaded.Values.Any((Bed other) => (Object)(object)other != (Object)(object)bed && Owned(other) && Matches(entry, other))) { return text; } } array2 = array; for (int num2 = 0; num2 < array2.Length; num2++) { Forget(array2[num2].Id, save: false); } if (Beds.ContainsKey(text) || Beds.Count >= 128) { if (array.Length != 0) { Save(); } return text; } Beds[text] = new BedBookRules.Entry { Id = text, X = pos.x, Y = pos.y, Z = pos.z }; Show(text); Save(); return text; } private static bool Matches(BedBookRules.Entry entry, Bed bed) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) Vector3 spawnPoint = bed.GetSpawnPoint(); return BedBookRules.SamePoint(entry, spawnPoint.x, spawnPoint.y, spawnPoint.z); } private static void Reconcile() { //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_player == (Object)null || (Object)(object)ZNetScene.instance == (Object)null) { return; } HashSet<string> hashSet = new HashSet<string>(); foreach (Bed value in Loaded.Values) { string text = Observe(value, reconcile: true); if (text != null) { hashSet.Add(text); } } Vector3 val = default(Vector3); foreach (KeyValuePair<string, BedBookRules.Entry> item in new List<KeyValuePair<string, BedBookRules.Entry>>(Beds)) { BedBookRules.Entry e = item.Value; ((Vector3)(ref val))..ctor(e.X, e.Y, e.Z); Vector3 val2 = ((Component)_player).transform.position - val; if (((Vector3)(ref val2)).sqrMagnitude >= 10000f || !ZNetScene.instance.IsAreaReady(val) || hashSet.Contains(item.Key)) { continue; } if (BedBookRules.TryToken(item.Key, out var token)) { if (StableObjectId.CanProveAbsent(token)) { Forget(item.Key); } } else if (!Loaded.Values.Any((Bed bed) => Owned(bed) && Matches(e, bed))) { Forget(item.Key); } } } } public static class BedBookRules { public sealed class Entry { public string Id; public float X; public float Y; public float Z; } private const string TokenPrefix = "token:"; public static bool Valid(Entry e) { if (e != null && !string.IsNullOrEmpty(e.Id) && e.Id.Length <= 80 && Finite(e.X) && Finite(e.Y)) { return Finite(e.Z); } return false; } public static string Identity(long token) { if (token != 0L) { return "token:" + token.ToString(CultureInfo.InvariantCulture); } return null; } public static bool TryToken(string id, out long token) { token = 0L; if (id != null && id.StartsWith("token:", StringComparison.Ordinal) && long.TryParse(id.Substring("token:".Length), NumberStyles.Integer, CultureInfo.InvariantCulture, out token)) { return token != 0; } return false; } public static bool LegacyMatch(Entry entry, float x, float y, float z) { if (!entry.Id.StartsWith("token:", StringComparison.Ordinal)) { return SamePoint(entry, x, y, z); } return false; } internal static bool SamePoint(Entry entry, float x, float y, float z) { float num = entry.X - x; float num2 = entry.Y - y; float num3 = entry.Z - z; return num * num + num2 * num2 + num3 * num3 <= 0.0025000002f; } private static bool Finite(float value) { if (!float.IsNaN(value) && !float.IsInfinity(value)) { return Math.Abs(value) < 100000f; } return false; } public static bool TryRead(string text, out List<Entry> entries) { entries = null; if (text == null || text.Length > 65536) { return false; } try { List<Entry> list = JsonConvert.DeserializeObject<List<Entry>>(text); if (list == null || list.Count > 128) { return false; } HashSet<string> hashSet = new HashSet<string>(); foreach (Entry item in list) { if (!Valid(item) || !hashSet.Add(item.Id)) { return false; } } entries = list; return true; } catch (JsonException) { return false; } } } public static class FullMap { private sealed class ChipUI { public MapRules.PinFilter Filter; public KitChip Chip; public Image Glyph; } private sealed class RowUI { public KitRow Row; public Image Glyph; public PinData Pin; } private sealed class PositionToggleSync : MonoBehaviour { public Toggle Original; public KitToggle Switch; private void LateUpdate() { if (!((Object)(object)Original == (Object)null) && !((Object)(object)Switch == (Object)null)) { Switch.SetValueWithoutNotify(Original.isOn); bool flag = ((Selectable)Original).IsInteractable(); if (Switch.Interactable != flag) { Switch.Interactable = flag; } } } } private sealed class ClusterBadgeHover : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler { public PinClusters.Cluster Cluster; public TextMeshProUGUI CountText; public RectTransform CountTag; public Image Icon; public void OnPointerEnter(PointerEventData eventData) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (!_clusterPinned) { OpenClusterCard(Cluster, ((Component)this).transform.position, pinned: false); } } public void OnPointerExit(PointerEventData eventData) { if (!_clusterPinned && _hoveredCluster == Cluster) { _hoverExitAt = Time.unscaledTime + 0.25f; } } } private sealed class ClusterRowHover : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler { public RowUI Row; public void OnPointerEnter(PointerEventData eventData) { _highlightRow = Row; SetHighlight(Row.Pin); } public void OnPointerExit(PointerEventData eventData) { Release(); } private void OnDisable() { Release(); } private void Release() { if (_highlightRow == Row) { _highlightRow = null; SetHighlight(null); } } } private sealed class ClusterCardHover : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler { public void OnPointerEnter(PointerEventData eventData) { _hoverExitAt = 0f; } public void OnPointerExit(PointerEventData eventData) { if (!_clusterPinned) { _hoverExitAt = Time.unscaledTime + 0.25f; } } } private sealed class Watcher : MonoBehaviour { private void LateUpdate() { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) Minimap instance = Minimap.instance; NoteSession(instance); if (Scene.NeedsRestore(((Object)(object)instance == (Object)null) ? null : instance, (Object)(object)_overlay != (Object)null, (Object)(object)_popover != (Object)null) || (NativeFilters.Owner != null && ((Object)(object)instance == (Object)null || NativeFilters.Owner != instance))) { Restore(); } if (!Enabled) { return; } if ((Object)(object)instance != (Object)null && (Object)(object)instance.m_largeRoot != (Object)null && instance.m_largeRoot.activeInHierarchy) { if ((Object)(object)_overlay == (Object)null) { Apply(); } if (ZInput.GetMouseButtonDown(0) && (Object)(object)_frame != (Object)null) { Vector3 pointerPosition = ZInput.pointerPosition; bool onFrame = (Object)(object)_mapFrame != (Object)null && ((Component)_mapFrame).gameObject.activeInHierarchy && RectTransformUtility.RectangleContainsScreenPoint(_mapFrame, Vector2.op_Implicit(pointerPosition), (Camera)null); if (MapFrameRules.ClickClosesMap(RectTransformUtility.RectangleContainsScreenPoint(_frame, Vector2.op_Implicit(pointerPosition), (Camera)null), onFrame, PointerOverPanels())) { instance.SetMapMode((MapMode)1); return; } } Tick(instance); } else { UpdateMapHealth(open: false); _course = PinCardRules.Take(_course); if ((Object)(object)_mapFrame != (Object)null && ((Component)_mapFrame).gameObject.activeSelf) { ((Component)_mapFrame).gameObject.SetActive(false); } if ((Object)(object)_overlay != (Object)null && _overlay.activeSelf) { _overlay.SetActive(false); } } } } private static class Patches { [HarmonyPatch(typeof(Minimap), "UpdatePins")] [HarmonyPrefix] [HarmonyPriority(800)] private static void BeforeUpdatePins(Minimap __instance) { ApplyFiltersToMinimap(__instance); } [HarmonyPatch(typeof(Minimap), "UpdatePins")] [HarmonyPostfix] [HarmonyPriority(0)] private static void AfterUpdatePins(Minimap __instance) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 if (!Enabled || !_active || (int)__instance.m_mode != 2) { MarkTracked(__instance); return; } UpdateClustersAndBadges(__instance); UpdatePinVisibility(__instance); UpdateClusterCard(); MarkTracked(__instance); } [HarmonyPatch(typeof(Minimap), "RemovePin", new Type[] { typeof(Vector3), typeof(float) })] [HarmonyPrefix] private static void BeforeRemoveAt() { _captureRemoval = true; } [HarmonyPatch(typeof(Minimap), "RemovePin", new Type[] { typeof(Vector3), typeof(float) })] [HarmonyPostfix] private static void AfterRemoveAt() { _captureRemoval = false; } [HarmonyPatch(typeof(Minimap), "RemovePin", new Type[] { typeof(PinData) })] [HarmonyPrefix] private static void BeforeRemovePin(PinData pin) { if (_captureRemoval && pin != null) { _captureRemoval = false; RememberRemoval(pin); } } [HarmonyPatch(typeof(Minimap), "DelayActivation")] [HarmonyPostfix] private static void AfterDelayActivation(Minimap __instance, GameObject go, ref IEnumerator __result) { __result = KeepPinNameVisibility(__result, __instance, go); } [HarmonyPatch(typeof(Minimap), "AddPin")] [HarmonyPrefix] private static void BeforeAddPin(Minimap __instance, PinType type, bool save, out int __state) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected I4, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected I4, but got Unknown __state = -1; if (Enabled && !((Object)(object)__instance == (Object)null)) { if (PinCardRules.CanEdit((int)type, save)) { _course = PinCardRules.Take(_course); } CaptureFilters(__instance); __state = MapRules.PrepareAddPin(__instance.m_visibleIconTypes, (int)type); } } [HarmonyPatch(typeof(Minimap), "AddPin")] [HarmonyPostfix] private static void AfterAddPin(Minimap __instance, int __state) { if (Enabled && !((Object)(object)__instance == (Object)null)) { bool refreshTint = MapRules.FilterTintChanged(__instance.m_visibleIconTypes, CurrentState(), __state); ApplyFiltersToMinimap(__instance, refreshTint); _dirty = true; } } [HarmonyPatch(typeof(Minimap), "ToggleIconFilter")] [HarmonyPostfix] private static void AfterToggleIconFilter(Minimap __instance, PinType type) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected I4, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected I4, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected I4, but got Unknown if (Enabled && !((Object)(object)__instance == (Object)null)) { MapRules.FilterState filterState = CurrentState(); if (MapRules.AdoptNativeFilter(__instance.m_visibleIconTypes, (int)type, filterState)) { SetFilter(MapRules.ToFilter((int)type), filterState.IsPinVisible((int)type)); } ApplyFiltersToMinimap(__instance); _dirty = true; } } [HarmonyPatch(typeof(Minimap), "SetMapMode")] [HarmonyPostfix] private static void OnSetMapMode(Minimap __instance, MapMode mode) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Invalid comparison between Unknown and I4 if ((int)mode != 2) { UpdateMapHealth(open: false); } if ((int)mode != 2 && (Object)(object)_mapFrame != (Object)null) { ((Component)_mapFrame).gameObject.SetActive(false); } if ((int)mode != 2) { _course = PinCardRules.Take(_course); CloseClusterCard(); ResetPinVisibility(); foreach (GameObject item in BadgePool) { SetVisible(item, visible: false); } } if (!Enabled || (Object)(object)__instance == (Object)null) { return; } if ((int)mode == 2) { Apply(); if ((Object)(object)_overlay != (Object)null) { _overlay.SetActive(true); } RefreshGoButton(); _dirty = true; return; } if ((Object)(object)_popover != (Object)null) { ClosePopover(); } _searchWasFocused = false; if ((Object)(object)_overlay != (Object)null) { _overlay.SetActive(false); } } [HarmonyPatch(typeof(Minimap), "OnMapLeftUp")] [HarmonyPostfix] private static void OnMapLeftUp(Minimap __instance) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (Enabled && !((Object)(object)__instance == (Object)null) && (int)__instance.m_mode == 2 && !((Object)(object)_popover != (Object)null)) { OnMapClick(ScreenToWorld(__instance, ZInput.pointerPosition)); } } [HarmonyPatch(typeof(Minimap), "ShowPinNameInput")] [HarmonyPostfix] private static void OnShowPinNameInput(Minimap __instance) { if (Enabled && _active && (Object)(object)__instance != (Object)null) { OpenPopover(__instance); } } [HarmonyPatch(typeof(Minimap), "InTextInput")] [HarmonyPostfix] private static void OnInTextInput(ref bool __result) { if (!__result && Typing) { __result = true; } } [HarmonyPatch(typeof(Minimap), "UpdateMap")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> FilterMapWheel(IEnumerable<CodeInstruction> instructions) { MethodInfo method = typeof(ZInput).GetMethod("GetMouseScrollWheel", BindingFlags.Static | BindingFlags.Public, null, Type.EmptyTypes, null); MethodInfo method2 = typeof(FullMap).GetMethod("MapScrollWheel", BindingFlags.Static | BindingFlags.NonPublic, null, Type.EmptyTypes, null); return MapWheelPatch.Rewrite(instructions, method, method2, delegate(string message) { MwLog.WarnOnce("travel.map-wheel", (object)message); }); } } internal const float Margin = 40f; internal const float PanelWidth = 320f; private const float Gutter = 12f; private const float MapLeft = 372f; private const float Inset = 16f; private const float ChipGap = 6f; private const float ChipGlyph = 14f; private const float RowGlyph = 16f; private const float ScaleMax = 90f; private const float CardGap = 18f; private const float ClusterWidth = 220f; private const float CardWidth = 260f; private const float BadgeSize = 40f; private const float RefreshEvery = 0.25f; private const int ClusterRowsShown = 6; private static Setting<bool> _on; private static Setting<bool> _pinNames; private static Setting<float> _pinSize; private static Setting<float> _hideZoom; private static readonly Dictionary<GameObject, PinData> PinsByName = new Dictionary<GameObject, PinData>(); private static readonly List<GameObject> PinNameObjects = new List<GameObject>(); private static readonly List<MapRules.PinName> PinNames = new List<MapRules.PinName>(); private static readonly HashSet<GameObject> OverlappingPinNames = new HashSet<GameObject>(); private static readonly HashSet<PinData> FoldedPins = new HashSet<PinData>(); private static readonly Dictionary<MapRules.PinFilter, Setting<bool>> FilterSettings = new Dictionary<MapRules.PinFilter, Setting<bool>>(); private static readonly MapRules.FilterState Filters = new MapRules.FilterState(); private static readonly MapFilterSnapshot NativeFilters = new MapFilterSnapshot(); private static readonly MapSceneRules MapOpen = new MapSceneRules(); private static readonly MapSceneRules Scene = new MapSceneRules(); private static bool _active; private static GameObject _overlay; private static RectTransform _frame; private static RectTransform _mapFrame; private static bool _frameLayoutValid; private static Vector2 _frameAnchorMin; private static Vector2 _frameAnchorMax; private static Vector2 _framePivot; private static Vector2 _frameOffsetMin; private static Vector2 _frameOffsetMax; private static Vector3 _frameScale; private static Quaternion _frameRotation; private static GameObject _badges; private static KitPanel _panel; private static TextMeshProUGUI _clock; private static KitSearch _search; private static TMP_InputField _searchInput; private static bool _searchWasFocused; private static KitSection _showSection; private static RectTransform _chipHost; private static readonly List<ChipUI> Chips = new List<ChipUI>(); private static readonly List<RectTransform> ChipRows = new List<RectTransform>(); private static string _chipSignature; private static int _cursorX = int.MinValue; private static int _cursorZ = int.MinValue; private static float _scaleMeters = -1f; private static long _panelSignature; private static bool _panelDrawn; private static PinData _cardPin; private static Setting<bool> _mapPinTravel; private static string _cardName; private static int _cardType; private static Vector3 _cardPos; private static Vector3 _cardPlayer; private static PinClusters.Cluster _shownCluster; private static PinData _shownSelected; private static int _shownCount; private static int _shownState; private static Vector3 _shownPlayer; private static Vector3 _shownAt; private static KitList _list; private static readonly List<RowUI> Rows = new List<RowUI>(); private static readonly List<PinData> ListPins = new List<PinData>(); private static readonly List<MapRules.PinEntry> Entries = new List<MapRules.PinEntry>(); private static readonly List<int> Types = new List<int>(); private static string _query = ""; private static int _listCount = -1; private static float _refreshAt; private static bool _dirty; private static GameObject _sharedRow; private static GameObject _sharedPanel; private static CanvasGroup[] _pickers = (CanvasGroup[])(object)new CanvasGroup[0]; private static bool _pickersShown; private static TextMeshProUGUI _cursorBiome; private static TextMeshProUGUI _cursorPos; private static TextMeshProUGUI _scaleText; private static LayoutElement _scaleLine; private static readonly List<GameObject> BadgePool = new List<GameObject>(); private static readonly List<ClusterBadgeHover> BadgeHovers = new List<ClusterBadgeHover>(); private static readonly List<PinData> VisiblePins = new List<PinData>(); private static readonly List<PinClusters.Pin> ClusterInput = new List<PinClusters.Pin>(); private static readonly PinClusters.Workspace Clusters = new PinClusters.Workspace(); private static PinData _clusterAnchor; private static PinData _highlightPin; private static RowUI _highlightRow; private static bool _clusterPinned; private static readonly List<int> OrderedClusterMembers = new List<int>(); private static readonly List<float> ClusterMemberDistances = new List<float>(); private static KitPanel _clusterCard; private static KitSection _clusterTitle; private static KitList _clusterList; private static readonly List<RowUI> ClusterRows = new List<RowUI>(); private static PinClusters.Cluster _hoveredCluster; private static Vector3 _hoverAt; private static float _hoverExitAt; private static PinData _selectedPin; private static KitPanel _pinCard; private static Image _pinCardGlyph; private static TextMeshProUGUI _pinCardName; private static TextMeshProUGUI _pinCardCoords; private static KitButton _removeButton; private static KitButton _goButton; private static KitButton _editButton; private static KitButton _trackButton; private static KitButton _undoButton; private static GameObject _editBlock; private static KitTextField _editField; private static int _editType; private static PinData _editPin; private static bool _editing; private static bool _captureRemoval; private static PinCardRules.Course _course; private static Minimap _sessionMap; private static PinData _marked; private static readonly List<KitSlot> EditSlots = new List<KitSlot>(); private static KitPanel _popover; private static Minimap _popMap; private static PinData _popPin; private static KitTextField _popField; private static int _popType; private static readonly List<KitSlot> PopSlots = new List<KitSlot>(); private static float _nativePinSize = -1f; private static List<Action> Undo => Scene.Undo; public static bool Enabled { get { if (_on != null) { return _on.Value; } return true; } } public static bool Active => _active; public static int FilterCount => MapRules.AllFilters.Length; public static int ListCount => Math.Max(0, _listCount); private static bool HintsWanted => PlatformPrefs.GetInt("KeyHints", 1) == 1; private static bool Typing => MapRules.Typing(_active, (Object)(object)_overlay != (Object)null && _overlay.activeInHierarchy, (Object)(object)_popover != (Object)null || _editing, (Object)(object)_searchInput != (Object)null && _searchInput.isFocused, _searchWasFocused); public static bool GetFilter(MapRules.PinFilter filter) { if (FilterSettings.TryGetValue(filter, out var value)) { return value?.Value ?? true; } return false; } public static void SetFilter(MapRules.PinFilter filter, bool value) { if (FilterSettings.TryGetValue(filter, out var value2) && value2 != null) { SettingsWindow.Write((Setting)(object)value2, value ? "true" : "false"); } } public static void Init(SettingsPage page) { //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Expected O, but got Unknown //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Expected O, but got Unknown //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Expected O, but got Unknown _on = page.Toggle("map_restyle", "Restyle full map", true, (SettingPolicy)0, false); ((Setting)_on).Changed += Refresh; MapRules.PinFilter[] allFilters = MapRules.AllFilters; for (int i = 0; i < allFilters.Length; i++) { MapRules.PinFilter filter = allFilters[i]; string settingKey = MapRules.GetSettingKey(filter); string text = "Show " + filter.ToString() + " pins"; Setting<bool> setting = page.Toggle(settingKey, text, true, (SettingPolicy)0, true); FilterSettings[filter] = setting; Filters.SetEnabled(filter, setting.Value); ((Setting)setting).Changed += delegate { Filters.SetEnabled(filter, setting.Value); ApplyFiltersToMinimap(); _dirty = true; }; } _pinNames = page.Toggle("map_pin_names", "Map pin names", true, (SettingPolicy)0, false); ((Setting)_pinNames).Changed += ApplyPinLook; _pinSize = page.Slider("map_pin_size", "Map pin size", 48f, 32f, 64f, 4f, (SettingPolicy)0, false); ((Setting)_pinSize).Changed += ApplyPinLook; _hideZoom = page.Slider("map_pin_hide_zoom", "Hide pins beyond zoom", 0.15f, 0.01f, 1f, 0.01f, (SettingPolicy)0, false); ((Setting)_hideZoom).Changed += RefreshPins; Harmony val = new Harmony("expdare.meadworks.travel.fullmap"); val.PatchAll(typeof(Patches)); LedgerTrack.Patch(val, "travel full map"); GameObject val2 = new GameObject("MeadWorks.FullMapWatcher"); Object.DontDestroyOnLoad((Object)val2); val2.AddComponent<Watcher>(); LedgerTrack.Object<GameObject>(val2, "travel full map watcher"); Theme.Changed += OnThemeChanged; _mapPinTravel = MapPinTravel.Register(page); ((Setting)_mapPinTravel).Changed += OnMapPinTravelChanged; Ledger.Add("travel full map state", (Action)delegate { Theme.Changed -= OnThemeChanged; ((Setting)_mapPinTravel).Changed -= OnMapPinTravelChanged; _mapPinTravel = null; Restore(); _on = null; _pinNames = null; _pinSize = null; _hideZoom = null; FilterSettings.Clear(); _course = PinCardRules.Clear(_course); SyncTracked(); _editing = false; _marked = null; _sessionMap = null; }); PinTeleport.Init(); Refresh(); } public static void Refresh() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 if (!Enabled) { Restore(); return; } Minimap instance = Minimap.instance; if ((Object)(object)instance != (Object)null && (int)instance.m_mode == 2) { Apply(); } } public static void Restore() { _course = PinCardRules.Take(_course); ResetPinVisibility(); MapOpen.Restore(); Scene.Restore(); RestoreFilters(); DropOverlay(); _selectedPin = null; _active = false; } private static void OnThemeChanged() { DropOverlay(); } private static void DropOverlay() { FinishPopoverSession(); ResetPinVisibility(); if ((Object)(object)_mapFrame != (Object)null) { ((Component)_mapFrame).gameObject.SetActive(false); Object.Destroy((Object)(object)((Component)_mapFrame).gameObject); _mapFrame = null; _frameLayoutValid = false; } if ((Object)(object)_overlay != (Object)null) { try { Object.Destroy((Object)(object)_overlay); } catch { } _overlay = null; } if ((Object)(object)_badges != (Object)null) { try { Object.Destroy((Object)(object)_badges); } catch { } _badges = null; } _panel = null; _search = null; _searchInput = null; _searchWasFocused = false; _list = null; _clusterCard = null; _clusterList = null; _pinCard = null; _goButton = null; _editButton = null; _trackButton = null; _undoButton = null; _editBlock = null; _editField = null; _editing = false; _popover = null; _popPin = null; _popField = null; _sharedRow = null; _hoveredCluster = null; _clusterAnchor = null; _clusterPinned = false; _hoverExitAt = 0f; _chipSignature = null; _cursorX = (_cursorZ = int.MinValue); _scaleMeters = -1f; _panelDrawn = false; _cardPin = null; _shownCluster = null; _listCount = -1; Chips.Clear(); ChipRows.Clear(); Rows.Clear(); ClusterRows.Clear(); PopSlots.Clear(); EditSlots.Clear(); BadgePool.Clear(); BadgeHovers.Clear(); VisiblePins.Clear(); ClusterInput.Clear(); Clusters.Clear(); OrderedClusterMembers.Clear(); ClusterMemberDistances.Clear(); ListPins.Clear(); } private static MapRules.FilterState CurrentState() { return Filters; } private static void ApplyFiltersToMinimap() { ApplyFiltersToMinimap(Minimap.instance); } private static void ApplyFiltersToMinimap(Minimap mm, bool refreshTint = true) { if (!Enabled || (Object)(object)mm == (Object)null) { return; } CaptureFilters(mm); if (MapRules.ReconcileFilters(mm.m_visibleIconTypes, CurrentState())) { mm.m_pinUpdateRequired = true; if (refreshTint) { RefreshFilterIcons(mm); } } } private static void CaptureFilters(Minimap mm) { if (NativeFilters.Owner != mm) { RestoreFilters(); } NativeFilters.Capture(mm, mm.m_visibleIconTypes); } private static void RestoreFilters() { object obj = NativeFilters.Restore(); Minimap val = (Minimap)((obj is Minimap) ? obj : null); if (!((Object)(object)val == (Object)null)) { val.m_pinUpdateRequired = true; RefreshFilterIcons(val); } } private static void RefreshFilterIcons(Minimap mm) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected I4, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair<PinType, Image> selectedIcon in mm.m_selectedIcons) { if (!((Object)(object)selectedIcon.Value == (Object)null) && !((Object)(object)((Component)selectedIcon.Value).transform.parent == (Object)null)) { Image component = ((Component)((Component)selectedIcon.Value).transform.parent).GetComponent<Image>(); int num = (int)selectedIcon.Key; if ((Object)(object)component != (Object)null && num >= 0 && num < mm.m_visibleIconTypes.Length) { ((Graphic)component).color = (mm.m_visibleIconTypes[num] ? Color.white : Color.gray); } } } } public static void Apply() { if (!Enabled) { return; } Minimap instance = Minimap.instance; if (Scene.Owner != instance) { Restore(); } if (!((Object)(object)instance == (Object)null) && !((Object)(object)instance.m_largeRoot == (Object)null)) { ApplyFiltersToMinimap(); HideHints(instance); if (Scene.Owner == null) { Suppress(instance); } if ((Object)(object)_overlay == (Object)null) { BuildOverlay(instance); } _active = true; UpdateMapHealth(open: true); } } private static void UpdateMapHealth(bool open) { if (!open) { MapOpen.Restore(); return; } Hud instance = Hud.instance; Transform val = (((Object)(object)instance == (Object)null || (Object)(object)instance.m_healthBarRoot == (Object)null) ? null : ((Transform)instance.m_healthBarRoot).parent); if ((Object)(object)val == (Object)null || MapOpen.Owner == val) { return; } MapOpen.Capture(val); CanvasGroup group = ((Component)val).GetComponent<CanvasGroup>(); bool added = (Object)(object)group == (Object)null; if (added) { group = ((Component)val).gameObject.AddComponent<CanvasGroup>(); } float alpha = group.alpha; group.alpha = 0f; MapOpen.Undo.Add(delegate { if (!((Object)(object)group == (Object)null)) { group.alpha = alpha; if (added) { Object.Destroy((Object)(object)group); } } }); } private static void HideHints(Minimap mm) { if (mm.m_hints == null) { return; } foreach (GameObject hint in mm.m_hints) { if ((Object)(object)hint != (Object)null && hint.activeSelf) { hint.SetActive(false); } } } private static void Suppress(Minimap mm) { Scene.Capture(mm); Undo.Add(delegate { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 if ((Object)(object)mm == (Object)null || mm.m_hints == null || (int)mm.m_mode != 2 || !HintsWanted) { return; } foreach (GameObject hint in mm.m_hints) { if ((Object)(object)hint != (Object)null) { hint.SetActive(true); } } }); if ((Object)(object)mm.m_biomeNameLarge != (Object)null && ((Component)mm.m_biomeNameLarge).gameObject.activeSelf) { ((Component)mm.m_biomeNameLarge).gameObject.SetActive(false); Undo.Add(delegate { if ((Object)(object)mm.m_biomeNameLarge != (Object)null) { ((Component)mm.m_biomeNameLarge).gameObject.SetActive(true); } }); } Image backdrop = mm.m_largeRoot.GetComponent<Image>(); if ((Object)(object)backdrop != (Object)null) { bool enabled = ((Behaviour)backdrop).enabled; ((Behaviour)backdrop).enabled = false; Undo.Add(delegate { if ((Object)(object)backdrop != (Object)null) { ((Behaviour)backdrop).enabled = enabled; } }); } FitMap(mm); Veil(mm, "PublicPanel"); Veil(mm, "SharedPanel"); CanvasGroup val = Veil(mm, "IconPanel"); CanvasGroup val2 = Veil(mm, "IconPanel2"); List<CanvasGroup> list = new List<CanvasGroup>(); if ((Object)(object)val != (Object)null) { list.Add(val); } if ((Object)(object)val2 != (Object)null) { list.Add(val2); } _pickers = list.ToArray(); _pickersShown = false; Undo.Add(delegate { _pickers = (CanvasGroup[])(object)new CanvasGroup[0]; }); ApplyPinLook(); } private static void FitMap(Minimap mm) { if ((Object)(object)mm.m_mapImageLarge == (Object)null) { return; } RectTransform rectTransform = ((Graphic)mm.m_mapImageLarge).rectTransform; Fit(rectTransform); RectTransform[] array = (RectTransform[])(object)new RectTransform[2] { mm.m_pinRootLarge, mm.m_pinNameRootLarge }; foreach (RectTransform val in array) { if ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)rectTransform && (Object)(object)((Transform)val).parent != (Object)(object)((Component)rectTransform).transform) { Fit(val); } } } private static void Fit(RectTransform rt) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) Vector2 min = rt.anchorMin; Vector2 max = rt.anchorMax; Vector2 offMin = rt.offsetMin; Vector2 offMax = rt.offsetMax; rt.anchorMin = Vector2.zero; rt.anchorMax = Vector2.one; rt.offsetMin = new Vector2(372f, 40f); rt.offsetMax = new Vector2(-40f, -40f); Undo.Add(delegate { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)rt == (Object)null)) { rt.anchorMin = min; rt.anchorMax = max; rt.offsetMin = offMin; rt.offsetMax = offMax; } }); } private static CanvasGroup Veil(Minimap mm, string name) { Transform val = mm.m_largeRoot.transform.Find(name); if ((Object)(object)val == (Object)null) { return null; } CanvasGroup group = ((Component)val).GetComponent<CanvasGroup>(); bool added = (Object)(object)group == (Object)null; if (added) { group = ((Component)val).gameObject.AddComponent<CanvasGroup>(); } float alpha = group.alpha; bool raycasts = group.blocksRaycasts; group.alpha = 0f; group.blocksRaycasts = false; Undo.Add(delegate { if (!((Object)(object)group == (Object)null)) { group.alpha = alpha; group.blocksRaycasts = raycasts; if (added) { Object.Destroy((Object)(object)group); } } }); return group; } private static void ShowPickers(bool show) { if (show == _pickersShown) { return; } _pickersShown = show; CanvasGroup[] pickers = _pickers; foreach (CanvasGroup val in pickers) { if (!((Object)(object)val == (Object)null)) { val.alpha = (show ? 1f : 0f); val.blocksRaycasts = show; } } } private static void ApplyPinLook() { Minimap mm = Minimap.instance; if ((Object)(object)mm == (Object)null || Scene.Owner != mm) { return; } if ((Object)(object)mm.m_pinNameRootLarge != (Object)null) { bool flag = _pinNames == null || _pinNames.Value; if (((Component)mm.m_pinNameRootLarge).gameObject.activeSelf != flag) { ((Component)mm.m_pinNameRootLarge).gameObject.SetActive(flag); } } if (_nativePinSize < 0f) { _nativePinSize = mm.m_pinSizeLarge; Undo.Add(delegate { if ((Object)(object)mm != (Object)null) { if ((Object)(object)mm.m_pinNameRootLarge != (Object)null) { ((Component)mm.m_pinNameRootLarge).gameObject.SetActive(true); } SetPinSize(mm, _nativePinSize); } _nativePinSize = -1f; }); } SetPinSize(mm, (_pinSize != null) ? _pinSize.Value : _nativePinSize); } private static void SetPinSize(Minimap mm, float size) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 if (Mathf.Approximately(mm.m_pinSizeLarge, size)) { return; } mm.m_pinSizeLarge = size; if ((int)mm.m_mode != 2 || mm.m_pins == null) { return; } foreach (PinData pin in mm.m_pins) { if (pin != null) { mm.DestroyPinMarker(pin); } } mm.m_pinUpdateRequired = true; } private static void BuildOverlay(Minimap mm) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown _overlay = new GameObject("MeadWorks.MapOverlay", new Type[1] { typeof(RectTransform) }); _overlay.transform.SetParent(mm.m_largeRoot.transform, false); Stretch((RectTransform)_overlay.transform, 0f, 0f, 0f, 0f); _frame = Child("Frame", _overlay.transform); MapFrameRules.CloseRect(40f, out var left, out var bottom, out var right, out var top); Stretch(_frame, left, bottom, right, top); if ((Object)(object)mm.m_mapImageLarge != (Object)null) { _badges = new GameObject("MeadWorks.ClusterBadges", new Type[1] { typeof(RectTransform) }); _badges.transform.SetParent(((Component)mm.m_mapImageLarge).transform, false); Stretch((RectTransform)_badges.transform, 0f, 0f, 0f, 0f); } BuildMapChrome(mm); BuildSidePanel(mm); BuildClusterCard(); BuildPinCard(); _dirty = true; _refreshAt = 0f; } internal static RectTransform Child(string name, Transform parent) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); return (RectTransform)val.transform; } internal static void Stretch(RectTransform rt, float left, float bottom, float right, float top) { //IL_0001: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) rt.anchorMin = Vector2.zero; rt.anchorMax = Vector2.one; rt.offsetMin = new Vector2(left, bottom); rt.offsetMax = new Vector2(0f - right, 0f - top); } private static void Corner(RectTransform rt, Vector2 corner, Vector2 position) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_001a: Unknown result type (might be due to invalid IL or missing references) Vector2 val = (rt.pivot = corner); Vector2 anchorMin = (rt.anchorMax = val); rt.anchorMin = anchorMin; rt.anchoredPosition = position; } private static HorizontalLayoutGroup RowLayout(GameObject go, float gap, TextAnchor align = (TextAnchor)3) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) HorizontalLayoutGroup obj = go.AddComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)obj).spacing = gap; ((LayoutGroup)obj).childAlignment = align; bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true); ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = childControlWidth; childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false); ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = childControlWidth; return obj; } internal static VerticalLayoutGroup ColumnLayout(GameObject go, float gap) { VerticalLayoutGroup obj = go.AddComponent<VerticalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)obj).spacing = gap; bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true); ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = childControlWidth; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; return obj; } internal static LayoutElement Size(GameObject go, float width, float height) { LayoutElement val = go.GetComponent<LayoutElement>() ?? go.AddComponent<LayoutElement>(); if (width > 0f) { float minWidth = (val.preferredWidth = width); val.minWidth = minWidth; val.flexibleWidth = 0f; } if (height > 0f) { float minWidth = (val.preferredHeight = height); val.minHeight = minWidth; val.flexibleHeight = 0f; } return val; } internal static TextMeshProUGUI Label(Transform parent, string name, string value, float size, Color color) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI obj = Kit.Label(parent, name, value); ((TMP_Text)obj).fontSize = size; ((Graphic)obj).color = color; ((Graphic)obj).raycastTarget = false; ((TMP_Text)obj).alignment = (TextAlignmentOptions)4097; return obj; } internal static Image Glyph(Transform parent, string glyph, float size, Color color) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) RectTransform val = Child("Glyph", parent); Image obj = ((Component)val).gameObject.AddComponent<Image>(); obj.sprite = Glyphs.Get(glyph); ((Graphic)obj).color = color; ((Graphic)obj).raycastTarget = false; Size(((Component)val).gameObject, size, size); return obj; } internal static RectTransform GlassChip(string name, Transform parent) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = Child(name, parent); ((Graphic)HudParts.PanelBox((Transform)(object)obj, Theme.Radius)).raycastTarget = false; ((LayoutGroup)RowLayout(((Component)obj).gameObject, 8f, (TextAnchor)3)).padding = new RectOffset(10, 10, 0, 0); Size(((Component)obj).gameObject, 0f, 30f); ContentSizeFitter obj2 = ((Component)obj).gameObject.AddComponent<ContentSizeFitter>(); FitMode horizontalFit = (FitMode)2; obj2.verticalFit = (FitMode)2; obj2.horizontalFit = horizontalFit; return obj; } private static void BuildMapChrome(Minimap mm) { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01be: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) Transform transform = _overlay.transform; if ((Object)(object)mm.m_mapImageLarge != (Object)null) { RectTransform rectTransform = ((Graphic)mm.m_mapImageLarge).rectTransform; _mapFrame = Child("MeadWorks.MapFrame", ((Transform)rectTransform).parent); HudParts.Box((Transform)(object)_mapFrame, Theme.PanelSolid, Theme.Border, Theme.RadiusWindow, 1f); Graphic[] componentsInChildren = ((Component)_mapFrame).GetComponentsInChildren<Graphic>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].raycastTarget = false; } ((Transform)_mapFrame).SetAsFirstSibling(); _frameLayoutValid = false; UpdateMapFrame(mm); } RectTransform obj = GlassChip("CursorChip", transform); Corner(obj, new Vector2(0f, 1f), new Vector2(388f, -56f)); _cursorBiome = Label((Transform)(object)obj, "Biome", "", 13f, Theme.Text); _cursorPos = Label((Transform)(object)obj, "Position", "", 13f, Theme.TextDim); RectTransform obj2 = Child("Zoom", transform); Corner(obj2, new Vector2(1f, 1f), new Vector2(-56f, -56f)); ColumnLayout(((Component)obj2).gameObject, 6f); ContentSizeFitter obj3 = ((Component)obj2).gameObject.AddComponent<ContentSizeFitter>(); FitMode horizontalFit = (FitMode)2; obj3.verticalFit = (FitMode)2; obj3.horizontalFit = horizontalFit; ZoomButton((Transform)(object)obj2, "plus", 0.71428573f); ZoomButton((Transform)(object)obj2, "minus", 1.4f); RectTransform val = GlassChip("Scale", transform); Corner(val, new Vector2(0f, 0f), new Vector2(388f, 56f)); _scaleText = Label((Transform)(object)val, "Text", "", 13f, Theme.Text); RectTransform obj4 = Child("Line", (Transform)(object)val); Image obj5 = ((Component)obj4).gameObject.AddComponent<Image>(); ((Graphic)obj5).color = Theme.TextDim; ((Graphic)obj5).raycastTarget = false; _scaleLine = Size(((Component)obj4).gameObject, 90f, 2f); if (HintsWanted) { RectTransform obj6 = Kit.KeyHints(transform, (IList<string[]>)new List<string[]> { new string[2] { "2×LMB", Lang.T("travel.pin", "Pin") }, new string[2] { "LMB", Lang.T("travel.cross_off", "Cross off") }, new string[2] { "RMB", Lang.T("travel.remove", "Remove") }, new string[2] { "MMB", Lang.T("travel.ping", "Ping") }, new string[2] { MapKey(), Lang.T("travel.close", "Close") } }, true); Corner(obj6, new Vector2(1f, 0f), new Vector2(-56f, 56f)); ContentSizeFitter obj7 = ((Component)obj6).gameObject.AddComponent<ContentSizeFitter>(); horizontalFit = (FitMode)2; obj7.verticalFit = (FitMode)2; obj7.horizontalFit = horizontalFit; Graphic[] componentsInChildren = ((Component)obj6).GetComponentsInChildren<Graphic>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].raycastTarget = false; } } } private static string MapKey() { try { string text = ((Localization.instance != null) ? Localization.instance.GetBoundKeyString("Map", false) : null); if (!string.IsNullOrEmpty(text)) { return text; } } catch { } return "M"; } private static void ZoomButton(Transform parent, string glyph, float factor) { KitButton obj = Kit.Button(parent, (string)null, (Action)delegate { Minimap instance = Minimap.instance; if ((Object)(object)instance != (Object)null) { instance.LargeZoom = Mathf.Clamp(instance.LargeZoom * factor, instance.m_minZoom, instance.m_maxZoom); } }, false); obj.Glyph = glyph; obj.HoverName = ((glyph == "plus") ? Lang.T("travel.zoom_in", "Zoom in") : Lang.T("travel.zoom_out", "Zoom out")); obj.Square = true; } private static void BuildSidePanel(Minimap mm) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) _panel = Kit.Panel(_overlay.transform, Lang.T("travel.map", "Map"), 320f); ContentSizeFitter component = ((Component)_panel).GetComponent<ContentSizeFitter>(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = false; } RectTransform val = (RectTransform)((Component)_panel).transform; val.anchorMin = new Vector2(0f, 0f); val.anchorMax = new Vector2(0f, 1f); val.pivot = new Vector2(0f, 0.5f); val.offsetMin = new Vector2(40f, 40f); val.offsetMax = new Vector2(360f, -40f); _clock = Label((Transform)(object)_panel.HeadEnd, "Clock", "", 13f, Theme.TextDim); RectTransform content = _panel.Content; _search = Kit.Search((Transform)(object)content, MapRules.SearchPlaceholder(0), (Action<string>)delegate(string q) { _query = q ?? ""; _dirty = true; }); _search.HitCount = (string q) => MapRules.BuildList(Entries, CurrentState(), q).Count; _search.Query = _query; _searchInput = ((Component)_search).GetComponentInChildren<TMP_InputField>(true); _showSection = Kit.Section((Transform)(object)content, Lang.T("travel.show", "Show"), Lang.T("travel.all", "All"), false); _chipHost = Child("Chips", (Transform)(object)content); ColumnLayout(((Component)_chipHost).gameObject, 6f); NoMinWidth(((Component)_chipHost).gameObject); MapRules.PinFilter[] allFilters = MapRules.AllFilters; foreach (MapRules.PinFilter pinFilter in allFilters) { MapRules.PinFilter f = pinFilter; KitChip val2 = Kit.Chip((Transform)(object)_chipHost, MapRules.GetFilterLabel(f), (Action)delegate { SetFilter(f, !GetFilter(f)); }); Image val3 = Glyph(((Component)val2).transform, MapRules.Glyph(f), 14f, Theme.TextDim); Transform val4 = ((Component)val2).transform.Find("Label"); if ((Object)(object)val4 != (Object)null) { ((Component)val3).transform.SetSiblingIndex(val4.GetSiblingIndex()); } Chips.Add(new ChipUI { Filter = f, Chip = val2, Glyph = val3 }); } Kit.Section((Transform)(object)content, Lang.T("travel.pins", "Pins"), (string)null, false); _list = Kit.List((Transform)(object)content, 96f); _list.Bare = true; LayoutElement component2 = ((Component)_list).GetComponent<LayoutElement>(); if ((Object)(object)component2 != (Object)null) { component2.flexibleHeight = 1f; } RectTransform obj = Child("Rule", (Transform)(object)content); Image obj2 = ((Component)obj).gameObject.AddComponent<Image>(); ((Graphic)obj2).color = Theme.Line; ((Graphic)obj2).raycastTarget = false; Size(((Component)obj).gameObject, 0f, 1f); BuildOptions(mm, (Transform)(object)content); } private static void BuildOptions(Minimap mm, Transform body) { RectTransform val = Child("Options", body); ColumnLayout(((Component)val).gameObject, 2f); Toggle pub = mm.m_publicPosition; if ((Object)(object)pub != (Object)null) { KitToggle val2 = Kit.Toggle((Transform)(object)val, Lang.T("travel.visible_to_other_players", "Visible to other players"), pub.isOn, (Action<bool>)delegate(bool v) { if ((Object)(object)pub != (Object)null) { pub.isOn = v; } }); PositionToggleSync positionToggleSync = ((Component)val2).gameObject.AddComponent<PositionToggleSync>(); positionToggleSync.Original = pub; positionToggleSync.Switch = val2; } Transform val3 = mm.m_largeRoot.transform.Find("SharedPanel"); Toggle shared = (((Object)(object)val3 != (Object)null) ? ((Component)val3).GetComponentInChildren<Toggle>(true) : null); if ((Object)(object)shared != (Object)null) { TextMeshProUGUI componentInChildren = ((Component)shared).GetComponentInChildren<TextMeshProUGUI>(true); KitToggle val4 = Kit.Toggle((Transform)(object)val, ((Object)(object)componentInChildren != (Object)null && !string.IsNullOrEmpty(((TMP_Text)componentInChildren).text)) ? ((TMP_Text)componentInChildren).text : Lang.T("travel.shared_map", "Shared map"), shared.isOn, (Action<bool>)delegate(bool v) { if ((Object)(object)shared != (Object)null) { shared.isOn = v; } }); PositionToggleSync positionToggleSync2 = ((Component)val4).gameObject.AddComponent<PositionToggleSync>(); positionToggleSync2.Original = shared; positionToggleSync2.Switch = val4; _sharedRow = ((Component)val4).gameObject; _sharedPanel = ((Component)val3).gameObject; _sharedRow.SetActive(_sharedPanel.activeSelf); } Kit.Toggle((Transform)(object)val, Lang.T("travel.pin_names", "Pin names"), _pinNames == null || _pinNames.Value, (Action<bool>)delegate(bool v) { if (_pinNames != null) { SettingsWindow.Write((Setting)(object)_pinNames, v ? "true" : "false"); } }).Interactable = _pinNames != null && ((Setting)_pinNames).Editable; Kit.Section((Transform)(object)val, Lang.T("travel.pin_size", "Pin size"), (string)null, false); Kit.Slider((Transform)(object)val, 32f, 64f, (_pinSize != null) ? _pinSize.Value : 48f, 4f, (Action<float>)delegate(float v) { if (_pinSize != null) { SettingsWindow.Write((Setting)(object)_pinSize, v.ToString(CultureInfo.InvariantCulture)); } }).Locked = _pinSize == null || !((Setting)_pinSize).Editable; } private static void BuildClusterCard() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) _clusterCard = Kit.Panel(_overlay.transform, (string)null, 220f); _clusterCard.Tooltip = true; RectTransform val = (RectTransform)((Component)_clusterCard).transform; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0.5f, 0.5f); val.anchorMax = val2; val.anchorMin = val2; val.pivot = new Vector2(0f, 1f); ((Component)_clusterCard).gameObject.AddComponent<ClusterCardHover>(); _clusterTitle = Kit.Section((Transform)(object)_clusterCard.Content, MapRules.ClusterTitle(0), (string)null, false); _clusterList = Kit.List((Transform)(object)_clusterCard.Content, 32f); _clusterList.Bare = true; ((Component)_clusterCard).gameObject.SetActive(false); } private static void BuildPinCard() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) _pinCard = Kit.Panel(_overlay.transform, (string)null, 260f); RectTransform val = (RectTransform)((Component)_pinCard).transform; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0.5f, 0.5f); val.anchorMax = val2; val.anchorMin = val2; val.pivot = new Vector2(0f, 1f); RectTransform obj = Child("Head", (Transform)(object)_pinCard.Content); RowLayout(((Component)obj).gameObject, 8f, (TextAnchor)3); _pinCardGlyph = Glyph((Transform)(object)obj, "pin", 16f, Theme.TextDim); _pinCardName = Label((Transform)(object)obj, "Name", "", Theme.FontSize, Theme.Heading); Kit.WrapText((TMP_Text)(object)_pinCardName); _pinCardCoords = Label((Transform)(object)_pinCard.Content, "Coords", "", 13f, Theme.TextDim); RectTransform obj2 = Child("Buttons", (Transform)(object)_pinCard.Content); ((HorizontalOrVerticalLayoutGroup)RowLayout(((Component)obj2).gameObject, 8f, (TextAnchor)3)).childForceExpandWidth = true; _removeButton = Kit.Button((Transform)(object)obj2, Lang.T("travel.remove", "Remove"), (Action)RemoveSelected, false); _removeButton.Size = (ButtonSize)1; _removeButton.Fit = false; KitButton obj3 = Kit.Button((Transform)(object)obj2, Lang.T("travel.ping", "Ping"), (Action)PingSelected, true); obj3.Size = (ButtonSize)1; obj3.Fit = false; _goButton = Kit.Button((Transform)(object)_pinCard.Content, Lang.T("travel.go_here", "Go here"), (Action)GoSelected, false); _goButton.Size = (ButtonSize)1; _goButton.Fit = false; ((Component)_goButton).gameObject.SetActive(false); _editButton = Kit.Button((Transform)(object)_pinCard.Content, Lang.T("travel.edit", "Edit"), (Action)BeginEdit, false); _editButton.Size = (ButtonSize)1; _editButton.Fit = false; _trackButton = Kit.Button((Transform)(object)_pinCard.Content, Lang.T("travel.track", "Track"), (Action)TrackSelected, true); _trackButton.Size = (ButtonSize)1; _trackButton.Fit = false; _undoButton = Kit.Button((Transform)(object)_pinCard.Content, Lang.T("travel.undo", "Undo"), (Action)UndoRemoval, false); _undoButton.Size = (ButtonSize)1; _undoButton.Fit = false; _editBlock = ((Component)Child("Edit", (Transform)(object)_pinCard.Content)).gameObject; ColumnLayout(_editBlock.gameObject, 8f); RectTransform obj4 = Child("Name", _editBlock.transform); Size(((Component)obj4).gameObject, 0f, 30f); _editField = Kit.TextField((Transform)(object)obj4, "", (Action<string>)null); _editField.Fill = true; RectTransform val3 = Child("Icons", _editBlock.transform); RowLayout(((Component)val3).gameObject, 6f, (TextAnchor)3); EditSlots.Clear(); Minimap instance = Minimap.instance; int[] placeableTypes = MapRules.PlaceableTypes; foreach (int num in placeableTypes) { int t = num; KitSlot val4 = Kit.Slot((Transform)(object)val3, (SlotSize)4); val4.Icon = (((Object)(object)instance != (Object)null) ? instance.GetSprite((PinType)t) : null); val4.OnClick = delegate { ChooseEditType(t); }; EditSlots.Add(val4); } RectTransform obj5 = Child("EditButtons", _editBlock.transform); ((HorizontalOrVerticalLayoutGroup)RowLayout(((Component)obj5).gameObject, 8f, (TextAnchor)3)).childForceExpandWidth = true; KitButton obj6 = Kit.Button((Transform)(object)obj5, Lang.T("travel.cancel", "Cancel"), (Action)CancelEdit, false); obj6.Size = (ButtonSize)1; obj6.Fit = false; KitButton obj7 = Kit.Button((Transform)(object)obj5, Lang.T("travel.save", "Save"), (Action)SaveEdit, true); obj7.Size = (ButtonSize)1; obj7.Fit = false; _editBlock.SetActive(false); ((Component)_pinCard).gameObject.SetActive(false); } public static void PingSelected() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) _course = PinCardRules.Take(_course); if (_selectedPin != null && (Object)(object)Chat.instance != (Object)null) { Chat.instance.SendPing(_selectedPin.m_pos); } } private static void GoSelected() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected I4, but got Unknown Minimap instance = Minimap.instance; if (!((Object)(object)instance == (Object)null) && (int)instance.m_mode == 2 && _selectedPin != null && instance.m_pins != null && instance.m_pins.Contains(_selectedPin) && CardPinVisible(instance, _selectedPin)) { _course = PinCardRules.Take(_course); if (MapPinTravel.GoHere(_mapPinTravel, _selectedPin.m_pos, MapRules.IsListed((int)_selectedPin.m_type))) { instance.SetMapMode((MapMode)1); } } } private static void OnMapPinTravelChanged() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 Minimap instance = Minimap.instance; if (!((Object)(object)instance == (Object)null) && (int)instance.m_mode == 2) { if (_selectedPin != null && !VisiblePin(instance, _selectedPin) && MapPinTravel.Mode(_mapPinTravel) != MapPinTravelMode.Player) { SelectPin(null); } RefreshGoButton(); } } private static void RefreshGoButton() { if (!((Object)(object)_goButton == (Object)null)) { bool visible = _selectedPin != null && !_editing && (Object)(object)_popover == (Object)null && MapPinTravel.Mode(_mapPinTravel) != MapPinTravelMode.None; SetVisible(((Component)_goButton).gameObject, visible); } } public static void RemoveSelected() { Minimap instance = Minimap.instance; if (_selectedPin != null && !((Object)(object)instance == (Object)null) && CanRemove(_selectedPin)) { _captureRemoval = true; instance.RemovePin(_selectedPin); _captureRemoval = false; _selectedPin = null; _editing = false; _dirty = true; UpdatePinCard(instance); } } private static void TrackSelected() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected I4, but got Unknown if (_selectedPin != null && PinCardRules.CanTrack((int)_selectedPin.m_type)) { _course = PinCardRules.Take(_course); _course = PinCardRules.Track(_course, _selectedPin); SyncTracked(); Minimap instance = Minimap.instance; if ((Object)(object)instance != (Object)null) { instance.m_pinUpdateRequired = true; } } } private static void SyncTracked() { object destination = _course.Destination; CompassPins.SetTracked((PinData)((destination is PinData) ? destination : null)); } private static void BeginEdit() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected I4, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected I4, but got Unknown PinData selectedPin = _selectedPin; Minimap instance = Minimap.instance; if (selectedPin == null || (Object)(object)instance == (Object)null || !PinCardRules.CanEdit((int)selectedPin.m_type, selectedPin.m_save)) { return; } _course = PinCardRules.Take(_course); _editing = true; _editPin = selectedPin; _editType = (int)selectedPin.m_type; UpdatePinCard(instance); if ((Object)(object)_editField != (Object)null) { _editField.Value = selectedPin.m_name ?? ""; if ((Object)(object)instance.m_nameInput != (Object)null && ((TMP_InputField)instance.m_nameInput).characterLimit > 0) { _editField.MaxLength = ((TMP_InputField)instance.m_nameInput).characterLimit; } _editField.Focus(); } for (int i = 0; i < EditSlots.Count && i < MapRules.PlaceableTypes.Length; i++) { if (!((Object)(object)EditSlots[i] == (Object)null)) { if ((Object)(object)EditSlots[i].Icon == (Object)null) { EditSlots[i].Icon = instance.GetSprite((PinType)MapRules.PlaceableTypes[i]); } EditSlots[i].Chosen = MapRules.PlaceableTypes[i] == _editType; } } } private static void ChooseEditType(int type) { _editType = type; for (int i = 0; i < EditSlots.Count && i < MapRules.PlaceableTypes.Length; i++) { if ((Object)(object)EditSlots[i] != (Object)null) { EditSlots[i].Chosen = MapRules.PlaceableTypes[i] == type; } } if ((Object)(object)_editField != (Object)null) { _editField.Focus(); } } private static void CancelEdit() { _editing = false; } private static void SaveEdit() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected I4, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) Minimap instance = Minimap.instance; PinData selectedPin = _selectedPin; _editing = false; if (!((Object)(object)instance == (Object)null) && selectedPin != null && instance.m_pins != null && instance.m_pins.Contains(selectedPin)) { int limit = (((Object)(object)instance.m_nameInput != (Object)null) ? ((TMP_InputField)instance.m_nameInput).characterLimit : 0); string author = (((PlatformUserID)(ref selectedPin.m_author)).IsValid ? ((object)Unsafe.As<PlatformUserID, PlatformUserID>(ref selectedPin.m_author)/*cast due to .constrained prefix*/).ToString() : ""); PinCardRules.Edit edit = PinCardRules.Apply(PinCardRules.CanEdit((int)selectedPin.m_type, selectedPin.m_save), ((Object)(object)_editField != (Object)null) ? _editField.Value : "", _editType, limit, selectedPin.m_checked, selectedPin.m_ownerID, author); if (edit.Ok) { selectedPin.m_name = edit.Name; selectedPin.m_type = (PinType)edit.Type; selectedPin.m_icon = instance.GetSprite(selectedPin.m_type); selectedPin.m_checked = edit.Checked; RewritePinText(instance, selectedPin); _cardPin = null; _dirty = true; } } } private static void UndoRemoval() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) Minimap instance = Minimap.instance; _course = PinCardRules.ExpireUndo(_course, Time.unscaledTime, (Object)(object)instance != (Object)null && (int)instance.m_mode == 2); if (_course.Undo.HasValue) { PinCardRules.Removed value = _course.Undo.Value; _course = PinCardRules.Take(_course); if (!((Object)(object)instance == (Object)null)) { PlatformUserID val = (PlatformUserID)(string.IsNullOrEmpty(value.Author) ? PlatformUserID.None : new PlatformUserID(value.Author)); PinData pin = instance.AddPin(new Vector3(value.X, value.Y, value.Z), (PinType)value.Type, value.Name ?? "", value.Save, value.Checked, value.Owner, val); _dirty = true; SelectPin(pin); } } } private static void RememberRemoval(PinData pin) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected I4, but got Unknown if (pin != null) { _course = PinCardRules.Remember(_course, new PinCardRules.Removed { Name = (pin.m_name ?? ""), Type = (int)pin.m_type, X = pin.m_pos.x, Y = pin.m_pos.y, Z = pin.m_pos.z, Checked = pin.m_checked, Save = pin.m_save, Owner = pin.m_ownerID, Author = (((PlatformUserID)(ref pin.m_author)).IsValid ? ((object)Unsafe.As<PlatformUserID, PlatformUserID>(ref pin.m_author)/*cast due to .constrained prefix*/).ToString() : "") }, Time.unscaledTime); if (_course.Destination == pin) { _course = PinCardRules.Track(_course, pin); } SyncTracked(); TransportMarkers.Detach(pin); _editing = false; _dirty = true; } } internal static void ReleaseIfTracked(PinData pin) { if (pin != null && _course.Destination == pin) { _course = PinCardRules.Track(_course, pin); } SyncTracked(); } internal static void RewritePinText(Minimap mm, PinData pin) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown if ((Object)(object)mm == (Object)null || pin == null) { return; } if ((Object)(object)pin.m_iconElement != (Object)null && (Object)(object)pin.m_icon != (Object)null) { pin.m_iconElement.sprite = pin.m_icon; } if (string.IsNullOrEmpty(pin.m_name)) { if (pin.m_NamePinData != null && (Object)(object)pin.m_NamePinData.PinNameGameObject != (Object)null) { Object.Destroy((Object)(object)pin.m_NamePinData.PinNameGameObject); } pin.m_NamePinData = null; } else if (pin.m_NamePinData == null) { pin.m_NamePinData = new PinNameData(pin); } else if ((Object)(object)pin.m_NamePinData.PinNameGameObject != (Object)null) { Object.Destroy((Object)(object)pin.m_NamePinData.PinNameGameObject); } mm.m_pinUpdateRequired = true; } private static bool CanRemove(PinData pin) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected I4, but got Unknown //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected I4, but got Unknown if (MapRules.IsListed((int)pin.m_type)) { return MapRules.ToFilter((int)pin.m_type) != MapRules.PinFilter.Players; } return false; } public static void SelectPin(PinData pin) { _course = PinCardRules.Take(_course); Minimap instance = Minimap.instance; if (!VisiblePin(instance, pin) && (!NativePinShown(pin) || MapPinTravel.Mode(_mapPinTravel) != MapPinTravelMode.Player)) { pin = null; } _selectedPin = pin; _dirty = true; if ((Object)(object)instance != (Object)null) { instance.m_pinUpdateRequired = true; UpdatePinCard(instance); } } private static void CentreOn(PinData pin) { //IL_002a: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) Minimap instance = Minimap.instance; Player localPlayer = Player.m_localPlayer; if (!((Object)(object)instance == (Object)null) && !((Object)(object)localPlayer == (Object)null) && VisiblePin(instance, pin)) { instance.m_mapOffset = pin.m_pos - ((Component)localPlayer).transform.position; } } public static void OnMapClick(Vector3 worldPos) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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) //IL_008c: Unknown result type (might be due to invalid IL or missing references) Minimap instance = Minimap.instance; if ((Object)(object)instance == (Object)null) { return; } CloseClusterCard(); float num = instance.m_removeRadius * (instance.LargeZoom * 2f); PinData val = instance.GetClosestPin(worldPos, num, true); if (MapPinTravel.Mode(_mapPinTravel) == MapPinTravelMode.Player && instance.m_pins != null) { float num2 = ((val == null) ? num : FlatDistance(worldPos, val.m_pos)); foreach (PinData pin in instance.m_pins) { if (pin != null && !pin.m_save && NativePinShown(pin)) { float num3 = FlatDistance(worldPos, pin.m_pos); if (!(num3 >= num2)) { val = pin; num2 = num3; } } } } SelectPin(val); } private static void UpdatePinCard(Minimap mm) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Expected O, but got Unknown //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Expected I4, but got Unknown //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_0330: 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_0343: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Expected I4, but got Unknown //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Expected O, but got Unknown //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Expected O, but got Unknown //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Expected O, but got Unknown //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Expected I4, but got Unknown //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_04df: 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_0533: 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_048e: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_05e2: Unknown result type (might be due to invalid IL or missing references) //IL_05e9: Expected O, but got Unknown //IL_0633: Unknown result type (might be due to invalid IL or missing references) //IL_0638: Unknown result type (might be due to invalid IL or missing references) //IL_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_060d: Unknown result type (might be due to invalid IL or missing references) //IL_0612: Unknown result type (might be due to invalid IL or missing references) //IL_0620: Unknown result type (might be due to invalid IL or missing references) //IL_063d: Unknown result type (might be due to invalid IL or missing references) //IL_0649: Unknown result type (might be due to invalid IL or missing references) //IL_064e: Unknown result type (might be due to invalid IL or missing references) //IL_0655: Expected O, but got Unknown _course = PinCardRules.ExpireUndo(_course, Time.unscaledTime, (int)mm.m_mode == 2); if ((Object)(object)_pinCard == (Object)null) { return; } if (_selectedPin != null && (mm.m_pins == null || !mm.m_pins.Contains(_selectedPin) || !CardPinVisible(mm, _selectedPin))) { _selectedPin = null; _editing = false; } if (_selectedPin != _editPin) { _editing = false; _editPin = _selectedPin; } bool hasValue = _course.Undo.HasValue; bool flag = (_selectedPin != null || hasValue) && (Object)(object)_popover == (Object)null; bool activeSelf = ((Component)_pinCard).gameObject.activeSelf; if (activeSelf != flag) { ((Component)_pinCard).gameObject.SetActive(flag); } if (!flag) { _cardPin = null; return; } bool flag2 = _editing && _selectedPin != null; SetVisible(_editBlock, flag2); SetVisible(((Object)(object)_pinCardName != (Object)null) ? ((Component)((TMP_Text)_pinCardName).transform.parent).gameObject : null, !flag2); SetVisible(((Object)(object)_pinCardCoords != (Object)null) ? ((Component)_pinCardCoords).gameObject : null, _selectedPin != null && !flag2); bool flag3 = _selectedPin != null && !flag2; if ((Object)(object)_removeButton != (Object)null) { SetVisible(((Component)((Component)_removeButton).transform.parent).gameObject, flag3); } if (!flag3) { _cardPin = null; if ((Object)(object)_goButton != (Object)null) { SetVisible(((Component)_goButton).gameObject, visible: false); } } if ((Object)(object)_editButton != (Object)null && !flag3) { SetVisible(((Component)_editButton).gameObject, visible: false); } if ((Object)(object)_trackButton != (Object)null && !flag3) { SetVisible(((Component)_trackButton).gameObject, visible: false); } if ((Object)(object)_undoButton != (Object)null) { SetVisible(((Component)_undoButton).gameObject, hasValue && !flag2); } if (!flag2 && _selectedPin == null) { PinCardRules.Removed value = _course.Undo.Value; string name = (string.IsNullOrEmpty(value.Name) ? Lang.T("travel.pin", "Pin") : value.Name); SetText((TMP_Text)(object)_pinCardName, MapRules.DisplayName(LocalizePinName(name), value.Type)); if ((Object)(object)_pinCardGlyph != (Object)null) { _pinCardGlyph.sprite = Glyphs.Get(MapRules.Glyph(MapRules.ToFilter(value.Type))); _pinCardGlyph.preserveAspect = false; } if (!activeSelf) { Vector2 val = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle((RectTransform)_overlay.transform, Vector2.op_Implicit(ZInput.pointerPosition), (Camera)null, ref val); PlaceCard((RectTransform)((Component)_pinCard).transform, Vector2.op_Implicit(val)); } return; } Rect rect; if (flag2) { RectTransform val2 = (RectTransform)_overlay.transform; ? val3; if (!((Object)(object)_selectedPin.m_uiElement != (Object)null)) { rect = val2.rect; float xMax = ((Rect)(ref rect)).xMax; rect = val2.rect; val3 = new Vector3(xMax, ((Rect)(ref rect)).yMax, 0f); } else { val3 = ((Transform)val2).InverseTransformPoint(((Transform)_selectedPin.m_uiElement).position); } Vector3 at = (Vector3)val3; PlaceCard((RectTransform)((Component)_pinCard).transform, at); return; } if (_selectedPin != _cardPin) { RefreshGoButton(); } bool flag4 = PinCardRules.CanEdit((int)_selectedPin.m_type, _selectedPin.m_save); if (((Component)_editButton).gameObject.activeSelf != flag4) { ((Component)_editButton).gameObject.SetActive(flag4); } bool flag5 = PinCardRules.CanTrack((int)_selectedPin.m_type); if (((Component)_trackButton).gameObject.activeSelf != flag5) { ((Component)_trackButton).gameObject.SetActive(flag5); } string text = ((_course.Destination == _selectedPin) ? Lang.T("travel.stop_tracking", "Stop tracking") : Lang.T("travel.track", "Track")); if (_trackButton.Label != text) { _trackButton.Label = text; } int num = (int)_selectedPin.m_type; Vector3 val4 = PlayerPosition(); if (_selectedPin != _cardPin || (object)_selectedPin.m_name != _cardName || num != _cardType || _selectedPin.m_pos != _cardPos || val4 != _cardPlayer) { _cardPin = _selectedPin; _cardName = _selectedPin.m_name; _cardType = num; _cardPos = _selectedPin.m_pos; _cardPlayer = val4; SetText((TMP_Text)(object)_pinCardName, MapRules.DisplayName(LocalizePinName(_selectedPin.m_name), num)); SetText((TMP_Text)(object)_pinCardCoords, MapRules.FormatPinCoords(_selectedPin.m_pos.x, _selectedPin.m_pos.z) + " " + MapRules.FormatDistance(FlatDistance(val4, _selectedPin.m_pos))); Sprite val5 = ((TransportMarkers.IsMarker(_selectedPin) || !MapRules.IsListed(num)) ? _selectedPin.m_icon : null); _pinCardGlyph.sprite = (((Object)(object)val5 != (Object)null) ? val5 : Glyphs.Get(MapRules.Glyph(MapRules.ToFilter(num)))); _pinCardGlyph.preserveAspect = (Object)(object)val5 != (Object)null; } bool flag6 = CanRemove(_selectedPin); if (_removeButton.Interactable != flag6) { _removeButton.Interactable = flag6; } RectTransform val6 = (RectTransform)_overlay.transform; ? val7; if (!((Object)(object)_selectedPin.m_uiElement != (Object)null)) { rect = val6.rect; float xMax2 = ((Rect)(ref rect)).xMax; rect = val6.rect; val7 = new Vector3(xMax2, ((Rect)(ref rect)).yMax, 0f); } else { val7 = ((Transform)val6).InverseTransformPoint(((Transform)_selectedPin.m_uiElement).position); } Vector3 at2 = (Vector3)val7; PlaceCard((RectTransform)((Component)_pinCard).transform, at2); } private static void PlaceCard(RectTransform card, Vector3 at) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) Rect rect = ((RectTransform)_overlay.transform).rect; float x = at.x; float y = at.y; Rect rect2 = card.rect; float width = ((Rect)(ref rect2)).width; rect2 = card.rect; MapRules.PlaceCard(x, y, width, ((Rect)(ref rect2)).height, 18f, ((Rect)(ref rect)).xMin + 372f + 16f, ((Rect)(ref rect)).yMin + 40f + 16f, ((Rect)(ref rect)).xMax - 40f - 16f, ((Rect)(ref rect)).yMax - 40f - 16f, out var left, out var top); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(left, top); if (card.anchoredPosition != val) { card.anchoredPosition = val; } } private static void OpenPopover(Minimap mm) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected I4, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Expected O, but got Unknown //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) ClosePopover(); if (ZInput.IsGamepadActive() || ZInput.IsTouchActive()) { return; } PinData namePin = mm.m_namePin; if (namePin == null || (Object)(object)_overlay == (Object)null) { return; } if ((Object)(object)mm.m_nameInput != (Object)null) { ((Component)mm.m_nameInput).gameObject.SetActive(false); } _popPin = namePin; _popMap = mm; _popType = (int)namePin.m_type; _selectedPin = null; mm.m_pinUpdateRequired = true; _popover = Kit.Panel(_overlay.transform, (string)null, 260f); RectTransform val = (RectTransform)((Component)_popover).transform; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0.5f, 0.5f); val.anchorMax = val2; val.anchorMin = val2; val.pivot = new Vector2(0f, 1f); RectTransform obj = Child("Name", (Transform)(object)_popover.Content); Size(((Component)obj).gameObject, 0f, 30f); _popField = Kit.TextField((Transform)(object)obj, "", (Action<string>)null); _popField.Fill = true; if ((Object)(object)mm.m_nameInput != (Object)null && ((TMP_InputField)mm.m_nameInput).characterLimit > 0) { _popField.MaxLength = ((TMP_InputField)mm.m_nameInput).characterLimit; } RectTransform val3 = Child("Icons", (Transform)(object)_popover.Content); RowLayout(((Component)val3).gameObject, 6f, (TextAnchor)3); PopSlots.Clear(); int[] placeableTypes = MapRules.PlaceableTypes; foreach (int num in placeableTypes) { int t = num; KitSlot val4 = Kit.Slot((Transform)(object)val3, (SlotSize)4); val4.Icon = mm.GetSprite((PinType)t); val4.Chosen = t == _popType; val4.OnClick = delegate { ChoosePopType(t); }; PopSlots.Add(val4); } RectTransform obj2 = Child("Buttons", (Transform)(object)_popover.Content); ((HorizontalOrVerticalLayoutGroup)RowLayout(((Component)obj2).gameObject, 8f, (TextAnchor)3)).childForceExpandWidth = true; KitButton obj3 = Kit.Button((Transform)(object)obj2, Lang.T("travel.cancel", "Cancel"), (Action)CancelPopover, false); obj3.Size = (ButtonSize)1; obj3.Fit = false; KitButton obj4 = Kit.Button((Transform)(object)obj2, Lang.T("travel.add_pin", "Add pin"), (Action)ConfirmPopover, true); obj4.Size = (ButtonSize)1; obj4.Fit = false; LayoutRebuilder.ForceRebuildLayoutImmediate(val); Vector2 val5 = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle((RectTransform)_overlay.transform, Vector2.op_Implicit(ZInput.pointerPosition), (Camera)null, ref val5); PlaceCard(val, Vector2.op_Implic