Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of PingItemDescription v1.0.4
PingItemDescription.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; 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 RoR2.UI.LogBook; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [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 class ItemStats { private static LogBookController logbook; private void foo() { } } internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void LogDebug(object data) { _logSource.LogDebug(data); } internal static void LogError(object data) { _logSource.LogError(data); } internal static void LogFatal(object data) { _logSource.LogFatal(data); } internal static void LogInfo(object data) { _logSource.LogInfo(data); } internal static void LogMessage(object data) { _logSource.LogMessage(data); } internal static void LogWarning(object data) { _logSource.LogWarning(data); } } 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 (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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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), (float)_config.DefaultDescriptionTime.Value); } else if ((Object)(object)equipmentDef != (Object)null) { notificationQueueForMaster.PushNotification(new NotificationInfo((object)equipmentDef, (TransformationInfo)null), (float)_config.DefaultDescriptionTime.Value); } else if ((Object)(object)artifactDef != (Object)null) { notificationQueueForMaster.PushNotification(new NotificationInfo((object)artifactDef, (TransformationInfo)null), (float)_config.DefaultDescriptionTime.Value); } } } [BepInPlugin("Red.PingItemDescription", "PingItemDescription", "1.0.4")] 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.4"; private static PingItemDescriptionConfig _config; 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.LogInfo("Awake done."); } } 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 "); } } }