Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ChatTooltips v1.1.4
ChatTooltips.dll
Decompiled 3 weeks agousing System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using ChatTooltips.Properties; using HUDdleUP; using HarmonyLib; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.EventSystems; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ChatTooltips")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ChatTooltips")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d6a316ac-523f-4709-9664-2a3e0468b33f")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace ChatTooltips { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("bulletbot.chattooltips", "ChatTooltips", "1.1.4")] public class Plugin : BaseUnityPlugin { private static class RiskOfOptions { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static IsDisabledDelegate <>9__2_0; public static IsDisabledDelegate <>9__2_1; public static IsDisabledDelegate <>9__2_2; public static IsDisabledDelegate <>9__2_3; public static IsDisabledDelegate <>9__2_4; public static IsDisabledDelegate <>9__2_5; public static IsDisabledDelegate <>9__2_6; internal bool <OnAwake>b__2_0() { return instance.anyTooltip.Value; } internal bool <OnAwake>b__2_1() { return instance.anyTooltip.Value; } internal bool <OnAwake>b__2_2() { return instance.anyTooltip.Value; } internal bool <OnAwake>b__2_3() { return !instance.anyTooltip.Value; } internal bool <OnAwake>b__2_4() { return LookingGlass.IsLoaded(); } internal bool <OnAwake>b__2_5() { return !LookingGlass.IsLoaded(); } internal bool <OnAwake>b__2_6() { return !LookingGlass.IsLoaded(); } } public const string modGUID = "com.rune580.riskofoptions"; public static bool IsLoaded() { return Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); } public static void OnAwake() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_005e: 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) //IL_0095: 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_00c4: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown //IL_0103: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_0142: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Expected O, but got Unknown //IL_019d: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Expected O, but got Unknown //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Expected O, but got Unknown //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: 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_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Expected O, but got Unknown //IL_0213: Expected O, but got Unknown //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Expected O, but got Unknown //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Expected O, but got Unknown //IL_0252: Expected O, but got Unknown //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Expected O, but got Unknown //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Expected O, but got Unknown //IL_0291: Expected O, but got Unknown //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Expected O, but got Unknown //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Expected O, but got Unknown //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Expected O, but got Unknown //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Expected O, but got Unknown Bitmap icon = Resources.icon; using (MemoryStream memoryStream = new MemoryStream()) { ((Image)icon).Save((Stream)memoryStream, ImageFormat.Png); Texture2D val = new Texture2D(((Image)icon).Width, ((Image)icon).Height, (TextureFormat)5, false, false); ImageConversion.LoadImage(val, memoryStream.ToArray()); ((Texture)val).filterMode = (FilterMode)0; ModSettingsManager.SetModIcon(Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f))); } ConfigEntry<bool> pickupTooltip = instance.pickupTooltip; CheckBoxConfig val2 = new CheckBoxConfig(); object obj = <>c.<>9__2_0; if (obj == null) { IsDisabledDelegate val3 = () => instance.anyTooltip.Value; <>c.<>9__2_0 = val3; obj = (object)val3; } ((BaseOptionConfig)val2).checkIfDisabled = (IsDisabledDelegate)obj; ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(pickupTooltip, val2)); ConfigEntry<bool> achievementTooltip = instance.achievementTooltip; CheckBoxConfig val4 = new CheckBoxConfig(); object obj2 = <>c.<>9__2_1; if (obj2 == null) { IsDisabledDelegate val5 = () => instance.anyTooltip.Value; <>c.<>9__2_1 = val5; obj2 = (object)val5; } ((BaseOptionConfig)val4).checkIfDisabled = (IsDisabledDelegate)obj2; ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(achievementTooltip, val4)); ConfigEntry<bool> pingTooltip = instance.pingTooltip; CheckBoxConfig val6 = new CheckBoxConfig(); object obj3 = <>c.<>9__2_2; if (obj3 == null) { IsDisabledDelegate val7 = () => instance.anyTooltip.Value; <>c.<>9__2_2 = val7; obj3 = (object)val7; } ((BaseOptionConfig)val6).checkIfDisabled = (IsDisabledDelegate)obj3; ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(pingTooltip, val6)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.anyTooltip)); ConfigEntry<string> excludeMessageTypes = instance.excludeMessageTypes; InputFieldConfig val8 = new InputFieldConfig { lineType = (LineType)2 }; object obj4 = <>c.<>9__2_3; if (obj4 == null) { IsDisabledDelegate val9 = () => !instance.anyTooltip.Value; <>c.<>9__2_3 = val9; obj4 = (object)val9; } ((BaseOptionConfig)val8).checkIfDisabled = (IsDisabledDelegate)obj4; ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(excludeMessageTypes, val8)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.notificationOnClick)); ConfigEntry<float> notificationDuration = instance.notificationDuration; SliderConfig val10 = new SliderConfig { min = 0.25f, max = 20f, FormatString = "{0:0.##}s" }; object obj5 = <>c.<>9__2_4; if (obj5 == null) { IsDisabledDelegate val11 = () => LookingGlass.IsLoaded(); <>c.<>9__2_4 = val11; obj5 = (object)val11; } ((BaseOptionConfig)val10).checkIfDisabled = (IsDisabledDelegate)obj5; ModSettingsManager.AddOption((BaseOption)new SliderOption(notificationDuration, val10)); ConfigEntry<bool> quantityBasedOnInventory = instance.quantityBasedOnInventory; CheckBoxConfig val12 = new CheckBoxConfig(); object obj6 = <>c.<>9__2_5; if (obj6 == null) { IsDisabledDelegate val13 = () => !LookingGlass.IsLoaded(); <>c.<>9__2_5 = val13; obj6 = (object)val13; } ((BaseOptionConfig)val12).checkIfDisabled = (IsDisabledDelegate)obj6; ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(quantityBasedOnInventory, val12)); ConfigEntry<bool> quantityBasedOnPickup = instance.quantityBasedOnPickup; CheckBoxConfig val14 = new CheckBoxConfig(); object obj7 = <>c.<>9__2_6; if (obj7 == null) { IsDisabledDelegate val15 = () => !LookingGlass.IsLoaded(); <>c.<>9__2_6 = val15; obj7 = (object)val15; } ((BaseOptionConfig)val14).checkIfDisabled = (IsDisabledDelegate)obj7; ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(quantityBasedOnPickup, val14)); ModSettingsManager.AddOption((BaseOption)new SliderOption(instance.hideUnderPercentage, new SliderConfig { min = 0f, max = 100f, FormatString = "{0:0.##}%" })); } } private static class LookingGlass { public const string modGUID = "droppod.lookingglass"; private static Type itemStatsClassType; private static MethodInfo getItemDescription; public static bool IsLoaded() { return Chainloader.PluginInfos.ContainsKey("droppod.lookingglass"); } public static void OnAwake() { itemStatsClassType = AccessTools.TypeByName("LookingGlass.ItemStatsNameSpace.ItemStats"); getItemDescription = AccessTools.Method(itemStatsClassType, "GetItemDescription", (Type[])null, (Type[])null); } public static bool IsItemStatsEnabled() { return ((ConfigEntry<bool>)AccessTools.Field(itemStatsClassType, "fullDescInHud").GetValue(null)).Value; } public static string GetItemDescription(ItemDef itemDef, int newItemCount, CharacterMaster master, bool withOneMore, bool forceNew = false) { return (string)getItemDescription.Invoke(null, new object[5] { itemDef, newItemCount, master, withOneMore, forceNew }); } } private static class HUDdleUPMod { public const string modGUID = "itsschwer.HUDdleUP"; private static MethodInfo getCombinedDescription; private static MethodInfo getEquipmentCooldown; public static bool IsLoaded() { return Chainloader.PluginInfos.ContainsKey("itsschwer.HUDdleUP"); } public static void OnAwake() { Type type = AccessTools.TypeByName("HUDdleUP.Patches.FullerDescriptions"); getCombinedDescription = AccessTools.Method(type, "GetCombinedDescription", (Type[])null, (Type[])null); getEquipmentCooldown = AccessTools.Method(type, "GetEquipmentCooldown", (Type[])null, (Type[])null); } public static bool IsFullerItemDescriptionsEnabled() { return Plugin.Config.FullerItemDescriptions; } public static bool IsFullerEquipmentDescriptionsEnabled() { return Plugin.Config.FullerEquipmentDescriptions; } public static string GetCombinedDescription(string descriptionToken, string pickupToken) { return (string)getCombinedDescription.Invoke(null, new object[2] { descriptionToken, pickupToken }); } public static string GetEquipmentCooldown(EquipmentDef equipment, Inventory inventory) { return (string)getEquipmentCooldown.Invoke(null, new object[2] { equipment, inventory }); } } public enum MessageType { None = -1, Pickup, Achievement, Ping, Any } [CompilerGenerated] private sealed class <RefocusChatbox>d__26 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public bool showInp; public Plugin <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RefocusChatbox>d__26(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitUntil((Func<bool>)(() => !(bool)AccessTools.Property(typeof(ChatBox), "showInput").GetValue(<>4__this.chatBox))); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.chatBox.SetShowInput(true); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const string modGUID = "bulletbot.chattooltips"; private const string modName = "ChatTooltips"; private const string modVer = "1.1.4"; public static Plugin instance; public ManualLogSource logger; private readonly Harmony harmony = new Harmony("bulletbot.chattooltips"); private ConfigEntry<bool> pickupTooltip; private ConfigEntry<bool> achievementTooltip; private ConfigEntry<bool> pingTooltip; private ConfigEntry<bool> anyTooltip; public ConfigEntry<string> excludeMessageTypes; private ConfigEntry<bool> notificationOnClick; private ConfigEntry<float> notificationDuration; private ConfigEntry<bool> quantityBasedOnInventory; private ConfigEntry<bool> quantityBasedOnPickup; private ConfigEntry<float> hideUnderPercentage; public ChatBox chatBox; private MPEventSystem eventSystem; private TooltipProvider tooltipProvider; private int currentQuantity; private const string dataSeperator = "|"; private void Awake() { //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Expected O, but got Unknown instance = this; logger = Logger.CreateLogSource("ChatTooltips"); string text = "General"; pickupTooltip = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Pickup Tooltip", true, "Determines whether to be able to display the pickup tooltip."); achievementTooltip = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Achievement Tooltip", true, "Determines whether to be able to display the description tooltip."); pingTooltip = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Ping Tooltip", true, "Determines whether to be able to display the ping tooltip."); anyTooltip = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Any Tooltip", false, "Determines whether to be able to display the any type of message tooltip."); List<Type> list = (List<Type>)AccessTools.Field(typeof(ChatMessageBase), "chatMessageIndexToType").GetValue(null); string text2 = ""; foreach (Type item in list) { text2 = text2 + "\n" + item.FullName.Replace("+", "."); } excludeMessageTypes = ((BaseUnityPlugin)this).Config.Bind<string>(text, "Exclude Message Types", "RoR2.Chat.UserChatMessage", "Types:\n" + text2); notificationOnClick = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Notification On Click", true, "Determines whether to be able to display a notification when clicked."); notificationDuration = ((BaseUnityPlugin)this).Config.Bind<float>(text, "Notification Duration", 2f, "Determines the duration of the notification. Note: If the \"LookingGlass\" mod is installed, this setting will be disabled and will be set by the \"LookingGlass\" mod."); quantityBasedOnInventory = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Quantity Based On Inventory", true, "Determines whether to calculate the item stats based on your inventory. Note: This setting is only for the \"LookingGlass\" mod."); quantityBasedOnPickup = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Quantity Based On Pickup", false, "Determines whether to calculate the item stats based on the pickup count. Note: This setting is only for the \"LookingGlass\" mod."); hideUnderPercentage = ((BaseUnityPlugin)this).Config.Bind<float>(text, "Hide Under Percentage", 10f, "Determines the percentage threshold to hide the tooltip based on text transparency."); if (RiskOfOptions.IsLoaded()) { RiskOfOptions.OnAwake(); } if (LookingGlass.IsLoaded()) { LookingGlass.OnAwake(); } if (HUDdleUPMod.IsLoaded()) { HUDdleUPMod.OnAwake(); } HUD.shouldHudDisplay += (ShouldHudDisplayDelegate)delegate(HUD hud, ref bool _) { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: 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_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Expected O, but got Unknown //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)chatBox == (Object)null)) { if ((Object)(object)eventSystem == (Object)null) { ref MPEventSystem reference = ref eventSystem; EventSystem current2 = EventSystem.current; reference = (MPEventSystem)(object)((current2 is MPEventSystem) ? current2 : null); } else { TMP_InputField messagesText = chatBox.messagesText; TMP_Text componentInChildren = (TMP_Text)(object)((Component)messagesText).GetComponentInChildren<HGTextMeshProUGUI>(); RectTransform component = ((Component)((Component)messagesText).transform.parent).GetComponent<RectTransform>(); if ((Object)(object)tooltipProvider == (Object)null) { tooltipProvider = ((Component)component).gameObject.AddComponent<TooltipProvider>(); } CanvasRenderer component2 = ((Component)componentInChildren).GetComponent<CanvasRenderer>(); if (component2.GetInheritedAlpha() <= hideUnderPercentage.Value / 100f || PauseManager.PauseScreenIsOpen()) { RemoveTooltip(eventSystem); } else { Vector3 mousePosition = Input.mousePosition; int num = TMP_TextUtilities.FindIntersectingLink(componentInChildren, mousePosition, hud.cameraRigController.uiCam); if (num != -1) { TMP_LinkInfo val = componentInChildren.textInfo.linkInfo[num]; for (int i = val.linkTextfirstCharacterIndex; i < val.linkTextfirstCharacterIndex + val.linkTextLength; i++) { TMP_CharacterInfo val2 = componentInChildren.textInfo.characterInfo[i]; Vector3 val3 = componentInChildren.transform.TransformPoint(val2.topLeft); Vector3 val4 = componentInChildren.transform.TransformPoint(val2.bottomRight); if (!RectTransformUtility.RectangleContainsScreenPoint(component, Vector2.op_Implicit(val3), (Camera)null) || !RectTransformUtility.RectangleContainsScreenPoint(component, Vector2.op_Implicit(val4), (Camera)null)) { RemoveTooltip(eventSystem); return; } } string[] array = ((TMP_LinkInfo)(ref val)).GetLinkID().Split("|".ToCharArray()); MessageType messageType = (MessageType)int.Parse(array[0]); string text3 = array[1]; TooltipContent val5 = default(TooltipContent); val5.titleColor = Color.white; val5.bodyColor = new Color(0.6f, 0.6f, 0.6f, 1f); TooltipContent content = val5; if (Input.GetMouseButtonDown(0) && notificationOnClick.Value) { if ((bool)AccessTools.Property(typeof(ChatBox), "showInput").GetValue(chatBox)) { ((MonoBehaviour)this).StartCoroutine("RefocusChatbox"); } CharacterMaster cachedMaster = LocalUserManager.GetFirstLocalUser().cachedMaster; if ((Object)(object)cachedMaster != (Object)null) { CharacterMasterNotificationQueue notificationQueueForMaster = CharacterMasterNotificationQueue.GetNotificationQueueForMaster(cachedMaster); if ((Object)(object)notificationQueueForMaster != (Object)null) { object objectDef = GetObjectDef(ref content, new string[2] { (-1).ToString(), text3 }, shouldSet: false); if (objectDef != null) { AccessTools.Method(typeof(CharacterMasterNotificationQueue), "PushNotification", (Type[])null, (Type[])null).Invoke(notificationQueueForMaster, new object[2] { (object)new NotificationInfo(objectDef, (TransformationInfo)null, false, 0), notificationDuration.Value }); } } } } bool flag = false; if (messageType == MessageType.Pickup && pickupTooltip.Value) { int result = 1; if (quantityBasedOnPickup.Value && LookingGlass.IsLoaded() && LookingGlass.IsItemStatsEnabled()) { int.TryParse(array[2], out result); } flag = tooltipProvider.titleToken == text3 && currentQuantity == result; if (!flag) { RemoveTooltip(eventSystem); flag = GetObjectDef(ref content, array) != null; if (flag) { currentQuantity = result; SetTooltip(eventSystem, content, Vector2.op_Implicit(mousePosition)); } } } else if ((messageType == MessageType.Achievement && achievementTooltip.Value) || (messageType == MessageType.Ping && pingTooltip.Value) || (messageType == MessageType.Any && anyTooltip.Value)) { flag = tooltipProvider.titleToken == text3; if (!flag) { RemoveTooltip(eventSystem); flag = GetObjectDef(ref content, array) != null; if (flag) { SetTooltip(eventSystem, content, Vector2.op_Implicit(mousePosition)); } } } if (flag) { return; } } RemoveTooltip(eventSystem); } } } }; harmony.PatchAll(); } [IteratorStateMachine(typeof(<RefocusChatbox>d__26))] private IEnumerator RefocusChatbox(bool showInp) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <RefocusChatbox>d__26(0) { <>4__this = this, showInp = showInp }; } private void SetTooltip(MPEventSystem eventSystem, TooltipContent content, Vector2 mousePosition) { //IL_0007: 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) tooltipProvider.SetContent(content); TooltipController.SetTooltip(eventSystem, tooltipProvider, mousePosition, (RectTransform)null); } private void RemoveTooltip(MPEventSystem eventSystem) { TooltipController.RemoveTooltip(eventSystem, tooltipProvider); tooltipProvider.titleToken = null; currentQuantity = 1; } private object GetObjectDef(ref TooltipContent content, string[] data, bool shouldSet = true) { //IL_001a: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: 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_0079: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: 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_021d: 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_0227: 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_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) CharacterMaster cachedMaster = LocalUserManager.GetFirstLocalUser().cachedMaster; MessageType messageType = (MessageType)int.Parse(data[0]); string text = data[1]; GenericStaticEnumerable<ItemIndex, AllItemsEnumerator> allItems = ItemCatalog.allItems; AllItemsEnumerator enumerator = allItems.GetEnumerator(); try { while (((AllItemsEnumerator)(ref enumerator)).MoveNext()) { ItemIndex current = ((AllItemsEnumerator)(ref enumerator)).Current; ItemDef itemDef = ItemCatalog.GetItemDef(current); if (!((Object)(object)itemDef != (Object)null) || !(itemDef.nameToken == text)) { continue; } if (shouldSet) { content.titleToken = text; Color titleColor = Color32.op_Implicit(ColorCatalog.GetColor((ColorIndex)10)); ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef(itemDef.tier); if ((Object)(object)itemTierDef != (Object)null) { titleColor = Color32.op_Implicit(ColorCatalog.GetColor(itemTierDef.darkColorIndex)); } content.titleColor = titleColor; content.bodyToken = itemDef.pickupToken; string overrideBodyText = null; if (LookingGlass.IsLoaded() && LookingGlass.IsItemStatsEnabled()) { int result = 1; if ((Object)(object)cachedMaster != (Object)null && quantityBasedOnInventory.Value) { result = cachedMaster.inventory.GetItemCountEffective(current); } else if (messageType == MessageType.Pickup && quantityBasedOnPickup.Value) { int.TryParse(data[2], out result); } overrideBodyText = LookingGlass.GetItemDescription(itemDef, result, cachedMaster, (Object)(object)cachedMaster != (Object)null && quantityBasedOnInventory.Value); } else if (HUDdleUPMod.IsLoaded() && HUDdleUPMod.IsFullerItemDescriptionsEnabled()) { overrideBodyText = HUDdleUPMod.GetCombinedDescription(itemDef.descriptionToken, itemDef.pickupToken); } content.overrideBodyText = overrideBodyText; } return itemDef; } } finally { ((IDisposable)(AllItemsEnumerator)(ref enumerator)).Dispose(); } GenericStaticEnumerable<EquipmentIndex, AllEquipmentEnumerator> allEquipment = EquipmentCatalog.allEquipment; AllEquipmentEnumerator enumerator2 = allEquipment.GetEnumerator(); try { while (((AllEquipmentEnumerator)(ref enumerator2)).MoveNext()) { EquipmentIndex current2 = ((AllEquipmentEnumerator)(ref enumerator2)).Current; EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(current2); if (!((Object)(object)equipmentDef != (Object)null) || !(equipmentDef.nameToken == text)) { continue; } if (shouldSet) { content.titleToken = text; content.titleColor = Color32.op_Implicit(ColorCatalog.GetColor(equipmentDef.colorIndex)); string bodyToken = equipmentDef.pickupToken; if (LookingGlass.IsLoaded() && LookingGlass.IsItemStatsEnabled()) { bodyToken = equipmentDef.descriptionToken; } content.bodyToken = bodyToken; string overrideBodyText2 = null; if (HUDdleUPMod.IsLoaded() && HUDdleUPMod.IsFullerEquipmentDescriptionsEnabled()) { overrideBodyText2 = HUDdleUPMod.GetCombinedDescription(equipmentDef.descriptionToken, equipmentDef.pickupToken) + (((Object)(object)cachedMaster != (Object)null) ? ("\n\n" + HUDdleUPMod.GetEquipmentCooldown(equipmentDef, cachedMaster.inventory)) : ""); } content.overrideBodyText = overrideBodyText2; } return equipmentDef; } } finally { ((IDisposable)(AllEquipmentEnumerator)(ref enumerator2)).Dispose(); } GenericStaticEnumerable<AchievementDef, Enumerator> allAchievementDefs = AchievementManager.allAchievementDefs; Enumerator enumerator3 = allAchievementDefs.GetEnumerator(); try { while (((Enumerator)(ref enumerator3)).MoveNext()) { AchievementDef current3 = ((Enumerator)(ref enumerator3)).Current; if (current3.nameToken == text) { if (shouldSet) { content.titleToken = text; content.titleColor = new Color(0.741f, 0.882f, 0.318f); content.bodyToken = current3.descriptionToken; } return current3; } } } finally { ((IDisposable)(Enumerator)(ref enumerator3)).Dispose(); } return null; } public bool LinkMessage(ref string result, MessageType messageType, string[] data) { string @string = Language.GetString(data[0]); int num = result.IndexOf(@string); bool flag = num != -1; if (flag) { string text = ""; for (int i = 0; i < data.Length; i++) { text = text + (string.IsNullOrEmpty(text) ? "|" : "") + data[i] + ((i != data.Length - 1) ? "|" : ""); } string[] obj = new string[8] { result.Substring(0, num), "<link=\"", null, null, null, null, null, null }; int num2 = (int)messageType; obj[2] = num2.ToString(); obj[3] = text; obj[4] = "\">"; obj[5] = @string; obj[6] = "</link>"; obj[7] = result.Substring(num + @string.Length); result = string.Concat(obj); } return flag; } } } namespace ChatTooltips.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("ChatTooltips.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static Bitmap icon { get { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown object @object = ResourceManager.GetObject("icon", resourceCulture); return (Bitmap)@object; } } internal Resources() { } } } namespace ChatTooltips.Patches { [HarmonyPatch(typeof(ChatBox))] internal class ChatBoxPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start(ChatBox __instance) { if (!((Object)(object)Run.instance == (Object)null)) { Plugin.instance.chatBox = __instance; } } } [HarmonyPatch(typeof(PingIndicator))] internal class PingIndicatorPatch { [HarmonyPatch("RebuildPing")] [HarmonyPostfix] private static void RebuildPing(PingIndicator __instance) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Plugin.instance.chatBox == (Object)null || (Object)(object)__instance.pingTarget == (Object)null) { return; } List<PickupIndex> list = new List<PickupIndex>(); PingType val = (PingType)AccessTools.Field(typeof(PingIndicator), "pingType").GetValue(__instance); if ((int)val == 2) { ShopTerminalBehavior component = __instance.pingTarget.GetComponent<ShopTerminalBehavior>(); GenericPickupController component2 = __instance.pingTarget.GetComponent<GenericPickupController>(); PickupPickerController component3 = __instance.pingTarget.GetComponent<PickupPickerController>(); if ((Object)(object)component != (Object)null && !component.pickupIndexIsHidden && Object.op_Implicit((Object)(object)component.pickupDisplay)) { list.Add(component.CurrentPickup().pickupIndex); } else if ((Object)(object)component2 != (Object)null) { list.Add(component2.pickup.pickupIndex); } else if ((Object)(object)component3 != (Object)null) { List<Option> source = ((Option[])AccessTools.Field(typeof(PickupPickerController), "options").GetValue(component3)).ToList(); list.AddRange(from x in source where x.available select x.pickup.pickupIndex); } } if (list.Count <= 0) { return; } List<string> list2 = (List<string>)AccessTools.Field(typeof(Chat), "log").GetValue(null); string result = list2[list2.Count - 1]; bool flag = false; foreach (PickupIndex item in list) { bool flag2 = false; foreach (MiscPickupDef miscPickupDef in MiscPickupCatalog.miscPickupDefs) { if (PickupCatalog.FindPickupIndex(miscPickupDef.miscPickupIndex) == item) { flag2 = true; break; } } if (!flag2) { string nameToken = PickupCatalog.GetPickupDef(item).nameToken; bool flag3 = Plugin.instance.LinkMessage(ref result, Plugin.MessageType.Ping, new string[1] { nameToken }); if (!flag && flag3) { flag = true; } } } if (flag) { list2[list2.Count - 1] = result; AccessTools.Method(typeof(ChatBox), "BuildChat", (Type[])null, (Type[])null).Invoke(Plugin.instance.chatBox, null); ((Action)AccessTools.Field(typeof(Chat), "onChatChanged").GetValue(null))(); } } } [HarmonyPatch] internal class ChatMessageBasesPatch { [CompilerGenerated] private sealed class <TargetMethods>d__0 : IEnumerable<MethodBase>, IEnumerable, IEnumerator<MethodBase>, IDisposable, IEnumerator { private int <>1__state; private MethodBase <>2__current; private int <>l__initialThreadId; private List<Type> <chatMessageIndexToType>5__1; private List<Type>.Enumerator <>s__2; private Type <type>5__3; private MethodInfo <methodInfo>5__4; MethodBase IEnumerator<MethodBase>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <TargetMethods>d__0(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <chatMessageIndexToType>5__1 = null; <>s__2 = default(List<Type>.Enumerator); <type>5__3 = null; <methodInfo>5__4 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <chatMessageIndexToType>5__1 = (List<Type>)AccessTools.Field(typeof(ChatMessageBase), "chatMessageIndexToType").GetValue(null); <>s__2 = <chatMessageIndexToType>5__1.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; <methodInfo>5__4 = null; <type>5__3 = null; break; } while (<>s__2.MoveNext()) { <type>5__3 = <>s__2.Current; <methodInfo>5__4 = AccessTools.Method(<type>5__3, "ConstructChatString", (Type[])null, (Type[])null); if (<methodInfo>5__4 == null || <methodInfo>5__4.IsAbstract) { continue; } <>2__current = <methodInfo>5__4; <>1__state = 1; return true; } <>m__Finally1(); <>s__2 = default(List<Type>.Enumerator); return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>s__2).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<MethodBase> IEnumerable<MethodBase>.GetEnumerator() { if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; return this; } return new <TargetMethods>d__0(0); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<MethodBase>)this).GetEnumerator(); } } [IteratorStateMachine(typeof(<TargetMethods>d__0))] private static IEnumerable<MethodBase> TargetMethods() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <TargetMethods>d__0(-2); } [HarmonyPostfix] private static void ConstructChatString(object __instance, string __result) { Type type = __instance.GetType(); if (!(from x in Plugin.instance.excludeMessageTypes.Value.Split(new char[1] { ',' }) select x.Trim() into x where !string.IsNullOrEmpty(x) select x).Contains(type.FullName.Replace("+", "."))) { } } } [HarmonyPatch(typeof(SubjectFormatChatMessage))] internal class SubjectFormatChatMessagePatch { [HarmonyPatch("ConstructChatString")] [HarmonyPostfix] private static void ConstructChatString(SubjectFormatChatMessage __instance, ref string __result) { if (((SubjectChatMessage)__instance).baseToken.StartsWith("ACHIEVEMENT_UNLOCKED_MESSAGE")) { Plugin.instance.LinkMessage(ref __result, Plugin.MessageType.Achievement, new string[1] { __instance.paramTokens[0] }); } } } [HarmonyPatch(typeof(PlayerPickupChatMessage))] internal class PlayerPickupChatMessage { [HarmonyPatch("ConstructChatString")] [HarmonyPostfix] private static void ConstructChatString(PlayerPickupChatMessage __instance, ref string __result) { string pickupToken = __instance.pickupToken; foreach (MiscPickupDef miscPickupDef in MiscPickupCatalog.miscPickupDefs) { if (miscPickupDef.nameToken == pickupToken) { return; } } Plugin.instance.LinkMessage(ref __result, Plugin.MessageType.Pickup, new string[2] { pickupToken, __instance.pickupQuantity.ToString() }); } } }