Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of ChatTooltips v1.1.3
ChatTooltips.dll
Decompiled 2 months agousing System; using System.CodeDom.Compiler; 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.3")] 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; internal bool <OnAwake>b__2_0() { return LookingGlass.IsLoaded(); } internal bool <OnAwake>b__2_1() { return !LookingGlass.IsLoaded(); } internal bool <OnAwake>b__2_2() { 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_009f: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00de: Expected O, but got Unknown //IL_00e9: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Expected O, but got Unknown //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown //IL_0179: Expected O, but got Unknown //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Expected O, but got Unknown //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown //IL_01b8: Expected O, but got Unknown //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Expected O, but got Unknown //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: 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_01f4: Expected O, but got Unknown //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Expected O, but got Unknown //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: 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))); } ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.pickupTooltip)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.achievementTooltip)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.pingTooltip)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.notificationOnClick)); ConfigEntry<float> notificationDuration = instance.notificationDuration; SliderConfig val2 = new SliderConfig { min = 0.25f, max = 20f, FormatString = "{0:0.##}s" }; object obj = <>c.<>9__2_0; if (obj == null) { IsDisabledDelegate val3 = () => LookingGlass.IsLoaded(); <>c.<>9__2_0 = val3; obj = (object)val3; } ((BaseOptionConfig)val2).checkIfDisabled = (IsDisabledDelegate)obj; ModSettingsManager.AddOption((BaseOption)new SliderOption(notificationDuration, val2)); ConfigEntry<bool> quantityBasedOnInventory = instance.quantityBasedOnInventory; CheckBoxConfig val4 = new CheckBoxConfig(); object obj2 = <>c.<>9__2_1; if (obj2 == null) { IsDisabledDelegate val5 = () => !LookingGlass.IsLoaded(); <>c.<>9__2_1 = val5; obj2 = (object)val5; } ((BaseOptionConfig)val4).checkIfDisabled = (IsDisabledDelegate)obj2; ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(quantityBasedOnInventory, val4)); ConfigEntry<bool> quantityBasedOnPickup = instance.quantityBasedOnPickup; CheckBoxConfig val6 = new CheckBoxConfig(); object obj3 = <>c.<>9__2_2; if (obj3 == null) { IsDisabledDelegate val7 = () => !LookingGlass.IsLoaded(); <>c.<>9__2_2 = val7; obj3 = (object)val7; } ((BaseOptionConfig)val6).checkIfDisabled = (IsDisabledDelegate)obj3; ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(quantityBasedOnPickup, val6)); 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, "itemStats").GetValue(null)).Value; } public static string GetItemDescription(ItemDef itemDef, ItemIndex newItemIndex, int newItemCount, CharacterMaster master, bool withOneMore, bool forceNew = false) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return (string)getItemDescription.Invoke(null, new object[6] { itemDef, newItemIndex, 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 } private const string modGUID = "bulletbot.chattooltips"; private const string modName = "ChatTooltips"; private const string modVer = "1.1.3"; 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> 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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: 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."); 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_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Expected O, but got Unknown //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0401: 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_0393: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_0448: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_048b: 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) if (!((Object)(object)chatBox == (Object)null)) { if ((Object)(object)eventSystem == (Object)null) { ref MPEventSystem reference = ref eventSystem; EventSystem current = EventSystem.current; reference = (MPEventSystem)(object)((current is MPEventSystem) ? current : 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.bottomLeft); Vector3 val4 = componentInChildren.transform.TransformPoint(val2.topRight); 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 text2 = 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) { CharacterMaster cachedMaster = LocalUserManager.GetFirstLocalUser().cachedMaster; if ((Object)(object)cachedMaster != (Object)null) { CharacterMasterNotificationQueue notificationQueueForMaster = CharacterMasterNotificationQueue.GetNotificationQueueForMaster(cachedMaster); if ((Object)(object)notificationQueueForMaster != (Object)null) { object pickupDef = GetPickupDef(ref content, new string[2] { (-1).ToString(), text2 }, shouldSet: false); if (pickupDef != null) { AccessTools.Method(typeof(CharacterMasterNotificationQueue), "PushNotification", (Type[])null, (Type[])null).Invoke(notificationQueueForMaster, new object[2] { (object)new NotificationInfo(pickupDef, (TransformationInfo)null), 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 == text2 && currentQuantity == result; if (!flag) { RemoveTooltip(eventSystem); flag = GetPickupDef(ref content, array) != null; if (flag) { currentQuantity = result; SetTooltip(eventSystem, content, Vector2.op_Implicit(mousePosition)); } } } else if (messageType == MessageType.Achievement && achievementTooltip.Value) { flag = tooltipProvider.titleToken == text2; if (!flag) { RemoveTooltip(eventSystem); GenericStaticEnumerable<AchievementDef, Enumerator> allAchievementDefs = AchievementManager.allAchievementDefs; Enumerator enumerator = allAchievementDefs.GetEnumerator(); try { while (((Enumerator)(ref enumerator)).MoveNext()) { AchievementDef current2 = ((Enumerator)(ref enumerator)).Current; if (current2.nameToken == text2) { content.titleToken = text2; content.titleColor = new Color(0.741f, 0.882f, 0.318f); content.bodyToken = current2.descriptionToken; flag = true; } } } finally { ((IDisposable)(Enumerator)(ref enumerator)).Dispose(); } if (flag) { SetTooltip(eventSystem, content, Vector2.op_Implicit(mousePosition)); } } } else if (messageType == MessageType.Ping && pingTooltip.Value) { flag = tooltipProvider.titleToken == text2; if (!flag) { RemoveTooltip(eventSystem); flag = GetPickupDef(ref content, array) != null; if (flag) { SetTooltip(eventSystem, content, Vector2.op_Implicit(mousePosition)); } } } if (flag) { return; } } RemoveTooltip(eventSystem); } } } }; harmony.PatchAll(); } 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 GetPickupDef(ref TooltipContent content, string[] data, bool shouldSet = true) { //IL_004c: 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_0055: 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) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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) CharacterMaster cachedMaster = LocalUserManager.GetFirstLocalUser().cachedMaster; MessageType messageType = (MessageType)int.Parse(data[0]); string text = data[1]; int result = 1; if (messageType == MessageType.Pickup && quantityBasedOnPickup.Value && LookingGlass.IsLoaded() && LookingGlass.IsItemStatsEnabled()) { int.TryParse(data[2], out result); } 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()) { if (quantityBasedOnInventory.Value) { if ((Object)(object)cachedMaster != (Object)null) { result = cachedMaster.inventory.GetItemCount(current); } else if (messageType == MessageType.Pickup && quantityBasedOnPickup.Value) { int.TryParse(data[2], out result); } } overrideBodyText = LookingGlass.GetItemDescription(itemDef, current, 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(); } return null; } public bool LinkMessage(ref string result, MessageType messageType, string text, string[] data) { int num = result.IndexOf(text); bool flag = num != -1; if (flag) { string text2 = ""; for (int i = 0; i < data.Length; i++) { text2 = text2 + (string.IsNullOrEmpty(text2) ? "|" : "") + 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] = text2; obj[4] = "\">"; obj[5] = text; obj[6] = "</link>"; obj[7] = result.Substring(num + text.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_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_00d0: 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_01f2: 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) 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.CurrentPickupIndex()); } else if ((Object)(object)component2 != (Object)null) { list.Add(component2.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.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, Language.GetString(nameToken), 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(typeof(SubjectFormatChatMessage))] internal class SubjectFormatChatMessage { [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, Language.GetString(__instance.paramTokens[0]), new string[1] { __instance.paramTokens[0] }); } } } [HarmonyPatch(typeof(PlayerPickupChatMessage))] internal class PlayerPickupChatMessagePatch { [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, Language.GetString(pickupToken), new string[2] { pickupToken, __instance.pickupQuantity.ToString() }); } } }