using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using HarmonyLib; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using Splatform; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Compass")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Compass")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("873ca971-9465-4427-a377-7523973b9138")] [assembly: AssemblyFileVersion("1.0.6")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.6.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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; } } } public class WildcardPattern { private readonly string _expression; private readonly Regex _regex; public WildcardPattern(string pattern) { if (string.IsNullOrEmpty(pattern)) { throw new ArgumentNullException("pattern"); } _expression = "^" + Regex.Escape(pattern).Replace("\\\\\\?", "??").Replace("\\?", ".") .Replace("??", "\\?") .Replace("\\\\\\*", "**") .Replace("\\*", ".*") .Replace("**", "\\*") + "$"; _regex = new Regex(_expression, RegexOptions.Compiled); } public bool IsMatch(string value) { return _regex.IsMatch(value); } } namespace Compass { [BepInPlugin("shudnal.Compass", "Compass", "1.0.6")] public class Compass : BaseUnityPlugin { public enum OrientationType { Camera, Player } public enum AnchorPositionType { Top, Bottom } [Flags] public enum CompassPinType { None = 0, Icon0 = 1, Icon1 = 2, Icon2 = 4, Icon3 = 8, Icon4 = 0x10, Death = 0x20, Bed = 0x40, Shout = 0x80, Boss = 0x100, Player = 0x200, RandomEvent = 0x400, Ping = 0x800, EventArea = 0x1000, HildirQuest = 0x2000, Static = 0x4000, Custom = 0x8000, All = 0xFFFF } public const string pluginID = "shudnal.Compass"; public const string pluginName = "Compass"; public const string pluginVersion = "1.0.6"; private readonly Harmony harmony = new Harmony("shudnal.Compass"); internal static Compass instance; public static ConfigEntry modEnabled; public static ConfigEntry loggingEnabled; public static ConfigEntry orientation; public static ConfigEntry anchorPosition; public static ConfigEntry scale; public static ConfigEntry offset; public static ConfigEntry showCenter; public static ConfigEntry showPins; public static ConfigEntry pinNamesToIgnore; public static ConfigEntry showOnlyLastDeath; public static ConfigEntry hideChecked; public static ConfigEntry hideShared; public static ConfigEntry alwaysShowPinText; public static ConfigEntry holdToAlwaysShowPings; public static ConfigEntry holdToAlwaysShowShouts; public static ConfigEntry holdToAlwaysShowPlayerPin; public static ConfigEntry holdToShowText; public static ConfigEntry pinsAlpha; public static ConfigEntry pinsScale; public static ConfigEntry pinsStyleConditions; public static ConfigEntry compassColor; public static ConfigEntry centerColor; public static ConfigEntry pinsColor; public static ConfigEntry pinTextSize; public static ConfigEntry pinTextColor; public static ConfigEntry pinTextFormat; public static readonly string configDirectory = Path.Combine(Paths.ConfigPath, "shudnal.Compass"); private void Awake() { harmony.PatchAll(); instance = this; ConfigInit(); Game.isModded = true; CompassHUD.CheckImageFiles(); SetupFileWatcher(); } private void ConfigInit() { //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Expected O, but got Unknown //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) modEnabled = ((BaseUnityPlugin)this).Config.Bind("General", "Enabled", true, "Enable the mod."); loggingEnabled = ((BaseUnityPlugin)this).Config.Bind("General", "Logging enabled", false, "Enable logging."); modEnabled.SettingChanged += delegate { CompassHUD.UpdateParentObject(); }; orientation = ((BaseUnityPlugin)this).Config.Bind("Compass", "Orientation based on", OrientationType.Camera, "Orientation type. Camera direction or player eyes direction could be used as a center of a compass."); anchorPosition = ((BaseUnityPlugin)this).Config.Bind("Compass", "Anchor position", AnchorPositionType.Top, "Defines whether compass is anchored to top or bottom side of the screen."); scale = ((BaseUnityPlugin)this).Config.Bind("Compass", "Scale", 1f, "Scale of whole compass component"); offset = ((BaseUnityPlugin)this).Config.Bind("Compass", "Position offset", Vector2.zero, "Offset from selected anchor position. X moves compass left/right. Y moves compass down from top, up from bottom."); showCenter = ((BaseUnityPlugin)this).Config.Bind("Compass", "Show center", true, "Show center marker"); anchorPosition.SettingChanged += delegate { CompassHUD.UpdateAnchorImages(); CompassHUD.UpdateParentObject(); CompassHUD.UpdateCompassObject(); CompassHUD.UpdateMaskObject(); CompassHUD.UpdateCenterObject(); CompassHUD.UpdatePinsObject(); }; scale.SettingChanged += delegate { CompassHUD.UpdateParentObject(); }; offset.SettingChanged += delegate { CompassHUD.UpdateParentObject(); }; showCenter.SettingChanged += delegate { CompassHUD.UpdateCenterObject(); }; showPins = ((BaseUnityPlugin)this).Config.Bind("Pins", "Show pins", CompassPinType.All, "Pin types to show on the compass. Use Configuration Manager for more convenient editing.\nStatic - fixed locations like Haldor, Hildir, Bog Witch, Sacrificial Stones\nCustom - Any custom pin type added by other mods\nEventArea - red circle around an event\nRandomEvent - red exclamation mark of an event"); pinNamesToIgnore = ((BaseUnityPlugin)this).Config.Bind("Pins", "Ignore pin names", "Silver&&Obsidian&&Copper&&Tin", new ConfigDescription("&& separated pin names to ignore. Wildcards * and ? supported. Use Configuration Manager for more convenient editing.", (AcceptableValueBase)null, new object[1] { new CustomConfigs.ConfigurationManagerAttributes { CustomDrawer = CustomConfigs.DrawSeparatedStrings("&&") } })); showOnlyLastDeath = ((BaseUnityPlugin)this).Config.Bind("Pins", "Show only last death", true, "Death pins except the last one will be hidden."); hideChecked = ((BaseUnityPlugin)this).Config.Bind("Pins", "Hide checked pins", false, "Hide pins checked by red cross."); hideShared = ((BaseUnityPlugin)this).Config.Bind("Pins", "Hide shared pins", false, "Hide pins shared via Cartography Table."); holdToAlwaysShowShouts = ((BaseUnityPlugin)this).Config.Bind("Pins", "Hold to show shouts at any distance", new KeyboardShortcut((KeyCode)308, Array.Empty()), "Hold to show player shouts without distance filter."); holdToAlwaysShowPlayerPin = ((BaseUnityPlugin)this).Config.Bind("Pins", "Hold to show players at any distance", new KeyboardShortcut((KeyCode)308, Array.Empty()), "Hold to show players with public positions without distance filter."); holdToAlwaysShowPings = ((BaseUnityPlugin)this).Config.Bind("Pins", "Hold to show pings at any distance", new KeyboardShortcut((KeyCode)308, Array.Empty()), "Hold to show player pings without distance filter."); holdToShowText = ((BaseUnityPlugin)this).Config.Bind("Pins", "Hold to show pin text", new KeyboardShortcut((KeyCode)306, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), "Hold to show pin text if it is set."); alwaysShowPinText = ((BaseUnityPlugin)this).Config.Bind("Pins", "Always show pin text", false, "Always show pin text if it is set."); showPins.SettingChanged += delegate { CompassHUD.UpdatePinsObject(); }; pinNamesToIgnore.SettingChanged += delegate { UpdatePinFilterNames(); }; compassColor = ((BaseUnityPlugin)this).Config.Bind("Style", "Compass color", Color.white - new Color(0f, 0f, 0f, 0.5f), "Compass color"); centerColor = ((BaseUnityPlugin)this).Config.Bind("Style", "Center color", Color.yellow - new Color(0f, 0f, 0f, 0.5f), "Center marker color"); compassColor.SettingChanged += delegate { CompassHUD.UpdateCompassObject(); }; centerColor.SettingChanged += delegate { CompassHUD.UpdateCenterObject(); }; pinsColor = ((BaseUnityPlugin)this).Config.Bind("Pin style", "Color", Color.clear, "Pins color. If not set - default is white"); pinsAlpha = ((BaseUnityPlugin)this).Config.Bind("Pin style", "Alpha", new Vector2(1f, 0.33f), "Pins alpha. X for max alpha, Y for min alpha"); pinsScale = ((BaseUnityPlugin)this).Config.Bind("Pin style", "Scale", new Vector2(1f, 0.33f), "Pins scale. X for max scale, Y for min scale"); pinsStyleConditions = ((BaseUnityPlugin)this).Config.Bind("Pin style", "Style conditions", new Vector4(1f, 20f, 250f, 550f), "Conditions for alpha and scale application\nX - Minimum distance to show pins\nY - Distance where pins will start to become smaller. Size is at maximum. Alpha is at maximum.\nZ - Distance where pins will start to become more transparent. Size is at minimum. Alpha is at maximum.\nW - Maximum distance to show pins. Size is at minimum. Alpha is at minimum."); pinsStyleConditions.SettingChanged += delegate { UpdatePinsStyleConditions(); }; pinTextSize = ((BaseUnityPlugin)this).Config.Bind("Pin text style", "Size", 18f, "Pin text size"); pinTextColor = ((BaseUnityPlugin)this).Config.Bind("Pin text style", "Color", Color.white, "Pin text color"); pinTextFormat = ((BaseUnityPlugin)this).Config.Bind("Pin text style", "Format", (FontStyles)1, "Pin text format"); pinTextSize.SettingChanged += delegate { CompassHUD.UpdatePinTextStyle(); }; pinTextColor.SettingChanged += delegate { CompassHUD.UpdatePinTextStyle(); }; pinTextFormat.SettingChanged += delegate { CompassHUD.UpdatePinTextStyle(); }; } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); instance = null; Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } public static void LogInfo(object data) { if (loggingEnabled.Value) { ((BaseUnityPlugin)instance).Logger.LogInfo(data); } } public static void LogWarning(object data) { ((BaseUnityPlugin)instance).Logger.LogWarning(data); } private static void UpdatePinFilterNames() { CompassHUD.filteredWildcards.Clear(); CompassHUD.filteredNames = new HashSet(from p in pinNamesToIgnore.Value.Split(new string[1] { "&&" }, StringSplitOptions.RemoveEmptyEntries) select p.Trim().ToLower() into p where !string.IsNullOrWhiteSpace(p) select p); CollectionExtensions.DoIf((IEnumerable)CompassHUD.filteredNames, (Func)((string str) => str.IndexOf('*') != -1 || str.IndexOf('?') != -1), (Action)delegate(string str) { CompassHUD.filteredWildcards.Add(str); }); CompassHUD.filteredNames.RemoveWhere((string str) => CompassHUD.filteredWildcards.Contains(str)); } private static void UpdatePinsStyleConditions() { //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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) pinsStyleConditions.Value = new Vector4((float)Mathf.FloorToInt(pinsStyleConditions.Value.x), (float)Mathf.FloorToInt(pinsStyleConditions.Value.y), (float)Mathf.FloorToInt(pinsStyleConditions.Value.z), (float)Mathf.FloorToInt(pinsStyleConditions.Value.w)); } public static void SetupFileWatcher() { FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(configDirectory, ImageFileInfo.filter); fileSystemWatcher.Changed += OnTextureFileChange; fileSystemWatcher.Created += OnTextureFileChange; fileSystemWatcher.Renamed += OnTextureFileChange; fileSystemWatcher.Deleted += OnTextureFileChange; fileSystemWatcher.IncludeSubdirectories = false; fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject; fileSystemWatcher.EnableRaisingEvents = true; } private static void OnTextureFileChange(object sender, FileSystemEventArgs eargs) { ImageFileInfo.TryLoadFile(eargs.Name); if (eargs is RenamedEventArgs) { ImageFileInfo.TryClearFile((eargs as RenamedEventArgs).OldName); } } internal static bool LoadTextureFromConfigDirectory(string filename, ref Texture2D tex) { string path = Path.Combine(configDirectory, filename); if (!File.Exists(path)) { return false; } LogInfo("Loaded image from config folder: " + filename); return ImageConversion.LoadImage(tex, File.ReadAllBytes(path)); } internal static byte[] GetEmbeddedFileData(string filename) { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string name = executingAssembly.GetManifestResourceNames().Single((string str) => str.EndsWith(filename)); Stream manifestResourceStream = executingAssembly.GetManifestResourceStream(name); byte[] array = new byte[manifestResourceStream.Length]; manifestResourceStream.Read(array, 0, array.Length); return array; } } internal class CustomConfigs { internal class ConfigurationManagerAttributes { [UsedImplicitly] public Action? CustomDrawer; } internal static object? configManager; internal static Type? configManagerStyles; internal static GUIStyle GetStyle(GUIStyle other) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown if (configManagerStyles == null) { return other; } FieldInfo fieldInfo = AccessTools.Field(configManagerStyles, "fontSize"); if (fieldInfo == null) { return other; } return new GUIStyle(other) { fontSize = (int)fieldInfo.GetValue(configManagerStyles) }; } internal static void Awake() { Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "ConfigurationManager"); Type type = assembly?.GetType("ConfigurationManager.ConfigurationManager"); configManager = ((type == null) ? null : Chainloader.ManagerObject.GetComponent(type)); configManagerStyles = assembly?.GetType("ConfigurationManager.ConfigurationManagerStyles"); } internal static Action DrawSeparatedStrings(string splitString) { string splitString2 = splitString; return delegate(ConfigEntryBase cfg) { //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Expected O, but got Unknown bool valueOrDefault = cfg.Description.Tags.Select((object a) => (a.GetType().Name == "ConfigurationManagerAttributes") ? ((bool?)a.GetType().GetField("ReadOnly")?.GetValue(a)) : null).FirstOrDefault((bool? v) => v.HasValue).GetValueOrDefault(); bool flag = false; GUILayout.BeginVertical(Array.Empty()); List list = new List(); List list2 = ((string)cfg.BoxedValue).Split(new string[1] { splitString2 }, StringSplitOptions.None).ToList(); for (int i = 0; i < list2.Count; i++) { GUILayout.BeginHorizontal(Array.Empty()); string text = list2[i]; string text2 = GUILayout.TextField(text, GetStyle(GUI.skin.textArea), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (text2 != text && !valueOrDefault) { flag = true; } if (GUILayout.Button("x", new GUIStyle(GetStyle(GUI.skin.button)) { fixedWidth = 21f }, Array.Empty()) && !valueOrDefault) { flag = true; } else { list.Add(text2); } if (GUILayout.Button("+", new GUIStyle(GetStyle(GUI.skin.button)) { fixedWidth = 21f }, Array.Empty()) && !valueOrDefault) { flag = true; list.Add(""); } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); if (flag) { cfg.BoxedValue = string.Join(splitString2, list); } }; } } internal static class CompassHUD { public class PinElement { public string name; public RectTransform rect; public Image image; public GameObject checkedIcon; public TMP_Text text; public PinElement() { rect = Object.Instantiate(pinElement, (Transform)(object)pinsRootObject); ((Component)rect).gameObject.SetActive(true); image = ((Component)rect).GetComponent(); Transform obj = ((Transform)rect).Find("Checked"); checkedIcon = ((obj != null) ? ((Component)obj).gameObject : null); Transform obj2 = ((Transform)rect).Find("Name"); text = ((obj2 != null) ? ((Component)obj2).GetComponent() : null); pinsList.Add(this); } public void Destroy() { RectTransform obj = rect; Object.Destroy((Object)(object)((obj != null) ? ((Component)obj).gameObject : null)); } } [HarmonyPatch(typeof(Hud), "Awake")] private static class Hud_Awake_Initialize { private static void Postfix() { InitializeCompass(); } } [HarmonyPatch(typeof(Hud), "Update")] public static class Hud_Update_Compass { public static void Postfix() { UpdateCompass(); } } [HarmonyPatch(typeof(Hud), "OnDestroy")] public static class Hud_OnDestroy_Compass { public static void Postfix() { DestroyCompass(); } } [HarmonyPatch(typeof(Player), "SetCrouch")] public static class Player_SetCrouch_PreventCrouchingOnControlPress { private static bool IsCtrlDown(KeyboardShortcut shortcut) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return (ZInput.GetButton("Crouch") || ZInput.GetButton("JoyCrouch")) && IsShortcutDown(shortcut); } [HarmonyPriority(800)] public static bool Prefix() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_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) return !IsCtrlDown(Compass.holdToAlwaysShowPings.Value) && !IsCtrlDown(Compass.holdToAlwaysShowPlayerPin.Value) && !IsCtrlDown(Compass.holdToAlwaysShowShouts.Value) && !IsCtrlDown(Compass.holdToShowText.Value); } } public const string fileNameCompass = "compass"; public const string fileNameCompassBottom = "compass_bottom"; public const string fileNameCenter = "center"; public const string fileNameCenterBottom = "center_bottom"; public const string fileNameMask = "mask"; public const string fileNameOverlay = "overlay"; public const string fileNameUnderlay = "underlay"; private const string objectRootName = "Compass_Parent"; private const string objectOverlayName = "Overlay"; private const string objectUnderlayName = "Underlay"; private const string objectGlobalMaskName = "GlobalMask"; private const string objectMaskName = "Mask"; private const string objectCompassName = "Compass"; private const string objectCenterName = "Center"; private const string objectPinsRootName = "Pins"; private const string objectPinElementName = "PinElement"; private const string objectPinElementCheckedName = "Checked"; private const string objectPinElementNameName = "Name"; private static readonly int layerUI = LayerMask.NameToLayer("UI"); public static GameObject parentObject; public static GameObject compassObject; public static GameObject centerObject; public static RectTransform pinsRootObject; public static RectTransform pinElement; public static RectTransform compassTransform; public static Mask maskComponent; public static Image maskImage; public static float compassWidth; public static readonly List tempPins = new List(); public static readonly List pinsList = new List(); public static HashSet filteredNames = new HashSet(); public static HashSet filteredWildcards = new HashSet(); private static Transform AnchorTransform { get { object result; if (Compass.orientation.Value != 0) { Player localPlayer = Player.m_localPlayer; result = ((localPlayer != null) ? ((Component)localPlayer).transform : null); } else { GameCamera instance = GameCamera.instance; result = ((instance != null) ? ((Component)instance).transform : null); } return (Transform)result; } } public static void CheckImageFiles() { Directory.CreateDirectory(Compass.configDirectory); CheckFile("compass"); CheckFile("compass_bottom"); CheckFile("center"); CheckFile("center_bottom"); CheckFile("mask"); static void CheckFile(string id) { ImageFileInfo imageInfo = ImageFileInfo.GetImageInfo(id); if (!imageInfo.initialized) { File.WriteAllBytes(imageInfo.filePath, Compass.GetEmbeddedFileData(imageInfo.fileName)); imageInfo.Load(); } } } public static void UpdateParentObject() { //IL_0038: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)parentObject)) { return; } parentObject.SetActive(Compass.modEnabled.Value); RectTransform component = parentObject.GetComponent(); ((Transform)component).localScale = Vector3.one * Compass.scale.Value; Texture2D texture = GetActiveCompassImageInfo().texture; if (Object.op_Implicit((Object)(object)texture)) { if (Compass.anchorPosition.Value == Compass.AnchorPositionType.Bottom) { component.anchorMin = new Vector2(0.5f, 0f); component.anchorMax = new Vector2(0.5f, 0f); component.anchoredPosition = new Vector2(0f, (float)(((Texture)texture).height / 2)) + new Vector2(0f - Compass.offset.Value.x, Compass.offset.Value.y); } else { component.anchorMin = new Vector2(0.5f, 1f); component.anchorMax = new Vector2(0.5f, 1f); component.anchoredPosition = new Vector2(0f, (float)(-((Texture)texture).height / 2)) - Compass.offset.Value; } } } private static ImageFileInfo GetActiveCompassImageInfo() { ImageFileInfo imageInfo = ImageFileInfo.GetImageInfo("compass"); ImageFileInfo imageInfo2 = ImageFileInfo.GetImageInfo("compass_bottom"); return (Compass.anchorPosition.Value == Compass.AnchorPositionType.Bottom && imageInfo2.initialized) ? imageInfo2 : imageInfo; } private static ImageFileInfo GetActiveCenterImageInfo() { ImageFileInfo imageInfo = ImageFileInfo.GetImageInfo("center"); ImageFileInfo imageInfo2 = ImageFileInfo.GetImageInfo("center_bottom"); return (Compass.anchorPosition.Value == Compass.AnchorPositionType.Bottom && imageInfo2.initialized) ? imageInfo2 : imageInfo; } public static void UpdateAnchorImages() { if (Object.op_Implicit((Object)(object)compassObject) && Object.op_Implicit((Object)(object)centerObject)) { bool flag = Compass.anchorPosition.Value == Compass.AnchorPositionType.Bottom; ImageFileInfo imageFileInfo = ImageFileInfo.GetImageInfo("compass").SetGameObject(flag ? null : compassObject); ImageFileInfo imageFileInfo2 = ImageFileInfo.GetImageInfo("compass_bottom").SetGameObject(flag ? compassObject : null); ((flag && imageFileInfo2.initialized) ? imageFileInfo2 : imageFileInfo).UpdateGameObject(); ImageFileInfo imageFileInfo3 = ImageFileInfo.GetImageInfo("center").SetGameObject(flag ? null : centerObject); ImageFileInfo imageFileInfo4 = ImageFileInfo.GetImageInfo("center_bottom").SetGameObject(flag ? centerObject : null); ((flag && imageFileInfo4.initialized) ? imageFileInfo4 : imageFileInfo3).UpdateGameObject(); } } public static void UpdateCenterObject() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)centerObject)) { ((Graphic)centerObject.GetComponent()).color = Compass.centerColor.Value; centerObject.SetActive(Compass.showCenter.Value); } } public static void UpdateMaskObject() { Texture2D texture = GetActiveCompassImageInfo().texture; if (Object.op_Implicit((Object)(object)texture)) { ImageFileInfo.GetImageInfo("mask").SetSpriteWidth(((Texture)texture).width / 2).UpdateGameObject(); } } public static void UpdateCompassObject() { //IL_0025: 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) if (Object.op_Implicit((Object)(object)compassObject)) { Image component = compassObject.GetComponent(); ((Graphic)component).color = Compass.compassColor.Value; Rect rect = component.sprite.rect; compassWidth = ((Rect)(ref rect)).width; } } public static void UpdatePinsObject() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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) if (Object.op_Implicit((Object)(object)pinsRootObject)) { ((Component)pinsRootObject).gameObject.SetActive(Compass.showPins.Value != Compass.CompassPinType.None); Texture2D texture = GetActiveCompassImageInfo().texture; if ((Object)(object)texture != (Object)null) { pinsRootObject.sizeDelta = new Vector2((float)(((Texture)texture).width / 2), (float)((Texture)texture).height); } RectTransform obj = pinElement; if (obj != null) { obj.SetSizeWithCurrentAnchors((Axis)0, pinsRootObject.sizeDelta.y); } RectTransform obj2 = pinElement; if (obj2 != null) { obj2.SetSizeWithCurrentAnchors((Axis)1, pinsRootObject.sizeDelta.y); } } } public static void InitializeCompass() { //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_0123: 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_0135: Expected O, but got Unknown //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Expected O, but got Unknown //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Expected O, but got Unknown //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Expected O, but got Unknown //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Expected O, but got Unknown //IL_0488: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Unknown result type (might be due to invalid IL or missing references) pinsList.Clear(); tempPins.Clear(); ImageFileInfo activeCompassImageInfo = GetActiveCompassImageInfo(); if (!activeCompassImageInfo.initialized) { Compass.LogWarning("Mandatory file " + activeCompassImageInfo.fileName + " is not found"); return; } ImageFileInfo activeCenterImageInfo = GetActiveCenterImageInfo(); if (!activeCenterImageInfo.initialized) { Compass.LogWarning("Mandatory file " + activeCenterImageInfo.fileName + " is not found"); return; } ImageFileInfo imageInfo = ImageFileInfo.GetImageInfo("mask"); if (!imageInfo.initialized) { Compass.LogWarning("Mandatory file " + imageInfo.fileName + " is not found"); return; } parentObject = new GameObject("Compass_Parent", new Type[1] { typeof(RectTransform) }) { layer = layerUI }; parentObject.transform.SetParent(Hud.instance.m_rootObject.transform); GameObject val = new GameObject("Overlay", new Type[1] { typeof(RectTransform) }) { layer = layerUI }; val.transform.SetParent(parentObject.transform, false); ImageFileInfo.SetGameObject("overlay", val).UpdateGameObject(); GameObject val2 = new GameObject("Underlay", new Type[1] { typeof(RectTransform) }) { layer = layerUI }; val2.transform.SetParent(parentObject.transform, false); ImageFileInfo.SetGameObject("underlay", val2).UpdateGameObject(); GameObject val3 = new GameObject("GlobalMask", new Type[1] { typeof(RectTransform) }) { layer = layerUI }; val3.transform.SetParent(parentObject.transform, false); val3.AddComponent(); val3.GetComponent().sizeDelta = new Vector2(1600f, 100f); GameObject val4 = new GameObject("Mask", new Type[1] { typeof(RectTransform) }) { layer = layerUI }; val4.transform.SetParent(val3.transform, false); imageInfo.SetGameObject(val4); UpdateMaskObject(); maskComponent = val4.AddComponent(); maskComponent.showMaskGraphic = false; maskImage = val4.GetComponent(); compassObject = new GameObject("Compass", new Type[1] { typeof(RectTransform) }) { layer = layerUI }; compassObject.transform.SetParent(val4.transform, false); activeCompassImageInfo.SetGameObject(compassObject).UpdateGameObject(); ImageFileInfo.GetImageInfo("compass").textureChanged = (Action)Delegate.Combine(new Action(UpdateAnchorImages), new Action(UpdateParentObject), new Action(UpdateCompassObject), new Action(UpdateMaskObject), new Action(UpdatePinsObject)); ImageFileInfo.GetImageInfo("compass_bottom").textureChanged = (Action)Delegate.Combine(new Action(UpdateAnchorImages), new Action(UpdateParentObject), new Action(UpdateCompassObject), new Action(UpdateMaskObject), new Action(UpdatePinsObject)); centerObject = new GameObject("Center", new Type[1] { typeof(RectTransform) }) { layer = layerUI }; centerObject.transform.SetParent(val4.transform, false); activeCenterImageInfo.SetGameObject(centerObject).UpdateGameObject(); ImageFileInfo.GetImageInfo("center").textureChanged = (Action)Delegate.Combine(new Action(UpdateAnchorImages), new Action(UpdateCenterObject)); ImageFileInfo.GetImageInfo("center_bottom").textureChanged = (Action)Delegate.Combine(new Action(UpdateAnchorImages), new Action(UpdateCenterObject)); pinsRootObject = new GameObject("Pins", new Type[1] { typeof(RectTransform) }) { layer = layerUI }.GetComponent(); ((Transform)pinsRootObject).SetParent(val4.transform, false); pinElement = new GameObject("PinElement", new Type[1] { typeof(RectTransform) }) { layer = layerUI }.GetComponent(); ((Transform)pinElement).SetParent(parentObject.transform, false); ((Component)pinElement).gameObject.AddComponent(); ((Component)pinElement).gameObject.SetActive(false); GameObject val5 = Object.Instantiate(((Component)Minimap.instance.m_pinPrefab.transform.Find("Checked")).gameObject, (Transform)(object)pinElement); ((Object)val5).name = "Checked"; val5.SetActive(false); GameObject val6 = Object.Instantiate(((Component)Minimap.instance.m_pinNamePrefab.transform.Find("Name")).gameObject, (Transform)(object)pinElement); ((Object)val6).name = "Name"; val6.GetComponent().fontSizeMax = 24f; val6.SetActive(false); UpdateAnchorImages(); UpdateParentObject(); UpdateCenterObject(); UpdateCompassObject(); UpdatePinsObject(); } public static void UpdateCompass() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_008f: 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_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) if (Compass.modEnabled.Value && Object.op_Implicit((Object)(object)Player.m_localPlayer) && Object.op_Implicit((Object)(object)compassObject)) { float num = AnchorTransform.eulerAngles.y; if (num > 180f) { num -= 360f; } num *= -(float)Math.PI / 180f; if (compassTransform == null) { compassTransform = compassObject.GetComponent(); } ((Transform)compassTransform).localPosition = Vector3.right * (compassWidth / 2f) * num / ((float)Math.PI * 2f) - new Vector3(compassWidth * 0.125f, 0f, 0f); UpdatePins(); } } public static void UpdatePinTextStyle() { CollectionExtensions.Do((IEnumerable)pinsList, (Action)delegate(PinElement pin) { //IL_0041: 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) if (!((Object)(object)pin.text == (Object)null)) { pin.text.enableAutoSizing = false; pin.text.fontSize = Compass.pinTextSize.Value; ((Graphic)pin.text).color = Compass.pinTextColor.Value; pin.text.fontStyle = Compass.pinTextFormat.Value; } }); } public static void DestroyCompass() { parentObject = null; compassObject = null; centerObject = null; pinsRootObject = null; pinElement = null; compassTransform = null; maskComponent = null; maskImage = null; CollectionExtensions.Do((IEnumerable)pinsList, (Action)delegate(PinElement pin) { pin.Destroy(); }); pinsList.Clear(); tempPins.Clear(); } private static void UpdatePinList() { tempPins.Clear(); AddPinRange(Minimap.instance.m_pins); if (ShowAllPingPins()) { AddPinRange(Minimap.instance.m_pingPins); } if (ShowAllShoutPins()) { AddPinRange(Minimap.instance.m_shoutPins); } if (ShowAllPlayerPins()) { AddPinRange(Minimap.instance.m_playerPins); } tempPins.Sort((PinData x, PinData y) => ComparePins(x, y)); static int ComparePins(PinData x, PinData y) { //IL_0002: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (y.m_pos == x.m_pos) { if ((int)x.m_type == 13) { return -1; } if ((int)y.m_type == 13) { return 1; } return ((Enum)(PinType)(ref y.m_type)).CompareTo((object?)x.m_type); } return Utils.DistanceXZ(AnchorTransform.position, y.m_pos).CompareTo(Utils.DistanceXZ(AnchorTransform.position, x.m_pos)); } } public static bool IsShortcutDown(KeyboardShortcut shortcut) { //IL_0002: 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) return (int)((KeyboardShortcut)(ref shortcut)).MainKey != 0 && ZInput.GetKey(((KeyboardShortcut)(ref shortcut)).MainKey, true) && ((KeyboardShortcut)(ref shortcut)).Modifiers.All((KeyCode key) => ZInput.GetKey(key, true)); } private static bool ShowAllPlayerPins() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) return Compass.alwaysShowPinText.Value || IsShortcutDown(Compass.holdToAlwaysShowPlayerPin.Value); } private static bool ShowAllShoutPins() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) return Compass.alwaysShowPinText.Value || IsShortcutDown(Compass.holdToAlwaysShowShouts.Value); } private static bool ShowAllPingPins() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) return Compass.alwaysShowPinText.Value || IsShortcutDown(Compass.holdToAlwaysShowPings.Value); } private static bool ShowPinText() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) return Compass.alwaysShowPinText.Value || IsShortcutDown(Compass.holdToShowText.Value); } private static void AddPinRange(List pinList) { CollectionExtensions.Do((IEnumerable)pinList, (Action)AddPin); } private static void AddPin(PinData pin) { //IL_0072: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_012c: Unknown result type (might be due to invalid IL or missing references) if (pin == null || (Compass.hideChecked.Value && pin.m_checked) || (Compass.hideShared.Value && pin.m_ownerID != 0)) { return; } Compass.CompassPinType pinType = GetPinType(pin.m_type); if (!Compass.showPins.Value.HasFlag(pinType) || (Compass.showOnlyLastDeath.Value && pinType == Compass.CompassPinType.Death && pin.m_pos != Game.instance.GetPlayerProfile().GetDeathPoint())) { return; } if (!IsDynamicPinToShow(pinType)) { float num = Utils.DistanceXZ(AnchorTransform.position, pin.m_pos); if (num < Compass.pinsStyleConditions.Value.x || num > Compass.pinsStyleConditions.Value.w || filteredNames.Contains(pin.m_name) || filteredWildcards.Any((string wildcard) => new WildcardPattern(wildcard).IsMatch(pin.m_name))) { return; } } if (!tempPins.Contains(pin)) { tempPins.Add(pin); } } private static Compass.CompassPinType GetPinType(PinType pinType) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected I4, but got Unknown if (1 == 0) { } Compass.CompassPinType result = (int)pinType switch { 0 => Compass.CompassPinType.Icon0, 1 => Compass.CompassPinType.Icon1, 2 => Compass.CompassPinType.Icon2, 3 => Compass.CompassPinType.Icon3, 6 => Compass.CompassPinType.Icon4, 4 => Compass.CompassPinType.Death, 5 => Compass.CompassPinType.Bed, 7 => Compass.CompassPinType.Shout, 9 => Compass.CompassPinType.Boss, 10 => Compass.CompassPinType.Player, 11 => Compass.CompassPinType.RandomEvent, 12 => Compass.CompassPinType.Ping, 13 => Compass.CompassPinType.EventArea, 14 => Compass.CompassPinType.HildirQuest, 15 => Compass.CompassPinType.HildirQuest, 16 => Compass.CompassPinType.HildirQuest, 8 => Compass.CompassPinType.Static, _ => Compass.CompassPinType.Custom, }; if (1 == 0) { } return result; } public static void UpdatePins() { //IL_00c0: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_028c: 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_02a5: 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_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)pinsRootObject) || !((Component)pinsRootObject).gameObject.activeInHierarchy || (Object)(object)AnchorTransform == (Object)null) { return; } UpdatePinList(); if (pinsList.Count != tempPins.Count) { CollectionExtensions.Do((IEnumerable)pinsList, (Action)delegate(PinElement pin) { pin.Destroy(); }); pinsList.Clear(); for (int i = 0; i < tempPins.Count; i++) { new PinElement(); } } Rect rect = GetActiveCompassImageInfo().sprite.rect; bool flag = false; float num = ((Compass.anchorPosition.Value == Compass.AnchorPositionType.Bottom) ? (((Rect)(ref rect)).height / 2f) : ((0f - ((Rect)(ref rect)).height) / 2f)); for (int j = 0; j < tempPins.Count; j++) { PinElement pinElement = pinsList[j]; PinData val = tempPins[j]; pinElement.name = val.m_name; pinElement.image.sprite = val.m_icon; if (Compass.pinsColor.Value != Color.clear) { ((Graphic)pinElement.image).color = Compass.pinsColor.Value; } bool flag2 = IsDynamicPinToShow(val.m_type); float num2 = Utils.DistanceXZ(AnchorTransform.position, val.m_pos); if (num2 > Compass.pinsStyleConditions.Value.y && flag2) { num2 = Compass.pinsStyleConditions.Value.y; } float num3 = Mathf.Lerp(Compass.pinsScale.Value.x, Compass.pinsScale.Value.y, (num2 - Compass.pinsStyleConditions.Value.y) / (Compass.pinsStyleConditions.Value.z - Compass.pinsStyleConditions.Value.y)); float num4 = Mathf.Lerp(Compass.pinsAlpha.Value.x, Compass.pinsAlpha.Value.y, (num2 - Compass.pinsStyleConditions.Value.z) / (Compass.pinsStyleConditions.Value.w - Compass.pinsStyleConditions.Value.z)); ((Transform)pinElement.rect).localScale = Vector3.one * num3; ((Transform)pinElement.rect).localPosition = Vector3.right * (((Rect)(ref rect)).width / 2f) * GetAngle(val.m_pos) / ((float)Math.PI * 2f); ((Graphic)pinElement.image).color = new Color(((Graphic)pinElement.image).color.r, ((Graphic)pinElement.image).color.g, ((Graphic)pinElement.image).color.b, val.m_animate ? Compass.pinsAlpha.Value.x : num4); ((Transform)pinElement.rect).SetSiblingIndex(j); GameObject checkedIcon = pinElement.checkedIcon; if (checkedIcon != null) { checkedIcon.SetActive(val.m_checked); } if ((Object)(object)pinElement.text != (Object)null) { ((Component)pinElement.text).gameObject.SetActive(!string.IsNullOrWhiteSpace(val.m_name) && (flag2 || ShowPinText())); if (((Behaviour)pinElement.text).isActiveAndEnabled) { pinElement.text.SetText(GetPinText(val)); pinElement.text.enableAutoSizing = false; pinElement.text.fontSize = Compass.pinTextSize.Value; ((Graphic)pinElement.text).color = Compass.pinTextColor.Value; pinElement.text.fontStyle = Compass.pinTextFormat.Value; pinElement.text.transform.localScale = Vector3.one / num3; pinElement.text.transform.localPosition = new Vector3(0f, num, 0f); flag = true; } } if (val.m_animate && !flag2) { RectTransform rect2 = pinElement.rect; ((Transform)rect2).localScale = ((Transform)rect2).localScale * (0.9f + Mathf.Sin(Time.time * 5f) * 0.2f); } } ((Behaviour)maskComponent).enabled = !flag; ((Behaviour)maskImage).enabled = !flag; } public static bool IsDynamicPinToShow(Compass.CompassPinType pinType) { return (pinType == Compass.CompassPinType.Shout && ShowAllShoutPins()) || (pinType == Compass.CompassPinType.Player && ShowAllPlayerPins()) || (pinType == Compass.CompassPinType.Ping && ShowAllPingPins()); } public static bool IsDynamicPinToShow(PinType pinType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return IsDynamicPinToShow(GetPinType(pinType)); } public static float GetAngle(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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) //IL_0020: 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) return GetAtan2(AnchorTransform.InverseTransformPoint(new Vector3(position.x, AnchorTransform.position.y, position.z))); } public static float GetAtan2(Vector3 vector) { //IL_0000: 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) return Mathf.Atan2(vector.x, vector.z); } public static string GetPinText(PinData pin) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) return (string.IsNullOrEmpty(pin.m_author.m_userID) || pin.m_author == ((IUser)PlatformManager.DistributionPlatform.LocalUser).PlatformUserID) ? Localization.instance.Localize(pin.m_name) : CensorShittyWords.FilterUGC(Localization.instance.Localize(pin.m_name), (UGCType)4, pin.m_author, 0L); } } public class ImageFileInfo { public static readonly Dictionary images = new Dictionary(); public const string ext = "png"; public static string filter = GetFilename("*"); public string fileID; public string fileName; public string filePath; public Texture2D texture; public bool initialized = false; public GameObject gameObject; public Sprite sprite; public int spriteWidthOverride; public Action textureChanged; public ImageFileInfo(string id) { fileID = id; fileName = GetFilename(id); filePath = Path.Combine(Compass.configDirectory, fileName); Load(); images[fileID] = this; } public void Load() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown Clear(); texture = new Texture2D(2, 2, (TextureFormat)4, true, true); initialized = Compass.LoadTextureFromConfigDirectory(fileName, ref texture); ((Texture)texture).wrapMode = (TextureWrapMode)1; InitSprite(); UpdateGameObject(); Update(); textureChanged?.Invoke(); } public void Clear() { if ((Object)(object)texture != (Object)null) { Object.Destroy((Object)(object)texture); texture = null; } if ((Object)(object)sprite != (Object)null) { Object.Destroy((Object)(object)sprite); sprite = null; } initialized = false; Update(); } public void Update() { GameObject obj = gameObject; if (obj != null) { obj.SetActive(initialized); } } public ImageFileInfo SetSpriteWidth(int width) { spriteWidthOverride = width; InitSprite(); return this; } public ImageFileInfo SetGameObject(GameObject gameObject) { this.gameObject = gameObject; return this; } public void UpdateGameObject() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)gameObject) && initialized) { RectTransform component = gameObject.GetComponent(); component.sizeDelta = new Vector2((float)((spriteWidthOverride == 0) ? ((Texture)texture).width : spriteWidthOverride), (float)((Texture)texture).height); Image val = gameObject.GetComponent() ?? gameObject.AddComponent(); val.sprite = sprite; val.preserveAspect = true; } } private void InitSprite() { //IL_005e: 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) if ((Object)(object)sprite != (Object)null) { Object.Destroy((Object)(object)sprite); } sprite = ((!initialized) ? null : Sprite.Create(texture, new Rect(0f, 0f, (float)((spriteWidthOverride == 0) ? ((Texture)texture).width : spriteWidthOverride), (float)((Texture)texture).height), Vector2.zero)); } private static string GetFilename(string filename) { return Path.ChangeExtension(filename, "png"); } public static ImageFileInfo SetGameObject(string id, GameObject gameObject) { return GetImageInfo(id).SetGameObject(gameObject); } public static ImageFileInfo GetImageInfo(string id) { ImageFileInfo value; return images.TryGetValue(id, out value) ? value : new ImageFileInfo(id); } public static void TryClearFile(string filename) { if (images.TryGetValue(Path.GetFileNameWithoutExtension(filename), out var value)) { value.Clear(); } } public static void TryLoadFile(string filename) { if (images.TryGetValue(Path.GetFileNameWithoutExtension(filename), out var value)) { value.Load(); } } } }