using 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.Logging; using Microsoft.CodeAnalysis; using On.RoR2; using RoR2; using UnityEngine; using UnityEngine.Networking; [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("LobbyPlayersEclipseLevels")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+114b2d1d8076bf8918f4de69060fbbf1c8a90c80")] [assembly: AssemblyProduct("LobbyPlayersEclipseLevels")] [assembly: AssemblyTitle("LobbyPlayersEclipseLevels")] [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 LobbyPlayersEclipseLevels { [BepInPlugin("diselgonk.LobbyPlayersEclipseLevels", "LobbyPlayersEclipseLevels", "1.0.0")] public class LobbyPlayersEclipseLevels : BaseUnityPlugin { public const string PluginGUID = "diselgonk.LobbyPlayersEclipseLevels"; public const string PluginAuthor = "diselgonk"; public const string PluginName = "LobbyPlayersEclipseLevels"; public const string PluginVersion = "1.0.0"; private List processedUserIds = new List(); public void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); PreGameController.RecalculateModifierAvailability += new hook_RecalculateModifierAvailability(PreGameController_RecalculateModifierAvailability); PreGameController.OnDestroy += new hook_OnDestroy(PreGameController_OnDestroy); PreGameController.OnNetworkUserLost += new hook_OnNetworkUserLost(PreGameController_OnNetworkUserLost); } private void PreGameController_OnNetworkUserLost(orig_OnNetworkUserLost orig, PreGameController self, NetworkUser networkUser) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, networkUser); if (NetworkServer.active) { Log.Debug($"Removed user id {networkUser.id} from processed", "I:\\_important\\_hobby\\c#\\ror2mods\\LobbyEclipseInfo\\LobbyPlayersEclipseLevels\\LobbyPlayersEclipseLevels.cs", 37); processedUserIds.Remove(networkUser.id); } } private void PreGameController_OnDestroy(orig_OnDestroy orig, PreGameController self) { orig.Invoke(self); if (NetworkServer.active) { Log.Debug("Cleared processed user ids", "I:\\_important\\_hobby\\c#\\ror2mods\\LobbyEclipseInfo\\LobbyPlayersEclipseLevels\\LobbyPlayersEclipseLevels.cs", 48); processedUserIds.Clear(); } } private void PreGameController_RecalculateModifierAvailability(orig_RecalculateModifierAvailability orig, PreGameController self) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (!NetworkServer.active) { return; } foreach (NetworkUser readOnlyInstances in NetworkUser.readOnlyInstancesList) { if (!processedUserIds.Contains(readOnlyInstances.id) && !((NetworkBehaviour)readOnlyInstances).isLocalPlayer && PrintUserEclipseLevels(readOnlyInstances)) { Log.Debug($"Added user id {readOnlyInstances.id} to processed", "I:\\_important\\_hobby\\c#\\ror2mods\\LobbyEclipseInfo\\LobbyPlayersEclipseLevels\\LobbyPlayersEclipseLevels.cs", 70); processedUserIds.Add(readOnlyInstances.id); } } } private static bool PrintUserEclipseLevels(NetworkUser user) { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Expected O, but got Unknown string userName = user.userName; if (string.IsNullOrEmpty(userName)) { Log.Warning("Couldn't print eclipse levels. " + userName + " - username is empty. How so?", "I:\\_important\\_hobby\\c#\\ror2mods\\LobbyEclipseInfo\\LobbyPlayersEclipseLevels\\LobbyPlayersEclipseLevels.cs", 81); return false; } Dictionary dictionary = new Dictionary(); foreach (SurvivorDef allSurvivorDef in SurvivorCatalog.allSurvivorDefs) { int networkUserSurvivorCompletedEclipseLevel = EclipseRun.GetNetworkUserSurvivorCompletedEclipseLevel(user, allSurvivorDef); dictionary.Add(allSurvivorDef, networkUserSurvivorCompletedEclipseLevel); } string text = userName + ": "; foreach (var (val2, num2) in dictionary) { if (num2 != 0) { string @string = Language.GetString(val2.displayNameToken); string text2 = ColorUtility.ToHtmlStringRGBA(val2.primaryColor); if (!string.IsNullOrEmpty(text2)) { text = text + ""; } text += $"{@string} - {num2} "; if (!string.IsNullOrEmpty(text2)) { text += ""; } } } if (dictionary.All((KeyValuePair kvp) => kvp.Value == 0)) { return false; } Log.Info(text ?? "", "I:\\_important\\_hobby\\c#\\ror2mods\\LobbyEclipseInfo\\LobbyPlayersEclipseLevels\\LobbyPlayersEclipseLevels.cs", 114); Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = (text ?? "") }); return true; } } 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)); } } }