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 BetterItemPing v1.0.1
BepInEx/plugins/BetterItemPing/BetterItemPing.dll
Decompiled 2 months agousing System; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using Microsoft.CodeAnalysis; using On.RoR2.UI; using RoR2; using RoR2.UI; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BetterItemPing")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1+01c35464cf4f32a9c711bc36e4e4ddcb2a1d842e")] [assembly: AssemblyProduct("BetterItemPing")] [assembly: AssemblyTitle("BetterItemPing")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BetterItemPing { [BepInPlugin("com.cirillom.betteritemping", "Better Item Ping", "1.0.1")] public sealed class Plugin : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static hook_RebuildPing <0>__PingIndicatorRebuildPing; } public const string PluginGuid = "com.cirillom.betteritemping"; public const string PluginName = "Better Item Ping"; public const string PluginVersion = "1.0.1"; private void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__PingIndicatorRebuildPing; if (obj == null) { hook_RebuildPing val = PingIndicatorRebuildPing; <>O.<0>__PingIndicatorRebuildPing = val; obj = (object)val; } PingIndicator.RebuildPing += (hook_RebuildPing)obj; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Better Item Ping loaded!"); } private static void PingIndicatorRebuildPing(orig_RebuildPing orig, PingIndicator self) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Invalid comparison between Unknown and I4 //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Invalid comparison between Unknown and I4 orig.Invoke(self); if (!Object.op_Implicit((Object)(object)self.pingTarget) || !TryGetPickupIndex(self.pingTarget, out var pickupIndex)) { return; } PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); if (pickupDef != null && ((int)pickupDef.itemIndex != -1 || (int)pickupDef.equipmentIndex != -1)) { string[] array = (from entry in NetworkUser.readOnlyInstancesList.Select(delegate(NetworkUser user) { CharacterMaster master = user.master; return new { User = user, Count = GetCount((master != null) ? master.inventory : null, pickupDef) }; }) where entry.Count > 0 select $"{Util.EscapeRichTextForTextMeshPro(entry.User.userName)} ×{entry.Count}").ToArray(); if (array.Length != 0) { Chat.AddMessage("<style=cSub>Owned by: " + string.Join(", ", array) + "</style>"); } } } private static bool TryGetPickupIndex(GameObject target, out PickupIndex pickupIndex) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) GenericPickupController val = target.GetComponentInParent<GenericPickupController>() ?? target.GetComponentInChildren<GenericPickupController>(); if (Object.op_Implicit((Object)(object)val)) { pickupIndex = val.pickup.pickupIndex; return ((PickupIndex)(ref pickupIndex)).isValid; } PickupDisplay componentInChildren = target.GetComponentInChildren<PickupDisplay>(); pickupIndex = (Object.op_Implicit((Object)(object)componentInChildren) ? componentInChildren.GetPickupIndex() : PickupIndex.none); return ((PickupIndex)(ref pickupIndex)).isValid; } private static int GetCount(Inventory? inventory, PickupDef pickupDef) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)inventory == (Object)null) { return 0; } if ((int)pickupDef.itemIndex != -1) { return inventory.GetItemCountEffective(pickupDef.itemIndex); } if ((int)pickupDef.equipmentIndex == -1 || !inventory.HasEquipment(pickupDef.equipmentIndex)) { return 0; } return 1; } } }