Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of ClearMinimap v0.2.0
Mods/ClearMinimap.dll
Decompiled 2 weeks agousing System; using System.Diagnostics; using System.Numerics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using ClearMinimap; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppScheduleOne.DevUtilities; using Il2CppScheduleOne.GameTime; using Il2CppScheduleOne.Map; using Il2CppScheduleOne.Persistence; using Il2CppScheduleOne.PlayerScripts; using Il2CppScheduleOne.Property; using Il2CppScheduleOne.Quests; using Il2CppScheduleOne.UI; using Il2CppScheduleOne.UI.MainMenu; using Il2CppScheduleOne.UI.Phone; using Il2CppScheduleOne.UI.Phone.Map; using Il2CppSystem; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using ModSettings; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(Main), "Clear Minimap", "0.2.0", "holyfurries", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("ClearMinimap")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.2.0.0")] [assembly: AssemblyInformationalVersion("0.2.0+7c23cd66edf530fbaa3690ea74cb05f52b0d5f4b")] [assembly: AssemblyProduct("ClearMinimap")] [assembly: AssemblyTitle("ClearMinimap")] [assembly: AssemblyVersion("0.2.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace ClearMinimap { public sealed class Main : MelonMod { private readonly MinimapView view = new MinimapView(); private MelonPreferences_Entry<float> map_size; private MelonPreferences_Entry<bool> enabled; private bool running; private bool failed; private bool conflict; private float refresh_seconds; private int objective_count_previous = -1; public override void OnInitializeMelon() { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown MelonPreferences_Category val = MelonPreferences.CreateCategory("ClearMinimap"); map_size = val.CreateEntry<float>("size", 280f, "Minimap size", (string)null, false, false, (ValueValidator)null, (string)null); enabled = val.CreateEntry<bool>("enabled", true, "Show minimap", (string)null, false, false, (ValueValidator)null, (string)null); Settings.toggle("Clear Minimap", "Show minimap", enabled); Settings.slider("Clear Minimap", "Minimap size", map_size, 200f, 360f, true); ((MelonBase)this).HarmonyInstance.Patch((MethodBase)AccessTools.Method(typeof(POI), "OnEnable", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Main), "register_point", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((MelonBase)this).HarmonyInstance.Patch((MethodBase)AccessTools.Method(typeof(POI), "OnDisable", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Main), "unregister_point", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); foreach (MelonMod registeredMelon in MelonTypeBase<MelonMod>.RegisteredMelons) { if ((object)registeredMelon != this) { string name = ((MelonBase)registeredMelon).Info.Name; if (name.Equals("MinimapMod", StringComparison.OrdinalIgnoreCase) || name.Contains("SimpleMinimap", StringComparison.OrdinalIgnoreCase) || name.Contains("Expanded_Minimap", StringComparison.OrdinalIgnoreCase) || name.Contains("Expanded Minimap", StringComparison.OrdinalIgnoreCase)) { conflict = true; } } } if (conflict) { ((MelonBase)this).LoggerInstance.Warning("Clear Minimap: Disable the other minimap mod, then relaunch. This copy will stay hidden to avoid duplicate maps."); } } public override void OnSceneWasInitialized(int buildIndex, string sceneName) { if (!(sceneName != "Main")) { running = true; failed = false; refresh_seconds = 0f; objective_count_previous = -1; ((MelonBase)this).LoggerInstance.Msg("Clear Minimap: Map enabled; screen-space overlay renderer; size and visibility are on the Mods settings tab."); } } public override void OnSceneWasUnloaded(int buildIndex, string sceneName) { if (!(sceneName != "Main")) { running = false; failed = false; view.reset(); MapMarkers.reset(); } } public override void OnUpdate() { try { if (!ready() || Time.unscaledTime < refresh_seconds) { return; } refresh_seconds = Time.unscaledTime + 0.5f; MapMarkers.refresh(); int num = 0; for (int i = 0; i < MapMarkers.count; i++) { if (MapMarkers.markers[i].kind == MarkerKind.Objective) { num++; } } if (num != objective_count_previous) { objective_count_previous = num; ((MelonBase)this).LoggerInstance.Msg($"Clear Minimap: Located tracked objectives={num}."); } } catch (Exception error) { fail(error); } } public override void OnLateUpdate() { //IL_00c9: Unknown result type (might be due to invalid IL or missing references) if (failed || conflict) { view.hide(); return; } try { bool num = settings_open(); bool flag = ready(); if (!num && (!flag || !enabled.Value || (Singleton<PauseMenu>.InstanceExists && Singleton<PauseMenu>.Instance.IsPaused) || (PlayerSingleton<Phone>.InstanceExists && PlayerSingleton<Phone>.Instance.IsOpen) || !Player.Local.Health.IsAlive)) { view.hide(); return; } float num2 = Math.Clamp((float)Screen.height / 1080f, 0.65f, 2f); float num3 = MapProjection.size(map_size.Value); view.draw(new Rect((float)Screen.width / num2 - num3 - 16f, 16f, num3, num3), flag, num2); } catch (Exception error) { fail(error); } } private static bool settings_open() { MenuScreen current = MenuScreen.Current; if ((Object)(object)current != (Object)null && current.IsOpen) { return (Object)(object)((Il2CppObjectBase)current).TryCast<SettingsScreen>() != (Object)null; } return false; } private bool ready() { if (running && !failed && !conflict && Singleton<LoadManager>.InstanceExists && Singleton<LoadManager>.Instance.IsGameLoaded && (Object)(object)Player.Local != (Object)null && (Object)(object)Player.Local.Health != (Object)null && PlayerSingleton<MapApp>.InstanceExists && Singleton<MapPositionUtility>.InstanceExists && (Object)(object)PlayerSingleton<MapApp>.Instance.BackgroundImage != (Object)null) { return (Object)(object)PlayerSingleton<MapApp>.Instance.PoIContainer != (Object)null; } return false; } private static void register_point(POI __instance) { MapMarkers.register_point(__instance); } private static void unregister_point(POI __instance) { MapMarkers.unregister_point(__instance); } private void fail(Exception error) { if (!failed) { failed = true; view.hide(); ((MelonBase)this).LoggerInstance.Error($"Clear Minimap: Hidden after a game API failure: {error}"); } } } internal enum MarkerKind { Place, Home, Deal, Teammate, Objective } internal readonly record struct MapMarker(Vector3 position, string label, MarkerKind kind, IntPtr source, Sprite? sprite, Transform? target, Color tint); internal static class MapMarkers { private static readonly POI?[] points = (POI?[])(object)new POI[256]; public static readonly MapMarker[] markers = new MapMarker[96]; public static int count { get; private set; } public static void reset() { Array.Clear(points, 0, points.Length); Array.Clear(markers, 0, markers.Length); count = 0; } public static void register_point(POI point) { if ((Object)(object)point == (Object)null) { return; } int num = -1; for (int i = 0; i < points.Length; i++) { if ((Object)(object)points[i] == (Object)(object)point) { return; } if ((Object)(object)points[i] == (Object)null && num < 0) { num = i; } } if (num >= 0) { points[num] = point; } } public static void unregister_point(POI point) { for (int i = 0; i < points.Length; i++) { if ((Object)(object)points[i] == (Object)(object)point) { points[i] = null; } } } public static void refresh() { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Invalid comparison between Unknown and I4 //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Invalid comparison between Unknown and I4 //IL_00e7: 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) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Invalid comparison between Unknown and I4 //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0589: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_05c7: Unknown result type (might be due to invalid IL or missing references) //IL_05be: Unknown result type (might be due to invalid IL or missing references) Array.Clear(markers, 0, count); count = 0; Player local = Player.Local; int num = Math.Min(Player.PlayerList.Count, 16); for (int i = 0; i < num; i++) { Player val = Player.PlayerList[i]; if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)local)) { string text = val.PlayerName; if ((Object)(object)val.Health != (Object)null && !val.Health.IsAlive) { text += " (down)"; } Image val2 = foreground_image(val.PoI); add(new MapMarker(((Component)val).transform.position, text, MarkerKind.Teammate, ((Object)(object)val.PoI != (Object)null) ? ((Il2CppObjectBase)val.PoI).Pointer : ((Il2CppObjectBase)val).Pointer, (val2 != null) ? val2.sprite : null, ((Component)val).transform, (val2 != null) ? ((Graphic)val2).color : Color.white)); } } num = Math.Min(Contract.Contracts.Count, 32); for (int j = 0; j < num; j++) { Contract val3 = Contract.Contracts[j]; if (!((Object)(object)val3 == (Object)null) && (int)((Quest)val3).State == 1 && !((Object)(object)val3.Dealer != (Object)null) && !((Object)(object)val3.DeliveryLocation == (Object)null)) { Transform customerStandPoint = val3.DeliveryLocation.CustomerStandPoint; if (!((Object)(object)customerStandPoint == (Object)null)) { POI val4 = ((((Quest)val3).Entries != null && ((Quest)val3).Entries.Count > 0 && (Object)(object)((Quest)val3).Entries[0] != (Object)null) ? ((Quest)val3).Entries[0].PoI : null); Image val5 = foreground_image(val4); add(new MapMarker(customerStandPoint.position, "Deal", MarkerKind.Deal, ((Object)(object)val4 != (Object)null) ? ((Il2CppObjectBase)val4).Pointer : ((Il2CppObjectBase)val3).Pointer, (val5 != null) ? val5.sprite : null, customerStandPoint, (val5 != null) ? ((Graphic)val5).color : Color.white)); } } } num = Math.Min(Quest.ActiveQuests.Count, 32); for (int k = 0; k < num; k++) { if (count >= markers.Length) { break; } Quest val6 = Quest.ActiveQuests[k]; if ((Object)(object)val6 == (Object)null || (Object)(object)((Il2CppObjectBase)val6).TryCast<Contract>() != (Object)null || (int)val6.State != 1 || !val6.IsTracked || val6.Entries == null) { continue; } int num2 = Math.Min(val6.Entries.Count, 16); for (int l = 0; l < num2; l++) { if (count >= markers.Length) { break; } QuestEntry val7 = val6.Entries[l]; if (!((Object)(object)val7 == (Object)null) && (int)val7.State == 1) { POI poI = val7.PoI; Transform val8 = (((Object)(object)poI != (Object)null) ? ((Component)poI).transform : val7.PoILocation); if (!((Object)(object)val8 == (Object)null)) { Image val9 = foreground_image(poI); add(new MapMarker(val8.position, val7.Title, MarkerKind.Objective, ((Object)(object)poI != (Object)null) ? ((Il2CppObjectBase)poI).Pointer : ((Il2CppObjectBase)val7).Pointer, (val9 != null) ? val9.sprite : null, val8, (val9 != null) ? ((Graphic)val9).color : Color.white)); } } } } num = Math.Min(Property.OwnedProperties.Count, 32); for (int m = 0; m < num; m++) { Property val10 = Property.OwnedProperties[m]; if (!((Object)(object)val10 == (Object)null)) { Vector3 position = (((Object)(object)val10.PoI != (Object)null) ? ((Component)val10.PoI).transform.position : ((Component)val10).transform.position); Image val11 = foreground_image(val10.PoI); add(new MapMarker(position, val10.propertyName, MarkerKind.Home, ((Object)(object)val10.PoI != (Object)null) ? ((Il2CppObjectBase)val10.PoI).Pointer : ((Il2CppObjectBase)val10).Pointer, (val11 != null) ? val11.sprite : null, ((Object)(object)val10.PoI != (Object)null) ? ((Component)val10.PoI).transform : ((Component)val10).transform, (val11 != null) ? ((Graphic)val11).color : Color.white)); } } for (int n = 0; n < points.Length; n++) { if (count >= markers.Length) { break; } POI val12 = points[n]; if (!((Object)(object)val12 == (Object)null) && ((Behaviour)val12).isActiveAndEnabled && !((Object)(object)((Il2CppObjectBase)val12).TryCast<NPCPoI>() != (Object)null) && val12.UISetup && !((Object)(object)val12.UI == (Object)null) && ((Component)val12.UI).gameObject.activeSelf && (!((Object)(object)local != (Object)null) || !((Object)(object)local.PoI == (Object)(object)val12))) { string mainText = val12.MainText; if (!string.IsNullOrWhiteSpace(mainText)) { Image val13 = foreground_image(val12); MarkerKind kind = (MapProjection.objective_icon(((Object)(object)val12.UIPrefab != (Object)null) ? ((Object)val12.UIPrefab).name : ((Object)val12.UI).name) ? MarkerKind.Objective : MarkerKind.Place); add(new MapMarker(((Component)val12).transform.position, mainText, kind, ((Il2CppObjectBase)val12).Pointer, ((Object)(object)val13 != (Object)null) ? val13.sprite : null, ((Component)val12).transform, ((Object)(object)val13 != (Object)null) ? ((Graphic)val13).color : Color.white)); } } } } private static Image? foreground_image(POI? point) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)point == (Object)null || (Object)(object)point.IconContainer == (Object)null) { return null; } Il2CppArrayBase<Image> componentsInChildren = ((Component)point.IconContainer).GetComponentsInChildren<Image>(true); for (int num = Math.Min(componentsInChildren.Length, 32) - 1; num >= 0; num--) { Image val = componentsInChildren[num]; if (!((Object)(object)val == (Object)null) && ((Behaviour)val).enabled && ((Component)val).gameObject.activeSelf && !(((Graphic)val).color.a <= 0f) && !((Object)(object)val.sprite == (Object)null) && MapProjection.foreground_icon(((Object)((Component)val).gameObject).name)) { return val; } } return null; } private static void add(MapMarker marker) { //IL_0010: 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) if (count >= markers.Length) { return; } Vector3 position = marker.position; if (!float.IsFinite(((Vector3)(ref position)).sqrMagnitude)) { return; } for (int i = 0; i < count; i++) { if (markers[i].source == marker.source) { return; } } string text = marker.label ?? ""; if (text.Length > 24) { text = text.Substring(0, 24); } markers[count++] = marker with { label = text.Replace('\n', ' ').Replace('\r', ' ') }; } } internal sealed class MapMotion { private readonly long[] identities = new long[97]; private readonly Vector2[] positions = new Vector2[97]; private readonly int[] frames = new int[97]; private readonly float[] times = new float[97]; private int count; public Vector2 sample(long identity, Vector2 target, int frame, float seconds) { if (!float.IsFinite(target.LengthSquared()) || !float.IsFinite(seconds)) { throw new ArgumentOutOfRangeException("target"); } int num = -1; for (int i = 0; i < count; i++) { if (identities[i] == identity) { num = i; break; } } if (num < 0) { if (count < identities.Length) { num = count++; } else { num = 0; for (int j = 1; j < count; j++) { if (frames[j] < frames[num]) { num = j; } } } identities[num] = identity; positions[num] = target; frames[num] = frame; times[num] = seconds; return target; } if (frames[num] == frame) { return positions[num]; } float num2 = seconds - times[num]; if (num2 <= 0f || num2 > 0.25f || Vector2.DistanceSquared(positions[num], target) > 900f) { positions[num] = target; } else { positions[num] = Vector2.Lerp(positions[num], target, 1f - MathF.Exp((0f - num2) / 0.045f)); } frames[num] = frame; times[num] = seconds; return positions[num]; } public void reset() { count = 0; } } internal sealed class MapOverlay { private readonly RawImage?[] images = (RawImage?[])(object)new RawImage[144]; private readonly Text?[] labels = (Text?[])(object)new Text[16]; private Canvas? canvas; private Font? font; private int image_count; private int label_count; private int draw_order; public void begin(float scale) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown if ((Object)(object)canvas == (Object)null) { GameObject val = new GameObject("ClearMinimap", (Type[])(object)new Type[1] { Il2CppType.Of<RectTransform>() }); canvas = val.AddComponent<Canvas>(); canvas.renderMode = (RenderMode)0; canvas.sortingOrder = 100; canvas.pixelPerfect = false; } ((Behaviour)canvas).enabled = true; canvas.scaleFactor = scale; if ((Object)(object)font == (Object)null) { Il2CppArrayBase<Font> val2 = Resources.FindObjectsOfTypeAll<Font>(); int num = Math.Min(val2.Length, 128); for (int i = 0; i < num; i++) { if ((Object)(object)val2[i] != (Object)null) { font = val2[i]; break; } } } image_count = 0; label_count = 0; draw_order = 0; } public void texture(Rect rect, Texture? texture, Rect uv, Color color, float angle = 0f) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)texture == (Object)null)) { if (image_count >= images.Length) { throw new InvalidOperationException("Minimap image pool exhausted."); } RawImage val = images[image_count]; if ((Object)(object)val == (Object)null) { GameObject val2 = new GameObject("Symbol", (Type[])(object)new Type[1] { Il2CppType.Of<RectTransform>() }); val2.transform.SetParent(((Component)canvas).transform, false); val = val2.AddComponent<RawImage>(); ((Graphic)val).raycastTarget = false; images[image_count] = val; } image_count++; ((Behaviour)val).enabled = true; val.texture = texture; val.uvRect = uv; ((Graphic)val).color = color; place(((Graphic)val).rectTransform, rect, angle); } } public void label(Rect rect, string value, Color color, bool centered = false, int font_size = 12) { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)font == (Object)null)) { if (label_count >= labels.Length) { throw new InvalidOperationException("Minimap label pool exhausted."); } Text val = labels[label_count]; if ((Object)(object)val == (Object)null) { GameObject val2 = new GameObject("Label", (Type[])(object)new Type[1] { Il2CppType.Of<RectTransform>() }); val2.transform.SetParent(((Component)canvas).transform, false); val = val2.AddComponent<Text>(); ((Graphic)val).raycastTarget = false; val.supportRichText = false; val.horizontalOverflow = (HorizontalWrapMode)1; val.verticalOverflow = (VerticalWrapMode)1; labels[label_count] = val; } label_count++; ((Behaviour)val).enabled = true; val.font = font; val.fontSize = font_size; val.text = value; ((Graphic)val).color = color; val.alignment = (TextAnchor)(centered ? 4 : 3); place(((Graphic)val).rectTransform, rect, 0f); } } public void box(Rect rect, Color color) { //IL_0001: 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_0020: Unknown result type (might be due to invalid IL or missing references) texture(rect, (Texture?)(object)Texture2D.whiteTexture, new Rect(0f, 0f, 1f, 1f), color); } public void end() { for (int i = image_count; i < images.Length; i++) { if ((Object)(object)images[i] != (Object)null) { ((Behaviour)images[i]).enabled = false; } } for (int j = label_count; j < labels.Length; j++) { if ((Object)(object)labels[j] != (Object)null) { ((Behaviour)labels[j]).enabled = false; } } } public void hide() { if ((Object)(object)canvas != (Object)null) { ((Behaviour)canvas).enabled = false; } } public void reset() { if ((Object)(object)canvas != (Object)null) { Object.Destroy((Object)(object)((Component)canvas).gameObject); } canvas = null; font = null; Array.Clear(images, 0, images.Length); Array.Clear(labels, 0, labels.Length); } private void place(RectTransform transform, Rect rect, float angle) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0089: Unknown result type (might be due to invalid IL or missing references) transform.anchorMin = new Vector2(0f, 1f); transform.anchorMax = new Vector2(0f, 1f); transform.pivot = new Vector2(0.5f, 0.5f); transform.anchoredPosition = new Vector2(((Rect)(ref rect)).center.x, 0f - ((Rect)(ref rect)).center.y); transform.sizeDelta = new Vector2(((Rect)(ref rect)).width, ((Rect)(ref rect)).height); ((Transform)transform).localRotation = Quaternion.Euler(0f, 0f, 0f - angle); if (((Transform)transform).GetSiblingIndex() != draw_order) { ((Transform)transform).SetSiblingIndex(draw_order); } draw_order++; } } internal static class MapProjection { public static float size(float value) { if (!float.IsFinite(value)) { return 280f; } return Math.Clamp(value, 200f, 360f); } public static bool try_offset(Vector2 point, Vector2 center, Vector2 span, float size_pixels, bool edge_marker, out Vector2 offset, out bool at_edge) { offset = default(Vector2); at_edge = false; if (!float.IsFinite(point.LengthSquared()) || !float.IsFinite(center.LengthSquared()) || !float.IsFinite(span.LengthSquared()) || span.X <= 0f || span.Y <= 0f || !float.IsFinite(size_pixels) || size_pixels < 32f) { return false; } offset = new Vector2((point.X - center.X) / span.X, (0f - (point.Y - center.Y)) / span.Y) * size_pixels; if (!float.IsFinite(offset.LengthSquared())) { return false; } float num = size_pixels / 2f - 12f; float num2 = Math.Max(Math.Abs(offset.X), Math.Abs(offset.Y)); at_edge = num2 > num; if (!at_edge) { return true; } if (!edge_marker) { return false; } offset *= num / num2; return true; } public static float heading(Vector2 direction) { if (!float.IsFinite(direction.LengthSquared()) || direction.LengthSquared() < 1E-08f) { return 0f; } return MathF.Atan2(direction.X, direction.Y) * 180f / (float)Math.PI; } public static (int width, int height) texture_size(float width, float height, bool map) { if (!float.IsFinite(width) || !float.IsFinite(height) || width <= 0f || height <= 0f) { throw new ArgumentOutOfRangeException("width", "Sprite dimensions must be finite and positive."); } float num = Math.Min(1f, (map ? 2048f : 256f) / Math.Max(width, height)); return (width: Math.Max(1, (int)MathF.Round(width * num)), height: Math.Max(1, (int)MathF.Round(height * num))); } public static bool foreground_icon(string name) { if (!name.Equals("Shade", StringComparison.OrdinalIgnoreCase) && !name.Equals("Shadow", StringComparison.OrdinalIgnoreCase) && !name.Equals("Background", StringComparison.OrdinalIgnoreCase)) { return !name.Equals("Outline", StringComparison.OrdinalIgnoreCase); } return false; } public static bool objective_icon(string name) { if (!name.StartsWith("QuestPoI", StringComparison.OrdinalIgnoreCase)) { return name.StartsWith("DeaddropPoI", StringComparison.OrdinalIgnoreCase); } return true; } public static Vector2 world_position(Vector2 world, Vector2 origin, Vector2 axis_x, Vector2 axis_z) { return origin + axis_x * world.X + axis_z * world.Y; } public static bool clip(Vector2 center, Vector2 span, out Vector2 minimum, out Vector2 maximum) { minimum = default(Vector2); maximum = default(Vector2); if (!float.IsFinite(center.LengthSquared()) || !float.IsFinite(span.LengthSquared()) || span.X <= 0f || span.Y <= 0f) { return false; } minimum = Vector2.Max(Vector2.Zero, center - span / 2f); maximum = Vector2.Min(Vector2.One, center + span / 2f); if (minimum.X < maximum.X) { return minimum.Y < maximum.Y; } return false; } } internal static class MarkerDay { public static uint score(string identity, int day) { if (identity.Length > 128 || day < 0) { return uint.MaxValue; } uint num = 2166136261u; foreach (char c in identity) { num = (num ^ c) * 16777619; } num = (num ^ (uint)day) * 16777619; num ^= num >> 16; num *= 2146121005; return num ^ (num >> 15); } } internal sealed class MinimapView { private readonly SpriteTextures sprite_textures = new SpriteTextures(); private readonly MapMotion motion = new MapMotion(); private readonly Texture2D?[] icons = (Texture2D?[])(object)new Texture2D[6]; private readonly MapOverlay overlay = new MapOverlay(); private readonly Rect[] labels = (Rect[])(object)new Rect[12]; private readonly Vector2[] placed_markers = (Vector2[])(object)new Vector2[96]; private readonly MapMarker[] visible_markers = new MapMarker[96]; private readonly Color[] marker_colors = (Color[])(object)new Color[96]; private float heading_degrees; private readonly Color background = new Color(0.055f, 0.07f, 0.085f, 0.97f); public void reset() { sprite_textures.reset(); motion.reset(); for (int i = 0; i < icons.Length; i++) { if ((Object)(object)icons[i] != (Object)null) { Object.Destroy((Object)(object)icons[i]); } icons[i] = null; } Array.Clear(visible_markers, 0, visible_markers.Length); overlay.reset(); heading_degrees = 0f; } public void hide() { overlay.hide(); } public void draw(Rect panel, bool map_available, float scale) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) overlay.begin(scale); try { draw_content(panel, map_available); } finally { overlay.end(); } } private void draw_content(Rect panel, bool map_available) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0222: 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_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_07f0: Unknown result type (might be due to invalid IL or missing references) //IL_080a: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_0852: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: 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_086d: Unknown result type (might be due to invalid IL or missing references) //IL_0868: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_0532: Unknown result type (might be due to invalid IL or missing references) //IL_088b: Unknown result type (might be due to invalid IL or missing references) //IL_0899: Unknown result type (might be due to invalid IL or missing references) //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_0560: Unknown result type (might be due to invalid IL or missing references) //IL_0565: Unknown result type (might be due to invalid IL or missing references) //IL_0994: Unknown result type (might be due to invalid IL or missing references) //IL_09a4: Unknown result type (might be due to invalid IL or missing references) //IL_0919: Unknown result type (might be due to invalid IL or missing references) //IL_092b: Unknown result type (might be due to invalid IL or missing references) //IL_0945: Unknown result type (might be due to invalid IL or missing references) //IL_0966: Unknown result type (might be due to invalid IL or missing references) //IL_097f: Unknown result type (might be due to invalid IL or missing references) //IL_061e: Unknown result type (might be due to invalid IL or missing references) //IL_0623: Unknown result type (might be due to invalid IL or missing references) //IL_05e4: Unknown result type (might be due to invalid IL or missing references) //IL_05e9: Unknown result type (might be due to invalid IL or missing references) //IL_05c7: Unknown result type (might be due to invalid IL or missing references) //IL_05cc: Unknown result type (might be due to invalid IL or missing references) //IL_0601: Unknown result type (might be due to invalid IL or missing references) //IL_0606: Unknown result type (might be due to invalid IL or missing references) //IL_062e: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Unknown result type (might be due to invalid IL or missing references) //IL_063a: Unknown result type (might be due to invalid IL or missing references) //IL_063c: Unknown result type (might be due to invalid IL or missing references) //IL_0658: Unknown result type (might be due to invalid IL or missing references) //IL_065a: Unknown result type (might be due to invalid IL or missing references) //IL_0627: Unknown result type (might be due to invalid IL or missing references) //IL_062c: Unknown result type (might be due to invalid IL or missing references) //IL_0a3e: Unknown result type (might be due to invalid IL or missing references) //IL_0a45: Unknown result type (might be due to invalid IL or missing references) //IL_0693: Unknown result type (might be due to invalid IL or missing references) //IL_0698: Unknown result type (might be due to invalid IL or missing references) //IL_06ea: Unknown result type (might be due to invalid IL or missing references) //IL_0716: Unknown result type (might be due to invalid IL or missing references) //IL_0766: Unknown result type (might be due to invalid IL or missing references) //IL_078f: Unknown result type (might be due to invalid IL or missing references) //IL_0791: Unknown result type (might be due to invalid IL or missing references) //IL_079c: Unknown result type (might be due to invalid IL or missing references) //IL_07b2: Unknown result type (might be due to invalid IL or missing references) //IL_07c2: Unknown result type (might be due to invalid IL or missing references) //IL_07c6: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < icons.Length; i++) { ref Texture2D reference = ref icons[i]; if (reference == null) { reference = create_icon(i); } } overlay.box(new Rect(((Rect)(ref panel)).x - 3f, ((Rect)(ref panel)).y - 3f, ((Rect)(ref panel)).width + 6f, ((Rect)(ref panel)).height + 26f), background); overlay.box(new Rect(((Rect)(ref panel)).x - 1f, ((Rect)(ref panel)).y - 1f, ((Rect)(ref panel)).width + 2f, ((Rect)(ref panel)).height + 2f), new Color(0.3f, 0.37f, 0.4f, 1f)); overlay.box(panel, new Color(0.09f, 0.12f, 0.14f, 1f)); if (!map_available) { overlay.label(panel, "Map preview", Color.white, centered: true); draw_arrow(((Rect)(ref panel)).center, 0f, 16f, Color.white); return; } Player local = Player.Local; MapApp instance = PlayerSingleton<MapApp>.Instance; Sprite val = (((Object)(object)instance.BackgroundImage.sprite != (Object)null) ? instance.BackgroundImage.sprite : instance.MainMapSprite); if ((Object)(object)val == (Object)null || (Object)(object)val.texture == (Object)null) { return; } RectTransform poIContainer = instance.PoIContainer; Rect rect = ((Graphic)instance.BackgroundImage).rectTransform.rect; Matrix4x4 container_to_image = map_transform((Transform)(object)poIContainer, (Transform)(object)((Graphic)instance.BackgroundImage).rectTransform); float num = 0.5f - poIContainer.pivot.x; Rect rect2 = poIContainer.rect; float num2 = num * ((Rect)(ref rect2)).width; float num3 = 0.5f - poIContainer.pivot.y; rect2 = poIContainer.rect; Vector3 anchor = default(Vector3); ((Vector3)(ref anchor))..ctor(num2, num3 * ((Rect)(ref rect2)).height, 0f); Vector2 vector = map_position(Vector3.zero, container_to_image, anchor, rect); Vector2 vector2 = (map_position(Vector3.right * 100f, container_to_image, anchor, rect) - vector) / 100f; Vector2 vector3 = (map_position(Vector3.forward * 100f, container_to_image, anchor, rect) - vector) / 100f; int frameCount = Time.frameCount; float unscaledTime = Time.unscaledTime; Vector2 vector4 = MapProjection.world_position(motion.sample(long.MinValue, new Vector2(((Component)local).transform.position.x, ((Component)local).transform.position.z), frameCount, unscaledTime), vector, vector2, vector3); Vector2 vector5 = new Vector2(220f * MathF.Sqrt(vector2.X * vector2.X + vector3.X * vector3.X), 220f * MathF.Sqrt(vector2.Y * vector2.Y + vector3.Y * vector3.Y)); if (!float.IsFinite(vector5.LengthSquared()) || vector5.X < 1E-05f || vector5.Y < 1E-05f) { return; } if (MapProjection.clip(vector4, vector5, out var minimum, out var maximum)) { Vector2 vector6 = vector4 - vector5 / 2f; Rect rect3 = default(Rect); ((Rect)(ref rect3))..ctor(((Rect)(ref panel)).x + (minimum.X - vector6.X) / vector5.X * ((Rect)(ref panel)).width, ((Rect)(ref panel)).y + (vector6.Y + vector5.Y - maximum.Y) / vector5.Y * ((Rect)(ref panel)).height, (maximum.X - minimum.X) / vector5.X * ((Rect)(ref panel)).width, (maximum.Y - minimum.Y) / vector5.Y * ((Rect)(ref panel)).height); Rect uv = default(Rect); ((Rect)(ref uv))..ctor(minimum.X, minimum.Y, maximum.X - minimum.X, maximum.Y - minimum.Y); overlay.texture(rect3, sprite_textures.get(val, map: true), uv, Color.white); } int num4 = 0; int num5 = 0; Vector2 val3 = default(Vector2); Rect val6 = default(Rect); for (int j = 0; j < MapMarkers.count; j++) { MapMarker mapMarker = MapMarkers.markers[j]; MarkerKind kind = mapMarker.kind; bool at_edge = (uint)(kind - 2) <= 2u; bool flag = at_edge; Vector3 val2 = (((Object)(object)mapMarker.target != (Object)null) ? mapMarker.target.position : mapMarker.position); if (!MapProjection.try_offset(MapProjection.world_position(motion.sample(mapMarker.source.ToInt64(), new Vector2(val2.x, val2.z), frameCount, unscaledTime), vector, vector2, vector3), vector4, vector5, ((Rect)(ref panel)).width, flag, out var offset, out at_edge)) { continue; } ((Vector2)(ref val3))..ctor(((Rect)(ref panel)).center.x + offset.X, ((Rect)(ref panel)).center.y + offset.Y); bool flag2 = false; for (int k = 0; k < num5; k++) { Vector2 val4 = placed_markers[k] - val3; if (((Vector2)(ref val4)).sqrMagnitude < 100f) { flag2 = true; } } if (flag2 && !flag) { continue; } Color val5 = (Color)(mapMarker.kind switch { MarkerKind.Teammate => new Color(0.35f, 0.8f, 1f, 1f), MarkerKind.Deal => new Color(0.35f, 1f, 0.55f, 1f), MarkerKind.Objective => new Color(1f, 0.86f, 0.3f, 1f), MarkerKind.Home => new Color(1f, 0.86f, 0.5f, 1f), _ => Color.white, }); placed_markers[num5] = val3; visible_markers[num5] = mapMarker; marker_colors[num5] = val5; num5++; if (mapMarker.kind == MarkerKind.Objective || !flag || num4 >= labels.Length) { continue; } int value = (int)Math.Min(9999f, Vector3.Distance(((Component)local).transform.position, val2)); string value2 = $"{mapMarker.label} · {value}m"; ((Rect)(ref val6))..ctor(Math.Clamp(val3.x + 11f, ((Rect)(ref panel)).x + 2f, ((Rect)(ref panel)).xMax - 132f), Math.Clamp(val3.y - 8f, ((Rect)(ref panel)).y + 2f, ((Rect)(ref panel)).yMax - 18f), 130f, 16f); bool flag3 = false; for (int l = 0; l < num4; l++) { if (((Rect)(ref labels[l])).Overlaps(val6)) { flag3 = true; } } if (!flag3) { labels[num4++] = val6; overlay.box(val6, new Color(0.03f, 0.045f, 0.06f, 0.8f)); overlay.label(val6, value2, val5, centered: false, 10); } } for (int m = 0; m < num5; m++) { draw_marker(placed_markers[m], visible_markers[m], marker_colors[m]); visible_markers[m] = default(MapMarker); } Vector3 val7 = ((PlayerSingleton<PlayerCamera>.InstanceExists && (Object)(object)PlayerSingleton<PlayerCamera>.Instance.Camera != (Object)null) ? ((Component)PlayerSingleton<PlayerCamera>.Instance.Camera).transform.forward : ((Component)local).transform.forward); val7.y = 0f; if (((Vector3)(ref val7)).sqrMagnitude > 0.001f) { Vector2 vector7 = vector2 * val7.x + vector3 * val7.z; heading_degrees = MapProjection.heading(new Vector2(vector7.X / vector5.X, vector7.Y / vector5.Y)); } if (NetworkSingleton<TimeManager>.InstanceExists && !string.IsNullOrEmpty(local.PlayerCode) && MarkerDay.score(local.PlayerCode, NetworkSingleton<TimeManager>.Instance.ElapsedDays) % 100 == 0) { overlay.texture(new Rect(((Rect)(ref panel)).center.x - 10f, ((Rect)(ref panel)).center.y - 10f, 20f, 20f), (Texture?)(object)icons[5], new Rect(0f, 0f, 1f, 1f), new Color(1f, 0.85f, 0.15f, 1f), heading_degrees); } else { draw_arrow(((Rect)(ref panel)).center, heading_degrees, 16f, Color.white); } string value3 = (NetworkSingleton<TimeManager>.InstanceExists ? $"{NetworkSingleton<TimeManager>.Instance.CurrentTime / 100:00}:{NetworkSingleton<TimeManager>.Instance.CurrentTime % 100:00}" : ""); overlay.label(new Rect(((Rect)(ref panel)).x + 6f, ((Rect)(ref panel)).yMax + 3f, ((Rect)(ref panel)).width - 12f, 18f), value3, Color.white); } private static Matrix4x4 map_transform(Transform container, Transform image) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0037: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) Transform val = image; Matrix4x4 val2 = Matrix4x4.identity; for (int i = 0; i < 32; i++) { if (!((Object)(object)val != (Object)null)) { break; } if ((Object)(object)container == (Object)(object)val) { break; } if (container.IsChildOf(val)) { break; } val2 = Matrix4x4.TRS(val.localPosition, val.localRotation, val.localScale) * val2; val = val.parent; } if ((Object)(object)val == (Object)null || ((Object)(object)container != (Object)(object)val && !container.IsChildOf(val))) { throw new InvalidOperationException("Map image and marker container have no shared ancestor within 32 levels."); } Matrix4x4 val3 = Matrix4x4.identity; Transform val4 = container; for (int j = 0; j < 32; j++) { if (!((Object)(object)val4 != (Object)(object)val)) { break; } if (!((Object)(object)val4 != (Object)null)) { break; } val3 = Matrix4x4.TRS(val4.localPosition, val4.localRotation, val4.localScale) * val3; val4 = val4.parent; } if ((Object)(object)val4 != (Object)(object)val) { throw new InvalidOperationException("Map marker hierarchy exceeds 32 levels."); } return ((Matrix4x4)(ref val2)).inverse * val3; } private static Vector2 map_position(Vector3 position, Matrix4x4 container_to_image, Vector3 anchor, Rect rect) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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_002f: 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_006d: Unknown result type (might be due to invalid IL or missing references) Vector2 mapPosition = Singleton<MapPositionUtility>.Instance.GetMapPosition(position); Vector3 val = ((Matrix4x4)(ref container_to_image)).MultiplyPoint3x4(new Vector3(mapPosition.x, mapPosition.y, 0f) + anchor); if (((Rect)(ref rect)).width <= 0f || ((Rect)(ref rect)).height <= 0f) { return new Vector2(float.NaN); } return new Vector2((val.x - ((Rect)(ref rect)).xMin) / ((Rect)(ref rect)).width, (val.y - ((Rect)(ref rect)).yMin) / ((Rect)(ref rect)).height); } private void draw_marker(Vector2 point, MapMarker marker, Color color) { //IL_0002: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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_006d: Invalid comparison between Unknown and I4 //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) Rect rect = default(Rect); ((Rect)(ref rect))..ctor(point.x - 8f, point.y - 8f, 16f, 16f); if ((Object)(object)marker.sprite != (Object)null && (Object)(object)marker.sprite.texture != (Object)null && (!marker.sprite.packed || (int)marker.sprite.packingMode == 1)) { Texture val = sprite_textures.get(marker.sprite, map: false); float num = (float)val.width / (float)val.height; if (num > 1f) { ((Rect)(ref rect)).height = ((Rect)(ref rect)).height / num; ((Rect)(ref rect)).y = point.y - ((Rect)(ref rect)).height / 2f; } else { ((Rect)(ref rect)).width = ((Rect)(ref rect)).width * num; ((Rect)(ref rect)).x = point.x - ((Rect)(ref rect)).width / 2f; } overlay.texture(rect, val, new Rect(0f, 0f, 1f, 1f), marker.tint); } else { overlay.texture(rect, (Texture?)(object)icons[(marker.kind == MarkerKind.Home) ? 1 : ((marker.kind == MarkerKind.Deal) ? 2 : ((marker.kind == MarkerKind.Objective) ? 4 : 3))], new Rect(0f, 0f, 1f, 1f), color); } } private void draw_arrow(Vector2 point, float angle, float size, Color color) { //IL_0006: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) overlay.texture(new Rect(point.x - size / 2f, point.y - size / 2f, size, size), (Texture?)(object)icons[0], new Rect(0f, 0f, 1f, 1f), color, angle); } private static Texture2D create_icon(int kind) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_02c3: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { int num = 0; for (int k = 0; k < 16; k++) { float num2 = ((float)j + ((float)(k % 4) + 0.5f) / 4f - 16f) / 16f; float num3 = ((float)i + ((float)(k / 4) + 0.5f) / 4f - 16f) / 16f; if (kind switch { 0 => num3 > -0.7f && num3 < 0.85f && Math.Abs(num2) < (0.85f - num3) * 0.48f && (num3 > -0.15f || Math.Abs(num2) > (-0.15f - num3) * 0.4f), 1 => (Math.Abs(num2) < 0.65f && num3 > -0.7f && num3 < 0.2f && (!(Math.Abs(num2) < 0.18f) || !(num3 < -0.1f))) || (num3 >= 0.2f && num3 < 0.85f && Math.Abs(num2) < 0.85f - num3), 2 => (Math.Abs(num2) < 0.75f && num3 > -0.55f && num3 < 0.4f) || (Math.Abs(num2) < 0.35f && num3 >= 0.4f && num3 < 0.65f), 5 => num2 * num2 / 0.35f + (num3 + 0.25f) * (num3 + 0.25f) / 0.18f < 1f || (num2 * num2 + (num3 - 0.35f) * (num3 - 0.35f) < 0.12f && !((num2 - 0.13f) * (num2 - 0.13f) + (num3 - 0.4f) * (num3 - 0.4f) < 0.004f)) || (num3 > 0.55f && num3 < 0.85f && Math.Abs(num2) < 0.12f), 4 => Math.Abs(num2) < 0.18f && ((num3 > -0.15f && num3 < 0.8f) || (num3 > -0.75f && num3 < -0.4f)), _ => num2 * num2 + num3 * num3 < 0.45f, }) { num++; } } val.SetPixel(j, i, new Color(1f, 1f, 1f, (float)num / 16f)); } } val.Apply(false, true); return val; } } internal sealed class SpriteTextures { private readonly Sprite?[] sources = (Sprite?[])(object)new Sprite[128]; private readonly RenderTexture?[] textures = (RenderTexture?[])(object)new RenderTexture[128]; private int next_icon = 1; public Texture get(Sprite sprite, bool map) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) for (int i = ((!map) ? 1 : 0); i < (map ? 1 : textures.Length); i++) { if ((Object)(object)sources[i] == (Object)(object)sprite && (Object)(object)textures[i] != (Object)null) { return (Texture)(object)textures[i]; } } int num = ((!map) ? next_icon : 0); Rect textureRect = sprite.textureRect; Texture texture = (Texture)(object)sprite.texture; (int width, int height) tuple = MapProjection.texture_size(((Rect)(ref textureRect)).width, ((Rect)(ref textureRect)).height, map); int item = tuple.width; int item2 = tuple.height; RenderTexture val = new RenderTexture(item, item2, 0, (RenderTextureFormat)0) { useMipMap = true, autoGenerateMips = false, filterMode = (FilterMode)2, wrapMode = (TextureWrapMode)1, anisoLevel = 1 }; RenderTexture active = RenderTexture.active; try { if (!val.Create()) { throw new InvalidOperationException("Unable to allocate filtered minimap sprite."); } Graphics.Blit(texture, val, new Vector2(((Rect)(ref textureRect)).width / (float)texture.width, ((Rect)(ref textureRect)).height / (float)texture.height), new Vector2(((Rect)(ref textureRect)).x / (float)texture.width, ((Rect)(ref textureRect)).y / (float)texture.height)); val.GenerateMips(); if ((Object)(object)textures[num] != (Object)null) { textures[num].Release(); Object.Destroy((Object)(object)textures[num]); } sources[num] = sprite; textures[num] = val; if (!map) { next_icon = ((next_icon == textures.Length - 1) ? 1 : (next_icon + 1)); } return (Texture)(object)val; } catch { val.Release(); Object.Destroy((Object)(object)val); throw; } finally { RenderTexture.active = active; } } public void reset() { for (int i = 0; i < textures.Length; i++) { if ((Object)(object)textures[i] != (Object)null) { textures[i].Release(); Object.Destroy((Object)(object)textures[i]); } textures[i] = null; sources[i] = null; } next_icon = 1; } } }