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 ItemStats v1.3.4
ItemStats.dll
Decompiled 6 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using On.RoR2; using On.RoR2.UI; using RoR2; using RoR2.UI; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ItemStats")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+3ec632bf768c2f8a5f4b0dc9855a6f6bc8a9f8a5")] [assembly: AssemblyProduct("ItemStats")] [assembly: AssemblyTitle("ItemStats")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace ItemStats { [BepInPlugin("com.Moffein.ItemStats", "ItemStats", "1.3.4")] public class ItemStats : BaseUnityPlugin { public static List<ItemDef> IgnoredItems = new List<ItemDef>(); public static List<EquipmentDef> IgnoredEquipment = new List<EquipmentDef>(); public static bool pingDetails = true; public static bool pingDetailsVerbose = false; public static float pingDetailsDuration = 3f; public static bool pingNotif = true; public static bool pingChat = false; public static bool detailedHover = true; public static bool detailedPickup = true; public void Awake() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown ReadConfig(); if (detailedHover) { ItemIcon.SetItemIndex_ItemIndex_int_float += new hook_SetItemIndex_ItemIndex_int_float(ItemIcon_SetItemIndex); EquipmentIcon.Update += new hook_Update(EquipmentIcon_Update); } if (detailedPickup) { GenericNotification.SetItem += new hook_SetItem(GenericNotification_SetItem); GenericNotification.SetEquipment += new hook_SetEquipment(GenericNotification_SetEquipment); } if (pingDetails) { PingerController.SetCurrentPing += new hook_SetCurrentPing(PingerController_SetCurrentPing); } } public void ReadConfig() { detailedHover = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Detailed Hover", true, "Show full item description when hovering over the item icon.").Value; detailedPickup = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Detailed Pickup", true, "Show full item description when picking up the item.").Value; pingDetailsDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Ping Details - Notification Duration", 4f, "How long the item notification lasts for.").Value; pingDetails = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Ping Details", true, "Pinging an item shows its description.").Value; pingNotif = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Ping Details - Show as Notification", true, "Item description shows as a notification on the HUD.").Value; pingChat = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Ping Details - Show as Chat Message", false, "Item description shows as a chat message.").Value; pingDetailsVerbose = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Ping Details - Show as Chat Message - Show Full Description", false, "Chat messages show the full item description.").Value; if (!pingChat && !pingNotif) { pingDetails = false; } } private void PingerController_SetCurrentPing(orig_SetCurrentPing orig, PingerController self, PingInfo newPingInfo) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Expected O, but got Unknown orig.Invoke(self, newPingInfo); if (!((NetworkBehaviour)self).hasAuthority || !Object.op_Implicit((Object)(object)((PingInfo)(ref newPingInfo)).targetGameObject)) { return; } PickupDef val = null; GenericPickupController component = ((PingInfo)(ref newPingInfo)).targetGameObject.GetComponent<GenericPickupController>(); if (Object.op_Implicit((Object)(object)component)) { val = PickupCatalog.GetPickupDef(component.pickupIndex); } else { ShopTerminalBehavior component2 = ((PingInfo)(ref newPingInfo)).targetGameObject.GetComponent<ShopTerminalBehavior>(); if (Object.op_Implicit((Object)(object)component2) && !component2.pickupIndexIsHidden && !component2.Networkhidden && Object.op_Implicit((Object)(object)component2.pickupDisplay)) { UniquePickup val2 = component2.CurrentPickup(); if (val2.pickupIndex != PickupIndex.none) { val = PickupCatalog.GetPickupDef(val2.pickupIndex); } } } if (val == null) { return; } ItemDef itemDef = ItemCatalog.GetItemDef(val.itemIndex); if (Object.op_Implicit((Object)(object)itemDef)) { if (pingChat) { Chat.AddMessage((ChatMessageBase)new SimpleChatMessage { baseToken = ((pingDetailsVerbose && !IgnoredItems.Contains(itemDef)) ? itemDef.descriptionToken : itemDef.pickupToken) }); } if (pingNotif) { CharacterMaster component3 = ((Component)self).gameObject.GetComponent<CharacterMaster>(); if (Object.op_Implicit((Object)(object)component3)) { PushItemNotificationDuration(component3, itemDef.itemIndex, pingDetailsDuration); } } return; } EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(val.equipmentIndex); if (!Object.op_Implicit((Object)(object)equipmentDef)) { return; } if (pingChat) { Chat.AddMessage((ChatMessageBase)new SimpleChatMessage { baseToken = ((pingDetailsVerbose && !IgnoredEquipment.Contains(equipmentDef)) ? equipmentDef.descriptionToken : equipmentDef.pickupToken) }); } if (pingNotif) { CharacterMaster component4 = ((Component)self).gameObject.GetComponent<CharacterMaster>(); if (Object.op_Implicit((Object)(object)component4)) { PushEquipmentNotificationDuration(component4, equipmentDef.equipmentIndex, pingDetailsDuration); } } } public static void GenericNotification_SetItem(orig_SetItem orig, GenericNotification self, ItemDef itemDef) { orig.Invoke(self, itemDef); if (!IgnoredItems.Contains(itemDef)) { if (!Language.IsTokenInvalid(itemDef.descriptionToken)) { self.descriptionText.token = itemDef.descriptionToken; } else { self.descriptionText.token = itemDef.pickupToken; } } } private void GenericNotification_SetEquipment(orig_SetEquipment orig, GenericNotification self, EquipmentDef equipmentDef) { orig.Invoke(self, equipmentDef); if (!IgnoredEquipment.Contains(equipmentDef)) { if (!Language.IsTokenInvalid(equipmentDef.descriptionToken)) { self.descriptionText.token = equipmentDef.descriptionToken; } else { self.descriptionText.token = equipmentDef.pickupToken; } } } public static void ItemIcon_SetItemIndex(orig_SetItemIndex_ItemIndex_int_float orig, ItemIcon self, ItemIndex newItemIndex, int newItemCount, float duration) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, newItemIndex, newItemCount, duration); ItemDef itemDef = ItemCatalog.GetItemDef(newItemIndex); if (Object.op_Implicit((Object)(object)itemDef) && Object.op_Implicit((Object)(object)self.tooltipProvider) && !IgnoredItems.Contains(itemDef)) { if (!Language.IsTokenInvalid(itemDef.descriptionToken)) { self.tooltipProvider.overrideBodyText = Language.GetString(itemDef.descriptionToken); } else { self.tooltipProvider.overrideBodyText = Language.GetString(itemDef.pickupToken); } } } private void EquipmentIcon_Update(orig_Update orig, EquipmentIcon self) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (!self.hasEquipment || !Object.op_Implicit((Object)(object)self.tooltipProvider) || !Object.op_Implicit((Object)(object)self.targetEquipmentSlot)) { return; } EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(self.targetEquipmentSlot.equipmentIndex); if (Object.op_Implicit((Object)(object)equipmentDef) && !IgnoredEquipment.Contains(equipmentDef)) { if (!Language.IsTokenInvalid(equipmentDef.descriptionToken)) { self.tooltipProvider.overrideBodyText = Language.GetString(equipmentDef.descriptionToken); } else { self.tooltipProvider.overrideBodyText = Language.GetString(equipmentDef.pickupToken); } } } public static void PushItemNotificationDuration(CharacterMaster characterMaster, ItemIndex itemIndex, float duration) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_004a: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown if (!((NetworkBehaviour)characterMaster).hasAuthority) { Debug.LogError((object)("Can't PushItemNotification for " + Util.GetBestMasterName(characterMaster) + " because they aren't local.")); return; } CharacterMasterNotificationQueue notificationQueueForMaster = CharacterMasterNotificationQueue.GetNotificationQueueForMaster(characterMaster); if (Object.op_Implicit((Object)(object)notificationQueueForMaster) && (int)itemIndex != -1) { ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); if (!((Object)(object)itemDef == (Object)null) && !itemDef.hidden) { notificationQueueForMaster.PushNotification(new NotificationInfo((object)ItemCatalog.GetItemDef(itemIndex), (TransformationInfo)null, false, 0), duration); } } } public static void PushEquipmentNotificationDuration(CharacterMaster characterMaster, EquipmentIndex equipmentIndex, float duration) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown if (!((NetworkBehaviour)characterMaster).hasAuthority) { Debug.LogError((object)("Can't PushEquipmentNotification for " + Util.GetBestMasterName(characterMaster) + " because they aren't local.")); return; } CharacterMasterNotificationQueue notificationQueueForMaster = CharacterMasterNotificationQueue.GetNotificationQueueForMaster(characterMaster); if (Object.op_Implicit((Object)(object)notificationQueueForMaster) && (int)equipmentIndex != -1) { notificationQueueForMaster.PushNotification(new NotificationInfo((object)EquipmentCatalog.GetEquipmentDef(equipmentIndex), (TransformationInfo)null, false, 0), duration); } } } } namespace R2API.Utils { [AttributeUsage(AttributeTargets.Assembly)] public class ManualNetworkRegistrationAttribute : Attribute { } }