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 WelcomeMessage v1.0.0
WelcomeMessage.dll
Decompiled 10 hours agousing System; using System.Collections; using System.Diagnostics; 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 HG.Reflection; using Microsoft.CodeAnalysis; using On.RoR2; using RoR2; using RoR2.Networking; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("WelcomeMessage")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+58a3a787d0bf0ab1a9478b5cb67e58ed05d88b63")] [assembly: AssemblyProduct("WelcomeMessage")] [assembly: AssemblyTitle("WelcomeMessage")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 WelcomeMessage { internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static ManualLogSource GetSource() { return _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); } } [BepInPlugin("Def.WelcomeMessage", "WelcomeMessage", "1.0.0")] public class WelcomeMessagePlugin : BaseUnityPlugin { public const string PluginGUID = "Def.WelcomeMessage"; public const string PluginAuthor = "Def"; public const string PluginName = "WelcomeMessage"; public const string PluginVersion = "1.0.0"; public static ConfigEntry<bool> Enabled; public static ConfigEntry<string> Message; public static ConfigEntry<bool> OnlyInLobby; public static ConfigEntry<bool> OnlyToJoiningPlayer; private const float Delay = 3f; public void Awake() { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "Enabled", true, "Write the welcome message."); Message = ((BaseUnityPlugin)this).Config.Bind<string>("Main", "Message", "Welcome, {player}!", "The chat message. {player} is replaced with the name of the player who joined. Unity's rich text works, e.g. <color=#ffcc00>text</color>."); OnlyInLobby = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "Only In Lobby", true, "Only welcome players who join the lobby, not a run that has already started."); OnlyToJoiningPlayer = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "Only To Joining Player", false, "Only the player who joined sees the message. Otherwise everyone does."); Chat.SendPlayerConnectedMessage += new hook_SendPlayerConnectedMessage(Chat_SendPlayerConnectedMessage); } private void Chat_SendPlayerConnectedMessage(orig_SendPlayerConnectedMessage orig, NetworkUser user) { orig.Invoke(user); if (Enabled.Value && NetworkServer.active && !((Object)(object)user == (Object)null) && !string.IsNullOrWhiteSpace(Message.Value) && (!OnlyInLobby.Value || !((Object)(object)Run.instance != (Object)null))) { ((MonoBehaviour)this).StartCoroutine(Welcome(user)); } } private IEnumerator Welcome(NetworkUser user) { yield return (object)new WaitForSecondsRealtime(3f); if (!((Object)(object)user == (Object)null) && NetworkServer.active && ((NetworkBehaviour)user).connectionToClient != null && !Util.ConnectionIsLocal(((NetworkBehaviour)user).connectionToClient)) { string value = Message.Value; NetworkPlayerName networkPlayerName = user.GetNetworkPlayerName(); string baseToken = value.Replace("{player}", ((NetworkPlayerName)(ref networkPlayerName)).GetResolvedName()); SimpleChatMessage val = new SimpleChatMessage { baseToken = baseToken }; if (OnlyToJoiningPlayer.Value) { SendTo(((NetworkBehaviour)user).connectionToClient, (ChatMessageBase)(object)val); } else { Chat.SendBroadcastChat((ChatMessageBase)(object)val); } } } private static void SendTo(NetworkConnection connection, ChatMessageBase message) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown if (connection != null) { NetworkWriter val = new NetworkWriter(); val.StartMessage((short)59); val.Write(message.GetTypeIndex()); val.Write((MessageBase)(object)message); val.FinishMessage(); connection.SendWriter(val, QosChannelIndex.chat.intVal); } } } }