Please disclose if your mod was created primarily 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 Exiliados de Midgard v1.0.96
plugins/Valheim.DisplayBepInExInfo.dll
Decompiled 3 months agousing System; 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.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace Valheim.DisplayBepInExInfo; [BepInPlugin("org.bepinex.valheim.displayinfo", "Display BepInEx Info In-Game", "2.0.2")] public class DisplayInfoPlugin : BaseUnityPlugin { internal static ConfigEntry<LogLevel> LogLevels; internal static ConfigEntry<bool> DisplayLogsInConsole; internal static string BepInExVersion => typeof(BaseUnityPlugin).Assembly.GetName().Version.ToString(); private void Awake() { LogLevels = ((BaseUnityPlugin)this).Config.Bind<LogLevel>("Console", "LogLevels", (LogLevel)30, "Log levels to log to Valheim console."); DisplayLogsInConsole = ((BaseUnityPlugin)this).Config.Bind<bool>("Console", "DisplayBepInExLogs", true, "If true, will display BepInEx logs in Valheim console."); if (DisplayLogsInConsole.Value) { Logger.Listeners.Add((ILogListener)(object)new ValheimConsoleListener()); } Harmony.CreateAndPatchAll(typeof(DisplayInfoPlugin), (string)null); Traverse.Create<Game>().Field<bool>("isModded").Value = true; } [HarmonyPatch(typeof(FejdStartup), "Start")] [HarmonyPostfix] private static void OnFejdStartup(FejdStartup __instance) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null) { Debug.LogWarning((object)"Instance is null"); return; } GameObject gameObject = ((Component)__instance.m_versionLabel.transform.parent).gameObject; GameObject val = new GameObject("BepInEx Version"); val.transform.parent = gameObject.transform; val.AddComponent<CanvasRenderer>(); val.transform.localPosition = Vector3.zero; RectTransform obj = val.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(0.03f, 0.95f); obj.anchorMax = new Vector2(0.3f, 0.95f); Text val2 = val.AddComponent<Text>(); val2.font = Font.CreateDynamicFontFromOSFont("Arial", 20); val2.text = $"Running BepInEx {BepInExVersion}\n{Chainloader.PluginInfos.Count} plugins loaded"; if ((Object)(object)Console.instance != (Object)null && Console.instance.IsConsoleEnabled()) { val2.text += "\nPress F5 to open console"; } ((Graphic)val2).color = Color.white; val2.fontSize = 20; } [HarmonyPatch(typeof(ZNet), "SetServer")] [HarmonyPostfix] private static void OnServerStart(string serverName) { Type type = typeof(BaseUnityPlugin).Assembly.GetType("BepInEx.ConsoleManager", throwOnError: false); if (!(type == null)) { AccessTools.MethodDelegate<Action<string>>(AccessTools.Method(type, "SetConsoleTitle", (Type[])null, (Type[])null), (object)null, true)("BepInEx " + BepInExVersion + " - Valheim Server - " + serverName); } } [HarmonyPatch(typeof(Terminal), "Awake")] [HarmonyPostfix] private static void FixConsoleMesh() { if (Object.op_Implicit((Object)(object)Console.instance) && Object.op_Implicit((Object)(object)((Component)((Terminal)Console.instance).m_chatWindow).gameObject)) { Outline[] componentsInChildren = ((Component)((Terminal)Console.instance).m_chatWindow).gameObject.GetComponentsInChildren<Outline>(); for (int i = 0; i < componentsInChildren.Length; i++) { ((Behaviour)componentsInChildren[i]).enabled = false; } } } [HarmonyPatch(typeof(Terminal), "UpdateChat")] [HarmonyPostfix] private static void FixConsoleMesh2() { if (((TMP_Text)((Terminal)Console.instance).m_output).text.Length > 6000) { ((Terminal)Console.instance).m_chatBuffer.Clear(); } } } internal class ValheimConsoleListener : ILogListener, IDisposable { public void Dispose() { } public void LogEvent(object sender, LogEventArgs eventArgs) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) if ((eventArgs.Level & DisplayInfoPlugin.LogLevels.Value) != 0 && Object.op_Implicit((Object)(object)Console.instance)) { Console.instance.Print(((object)eventArgs).ToString()); } } }