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 PingItemDescription v1.0.5
PingItemDescription.dll
Decompiled 3 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using On.RoR2; 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("PingItemDescription")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PingItemDescription")] [assembly: AssemblyTitle("PingItemDescription")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 PingItemDescription { internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } private static string Format(object data, string file, int line) { string fileName = Path.GetFileName(file); return $"[{fileName}:{line}] {data}"; } internal static void Debug(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogDebug((object)Format(data, file, line)); } internal static void Error(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogError((object)Format(data, file, line)); } internal static void Fatal(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogFatal((object)Format(data, file, line)); } internal static void Info(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogInfo((object)Format(data, file, line)); } internal static void Message(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogMessage((object)Format(data, file, line)); } internal static void Warning(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogWarning((object)Format(data, file, line)); } } internal class ChatCommand { public string Name { get; set; } public Func<string[], string> Handler { get; set; } internal ChatCommand(string name, Func<string[], string> handler) { Name = name; Handler = handler; } } public class PIDCommand { private static PingItemDescriptionConfig _config; private static string commandPrefix = "PID"; private static readonly Dictionary<string, ChatCommand> _chatCommands = new List<ChatCommand> { new ChatCommand("TOGGLE", ShowDescription), new ChatCommand("OTHERS", ShowDescriptionOther), new ChatCommand("TIME", SetDescriptionTime), new ChatCommand("HIDDEN", ShowHidden) }.ToDictionary((ChatCommand rec) => rec.Name); public PIDCommand(PingItemDescription plugin) { _config = plugin.GetConfig(); } private static string ShowDescription(string[] args) { _config.EnableMod.Value = !_config.EnableMod.Value; if (!_config.EnableMod.Value) { return "PingItemDescription disabled."; } return "PingItemDescription enabled."; } private static string ShowHidden(string[] args) { _config.SeeQuestionMarkDescription.Value = !_config.SeeQuestionMarkDescription.Value; if (!_config.SeeQuestionMarkDescription.Value) { return "Ping description of question marks are now hidden."; } return "Ping description of question marks are now shown."; } private static string ShowDescriptionOther(string[] args) { _config.ShowPingDescriptionFromOtherPlayers.Value = !_config.ShowPingDescriptionFromOtherPlayers.Value; if (!_config.ShowPingDescriptionFromOtherPlayers.Value) { return "Ping description of other players are now hidden."; } return "Ping description of other players will be shown."; } private static string SetDescriptionTime(string[] args) { if (args.Length < 1 || args.Length > 2) { return "Requires 1 number argument"; } if (int.TryParse(args[1], out var result)) { if (result >= 1 && result <= 60) { _config.DefaultDescriptionTime.Value = result; string text = ((result == 1) ? " second" : " seconds"); return "Ping descriptions will be shown for " + result + text; } return "Value must be between 1 and 60 seconds"; } return "Requires 1 number argument. Input: " + args; } public void Console_RunCmd(orig_RunCmd orig, Console self, CmdSender sender, string concommandName, List<string> userArgs) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, sender, concommandName, userArgs); if ((Object)(object)Run.instance == (Object)null || !concommandName.Equals("say", StringComparison.InvariantCultureIgnoreCase)) { return; } string text = userArgs.FirstOrDefault(); if (string.IsNullOrWhiteSpace(text) || !text.StartsWith("/")) { return; } string[] source = text.Split(new char[1] { ' ' }); string text2 = source.FirstOrDefault().Substring(1); string[] array = source.Skip(1).ToArray(); if (array.Length == 0) { Chat.AddMessage("PingItemDescription: Subcommand is missing. Subcommands: toggle,others,time "); } else if (text2.ToUpper().Equals(commandPrefix)) { if (!_chatCommands.TryGetValue(array[0].ToUpperInvariant(), out var value)) { Chat.AddMessage("PingItemDescription: Command not found: " + array[0]); } string text3 = value.Handler(array); if (!string.IsNullOrWhiteSpace(text3)) { Chat.AddMessage(text3); } } } } public class PingIndicator { private static PingItemDescriptionConfig _config; public PingIndicator(PingItemDescription plugin) { _config = plugin.GetConfig(); } public void rebuild(orig_RebuildPing orig, PingIndicator self) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Invalid comparison between Unknown and I4 //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (!_config.EnableMod.Value) { return; } LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); CharacterMasterNotificationQueue notificationQueueForMaster = CharacterMasterNotificationQueue.GetNotificationQueueForMaster(firstLocalUser.cachedMaster); if ((self.pingOwner.GetComponent<PlayerCharacterMasterController>().GetDisplayName().Equals(firstLocalUser.cachedMasterController.GetDisplayName()) || _config.ShowPingDescriptionFromOtherPlayers.Value) && (int)self.pingType == 2) { ShopTerminalBehavior component = self.pingTarget.GetComponent<ShopTerminalBehavior>(); GenericPickupController component2 = self.pingTarget.GetComponent<GenericPickupController>(); PickupDropletController component3 = self.pingTarget.GetComponent<PickupDropletController>(); if (Object.op_Implicit((Object)(object)component2)) { PickupDef pickupDef = PickupCatalog.GetPickupDef(component2.pickupIndex); checkItems(notificationQueueForMaster, pickupDef.itemIndex, pickupDef.equipmentIndex, pickupDef.artifactIndex); } if (Object.op_Implicit((Object)(object)component) && (!component.hidden || (component.hidden && _config.SeeQuestionMarkDescription.Value))) { PickupDef pickupDef2 = PickupCatalog.GetPickupDef(component.CurrentPickupIndex()); checkItems(notificationQueueForMaster, pickupDef2.itemIndex, pickupDef2.equipmentIndex, pickupDef2.artifactIndex); } if (Object.op_Implicit((Object)(object)component3)) { PickupDef pickupDef3 = PickupCatalog.GetPickupDef(component3.pickupIndex); checkItems(notificationQueueForMaster, pickupDef3.itemIndex, pickupDef3.equipmentIndex, pickupDef3.artifactIndex); } } } private void checkItems(CharacterMasterNotificationQueue notificationQueueForMaster, ItemIndex itemIndex, EquipmentIndex equipmentIndex, ArtifactIndex artifactIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(equipmentIndex); ArtifactDef artifactDef = ArtifactCatalog.GetArtifactDef(artifactIndex); notificationQueueForMaster.notifications.Clear(); if ((Object)(object)itemDef != (Object)null) { Language.GetString(itemDef.descriptionToken); notificationQueueForMaster.PushNotification(new NotificationInfo((object)itemDef, (TransformationInfo)null, false, 0), (float)_config.DefaultDescriptionTime.Value); } else if ((Object)(object)equipmentDef != (Object)null) { notificationQueueForMaster.PushNotification(new NotificationInfo((object)equipmentDef, (TransformationInfo)null, false, 0), (float)_config.DefaultDescriptionTime.Value); } else if ((Object)(object)artifactDef != (Object)null) { notificationQueueForMaster.PushNotification(new NotificationInfo((object)artifactDef, (TransformationInfo)null, false, 0), (float)_config.DefaultDescriptionTime.Value); } } } [BepInPlugin("Red.PingItemDescription", "PingItemDescription", "1.0.5")] public class PingItemDescription : BaseUnityPlugin { public const string PluginGUID = "Red.PingItemDescription"; public const string PluginAuthor = "Red"; public const string PluginName = "PingItemDescription"; public const string PluginVersion = "1.0.5"; private static PingItemDescriptionConfig _config; private static ItemDef myItemDef; public PingItemDescriptionConfig GetConfig() { return _config; } public PingItemDescription() { _config = new PingItemDescriptionConfig(((BaseUnityPlugin)this).Config); } public void Awake() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); PingIndicator pingIndicator = new PingIndicator(this); PIDCommand pIDCommand = new PIDCommand(this); PingIndicator.RebuildPing += new hook_RebuildPing(pingIndicator.rebuild); Console.RunCmd += new hook_RunCmd(pIDCommand.Console_RunCmd); Log.Info("PingItemDescription 1.0.5 loaded.", "C:\\Users\\fabia\\Desktop\\ExamplePlugin-main\\PingItemDescription\\PingItemDescription.cs", 49); } } public class PingItemDescriptionConfig { public ConfigEntry<bool> EnableMod { get; set; } public ConfigEntry<bool> SeeQuestionMarkDescription { get; set; } public ConfigEntry<bool> ShowPingDescriptionFromOtherPlayers { get; set; } public ConfigEntry<int> DefaultDescriptionTime { get; set; } public PingItemDescriptionConfig(ConfigFile configfile) { EnableMod = configfile.Bind<bool>("General", "EnableMod", true, "Enable Mod"); ShowPingDescriptionFromOtherPlayers = configfile.Bind<bool>("General", "ShowPingDescriptionFromOtherPlayers", false, "Show ping description of other players"); DefaultDescriptionTime = configfile.Bind<int>("General", "DefaultDescriptionTime", 5, "Time in seconds how long item descriptions should be shown after a ping"); SeeQuestionMarkDescription = configfile.Bind<bool>("General", "SeeQuestionMarkDescription", false, "If true you can see the description of the question mark item in the multishop "); } } }